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
6eac67df9302056df45dd866887dc133
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 Main { public static void main(String[] args) throws IOException { // br = new BufferedReader(new FileReader(new File("input.txt"))); // out = new PrintWriter(new File("output.txt")); int nasral = nextInt(); for (int JOPA = 0; JOPA <...
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
8b044f621f64dd7c799bc6baaa8a73c2
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.*; import java.lang.*; public class Solution { 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...
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
c282641b7ff2b4aff37572641c4ee5d1
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.HashMap; import java.util.Scanner; import java.util.Set; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws Exception{ Scanner s = new Scan...
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
29fab25fb616ebd4baac13b23505e857
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 JavaTasks{ static Scanner sc=new Scanner(System.in); public static void solve(){ long p=sc.nextLong(),a=sc.nextLong(),b=sc.nextLong(),c=sc.nextLong(),x,y,z,temp1; if (p<a) x=a-p; else if (p>=a && p%a==0) x=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
5e57efb464cfffc8e2e4baae5c7edcbe
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.InputStreamReader; import java.util.*; public class Main { public static void main(String[] args) { try{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(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
0fd6b5fa889f847ba1c70529b2a9215b
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.Arrays; import java.util.Scanner; import java.util.ArrayList; public class test { static void solve(long p, long[] a) { long res = Long.MAX_VALUE; long r = 0; for (int i = 0; i < 3; i++) { if (p % a[i] == 0) { r = p/a[i]; } else { r = p/a[i] + 1; } res =...
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
b41f63210577133161205f60e81b163b
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 swimmers { public static void main(String[] args) { Scanner input = new Scanner(System.in); int numCases = input.nextInt(); for (int i = 0; i < numCases; i++) { long currMin = Long.MAX_VALUE; long p = input.nextLong(); ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 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
ad4a3ad2050590e8260a150490beba9b
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 Training2 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t > 0) { long p, a, b, c; p = sc.nextLong(); a = sc.nextLong(); b = sc.nextLo...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 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
aa514813e3576b23514859ee15f69b5e
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 Solution { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int number_of_test_cases = sc.nextInt(); for(int t=0;t<number_of_test_cases;t++) { long p,a,b,c; 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
f7d21485511cced2a66934f2eac6a99a
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.BigInteger; public class Main { InputStream is; PrintWriter out = new PrintWriter(System.out); ; String INPUT = ""; void run() throws Exception { is = System.in; solve(); out.flush(); 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
f0d0ae0fab9acf97325b82806250f25b
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.*; import java.math.*; public class Experiment { public static long func(long p,long a) { if(p==a) return 0; if(p%a==0) return 0; if(p<a) return a-p; return a-(p%a); } public static void main(String[] args) { Scanner in=new Scanner(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
e6c069db360957fc4d37e21281c02ae4
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 D { public static void main(String[] args) throws Exception { Scanner src = new Scanner(System.in); int t = src.nextInt(); while(t-->0){ long p = src.nextLong(); long a = src.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
101d8caa1cb57dd1ca9a3e1c6570d51b
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 { static long mod = (int)1e9+7; public static void main (String[] args) throws java.lang.Exception { FastReader sc =new FastReader(); int t=sc.nextInt(); // int t=1; while(t-->0...
Java
["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
893cbb6fe1e0bbe2e9bfed4c7ed2939e
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.Arrays; import java.util.Scanner; public class cf1492A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-- > 0) { long p = sc.nextLong(); long a = sc.nextLong(); ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 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
1239e31cc43754b8b5366547ad47d6b9
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.Arrays; import java.util.Scanner; public class cf1492A { 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 = new long[3]; ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 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
2dc7e7d81cfa633f98186a84c5d0aac9
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) { f(); } private static void f() { g(); } private static void g() { Scanner scanner = new Scanner(System.in); int ttt = scanner.nextInt(); for (int k = 0; k < ttt; ...
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
4819937181a9029a2b490ca8fcc2e69f
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) { f(); } private static void f() { Scanner scanner = new Scanner(System.in); int ttt = scanner.nextInt(); for (int k = 0; k < ttt; k++) { long p = 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
8b7312c9ae16392d1e087b00d5122932
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 scanner = new Scanner(System.in); int ttt = scanner.nextInt(); for (int k = 0; k < ttt; k++) { long p = scanner.nextLong(); long a = scanner.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
b9e6c1ba874ddcff44b57b03ef4a2752
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 scanner = new Scanner(System.in); int t = scanner.nextInt(); for (int k = 0; k < t; k++) { long p = scanner.nextLong(); long a = scanner.nextLong(); long b = 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
07278a9b3cd9cf1a55f54188780b8eff
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.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.Map; import java.util.Set; public class Main { public static void main(String[] args) { ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 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
058e9f23240a4b4e8724b342103fb2ae
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 BufferedReader rd = new BufferedReader(new InputStreamReader(System.in)); static BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(System.out)); static StringTokenizer tok; public static void main(String[] args) throws Exception { ...
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
74707f54192b0fdb16ecbdf6e010509a
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 { public static void main(String[] args) { Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); int t = in.nextInt(); // Scanner has functions to read ints, longs, strings, chars, etc. for (int idx = 1; idx <= t; ++idx)...
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
2d97301fe46e288e7d4b2dd765d3b3f7
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
// 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 first swimmer wil...
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
84472cafd405fe21dfc4a754c247cf7b
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.reflect.Array; import java.util.*; public class t{ static Scanner sc = new Scanner(System.in); static void solve() { long a,b,c,p; p = sc.nextLong(); a = sc.nextLong(); b = sc.nextLong(); c = sc.nextLong(); long min = Integer.MAX_VALUE; if(p%a==0) min = 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
10944c8e20ed64621d68b1fdc9c99322
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 long mini(long a, long b, long c) { long min = 0; if ((a < b) && (a < c)) { min = a; } else if (b < c) { min = b; } else { min = c; } return 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
45c5ce74701d309958055930395477b8
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 in = new Scanner(System.in); long t = in.nextLong(); while(t-- >0) { long p = in.nextLong(); long a = in.nextLong(); long b = in.nextLong(); long c...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 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
07fbf4d50eceebfb191294e643d05942
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 cp{ public static void main(String[] args) { Scanner sc = new Scanner(); int t = sc.nextInt(); while(t-->0) { long p = sc.nextLong(); long a = sc.nextLong(); long b = sc.nextLong(); long c ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 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
af8d3e4aab6844e92df5e2190920567c
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.*; import java.math.*; 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 ...
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
6db92a83f5e1debeaeb7707b3d00282d
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.ArrayList; public class ThreeSwimmer{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); sc.nextLine(); ArrayList<Long> list = new ArrayList<Long>(); while(t-- > 0){ String arr [] = sc.nextLine().split(...
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
35aea39dd5d4a793ceee9202f02756f8
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 Training { // public static int numOfDigits(long n) { // int c = 0; // while (n != 0) { // n /= 10; // c++; // } // return c; // } // public static long round(long p, long a){ // int n=numOfDigits(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 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
869cd3ce1b03aa6eb274e7a3618d95d3
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.*; import java.lang.Math; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long q; q=sc.nextLong(); while(q!=0) { long p,a,b,c,min1,min2,min3; 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 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
d81068cfa056a3ac995aa12363aa7d58
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.*; import java.util.StringTokenizer; public class Main //JAVA FORMAT { final static int n=1000000; static boolean b[]=new boolean[n+2]; static class FastReader { Buffer...
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
494b886d94d39cd3e0f6dd87610799fe
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
//package com.example.helloworld; import java.util.Scanner; public class HelloWorld { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int t = scnr.nextInt(); for(int i = 0 ; i < t ; i++){ long a , b , c , p; p = scnr.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
620a812021aec2c144f1677b6a793c09
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 cf704 { public static long ceil(long a, long b){ if(a%b==0) return a/b; else return (a/b)+1; } public static void main(String[] args){ long p=0,a=0,b=0,c=0; int t=0; Scanner sc = new Scanner(System.in); 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
c8c0b0acaab8d25e9fb57da8c52c84e9
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.*; @SuppressWarnings("unchecked") public class ThreeSwimmers implements Runnable { void solve() throws IOException { int t = read.intNext(); while (t-- > 0) { long p = Long.parseLong(read.read()), a = Long.parseLong(read.read()), b = 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
59b836582099a08d50ee1e268df5982c
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 scn = new Scanner(System.in); int test = scn.nextInt(); long[] p = new long[test]; long[]a = new long[test]; long[]b = new long[test]; long[]c= new 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
f2a9562d6ee5ddfb9713cb265b8baef4
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 Solution1 { public static void main(String args[]) { Scanner ob = new Scanner(System.in); int i, t; long p, a, b, c, min; min = 0; t = ob.nextInt(); for(i = 1; i <= t; i++) { min = 0; p = ob.nextLong(); a = 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
29eb0ac7fb26afb72c07688c5a700181
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.*; import java.lang.*; /* ******************** _/\_Siya pati Ram Chandra ki Jai_/\_ ****************** */ public class JaiShreeRam{ static Scanner in=new Scanner(); public static void main(String[] args...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 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
63ec82bec8f63e753a28958377c6df05
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 { public static void main(String[] args) throws IOException { FastScanner f = new FastScanner(); int t=1; t=f.nextInt(); PrintWriter out=new PrintWriter(System.out); while(t>0) { t--; long p=f.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
b6f03cbf5f46df7f0fa2c2f895405846
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 { public static void main(String[] args) throws IOException { FastScanner f = new FastScanner(); int t=1; t=f.nextInt(); PrintWriter out=new PrintWriter(System.out); while(t>0) { t--; long p=f.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
779c6ef1cc9b11f0df9898a10a710141
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 ProblemD{ public static void main(String[] args){ MyScanner sc = new MyScanner(); PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); int t=sc.nextInt(); for(int m = 0; m < t; m++) { 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
d10c50bb8da383d8d8e3abb6ceccadd2
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 clipse; import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Random; import java.util.StringTo...
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
bbd2364ce81f0a50313c63cd27bace34
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * 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
e2c5f45f99f096c08d21f75101d87525
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 //do not write package name here */ import java.io.*; import java.util.Scanner; public class GFG { public static void main (String[] args) { //System.out.println("GfG!"); Scanner input = new Scanner(System.in); int t = input.nextInt(); while(t>0){ long p = input...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 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
6026c612c41a0337d70da800926b52e1
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->.....future_me......// //..............Learning.........// /*Compete against yourself*/ import java.util.*; import java.io.*; import java.lang.*; import java.math.BigInteger; public class A { static FastReader sc = new FastReader(); static PrintWriter out = new PrintWriter(System.ou...
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
00f95ccf645490bc034353eca3ef5a0d
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->.....future_me......// //..............Learning.........// /*Compete against yourself*/ import java.util.*; import java.io.*; import java.lang.*; import java.math.BigInteger; public class C { // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Code Starts <<<<<<<<<<<<<<<<<<<<<<<<<<<<< // static...
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
e7c74d423c5eecf4d4e088c14f8ece4e
train_109.jsonl
1614071100
Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.It takes the first swimmer exactly $$$a$$$ minutes to swim across the entire pool and come back, exactly $$$b$$$ minutes for the second swimmer and $$$c$$$ minutes for the third. Hence, the firs...
512 megabytes
import java.util.*; import java.math.*; public class Three_Swimmers { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in=new Scanner(System.in); int t=in.nextInt(); for(int i=1;i<=t;i++) { BigInteger p=new BigInteger(in.next()); BigInteger a=new BigInteg...
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
3dada5bd39f7185bf7c975a8831f081b
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.Arrays; import java.util.StringTokenizer; import static java.lang.System.in; public class Main { public static void main(String[] args){ FastReader fr=new FastReader(); int tc...
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
bbb4d175f65e9f7fef4256ac3dd39820
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 reg { static long floor(long p, long i) { long s = (p/i); long s2 = i*s; if(s2-p>=0) return s2-p; else { s = s+1; s2 = i*s; return s2-p; } } static long result(long a1, long a2, long a3) { if (a1 <= a2 && a1 <= a3) ...
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
31abaaa0a8fd978b817601ea8678ab6b
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 m = sc.nextInt(); long[] arr1 = new long[m]; for (int i = 0; i < m; i++) { long p = sc.nextLong(); long a = 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 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
8f2c01874c4d5fd67e95f068779bf0dc
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.ArrayDeque; import java.util.InputMismatchException; import java.util.Queue; import static java.lang.Double.parseDouble; import static java.lang.Long.numberOfTrailingZeros; import static java.lang.Math.pow; import static java.lang.System.*; import static java.util.Arrays.cop...
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
5ab15053c179c78fec2494a26e3793cd
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 chef{ 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
ec1138ff1bc80d5cf9b772ef63ec69a5
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.math.BigDecimal; import java.util.Arrays; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); long t=sc.nextLong(); while(t--!=0) { long p=sc.nextLong(); long a=sc.nextLong(); long b=sc.nextLong(); long c...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 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
78976329d5e751650a1f3a457c928862
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.InputStreamReader; import java.util.StringTokenizer; public class _704_A { static int t; static long p, a, b, c; static long ans; public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System....
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 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
ce25e63d53359e0923071c91d112df09
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.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; public class f { public static void main(String[]args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); while(n-->0) { long a=sc.nextLong(); ...
Java
["4\n9 5 4 8\n2 6 10 9\n10 2 5 10\n10 9 9 9"]
1 second
["1\n4\n0\n8"]
NoteIn the first test case, the first swimmer is on the left side in $$$0, 5, 10, 15, \ldots$$$ minutes after the start time, the second swimmer is on the left side in $$$0, 4, 8, 12, \ldots$$$ minutes after the start time, and the third swimmer is on the left side in $$$0, 8, 16, 24, \ldots$$$ minutes after the start ...
Java 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
d29615bc37b545b56d54b88a01ca2acf
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 A { public static Scanner scan = new Scanner(System.in); public static void main(String[] args) { int t = scan.nextInt(); while (t-- > 0) { solve(); } } public static void solve() { long p = 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
717e8684603641e14e3db32436ff337c
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) { // TODO Auto-generated method stub Scanner in = new Scanner(System.in); int t = in.nextInt(); while(t-- > 0) { long p = in.nextLong(); long ar[] = new long[3]; ar[0] = in.nextLong(); ar[1] = in.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 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
9b84c13c443f0faed5ef502b449f5109
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 JavaApplication4 { 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(); 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
b4e343d0f8b9a7c109ad6947ba43ad27
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 s=new Scanner(System.in); int num=s.nextInt(); for(int i=0; i<num; i++){ long[] numbers1 = new long[4]; for(int i1=0; i1<=3; i1++){ numbers1[i1]=s.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
2313fee57de53a8f34224f864c10bd81
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.Math; 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(); ...
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
57ae0769cffdc8bca2807b356932fa9f
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Scanner; public class MaximumWidth { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int n = ...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
badee2181b6612df2d06b862d722038b
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Scanner; public class MaximumWidth { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int n = ...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
795df52e0a19f9f58823414f9d44924c
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Scanner; public class MaximumWidth { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = s...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
53bb67bea7b5cfef66cee9639f20520c
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.util.*; import java.io.*; public class Solution{ public static void main(String arg[]){ Scanner scan = new Scanner(System.in); int i, j, k = 0, n = scan.nextInt(), m = scan.nextInt(); String a = scan.next(), b = scan.next(); HashMap <Character, ArrayList<Integer>> map = new Ha...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
58666a5bc98b594d7b44c5aca3bfc42b
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.io.*; import java.util.*; public class C680 { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } ...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
d030d3370cafe968f199e662343a58ba
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.util.*; public class Ques3 { public static void main(String args[]) { Scanner in=new Scanner(System.in); int n=in.nextInt(); int m=in.nextInt(); String s=in.next(); String t=in.next(); int a[]=new int[m]; int b[]=new int[m]; ...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
fe4ca8643ed0a06b11c5a7a1568f515e
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class CF1492_D2_C { public static void main(String[] args) { FastScanner scanner = new FastScanner(); int n = scanner.nextInt(); int m = scanner.nextInt(); ...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
81a690d229a0948ab7dd68be334e0521
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.util.*; import java.io.*; import java.math.*; /** * * @Har_Har_Mahadev */ public class A { private static long INF = 2000000000000000000L, M = 1000000007, MM = 998244353; private static int N = 0; public static void process() throws IOException { int n = sc.nextInt(),m = sc.next...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
69d9f42c17e83a9e7d659b6809a60a83
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.util.*;import java.io.*;import java.math.*; public class MaxWidth { static final Random random=new Random(); static void ruffleSort(int[] a) { int n = a.length; for (int i=0; i<n; i++) { int oi=random.nextInt(n), temp=a[oi]; a[oi]=a[i]; a[i]=tem...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
05bdfd1c1cadc2c058c3be41e4877aba
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s=new Scanner(System.in); int n=s.nextInt(); int m=s.nextInt(); String str1=s.next(); String str2=s.next(); int[] left=new int[m]; int[] right=new int[m]; int ptr=0; fo...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
962c676d85f3b6d176ef311df0f76943
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Zad1492C { public static void main(String[] args) { // TODO Auto-generated method stub FastReader sc = new FastReader(); PrintWriter...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
2d795a6edfc37d6a2d11ed83fe089c3e
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.HashMap; import java.util.Random; import java.util.*; import java.util.StringTokenizer; import java.util.*; import java.util.Scanner; public class Comptetive { s...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
5f729438c3c1218d92f62529c716d87e
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { /* HashMap<> map=new HashMap<>(); TreeMap<> map=new TreeMap<>(); map.put(p,map.getOrDefault(p,0)+1); for(Map.Entry<> mx:map.entrySet()){ int v=mx.getValue(),k=mx.getKey(); }for (int i = 1; i <= 1000...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
ccfd510350adca23e0839df8cbc48399
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.util.*; public class TestClass { public static void main(String args[] ) throws Exception { Scanner in = new Scanner(System.in); int n=in.nextInt(); int m=in.nextInt(); String s=in.next(); String t=in.next(); Map<Integer, Integer> far...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
8582acd47f8d98db85235c5a6eac7375
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.io.BufferedOutputStream; import java.io.PrintWriter; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.Arrays; public class C extends Driver { public static void main(String[] args) { new C().run()...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
ab2499bd3728761ff8f64897e29a0f8a
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class C { static int ans = 1, maxn = 200010; static int m, n; static int[] L = new int[maxn]; static int[] R = new int[maxn]; static String s, t; public static void main(String[] ...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
e243adc27c03b14d1dff9d325a7235ae
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.awt.Point; public class CFTemplate { static final long MOD = 1000000007L; //static final long MOD2 = 1000000009L; //static final long MOD = 998244353L; //static final long INF = 500000000000L; static final int INF =...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
1ef984b16d90db1478ee1d0625696dfa
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
/* "Why do we fall? So we can learn to pick ourselves up." */ import java.util.*; import java.io.*; import java.math.*; public class Main { static FastReader sc=new FastReader(); static int dp[][]; //static int mod=1000000007; public static void main(String[] args) { //CHECK FOR...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
23f3ec5552f0f3aabe0240d0e379b29c
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.io.*; import java.util.*; public class Main { static BufferedReader bf; static PrintWriter out; static Scanner sc; static StringTokenizer st; static long mod = (long)(1e9+7); static long mod2 = 998244353; public static void main (String[] args)throws IOException { bf = new Buf...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
3763977ded1c5a6691e4695756c4ff0f
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.*; import javafx.util.Pair; public class Main { static int left ,right; public static int LowerBound(ArrayList<Integer> a, int x) { int l = -1, r ...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
97ab479592a4ec6d8862bdd09abb7284
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
/* * akshaygupta26 */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.Random; import java.util.Arrays; import java.util.StringTokenizer; import java.util.ArrayList; import java.util.HashMap; import java.util.HashS...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
80c44cb7e0c926f01177fcced00e7e4d
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
//WHEN IN DOUBT , USE BRUTE FORCE !!!!!!!!! import java.lang.String; import java.io.*; import java.util.*; import java.util.StringTokenizer; //class Main //AtCoder()Bt //class Solution // Codechef public class Solution2 //Codeforces { public static void main(String args[]) { try { ...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
5bba3a6e98898fb94f271fd94d498094
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.io.*; import java.util.*; public class Codeforces { public void solve() { FastScanner fs = new FastScanner(); StringBuilder print = new StringBuilder(); int n = fs.nextInt(), m = fs.nextInt(); char[]a = fs.nextLine().toCharArray(); char[]b = fs.nextLi...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
a8b28fa233c1567c70831c0575ea56bc
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.io.*; import java.util.*; public class MainC { static class InputReader { public BufferedReader reader; public StringTokenizer tokenizer; public InputReader(InputStream stream) { reader = new BufferedReader(new InputStreamReader(stream), 32768); ...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
dddbbb01fcf3924310c0b5c8c621d439
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.StringTokenizer; import java.util.TreeMap; ...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
78a35cf1690a56eefa1c16fca3746952
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.io.*; import java.security.KeyStore.Entry; import java.util.*; public class Odd_Selection { static InputStreamReader r = new InputStreamReader(System.in); static BufferedReader br = new BufferedReader(r); static PrintWriter p = new PrintWriter(System.out); static int n,m; s...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
57fd0c2ff8402cc26dab0b6c854a5861
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.io.*; import java.util.*; public class C { public static void main(String[] args) { FastReader in = new FastReader(); int n = in.nextInt(); int m = in.nextInt(); char[] s = in.next().toCharArray(); char[] t = in.next().toCharArray(); int...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
c852acfeb53b9aecfc99e4e5ac187c2b
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.io.*; import java.util.*; public class C { public static void main(String[] args) { FastReader in = new FastReader(); int n = in.nextInt(); int m = in.nextInt(); char[] s = in.next().toCharArray(); char[] t = in.next().toCharArray(); Lis...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
b25a7769f861c23f34b40d5f07a6e81c
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.io.*; import java.util.*; public class C { public static void main(String[] args) { FastReader in = new FastReader(); int n = in.nextInt(); int m = in.nextInt(); char[] s = in.next().toCharArray(); char[] t = in.next().toCharArray(); Lis...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
8fb56f7b1aa896ceb728744b446ecd24
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.io.*; import java.util.*; public class C { public static void main(String[] args) { FastReader f = new FastReader(); StringBuffer sb=new StringBuffer(); int n=f.nextInt(); int m=f.nextInt(); char s[]=f.next().toCharArray(); char t[]=f.next().toCharArray(); int[]low=...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
7000fecb8497029d02609738d5feeb06
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
// これを翻訳している間、あなたはあなたの人生のいくつかの貴重な瞬間を無駄にしました import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Solution { static PrintWriter fop = new PrintWri...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
ccff04d7d102d85bd1cd6a83e65913fe
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.InputMismatchException; import java.util.*; import java.io.*; import java.lang.*; public class Main{ public static class InputReader { private InputStream strea...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
2d81b30bc4cdf3097795572eed11154a
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Random; import java.util.StringTokenizer; import java.util.List; import java.util.Collections; import java.util.Map; i...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
71f1d395a4b55a5388a9da486e0fba92
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.util.*; import java.util.Scanner; import java.io.*; import javax.lang.model.util.ElementScanner6; import static java.lang.System.out; import java.util.Stack; import java.util.Queue; import java.util.LinkedList; public class C1492 { static int mod=(int)(1e9+7); static long MOD=(long)(1e...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
c45f48b9af33b35140542d7d811b9984
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.io.*; import java.util.*; public class C { public static void main(String[] args) { FastScanner in = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int t = 1;//in.nextInt(); while(t-->0) { int m = in.nextInt(), n = in.nextInt(); ...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
f2549090796d929d48d4df2d588ad800
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Practice { public static void main(String[] args) throws Exception { Scanner s = new Scanner(System.in); int n = s.nextInt(); int m = s.nextInt(); String str = s.next(); ...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
6362714cc2dde6e1a88daf96ba955ab0
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; import java.util.*; public class c704c { //By shwetank_verma public static void main(String[] args) { FastReader sc=new Fas...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
7027403d67a4192d9b4e87beb1a69b82
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.util.Arrays; import java.util.Scanner; public class code4 { // { // static class pair implements Comparable<pair>{ // int x;int y; // // public pair(int x,int y){ // this.x=x; // this.y=y; // } // // // ...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
8192d97a04d4f5c7e7d415359961f1e2
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.io.*; import java.util.*; public class Main { public static int INF = 0x3f3f3f3f; public static int mod = 1000000007; public static void main(String args[]){ try { PrintWriter o = new PrintWriter(System.out); FastScanner sc = new FastScanner(); ...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output
PASSED
49ddc98be2699748bd6883a3e1b8bf0c
train_109.jsonl
1614071100
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $$$s$$$ of length $$$n$$$ and $$$t$$$ of length $$$m$$$.A sequence $$$p_1, p_2, \ldots, p_m$$$, where $$$1 \leq p_1 &lt; p_2 &lt; \ldots &lt; p_m \leq n$$$, is called beautiful, if $$$s_{p_i} = t_i$$$ for...
512 megabytes
import java.io.*; import java.util.ArrayList; import java.util.Comparator; import java.util.StringTokenizer; public class C1492 { public static void main(String[] args) { FastScanner sc = new FastScanner(System.in); FastPrintStream out = new FastPrintStream(System.out); int n = s...
Java
["5 3\nabbbc\nabc", "5 2\naaaaa\naa", "5 5\nabcdf\nabcdf", "2 2\nab\nab"]
2 seconds
["3", "4", "1", "1"]
NoteIn the first example there are two beautiful sequences of width $$$3$$$: they are $$$\{1, 2, 5\}$$$ and $$$\{1, 4, 5\}$$$.In the second example the beautiful sequence with the maximum width is $$$\{1, 5\}$$$.In the third example there is exactly one beautiful sequence — it is $$$\{1, 2, 3, 4, 5\}$$$.In the fourth e...
Java 8
standard input
[ "binary search", "data structures", "dp", "greedy", "two pointers" ]
17fff01f943ad467ceca5dce5b962169
The first input line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \leq m \leq n \leq 2 \cdot 10^5$$$) — the lengths of the strings $$$s$$$ and $$$t$$$. The following line contains a single string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the Latin alphabet. The last line contains a single string ...
1,500
Output one integer — the maximum width of a beautiful sequence.
standard output