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
73cef69273919c8f61b674366b36461b
train_109.jsonl
1642257300
Major Ram is being chased by his arch enemy Raghav. Ram must reach the top of the building to escape via helicopter. The building, however, is on fire. Ram must choose the optimal path to reach the top of the building to lose the minimum amount of health.The building consists of $$$n$$$ floors, each with $$$m$$$ rooms ...
256 megabytes
import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.Map; import ...
Java
["4\n\n5 3 3\n\n5 17 8 1 4\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n6 3 3\n\n5 17 8 1 4 2\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n5 3 1\n\n5 17 8 1 4\n\n1 3 5 3 100\n\n5 5 5\n\n3 2 3 7 5\n\n3 5 4 2 1\n\n2 2 5 4 5\n\n4 4 5 2 3\n\n1 2 4 2 2\n\n3 3 5 2 4"]
2 seconds
["16\nNO ESCAPE\n-90\n27"]
NoteThe figure for the first test case is in the statement. There are only $$$2$$$ possible paths to $$$(n, m)$$$: Ram travels to $$$(1, 3)$$$, takes the ladder to $$$(3, 3)$$$, travels to $$$(3, 2)$$$, takes the ladder to $$$(5, 1)$$$, travels to $$$(5, 3)$$$ where he finally escapes via helicopter. The health lost ...
Java 8
standard input
[ "data structures", "dp", "implementation", "shortest paths", "two pointers" ]
0c2fd0e84b88d407a3bd583d8879de34
The first line of input contains $$$t$$$ ($$$1 \leq t \leq 5 \cdot 10^4$$$) — the number of test cases. The first line of each test case consists of $$$3$$$ integers $$$n, m, k$$$ ($$$2 \leq n, m \leq 10^5$$$; $$$1 \leq k \leq 10^5$$$) — the number of floors, the number of rooms on each floor and the number of ladders ...
2,200
Output the minimum health Ram loses on the optimal path from $$$(1, 1)$$$ to $$$(n, m)$$$. If Ram cannot escape the clutches of Raghav regardless of the path he takes, output "NO ESCAPE" (all uppercase, without quotes).
standard output
PASSED
d73fbac1f03d19d3daaf15aa1c274e70
train_109.jsonl
1642257300
Major Ram is being chased by his arch enemy Raghav. Ram must reach the top of the building to escape via helicopter. The building, however, is on fire. Ram must choose the optimal path to reach the top of the building to lose the minimum amount of health.The building consists of $$$n$$$ floors, each with $$$m$$$ rooms ...
256 megabytes
import java.util.*; import java.util.function.*; import java.io.*; // you can compare with output.txt and expected out public class Round766E { MyPrintWriter out; MyScanner in; // final static long FIXED_RANDOM; // static { // FIXED_RANDOM = System.currentTimeMillis(); // } final static String IMPO...
Java
["4\n\n5 3 3\n\n5 17 8 1 4\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n6 3 3\n\n5 17 8 1 4 2\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n5 3 1\n\n5 17 8 1 4\n\n1 3 5 3 100\n\n5 5 5\n\n3 2 3 7 5\n\n3 5 4 2 1\n\n2 2 5 4 5\n\n4 4 5 2 3\n\n1 2 4 2 2\n\n3 3 5 2 4"]
2 seconds
["16\nNO ESCAPE\n-90\n27"]
NoteThe figure for the first test case is in the statement. There are only $$$2$$$ possible paths to $$$(n, m)$$$: Ram travels to $$$(1, 3)$$$, takes the ladder to $$$(3, 3)$$$, travels to $$$(3, 2)$$$, takes the ladder to $$$(5, 1)$$$, travels to $$$(5, 3)$$$ where he finally escapes via helicopter. The health lost ...
Java 17
standard input
[ "data structures", "dp", "implementation", "shortest paths", "two pointers" ]
0c2fd0e84b88d407a3bd583d8879de34
The first line of input contains $$$t$$$ ($$$1 \leq t \leq 5 \cdot 10^4$$$) — the number of test cases. The first line of each test case consists of $$$3$$$ integers $$$n, m, k$$$ ($$$2 \leq n, m \leq 10^5$$$; $$$1 \leq k \leq 10^5$$$) — the number of floors, the number of rooms on each floor and the number of ladders ...
2,200
Output the minimum health Ram loses on the optimal path from $$$(1, 1)$$$ to $$$(n, m)$$$. If Ram cannot escape the clutches of Raghav regardless of the path he takes, output "NO ESCAPE" (all uppercase, without quotes).
standard output
PASSED
ed2853b149e991bb2c411e260d4f4008
train_109.jsonl
1642257300
Major Ram is being chased by his arch enemy Raghav. Ram must reach the top of the building to escape via helicopter. The building, however, is on fire. Ram must choose the optimal path to reach the top of the building to lose the minimum amount of health.The building consists of $$$n$$$ floors, each with $$$m$$$ rooms ...
256 megabytes
import java.io.*; import java.util.*; public class E1637 { public static void main(String[] args) throws IOException, FileNotFoundException { // Scanner in = new Scanner(new File("test.in")); Kattio in = new Kattio(); int T = in.nextInt(); while(T > 0){ T--; int N = in.nextInt(); i...
Java
["4\n\n5 3 3\n\n5 17 8 1 4\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n6 3 3\n\n5 17 8 1 4 2\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n5 3 1\n\n5 17 8 1 4\n\n1 3 5 3 100\n\n5 5 5\n\n3 2 3 7 5\n\n3 5 4 2 1\n\n2 2 5 4 5\n\n4 4 5 2 3\n\n1 2 4 2 2\n\n3 3 5 2 4"]
2 seconds
["16\nNO ESCAPE\n-90\n27"]
NoteThe figure for the first test case is in the statement. There are only $$$2$$$ possible paths to $$$(n, m)$$$: Ram travels to $$$(1, 3)$$$, takes the ladder to $$$(3, 3)$$$, travels to $$$(3, 2)$$$, takes the ladder to $$$(5, 1)$$$, travels to $$$(5, 3)$$$ where he finally escapes via helicopter. The health lost ...
Java 11
standard input
[ "data structures", "dp", "implementation", "shortest paths", "two pointers" ]
0c2fd0e84b88d407a3bd583d8879de34
The first line of input contains $$$t$$$ ($$$1 \leq t \leq 5 \cdot 10^4$$$) — the number of test cases. The first line of each test case consists of $$$3$$$ integers $$$n, m, k$$$ ($$$2 \leq n, m \leq 10^5$$$; $$$1 \leq k \leq 10^5$$$) — the number of floors, the number of rooms on each floor and the number of ladders ...
2,200
Output the minimum health Ram loses on the optimal path from $$$(1, 1)$$$ to $$$(n, m)$$$. If Ram cannot escape the clutches of Raghav regardless of the path he takes, output "NO ESCAPE" (all uppercase, without quotes).
standard output
PASSED
383267779f2a148184b5c7701aec3e00
train_109.jsonl
1642257300
Major Ram is being chased by his arch enemy Raghav. Ram must reach the top of the building to escape via helicopter. The building, however, is on fire. Ram must choose the optimal path to reach the top of the building to lose the minimum amount of health.The building consists of $$$n$$$ floors, each with $$$m$$$ rooms ...
256 megabytes
import java.io.*; import java.util.*; public class E1637 { public static void main(String[] args) throws IOException, FileNotFoundException { // Scanner in = new Scanner(new File("test.in")); Kattio in = new Kattio(); int T = in.nextInt(); while(T > 0){ T--; int N = in.nextInt(); i...
Java
["4\n\n5 3 3\n\n5 17 8 1 4\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n6 3 3\n\n5 17 8 1 4 2\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n5 3 1\n\n5 17 8 1 4\n\n1 3 5 3 100\n\n5 5 5\n\n3 2 3 7 5\n\n3 5 4 2 1\n\n2 2 5 4 5\n\n4 4 5 2 3\n\n1 2 4 2 2\n\n3 3 5 2 4"]
2 seconds
["16\nNO ESCAPE\n-90\n27"]
NoteThe figure for the first test case is in the statement. There are only $$$2$$$ possible paths to $$$(n, m)$$$: Ram travels to $$$(1, 3)$$$, takes the ladder to $$$(3, 3)$$$, travels to $$$(3, 2)$$$, takes the ladder to $$$(5, 1)$$$, travels to $$$(5, 3)$$$ where he finally escapes via helicopter. The health lost ...
Java 11
standard input
[ "data structures", "dp", "implementation", "shortest paths", "two pointers" ]
0c2fd0e84b88d407a3bd583d8879de34
The first line of input contains $$$t$$$ ($$$1 \leq t \leq 5 \cdot 10^4$$$) — the number of test cases. The first line of each test case consists of $$$3$$$ integers $$$n, m, k$$$ ($$$2 \leq n, m \leq 10^5$$$; $$$1 \leq k \leq 10^5$$$) — the number of floors, the number of rooms on each floor and the number of ladders ...
2,200
Output the minimum health Ram loses on the optimal path from $$$(1, 1)$$$ to $$$(n, m)$$$. If Ram cannot escape the clutches of Raghav regardless of the path he takes, output "NO ESCAPE" (all uppercase, without quotes).
standard output
PASSED
2c6f1204e0d35e506bb5d5d5704f1f35
train_109.jsonl
1642257300
Major Ram is being chased by his arch enemy Raghav. Ram must reach the top of the building to escape via helicopter. The building, however, is on fire. Ram must choose the optimal path to reach the top of the building to lose the minimum amount of health.The building consists of $$$n$$$ floors, each with $$$m$$$ rooms ...
256 megabytes
import java.util.*; import java.io.*; public class E { public static long INF = 0x3f3f3f3f3f3f3f3fL; public static void main(String[] args) { var io = new Kattio(System.in, System.out); int t = io.nextInt(); for (int i = 0; i < t; i++) { solve(io); } io.cl...
Java
["4\n\n5 3 3\n\n5 17 8 1 4\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n6 3 3\n\n5 17 8 1 4 2\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n5 3 1\n\n5 17 8 1 4\n\n1 3 5 3 100\n\n5 5 5\n\n3 2 3 7 5\n\n3 5 4 2 1\n\n2 2 5 4 5\n\n4 4 5 2 3\n\n1 2 4 2 2\n\n3 3 5 2 4"]
2 seconds
["16\nNO ESCAPE\n-90\n27"]
NoteThe figure for the first test case is in the statement. There are only $$$2$$$ possible paths to $$$(n, m)$$$: Ram travels to $$$(1, 3)$$$, takes the ladder to $$$(3, 3)$$$, travels to $$$(3, 2)$$$, takes the ladder to $$$(5, 1)$$$, travels to $$$(5, 3)$$$ where he finally escapes via helicopter. The health lost ...
Java 11
standard input
[ "data structures", "dp", "implementation", "shortest paths", "two pointers" ]
0c2fd0e84b88d407a3bd583d8879de34
The first line of input contains $$$t$$$ ($$$1 \leq t \leq 5 \cdot 10^4$$$) — the number of test cases. The first line of each test case consists of $$$3$$$ integers $$$n, m, k$$$ ($$$2 \leq n, m \leq 10^5$$$; $$$1 \leq k \leq 10^5$$$) — the number of floors, the number of rooms on each floor and the number of ladders ...
2,200
Output the minimum health Ram loses on the optimal path from $$$(1, 1)$$$ to $$$(n, m)$$$. If Ram cannot escape the clutches of Raghav regardless of the path he takes, output "NO ESCAPE" (all uppercase, without quotes).
standard output
PASSED
111c347614498eb5af7e514b293c1d6e
train_109.jsonl
1642257300
Major Ram is being chased by his arch enemy Raghav. Ram must reach the top of the building to escape via helicopter. The building, however, is on fire. Ram must choose the optimal path to reach the top of the building to lose the minimum amount of health.The building consists of $$$n$$$ floors, each with $$$m$$$ rooms ...
256 megabytes
//Utilities import java.io.*; import java.util.*; public class a { static int t; static int n, m, k; static int a, b, c, d, h; static long[] x; static ArrayList<Ladder>[] start; static TreeMap<Integer, Long>[] dp; static long res; public static void main(String[] args) throws IOException { t ...
Java
["4\n\n5 3 3\n\n5 17 8 1 4\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n6 3 3\n\n5 17 8 1 4 2\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n5 3 1\n\n5 17 8 1 4\n\n1 3 5 3 100\n\n5 5 5\n\n3 2 3 7 5\n\n3 5 4 2 1\n\n2 2 5 4 5\n\n4 4 5 2 3\n\n1 2 4 2 2\n\n3 3 5 2 4"]
2 seconds
["16\nNO ESCAPE\n-90\n27"]
NoteThe figure for the first test case is in the statement. There are only $$$2$$$ possible paths to $$$(n, m)$$$: Ram travels to $$$(1, 3)$$$, takes the ladder to $$$(3, 3)$$$, travels to $$$(3, 2)$$$, takes the ladder to $$$(5, 1)$$$, travels to $$$(5, 3)$$$ where he finally escapes via helicopter. The health lost ...
Java 11
standard input
[ "data structures", "dp", "implementation", "shortest paths", "two pointers" ]
0c2fd0e84b88d407a3bd583d8879de34
The first line of input contains $$$t$$$ ($$$1 \leq t \leq 5 \cdot 10^4$$$) — the number of test cases. The first line of each test case consists of $$$3$$$ integers $$$n, m, k$$$ ($$$2 \leq n, m \leq 10^5$$$; $$$1 \leq k \leq 10^5$$$) — the number of floors, the number of rooms on each floor and the number of ladders ...
2,200
Output the minimum health Ram loses on the optimal path from $$$(1, 1)$$$ to $$$(n, m)$$$. If Ram cannot escape the clutches of Raghav regardless of the path he takes, output "NO ESCAPE" (all uppercase, without quotes).
standard output
PASSED
590d71a8b9ed2fe12942cdde65d91cba
train_109.jsonl
1642257300
Major Ram is being chased by his arch enemy Raghav. Ram must reach the top of the building to escape via helicopter. The building, however, is on fire. Ram must choose the optimal path to reach the top of the building to lose the minimum amount of health.The building consists of $$$n$$$ floors, each with $$$m$$$ rooms ...
256 megabytes
import java.util.*; public class Ram3_peeked { static class Ladder { Room target; int healthLost; } static class Room { int floor; int room; long health; ArrayList<Ladder> ladders = new ArrayList<>(); } static Scanner in = new Scann...
Java
["4\n\n5 3 3\n\n5 17 8 1 4\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n6 3 3\n\n5 17 8 1 4 2\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n5 3 1\n\n5 17 8 1 4\n\n1 3 5 3 100\n\n5 5 5\n\n3 2 3 7 5\n\n3 5 4 2 1\n\n2 2 5 4 5\n\n4 4 5 2 3\n\n1 2 4 2 2\n\n3 3 5 2 4"]
2 seconds
["16\nNO ESCAPE\n-90\n27"]
NoteThe figure for the first test case is in the statement. There are only $$$2$$$ possible paths to $$$(n, m)$$$: Ram travels to $$$(1, 3)$$$, takes the ladder to $$$(3, 3)$$$, travels to $$$(3, 2)$$$, takes the ladder to $$$(5, 1)$$$, travels to $$$(5, 3)$$$ where he finally escapes via helicopter. The health lost ...
Java 11
standard input
[ "data structures", "dp", "implementation", "shortest paths", "two pointers" ]
0c2fd0e84b88d407a3bd583d8879de34
The first line of input contains $$$t$$$ ($$$1 \leq t \leq 5 \cdot 10^4$$$) — the number of test cases. The first line of each test case consists of $$$3$$$ integers $$$n, m, k$$$ ($$$2 \leq n, m \leq 10^5$$$; $$$1 \leq k \leq 10^5$$$) — the number of floors, the number of rooms on each floor and the number of ladders ...
2,200
Output the minimum health Ram loses on the optimal path from $$$(1, 1)$$$ to $$$(n, m)$$$. If Ram cannot escape the clutches of Raghav regardless of the path he takes, output "NO ESCAPE" (all uppercase, without quotes).
standard output
PASSED
710d2afa237c1dbe26071c0c5421f55c
train_109.jsonl
1642257300
Major Ram is being chased by his arch enemy Raghav. Ram must reach the top of the building to escape via helicopter. The building, however, is on fire. Ram must choose the optimal path to reach the top of the building to lose the minimum amount of health.The building consists of $$$n$$$ floors, each with $$$m$$$ rooms ...
256 megabytes
import java.io.*; import java.util.*; public class q5 { public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); // public static long mod = 1000000007; public static class Point implements Comparable<Point>{ long b; long c; Point next; ...
Java
["4\n\n5 3 3\n\n5 17 8 1 4\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n6 3 3\n\n5 17 8 1 4 2\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n5 3 1\n\n5 17 8 1 4\n\n1 3 5 3 100\n\n5 5 5\n\n3 2 3 7 5\n\n3 5 4 2 1\n\n2 2 5 4 5\n\n4 4 5 2 3\n\n1 2 4 2 2\n\n3 3 5 2 4"]
2 seconds
["16\nNO ESCAPE\n-90\n27"]
NoteThe figure for the first test case is in the statement. There are only $$$2$$$ possible paths to $$$(n, m)$$$: Ram travels to $$$(1, 3)$$$, takes the ladder to $$$(3, 3)$$$, travels to $$$(3, 2)$$$, takes the ladder to $$$(5, 1)$$$, travels to $$$(5, 3)$$$ where he finally escapes via helicopter. The health lost ...
Java 11
standard input
[ "data structures", "dp", "implementation", "shortest paths", "two pointers" ]
0c2fd0e84b88d407a3bd583d8879de34
The first line of input contains $$$t$$$ ($$$1 \leq t \leq 5 \cdot 10^4$$$) — the number of test cases. The first line of each test case consists of $$$3$$$ integers $$$n, m, k$$$ ($$$2 \leq n, m \leq 10^5$$$; $$$1 \leq k \leq 10^5$$$) — the number of floors, the number of rooms on each floor and the number of ladders ...
2,200
Output the minimum health Ram loses on the optimal path from $$$(1, 1)$$$ to $$$(n, m)$$$. If Ram cannot escape the clutches of Raghav regardless of the path he takes, output "NO ESCAPE" (all uppercase, without quotes).
standard output
PASSED
62b13f9df60be757fca7bd5b0ff2add8
train_109.jsonl
1642257300
Major Ram is being chased by his arch enemy Raghav. Ram must reach the top of the building to escape via helicopter. The building, however, is on fire. Ram must choose the optimal path to reach the top of the building to lose the minimum amount of health.The building consists of $$$n$$$ floors, each with $$$m$$$ rooms ...
256 megabytes
//package notescaping; import java.util.*; import java.io.*; public class notescaping { public static void main(String[] args) throws IOException { BufferedReader fin = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(fin.readLine()); StringBuilder fout = new StringBuilde...
Java
["4\n\n5 3 3\n\n5 17 8 1 4\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n6 3 3\n\n5 17 8 1 4 2\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n5 3 1\n\n5 17 8 1 4\n\n1 3 5 3 100\n\n5 5 5\n\n3 2 3 7 5\n\n3 5 4 2 1\n\n2 2 5 4 5\n\n4 4 5 2 3\n\n1 2 4 2 2\n\n3 3 5 2 4"]
2 seconds
["16\nNO ESCAPE\n-90\n27"]
NoteThe figure for the first test case is in the statement. There are only $$$2$$$ possible paths to $$$(n, m)$$$: Ram travels to $$$(1, 3)$$$, takes the ladder to $$$(3, 3)$$$, travels to $$$(3, 2)$$$, takes the ladder to $$$(5, 1)$$$, travels to $$$(5, 3)$$$ where he finally escapes via helicopter. The health lost ...
Java 11
standard input
[ "data structures", "dp", "implementation", "shortest paths", "two pointers" ]
0c2fd0e84b88d407a3bd583d8879de34
The first line of input contains $$$t$$$ ($$$1 \leq t \leq 5 \cdot 10^4$$$) — the number of test cases. The first line of each test case consists of $$$3$$$ integers $$$n, m, k$$$ ($$$2 \leq n, m \leq 10^5$$$; $$$1 \leq k \leq 10^5$$$) — the number of floors, the number of rooms on each floor and the number of ladders ...
2,200
Output the minimum health Ram loses on the optimal path from $$$(1, 1)$$$ to $$$(n, m)$$$. If Ram cannot escape the clutches of Raghav regardless of the path he takes, output "NO ESCAPE" (all uppercase, without quotes).
standard output
PASSED
17d9e2813e219977a636648f12df9a09
train_109.jsonl
1642257300
Major Ram is being chased by his arch enemy Raghav. Ram must reach the top of the building to escape via helicopter. The building, however, is on fire. Ram must choose the optimal path to reach the top of the building to lose the minimum amount of health.The building consists of $$$n$$$ floors, each with $$$m$$$ rooms ...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; public class Main{ public static void main(String args[]){ InputReader in=new InputReader(System.in); TASK solver = new TASK(); int t=1; t = in.nextInt(); for(int i=1;i<=t;i++) { ...
Java
["4\n\n5 3 3\n\n5 17 8 1 4\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n6 3 3\n\n5 17 8 1 4 2\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n5 3 1\n\n5 17 8 1 4\n\n1 3 5 3 100\n\n5 5 5\n\n3 2 3 7 5\n\n3 5 4 2 1\n\n2 2 5 4 5\n\n4 4 5 2 3\n\n1 2 4 2 2\n\n3 3 5 2 4"]
2 seconds
["16\nNO ESCAPE\n-90\n27"]
NoteThe figure for the first test case is in the statement. There are only $$$2$$$ possible paths to $$$(n, m)$$$: Ram travels to $$$(1, 3)$$$, takes the ladder to $$$(3, 3)$$$, travels to $$$(3, 2)$$$, takes the ladder to $$$(5, 1)$$$, travels to $$$(5, 3)$$$ where he finally escapes via helicopter. The health lost ...
Java 11
standard input
[ "data structures", "dp", "implementation", "shortest paths", "two pointers" ]
0c2fd0e84b88d407a3bd583d8879de34
The first line of input contains $$$t$$$ ($$$1 \leq t \leq 5 \cdot 10^4$$$) — the number of test cases. The first line of each test case consists of $$$3$$$ integers $$$n, m, k$$$ ($$$2 \leq n, m \leq 10^5$$$; $$$1 \leq k \leq 10^5$$$) — the number of floors, the number of rooms on each floor and the number of ladders ...
2,200
Output the minimum health Ram loses on the optimal path from $$$(1, 1)$$$ to $$$(n, m)$$$. If Ram cannot escape the clutches of Raghav regardless of the path he takes, output "NO ESCAPE" (all uppercase, without quotes).
standard output
PASSED
c115568422a68e3ee3f2466c79bb0f90
train_109.jsonl
1642257300
Major Ram is being chased by his arch enemy Raghav. Ram must reach the top of the building to escape via helicopter. The building, however, is on fire. Ram must choose the optimal path to reach the top of the building to lose the minimum amount of health.The building consists of $$$n$$$ floors, each with $$$m$$$ rooms ...
256 megabytes
/* "Everything in the universe is balanced. Every disappointment you face in life will be balanced by something good for you! Keep going, never give up." Just have Patience + 1... */ import java.util.*; import java.lang.*; import ...
Java
["4\n\n5 3 3\n\n5 17 8 1 4\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n6 3 3\n\n5 17 8 1 4 2\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n5 3 1\n\n5 17 8 1 4\n\n1 3 5 3 100\n\n5 5 5\n\n3 2 3 7 5\n\n3 5 4 2 1\n\n2 2 5 4 5\n\n4 4 5 2 3\n\n1 2 4 2 2\n\n3 3 5 2 4"]
2 seconds
["16\nNO ESCAPE\n-90\n27"]
NoteThe figure for the first test case is in the statement. There are only $$$2$$$ possible paths to $$$(n, m)$$$: Ram travels to $$$(1, 3)$$$, takes the ladder to $$$(3, 3)$$$, travels to $$$(3, 2)$$$, takes the ladder to $$$(5, 1)$$$, travels to $$$(5, 3)$$$ where he finally escapes via helicopter. The health lost ...
Java 11
standard input
[ "data structures", "dp", "implementation", "shortest paths", "two pointers" ]
0c2fd0e84b88d407a3bd583d8879de34
The first line of input contains $$$t$$$ ($$$1 \leq t \leq 5 \cdot 10^4$$$) — the number of test cases. The first line of each test case consists of $$$3$$$ integers $$$n, m, k$$$ ($$$2 \leq n, m \leq 10^5$$$; $$$1 \leq k \leq 10^5$$$) — the number of floors, the number of rooms on each floor and the number of ladders ...
2,200
Output the minimum health Ram loses on the optimal path from $$$(1, 1)$$$ to $$$(n, m)$$$. If Ram cannot escape the clutches of Raghav regardless of the path he takes, output "NO ESCAPE" (all uppercase, without quotes).
standard output
PASSED
9b9442526e65523645f72ea64e0a317c
train_109.jsonl
1642257300
Major Ram is being chased by his arch enemy Raghav. Ram must reach the top of the building to escape via helicopter. The building, however, is on fire. Ram must choose the optimal path to reach the top of the building to lose the minimum amount of health.The building consists of $$$n$$$ floors, each with $$$m$$$ rooms ...
256 megabytes
/* "Everything in the universe is balanced. Every disappointment you face in life will be balanced by something good for you! Keep going, never give up." Just have Patience + 1... */ import java.util.*; import java.lang.*; import ...
Java
["4\n\n5 3 3\n\n5 17 8 1 4\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n6 3 3\n\n5 17 8 1 4 2\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n5 3 1\n\n5 17 8 1 4\n\n1 3 5 3 100\n\n5 5 5\n\n3 2 3 7 5\n\n3 5 4 2 1\n\n2 2 5 4 5\n\n4 4 5 2 3\n\n1 2 4 2 2\n\n3 3 5 2 4"]
2 seconds
["16\nNO ESCAPE\n-90\n27"]
NoteThe figure for the first test case is in the statement. There are only $$$2$$$ possible paths to $$$(n, m)$$$: Ram travels to $$$(1, 3)$$$, takes the ladder to $$$(3, 3)$$$, travels to $$$(3, 2)$$$, takes the ladder to $$$(5, 1)$$$, travels to $$$(5, 3)$$$ where he finally escapes via helicopter. The health lost ...
Java 11
standard input
[ "data structures", "dp", "implementation", "shortest paths", "two pointers" ]
0c2fd0e84b88d407a3bd583d8879de34
The first line of input contains $$$t$$$ ($$$1 \leq t \leq 5 \cdot 10^4$$$) — the number of test cases. The first line of each test case consists of $$$3$$$ integers $$$n, m, k$$$ ($$$2 \leq n, m \leq 10^5$$$; $$$1 \leq k \leq 10^5$$$) — the number of floors, the number of rooms on each floor and the number of ladders ...
2,200
Output the minimum health Ram loses on the optimal path from $$$(1, 1)$$$ to $$$(n, m)$$$. If Ram cannot escape the clutches of Raghav regardless of the path he takes, output "NO ESCAPE" (all uppercase, without quotes).
standard output
PASSED
1c9dbc05201aaccf53f18db2d619192f
train_109.jsonl
1642257300
Major Ram is being chased by his arch enemy Raghav. Ram must reach the top of the building to escape via helicopter. The building, however, is on fire. Ram must choose the optimal path to reach the top of the building to lose the minimum amount of health.The building consists of $$$n$$$ floors, each with $$$m$$$ rooms ...
256 megabytes
/* "Everything in the universe is balanced. Every disappointment you face in life will be balanced by something good for you! Keep going, never give up." Just have Patience + 1... */ import java.util.*; import java.lang.*; import ...
Java
["4\n\n5 3 3\n\n5 17 8 1 4\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n6 3 3\n\n5 17 8 1 4 2\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n5 3 1\n\n5 17 8 1 4\n\n1 3 5 3 100\n\n5 5 5\n\n3 2 3 7 5\n\n3 5 4 2 1\n\n2 2 5 4 5\n\n4 4 5 2 3\n\n1 2 4 2 2\n\n3 3 5 2 4"]
2 seconds
["16\nNO ESCAPE\n-90\n27"]
NoteThe figure for the first test case is in the statement. There are only $$$2$$$ possible paths to $$$(n, m)$$$: Ram travels to $$$(1, 3)$$$, takes the ladder to $$$(3, 3)$$$, travels to $$$(3, 2)$$$, takes the ladder to $$$(5, 1)$$$, travels to $$$(5, 3)$$$ where he finally escapes via helicopter. The health lost ...
Java 11
standard input
[ "data structures", "dp", "implementation", "shortest paths", "two pointers" ]
0c2fd0e84b88d407a3bd583d8879de34
The first line of input contains $$$t$$$ ($$$1 \leq t \leq 5 \cdot 10^4$$$) — the number of test cases. The first line of each test case consists of $$$3$$$ integers $$$n, m, k$$$ ($$$2 \leq n, m \leq 10^5$$$; $$$1 \leq k \leq 10^5$$$) — the number of floors, the number of rooms on each floor and the number of ladders ...
2,200
Output the minimum health Ram loses on the optimal path from $$$(1, 1)$$$ to $$$(n, m)$$$. If Ram cannot escape the clutches of Raghav regardless of the path he takes, output "NO ESCAPE" (all uppercase, without quotes).
standard output
PASSED
e8dc2143527c97096ad5ad80d4939e00
train_109.jsonl
1642257300
Major Ram is being chased by his arch enemy Raghav. Ram must reach the top of the building to escape via helicopter. The building, however, is on fire. Ram must choose the optimal path to reach the top of the building to lose the minimum amount of health.The building consists of $$$n$$$ floors, each with $$$m$$$ rooms ...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { static int MOD = 1000000007; // After writing solution, quick scan for: // array out of bounds // special cases e.g. n=1? // npe, particularly in maps // // Big numbers arithmetic bugs: // in...
Java
["4\n\n5 3 3\n\n5 17 8 1 4\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n6 3 3\n\n5 17 8 1 4 2\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n5 3 1\n\n5 17 8 1 4\n\n1 3 5 3 100\n\n5 5 5\n\n3 2 3 7 5\n\n3 5 4 2 1\n\n2 2 5 4 5\n\n4 4 5 2 3\n\n1 2 4 2 2\n\n3 3 5 2 4"]
2 seconds
["16\nNO ESCAPE\n-90\n27"]
NoteThe figure for the first test case is in the statement. There are only $$$2$$$ possible paths to $$$(n, m)$$$: Ram travels to $$$(1, 3)$$$, takes the ladder to $$$(3, 3)$$$, travels to $$$(3, 2)$$$, takes the ladder to $$$(5, 1)$$$, travels to $$$(5, 3)$$$ where he finally escapes via helicopter. The health lost ...
Java 11
standard input
[ "data structures", "dp", "implementation", "shortest paths", "two pointers" ]
0c2fd0e84b88d407a3bd583d8879de34
The first line of input contains $$$t$$$ ($$$1 \leq t \leq 5 \cdot 10^4$$$) — the number of test cases. The first line of each test case consists of $$$3$$$ integers $$$n, m, k$$$ ($$$2 \leq n, m \leq 10^5$$$; $$$1 \leq k \leq 10^5$$$) — the number of floors, the number of rooms on each floor and the number of ladders ...
2,200
Output the minimum health Ram loses on the optimal path from $$$(1, 1)$$$ to $$$(n, m)$$$. If Ram cannot escape the clutches of Raghav regardless of the path he takes, output "NO ESCAPE" (all uppercase, without quotes).
standard output
PASSED
71476d61790d40f7961595507d8ffa49
train_109.jsonl
1642257300
Major Ram is being chased by his arch enemy Raghav. Ram must reach the top of the building to escape via helicopter. The building, however, is on fire. Ram must choose the optimal path to reach the top of the building to lose the minimum amount of health.The building consists of $$$n$$$ floors, each with $$$m$$$ rooms ...
256 megabytes
import java.util.*; import java.io.*; public class _766 { public static void main(String[] args) { MyScanner sc = new MyScanner(); PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt...
Java
["4\n\n5 3 3\n\n5 17 8 1 4\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n6 3 3\n\n5 17 8 1 4 2\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n5 3 1\n\n5 17 8 1 4\n\n1 3 5 3 100\n\n5 5 5\n\n3 2 3 7 5\n\n3 5 4 2 1\n\n2 2 5 4 5\n\n4 4 5 2 3\n\n1 2 4 2 2\n\n3 3 5 2 4"]
2 seconds
["16\nNO ESCAPE\n-90\n27"]
NoteThe figure for the first test case is in the statement. There are only $$$2$$$ possible paths to $$$(n, m)$$$: Ram travels to $$$(1, 3)$$$, takes the ladder to $$$(3, 3)$$$, travels to $$$(3, 2)$$$, takes the ladder to $$$(5, 1)$$$, travels to $$$(5, 3)$$$ where he finally escapes via helicopter. The health lost ...
Java 11
standard input
[ "data structures", "dp", "implementation", "shortest paths", "two pointers" ]
0c2fd0e84b88d407a3bd583d8879de34
The first line of input contains $$$t$$$ ($$$1 \leq t \leq 5 \cdot 10^4$$$) — the number of test cases. The first line of each test case consists of $$$3$$$ integers $$$n, m, k$$$ ($$$2 \leq n, m \leq 10^5$$$; $$$1 \leq k \leq 10^5$$$) — the number of floors, the number of rooms on each floor and the number of ladders ...
2,200
Output the minimum health Ram loses on the optimal path from $$$(1, 1)$$$ to $$$(n, m)$$$. If Ram cannot escape the clutches of Raghav regardless of the path he takes, output "NO ESCAPE" (all uppercase, without quotes).
standard output
PASSED
637ce8976f5ec7c570d13769d3132b24
train_109.jsonl
1642257300
Major Ram is being chased by his arch enemy Raghav. Ram must reach the top of the building to escape via helicopter. The building, however, is on fire. Ram must choose the optimal path to reach the top of the building to lose the minimum amount of health.The building consists of $$$n$$$ floors, each with $$$m$$$ rooms ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.Arrays; import java.util.PriorityQueue; public class E_NotEscaping_766 { static long INF = (long) 1e18; static long BLANK = -INF; static Ladder[] lad...
Java
["4\n\n5 3 3\n\n5 17 8 1 4\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n6 3 3\n\n5 17 8 1 4 2\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n5 3 1\n\n5 17 8 1 4\n\n1 3 5 3 100\n\n5 5 5\n\n3 2 3 7 5\n\n3 5 4 2 1\n\n2 2 5 4 5\n\n4 4 5 2 3\n\n1 2 4 2 2\n\n3 3 5 2 4"]
2 seconds
["16\nNO ESCAPE\n-90\n27"]
NoteThe figure for the first test case is in the statement. There are only $$$2$$$ possible paths to $$$(n, m)$$$: Ram travels to $$$(1, 3)$$$, takes the ladder to $$$(3, 3)$$$, travels to $$$(3, 2)$$$, takes the ladder to $$$(5, 1)$$$, travels to $$$(5, 3)$$$ where he finally escapes via helicopter. The health lost ...
Java 11
standard input
[ "data structures", "dp", "implementation", "shortest paths", "two pointers" ]
0c2fd0e84b88d407a3bd583d8879de34
The first line of input contains $$$t$$$ ($$$1 \leq t \leq 5 \cdot 10^4$$$) — the number of test cases. The first line of each test case consists of $$$3$$$ integers $$$n, m, k$$$ ($$$2 \leq n, m \leq 10^5$$$; $$$1 \leq k \leq 10^5$$$) — the number of floors, the number of rooms on each floor and the number of ladders ...
2,200
Output the minimum health Ram loses on the optimal path from $$$(1, 1)$$$ to $$$(n, m)$$$. If Ram cannot escape the clutches of Raghav regardless of the path he takes, output "NO ESCAPE" (all uppercase, without quotes).
standard output
PASSED
1d197e84364131bfa1c33ae48cd2ed35
train_109.jsonl
1642257300
Major Ram is being chased by his arch enemy Raghav. Ram must reach the top of the building to escape via helicopter. The building, however, is on fire. Ram must choose the optimal path to reach the top of the building to lose the minimum amount of health.The building consists of $$$n$$$ floors, each with $$$m$$$ rooms ...
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.Collections; import java.util.Comparator; import java.util.StringTokenizer; /...
Java
["4\n\n5 3 3\n\n5 17 8 1 4\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n6 3 3\n\n5 17 8 1 4 2\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n5 3 1\n\n5 17 8 1 4\n\n1 3 5 3 100\n\n5 5 5\n\n3 2 3 7 5\n\n3 5 4 2 1\n\n2 2 5 4 5\n\n4 4 5 2 3\n\n1 2 4 2 2\n\n3 3 5 2 4"]
2 seconds
["16\nNO ESCAPE\n-90\n27"]
NoteThe figure for the first test case is in the statement. There are only $$$2$$$ possible paths to $$$(n, m)$$$: Ram travels to $$$(1, 3)$$$, takes the ladder to $$$(3, 3)$$$, travels to $$$(3, 2)$$$, takes the ladder to $$$(5, 1)$$$, travels to $$$(5, 3)$$$ where he finally escapes via helicopter. The health lost ...
Java 11
standard input
[ "data structures", "dp", "implementation", "shortest paths", "two pointers" ]
0c2fd0e84b88d407a3bd583d8879de34
The first line of input contains $$$t$$$ ($$$1 \leq t \leq 5 \cdot 10^4$$$) — the number of test cases. The first line of each test case consists of $$$3$$$ integers $$$n, m, k$$$ ($$$2 \leq n, m \leq 10^5$$$; $$$1 \leq k \leq 10^5$$$) — the number of floors, the number of rooms on each floor and the number of ladders ...
2,200
Output the minimum health Ram loses on the optimal path from $$$(1, 1)$$$ to $$$(n, m)$$$. If Ram cannot escape the clutches of Raghav regardless of the path he takes, output "NO ESCAPE" (all uppercase, without quotes).
standard output
PASSED
84b0dd3fb5b87c74f2f591f5e59d1ea6
train_109.jsonl
1642257300
Major Ram is being chased by his arch enemy Raghav. Ram must reach the top of the building to escape via helicopter. The building, however, is on fire. Ram must choose the optimal path to reach the top of the building to lose the minimum amount of health.The building consists of $$$n$$$ floors, each with $$$m$$$ rooms ...
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.Collections; import java.util.Comparator; import java.util.List; import java.u...
Java
["4\n\n5 3 3\n\n5 17 8 1 4\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n6 3 3\n\n5 17 8 1 4 2\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n5 3 1\n\n5 17 8 1 4\n\n1 3 5 3 100\n\n5 5 5\n\n3 2 3 7 5\n\n3 5 4 2 1\n\n2 2 5 4 5\n\n4 4 5 2 3\n\n1 2 4 2 2\n\n3 3 5 2 4"]
2 seconds
["16\nNO ESCAPE\n-90\n27"]
NoteThe figure for the first test case is in the statement. There are only $$$2$$$ possible paths to $$$(n, m)$$$: Ram travels to $$$(1, 3)$$$, takes the ladder to $$$(3, 3)$$$, travels to $$$(3, 2)$$$, takes the ladder to $$$(5, 1)$$$, travels to $$$(5, 3)$$$ where he finally escapes via helicopter. The health lost ...
Java 11
standard input
[ "data structures", "dp", "implementation", "shortest paths", "two pointers" ]
0c2fd0e84b88d407a3bd583d8879de34
The first line of input contains $$$t$$$ ($$$1 \leq t \leq 5 \cdot 10^4$$$) — the number of test cases. The first line of each test case consists of $$$3$$$ integers $$$n, m, k$$$ ($$$2 \leq n, m \leq 10^5$$$; $$$1 \leq k \leq 10^5$$$) — the number of floors, the number of rooms on each floor and the number of ladders ...
2,200
Output the minimum health Ram loses on the optimal path from $$$(1, 1)$$$ to $$$(n, m)$$$. If Ram cannot escape the clutches of Raghav regardless of the path he takes, output "NO ESCAPE" (all uppercase, without quotes).
standard output
PASSED
4cc6f3c19e9b55ecb7597dfd3c4180e8
train_109.jsonl
1642257300
Major Ram is being chased by his arch enemy Raghav. Ram must reach the top of the building to escape via helicopter. The building, however, is on fire. Ram must choose the optimal path to reach the top of the building to lose the minimum amount of health.The building consists of $$$n$$$ floors, each with $$$m$$$ rooms ...
256 megabytes
import java.io.DataInputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.TreeMap; public class Main { private static final long max_ans = 100000L * 100000L * 1000000L + 10L; private static void run() thr...
Java
["4\n\n5 3 3\n\n5 17 8 1 4\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n6 3 3\n\n5 17 8 1 4 2\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n5 3 1\n\n5 17 8 1 4\n\n1 3 5 3 100\n\n5 5 5\n\n3 2 3 7 5\n\n3 5 4 2 1\n\n2 2 5 4 5\n\n4 4 5 2 3\n\n1 2 4 2 2\n\n3 3 5 2 4"]
2 seconds
["16\nNO ESCAPE\n-90\n27"]
NoteThe figure for the first test case is in the statement. There are only $$$2$$$ possible paths to $$$(n, m)$$$: Ram travels to $$$(1, 3)$$$, takes the ladder to $$$(3, 3)$$$, travels to $$$(3, 2)$$$, takes the ladder to $$$(5, 1)$$$, travels to $$$(5, 3)$$$ where he finally escapes via helicopter. The health lost ...
Java 11
standard input
[ "data structures", "dp", "implementation", "shortest paths", "two pointers" ]
0c2fd0e84b88d407a3bd583d8879de34
The first line of input contains $$$t$$$ ($$$1 \leq t \leq 5 \cdot 10^4$$$) — the number of test cases. The first line of each test case consists of $$$3$$$ integers $$$n, m, k$$$ ($$$2 \leq n, m \leq 10^5$$$; $$$1 \leq k \leq 10^5$$$) — the number of floors, the number of rooms on each floor and the number of ladders ...
2,200
Output the minimum health Ram loses on the optimal path from $$$(1, 1)$$$ to $$$(n, m)$$$. If Ram cannot escape the clutches of Raghav regardless of the path he takes, output "NO ESCAPE" (all uppercase, without quotes).
standard output
PASSED
f1dfb62231c5d62c641ede1c08d02cb9
train_109.jsonl
1642257300
Major Ram is being chased by his arch enemy Raghav. Ram must reach the top of the building to escape via helicopter. The building, however, is on fire. Ram must choose the optimal path to reach the top of the building to lose the minimum amount of health.The building consists of $$$n$$$ floors, each with $$$m$$$ rooms ...
256 megabytes
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.Collections; import java.util.PriorityQueue; import java.util.Random; import java.util.StringTokenizer; import java.uti...
Java
["4\n\n5 3 3\n\n5 17 8 1 4\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n6 3 3\n\n5 17 8 1 4 2\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n5 3 1\n\n5 17 8 1 4\n\n1 3 5 3 100\n\n5 5 5\n\n3 2 3 7 5\n\n3 5 4 2 1\n\n2 2 5 4 5\n\n4 4 5 2 3\n\n1 2 4 2 2\n\n3 3 5 2 4"]
2 seconds
["16\nNO ESCAPE\n-90\n27"]
NoteThe figure for the first test case is in the statement. There are only $$$2$$$ possible paths to $$$(n, m)$$$: Ram travels to $$$(1, 3)$$$, takes the ladder to $$$(3, 3)$$$, travels to $$$(3, 2)$$$, takes the ladder to $$$(5, 1)$$$, travels to $$$(5, 3)$$$ where he finally escapes via helicopter. The health lost ...
Java 11
standard input
[ "data structures", "dp", "implementation", "shortest paths", "two pointers" ]
0c2fd0e84b88d407a3bd583d8879de34
The first line of input contains $$$t$$$ ($$$1 \leq t \leq 5 \cdot 10^4$$$) — the number of test cases. The first line of each test case consists of $$$3$$$ integers $$$n, m, k$$$ ($$$2 \leq n, m \leq 10^5$$$; $$$1 \leq k \leq 10^5$$$) — the number of floors, the number of rooms on each floor and the number of ladders ...
2,200
Output the minimum health Ram loses on the optimal path from $$$(1, 1)$$$ to $$$(n, m)$$$. If Ram cannot escape the clutches of Raghav regardless of the path he takes, output "NO ESCAPE" (all uppercase, without quotes).
standard output
PASSED
3a01c847e082aa587fd521d4f511ceb8
train_109.jsonl
1642257300
Major Ram is being chased by his arch enemy Raghav. Ram must reach the top of the building to escape via helicopter. The building, however, is on fire. Ram must choose the optimal path to reach the top of the building to lose the minimum amount of health.The building consists of $$$n$$$ floors, each with $$$m$$$ rooms ...
256 megabytes
import java.util.*; import java.io.*; public class _1627_E { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); int t = Integer.parseInt(in.readLine()); ...
Java
["4\n\n5 3 3\n\n5 17 8 1 4\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n6 3 3\n\n5 17 8 1 4 2\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n5 3 1\n\n5 17 8 1 4\n\n1 3 5 3 100\n\n5 5 5\n\n3 2 3 7 5\n\n3 5 4 2 1\n\n2 2 5 4 5\n\n4 4 5 2 3\n\n1 2 4 2 2\n\n3 3 5 2 4"]
2 seconds
["16\nNO ESCAPE\n-90\n27"]
NoteThe figure for the first test case is in the statement. There are only $$$2$$$ possible paths to $$$(n, m)$$$: Ram travels to $$$(1, 3)$$$, takes the ladder to $$$(3, 3)$$$, travels to $$$(3, 2)$$$, takes the ladder to $$$(5, 1)$$$, travels to $$$(5, 3)$$$ where he finally escapes via helicopter. The health lost ...
Java 11
standard input
[ "data structures", "dp", "implementation", "shortest paths", "two pointers" ]
0c2fd0e84b88d407a3bd583d8879de34
The first line of input contains $$$t$$$ ($$$1 \leq t \leq 5 \cdot 10^4$$$) — the number of test cases. The first line of each test case consists of $$$3$$$ integers $$$n, m, k$$$ ($$$2 \leq n, m \leq 10^5$$$; $$$1 \leq k \leq 10^5$$$) — the number of floors, the number of rooms on each floor and the number of ladders ...
2,200
Output the minimum health Ram loses on the optimal path from $$$(1, 1)$$$ to $$$(n, m)$$$. If Ram cannot escape the clutches of Raghav regardless of the path he takes, output "NO ESCAPE" (all uppercase, without quotes).
standard output
PASSED
97434dc111338e5a11e51970f43b8158
train_109.jsonl
1642257300
Major Ram is being chased by his arch enemy Raghav. Ram must reach the top of the building to escape via helicopter. The building, however, is on fire. Ram must choose the optimal path to reach the top of the building to lose the minimum amount of health.The building consists of $$$n$$$ floors, each with $$$m$$$ rooms ...
256 megabytes
import java.io.*; import java.util.*; public class Solution extends PrintWriter { void solve() { int t = sc.nextInt(); for(int i = 1; i <= t; i++) { test_case(); } } void test_case() { int n = sc.nextInt(); int m = sc.nextInt(); ...
Java
["4\n\n5 3 3\n\n5 17 8 1 4\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n6 3 3\n\n5 17 8 1 4 2\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n5 3 1\n\n5 17 8 1 4\n\n1 3 5 3 100\n\n5 5 5\n\n3 2 3 7 5\n\n3 5 4 2 1\n\n2 2 5 4 5\n\n4 4 5 2 3\n\n1 2 4 2 2\n\n3 3 5 2 4"]
2 seconds
["16\nNO ESCAPE\n-90\n27"]
NoteThe figure for the first test case is in the statement. There are only $$$2$$$ possible paths to $$$(n, m)$$$: Ram travels to $$$(1, 3)$$$, takes the ladder to $$$(3, 3)$$$, travels to $$$(3, 2)$$$, takes the ladder to $$$(5, 1)$$$, travels to $$$(5, 3)$$$ where he finally escapes via helicopter. The health lost ...
Java 11
standard input
[ "data structures", "dp", "implementation", "shortest paths", "two pointers" ]
0c2fd0e84b88d407a3bd583d8879de34
The first line of input contains $$$t$$$ ($$$1 \leq t \leq 5 \cdot 10^4$$$) — the number of test cases. The first line of each test case consists of $$$3$$$ integers $$$n, m, k$$$ ($$$2 \leq n, m \leq 10^5$$$; $$$1 \leq k \leq 10^5$$$) — the number of floors, the number of rooms on each floor and the number of ladders ...
2,200
Output the minimum health Ram loses on the optimal path from $$$(1, 1)$$$ to $$$(n, m)$$$. If Ram cannot escape the clutches of Raghav regardless of the path he takes, output "NO ESCAPE" (all uppercase, without quotes).
standard output
PASSED
96c50ada54b6c4e297799a45936d6abc
train_109.jsonl
1642257300
Major Ram is being chased by his arch enemy Raghav. Ram must reach the top of the building to escape via helicopter. The building, however, is on fire. Ram must choose the optimal path to reach the top of the building to lose the minimum amount of health.The building consists of $$$n$$$ floors, each with $$$m$$$ rooms ...
256 megabytes
// package c1627; import java.io.File; import java.lang.invoke.MethodHandles; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Random; import java.util.Scanner; import java.util.TreeMap; // // Codeforces Round #766 (Div. 2) 2022-01-15 06:35 // E. Not ...
Java
["4\n\n5 3 3\n\n5 17 8 1 4\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n6 3 3\n\n5 17 8 1 4 2\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n5 3 1\n\n5 17 8 1 4\n\n1 3 5 3 100\n\n5 5 5\n\n3 2 3 7 5\n\n3 5 4 2 1\n\n2 2 5 4 5\n\n4 4 5 2 3\n\n1 2 4 2 2\n\n3 3 5 2 4"]
2 seconds
["16\nNO ESCAPE\n-90\n27"]
NoteThe figure for the first test case is in the statement. There are only $$$2$$$ possible paths to $$$(n, m)$$$: Ram travels to $$$(1, 3)$$$, takes the ladder to $$$(3, 3)$$$, travels to $$$(3, 2)$$$, takes the ladder to $$$(5, 1)$$$, travels to $$$(5, 3)$$$ where he finally escapes via helicopter. The health lost ...
Java 11
standard input
[ "data structures", "dp", "implementation", "shortest paths", "two pointers" ]
0c2fd0e84b88d407a3bd583d8879de34
The first line of input contains $$$t$$$ ($$$1 \leq t \leq 5 \cdot 10^4$$$) — the number of test cases. The first line of each test case consists of $$$3$$$ integers $$$n, m, k$$$ ($$$2 \leq n, m \leq 10^5$$$; $$$1 \leq k \leq 10^5$$$) — the number of floors, the number of rooms on each floor and the number of ladders ...
2,200
Output the minimum health Ram loses on the optimal path from $$$(1, 1)$$$ to $$$(n, m)$$$. If Ram cannot escape the clutches of Raghav regardless of the path he takes, output "NO ESCAPE" (all uppercase, without quotes).
standard output
PASSED
0e48be118ebc6b6b2e320f40c66e2964
train_109.jsonl
1642257300
Major Ram is being chased by his arch enemy Raghav. Ram must reach the top of the building to escape via helicopter. The building, however, is on fire. Ram must choose the optimal path to reach the top of the building to lose the minimum amount of health.The building consists of $$$n$$$ floors, each with $$$m$$$ rooms ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Set; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.util.TreeMap; import java.util.Map; import java.util.Map.Ent...
Java
["4\n\n5 3 3\n\n5 17 8 1 4\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n6 3 3\n\n5 17 8 1 4 2\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n5 3 1\n\n5 17 8 1 4\n\n1 3 5 3 100\n\n5 5 5\n\n3 2 3 7 5\n\n3 5 4 2 1\n\n2 2 5 4 5\n\n4 4 5 2 3\n\n1 2 4 2 2\n\n3 3 5 2 4"]
2 seconds
["16\nNO ESCAPE\n-90\n27"]
NoteThe figure for the first test case is in the statement. There are only $$$2$$$ possible paths to $$$(n, m)$$$: Ram travels to $$$(1, 3)$$$, takes the ladder to $$$(3, 3)$$$, travels to $$$(3, 2)$$$, takes the ladder to $$$(5, 1)$$$, travels to $$$(5, 3)$$$ where he finally escapes via helicopter. The health lost ...
Java 11
standard input
[ "data structures", "dp", "implementation", "shortest paths", "two pointers" ]
0c2fd0e84b88d407a3bd583d8879de34
The first line of input contains $$$t$$$ ($$$1 \leq t \leq 5 \cdot 10^4$$$) — the number of test cases. The first line of each test case consists of $$$3$$$ integers $$$n, m, k$$$ ($$$2 \leq n, m \leq 10^5$$$; $$$1 \leq k \leq 10^5$$$) — the number of floors, the number of rooms on each floor and the number of ladders ...
2,200
Output the minimum health Ram loses on the optimal path from $$$(1, 1)$$$ to $$$(n, m)$$$. If Ram cannot escape the clutches of Raghav regardless of the path he takes, output "NO ESCAPE" (all uppercase, without quotes).
standard output
PASSED
dabf0a780f2b3607f84f6610d9ba1ad5
train_109.jsonl
1642257300
Major Ram is being chased by his arch enemy Raghav. Ram must reach the top of the building to escape via helicopter. The building, however, is on fire. Ram must choose the optimal path to reach the top of the building to lose the minimum amount of health.The building consists of $$$n$$$ floors, each with $$$m$$$ rooms ...
256 megabytes
import java.io.*; import java.util.*; public class CF1627E extends PrintWriter { CF1627E() { super(System.out); } static class Scanner { Scanner(InputStream in) { this.in = in; } InputStream in; byte[] bb = new byte[1 << 15]; int i, n; byte getc() { if (i == n) { i = n = 0; try { n = in.read(bb); } ...
Java
["4\n\n5 3 3\n\n5 17 8 1 4\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n6 3 3\n\n5 17 8 1 4 2\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n5 3 1\n\n5 17 8 1 4\n\n1 3 5 3 100\n\n5 5 5\n\n3 2 3 7 5\n\n3 5 4 2 1\n\n2 2 5 4 5\n\n4 4 5 2 3\n\n1 2 4 2 2\n\n3 3 5 2 4"]
2 seconds
["16\nNO ESCAPE\n-90\n27"]
NoteThe figure for the first test case is in the statement. There are only $$$2$$$ possible paths to $$$(n, m)$$$: Ram travels to $$$(1, 3)$$$, takes the ladder to $$$(3, 3)$$$, travels to $$$(3, 2)$$$, takes the ladder to $$$(5, 1)$$$, travels to $$$(5, 3)$$$ where he finally escapes via helicopter. The health lost ...
Java 11
standard input
[ "data structures", "dp", "implementation", "shortest paths", "two pointers" ]
0c2fd0e84b88d407a3bd583d8879de34
The first line of input contains $$$t$$$ ($$$1 \leq t \leq 5 \cdot 10^4$$$) — the number of test cases. The first line of each test case consists of $$$3$$$ integers $$$n, m, k$$$ ($$$2 \leq n, m \leq 10^5$$$; $$$1 \leq k \leq 10^5$$$) — the number of floors, the number of rooms on each floor and the number of ladders ...
2,200
Output the minimum health Ram loses on the optimal path from $$$(1, 1)$$$ to $$$(n, m)$$$. If Ram cannot escape the clutches of Raghav regardless of the path he takes, output "NO ESCAPE" (all uppercase, without quotes).
standard output
PASSED
d40e3869c6c63204a303d416ab768c1a
train_109.jsonl
1642257300
Major Ram is being chased by his arch enemy Raghav. Ram must reach the top of the building to escape via helicopter. The building, however, is on fire. Ram must choose the optimal path to reach the top of the building to lose the minimum amount of health.The building consists of $$$n$$$ floors, each with $$$m$$$ rooms ...
256 megabytes
import java.io.DataInputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.TreeMap; public class Main { private static final long max_ans = 100000L * 100000L * 1000000L + 10L; private static void run() thr...
Java
["4\n\n5 3 3\n\n5 17 8 1 4\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n6 3 3\n\n5 17 8 1 4 2\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n5 3 1\n\n5 17 8 1 4\n\n1 3 5 3 100\n\n5 5 5\n\n3 2 3 7 5\n\n3 5 4 2 1\n\n2 2 5 4 5\n\n4 4 5 2 3\n\n1 2 4 2 2\n\n3 3 5 2 4"]
2 seconds
["16\nNO ESCAPE\n-90\n27"]
NoteThe figure for the first test case is in the statement. There are only $$$2$$$ possible paths to $$$(n, m)$$$: Ram travels to $$$(1, 3)$$$, takes the ladder to $$$(3, 3)$$$, travels to $$$(3, 2)$$$, takes the ladder to $$$(5, 1)$$$, travels to $$$(5, 3)$$$ where he finally escapes via helicopter. The health lost ...
Java 11
standard input
[ "data structures", "dp", "implementation", "shortest paths", "two pointers" ]
0c2fd0e84b88d407a3bd583d8879de34
The first line of input contains $$$t$$$ ($$$1 \leq t \leq 5 \cdot 10^4$$$) — the number of test cases. The first line of each test case consists of $$$3$$$ integers $$$n, m, k$$$ ($$$2 \leq n, m \leq 10^5$$$; $$$1 \leq k \leq 10^5$$$) — the number of floors, the number of rooms on each floor and the number of ladders ...
2,200
Output the minimum health Ram loses on the optimal path from $$$(1, 1)$$$ to $$$(n, m)$$$. If Ram cannot escape the clutches of Raghav regardless of the path he takes, output "NO ESCAPE" (all uppercase, without quotes).
standard output
PASSED
d69627ebdf71128c4b907dad9017becc
train_109.jsonl
1642257300
Major Ram is being chased by his arch enemy Raghav. Ram must reach the top of the building to escape via helicopter. The building, however, is on fire. Ram must choose the optimal path to reach the top of the building to lose the minimum amount of health.The building consists of $$$n$$$ floors, each with $$$m$$$ rooms ...
256 megabytes
import java.io.*; import java.util.*; public class CF1627E extends PrintWriter { CF1627E() { super(System.out); } static class Scanner { Scanner(InputStream in) { this.in = in; } InputStream in; byte[] bb = new byte[1 << 15]; int i, n; byte getc() { if (i == n) { i = n = 0; try { n = in.r...
Java
["4\n\n5 3 3\n\n5 17 8 1 4\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n6 3 3\n\n5 17 8 1 4 2\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n5 3 1\n\n5 17 8 1 4\n\n1 3 5 3 100\n\n5 5 5\n\n3 2 3 7 5\n\n3 5 4 2 1\n\n2 2 5 4 5\n\n4 4 5 2 3\n\n1 2 4 2 2\n\n3 3 5 2 4"]
2 seconds
["16\nNO ESCAPE\n-90\n27"]
NoteThe figure for the first test case is in the statement. There are only $$$2$$$ possible paths to $$$(n, m)$$$: Ram travels to $$$(1, 3)$$$, takes the ladder to $$$(3, 3)$$$, travels to $$$(3, 2)$$$, takes the ladder to $$$(5, 1)$$$, travels to $$$(5, 3)$$$ where he finally escapes via helicopter. The health lost ...
Java 11
standard input
[ "data structures", "dp", "implementation", "shortest paths", "two pointers" ]
0c2fd0e84b88d407a3bd583d8879de34
The first line of input contains $$$t$$$ ($$$1 \leq t \leq 5 \cdot 10^4$$$) — the number of test cases. The first line of each test case consists of $$$3$$$ integers $$$n, m, k$$$ ($$$2 \leq n, m \leq 10^5$$$; $$$1 \leq k \leq 10^5$$$) — the number of floors, the number of rooms on each floor and the number of ladders ...
2,200
Output the minimum health Ram loses on the optimal path from $$$(1, 1)$$$ to $$$(n, m)$$$. If Ram cannot escape the clutches of Raghav regardless of the path he takes, output "NO ESCAPE" (all uppercase, without quotes).
standard output
PASSED
6af4396c7207506d47ccab90d9609831
train_109.jsonl
1642257300
Major Ram is being chased by his arch enemy Raghav. Ram must reach the top of the building to escape via helicopter. The building, however, is on fire. Ram must choose the optimal path to reach the top of the building to lose the minimum amount of health.The building consists of $$$n$$$ floors, each with $$$m$$$ rooms ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class CF1627E { final static long INF = (long) 1e18; private static int addVertex(TreeMap<Integer, TreeMap<Integer, Integer>> mapV, int x, int y, int i) { if (mapV.containsKey(x) && ...
Java
["4\n\n5 3 3\n\n5 17 8 1 4\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n6 3 3\n\n5 17 8 1 4 2\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n5 3 1\n\n5 17 8 1 4\n\n1 3 5 3 100\n\n5 5 5\n\n3 2 3 7 5\n\n3 5 4 2 1\n\n2 2 5 4 5\n\n4 4 5 2 3\n\n1 2 4 2 2\n\n3 3 5 2 4"]
2 seconds
["16\nNO ESCAPE\n-90\n27"]
NoteThe figure for the first test case is in the statement. There are only $$$2$$$ possible paths to $$$(n, m)$$$: Ram travels to $$$(1, 3)$$$, takes the ladder to $$$(3, 3)$$$, travels to $$$(3, 2)$$$, takes the ladder to $$$(5, 1)$$$, travels to $$$(5, 3)$$$ where he finally escapes via helicopter. The health lost ...
Java 11
standard input
[ "data structures", "dp", "implementation", "shortest paths", "two pointers" ]
0c2fd0e84b88d407a3bd583d8879de34
The first line of input contains $$$t$$$ ($$$1 \leq t \leq 5 \cdot 10^4$$$) — the number of test cases. The first line of each test case consists of $$$3$$$ integers $$$n, m, k$$$ ($$$2 \leq n, m \leq 10^5$$$; $$$1 \leq k \leq 10^5$$$) — the number of floors, the number of rooms on each floor and the number of ladders ...
2,200
Output the minimum health Ram loses on the optimal path from $$$(1, 1)$$$ to $$$(n, m)$$$. If Ram cannot escape the clutches of Raghav regardless of the path he takes, output "NO ESCAPE" (all uppercase, without quotes).
standard output
PASSED
e2f3b2dd289a71300ba39fbe6aabbda5
train_109.jsonl
1642257300
Major Ram is being chased by his arch enemy Raghav. Ram must reach the top of the building to escape via helicopter. The building, however, is on fire. Ram must choose the optimal path to reach the top of the building to lose the minimum amount of health.The building consists of $$$n$$$ floors, each with $$$m$$$ rooms ...
256 megabytes
import java.util.*; import java.io.*; public class E { public static long INF = 0x3f3f3f3f3f3f3f3fL; public static void main(String[] args) { var io = new Kattio(System.in, System.out); int t = io.nextInt(); for (int i = 0; i < t; i++) { solve(io); } ...
Java
["4\n\n5 3 3\n\n5 17 8 1 4\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n6 3 3\n\n5 17 8 1 4 2\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n5 3 1\n\n5 17 8 1 4\n\n1 3 5 3 100\n\n5 5 5\n\n3 2 3 7 5\n\n3 5 4 2 1\n\n2 2 5 4 5\n\n4 4 5 2 3\n\n1 2 4 2 2\n\n3 3 5 2 4"]
2 seconds
["16\nNO ESCAPE\n-90\n27"]
NoteThe figure for the first test case is in the statement. There are only $$$2$$$ possible paths to $$$(n, m)$$$: Ram travels to $$$(1, 3)$$$, takes the ladder to $$$(3, 3)$$$, travels to $$$(3, 2)$$$, takes the ladder to $$$(5, 1)$$$, travels to $$$(5, 3)$$$ where he finally escapes via helicopter. The health lost ...
Java 11
standard input
[ "data structures", "dp", "implementation", "shortest paths", "two pointers" ]
0c2fd0e84b88d407a3bd583d8879de34
The first line of input contains $$$t$$$ ($$$1 \leq t \leq 5 \cdot 10^4$$$) — the number of test cases. The first line of each test case consists of $$$3$$$ integers $$$n, m, k$$$ ($$$2 \leq n, m \leq 10^5$$$; $$$1 \leq k \leq 10^5$$$) — the number of floors, the number of rooms on each floor and the number of ladders ...
2,200
Output the minimum health Ram loses on the optimal path from $$$(1, 1)$$$ to $$$(n, m)$$$. If Ram cannot escape the clutches of Raghav regardless of the path he takes, output "NO ESCAPE" (all uppercase, without quotes).
standard output
PASSED
216a3013876b4d58a0635f2efe09671f
train_109.jsonl
1642257300
Major Ram is being chased by his arch enemy Raghav. Ram must reach the top of the building to escape via helicopter. The building, however, is on fire. Ram must choose the optimal path to reach the top of the building to lose the minimum amount of health.The building consists of $$$n$$$ floors, each with $$$m$$$ rooms ...
256 megabytes
import java.util.*; import java.io.*; public class E { public static long INF = 0x3f3f3f3f3f3f3f3fL; public static void main(String[] args) { var io = new Kattio(System.in, System.out); int t = io.nextInt(); for (int i = 0; i < t; i++) { solve(io); } io.cl...
Java
["4\n\n5 3 3\n\n5 17 8 1 4\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n6 3 3\n\n5 17 8 1 4 2\n\n1 3 3 3 4\n\n3 1 5 2 5\n\n3 2 5 1 6\n\n5 3 1\n\n5 17 8 1 4\n\n1 3 5 3 100\n\n5 5 5\n\n3 2 3 7 5\n\n3 5 4 2 1\n\n2 2 5 4 5\n\n4 4 5 2 3\n\n1 2 4 2 2\n\n3 3 5 2 4"]
2 seconds
["16\nNO ESCAPE\n-90\n27"]
NoteThe figure for the first test case is in the statement. There are only $$$2$$$ possible paths to $$$(n, m)$$$: Ram travels to $$$(1, 3)$$$, takes the ladder to $$$(3, 3)$$$, travels to $$$(3, 2)$$$, takes the ladder to $$$(5, 1)$$$, travels to $$$(5, 3)$$$ where he finally escapes via helicopter. The health lost ...
Java 11
standard input
[ "data structures", "dp", "implementation", "shortest paths", "two pointers" ]
0c2fd0e84b88d407a3bd583d8879de34
The first line of input contains $$$t$$$ ($$$1 \leq t \leq 5 \cdot 10^4$$$) — the number of test cases. The first line of each test case consists of $$$3$$$ integers $$$n, m, k$$$ ($$$2 \leq n, m \leq 10^5$$$; $$$1 \leq k \leq 10^5$$$) — the number of floors, the number of rooms on each floor and the number of ladders ...
2,200
Output the minimum health Ram loses on the optimal path from $$$(1, 1)$$$ to $$$(n, m)$$$. If Ram cannot escape the clutches of Raghav regardless of the path he takes, output "NO ESCAPE" (all uppercase, without quotes).
standard output
PASSED
9eed455273cc0d4868b295fa72d41dbc
train_109.jsonl
1642257300
There is a $$$k \times k$$$ grid, where $$$k$$$ is even. The square in row $$$r$$$ and column $$$c$$$ is denoted by $$$(r,c)$$$. Two squares $$$(r_1, c_1)$$$ and $$$(r_2, c_2)$$$ are considered adjacent if $$$\lvert r_1 - r_2 \rvert + \lvert c_1 - c_2 \rvert = 1$$$.An array of adjacent pairs of squares is called strong...
512 megabytes
import java.util.*; import java.io.*; public class Solution{ static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader( new InputStreamReader(System.in)); } String ne...
Java
["3\n\n8 4\n\n1 2 1 3\n\n2 2 2 3\n\n3 2 3 3\n\n4 2 4 3\n\n1 4 2 4\n\n2 1 3 1\n\n2 2 3 2\n\n4 1 4 2\n\n7 2\n\n1 1 1 2\n\n2 1 2 2\n\n1 1 1 2\n\n1 1 2 1\n\n1 2 2 2\n\n1 1 2 1\n\n1 2 2 2\n\n1 6\n\n3 3 3 4"]
3 seconds
["7\n4\n1"]
NoteIn the first test case, the array $$$a$$$ is not good, but if we take the subsequence $$$[a_1, a_2, a_3, a_4, a_5, a_6, a_8]$$$, then the square can be split as shown in the statement.In the second test case, we can take the subsequence consisting of the last four elements of $$$a$$$ and cut the square with a horiz...
Java 8
standard input
[ "geometry", "graphs", "greedy", "implementation", "shortest paths" ]
6c1d534c1066997eb7e7963b4e783708
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two space-separated integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 10^5$$$; $$$2 \leq k \leq 50...
2,700
For each test case, output a single integer — the size of the largest strong subsequence of $$$a$$$.
standard output
PASSED
1e8d04b0c9532ba12cb03f4ba4437cfa
train_109.jsonl
1642257300
There is a $$$k \times k$$$ grid, where $$$k$$$ is even. The square in row $$$r$$$ and column $$$c$$$ is denoted by $$$(r,c)$$$. Two squares $$$(r_1, c_1)$$$ and $$$(r_2, c_2)$$$ are considered adjacent if $$$\lvert r_1 - r_2 \rvert + \lvert c_1 - c_2 \rvert = 1$$$.An array of adjacent pairs of squares is called strong...
512 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 x1627F { static final int INF = Integer...
Java
["3\n\n8 4\n\n1 2 1 3\n\n2 2 2 3\n\n3 2 3 3\n\n4 2 4 3\n\n1 4 2 4\n\n2 1 3 1\n\n2 2 3 2\n\n4 1 4 2\n\n7 2\n\n1 1 1 2\n\n2 1 2 2\n\n1 1 1 2\n\n1 1 2 1\n\n1 2 2 2\n\n1 1 2 1\n\n1 2 2 2\n\n1 6\n\n3 3 3 4"]
3 seconds
["7\n4\n1"]
NoteIn the first test case, the array $$$a$$$ is not good, but if we take the subsequence $$$[a_1, a_2, a_3, a_4, a_5, a_6, a_8]$$$, then the square can be split as shown in the statement.In the second test case, we can take the subsequence consisting of the last four elements of $$$a$$$ and cut the square with a horiz...
Java 8
standard input
[ "geometry", "graphs", "greedy", "implementation", "shortest paths" ]
6c1d534c1066997eb7e7963b4e783708
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two space-separated integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 10^5$$$; $$$2 \leq k \leq 50...
2,700
For each test case, output a single integer — the size of the largest strong subsequence of $$$a$$$.
standard output
PASSED
b7980e295915210d93dd2142db26fa7e
train_109.jsonl
1642257300
There is a $$$k \times k$$$ grid, where $$$k$$$ is even. The square in row $$$r$$$ and column $$$c$$$ is denoted by $$$(r,c)$$$. Two squares $$$(r_1, c_1)$$$ and $$$(r_2, c_2)$$$ are considered adjacent if $$$\lvert r_1 - r_2 \rvert + \lvert c_1 - c_2 \rvert = 1$$$.An array of adjacent pairs of squares is called strong...
512 megabytes
import java.io.*; import java.util.*; public class NotSplitting { static final int INF = 1000000000; public static void main(String[] args) { InputReader reader = new InputReader(System.in); PrintWriter writer = new PrintWriter(System.out, false); int T = reader.nextInt(); ...
Java
["3\n\n8 4\n\n1 2 1 3\n\n2 2 2 3\n\n3 2 3 3\n\n4 2 4 3\n\n1 4 2 4\n\n2 1 3 1\n\n2 2 3 2\n\n4 1 4 2\n\n7 2\n\n1 1 1 2\n\n2 1 2 2\n\n1 1 1 2\n\n1 1 2 1\n\n1 2 2 2\n\n1 1 2 1\n\n1 2 2 2\n\n1 6\n\n3 3 3 4"]
3 seconds
["7\n4\n1"]
NoteIn the first test case, the array $$$a$$$ is not good, but if we take the subsequence $$$[a_1, a_2, a_3, a_4, a_5, a_6, a_8]$$$, then the square can be split as shown in the statement.In the second test case, we can take the subsequence consisting of the last four elements of $$$a$$$ and cut the square with a horiz...
Java 11
standard input
[ "geometry", "graphs", "greedy", "implementation", "shortest paths" ]
6c1d534c1066997eb7e7963b4e783708
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two space-separated integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 10^5$$$; $$$2 \leq k \leq 50...
2,700
For each test case, output a single integer — the size of the largest strong subsequence of $$$a$$$.
standard output
PASSED
ffc332bd7b30d601c5f5e09ccd465e24
train_109.jsonl
1642257300
There is a $$$k \times k$$$ grid, where $$$k$$$ is even. The square in row $$$r$$$ and column $$$c$$$ is denoted by $$$(r,c)$$$. Two squares $$$(r_1, c_1)$$$ and $$$(r_2, c_2)$$$ are considered adjacent if $$$\lvert r_1 - r_2 \rvert + \lvert c_1 - c_2 \rvert = 1$$$.An array of adjacent pairs of squares is called strong...
512 megabytes
// package c1627; import java.io.File; import java.lang.invoke.MethodHandles; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Random; import java.util.Scanner; import java.util.Set; import java.util.TreeMap; // // Codeforces Round #766 (Div. 2) 2022-...
Java
["3\n\n8 4\n\n1 2 1 3\n\n2 2 2 3\n\n3 2 3 3\n\n4 2 4 3\n\n1 4 2 4\n\n2 1 3 1\n\n2 2 3 2\n\n4 1 4 2\n\n7 2\n\n1 1 1 2\n\n2 1 2 2\n\n1 1 1 2\n\n1 1 2 1\n\n1 2 2 2\n\n1 1 2 1\n\n1 2 2 2\n\n1 6\n\n3 3 3 4"]
3 seconds
["7\n4\n1"]
NoteIn the first test case, the array $$$a$$$ is not good, but if we take the subsequence $$$[a_1, a_2, a_3, a_4, a_5, a_6, a_8]$$$, then the square can be split as shown in the statement.In the second test case, we can take the subsequence consisting of the last four elements of $$$a$$$ and cut the square with a horiz...
Java 11
standard input
[ "geometry", "graphs", "greedy", "implementation", "shortest paths" ]
6c1d534c1066997eb7e7963b4e783708
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two space-separated integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 10^5$$$; $$$2 \leq k \leq 50...
2,700
For each test case, output a single integer — the size of the largest strong subsequence of $$$a$$$.
standard output
PASSED
807d521ac3c35baed060bc143d1914f9
train_109.jsonl
1642257300
There is a $$$k \times k$$$ grid, where $$$k$$$ is even. The square in row $$$r$$$ and column $$$c$$$ is denoted by $$$(r,c)$$$. Two squares $$$(r_1, c_1)$$$ and $$$(r_2, c_2)$$$ are considered adjacent if $$$\lvert r_1 - r_2 \rvert + \lvert c_1 - c_2 \rvert = 1$$$.An array of adjacent pairs of squares is called strong...
512 megabytes
import java.util.*; import java.io.*; public class F { public static final int INF = 0x3f3f3f3f; public static void main(String[] args) { var io = new Kattio(System.in, System.out); int t = io.nextInt(); for (int i = 0; i < t; i++) { solve(io); } ...
Java
["3\n\n8 4\n\n1 2 1 3\n\n2 2 2 3\n\n3 2 3 3\n\n4 2 4 3\n\n1 4 2 4\n\n2 1 3 1\n\n2 2 3 2\n\n4 1 4 2\n\n7 2\n\n1 1 1 2\n\n2 1 2 2\n\n1 1 1 2\n\n1 1 2 1\n\n1 2 2 2\n\n1 1 2 1\n\n1 2 2 2\n\n1 6\n\n3 3 3 4"]
3 seconds
["7\n4\n1"]
NoteIn the first test case, the array $$$a$$$ is not good, but if we take the subsequence $$$[a_1, a_2, a_3, a_4, a_5, a_6, a_8]$$$, then the square can be split as shown in the statement.In the second test case, we can take the subsequence consisting of the last four elements of $$$a$$$ and cut the square with a horiz...
Java 11
standard input
[ "geometry", "graphs", "greedy", "implementation", "shortest paths" ]
6c1d534c1066997eb7e7963b4e783708
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two space-separated integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 10^5$$$; $$$2 \leq k \leq 50...
2,700
For each test case, output a single integer — the size of the largest strong subsequence of $$$a$$$.
standard output
PASSED
c1937babbb7ad4d1ec4a21ca803ec8ad
train_109.jsonl
1642257300
There is a $$$k \times k$$$ grid, where $$$k$$$ is even. The square in row $$$r$$$ and column $$$c$$$ is denoted by $$$(r,c)$$$. Two squares $$$(r_1, c_1)$$$ and $$$(r_2, c_2)$$$ are considered adjacent if $$$\lvert r_1 - r_2 \rvert + \lvert c_1 - c_2 \rvert = 1$$$.An array of adjacent pairs of squares is called strong...
512 megabytes
import java.util.*; import java.io.*; public class F { public static final int INF = 0x3f3f3f3f; public static void main(String[] args) { var io = new Kattio(System.in, System.out); int t = io.nextInt(); for (int i = 0; i < t; i++) { solve(io); } io.close(...
Java
["3\n\n8 4\n\n1 2 1 3\n\n2 2 2 3\n\n3 2 3 3\n\n4 2 4 3\n\n1 4 2 4\n\n2 1 3 1\n\n2 2 3 2\n\n4 1 4 2\n\n7 2\n\n1 1 1 2\n\n2 1 2 2\n\n1 1 1 2\n\n1 1 2 1\n\n1 2 2 2\n\n1 1 2 1\n\n1 2 2 2\n\n1 6\n\n3 3 3 4"]
3 seconds
["7\n4\n1"]
NoteIn the first test case, the array $$$a$$$ is not good, but if we take the subsequence $$$[a_1, a_2, a_3, a_4, a_5, a_6, a_8]$$$, then the square can be split as shown in the statement.In the second test case, we can take the subsequence consisting of the last four elements of $$$a$$$ and cut the square with a horiz...
Java 11
standard input
[ "geometry", "graphs", "greedy", "implementation", "shortest paths" ]
6c1d534c1066997eb7e7963b4e783708
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two space-separated integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 10^5$$$; $$$2 \leq k \leq 50...
2,700
For each test case, output a single integer — the size of the largest strong subsequence of $$$a$$$.
standard output
PASSED
b00674e37b6ba864b3c198e00c5790b7
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.io.*; import java.util.*; public class ThreeSwimmers { public static void main(String[] args) throws IOException{ BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st; int N = Integer.parseInt(bf.readLine()); for(int i = 0; i < N; i++){ ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
0363b34518209eaa35f56d19adf48749
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.*; public class A_23 { public static void main(String[]args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { //Scanner sc=new Scanner(System.in); long p=sc.nextLong(); long a=sc.nextLong(); long b=sc.nextLong(); long c=sc.nextLong(); lon...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
d7823f4def4ce495b807a678f6a8d6dd
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.Arrays; import java.util.Scanner; public class ThreeSwimmers { static void findResult(long p, long a, long b, long c){ long[] total = new long[]{0,0,0}; total[0] = a - p%a; total[1] = b - p%b; total[2] = c - p%c; Arrays.sort(total); if(p%a==0 || p%b==0 || p%c==0){ System...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
b7152a11fdece05d1881d9a136ed835a
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.Scanner; public class cf1492A { public static void main(String[] args) { Scanner scan = new Scanner(System.in); long p = 0; long a = 0; long b = 0; long c = 0; int t = scan.nextInt(); long r = 0; int temp = 0; ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
2bc0ae0245ca33baba0e6ec101e605b1
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String args[]) { Scanner scn=new Scanner(System.in); int t=scn.nextInt(); while(t-->0){ long p=scn.nextLong(); long[] arr=new long[3]; for(int i=0;i<3;i++){ ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
0cb94edc17a0c53c4d8c49e79a1219e9
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { //antiKnapsack(); threeSwimmers(); } // public static void antiKnapsack(){ // Scanner sc = new Scanner(System.in); // int noOfInput = sc.nextInt(); // for (int i=0;...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
de869fa823147250cb4eb9705b5e1f76
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.util.Scanner; /** * * @author afsc1 */ public class threeSwimmers { static Scanner sc = new S...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
4d47a0ea28a1901aed36dfaa173ece90
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.*; public class Swim3 { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { long p = sc.nextLong(); long a = sc.nextLong(); long b = sc.nextLong(); long c = sc.nextLong(); System.out.println(Math.min...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
463f6269975104ac5d1aeb07a6044827
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.io.*; import java.math.BigInteger; import java.text.DecimalFormat; import java.util.*; //import jdk.javadoc.internal.doclets.toolkit.NestedClassWriter; public class Codeforces { static class Node { int val; Node left; Node right; public Node(int x) { // TODO Auto-g...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
af9f0e0f313540b4859f5ea4159a2669
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.*; public class threeswimmers { public static void main(String[] args) { int t; Scanner sc=new Scanner(System.in); t=sc.nextInt(); while(t-->0) { long p=sc.nextLong(); long a=sc.nextLong(); long b=sc.nextLong(); long c=sc.nextLong(); ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
d0dba207a607cce4147126a6dc596f3a
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); int mod = 1000000007; while (t...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
e30da48747cf29ca93ca253ec79eb74c
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class A { public static void main(String[] args) { FastReader fs = new FastReader(); StringBuilder sb = new StringBuilder(); int t = fs.nextInt();...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
a377129384b7a827058df379b4cb4f36
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.Arrays; import java.util.Scanner; public class _1098MaximumProduct { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t=sc.nextInt(); while(t>0) { long p=sc.nextLong(); long a=sc.nextLong(); long b=sc.nextLong(); long c=sc.nextLo...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
19cff5039053734e157e1a9dd110c22c
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.Scanner; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->=1){ long p = sc.nextLong(); long a = sc.nextLong(); long b = sc.nextLong(); long c...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
4d373d467c225018af110a18cd26239b
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
//package networking; import java.util.Scanner; public class MainNetworking { public static void main(String[] args) { //go to sleep :) Scanner scanner = new Scanner(System.in); long testCases = scanner.nextInt(); long p, result; long[] arr = new long[3]; ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
dba13124905282a56efe9c1d377cd723
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.*; public class Threeswimmers { public static void main(String[] args) { Scanner in = new Scanner(System.in); long sets = in.nextLong(); for (long i = 0; i < sets; i++) { long myTime = in.nextLong(); long timeA = i...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
19da65b626883a6ebd0f0effac76b420
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.Scanner; public class threeSwimmers { public static void tempsAttenduAvantPremierArrivee(){ Scanner scanner =new Scanner(System.in); int testNbr = scanner.nextInt(); for(int i=0; i<testNbr;i++){ String enter = scanner.nextLine(); long minutes...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
5377539724d7cfbdef3ae77eec7dc0e3
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.*; public class ThreeSwimmers { public static void main(String[] args){ Scanner input = new Scanner(System.in); int cases = input.nextInt(); for(int i=0;i<cases;i++) { long p = input.nextLong(); long a = input.nextLong(); long b = input.nextLong(); long c = input....
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
29051200041c9c3e0f12da1e7a18adac
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.*; public class CodeForces704 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int i = 0; i<t; i++){ System.out.println(solve(sc)); } } static long solve(Scanner sc) { ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
bf58b2ba710fde1fc537ceaf1fd782d7
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.io.*; import java.util.*; public class Solution{ static PrintWriter out = new PrintWriter(System.out); static int mod = 1000000009; public static void main(String[] args) throws IOException { FastReader fs = new FastReader(); int t = fs.nextInt(); while(t > 0){ long p = f...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
c9e4c9b5cf15990cd10908ddadc9d5c6
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.Scanner; public class file{ private static long solve(long p, long a, long b, long c){ if(p % a == 0 || p % b == 0 || p % c == 0){ return 0; } long first = a * ((p / a)+1) - p; long second = b * ((p / b)+1) - p; long third = c * ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
d5ca063b9fe9e49dbdb4bd5c7bd8081a
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
///*بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم*/// import java.math.BigDecimal; import java.math.BigInteger; import java.math.RoundingMode; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.Scanner; import java....
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
9c8f5e4cb0fcc1c0d4f417fbb8becc3f
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.io.*; import java.util.*; public class threeSwimmers { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); // String separated by delimitor in...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
d921858780eda9931aa2b546ae1f507f
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.io.*; import java.util.*; public class threeSwimmers { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); // String separated by delimitor in...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
f1055bd3743ec09fa43435b9fa37b46a
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Stack; import java.util.StringTokenizer; public class Solution { static class FastIO { BufferedReader br; StringTokenizer st; public FastIO() ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
4637cd14dd20dd6d90e30c9423077f1c
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.io.*; import java.math.BigInteger; import java.util.StringTokenizer; public class MainForces { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; FastScanner fs = new FastScanner(inputStream); ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
10adbcb544696de8e9a7c62a1cf60534
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.*; import static java.util.Arrays.sort; import javafx.util.Pair; public class Main { public static void main(String[] args) { FastScanner input = ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
6f57afa185f8d412fd7c4988d4078487
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; pub...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
349bc9ebb8a3e8f2b03ce78faa30d9f0
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 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 class Main { public static void main (String[] args) throws java.lang.Exception { // uncomment this lin...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
209868b6bb7918d6f2e61cde9b555794
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.Scanner; public class Main { static Scanner scan = new Scanner(System.in); /** * 999999999999999998 * 999999999998 * 1000000000000 * * 1000000000000 999999999999 999999999999 999999999999 */ public static void slove() { long p = scan.ne...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
c837e3da08f3a8a275d406dcdb36e616
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 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 j=0;j<t;j++) { long p=sc.nextLong(); long a=sc.nextLong(); long b=sc.nextLong(); long c=sc.nex...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
98afe67f19034088020077aae13f078a
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.*; public class Swimmer { public static long firstComer(long p,long a,long b,long c) { long RemA=p%a; long RemB=p%b; long RemC=p%c; if(RemA!=0&&RemB!=0&&RemC!=0) { long tArrivalA=a-RemA; long tArrivalB=b-RemB; long tArrivalC=c-RemC; return Math.min(tArrivalA, Math.min(tA...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
c29f7d9994ec89340d764991d34430e2
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import static java.lang.Math.abs; import static java.lang.Math.min; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; // https://codeforces.com/problemset/problem/1492/A public class ThreeSwimmers { ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
42e6633c63b111277ab8eb05d9b1c8c8
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 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(int i=1;i<=t;i++){ long a,b,c,p; p=sc.nextLong(); a=sc.nextLong(); b=sc.nextLong(); c=sc.nextLong(); long m=min(a,b,c); if((p%...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
4d82a49e3a2450714d8a168bc09a1c0d
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class Main { public static void main(String[] args) throws IOException { InputStre...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
ac74a9dcb6e110b31038853053b45d19
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 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 class Main { public static void main (String[] args) throws java.lang.Exception { Scanner sc = new Scanner(Syst...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
7556c59e336e51ef845379b6c8b88794
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; public class Swimer { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
288ceba35fdceae9b3bc703100d9d4e8
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.*; import java.math.*; import java.io.*; public class Hell{ public static void main(String args[]) { //Scanner sc = new Scanner(System.in); FastIo sc = new FastIo(); int t = sc.nextInt(); while(t--!=0) { BigInteger b[] = new BigInteger[4]; for(int i = 0; i<4; i++) b[i] = ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
34e2b7c7947612282e13a3fb9dee37d9
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.*; import java.math.*; public class Hell{ public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t--!=0) { BigInteger b[] = new BigInteger[4]; for(int i = 0; i<4; i++) b[i] = sc.nextBigInteger(); BigInteger rem = b[0]....
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
17aa041e383b8dfb33d72ac2f476574a
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.*; public class Swim3 { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { long p = sc.nextLong(); long a = sc.nextLong(); long b = sc.nextLong(); long c = sc.nextLong(); System.out.println(Math.min...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
9d53889a414af57d486b4ae712b375bb
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
//package com.company; import java.io.*; import java.util.*; public class Main { static void sieveOfEratosthenes(int n){ boolean[] prime = new boolean[n + 1]; for (int i = 2; i <= n; i++) prime[i] = true; for (int p = 2; p * p <= n; p++) { if (prime[p]){ for (in...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
c5efd236aaebd2807806573f108808a0
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.*; public class Check2 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t=sc.nextInt(); for(int i=0;i<t;i++){ long p = sc.nextLong(); long a = sc.nextLong(); long b = sc.nextLong(); ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
6355e42305cae2463ffd02aedf426d63
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.*; public class A { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { long p=sc.nextLong(); long a=sc.nextLong(); long b=sc.nextLong(); long c=sc.nextLong(); long A=a-p%a; long B=b-p%b;...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
ed8fe29c588b3261813241e531270c4b
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.Scanner; public class p1492A { public static void main(String[] args) { Scanner sc=new Scanner(System.in); for(int t=sc.nextInt();t-->0;) { long p=sc.nextLong(),a=sc.nextLong(),b=sc.nextLong(),c=sc.nextLong(); if(p%a!=0) a*=(p/a+1); else a=p; ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
891d944dabb890e8630bdc9fd928a387
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.io.*; import java.util.*; public class A { public static void main(String args[]) { FastReader sc = new FastReader(); PrintWriter out = new PrintWriter(System.out); int tc, i, j; String s; tc = sc.nextInt(); while (tc-- > 0) { ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
7a2a56e34063fb680fe97d79d7244089
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.Scanner; public class CodeForces { public static void main(String[] args) { Scanner sc= new Scanner(System.in); int testCases = Integer.parseInt(sc.nextLine()); for (int i = 0; i < testCases; i++) { String entry = sc.nextLine(); String[] en...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
e20ae9b34640313bf746d979856d7084
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.*; import java.lang.*; public final class Main { public static long ret(long a, long p) { long e = p % a; if(e > 0) e = a - e; return e; } public static void main (String[] args) { Scanner scan = new Scanner(System.in); ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
6e8fca58af6cf32f9c8d6ce9d23205b0
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.*; public class Swim3 { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { long p = sc.nextLong(); long a = sc.nextLong(); long b = sc.nextLong(); long c = sc.nextLong(); System.out.println(Math.min...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
4e1c7f712e874937a48aca07505e3f14
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t--!=0) { long p=sc.nextLong(); long a=sc.nextLong(); long b=sc.nextLong(); lon...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
89636104f71a0bd0e856b1a65e2254df
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.Scanner; public class A1492 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); for (int i = 0; i < t; i++) { long p = scanner.nextLong(), a = scanner.nextLong(), b = scanner...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
03294a3152f0d05cce99ac8aed5c4476
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.LinkedList; import java.util.PriorityQueue; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n=scanner.nextInt(); LinkedList<Double> list = new LinkedList<>(); while(n>0) ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
f79ba8ae01677afaa405517436f6742f
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.*; public class Thing{ public static void main(String[] args){ Scanner input = new Scanner(System.in); int z = input.nextInt(); for(int j = 0; j < z; j++){ long p = input.nextLong(); long a = input.nextLong(); long b = input.nextLong()...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
9b25b1c842624958e26cfd7eebf74b14
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.io.*; import java.lang.*; import java.util.*; public class Main{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { long p=sc.nextLong(); long a=sc.nextLong(); ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
7889bb6f8672bbd7dd0448cc72132f2b
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.Scanner; public class Main { private static final int SWIMMERS = 3; public static void main(String[] args) { Scanner input = new Scanner(System.in); long[] tab = new long[SWIMMERS]; long t = input.nextLong(); while (t-- > 0) { long p = i...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
b3c990a5497556399635a726883e14a3
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); while (t-- > 0) { long p = in.nextLong(); long a = in.nextLong(); long b = in.nextLong(); ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
6dc363fdd4099d44005b0a62b9c4c720
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.Scanner; public class ThreeSwimmers { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); for (int i = 0; i < t; i++) { long p = scanner.nextLong(); long a = scanner.nextLong(); ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
5d335c7fdf31c27b4f4942617620e62f
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top * * @author Sandip Jana */ public class Main { public static void main(String[] args) { ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
a12c17b611f7f1c86c40654554c51c01
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 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 class Codechef { public static void main (String[] args) throws java.lang.Exception { Scanner sc = new Scanner(Syst...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
02b34f1d4a3d1ad7407ff2a9b65d406f
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.Scanner; public class ThreeSwimmers { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int test = sc.nextInt(); long[] p = new long[test]; long[]a = new long[test]; long[]b = new long[test]; long[]c= new long[test...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
7e1c7966320d8b781cafd584e799096a
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class Test { public static void main(String[] args) { Scanner sc =new Scanner(System.in); int tt=sc.nextInt(); for(int testcase=0;testcase<tt;testcase++){ long a=sc.nextLong(); ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
2ba0cfdd2eaa78f35f4cc384067fa8f6
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.*; import java.io.*; public class ProbA { public static void main(String[] args) throws IOException { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st; int cases = Integer.parseInt(bf.readLine()); for(int x=0; x<cases; x++) { ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
8aaad4edf43f317c141b1dac9d5cafe0
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class A { static class FastScanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new String...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
1adb0da01f82bd4e40c6c46a90d6c800
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.Scanner; public class Codeforces { public static void main(String[] args) { Scanner kb = new Scanner(System.in); int t = kb.nextInt(); while(t-->0) { long p=kb.nextLong(); long a=kb.nextLong(); long b=kb.nextLong(); ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output
PASSED
2895c3f36e5a4fdba6a5d61f01d8141a
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.awt.Point; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.lang.reflect.Array; import java.math.BigDecimal; import java.math.BigInteger; import java.util.ArrayList; import java.util.A...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 8
standard input
[ "math" ]
293f9b996eee9f76d4bfdeda85685baa
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. Next $$$t$$$ lines contains test case descriptions, one per line. Each line contains four integers $$$p$$$, $$$a$$$, $$$b$$$ and $$$c$$$ ($$$1 \leq p, a, b, c \leq 10^{18}$$$), time in minutes after the ...
800
For each test case, output one integer — how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool.
standard output