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
72924a57fe800879ac4dcc58a4711d89
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.BigInteger; import java.util.*; public class dummycodes { public static BigInteger solve(BigInteger p ,BigInteger a,BigInteger b,BigInteger c){ if(p==BigInteger.valueOf(0)) return BigInteger.valueOf(0); if(p.mod(a)==BigI...
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
412f8bde672c1582ea472940c834fe40
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 temp { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0){ long p = sc.nextLong(); long min = Long.MAX_VALUE; long a[] = new long[3]; for(...
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
ea361239a2b8a608a7dc0b2b6934969f
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.BigInteger; import java.util.Scanner; public class swim { public static void check(BigInteger p, BigInteger a, BigInteger b, BigInteger c) { BigInteger a1, b1, c1; if(p.compareTo((p.divide(a)).multiply(a))==1) { a1=a.subtract(p.remainder(a)); } else { a1=p.remainder(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
PASSED
282b7a5383e6443fc2d477c6592725e8
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) { FastScanner fs = new FastScanner(); int t = fs.nextInt(); while (t-- > 0) { long 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
1f9a10523aa7e0cb766e7df45cbe834c
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 hs to be "Main" only if the class is public. */ public final class Test { static boolean isLucky(long n){ if(n==0) return false; while(n>0){ long digit=n%10; ...
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
a898c3c2ea7cc117bf6904a105c2cad1
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 final class Main { public static void main(String[] args) { FastScanner sc = new FastScanner(System.in); StringBuilder ans = new StringBuilder(""); int t = sc.nextInt(); while (t-- > 0) { long p = 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
11286d1b2ef85c2f7bd8cb4f0c002a0c
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
//created by toufique on 9/9/22 import java.util.*; import java.io.*; public class A { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int t = in.nextInt(); for (int tt=0; tt<t; tt++) { ...
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
972e954b3d1ad89ad0d485e234684ac7
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 t= sc.nextInt(); for (int i= 0;i<t;i++) { long p=sc.nextLong(); long a=sc.nextLong(); long b=sc.nextLong(); long c=sc.nextLong(); long...
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
484c46da28565d45062c5633a3bef530
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; /** * <a href = "https://codeforces.com/contest/1492/problem/A"> Link </a> * @author Bris * @version 1.0 * @since 9:20:21 PM - May 22, 2022 */ public class A1492 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.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
26f143a7881d05c56cf8883bf7e6838e
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 A1492 { 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
e38ec2b178a7f825e8c833f3d02383a1
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 test { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); while(t-- > 0){ long p = in.nextLong(),a = in.nextLong(), b = in.nextLong(),c = in.nextLong(); if(p % a == 0 || 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
a2b3cea26a48f9a044a1f2b33feb4b1c
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.*; import java.math.*; public class MyClass { public static void main(String args[]) { Scanner in = new Scanner(System.in); int t = in.nextInt(); while(t -- >0){ long p,a,b,c; p=in.nextLong(); a=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
a331f3711708bcd280d37a243378c76b
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 { static StringBuilder sb; static dsu dsu; static long fact[]; static int mod = (int) (1e9 + 7); static long get(long p,long a){ long modd=p%a; if(modd==0){ return 0; } else{ long wt=a-modd; return wt; ...
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
b4797c5169496fa7cec4ed47c797393e
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 Tofayel { 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(); ...
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
e08fe07f794b66266004af1b18f223b9
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 Solution { private static ArrayList<Integer> prime = new ArrayList<>(); public static void main(String[] args) throws IOException { Scanner in=new Scanner(System.in); BufferedReader br=new BufferedReader(new InputStreamReader(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
66ca724e358c49bec482d50d089f56b5
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 Solution { private static ArrayList<Integer> prime = new ArrayList<>(); public static void main(String[] args) throws IOException { Scanner in=new Scanner(System.in); BufferedReader br=new BufferedReader(new InputStreamReader(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
f60581b065feac090a598bb9b78b35a4
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.File; import java.math.BigDecimal; import java.util.Scanner; public class App { public static void main(String[] args) { int t, n; try(Scanner sc = new Scanner(System.in)) { //try(Scanner sc = new Scanner(new File("in.txt"))) { t = sc.nextInt(); for(int i=0; i<t; 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
2ca3647c7e2af69059af96f30164c838
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 Problem1492A { public static void main(String[] args) { Scanner s = new Scanner(System.in); int t = s.nextInt(); while(t-->0) { long p = s.nextLong(); long a = s.nextLong(); long b = s.nextLong(); long c = s.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
d5fa19511724c026905da20aba24b555
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.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; public class Codef2 { static class FastReader { BufferedReader br; St...
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
dffaf4c526f5325f577793f3cb7439a7
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 s = new Scanner(System.in); int t = s.nextInt(); for(int i=0;i<t;i++) { long p = s.nextLong(); long a = s.nextLong(); long b = s.nextL...
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
317f84de127c0c9904c48a3e00fa1c83
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); int cycle = Integer.parseInt(sc.nextLine()); for (int i = 0; i < cycle; i++){ long time = sc.nextLong(); long first = sc.nextLong(); long second = 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
a18a8f958beece425adf937082bca668
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 Solution{ 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(); long c=sc.nextLong(); System.out.println(Math.min((a - p % 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
PASSED
f490dab975565f5e19099b4842775843
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 input = new Scanner(System.in); int testCases = input.nextInt(); for(int i = 0; i < testCases; i ++){ long p = input.nextLong(); long a = input.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
fe17af6a5afbe951fcc5029c6d539de5
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 Hello { public static void main(String[] args) { FastScanner sc=new FastScanner(); int t=sc.nextInt(); while(t-->0) { long p=sc.nextLong(),a=sc.nextLong(),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
443f799e3e043f37fcb87fc19119d068
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 long f(long p, long d){ if(p % d == 0) return 0; return (d - (p % d)); } public static void main(String[] args) { Scanner scammer = new Scanner(System.in); int test_cases = scammer.next...
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
17c2c63cdd051cb4c2a0dc3d3f92556f
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.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Main { public static void main(String[] args) throws IOExce...
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
29b6d962694c89499ee8b0cf6d0302b2
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 task11 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int testCase = scanner.nextInt(); while ((testCase--) != 0) { long p; long a; long...
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
fcc409ce87539943718ec1ee5a05af8d
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 { private static final FastIO fastIO = new FastIO(); private static final String yes = "YES"; private static final String no = "NO"; public static void main(String[] args) { int t = fastIO.nextInt(); while(t-- > 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
acf898fa35cf433be63909dbaabca8e3
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.BigInteger; import java.util.Scanner; public class ThreeSwimmers { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int T = Integer.parseInt(scan.nextLine()); for (int i = 0; i < T; i++) { String[] constants = scan.nextLi...
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
becf1bdbacb70bad3ae6bd4abea92b64
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_Three_swimmers { static long testCases,p,a,b,c,A,B,C; static Scanner scanner=new Scanner(); public static void main(String[] args) throws IOE...
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
f5680f193ababd5c2d95cf369cb9e10e
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.*; import java.lang.*; import java.math.*; public class rough{ public static void main(String[] arg){ Scanner sc= new Scanner(System.in); int t=Integer.parseInt(sc.nextLine()); long[] ans = new long[t]; for(int i=0;i<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
cc3af78b08d2f7ed367b7d91f943e873
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.*; import java.io.*; public class swimmer { public static void main(String args[]) throws IOException { Scanner sc = new Scanner(System.in); long t = sc.nextInt(); long A[] = new long[4]; for (long i = 0; i < t; i++) { long ...
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
fb762286db771ee683c22e36630b233f
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 input=new Scanner(System.in); int n=input.nextInt(); while((n--)!=0) { long p,a,b,c; p=input.nextLong(); a=input.nextLong(); b=input.nextLong(); c=input.nextLong(); System.out.println(Math.min(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
dc1a21fbd13458b3fea9fbc2209ff3ba
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); int t = sc.nextInt(); while(t-- > 0) { long p = sc.nextLong(); long a = sc.nextLong(); long b = sc.nextLong(); long c = sc.nextLong(); long ma = p%a; long mb = p%b; lo...
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
72640afcf2be2447dd657bb8554dbc1f
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 whatever; // 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 Ideone { public static void main (String[] args) throws java.lang.Exception { BufferedReader br=new BufferedR...
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
a54a54db371180b5eda04f5346f3eb0e
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 Cf704 { public static void main( String[] args)throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine()); while(t-- >0){ String line[] = br....
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
d5c334bbec4d96508083c8859dc8abc6
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.*; import java.math.*; public class Main { static FastReader in; static PrintWriter o; public static void solve() { int t = in.nextInt(); while (t-- > 0) { long p = in.nextLong(); long a = in.nextLong(); lo...
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
9f8b98e222e385f600b0d576871e7c10
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
// 24-Feb-2021 import java.util.*; import java.io.*; public class P { static class FastReader { BufferedReader br; StringTokenizer st; private FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { ...
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
1cb54ae406e629397252cd3f6ad432dc
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
// 23-Feb-2021 import java.util.*; import java.io.*; public class AJA { static class FastReader { BufferedReader br; StringTokenizer st; private FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { ...
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
31ffbbb980ae2a694790b633a9bf2a1b
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 three_swimmers { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int a =sc.nextInt(); for(int k=0;k<a;k++) { long c= sc.nextLong(); long b= sc.nextLong(); long d =sc.nextLong(); long e =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
0814807f5337add819658e82e8e71f6f
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.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.nio.file.Paths; import java.util.StringTokenizer; public class Main1 { public Main1() throws FileNotFoundException { ...
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
f0eb3cff43ab958a9c8c5a4a3353c38b
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 zatona; import java.io.*; import java.util.*; /* zatona Ahmed Maher */ public class zatona { public static int mod = 1000000007; public static InputReader in; public static PrintWriter out; public static void main(String[] args) { in = new 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
32d7681fcd195cfdd89924968c4e20d1
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 Solve { static Scanner sc = new Scanner(System.in); private static void solve() { long p = sc.nextLong(); long a = sc.nextLong(); long b = sc.nextLong(); long c = sc.nextLong(); ArrayList<Long> nums = new ArrayList<>(); long a1 = (p + a - 1) / a * 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 17
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
a9aa3f070f42ad8daa6451a6103962cb
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
//https://codeforces.com/problemset/problem/1492/A import java.util.Scanner; public class Three_swimmers { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int testcase = sc.nextInt(); while (testcase-- != 0) { long min = Long.MAX_VALUE; ...
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 17
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
d20487f9e36488fce42cffc87505504b
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 Solve { static Scanner sc = new Scanner(System.in); private static void solve() { long p = sc.nextLong(); long a = sc.nextLong(); long b = sc.nextLong(); long c = sc.nextLong(); ArrayList<Long> nums = new ArrayList<>(); long a1 = (p + a - 1) / a * a; long b1 = (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 17
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
24175f501314f505a06720a195a2c5d7
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.*; /** * * @author eslam */ public class Solution { // Beginning of the solution static Kattio input = new Kattio(); static BufferedWriter log = new BufferedWriter(new OutputStreamWriter(System.out)); static ArrayList<Ar...
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 17
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
00fab77cf966600d7ec38b12ba0f0491
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.text.DecimalFormat; import java.util.Scanner; public class ThreeSwimmers { //Runttime error public static void main(String[] args) { Scanner sc=new Scanner(System.in); double T; BigInteger result; DecimalFormat 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 11
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
039ef5d6eab6e21508a8d6003ada74b6
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 sc = new Scanner(System.in); int t = sc.nextInt(); while(t-- > 0){ 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 11
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
96b3a3df9425f381f9bbdcdf6411415d
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 s = new Scanner(System.in); int t = s.nextInt(); while(t>0) { long p = s.nextLong(); long a = s.nextLong(); long b = s.nextLong(); long c = s.nextLong(); if(p%a==0 || p%b==0 || p%c==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 11
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
7c0e94f4d56e3999e6ef1a81470fce57
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-->0) { long p =sc.nextLong(); long a = sc.nextLong(); long b = sc.nextL...
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 11
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
5b1e9f4baa08520bea14a5978ed288fd
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.*; 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 { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int t=Integer.parse...
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 11
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
e4b7c7fb855c795239d34ed25def93eb
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 Binary{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int t=sc.nextInt(); long d=-1; while(t-->0) { long res1=0,res2=0,res3=0; long p=sc.nextLong(); long a=sc.nextLong(); long 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 11
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
107c0d4fbb96c8736e18de9b11db1f11
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 QuestionA { static void steps(long p, long first_swimmer,long second_swimmer,long third_swimmer) { if(p%first_swimmer==0) { System.out.println(0); return; }else if(p%second_swimmer==0) { System.out.println(0); return; ...
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 11
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
87e86a70975e72bdfbef4770b378f654
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 JavaApplication21 { public static long min(long a,long b,long c) { if(a==b&&b==c) { return a; } if(a<b&&a<c) { return a; } if(b<c&&b<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 11
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
87f17068950d4aeca875f80ae456a2dd
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); StringBuilder sb = new StringBuilder(); int testCases = sc.nextInt(); for (int t = 0; t < testCases; t++) { long p = 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 11
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
1970eb75c4ee7a55310ac62f327cea77
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 s=new Scanner (System.in); long p ,a ,b ,c ; int t=s.nextInt(); for(int i=0; i<t;i++) { p=s.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 11
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
74e357f5d95610336b221c63e3daab8d
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
/*Jayam Vimal - java template*/ import java.io.*; import java.util.*; public class threeSwimmer { static PrintWriter out = new PrintWriter(System.out); static FastReader in = new FastReader(); // static Pair[] moves = new Pair[] { new Pair(-1, 0), new Pair(1, 0), new // Pair(0, -1), new Pair(0, 1) };...
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 11
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
3b64b39b83c0f251a2436f53112be2a3
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.*;import java.math.*; public class Swimmer { public static void process()throws IOException { long p =sc.nextLong(); long[] a = new long[3]; long[] b = new long[3]; int t=0; for(int i=0;i<3;i++) { a[i]= 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 11
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
a377e5875e7a059a9609385d6c51dd92
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 Round704 { public static void main(String[] args) { Scanner o=new Scanner(System.in); int t=o.nextInt(); while(t>0) { long p=o.nextLong(); long a=o.nextLong(); long b=o.nextLong(); long c=o.nextLong(); if(p%a==0||p%b==0||p%c==0) { System.out.println(...
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 11
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
dcf2a3079dc9e2368b851ae56282edcb
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 static java.lang.Math.*; import static java.lang.System.out; import java.util.*; import java.io.PrintStream; import java.io.PrintWriter; public class A { /* 10^(7) = 1s. * ceilVal = (a+b-1) / 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 11
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
46b2f42e7f02da20f4231acb8d8e6938
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 static java.lang.Math.*; import static java.lang.System.out; import java.util.*; import java.io.PrintStream; import java.io.PrintWriter; public class A { /* 10^(7) = 1s. * ceilVal = (a+b-1) / 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 11
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
d88b4aadd6c75a46fc2a3f5a90c21fca
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 C_ThreeSwimmers { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine()); for (int i=0; i<t; i++) { String[] stuff = br.readLine(...
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 11
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
e5328fb091a74ee55786edaa0acd90bb
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 Template { public static void main(String[] args) { FastScanner sc = new FastScanner(); int yo = sc.nextInt(); while (yo-- > 0) { long p = sc.nextLong(); long[] a = new long[3]; for(int i = 0; i < 3; i++) a[i] = sc.nextLong(); long...
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 11
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
8b780e3c97f5bc3841f1fbc219f98ec7
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[] code_7) { Scanner scanner = new Scanner(System.in); StringBuilder str = new StringBuilder(); int t = scanner.nextInt(); while (t-- > 0) { long p = scanner.nextLong(), min = Long.MAX_VALUE; ...
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 11
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
f37dbf2ddd26d8c9774c0d0988eb6873
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.*; import java.io.*; public class A_Three_swimmers { public static void main (String[] args) throws java.lang.Exception { FastReader sc =new FastReader(); int t=sc.nextInt(); while(t-->0) { long p=sc.nextLong(); l...
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 11
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
adeede1710c9046060ff11f67f874b79
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.IOException; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { Scanner scanner=new Scanner(System.in); int t=scanner.nextInt(); while (t-->0){ 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 11
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
70aff40c18a0c4b79c1ecabd416682ec
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 p1_704 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int test = sc.nextInt(); for (int i = 0; i < test; i++) { long d = sc.nextLong(); long a= sc.nextLong(); long 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 11
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
fc1ea7d2034a6568c1ac4860cf7159d3
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.*; import java.lang.*; public class Cfff { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader( new InputStreamReader(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 11
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
f6325988f7c8d49f0735c37f6a97bdef
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.*; import java.text.*; import java.math.*; import java.util.regex.*; public class a { static long mod = 1000000007; public static void main(String[] args) throws Exception { FastScanner in = new FastScanner(); PrintWriter out = new PrintWriter(System.out...
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 11
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
d168774332bd9bfbbb75dc8e481d8ca1
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 11
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
a7d77a7053557f1e236861425e190ade
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
// Problem: A. Three swimmers // Contest: Codeforces - Codeforces Round #704 (Div. 2) // URL: http://codeforces.com/contest/1492/problem/A // Memory Limit: 512 MB // Time Limit: 1000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) import java.io.*; import java.util.*; public class Main {...
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 11
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
a375a6e9fb5f7fe81006bc0fa8f1f176
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
// Working program with FastReader //Night timing is good for contests. Pleaseseeeee import java.io.BufferedReader; import java.io.CharArrayReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Main{ static class FastReader { BufferedReader br; ...
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 11
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
dc265fe0c7ce62035a52624fe788aaf2
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.*; import java.lang.*; public class first { public static long ub(long p, long k){ if(p%k==0) return p/k; else return (p/k)+1; } public static void main(String[] args) { try { System.setIn(new FileIn...
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 11
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
8f8a8f9b2a4efb1313ae45273c8caabb
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.*; import java.lang.*; public class first { public static long ub(long p, long k){ if(p%k==0) return p/k; else return (p/k)+1; } public static void main(String[] args) { try { System.setIn(new FileIn...
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 11
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
249165764653918559e73b837c539aa0
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 div { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st ...
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 11
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
69e3e9d3c9880bc7213a3649c4ecfab6
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.InputStream; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedList; import java.util.List; import java.util.Queu...
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 11
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
e905bf630eb3fd236d892dfa0ce856ad
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.IOException; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; public class Threeswimmers { static InputReader inputReader=new InputReader(System.in); static void solve() { long p=inputReader.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 11
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
abe36d2707e8c5623631f1811c9a97f2
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 cp2 { public static void main(String[] args)throws Exception { BufferedReader bR=new BufferedReader(new InputStreamReader(System.in)); int t=Integer.parseInt(bR.readLine()); while(t-->0) { String s[]=bR.readLine().split(" "); long p=Long.parseLong(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 11
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
1caf6821923bffa5b22c993154d92470
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.io.InputStream; import java.io.OutputStream; import java.util.StringTokenizer; import java.util.InputMismatchException; /* * @author : Imtiaz Adar */ public class Three_Swi...
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 11
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
e33756368beb7dc7ebd780ab7780c243
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.io.InputStream; import java.io.OutputStream; import java.util.StringTokenizer; import java.util.InputMismatchException; /* * @author : Imtiaz Adar */ public class Three_Swi...
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 11
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
e399f7d2cd48c6c6ef5e92ed815498ec
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.io.InputStream; import java.io.OutputStream; import java.util.StringTokenizer; import java.util.InputMismatchException; /* * @author : Imtiaz Adar */ public class Three_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 11
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
3e9748ecb434afc07d4363769404f985
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.io.PrintWriter; import java.io.InputStream; import java.io.OutputStream; /* * @author : Imtiaz Adar */ public class Three_Swimmers { public static void main(Strin...
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 11
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
b868b43a6739f6daa13d69e109dae10e
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 practice { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); while (t --> 0) { long p = scan.nextLong(); long a = scan.nextLong(); long b = scan.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 11
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
e836ddedb9a55d502c1fb5e629959772
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.*; //* --> number of prime numbers less then or equal to x are --> x/ln(x) //* --> String concatenation using the + operator within a loop should be avoided. Since the String object is immutable, each call for concatenation will // result in a new String o...
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 11
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
6191059915f5be131dc598c64fb65ae2
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.PrintWriter; import java.util.*; public class Practice { public static void main(String[] args) { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int t = sc.nextInt(); while (t-->0){ long p = sc.nextLong(); lo...
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 11
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
3dd79b9157eb7bc1e71785c2ff5014c1
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 HelloWorld { 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 ans[] = new long[4]; an...
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 11
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
401a0dcea5caefde8e722b7d67331df8
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.*; public class Try1{ public static void main(String[] args) throws IOException { FastScanner fs = new FastScanner(); int t =fs.nextInt(); while (t-- > 0) { long p = fs.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 11
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
a61bd31b826d78057f3a85507bf2acca
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 Program { public static void main(String[] args) { Scanner input = new Scanner(System.in); int t = input.nextInt(); for(int i=0; i<t; i++) { long p = input.nextLong(); long a = input.nextLong(); long b = input.nextLong(); long c = input.nextLong(); long 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 11
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
699c67511752368bea5c4a795b076f50
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 Solution { public static void main(String[] args) { FastScanner fs=new FastScanner(); int tt=fs.nextInt(); while(tt-->0) { long p=fs.nextLong(),a=fs.nextLon...
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 11
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
ac3db744fd97f6d040f754c51609afdc
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.*; import java.io.*; public class Main { public static void main (String[] args) throws java.lang.Exception { FastReader sc = new FastReader(); int t=sc.nextInt(); while(t-->0) { long p,a,b,c; p=sc.nextLong(); a=sc.nextLon...
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 11
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
53e4b8a1042c4b736f09670b25378cec
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.lang.*; import java.util.*; import java.io.*; /* CodeForces Practice question Rohit Talreja 09 - 04 - 2021 */ public class file{ public static long minimum(long a,long b,long c){ return Math.min(Math.min(a,b),c); } public static long solve(UserDefinedReader ud){ long p=ud.nextLon...
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 11
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
9b4041e68c5b968bc123f471b9427318
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.StringTokenizer; public class Main { static long T, p, a, b, c; public static void main(String[] args) { Scanner sc = new Scanner(); PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); T = sc.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 11
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
72e8aac1846b2ca0a98fc0ffcc4cf0e5
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.*; public class CodeForces extends Functions { static Scanner sc = new Scanner(); public static void solve() { long p = sc.nextLong(); long a = sc.nextLong(); long b = sc.next...
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 11
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
b9f04551dd445d22e1b31ae6981a98a7
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 n = scanner.nextInt(); for (int i = 0; i < n; i++) { long num1 = scanner.nextLong(); long num2 = 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 11
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
53408003fc30e2476654f767a28cf491
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 Sol40 { 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 ...
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 11
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
676822802e0882c31cc8636dab9f4b20
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
//Author : Debojyoti Mandal //Attribute : Some of the methods are copied from GeeksforGeeks Website import java.util.*; import java.lang.*; import java.io.*; public class Main { static PrintWriter out=new PrintWriter(System.out); static Reader sc=new Reader(); //static FastReader sc=new FastReader(Sys...
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 11
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
fce36a12e2f7b6ea0d1356c70310e6c4
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
//Author : Debojyoti Mandal //Attribute : Some of the methods are copied from GeeksforGeeks Website import java.util.*; import java.lang.*; import java.io.*; public class Main { static PrintWriter out=new PrintWriter(System.out); static Reader sc=new Reader(); //static FastReader sc=new FastReader(Sys...
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 11
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
379b4bc9d6bff56493815da207c45283
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
//Author : Debojyoti Mandal //Attribute : Some of the methods are copied from GeeksforGeeks Website import java.util.*; import java.lang.*; import java.io.*; public class Main { static PrintWriter out=new PrintWriter(System.out); static Reader sc=new Reader(); //static FastReader sc=new FastReader(Sys...
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 11
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
517112d3df3da295e2b1b6869b0c4d32
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
//Author : Debojyoti Mandal //Attribute : Some of the methods are copied from GeeksforGeeks Website import java.util.*; import java.lang.*; import java.io.*; public class Main { static PrintWriter out=new PrintWriter(System.out); static Reader sc=new Reader(); //static FastReader sc=new FastReader(Sys...
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 11
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
4bd589bd87c444136773399d235aa1c1
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 swim{ public long cal(long ar[]){ long p = ar[0]; long a = ar[1]; long b = ar[2]; long c = ar[3]; long diffa = Integer.MAX_VALUE; long diffb = Integer.MAX_VALUE; long diffc = Integer.MAX_VALUE; if(p%a == 0){ diffa = 0; } else{ //diffa = Mat...
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 11
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