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
08d4480f3f22e066928dfde5e2612a79
train_000.jsonl
1398612600
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.StreamTokenizer; import java.util.Scanner; public class B { public static byte[][] a; public static int find(int n, int m) { boolean res = true; for (int i = 0; (i < n/2)&&(res == true) ; i++) for (...
Java
["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"]
1 second
["2", "3", "2"]
NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001
Java 8
standard input
[ "implementation" ]
90125e9d42c6dcb0bf3b2b5e4d0f845e
The first line contains two integers, n and m (1 ≤ n, m ≤ 100). Each of the next n lines contains m integers — the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≤ aij ≤ 1) — the i-th row of the matrix a.
1,300
In the single line, print the answer to the problem — the minimum number of rows of matrix b.
standard output
PASSED
4d82c86682b4c1452f2516d42d0e5e38
train_000.jsonl
1514037900
Priests of the Quetzalcoatl cult want to build a tower to represent a power of their god. Tower is usually made of power-charged rocks. It is built with the help of rare magic by levitating the current top of tower and adding rocks at its bottom. If top, which is built from k - 1 rocks, possesses power p and we want to...
256 megabytes
import java.io.*; import java.util.*; public class D { static int [] w ; static ArrayList<Integer> primes; static int[] isComposite; static int [] phi ; static void sieve(int N) { isComposite = new int[N + 1]; isComposite[0] = isComposite[1] = 1; primes = new ArrayList<Integer>(); for (int i = 2; ...
Java
["6 1000000000\n1 2 2 3 3 3\n8\n1 1\n1 6\n2 2\n2 3\n2 4\n4 4\n4 5\n4 6"]
4.5 seconds
["1\n1\n2\n4\n256\n3\n27\n597484987"]
Note327 = 7625597484987
Java 8
standard input
[ "number theory", "math" ]
a0038cd4698c649cf95759d744854cfc
First line of input contains two integers n (1 ≤ n ≤ 105) and m (1 ≤ m ≤ 109). Second line of input contains n integers wk (1 ≤ wk ≤ 109) which is the power of rocks that priests have. Third line of input contains single integer q (1 ≤ q ≤ 105) which is amount of queries from priests to you. kth of next q lines contain...
2,700
Output q integers. k-th of them must be the amount of cumulative power the tower will have if is built from rocks lk, lk + 1, ..., rk.
standard output
PASSED
5d05cdbeed56b74e7cfa262cf04c1cf6
train_000.jsonl
1514037900
Priests of the Quetzalcoatl cult want to build a tower to represent a power of their god. Tower is usually made of power-charged rocks. It is built with the help of rare magic by levitating the current top of tower and adding rocks at its bottom. If top, which is built from k - 1 rocks, possesses power p and we want to...
256 megabytes
import java.util.*; import java.io.*; public class Main { int [] phi , w; int phi(int n) { int ans = n ; for(int i = 2 ; 1L * i * i <= n ; i++) { if(n % i == 0 ) ans -= ans / i ; while(n % i == 0 ) n /= i ; } i...
Java
["6 1000000000\n1 2 2 3 3 3\n8\n1 1\n1 6\n2 2\n2 3\n2 4\n4 4\n4 5\n4 6"]
4.5 seconds
["1\n1\n2\n4\n256\n3\n27\n597484987"]
Note327 = 7625597484987
Java 8
standard input
[ "number theory", "math" ]
a0038cd4698c649cf95759d744854cfc
First line of input contains two integers n (1 ≤ n ≤ 105) and m (1 ≤ m ≤ 109). Second line of input contains n integers wk (1 ≤ wk ≤ 109) which is the power of rocks that priests have. Third line of input contains single integer q (1 ≤ q ≤ 105) which is amount of queries from priests to you. kth of next q lines contain...
2,700
Output q integers. k-th of them must be the amount of cumulative power the tower will have if is built from rocks lk, lk + 1, ..., rk.
standard output
PASSED
3b2a6fdf2b8cc7f221bd0ab8b284bef5
train_000.jsonl
1514037900
Priests of the Quetzalcoatl cult want to build a tower to represent a power of their god. Tower is usually made of power-charged rocks. It is built with the help of rare magic by levitating the current top of tower and adding rocks at its bottom. If top, which is built from k - 1 rocks, possesses power p and we want to...
256 megabytes
import java.io.*; import java.util.*; public class D { static int [] w ; static ArrayList<Integer> primes; static int[] isComposite; static int [] phi ; static void sieve(int N) { isComposite = new int[N + 1]; isComposite[0] = isComposite[1] = 1; primes = new ArrayList<Integer>(); for (int i = 2; ...
Java
["6 1000000000\n1 2 2 3 3 3\n8\n1 1\n1 6\n2 2\n2 3\n2 4\n4 4\n4 5\n4 6"]
4.5 seconds
["1\n1\n2\n4\n256\n3\n27\n597484987"]
Note327 = 7625597484987
Java 8
standard input
[ "number theory", "math" ]
a0038cd4698c649cf95759d744854cfc
First line of input contains two integers n (1 ≤ n ≤ 105) and m (1 ≤ m ≤ 109). Second line of input contains n integers wk (1 ≤ wk ≤ 109) which is the power of rocks that priests have. Third line of input contains single integer q (1 ≤ q ≤ 105) which is amount of queries from priests to you. kth of next q lines contain...
2,700
Output q integers. k-th of them must be the amount of cumulative power the tower will have if is built from rocks lk, lk + 1, ..., rk.
standard output
PASSED
b55d1c1d5debea19191b7c449c33e6ac
train_000.jsonl
1514037900
Priests of the Quetzalcoatl cult want to build a tower to represent a power of their god. Tower is usually made of power-charged rocks. It is built with the help of rare magic by levitating the current top of tower and adding rocks at its bottom. If top, which is built from k - 1 rocks, possesses power p and we want to...
256 megabytes
import java.util.*; import java.io.IOException; public class Test { int readInt() { int ans = 0; boolean neg = false; try { boolean start = false; for (int c = 0; (c = System.in.read()) != -1; ) { if (c == '-') { start = true; ...
Java
["6 1000000000\n1 2 2 3 3 3\n8\n1 1\n1 6\n2 2\n2 3\n2 4\n4 4\n4 5\n4 6"]
4.5 seconds
["1\n1\n2\n4\n256\n3\n27\n597484987"]
Note327 = 7625597484987
Java 8
standard input
[ "number theory", "math" ]
a0038cd4698c649cf95759d744854cfc
First line of input contains two integers n (1 ≤ n ≤ 105) and m (1 ≤ m ≤ 109). Second line of input contains n integers wk (1 ≤ wk ≤ 109) which is the power of rocks that priests have. Third line of input contains single integer q (1 ≤ q ≤ 105) which is amount of queries from priests to you. kth of next q lines contain...
2,700
Output q integers. k-th of them must be the amount of cumulative power the tower will have if is built from rocks lk, lk + 1, ..., rk.
standard output
PASSED
5e4a51edda4147a8cfa9131810a303d0
train_000.jsonl
1514037900
Priests of the Quetzalcoatl cult want to build a tower to represent a power of their god. Tower is usually made of power-charged rocks. It is built with the help of rare magic by levitating the current top of tower and adding rocks at its bottom. If top, which is built from k - 1 rocks, possesses power p and we want to...
256 megabytes
import java.util.*; import java.io.IOException; public class Test { int readInt() { int ans = 0; boolean neg = false; try { boolean start = false; for (int c = 0; (c = System.in.read()) != -1; ) { if (c == '-') { start = true; ...
Java
["6 1000000000\n1 2 2 3 3 3\n8\n1 1\n1 6\n2 2\n2 3\n2 4\n4 4\n4 5\n4 6"]
4.5 seconds
["1\n1\n2\n4\n256\n3\n27\n597484987"]
Note327 = 7625597484987
Java 8
standard input
[ "number theory", "math" ]
a0038cd4698c649cf95759d744854cfc
First line of input contains two integers n (1 ≤ n ≤ 105) and m (1 ≤ m ≤ 109). Second line of input contains n integers wk (1 ≤ wk ≤ 109) which is the power of rocks that priests have. Third line of input contains single integer q (1 ≤ q ≤ 105) which is amount of queries from priests to you. kth of next q lines contain...
2,700
Output q integers. k-th of them must be the amount of cumulative power the tower will have if is built from rocks lk, lk + 1, ..., rk.
standard output
PASSED
4d42b2ebb6a5424c78a6d8e9b2c2e29b
train_000.jsonl
1514037900
Priests of the Quetzalcoatl cult want to build a tower to represent a power of their god. Tower is usually made of power-charged rocks. It is built with the help of rare magic by levitating the current top of tower and adding rocks at its bottom. If top, which is built from k - 1 rocks, possesses power p and we want to...
256 megabytes
import java.util.*; import java.io.IOException; public class Test { int readInt() { int ans = 0; boolean neg = false; try { boolean start = false; for (int c = 0; (c = System.in.read()) != -1; ) { if (c == '-') { start = true; ...
Java
["6 1000000000\n1 2 2 3 3 3\n8\n1 1\n1 6\n2 2\n2 3\n2 4\n4 4\n4 5\n4 6"]
4.5 seconds
["1\n1\n2\n4\n256\n3\n27\n597484987"]
Note327 = 7625597484987
Java 8
standard input
[ "number theory", "math" ]
a0038cd4698c649cf95759d744854cfc
First line of input contains two integers n (1 ≤ n ≤ 105) and m (1 ≤ m ≤ 109). Second line of input contains n integers wk (1 ≤ wk ≤ 109) which is the power of rocks that priests have. Third line of input contains single integer q (1 ≤ q ≤ 105) which is amount of queries from priests to you. kth of next q lines contain...
2,700
Output q integers. k-th of them must be the amount of cumulative power the tower will have if is built from rocks lk, lk + 1, ..., rk.
standard output
PASSED
d28d9be1c728369e3cec84a84d1cd36b
train_000.jsonl
1514037900
Priests of the Quetzalcoatl cult want to build a tower to represent a power of their god. Tower is usually made of power-charged rocks. It is built with the help of rare magic by levitating the current top of tower and adding rocks at its bottom. If top, which is built from k - 1 rocks, possesses power p and we want to...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; public class F { private static int[] w; private static int fastModPow(int a, int b, int mod) { int modPow = 1; for (; b > 0; b >>= 1) { if ((b & 1) != 0) ...
Java
["6 1000000000\n1 2 2 3 3 3\n8\n1 1\n1 6\n2 2\n2 3\n2 4\n4 4\n4 5\n4 6"]
4.5 seconds
["1\n1\n2\n4\n256\n3\n27\n597484987"]
Note327 = 7625597484987
Java 8
standard input
[ "number theory", "math" ]
a0038cd4698c649cf95759d744854cfc
First line of input contains two integers n (1 ≤ n ≤ 105) and m (1 ≤ m ≤ 109). Second line of input contains n integers wk (1 ≤ wk ≤ 109) which is the power of rocks that priests have. Third line of input contains single integer q (1 ≤ q ≤ 105) which is amount of queries from priests to you. kth of next q lines contain...
2,700
Output q integers. k-th of them must be the amount of cumulative power the tower will have if is built from rocks lk, lk + 1, ..., rk.
standard output
PASSED
de9a5fc0ca8a2f55348e28e047cb3bc3
train_000.jsonl
1533994500
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to the server room.The buil...
256 megabytes
//1020A //SISBuilding import java.io.*; import java.util.*; public class SISBuilding { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int tow = sc.nextInt(); int flo = sc.nextInt();...
Java
["3 6 2 3 3\n1 2 1 3\n1 4 3 4\n1 2 2 3"]
1 second
["1\n4\n2"]
null
Java 8
standard input
[ "math" ]
bdce4761496c88a3de00aa863ba7308d
The first line of the input contains following integers: n: the number of towers in the building (1 ≤ n ≤ 108), h: the number of floors in each tower (1 ≤ h ≤ 108), a and b: the lowest and highest floor where it's possible to move between adjacent towers (1 ≤ a ≤ b ≤ h), k: total number of queries (1 ≤ k ≤ 104). ...
1,000
For each query print a single integer: the minimum walking time between the locations in minutes.
standard output
PASSED
ef9e665c8a9b426891d4a2619fbb16ef
train_000.jsonl
1533994500
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to the server room.The buil...
256 megabytes
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int h = scan.nextInt(); int a = scan.nextInt(); int b = scan.nextInt(); int k = scan.nextInt(); for(int ...
Java
["3 6 2 3 3\n1 2 1 3\n1 4 3 4\n1 2 2 3"]
1 second
["1\n4\n2"]
null
Java 8
standard input
[ "math" ]
bdce4761496c88a3de00aa863ba7308d
The first line of the input contains following integers: n: the number of towers in the building (1 ≤ n ≤ 108), h: the number of floors in each tower (1 ≤ h ≤ 108), a and b: the lowest and highest floor where it's possible to move between adjacent towers (1 ≤ a ≤ b ≤ h), k: total number of queries (1 ≤ k ≤ 104). ...
1,000
For each query print a single integer: the minimum walking time between the locations in minutes.
standard output
PASSED
8b76c20285240e4f72d17f93b86e37f5
train_000.jsonl
1533994500
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to the server room.The buil...
256 megabytes
import java.io.*; public class A3 { public static void main(String[] args) throws IOException{ InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); String[] s = br.readLine().split(" "); int n = Integer.parseInt(s[0]); int h = Integer.parseInt(s[1]); int ...
Java
["3 6 2 3 3\n1 2 1 3\n1 4 3 4\n1 2 2 3"]
1 second
["1\n4\n2"]
null
Java 8
standard input
[ "math" ]
bdce4761496c88a3de00aa863ba7308d
The first line of the input contains following integers: n: the number of towers in the building (1 ≤ n ≤ 108), h: the number of floors in each tower (1 ≤ h ≤ 108), a and b: the lowest and highest floor where it's possible to move between adjacent towers (1 ≤ a ≤ b ≤ h), k: total number of queries (1 ≤ k ≤ 104). ...
1,000
For each query print a single integer: the minimum walking time between the locations in minutes.
standard output
PASSED
bb283a2e8248772d72384bcd7c62985b
train_000.jsonl
1533994500
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to the server room.The buil...
256 megabytes
//package pack; import java.util.*; public class second { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int h=sc.nextInt(); int a=sc.nextInt(); int b=sc.nextInt(); int k=sc.nextInt(); for(int rep=0;rep<k;rep++) { int ta=sc.nextInt(); int fa...
Java
["3 6 2 3 3\n1 2 1 3\n1 4 3 4\n1 2 2 3"]
1 second
["1\n4\n2"]
null
Java 8
standard input
[ "math" ]
bdce4761496c88a3de00aa863ba7308d
The first line of the input contains following integers: n: the number of towers in the building (1 ≤ n ≤ 108), h: the number of floors in each tower (1 ≤ h ≤ 108), a and b: the lowest and highest floor where it's possible to move between adjacent towers (1 ≤ a ≤ b ≤ h), k: total number of queries (1 ≤ k ≤ 104). ...
1,000
For each query print a single integer: the minimum walking time between the locations in minutes.
standard output
PASSED
41219da85ad4b133b7ea2d8b51e948fa
train_000.jsonl
1533994500
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to the server room.The buil...
256 megabytes
import java.util.Scanner; public class NewBuildingInSIS { private int n; private int h; private int a; private int b; public NewBuildingInSIS(int n,int h,int a, int b){ this.n=n; this.h=h; this.a=a; this.b=b; } public static void main(String[] args) { ...
Java
["3 6 2 3 3\n1 2 1 3\n1 4 3 4\n1 2 2 3"]
1 second
["1\n4\n2"]
null
Java 8
standard input
[ "math" ]
bdce4761496c88a3de00aa863ba7308d
The first line of the input contains following integers: n: the number of towers in the building (1 ≤ n ≤ 108), h: the number of floors in each tower (1 ≤ h ≤ 108), a and b: the lowest and highest floor where it's possible to move between adjacent towers (1 ≤ a ≤ b ≤ h), k: total number of queries (1 ≤ k ≤ 104). ...
1,000
For each query print a single integer: the minimum walking time between the locations in minutes.
standard output
PASSED
e1cd629e576612a5b40d32e07d9c396e
train_000.jsonl
1533994500
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to the server room.The buil...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; public class A1020 { public static void main(String[] args) throws IOException { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); PrintWriter printWrit...
Java
["3 6 2 3 3\n1 2 1 3\n1 4 3 4\n1 2 2 3"]
1 second
["1\n4\n2"]
null
Java 8
standard input
[ "math" ]
bdce4761496c88a3de00aa863ba7308d
The first line of the input contains following integers: n: the number of towers in the building (1 ≤ n ≤ 108), h: the number of floors in each tower (1 ≤ h ≤ 108), a and b: the lowest and highest floor where it's possible to move between adjacent towers (1 ≤ a ≤ b ≤ h), k: total number of queries (1 ≤ k ≤ 104). ...
1,000
For each query print a single integer: the minimum walking time between the locations in minutes.
standard output
PASSED
89b2f44343888668c241f2eb64bea730
train_000.jsonl
1533994500
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to the server room.The buil...
256 megabytes
import java.util.*; import java.io.*; public class programA { public static void main(String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int n = Integer.parseInt(st.nextToken()); int h = Intege...
Java
["3 6 2 3 3\n1 2 1 3\n1 4 3 4\n1 2 2 3"]
1 second
["1\n4\n2"]
null
Java 8
standard input
[ "math" ]
bdce4761496c88a3de00aa863ba7308d
The first line of the input contains following integers: n: the number of towers in the building (1 ≤ n ≤ 108), h: the number of floors in each tower (1 ≤ h ≤ 108), a and b: the lowest and highest floor where it's possible to move between adjacent towers (1 ≤ a ≤ b ≤ h), k: total number of queries (1 ≤ k ≤ 104). ...
1,000
For each query print a single integer: the minimum walking time between the locations in minutes.
standard output
PASSED
7085421e4cabda988f69d139413f3bdc
train_000.jsonl
1533994500
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to the server room.The buil...
256 megabytes
import java.util.Scanner; public class ReceiveInput { public static int abs(int a) { return a>=0? a:-a; } public static int min(int a,int b) { return a>b?b:a; } public static void main(String[]args) { Scanner input=new Scanner(System.in); int n=input.nextInt(); ...
Java
["3 6 2 3 3\n1 2 1 3\n1 4 3 4\n1 2 2 3"]
1 second
["1\n4\n2"]
null
Java 8
standard input
[ "math" ]
bdce4761496c88a3de00aa863ba7308d
The first line of the input contains following integers: n: the number of towers in the building (1 ≤ n ≤ 108), h: the number of floors in each tower (1 ≤ h ≤ 108), a and b: the lowest and highest floor where it's possible to move between adjacent towers (1 ≤ a ≤ b ≤ h), k: total number of queries (1 ≤ k ≤ 104). ...
1,000
For each query print a single integer: the minimum walking time between the locations in minutes.
standard output
PASSED
93bcd94c8de4bd808589d52c12f95a00
train_000.jsonl
1533994500
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to the server room.The buil...
256 megabytes
/* * Remember a 7.0 student can know more than a 10.0 student. * Grades don't determine intelligence, they test obedience. * I Never Give Up. */ import java.util.*; import java.util.Map.Entry; import java.io.*; import static java.lang.System.out; import static java.util.Arrays.*; import static java.lang.Math.*; ...
Java
["3 6 2 3 3\n1 2 1 3\n1 4 3 4\n1 2 2 3"]
1 second
["1\n4\n2"]
null
Java 8
standard input
[ "math" ]
bdce4761496c88a3de00aa863ba7308d
The first line of the input contains following integers: n: the number of towers in the building (1 ≤ n ≤ 108), h: the number of floors in each tower (1 ≤ h ≤ 108), a and b: the lowest and highest floor where it's possible to move between adjacent towers (1 ≤ a ≤ b ≤ h), k: total number of queries (1 ≤ k ≤ 104). ...
1,000
For each query print a single integer: the minimum walking time between the locations in minutes.
standard output
PASSED
69bda8a6a28dff3c02c56d8cceb8cb7d
train_000.jsonl
1533994500
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to the server room.The buil...
256 megabytes
import java.util.*; import java.io.*; public class building { public void run() throws Exception { Scanner file = new Scanner(System.in); int n = file.nextInt(), h = file.nextInt(), low = file.nextInt(), high = file.nextInt(), k = file.nextInt(); for (int i= 0; i < k; i++) { long a = file.nextInt(), b = file...
Java
["3 6 2 3 3\n1 2 1 3\n1 4 3 4\n1 2 2 3"]
1 second
["1\n4\n2"]
null
Java 8
standard input
[ "math" ]
bdce4761496c88a3de00aa863ba7308d
The first line of the input contains following integers: n: the number of towers in the building (1 ≤ n ≤ 108), h: the number of floors in each tower (1 ≤ h ≤ 108), a and b: the lowest and highest floor where it's possible to move between adjacent towers (1 ≤ a ≤ b ≤ h), k: total number of queries (1 ≤ k ≤ 104). ...
1,000
For each query print a single integer: the minimum walking time between the locations in minutes.
standard output
PASSED
ea088c0cfb33025d500122b20ace7982
train_000.jsonl
1533994500
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to the server room.The buil...
256 megabytes
import java.util.Scanner; public class NewBuild{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int h = sc.nextInt(); int a = sc.nextInt(); int b = sc.nextInt(); int k = sc.nextInt(); long arr[] = new long[k]; long sum = 0; int z = 0; for(int j =...
Java
["3 6 2 3 3\n1 2 1 3\n1 4 3 4\n1 2 2 3"]
1 second
["1\n4\n2"]
null
Java 8
standard input
[ "math" ]
bdce4761496c88a3de00aa863ba7308d
The first line of the input contains following integers: n: the number of towers in the building (1 ≤ n ≤ 108), h: the number of floors in each tower (1 ≤ h ≤ 108), a and b: the lowest and highest floor where it's possible to move between adjacent towers (1 ≤ a ≤ b ≤ h), k: total number of queries (1 ≤ k ≤ 104). ...
1,000
For each query print a single integer: the minimum walking time between the locations in minutes.
standard output
PASSED
1d21b4019b6a227a85cd8ebec384ccf3
train_000.jsonl
1533994500
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to the server room.The buil...
256 megabytes
/** * Author: Ridam Nagar * Date: 27 February 2019 * Time: 01:17:36 **/ /* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; import java.math.BigInteger; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { ...
Java
["3 6 2 3 3\n1 2 1 3\n1 4 3 4\n1 2 2 3"]
1 second
["1\n4\n2"]
null
Java 8
standard input
[ "math" ]
bdce4761496c88a3de00aa863ba7308d
The first line of the input contains following integers: n: the number of towers in the building (1 ≤ n ≤ 108), h: the number of floors in each tower (1 ≤ h ≤ 108), a and b: the lowest and highest floor where it's possible to move between adjacent towers (1 ≤ a ≤ b ≤ h), k: total number of queries (1 ≤ k ≤ 104). ...
1,000
For each query print a single integer: the minimum walking time between the locations in minutes.
standard output
PASSED
48fb618bc2449112f30d978f73359aa3
train_000.jsonl
1533994500
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to the server room.The buil...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.FilterInputStream; import java.io.BufferedInputStream; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author nirav */ public class Mai...
Java
["3 6 2 3 3\n1 2 1 3\n1 4 3 4\n1 2 2 3"]
1 second
["1\n4\n2"]
null
Java 8
standard input
[ "math" ]
bdce4761496c88a3de00aa863ba7308d
The first line of the input contains following integers: n: the number of towers in the building (1 ≤ n ≤ 108), h: the number of floors in each tower (1 ≤ h ≤ 108), a and b: the lowest and highest floor where it's possible to move between adjacent towers (1 ≤ a ≤ b ≤ h), k: total number of queries (1 ≤ k ≤ 104). ...
1,000
For each query print a single integer: the minimum walking time between the locations in minutes.
standard output
PASSED
1fa09b7a62ae08e0c103200b2f771404
train_000.jsonl
1533994500
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to the server room.The buil...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.FilterInputStream; import java.io.BufferedInputStream; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author nirav */ public class Mai...
Java
["3 6 2 3 3\n1 2 1 3\n1 4 3 4\n1 2 2 3"]
1 second
["1\n4\n2"]
null
Java 8
standard input
[ "math" ]
bdce4761496c88a3de00aa863ba7308d
The first line of the input contains following integers: n: the number of towers in the building (1 ≤ n ≤ 108), h: the number of floors in each tower (1 ≤ h ≤ 108), a and b: the lowest and highest floor where it's possible to move between adjacent towers (1 ≤ a ≤ b ≤ h), k: total number of queries (1 ≤ k ≤ 104). ...
1,000
For each query print a single integer: the minimum walking time between the locations in minutes.
standard output
PASSED
cfc0927e57cc3e75b91e591e6251979c
train_000.jsonl
1533994500
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to the server room.The buil...
256 megabytes
import java.util.*; public class vashya { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int h=sc.nextInt(); int a=sc.nextInt(); int b=sc.nextInt(); int k=sc.nextInt(); ...
Java
["3 6 2 3 3\n1 2 1 3\n1 4 3 4\n1 2 2 3"]
1 second
["1\n4\n2"]
null
Java 8
standard input
[ "math" ]
bdce4761496c88a3de00aa863ba7308d
The first line of the input contains following integers: n: the number of towers in the building (1 ≤ n ≤ 108), h: the number of floors in each tower (1 ≤ h ≤ 108), a and b: the lowest and highest floor where it's possible to move between adjacent towers (1 ≤ a ≤ b ≤ h), k: total number of queries (1 ≤ k ≤ 104). ...
1,000
For each query print a single integer: the minimum walking time between the locations in minutes.
standard output
PASSED
e75338cbfd9514b3dba930c9816c0872
train_000.jsonl
1533994500
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to the server room.The buil...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; import java.awt.geom.*; public class Travel{ public static void main(String[] args) { MyScanner sc=new MyScanner(); int towers=sc.ni(); int floors=sc.ni(); int a=sc.ni(); int b=sc.ni(); int q=sc.ni(); while(q-->0) { ...
Java
["3 6 2 3 3\n1 2 1 3\n1 4 3 4\n1 2 2 3"]
1 second
["1\n4\n2"]
null
Java 8
standard input
[ "math" ]
bdce4761496c88a3de00aa863ba7308d
The first line of the input contains following integers: n: the number of towers in the building (1 ≤ n ≤ 108), h: the number of floors in each tower (1 ≤ h ≤ 108), a and b: the lowest and highest floor where it's possible to move between adjacent towers (1 ≤ a ≤ b ≤ h), k: total number of queries (1 ≤ k ≤ 104). ...
1,000
For each query print a single integer: the minimum walking time between the locations in minutes.
standard output
PASSED
5662e494dd0854b8feac9ed1757c866c
train_000.jsonl
1533994500
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to the server room.The buil...
256 megabytes
import java.util.Scanner; public class SISBuilding { public static void main(String... args) { Scanner sc = new Scanner(System.in); int towers = sc.nextInt(); int floors = sc.nextInt(); int a = sc.nextInt(); int b = sc.nextInt(); int queries = sc.nextInt(); for (int i = 0; i < queries; i++) { int t1...
Java
["3 6 2 3 3\n1 2 1 3\n1 4 3 4\n1 2 2 3"]
1 second
["1\n4\n2"]
null
Java 8
standard input
[ "math" ]
bdce4761496c88a3de00aa863ba7308d
The first line of the input contains following integers: n: the number of towers in the building (1 ≤ n ≤ 108), h: the number of floors in each tower (1 ≤ h ≤ 108), a and b: the lowest and highest floor where it's possible to move between adjacent towers (1 ≤ a ≤ b ≤ h), k: total number of queries (1 ≤ k ≤ 104). ...
1,000
For each query print a single integer: the minimum walking time between the locations in minutes.
standard output
PASSED
392374ae34cb579264072f9c82747245
train_000.jsonl
1533994500
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to the server room.The buil...
256 megabytes
import java.util.*; import java.lang.Math.*; public class NewBuilding{ public static void main(String[] args){ Scanner s = new Scanner(System.in); int n = s.nextInt(); //no. of towers int h = s.nextInt(); //no. of flowers int a = s.nextInt(); //lowest floor int b = s.nextInt(); //highest floor int k = s.ne...
Java
["3 6 2 3 3\n1 2 1 3\n1 4 3 4\n1 2 2 3"]
1 second
["1\n4\n2"]
null
Java 8
standard input
[ "math" ]
bdce4761496c88a3de00aa863ba7308d
The first line of the input contains following integers: n: the number of towers in the building (1 ≤ n ≤ 108), h: the number of floors in each tower (1 ≤ h ≤ 108), a and b: the lowest and highest floor where it's possible to move between adjacent towers (1 ≤ a ≤ b ≤ h), k: total number of queries (1 ≤ k ≤ 104). ...
1,000
For each query print a single integer: the minimum walking time between the locations in minutes.
standard output
PASSED
247bbaf579fecbb4fdbad8d8025005c7
train_000.jsonl
1533994500
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to the server room.The buil...
256 megabytes
import java.util.Scanner; /** * * @author Suraya */ public class Main { public static void main(String[] args) { Scanner leia = new Scanner(System.in); int n = leia.nextInt(); int h = leia.nextInt(); int a = leia.nextInt(); int b = leia.nextInt(); int k = lei...
Java
["3 6 2 3 3\n1 2 1 3\n1 4 3 4\n1 2 2 3"]
1 second
["1\n4\n2"]
null
Java 8
standard input
[ "math" ]
bdce4761496c88a3de00aa863ba7308d
The first line of the input contains following integers: n: the number of towers in the building (1 ≤ n ≤ 108), h: the number of floors in each tower (1 ≤ h ≤ 108), a and b: the lowest and highest floor where it's possible to move between adjacent towers (1 ≤ a ≤ b ≤ h), k: total number of queries (1 ≤ k ≤ 104). ...
1,000
For each query print a single integer: the minimum walking time between the locations in minutes.
standard output
PASSED
14d94ff3c606ee21631ac0c8721d1fef
train_000.jsonl
1533994500
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to the server room.The buil...
256 megabytes
import java.util.*; import java.io.*; public class cf503a{ public static void main(String [] args) throws IOException{ InputReader in = new InputReader("cf503a.in"); StringTokenizer st = new StringTokenizer(in.readLine()); int n = Integer.parseInt(st.nextToken()); int h = Integer.parseInt(st.nextToken()); ...
Java
["3 6 2 3 3\n1 2 1 3\n1 4 3 4\n1 2 2 3"]
1 second
["1\n4\n2"]
null
Java 8
standard input
[ "math" ]
bdce4761496c88a3de00aa863ba7308d
The first line of the input contains following integers: n: the number of towers in the building (1 ≤ n ≤ 108), h: the number of floors in each tower (1 ≤ h ≤ 108), a and b: the lowest and highest floor where it's possible to move between adjacent towers (1 ≤ a ≤ b ≤ h), k: total number of queries (1 ≤ k ≤ 104). ...
1,000
For each query print a single integer: the minimum walking time between the locations in minutes.
standard output
PASSED
36cb70fcb99ea94247cd37e43bc0ffc0
train_000.jsonl
1533994500
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to the server room.The buil...
256 megabytes
//package cf.pkgnew.building.pkgfor.sis; // @author samyar import java.util.Scanner; public class CFNewBuildingForSIS { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n =in.nextInt(),h=in.nextInt(),a=in.nextInt(),b=in.nextInt(),k=in.nextInt(); while(k-- ...
Java
["3 6 2 3 3\n1 2 1 3\n1 4 3 4\n1 2 2 3"]
1 second
["1\n4\n2"]
null
Java 8
standard input
[ "math" ]
bdce4761496c88a3de00aa863ba7308d
The first line of the input contains following integers: n: the number of towers in the building (1 ≤ n ≤ 108), h: the number of floors in each tower (1 ≤ h ≤ 108), a and b: the lowest and highest floor where it's possible to move between adjacent towers (1 ≤ a ≤ b ≤ h), k: total number of queries (1 ≤ k ≤ 104). ...
1,000
For each query print a single integer: the minimum walking time between the locations in minutes.
standard output
PASSED
873e36f60fcc1d29327ffa3690a55ecd
train_000.jsonl
1533994500
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to the server room.The buil...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.nio.file.StandardWatchEventKinds; import java.util.*; import java.lang.*; import java.util.concurrent.LinkedBlockingDeque; import static java.lang.Math.*; public class Main implements Runnable { public static void main(Strin...
Java
["3 6 2 3 3\n1 2 1 3\n1 4 3 4\n1 2 2 3"]
1 second
["1\n4\n2"]
null
Java 8
standard input
[ "math" ]
bdce4761496c88a3de00aa863ba7308d
The first line of the input contains following integers: n: the number of towers in the building (1 ≤ n ≤ 108), h: the number of floors in each tower (1 ≤ h ≤ 108), a and b: the lowest and highest floor where it's possible to move between adjacent towers (1 ≤ a ≤ b ≤ h), k: total number of queries (1 ≤ k ≤ 104). ...
1,000
For each query print a single integer: the minimum walking time between the locations in minutes.
standard output
PASSED
36a070d88cf2300c0a81dbf448f34934
train_000.jsonl
1533994500
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to the server room.The buil...
256 megabytes
/* ⣿⣿⣿⣿⣿⣿⡷⣯⢿⣿⣷⣻⢯⣿⡽⣻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠸⣿⣿⣆⠹⣿⣿⢾⣟⣯⣿⣿⣿⣿⣿⣿⣽⣻⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣻⣽⡿⣿⣎⠙⣿⣞⣷⡌⢻⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⡄⠹⣿⣿⡆⠻⣿⣟⣯⡿⣽⡿⣿⣿⣿⣿⣽⡷⣯⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣟⣷⣿⣿⣿⡀⠹⣟⣾⣟⣆⠹⣯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢠⡘⣿⣿⡄⠉⢿⣿⣽⡷⣿⣻⣿⣿⣿⣿⡝⣷⣯⢿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣯⢿⣾⢿⣿⡄⢄⠘⢿⣞⡿⣧⡈⢷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⣧⠘⣿⣷⠈⣦⠙⢿⣽⣷⣻⣽⣿⣿⣿⣿⣌⢿⣯⢿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣟⣯⣿⢿⣿⡆⢸⡷⡈⢻⡽⣷⡷⡄⠻⣽⣿⣿⡿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣏⢰⣯⢷⠈⣿⡆⢹⢷⡌⠻⡾⢋⣱⣯⣿⣿⣿⣿⡆⢻⡿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⡎...
Java
["3 6 2 3 3\n1 2 1 3\n1 4 3 4\n1 2 2 3"]
1 second
["1\n4\n2"]
null
Java 8
standard input
[ "math" ]
bdce4761496c88a3de00aa863ba7308d
The first line of the input contains following integers: n: the number of towers in the building (1 ≤ n ≤ 108), h: the number of floors in each tower (1 ≤ h ≤ 108), a and b: the lowest and highest floor where it's possible to move between adjacent towers (1 ≤ a ≤ b ≤ h), k: total number of queries (1 ≤ k ≤ 104). ...
1,000
For each query print a single integer: the minimum walking time between the locations in minutes.
standard output
PASSED
22dd3bb4120c1aff42ed62fa7aa6338f
train_000.jsonl
1429029300
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + ...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.Comparator; import java.u...
Java
["2 1 4\n1 5 3\n3 3 10\n7 10 2\n6 4 8", "1 5 2\n1 5 10\n2 7 4"]
2 seconds
["4\n-1\n8\n-1", "1\n2"]
null
Java 7
standard input
[ "binary search", "greedy", "math" ]
89c97b6c302bbb51e9d5328c680a7ea7
The first line of input contains three integers A, B and n (1 ≤ A, B ≤ 106, 1 ≤ n ≤ 105). Next n lines contain information about queries. i-th line contains integers l, t, m (1 ≤ l, t, m ≤ 106) for i-th query.
1,900
For each query, print its answer in a single line.
standard output
PASSED
b814b6354eb25bd6a796304b1062fb6c
train_000.jsonl
1429029300
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + ...
256 megabytes
/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Ideone { //int r2 = (r-l+1)*(a+((l+r)/2-1)*b); static long a; static long b; static long l; static long ...
Java
["2 1 4\n1 5 3\n3 3 10\n7 10 2\n6 4 8", "1 5 2\n1 5 10\n2 7 4"]
2 seconds
["4\n-1\n8\n-1", "1\n2"]
null
Java 7
standard input
[ "binary search", "greedy", "math" ]
89c97b6c302bbb51e9d5328c680a7ea7
The first line of input contains three integers A, B and n (1 ≤ A, B ≤ 106, 1 ≤ n ≤ 105). Next n lines contain information about queries. i-th line contains integers l, t, m (1 ≤ l, t, m ≤ 106) for i-th query.
1,900
For each query, print its answer in a single line.
standard output
PASSED
3f17a516be6dd7a3de0463863fc469b4
train_000.jsonl
1429029300
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + ...
256 megabytes
import static java.lang.Math.*; public class A { public A () { long A = sc.nextLong(), B = sc.nextLong(); int N = sc.nextInt(); for (@SuppressWarnings("unused") int i : rep(N)) { long L = sc.nextLong(), T = sc.nextLong(), M = sc.nextLong(); long res = LINF; if (sum(A, B, L, L) > T) res = -1; ...
Java
["2 1 4\n1 5 3\n3 3 10\n7 10 2\n6 4 8", "1 5 2\n1 5 10\n2 7 4"]
2 seconds
["4\n-1\n8\n-1", "1\n2"]
null
Java 7
standard input
[ "binary search", "greedy", "math" ]
89c97b6c302bbb51e9d5328c680a7ea7
The first line of input contains three integers A, B and n (1 ≤ A, B ≤ 106, 1 ≤ n ≤ 105). Next n lines contain information about queries. i-th line contains integers l, t, m (1 ≤ l, t, m ≤ 106) for i-th query.
1,900
For each query, print its answer in a single line.
standard output
PASSED
4163f4dcb77136bc8e0d4ced24e5dde5
train_000.jsonl
1429029300
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + ...
256 megabytes
import java.io.InputStream; import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.BufferedReader; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStreamReader; import java.io.IOException; /** * Built using CHelper plug-in * Actual soluti...
Java
["2 1 4\n1 5 3\n3 3 10\n7 10 2\n6 4 8", "1 5 2\n1 5 10\n2 7 4"]
2 seconds
["4\n-1\n8\n-1", "1\n2"]
null
Java 7
standard input
[ "binary search", "greedy", "math" ]
89c97b6c302bbb51e9d5328c680a7ea7
The first line of input contains three integers A, B and n (1 ≤ A, B ≤ 106, 1 ≤ n ≤ 105). Next n lines contain information about queries. i-th line contains integers l, t, m (1 ≤ l, t, m ≤ 106) for i-th query.
1,900
For each query, print its answer in a single line.
standard output
PASSED
867044a95bfd6117f1a74340ff67ffdd
train_000.jsonl
1429029300
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + ...
256 megabytes
import java.util.InputMismatchException; import java.io.InputStream; import java.math.BigInteger; import java.io.PrintStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; /** * Built using CHelper plug-in * Actual solution is at the top * @author karan173 */ public class Mai...
Java
["2 1 4\n1 5 3\n3 3 10\n7 10 2\n6 4 8", "1 5 2\n1 5 10\n2 7 4"]
2 seconds
["4\n-1\n8\n-1", "1\n2"]
null
Java 7
standard input
[ "binary search", "greedy", "math" ]
89c97b6c302bbb51e9d5328c680a7ea7
The first line of input contains three integers A, B and n (1 ≤ A, B ≤ 106, 1 ≤ n ≤ 105). Next n lines contain information about queries. i-th line contains integers l, t, m (1 ≤ l, t, m ≤ 106) for i-th query.
1,900
For each query, print its answer in a single line.
standard output
PASSED
ba5795b6107f04e627ef0806e866274d
train_000.jsonl
1429029300
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + ...
256 megabytes
import java.util.Scanner; import java.io.OutputStream; import java.io.IOException; import java.io.FileOutputStream; import java.io.PrintWriter; import java.io.FileInputStream; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void ...
Java
["2 1 4\n1 5 3\n3 3 10\n7 10 2\n6 4 8", "1 5 2\n1 5 10\n2 7 4"]
2 seconds
["4\n-1\n8\n-1", "1\n2"]
null
Java 7
standard input
[ "binary search", "greedy", "math" ]
89c97b6c302bbb51e9d5328c680a7ea7
The first line of input contains three integers A, B and n (1 ≤ A, B ≤ 106, 1 ≤ n ≤ 105). Next n lines contain information about queries. i-th line contains integers l, t, m (1 ≤ l, t, m ≤ 106) for i-th query.
1,900
For each query, print its answer in a single line.
standard output
PASSED
7520f3aa084956bd20612747c1543122
train_000.jsonl
1429029300
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + ...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.StringTokenizer; public class A { static StringTokenizer st; static BufferedReader br; static PrintWr...
Java
["2 1 4\n1 5 3\n3 3 10\n7 10 2\n6 4 8", "1 5 2\n1 5 10\n2 7 4"]
2 seconds
["4\n-1\n8\n-1", "1\n2"]
null
Java 7
standard input
[ "binary search", "greedy", "math" ]
89c97b6c302bbb51e9d5328c680a7ea7
The first line of input contains three integers A, B and n (1 ≤ A, B ≤ 106, 1 ≤ n ≤ 105). Next n lines contain information about queries. i-th line contains integers l, t, m (1 ≤ l, t, m ≤ 106) for i-th query.
1,900
For each query, print its answer in a single line.
standard output
PASSED
163f57e6a7f154b798bb04a3fd15aab2
train_000.jsonl
1429029300
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.math.BigInteger; import java.util.Random; import java.util.StringTokenizer; public class TavasandKarafs { static BufferedReader in; static PrintWr...
Java
["2 1 4\n1 5 3\n3 3 10\n7 10 2\n6 4 8", "1 5 2\n1 5 10\n2 7 4"]
2 seconds
["4\n-1\n8\n-1", "1\n2"]
null
Java 7
standard input
[ "binary search", "greedy", "math" ]
89c97b6c302bbb51e9d5328c680a7ea7
The first line of input contains three integers A, B and n (1 ≤ A, B ≤ 106, 1 ≤ n ≤ 105). Next n lines contain information about queries. i-th line contains integers l, t, m (1 ≤ l, t, m ≤ 106) for i-th query.
1,900
For each query, print its answer in a single line.
standard output
PASSED
890285ee70cfa07e9209d1a4dc4fe11b
train_000.jsonl
1429029300
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + ...
256 megabytes
import java.util.*; import java.io.*; public class TavasAndKarafs { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); StringTokenizer st = new StringTokenizer(in.readLine()); long...
Java
["2 1 4\n1 5 3\n3 3 10\n7 10 2\n6 4 8", "1 5 2\n1 5 10\n2 7 4"]
2 seconds
["4\n-1\n8\n-1", "1\n2"]
null
Java 7
standard input
[ "binary search", "greedy", "math" ]
89c97b6c302bbb51e9d5328c680a7ea7
The first line of input contains three integers A, B and n (1 ≤ A, B ≤ 106, 1 ≤ n ≤ 105). Next n lines contain information about queries. i-th line contains integers l, t, m (1 ≤ l, t, m ≤ 106) for i-th query.
1,900
For each query, print its answer in a single line.
standard output
PASSED
d59ccc7ad8a7be52e6b4a5984bbb025a
train_000.jsonl
1429029300
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + ...
256 megabytes
import java.io.*; import java.util.*; public class R299TaskA { static long a,b; public static void main(String args[] ) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter w = new PrintWriter(System.out); StringTokenizer st1 = new String...
Java
["2 1 4\n1 5 3\n3 3 10\n7 10 2\n6 4 8", "1 5 2\n1 5 10\n2 7 4"]
2 seconds
["4\n-1\n8\n-1", "1\n2"]
null
Java 7
standard input
[ "binary search", "greedy", "math" ]
89c97b6c302bbb51e9d5328c680a7ea7
The first line of input contains three integers A, B and n (1 ≤ A, B ≤ 106, 1 ≤ n ≤ 105). Next n lines contain information about queries. i-th line contains integers l, t, m (1 ≤ l, t, m ≤ 106) for i-th query.
1,900
For each query, print its answer in a single line.
standard output
PASSED
4bd920484b6d1ba3fe6945d59dc69eae
train_000.jsonl
1429029300
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + ...
256 megabytes
import java.io.IOException; import java.util.InputMismatchException; public class TavasAndKarafs { public static void main(String[] args) { FasterScanner sc = new FasterScanner(); long A = sc.nextLong(); long B = sc.nextLong(); long N = sc.nextLong(); Strin...
Java
["2 1 4\n1 5 3\n3 3 10\n7 10 2\n6 4 8", "1 5 2\n1 5 10\n2 7 4"]
2 seconds
["4\n-1\n8\n-1", "1\n2"]
null
Java 7
standard input
[ "binary search", "greedy", "math" ]
89c97b6c302bbb51e9d5328c680a7ea7
The first line of input contains three integers A, B and n (1 ≤ A, B ≤ 106, 1 ≤ n ≤ 105). Next n lines contain information about queries. i-th line contains integers l, t, m (1 ≤ l, t, m ≤ 106) for i-th query.
1,900
For each query, print its answer in a single line.
standard output
PASSED
dcf01d6a54ad6b964b476a192cad1637
train_000.jsonl
1429029300
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + ...
256 megabytes
import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.PrintStream; import java.util.Scanner; public class CF3 { public static void main(String args[]) throws FileNotFoundException{ Scanner sc=new Scanner(System.in); // PrintStream out = new PrintStream(new FileOutputStream("C:/Users/z0...
Java
["2 1 4\n1 5 3\n3 3 10\n7 10 2\n6 4 8", "1 5 2\n1 5 10\n2 7 4"]
2 seconds
["4\n-1\n8\n-1", "1\n2"]
null
Java 7
standard input
[ "binary search", "greedy", "math" ]
89c97b6c302bbb51e9d5328c680a7ea7
The first line of input contains three integers A, B and n (1 ≤ A, B ≤ 106, 1 ≤ n ≤ 105). Next n lines contain information about queries. i-th line contains integers l, t, m (1 ≤ l, t, m ≤ 106) for i-th query.
1,900
For each query, print its answer in a single line.
standard output
PASSED
b30663390c5f2b487d1e4d727c34813b
train_000.jsonl
1429029300
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + ...
256 megabytes
import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.OutputStream; import java.io.PrintWriter; import java.util.NoSuchElementException; import java.io.Writer; import java.math.BigInteger; import java.io.InputStream; /** *...
Java
["2 1 4\n1 5 3\n3 3 10\n7 10 2\n6 4 8", "1 5 2\n1 5 10\n2 7 4"]
2 seconds
["4\n-1\n8\n-1", "1\n2"]
null
Java 7
standard input
[ "binary search", "greedy", "math" ]
89c97b6c302bbb51e9d5328c680a7ea7
The first line of input contains three integers A, B and n (1 ≤ A, B ≤ 106, 1 ≤ n ≤ 105). Next n lines contain information about queries. i-th line contains integers l, t, m (1 ≤ l, t, m ≤ 106) for i-th query.
1,900
For each query, print its answer in a single line.
standard output
PASSED
c7c7db7a6ad79b32f14aac3f405c5d21
train_000.jsonl
1429029300
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + ...
256 megabytes
import java.util.*; import java.io.*; public class A { public static void main(String[] args) throws Exception { FastScanner in = new FastScanner(System.in); PrintWriter out = new PrintWriter(System.out); long a = in.nextInt(); long b = in.nextInt(); int n = in.nextInt(); for(int x = 0; x < n; x++) ...
Java
["2 1 4\n1 5 3\n3 3 10\n7 10 2\n6 4 8", "1 5 2\n1 5 10\n2 7 4"]
2 seconds
["4\n-1\n8\n-1", "1\n2"]
null
Java 7
standard input
[ "binary search", "greedy", "math" ]
89c97b6c302bbb51e9d5328c680a7ea7
The first line of input contains three integers A, B and n (1 ≤ A, B ≤ 106, 1 ≤ n ≤ 105). Next n lines contain information about queries. i-th line contains integers l, t, m (1 ≤ l, t, m ≤ 106) for i-th query.
1,900
For each query, print its answer in a single line.
standard output
PASSED
2d324b97de4d18652049496e78da1927
train_000.jsonl
1429029300
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + ...
256 megabytes
import java.awt.Point; import java.io.*; import java.math.BigInteger; import java.util.*; import static java.lang.Math.*; public class solver implements Runnable { final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; BufferedReader in; PrintWriter out; StringTokenizer tok = new S...
Java
["2 1 4\n1 5 3\n3 3 10\n7 10 2\n6 4 8", "1 5 2\n1 5 10\n2 7 4"]
2 seconds
["4\n-1\n8\n-1", "1\n2"]
null
Java 7
standard input
[ "binary search", "greedy", "math" ]
89c97b6c302bbb51e9d5328c680a7ea7
The first line of input contains three integers A, B and n (1 ≤ A, B ≤ 106, 1 ≤ n ≤ 105). Next n lines contain information about queries. i-th line contains integers l, t, m (1 ≤ l, t, m ≤ 106) for i-th query.
1,900
For each query, print its answer in a single line.
standard output
PASSED
97a583262e80083688ec43267bfde2f3
train_000.jsonl
1429029300
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + ...
256 megabytes
import java.io.*; import java.util.*; public class AMain { String noResultMessage = "NoResult"; Parser in = new Parser(); PrintWriter out; long A = in.nextInteger(); long B = in.nextInteger(); int n = in.nextInteger(); public void solve() { for(int i = 0; i < n; ++i){ ...
Java
["2 1 4\n1 5 3\n3 3 10\n7 10 2\n6 4 8", "1 5 2\n1 5 10\n2 7 4"]
2 seconds
["4\n-1\n8\n-1", "1\n2"]
null
Java 7
standard input
[ "binary search", "greedy", "math" ]
89c97b6c302bbb51e9d5328c680a7ea7
The first line of input contains three integers A, B and n (1 ≤ A, B ≤ 106, 1 ≤ n ≤ 105). Next n lines contain information about queries. i-th line contains integers l, t, m (1 ≤ l, t, m ≤ 106) for i-th query.
1,900
For each query, print its answer in a single line.
standard output
PASSED
0144dc5164cf4c9a6a97983bcf670653
train_000.jsonl
1429029300
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + ...
256 megabytes
import java.util.*; import java.io.*; public class A { public static void main(String[] args) { new A(new FastScanner()); } int A, B; long sum(long n) { if (n <= 0) return 0; return n*(n+1L)/2; } long countBites(long lo, long hi, int m) { long height = A+B*hi; ...
Java
["2 1 4\n1 5 3\n3 3 10\n7 10 2\n6 4 8", "1 5 2\n1 5 10\n2 7 4"]
2 seconds
["4\n-1\n8\n-1", "1\n2"]
null
Java 7
standard input
[ "binary search", "greedy", "math" ]
89c97b6c302bbb51e9d5328c680a7ea7
The first line of input contains three integers A, B and n (1 ≤ A, B ≤ 106, 1 ≤ n ≤ 105). Next n lines contain information about queries. i-th line contains integers l, t, m (1 ≤ l, t, m ≤ 106) for i-th query.
1,900
For each query, print its answer in a single line.
standard output
PASSED
6472a3de7f7b391ae1fcaf8d0a7c7323
train_000.jsonl
1429029300
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + ...
256 megabytes
//package round299; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class A { InputStream is; PrintWriter out; String INPUT = ""; void solve() { long a = nl(); lo...
Java
["2 1 4\n1 5 3\n3 3 10\n7 10 2\n6 4 8", "1 5 2\n1 5 10\n2 7 4"]
2 seconds
["4\n-1\n8\n-1", "1\n2"]
null
Java 7
standard input
[ "binary search", "greedy", "math" ]
89c97b6c302bbb51e9d5328c680a7ea7
The first line of input contains three integers A, B and n (1 ≤ A, B ≤ 106, 1 ≤ n ≤ 105). Next n lines contain information about queries. i-th line contains integers l, t, m (1 ≤ l, t, m ≤ 106) for i-th query.
1,900
For each query, print its answer in a single line.
standard output
PASSED
db66bd458fe7eb488cd6306f5b665ff2
train_000.jsonl
1429029300
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.StringTokenizer; public class CF299A { public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer strtok; strtok = new S...
Java
["2 1 4\n1 5 3\n3 3 10\n7 10 2\n6 4 8", "1 5 2\n1 5 10\n2 7 4"]
2 seconds
["4\n-1\n8\n-1", "1\n2"]
null
Java 7
standard input
[ "binary search", "greedy", "math" ]
89c97b6c302bbb51e9d5328c680a7ea7
The first line of input contains three integers A, B and n (1 ≤ A, B ≤ 106, 1 ≤ n ≤ 105). Next n lines contain information about queries. i-th line contains integers l, t, m (1 ≤ l, t, m ≤ 106) for i-th query.
1,900
For each query, print its answer in a single line.
standard output
PASSED
b4c7481ee5e857553c8f5b6e1c2ad546
train_000.jsonl
1429029300
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + ...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { long A, B; int n; Scanner in = new Scanner(System.in); A = in.nextLong(); B = in.nextLong(); n = in.nextInt(); while ((n--) != 0) { long L; long t, m; ...
Java
["2 1 4\n1 5 3\n3 3 10\n7 10 2\n6 4 8", "1 5 2\n1 5 10\n2 7 4"]
2 seconds
["4\n-1\n8\n-1", "1\n2"]
null
Java 7
standard input
[ "binary search", "greedy", "math" ]
89c97b6c302bbb51e9d5328c680a7ea7
The first line of input contains three integers A, B and n (1 ≤ A, B ≤ 106, 1 ≤ n ≤ 105). Next n lines contain information about queries. i-th line contains integers l, t, m (1 ≤ l, t, m ≤ 106) for i-th query.
1,900
For each query, print its answer in a single line.
standard output
PASSED
b1208f0ee2a0765fe07945157d9ef6b4
train_000.jsonl
1429029300
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + ...
256 megabytes
import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { InputStream inputStream = System.i...
Java
["2 1 4\n1 5 3\n3 3 10\n7 10 2\n6 4 8", "1 5 2\n1 5 10\n2 7 4"]
2 seconds
["4\n-1\n8\n-1", "1\n2"]
null
Java 7
standard input
[ "binary search", "greedy", "math" ]
89c97b6c302bbb51e9d5328c680a7ea7
The first line of input contains three integers A, B and n (1 ≤ A, B ≤ 106, 1 ≤ n ≤ 105). Next n lines contain information about queries. i-th line contains integers l, t, m (1 ≤ l, t, m ≤ 106) for i-th query.
1,900
For each query, print its answer in a single line.
standard output
PASSED
f806e869e29d12683b1a4eeba948f981
train_000.jsonl
1429029300
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + ...
256 megabytes
import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { InputStream inputStream = System.i...
Java
["2 1 4\n1 5 3\n3 3 10\n7 10 2\n6 4 8", "1 5 2\n1 5 10\n2 7 4"]
2 seconds
["4\n-1\n8\n-1", "1\n2"]
null
Java 7
standard input
[ "binary search", "greedy", "math" ]
89c97b6c302bbb51e9d5328c680a7ea7
The first line of input contains three integers A, B and n (1 ≤ A, B ≤ 106, 1 ≤ n ≤ 105). Next n lines contain information about queries. i-th line contains integers l, t, m (1 ≤ l, t, m ≤ 106) for i-th query.
1,900
For each query, print its answer in a single line.
standard output
PASSED
2b1a76342b58f2a685055b7405dfc446
train_000.jsonl
1429029300
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + ...
256 megabytes
import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { InputStream inputStream = System.i...
Java
["2 1 4\n1 5 3\n3 3 10\n7 10 2\n6 4 8", "1 5 2\n1 5 10\n2 7 4"]
2 seconds
["4\n-1\n8\n-1", "1\n2"]
null
Java 7
standard input
[ "binary search", "greedy", "math" ]
89c97b6c302bbb51e9d5328c680a7ea7
The first line of input contains three integers A, B and n (1 ≤ A, B ≤ 106, 1 ≤ n ≤ 105). Next n lines contain information about queries. i-th line contains integers l, t, m (1 ≤ l, t, m ≤ 106) for i-th query.
1,900
For each query, print its answer in a single line.
standard output
PASSED
0c49241ce559c75238fbe7d348c0e5fe
train_000.jsonl
1429029300
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + ...
256 megabytes
import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.util.StringTokenizer; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static ...
Java
["2 1 4\n1 5 3\n3 3 10\n7 10 2\n6 4 8", "1 5 2\n1 5 10\n2 7 4"]
2 seconds
["4\n-1\n8\n-1", "1\n2"]
null
Java 7
standard input
[ "binary search", "greedy", "math" ]
89c97b6c302bbb51e9d5328c680a7ea7
The first line of input contains three integers A, B and n (1 ≤ A, B ≤ 106, 1 ≤ n ≤ 105). Next n lines contain information about queries. i-th line contains integers l, t, m (1 ≤ l, t, m ≤ 106) for i-th query.
1,900
For each query, print its answer in a single line.
standard output
PASSED
892788879543014f884fdf2704544530
train_000.jsonl
1429029300
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + ...
256 megabytes
import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); lon...
Java
["2 1 4\n1 5 3\n3 3 10\n7 10 2\n6 4 8", "1 5 2\n1 5 10\n2 7 4"]
2 seconds
["4\n-1\n8\n-1", "1\n2"]
null
Java 7
standard input
[ "binary search", "greedy", "math" ]
89c97b6c302bbb51e9d5328c680a7ea7
The first line of input contains three integers A, B and n (1 ≤ A, B ≤ 106, 1 ≤ n ≤ 105). Next n lines contain information about queries. i-th line contains integers l, t, m (1 ≤ l, t, m ≤ 106) for i-th query.
1,900
For each query, print its answer in a single line.
standard output
PASSED
c11a77dd4c9f46d63be40e39cae165e6
train_000.jsonl
1429029300
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + ...
256 megabytes
import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.util.StringTokenizer; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public stat...
Java
["2 1 4\n1 5 3\n3 3 10\n7 10 2\n6 4 8", "1 5 2\n1 5 10\n2 7 4"]
2 seconds
["4\n-1\n8\n-1", "1\n2"]
null
Java 7
standard input
[ "binary search", "greedy", "math" ]
89c97b6c302bbb51e9d5328c680a7ea7
The first line of input contains three integers A, B and n (1 ≤ A, B ≤ 106, 1 ≤ n ≤ 105). Next n lines contain information about queries. i-th line contains integers l, t, m (1 ≤ l, t, m ≤ 106) for i-th query.
1,900
For each query, print its answer in a single line.
standard output
PASSED
29f6180c9a6b03518fefb3eb81cb656b
train_000.jsonl
1429029300
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + ...
256 megabytes
import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { InputStream inputStream = System.i...
Java
["2 1 4\n1 5 3\n3 3 10\n7 10 2\n6 4 8", "1 5 2\n1 5 10\n2 7 4"]
2 seconds
["4\n-1\n8\n-1", "1\n2"]
null
Java 7
standard input
[ "binary search", "greedy", "math" ]
89c97b6c302bbb51e9d5328c680a7ea7
The first line of input contains three integers A, B and n (1 ≤ A, B ≤ 106, 1 ≤ n ≤ 105). Next n lines contain information about queries. i-th line contains integers l, t, m (1 ≤ l, t, m ≤ 106) for i-th query.
1,900
For each query, print its answer in a single line.
standard output
PASSED
032a6f83857dca63962e5c7903bb7c7c
train_000.jsonl
1429029300
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + ...
256 megabytes
import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { InputStream inputStream = System.i...
Java
["2 1 4\n1 5 3\n3 3 10\n7 10 2\n6 4 8", "1 5 2\n1 5 10\n2 7 4"]
2 seconds
["4\n-1\n8\n-1", "1\n2"]
null
Java 7
standard input
[ "binary search", "greedy", "math" ]
89c97b6c302bbb51e9d5328c680a7ea7
The first line of input contains three integers A, B and n (1 ≤ A, B ≤ 106, 1 ≤ n ≤ 105). Next n lines contain information about queries. i-th line contains integers l, t, m (1 ≤ l, t, m ≤ 106) for i-th query.
1,900
For each query, print its answer in a single line.
standard output
PASSED
d9970b2702b4958c220fe36c5a771c01
train_000.jsonl
1429029300
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the i-th Karafs is si = A + ...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); long a = in.nextLong(); long b = in.nextLong(); int n = in.nextInt(); for (int i = 0; i < n; ++i) { long l = in.nextLong(); ...
Java
["2 1 4\n1 5 3\n3 3 10\n7 10 2\n6 4 8", "1 5 2\n1 5 10\n2 7 4"]
2 seconds
["4\n-1\n8\n-1", "1\n2"]
null
Java 7
standard input
[ "binary search", "greedy", "math" ]
89c97b6c302bbb51e9d5328c680a7ea7
The first line of input contains three integers A, B and n (1 ≤ A, B ≤ 106, 1 ≤ n ≤ 105). Next n lines contain information about queries. i-th line contains integers l, t, m (1 ≤ l, t, m ≤ 106) for i-th query.
1,900
For each query, print its answer in a single line.
standard output
PASSED
ea0d64c68756e40e526a5fd7d31a19bb
train_000.jsonl
1300809600
A guy named Vasya attends the final grade of a high school. One day Vasya decided to watch a match of his favorite hockey team. And, as the boy loves hockey very much, even more than physics, he forgot to do the homework. Specifically, he forgot to complete his physics tasks. Next day the teacher got very angry at Vasy...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class YoungPhysicist { public static void main(String[] args) throws IOException { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); int x = 0, y = 0, z...
Java
["3\n4 1 7\n-2 4 -1\n1 -5 -3", "3\n3 -1 7\n-5 2 -4\n2 -1 -3"]
2 seconds
["NO", "YES"]
null
Java 6
standard input
[ "implementation", "math" ]
8ea24f3339b2ec67a769243dc68a47b2
The first line contains a positive integer n (1 ≤ n ≤ 100), then follow n lines containing three integers each: the xi coordinate, the yi coordinate and the zi coordinate of the force vector, applied to the body ( - 100 ≤ xi, yi, zi ≤ 100).
1,000
Print the word "YES" if the body is in equilibrium, or the word "NO" if it is not.
standard output
PASSED
b50bfef5e5984a04b7a0eebaebbb39ad
train_000.jsonl
1300809600
A guy named Vasya attends the final grade of a high school. One day Vasya decided to watch a match of his favorite hockey team. And, as the boy loves hockey very much, even more than physics, he forgot to do the homework. Specifically, he forgot to complete his physics tasks. Next day the teacher got very angry at Vasy...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class YoungPhysicist { public static void main(String[] args) throws IOException { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); int x = 0, y = 0, z ...
Java
["3\n4 1 7\n-2 4 -1\n1 -5 -3", "3\n3 -1 7\n-5 2 -4\n2 -1 -3"]
2 seconds
["NO", "YES"]
null
Java 6
standard input
[ "implementation", "math" ]
8ea24f3339b2ec67a769243dc68a47b2
The first line contains a positive integer n (1 ≤ n ≤ 100), then follow n lines containing three integers each: the xi coordinate, the yi coordinate and the zi coordinate of the force vector, applied to the body ( - 100 ≤ xi, yi, zi ≤ 100).
1,000
Print the word "YES" if the body is in equilibrium, or the word "NO" if it is not.
standard output
PASSED
9e85c3ddc9d6083c8f402cd91a020b51
train_000.jsonl
1592318100
Polycarp and his friends want to visit a new restaurant. The restaurant has $$$n$$$ tables arranged along a straight line. People are already sitting at some tables. The tables are numbered from $$$1$$$ to $$$n$$$ in the order from left to right. The state of the restaurant is described by a string of length $$$n$$$ wh...
256 megabytes
import java.io.*; import java.util.*; public class C { public static void main(String[] args)throws IOException { BufferedReader ob=new BufferedReader(new InputStreamReader(System.in)); StringBuffer sb=new StringBuffer(); int t=Integer.parseInt(ob.readLine()); while(t-->0) { ...
Java
["6\n6 1\n100010\n6 2\n000000\n5 1\n10101\n3 1\n001\n2 2\n00\n1 1\n0"]
2 seconds
["1\n2\n0\n1\n1\n1"]
NoteThe first test case is explained in the statement.In the second test case, the answer is $$$2$$$, since you can choose the first and the sixth table.In the third test case, you cannot take any free table without violating the rules of the restaurant.
Java 8
standard input
[ "constructive algorithms", "greedy", "math" ]
fd85ebe1dc975a71c72fac7eeb944a4a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. Then $$$t$$$ test cases follow. Each test case starts with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2\cdot 10^5$$$) — the number of tables in the restaurant and the minimum a...
1,300
For each test case output one integer — the number of tables that you can occupy so as not to violate the rules of the restaurant. If additional tables cannot be taken, then, obviously, you need to output $$$0$$$.
standard output
PASSED
ffaf4134a551017ba03497a8636be2bf
train_000.jsonl
1592318100
Polycarp and his friends want to visit a new restaurant. The restaurant has $$$n$$$ tables arranged along a straight line. People are already sitting at some tables. The tables are numbered from $$$1$$$ to $$$n$$$ in the order from left to right. The state of the restaurant is described by a string of length $$$n$$$ wh...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; public class c1 { public static void main(String[] args) { MyScanner scan = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); int t=scan.nextInt(); while(t-->0) { int n=scan.nextInt();...
Java
["6\n6 1\n100010\n6 2\n000000\n5 1\n10101\n3 1\n001\n2 2\n00\n1 1\n0"]
2 seconds
["1\n2\n0\n1\n1\n1"]
NoteThe first test case is explained in the statement.In the second test case, the answer is $$$2$$$, since you can choose the first and the sixth table.In the third test case, you cannot take any free table without violating the rules of the restaurant.
Java 8
standard input
[ "constructive algorithms", "greedy", "math" ]
fd85ebe1dc975a71c72fac7eeb944a4a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. Then $$$t$$$ test cases follow. Each test case starts with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2\cdot 10^5$$$) — the number of tables in the restaurant and the minimum a...
1,300
For each test case output one integer — the number of tables that you can occupy so as not to violate the rules of the restaurant. If additional tables cannot be taken, then, obviously, you need to output $$$0$$$.
standard output
PASSED
bf78ac1097707fd6e822afcb446c5d85
train_000.jsonl
1592318100
Polycarp and his friends want to visit a new restaurant. The restaurant has $$$n$$$ tables arranged along a straight line. People are already sitting at some tables. The tables are numbered from $$$1$$$ to $$$n$$$ in the order from left to right. The state of the restaurant is described by a string of length $$$n$$$ wh...
256 megabytes
import java.util.*; public class Main{ public static void main(String [] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); while(t-- >0) { int n = scan.nextInt(); int k = scan.nextInt(); char s[] = scan.next().toCharArray(...
Java
["6\n6 1\n100010\n6 2\n000000\n5 1\n10101\n3 1\n001\n2 2\n00\n1 1\n0"]
2 seconds
["1\n2\n0\n1\n1\n1"]
NoteThe first test case is explained in the statement.In the second test case, the answer is $$$2$$$, since you can choose the first and the sixth table.In the third test case, you cannot take any free table without violating the rules of the restaurant.
Java 8
standard input
[ "constructive algorithms", "greedy", "math" ]
fd85ebe1dc975a71c72fac7eeb944a4a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. Then $$$t$$$ test cases follow. Each test case starts with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2\cdot 10^5$$$) — the number of tables in the restaurant and the minimum a...
1,300
For each test case output one integer — the number of tables that you can occupy so as not to violate the rules of the restaurant. If additional tables cannot be taken, then, obviously, you need to output $$$0$$$.
standard output
PASSED
d1fa4619b79efd04b77e263770ae5cc2
train_000.jsonl
1592318100
Polycarp and his friends want to visit a new restaurant. The restaurant has $$$n$$$ tables arranged along a straight line. People are already sitting at some tables. The tables are numbered from $$$1$$$ to $$$n$$$ in the order from left to right. The state of the restaurant is described by a string of length $$$n$$$ wh...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class C { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); for (int test = 0; test < t; test++) { int n = in.nextInt(); int k = in.nextInt(); cha...
Java
["6\n6 1\n100010\n6 2\n000000\n5 1\n10101\n3 1\n001\n2 2\n00\n1 1\n0"]
2 seconds
["1\n2\n0\n1\n1\n1"]
NoteThe first test case is explained in the statement.In the second test case, the answer is $$$2$$$, since you can choose the first and the sixth table.In the third test case, you cannot take any free table without violating the rules of the restaurant.
Java 8
standard input
[ "constructive algorithms", "greedy", "math" ]
fd85ebe1dc975a71c72fac7eeb944a4a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. Then $$$t$$$ test cases follow. Each test case starts with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2\cdot 10^5$$$) — the number of tables in the restaurant and the minimum a...
1,300
For each test case output one integer — the number of tables that you can occupy so as not to violate the rules of the restaurant. If additional tables cannot be taken, then, obviously, you need to output $$$0$$$.
standard output
PASSED
e37d044567f2028c7b128a2754e72a21
train_000.jsonl
1592318100
Polycarp and his friends want to visit a new restaurant. The restaurant has $$$n$$$ tables arranged along a straight line. People are already sitting at some tables. The tables are numbered from $$$1$$$ to $$$n$$$ in the order from left to right. The state of the restaurant is described by a string of length $$$n$$$ wh...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class C { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); for (int test = 0; test < t; test++) { int n = in.nextInt(); int k = in.nextInt(); cha...
Java
["6\n6 1\n100010\n6 2\n000000\n5 1\n10101\n3 1\n001\n2 2\n00\n1 1\n0"]
2 seconds
["1\n2\n0\n1\n1\n1"]
NoteThe first test case is explained in the statement.In the second test case, the answer is $$$2$$$, since you can choose the first and the sixth table.In the third test case, you cannot take any free table without violating the rules of the restaurant.
Java 8
standard input
[ "constructive algorithms", "greedy", "math" ]
fd85ebe1dc975a71c72fac7eeb944a4a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. Then $$$t$$$ test cases follow. Each test case starts with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2\cdot 10^5$$$) — the number of tables in the restaurant and the minimum a...
1,300
For each test case output one integer — the number of tables that you can occupy so as not to violate the rules of the restaurant. If additional tables cannot be taken, then, obviously, you need to output $$$0$$$.
standard output
PASSED
c6b2a732723afe55125d19d8de8dbec6
train_000.jsonl
1592318100
Polycarp and his friends want to visit a new restaurant. The restaurant has $$$n$$$ tables arranged along a straight line. People are already sitting at some tables. The tables are numbered from $$$1$$$ to $$$n$$$ in the order from left to right. The state of the restaurant is described by a string of length $$$n$$$ wh...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class C { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); for (int test = 0; test < t; test++) { int n = in.nextInt(); int k = in.nextInt(); cha...
Java
["6\n6 1\n100010\n6 2\n000000\n5 1\n10101\n3 1\n001\n2 2\n00\n1 1\n0"]
2 seconds
["1\n2\n0\n1\n1\n1"]
NoteThe first test case is explained in the statement.In the second test case, the answer is $$$2$$$, since you can choose the first and the sixth table.In the third test case, you cannot take any free table without violating the rules of the restaurant.
Java 8
standard input
[ "constructive algorithms", "greedy", "math" ]
fd85ebe1dc975a71c72fac7eeb944a4a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. Then $$$t$$$ test cases follow. Each test case starts with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2\cdot 10^5$$$) — the number of tables in the restaurant and the minimum a...
1,300
For each test case output one integer — the number of tables that you can occupy so as not to violate the rules of the restaurant. If additional tables cannot be taken, then, obviously, you need to output $$$0$$$.
standard output
PASSED
5793cff2fc62f1af9ed48038a6988559
train_000.jsonl
1592318100
Polycarp and his friends want to visit a new restaurant. The restaurant has $$$n$$$ tables arranged along a straight line. People are already sitting at some tables. The tables are numbered from $$$1$$$ to $$$n$$$ in the order from left to right. The state of the restaurant is described by a string of length $$$n$$$ wh...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class C { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); for (int test = 0; test < t; test++) { int n = in.nextInt(); int k = in.nextInt(); cha...
Java
["6\n6 1\n100010\n6 2\n000000\n5 1\n10101\n3 1\n001\n2 2\n00\n1 1\n0"]
2 seconds
["1\n2\n0\n1\n1\n1"]
NoteThe first test case is explained in the statement.In the second test case, the answer is $$$2$$$, since you can choose the first and the sixth table.In the third test case, you cannot take any free table without violating the rules of the restaurant.
Java 8
standard input
[ "constructive algorithms", "greedy", "math" ]
fd85ebe1dc975a71c72fac7eeb944a4a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. Then $$$t$$$ test cases follow. Each test case starts with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2\cdot 10^5$$$) — the number of tables in the restaurant and the minimum a...
1,300
For each test case output one integer — the number of tables that you can occupy so as not to violate the rules of the restaurant. If additional tables cannot be taken, then, obviously, you need to output $$$0$$$.
standard output
PASSED
ce173a4d9beaae0b2f12e7af03168e6a
train_000.jsonl
1592318100
Polycarp and his friends want to visit a new restaurant. The restaurant has $$$n$$$ tables arranged along a straight line. People are already sitting at some tables. The tables are numbered from $$$1$$$ to $$$n$$$ in the order from left to right. The state of the restaurant is described by a string of length $$$n$$$ wh...
256 megabytes
//package codeforces.problem.nov; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; /* https://codeforces.com/problemset/problem/?/? 1 1 1 1 */ public class Tas...
Java
["6\n6 1\n100010\n6 2\n000000\n5 1\n10101\n3 1\n001\n2 2\n00\n1 1\n0"]
2 seconds
["1\n2\n0\n1\n1\n1"]
NoteThe first test case is explained in the statement.In the second test case, the answer is $$$2$$$, since you can choose the first and the sixth table.In the third test case, you cannot take any free table without violating the rules of the restaurant.
Java 8
standard input
[ "constructive algorithms", "greedy", "math" ]
fd85ebe1dc975a71c72fac7eeb944a4a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. Then $$$t$$$ test cases follow. Each test case starts with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2\cdot 10^5$$$) — the number of tables in the restaurant and the minimum a...
1,300
For each test case output one integer — the number of tables that you can occupy so as not to violate the rules of the restaurant. If additional tables cannot be taken, then, obviously, you need to output $$$0$$$.
standard output
PASSED
c81711de834ebde1c5373f0a655fa83c
train_000.jsonl
1592318100
Polycarp and his friends want to visit a new restaurant. The restaurant has $$$n$$$ tables arranged along a straight line. People are already sitting at some tables. The tables are numbered from $$$1$$$ to $$$n$$$ in the order from left to right. The state of the restaurant is described by a string of length $$$n$$$ wh...
256 megabytes
//package CodeForces; import java.util.Scanner; public class SocialDistance { public static void main(String[] args) { // TODO Auto-generated method stub Scanner s=new Scanner(System.in); int t=s.nextInt(); while(t>0) { int n=s.nextInt(); int k=s.nextInt(); String str=s.next(); int i=0;int j=s...
Java
["6\n6 1\n100010\n6 2\n000000\n5 1\n10101\n3 1\n001\n2 2\n00\n1 1\n0"]
2 seconds
["1\n2\n0\n1\n1\n1"]
NoteThe first test case is explained in the statement.In the second test case, the answer is $$$2$$$, since you can choose the first and the sixth table.In the third test case, you cannot take any free table without violating the rules of the restaurant.
Java 8
standard input
[ "constructive algorithms", "greedy", "math" ]
fd85ebe1dc975a71c72fac7eeb944a4a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. Then $$$t$$$ test cases follow. Each test case starts with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2\cdot 10^5$$$) — the number of tables in the restaurant and the minimum a...
1,300
For each test case output one integer — the number of tables that you can occupy so as not to violate the rules of the restaurant. If additional tables cannot be taken, then, obviously, you need to output $$$0$$$.
standard output
PASSED
5ceb335f0d0ff62972335db51396685e
train_000.jsonl
1592318100
Polycarp and his friends want to visit a new restaurant. The restaurant has $$$n$$$ tables arranged along a straight line. People are already sitting at some tables. The tables are numbered from $$$1$$$ to $$$n$$$ in the order from left to right. The state of the restaurant is described by a string of length $$$n$$$ wh...
256 megabytes
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.FileWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.UncheckedIOException; import java.io.Writer; import java.util.ArrayList; import java.util.List; public class TEST { static int LOCAL = 1; public st...
Java
["6\n6 1\n100010\n6 2\n000000\n5 1\n10101\n3 1\n001\n2 2\n00\n1 1\n0"]
2 seconds
["1\n2\n0\n1\n1\n1"]
NoteThe first test case is explained in the statement.In the second test case, the answer is $$$2$$$, since you can choose the first and the sixth table.In the third test case, you cannot take any free table without violating the rules of the restaurant.
Java 8
standard input
[ "constructive algorithms", "greedy", "math" ]
fd85ebe1dc975a71c72fac7eeb944a4a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. Then $$$t$$$ test cases follow. Each test case starts with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2\cdot 10^5$$$) — the number of tables in the restaurant and the minimum a...
1,300
For each test case output one integer — the number of tables that you can occupy so as not to violate the rules of the restaurant. If additional tables cannot be taken, then, obviously, you need to output $$$0$$$.
standard output
PASSED
76b0c5441275195d06b981c36293c0e9
train_000.jsonl
1592318100
Polycarp and his friends want to visit a new restaurant. The restaurant has $$$n$$$ tables arranged along a straight line. People are already sitting at some tables. The tables are numbered from $$$1$$$ to $$$n$$$ in the order from left to right. The state of the restaurant is described by a string of length $$$n$$$ wh...
256 megabytes
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.FileWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.UncheckedIOException; import java.io.Writer; import java.util.ArrayList; import java.util.List; public class TEST2 { static FastInput in = new FastIn...
Java
["6\n6 1\n100010\n6 2\n000000\n5 1\n10101\n3 1\n001\n2 2\n00\n1 1\n0"]
2 seconds
["1\n2\n0\n1\n1\n1"]
NoteThe first test case is explained in the statement.In the second test case, the answer is $$$2$$$, since you can choose the first and the sixth table.In the third test case, you cannot take any free table without violating the rules of the restaurant.
Java 8
standard input
[ "constructive algorithms", "greedy", "math" ]
fd85ebe1dc975a71c72fac7eeb944a4a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. Then $$$t$$$ test cases follow. Each test case starts with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2\cdot 10^5$$$) — the number of tables in the restaurant and the minimum a...
1,300
For each test case output one integer — the number of tables that you can occupy so as not to violate the rules of the restaurant. If additional tables cannot be taken, then, obviously, you need to output $$$0$$$.
standard output
PASSED
c77c2a939db25c8bfe9eb9d2e13810b6
train_000.jsonl
1592318100
Polycarp and his friends want to visit a new restaurant. The restaurant has $$$n$$$ tables arranged along a straight line. People are already sitting at some tables. The tables are numbered from $$$1$$$ to $$$n$$$ in the order from left to right. The state of the restaurant is described by a string of length $$$n$$$ wh...
256 megabytes
//package BaseCodeForCoding; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; public class TEST2 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(...
Java
["6\n6 1\n100010\n6 2\n000000\n5 1\n10101\n3 1\n001\n2 2\n00\n1 1\n0"]
2 seconds
["1\n2\n0\n1\n1\n1"]
NoteThe first test case is explained in the statement.In the second test case, the answer is $$$2$$$, since you can choose the first and the sixth table.In the third test case, you cannot take any free table without violating the rules of the restaurant.
Java 8
standard input
[ "constructive algorithms", "greedy", "math" ]
fd85ebe1dc975a71c72fac7eeb944a4a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. Then $$$t$$$ test cases follow. Each test case starts with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2\cdot 10^5$$$) — the number of tables in the restaurant and the minimum a...
1,300
For each test case output one integer — the number of tables that you can occupy so as not to violate the rules of the restaurant. If additional tables cannot be taken, then, obviously, you need to output $$$0$$$.
standard output
PASSED
fc917b13f7f96aa6fbc5d846a2d51a31
train_000.jsonl
1592318100
Polycarp and his friends want to visit a new restaurant. The restaurant has $$$n$$$ tables arranged along a straight line. People are already sitting at some tables. The tables are numbered from $$$1$$$ to $$$n$$$ in the order from left to right. The state of the restaurant is described by a string of length $$$n$$$ wh...
256 megabytes
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.FileWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.UncheckedIOException; import java.io.Writer; import java.util.ArrayList; import java.util.List; public class TEST2 { static FastInput in = new FastIn...
Java
["6\n6 1\n100010\n6 2\n000000\n5 1\n10101\n3 1\n001\n2 2\n00\n1 1\n0"]
2 seconds
["1\n2\n0\n1\n1\n1"]
NoteThe first test case is explained in the statement.In the second test case, the answer is $$$2$$$, since you can choose the first and the sixth table.In the third test case, you cannot take any free table without violating the rules of the restaurant.
Java 8
standard input
[ "constructive algorithms", "greedy", "math" ]
fd85ebe1dc975a71c72fac7eeb944a4a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. Then $$$t$$$ test cases follow. Each test case starts with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2\cdot 10^5$$$) — the number of tables in the restaurant and the minimum a...
1,300
For each test case output one integer — the number of tables that you can occupy so as not to violate the rules of the restaurant. If additional tables cannot be taken, then, obviously, you need to output $$$0$$$.
standard output
PASSED
e35f5a89ef09a6b3c29d5dfef90a5e62
train_000.jsonl
1592318100
Polycarp and his friends want to visit a new restaurant. The restaurant has $$$n$$$ tables arranged along a straight line. People are already sitting at some tables. The tables are numbered from $$$1$$$ to $$$n$$$ in the order from left to right. The state of the restaurant is described by a string of length $$$n$$$ wh...
256 megabytes
import java.util.*; public class SocialDistance { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); while (t-- > 0) { int n = scanner.nextInt(); int k = scanner.nextInt(); String s = scanner.nex...
Java
["6\n6 1\n100010\n6 2\n000000\n5 1\n10101\n3 1\n001\n2 2\n00\n1 1\n0"]
2 seconds
["1\n2\n0\n1\n1\n1"]
NoteThe first test case is explained in the statement.In the second test case, the answer is $$$2$$$, since you can choose the first and the sixth table.In the third test case, you cannot take any free table without violating the rules of the restaurant.
Java 8
standard input
[ "constructive algorithms", "greedy", "math" ]
fd85ebe1dc975a71c72fac7eeb944a4a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. Then $$$t$$$ test cases follow. Each test case starts with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2\cdot 10^5$$$) — the number of tables in the restaurant and the minimum a...
1,300
For each test case output one integer — the number of tables that you can occupy so as not to violate the rules of the restaurant. If additional tables cannot be taken, then, obviously, you need to output $$$0$$$.
standard output
PASSED
5e984a7080e6e3cab295d196472ecd66
train_000.jsonl
1592318100
Polycarp and his friends want to visit a new restaurant. The restaurant has $$$n$$$ tables arranged along a straight line. People are already sitting at some tables. The tables are numbered from $$$1$$$ to $$$n$$$ in the order from left to right. The state of the restaurant is described by a string of length $$$n$$$ wh...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.StringTokenizer; public class SocialDistance { // Template for CF public static class ListCompara...
Java
["6\n6 1\n100010\n6 2\n000000\n5 1\n10101\n3 1\n001\n2 2\n00\n1 1\n0"]
2 seconds
["1\n2\n0\n1\n1\n1"]
NoteThe first test case is explained in the statement.In the second test case, the answer is $$$2$$$, since you can choose the first and the sixth table.In the third test case, you cannot take any free table without violating the rules of the restaurant.
Java 8
standard input
[ "constructive algorithms", "greedy", "math" ]
fd85ebe1dc975a71c72fac7eeb944a4a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. Then $$$t$$$ test cases follow. Each test case starts with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2\cdot 10^5$$$) — the number of tables in the restaurant and the minimum a...
1,300
For each test case output one integer — the number of tables that you can occupy so as not to violate the rules of the restaurant. If additional tables cannot be taken, then, obviously, you need to output $$$0$$$.
standard output
PASSED
7e2c6690b81aec74a39b5c7ca4e7b357
train_000.jsonl
1592318100
Polycarp and his friends want to visit a new restaurant. The restaurant has $$$n$$$ tables arranged along a straight line. People are already sitting at some tables. The tables are numbered from $$$1$$$ to $$$n$$$ in the order from left to right. The state of the restaurant is described by a string of length $$$n$$$ wh...
256 megabytes
import java.util.Scanner; /** * * @author HP */ public class Question3 { public static void main(String[] args) { Scanner s = new Scanner(System.in); int testCases = s.nextInt(); while(testCases-->0) { int size =s.nextInt(); int k = s.nextInt(); s.next...
Java
["6\n6 1\n100010\n6 2\n000000\n5 1\n10101\n3 1\n001\n2 2\n00\n1 1\n0"]
2 seconds
["1\n2\n0\n1\n1\n1"]
NoteThe first test case is explained in the statement.In the second test case, the answer is $$$2$$$, since you can choose the first and the sixth table.In the third test case, you cannot take any free table without violating the rules of the restaurant.
Java 8
standard input
[ "constructive algorithms", "greedy", "math" ]
fd85ebe1dc975a71c72fac7eeb944a4a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. Then $$$t$$$ test cases follow. Each test case starts with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2\cdot 10^5$$$) — the number of tables in the restaurant and the minimum a...
1,300
For each test case output one integer — the number of tables that you can occupy so as not to violate the rules of the restaurant. If additional tables cannot be taken, then, obviously, you need to output $$$0$$$.
standard output
PASSED
45f4bd1609e122c1c8466c8b8e9f7136
train_000.jsonl
1592318100
Polycarp and his friends want to visit a new restaurant. The restaurant has $$$n$$$ tables arranged along a straight line. People are already sitting at some tables. The tables are numbered from $$$1$$$ to $$$n$$$ in the order from left to right. The state of the restaurant is described by a string of length $$$n$$$ wh...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in...
Java
["6\n6 1\n100010\n6 2\n000000\n5 1\n10101\n3 1\n001\n2 2\n00\n1 1\n0"]
2 seconds
["1\n2\n0\n1\n1\n1"]
NoteThe first test case is explained in the statement.In the second test case, the answer is $$$2$$$, since you can choose the first and the sixth table.In the third test case, you cannot take any free table without violating the rules of the restaurant.
Java 8
standard input
[ "constructive algorithms", "greedy", "math" ]
fd85ebe1dc975a71c72fac7eeb944a4a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. Then $$$t$$$ test cases follow. Each test case starts with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2\cdot 10^5$$$) — the number of tables in the restaurant and the minimum a...
1,300
For each test case output one integer — the number of tables that you can occupy so as not to violate the rules of the restaurant. If additional tables cannot be taken, then, obviously, you need to output $$$0$$$.
standard output
PASSED
d0667444f9b6ab2d14781a68c9312427
train_000.jsonl
1592318100
Polycarp and his friends want to visit a new restaurant. The restaurant has $$$n$$$ tables arranged along a straight line. People are already sitting at some tables. The tables are numbered from $$$1$$$ to $$$n$$$ in the order from left to right. The state of the restaurant is described by a string of length $$$n$$$ wh...
256 megabytes
import java.util.Scanner; public class SocialDistances { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int count = Integer.parseInt(sc.nextLine()); if (count == 0) System.out.println(0); while (count > 0) { String row = sc.nextLine(); ...
Java
["6\n6 1\n100010\n6 2\n000000\n5 1\n10101\n3 1\n001\n2 2\n00\n1 1\n0"]
2 seconds
["1\n2\n0\n1\n1\n1"]
NoteThe first test case is explained in the statement.In the second test case, the answer is $$$2$$$, since you can choose the first and the sixth table.In the third test case, you cannot take any free table without violating the rules of the restaurant.
Java 8
standard input
[ "constructive algorithms", "greedy", "math" ]
fd85ebe1dc975a71c72fac7eeb944a4a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. Then $$$t$$$ test cases follow. Each test case starts with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2\cdot 10^5$$$) — the number of tables in the restaurant and the minimum a...
1,300
For each test case output one integer — the number of tables that you can occupy so as not to violate the rules of the restaurant. If additional tables cannot be taken, then, obviously, you need to output $$$0$$$.
standard output
PASSED
4de68e969a138ac78aeb16ae9803648e
train_000.jsonl
1592318100
Polycarp and his friends want to visit a new restaurant. The restaurant has $$$n$$$ tables arranged along a straight line. People are already sitting at some tables. The tables are numbered from $$$1$$$ to $$$n$$$ in the order from left to right. The state of the restaurant is described by a string of length $$$n$$$ wh...
256 megabytes
import java.io.*; import java.util.*; public class codeforce { public static void main(String[] args) throws IOException { BufferedReader bf=new BufferedReader(new InputStreamReader(System.in)); int t=Integer.parseInt(bf.readLine().trim()); while(t!=0) { String[] in=...
Java
["6\n6 1\n100010\n6 2\n000000\n5 1\n10101\n3 1\n001\n2 2\n00\n1 1\n0"]
2 seconds
["1\n2\n0\n1\n1\n1"]
NoteThe first test case is explained in the statement.In the second test case, the answer is $$$2$$$, since you can choose the first and the sixth table.In the third test case, you cannot take any free table without violating the rules of the restaurant.
Java 8
standard input
[ "constructive algorithms", "greedy", "math" ]
fd85ebe1dc975a71c72fac7eeb944a4a
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. Then $$$t$$$ test cases follow. Each test case starts with a line containing two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2\cdot 10^5$$$) — the number of tables in the restaurant and the minimum a...
1,300
For each test case output one integer — the number of tables that you can occupy so as not to violate the rules of the restaurant. If additional tables cannot be taken, then, obviously, you need to output $$$0$$$.
standard output
PASSED
030d17c6fa00b6d657099ffd75629f2b
train_000.jsonl
1443430800
Petya loves computer games. Finally a game that he's been waiting for so long came out!The main character of this game has n different skills, each of which is characterized by an integer ai from 0 to 100. The higher the number ai is, the higher is the i-th skill of the character. The total rating of the character is c...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.*; public class Codeforces implements Runnable { private BufferedReader br = null; private PrintWriter pw = null; private StringTokenizer stk = new StringTokenizer(""); public static void main(String[] arg...
Java
["2 4\n7 9", "3 8\n17 15 19", "2 2\n99 100"]
1 second
["2", "5", "20"]
NoteIn the first test case the optimal strategy is as follows. Petya has to improve the first skill to 10 by spending 3 improvement units, and the second skill to 10, by spending one improvement unit. Thus, Petya spends all his improvement units and the total rating of the character becomes equal to lfloor frac{100}{1...
Java 7
standard input
[ "implementation", "sortings", "math" ]
b4341e1b0ec0b7341fdbe6edfe81a0d4
The first line of the input contains two positive integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 107) — the number of skills of the character and the number of units of improvements at Petya's disposal. The second line of the input contains a sequence of n integers ai (0 ≤ ai ≤ 100), where ai characterizes the level of the i-t...
1,400
The first line of the output should contain a single non-negative integer — the maximum total rating of the character that Petya can get using k or less improvement units.
standard output
PASSED
34a0a38d5fc58665659e70fd45f1cedd
train_000.jsonl
1443430800
Petya loves computer games. Finally a game that he's been waiting for so long came out!The main character of this game has n different skills, each of which is characterized by an integer ai from 0 to 100. The higher the number ai is, the higher is the i-th skill of the character. The total rating of the character is c...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class C { public static void main(String args[]){ Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); int l = n*100; int a[] = new int[n]; int m = 0 ; for(int i = 0 ; i < n...
Java
["2 4\n7 9", "3 8\n17 15 19", "2 2\n99 100"]
1 second
["2", "5", "20"]
NoteIn the first test case the optimal strategy is as follows. Petya has to improve the first skill to 10 by spending 3 improvement units, and the second skill to 10, by spending one improvement unit. Thus, Petya spends all his improvement units and the total rating of the character becomes equal to lfloor frac{100}{1...
Java 7
standard input
[ "implementation", "sortings", "math" ]
b4341e1b0ec0b7341fdbe6edfe81a0d4
The first line of the input contains two positive integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 107) — the number of skills of the character and the number of units of improvements at Petya's disposal. The second line of the input contains a sequence of n integers ai (0 ≤ ai ≤ 100), where ai characterizes the level of the i-t...
1,400
The first line of the output should contain a single non-negative integer — the maximum total rating of the character that Petya can get using k or less improvement units.
standard output
PASSED
27082417b1b536f6bc779947294fee38
train_000.jsonl
1443430800
Petya loves computer games. Finally a game that he's been waiting for so long came out!The main character of this game has n different skills, each of which is characterized by an integer ai from 0 to 100. The higher the number ai is, the higher is the i-th skill of the character. The total rating of the character is c...
256 megabytes
import java.io.*; import java.util.*; public class C { FastScanner in; PrintWriter out; int i = 0, j = 0; void solve() { /**************START**************/ int n = in.nextInt(); int k = in.nextInt(); int totalPoints = 0; int[] needed = new int[n]; int cur; for (i = 0; i < n; i++) { cur = in....
Java
["2 4\n7 9", "3 8\n17 15 19", "2 2\n99 100"]
1 second
["2", "5", "20"]
NoteIn the first test case the optimal strategy is as follows. Petya has to improve the first skill to 10 by spending 3 improvement units, and the second skill to 10, by spending one improvement unit. Thus, Petya spends all his improvement units and the total rating of the character becomes equal to lfloor frac{100}{1...
Java 7
standard input
[ "implementation", "sortings", "math" ]
b4341e1b0ec0b7341fdbe6edfe81a0d4
The first line of the input contains two positive integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 107) — the number of skills of the character and the number of units of improvements at Petya's disposal. The second line of the input contains a sequence of n integers ai (0 ≤ ai ≤ 100), where ai characterizes the level of the i-t...
1,400
The first line of the output should contain a single non-negative integer — the maximum total rating of the character that Petya can get using k or less improvement units.
standard output
PASSED
e420b33287e73b68eeaf2f08176ca7e8
train_000.jsonl
1443430800
Petya loves computer games. Finally a game that he's been waiting for so long came out!The main character of this game has n different skills, each of which is characterized by an integer ai from 0 to 100. The higher the number ai is, the higher is the i-th skill of the character. The total rating of the character is c...
256 megabytes
import java.io.PrintStream; import java.util.Arrays; import java.util.Scanner; import static java.lang.Math.min; public class C { static Scanner in = new Scanner(System.in); static PrintStream out = System.out; public static void main(String[] args) { int n = in.nextInt(); int k = in.next...
Java
["2 4\n7 9", "3 8\n17 15 19", "2 2\n99 100"]
1 second
["2", "5", "20"]
NoteIn the first test case the optimal strategy is as follows. Petya has to improve the first skill to 10 by spending 3 improvement units, and the second skill to 10, by spending one improvement unit. Thus, Petya spends all his improvement units and the total rating of the character becomes equal to lfloor frac{100}{1...
Java 7
standard input
[ "implementation", "sortings", "math" ]
b4341e1b0ec0b7341fdbe6edfe81a0d4
The first line of the input contains two positive integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 107) — the number of skills of the character and the number of units of improvements at Petya's disposal. The second line of the input contains a sequence of n integers ai (0 ≤ ai ≤ 100), where ai characterizes the level of the i-t...
1,400
The first line of the output should contain a single non-negative integer — the maximum total rating of the character that Petya can get using k or less improvement units.
standard output
PASSED
fe6ef1af3c7607643c2b932c02d4a92f
train_000.jsonl
1443430800
Petya loves computer games. Finally a game that he's been waiting for so long came out!The main character of this game has n different skills, each of which is characterized by an integer ai from 0 to 100. The higher the number ai is, the higher is the i-th skill of the character. The total rating of the character is c...
256 megabytes
import java.util.*; public class Main { private static Scanner in; static class Rate implements Comparable<Rate> { int rate, rateMod; public Rate() { } public Rate(int R) { rate = R; rateMod = R % 10; } public int compareTo(Rate arg0) { if (rateMod != arg0.rateMod) return rateMod - arg0...
Java
["2 4\n7 9", "3 8\n17 15 19", "2 2\n99 100"]
1 second
["2", "5", "20"]
NoteIn the first test case the optimal strategy is as follows. Petya has to improve the first skill to 10 by spending 3 improvement units, and the second skill to 10, by spending one improvement unit. Thus, Petya spends all his improvement units and the total rating of the character becomes equal to lfloor frac{100}{1...
Java 7
standard input
[ "implementation", "sortings", "math" ]
b4341e1b0ec0b7341fdbe6edfe81a0d4
The first line of the input contains two positive integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 107) — the number of skills of the character and the number of units of improvements at Petya's disposal. The second line of the input contains a sequence of n integers ai (0 ≤ ai ≤ 100), where ai characterizes the level of the i-t...
1,400
The first line of the output should contain a single non-negative integer — the maximum total rating of the character that Petya can get using k or less improvement units.
standard output
PASSED
c8f26b79b0e68536409b6fa3890e2aa3
train_000.jsonl
1443430800
Petya loves computer games. Finally a game that he's been waiting for so long came out!The main character of this game has n different skills, each of which is characterized by an integer ai from 0 to 100. The higher the number ai is, the higher is the i-th skill of the character. The total rating of the character is c...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.util.Random; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; im...
Java
["2 4\n7 9", "3 8\n17 15 19", "2 2\n99 100"]
1 second
["2", "5", "20"]
NoteIn the first test case the optimal strategy is as follows. Petya has to improve the first skill to 10 by spending 3 improvement units, and the second skill to 10, by spending one improvement unit. Thus, Petya spends all his improvement units and the total rating of the character becomes equal to lfloor frac{100}{1...
Java 7
standard input
[ "implementation", "sortings", "math" ]
b4341e1b0ec0b7341fdbe6edfe81a0d4
The first line of the input contains two positive integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 107) — the number of skills of the character and the number of units of improvements at Petya's disposal. The second line of the input contains a sequence of n integers ai (0 ≤ ai ≤ 100), where ai characterizes the level of the i-t...
1,400
The first line of the output should contain a single non-negative integer — the maximum total rating of the character that Petya can get using k or less improvement units.
standard output
PASSED
dc13dbd3f27f7e68c0a834fc0604837d
train_000.jsonl
1443430800
Petya loves computer games. Finally a game that he's been waiting for so long came out!The main character of this game has n different skills, each of which is characterized by an integer ai from 0 to 100. The higher the number ai is, the higher is the i-th skill of the character. The total rating of the character is c...
256 megabytes
import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.Scanner; public class ACMSolution { public static void main(String[] args) throws IOException { //Scanner in = new Scanner(Paths.get("input....
Java
["2 4\n7 9", "3 8\n17 15 19", "2 2\n99 100"]
1 second
["2", "5", "20"]
NoteIn the first test case the optimal strategy is as follows. Petya has to improve the first skill to 10 by spending 3 improvement units, and the second skill to 10, by spending one improvement unit. Thus, Petya spends all his improvement units and the total rating of the character becomes equal to lfloor frac{100}{1...
Java 7
standard input
[ "implementation", "sortings", "math" ]
b4341e1b0ec0b7341fdbe6edfe81a0d4
The first line of the input contains two positive integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 107) — the number of skills of the character and the number of units of improvements at Petya's disposal. The second line of the input contains a sequence of n integers ai (0 ≤ ai ≤ 100), where ai characterizes the level of the i-t...
1,400
The first line of the output should contain a single non-negative integer — the maximum total rating of the character that Petya can get using k or less improvement units.
standard output
PASSED
dfc7b40eb0d79c68197bc02c5aeadcbf
train_000.jsonl
1443430800
Petya loves computer games. Finally a game that he's been waiting for so long came out!The main character of this game has n different skills, each of which is characterized by an integer ai from 0 to 100. The higher the number ai is, the higher is the i-th skill of the character. The total rating of the character is c...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.BitS...
Java
["2 4\n7 9", "3 8\n17 15 19", "2 2\n99 100"]
1 second
["2", "5", "20"]
NoteIn the first test case the optimal strategy is as follows. Petya has to improve the first skill to 10 by spending 3 improvement units, and the second skill to 10, by spending one improvement unit. Thus, Petya spends all his improvement units and the total rating of the character becomes equal to lfloor frac{100}{1...
Java 7
standard input
[ "implementation", "sortings", "math" ]
b4341e1b0ec0b7341fdbe6edfe81a0d4
The first line of the input contains two positive integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 107) — the number of skills of the character and the number of units of improvements at Petya's disposal. The second line of the input contains a sequence of n integers ai (0 ≤ ai ≤ 100), where ai characterizes the level of the i-t...
1,400
The first line of the output should contain a single non-negative integer — the maximum total rating of the character that Petya can get using k or less improvement units.
standard output
PASSED
cd3dfa52601dbf27745a23608be14909
train_000.jsonl
1443430800
Petya loves computer games. Finally a game that he's been waiting for so long came out!The main character of this game has n different skills, each of which is characterized by an integer ai from 0 to 100. The higher the number ai is, the higher is the i-th skill of the character. The total rating of the character is c...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class P581C { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] n_k_str = br.readLine().split(" "); ...
Java
["2 4\n7 9", "3 8\n17 15 19", "2 2\n99 100"]
1 second
["2", "5", "20"]
NoteIn the first test case the optimal strategy is as follows. Petya has to improve the first skill to 10 by spending 3 improvement units, and the second skill to 10, by spending one improvement unit. Thus, Petya spends all his improvement units and the total rating of the character becomes equal to lfloor frac{100}{1...
Java 7
standard input
[ "implementation", "sortings", "math" ]
b4341e1b0ec0b7341fdbe6edfe81a0d4
The first line of the input contains two positive integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 107) — the number of skills of the character and the number of units of improvements at Petya's disposal. The second line of the input contains a sequence of n integers ai (0 ≤ ai ≤ 100), where ai characterizes the level of the i-t...
1,400
The first line of the output should contain a single non-negative integer — the maximum total rating of the character that Petya can get using k or less improvement units.
standard output
PASSED
efee5c54ca4b199fb247f23574f307d5
train_000.jsonl
1443430800
Petya loves computer games. Finally a game that he's been waiting for so long came out!The main character of this game has n different skills, each of which is characterized by an integer ai from 0 to 100. The higher the number ai is, the higher is the i-th skill of the character. The total rating of the character is c...
256 megabytes
import java.util.*; import java.awt.Point; import java.io.*; import java.math.BigInteger; public class CodeForces { FastScanner in; PrintWriter out; class skil implements Comparable { int skil; int x; skil (int a, int b) { skil = a; x = b; } publ...
Java
["2 4\n7 9", "3 8\n17 15 19", "2 2\n99 100"]
1 second
["2", "5", "20"]
NoteIn the first test case the optimal strategy is as follows. Petya has to improve the first skill to 10 by spending 3 improvement units, and the second skill to 10, by spending one improvement unit. Thus, Petya spends all his improvement units and the total rating of the character becomes equal to lfloor frac{100}{1...
Java 7
standard input
[ "implementation", "sortings", "math" ]
b4341e1b0ec0b7341fdbe6edfe81a0d4
The first line of the input contains two positive integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 107) — the number of skills of the character and the number of units of improvements at Petya's disposal. The second line of the input contains a sequence of n integers ai (0 ≤ ai ≤ 100), where ai characterizes the level of the i-t...
1,400
The first line of the output should contain a single non-negative integer — the maximum total rating of the character that Petya can get using k or less improvement units.
standard output
PASSED
dcf17459809f9dd7230f55a965e857ed
train_000.jsonl
1443430800
Petya loves computer games. Finally a game that he's been waiting for so long came out!The main character of this game has n different skills, each of which is characterized by an integer ai from 0 to 100. The higher the number ai is, the higher is the i-th skill of the character. The total rating of the character is c...
256 megabytes
import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Scanner; import java.util.Set; public class P581C { private void run() { int n = nextInt(); int k = nextInt()...
Java
["2 4\n7 9", "3 8\n17 15 19", "2 2\n99 100"]
1 second
["2", "5", "20"]
NoteIn the first test case the optimal strategy is as follows. Petya has to improve the first skill to 10 by spending 3 improvement units, and the second skill to 10, by spending one improvement unit. Thus, Petya spends all his improvement units and the total rating of the character becomes equal to lfloor frac{100}{1...
Java 7
standard input
[ "implementation", "sortings", "math" ]
b4341e1b0ec0b7341fdbe6edfe81a0d4
The first line of the input contains two positive integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 107) — the number of skills of the character and the number of units of improvements at Petya's disposal. The second line of the input contains a sequence of n integers ai (0 ≤ ai ≤ 100), where ai characterizes the level of the i-t...
1,400
The first line of the output should contain a single non-negative integer — the maximum total rating of the character that Petya can get using k or less improvement units.
standard output
PASSED
98ae622f98f67870e5661477849516ff
train_000.jsonl
1443430800
Petya loves computer games. Finally a game that he's been waiting for so long came out!The main character of this game has n different skills, each of which is characterized by an integer ai from 0 to 100. The higher the number ai is, the higher is the i-th skill of the character. The total rating of the character is c...
256 megabytes
import java.util.*; import java.io.*; public class Codeforces { public static void main(String[] args) throws IOException { Reader.init(System.in); int n = Reader.nextInt(); int k = Reader.nextInt(); NN mod[] = new NN[n]; ...
Java
["2 4\n7 9", "3 8\n17 15 19", "2 2\n99 100"]
1 second
["2", "5", "20"]
NoteIn the first test case the optimal strategy is as follows. Petya has to improve the first skill to 10 by spending 3 improvement units, and the second skill to 10, by spending one improvement unit. Thus, Petya spends all his improvement units and the total rating of the character becomes equal to lfloor frac{100}{1...
Java 7
standard input
[ "implementation", "sortings", "math" ]
b4341e1b0ec0b7341fdbe6edfe81a0d4
The first line of the input contains two positive integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 107) — the number of skills of the character and the number of units of improvements at Petya's disposal. The second line of the input contains a sequence of n integers ai (0 ≤ ai ≤ 100), where ai characterizes the level of the i-t...
1,400
The first line of the output should contain a single non-negative integer — the maximum total rating of the character that Petya can get using k or less improvement units.
standard output
PASSED
5d3c4b53060c0246d6f8da12fdbcd4bd
train_000.jsonl
1443430800
Petya loves computer games. Finally a game that he's been waiting for so long came out!The main character of this game has n different skills, each of which is characterized by an integer ai from 0 to 100. The higher the number ai is, the higher is the i-th skill of the character. The total rating of the character is c...
256 megabytes
import java.io.IOException; import java.io.InputStream; public class C581 { public static void main(String[] args) throws IOException { InputReader reader = new InputReader(System.in); int N = reader.readInt(); int K = reader.readInt(); int rating = 0; int[] upgrades = ne...
Java
["2 4\n7 9", "3 8\n17 15 19", "2 2\n99 100"]
1 second
["2", "5", "20"]
NoteIn the first test case the optimal strategy is as follows. Petya has to improve the first skill to 10 by spending 3 improvement units, and the second skill to 10, by spending one improvement unit. Thus, Petya spends all his improvement units and the total rating of the character becomes equal to lfloor frac{100}{1...
Java 7
standard input
[ "implementation", "sortings", "math" ]
b4341e1b0ec0b7341fdbe6edfe81a0d4
The first line of the input contains two positive integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 107) — the number of skills of the character and the number of units of improvements at Petya's disposal. The second line of the input contains a sequence of n integers ai (0 ≤ ai ≤ 100), where ai characterizes the level of the i-t...
1,400
The first line of the output should contain a single non-negative integer — the maximum total rating of the character that Petya can get using k or less improvement units.
standard output
PASSED
587567756277e6cbbb2a76d8d9c983dc
train_000.jsonl
1443430800
Petya loves computer games. Finally a game that he's been waiting for so long came out!The main character of this game has n different skills, each of which is characterized by an integer ai from 0 to 100. The higher the number ai is, the higher is the i-th skill of the character. The total rating of the character is c...
256 megabytes
import java.io.IOException; import java.io.InputStreamReader; import java.util.InputMismatchException; import java.util.ArrayList; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; import java.util.Collections; import ja...
Java
["2 4\n7 9", "3 8\n17 15 19", "2 2\n99 100"]
1 second
["2", "5", "20"]
NoteIn the first test case the optimal strategy is as follows. Petya has to improve the first skill to 10 by spending 3 improvement units, and the second skill to 10, by spending one improvement unit. Thus, Petya spends all his improvement units and the total rating of the character becomes equal to lfloor frac{100}{1...
Java 7
standard input
[ "implementation", "sortings", "math" ]
b4341e1b0ec0b7341fdbe6edfe81a0d4
The first line of the input contains two positive integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 107) — the number of skills of the character and the number of units of improvements at Petya's disposal. The second line of the input contains a sequence of n integers ai (0 ≤ ai ≤ 100), where ai characterizes the level of the i-t...
1,400
The first line of the output should contain a single non-negative integer — the maximum total rating of the character that Petya can get using k or less improvement units.
standard output
PASSED
42612c58394786836549e9e2fa605518
train_000.jsonl
1443430800
Petya loves computer games. Finally a game that he's been waiting for so long came out!The main character of this game has n different skills, each of which is characterized by an integer ai from 0 to 100. The higher the number ai is, the higher is the i-th skill of the character. The total rating of the character is c...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class Main { private static class Elem implements Comparable<Elem> { int number; int cong; public Elem(int number, int cong) { this.number = number; this.cong = cong; } @Over...
Java
["2 4\n7 9", "3 8\n17 15 19", "2 2\n99 100"]
1 second
["2", "5", "20"]
NoteIn the first test case the optimal strategy is as follows. Petya has to improve the first skill to 10 by spending 3 improvement units, and the second skill to 10, by spending one improvement unit. Thus, Petya spends all his improvement units and the total rating of the character becomes equal to lfloor frac{100}{1...
Java 7
standard input
[ "implementation", "sortings", "math" ]
b4341e1b0ec0b7341fdbe6edfe81a0d4
The first line of the input contains two positive integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 107) — the number of skills of the character and the number of units of improvements at Petya's disposal. The second line of the input contains a sequence of n integers ai (0 ≤ ai ≤ 100), where ai characterizes the level of the i-t...
1,400
The first line of the output should contain a single non-negative integer — the maximum total rating of the character that Petya can get using k or less improvement units.
standard output
PASSED
0260270abdc937e400b9ebb8ea37abd7
train_000.jsonl
1443430800
Petya loves computer games. Finally a game that he's been waiting for so long came out!The main character of this game has n different skills, each of which is characterized by an integer ai from 0 to 100. The higher the number ai is, the higher is the i-th skill of the character. The total rating of the character is c...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Collections; import java.util.LinkedList; import java.util.StringTokenizer; public class R322C { public static void main(String[] args) { I...
Java
["2 4\n7 9", "3 8\n17 15 19", "2 2\n99 100"]
1 second
["2", "5", "20"]
NoteIn the first test case the optimal strategy is as follows. Petya has to improve the first skill to 10 by spending 3 improvement units, and the second skill to 10, by spending one improvement unit. Thus, Petya spends all his improvement units and the total rating of the character becomes equal to lfloor frac{100}{1...
Java 7
standard input
[ "implementation", "sortings", "math" ]
b4341e1b0ec0b7341fdbe6edfe81a0d4
The first line of the input contains two positive integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 107) — the number of skills of the character and the number of units of improvements at Petya's disposal. The second line of the input contains a sequence of n integers ai (0 ≤ ai ≤ 100), where ai characterizes the level of the i-t...
1,400
The first line of the output should contain a single non-negative integer — the maximum total rating of the character that Petya can get using k or less improvement units.
standard output
PASSED
c9a684c4bbe82f5208e539e12f671054
train_000.jsonl
1443430800
Petya loves computer games. Finally a game that he's been waiting for so long came out!The main character of this game has n different skills, each of which is characterized by an integer ai from 0 to 100. The higher the number ai is, the higher is the i-th skill of the character. The total rating of the character is c...
256 megabytes
import java.io.*; import java.util.*; public final class developing_skills { static FastScanner sc=new FastScanner(new BufferedReader(new InputStreamReader(System.in))); static PrintWriter out=new PrintWriter(System.out); @SuppressWarnings("unchecked") public static void main(String args[]) throws Exc...
Java
["2 4\n7 9", "3 8\n17 15 19", "2 2\n99 100"]
1 second
["2", "5", "20"]
NoteIn the first test case the optimal strategy is as follows. Petya has to improve the first skill to 10 by spending 3 improvement units, and the second skill to 10, by spending one improvement unit. Thus, Petya spends all his improvement units and the total rating of the character becomes equal to lfloor frac{100}{1...
Java 7
standard input
[ "implementation", "sortings", "math" ]
b4341e1b0ec0b7341fdbe6edfe81a0d4
The first line of the input contains two positive integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 107) — the number of skills of the character and the number of units of improvements at Petya's disposal. The second line of the input contains a sequence of n integers ai (0 ≤ ai ≤ 100), where ai characterizes the level of the i-t...
1,400
The first line of the output should contain a single non-negative integer — the maximum total rating of the character that Petya can get using k or less improvement units.
standard output
PASSED
6b05bf51d8e1e1eb25ed2f65cf69d41c
train_000.jsonl
1443430800
Petya loves computer games. Finally a game that he's been waiting for so long came out!The main character of this game has n different skills, each of which is characterized by an integer ai from 0 to 100. The higher the number ai is, the higher is the i-th skill of the character. The total rating of the character is c...
256 megabytes
import java.util.*; public class fence { //static {System.out.println("hello"); } public static void main(String args[]) { Scanner scn=new Scanner(System.in); int n=scn.nextInt(); int k=scn.nextInt(); num ar[]=new num[n]; int a[]=new int[n]; for(int i=0;i<n;i++) { a[i]=scn...
Java
["2 4\n7 9", "3 8\n17 15 19", "2 2\n99 100"]
1 second
["2", "5", "20"]
NoteIn the first test case the optimal strategy is as follows. Petya has to improve the first skill to 10 by spending 3 improvement units, and the second skill to 10, by spending one improvement unit. Thus, Petya spends all his improvement units and the total rating of the character becomes equal to lfloor frac{100}{1...
Java 7
standard input
[ "implementation", "sortings", "math" ]
b4341e1b0ec0b7341fdbe6edfe81a0d4
The first line of the input contains two positive integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 107) — the number of skills of the character and the number of units of improvements at Petya's disposal. The second line of the input contains a sequence of n integers ai (0 ≤ ai ≤ 100), where ai characterizes the level of the i-t...
1,400
The first line of the output should contain a single non-negative integer — the maximum total rating of the character that Petya can get using k or less improvement units.
standard output
PASSED
04d1f7436cda9ace760bf571eff1285b
train_000.jsonl
1443430800
Petya loves computer games. Finally a game that he's been waiting for so long came out!The main character of this game has n different skills, each of which is characterized by an integer ai from 0 to 100. The higher the number ai is, the higher is the i-th skill of the character. The total rating of the character is c...
256 megabytes
import java.io.PrintWriter; import java.util.*; public class Solution { Comparator<Integer> myComparator = new Comparator<Integer>() { @Override public int compare(Integer a, Integer b) { if (a % 10 > b % 10) return -1; if (a % 10 < b % 10) r...
Java
["2 4\n7 9", "3 8\n17 15 19", "2 2\n99 100"]
1 second
["2", "5", "20"]
NoteIn the first test case the optimal strategy is as follows. Petya has to improve the first skill to 10 by spending 3 improvement units, and the second skill to 10, by spending one improvement unit. Thus, Petya spends all his improvement units and the total rating of the character becomes equal to lfloor frac{100}{1...
Java 7
standard input
[ "implementation", "sortings", "math" ]
b4341e1b0ec0b7341fdbe6edfe81a0d4
The first line of the input contains two positive integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 107) — the number of skills of the character and the number of units of improvements at Petya's disposal. The second line of the input contains a sequence of n integers ai (0 ≤ ai ≤ 100), where ai characterizes the level of the i-t...
1,400
The first line of the output should contain a single non-negative integer — the maximum total rating of the character that Petya can get using k or less improvement units.
standard output