exec_outcome stringclasses 1
value | code_uid stringlengths 32 32 | file_name stringclasses 111
values | prob_desc_created_at stringlengths 10 10 | prob_desc_description stringlengths 63 3.8k | prob_desc_memory_limit stringclasses 18
values | source_code stringlengths 117 65.5k | lang_cluster stringclasses 1
value | prob_desc_sample_inputs stringlengths 2 802 | prob_desc_time_limit stringclasses 27
values | prob_desc_sample_outputs stringlengths 2 796 | prob_desc_notes stringlengths 4 3k ⌀ | lang stringclasses 5
values | prob_desc_input_from stringclasses 3
values | tags listlengths 0 11 | src_uid stringlengths 32 32 | prob_desc_input_spec stringlengths 28 2.37k ⌀ | difficulty int64 -1 3.5k ⌀ | prob_desc_output_spec stringlengths 17 1.47k ⌀ | prob_desc_output_to stringclasses 3
values | hidden_unit_tests stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
PASSED | 75ff866beed3666b6d2cf4307a9e8ffc | train_000.jsonl | 1484235300 | It's the turn of the year, so Bash wants to send presents to his friends. There are n cities in the Himalayan region and they are connected by m bidirectional roads. Bash is living in city s. Bash has exactly one friend in each of the other cities. Since Bash wants to surprise his friends, he decides to send a Pikachu ... | 512 megabytes | import java.io.*;
import java.util.*;
public class F {
BufferedReader br;
PrintWriter out;
StringTokenizer st;
boolean eof;
int n;
int root;
List<Edge>[] g;
static class Edge {
int to, cost;
public Edge(int to, int cost) {
this.to = to;
this.cost = cost;
}
@Override
public String toStrin... | Java | ["4 4 3\n1 2 1\n2 3 1\n2 4 1\n3 1 1", "7 11 2\n1 2 5\n1 3 5\n2 4 2\n2 5 2\n3 6 3\n3 7 3\n4 6 2\n3 4 2\n6 7 3\n4 5 7\n4 7 7"] | 2.5 seconds | ["2", "4"] | NoteIn the first sample, on destroying the city 2, the length of shortest distance between pairs of cities (3, 2) and (3, 4) will change. Hence the answer is 2. | Java 8 | standard input | [
"data structures",
"graphs",
"shortest paths"
] | c47d0c9a429030c4b5d6f5605be36c75 | The first line contains three space separated integers n, m and s (2 ≤ n ≤ 2·105, , 1 ≤ s ≤ n) — the number of cities and the number of roads in the Himalayan region and the city Bash lives in. Each of the next m lines contain three space-separated integers u, v and w (1 ≤ u, v ≤ n, u ≠ v, 1 ≤ w ≤ 109) denoting that th... | 2,800 | Print a single integer, the answer to the problem. | standard output | |
PASSED | ad2b57f4e51dd77cd7fadc22ed006f64 | train_000.jsonl | 1337182200 | Berland has managed to repel the flatlanders' attack and is now starting the counter attack.Flatland has n cities, numbered from 1 to n, and some pairs of them are connected by bidirectional roads. The Flatlandian maps show roads between cities if and only if there is in fact no road between this pair of cities (we do ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
OutputWriter out = new OutputWriter(outputStream);
Ta... | Java | ["4 4\n1 2\n1 3\n4 2\n4 3", "3 1\n1 2"] | 3 seconds | ["2\n2 1 4 \n2 2 3", "1\n3 1 2 3"] | NoteIn the first sample there are roads only between pairs of cities 1-4 and 2-3.In the second sample there is no road between cities 1 and 2, but still you can get from one city to the other one through city number 3. | Java 8 | standard input | [
"hashing",
"graphs",
"dsu",
"sortings",
"data structures"
] | 72394a06a9d9dffb61c6c92c4bbd2f3a | The first line contains two space-separated integers n and m (1 ≤ n ≤ 5·105, 0 ≤ m ≤ 106) — the number of cities and the number of roads marked on the flatland map, correspondingly. Next m lines contain descriptions of the cities on the map. The i-th line contains two integers ai and bi (1 ≤ ai, bi ≤ n, ai ≠ bi) — the ... | 2,100 | On the first line print number k — the number of groups of cities in Flatland, such that in each group you can get from any city to any other one by flatland roads. At the same time, the cities from different groups should be unreachable by flatland roads. On each of the following k lines first print ti (1 ≤ ti ≤ n) — ... | standard output | |
PASSED | fbccaa26153b84bdbf26214e5bdb741d | train_000.jsonl | 1337182200 | Berland has managed to repel the flatlanders' attack and is now starting the counter attack.Flatland has n cities, numbered from 1 to n, and some pairs of them are connected by bidirectional roads. The Flatlandian maps show roads between cities if and only if there is in fact no road between this pair of cities (we do ... | 256 megabytes | import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
public class Task2 {
public static void main(String[] args) throws IOException {
new Task2().solve();
}
int mod = 1000000007;
PrintWriter out;
int n;
int m;
ArrayList<Integer>[] g;... | Java | ["4 4\n1 2\n1 3\n4 2\n4 3", "3 1\n1 2"] | 3 seconds | ["2\n2 1 4 \n2 2 3", "1\n3 1 2 3"] | NoteIn the first sample there are roads only between pairs of cities 1-4 and 2-3.In the second sample there is no road between cities 1 and 2, but still you can get from one city to the other one through city number 3. | Java 8 | standard input | [
"hashing",
"graphs",
"dsu",
"sortings",
"data structures"
] | 72394a06a9d9dffb61c6c92c4bbd2f3a | The first line contains two space-separated integers n and m (1 ≤ n ≤ 5·105, 0 ≤ m ≤ 106) — the number of cities and the number of roads marked on the flatland map, correspondingly. Next m lines contain descriptions of the cities on the map. The i-th line contains two integers ai and bi (1 ≤ ai, bi ≤ n, ai ≠ bi) — the ... | 2,100 | On the first line print number k — the number of groups of cities in Flatland, such that in each group you can get from any city to any other one by flatland roads. At the same time, the cities from different groups should be unreachable by flatland roads. On each of the following k lines first print ti (1 ≤ ti ≤ n) — ... | standard output | |
PASSED | 60ea9cb1d4682f1dc911efaf7945e3e3 | train_000.jsonl | 1337182200 | Berland has managed to repel the flatlanders' attack and is now starting the counter attack.Flatland has n cities, numbered from 1 to n, and some pairs of them are connected by bidirectional roads. The Flatlandian maps show roads between cities if and only if there is in fact no road between this pair of cities (we do ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static FastReader in;
static PrintWriter out;
static int g [][];
static int deg [];
static int edges [][];
static ArrayList<ArrayList<Integer>> answer = new ArrayList<ArrayList<Integer>>();
public static void solve () {
i... | Java | ["4 4\n1 2\n1 3\n4 2\n4 3", "3 1\n1 2"] | 3 seconds | ["2\n2 1 4 \n2 2 3", "1\n3 1 2 3"] | NoteIn the first sample there are roads only between pairs of cities 1-4 and 2-3.In the second sample there is no road between cities 1 and 2, but still you can get from one city to the other one through city number 3. | Java 8 | standard input | [
"hashing",
"graphs",
"dsu",
"sortings",
"data structures"
] | 72394a06a9d9dffb61c6c92c4bbd2f3a | The first line contains two space-separated integers n and m (1 ≤ n ≤ 5·105, 0 ≤ m ≤ 106) — the number of cities and the number of roads marked on the flatland map, correspondingly. Next m lines contain descriptions of the cities on the map. The i-th line contains two integers ai and bi (1 ≤ ai, bi ≤ n, ai ≠ bi) — the ... | 2,100 | On the first line print number k — the number of groups of cities in Flatland, such that in each group you can get from any city to any other one by flatland roads. At the same time, the cities from different groups should be unreachable by flatland roads. On each of the following k lines first print ti (1 ≤ ti ≤ n) — ... | standard output | |
PASSED | da09428ce9658c85471c0284d5fe64e0 | train_000.jsonl | 1337182200 | Berland has managed to repel the flatlanders' attack and is now starting the counter attack.Flatland has n cities, numbered from 1 to n, and some pairs of them are connected by bidirectional roads. The Flatlandian maps show roads between cities if and only if there is in fact no road between this pair of cities (we do ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static FastReader in;
static PrintWriter out;
static int n, m;
static int[][] edges;
static int[] deg;
static int[][] g;
static HashSet<Integer> s;
static LinkedList<Integer> q;
static ArrayList<ArrayList<Integer>> ans;
... | Java | ["4 4\n1 2\n1 3\n4 2\n4 3", "3 1\n1 2"] | 3 seconds | ["2\n2 1 4 \n2 2 3", "1\n3 1 2 3"] | NoteIn the first sample there are roads only between pairs of cities 1-4 and 2-3.In the second sample there is no road between cities 1 and 2, but still you can get from one city to the other one through city number 3. | Java 8 | standard input | [
"hashing",
"graphs",
"dsu",
"sortings",
"data structures"
] | 72394a06a9d9dffb61c6c92c4bbd2f3a | The first line contains two space-separated integers n and m (1 ≤ n ≤ 5·105, 0 ≤ m ≤ 106) — the number of cities and the number of roads marked on the flatland map, correspondingly. Next m lines contain descriptions of the cities on the map. The i-th line contains two integers ai and bi (1 ≤ ai, bi ≤ n, ai ≠ bi) — the ... | 2,100 | On the first line print number k — the number of groups of cities in Flatland, such that in each group you can get from any city to any other one by flatland roads. At the same time, the cities from different groups should be unreachable by flatland roads. On each of the following k lines first print ti (1 ≤ ti ≤ n) — ... | standard output | |
PASSED | c1da0687e699f7b87c344eea3ee73185 | train_000.jsonl | 1337182200 | Berland has managed to repel the flatlanders' attack and is now starting the counter attack.Flatland has n cities, numbered from 1 to n, and some pairs of them are connected by bidirectional roads. The Flatlandian maps show roads between cities if and only if there is in fact no road between this pair of cities (we do ... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import java.awt.geom.*;
import static java.lang.Math.*;
public class Solution implements Runnable {
int g [][];
int deg [];
int edges [][];
ArrayList<ArrayList<Integer>> answer = new ArrayList<ArrayList<Integer>>();
public void solve () throws ... | Java | ["4 4\n1 2\n1 3\n4 2\n4 3", "3 1\n1 2"] | 3 seconds | ["2\n2 1 4 \n2 2 3", "1\n3 1 2 3"] | NoteIn the first sample there are roads only between pairs of cities 1-4 and 2-3.In the second sample there is no road between cities 1 and 2, but still you can get from one city to the other one through city number 3. | Java 8 | standard input | [
"hashing",
"graphs",
"dsu",
"sortings",
"data structures"
] | 72394a06a9d9dffb61c6c92c4bbd2f3a | The first line contains two space-separated integers n and m (1 ≤ n ≤ 5·105, 0 ≤ m ≤ 106) — the number of cities and the number of roads marked on the flatland map, correspondingly. Next m lines contain descriptions of the cities on the map. The i-th line contains two integers ai and bi (1 ≤ ai, bi ≤ n, ai ≠ bi) — the ... | 2,100 | On the first line print number k — the number of groups of cities in Flatland, such that in each group you can get from any city to any other one by flatland roads. At the same time, the cities from different groups should be unreachable by flatland roads. On each of the following k lines first print ti (1 ≤ ti ≤ n) — ... | standard output | |
PASSED | cd3bb97d73f115845893f17ca3601e68 | train_000.jsonl | 1266580800 | In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th... | 64 megabytes | import java.util.ArrayList;
import java.util.Scanner;
public class cf1b {
public static String xclToRow(String input){
String result;
int j=0;
ArrayList<Integer> letterValues = new ArrayList<>();
while(!Character.isDigit(input.charAt(j))){
letterValues.add(input.charAt(j... | Java | ["2\nR23C55\nBC23"] | 10 seconds | ["BC23\nR23C55"] | null | Java 8 | standard input | [
"implementation",
"math"
] | 910c0e650d48af22fa51ab05e8123709 | The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 . | 1,600 | Write n lines, each line should contain a cell coordinates in the other numeration system. | standard output | |
PASSED | 2644a81d00bd1feb93d81b502063c2ea | train_000.jsonl | 1266580800 | In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th... | 64 megabytes | // package CodeForces;
import java.io.*;
import java.util.*;
public class Problem_1B {
public static StringBuilder add(StringBuilder s)
{
if(s.toString().equals("Z"))
return new StringBuilder("AA");
char c=s.charAt(s.length()-1);
c++;
// System.out.println(c);
if(c>'Z')
{
return add(s.replace(s.len... | Java | ["2\nR23C55\nBC23"] | 10 seconds | ["BC23\nR23C55"] | null | Java 8 | standard input | [
"implementation",
"math"
] | 910c0e650d48af22fa51ab05e8123709 | The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 . | 1,600 | Write n lines, each line should contain a cell coordinates in the other numeration system. | standard output | |
PASSED | 85aa0e881c333dcd410a2a2240d53a90 | train_000.jsonl | 1266580800 | In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th... | 64 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Z1B {
static char[] digits = {'a', 'b',
'c', 'd', 'e', 'f', 'g', 'h',
'i', 'j', 'k', 'l', 'm', 'n',
'o', 'p', 'q', 'r', 's', 't',
'u', 'v', 'w', 'x', 'y', 'z'};... | Java | ["2\nR23C55\nBC23"] | 10 seconds | ["BC23\nR23C55"] | null | Java 8 | standard input | [
"implementation",
"math"
] | 910c0e650d48af22fa51ab05e8123709 | The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 . | 1,600 | Write n lines, each line should contain a cell coordinates in the other numeration system. | standard output | |
PASSED | e9d205ad35c6173dbc51b3bd28ee5586 | train_000.jsonl | 1266580800 | In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th... | 64 megabytes | import java.util.*;
import java.io.*;
public class spreadsheet {
public static void main(String[] args) {
@SuppressWarnings("resource")
Scanner sc=new Scanner(System.in);
PrintWriter out=new PrintWriter(System.out);
int tc=sc.nextInt();
while(tc-->0) {
String s=sc.next();
if(s.charAt(0)=='R'&&Chara... | Java | ["2\nR23C55\nBC23"] | 10 seconds | ["BC23\nR23C55"] | null | Java 8 | standard input | [
"implementation",
"math"
] | 910c0e650d48af22fa51ab05e8123709 | The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 . | 1,600 | Write n lines, each line should contain a cell coordinates in the other numeration system. | standard output | |
PASSED | 183beead68a0b340f21f3558e9cd5f18 | train_000.jsonl | 1266580800 | In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th... | 64 megabytes | import java.util.Scanner;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
while(n-- > 0)
{
String line = sc.next();
if(line.charAt(0) ... | Java | ["2\nR23C55\nBC23"] | 10 seconds | ["BC23\nR23C55"] | null | Java 8 | standard input | [
"implementation",
"math"
] | 910c0e650d48af22fa51ab05e8123709 | The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 . | 1,600 | Write n lines, each line should contain a cell coordinates in the other numeration system. | standard output | |
PASSED | 1a916f97f0d145677e2ee141b63af40d | train_000.jsonl | 1266580800 | In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th... | 64 megabytes | import java.util.Scanner;
import java.util.regex.Pattern;
public class Puzzle1B {
public static Pattern ROW_NUM_COL_NUM = Pattern.compile("R[0-9]+C[0-9]+");
public static Pattern COL_ROW = Pattern.compile("[A-Z]+[0-9]+");
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int nu... | Java | ["2\nR23C55\nBC23"] | 10 seconds | ["BC23\nR23C55"] | null | Java 8 | standard input | [
"implementation",
"math"
] | 910c0e650d48af22fa51ab05e8123709 | The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 . | 1,600 | Write n lines, each line should contain a cell coordinates in the other numeration system. | standard output | |
PASSED | f73a788a8f0ab4b437fd8f84a55a6a2c | train_000.jsonl | 1266580800 | In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th... | 64 megabytes | import java.io.*;
import java.util.Arrays;
public class Codeforces {
public static PrintWriter out;
public static void main(String[] args) throws IOException{
Reader sc = new Reader();
out = new PrintWriter(new BufferedOutputStream(System.out));
int n = sc.nextInt();
for(int... | Java | ["2\nR23C55\nBC23"] | 10 seconds | ["BC23\nR23C55"] | null | Java 8 | standard input | [
"implementation",
"math"
] | 910c0e650d48af22fa51ab05e8123709 | The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 . | 1,600 | Write n lines, each line should contain a cell coordinates in the other numeration system. | standard output | |
PASSED | 9efe9ca73f7f4b5b1ed20e3d218fc357 | train_000.jsonl | 1266580800 | In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th... | 64 megabytes | //package main;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
public class Test {
public static int[] pows = new int[6];
public static void main(String[] args) throws Exception {
BufferedReader reader = new B... | Java | ["2\nR23C55\nBC23"] | 10 seconds | ["BC23\nR23C55"] | null | Java 8 | standard input | [
"implementation",
"math"
] | 910c0e650d48af22fa51ab05e8123709 | The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 . | 1,600 | Write n lines, each line should contain a cell coordinates in the other numeration system. | standard output | |
PASSED | 14f53c15214eb0044e7f9d6df34ac7d9 | train_000.jsonl | 1266580800 | In the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. Then there are two-letter numbers: column 27 has number AA, 28 — AB, column 52 is marked by AZ. After ZZ there follow th... | 64 megabytes | import java.io.*;
import java.util.StringTokenizer;
public class Problem2 {
public static void main(String[]args) throws IOException {
Scanner reader = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int tests = reader.nextInt();
for(int test=0; test<tests; te... | Java | ["2\nR23C55\nBC23"] | 10 seconds | ["BC23\nR23C55"] | null | Java 8 | standard input | [
"implementation",
"math"
] | 910c0e650d48af22fa51ab05e8123709 | The first line of the input contains integer number n (1 ≤ n ≤ 105), the number of coordinates in the test. Then there follow n lines, each of them contains coordinates. All the coordinates are correct, there are no cells with the column and/or the row numbers larger than 106 . | 1,600 | Write n lines, each line should contain a cell coordinates in the other numeration system. | standard output | |
PASSED | 5d95b4bef2fd4d7394bab22f795daebf | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import javafx.util.*;
import java.util.*;
import java.io.*;
public class JavaApplication1 {
static long x, y, z;
static ArrayList<Integer>arr1 = new ArrayList<Integer>();
static ArrayList<Integer>arr2 = new ArrayList<Integer>();
public static void main(String[] args) throws IOException {
Scanne... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | d643c3108e935c581e93bdfa4a9f81eb | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
/**
* Created by vikas.k on 26/12/16.
*/
public class CF251D {
public static void main(String[] args){
CF251D gv = new CF251D();
gv.solve();
}
private int n,m;
private List<Long> ls... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | e7e99c14a63a7cba604961c4856f3c7e | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Random;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;
/... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | af87de09c78e1066e068d5e17aa91e19 | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Random;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.function.Function;
import java.util.StringTokenizer;
import java.io.BufferedRe... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | 6d12a28fbcf8dda07236e05ee3b33dbe | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Random;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;
/... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | 6a848dce605ce0a432520055e8405b2d | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes |
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.StringTokenizer;
public class Task2 {
static ArrayList<Long> arr1 ... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | ac04c065d8363ad062cfaf124d37fc17 | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes |
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Task2 {
static long []arr1 , arr2;
sta... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | 3cf56a2ce06178b50466d88d76a416f0 | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.Random;
import java.util.StringTokenizer;
public class Main {
long b = 31;
String fileName = "";
////////////////////// SOLUTION SOLUTION SOLUTION //////////////////////////////
long INF = Long.MAX_VALUE / 10000;
int MODULO = 1000*... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | 6d632358882030a490ef46b3716edd06 | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | 8a241e311e00abcd11aa372d8ce23c3c | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static int a[];
static int b[];
static long find(long mid){
long temp = 0;
for(int i = 0;i < a.length;i++){
if(mid >= a[i])
temp += mid - a[i];
}
for(int i = 0;i < b.length;i++){
if(mid < b[i])
temp += b[i] - mid;
}
return temp;
}
public static vo... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | 02c6fe12ce7766acbac520acda71a7d6 | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
OutputWriter out = new OutputWriter(outputStream);
Task solver = ... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | 296fea11340cc46e127a94115b7805a4 | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Random;
import java.util.Scanner;
import java.io.... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | 685c9c7c81a729143a4d3f67899adcae | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.TreeSet;
import java.util.TreeMap;
import java.util.Map;
impo... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | 3d0cdb6b6694203334c22ef9033d0ea1 | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.Set;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.TreeSet;
import java.util.TreeMap;
impo... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | db040f2a0eaaad7f1821e69afa804f34 | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.TreeSet;
import java.io.Writer;
imp... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | b151604db5354678073026a9f33a6516 | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.TreeSet;
import java.util.TreeMap;
import java.util.Map;
impo... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | 9334815dd5d2e026321e53c8e92afeca | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collection;
import java.util.Locale;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
ne... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | 4e1448bae404b1caa4f7b614ec42daae | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class P439D
{
public static void main(String[] args)
{
FastScanner scan = new FastScanner();
int n = scan.nextInt();
int m = scan.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = ... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | 40c1120288f66cc6b15bc529c50b536c | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import java.io.*;
import java.util.*;
public class Solution {
static Scanner sc=new Scanner(System.in);
static PrintWriter out=new PrintWriter(System.out);
//Main
static int n,m;
static long a[],b[];
static long check(long x) {
long res=0;
for(int i=0;i<n;i++) res+=Math.max(0, x-a[i]);
for(int i=0;i<m;i++) ... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | 8b48792482d1358bf320d17b3f9dda28 | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
int n, m;
int[] aa, bb;
public long f(int k){
long res = 0;
for(int i = 0; i < n; i++){
res += Math.max(k - aa[i], 0);
}
for(int i = 0; i < m; i++){
res += Math.max(... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | f399a6fc88c3e513fa00811f05b2e6ba | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class DevuandhisBrother {
static long[] a, b;
static boolean hat(long x) {
long y = x + 1;
long res1 = 0;
long res2 = 0;
... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | 4cc13276b4eccaceeee12e2e3782a928 | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Main {
long[]a;
long[]b;
long min = (long) Math.pow(20, 9);
long max = 0;
public static void main(String[] args) {
// TODO Auto-generated method stub
Main t = new Main();
... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | db86b99c41d4ada8c574b6a5880090cf | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public final class devu_bro
{
static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
static FastScanner sc=new FastScanner(br);
static PrintWriter out=new PrintWriter(System.out);
static Random rnd=new Random();
static long[] ... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | 95893efe21e8be9ac5fe91e3018a0b51 | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import java.io.*;
import java.util.*;
public class MainClass
{
public static void main(String[] args)throws IOException
{
Reader in = new Reader();
int n = in.nextInt();
int m = in.nextInt();
long[] A = new long[n];
long[] B = new long[m];
for (int i=0;i<n;i++) ... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | 64492d57c6498ff8924b37dae4f454be | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import java.awt.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class CandidateCode {
static int a[],b[],n,m;
public static void main(String[] args) throws IOException {
FastReader sc = new FastReader();
n=sc.nextInt();m... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | 86e6a42d29bb3f643ebe36176c2c3ded | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import java.io.*;
import java.lang.*;
import java.util.*;
import java.text.*;
public class Main {
public static void main(String[] args) throws IOException {
//BufferedReader cin = new BufferedReader(new FileReader("test.txt"));
BufferedReader cin = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | 681771e7dffc3d5abf14c4cdc193cb35 | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class Main {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
int n = ni(), m = ni();
int[] a = ... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | 8eb8022771a630865b15c26b28b1d748 | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | e107e73ffd09760dc6d29788cdd593d6 | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import java.io.*;
import java.util.Arrays;
import java.util.Collections;
public class D {
public static void main(String[] args) throws Exception{
Integer[] first = IO.nextIntArray(2, " ");
Integer[] d1 = IO.nextIntArray(first[0], " ");
Integer[] d2 = IO.nextIntArray(first[1], " ");
... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | e4e126ad51cd870673dae8c5c54a43f7 | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import java.util.*;
import java.io.*;
public class b{
static void shuffle(int [] a){
Random rn=new Random();
for(int i=a.length-1;i>0;i--){
int ind=rn.nextInt(i);
int temp=a[ind];
a[ind]=a[i];
a[i]=temp;
}
Arrays.sort(a);
}
st... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | 686c5283ab645d2fab7ba33432e7e2a5 | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import java.util.*;
import java.io.*;
public class b{
static void shuffle(int [] a){
Random rn=new Random();
for(int i=a.length-1;i>0;i--){
int ind=rn.nextInt(i);
int temp=a[ind];
a[ind]=a[i];
a[i]=temp;
}
Arrays.sort(a);
}
st... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | 9b1a46b76b8e10eef4d02a351356632f | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import java.util.*;
import java.io.*;
import java.text.*;
public class T{
static final long mod = (long)163577857, root = 23;
static int MAX = (int)2e5+1, A = 26;
static FastReader in;
public static void main(String[] args) throws Exception{
in = new FastReader();
int n = ni(), m = ... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | 0adbaf403c84904eed33ab5a80b6e00e | train_000.jsonl | 1401895800 | Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays a and b by their father. The array a is given to Devu and b to his brother. As Devu is really a naughty kid, he wants the minimum value of his array a should be at least as much as the maxi... | 256 megabytes | import java.io.*;
import java.util.*;
public class CF439Dpt2 {
public static void main (String[]args) throws IOException {
//BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
//Scanner in = new Scanner(System.in);
/... | Java | ["2 2\n2 3\n3 5", "3 2\n1 2 3\n3 4", "3 2\n4 5 6\n1 2"] | 1 second | ["3", "4", "0"] | NoteIn example 1, you can increase a1 by 1 and decrease b2 by 1 and then again decrease b2 by 1. Now array a will be [3; 3] and array b will also be [3; 3]. Here minimum element of a is at least as large as maximum element of b. So minimum number of operations needed to satisfy Devu's condition are 3.In example 3, you ... | Java 8 | standard input | [
"two pointers",
"binary search",
"sortings",
"ternary search"
] | e0b5169945909cd2809482b7fd7178c2 | The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105). The second line will contain n space-separated integers representing content of the array a (1 ≤ ai ≤ 109). The third line will contain m space-separated integers representing content of the array b (1 ≤ bi ≤ 109). | 1,700 | You need to output a single integer representing the minimum number of operations needed to satisfy Devu's condition. | standard output | |
PASSED | 8f0ee9d3f6069722e0928e5f5968978d | train_000.jsonl | 1405774800 | Jzzhu is the president of country A. There are n cities numbered from 1 to n in his country. City 1 is the capital of A. Also there are m roads connecting the cities. One can go from city ui to vi (and vise versa) using the i-th road, the length of this road is xi. Finally, there are k train routes in the country. One ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.PriorityQueue;
public class JzzhuandCities {
public static class node implements Comparable<... | Java | ["5 5 3\n1 2 1\n2 3 2\n1 3 3\n3 4 4\n1 5 5\n3 5\n4 5\n5 5", "2 2 3\n1 2 2\n2 1 3\n2 1\n2 2\n2 3"] | 2 seconds | ["2", "2"] | null | Java 7 | standard input | [
"graphs",
"greedy",
"shortest paths"
] | 03d6b61be6ca0ac9dd8259458f41da59 | The first line contains three integers n, m, k (2 ≤ n ≤ 105; 1 ≤ m ≤ 3·105; 1 ≤ k ≤ 105). Each of the next m lines contains three integers ui, vi, xi (1 ≤ ui, vi ≤ n; ui ≠ vi; 1 ≤ xi ≤ 109). Each of the next k lines contains two integers si and yi (2 ≤ si ≤ n; 1 ≤ yi ≤ 109). It is guaranteed that there is at least one ... | 2,000 | Output a single integer representing the maximum number of the train routes which can be closed. | standard output | |
PASSED | 7237168685fc2fdcb0c02fa6a08b9048 | train_000.jsonl | 1405774800 | Jzzhu is the president of country A. There are n cities numbered from 1 to n in his country. City 1 is the capital of A. Also there are m roads connecting the cities. One can go from city ui to vi (and vise versa) using the i-th road, the length of this road is xi. Finally, there are k train routes in the country. One ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Div2_257_D {
static long INFINITY = 1000000000000l;
static int nodes;
static int edges;
static int trains;
static long distance[];
static in... | Java | ["5 5 3\n1 2 1\n2 3 2\n1 3 3\n3 4 4\n1 5 5\n3 5\n4 5\n5 5", "2 2 3\n1 2 2\n2 1 3\n2 1\n2 2\n2 3"] | 2 seconds | ["2", "2"] | null | Java 7 | standard input | [
"graphs",
"greedy",
"shortest paths"
] | 03d6b61be6ca0ac9dd8259458f41da59 | The first line contains three integers n, m, k (2 ≤ n ≤ 105; 1 ≤ m ≤ 3·105; 1 ≤ k ≤ 105). Each of the next m lines contains three integers ui, vi, xi (1 ≤ ui, vi ≤ n; ui ≠ vi; 1 ≤ xi ≤ 109). Each of the next k lines contains two integers si and yi (2 ≤ si ≤ n; 1 ≤ yi ≤ 109). It is guaranteed that there is at least one ... | 2,000 | Output a single integer representing the maximum number of the train routes which can be closed. | standard output | |
PASSED | 325e7ad073f6f11666527c07b9c15772 | train_000.jsonl | 1405774800 | Jzzhu is the president of country A. There are n cities numbered from 1 to n in his country. City 1 is the capital of A. Also there are m roads connecting the cities. One can go from city ui to vi (and vise versa) using the i-th road, the length of this road is xi. Finally, there are k train routes in the country. One ... | 256 megabytes | import java.util.*;
import java.io.*;
public class CF257D {
class EdgeList extends HashMap<Integer, List<Integer>> {};
// multigraph
// src -> (dest -> [costs of edges])
static EdgeList [] graph;
static CF257D c;
private static void populateEdge (int u, int v, int x) {
EdgeList nbrs = graph[u];
if (... | Java | ["5 5 3\n1 2 1\n2 3 2\n1 3 3\n3 4 4\n1 5 5\n3 5\n4 5\n5 5", "2 2 3\n1 2 2\n2 1 3\n2 1\n2 2\n2 3"] | 2 seconds | ["2", "2"] | null | Java 7 | standard input | [
"graphs",
"greedy",
"shortest paths"
] | 03d6b61be6ca0ac9dd8259458f41da59 | The first line contains three integers n, m, k (2 ≤ n ≤ 105; 1 ≤ m ≤ 3·105; 1 ≤ k ≤ 105). Each of the next m lines contains three integers ui, vi, xi (1 ≤ ui, vi ≤ n; ui ≠ vi; 1 ≤ xi ≤ 109). Each of the next k lines contains two integers si and yi (2 ≤ si ≤ n; 1 ≤ yi ≤ 109). It is guaranteed that there is at least one ... | 2,000 | Output a single integer representing the maximum number of the train routes which can be closed. | standard output | |
PASSED | 293f4b98d31c43dca298bdf977c8a033 | train_000.jsonl | 1405774800 | Jzzhu is the president of country A. There are n cities numbered from 1 to n in his country. City 1 is the capital of A. Also there are m roads connecting the cities. One can go from city ui to vi (and vise versa) using the i-th road, the length of this road is xi. Finally, there are k train routes in the country. One ... | 256 megabytes | import java.util.*;
import java.io.*;
public class B257 {
public static void main(String[] args) throws IOException
{
input.init(System.in);
int n = input.nextInt(), m = input.nextInt(), k = input.nextInt();
ArrayList<Edge>[] g = new ArrayList[n];
for(int i = 0; i<n; i++) g[i] = new ArrayList<Edge>();
... | Java | ["5 5 3\n1 2 1\n2 3 2\n1 3 3\n3 4 4\n1 5 5\n3 5\n4 5\n5 5", "2 2 3\n1 2 2\n2 1 3\n2 1\n2 2\n2 3"] | 2 seconds | ["2", "2"] | null | Java 7 | standard input | [
"graphs",
"greedy",
"shortest paths"
] | 03d6b61be6ca0ac9dd8259458f41da59 | The first line contains three integers n, m, k (2 ≤ n ≤ 105; 1 ≤ m ≤ 3·105; 1 ≤ k ≤ 105). Each of the next m lines contains three integers ui, vi, xi (1 ≤ ui, vi ≤ n; ui ≠ vi; 1 ≤ xi ≤ 109). Each of the next k lines contains two integers si and yi (2 ≤ si ≤ n; 1 ≤ yi ≤ 109). It is guaranteed that there is at least one ... | 2,000 | Output a single integer representing the maximum number of the train routes which can be closed. | standard output | |
PASSED | 6cc8504a8f4f5cf23dfa5602339b389a | train_000.jsonl | 1405774800 | Jzzhu is the president of country A. There are n cities numbered from 1 to n in his country. City 1 is the capital of A. Also there are m roads connecting the cities. One can go from city ui to vi (and vise versa) using the i-th road, the length of this road is xi. Finally, there are k train routes in the country. One ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class PD2 {
public static void main(String[] args) {
MyScanner scanner = new MyScanner();
int n = scanner.nextInt();
int m = scanner.nextInt();
int k = scanner.nex... | Java | ["5 5 3\n1 2 1\n2 3 2\n1 3 3\n3 4 4\n1 5 5\n3 5\n4 5\n5 5", "2 2 3\n1 2 2\n2 1 3\n2 1\n2 2\n2 3"] | 2 seconds | ["2", "2"] | null | Java 7 | standard input | [
"graphs",
"greedy",
"shortest paths"
] | 03d6b61be6ca0ac9dd8259458f41da59 | The first line contains three integers n, m, k (2 ≤ n ≤ 105; 1 ≤ m ≤ 3·105; 1 ≤ k ≤ 105). Each of the next m lines contains three integers ui, vi, xi (1 ≤ ui, vi ≤ n; ui ≠ vi; 1 ≤ xi ≤ 109). Each of the next k lines contains two integers si and yi (2 ≤ si ≤ n; 1 ≤ yi ≤ 109). It is guaranteed that there is at least one ... | 2,000 | Output a single integer representing the maximum number of the train routes which can be closed. | standard output | |
PASSED | 908880263d5c150004ef8907c36a8c15 | train_000.jsonl | 1405774800 | Jzzhu is the president of country A. There are n cities numbered from 1 to n in his country. City 1 is the capital of A. Also there are m roads connecting the cities. One can go from city ui to vi (and vise versa) using the i-th road, the length of this road is xi. Finally, there are k train routes in the country. One ... | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.List;
public class Main {
private static StringTokenizer st;
private static BufferedReader br;
public static long MOD = 1000000007;
public static void print(Object x) {
System.out.println(x + "");
}
public static String join(List<?... | Java | ["5 5 3\n1 2 1\n2 3 2\n1 3 3\n3 4 4\n1 5 5\n3 5\n4 5\n5 5", "2 2 3\n1 2 2\n2 1 3\n2 1\n2 2\n2 3"] | 2 seconds | ["2", "2"] | null | Java 7 | standard input | [
"graphs",
"greedy",
"shortest paths"
] | 03d6b61be6ca0ac9dd8259458f41da59 | The first line contains three integers n, m, k (2 ≤ n ≤ 105; 1 ≤ m ≤ 3·105; 1 ≤ k ≤ 105). Each of the next m lines contains three integers ui, vi, xi (1 ≤ ui, vi ≤ n; ui ≠ vi; 1 ≤ xi ≤ 109). Each of the next k lines contains two integers si and yi (2 ≤ si ≤ n; 1 ≤ yi ≤ 109). It is guaranteed that there is at least one ... | 2,000 | Output a single integer representing the maximum number of the train routes which can be closed. | standard output | |
PASSED | 4824fcc56c417dbb5f85de361dcac3b1 | train_000.jsonl | 1276700400 | In one one-dimensional world there are n platforms. Platform with index k (platforms are numbered from 1) is a segment with coordinates [(k - 1)m, (k - 1)m + l], and l < m. Grasshopper Bob starts to jump along the platforms from point 0, with each jump he moves exactly d units right. Find out the coordinate of the p... | 64 megabytes | import java.util.*;
import java.io.*;
public class Main implements Runnable {
public void solve() throws IOException {
long n = nextLong();
long d = nextLong();
long m = nextLong();
long l = nextLong();
if(l == m - 1){
... | Java | ["2 2 5 3", "5 4 11 8"] | 2 seconds | ["4", "20"] | null | Java 7 | standard input | [
"brute force",
"math"
] | ecbc339ad8064681789075f9234c269a | The first input line contains 4 integer numbers n, d, m, l (1 ≤ n, d, m, l ≤ 106, l < m) — respectively: amount of platforms, length of the grasshopper Bob's jump, and numbers m and l needed to find coordinates of the k-th platform: [(k - 1)m, (k - 1)m + l]. | 1,700 | Output the coordinates of the point, where the grosshopper will fall down. Don't forget that if Bob finds himself on the platform edge, he doesn't fall down. | standard output | |
PASSED | 27816d0d0e9f606bb476ca9c83b9c996 | train_000.jsonl | 1276700400 | In one one-dimensional world there are n platforms. Platform with index k (platforms are numbered from 1) is a segment with coordinates [(k - 1)m, (k - 1)m + l], and l < m. Grasshopper Bob starts to jump along the platforms from point 0, with each jump he moves exactly d units right. Find out the coordinate of the p... | 64 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
public class Task018B {
public static void main(String... args) throws NumberFormatException,
IOException {
Solution... | Java | ["2 2 5 3", "5 4 11 8"] | 2 seconds | ["4", "20"] | null | Java 7 | standard input | [
"brute force",
"math"
] | ecbc339ad8064681789075f9234c269a | The first input line contains 4 integer numbers n, d, m, l (1 ≤ n, d, m, l ≤ 106, l < m) — respectively: amount of platforms, length of the grasshopper Bob's jump, and numbers m and l needed to find coordinates of the k-th platform: [(k - 1)m, (k - 1)m + l]. | 1,700 | Output the coordinates of the point, where the grosshopper will fall down. Don't forget that if Bob finds himself on the platform edge, he doesn't fall down. | standard output | |
PASSED | d9b4fa50e3c50a4931954d6dc9eb85c6 | train_000.jsonl | 1276700400 | In one one-dimensional world there are n platforms. Platform with index k (platforms are numbered from 1) is a segment with coordinates [(k - 1)m, (k - 1)m + l], and l < m. Grasshopper Bob starts to jump along the platforms from point 0, with each jump he moves exactly d units right. Find out the coordinate of the p... | 64 megabytes | import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Scanner;
public class B {
public static void main(String[] args) throws IOException {
File inputFile = new File("entradaB");
if (inputFile.exists())
System.setIn(new FileInputStream(inputFile));
Scanner in = new... | Java | ["2 2 5 3", "5 4 11 8"] | 2 seconds | ["4", "20"] | null | Java 7 | standard input | [
"brute force",
"math"
] | ecbc339ad8064681789075f9234c269a | The first input line contains 4 integer numbers n, d, m, l (1 ≤ n, d, m, l ≤ 106, l < m) — respectively: amount of platforms, length of the grasshopper Bob's jump, and numbers m and l needed to find coordinates of the k-th platform: [(k - 1)m, (k - 1)m + l]. | 1,700 | Output the coordinates of the point, where the grosshopper will fall down. Don't forget that if Bob finds himself on the platform edge, he doesn't fall down. | standard output | |
PASSED | d3087734cb6cf66d9e9c46fc7f882b1d | train_000.jsonl | 1276700400 | In one one-dimensional world there are n platforms. Platform with index k (platforms are numbered from 1) is a segment with coordinates [(k - 1)m, (k - 1)m + l], and l < m. Grasshopper Bob starts to jump along the platforms from point 0, with each jump he moves exactly d units right. Find out the coordinate of the p... | 64 megabytes | import java.util.*;
import java.io.*;
public class B0018 {
public static void main(String args[]) throws Exception {
new B0018();
}
B0018() throws Exception {
PandaScanner sc = null;
PrintWriter out = null;
try {
sc = new PandaScanner(System.in);
ou... | Java | ["2 2 5 3", "5 4 11 8"] | 2 seconds | ["4", "20"] | null | Java 7 | standard input | [
"brute force",
"math"
] | ecbc339ad8064681789075f9234c269a | The first input line contains 4 integer numbers n, d, m, l (1 ≤ n, d, m, l ≤ 106, l < m) — respectively: amount of platforms, length of the grasshopper Bob's jump, and numbers m and l needed to find coordinates of the k-th platform: [(k - 1)m, (k - 1)m + l]. | 1,700 | Output the coordinates of the point, where the grosshopper will fall down. Don't forget that if Bob finds himself on the platform edge, he doesn't fall down. | standard output | |
PASSED | 1c8f4618f5f1a9a09f4d92f26c237aff | train_000.jsonl | 1276700400 | In one one-dimensional world there are n platforms. Platform with index k (platforms are numbered from 1) is a segment with coordinates [(k - 1)m, (k - 1)m + l], and l < m. Grasshopper Bob starts to jump along the platforms from point 0, with each jump he moves exactly d units right. Find out the coordinate of the p... | 64 megabytes | import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;
/**
*... | Java | ["2 2 5 3", "5 4 11 8"] | 2 seconds | ["4", "20"] | null | Java 7 | standard input | [
"brute force",
"math"
] | ecbc339ad8064681789075f9234c269a | The first input line contains 4 integer numbers n, d, m, l (1 ≤ n, d, m, l ≤ 106, l < m) — respectively: amount of platforms, length of the grasshopper Bob's jump, and numbers m and l needed to find coordinates of the k-th platform: [(k - 1)m, (k - 1)m + l]. | 1,700 | Output the coordinates of the point, where the grosshopper will fall down. Don't forget that if Bob finds himself on the platform edge, he doesn't fall down. | standard output | |
PASSED | 6760e767bca637341ba11e5e6b2f7128 | train_000.jsonl | 1276700400 | In one one-dimensional world there are n platforms. Platform with index k (platforms are numbered from 1) is a segment with coordinates [(k - 1)m, (k - 1)m + l], and l < m. Grasshopper Bob starts to jump along the platforms from point 0, with each jump he moves exactly d units right. Find out the coordinate of the p... | 64 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.reflect.Constructor;
import java.util.Arrays;
import java.util.StringTokenizer;
public class CodeE
{
static class Scanner
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new String... | Java | ["2 2 5 3", "5 4 11 8"] | 2 seconds | ["4", "20"] | null | Java 7 | standard input | [
"brute force",
"math"
] | ecbc339ad8064681789075f9234c269a | The first input line contains 4 integer numbers n, d, m, l (1 ≤ n, d, m, l ≤ 106, l < m) — respectively: amount of platforms, length of the grasshopper Bob's jump, and numbers m and l needed to find coordinates of the k-th platform: [(k - 1)m, (k - 1)m + l]. | 1,700 | Output the coordinates of the point, where the grosshopper will fall down. Don't forget that if Bob finds himself on the platform edge, he doesn't fall down. | standard output | |
PASSED | 8f0c7ac97b4d8a01f1d8032fe5fc9757 | train_000.jsonl | 1276700400 | In one one-dimensional world there are n platforms. Platform with index k (platforms are numbered from 1) is a segment with coordinates [(k - 1)m, (k - 1)m + l], and l < m. Grasshopper Bob starts to jump along the platforms from point 0, with each jump he moves exactly d units right. Find out the coordinate of the p... | 64 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class B implements Runnable {
BufferedReader in;
PrintWriter out;
StringTokenizer st;
Random rnd;
void solve() throws IOException {
long total = nextInt(), oneJump = nextInt(), m = nextInt(), l = nextInt();
long current = 0;
while(true... | Java | ["2 2 5 3", "5 4 11 8"] | 2 seconds | ["4", "20"] | null | Java 7 | standard input | [
"brute force",
"math"
] | ecbc339ad8064681789075f9234c269a | The first input line contains 4 integer numbers n, d, m, l (1 ≤ n, d, m, l ≤ 106, l < m) — respectively: amount of platforms, length of the grasshopper Bob's jump, and numbers m and l needed to find coordinates of the k-th platform: [(k - 1)m, (k - 1)m + l]. | 1,700 | Output the coordinates of the point, where the grosshopper will fall down. Don't forget that if Bob finds himself on the platform edge, he doesn't fall down. | standard output | |
PASSED | 99b30e9f485109da62ff477478f50c29 | train_000.jsonl | 1276700400 | In one one-dimensional world there are n platforms. Platform with index k (platforms are numbered from 1) is a segment with coordinates [(k - 1)m, (k - 1)m + l], and l < m. Grasshopper Bob starts to jump along the platforms from point 0, with each jump he moves exactly d units right. Find out the coordinate of the p... | 64 megabytes | import java.io.*;
import java.util.*;
public class Platforms {
public static void main(String[] args) throws IOException {
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(f.readLine());
long n = Long.parseLong(st.nextToken())... | Java | ["2 2 5 3", "5 4 11 8"] | 2 seconds | ["4", "20"] | null | Java 7 | standard input | [
"brute force",
"math"
] | ecbc339ad8064681789075f9234c269a | The first input line contains 4 integer numbers n, d, m, l (1 ≤ n, d, m, l ≤ 106, l < m) — respectively: amount of platforms, length of the grasshopper Bob's jump, and numbers m and l needed to find coordinates of the k-th platform: [(k - 1)m, (k - 1)m + l]. | 1,700 | Output the coordinates of the point, where the grosshopper will fall down. Don't forget that if Bob finds himself on the platform edge, he doesn't fall down. | standard output | |
PASSED | 93b4191fb3d00e31104483834e85056c | train_000.jsonl | 1276700400 | In one one-dimensional world there are n platforms. Platform with index k (platforms are numbered from 1) is a segment with coordinates [(k - 1)m, (k - 1)m + l], and l < m. Grasshopper Bob starts to jump along the platforms from point 0, with each jump he moves exactly d units right. Find out the coordinate of the p... | 64 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int jump = in.nextInt();
int m = in.nextInt();
int len = in.nextInt();
int delta = jump % m;
boolean[] p... | Java | ["2 2 5 3", "5 4 11 8"] | 2 seconds | ["4", "20"] | null | Java 7 | standard input | [
"brute force",
"math"
] | ecbc339ad8064681789075f9234c269a | The first input line contains 4 integer numbers n, d, m, l (1 ≤ n, d, m, l ≤ 106, l < m) — respectively: amount of platforms, length of the grasshopper Bob's jump, and numbers m and l needed to find coordinates of the k-th platform: [(k - 1)m, (k - 1)m + l]. | 1,700 | Output the coordinates of the point, where the grosshopper will fall down. Don't forget that if Bob finds himself on the platform edge, he doesn't fall down. | standard output | |
PASSED | 25f9ad06968f23dc3248b7dd0742c3db | train_000.jsonl | 1276700400 | In one one-dimensional world there are n platforms. Platform with index k (platforms are numbered from 1) is a segment with coordinates [(k - 1)m, (k - 1)m + l], and l < m. Grasshopper Bob starts to jump along the platforms from point 0, with each jump he moves exactly d units right. Find out the coordinate of the p... | 64 megabytes |
import java.io.*;
import java.util.*;
public class Codeforces {
public static void main(String[] args) throws IOException {
Reader.init(System.in);
long n = Reader.nextInt(), d = Reader.nextInt(), m = Reader.nextInt(), l = Reader.nextInt();
long arr[][] = new long[2][(int)n];
... | Java | ["2 2 5 3", "5 4 11 8"] | 2 seconds | ["4", "20"] | null | Java 7 | standard input | [
"brute force",
"math"
] | ecbc339ad8064681789075f9234c269a | The first input line contains 4 integer numbers n, d, m, l (1 ≤ n, d, m, l ≤ 106, l < m) — respectively: amount of platforms, length of the grasshopper Bob's jump, and numbers m and l needed to find coordinates of the k-th platform: [(k - 1)m, (k - 1)m + l]. | 1,700 | Output the coordinates of the point, where the grosshopper will fall down. Don't forget that if Bob finds himself on the platform edge, he doesn't fall down. | standard output | |
PASSED | 993773a660dfb62d7bb390a8daaba70d | train_000.jsonl | 1276700400 | In one one-dimensional world there are n platforms. Platform with index k (platforms are numbered from 1) is a segment with coordinates [(k - 1)m, (k - 1)m + l], and l < m. Grasshopper Bob starts to jump along the platforms from point 0, with each jump he moves exactly d units right. Find out the coordinate of the p... | 64 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class _18B {
public static void main(String arg[]) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String s[] = br.readLine().split(" ");
long n... | Java | ["2 2 5 3", "5 4 11 8"] | 2 seconds | ["4", "20"] | null | Java 7 | standard input | [
"brute force",
"math"
] | ecbc339ad8064681789075f9234c269a | The first input line contains 4 integer numbers n, d, m, l (1 ≤ n, d, m, l ≤ 106, l < m) — respectively: amount of platforms, length of the grasshopper Bob's jump, and numbers m and l needed to find coordinates of the k-th platform: [(k - 1)m, (k - 1)m + l]. | 1,700 | Output the coordinates of the point, where the grosshopper will fall down. Don't forget that if Bob finds himself on the platform edge, he doesn't fall down. | standard output | |
PASSED | 732b8b63f09c3010e47db8712e168cec | train_000.jsonl | 1276700400 | In one one-dimensional world there are n platforms. Platform with index k (platforms are numbered from 1) is a segment with coordinates [(k - 1)m, (k - 1)m + l], and l < m. Grasshopper Bob starts to jump along the platforms from point 0, with each jump he moves exactly d units right. Find out the coordinate of the p... | 64 megabytes | import java.util.ArrayList;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author ... | Java | ["2 2 5 3", "5 4 11 8"] | 2 seconds | ["4", "20"] | null | Java 7 | standard input | [
"brute force",
"math"
] | ecbc339ad8064681789075f9234c269a | The first input line contains 4 integer numbers n, d, m, l (1 ≤ n, d, m, l ≤ 106, l < m) — respectively: amount of platforms, length of the grasshopper Bob's jump, and numbers m and l needed to find coordinates of the k-th platform: [(k - 1)m, (k - 1)m + l]. | 1,700 | Output the coordinates of the point, where the grosshopper will fall down. Don't forget that if Bob finds himself on the platform edge, he doesn't fall down. | standard output | |
PASSED | 81ffd2ad7d4e19b0b3631a9a12e1fd13 | train_000.jsonl | 1276700400 | In one one-dimensional world there are n platforms. Platform with index k (platforms are numbered from 1) is a segment with coordinates [(k - 1)m, (k - 1)m + l], and l < m. Grasshopper Bob starts to jump along the platforms from point 0, with each jump he moves exactly d units right. Find out the coordinate of the p... | 64 megabytes | import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author nasko
*/
public class Main ... | Java | ["2 2 5 3", "5 4 11 8"] | 2 seconds | ["4", "20"] | null | Java 7 | standard input | [
"brute force",
"math"
] | ecbc339ad8064681789075f9234c269a | The first input line contains 4 integer numbers n, d, m, l (1 ≤ n, d, m, l ≤ 106, l < m) — respectively: amount of platforms, length of the grasshopper Bob's jump, and numbers m and l needed to find coordinates of the k-th platform: [(k - 1)m, (k - 1)m + l]. | 1,700 | Output the coordinates of the point, where the grosshopper will fall down. Don't forget that if Bob finds himself on the platform edge, he doesn't fall down. | standard output | |
PASSED | 00e900f874b854b65c3413084679a96c | train_000.jsonl | 1276700400 | In one one-dimensional world there are n platforms. Platform with index k (platforms are numbered from 1) is a segment with coordinates [(k - 1)m, (k - 1)m + l], and l < m. Grasshopper Bob starts to jump along the platforms from point 0, with each jump he moves exactly d units right. Find out the coordinate of the p... | 64 megabytes | import java.util.Scanner;
public class Platforms {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
long n = in.nextLong();
long d = in.nextLong();
long m = in.nextLong();
long l = in.nextLong();
in.close();
long x = 0;
for (long i = 0; i < n; i++) {
long endPlat... | Java | ["2 2 5 3", "5 4 11 8"] | 2 seconds | ["4", "20"] | null | Java 7 | standard input | [
"brute force",
"math"
] | ecbc339ad8064681789075f9234c269a | The first input line contains 4 integer numbers n, d, m, l (1 ≤ n, d, m, l ≤ 106, l < m) — respectively: amount of platforms, length of the grasshopper Bob's jump, and numbers m and l needed to find coordinates of the k-th platform: [(k - 1)m, (k - 1)m + l]. | 1,700 | Output the coordinates of the point, where the grosshopper will fall down. Don't forget that if Bob finds himself on the platform edge, he doesn't fall down. | standard output | |
PASSED | 586f43d293a85061f71926370d0d3521 | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes | import java.util.Scanner;
public class CodeForce {
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int w=0;
int x = 0;
if(n%2==0)
{
System.out.println(n/2);
... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | a4f74cb598fb01c874996b3718f91ae9 | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes | import java.util.Scanner;
public class A{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int t ,n;
n=sc.nextInt();
if(n%2!=0)
{
System.out.println(1+(n-3)/2)... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | c7334d47b787a1a5e3cd862b019fd48f | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes | import java.util.Scanner;
public class A749 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
if(t%2==0){
System.out.println(t/2);
while(t > 0){
System.out.print("2 ");
t-=2;
... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | a6bbfd15fa2e0b88e47c0ab565975e3c | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.util.Scanner;
/**
*
* @author yashvi1902
*/
public class bachgold {
public static void main(String[] args) {
... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | bbba891c2dd293eaceb28f5bf49815de | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes | import java.util.Scanner;
public class P749A {
static void printAsMaximalPrimeSum(int n) {
int cont2=0, cont3=0, cont=0;
if (n % 2 == 1) {
cont++;
cont3++;
n =n-3;
}
while (n>0) {
cont++;
cont2++;
... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | bb659e6cfba304215074caa02fb02385 | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes | import java.util.*;
public class solution {
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
int t=s.nextInt();
if(t%2==0) {
int n=t/2;
System.out.println(n);
for(int i=0;i<n;i++) {
System.out.print(2+" ");
}
}
else {
t=t-3;
int n=t/2;
System.out.println(n... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | 7e8bc26e37be39fcbd02ff38a0941d44 | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes | import java.util.*;
public class solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt() ;
System.out.println(n/2);
while (n > 3){
System.out.print(2 + " ");
n -= 2 ;
}
Sy... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | 86001d83ab9acef755f38c21ee90bc8f | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes | import java.util.Scanner;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author ASUS
*/
public class Main {
public static void main(String[] args) {
Scanner... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | b85123ee1382809cadb7dfdcc395c7d1 | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class SolutionA extends Thread {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new B... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | 6ab3b576be00c3b01f1b33c843b24433 | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes | //package hiougyf;
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) throws IOException
{
Scanner sc =new Scanner(System.in);
int n=sc.nextInt();
int x=n/2;
System.out.println(x);
if(n%2==0) {
while(x-->0) System.out.print(2+" ");
}
el... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | c73117f83bb41ed425c9d0bf179145d0 | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes | import java.util.*;
import java.io.*;
public class BachgoldProblem {
public static void main (String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
if (n%2==0) {
System.out.print(n/2);
System.out.println(" ");
for (int i=0; i<(... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | cc629c6ff50023bbb9037ed94b06438e | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes | import java.util.*;
public class Solution{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
if(n == 2){
System.out.println("1");
System.out.println("2");
}
else if(n == 3){
... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | 7893e8b9e92e4764df63de8c566ad192 | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.String;
import java.util.*;
public class Main {
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedRead... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | 6aa20efadc34b26bebf0a8864c733c8e | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int count = 0;
int sumEven = 0;
if (n % 2 == 0) {
while (sumEven != n) {
sumEven += 2;
... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | 9eee968fad5cdd1b7c576b09a0c9982b | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner akash = new Scanner(System.in);
int number = akash.nextInt();
if(number%2==0){
System.out.println(number/2);
for(int i=0;i<number/2;i++){
System.out.print(2 +" ");
}
System.... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | 41ea5878d74d39883072832dabba898e | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner akash = new Scanner(System.in);
int number = akash.nextInt();
if(number%2==0){
System.out.println(number/2);
for(int i=0;i<number/2;i++){
System.out.print(2+" ");
}
System.ou... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | 9fb3e365e9b0d3e3031fb00e564acb64 | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes | import java.util.Scanner;
public class competitive8 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int ans=(int)(n/2);
System.out.println(ans);
for(int i=0;i<(int)(n/2);i++){
if(i!=((int)(n/2)-1)) {
... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | a449133a313fb5a8f20319a54e144a54 | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes | import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
public class CF749A {
public static ArrayList<Integer> primes=new ArrayList<>();
public static void sieve(){
int[] prime=new int[100000];
for(int i=3;i<prime.length;i+=2){
prime[i]=1;
}
pr... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | f2d001eb7699d133a7bd4488a80f58a1 | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes | import java.util.Scanner;
public class Main{
public static void main(String [] args)
{
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int count=0;
if(n%2==0)
{
for(int i=2;i<=n;i=i+2)
{
count++;
}
... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | 32e68b1cb53a5b26613933c298b42621 | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes | import java.util.Scanner;
public class BachgoldProblem {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int count = 0;
if (n % 2 == 0) {
count = n / 2;
System.out.println(count);
for (int i ... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | 8598b0f558a815ef76c7cc1faff5d6c7 | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes | import java.util.Scanner;
public class BachgoldProblem {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int count = 0;
if (n % 2 == 0) {
count = n / 2;
System.out.println(count);
for (int i ... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | 0c30004253a7be8166c4bc069f2852e1 | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes | import java .util.Scanner ;
import java.util.*;
public class cf2{
public static void main(String[] args ){
Scanner s =new Scanner (System.in);
int n =s.nextInt();
int count=0;
System.out.println(n/2);
while(n>0){
//System.out.println(n/2);
if(n>=2 && ... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | 49ceb9b4d04b06e64819beb7d3f22d8b | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes | import java.util.*;
public class BachgoldProblem {
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
if(n==3)
{
System.out.println(1);
System.out.println(3);
}
else if(n%2==0)
{
... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | 579bd66f2b308e0742a3c39682a6104e | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes |
import java.util.Scanner;
public class BachgoldProblem {
public static void main(String [] args) {
Scanner sc = new Scanner(System.in);
int n,two,three=0;n=sc.nextInt();
if(n%2==0) two=n/2;
else {
three=1;
n=n-3;
two=n/2;
}
System.out.println(two+three);
for(int i=1;i<=two;i++) System.out.print... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | b6a7b0f8bbb0e569f77e0be877e5079e | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes | import java.util.*;
public class file {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
if(n%2==0) {
System.out.println(n/2);
for(int i = 0 ; i< n/2 ; i++) {
System.out.print(2 + " ");
}
... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | 4fcdc0edb8f152a49654550a21c74250 | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes | import java.util.Scanner;
public class BachgoldProblem {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
System.out.println(n/2);
if(n % 2 == 0) {
for(int i = 1; i <= n/2 - 1; i++) {
System.out.print("2 ... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | 6dd7c3d342487a985e0d124aa90a6add | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int sum=0;
if(n%2==0) {
System.out.println(n/2);
for(int i=0;i<n/2;i++)
System.out.print(2+" ");
}else {
System.out.println(n/2);
for(int i=0;i<n/2-1;i++)
... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | 24e8a5e6513a4119899abe83a258c8f6 | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes | import java.util.Scanner;
public class BachgoldProblem {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
System.out.println( n / 2);
System.out.print((n % 2) != 0 ? 3 : 2);
for (int i = n - 2; i >= 2; i -= 2){
Syste... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | c1affbba9b30116c7c35b77e2b9d55ce | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes | // Codeforces 749A
import java.util.Scanner;
public class CF749A {
static final Scanner SC = new Scanner(System.in);
public static void main(String[] args) {
int number = SC.nextInt();
printPrimeDistribution(number);
}
// Prints the given number as a sum of prime numbers such that the ... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | fc076904929ff67400f916c48e6e6f15 | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
// QAQAQYSYIOIWIN
// outputCopy
// 4
// inputCopy
// QAQQQZZYNOIWIN
// outputCopy
// 3
public class Main
{
static PrintWriter out;
static class FastReader{
... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | f155cd74be670c6cf90f3c718cde7981 | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes | import java.util.*;
import java.io.*;
public class sumofprimeequalton{
static int n,k;
static StringBuilder ans;
static HashMap<Integer,Integer> map=new HashMap<>();
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); ... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output | |
PASSED | adc55086ccd58499cd537de92f295937 | train_000.jsonl | 1482165300 | Bachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.Recall that integer k is called prime if it is greater than 1 and has exactly two positive integer diviso... | 256 megabytes |
import java.util.Scanner;
public class BachgoldProblem {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner s=new Scanner(System.in);
int n=s.nextInt();
if(n%2==0){
int v=n/2;
System.out.println(n/2);
while(v--!=0){
System.out.print("2 ");
}
}else{
int v... | Java | ["5", "6"] | 1 second | ["2\n2 3", "3\n2 2 2"] | null | Java 11 | standard input | [
"implementation",
"number theory",
"greedy",
"math"
] | 98fd00d3c83d4b3f0511d8afa6fdb27b | The only line of the input contains a single integer n (2 ≤ n ≤ 100 000). | 800 | The first line of the output contains a single integer k — maximum possible number of primes in representation. The second line should contain k primes with their sum equal to n. You can print them in any order. If there are several optimal solution, print any of them. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.