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
bb6315f489403d5f139506e87eb1dcf0
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.File; import java.io.PrintStream; import java.util.Scanner; public class B { public static void main(String[] args) { try { //* File in = new File("input.txt"); File out = new File("output.txt"); PrintStream writer = new PrintStream(out); ...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 6
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
0d1882705982a6c6886a9ff4d636e522
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; public class Main implements Runnable { private void solve() throws IOException { int n = nextInt(), k = nextInt() - 1; int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = nextInt(); } while (a[k] == 0) { k++; k %= n; }...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 6
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
0e366cdb834f46ceabedd6b3cc3da2c9
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.BufferedWriter; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.Scanner; public class QuizLeague { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(new FileReader("input.txt")); BufferedWriter out...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 6
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
17407d52a434b4b7dac5c65041b92c7d
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.Write...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 6
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
72ce6203bb2b5ff6f57ba98129e90903
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
/* ********QUESTION DESCRIPTION************* * @author (codeKNIGHT) */ import java.util.*; import java.math.*; import java.io.*; public class saratov_b { public static void main(String args[])throws IOException { //Scanner in=new Scanner(System.in); PrintWriter out=new PrintWriter("output...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 6
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
cab4fbfa23a8d2fce3a1e3b6f9772a45
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; import static java.lang.Math.*; public class problemB implements Runnable { BufferedReader in; PrintWriter out; StringTokenizer st; public static void main(String[] args) throws Exception { new Thread(new problemB()).start(); } private String next() ...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 6
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
f2ea4eb9d8baaeefd81f3c71538164d9
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Scanner; public class P1 { /** * @param args * @throws Exception */ public static void main(String[] args) throws Exception { ...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 6
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
b2acccdbbe37a6d9c1bfc588d40cbedf
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileReader; import java.io.FileWriter; import java.io.PrintWriter; import java.util.StringTokenizer; /** * * @author Mohamed Ibrahim (MIM) */ public class QuizLeague { public static void main(String[] args) throws Exception { ...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 6
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
5fe3cb3537d4f1bfe3495ef96d141076
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.*; import java.util.*; public class B { public static void main(String[] args) throws Exception { Scanner s = new Scanner(new File("input.txt")); PrintWriter pw = new PrintWriter(new File("output.txt")); int n = s.nextInt(), k = s.nextInt() - 1; int[] a = new int[n]; for (int i = 0; i < n; ++...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 6
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
48c8464a8be2efae96269fc474672a18
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.Arrays; import java.util.Scanner; public class B_Schools { public static void main(String[] args) throws IOException { FileReader f = new FileReader("input.txt"); FileWriter fr = new FileWriter("outp...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 6
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
d0125d0a2402c1929a5be1bfe7fd45ac
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.util.Locale; import java.util.StringTokenizer; public class Main implements Runnable { void solve() throws IOException { int n = nextInt(); int k = nextInt() - 1; boolean[] a = new bool...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 6
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
7e9d0cc5c0c156628c13c4c1f1fa3d1a
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Locale; import java.util.StringTokenizer; public class Main { static BufferedReader in; static PrintWriter out; public static void main(String args[]) throws IOException { //in =...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 6
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
1ac55fd4dd796a478b9349d92bb292da
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.util.*; import java.io.*; public class cf120b { public static void main(String[] args) throws Exception { Scanner in = new Scanner(new File("input.txt")); PrintWriter out = new PrintWriter(new File("output.txt")); int n = in.nextInt(); int k = in.nextInt()-1; int[] v = new int[n]; for(int i=0;...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 6
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
0f4f6f93bc9a67801579184cb5ed3d3a
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.*; import java.util.*; public class Main { FastScanner in = new FastScanner(System.in); PrintWriter out = new PrintWriter(System.out); static FileReader reader; static FileWriter writer; public static void main(String[] args) throws IOException { reader = new FileR...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 6
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
c7867a7302dcb066554142a5980be883
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.*; import java.util.*; public class Main { FastScanner in = new FastScanner(System.in); PrintWriter out = new PrintWriter(System.out); static FileReader reader; static FileWriter writer; public static void main(String[] args) throws IOException { reader = new FileR...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 6
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
d350cfbac16c8a8ed3b2166179e1437b
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.util.*; import java.lang.*; import java.math.*; import java.io.*; import static java.lang.Math.*; import static java.util.Arrays.*; public class Main { static int INF=1<<28; // static int key=1; /*int x,y; Main(int x,int y){ this.x=x; this.y=y; }*/ //static int sum=0; public sta...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 6
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
46904087d65c37976b16b16524dde3cd
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.*; import java.util.*; public class Main { Scanner in; PrintWriter out; void solve() { int n = in.nextInt(); int k = in.nextInt() - 1; int[] a = new int[2 * n]; for (int i = 0; i < n; i++) { a[i] = in.nextInt(); a[i + n] = a[i]; ...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 6
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
5071f2c8f1808739b7a75f479a97edd4
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.IOException; import java.util.InputMismatchException; import java.io.FileOutputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.FileInputStream; import java.math.BigInteger; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * ...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 6
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
b357045428838b5dda5b49e69cb4e605
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class A implements Runnable { public void run() { long startTime = System.nanoTime(); int n = nextInt(); int t = nextInt(); boolean[] b = new boolean[n + 1]; for (int i = 0; i < n; i++) { b[i + 1]...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 6
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
2ce64de5e355a84178e9e293c1e4aeee
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; public class Main { /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 6
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
fc8f9426cc4ddd7e1687114090e6b543
train_002.jsonl
1318919400
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.*; import static java.util.Collections.*; public class Main{ public static void main(String[]args){ InputStream in = System.in; PrintWriter out = new PrintWriter(System.out); try{ ...
Java
["5 5\n0 1 0 1 0", "2 1\n1 1"]
1 second
["2", "1"]
null
Java 6
input.txt
[ "implementation" ]
1378b4c9ba8029d310f07a1027a8c7a6
The first line contains two positive integers n and k (1 ≤ n ≤ 1000 and 1 ≤ k ≤ n) — the numbers of sectors on the table and the number of the sector where the arrow is pointing. The second line contains n numbers: ai = 0 if the question from sector i has already been asked and ai = 1 if the question from sector i hasn...
1,100
Print the single number — the number of the sector containing the question the experts will be asked. It is guaranteed that the answer exists, that is that not all the questions have already been asked.
output.txt
PASSED
3d8c7d5ca285233ca6296bf4350d117d
train_002.jsonl
1409383800
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; import java.math.*; public class Main{ public static int mod=(int)Math.pow(10,9)+7; public static void main (String[] args) throws java.lang.Exception{ //BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); InputR...
Java
["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"]
3 seconds
["12\n2 2 3 2"]
null
Java 8
standard input
[ "implementation", "hashing", "greedy" ]
a55d6c4af876e9c88b43d088f2b81817
The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard.
1,900
On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number...
standard output
PASSED
5580f588b2baed8cd7c7ba9837f29b0f
train_002.jsonl
1409383800
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t...
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 javax.xml.stream.events.Characters; import sun.security.x509.IPAddressName; import static java....
Java
["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"]
3 seconds
["12\n2 2 3 2"]
null
Java 8
standard input
[ "implementation", "hashing", "greedy" ]
a55d6c4af876e9c88b43d088f2b81817
The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard.
1,900
On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number...
standard output
PASSED
99207a0de00835dad04b8c6ad42f00d2
train_002.jsonl
1409383800
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t...
256 megabytes
import java.io.*; import java.util.*; public class Abc { static int arr[][]; static long sum[][]; static int n; public static void main(String[] args) { FastReader sc = new FastReader(); n=sc.nextInt(); arr=new int[n][n];sum=new long[n][n]; long sec[]=new long[2*n],prim...
Java
["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"]
3 seconds
["12\n2 2 3 2"]
null
Java 8
standard input
[ "implementation", "hashing", "greedy" ]
a55d6c4af876e9c88b43d088f2b81817
The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard.
1,900
On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number...
standard output
PASSED
08032027b141935618c863edae4f2be3
train_002.jsonl
1409383800
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t...
256 megabytes
import java.io.*; import java.util.*; public class Abc { static int arr[][]; static long sum[][]; static int n; public static void main(String[] args) { FastReader sc = new FastReader(); n=sc.nextInt(); arr=new int[n][n];sum=new long[n][n]; long sec[]=new long[2*n],prim...
Java
["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"]
3 seconds
["12\n2 2 3 2"]
null
Java 8
standard input
[ "implementation", "hashing", "greedy" ]
a55d6c4af876e9c88b43d088f2b81817
The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard.
1,900
On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number...
standard output
PASSED
14a586d4b089c35ab6207eb99358f5ad
train_002.jsonl
1409383800
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; public class quedt { public static void main(String[] args) throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); ...
Java
["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"]
3 seconds
["12\n2 2 3 2"]
null
Java 8
standard input
[ "implementation", "hashing", "greedy" ]
a55d6c4af876e9c88b43d088f2b81817
The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard.
1,900
On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number...
standard output
PASSED
48b970fb9f7698a4c2e965ecbc7b7413
train_002.jsonl
1409383800
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Application { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.valueOf(reader.readLine(...
Java
["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"]
3 seconds
["12\n2 2 3 2"]
null
Java 8
standard input
[ "implementation", "hashing", "greedy" ]
a55d6c4af876e9c88b43d088f2b81817
The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard.
1,900
On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number...
standard output
PASSED
4527604e79cb1203b45d26883def1425
train_002.jsonl
1409383800
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t...
256 megabytes
// FOR YOU A THOUSAND TIMES OVER.// // Author :- Saurabh// //BIT MESRA, RANCHI// import java.io.*; import java.util.*; import static java.lang.Math.*; public class gargariAndBishops { static void Bolo_Jai_Mata_Di() { n=ni(); long ar[][]=new long[n+2][n+2]; tsc(); for(int i=1;i<...
Java
["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"]
3 seconds
["12\n2 2 3 2"]
null
Java 8
standard input
[ "implementation", "hashing", "greedy" ]
a55d6c4af876e9c88b43d088f2b81817
The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard.
1,900
On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number...
standard output
PASSED
966cb830fc6f9d3bd33697d408218826
train_002.jsonl
1409383800
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { static int n; static long[][] a; static int[] dx = {1,-1,1,-1}; static int...
Java
["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"]
3 seconds
["12\n2 2 3 2"]
null
Java 8
standard input
[ "implementation", "hashing", "greedy" ]
a55d6c4af876e9c88b43d088f2b81817
The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard.
1,900
On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number...
standard output
PASSED
fc8ad982bd2e893148e427e20113b37e
train_002.jsonl
1409383800
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t...
256 megabytes
import java.util.*; import java.io.*; public class Main{ static long res[]; static int ans[][]; public static void main(String args[]) throws IOException{ BufferedReader sc=new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw=new PrintWriter(System.out); int n=Integer...
Java
["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"]
3 seconds
["12\n2 2 3 2"]
null
Java 8
standard input
[ "implementation", "hashing", "greedy" ]
a55d6c4af876e9c88b43d088f2b81817
The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard.
1,900
On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number...
standard output
PASSED
4889c78e1a24ba6e413f2bebbfd4c5c6
train_002.jsonl
1409383800
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t...
256 megabytes
import java.awt.List; import java.io.BufferedReader; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigDecimal; import java.math.BigInteger; import java.math.RoundingMode; import java.util.*; public class W...
Java
["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"]
3 seconds
["12\n2 2 3 2"]
null
Java 8
standard input
[ "implementation", "hashing", "greedy" ]
a55d6c4af876e9c88b43d088f2b81817
The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard.
1,900
On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number...
standard output
PASSED
2a73d53108a8dd24d5f625fbf432dde7
train_002.jsonl
1409383800
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t...
256 megabytes
import java.io.*; public class C { static StreamTokenizer st; static int n; static int[][] a; public static void main(String[] args) throws IOException { st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in), 60 * 1024 * 1024)); read(); long[] mainDiago...
Java
["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"]
3 seconds
["12\n2 2 3 2"]
null
Java 8
standard input
[ "implementation", "hashing", "greedy" ]
a55d6c4af876e9c88b43d088f2b81817
The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard.
1,900
On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number...
standard output
PASSED
2b172327dece924f86c3ef536e6746e4
train_002.jsonl
1409383800
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t...
256 megabytes
import java.io.*; public class C { static StreamTokenizer st; static int n; static int[][] a; public static void main(String[] args) throws IOException { st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); read(); long[] mainDiagonal = mainDiagonal...
Java
["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"]
3 seconds
["12\n2 2 3 2"]
null
Java 8
standard input
[ "implementation", "hashing", "greedy" ]
a55d6c4af876e9c88b43d088f2b81817
The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard.
1,900
On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number...
standard output
PASSED
a7358a48e2e4abf67760a43d5dde6677
train_002.jsonl
1409383800
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main (String[] args) {new Main();} Main () { FastScanner fs = new FastScanner(); Scanner s = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = fs.nextInt(); long[][][] sum = new long[5][n][n]; for(...
Java
["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"]
3 seconds
["12\n2 2 3 2"]
null
Java 8
standard input
[ "implementation", "hashing", "greedy" ]
a55d6c4af876e9c88b43d088f2b81817
The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard.
1,900
On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number...
standard output
PASSED
9cde7610d545bbeb3f5e597277e9008a
train_002.jsonl
1409383800
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.HashMap; import java.util.InputMismatchException; import java.io.IOExcep...
Java
["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"]
3 seconds
["12\n2 2 3 2"]
null
Java 8
standard input
[ "implementation", "hashing", "greedy" ]
a55d6c4af876e9c88b43d088f2b81817
The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard.
1,900
On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number...
standard output
PASSED
a40931fc87a1014db769aa3c10d58ac8
train_002.jsonl
1409383800
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class C { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.rea...
Java
["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"]
3 seconds
["12\n2 2 3 2"]
null
Java 8
standard input
[ "implementation", "hashing", "greedy" ]
a55d6c4af876e9c88b43d088f2b81817
The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard.
1,900
On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number...
standard output
PASSED
7dd67b75007a2b825492e80c338a967f
train_002.jsonl
1409383800
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t...
256 megabytes
import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.ObjectInputStream.GetField; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.In...
Java
["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"]
3 seconds
["12\n2 2 3 2"]
null
Java 8
standard input
[ "implementation", "hashing", "greedy" ]
a55d6c4af876e9c88b43d088f2b81817
The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard.
1,900
On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number...
standard output
PASSED
6a6a9058132df98648adceadaf9dd22c
train_002.jsonl
1409383800
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import java.util.StringTokenizer; import java.io.PrintWriter; public class Ideone { static class FastReader { BufferedReader br; StringTokenizer st; public FastRe...
Java
["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"]
3 seconds
["12\n2 2 3 2"]
null
Java 8
standard input
[ "implementation", "hashing", "greedy" ]
a55d6c4af876e9c88b43d088f2b81817
The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard.
1,900
On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number...
standard output
PASSED
605679cd45efa4d77a1f8c990cddd498
train_002.jsonl
1409383800
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] agrs) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int a[][] = new int[n + 1][n + 1]; int x[] = new ...
Java
["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"]
3 seconds
["12\n2 2 3 2"]
null
Java 8
standard input
[ "implementation", "hashing", "greedy" ]
a55d6c4af876e9c88b43d088f2b81817
The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard.
1,900
On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number...
standard output
PASSED
8a027f63bde476e1b1ae35892f067047
train_002.jsonl
1409383800
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t...
256 megabytes
import java.util.*; import java.io.*; public class GargariBishops { private static long sum(int r, int c, int[][] grid) { long total = grid[r][c]; int tempR = r; int tempC = c; /* int[] arrayX = new int[] {1,1,-1,-1}; int[] arrayY = new int[] {1,-1,1,-1}; for ...
Java
["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"]
3 seconds
["12\n2 2 3 2"]
null
Java 8
standard input
[ "implementation", "hashing", "greedy" ]
a55d6c4af876e9c88b43d088f2b81817
The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard.
1,900
On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number...
standard output
PASSED
06e7d6fa3c5349cd6dfef61999d9719c
train_002.jsonl
1409383800
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t...
256 megabytes
import java.io.*; public class Solution { static StreamTokenizer in = new StreamTokenizer(new BufferedReader( new InputStreamReader(System.in))); static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); static int nextInt() throws IOException { in.nextToken(); ...
Java
["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"]
3 seconds
["12\n2 2 3 2"]
null
Java 8
standard input
[ "implementation", "hashing", "greedy" ]
a55d6c4af876e9c88b43d088f2b81817
The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard.
1,900
On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number...
standard output
PASSED
4526fbd2cc8085b1a4915bad6a7a0c68
train_002.jsonl
1409383800
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class CF463C { //***************************************** VARIABLE DECLERATION SECTION ********************************************************************; //static ArrayList<Integer> al; //static PriorityQueue<Integer> pq; ...
Java
["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"]
3 seconds
["12\n2 2 3 2"]
null
Java 8
standard input
[ "implementation", "hashing", "greedy" ]
a55d6c4af876e9c88b43d088f2b81817
The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard.
1,900
On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number...
standard output
PASSED
a5f608fad41d0bcb5633aea184850d87
train_002.jsonl
1409383800
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t...
256 megabytes
import java.util.*;import java.io.*;import java.math.*; public class Main { public static void process()throws IOException { int n=ni(); long[][]A=new long[n][n]; for(int i=0;i<n;i++) for(int j=0;j<n;j++) A[i][j]=nl(); int[][]fl=new int[n][n]; ...
Java
["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"]
3 seconds
["12\n2 2 3 2"]
null
Java 8
standard input
[ "implementation", "hashing", "greedy" ]
a55d6c4af876e9c88b43d088f2b81817
The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard.
1,900
On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number...
standard output
PASSED
39f606bd6a2d78cedea708ce0fce003c
train_002.jsonl
1409383800
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t...
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 C463 { public static BufferedReader in; public static PrintWriter out; public st...
Java
["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"]
3 seconds
["12\n2 2 3 2"]
null
Java 8
standard input
[ "implementation", "hashing", "greedy" ]
a55d6c4af876e9c88b43d088f2b81817
The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard.
1,900
On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number...
standard output
PASSED
d6f690c011c727120701cd39d05dd468
train_002.jsonl
1409383800
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t...
256 megabytes
import java.util.*; import java.io.*; public class codeforces { public static void main(String args []) { InputReader obj = new InputReader(System.in); int n = obj.nextInt(); int arr[][] = new int[n][n]; HashMap<Integer, Long> d1 = new HashMap<Integer, Long>(); HashMap<Integer, Long> d2 = new HashMap<I...
Java
["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"]
3 seconds
["12\n2 2 3 2"]
null
Java 8
standard input
[ "implementation", "hashing", "greedy" ]
a55d6c4af876e9c88b43d088f2b81817
The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard.
1,900
On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number...
standard output
PASSED
cb039cb49a5636af18b1b6b328413d2d
train_002.jsonl
1409383800
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class cf { public static void main(String args[])throws IOException { PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); Reader sc = new Reader(); int n = sc.nextI...
Java
["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"]
3 seconds
["12\n2 2 3 2"]
null
Java 8
standard input
[ "implementation", "hashing", "greedy" ]
a55d6c4af876e9c88b43d088f2b81817
The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard.
1,900
On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number...
standard output
PASSED
c8f58fa0ede3d55fd2dd69a4ae9c5fc3
train_002.jsonl
1409383800
Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius.He has a n × n chessboard. Each cell of the chessboard has a number written on it. Gargari wants to place two bishops on the chessboard in such a way that there is no cell that is attacked by both of t...
256 megabytes
/* Author: prakashn ProblemLink: Thanks to uwi for the code template */ 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 Task463C { InputStream is; PrintWrite...
Java
["4\n1 1 1 1\n2 1 1 0\n1 1 1 0\n1 0 0 1"]
3 seconds
["12\n2 2 3 2"]
null
Java 8
standard input
[ "implementation", "hashing", "greedy" ]
a55d6c4af876e9c88b43d088f2b81817
The first line contains a single integer n (2 ≤ n ≤ 2000). Each of the next n lines contains n integers aij (0 ≤ aij ≤ 109) — description of the chessboard.
1,900
On the first line print the maximal number of dollars Gargari will get. On the next line print four integers: x1, y1, x2, y2 (1 ≤ x1, y1, x2, y2 ≤ n), where xi is the number of the row where the i-th bishop should be placed, yi is the number of the column where the i-th bishop should be placed. Consider rows are number...
standard output
PASSED
6c6edbbe451eea1a578cbb7490aede5c
train_002.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner (System.in); int numOfLines = in.nextInt(); int length = numOfLines - 1; int [] result = new int [numOfLines]; while (numOfLines > 0) { int coder = in.nextInt(); int math = i...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
3b5913efeaf33b6a11127e8465bceed3
train_002.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
import java.util.*; public class Main { public static void main(String args[]) { Scanner in=new Scanner(System.in); int q=in.nextInt(); for(int i=0;i<q;i++) { int a=in.nextInt(); int b=in.nextInt(); int c=in.nextInt(); int min1=Math...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
c257041cf3cd6c186dbe5ce9842f8087
train_002.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
import java.util.*; public class C1221 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); for (int tt = scan.nextInt(), t = 1; t <= tt; ++t) { int a = scan.nextInt(); int b = scan.nextInt(); int c = scan.nextInt(); System.out.println(Math.min(Math.min(a, b), (a + b + c) /...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
d8c47bb9b76bd55bf9657c2f554db087
train_002.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
import java.io.*; import java.util.*; public class cp1 { static int find(int a, int b){ if(a >= 2 * b) return b; if(b >= 2 * a) return a; return (a + b) / 3; // if(a>=2*b) // return b; // else if(b>=2*a) // return a; // else if((a+b)%3==0) ...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
4b3468a1f0c92d2016406b593010c939
train_002.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
import java.util.*; import java.io.*; public class A { public static void main(String[] args) throws Exception { // FileInputStream inputStream = new FileInputStream("input.txt"); // FileOutputStream outputStream = new FileOutputStream("output.txt"); InputStream inputStream = System.in; ...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
58144dcbc6458ca4ebb1abc848371b89
train_002.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
import java.util.*; import java.io.*; public class A { public static void main(String[] args) throws Exception { // FileInputStream inputStream = new FileInputStream("input.txt"); // FileOutputStream outputStream = new FileOutputStream("output.txt"); InputStream inputStream = System.in; ...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
c18f75d70a9c4056fdcccf0dba66509b
train_002.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
//package Div3; import java.io.*; import java.util.StringTokenizer; import java.util.ArrayList; import java.util.HashSet; import java.util.LinkedList; import java.util.Queue; import java.util.HashMap; import java.util.TreeSet; import java.util.TreeMap; import java.util.Arrays; import java.util.Collections; public cla...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
8d48d33ae81f26ffebc8aa2fae0905c3
train_002.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
//package Jobeel; import java.util.*; import java.io.*; import java.lang.*; import java.math.*; import java.util.Map.*; public class codeforces { static int count =0; static boolean f=false; static int [] arr; static PrintWriter pw=new PrintWriter(System.out); static void bruteforce(int index,int mask...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
a5d34d384fcdeb57a4fbccdbaca29915
train_002.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class e { public static class FastReader { BufferedReader br; StringTokenizer st; //it reads the data about the specified point and divide the d...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
ee2ac967abef9f00564e3f6869ea8d93
train_002.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
import java.util.*; public class a { static int mod = (int) 1e9 + 7; static int Infinity=Integer.MAX_VALUE; static int negInfinity=Integer.MIN_VALUE; public static void main(String args[]) { Scanner d= new Scanner(System.in); int q,x,c,m,min,l,h,mid,z,st; q=d.nextInt(); ...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
3496916f1796b9595607ddc8e93f4d79
train_002.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solu...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
840e4e61c6f414d665192c89bc1f1455
train_002.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class CF1221C { public static void main(String[] args) { FastReader input = new FastReader(); int q = input.nextInt(); while(q > 0){ long a = inp...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
ed05cf6cf1872988904a1cbb881a7322
train_002.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class CF1221C { public static void main(String[] args) { FastReader input = new FastReader(); int q = input.nextInt(); while(q > 0){ long a = inp...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
1b9f6de87af0601c86fc5a56d1aec0e5
train_002.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
import java.io.PrintWriter; import java.util.Scanner; import java.util.TreeMap; public class Main { public static void main(String[] args) { Scanner in=new Scanner(System.in); PrintWriter out=new PrintWriter(System.out); int n=in.nextInt(); while(n>0){ int x=in.nextInt(); ...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
3c9af878e602e49e44b3a74af3a0e0da
train_002.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; public class CR73A { static FastReader sc = new FastReader(); static OutputStream outputstream = System.out; static PrintWr...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
f9f2e5ca6bc91996a3a55b49df8a8f0b
train_002.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
import java.util.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class a{ static int[] count,count1; static Node[] arr; static char[] ch,ch1; static long[] darr; static long[][] mat; static long x; ...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
b0bbc60733c44e5286b3a62c062c2dda
train_002.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
import java.util.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class a{ static int[] count,count1; static Node[] arr; static char[] ch,ch1; static long[] darr; static long[][] mat; static long x; ...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
89778207e271029742b3a8b7a32fec5b
train_002.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static Scanner scanner =new Scanner(System.in); public static void main (String [] args) { int q = scanner.nextInt(); for (int i = 0; i <q ; i++) { long c = scanner.nextInt(); long m = scanner.nextInt(); ...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
9597363dcef07f0edf90ed29ca6561b5
train_002.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.Writer; import java.util.Arrays; import java.util.InputMismatchException; import...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
84f1448786f8dc8e8184c8abdb301d99
train_002.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class TaskC { private static final String filenameIn = "input.txt"; private static final String filenameOut = "output.txt"; // THIS IS SOLUTION...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
3580c8afc7340c31a870c8a92a26a0eb
train_002.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class PerfectTeam { private static int min(int a, int b, int c) { if(a <= b) { if (a <= c) return 1; else return 3;...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
f24b7692411491a144c9535c586990e8
train_002.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); List<int[]> params = new ArrayList<>(); for (int i = 0; i < n; i++) { ...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
5fe50be2f4c1a229cbe7868f89af544d
train_002.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
import java.io.*; import java.util.Scanner; public class Main { public static void main(String args[]) throws IOException { StreamTokenizer sc=new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); sc.nextToken(); int T=(int) sc.nval; while(T--!=0) { int a,b,c; sc.nextToken(); ...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
1d4daf384f28ab4e06f8e7d3f08568d0
train_002.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
import java.util.*; import java.io.* ; /* NOTES: -more than 10 digits (10^10), use long -prefix sum of 1's and -1's to control flow of highlighting a region -log(a)/log(b) = log base b of a -create a position array if trying to see if elements show up next to each other sequentially i.e. elements 1,2,3 are within 3 sp...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
dfbd3c243d8cc58f4b3af45c6cc5f6e1
train_002.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
import java.util.Scanner; public class PerfectTeam { public static void main(String[] args) { Scanner in = new Scanner(System.in); long q = in.nextLong(); for (int i = 1; i <= q; i++) { long c = in.nextLong(), m = in.nextLong(), x = in.nextLong(); long s = (c + ...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
db9e6b6d2005612a4d78aec96917ea98
train_002.jsonl
1359732600
Emuskald is a well-known illusionist. One of his trademark tricks involves a set of magical boxes. The essence of the trick is in packing the boxes inside other boxes.From the top view each magical box looks like a square with side length equal to 2k (k is an integer, k ≥ 0) units. A magical box v can be put inside a m...
256 megabytes
import java.io.PrintWriter; import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Main { public static void main(String[] s) { Scanner in = new Scanner(System.in); PrintWriter writer = new PrintWriter(System.out); TaskC solution = new TaskC(); solution.solve(in,writer); w...
Java
["2\n0 3\n1 5", "1\n0 4", "2\n1 10\n2 2"]
2 seconds
["3", "1", "3"]
NotePicture explanation. If we have 3 boxes with side length 2 and 5 boxes with side length 1, then we can put all these boxes inside a box with side length 4, for example, as shown in the picture.In the second test case, we can put all four small boxes into a box with side length 2.
Java 6
standard input
[ "greedy", "math", "implementation", "sortings", "binary search" ]
15aac7420160f156d5b73059af1fae3b
The first line of input contains an integer n (1 ≤ n ≤ 105), the number of different sizes of boxes Emuskald has. Each of following n lines contains two integers ki and ai (0 ≤ ki ≤ 109, 1 ≤ ai ≤ 109), which means that Emuskald has ai boxes with side length 2ki. It is guaranteed that all of ki are distinct.
1,600
Output a single integer p, such that the smallest magical box that can contain all of Emuskald’s boxes has side length 2p.
standard output
PASSED
44364284b8e4e812db7f3565a8d4ee8e
train_002.jsonl
1359732600
Emuskald is a well-known illusionist. One of his trademark tricks involves a set of magical boxes. The essence of the trick is in packing the boxes inside other boxes.From the top view each magical box looks like a square with side length equal to 2k (k is an integer, k ≥ 0) units. A magical box v can be put inside a m...
256 megabytes
import java.io.PrintWriter; import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Main { public static void main(String[] s) { Scanner in = new Scanner(System.in); PrintWriter writer = new PrintWriter(System.out); TaskC solution = new TaskC(); solution.solve(in,writer); w...
Java
["2\n0 3\n1 5", "1\n0 4", "2\n1 10\n2 2"]
2 seconds
["3", "1", "3"]
NotePicture explanation. If we have 3 boxes with side length 2 and 5 boxes with side length 1, then we can put all these boxes inside a box with side length 4, for example, as shown in the picture.In the second test case, we can put all four small boxes into a box with side length 2.
Java 6
standard input
[ "greedy", "math", "implementation", "sortings", "binary search" ]
15aac7420160f156d5b73059af1fae3b
The first line of input contains an integer n (1 ≤ n ≤ 105), the number of different sizes of boxes Emuskald has. Each of following n lines contains two integers ki and ai (0 ≤ ki ≤ 109, 1 ≤ ai ≤ 109), which means that Emuskald has ai boxes with side length 2ki. It is guaranteed that all of ki are distinct.
1,600
Output a single integer p, such that the smallest magical box that can contain all of Emuskald’s boxes has side length 2p.
standard output
PASSED
7d77ed5408098b136175fa79c7556cd6
train_002.jsonl
1359732600
Emuskald is a well-known illusionist. One of his trademark tricks involves a set of magical boxes. The essence of the trick is in packing the boxes inside other boxes.From the top view each magical box looks like a square with side length equal to 2k (k is an integer, k ≥ 0) units. A magical box v can be put inside a m...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Iterator; import static java.lang.Integer.*; import static java.lang.System.out; import static java.lang.Math.*; public class...
Java
["2\n0 3\n1 5", "1\n0 4", "2\n1 10\n2 2"]
2 seconds
["3", "1", "3"]
NotePicture explanation. If we have 3 boxes with side length 2 and 5 boxes with side length 1, then we can put all these boxes inside a box with side length 4, for example, as shown in the picture.In the second test case, we can put all four small boxes into a box with side length 2.
Java 6
standard input
[ "greedy", "math", "implementation", "sortings", "binary search" ]
15aac7420160f156d5b73059af1fae3b
The first line of input contains an integer n (1 ≤ n ≤ 105), the number of different sizes of boxes Emuskald has. Each of following n lines contains two integers ki and ai (0 ≤ ki ≤ 109, 1 ≤ ai ≤ 109), which means that Emuskald has ai boxes with side length 2ki. It is guaranteed that all of ki are distinct.
1,600
Output a single integer p, such that the smallest magical box that can contain all of Emuskald’s boxes has side length 2p.
standard output
PASSED
6a1a40b3d933a30859424954ace598db
train_002.jsonl
1359732600
Emuskald is a well-known illusionist. One of his trademark tricks involves a set of magical boxes. The essence of the trick is in packing the boxes inside other boxes.From the top view each magical box looks like a square with side length equal to 2k (k is an integer, k ≥ 0) units. A magical box v can be put inside a m...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class C { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["2\n0 3\n1 5", "1\n0 4", "2\n1 10\n2 2"]
2 seconds
["3", "1", "3"]
NotePicture explanation. If we have 3 boxes with side length 2 and 5 boxes with side length 1, then we can put all these boxes inside a box with side length 4, for example, as shown in the picture.In the second test case, we can put all four small boxes into a box with side length 2.
Java 6
standard input
[ "greedy", "math", "implementation", "sortings", "binary search" ]
15aac7420160f156d5b73059af1fae3b
The first line of input contains an integer n (1 ≤ n ≤ 105), the number of different sizes of boxes Emuskald has. Each of following n lines contains two integers ki and ai (0 ≤ ki ≤ 109, 1 ≤ ai ≤ 109), which means that Emuskald has ai boxes with side length 2ki. It is guaranteed that all of ki are distinct.
1,600
Output a single integer p, such that the smallest magical box that can contain all of Emuskald’s boxes has side length 2p.
standard output
PASSED
ab0b417422c24671713fb1d52b22bfa4
train_002.jsonl
1359732600
Emuskald is a well-known illusionist. One of his trademark tricks involves a set of magical boxes. The essence of the trick is in packing the boxes inside other boxes.From the top view each magical box looks like a square with side length equal to 2k (k is an integer, k ≥ 0) units. A magical box v can be put inside a m...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class C { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["2\n0 3\n1 5", "1\n0 4", "2\n1 10\n2 2"]
2 seconds
["3", "1", "3"]
NotePicture explanation. If we have 3 boxes with side length 2 and 5 boxes with side length 1, then we can put all these boxes inside a box with side length 4, for example, as shown in the picture.In the second test case, we can put all four small boxes into a box with side length 2.
Java 6
standard input
[ "greedy", "math", "implementation", "sortings", "binary search" ]
15aac7420160f156d5b73059af1fae3b
The first line of input contains an integer n (1 ≤ n ≤ 105), the number of different sizes of boxes Emuskald has. Each of following n lines contains two integers ki and ai (0 ≤ ki ≤ 109, 1 ≤ ai ≤ 109), which means that Emuskald has ai boxes with side length 2ki. It is guaranteed that all of ki are distinct.
1,600
Output a single integer p, such that the smallest magical box that can contain all of Emuskald’s boxes has side length 2p.
standard output
PASSED
b2ec05cb47670716a039b3768533c6a7
train_002.jsonl
1543044900
Little girl Margarita is a big fan of competitive programming. She especially loves problems about arrays and queries on them.Recently, she was presented with an array $$$a$$$ of the size of $$$10^9$$$ elements that is filled as follows: $$$a_1 = -1$$$ $$$a_2 = 2$$$ $$$a_3 = -3$$$ $$$a_4 = 4$$$ $$$a_5 = -5$$$ An...
256 megabytes
import java.util.*; import java.io.*; /********************************************************* * * * **** *** ** ** ****** ** * * ** * * ** ** * ** * * *** ** * * ******* ******* ******...
Java
["5\n1 3\n2 5\n5 5\n4 4\n2 3"]
1 second
["-2\n-2\n-5\n4\n-1"]
NoteIn the first query, you need to find the sum of the elements of the array from position $$$1$$$ to position $$$3$$$. The sum is equal to $$$a_1 + a_2 + a_3 = -1 + 2 -3 = -2$$$.In the second query, you need to find the sum of the elements of the array from position $$$2$$$ to position $$$5$$$. The sum is equal to $$...
Java 8
standard input
[ "math" ]
7eae40835f6e9580b985d636d5730e2d
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^3$$$) — the number of the queries. Each of the next $$$q$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 10^9$$$) — the descriptions of the queries.
900
Print $$$q$$$ lines, each containing one number — the answer to the query.
standard output
PASSED
690bc530b50fd999f7dda898e99513fa
train_002.jsonl
1543044900
Little girl Margarita is a big fan of competitive programming. She especially loves problems about arrays and queries on them.Recently, she was presented with an array $$$a$$$ of the size of $$$10^9$$$ elements that is filled as follows: $$$a_1 = -1$$$ $$$a_2 = 2$$$ $$$a_3 = -3$$$ $$$a_4 = 4$$$ $$$a_5 = -5$$$ An...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Main { public static void main(String[] argv) throws Exception { FastReader in = new FastReader(System.i...
Java
["5\n1 3\n2 5\n5 5\n4 4\n2 3"]
1 second
["-2\n-2\n-5\n4\n-1"]
NoteIn the first query, you need to find the sum of the elements of the array from position $$$1$$$ to position $$$3$$$. The sum is equal to $$$a_1 + a_2 + a_3 = -1 + 2 -3 = -2$$$.In the second query, you need to find the sum of the elements of the array from position $$$2$$$ to position $$$5$$$. The sum is equal to $$...
Java 8
standard input
[ "math" ]
7eae40835f6e9580b985d636d5730e2d
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^3$$$) — the number of the queries. Each of the next $$$q$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 10^9$$$) — the descriptions of the queries.
900
Print $$$q$$$ lines, each containing one number — the answer to the query.
standard output
PASSED
c799d4f15b490992a6a756e920d1b122
train_002.jsonl
1543044900
Little girl Margarita is a big fan of competitive programming. She especially loves problems about arrays and queries on them.Recently, she was presented with an array $$$a$$$ of the size of $$$10^9$$$ elements that is filled as follows: $$$a_1 = -1$$$ $$$a_2 = 2$$$ $$$a_3 = -3$$$ $$$a_4 = 4$$$ $$$a_5 = -5$$$ An...
256 megabytes
import java.io.IOException; import java.io.InputStreamReader; import java.io.BufferedReader; import java.util.*; import java.math.*; import java.io.*; import java.text.*; public class hacker { /*Fatt Gyi Bhai*/ //Dekh le mera code public static boolean[] sieve(long n) { boolean[] prime = ne...
Java
["5\n1 3\n2 5\n5 5\n4 4\n2 3"]
1 second
["-2\n-2\n-5\n4\n-1"]
NoteIn the first query, you need to find the sum of the elements of the array from position $$$1$$$ to position $$$3$$$. The sum is equal to $$$a_1 + a_2 + a_3 = -1 + 2 -3 = -2$$$.In the second query, you need to find the sum of the elements of the array from position $$$2$$$ to position $$$5$$$. The sum is equal to $$...
Java 8
standard input
[ "math" ]
7eae40835f6e9580b985d636d5730e2d
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^3$$$) — the number of the queries. Each of the next $$$q$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 10^9$$$) — the descriptions of the queries.
900
Print $$$q$$$ lines, each containing one number — the answer to the query.
standard output
PASSED
5b4f82a2352078abdae9e64bb77ac0f0
train_002.jsonl
1543044900
Little girl Margarita is a big fan of competitive programming. She especially loves problems about arrays and queries on them.Recently, she was presented with an array $$$a$$$ of the size of $$$10^9$$$ elements that is filled as follows: $$$a_1 = -1$$$ $$$a_2 = 2$$$ $$$a_3 = -3$$$ $$$a_4 = 4$$$ $$$a_5 = -5$$$ An...
256 megabytes
import java.io.ByteArrayInputStream; import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); // Scanner sc = testdata(); int n = sc.nextInt(); for (int i = 0; i < n; i++) { System.out.println(sum(sc....
Java
["5\n1 3\n2 5\n5 5\n4 4\n2 3"]
1 second
["-2\n-2\n-5\n4\n-1"]
NoteIn the first query, you need to find the sum of the elements of the array from position $$$1$$$ to position $$$3$$$. The sum is equal to $$$a_1 + a_2 + a_3 = -1 + 2 -3 = -2$$$.In the second query, you need to find the sum of the elements of the array from position $$$2$$$ to position $$$5$$$. The sum is equal to $$...
Java 8
standard input
[ "math" ]
7eae40835f6e9580b985d636d5730e2d
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^3$$$) — the number of the queries. Each of the next $$$q$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 10^9$$$) — the descriptions of the queries.
900
Print $$$q$$$ lines, each containing one number — the answer to the query.
standard output
PASSED
3d06d90236b861602ee66b74fa27e315
train_002.jsonl
1543044900
Little girl Margarita is a big fan of competitive programming. She especially loves problems about arrays and queries on them.Recently, she was presented with an array $$$a$$$ of the size of $$$10^9$$$ elements that is filled as follows: $$$a_1 = -1$$$ $$$a_2 = 2$$$ $$$a_3 = -3$$$ $$$a_4 = 4$$$ $$$a_5 = -5$$$ An...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; // author @mdazmat9 public class CodeForces_CA { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n=sc.nextInt(); for(int i...
Java
["5\n1 3\n2 5\n5 5\n4 4\n2 3"]
1 second
["-2\n-2\n-5\n4\n-1"]
NoteIn the first query, you need to find the sum of the elements of the array from position $$$1$$$ to position $$$3$$$. The sum is equal to $$$a_1 + a_2 + a_3 = -1 + 2 -3 = -2$$$.In the second query, you need to find the sum of the elements of the array from position $$$2$$$ to position $$$5$$$. The sum is equal to $$...
Java 8
standard input
[ "math" ]
7eae40835f6e9580b985d636d5730e2d
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^3$$$) — the number of the queries. Each of the next $$$q$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 10^9$$$) — the descriptions of the queries.
900
Print $$$q$$$ lines, each containing one number — the answer to the query.
standard output
PASSED
99797f36d4dcb841d97bda04ac3856fc
train_002.jsonl
1543044900
Little girl Margarita is a big fan of competitive programming. She especially loves problems about arrays and queries on them.Recently, she was presented with an array $$$a$$$ of the size of $$$10^9$$$ elements that is filled as follows: $$$a_1 = -1$$$ $$$a_2 = 2$$$ $$$a_3 = -3$$$ $$$a_4 = 4$$$ $$$a_5 = -5$$$ An...
256 megabytes
import java.util.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class a{ static int[] count,count1,count2; static long[] arr; static char[] ch,ch1; static long[] darr,farr; static Character[][] mat,mat1;...
Java
["5\n1 3\n2 5\n5 5\n4 4\n2 3"]
1 second
["-2\n-2\n-5\n4\n-1"]
NoteIn the first query, you need to find the sum of the elements of the array from position $$$1$$$ to position $$$3$$$. The sum is equal to $$$a_1 + a_2 + a_3 = -1 + 2 -3 = -2$$$.In the second query, you need to find the sum of the elements of the array from position $$$2$$$ to position $$$5$$$. The sum is equal to $$...
Java 8
standard input
[ "math" ]
7eae40835f6e9580b985d636d5730e2d
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^3$$$) — the number of the queries. Each of the next $$$q$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 10^9$$$) — the descriptions of the queries.
900
Print $$$q$$$ lines, each containing one number — the answer to the query.
standard output
PASSED
fdd3e8fe2dada9624e75711f684f8d71
train_002.jsonl
1543044900
Little girl Margarita is a big fan of competitive programming. She especially loves problems about arrays and queries on them.Recently, she was presented with an array $$$a$$$ of the size of $$$10^9$$$ elements that is filled as follows: $$$a_1 = -1$$$ $$$a_2 = 2$$$ $$$a_3 = -3$$$ $$$a_4 = 4$$$ $$$a_5 = -5$$$ An...
256 megabytes
import java.util.Scanner; public class B { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int q = sc.nextInt(); for (int i = 1; i <= q; i++) { int l = sc.nextInt(); int r = sc.nextInt(); int ans = 0; if (l % 2 =...
Java
["5\n1 3\n2 5\n5 5\n4 4\n2 3"]
1 second
["-2\n-2\n-5\n4\n-1"]
NoteIn the first query, you need to find the sum of the elements of the array from position $$$1$$$ to position $$$3$$$. The sum is equal to $$$a_1 + a_2 + a_3 = -1 + 2 -3 = -2$$$.In the second query, you need to find the sum of the elements of the array from position $$$2$$$ to position $$$5$$$. The sum is equal to $$...
Java 8
standard input
[ "math" ]
7eae40835f6e9580b985d636d5730e2d
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^3$$$) — the number of the queries. Each of the next $$$q$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 10^9$$$) — the descriptions of the queries.
900
Print $$$q$$$ lines, each containing one number — the answer to the query.
standard output
PASSED
67db795efdf9881bcd52780e5a28a8ef
train_002.jsonl
1543044900
Little girl Margarita is a big fan of competitive programming. She especially loves problems about arrays and queries on them.Recently, she was presented with an array $$$a$$$ of the size of $$$10^9$$$ elements that is filled as follows: $$$a_1 = -1$$$ $$$a_2 = 2$$$ $$$a_3 = -3$$$ $$$a_4 = 4$$$ $$$a_5 = -5$$$ An...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; public class Question { public static void main(String[] args) throws IOException { Reader.init(...
Java
["5\n1 3\n2 5\n5 5\n4 4\n2 3"]
1 second
["-2\n-2\n-5\n4\n-1"]
NoteIn the first query, you need to find the sum of the elements of the array from position $$$1$$$ to position $$$3$$$. The sum is equal to $$$a_1 + a_2 + a_3 = -1 + 2 -3 = -2$$$.In the second query, you need to find the sum of the elements of the array from position $$$2$$$ to position $$$5$$$. The sum is equal to $$...
Java 8
standard input
[ "math" ]
7eae40835f6e9580b985d636d5730e2d
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^3$$$) — the number of the queries. Each of the next $$$q$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 10^9$$$) — the descriptions of the queries.
900
Print $$$q$$$ lines, each containing one number — the answer to the query.
standard output
PASSED
3f642be2bfb7ff1ded526064037a7a58
train_002.jsonl
1543044900
Little girl Margarita is a big fan of competitive programming. She especially loves problems about arrays and queries on them.Recently, she was presented with an array $$$a$$$ of the size of $$$10^9$$$ elements that is filled as follows: $$$a_1 = -1$$$ $$$a_2 = 2$$$ $$$a_3 = -3$$$ $$$a_4 = 4$$$ $$$a_5 = -5$$$ An...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner s=new Scanner(System.in); int n = s.nextInt(); for(int i=0;i<n;i++) { long a=s.nextLong(); long b=s.nextLong(); long p=(b*(b+1))/2-((a-1)*(a))/2; a=a/2+a%2; b=b/2; long q=4*((b*...
Java
["5\n1 3\n2 5\n5 5\n4 4\n2 3"]
1 second
["-2\n-2\n-5\n4\n-1"]
NoteIn the first query, you need to find the sum of the elements of the array from position $$$1$$$ to position $$$3$$$. The sum is equal to $$$a_1 + a_2 + a_3 = -1 + 2 -3 = -2$$$.In the second query, you need to find the sum of the elements of the array from position $$$2$$$ to position $$$5$$$. The sum is equal to $$...
Java 8
standard input
[ "math" ]
7eae40835f6e9580b985d636d5730e2d
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^3$$$) — the number of the queries. Each of the next $$$q$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 10^9$$$) — the descriptions of the queries.
900
Print $$$q$$$ lines, each containing one number — the answer to the query.
standard output
PASSED
96b7bdbd34dae93dc29d2ca9c9dfc3f1
train_002.jsonl
1543044900
Little girl Margarita is a big fan of competitive programming. She especially loves problems about arrays and queries on them.Recently, she was presented with an array $$$a$$$ of the size of $$$10^9$$$ elements that is filled as follows: $$$a_1 = -1$$$ $$$a_2 = 2$$$ $$$a_3 = -3$$$ $$$a_4 = 4$$$ $$$a_5 = -5$$$ An...
256 megabytes
/* || || ========= ||====== || . >> ** \\ // || || || (( || || . >> ** ** \\ // || || || (( || || . >> ** ** \\ // ||=======|| || (( ||===== || ...
Java
["5\n1 3\n2 5\n5 5\n4 4\n2 3"]
1 second
["-2\n-2\n-5\n4\n-1"]
NoteIn the first query, you need to find the sum of the elements of the array from position $$$1$$$ to position $$$3$$$. The sum is equal to $$$a_1 + a_2 + a_3 = -1 + 2 -3 = -2$$$.In the second query, you need to find the sum of the elements of the array from position $$$2$$$ to position $$$5$$$. The sum is equal to $$...
Java 8
standard input
[ "math" ]
7eae40835f6e9580b985d636d5730e2d
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^3$$$) — the number of the queries. Each of the next $$$q$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 10^9$$$) — the descriptions of the queries.
900
Print $$$q$$$ lines, each containing one number — the answer to the query.
standard output
PASSED
e2fa91f8d976cbcb072aa2324be20714
train_002.jsonl
1543044900
Little girl Margarita is a big fan of competitive programming. She especially loves problems about arrays and queries on them.Recently, she was presented with an array $$$a$$$ of the size of $$$10^9$$$ elements that is filled as follows: $$$a_1 = -1$$$ $$$a_2 = 2$$$ $$$a_3 = -3$$$ $$$a_4 = 4$$$ $$$a_5 = -5$$$ An...
256 megabytes
import java.util.*; public class bestPresent { public static long cal(long a){ if(a%2==0){ return a/2; } else return -(a+1)/2; } public static void main(String[] args){ Scanner sc = new Scanner(System.in); int q = sc.nextInt(); for(int ...
Java
["5\n1 3\n2 5\n5 5\n4 4\n2 3"]
1 second
["-2\n-2\n-5\n4\n-1"]
NoteIn the first query, you need to find the sum of the elements of the array from position $$$1$$$ to position $$$3$$$. The sum is equal to $$$a_1 + a_2 + a_3 = -1 + 2 -3 = -2$$$.In the second query, you need to find the sum of the elements of the array from position $$$2$$$ to position $$$5$$$. The sum is equal to $$...
Java 8
standard input
[ "math" ]
7eae40835f6e9580b985d636d5730e2d
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^3$$$) — the number of the queries. Each of the next $$$q$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 10^9$$$) — the descriptions of the queries.
900
Print $$$q$$$ lines, each containing one number — the answer to the query.
standard output
PASSED
132c17eaf66fa36dfea5769114ad4bca
train_002.jsonl
1543044900
Little girl Margarita is a big fan of competitive programming. She especially loves problems about arrays and queries on them.Recently, she was presented with an array $$$a$$$ of the size of $$$10^9$$$ elements that is filled as follows: $$$a_1 = -1$$$ $$$a_2 = 2$$$ $$$a_3 = -3$$$ $$$a_4 = 4$$$ $$$a_5 = -5$$$ An...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class CFMargariteAndTheBestPresent { public static void main(String args[]) throws Exception { FastReader input = new FastReader(); int n = input.nextInt(); for(int i ...
Java
["5\n1 3\n2 5\n5 5\n4 4\n2 3"]
1 second
["-2\n-2\n-5\n4\n-1"]
NoteIn the first query, you need to find the sum of the elements of the array from position $$$1$$$ to position $$$3$$$. The sum is equal to $$$a_1 + a_2 + a_3 = -1 + 2 -3 = -2$$$.In the second query, you need to find the sum of the elements of the array from position $$$2$$$ to position $$$5$$$. The sum is equal to $$...
Java 8
standard input
[ "math" ]
7eae40835f6e9580b985d636d5730e2d
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^3$$$) — the number of the queries. Each of the next $$$q$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 10^9$$$) — the descriptions of the queries.
900
Print $$$q$$$ lines, each containing one number — the answer to the query.
standard output
PASSED
e04d034260c6bdeca6900a0aff58af2c
train_002.jsonl
1543044900
Little girl Margarita is a big fan of competitive programming. She especially loves problems about arrays and queries on them.Recently, she was presented with an array $$$a$$$ of the size of $$$10^9$$$ elements that is filled as follows: $$$a_1 = -1$$$ $$$a_2 = 2$$$ $$$a_3 = -3$$$ $$$a_4 = 4$$$ $$$a_5 = -5$$$ An...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int q = sc.nextInt(); int[] ans = new int[q]; int l; int r; for(int i = 0; i < q; i++){ l = sc.nextInt(); r = sc.nextInt(); ...
Java
["5\n1 3\n2 5\n5 5\n4 4\n2 3"]
1 second
["-2\n-2\n-5\n4\n-1"]
NoteIn the first query, you need to find the sum of the elements of the array from position $$$1$$$ to position $$$3$$$. The sum is equal to $$$a_1 + a_2 + a_3 = -1 + 2 -3 = -2$$$.In the second query, you need to find the sum of the elements of the array from position $$$2$$$ to position $$$5$$$. The sum is equal to $$...
Java 8
standard input
[ "math" ]
7eae40835f6e9580b985d636d5730e2d
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^3$$$) — the number of the queries. Each of the next $$$q$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 10^9$$$) — the descriptions of the queries.
900
Print $$$q$$$ lines, each containing one number — the answer to the query.
standard output
PASSED
eecaaaa1b25f590fad705ad48e84e5f1
train_002.jsonl
1543044900
Little girl Margarita is a big fan of competitive programming. She especially loves problems about arrays and queries on them.Recently, she was presented with an array $$$a$$$ of the size of $$$10^9$$$ elements that is filled as follows: $$$a_1 = -1$$$ $$$a_2 = 2$$$ $$$a_3 = -3$$$ $$$a_4 = 4$$$ $$$a_5 = -5$$$ An...
256 megabytes
import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintStream; import java.io.PrintWriter; import java.security.AccessControlException; import java.util.Arrays; import java.util.Collection; import java.util.Comparator; import java.util....
Java
["5\n1 3\n2 5\n5 5\n4 4\n2 3"]
1 second
["-2\n-2\n-5\n4\n-1"]
NoteIn the first query, you need to find the sum of the elements of the array from position $$$1$$$ to position $$$3$$$. The sum is equal to $$$a_1 + a_2 + a_3 = -1 + 2 -3 = -2$$$.In the second query, you need to find the sum of the elements of the array from position $$$2$$$ to position $$$5$$$. The sum is equal to $$...
Java 8
standard input
[ "math" ]
7eae40835f6e9580b985d636d5730e2d
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^3$$$) — the number of the queries. Each of the next $$$q$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 10^9$$$) — the descriptions of the queries.
900
Print $$$q$$$ lines, each containing one number — the answer to the query.
standard output
PASSED
a3ea55e14cecc204740a62dd4eb2361f
train_002.jsonl
1543044900
Little girl Margarita is a big fan of competitive programming. She especially loves problems about arrays and queries on them.Recently, she was presented with an array $$$a$$$ of the size of $$$10^9$$$ elements that is filled as follows: $$$a_1 = -1$$$ $$$a_2 = 2$$$ $$$a_3 = -3$$$ $$$a_4 = 4$$$ $$$a_5 = -5$$$ An...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int test = sc.nextInt(); while(test-- > 0) { long l = sc.nextLong(); long r = sc.nextLong(); long result = 0l; long s1s,...
Java
["5\n1 3\n2 5\n5 5\n4 4\n2 3"]
1 second
["-2\n-2\n-5\n4\n-1"]
NoteIn the first query, you need to find the sum of the elements of the array from position $$$1$$$ to position $$$3$$$. The sum is equal to $$$a_1 + a_2 + a_3 = -1 + 2 -3 = -2$$$.In the second query, you need to find the sum of the elements of the array from position $$$2$$$ to position $$$5$$$. The sum is equal to $$...
Java 8
standard input
[ "math" ]
7eae40835f6e9580b985d636d5730e2d
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^3$$$) — the number of the queries. Each of the next $$$q$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 10^9$$$) — the descriptions of the queries.
900
Print $$$q$$$ lines, each containing one number — the answer to the query.
standard output
PASSED
16776e91bc74b18a5b6a83dcd92a0d2a
train_002.jsonl
1543044900
Little girl Margarita is a big fan of competitive programming. She especially loves problems about arrays and queries on them.Recently, she was presented with an array $$$a$$$ of the size of $$$10^9$$$ elements that is filled as follows: $$$a_1 = -1$$$ $$$a_2 = 2$$$ $$$a_3 = -3$$$ $$$a_4 = 4$$$ $$$a_5 = -5$$$ An...
256 megabytes
import java.util.Scanner; public class Scratch { public static void main(String[] args) { Scanner scr=new Scanner(System.in); int q,l,r,sum; //q=new int(); //l=new int(); //r=new int(); //int sum=new int(); q=scr.nextInt...
Java
["5\n1 3\n2 5\n5 5\n4 4\n2 3"]
1 second
["-2\n-2\n-5\n4\n-1"]
NoteIn the first query, you need to find the sum of the elements of the array from position $$$1$$$ to position $$$3$$$. The sum is equal to $$$a_1 + a_2 + a_3 = -1 + 2 -3 = -2$$$.In the second query, you need to find the sum of the elements of the array from position $$$2$$$ to position $$$5$$$. The sum is equal to $$...
Java 8
standard input
[ "math" ]
7eae40835f6e9580b985d636d5730e2d
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^3$$$) — the number of the queries. Each of the next $$$q$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 10^9$$$) — the descriptions of the queries.
900
Print $$$q$$$ lines, each containing one number — the answer to the query.
standard output
PASSED
005c845e2c4a95919962c43adecd5be7
train_002.jsonl
1543044900
Little girl Margarita is a big fan of competitive programming. She especially loves problems about arrays and queries on them.Recently, she was presented with an array $$$a$$$ of the size of $$$10^9$$$ elements that is filled as follows: $$$a_1 = -1$$$ $$$a_2 = 2$$$ $$$a_3 = -3$$$ $$$a_4 = 4$$$ $$$a_5 = -5$$$ An...
256 megabytes
import java.util.Scanner; public class CF1080B{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int q = sc.nextInt(); StringBuilder sb = new StringBuilder(); for(int i = 0; i < q; i++){ int l = sc.nextInt(); int r = sc.nextInt(); ...
Java
["5\n1 3\n2 5\n5 5\n4 4\n2 3"]
1 second
["-2\n-2\n-5\n4\n-1"]
NoteIn the first query, you need to find the sum of the elements of the array from position $$$1$$$ to position $$$3$$$. The sum is equal to $$$a_1 + a_2 + a_3 = -1 + 2 -3 = -2$$$.In the second query, you need to find the sum of the elements of the array from position $$$2$$$ to position $$$5$$$. The sum is equal to $$...
Java 8
standard input
[ "math" ]
7eae40835f6e9580b985d636d5730e2d
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^3$$$) — the number of the queries. Each of the next $$$q$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 10^9$$$) — the descriptions of the queries.
900
Print $$$q$$$ lines, each containing one number — the answer to the query.
standard output
PASSED
9911c8869bbf67401b80a8f5af715fe4
train_002.jsonl
1543044900
Little girl Margarita is a big fan of competitive programming. She especially loves problems about arrays and queries on them.Recently, she was presented with an array $$$a$$$ of the size of $$$10^9$$$ elements that is filled as follows: $$$a_1 = -1$$$ $$$a_2 = 2$$$ $$$a_3 = -3$$$ $$$a_4 = 4$$$ $$$a_5 = -5$$$ An...
256 megabytes
//Where there is a will, there is a way! import java.util.*; import java.io.*; public class Solution { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); Stri...
Java
["5\n1 3\n2 5\n5 5\n4 4\n2 3"]
1 second
["-2\n-2\n-5\n4\n-1"]
NoteIn the first query, you need to find the sum of the elements of the array from position $$$1$$$ to position $$$3$$$. The sum is equal to $$$a_1 + a_2 + a_3 = -1 + 2 -3 = -2$$$.In the second query, you need to find the sum of the elements of the array from position $$$2$$$ to position $$$5$$$. The sum is equal to $$...
Java 8
standard input
[ "math" ]
7eae40835f6e9580b985d636d5730e2d
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^3$$$) — the number of the queries. Each of the next $$$q$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 10^9$$$) — the descriptions of the queries.
900
Print $$$q$$$ lines, each containing one number — the answer to the query.
standard output
PASSED
99863c2fb3434b707a6b9a1a0c355b29
train_002.jsonl
1543044900
Little girl Margarita is a big fan of competitive programming. She especially loves problems about arrays and queries on them.Recently, she was presented with an array $$$a$$$ of the size of $$$10^9$$$ elements that is filled as follows: $$$a_1 = -1$$$ $$$a_2 = 2$$$ $$$a_3 = -3$$$ $$$a_4 = 4$$$ $$$a_5 = -5$$$ An...
256 megabytes
//Where there is a will, there is a way! import java.util.*; import java.io.*; public class Solution { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); Stri...
Java
["5\n1 3\n2 5\n5 5\n4 4\n2 3"]
1 second
["-2\n-2\n-5\n4\n-1"]
NoteIn the first query, you need to find the sum of the elements of the array from position $$$1$$$ to position $$$3$$$. The sum is equal to $$$a_1 + a_2 + a_3 = -1 + 2 -3 = -2$$$.In the second query, you need to find the sum of the elements of the array from position $$$2$$$ to position $$$5$$$. The sum is equal to $$...
Java 8
standard input
[ "math" ]
7eae40835f6e9580b985d636d5730e2d
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^3$$$) — the number of the queries. Each of the next $$$q$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 10^9$$$) — the descriptions of the queries.
900
Print $$$q$$$ lines, each containing one number — the answer to the query.
standard output
PASSED
51a111ce7971e8d213800a95cb08d786
train_002.jsonl
1590327300
Polycarp wants to buy exactly $$$n$$$ shovels. The shop sells packages with shovels. The store has $$$k$$$ types of packages: the package of the $$$i$$$-th type consists of exactly $$$i$$$ shovels ($$$1 \le i \le k$$$). The store has an infinite number of packages of each type.Polycarp wants to choose one type of packa...
256 megabytes
//Written by Shagoto import java.util.*; import java.io.*; public class Main { // -------- Generating Prime Numbers Using Bit-wise sieve -------- // static HashSet<Integer> primes = new HashSet<Integer>(); // static BitSet bs = new BitSet(10000001); // static void sieve() // { // primes.add(2); // for(int i =...
Java
["5\n8 7\n8 1\n6 10\n999999733 999999732\n999999733 999999733"]
2 seconds
["2\n8\n1\n999999733\n1"]
NoteThe answer to the first test case was explained in the statement.In the second test case, there is only one way to buy $$$8$$$ shovels — $$$8$$$ packages of one shovel.In the third test case, you need to buy a $$$1$$$ package of $$$6$$$ shovels.
Java 8
standard input
[ "number theory", "math" ]
f00eb0452f5933103f1f77ef06473c6a
The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then, $$$t$$$ test cases follow, one per line. Each test case consists of two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$) — the number of shovels and the number of type...
1,300
Print $$$t$$$ answers to the test cases. Each answer is a positive integer — the minimum number of packages.
standard output
PASSED
f05b80256a0994ed7b9f9525e5a788d4
train_002.jsonl
1590327300
Polycarp wants to buy exactly $$$n$$$ shovels. The shop sells packages with shovels. The store has $$$k$$$ types of packages: the package of the $$$i$$$-th type consists of exactly $$$i$$$ shovels ($$$1 \le i \le k$$$). The store has an infinite number of packages of each type.Polycarp wants to choose one type of packa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.ArrayList; import java.util.Collections; import java.util.Map.Entry; import java.util.Scanner; import java.util.TreeMap; public class Gd { public static void main(Strin...
Java
["5\n8 7\n8 1\n6 10\n999999733 999999732\n999999733 999999733"]
2 seconds
["2\n8\n1\n999999733\n1"]
NoteThe answer to the first test case was explained in the statement.In the second test case, there is only one way to buy $$$8$$$ shovels — $$$8$$$ packages of one shovel.In the third test case, you need to buy a $$$1$$$ package of $$$6$$$ shovels.
Java 8
standard input
[ "number theory", "math" ]
f00eb0452f5933103f1f77ef06473c6a
The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then, $$$t$$$ test cases follow, one per line. Each test case consists of two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$) — the number of shovels and the number of type...
1,300
Print $$$t$$$ answers to the test cases. Each answer is a positive integer — the minimum number of packages.
standard output
PASSED
2451200c921b1e78da613db301471bda
train_002.jsonl
1590327300
Polycarp wants to buy exactly $$$n$$$ shovels. The shop sells packages with shovels. The store has $$$k$$$ types of packages: the package of the $$$i$$$-th type consists of exactly $$$i$$$ shovels ($$$1 \le i \le k$$$). The store has an infinite number of packages of each type.Polycarp wants to choose one type of packa...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ //package javaapplication1; import java.lang.Math; import java.util.*; import java.math.*; /** * * @author ujjwal abhishek */ publi...
Java
["5\n8 7\n8 1\n6 10\n999999733 999999732\n999999733 999999733"]
2 seconds
["2\n8\n1\n999999733\n1"]
NoteThe answer to the first test case was explained in the statement.In the second test case, there is only one way to buy $$$8$$$ shovels — $$$8$$$ packages of one shovel.In the third test case, you need to buy a $$$1$$$ package of $$$6$$$ shovels.
Java 8
standard input
[ "number theory", "math" ]
f00eb0452f5933103f1f77ef06473c6a
The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then, $$$t$$$ test cases follow, one per line. Each test case consists of two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$) — the number of shovels and the number of type...
1,300
Print $$$t$$$ answers to the test cases. Each answer is a positive integer — the minimum number of packages.
standard output
PASSED
bc9c73290e809b8bbb09496bbe7674f6
train_002.jsonl
1590327300
Polycarp wants to buy exactly $$$n$$$ shovels. The shop sells packages with shovels. The store has $$$k$$$ types of packages: the package of the $$$i$$$-th type consists of exactly $$$i$$$ shovels ($$$1 \le i \le k$$$). The store has an infinite number of packages of each type.Polycarp wants to choose one type of packa...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ //package javaapplication1; import java.lang.Math; import java.util.*; import java.math.*; /** * * @author ujjwal abhishek */ publi...
Java
["5\n8 7\n8 1\n6 10\n999999733 999999732\n999999733 999999733"]
2 seconds
["2\n8\n1\n999999733\n1"]
NoteThe answer to the first test case was explained in the statement.In the second test case, there is only one way to buy $$$8$$$ shovels — $$$8$$$ packages of one shovel.In the third test case, you need to buy a $$$1$$$ package of $$$6$$$ shovels.
Java 8
standard input
[ "number theory", "math" ]
f00eb0452f5933103f1f77ef06473c6a
The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then, $$$t$$$ test cases follow, one per line. Each test case consists of two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 10^9$$$) — the number of shovels and the number of type...
1,300
Print $$$t$$$ answers to the test cases. Each answer is a positive integer — the minimum number of packages.
standard output