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
331a3223f28a5c2ebe9f138b4e2eb788
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { int t = 0; Scanner sc = new Scanner(System.in); t = Integer.parseInt(sc.nextLine()); for (int i = 0; i < t; i++) { String input = sc.nextLine(); String[] arr = inp...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 11
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
23fc59c9bbc2a5fe376f9e26eb0052d4
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Solution { static PrintWriter out; public static void main(String[] args) { FastReader in = new FastReader(); out = new PrintWrit...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 11
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
31fa6b43008b471014d7f532946f5d36
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Solution { static PrintWriter out; public static void main(String[] args) { FastReader in = new FastReader(); out = new PrintWrit...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 11
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
0d306f25def2d1a9ae8d7f75336877e7
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int testcase = sc.nextInt(); sc.nextLine(); StringBuilder str = new StringBuilder(); while (testcase-- > 0) { long x = sc.next...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 11
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
42d62e62c8dcf96f4b1c0323671ebae8
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.util.Scanner; public class Solution{ public static void main(String[] args) { Scanner input = new Scanner(System.in); int t = input.nextInt(); while(t != 0){ t--; long x = input.nextLong(); long n = input.nextLong(); ...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 11
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
d00771212db397a03b03f5ef5bf13f82
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int i=0;i<t;i++){ long pos=sc.nextLong(); long n=sc.nextLong(); if(n==0) System.out.print...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 11
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
d22518d3551f61b8f67c8613d2ffe8c9
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.util.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.*; import java.math.*; public class b1607B { public static void main(String[] args) throws Exception { BufferedReader bu = new BufferedReader(new InputStreamReade...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 11
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
7be68cae6ac4aa47b319606c2ea25c7d
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.util.HashMap; import java.util.Scanner; public class B { public static void main(String[] args) { Scanner go = new Scanner(System.in); int t = go.nextInt(); while (t>0){ long x0 = go.nextLong(); long n = go.nextLong(); int g = 0; ...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 11
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
e3e39ecfc316c8d8db57a45789c7a34e
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.util.HashMap; import java.util.Scanner; public class B { public static void main(String[] args) { Scanner go = new Scanner(System.in); int t = go.nextInt(); while (t>0){ long x0 = go.nextLong(); long n = go.nextLong(); long ans = 0; ...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 11
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
9e38dddf1fcb01784893a34eebede91b
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; /*AUTHOR - ELDIIAR DZHUNUSOV */ public class a { static int mod= 1000000007 ; static final FastReader in = new FastReader(); static final PrintWriter out ...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 11
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
39019beaaa2e6ef32f1f55e3b6162262
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; /*AUTHOR - ELDIIAR DZHUNUSOV */ public class a { static int mod= 1000000007 ; static final FastReader in = new FastReader(); static final PrintWriter out ...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 11
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
997725638c528e75a9770bd2dd10e1d7
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); long t=sc.nextLong(); for(long i=0;i<t;i++){ long x=sc.nextLong(); long n=sc.nextLong(); if(n==0 || n%4==0){ System.out.println(x)...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 11
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
2f737467cb64a7ef85b3de0889c5dd61
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashMap; import java.util.StringTokenizer; public class Codeforces { public static void main(String[] args) { FastReader fastReader = new FastReader(); ...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 11
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
7ff1c2c9f9b3a61648ecaadd5b4aba0f
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; public class problemB{ public static void main(String[] args) throws Exception{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int t=Integer.parseInt(br.readLine()); StringBuilder sb=new StringBuilder()...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 11
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
6d69ada2e8cca3f6fd17ae331ddb69a3
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; public class problemA{ public static void main(String[] args) throws Exception{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int t=Integer.parseInt(br.readLine()); StringBuilder sb=new StringBuilder()...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 11
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
ebd120f948b07ed5cbcb3ef99e34939d
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.util.*; public class Solution { public static void main(String[] args) throws Exception { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); scanner.nextLine(); long[] a = new long[n]; long[] b = new long[n]; for(int i = 0;i <...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 11
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
514dfe77c813c44b877f353b9a9c0d6b
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.math.BigInteger; import java.util.*; public class Solution { static Scanner in = new Scanner(System.in); public static void main(String[] args) { int t = in.nextInt(); while(t-->0) { BigInteger x = new BigInteger(in.next()); BigInteger n = new Bi...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 11
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
e8a45230862baf4d512b7abdde697677
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.*; public class Codeforces { public static void main(String[]...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 11
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
07758e81ffe3701003965c5becf90d6b
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.util.*; import java.io.*; public class Main { static long mod = 1000000007; static long max ; static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); public static void main(String[] args) throws IOException { FastReader sc = new FastReader(); int t = sc.nextIn...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 11
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
16a8ee9d8135634c2d4a88cc6f9044b1
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.util.Scanner; public class OddGrasshopper { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-- > 0) { long x = sc.nextLong(); long n = sc.nextLong(); long i = n - n % 4 + 1;...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 11
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
d43395e2f08bbda16bd9ab907d08f9db
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.util.Scanner; public class HelloWorld { public static long result(long x,long n){ for(long i=(n-(n%4)+1);i<=n;i++){ if(x%2==0) x = x-i; else x = x+i; } return x; } public static void main(String[] args) { Scanner scan = new Scanner(Syst...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 11
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
8a9c27b25ef5d2c6606aa388017f69ee
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.io.*; import java.util.*; public class B { public static void main(String[] args) throws Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int T=Integer.parseInt(br.readLine().trim()); StringBuilder sb=new StringBuilder(); ...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 11
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
89a2ee168242734e4b4f8859307ebd50
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.util.*; import java.io.*; public class B { public static void main(String[] args) { FastScanner fs = new FastScanner(); int t = fs.nextInt(); for (int tt = 0; tt < t; tt++) { long x = fs.nextLong(); long n = fs.nextLong(); long ans = 0; if (n % 4 == 0) ans = 0; if (n % 4...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 11
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
7ef712a6da75a3d6d46f6fa81fb21e75
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.util.*; import java.io.*; public class B { public static void main(String[] args) { FastScanner fs = new FastScanner(); int t = fs.nextInt(); for (int tt = 0; tt < t; tt++) { long x = fs.nextLong(); long n = fs.nextLong(); long n2 = (n / 4) * 4; for (long i = n2 + 1; i <= n;...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 11
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
86a5d17bbde4008f2e81bafc1abc8e54
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.io.*; public class MyClass { public static void main(String args[])throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); long t=Long.parseLong(br.readLine()); while(t-->0){ String s[]=br.readLine().split(" "); ...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 11
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
ecda2b685d79757f86b9c2dad2814171
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
/** * 11/02/21 morning * https://codeforces.com/contest/1607/problem/B */ // package codeforce.cf.div3.r753; import java.util.*; import java.io.*; public class B { static PrintWriter pw; /* n is odd -1 + 1 - 1 + 1 9 ( + 1 - 2 - 3 + 4 + 5 - 6 - 7 + 8) + 9 = 18 (9, ...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 11
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
fc5e327c4ad4e83acba13283d92a112e
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { static long mod = (int)1e9+7; public static void main (String[] args) throws java.lang.Exception { FastReader sc =new FastReader(); int t=sc.nextInt(); // int t=1; while(t-->0...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 11
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
bdcbf951be95e5ac87b08dbaf779ccad
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public final class Codechef { public static void main (String[] args) throws java.lang.Exception { Scanner sc = new Scanne...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 11
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
9801e690554993487d6d660e6ccafe14
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static PrintWriter pw = new PrintWriter(System.out); ...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 11
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
dfe3250803f49f370b76c924b46976c7
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.util.*; public class Basha{ public static void main(String []argv){ Scanner in = new Scanner(System.in); int z; z = in.nextInt(); while(z!=0){ long a = in.nextLong(); long b = in.nextLong();long c = a; long temp = 0; fo...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 11
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
4cd288edbc040e778bc0d3c7615870b1
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.io.DataInputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; public class Main { private static void run() throws IOException { long x = in.nextLong(); long n = in.nextLong(); if (n == 0) { out.println(x...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 17
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
176b70bb51c0bbb155491cc9d1916391
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; /** * The grasshopper is located on the numeric axis at the point with coordinate x0. * * Having nothing else to do he starts jumping between integer points on the axis. * Making a jump ...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 17
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
5c5f7cbca3788821cc523892641fbf94
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.util.Scanner; import java.util.Arrays; import java.util.HashSet; import java.util.Iterator; import java.util.HashMap; import java.util.ArrayList; import java.util.Collections; import java.util.Random; import java.util.LinkedList; import java.util.TreeSet; import java.util.PriorityQueue; import ja...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 17
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
aedc1b665cec7501fd157e10c335e272
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.io.*; //import java.util.*; public class OldGrasshopper { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine()); while(t-->0) { String[] str ...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 17
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
4bff03df2fe6e599e676db54e56fecdb
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.util.*; import java.util.function.*; import java.io.*; // you can compare with output.txt and expected out public class Round753B { MyPrintWriter out; MyScanner in; // final static long FIXED_RANDOM; // static { // FIXED_RANDOM = System.currentTimeMillis(); // } final static String IMPO...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 17
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
6d6cfaaa3c577bf6010f8221b4291db4
train_108.jsonl
1635863700
The grasshopper is located on the numeric axis at the point with coordinate $$$x_0$$$.Having nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $$$x$$$ with a distance $$$d$$$ to the left moves the grasshopper to a point with a coordinate $$$x - d$$$, whi...
256 megabytes
import java.util.*; public class another { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int tc = sc.nextInt(); while(tc-- > 0){ long x = sc.nextLong(); long n = sc.nextLong(); long ans = x; if(x%2 == ...
Java
["9\n0 1\n0 2\n10 10\n10 99\n177 13\n10000000000 987654321\n-433494437 87178291199\n1 0\n-1 1"]
1 second
["-1\n1\n11\n110\n190\n9012345679\n-87611785637\n1\n0"]
NoteThe first two test cases in the example correspond to the first two jumps from the point $$$x_0 = 0$$$. Since $$$0$$$ is an even number, the first jump of length $$$1$$$ is made to the left, and the grasshopper ends up at the point $$$0 - 1 = -1$$$.Then, since $$$-1$$$ is an odd number, a jump of length $$$2$$$ is ...
Java 17
standard input
[ "math" ]
dbe12a665c374ce3745e20b4a8262eac
The first line of input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$x_0$$$ ($$$-10^{14} \leq x_0 \leq 10^{14}$$$) and $$$n$$$ ($$$0 \leq n \leq 10^{14}$$$) — the coordinate of the grasshopper's initial position and the n...
900
Print exactly $$$t$$$ lines. On the $$$i$$$-th line print one integer — the answer to the $$$i$$$-th test case — the coordinate of the point the grasshopper will be at after making $$$n$$$ jumps from the point $$$x_0$$$.
standard output
PASSED
66e5c1660a59f7f2d1dd26c5b293c50d
train_108.jsonl
1635863700
The chef has cooked $$$n$$$ dishes yet again: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. Banquet organizers consider two dishes $$$i$$$ and $$$j$$$ equal if $$$a_i=a_j$$$ and $$$b_i=b_j$$$ at the same time.The banquet organizers estimate the variety of $$$n$$$ dishes as follows...
256 megabytes
import java.util.*; import java.util.function.*; import java.io.*; // you can compare with output.txt and expected out public class Round753H { MyPrintWriter out; MyScanner in; // final static long FIXED_RANDOM; // static { // FIXED_RANDOM = System.currentTimeMillis(); // } final static String IMPO...
Java
["5\n\n3\n10 10 2\n9 9 0\n10 9 1\n\n2\n3 4 1\n5 1 2\n\n3\n7 2 5\n6 5 4\n5 5 6\n\n1\n13 42 50\n\n5\n5 7 12\n3 1 4\n7 3 7\n0 0 0\n4 1 5"]
3 seconds
["1\n1 1\n0 0\n1 0\n2\n0 1\n1 1\n2\n3 2\n0 4\n1 5\n1\n8 42\n2\n5 7\n3 1\n4 3\n0 0\n4 1"]
null
Java 17
standard input
[ "greedy", "sortings", "two pointers" ]
fdbfe3108e701123693c6e0a6bf9a539
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each test case's description is preceded by a blank line. Next comes a line that contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of dishes. Then follows $$$n$$$ lines, $$$i$$$-th o...
2,200
For each test case, print on the first line the minimum value of variety that can be achieved by eating exactly $$$m_i$$$ grams of food (for all $$$i$$$ from $$$1$$$ to $$$n$$$) from a dish $$$i$$$. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$...
standard output
PASSED
0d8d6c4c610f27fa44b1df391c76ff2b
train_108.jsonl
1635863700
The chef has cooked $$$n$$$ dishes yet again: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. Banquet organizers consider two dishes $$$i$$$ and $$$j$$$ equal if $$$a_i=a_j$$$ and $$$b_i=b_j$$$ at the same time.The banquet organizers estimate the variety of $$$n$$$ dishes as follows...
256 megabytes
// Problem: H. Banquet Preparations 2 // Contest: Codeforces - Codeforces Round #753 (Div. 3) // URL: https://codeforces.com/contest/1607/problem/H // Memory Limit: 256 MB // Time Limit: 3000 ms // // Powered by CP Editor (https://cpeditor.org) import java.io.*; import java.util.*; import static java.lang.Math.max...
Java
["5\n\n3\n10 10 2\n9 9 0\n10 9 1\n\n2\n3 4 1\n5 1 2\n\n3\n7 2 5\n6 5 4\n5 5 6\n\n1\n13 42 50\n\n5\n5 7 12\n3 1 4\n7 3 7\n0 0 0\n4 1 5"]
3 seconds
["1\n1 1\n0 0\n1 0\n2\n0 1\n1 1\n2\n3 2\n0 4\n1 5\n1\n8 42\n2\n5 7\n3 1\n4 3\n0 0\n4 1"]
null
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
fdbfe3108e701123693c6e0a6bf9a539
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each test case's description is preceded by a blank line. Next comes a line that contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of dishes. Then follows $$$n$$$ lines, $$$i$$$-th o...
2,200
For each test case, print on the first line the minimum value of variety that can be achieved by eating exactly $$$m_i$$$ grams of food (for all $$$i$$$ from $$$1$$$ to $$$n$$$) from a dish $$$i$$$. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$...
standard output
PASSED
f8cff896098967afca5cb9678e2c4744
train_108.jsonl
1635863700
The chef has cooked $$$n$$$ dishes yet again: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. Banquet organizers consider two dishes $$$i$$$ and $$$j$$$ equal if $$$a_i=a_j$$$ and $$$b_i=b_j$$$ at the same time.The banquet organizers estimate the variety of $$$n$$$ dishes as follows...
256 megabytes
/* I am dead inside Do you like NCT, sKz, BTS? 5 4 3 2 1 Moonwalk Imma knock it down like domino Is this what you want? Is this what you want? Let's ttalkbocky about that :() */ import static java.lang.Math.*; import java.util.*; import java.io.*; public class x1607H { static final int INF = Integer...
Java
["5\n\n3\n10 10 2\n9 9 0\n10 9 1\n\n2\n3 4 1\n5 1 2\n\n3\n7 2 5\n6 5 4\n5 5 6\n\n1\n13 42 50\n\n5\n5 7 12\n3 1 4\n7 3 7\n0 0 0\n4 1 5"]
3 seconds
["1\n1 1\n0 0\n1 0\n2\n0 1\n1 1\n2\n3 2\n0 4\n1 5\n1\n8 42\n2\n5 7\n3 1\n4 3\n0 0\n4 1"]
null
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
fdbfe3108e701123693c6e0a6bf9a539
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each test case's description is preceded by a blank line. Next comes a line that contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of dishes. Then follows $$$n$$$ lines, $$$i$$$-th o...
2,200
For each test case, print on the first line the minimum value of variety that can be achieved by eating exactly $$$m_i$$$ grams of food (for all $$$i$$$ from $$$1$$$ to $$$n$$$) from a dish $$$i$$$. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$...
standard output
PASSED
497c61599601a1018fb79b46d64a7b83
train_108.jsonl
1635863700
The chef has cooked $$$n$$$ dishes yet again: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. Banquet organizers consider two dishes $$$i$$$ and $$$j$$$ equal if $$$a_i=a_j$$$ and $$$b_i=b_j$$$ at the same time.The banquet organizers estimate the variety of $$$n$$$ dishes as follows...
256 megabytes
import java.io.*; import java.util.*; public class Solution{ static void main() throws Exception{ int n=sc.nextInt(); int[][]in=new int[n][]; int[][]arr=new int[n<<1][]; int[]ans=new int[n]; for(int i=0;i<n;i++){ int a=sc.nextInt(),b=sc.nextInt(),m=sc.nextInt(); in[i]=new int[]{a,b,m}; ...
Java
["5\n\n3\n10 10 2\n9 9 0\n10 9 1\n\n2\n3 4 1\n5 1 2\n\n3\n7 2 5\n6 5 4\n5 5 6\n\n1\n13 42 50\n\n5\n5 7 12\n3 1 4\n7 3 7\n0 0 0\n4 1 5"]
3 seconds
["1\n1 1\n0 0\n1 0\n2\n0 1\n1 1\n2\n3 2\n0 4\n1 5\n1\n8 42\n2\n5 7\n3 1\n4 3\n0 0\n4 1"]
null
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
fdbfe3108e701123693c6e0a6bf9a539
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each test case's description is preceded by a blank line. Next comes a line that contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of dishes. Then follows $$$n$$$ lines, $$$i$$$-th o...
2,200
For each test case, print on the first line the minimum value of variety that can be achieved by eating exactly $$$m_i$$$ grams of food (for all $$$i$$$ from $$$1$$$ to $$$n$$$) from a dish $$$i$$$. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$...
standard output
PASSED
83c46f773cbbcf7349a4ef10a5aba7aa
train_108.jsonl
1635863700
The chef has cooked $$$n$$$ dishes yet again: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. Banquet organizers consider two dishes $$$i$$$ and $$$j$$$ equal if $$$a_i=a_j$$$ and $$$b_i=b_j$$$ at the same time.The banquet organizers estimate the variety of $$$n$$$ dishes as follows...
256 megabytes
import java.util.*; import java.io.*; import java.lang.Math; public class Main { public class MainSolution extends MainSolutionT { // global vars public void init(int tests_count){} private class Item implements Comparable { public int idx, v, m; public Item(int idx, ...
Java
["5\n\n3\n10 10 2\n9 9 0\n10 9 1\n\n2\n3 4 1\n5 1 2\n\n3\n7 2 5\n6 5 4\n5 5 6\n\n1\n13 42 50\n\n5\n5 7 12\n3 1 4\n7 3 7\n0 0 0\n4 1 5"]
3 seconds
["1\n1 1\n0 0\n1 0\n2\n0 1\n1 1\n2\n3 2\n0 4\n1 5\n1\n8 42\n2\n5 7\n3 1\n4 3\n0 0\n4 1"]
null
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
fdbfe3108e701123693c6e0a6bf9a539
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each test case's description is preceded by a blank line. Next comes a line that contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of dishes. Then follows $$$n$$$ lines, $$$i$$$-th o...
2,200
For each test case, print on the first line the minimum value of variety that can be achieved by eating exactly $$$m_i$$$ grams of food (for all $$$i$$$ from $$$1$$$ to $$$n$$$) from a dish $$$i$$$. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$...
standard output
PASSED
6cde2450823e573308b58c9bdccba0ac
train_108.jsonl
1635863700
The chef has cooked $$$n$$$ dishes yet again: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. Banquet organizers consider two dishes $$$i$$$ and $$$j$$$ equal if $$$a_i=a_j$$$ and $$$b_i=b_j$$$ at the same time.The banquet organizers estimate the variety of $$$n$$$ dishes as follows...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String args[]) {new Main().run();} FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); void run() { for(int q=ni();q>0;q--){ work(); } out.flus...
Java
["5\n\n3\n10 10 2\n9 9 0\n10 9 1\n\n2\n3 4 1\n5 1 2\n\n3\n7 2 5\n6 5 4\n5 5 6\n\n1\n13 42 50\n\n5\n5 7 12\n3 1 4\n7 3 7\n0 0 0\n4 1 5"]
3 seconds
["1\n1 1\n0 0\n1 0\n2\n0 1\n1 1\n2\n3 2\n0 4\n1 5\n1\n8 42\n2\n5 7\n3 1\n4 3\n0 0\n4 1"]
null
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
fdbfe3108e701123693c6e0a6bf9a539
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each test case's description is preceded by a blank line. Next comes a line that contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of dishes. Then follows $$$n$$$ lines, $$$i$$$-th o...
2,200
For each test case, print on the first line the minimum value of variety that can be achieved by eating exactly $$$m_i$$$ grams of food (for all $$$i$$$ from $$$1$$$ to $$$n$$$) from a dish $$$i$$$. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$...
standard output
PASSED
53eef17f5b90e9fdcb079a05e1b98b49
train_108.jsonl
1635863700
The chef has cooked $$$n$$$ dishes yet again: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. Banquet organizers consider two dishes $$$i$$$ and $$$j$$$ equal if $$$a_i=a_j$$$ and $$$b_i=b_j$$$ at the same time.The banquet organizers estimate the variety of $$$n$$$ dishes as follows...
256 megabytes
import java.io.*; import java.util.*; public class Solution{ static void main() throws Exception{ int n=sc.nextInt(); int[][]in=new int[n][]; int[][]arr=new int[n<<1][]; int[]ans=new int[n]; for(int i=0;i<n;i++){ int a=sc.nextInt(),b=sc.nextInt(),m=sc.nextInt(); in[i]=new int[]{a,b,m}; ...
Java
["5\n\n3\n10 10 2\n9 9 0\n10 9 1\n\n2\n3 4 1\n5 1 2\n\n3\n7 2 5\n6 5 4\n5 5 6\n\n1\n13 42 50\n\n5\n5 7 12\n3 1 4\n7 3 7\n0 0 0\n4 1 5"]
3 seconds
["1\n1 1\n0 0\n1 0\n2\n0 1\n1 1\n2\n3 2\n0 4\n1 5\n1\n8 42\n2\n5 7\n3 1\n4 3\n0 0\n4 1"]
null
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
fdbfe3108e701123693c6e0a6bf9a539
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each test case's description is preceded by a blank line. Next comes a line that contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of dishes. Then follows $$$n$$$ lines, $$$i$$$-th o...
2,200
For each test case, print on the first line the minimum value of variety that can be achieved by eating exactly $$$m_i$$$ grams of food (for all $$$i$$$ from $$$1$$$ to $$$n$$$) from a dish $$$i$$$. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$...
standard output
PASSED
b34e88d69e17aacc05f089c6829ec0e9
train_108.jsonl
1635863700
The chef has cooked $$$n$$$ dishes yet again: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. Banquet organizers consider two dishes $$$i$$$ and $$$j$$$ equal if $$$a_i=a_j$$$ and $$$b_i=b_j$$$ at the same time.The banquet organizers estimate the variety of $$$n$$$ dishes as follows...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.text.DecimalFormat; import java.util.*; import java.util.concurrent.ThreadLocalRandom; import java.util.stream.Collectors; import java.util.stream.IntStream; import java.util.st...
Java
["5\n\n3\n10 10 2\n9 9 0\n10 9 1\n\n2\n3 4 1\n5 1 2\n\n3\n7 2 5\n6 5 4\n5 5 6\n\n1\n13 42 50\n\n5\n5 7 12\n3 1 4\n7 3 7\n0 0 0\n4 1 5"]
3 seconds
["1\n1 1\n0 0\n1 0\n2\n0 1\n1 1\n2\n3 2\n0 4\n1 5\n1\n8 42\n2\n5 7\n3 1\n4 3\n0 0\n4 1"]
null
Java 8
standard input
[ "greedy", "sortings", "two pointers" ]
fdbfe3108e701123693c6e0a6bf9a539
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each test case's description is preceded by a blank line. Next comes a line that contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of dishes. Then follows $$$n$$$ lines, $$$i$$$-th o...
2,200
For each test case, print on the first line the minimum value of variety that can be achieved by eating exactly $$$m_i$$$ grams of food (for all $$$i$$$ from $$$1$$$ to $$$n$$$) from a dish $$$i$$$. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$...
standard output
PASSED
6a822b5200ca6b164852dfbb15faa0f3
train_108.jsonl
1635863700
The chef has cooked $$$n$$$ dishes yet again: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. Banquet organizers consider two dishes $$$i$$$ and $$$j$$$ equal if $$$a_i=a_j$$$ and $$$b_i=b_j$$$ at the same time.The banquet organizers estimate the variety of $$$n$$$ dishes as follows...
256 megabytes
//package com.example.practice.codeforces.sc2200; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.StringTokenizer; //H. Banquet Preparations ...
Java
["5\n\n3\n10 10 2\n9 9 0\n10 9 1\n\n2\n3 4 1\n5 1 2\n\n3\n7 2 5\n6 5 4\n5 5 6\n\n1\n13 42 50\n\n5\n5 7 12\n3 1 4\n7 3 7\n0 0 0\n4 1 5"]
3 seconds
["1\n1 1\n0 0\n1 0\n2\n0 1\n1 1\n2\n3 2\n0 4\n1 5\n1\n8 42\n2\n5 7\n3 1\n4 3\n0 0\n4 1"]
null
Java 11
standard input
[ "greedy", "sortings", "two pointers" ]
fdbfe3108e701123693c6e0a6bf9a539
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each test case's description is preceded by a blank line. Next comes a line that contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of dishes. Then follows $$$n$$$ lines, $$$i$$$-th o...
2,200
For each test case, print on the first line the minimum value of variety that can be achieved by eating exactly $$$m_i$$$ grams of food (for all $$$i$$$ from $$$1$$$ to $$$n$$$) from a dish $$$i$$$. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$...
standard output
PASSED
7c9d47a2ce08d330c9646293f42e0c51
train_108.jsonl
1635863700
The chef has cooked $$$n$$$ dishes yet again: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. Banquet organizers consider two dishes $$$i$$$ and $$$j$$$ equal if $$$a_i=a_j$$$ and $$$b_i=b_j$$$ at the same time.The banquet organizers estimate the variety of $$$n$$$ dishes as follows...
256 megabytes
//package com.example.practice.codeforces.sc2200; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.StringTokenizer; //H. Banquet Preparations ...
Java
["5\n\n3\n10 10 2\n9 9 0\n10 9 1\n\n2\n3 4 1\n5 1 2\n\n3\n7 2 5\n6 5 4\n5 5 6\n\n1\n13 42 50\n\n5\n5 7 12\n3 1 4\n7 3 7\n0 0 0\n4 1 5"]
3 seconds
["1\n1 1\n0 0\n1 0\n2\n0 1\n1 1\n2\n3 2\n0 4\n1 5\n1\n8 42\n2\n5 7\n3 1\n4 3\n0 0\n4 1"]
null
Java 11
standard input
[ "greedy", "sortings", "two pointers" ]
fdbfe3108e701123693c6e0a6bf9a539
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each test case's description is preceded by a blank line. Next comes a line that contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of dishes. Then follows $$$n$$$ lines, $$$i$$$-th o...
2,200
For each test case, print on the first line the minimum value of variety that can be achieved by eating exactly $$$m_i$$$ grams of food (for all $$$i$$$ from $$$1$$$ to $$$n$$$) from a dish $$$i$$$. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$...
standard output
PASSED
f58afd26b2700141055d5aedc8832d50
train_108.jsonl
1635863700
The chef has cooked $$$n$$$ dishes yet again: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. Banquet organizers consider two dishes $$$i$$$ and $$$j$$$ equal if $$$a_i=a_j$$$ and $$$b_i=b_j$$$ at the same time.The banquet organizers estimate the variety of $$$n$$$ dishes as follows...
256 megabytes
import java.util.*; import java.io.*; import static java.lang.Math.*; public class ACMIND { static FastReader scan; static PrintWriter pw; static long MOD = 1_000_000_007; static long INF = 2_000_000_000_000_000_000L; static long inf = 2_000_000_000; public static void main(String[] ...
Java
["5\n\n3\n10 10 2\n9 9 0\n10 9 1\n\n2\n3 4 1\n5 1 2\n\n3\n7 2 5\n6 5 4\n5 5 6\n\n1\n13 42 50\n\n5\n5 7 12\n3 1 4\n7 3 7\n0 0 0\n4 1 5"]
3 seconds
["1\n1 1\n0 0\n1 0\n2\n0 1\n1 1\n2\n3 2\n0 4\n1 5\n1\n8 42\n2\n5 7\n3 1\n4 3\n0 0\n4 1"]
null
Java 11
standard input
[ "greedy", "sortings", "two pointers" ]
fdbfe3108e701123693c6e0a6bf9a539
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each test case's description is preceded by a blank line. Next comes a line that contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of dishes. Then follows $$$n$$$ lines, $$$i$$$-th o...
2,200
For each test case, print on the first line the minimum value of variety that can be achieved by eating exactly $$$m_i$$$ grams of food (for all $$$i$$$ from $$$1$$$ to $$$n$$$) from a dish $$$i$$$. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$...
standard output
PASSED
114a500447edd9931a77cf63815ac3d5
train_108.jsonl
1635863700
The chef has cooked $$$n$$$ dishes yet again: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. Banquet organizers consider two dishes $$$i$$$ and $$$j$$$ equal if $$$a_i=a_j$$$ and $$$b_i=b_j$$$ at the same time.The banquet organizers estimate the variety of $$$n$$$ dishes as follows...
256 megabytes
// package c1607; import java.io.File; import java.lang.invoke.MethodHandles; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Random; import java.util.Scanner; // // Codeforces Round #753 (Div. 3) 2021-11-02 06:35 // H. ...
Java
["5\n\n3\n10 10 2\n9 9 0\n10 9 1\n\n2\n3 4 1\n5 1 2\n\n3\n7 2 5\n6 5 4\n5 5 6\n\n1\n13 42 50\n\n5\n5 7 12\n3 1 4\n7 3 7\n0 0 0\n4 1 5"]
3 seconds
["1\n1 1\n0 0\n1 0\n2\n0 1\n1 1\n2\n3 2\n0 4\n1 5\n1\n8 42\n2\n5 7\n3 1\n4 3\n0 0\n4 1"]
null
Java 11
standard input
[ "greedy", "sortings", "two pointers" ]
fdbfe3108e701123693c6e0a6bf9a539
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each test case's description is preceded by a blank line. Next comes a line that contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of dishes. Then follows $$$n$$$ lines, $$$i$$$-th o...
2,200
For each test case, print on the first line the minimum value of variety that can be achieved by eating exactly $$$m_i$$$ grams of food (for all $$$i$$$ from $$$1$$$ to $$$n$$$) from a dish $$$i$$$. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$...
standard output
PASSED
0d86b4c33aaba07427c81d30f7324805
train_108.jsonl
1635863700
The chef has cooked $$$n$$$ dishes yet again: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. Banquet organizers consider two dishes $$$i$$$ and $$$j$$$ equal if $$$a_i=a_j$$$ and $$$b_i=b_j$$$ at the same time.The banquet organizers estimate the variety of $$$n$$$ dishes as follows...
256 megabytes
import java.io.DataInputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; import java.util.Set; import java.util.TreeSet; public class Main { private static Node[] nodes; private static void ru...
Java
["5\n\n3\n10 10 2\n9 9 0\n10 9 1\n\n2\n3 4 1\n5 1 2\n\n3\n7 2 5\n6 5 4\n5 5 6\n\n1\n13 42 50\n\n5\n5 7 12\n3 1 4\n7 3 7\n0 0 0\n4 1 5"]
3 seconds
["1\n1 1\n0 0\n1 0\n2\n0 1\n1 1\n2\n3 2\n0 4\n1 5\n1\n8 42\n2\n5 7\n3 1\n4 3\n0 0\n4 1"]
null
Java 11
standard input
[ "greedy", "sortings", "two pointers" ]
fdbfe3108e701123693c6e0a6bf9a539
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each test case's description is preceded by a blank line. Next comes a line that contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of dishes. Then follows $$$n$$$ lines, $$$i$$$-th o...
2,200
For each test case, print on the first line the minimum value of variety that can be achieved by eating exactly $$$m_i$$$ grams of food (for all $$$i$$$ from $$$1$$$ to $$$n$$$) from a dish $$$i$$$. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$...
standard output
PASSED
024faccf88dbaee0b57c359e5d468230
train_108.jsonl
1635863700
The chef has cooked $$$n$$$ dishes yet again: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. Banquet organizers consider two dishes $$$i$$$ and $$$j$$$ equal if $$$a_i=a_j$$$ and $$$b_i=b_j$$$ at the same time.The banquet organizers estimate the variety of $$$n$$$ dishes as follows...
256 megabytes
import java.io.*; import java.util.*; public class gotoJapan { public static void main(String[] args) throws java.lang.Exception { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream)...
Java
["5\n\n3\n10 10 2\n9 9 0\n10 9 1\n\n2\n3 4 1\n5 1 2\n\n3\n7 2 5\n6 5 4\n5 5 6\n\n1\n13 42 50\n\n5\n5 7 12\n3 1 4\n7 3 7\n0 0 0\n4 1 5"]
3 seconds
["1\n1 1\n0 0\n1 0\n2\n0 1\n1 1\n2\n3 2\n0 4\n1 5\n1\n8 42\n2\n5 7\n3 1\n4 3\n0 0\n4 1"]
null
Java 11
standard input
[ "greedy", "sortings", "two pointers" ]
fdbfe3108e701123693c6e0a6bf9a539
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each test case's description is preceded by a blank line. Next comes a line that contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of dishes. Then follows $$$n$$$ lines, $$$i$$$-th o...
2,200
For each test case, print on the first line the minimum value of variety that can be achieved by eating exactly $$$m_i$$$ grams of food (for all $$$i$$$ from $$$1$$$ to $$$n$$$) from a dish $$$i$$$. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$...
standard output
PASSED
cd43a7350c14e7b2d73b816ba4cf3ab1
train_108.jsonl
1635863700
The chef has cooked $$$n$$$ dishes yet again: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. Banquet organizers consider two dishes $$$i$$$ and $$$j$$$ equal if $$$a_i=a_j$$$ and $$$b_i=b_j$$$ at the same time.The banquet organizers estimate the variety of $$$n$$$ dishes as follows...
256 megabytes
import java.io.DataInputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; import java.util.Set; import java.util.TreeSet; public class Main { private static Node[] nodes; private static void ru...
Java
["5\n\n3\n10 10 2\n9 9 0\n10 9 1\n\n2\n3 4 1\n5 1 2\n\n3\n7 2 5\n6 5 4\n5 5 6\n\n1\n13 42 50\n\n5\n5 7 12\n3 1 4\n7 3 7\n0 0 0\n4 1 5"]
3 seconds
["1\n1 1\n0 0\n1 0\n2\n0 1\n1 1\n2\n3 2\n0 4\n1 5\n1\n8 42\n2\n5 7\n3 1\n4 3\n0 0\n4 1"]
null
Java 11
standard input
[ "greedy", "sortings", "two pointers" ]
fdbfe3108e701123693c6e0a6bf9a539
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each test case's description is preceded by a blank line. Next comes a line that contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of dishes. Then follows $$$n$$$ lines, $$$i$$$-th o...
2,200
For each test case, print on the first line the minimum value of variety that can be achieved by eating exactly $$$m_i$$$ grams of food (for all $$$i$$$ from $$$1$$$ to $$$n$$$) from a dish $$$i$$$. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$...
standard output
PASSED
07633fe85befac7b74b24b27e2335866
train_108.jsonl
1635863700
The chef has cooked $$$n$$$ dishes yet again: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. Banquet organizers consider two dishes $$$i$$$ and $$$j$$$ equal if $$$a_i=a_j$$$ and $$$b_i=b_j$$$ at the same time.The banquet organizers estimate the variety of $$$n$$$ dishes as follows...
256 megabytes
//package banquetpreparations2; import java.util.*; import java.io.*; public class banquetpreparations2 { public static void main(String[] args) throws IOException { BufferedReader fin = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(fin.readLine()); StringBuilder fout ...
Java
["5\n\n3\n10 10 2\n9 9 0\n10 9 1\n\n2\n3 4 1\n5 1 2\n\n3\n7 2 5\n6 5 4\n5 5 6\n\n1\n13 42 50\n\n5\n5 7 12\n3 1 4\n7 3 7\n0 0 0\n4 1 5"]
3 seconds
["1\n1 1\n0 0\n1 0\n2\n0 1\n1 1\n2\n3 2\n0 4\n1 5\n1\n8 42\n2\n5 7\n3 1\n4 3\n0 0\n4 1"]
null
Java 11
standard input
[ "greedy", "sortings", "two pointers" ]
fdbfe3108e701123693c6e0a6bf9a539
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each test case's description is preceded by a blank line. Next comes a line that contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of dishes. Then follows $$$n$$$ lines, $$$i$$$-th o...
2,200
For each test case, print on the first line the minimum value of variety that can be achieved by eating exactly $$$m_i$$$ grams of food (for all $$$i$$$ from $$$1$$$ to $$$n$$$) from a dish $$$i$$$. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$...
standard output
PASSED
956743680ca3ff018b6fb6566663c8f9
train_108.jsonl
1635863700
The chef has cooked $$$n$$$ dishes yet again: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. Banquet organizers consider two dishes $$$i$$$ and $$$j$$$ equal if $$$a_i=a_j$$$ and $$$b_i=b_j$$$ at the same time.The banquet organizers estimate the variety of $$$n$$$ dishes as follows...
256 megabytes
import java.io.DataInputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; import java.util.Set; import java.util.TreeSet; public class Main { private static Node[] nodes; private static void...
Java
["5\n\n3\n10 10 2\n9 9 0\n10 9 1\n\n2\n3 4 1\n5 1 2\n\n3\n7 2 5\n6 5 4\n5 5 6\n\n1\n13 42 50\n\n5\n5 7 12\n3 1 4\n7 3 7\n0 0 0\n4 1 5"]
3 seconds
["1\n1 1\n0 0\n1 0\n2\n0 1\n1 1\n2\n3 2\n0 4\n1 5\n1\n8 42\n2\n5 7\n3 1\n4 3\n0 0\n4 1"]
null
Java 11
standard input
[ "greedy", "sortings", "two pointers" ]
fdbfe3108e701123693c6e0a6bf9a539
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each test case's description is preceded by a blank line. Next comes a line that contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of dishes. Then follows $$$n$$$ lines, $$$i$$$-th o...
2,200
For each test case, print on the first line the minimum value of variety that can be achieved by eating exactly $$$m_i$$$ grams of food (for all $$$i$$$ from $$$1$$$ to $$$n$$$) from a dish $$$i$$$. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$...
standard output
PASSED
2b82b96cead364cd830ea6a1a722333d
train_108.jsonl
1635863700
The chef has cooked $$$n$$$ dishes yet again: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. Banquet organizers consider two dishes $$$i$$$ and $$$j$$$ equal if $$$a_i=a_j$$$ and $$$b_i=b_j$$$ at the same time.The banquet organizers estimate the variety of $$$n$$$ dishes as follows...
256 megabytes
import java.io.DataInputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; import java.util.Set; import java.util.TreeSet; public class Main { private static Node[] nodes; private static void ru...
Java
["5\n\n3\n10 10 2\n9 9 0\n10 9 1\n\n2\n3 4 1\n5 1 2\n\n3\n7 2 5\n6 5 4\n5 5 6\n\n1\n13 42 50\n\n5\n5 7 12\n3 1 4\n7 3 7\n0 0 0\n4 1 5"]
3 seconds
["1\n1 1\n0 0\n1 0\n2\n0 1\n1 1\n2\n3 2\n0 4\n1 5\n1\n8 42\n2\n5 7\n3 1\n4 3\n0 0\n4 1"]
null
Java 11
standard input
[ "greedy", "sortings", "two pointers" ]
fdbfe3108e701123693c6e0a6bf9a539
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each test case's description is preceded by a blank line. Next comes a line that contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of dishes. Then follows $$$n$$$ lines, $$$i$$$-th o...
2,200
For each test case, print on the first line the minimum value of variety that can be achieved by eating exactly $$$m_i$$$ grams of food (for all $$$i$$$ from $$$1$$$ to $$$n$$$) from a dish $$$i$$$. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$...
standard output
PASSED
e8461e57663a00dc80057a2dd595eca6
train_108.jsonl
1635863700
The chef has cooked $$$n$$$ dishes yet again: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. Banquet organizers consider two dishes $$$i$$$ and $$$j$$$ equal if $$$a_i=a_j$$$ and $$$b_i=b_j$$$ at the same time.The banquet organizers estimate the variety of $$$n$$$ dishes as follows...
256 megabytes
import java.io.*; import java.util.*; public class BMain { public static void main(String[] args) { QuickReader in = new QuickReader(System.in); try(PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));) { new BMain().solve(in, out); } } public void solve(QuickR...
Java
["5\n\n3\n10 10 2\n9 9 0\n10 9 1\n\n2\n3 4 1\n5 1 2\n\n3\n7 2 5\n6 5 4\n5 5 6\n\n1\n13 42 50\n\n5\n5 7 12\n3 1 4\n7 3 7\n0 0 0\n4 1 5"]
3 seconds
["1\n1 1\n0 0\n1 0\n2\n0 1\n1 1\n2\n3 2\n0 4\n1 5\n1\n8 42\n2\n5 7\n3 1\n4 3\n0 0\n4 1"]
null
Java 11
standard input
[ "greedy", "sortings", "two pointers" ]
fdbfe3108e701123693c6e0a6bf9a539
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each test case's description is preceded by a blank line. Next comes a line that contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of dishes. Then follows $$$n$$$ lines, $$$i$$$-th o...
2,200
For each test case, print on the first line the minimum value of variety that can be achieved by eating exactly $$$m_i$$$ grams of food (for all $$$i$$$ from $$$1$$$ to $$$n$$$) from a dish $$$i$$$. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$...
standard output
PASSED
f223041068d4c9492e32ad6cd41af105
train_108.jsonl
1635863700
The chef has cooked $$$n$$$ dishes yet again: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. Banquet organizers consider two dishes $$$i$$$ and $$$j$$$ equal if $$$a_i=a_j$$$ and $$$b_i=b_j$$$ at the same time.The banquet organizers estimate the variety of $$$n$$$ dishes as follows...
256 megabytes
import java.io.*; import java.util.*; public class CF1607H extends PrintWriter { CF1607H() { super(System.out); } Scanner sc = new Scanner(System.in); public static void main(String[] $) { CF1607H o = new CF1607H(); o.main(); o.flush(); } static final int INF = 0x3f3f3f3f; void main() { int t = sc.nextInt()...
Java
["5\n\n3\n10 10 2\n9 9 0\n10 9 1\n\n2\n3 4 1\n5 1 2\n\n3\n7 2 5\n6 5 4\n5 5 6\n\n1\n13 42 50\n\n5\n5 7 12\n3 1 4\n7 3 7\n0 0 0\n4 1 5"]
3 seconds
["1\n1 1\n0 0\n1 0\n2\n0 1\n1 1\n2\n3 2\n0 4\n1 5\n1\n8 42\n2\n5 7\n3 1\n4 3\n0 0\n4 1"]
null
Java 11
standard input
[ "greedy", "sortings", "two pointers" ]
fdbfe3108e701123693c6e0a6bf9a539
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Each test case's description is preceded by a blank line. Next comes a line that contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the number of dishes. Then follows $$$n$$$ lines, $$$i$$$-th o...
2,200
For each test case, print on the first line the minimum value of variety that can be achieved by eating exactly $$$m_i$$$ grams of food (for all $$$i$$$ from $$$1$$$ to $$$n$$$) from a dish $$$i$$$. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$...
standard output
PASSED
900dbbcbc15ec829abf4489c2f7f1def
train_108.jsonl
1635863700
A known chef has prepared $$$n$$$ dishes: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. The banquet organizers estimate the balance of $$$n$$$ dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat....
256 megabytes
import java.util.*; import java.util.function.*; import java.io.*; // you can compare with output.txt and expected out public class Round753G { MyPrintWriter out; MyScanner in; // final static long FIXED_RANDOM; // static { // FIXED_RANDOM = System.currentTimeMillis(); // } final static String IMPO...
Java
["8\n\n1 5\n3 4\n\n1 6\n3 4\n\n2 2\n1 3\n4 2\n\n2 4\n1 3\n1 7\n\n3 6\n1 7\n1 8\n1 9\n\n3 6\n1 8\n1 9\n30 10\n\n3 4\n3 1\n3 2\n4 1\n\n5 4\n0 7\n6 4\n0 8\n4 1\n5 3"]
2 seconds
["0\n2 3\n1\n3 3\n0\n1 1\n1 1\n2\n1 3\n0 4\n3\n0 6\n0 6\n0 6\n7\n1 5\n1 5\n6 0\n0\n3 1\n3 1\n3 1\n0\n0 4\n2 2\n0 4\n3 1\n1 3"]
null
Java 17
standard input
[ "greedy" ]
c63f5994543b136305a7ae2b9c744e13
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of the test cases. Each test case's description is preceded by a blank line. Next comes a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$0 \leq m \leq 10^6$$$). The next $$$n$$$ lines ...
2,200
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly $$$m$$$ grams of food from each dish. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \leq x_i \leq a_i$$$; $$$0 \leq y_i \l...
standard output
PASSED
ecd37863c384d81313b893295f619543
train_108.jsonl
1635863700
A known chef has prepared $$$n$$$ dishes: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. The banquet organizers estimate the balance of $$$n$$$ dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat....
256 megabytes
import java.io.DataInputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; public class Main { private static void run() throws IOException { int n, m; n = in.nextInt(); m = in.nextInt(); long count_remain = 0; l...
Java
["8\n\n1 5\n3 4\n\n1 6\n3 4\n\n2 2\n1 3\n4 2\n\n2 4\n1 3\n1 7\n\n3 6\n1 7\n1 8\n1 9\n\n3 6\n1 8\n1 9\n30 10\n\n3 4\n3 1\n3 2\n4 1\n\n5 4\n0 7\n6 4\n0 8\n4 1\n5 3"]
2 seconds
["0\n2 3\n1\n3 3\n0\n1 1\n1 1\n2\n1 3\n0 4\n3\n0 6\n0 6\n0 6\n7\n1 5\n1 5\n6 0\n0\n3 1\n3 1\n3 1\n0\n0 4\n2 2\n0 4\n3 1\n1 3"]
null
Java 11
standard input
[ "greedy" ]
c63f5994543b136305a7ae2b9c744e13
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of the test cases. Each test case's description is preceded by a blank line. Next comes a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$0 \leq m \leq 10^6$$$). The next $$$n$$$ lines ...
2,200
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly $$$m$$$ grams of food from each dish. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \leq x_i \leq a_i$$$; $$$0 \leq y_i \l...
standard output
PASSED
8e0e8cf442488b6381933ba7447b0e28
train_108.jsonl
1635863700
A known chef has prepared $$$n$$$ dishes: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. The banquet organizers estimate the balance of $$$n$$$ dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat....
256 megabytes
//Avoid division by decimal digits :). Always try to multiply with whole numbers or fractions instead. //if getting wrong answer then use long/double instead of int/float //e + e = o; o + o = e; e + o = o; //see stuff in a jugaad way... if you are being complicated you are doing it wrong //If a=b+1 and b is even, t...
Java
["8\n\n1 5\n3 4\n\n1 6\n3 4\n\n2 2\n1 3\n4 2\n\n2 4\n1 3\n1 7\n\n3 6\n1 7\n1 8\n1 9\n\n3 6\n1 8\n1 9\n30 10\n\n3 4\n3 1\n3 2\n4 1\n\n5 4\n0 7\n6 4\n0 8\n4 1\n5 3"]
2 seconds
["0\n2 3\n1\n3 3\n0\n1 1\n1 1\n2\n1 3\n0 4\n3\n0 6\n0 6\n0 6\n7\n1 5\n1 5\n6 0\n0\n3 1\n3 1\n3 1\n0\n0 4\n2 2\n0 4\n3 1\n1 3"]
null
Java 11
standard input
[ "greedy" ]
c63f5994543b136305a7ae2b9c744e13
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of the test cases. Each test case's description is preceded by a blank line. Next comes a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$0 \leq m \leq 10^6$$$). The next $$$n$$$ lines ...
2,200
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly $$$m$$$ grams of food from each dish. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \leq x_i \leq a_i$$$; $$$0 \leq y_i \l...
standard output
PASSED
d48cc7c9dd038d484a63859472c49b94
train_108.jsonl
1635863700
A known chef has prepared $$$n$$$ dishes: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. The banquet organizers estimate the balance of $$$n$$$ dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat....
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.Random; import java.util.StringTokenizer; public class codeforces_753_G { private static void solve(FastIOAdapter io) { int n = io.nextInt(); int m = io.nextInt(); int[][] q = new int[n][2]; long canEatA = 0; ...
Java
["8\n\n1 5\n3 4\n\n1 6\n3 4\n\n2 2\n1 3\n4 2\n\n2 4\n1 3\n1 7\n\n3 6\n1 7\n1 8\n1 9\n\n3 6\n1 8\n1 9\n30 10\n\n3 4\n3 1\n3 2\n4 1\n\n5 4\n0 7\n6 4\n0 8\n4 1\n5 3"]
2 seconds
["0\n2 3\n1\n3 3\n0\n1 1\n1 1\n2\n1 3\n0 4\n3\n0 6\n0 6\n0 6\n7\n1 5\n1 5\n6 0\n0\n3 1\n3 1\n3 1\n0\n0 4\n2 2\n0 4\n3 1\n1 3"]
null
Java 11
standard input
[ "greedy" ]
c63f5994543b136305a7ae2b9c744e13
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of the test cases. Each test case's description is preceded by a blank line. Next comes a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$0 \leq m \leq 10^6$$$). The next $$$n$$$ lines ...
2,200
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly $$$m$$$ grams of food from each dish. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \leq x_i \leq a_i$$$; $$$0 \leq y_i \l...
standard output
PASSED
628c187e37102488f4ce7e5fca58af03
train_108.jsonl
1635863700
A known chef has prepared $$$n$$$ dishes: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. The banquet organizers estimate the balance of $$$n$$$ dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat....
256 megabytes
//package com.example.practice.codeforces.sc2200; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; //G. Banquet Preparations 1 public class Solution14 { public static void main (String [] args) throws IOExcep...
Java
["8\n\n1 5\n3 4\n\n1 6\n3 4\n\n2 2\n1 3\n4 2\n\n2 4\n1 3\n1 7\n\n3 6\n1 7\n1 8\n1 9\n\n3 6\n1 8\n1 9\n30 10\n\n3 4\n3 1\n3 2\n4 1\n\n5 4\n0 7\n6 4\n0 8\n4 1\n5 3"]
2 seconds
["0\n2 3\n1\n3 3\n0\n1 1\n1 1\n2\n1 3\n0 4\n3\n0 6\n0 6\n0 6\n7\n1 5\n1 5\n6 0\n0\n3 1\n3 1\n3 1\n0\n0 4\n2 2\n0 4\n3 1\n1 3"]
null
Java 11
standard input
[ "greedy" ]
c63f5994543b136305a7ae2b9c744e13
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of the test cases. Each test case's description is preceded by a blank line. Next comes a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$0 \leq m \leq 10^6$$$). The next $$$n$$$ lines ...
2,200
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly $$$m$$$ grams of food from each dish. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \leq x_i \leq a_i$$$; $$$0 \leq y_i \l...
standard output
PASSED
15785461e195831311bc53fe9415df72
train_108.jsonl
1635863700
A known chef has prepared $$$n$$$ dishes: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. The banquet organizers estimate the balance of $$$n$$$ dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat....
256 megabytes
//package com.example.practice.codeforces.sc2200; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; //G. Banquet Preparations 1 public class Solution14 { pu...
Java
["8\n\n1 5\n3 4\n\n1 6\n3 4\n\n2 2\n1 3\n4 2\n\n2 4\n1 3\n1 7\n\n3 6\n1 7\n1 8\n1 9\n\n3 6\n1 8\n1 9\n30 10\n\n3 4\n3 1\n3 2\n4 1\n\n5 4\n0 7\n6 4\n0 8\n4 1\n5 3"]
2 seconds
["0\n2 3\n1\n3 3\n0\n1 1\n1 1\n2\n1 3\n0 4\n3\n0 6\n0 6\n0 6\n7\n1 5\n1 5\n6 0\n0\n3 1\n3 1\n3 1\n0\n0 4\n2 2\n0 4\n3 1\n1 3"]
null
Java 11
standard input
[ "greedy" ]
c63f5994543b136305a7ae2b9c744e13
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of the test cases. Each test case's description is preceded by a blank line. Next comes a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$0 \leq m \leq 10^6$$$). The next $$$n$$$ lines ...
2,200
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly $$$m$$$ grams of food from each dish. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \leq x_i \leq a_i$$$; $$$0 \leq y_i \l...
standard output
PASSED
9ccccfb38a2b653041d20494fe23b868
train_108.jsonl
1635863700
A known chef has prepared $$$n$$$ dishes: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. The banquet organizers estimate the balance of $$$n$$$ dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat....
256 megabytes
import java.util.*; import java.io.*; import static java.lang.Math.*; public class ACMIND { static FastReader scan; static PrintWriter pw; static long MOD = 1_000_000_007; static long INF = 2_000_000_000_000_000_000L; static long inf = 2_000_000_000; public static void main(String[] ...
Java
["8\n\n1 5\n3 4\n\n1 6\n3 4\n\n2 2\n1 3\n4 2\n\n2 4\n1 3\n1 7\n\n3 6\n1 7\n1 8\n1 9\n\n3 6\n1 8\n1 9\n30 10\n\n3 4\n3 1\n3 2\n4 1\n\n5 4\n0 7\n6 4\n0 8\n4 1\n5 3"]
2 seconds
["0\n2 3\n1\n3 3\n0\n1 1\n1 1\n2\n1 3\n0 4\n3\n0 6\n0 6\n0 6\n7\n1 5\n1 5\n6 0\n0\n3 1\n3 1\n3 1\n0\n0 4\n2 2\n0 4\n3 1\n1 3"]
null
Java 11
standard input
[ "greedy" ]
c63f5994543b136305a7ae2b9c744e13
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of the test cases. Each test case's description is preceded by a blank line. Next comes a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$0 \leq m \leq 10^6$$$). The next $$$n$$$ lines ...
2,200
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly $$$m$$$ grams of food from each dish. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \leq x_i \leq a_i$$$; $$$0 \leq y_i \l...
standard output
PASSED
998354946d75f3ec7293eb46a334ba1e
train_108.jsonl
1635863700
A known chef has prepared $$$n$$$ dishes: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. The banquet organizers estimate the balance of $$$n$$$ dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat....
256 megabytes
// package c1607; import java.io.File; import java.lang.invoke.MethodHandles; import java.util.Random; import java.util.Scanner; // // Codeforces Round #753 (Div. 3) 2021-11-02 06:35 // G. Banquet Preparations 1 // https://codeforces.com/contest/1607/problem/G // time limit per test 2 seconds; memory limit per test 2...
Java
["8\n\n1 5\n3 4\n\n1 6\n3 4\n\n2 2\n1 3\n4 2\n\n2 4\n1 3\n1 7\n\n3 6\n1 7\n1 8\n1 9\n\n3 6\n1 8\n1 9\n30 10\n\n3 4\n3 1\n3 2\n4 1\n\n5 4\n0 7\n6 4\n0 8\n4 1\n5 3"]
2 seconds
["0\n2 3\n1\n3 3\n0\n1 1\n1 1\n2\n1 3\n0 4\n3\n0 6\n0 6\n0 6\n7\n1 5\n1 5\n6 0\n0\n3 1\n3 1\n3 1\n0\n0 4\n2 2\n0 4\n3 1\n1 3"]
null
Java 11
standard input
[ "greedy" ]
c63f5994543b136305a7ae2b9c744e13
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of the test cases. Each test case's description is preceded by a blank line. Next comes a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$0 \leq m \leq 10^6$$$). The next $$$n$$$ lines ...
2,200
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly $$$m$$$ grams of food from each dish. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \leq x_i \leq a_i$$$; $$$0 \leq y_i \l...
standard output
PASSED
2ee08643660f326ff6b9124f93bedee9
train_108.jsonl
1635863700
A known chef has prepared $$$n$$$ dishes: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. The banquet organizers estimate the balance of $$$n$$$ dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat....
256 megabytes
import java.util.*; import java.io.*; public class G_1607 { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int t = sc.nextInt(); while(t-->0) { int n = sc.nextInt(), om = sc.nextInt(); int[] a = n...
Java
["8\n\n1 5\n3 4\n\n1 6\n3 4\n\n2 2\n1 3\n4 2\n\n2 4\n1 3\n1 7\n\n3 6\n1 7\n1 8\n1 9\n\n3 6\n1 8\n1 9\n30 10\n\n3 4\n3 1\n3 2\n4 1\n\n5 4\n0 7\n6 4\n0 8\n4 1\n5 3"]
2 seconds
["0\n2 3\n1\n3 3\n0\n1 1\n1 1\n2\n1 3\n0 4\n3\n0 6\n0 6\n0 6\n7\n1 5\n1 5\n6 0\n0\n3 1\n3 1\n3 1\n0\n0 4\n2 2\n0 4\n3 1\n1 3"]
null
Java 11
standard input
[ "greedy" ]
c63f5994543b136305a7ae2b9c744e13
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of the test cases. Each test case's description is preceded by a blank line. Next comes a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$0 \leq m \leq 10^6$$$). The next $$$n$$$ lines ...
2,200
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly $$$m$$$ grams of food from each dish. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \leq x_i \leq a_i$$$; $$$0 \leq y_i \l...
standard output
PASSED
ea157a1ff9aa03828b17a6afaed10034
train_108.jsonl
1635863700
A known chef has prepared $$$n$$$ dishes: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. The banquet organizers estimate the balance of $$$n$$$ dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat....
256 megabytes
import java.util.*; import java.io.*; public class G_1607 { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int t = sc.nextInt(); while(t-->0) { int n = sc.nextInt(), om = sc.nextInt(); int[] a = n...
Java
["8\n\n1 5\n3 4\n\n1 6\n3 4\n\n2 2\n1 3\n4 2\n\n2 4\n1 3\n1 7\n\n3 6\n1 7\n1 8\n1 9\n\n3 6\n1 8\n1 9\n30 10\n\n3 4\n3 1\n3 2\n4 1\n\n5 4\n0 7\n6 4\n0 8\n4 1\n5 3"]
2 seconds
["0\n2 3\n1\n3 3\n0\n1 1\n1 1\n2\n1 3\n0 4\n3\n0 6\n0 6\n0 6\n7\n1 5\n1 5\n6 0\n0\n3 1\n3 1\n3 1\n0\n0 4\n2 2\n0 4\n3 1\n1 3"]
null
Java 11
standard input
[ "greedy" ]
c63f5994543b136305a7ae2b9c744e13
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of the test cases. Each test case's description is preceded by a blank line. Next comes a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$0 \leq m \leq 10^6$$$). The next $$$n$$$ lines ...
2,200
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly $$$m$$$ grams of food from each dish. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \leq x_i \leq a_i$$$; $$$0 \leq y_i \l...
standard output
PASSED
9e6bb21e52ad2f53d7475f09c046d0b9
train_108.jsonl
1635863700
A known chef has prepared $$$n$$$ dishes: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. The banquet organizers estimate the balance of $$$n$$$ dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat....
256 megabytes
import java.util.StringTokenizer; import java.lang.Math; import java.lang.StringBuilder; import java.io.*; public class Coba{ public static void main (String args[]) throws IOException{ /*try { System.setIn(new FileInputStream("input.txt")); System.setOut(new PrintStream(new FileOutputStream("output.tx...
Java
["8\n\n1 5\n3 4\n\n1 6\n3 4\n\n2 2\n1 3\n4 2\n\n2 4\n1 3\n1 7\n\n3 6\n1 7\n1 8\n1 9\n\n3 6\n1 8\n1 9\n30 10\n\n3 4\n3 1\n3 2\n4 1\n\n5 4\n0 7\n6 4\n0 8\n4 1\n5 3"]
2 seconds
["0\n2 3\n1\n3 3\n0\n1 1\n1 1\n2\n1 3\n0 4\n3\n0 6\n0 6\n0 6\n7\n1 5\n1 5\n6 0\n0\n3 1\n3 1\n3 1\n0\n0 4\n2 2\n0 4\n3 1\n1 3"]
null
Java 11
standard input
[ "greedy" ]
c63f5994543b136305a7ae2b9c744e13
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of the test cases. Each test case's description is preceded by a blank line. Next comes a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$0 \leq m \leq 10^6$$$). The next $$$n$$$ lines ...
2,200
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly $$$m$$$ grams of food from each dish. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \leq x_i \leq a_i$$$; $$$0 \leq y_i \l...
standard output
PASSED
647f62566cefe28b545058d208e6faca
train_108.jsonl
1635863700
A known chef has prepared $$$n$$$ dishes: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. The banquet organizers estimate the balance of $$$n$$$ dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat....
256 megabytes
import java.util.StringTokenizer; import java.lang.Math; import java.lang.StringBuilder; import java.io.*; public class Coba{ public static void main (String args[]) throws IOException{ try { System.setIn(new FileInputStream("input.txt")); System.setOut(new PrintStream(new FileOutputStream("output.txt"...
Java
["8\n\n1 5\n3 4\n\n1 6\n3 4\n\n2 2\n1 3\n4 2\n\n2 4\n1 3\n1 7\n\n3 6\n1 7\n1 8\n1 9\n\n3 6\n1 8\n1 9\n30 10\n\n3 4\n3 1\n3 2\n4 1\n\n5 4\n0 7\n6 4\n0 8\n4 1\n5 3"]
2 seconds
["0\n2 3\n1\n3 3\n0\n1 1\n1 1\n2\n1 3\n0 4\n3\n0 6\n0 6\n0 6\n7\n1 5\n1 5\n6 0\n0\n3 1\n3 1\n3 1\n0\n0 4\n2 2\n0 4\n3 1\n1 3"]
null
Java 11
standard input
[ "greedy" ]
c63f5994543b136305a7ae2b9c744e13
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of the test cases. Each test case's description is preceded by a blank line. Next comes a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$0 \leq m \leq 10^6$$$). The next $$$n$$$ lines ...
2,200
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly $$$m$$$ grams of food from each dish. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \leq x_i \leq a_i$$$; $$$0 \leq y_i \l...
standard output
PASSED
17996ed650f758a11a5df7d9dc2e61f8
train_108.jsonl
1635863700
A known chef has prepared $$$n$$$ dishes: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. The banquet organizers estimate the balance of $$$n$$$ dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat....
256 megabytes
import java.io.DataInputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; public class Main { private static void run() throws IOException { int n, m; n = in.nextInt(); m = in.nextInt(); long count_remain = 0; l...
Java
["8\n\n1 5\n3 4\n\n1 6\n3 4\n\n2 2\n1 3\n4 2\n\n2 4\n1 3\n1 7\n\n3 6\n1 7\n1 8\n1 9\n\n3 6\n1 8\n1 9\n30 10\n\n3 4\n3 1\n3 2\n4 1\n\n5 4\n0 7\n6 4\n0 8\n4 1\n5 3"]
2 seconds
["0\n2 3\n1\n3 3\n0\n1 1\n1 1\n2\n1 3\n0 4\n3\n0 6\n0 6\n0 6\n7\n1 5\n1 5\n6 0\n0\n3 1\n3 1\n3 1\n0\n0 4\n2 2\n0 4\n3 1\n1 3"]
null
Java 11
standard input
[ "greedy" ]
c63f5994543b136305a7ae2b9c744e13
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of the test cases. Each test case's description is preceded by a blank line. Next comes a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$0 \leq m \leq 10^6$$$). The next $$$n$$$ lines ...
2,200
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly $$$m$$$ grams of food from each dish. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \leq x_i \leq a_i$$$; $$$0 \leq y_i \l...
standard output
PASSED
e057ea411736ba343057896b3655e09c
train_108.jsonl
1635863700
A known chef has prepared $$$n$$$ dishes: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. The banquet organizers estimate the balance of $$$n$$$ dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat....
256 megabytes
import java.io.*; import java.util.*; public class gotoJapan { public static void main(String[] args) throws java.lang.Exception { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream)...
Java
["8\n\n1 5\n3 4\n\n1 6\n3 4\n\n2 2\n1 3\n4 2\n\n2 4\n1 3\n1 7\n\n3 6\n1 7\n1 8\n1 9\n\n3 6\n1 8\n1 9\n30 10\n\n3 4\n3 1\n3 2\n4 1\n\n5 4\n0 7\n6 4\n0 8\n4 1\n5 3"]
2 seconds
["0\n2 3\n1\n3 3\n0\n1 1\n1 1\n2\n1 3\n0 4\n3\n0 6\n0 6\n0 6\n7\n1 5\n1 5\n6 0\n0\n3 1\n3 1\n3 1\n0\n0 4\n2 2\n0 4\n3 1\n1 3"]
null
Java 11
standard input
[ "greedy" ]
c63f5994543b136305a7ae2b9c744e13
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of the test cases. Each test case's description is preceded by a blank line. Next comes a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$0 \leq m \leq 10^6$$$). The next $$$n$$$ lines ...
2,200
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly $$$m$$$ grams of food from each dish. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \leq x_i \leq a_i$$$; $$$0 \leq y_i \l...
standard output
PASSED
2464b4225fcc88d1fc8d5289636b6b96
train_108.jsonl
1635863700
A known chef has prepared $$$n$$$ dishes: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. The banquet organizers estimate the balance of $$$n$$$ dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat....
256 megabytes
import java.io.DataInputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; public class Main { private static void run() throws IOException { int n, m; n = in.nextInt(); m = in.nextInt(); ...
Java
["8\n\n1 5\n3 4\n\n1 6\n3 4\n\n2 2\n1 3\n4 2\n\n2 4\n1 3\n1 7\n\n3 6\n1 7\n1 8\n1 9\n\n3 6\n1 8\n1 9\n30 10\n\n3 4\n3 1\n3 2\n4 1\n\n5 4\n0 7\n6 4\n0 8\n4 1\n5 3"]
2 seconds
["0\n2 3\n1\n3 3\n0\n1 1\n1 1\n2\n1 3\n0 4\n3\n0 6\n0 6\n0 6\n7\n1 5\n1 5\n6 0\n0\n3 1\n3 1\n3 1\n0\n0 4\n2 2\n0 4\n3 1\n1 3"]
null
Java 11
standard input
[ "greedy" ]
c63f5994543b136305a7ae2b9c744e13
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of the test cases. Each test case's description is preceded by a blank line. Next comes a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$0 \leq m \leq 10^6$$$). The next $$$n$$$ lines ...
2,200
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly $$$m$$$ grams of food from each dish. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \leq x_i \leq a_i$$$; $$$0 \leq y_i \l...
standard output
PASSED
51d4874619e218aa983d52ad182b448c
train_108.jsonl
1635863700
A known chef has prepared $$$n$$$ dishes: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. The banquet organizers estimate the balance of $$$n$$$ dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat....
256 megabytes
//package banquetpreparations1; import java.util.*; import java.io.*; public class banquetpreparations { public static void main(String[] args) throws IOException { BufferedReader fin = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(fin.readLine()); StringBuilder fout =...
Java
["8\n\n1 5\n3 4\n\n1 6\n3 4\n\n2 2\n1 3\n4 2\n\n2 4\n1 3\n1 7\n\n3 6\n1 7\n1 8\n1 9\n\n3 6\n1 8\n1 9\n30 10\n\n3 4\n3 1\n3 2\n4 1\n\n5 4\n0 7\n6 4\n0 8\n4 1\n5 3"]
2 seconds
["0\n2 3\n1\n3 3\n0\n1 1\n1 1\n2\n1 3\n0 4\n3\n0 6\n0 6\n0 6\n7\n1 5\n1 5\n6 0\n0\n3 1\n3 1\n3 1\n0\n0 4\n2 2\n0 4\n3 1\n1 3"]
null
Java 11
standard input
[ "greedy" ]
c63f5994543b136305a7ae2b9c744e13
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of the test cases. Each test case's description is preceded by a blank line. Next comes a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$0 \leq m \leq 10^6$$$). The next $$$n$$$ lines ...
2,200
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly $$$m$$$ grams of food from each dish. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \leq x_i \leq a_i$$$; $$$0 \leq y_i \l...
standard output
PASSED
dc96d8a599883561edbdfbcc51ccc347
train_108.jsonl
1635863700
A known chef has prepared $$$n$$$ dishes: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. The banquet organizers estimate the balance of $$$n$$$ dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat....
256 megabytes
import java.io.*; import java.util.*; public class Main { static PrintWriter out; static Reader in; public static void main(String[] args) throws Exception { input_output(); Main solver = new Main(); solver.solve(); out.close(); out.flush(); } static int INF = (int)1e9; static int...
Java
["8\n\n1 5\n3 4\n\n1 6\n3 4\n\n2 2\n1 3\n4 2\n\n2 4\n1 3\n1 7\n\n3 6\n1 7\n1 8\n1 9\n\n3 6\n1 8\n1 9\n30 10\n\n3 4\n3 1\n3 2\n4 1\n\n5 4\n0 7\n6 4\n0 8\n4 1\n5 3"]
2 seconds
["0\n2 3\n1\n3 3\n0\n1 1\n1 1\n2\n1 3\n0 4\n3\n0 6\n0 6\n0 6\n7\n1 5\n1 5\n6 0\n0\n3 1\n3 1\n3 1\n0\n0 4\n2 2\n0 4\n3 1\n1 3"]
null
Java 11
standard input
[ "greedy" ]
c63f5994543b136305a7ae2b9c744e13
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of the test cases. Each test case's description is preceded by a blank line. Next comes a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$0 \leq m \leq 10^6$$$). The next $$$n$$$ lines ...
2,200
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly $$$m$$$ grams of food from each dish. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \leq x_i \leq a_i$$$; $$$0 \leq y_i \l...
standard output
PASSED
d4687fa2fcf038d87a6717e934eaac8c
train_108.jsonl
1635863700
A known chef has prepared $$$n$$$ dishes: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. The banquet organizers estimate the balance of $$$n$$$ dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat....
256 megabytes
import java.io.*; import java.util.*; public class CF1607G extends PrintWriter { CF1607G() { super(System.out); } Scanner sc = new Scanner(System.in); public static void main(String[] $) { CF1607G o = new CF1607G(); o.main(); o.flush(); } void main() { int t = sc.nextInt(); while (t-- > 0) { ...
Java
["8\n\n1 5\n3 4\n\n1 6\n3 4\n\n2 2\n1 3\n4 2\n\n2 4\n1 3\n1 7\n\n3 6\n1 7\n1 8\n1 9\n\n3 6\n1 8\n1 9\n30 10\n\n3 4\n3 1\n3 2\n4 1\n\n5 4\n0 7\n6 4\n0 8\n4 1\n5 3"]
2 seconds
["0\n2 3\n1\n3 3\n0\n1 1\n1 1\n2\n1 3\n0 4\n3\n0 6\n0 6\n0 6\n7\n1 5\n1 5\n6 0\n0\n3 1\n3 1\n3 1\n0\n0 4\n2 2\n0 4\n3 1\n1 3"]
null
Java 11
standard input
[ "greedy" ]
c63f5994543b136305a7ae2b9c744e13
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of the test cases. Each test case's description is preceded by a blank line. Next comes a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$0 \leq m \leq 10^6$$$). The next $$$n$$$ lines ...
2,200
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly $$$m$$$ grams of food from each dish. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \leq x_i \leq a_i$$$; $$$0 \leq y_i \l...
standard output
PASSED
70e7645f43bee3d55e883dc15cc595e5
train_108.jsonl
1635863700
A known chef has prepared $$$n$$$ dishes: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. The banquet organizers estimate the balance of $$$n$$$ dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat....
256 megabytes
import java.io.*; import java.util.*; public class BMain { public static void main(String[] args) { QuickReader in = new QuickReader(System.in); try(PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));) { new BMain().solve(in, out); } } public void solve(QuickR...
Java
["8\n\n1 5\n3 4\n\n1 6\n3 4\n\n2 2\n1 3\n4 2\n\n2 4\n1 3\n1 7\n\n3 6\n1 7\n1 8\n1 9\n\n3 6\n1 8\n1 9\n30 10\n\n3 4\n3 1\n3 2\n4 1\n\n5 4\n0 7\n6 4\n0 8\n4 1\n5 3"]
2 seconds
["0\n2 3\n1\n3 3\n0\n1 1\n1 1\n2\n1 3\n0 4\n3\n0 6\n0 6\n0 6\n7\n1 5\n1 5\n6 0\n0\n3 1\n3 1\n3 1\n0\n0 4\n2 2\n0 4\n3 1\n1 3"]
null
Java 11
standard input
[ "greedy" ]
c63f5994543b136305a7ae2b9c744e13
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of the test cases. Each test case's description is preceded by a blank line. Next comes a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$0 \leq m \leq 10^6$$$). The next $$$n$$$ lines ...
2,200
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly $$$m$$$ grams of food from each dish. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \leq x_i \leq a_i$$$; $$$0 \leq y_i \l...
standard output
PASSED
a817b80be77b1c163d6092e67f2309d5
train_108.jsonl
1635863700
A known chef has prepared $$$n$$$ dishes: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. The banquet organizers estimate the balance of $$$n$$$ dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat....
256 megabytes
import java.io.*; import java.util.*; public class Codeforces { public static void main(String args[])throws Exception { BufferedReader bu=new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb=new StringBuilder(); int t=Integer.parseInt(bu.readLine()); ...
Java
["8\n\n1 5\n3 4\n\n1 6\n3 4\n\n2 2\n1 3\n4 2\n\n2 4\n1 3\n1 7\n\n3 6\n1 7\n1 8\n1 9\n\n3 6\n1 8\n1 9\n30 10\n\n3 4\n3 1\n3 2\n4 1\n\n5 4\n0 7\n6 4\n0 8\n4 1\n5 3"]
2 seconds
["0\n2 3\n1\n3 3\n0\n1 1\n1 1\n2\n1 3\n0 4\n3\n0 6\n0 6\n0 6\n7\n1 5\n1 5\n6 0\n0\n3 1\n3 1\n3 1\n0\n0 4\n2 2\n0 4\n3 1\n1 3"]
null
Java 11
standard input
[ "greedy" ]
c63f5994543b136305a7ae2b9c744e13
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of the test cases. Each test case's description is preceded by a blank line. Next comes a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$0 \leq m \leq 10^6$$$). The next $$$n$$$ lines ...
2,200
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly $$$m$$$ grams of food from each dish. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \leq x_i \leq a_i$$$; $$$0 \leq y_i \l...
standard output
PASSED
36c8b72c7e7862d9a12328b5fe556824
train_108.jsonl
1635863700
A known chef has prepared $$$n$$$ dishes: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. The banquet organizers estimate the balance of $$$n$$$ dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat....
256 megabytes
import java.io.*; import java.util.*; public class CF1607G extends PrintWriter { CF1607G() { super(System.out); } Scanner sc = new Scanner(System.in); public static void main(String[] $) { CF1607G o = new CF1607G(); o.main(); o.flush(); } void main() { int t = sc.nextInt(); while (t-- > 0) { int n = sc....
Java
["8\n\n1 5\n3 4\n\n1 6\n3 4\n\n2 2\n1 3\n4 2\n\n2 4\n1 3\n1 7\n\n3 6\n1 7\n1 8\n1 9\n\n3 6\n1 8\n1 9\n30 10\n\n3 4\n3 1\n3 2\n4 1\n\n5 4\n0 7\n6 4\n0 8\n4 1\n5 3"]
2 seconds
["0\n2 3\n1\n3 3\n0\n1 1\n1 1\n2\n1 3\n0 4\n3\n0 6\n0 6\n0 6\n7\n1 5\n1 5\n6 0\n0\n3 1\n3 1\n3 1\n0\n0 4\n2 2\n0 4\n3 1\n1 3"]
null
Java 11
standard input
[ "greedy" ]
c63f5994543b136305a7ae2b9c744e13
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of the test cases. Each test case's description is preceded by a blank line. Next comes a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$0 \leq m \leq 10^6$$$). The next $$$n$$$ lines ...
2,200
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly $$$m$$$ grams of food from each dish. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \leq x_i \leq a_i$$$; $$$0 \leq y_i \l...
standard output
PASSED
4130456884f8efae509af459045c6b7f
train_108.jsonl
1635863700
A known chef has prepared $$$n$$$ dishes: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. The banquet organizers estimate the balance of $$$n$$$ dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat....
256 megabytes
import java.io.*; import java.util.*; public class CF1607G extends PrintWriter { CF1607G() { super(System.out); } Scanner sc = new Scanner(System.in); public static void main(String[] $) { CF1607G o = new CF1607G(); o.main(); o.flush(); } void main() { int t = sc.nextInt(); while (t-- > 0) { ...
Java
["8\n\n1 5\n3 4\n\n1 6\n3 4\n\n2 2\n1 3\n4 2\n\n2 4\n1 3\n1 7\n\n3 6\n1 7\n1 8\n1 9\n\n3 6\n1 8\n1 9\n30 10\n\n3 4\n3 1\n3 2\n4 1\n\n5 4\n0 7\n6 4\n0 8\n4 1\n5 3"]
2 seconds
["0\n2 3\n1\n3 3\n0\n1 1\n1 1\n2\n1 3\n0 4\n3\n0 6\n0 6\n0 6\n7\n1 5\n1 5\n6 0\n0\n3 1\n3 1\n3 1\n0\n0 4\n2 2\n0 4\n3 1\n1 3"]
null
Java 8
standard input
[ "greedy" ]
c63f5994543b136305a7ae2b9c744e13
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of the test cases. Each test case's description is preceded by a blank line. Next comes a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$0 \leq m \leq 10^6$$$). The next $$$n$$$ lines ...
2,200
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly $$$m$$$ grams of food from each dish. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \leq x_i \leq a_i$$$; $$$0 \leq y_i \l...
standard output
PASSED
151fd65a75eb8e6345cf0c1226d8967e
train_108.jsonl
1635863700
A known chef has prepared $$$n$$$ dishes: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. The banquet organizers estimate the balance of $$$n$$$ dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat....
256 megabytes
import java.util.*; import java.io.*; import java.lang.Math; public class Main { public class MainSolution extends MainSolutionT { // global vars public void init(int tests_count){} public class TestCase extends TestCaseT { public Object solve() { long n ...
Java
["8\n\n1 5\n3 4\n\n1 6\n3 4\n\n2 2\n1 3\n4 2\n\n2 4\n1 3\n1 7\n\n3 6\n1 7\n1 8\n1 9\n\n3 6\n1 8\n1 9\n30 10\n\n3 4\n3 1\n3 2\n4 1\n\n5 4\n0 7\n6 4\n0 8\n4 1\n5 3"]
2 seconds
["0\n2 3\n1\n3 3\n0\n1 1\n1 1\n2\n1 3\n0 4\n3\n0 6\n0 6\n0 6\n7\n1 5\n1 5\n6 0\n0\n3 1\n3 1\n3 1\n0\n0 4\n2 2\n0 4\n3 1\n1 3"]
null
Java 8
standard input
[ "greedy" ]
c63f5994543b136305a7ae2b9c744e13
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of the test cases. Each test case's description is preceded by a blank line. Next comes a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$0 \leq m \leq 10^6$$$). The next $$$n$$$ lines ...
2,200
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly $$$m$$$ grams of food from each dish. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \leq x_i \leq a_i$$$; $$$0 \leq y_i \l...
standard output
PASSED
b5a6b0a27d1a9acd60288f4140481ec4
train_108.jsonl
1635863700
A known chef has prepared $$$n$$$ dishes: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. The banquet organizers estimate the balance of $$$n$$$ dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat....
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String args[]) {new Main().run();} FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); void run() { for(int q=ni();q>0;q--){ work(); } out.flus...
Java
["8\n\n1 5\n3 4\n\n1 6\n3 4\n\n2 2\n1 3\n4 2\n\n2 4\n1 3\n1 7\n\n3 6\n1 7\n1 8\n1 9\n\n3 6\n1 8\n1 9\n30 10\n\n3 4\n3 1\n3 2\n4 1\n\n5 4\n0 7\n6 4\n0 8\n4 1\n5 3"]
2 seconds
["0\n2 3\n1\n3 3\n0\n1 1\n1 1\n2\n1 3\n0 4\n3\n0 6\n0 6\n0 6\n7\n1 5\n1 5\n6 0\n0\n3 1\n3 1\n3 1\n0\n0 4\n2 2\n0 4\n3 1\n1 3"]
null
Java 8
standard input
[ "greedy" ]
c63f5994543b136305a7ae2b9c744e13
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of the test cases. Each test case's description is preceded by a blank line. Next comes a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$0 \leq m \leq 10^6$$$). The next $$$n$$$ lines ...
2,200
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly $$$m$$$ grams of food from each dish. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \leq x_i \leq a_i$$$; $$$0 \leq y_i \l...
standard output
PASSED
c7365418a6645452f2c552a0d1dc140b
train_108.jsonl
1635863700
A known chef has prepared $$$n$$$ dishes: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. The banquet organizers estimate the balance of $$$n$$$ dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat....
256 megabytes
import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import java.util.*; import java.io.*; import java.math.*; /** * * @Har_Har_Mahadev */ /** * Main , Solution , Remove Public */ public class D { public static void process() throws IOException ...
Java
["8\n\n1 5\n3 4\n\n1 6\n3 4\n\n2 2\n1 3\n4 2\n\n2 4\n1 3\n1 7\n\n3 6\n1 7\n1 8\n1 9\n\n3 6\n1 8\n1 9\n30 10\n\n3 4\n3 1\n3 2\n4 1\n\n5 4\n0 7\n6 4\n0 8\n4 1\n5 3"]
2 seconds
["0\n2 3\n1\n3 3\n0\n1 1\n1 1\n2\n1 3\n0 4\n3\n0 6\n0 6\n0 6\n7\n1 5\n1 5\n6 0\n0\n3 1\n3 1\n3 1\n0\n0 4\n2 2\n0 4\n3 1\n1 3"]
null
Java 8
standard input
[ "greedy" ]
c63f5994543b136305a7ae2b9c744e13
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of the test cases. Each test case's description is preceded by a blank line. Next comes a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$0 \leq m \leq 10^6$$$). The next $$$n$$$ lines ...
2,200
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly $$$m$$$ grams of food from each dish. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \leq x_i \leq a_i$$$; $$$0 \leq y_i \l...
standard output
PASSED
e54c4e194b487016a24eb16fa4d74303
train_108.jsonl
1635863700
A known chef has prepared $$$n$$$ dishes: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. The banquet organizers estimate the balance of $$$n$$$ dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat....
256 megabytes
import java.io.*; import java.util.*; public class CF1607G extends PrintWriter { CF1607G() { super(System.out); } Scanner sc = new Scanner(System.in); public static void main(String[] $) { CF1607G o = new CF1607G(); o.main(); o.flush(); } void main() { int t = sc.nextInt(); while (t-- > 0) { ...
Java
["8\n\n1 5\n3 4\n\n1 6\n3 4\n\n2 2\n1 3\n4 2\n\n2 4\n1 3\n1 7\n\n3 6\n1 7\n1 8\n1 9\n\n3 6\n1 8\n1 9\n30 10\n\n3 4\n3 1\n3 2\n4 1\n\n5 4\n0 7\n6 4\n0 8\n4 1\n5 3"]
2 seconds
["0\n2 3\n1\n3 3\n0\n1 1\n1 1\n2\n1 3\n0 4\n3\n0 6\n0 6\n0 6\n7\n1 5\n1 5\n6 0\n0\n3 1\n3 1\n3 1\n0\n0 4\n2 2\n0 4\n3 1\n1 3"]
null
Java 8
standard input
[ "greedy" ]
c63f5994543b136305a7ae2b9c744e13
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of the test cases. Each test case's description is preceded by a blank line. Next comes a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$0 \leq m \leq 10^6$$$). The next $$$n$$$ lines ...
2,200
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly $$$m$$$ grams of food from each dish. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \leq x_i \leq a_i$$$; $$$0 \leq y_i \l...
standard output
PASSED
b11a92a607c1ef902d80fded1703193a
train_108.jsonl
1635863700
A known chef has prepared $$$n$$$ dishes: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. The banquet organizers estimate the balance of $$$n$$$ dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat....
256 megabytes
// Problem: G. Banquet Preparations 1 // Contest: Codeforces - Codeforces Round #753 (Div. 3) // URL: https://codeforces.com/contest/1607/problem/G // Memory Limit: 256 MB // Time Limit: 2000 ms // // Powered by CP Editor (https://cpeditor.org) import java.io.*; import java.util.*; import static java.lang.Math.max; ...
Java
["8\n\n1 5\n3 4\n\n1 6\n3 4\n\n2 2\n1 3\n4 2\n\n2 4\n1 3\n1 7\n\n3 6\n1 7\n1 8\n1 9\n\n3 6\n1 8\n1 9\n30 10\n\n3 4\n3 1\n3 2\n4 1\n\n5 4\n0 7\n6 4\n0 8\n4 1\n5 3"]
2 seconds
["0\n2 3\n1\n3 3\n0\n1 1\n1 1\n2\n1 3\n0 4\n3\n0 6\n0 6\n0 6\n7\n1 5\n1 5\n6 0\n0\n3 1\n3 1\n3 1\n0\n0 4\n2 2\n0 4\n3 1\n1 3"]
null
Java 8
standard input
[ "greedy" ]
c63f5994543b136305a7ae2b9c744e13
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of the test cases. Each test case's description is preceded by a blank line. Next comes a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$0 \leq m \leq 10^6$$$). The next $$$n$$$ lines ...
2,200
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly $$$m$$$ grams of food from each dish. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \leq x_i \leq a_i$$$; $$$0 \leq y_i \l...
standard output
PASSED
08f87aa727d2f1b5f5e47f672a1ed7a6
train_108.jsonl
1635863700
A known chef has prepared $$$n$$$ dishes: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. The banquet organizers estimate the balance of $$$n$$$ dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat....
256 megabytes
import java.util.*; import java.io.*; ////*************************************************************************** /* public class E_Gardener_and_Tree implements Runnable{ public static void main(String[] args) throws Exception { new Thread(null, new E_Gardener_and_Tree(), "E_Gardener_and_Tr...
Java
["8\n\n1 5\n3 4\n\n1 6\n3 4\n\n2 2\n1 3\n4 2\n\n2 4\n1 3\n1 7\n\n3 6\n1 7\n1 8\n1 9\n\n3 6\n1 8\n1 9\n30 10\n\n3 4\n3 1\n3 2\n4 1\n\n5 4\n0 7\n6 4\n0 8\n4 1\n5 3"]
2 seconds
["0\n2 3\n1\n3 3\n0\n1 1\n1 1\n2\n1 3\n0 4\n3\n0 6\n0 6\n0 6\n7\n1 5\n1 5\n6 0\n0\n3 1\n3 1\n3 1\n0\n0 4\n2 2\n0 4\n3 1\n1 3"]
null
Java 8
standard input
[ "greedy" ]
c63f5994543b136305a7ae2b9c744e13
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of the test cases. Each test case's description is preceded by a blank line. Next comes a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$0 \leq m \leq 10^6$$$). The next $$$n$$$ lines ...
2,200
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly $$$m$$$ grams of food from each dish. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \leq x_i \leq a_i$$$; $$$0 \leq y_i \l...
standard output
PASSED
24d63581524bae2dc8814fc79bcc4aca
train_108.jsonl
1635863700
A known chef has prepared $$$n$$$ dishes: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. The banquet organizers estimate the balance of $$$n$$$ dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat....
256 megabytes
// Main Code at the Bottom import java.util.*; import java.io.*; import java.sql.Time; public class Main implements Runnable{ //Fast IO class static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { boolean env=System.getProperty("ONLINE_J...
Java
["8\n\n1 5\n3 4\n\n1 6\n3 4\n\n2 2\n1 3\n4 2\n\n2 4\n1 3\n1 7\n\n3 6\n1 7\n1 8\n1 9\n\n3 6\n1 8\n1 9\n30 10\n\n3 4\n3 1\n3 2\n4 1\n\n5 4\n0 7\n6 4\n0 8\n4 1\n5 3"]
2 seconds
["0\n2 3\n1\n3 3\n0\n1 1\n1 1\n2\n1 3\n0 4\n3\n0 6\n0 6\n0 6\n7\n1 5\n1 5\n6 0\n0\n3 1\n3 1\n3 1\n0\n0 4\n2 2\n0 4\n3 1\n1 3"]
null
Java 8
standard input
[ "greedy" ]
c63f5994543b136305a7ae2b9c744e13
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of the test cases. Each test case's description is preceded by a blank line. Next comes a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$0 \leq m \leq 10^6$$$). The next $$$n$$$ lines ...
2,200
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly $$$m$$$ grams of food from each dish. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \leq x_i \leq a_i$$$; $$$0 \leq y_i \l...
standard output
PASSED
c33f147a03a068c0944ffb3fd9398bda
train_108.jsonl
1635863700
A known chef has prepared $$$n$$$ dishes: the $$$i$$$-th dish consists of $$$a_i$$$ grams of fish and $$$b_i$$$ grams of meat. The banquet organizers estimate the balance of $$$n$$$ dishes as follows. The balance is equal to the absolute value of the difference between the total mass of fish and the total mass of meat....
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.text.DecimalFormat; import java.util.*; import java.util.concurrent.ThreadLocalRandom; import java.util.stream.Collectors; import java.util.stream.IntStream; import java.util.st...
Java
["8\n\n1 5\n3 4\n\n1 6\n3 4\n\n2 2\n1 3\n4 2\n\n2 4\n1 3\n1 7\n\n3 6\n1 7\n1 8\n1 9\n\n3 6\n1 8\n1 9\n30 10\n\n3 4\n3 1\n3 2\n4 1\n\n5 4\n0 7\n6 4\n0 8\n4 1\n5 3"]
2 seconds
["0\n2 3\n1\n3 3\n0\n1 1\n1 1\n2\n1 3\n0 4\n3\n0 6\n0 6\n0 6\n7\n1 5\n1 5\n6 0\n0\n3 1\n3 1\n3 1\n0\n0 4\n2 2\n0 4\n3 1\n1 3"]
null
Java 8
standard input
[ "greedy" ]
c63f5994543b136305a7ae2b9c744e13
The first line of input data contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of the test cases. Each test case's description is preceded by a blank line. Next comes a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$; $$$0 \leq m \leq 10^6$$$). The next $$$n$$$ lines ...
2,200
For each test case, print on the first line the minimal balance value that can be achieved by eating exactly $$$m$$$ grams of food from each dish. Then print $$$n$$$ lines that describe a way to do this: the $$$i$$$-th line should contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \leq x_i \leq a_i$$$; $$$0 \leq y_i \l...
standard output
PASSED
9d83aadaa3fcdd4183b54bf1975ee764
train_108.jsonl
1635863700
The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c...
256 megabytes
import java.io.*; import java.util.*; public class gotoJapan { public static void main(String[] args) throws java.lang.Exception { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream)...
Java
["7\n\n1 1\nR\n\n1 3\nRRL\n\n2 2\nDL\nRU\n\n2 2\nUD\nRU\n\n3 2\nDL\nUL\nRU\n\n4 4\nRRRD\nRUUD\nURUD\nULLR\n\n4 4\nDDLU\nRDDU\nUUUU\nRDLD"]
2 seconds
["1 1 1\n1 1 3\n1 1 4\n2 1 3\n3 1 5\n4 3 12\n1 1 4"]
null
Java 11
standard input
[ "brute force", "dfs and similar", "graphs", "implementation" ]
67c748999e681fa6f60165f411e5149d
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases in the test. Each test case's description is preceded by a blank line. Next is a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2000$$$; $$$1 \le m \le 2000$$$) — the height and width of the board. This line...
2,300
For each test case, output three integers $$$r$$$, $$$c$$$ and $$$d$$$ ($$$1 \le r \le n$$$; $$$1 \le c \le m$$$; $$$d \ge 0$$$), which denote that the robot should start moving from cell $$$(r, c)$$$ to make the maximum number of moves $$$d$$$. If there are several answers, output any of them.
standard output
PASSED
8395c3e579f6bcba3d1b8aa52f10ce50
train_108.jsonl
1635863700
The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c...
256 megabytes
//package com.company; //Avoid division by decimal digits :). Always try to multiply with whole numbers or fractions instead. //if getting wrong answer then use long/double instead of int/float //e + e = o; o + o = e; e + o = o; //see stuff in a jugaad way... if you are being complicated you are doing it wrong //I...
Java
["7\n\n1 1\nR\n\n1 3\nRRL\n\n2 2\nDL\nRU\n\n2 2\nUD\nRU\n\n3 2\nDL\nUL\nRU\n\n4 4\nRRRD\nRUUD\nURUD\nULLR\n\n4 4\nDDLU\nRDDU\nUUUU\nRDLD"]
2 seconds
["1 1 1\n1 1 3\n1 1 4\n2 1 3\n3 1 5\n4 3 12\n1 1 4"]
null
Java 11
standard input
[ "brute force", "dfs and similar", "graphs", "implementation" ]
67c748999e681fa6f60165f411e5149d
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases in the test. Each test case's description is preceded by a blank line. Next is a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2000$$$; $$$1 \le m \le 2000$$$) — the height and width of the board. This line...
2,300
For each test case, output three integers $$$r$$$, $$$c$$$ and $$$d$$$ ($$$1 \le r \le n$$$; $$$1 \le c \le m$$$; $$$d \ge 0$$$), which denote that the robot should start moving from cell $$$(r, c)$$$ to make the maximum number of moves $$$d$$$. If there are several answers, output any of them.
standard output
PASSED
43b5fda0d75a8fc2c89dcfed9097a69a
train_108.jsonl
1635863700
The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c...
256 megabytes
import java.io.DataInputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Stack; public class Main { private static int n, m; private static char[][] map; private static int[] dp, visited, deep; private static int round; ...
Java
["7\n\n1 1\nR\n\n1 3\nRRL\n\n2 2\nDL\nRU\n\n2 2\nUD\nRU\n\n3 2\nDL\nUL\nRU\n\n4 4\nRRRD\nRUUD\nURUD\nULLR\n\n4 4\nDDLU\nRDDU\nUUUU\nRDLD"]
2 seconds
["1 1 1\n1 1 3\n1 1 4\n2 1 3\n3 1 5\n4 3 12\n1 1 4"]
null
Java 11
standard input
[ "brute force", "dfs and similar", "graphs", "implementation" ]
67c748999e681fa6f60165f411e5149d
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases in the test. Each test case's description is preceded by a blank line. Next is a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2000$$$; $$$1 \le m \le 2000$$$) — the height and width of the board. This line...
2,300
For each test case, output three integers $$$r$$$, $$$c$$$ and $$$d$$$ ($$$1 \le r \le n$$$; $$$1 \le c \le m$$$; $$$d \ge 0$$$), which denote that the robot should start moving from cell $$$(r, c)$$$ to make the maximum number of moves $$$d$$$. If there are several answers, output any of them.
standard output
PASSED
a5ecfc6595fc2dc964dd616bf5de7826
train_108.jsonl
1635863700
The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c...
256 megabytes
import java.io.DataInputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Stack; public class Main { private static int n, m; private static char[][] map; private static int[] dp, visited, deep; private static int round; ...
Java
["7\n\n1 1\nR\n\n1 3\nRRL\n\n2 2\nDL\nRU\n\n2 2\nUD\nRU\n\n3 2\nDL\nUL\nRU\n\n4 4\nRRRD\nRUUD\nURUD\nULLR\n\n4 4\nDDLU\nRDDU\nUUUU\nRDLD"]
2 seconds
["1 1 1\n1 1 3\n1 1 4\n2 1 3\n3 1 5\n4 3 12\n1 1 4"]
null
Java 11
standard input
[ "brute force", "dfs and similar", "graphs", "implementation" ]
67c748999e681fa6f60165f411e5149d
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases in the test. Each test case's description is preceded by a blank line. Next is a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2000$$$; $$$1 \le m \le 2000$$$) — the height and width of the board. This line...
2,300
For each test case, output three integers $$$r$$$, $$$c$$$ and $$$d$$$ ($$$1 \le r \le n$$$; $$$1 \le c \le m$$$; $$$d \ge 0$$$), which denote that the robot should start moving from cell $$$(r, c)$$$ to make the maximum number of moves $$$d$$$. If there are several answers, output any of them.
standard output
PASSED
5905630a451fac99add348c9679d48a2
train_108.jsonl
1635863700
The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c...
256 megabytes
import java.io.DataInputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Stack; public class Main { private static int n, m; private static String[] map; private static int[] dp, visited, deep; private static int round; ...
Java
["7\n\n1 1\nR\n\n1 3\nRRL\n\n2 2\nDL\nRU\n\n2 2\nUD\nRU\n\n3 2\nDL\nUL\nRU\n\n4 4\nRRRD\nRUUD\nURUD\nULLR\n\n4 4\nDDLU\nRDDU\nUUUU\nRDLD"]
2 seconds
["1 1 1\n1 1 3\n1 1 4\n2 1 3\n3 1 5\n4 3 12\n1 1 4"]
null
Java 11
standard input
[ "brute force", "dfs and similar", "graphs", "implementation" ]
67c748999e681fa6f60165f411e5149d
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases in the test. Each test case's description is preceded by a blank line. Next is a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2000$$$; $$$1 \le m \le 2000$$$) — the height and width of the board. This line...
2,300
For each test case, output three integers $$$r$$$, $$$c$$$ and $$$d$$$ ($$$1 \le r \le n$$$; $$$1 \le c \le m$$$; $$$d \ge 0$$$), which denote that the robot should start moving from cell $$$(r, c)$$$ to make the maximum number of moves $$$d$$$. If there are several answers, output any of them.
standard output
PASSED
d47c07d104a74d4479d694b212a1bb8e
train_108.jsonl
1635863700
The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c...
256 megabytes
import java.util.*; import java.io.*; public class _1607_F { static int[][] dirs = new int[][] {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new P...
Java
["7\n\n1 1\nR\n\n1 3\nRRL\n\n2 2\nDL\nRU\n\n2 2\nUD\nRU\n\n3 2\nDL\nUL\nRU\n\n4 4\nRRRD\nRUUD\nURUD\nULLR\n\n4 4\nDDLU\nRDDU\nUUUU\nRDLD"]
2 seconds
["1 1 1\n1 1 3\n1 1 4\n2 1 3\n3 1 5\n4 3 12\n1 1 4"]
null
Java 11
standard input
[ "brute force", "dfs and similar", "graphs", "implementation" ]
67c748999e681fa6f60165f411e5149d
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases in the test. Each test case's description is preceded by a blank line. Next is a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2000$$$; $$$1 \le m \le 2000$$$) — the height and width of the board. This line...
2,300
For each test case, output three integers $$$r$$$, $$$c$$$ and $$$d$$$ ($$$1 \le r \le n$$$; $$$1 \le c \le m$$$; $$$d \ge 0$$$), which denote that the robot should start moving from cell $$$(r, c)$$$ to make the maximum number of moves $$$d$$$. If there are several answers, output any of them.
standard output
PASSED
8797c0b86d28b453dc2b2c7132a099ef
train_108.jsonl
1635863700
The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c...
256 megabytes
import java.util.*; import java.io.*; public class _1607_F { static int[][] dirs = new int[][] {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new P...
Java
["7\n\n1 1\nR\n\n1 3\nRRL\n\n2 2\nDL\nRU\n\n2 2\nUD\nRU\n\n3 2\nDL\nUL\nRU\n\n4 4\nRRRD\nRUUD\nURUD\nULLR\n\n4 4\nDDLU\nRDDU\nUUUU\nRDLD"]
2 seconds
["1 1 1\n1 1 3\n1 1 4\n2 1 3\n3 1 5\n4 3 12\n1 1 4"]
null
Java 11
standard input
[ "brute force", "dfs and similar", "graphs", "implementation" ]
67c748999e681fa6f60165f411e5149d
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases in the test. Each test case's description is preceded by a blank line. Next is a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2000$$$; $$$1 \le m \le 2000$$$) — the height and width of the board. This line...
2,300
For each test case, output three integers $$$r$$$, $$$c$$$ and $$$d$$$ ($$$1 \le r \le n$$$; $$$1 \le c \le m$$$; $$$d \ge 0$$$), which denote that the robot should start moving from cell $$$(r, c)$$$ to make the maximum number of moves $$$d$$$. If there are several answers, output any of them.
standard output
PASSED
397dc24bdacca0328d0d57ec67d5fe09
train_108.jsonl
1635863700
The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c...
256 megabytes
import java.util.*; import java.io.*; public class _1607_F { static int[][] dirs = new int[][] {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new P...
Java
["7\n\n1 1\nR\n\n1 3\nRRL\n\n2 2\nDL\nRU\n\n2 2\nUD\nRU\n\n3 2\nDL\nUL\nRU\n\n4 4\nRRRD\nRUUD\nURUD\nULLR\n\n4 4\nDDLU\nRDDU\nUUUU\nRDLD"]
2 seconds
["1 1 1\n1 1 3\n1 1 4\n2 1 3\n3 1 5\n4 3 12\n1 1 4"]
null
Java 11
standard input
[ "brute force", "dfs and similar", "graphs", "implementation" ]
67c748999e681fa6f60165f411e5149d
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases in the test. Each test case's description is preceded by a blank line. Next is a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2000$$$; $$$1 \le m \le 2000$$$) — the height and width of the board. This line...
2,300
For each test case, output three integers $$$r$$$, $$$c$$$ and $$$d$$$ ($$$1 \le r \le n$$$; $$$1 \le c \le m$$$; $$$d \ge 0$$$), which denote that the robot should start moving from cell $$$(r, c)$$$ to make the maximum number of moves $$$d$$$. If there are several answers, output any of them.
standard output
PASSED
9c69b3183c5caccd2b41af1204d37c6d
train_108.jsonl
1635863700
The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c...
256 megabytes
//package Codeforces; import java.io.File; import java.io.FileNotFoundException; import java.util.*; public class RobotOnTheBoard2 { static class Cell{ int x; int y; int val; Cell parent; boolean isVisited; boolean inStack; Cell(int x, int y){ ...
Java
["7\n\n1 1\nR\n\n1 3\nRRL\n\n2 2\nDL\nRU\n\n2 2\nUD\nRU\n\n3 2\nDL\nUL\nRU\n\n4 4\nRRRD\nRUUD\nURUD\nULLR\n\n4 4\nDDLU\nRDDU\nUUUU\nRDLD"]
2 seconds
["1 1 1\n1 1 3\n1 1 4\n2 1 3\n3 1 5\n4 3 12\n1 1 4"]
null
Java 11
standard input
[ "brute force", "dfs and similar", "graphs", "implementation" ]
67c748999e681fa6f60165f411e5149d
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases in the test. Each test case's description is preceded by a blank line. Next is a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2000$$$; $$$1 \le m \le 2000$$$) — the height and width of the board. This line...
2,300
For each test case, output three integers $$$r$$$, $$$c$$$ and $$$d$$$ ($$$1 \le r \le n$$$; $$$1 \le c \le m$$$; $$$d \ge 0$$$), which denote that the robot should start moving from cell $$$(r, c)$$$ to make the maximum number of moves $$$d$$$. If there are several answers, output any of them.
standard output
PASSED
6b390ada63d6e4581778df2613fd0e74
train_108.jsonl
1635863700
The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c...
256 megabytes
import java.io.*; import java.util.*; public class Practice { // static final long mod=7420738134811L; static int mod=1000000007; static final int size=501; static FastReader sc=new FastReader(System.in); // static Reader sc=new Reader(); static PrintWriter out=new PrintWriter(System.out); static lo...
Java
["7\n\n1 1\nR\n\n1 3\nRRL\n\n2 2\nDL\nRU\n\n2 2\nUD\nRU\n\n3 2\nDL\nUL\nRU\n\n4 4\nRRRD\nRUUD\nURUD\nULLR\n\n4 4\nDDLU\nRDDU\nUUUU\nRDLD"]
2 seconds
["1 1 1\n1 1 3\n1 1 4\n2 1 3\n3 1 5\n4 3 12\n1 1 4"]
null
Java 11
standard input
[ "brute force", "dfs and similar", "graphs", "implementation" ]
67c748999e681fa6f60165f411e5149d
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases in the test. Each test case's description is preceded by a blank line. Next is a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2000$$$; $$$1 \le m \le 2000$$$) — the height and width of the board. This line...
2,300
For each test case, output three integers $$$r$$$, $$$c$$$ and $$$d$$$ ($$$1 \le r \le n$$$; $$$1 \le c \le m$$$; $$$d \ge 0$$$), which denote that the robot should start moving from cell $$$(r, c)$$$ to make the maximum number of moves $$$d$$$. If there are several answers, output any of them.
standard output
PASSED
3b7e1bbe830a3a91cd73250d725815c4
train_108.jsonl
1635863700
The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { PrintWriter out = new PrintWriter(System.out); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer tok = new StringTokenizer(""); String next() throws IOException { while (!to...
Java
["7\n\n1 1\nR\n\n1 3\nRRL\n\n2 2\nDL\nRU\n\n2 2\nUD\nRU\n\n3 2\nDL\nUL\nRU\n\n4 4\nRRRD\nRUUD\nURUD\nULLR\n\n4 4\nDDLU\nRDDU\nUUUU\nRDLD"]
2 seconds
["1 1 1\n1 1 3\n1 1 4\n2 1 3\n3 1 5\n4 3 12\n1 1 4"]
null
Java 11
standard input
[ "brute force", "dfs and similar", "graphs", "implementation" ]
67c748999e681fa6f60165f411e5149d
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases in the test. Each test case's description is preceded by a blank line. Next is a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2000$$$; $$$1 \le m \le 2000$$$) — the height and width of the board. This line...
2,300
For each test case, output three integers $$$r$$$, $$$c$$$ and $$$d$$$ ($$$1 \le r \le n$$$; $$$1 \le c \le m$$$; $$$d \ge 0$$$), which denote that the robot should start moving from cell $$$(r, c)$$$ to make the maximum number of moves $$$d$$$. If there are several answers, output any of them.
standard output
PASSED
32125591ed8312bfb03b1800b176a4b1
train_108.jsonl
1635863700
The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c...
256 megabytes
import java.util.Scanner; public class F { public static void main(String[] args) { Scanner s = new Scanner(System.in); int lines = s.nextInt(); s.nextLine(); for (int i = 0; i < lines; i += 1) { solve(s.nextInt(), s.nextInt(), s); } } ...
Java
["7\n\n1 1\nR\n\n1 3\nRRL\n\n2 2\nDL\nRU\n\n2 2\nUD\nRU\n\n3 2\nDL\nUL\nRU\n\n4 4\nRRRD\nRUUD\nURUD\nULLR\n\n4 4\nDDLU\nRDDU\nUUUU\nRDLD"]
2 seconds
["1 1 1\n1 1 3\n1 1 4\n2 1 3\n3 1 5\n4 3 12\n1 1 4"]
null
Java 11
standard input
[ "brute force", "dfs and similar", "graphs", "implementation" ]
67c748999e681fa6f60165f411e5149d
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases in the test. Each test case's description is preceded by a blank line. Next is a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2000$$$; $$$1 \le m \le 2000$$$) — the height and width of the board. This line...
2,300
For each test case, output three integers $$$r$$$, $$$c$$$ and $$$d$$$ ($$$1 \le r \le n$$$; $$$1 \le c \le m$$$; $$$d \ge 0$$$), which denote that the robot should start moving from cell $$$(r, c)$$$ to make the maximum number of moves $$$d$$$. If there are several answers, output any of them.
standard output
PASSED
9598842b10dc24e7233793a52e738f22
train_108.jsonl
1635863700
The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c...
256 megabytes
// package c1607; import java.io.File; import java.lang.invoke.MethodHandles; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Random; import java.util.Scanner; // // Codeforces Round #753 (Div. 3) 2021-11-02 06:35 // F. Robot on the Board 2 // https://codeforces.com/c...
Java
["7\n\n1 1\nR\n\n1 3\nRRL\n\n2 2\nDL\nRU\n\n2 2\nUD\nRU\n\n3 2\nDL\nUL\nRU\n\n4 4\nRRRD\nRUUD\nURUD\nULLR\n\n4 4\nDDLU\nRDDU\nUUUU\nRDLD"]
2 seconds
["1 1 1\n1 1 3\n1 1 4\n2 1 3\n3 1 5\n4 3 12\n1 1 4"]
null
Java 11
standard input
[ "brute force", "dfs and similar", "graphs", "implementation" ]
67c748999e681fa6f60165f411e5149d
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases in the test. Each test case's description is preceded by a blank line. Next is a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2000$$$; $$$1 \le m \le 2000$$$) — the height and width of the board. This line...
2,300
For each test case, output three integers $$$r$$$, $$$c$$$ and $$$d$$$ ($$$1 \le r \le n$$$; $$$1 \le c \le m$$$; $$$d \ge 0$$$), which denote that the robot should start moving from cell $$$(r, c)$$$ to make the maximum number of moves $$$d$$$. If there are several answers, output any of them.
standard output
PASSED
5d7835a46e234d4df47e5667ca38c389
train_108.jsonl
1635863700
The robot is located on a checkered rectangular board of size $$$n \times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The rows in the board are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the columns — from $$$1$$$ to $$$m$$$ from left to right.The robot is able to move from the current cell to one of the four c...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.Random; import java.util.Stack; import java.util.StringTokenizer; public class codeforces_753_E2 { private static void solve(FastIOAdapter io) { int n = io.nextInt(); int m = io.nextInt(); char[][] a = new char[n][]; ...
Java
["7\n\n1 1\nR\n\n1 3\nRRL\n\n2 2\nDL\nRU\n\n2 2\nUD\nRU\n\n3 2\nDL\nUL\nRU\n\n4 4\nRRRD\nRUUD\nURUD\nULLR\n\n4 4\nDDLU\nRDDU\nUUUU\nRDLD"]
2 seconds
["1 1 1\n1 1 3\n1 1 4\n2 1 3\n3 1 5\n4 3 12\n1 1 4"]
null
Java 11
standard input
[ "brute force", "dfs and similar", "graphs", "implementation" ]
67c748999e681fa6f60165f411e5149d
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases in the test. Each test case's description is preceded by a blank line. Next is a line that contains integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2000$$$; $$$1 \le m \le 2000$$$) — the height and width of the board. This line...
2,300
For each test case, output three integers $$$r$$$, $$$c$$$ and $$$d$$$ ($$$1 \le r \le n$$$; $$$1 \le c \le m$$$; $$$d \ge 0$$$), which denote that the robot should start moving from cell $$$(r, c)$$$ to make the maximum number of moves $$$d$$$. If there are several answers, output any of them.
standard output