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
3fe6eacb2d354e0f93d356244f23c3b8
train_000.jsonl
1396798800
Mashmokh's boss, Bimokh, didn't like Mashmokh. So he fired him. Mashmokh decided to go to university and participate in ACM instead of finding a new job. He wants to become a member of Bamokh's team. In order to join he was given some programming tasks and one week to solve them. Mashmokh is not a very experienced prog...
512 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main { static PrintWriter out; static Reader in; public static void main(String[] args) throws IOException { //out = new PrintWriter(new File("out.txt")); //PrintWriter out = new PrintWriter(System.out); //in = ...
Java
["2\n2 1 4 3\n4\n1 2 0 2", "1\n1 2\n3\n0 1 1"]
4 seconds
["0\n6\n6\n0", "0\n1\n0"]
NoteIf we reverse an array x[1], x[2], ..., x[n] it becomes new array y[1], y[2], ..., y[n], where y[i] = x[n - i + 1] for each i.The number of inversions of an array x[1], x[2], ..., x[n] is the number of pairs of indices i, j such that: i < j and x[i] > x[j].
Java 8
standard input
[ "combinatorics", "divide and conquer" ]
ea7f8bd397f80ba7d3add6f9609dcc4a
The first line of input contains a single integer n (0 ≤ n ≤ 20). The second line of input contains 2n space-separated integers a[1], a[2], ..., a[2n] (1 ≤ a[i] ≤ 109), the initial array. The third line of input contains a single integer m (1 ≤ m ≤ 106). The fourth line of input contains m space-separated integers q1...
2,100
Output m lines. In the i-th line print the answer (the number of inversions) for the i-th query.
standard output
PASSED
50b35eb06d6c850adf71dbb7086f22a3
train_000.jsonl
1396798800
Mashmokh's boss, Bimokh, didn't like Mashmokh. So he fired him. Mashmokh decided to go to university and participate in ACM instead of finding a new job. He wants to become a member of Bamokh's team. In order to join he was given some programming tasks and one week to solve them. Mashmokh is not a very experienced prog...
512 megabytes
import java.io.*; import java.util.*; public class C { MyScanner in; PrintWriter out; public static void main(String[] args) throws Exception { new C().run(); } public void run() throws Exception { in = new MyScanner(); out = new PrintWriter(System.out); solve();...
Java
["2\n2 1 4 3\n4\n1 2 0 2", "1\n1 2\n3\n0 1 1"]
4 seconds
["0\n6\n6\n0", "0\n1\n0"]
NoteIf we reverse an array x[1], x[2], ..., x[n] it becomes new array y[1], y[2], ..., y[n], where y[i] = x[n - i + 1] for each i.The number of inversions of an array x[1], x[2], ..., x[n] is the number of pairs of indices i, j such that: i < j and x[i] > x[j].
Java 8
standard input
[ "combinatorics", "divide and conquer" ]
ea7f8bd397f80ba7d3add6f9609dcc4a
The first line of input contains a single integer n (0 ≤ n ≤ 20). The second line of input contains 2n space-separated integers a[1], a[2], ..., a[2n] (1 ≤ a[i] ≤ 109), the initial array. The third line of input contains a single integer m (1 ≤ m ≤ 106). The fourth line of input contains m space-separated integers q1...
2,100
Output m lines. In the i-th line print the answer (the number of inversions) for the i-th query.
standard output
PASSED
b90bb7e388fe37f85f79d60b2e7f75a5
train_000.jsonl
1396798800
Mashmokh's boss, Bimokh, didn't like Mashmokh. So he fired him. Mashmokh decided to go to university and participate in ACM instead of finding a new job. He wants to become a member of Bamokh's team. In order to join he was given some programming tasks and one week to solve them. Mashmokh is not a very experienced prog...
512 megabytes
import java.util.*; import java.lang.*; import java.math.*; import java.io.*; import static java.lang.Math.*; /* spar5h */ public class cf1 implements Runnable{ static void addMap(HashMap<Integer, Integer> hm, int x) { if(hm.get(x) == null) hm.put(x, 1); else hm.put(x, hm.get(x) + 1); } static...
Java
["2\n2 1 4 3\n4\n1 2 0 2", "1\n1 2\n3\n0 1 1"]
4 seconds
["0\n6\n6\n0", "0\n1\n0"]
NoteIf we reverse an array x[1], x[2], ..., x[n] it becomes new array y[1], y[2], ..., y[n], where y[i] = x[n - i + 1] for each i.The number of inversions of an array x[1], x[2], ..., x[n] is the number of pairs of indices i, j such that: i &lt; j and x[i] &gt; x[j].
Java 8
standard input
[ "combinatorics", "divide and conquer" ]
ea7f8bd397f80ba7d3add6f9609dcc4a
The first line of input contains a single integer n (0 ≤ n ≤ 20). The second line of input contains 2n space-separated integers a[1], a[2], ..., a[2n] (1 ≤ a[i] ≤ 109), the initial array. The third line of input contains a single integer m (1 ≤ m ≤ 106). The fourth line of input contains m space-separated integers q1...
2,100
Output m lines. In the i-th line print the answer (the number of inversions) for the i-th query.
standard output
PASSED
b1131c5278d7059089c17232b2669742
train_000.jsonl
1396798800
Mashmokh's boss, Bimokh, didn't like Mashmokh. So he fired him. Mashmokh decided to go to university and participate in ACM instead of finding a new job. He wants to become a member of Bamokh's team. In order to join he was given some programming tasks and one week to solve them. Mashmokh is not a very experienced prog...
512 megabytes
import java.io.*; import java.util.*; public class C implements Runnable{ public static void main (String[] args) {new Thread(null, new C(), "_cf", 1 << 28).start();} long[] sums, sumr; public void run() { FastScanner fs = new FastScanner(); PrintWriter out = new PrintWriter(System.out); System.err.println...
Java
["2\n2 1 4 3\n4\n1 2 0 2", "1\n1 2\n3\n0 1 1"]
4 seconds
["0\n6\n6\n0", "0\n1\n0"]
NoteIf we reverse an array x[1], x[2], ..., x[n] it becomes new array y[1], y[2], ..., y[n], where y[i] = x[n - i + 1] for each i.The number of inversions of an array x[1], x[2], ..., x[n] is the number of pairs of indices i, j such that: i &lt; j and x[i] &gt; x[j].
Java 8
standard input
[ "combinatorics", "divide and conquer" ]
ea7f8bd397f80ba7d3add6f9609dcc4a
The first line of input contains a single integer n (0 ≤ n ≤ 20). The second line of input contains 2n space-separated integers a[1], a[2], ..., a[2n] (1 ≤ a[i] ≤ 109), the initial array. The third line of input contains a single integer m (1 ≤ m ≤ 106). The fourth line of input contains m space-separated integers q1...
2,100
Output m lines. In the i-th line print the answer (the number of inversions) for the i-th query.
standard output
PASSED
96cd195fab49580ae28d5d9dd7af866b
train_000.jsonl
1396798800
Mashmokh's boss, Bimokh, didn't like Mashmokh. So he fired him. Mashmokh decided to go to university and participate in ACM instead of finding a new job. He wants to become a member of Bamokh's team. In order to join he was given some programming tasks and one week to solve them. Mashmokh is not a very experienced prog...
512 megabytes
import java.io.BufferedOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; public class Round240C { public static class Node { int[] sorted; int level; public Node(int level, int val) { sorted = new int[1]; sorted[...
Java
["2\n2 1 4 3\n4\n1 2 0 2", "1\n1 2\n3\n0 1 1"]
4 seconds
["0\n6\n6\n0", "0\n1\n0"]
NoteIf we reverse an array x[1], x[2], ..., x[n] it becomes new array y[1], y[2], ..., y[n], where y[i] = x[n - i + 1] for each i.The number of inversions of an array x[1], x[2], ..., x[n] is the number of pairs of indices i, j such that: i &lt; j and x[i] &gt; x[j].
Java 8
standard input
[ "combinatorics", "divide and conquer" ]
ea7f8bd397f80ba7d3add6f9609dcc4a
The first line of input contains a single integer n (0 ≤ n ≤ 20). The second line of input contains 2n space-separated integers a[1], a[2], ..., a[2n] (1 ≤ a[i] ≤ 109), the initial array. The third line of input contains a single integer m (1 ≤ m ≤ 106). The fourth line of input contains m space-separated integers q1...
2,100
Output m lines. In the i-th line print the answer (the number of inversions) for the i-th query.
standard output
PASSED
1b32445700641d6fa14d38941b810ada
train_000.jsonl
1396798800
Mashmokh's boss, Bimokh, didn't like Mashmokh. So he fired him. Mashmokh decided to go to university and participate in ACM instead of finding a new job. He wants to become a member of Bamokh's team. In order to join he was given some programming tasks and one week to solve them. Mashmokh is not a very experienced prog...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class Abood3A { static final int INF = Integer.MAX_VALUE; static long[] inv, invR; static void m...
Java
["2\n2 1 4 3\n4\n1 2 0 2", "1\n1 2\n3\n0 1 1"]
4 seconds
["0\n6\n6\n0", "0\n1\n0"]
NoteIf we reverse an array x[1], x[2], ..., x[n] it becomes new array y[1], y[2], ..., y[n], where y[i] = x[n - i + 1] for each i.The number of inversions of an array x[1], x[2], ..., x[n] is the number of pairs of indices i, j such that: i &lt; j and x[i] &gt; x[j].
Java 8
standard input
[ "combinatorics", "divide and conquer" ]
ea7f8bd397f80ba7d3add6f9609dcc4a
The first line of input contains a single integer n (0 ≤ n ≤ 20). The second line of input contains 2n space-separated integers a[1], a[2], ..., a[2n] (1 ≤ a[i] ≤ 109), the initial array. The third line of input contains a single integer m (1 ≤ m ≤ 106). The fourth line of input contains m space-separated integers q1...
2,100
Output m lines. In the i-th line print the answer (the number of inversions) for the i-th query.
standard output
PASSED
ea6dae42b767f2ff6db020747abef187
train_000.jsonl
1396798800
Mashmokh's boss, Bimokh, didn't like Mashmokh. So he fired him. Mashmokh decided to go to university and participate in ACM instead of finding a new job. He wants to become a member of Bamokh's team. In order to join he was given some programming tasks and one week to solve them. Mashmokh is not a very experienced prog...
512 megabytes
import java.lang.*; import java.math.*; import java.util.*; import java.io.*; public class Main { void solve() { int n=ni(); a=new int[(1<<n)+1]; for(int i=1;i<=(1<<n);i++) a[i]=ni(); sum2=new long[n+1][2]; tree=new int[4*(1<<n)+1][]; build(1,1,1<<n,0); // pw...
Java
["2\n2 1 4 3\n4\n1 2 0 2", "1\n1 2\n3\n0 1 1"]
4 seconds
["0\n6\n6\n0", "0\n1\n0"]
NoteIf we reverse an array x[1], x[2], ..., x[n] it becomes new array y[1], y[2], ..., y[n], where y[i] = x[n - i + 1] for each i.The number of inversions of an array x[1], x[2], ..., x[n] is the number of pairs of indices i, j such that: i &lt; j and x[i] &gt; x[j].
Java 8
standard input
[ "combinatorics", "divide and conquer" ]
ea7f8bd397f80ba7d3add6f9609dcc4a
The first line of input contains a single integer n (0 ≤ n ≤ 20). The second line of input contains 2n space-separated integers a[1], a[2], ..., a[2n] (1 ≤ a[i] ≤ 109), the initial array. The third line of input contains a single integer m (1 ≤ m ≤ 106). The fourth line of input contains m space-separated integers q1...
2,100
Output m lines. In the i-th line print the answer (the number of inversions) for the i-th query.
standard output
PASSED
81344bd909d204ecc8f5acfc2b2fd62e
train_000.jsonl
1448382900
In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one r...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; import java.text.*; /* Name of the class has to be "Main" only if the class is public*/ public class CF602C { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = n...
Java
["4 2\n1 3\n3 4", "4 6\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "5 5\n4 2\n3 5\n4 5\n5 1\n1 2"]
2 seconds
["2", "-1", "3"]
NoteIn the first sample, the train can take the route and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4.
Java 11
standard input
[ "graphs" ]
fbfc333ad4b0a750f654a00be84aea67
The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one ra...
1,600
Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output  - 1.
standard output
PASSED
ffe70122fe98ce0b60a0c92ccd325739
train_000.jsonl
1398409200
Recently an official statement of the world Olympic Committee said that the Olympic Winter Games 2030 will be held in Tomsk. The city officials decided to prepare for the Olympics thoroughly and to build all the necessary Olympic facilities as early as possible. First, a biathlon track will be built.To construct a biat...
256 megabytes
import java.io.*; import java.lang.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { InputReader reader = new InputReader(System.in); PrintWriter writer = new PrintWriter(System.out, true); try { Task task = new Task(); task.solve(reader, ...
Java
["6 7 48\n3 6 2\n5 4 8 3 3 7 9\n4 1 6 8 7 1 1\n1 6 4 6 4 8 6\n7 2 6 1 6 9 4\n1 9 8 6 3 9 2\n4 5 6 8 4 3 7"]
4.5 seconds
["4 3 6 7"]
null
Java 8
standard input
[ "dp", "constructive algorithms", "data structures", "binary search", "brute force" ]
667d00cac98b3bd07fc7c78be5373fb5
The first line of the input contains three integers n, m and t (3 ≤ n, m ≤ 300, 1 ≤ t ≤ 109) — the sizes of the land plot and the desired distance covering time. The second line also contains three integers tp, tu and td (1 ≤ tp, tu, td ≤ 100) — the time the average biathlete needs to cover a flat piece of the track, a...
2,300
In a single line of the output print four positive integers — the number of the row and the number of the column of the upper left corner and the number of the row and the number of the column of the lower right corner of the rectangle that is chosen for the track.
standard output
PASSED
7915411208091cc4937e712adae1e159
train_000.jsonl
1398409200
Recently an official statement of the world Olympic Committee said that the Olympic Winter Games 2030 will be held in Tomsk. The city officials decided to prepare for the Olympics thoroughly and to build all the necessary Olympic facilities as early as possible. First, a biathlon track will be built.To construct a biat...
256 megabytes
import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.OutputStream; import java.io.PrintWriter; import java.util.NoSuchElementException; import java.util.TreeSet; import java.io.Writer; import java.math.BigInteger; import ja...
Java
["6 7 48\n3 6 2\n5 4 8 3 3 7 9\n4 1 6 8 7 1 1\n1 6 4 6 4 8 6\n7 2 6 1 6 9 4\n1 9 8 6 3 9 2\n4 5 6 8 4 3 7"]
4.5 seconds
["4 3 6 7"]
null
Java 8
standard input
[ "dp", "constructive algorithms", "data structures", "binary search", "brute force" ]
667d00cac98b3bd07fc7c78be5373fb5
The first line of the input contains three integers n, m and t (3 ≤ n, m ≤ 300, 1 ≤ t ≤ 109) — the sizes of the land plot and the desired distance covering time. The second line also contains three integers tp, tu and td (1 ≤ tp, tu, td ≤ 100) — the time the average biathlete needs to cover a flat piece of the track, a...
2,300
In a single line of the output print four positive integers — the number of the row and the number of the column of the upper left corner and the number of the row and the number of the column of the lower right corner of the rectangle that is chosen for the track.
standard output
PASSED
3fa881a55999f8c0423d8053aa1c57d1
train_000.jsonl
1398409200
Recently an official statement of the world Olympic Committee said that the Olympic Winter Games 2030 will be held in Tomsk. The city officials decided to prepare for the Olympics thoroughly and to build all the necessary Olympic facilities as early as possible. First, a biathlon track will be built.To construct a biat...
256 megabytes
import java.io.Reader; import java.util.Arrays; import java.util.InputMismatchException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.OutputStream; import java.util.Comparator; import java.io.PrintWriter; import java.io.Writer; import java.io.IOException; ...
Java
["6 7 48\n3 6 2\n5 4 8 3 3 7 9\n4 1 6 8 7 1 1\n1 6 4 6 4 8 6\n7 2 6 1 6 9 4\n1 9 8 6 3 9 2\n4 5 6 8 4 3 7"]
4.5 seconds
["4 3 6 7"]
null
Java 8
standard input
[ "dp", "constructive algorithms", "data structures", "binary search", "brute force" ]
667d00cac98b3bd07fc7c78be5373fb5
The first line of the input contains three integers n, m and t (3 ≤ n, m ≤ 300, 1 ≤ t ≤ 109) — the sizes of the land plot and the desired distance covering time. The second line also contains three integers tp, tu and td (1 ≤ tp, tu, td ≤ 100) — the time the average biathlete needs to cover a flat piece of the track, a...
2,300
In a single line of the output print four positive integers — the number of the row and the number of the column of the upper left corner and the number of the row and the number of the column of the lower right corner of the rectangle that is chosen for the track.
standard output
PASSED
5a46a515a4d412dd64d46d0d18fdfa95
train_000.jsonl
1398409200
Recently an official statement of the world Olympic Committee said that the Olympic Winter Games 2030 will be held in Tomsk. The city officials decided to prepare for the Olympics thoroughly and to build all the necessary Olympic facilities as early as possible. First, a biathlon track will be built.To construct a biat...
256 megabytes
// practice with rainboy import java.io.*; import java.util.*; public class CF424D extends PrintWriter { CF424D() { super(System.out, true); } Scanner sc = new Scanner(System.in); public static void main(String[] $) { CF424D o = new CF424D(); o.main(); o.flush(); } static Random rand = new Random(); static cl...
Java
["6 7 48\n3 6 2\n5 4 8 3 3 7 9\n4 1 6 8 7 1 1\n1 6 4 6 4 8 6\n7 2 6 1 6 9 4\n1 9 8 6 3 9 2\n4 5 6 8 4 3 7"]
4.5 seconds
["4 3 6 7"]
null
Java 8
standard input
[ "dp", "constructive algorithms", "data structures", "binary search", "brute force" ]
667d00cac98b3bd07fc7c78be5373fb5
The first line of the input contains three integers n, m and t (3 ≤ n, m ≤ 300, 1 ≤ t ≤ 109) — the sizes of the land plot and the desired distance covering time. The second line also contains three integers tp, tu and td (1 ≤ tp, tu, td ≤ 100) — the time the average biathlete needs to cover a flat piece of the track, a...
2,300
In a single line of the output print four positive integers — the number of the row and the number of the column of the upper left corner and the number of the row and the number of the column of the lower right corner of the rectangle that is chosen for the track.
standard output
PASSED
9ca57681633f2123f91525b78f20f7f4
train_000.jsonl
1398409200
Recently an official statement of the world Olympic Committee said that the Olympic Winter Games 2030 will be held in Tomsk. The city officials decided to prepare for the Olympics thoroughly and to build all the necessary Olympic facilities as early as possible. First, a biathlon track will be built.To construct a biat...
256 megabytes
import java.io.Reader; import java.util.Arrays; import java.util.InputMismatchException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.OutputStream; import java.util.Comparator; import java.io.PrintWriter; import java.io.Writer; import java.io.IOException; ...
Java
["6 7 48\n3 6 2\n5 4 8 3 3 7 9\n4 1 6 8 7 1 1\n1 6 4 6 4 8 6\n7 2 6 1 6 9 4\n1 9 8 6 3 9 2\n4 5 6 8 4 3 7"]
4.5 seconds
["4 3 6 7"]
null
Java 8
standard input
[ "dp", "constructive algorithms", "data structures", "binary search", "brute force" ]
667d00cac98b3bd07fc7c78be5373fb5
The first line of the input contains three integers n, m and t (3 ≤ n, m ≤ 300, 1 ≤ t ≤ 109) — the sizes of the land plot and the desired distance covering time. The second line also contains three integers tp, tu and td (1 ≤ tp, tu, td ≤ 100) — the time the average biathlete needs to cover a flat piece of the track, a...
2,300
In a single line of the output print four positive integers — the number of the row and the number of the column of the upper left corner and the number of the row and the number of the column of the lower right corner of the rectangle that is chosen for the track.
standard output
PASSED
8c8ba8c83cc3a3d2ed9f53868924a466
train_000.jsonl
1398409200
Recently an official statement of the world Olympic Committee said that the Olympic Winter Games 2030 will be held in Tomsk. The city officials decided to prepare for the Olympics thoroughly and to build all the necessary Olympic facilities as early as possible. First, a biathlon track will be built.To construct a biat...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.NavigableSet; import java.util.StringTokenizer; import java.util.TreeSet; public class Main { static class Block implements Comparable<Block> { int tot; int col; public Block(int tot, int col) { this.tot = tot; ...
Java
["6 7 48\n3 6 2\n5 4 8 3 3 7 9\n4 1 6 8 7 1 1\n1 6 4 6 4 8 6\n7 2 6 1 6 9 4\n1 9 8 6 3 9 2\n4 5 6 8 4 3 7"]
4.5 seconds
["4 3 6 7"]
null
Java 8
standard input
[ "dp", "constructive algorithms", "data structures", "binary search", "brute force" ]
667d00cac98b3bd07fc7c78be5373fb5
The first line of the input contains three integers n, m and t (3 ≤ n, m ≤ 300, 1 ≤ t ≤ 109) — the sizes of the land plot and the desired distance covering time. The second line also contains three integers tp, tu and td (1 ≤ tp, tu, td ≤ 100) — the time the average biathlete needs to cover a flat piece of the track, a...
2,300
In a single line of the output print four positive integers — the number of the row and the number of the column of the upper left corner and the number of the row and the number of the column of the lower right corner of the rectangle that is chosen for the track.
standard output
PASSED
065c39da49913b12d3b5df20a99b322d
train_000.jsonl
1398409200
Recently an official statement of the world Olympic Committee said that the Olympic Winter Games 2030 will be held in Tomsk. The city officials decided to prepare for the Olympics thoroughly and to build all the necessary Olympic facilities as early as possible. First, a biathlon track will be built.To construct a biat...
256 megabytes
import java.io.*; import java.util.StringTokenizer; import java.util.TreeSet; public class Main { static class Block implements Comparable<Block> { int tot; int col; public Block(int tot, int col) { this.tot = tot; this.col = col; } public Block(Block...
Java
["6 7 48\n3 6 2\n5 4 8 3 3 7 9\n4 1 6 8 7 1 1\n1 6 4 6 4 8 6\n7 2 6 1 6 9 4\n1 9 8 6 3 9 2\n4 5 6 8 4 3 7"]
4.5 seconds
["4 3 6 7"]
null
Java 8
standard input
[ "dp", "constructive algorithms", "data structures", "binary search", "brute force" ]
667d00cac98b3bd07fc7c78be5373fb5
The first line of the input contains three integers n, m and t (3 ≤ n, m ≤ 300, 1 ≤ t ≤ 109) — the sizes of the land plot and the desired distance covering time. The second line also contains three integers tp, tu and td (1 ≤ tp, tu, td ≤ 100) — the time the average biathlete needs to cover a flat piece of the track, a...
2,300
In a single line of the output print four positive integers — the number of the row and the number of the column of the upper left corner and the number of the row and the number of the column of the lower right corner of the rectangle that is chosen for the track.
standard output
PASSED
bbfa79ecfb1ed451bbec891d6d404609
train_000.jsonl
1398409200
Recently an official statement of the world Olympic Committee said that the Olympic Winter Games 2030 will be held in Tomsk. The city officials decided to prepare for the Olympics thoroughly and to build all the necessary Olympic facilities as early as possible. First, a biathlon track will be built.To construct a biat...
256 megabytes
import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.OutputStream; import java.io.PrintWriter; import java.util.NoSuchElementException; import java.util.TreeSet; import java.io.Writer; import java.math.BigInteger; import ja...
Java
["6 7 48\n3 6 2\n5 4 8 3 3 7 9\n4 1 6 8 7 1 1\n1 6 4 6 4 8 6\n7 2 6 1 6 9 4\n1 9 8 6 3 9 2\n4 5 6 8 4 3 7"]
4.5 seconds
["4 3 6 7"]
null
Java 8
standard input
[ "dp", "constructive algorithms", "data structures", "binary search", "brute force" ]
667d00cac98b3bd07fc7c78be5373fb5
The first line of the input contains three integers n, m and t (3 ≤ n, m ≤ 300, 1 ≤ t ≤ 109) — the sizes of the land plot and the desired distance covering time. The second line also contains three integers tp, tu and td (1 ≤ tp, tu, td ≤ 100) — the time the average biathlete needs to cover a flat piece of the track, a...
2,300
In a single line of the output print four positive integers — the number of the row and the number of the column of the upper left corner and the number of the row and the number of the column of the lower right corner of the rectangle that is chosen for the track.
standard output
PASSED
00d0c85f14c88c0cbb59a885e7aa2115
train_000.jsonl
1398409200
Recently an official statement of the world Olympic Committee said that the Olympic Winter Games 2030 will be held in Tomsk. The city officials decided to prepare for the Olympics thoroughly and to build all the necessary Olympic facilities as early as possible. First, a biathlon track will be built.To construct a biat...
256 megabytes
import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.*; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { p...
Java
["6 7 48\n3 6 2\n5 4 8 3 3 7 9\n4 1 6 8 7 1 1\n1 6 4 6 4 8 6\n7 2 6 1 6 9 4\n1 9 8 6 3 9 2\n4 5 6 8 4 3 7"]
4.5 seconds
["4 3 6 7"]
null
Java 8
standard input
[ "dp", "constructive algorithms", "data structures", "binary search", "brute force" ]
667d00cac98b3bd07fc7c78be5373fb5
The first line of the input contains three integers n, m and t (3 ≤ n, m ≤ 300, 1 ≤ t ≤ 109) — the sizes of the land plot and the desired distance covering time. The second line also contains three integers tp, tu and td (1 ≤ tp, tu, td ≤ 100) — the time the average biathlete needs to cover a flat piece of the track, a...
2,300
In a single line of the output print four positive integers — the number of the row and the number of the column of the upper left corner and the number of the row and the number of the column of the lower right corner of the rectangle that is chosen for the track.
standard output
PASSED
bcc3c6138d40b1f35e6c2948a9700000
train_000.jsonl
1398409200
Recently an official statement of the world Olympic Committee said that the Olympic Winter Games 2030 will be held in Tomsk. The city officials decided to prepare for the Olympics thoroughly and to build all the necessary Olympic facilities as early as possible. First, a biathlon track will be built.To construct a biat...
256 megabytes
import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.*; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { p...
Java
["6 7 48\n3 6 2\n5 4 8 3 3 7 9\n4 1 6 8 7 1 1\n1 6 4 6 4 8 6\n7 2 6 1 6 9 4\n1 9 8 6 3 9 2\n4 5 6 8 4 3 7"]
4.5 seconds
["4 3 6 7"]
null
Java 8
standard input
[ "dp", "constructive algorithms", "data structures", "binary search", "brute force" ]
667d00cac98b3bd07fc7c78be5373fb5
The first line of the input contains three integers n, m and t (3 ≤ n, m ≤ 300, 1 ≤ t ≤ 109) — the sizes of the land plot and the desired distance covering time. The second line also contains three integers tp, tu and td (1 ≤ tp, tu, td ≤ 100) — the time the average biathlete needs to cover a flat piece of the track, a...
2,300
In a single line of the output print four positive integers — the number of the row and the number of the column of the upper left corner and the number of the row and the number of the column of the lower right corner of the rectangle that is chosen for the track.
standard output
PASSED
eac210f14d2bf7ad6cc155cd39fd9a10
train_000.jsonl
1398409200
Recently an official statement of the world Olympic Committee said that the Olympic Winter Games 2030 will be held in Tomsk. The city officials decided to prepare for the Olympics thoroughly and to build all the necessary Olympic facilities as early as possible. First, a biathlon track will be built.To construct a biat...
256 megabytes
import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.OutputStream; import java.io.PrintWriter; import java.util.NoSuchElementException; import java.util.TreeSet; import java.io.Writer; import java.math.BigInteger; import ja...
Java
["6 7 48\n3 6 2\n5 4 8 3 3 7 9\n4 1 6 8 7 1 1\n1 6 4 6 4 8 6\n7 2 6 1 6 9 4\n1 9 8 6 3 9 2\n4 5 6 8 4 3 7"]
4.5 seconds
["4 3 6 7"]
null
Java 8
standard input
[ "dp", "constructive algorithms", "data structures", "binary search", "brute force" ]
667d00cac98b3bd07fc7c78be5373fb5
The first line of the input contains three integers n, m and t (3 ≤ n, m ≤ 300, 1 ≤ t ≤ 109) — the sizes of the land plot and the desired distance covering time. The second line also contains three integers tp, tu and td (1 ≤ tp, tu, td ≤ 100) — the time the average biathlete needs to cover a flat piece of the track, a...
2,300
In a single line of the output print four positive integers — the number of the row and the number of the column of the upper left corner and the number of the row and the number of the column of the lower right corner of the rectangle that is chosen for the track.
standard output
PASSED
ba90b363776117c2b0c5d015fec00430
train_000.jsonl
1398409200
Recently an official statement of the world Olympic Committee said that the Olympic Winter Games 2030 will be held in Tomsk. The city officials decided to prepare for the Olympics thoroughly and to build all the necessary Olympic facilities as early as possible. First, a biathlon track will be built.To construct a biat...
256 megabytes
import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.OutputStream; import java.io.PrintWriter; import java.util.NoSuchElementException; import java.util.TreeSet; import java.io.Writer; import java.math.BigInteger; import ja...
Java
["6 7 48\n3 6 2\n5 4 8 3 3 7 9\n4 1 6 8 7 1 1\n1 6 4 6 4 8 6\n7 2 6 1 6 9 4\n1 9 8 6 3 9 2\n4 5 6 8 4 3 7"]
4.5 seconds
["4 3 6 7"]
null
Java 8
standard input
[ "dp", "constructive algorithms", "data structures", "binary search", "brute force" ]
667d00cac98b3bd07fc7c78be5373fb5
The first line of the input contains three integers n, m and t (3 ≤ n, m ≤ 300, 1 ≤ t ≤ 109) — the sizes of the land plot and the desired distance covering time. The second line also contains three integers tp, tu and td (1 ≤ tp, tu, td ≤ 100) — the time the average biathlete needs to cover a flat piece of the track, a...
2,300
In a single line of the output print four positive integers — the number of the row and the number of the column of the upper left corner and the number of the row and the number of the column of the lower right corner of the rectangle that is chosen for the track.
standard output
PASSED
3a347857801a17c4c093aaaec7c8ec34
train_000.jsonl
1398409200
Recently an official statement of the world Olympic Committee said that the Olympic Winter Games 2030 will be held in Tomsk. The city officials decided to prepare for the Olympics thoroughly and to build all the necessary Olympic facilities as early as possible. First, a biathlon track will be built.To construct a biat...
256 megabytes
import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.*; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { p...
Java
["6 7 48\n3 6 2\n5 4 8 3 3 7 9\n4 1 6 8 7 1 1\n1 6 4 6 4 8 6\n7 2 6 1 6 9 4\n1 9 8 6 3 9 2\n4 5 6 8 4 3 7"]
4.5 seconds
["4 3 6 7"]
null
Java 8
standard input
[ "dp", "constructive algorithms", "data structures", "binary search", "brute force" ]
667d00cac98b3bd07fc7c78be5373fb5
The first line of the input contains three integers n, m and t (3 ≤ n, m ≤ 300, 1 ≤ t ≤ 109) — the sizes of the land plot and the desired distance covering time. The second line also contains three integers tp, tu and td (1 ≤ tp, tu, td ≤ 100) — the time the average biathlete needs to cover a flat piece of the track, a...
2,300
In a single line of the output print four positive integers — the number of the row and the number of the column of the upper left corner and the number of the row and the number of the column of the lower right corner of the rectangle that is chosen for the track.
standard output
PASSED
91e997e723d2647ae7472e42b351c737
train_000.jsonl
1398409200
Recently an official statement of the world Olympic Committee said that the Olympic Winter Games 2030 will be held in Tomsk. The city officials decided to prepare for the Olympics thoroughly and to build all the necessary Olympic facilities as early as possible. First, a biathlon track will be built.To construct a biat...
256 megabytes
import java.io.PrintWriter; import java.util.Scanner; public class A { static int[][] down, up, left, right; static int H, W; public static void main(String[] args) { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); H = sc.nextInt(); W = s...
Java
["6 7 48\n3 6 2\n5 4 8 3 3 7 9\n4 1 6 8 7 1 1\n1 6 4 6 4 8 6\n7 2 6 1 6 9 4\n1 9 8 6 3 9 2\n4 5 6 8 4 3 7"]
4.5 seconds
["4 3 6 7"]
null
Java 6
standard input
[ "dp", "constructive algorithms", "data structures", "binary search", "brute force" ]
667d00cac98b3bd07fc7c78be5373fb5
The first line of the input contains three integers n, m and t (3 ≤ n, m ≤ 300, 1 ≤ t ≤ 109) — the sizes of the land plot and the desired distance covering time. The second line also contains three integers tp, tu and td (1 ≤ tp, tu, td ≤ 100) — the time the average biathlete needs to cover a flat piece of the track, a...
2,300
In a single line of the output print four positive integers — the number of the row and the number of the column of the upper left corner and the number of the row and the number of the column of the lower right corner of the rectangle that is chosen for the track.
standard output
PASSED
de063f71072dfe58cddb0d176b1713b0
train_000.jsonl
1398409200
Recently an official statement of the world Olympic Committee said that the Olympic Winter Games 2030 will be held in Tomsk. The city officials decided to prepare for the Olympics thoroughly and to build all the necessary Olympic facilities as early as possible. First, a biathlon track will be built.To construct a biat...
256 megabytes
import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.OutputStream; import java.io.PrintWriter; import java.util.NoSuchElementException; import java.util.TreeSet; import java.io.Writer; import java.math.BigInteger; import ja...
Java
["6 7 48\n3 6 2\n5 4 8 3 3 7 9\n4 1 6 8 7 1 1\n1 6 4 6 4 8 6\n7 2 6 1 6 9 4\n1 9 8 6 3 9 2\n4 5 6 8 4 3 7"]
4.5 seconds
["4 3 6 7"]
null
Java 6
standard input
[ "dp", "constructive algorithms", "data structures", "binary search", "brute force" ]
667d00cac98b3bd07fc7c78be5373fb5
The first line of the input contains three integers n, m and t (3 ≤ n, m ≤ 300, 1 ≤ t ≤ 109) — the sizes of the land plot and the desired distance covering time. The second line also contains three integers tp, tu and td (1 ≤ tp, tu, td ≤ 100) — the time the average biathlete needs to cover a flat piece of the track, a...
2,300
In a single line of the output print four positive integers — the number of the row and the number of the column of the upper left corner and the number of the row and the number of the column of the lower right corner of the rectangle that is chosen for the track.
standard output
PASSED
25d3c39e9044955c628aacb13d248a40
train_000.jsonl
1398409200
Recently an official statement of the world Olympic Committee said that the Olympic Winter Games 2030 will be held in Tomsk. The city officials decided to prepare for the Olympics thoroughly and to build all the necessary Olympic facilities as early as possible. First, a biathlon track will be built.To construct a biat...
256 megabytes
import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.*; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { p...
Java
["6 7 48\n3 6 2\n5 4 8 3 3 7 9\n4 1 6 8 7 1 1\n1 6 4 6 4 8 6\n7 2 6 1 6 9 4\n1 9 8 6 3 9 2\n4 5 6 8 4 3 7"]
4.5 seconds
["4 3 6 7"]
null
Java 6
standard input
[ "dp", "constructive algorithms", "data structures", "binary search", "brute force" ]
667d00cac98b3bd07fc7c78be5373fb5
The first line of the input contains three integers n, m and t (3 ≤ n, m ≤ 300, 1 ≤ t ≤ 109) — the sizes of the land plot and the desired distance covering time. The second line also contains three integers tp, tu and td (1 ≤ tp, tu, td ≤ 100) — the time the average biathlete needs to cover a flat piece of the track, a...
2,300
In a single line of the output print four positive integers — the number of the row and the number of the column of the upper left corner and the number of the row and the number of the column of the lower right corner of the rectangle that is chosen for the track.
standard output
PASSED
ad23503acf152f847f143259952a454d
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.lang.Comparable; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class Main { private static final int COORD_MOD = 5010; private static final int MAX_COORD = 5000 + COORD_MOD; private static Scanner in = new Scanner(System.in); private...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
b705805f3d357595518c39f2e92905d2
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.util.*; import java.io.*; public class E{ static PrintWriter out; static InputReader in; public static void main(String args[]){ out = new PrintWriter(System.out); in = new InputReader(); new E(); out.flush(); out.close(); } E(){ solve(); } ...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
dc2ba391af7b66701adbc3beaaf7b1e8
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.util.*; import java.io.*; public class EE { static int o = 5001; public static void main(String[] args) { FastScanner scanner = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int N = scanner.nextInt(); long ans = 0; ArrayList<HLine> horiz =...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
420a7973f86b86c08d6f1aecdef1cc5f
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class E { public static class FixedBitSet extends BitSet { private final long[] bits; // Array of longs holding the bits private final int numBits; // The number of bits in use private final int numWords; // The exact number of longs needed to ...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
a14d7313328cafd407af05863b13dc77
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.io.*; import java.util.*; import java.util.function.Function; public class MainE { static int N; static List<Segment> H; static List<Segment> V; public static void main(String[] args) { FastScanner sc = new FastScanner(System.in); N = sc.nextInt(); H = new ArrayLi...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
bd5d1aaf44e256d23ad21b8fe8eccb02
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.io.*; import java.util.*; import java.util.function.Function; public class MainE { static int N; static List<Segment> H; static List<Segment> V; public static void main(String[] args) { FastScanner sc = new FastScanner(System.in); N = sc.nextInt(); H = new ArrayLi...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
ae9792001aec530c5a47a518f8384a63
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
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.util.InputMismatchException; import java.io.IOException; import java.util.ArrayList; import java.io.Writer; import java.io.OutputStream...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
c16bb692e00b303dcef72a92e6add781
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
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.util.InputMismatchException; import java.io.IOException; import java.util.ArrayList; import java.io.Writer; import java.io.OutputStream...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
a43e077eb65a6da8b58f71f6400620a3
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.io.*; import java.util.*; public class B { static int N=5001; public static void main(String[] args) throws IOException { Scanner sc = new Scanner(); PrintWriter out = new PrintWriter(System.out); int n=sc.nextInt(); line[]lines=new line[n]; ArrayList<line>hor=new ArrayList(),ver=new ArrayList...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
18613270f26cd627a61a9038e0c19005
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.io.*; import java.util.*; public class B { static int N=5001; public static void main(String[] args) throws IOException { Scanner sc = new Scanner(); PrintWriter out = new PrintWriter(System.out); int n=sc.nextInt(); line[]lines=new line[n]; ArrayList<line>hor=new ArrayList(),ver=new ArrayList...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
fb0c6f995553c78aae2b3b7c0c415e52
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.nio.charset.Charset; import java.util.*; public class CFContest { public static void main(String[] args) throws Exception { boolean local = System.getProperty("ONLINE_JUDGE") ...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
df80495260c2177e63e43028dc36d251
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Scanner; public class countTheRectangles { public static void main(String[] args) { Scanner scan=new Scanner(System.in); int n=scan.nextInt(); int[][] data=new int[n][4]; int hct=0; for(int i=0;i<n;i++) { ...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
7f45c9a44a21e69cf7367ca90ae3eb0e
train_000.jsonl
1561559700
Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Comparator; import java.util.Objects; import java.util.StringTokenizer; import java.util.function.BiFunction; import java.uti...
Java
["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"]
3 seconds
["4\n-1\n5\n2\n0\n1"]
NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ...
Java 8
standard input
[ "binary search", "math" ]
2005224ffffb90411db3678ac4996f84
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b &lt; a \le 10^9$$$) — the initial charge of Vova's laptop batt...
1,400
For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise.
standard output
PASSED
e8a4c964b4fad1a6346b653a14c9dddd
train_000.jsonl
1561559700
Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict...
256 megabytes
import java.io.*; import java.util.*; import java.util.stream.*; import static java.lang.Integer.parseInt; public class m { private static final boolean ONLINE_JUDGE = true; //System.getProperty("ONLINE_JUDGE") != null; public static void main(String[] args) { try (BufferedReader reader = ONLINE_JUDGE ? new ...
Java
["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"]
3 seconds
["4\n-1\n5\n2\n0\n1"]
NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ...
Java 8
standard input
[ "binary search", "math" ]
2005224ffffb90411db3678ac4996f84
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b &lt; a \le 10^9$$$) — the initial charge of Vova's laptop batt...
1,400
For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise.
standard output
PASSED
44b905c30103fdc2db31ba3156fd0967
train_000.jsonl
1561559700
Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict...
256 megabytes
import java.util.*; import java.io.*; public class R570D3C { public static void main(String[] args) throws Exception{ // TODO Auto-generated method stub BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(bf.readLine()); int[] answers = new int[t]; for(int ...
Java
["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"]
3 seconds
["4\n-1\n5\n2\n0\n1"]
NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ...
Java 8
standard input
[ "binary search", "math" ]
2005224ffffb90411db3678ac4996f84
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b &lt; a \le 10^9$$$) — the initial charge of Vova's laptop batt...
1,400
For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise.
standard output
PASSED
b3e399fc665bcbfdb923ddc50d4be666
train_000.jsonl
1561559700
Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict...
256 megabytes
import java .util.*; public class game { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int t=scn.nextInt(); for(int p=0;p<t;p++) { long k=scn.nextLong(); long n=scn.nextLong(); long a=scn.nextLong(); long b=scn.nextLong(); long c=k-(a*n); if(c>0) System...
Java
["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"]
3 seconds
["4\n-1\n5\n2\n0\n1"]
NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ...
Java 8
standard input
[ "binary search", "math" ]
2005224ffffb90411db3678ac4996f84
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b &lt; a \le 10^9$$$) — the initial charge of Vova's laptop batt...
1,400
For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise.
standard output
PASSED
121a99b8a4a44275cf748d9da30071d6
train_000.jsonl
1561559700
Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws java.lang.Exception { Scanner sc = new Scanner(S...
Java
["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"]
3 seconds
["4\n-1\n5\n2\n0\n1"]
NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ...
Java 8
standard input
[ "binary search", "math" ]
2005224ffffb90411db3678ac4996f84
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b &lt; a \le 10^9$$$) — the initial charge of Vova's laptop batt...
1,400
For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise.
standard output
PASSED
3b939c07b01fd464546f0899452e6f4f
train_000.jsonl
1561559700
Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static long searchMaxA(long k,long n,long a,long b){ long left=0,right=n,mid=0; while(left<right){ mid=(left+right+1)/2; ...
Java
["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"]
3 seconds
["4\n-1\n5\n2\n0\n1"]
NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ...
Java 8
standard input
[ "binary search", "math" ]
2005224ffffb90411db3678ac4996f84
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b &lt; a \le 10^9$$$) — the initial charge of Vova's laptop batt...
1,400
For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise.
standard output
PASSED
8f02cfd907b3e93cefdc96b01677e052
train_000.jsonl
1561559700
Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { //Scanner scanner = new Scanner(new FileInputStream(new File("test"))); Scanner scanner = new Scanner(System.in); int Q = scanner.nextInt(); while (Q --> 0) { long K...
Java
["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"]
3 seconds
["4\n-1\n5\n2\n0\n1"]
NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ...
Java 8
standard input
[ "binary search", "math" ]
2005224ffffb90411db3678ac4996f84
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b &lt; a \le 10^9$$$) — the initial charge of Vova's laptop batt...
1,400
For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise.
standard output
PASSED
d32ac1566f0e28568e4b3825ade9c478
train_000.jsonl
1561559700
Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection;...
Java
["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"]
3 seconds
["4\n-1\n5\n2\n0\n1"]
NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ...
Java 8
standard input
[ "binary search", "math" ]
2005224ffffb90411db3678ac4996f84
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b &lt; a \le 10^9$$$) — the initial charge of Vova's laptop batt...
1,400
For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise.
standard output
PASSED
247f2f851e368140de7a314e44badfea
train_000.jsonl
1561559700
Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) throws java.lang.Exception { Scanner in = new Scanner(System.in); int q = in.nextInt(); for(int i=0;i<q;i++) { long ans =-1; long k = in.nextLong(); long n = in.ne...
Java
["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"]
3 seconds
["4\n-1\n5\n2\n0\n1"]
NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ...
Java 8
standard input
[ "binary search", "math" ]
2005224ffffb90411db3678ac4996f84
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b &lt; a \le 10^9$$$) — the initial charge of Vova's laptop batt...
1,400
For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise.
standard output
PASSED
12000807c0f4108a373759741113e8b6
train_000.jsonl
1561559700
Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict...
256 megabytes
import java.io.*; import java.util.*; public class Main{ public static void main(String[] args) throws IOException{ Reader reader = new Reader(); int q = reader.nextInt(); StringBuilder stringBuilder = new StringBuilder(); while(q-- > 0){ long k = reader.nextInt(); ...
Java
["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"]
3 seconds
["4\n-1\n5\n2\n0\n1"]
NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ...
Java 8
standard input
[ "binary search", "math" ]
2005224ffffb90411db3678ac4996f84
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b &lt; a \le 10^9$$$) — the initial charge of Vova's laptop batt...
1,400
For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise.
standard output
PASSED
b4581349319a5e202a69bb251db6914b
train_000.jsonl
1561559700
Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict...
256 megabytes
import java.io.*; import java.util.*; public class Main{ public static void main(String[] args) throws IOException{ Reader reader = new Reader(); int q = reader.nextInt(); while(q-- > 0){ long k = reader.nextInt(); long n = reader.nextInt(); long a = ...
Java
["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"]
3 seconds
["4\n-1\n5\n2\n0\n1"]
NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ...
Java 8
standard input
[ "binary search", "math" ]
2005224ffffb90411db3678ac4996f84
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b &lt; a \le 10^9$$$) — the initial charge of Vova's laptop batt...
1,400
For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise.
standard output
PASSED
582c008cd68dec6a6070d1643f694d8e
train_000.jsonl
1561559700
Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict...
256 megabytes
import java.io.*; import java.util.*; public class Main{ public static void main(String[] args) throws IOException{ Reader reader = new Reader(); int q = reader.nextInt(); StringBuilder stringBuilder = new StringBuilder(); while(q-- > 0){ long k = reader.nextInt(); ...
Java
["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"]
3 seconds
["4\n-1\n5\n2\n0\n1"]
NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ...
Java 8
standard input
[ "binary search", "math" ]
2005224ffffb90411db3678ac4996f84
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b &lt; a \le 10^9$$$) — the initial charge of Vova's laptop batt...
1,400
For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise.
standard output
PASSED
764c11ba18069f1004aa76a5f3f562b8
train_000.jsonl
1561559700
Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict...
256 megabytes
import java.util.*; import java.io.*; public class ComputerGame { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long q = sc.nextInt(); for (long i = 0; i < q; i++) { long charge = sc.nextInt(); long turns = sc.nextInt(); ...
Java
["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"]
3 seconds
["4\n-1\n5\n2\n0\n1"]
NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ...
Java 8
standard input
[ "binary search", "math" ]
2005224ffffb90411db3678ac4996f84
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b &lt; a \le 10^9$$$) — the initial charge of Vova's laptop batt...
1,400
For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise.
standard output
PASSED
7b6ab91d314ebc9bfa0ce853820edd50
train_000.jsonl
1561559700
Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.*; /** * # * * @author pttrung */ public class C_Rou...
Java
["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"]
3 seconds
["4\n-1\n5\n2\n0\n1"]
NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ...
Java 8
standard input
[ "binary search", "math" ]
2005224ffffb90411db3678ac4996f84
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b &lt; a \le 10^9$$$) — the initial charge of Vova's laptop batt...
1,400
For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise.
standard output
PASSED
42691e8563237359b8eac97f57c65eb1
train_000.jsonl
1561559700
Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict...
256 megabytes
import java.util.*; import java.io.*; public class cf570C { public static void main(String args[]) throws Exception { FastReader sc=new FastReader(); StringBuffer buf=new StringBuffer(); int t=sc.nextInt(); for(int k1=0;k1<t;k1++) { long k=sc.nextInt(); long n=s...
Java
["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"]
3 seconds
["4\n-1\n5\n2\n0\n1"]
NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ...
Java 8
standard input
[ "binary search", "math" ]
2005224ffffb90411db3678ac4996f84
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b &lt; a \le 10^9$$$) — the initial charge of Vova's laptop batt...
1,400
For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise.
standard output
PASSED
ed012bb2a5fc0b9fe8416c769e98a44f
train_000.jsonl
1561559700
Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict...
256 megabytes
import java.util.*; public class Main{ public static long search(long l,long r,long a,long b,long k,long N) { if (l+1>=r) { // System.out.println(l+" "+r); long A = l*a+(N-l)*b; long B = r*a+(N-r)*b; // System.out.println(A+" "+B); if (A<k && A>=0 && B<k && B>=0) { return r; } else if (A<k && ...
Java
["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"]
3 seconds
["4\n-1\n5\n2\n0\n1"]
NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ...
Java 8
standard input
[ "binary search", "math" ]
2005224ffffb90411db3678ac4996f84
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b &lt; a \le 10^9$$$) — the initial charge of Vova's laptop batt...
1,400
For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise.
standard output
PASSED
81538c9a074c660b13d5ef645e17dbb2
train_000.jsonl
1561559700
Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class Main extends ArrayList implements Runnable{ static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; p...
Java
["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"]
3 seconds
["4\n-1\n5\n2\n0\n1"]
NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ...
Java 8
standard input
[ "binary search", "math" ]
2005224ffffb90411db3678ac4996f84
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b &lt; a \le 10^9$$$) — the initial charge of Vova's laptop batt...
1,400
For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise.
standard output
PASSED
c5870847bf8194bbf218aa9eeb288688
train_000.jsonl
1561559700
Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict...
256 megabytes
//Author: Patel Rag //Java version "1.8.0_211" import java.util.*; import java.io.*; public class Main { static class Reader { private byte[] buffer = new byte[1024]; private int index; private InputStream in; private int total; public Reader() { in = System.in; } public int...
Java
["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"]
3 seconds
["4\n-1\n5\n2\n0\n1"]
NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ...
Java 8
standard input
[ "binary search", "math" ]
2005224ffffb90411db3678ac4996f84
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b &lt; a \le 10^9$$$) — the initial charge of Vova's laptop batt...
1,400
For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise.
standard output
PASSED
aec3e61f3e67a9d2af2101eebc824d0b
train_000.jsonl
1561559700
Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict...
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. */ import java.util.Scanner; /** * * @author KIIT */ public class ComputerGame { public static void main(String[] args) { ...
Java
["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"]
3 seconds
["4\n-1\n5\n2\n0\n1"]
NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ...
Java 8
standard input
[ "binary search", "math" ]
2005224ffffb90411db3678ac4996f84
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b &lt; a \le 10^9$$$) — the initial charge of Vova's laptop batt...
1,400
For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise.
standard output
PASSED
843d73e04dcfa47f045cfb4667c8b4d1
train_000.jsonl
1561559700
Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict...
256 megabytes
import java.util.Scanner; public class cf_5_3 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int q = sc.nextInt(); for(int i=0;i<q;i++){ long k = sc.nextInt(); long n = sc.nextInt(); long a = sc.nextInt(); long b = sc.nextInt(); ...
Java
["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"]
3 seconds
["4\n-1\n5\n2\n0\n1"]
NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ...
Java 8
standard input
[ "binary search", "math" ]
2005224ffffb90411db3678ac4996f84
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b &lt; a \le 10^9$$$) — the initial charge of Vova's laptop batt...
1,400
For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise.
standard output
PASSED
ec6ea19fa9570301d50cd09bc4fd0628
train_000.jsonl
1561559700
Vova is playing a computer game. There are in total $$$n$$$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $$$k$$$.During each turn Vova can choose what to do: If the current charge of his laptop battery is strict...
256 megabytes
import java.util.*; import java.io.*; public class Cy { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public Reader() { din = new Data...
Java
["6\n15 5 3 2\n15 5 4 3\n15 5 2 1\n15 5 5 1\n16 7 5 2\n20 5 7 3"]
3 seconds
["4\n-1\n5\n2\n0\n1"]
NoteIn the first example query Vova can just play $$$4$$$ turns and spend $$$12$$$ units of charge and then one turn play and charge and spend $$$2$$$ more units. So the remaining charge of the battery will be $$$1$$$.In the second example query Vova cannot complete the game because even if he will play and charge the ...
Java 8
standard input
[ "binary search", "math" ]
2005224ffffb90411db3678ac4996f84
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each query is presented by a single line. The only line of the query contains four integers $$$k, n, a$$$ and $$$b$$$ ($$$1 \le k, n \le 10^9, 1 \le b &lt; a \le 10^9$$$) — the initial charge of Vova's laptop batt...
1,400
For each query print one integer: -1 if Vova cannot complete the game or the maximum number of turns Vova can just play (make the first type turn) otherwise.
standard output
PASSED
142925538b8c0a22827bbab50eabc41d
train_000.jsonl
1328886000
Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga...
256 megabytes
import java.io.*; import java.util.*; public class DivisionIntoTeams { static class Player implements Comparable<Player> { int skill, number; public Player(int skill, int number) { this.skill = skill; this.number = number; } @Override public in...
Java
["3\n1 2 1", "5\n2 3 3 1 1"]
1 second
["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"]
NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2 - 1| = 1 ≤ 1) is fulfilled...
Java 7
standard input
[ "sortings", "greedy", "math" ]
0937a7e2f912fc094cc4275fd47cd457
The first line contains the only integer n (2 ≤ n ≤ 105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1 ≤ ai ≤ 104), the i-th number represents the i-th boy's playing skills.
1,500
On the first line print an integer x — the number of boys playing for the first team. On the second line print x integers — the individual numbers of boys playing for the first team. On the third line print an integer y — the number of boys playing for the second team, on the fourth line print y integers — the individu...
standard output
PASSED
ecad28074e6649764dc00c0ae4415b66
train_000.jsonl
1328886000
Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga...
256 megabytes
import java.io.*; import java.util.*; public class DivisionIntoTeams { static class Player implements Comparable<Player> { int skill, number; public Player(int skill, int number) { this.skill = skill; this.number = number; } @Override public int ...
Java
["3\n1 2 1", "5\n2 3 3 1 1"]
1 second
["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"]
NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2 - 1| = 1 ≤ 1) is fulfilled...
Java 7
standard input
[ "sortings", "greedy", "math" ]
0937a7e2f912fc094cc4275fd47cd457
The first line contains the only integer n (2 ≤ n ≤ 105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1 ≤ ai ≤ 104), the i-th number represents the i-th boy's playing skills.
1,500
On the first line print an integer x — the number of boys playing for the first team. On the second line print x integers — the individual numbers of boys playing for the first team. On the third line print an integer y — the number of boys playing for the second team, on the fourth line print y integers — the individu...
standard output
PASSED
2c7a7cbb4695cea336ca3ecf0f5774a7
train_000.jsonl
1328886000
Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga...
256 megabytes
import java.awt.Paint; import java.awt.Point; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Comparator; import java.util.StringTokenizer; public class C13 { public static void main(String[] args) throws Exception{ in...
Java
["3\n1 2 1", "5\n2 3 3 1 1"]
1 second
["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"]
NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2 - 1| = 1 ≤ 1) is fulfilled...
Java 7
standard input
[ "sortings", "greedy", "math" ]
0937a7e2f912fc094cc4275fd47cd457
The first line contains the only integer n (2 ≤ n ≤ 105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1 ≤ ai ≤ 104), the i-th number represents the i-th boy's playing skills.
1,500
On the first line print an integer x — the number of boys playing for the first team. On the second line print x integers — the individual numbers of boys playing for the first team. On the third line print an integer y — the number of boys playing for the second team, on the fourth line print y integers — the individu...
standard output
PASSED
8f3170823d4f14eae43a79fe0210a8a8
train_000.jsonl
1328886000
Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; public class C { static Scanner in = new Scanner(System.in); public static void main(String[] args) { int n = in.nextInt(); Player[] players = new Player[n]; for (int i = 1; i <= n; i++) { players[i - 1] =...
Java
["3\n1 2 1", "5\n2 3 3 1 1"]
1 second
["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"]
NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2 - 1| = 1 ≤ 1) is fulfilled...
Java 7
standard input
[ "sortings", "greedy", "math" ]
0937a7e2f912fc094cc4275fd47cd457
The first line contains the only integer n (2 ≤ n ≤ 105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1 ≤ ai ≤ 104), the i-th number represents the i-th boy's playing skills.
1,500
On the first line print an integer x — the number of boys playing for the first team. On the second line print x integers — the individual numbers of boys playing for the first team. On the third line print an integer y — the number of boys playing for the second team, on the fourth line print y integers — the individu...
standard output
PASSED
41550cf35c34dfc6c5ded9716cf6b20a
train_000.jsonl
1328886000
Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Arra...
Java
["3\n1 2 1", "5\n2 3 3 1 1"]
1 second
["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"]
NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2 - 1| = 1 ≤ 1) is fulfilled...
Java 7
standard input
[ "sortings", "greedy", "math" ]
0937a7e2f912fc094cc4275fd47cd457
The first line contains the only integer n (2 ≤ n ≤ 105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1 ≤ ai ≤ 104), the i-th number represents the i-th boy's playing skills.
1,500
On the first line print an integer x — the number of boys playing for the first team. On the second line print x integers — the individual numbers of boys playing for the first team. On the third line print an integer y — the number of boys playing for the second team, on the fourth line print y integers — the individu...
standard output
PASSED
d8ae410e253d2550822455b8cd88d927
train_000.jsonl
1328886000
Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga...
256 megabytes
import java.awt.Point; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Comparator; public class DivisionintoTeams { public static void main(String[] args) throws NumberFormatException, IOException { Buffered...
Java
["3\n1 2 1", "5\n2 3 3 1 1"]
1 second
["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"]
NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2 - 1| = 1 ≤ 1) is fulfilled...
Java 7
standard input
[ "sortings", "greedy", "math" ]
0937a7e2f912fc094cc4275fd47cd457
The first line contains the only integer n (2 ≤ n ≤ 105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1 ≤ ai ≤ 104), the i-th number represents the i-th boy's playing skills.
1,500
On the first line print an integer x — the number of boys playing for the first team. On the second line print x integers — the individual numbers of boys playing for the first team. On the third line print an integer y — the number of boys playing for the second team, on the fourth line print y integers — the individu...
standard output
PASSED
a589ae3ab3b9cfb0b0e4c52472b957e7
train_000.jsonl
1328886000
Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; import java.math.BigInteger; import java.util.Map.Entry; import java.util.logging.Level; import java.util.logging.Logger; public class Main { static StringTokenizer st=new StringTokenizer(""); static BufferedReader br; ////////////////////////...
Java
["3\n1 2 1", "5\n2 3 3 1 1"]
1 second
["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"]
NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2 - 1| = 1 ≤ 1) is fulfilled...
Java 7
standard input
[ "sortings", "greedy", "math" ]
0937a7e2f912fc094cc4275fd47cd457
The first line contains the only integer n (2 ≤ n ≤ 105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1 ≤ ai ≤ 104), the i-th number represents the i-th boy's playing skills.
1,500
On the first line print an integer x — the number of boys playing for the first team. On the second line print x integers — the individual numbers of boys playing for the first team. On the third line print an integer y — the number of boys playing for the second team, on the fourth line print y integers — the individu...
standard output
PASSED
479203f3a0bcba08439f6dca37b89d1f
train_000.jsonl
1328886000
Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga...
256 megabytes
import java.util.*; import java.io.*; public class C149 implements Runnable { class Person implements Comparable<Person>{ int id; int p; public Person(int id, int p){ this.id = id; ...
Java
["3\n1 2 1", "5\n2 3 3 1 1"]
1 second
["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"]
NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2 - 1| = 1 ≤ 1) is fulfilled...
Java 7
standard input
[ "sortings", "greedy", "math" ]
0937a7e2f912fc094cc4275fd47cd457
The first line contains the only integer n (2 ≤ n ≤ 105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1 ≤ ai ≤ 104), the i-th number represents the i-th boy's playing skills.
1,500
On the first line print an integer x — the number of boys playing for the first team. On the second line print x integers — the individual numbers of boys playing for the first team. On the third line print an integer y — the number of boys playing for the second team, on the fourth line print y integers — the individu...
standard output
PASSED
879c4cd72e07c795d348b379c6d28075
train_000.jsonl
1328886000
Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class Division_into_Teams { /** * @param args * @throws IOException * @throws NumberFormatException */ public static void main(String[] args) throws ...
Java
["3\n1 2 1", "5\n2 3 3 1 1"]
1 second
["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"]
NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2 - 1| = 1 ≤ 1) is fulfilled...
Java 7
standard input
[ "sortings", "greedy", "math" ]
0937a7e2f912fc094cc4275fd47cd457
The first line contains the only integer n (2 ≤ n ≤ 105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1 ≤ ai ≤ 104), the i-th number represents the i-th boy's playing skills.
1,500
On the first line print an integer x — the number of boys playing for the first team. On the second line print x integers — the individual numbers of boys playing for the first team. On the third line print an integer y — the number of boys playing for the second team, on the fourth line print y integers — the individu...
standard output
PASSED
d648e7b722a5bfae3e89d7c9f47dc825
train_000.jsonl
1328886000
Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class Main{ // split de array public static int[] atoi(String cad) { String read[] = cad.split(" "); int res[] = new int[ read.length ]; for (int i = 0; i < read.length; i++) { res[i...
Java
["3\n1 2 1", "5\n2 3 3 1 1"]
1 second
["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"]
NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2 - 1| = 1 ≤ 1) is fulfilled...
Java 7
standard input
[ "sortings", "greedy", "math" ]
0937a7e2f912fc094cc4275fd47cd457
The first line contains the only integer n (2 ≤ n ≤ 105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1 ≤ ai ≤ 104), the i-th number represents the i-th boy's playing skills.
1,500
On the first line print an integer x — the number of boys playing for the first team. On the second line print x integers — the individual numbers of boys playing for the first team. On the third line print an integer y — the number of boys playing for the second team, on the fourth line print y integers — the individu...
standard output
PASSED
909e6af7c9bfcc4e7110cb9c1d0ec399
train_000.jsonl
1328886000
Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga...
256 megabytes
import java.util.List; import java.io.IOException; import java.io.OutputStreamWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.util.ArrayList; import java.util.Comparator; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Abstra...
Java
["3\n1 2 1", "5\n2 3 3 1 1"]
1 second
["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"]
NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2 - 1| = 1 ≤ 1) is fulfilled...
Java 7
standard input
[ "sortings", "greedy", "math" ]
0937a7e2f912fc094cc4275fd47cd457
The first line contains the only integer n (2 ≤ n ≤ 105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1 ≤ ai ≤ 104), the i-th number represents the i-th boy's playing skills.
1,500
On the first line print an integer x — the number of boys playing for the first team. On the second line print x integers — the individual numbers of boys playing for the first team. On the third line print an integer y — the number of boys playing for the second team, on the fourth line print y integers — the individu...
standard output
PASSED
2e33669caad4a108a7f3f7669620e4da
train_000.jsonl
1328886000
Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga...
256 megabytes
import java.awt.Point; import java.util.*; public class Main { public static void main (String [] args){ Scanner in = new Scanner(System.in); int n =in.nextInt(); Point sum1=new Point(0,0); Point sum2=new Point(0,0); Point array[]=new Point[n]; for(int i=0;i<n;i++){ array[i]=n...
Java
["3\n1 2 1", "5\n2 3 3 1 1"]
1 second
["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"]
NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2 - 1| = 1 ≤ 1) is fulfilled...
Java 7
standard input
[ "sortings", "greedy", "math" ]
0937a7e2f912fc094cc4275fd47cd457
The first line contains the only integer n (2 ≤ n ≤ 105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1 ≤ ai ≤ 104), the i-th number represents the i-th boy's playing skills.
1,500
On the first line print an integer x — the number of boys playing for the first team. On the second line print x integers — the individual numbers of boys playing for the first team. On the third line print an integer y — the number of boys playing for the second team, on the fourth line print y integers — the individu...
standard output
PASSED
4b2e141b6f1d4904a6da51ae06c88ae1
train_000.jsonl
1328886000
Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class Solution { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["3\n1 2 1", "5\n2 3 3 1 1"]
1 second
["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"]
NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2 - 1| = 1 ≤ 1) is fulfilled...
Java 7
standard input
[ "sortings", "greedy", "math" ]
0937a7e2f912fc094cc4275fd47cd457
The first line contains the only integer n (2 ≤ n ≤ 105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1 ≤ ai ≤ 104), the i-th number represents the i-th boy's playing skills.
1,500
On the first line print an integer x — the number of boys playing for the first team. On the second line print x integers — the individual numbers of boys playing for the first team. On the third line print an integer y — the number of boys playing for the second team, on the fourth line print y integers — the individu...
standard output
PASSED
7509c87416625da1f00e3f3a93f2d364
train_000.jsonl
1328886000
Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga...
256 megabytes
//package acc; import java.util.*; public class ACC { //************Main*****************// public static void main(String[] args) { Scanner in=new Scanner (System.in); int n=in.nextInt(); Pair[]arr=new Pair[n]; ...
Java
["3\n1 2 1", "5\n2 3 3 1 1"]
1 second
["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"]
NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2 - 1| = 1 ≤ 1) is fulfilled...
Java 7
standard input
[ "sortings", "greedy", "math" ]
0937a7e2f912fc094cc4275fd47cd457
The first line contains the only integer n (2 ≤ n ≤ 105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1 ≤ ai ≤ 104), the i-th number represents the i-th boy's playing skills.
1,500
On the first line print an integer x — the number of boys playing for the first team. On the second line print x integers — the individual numbers of boys playing for the first team. On the third line print an integer y — the number of boys playing for the second team, on the fourth line print y integers — the individu...
standard output
PASSED
a647a8fb7aa157ce1b24ba894025407b
train_000.jsonl
1328886000
Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).The key in football is to divide into teams fairly before the ga...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Comparator; import java.util.PriorityQueue; public class hals { static class node{ int val,ind; public node(int x,int y){ ind = x; val=y; } } static class comparer implements Comparator<node>{...
Java
["3\n1 2 1", "5\n2 3 3 1 1"]
1 second
["2\n1 2 \n1\n3", "3\n4 1 3 \n2\n5 2"]
NoteLet's consider the first sample test. There we send the first and the second boy to the first team and the third boy to the second team. Let's check all three conditions of a fair division. The first limitation is fulfilled (all boys play), the second limitation on the sizes of groups (|2 - 1| = 1 ≤ 1) is fulfilled...
Java 7
standard input
[ "sortings", "greedy", "math" ]
0937a7e2f912fc094cc4275fd47cd457
The first line contains the only integer n (2 ≤ n ≤ 105) which represents the number of guys in the yard. The next line contains n positive space-separated integers, ai (1 ≤ ai ≤ 104), the i-th number represents the i-th boy's playing skills.
1,500
On the first line print an integer x — the number of boys playing for the first team. On the second line print x integers — the individual numbers of boys playing for the first team. On the third line print an integer y — the number of boys playing for the second team, on the fourth line print y integers — the individu...
standard output
PASSED
87f133d83eebc6baf6f04501e2f8f73c
train_000.jsonl
1467219900
Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String number = in.readLine(); StringBu...
Java
["1", "10"]
1 second
["11", "1001"]
NoteThe first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
Java 8
standard input
[ "constructive algorithms", "math" ]
bcf75978c9ef6202293773cf533afadf
The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).
1,000
Print the n-th even-length palindrome number.
standard output
PASSED
fa031bc09946bfef5553375c7c3dedbc
train_000.jsonl
1467219900
Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String n = in.readLine(); StringBuild...
Java
["1", "10"]
1 second
["11", "1001"]
NoteThe first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
Java 8
standard input
[ "constructive algorithms", "math" ]
bcf75978c9ef6202293773cf533afadf
The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).
1,000
Print the n-th even-length palindrome number.
standard output
PASSED
2dccd31f9f5abf5355bfffe89adc60e5
train_000.jsonl
1467219900
Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { public static void main (String [] args) throws IOException { BufferedReader bf = new BufferedReader (new InputStreamReader(System.in));; ...
Java
["1", "10"]
1 second
["11", "1001"]
NoteThe first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
Java 8
standard input
[ "constructive algorithms", "math" ]
bcf75978c9ef6202293773cf533afadf
The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).
1,000
Print the n-th even-length palindrome number.
standard output
PASSED
5f7fad02ff25f096be899ab095d620b8
train_000.jsonl
1467219900
Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String number = in.readLine(); StringBui...
Java
["1", "10"]
1 second
["11", "1001"]
NoteThe first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
Java 8
standard input
[ "constructive algorithms", "math" ]
bcf75978c9ef6202293773cf533afadf
The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).
1,000
Print the n-th even-length palindrome number.
standard output
PASSED
620171a886de32511877e9ad01696ccb
train_000.jsonl
1467219900
Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome...
256 megabytes
import java.util.Scanner; public class ProbB { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String stuff = scan.nextLine(); stuff += new StringBuilder(stuff).reverse().toString(); System.out.println(stuff); } }
Java
["1", "10"]
1 second
["11", "1001"]
NoteThe first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
Java 8
standard input
[ "constructive algorithms", "math" ]
bcf75978c9ef6202293773cf533afadf
The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).
1,000
Print the n-th even-length palindrome number.
standard output
PASSED
413222c09ce6de63de4beae3fba2fd0f
train_000.jsonl
1467219900
Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome...
256 megabytes
import java.util.Scanner; public class palindrome { public static void main(String[] args) { // Scanner s = new Scanner(System.in); String input = s.nextLine(); StringBuilder pal = new StringBuilder(input); int i = 11; System.out.println(pal.toString() + "" + pal.reverse()); } }
Java
["1", "10"]
1 second
["11", "1001"]
NoteThe first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
Java 8
standard input
[ "constructive algorithms", "math" ]
bcf75978c9ef6202293773cf533afadf
The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).
1,000
Print the n-th even-length palindrome number.
standard output
PASSED
2fc4799368b79354469ed5258fdcebd3
train_000.jsonl
1467219900
Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome...
256 megabytes
import java.util.Scanner; public class palindrome { public static void main(String[] args) { Scanner s = new Scanner(System.in); String input = s.nextLine(); StringBuilder pal = new StringBuilder(input); int i = 11; System.out.println(pal.toString() + "" + pal.reverse()); } }
Java
["1", "10"]
1 second
["11", "1001"]
NoteThe first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
Java 8
standard input
[ "constructive algorithms", "math" ]
bcf75978c9ef6202293773cf533afadf
The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).
1,000
Print the n-th even-length palindrome number.
standard output
PASSED
2879656ec4819e9c2457d73a9cd56435
train_000.jsonl
1467219900
Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome...
256 megabytes
import java.util.*; public class EffectiveApproach { public static void main(String[] args) { Scanner sc = new Scanner(System.in); StringBuilder stringBuilder = new StringBuilder(sc.next()); StringBuilder reversedString = new StringBuilder(stringBuilder); reversedString.reverse();...
Java
["1", "10"]
1 second
["11", "1001"]
NoteThe first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
Java 8
standard input
[ "constructive algorithms", "math" ]
bcf75978c9ef6202293773cf533afadf
The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).
1,000
Print the n-th even-length palindrome number.
standard output
PASSED
ac9c6d9e420ce98291e825bb262465e2
train_000.jsonl
1467219900
Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome...
256 megabytes
import java.util.Scanner; public class JavaApplication1 { public static void main(String[] args) { Scanner a =new Scanner(System.in); String n = a.next(); System.out.print(n); for (int i = n.length()-1; i >=0; i--) { System.out.print(n.charAt(i)); } ...
Java
["1", "10"]
1 second
["11", "1001"]
NoteThe first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
Java 8
standard input
[ "constructive algorithms", "math" ]
bcf75978c9ef6202293773cf533afadf
The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).
1,000
Print the n-th even-length palindrome number.
standard output
PASSED
e7015b37833f992717f4ba395bdde919
train_000.jsonl
1467219900
Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String w = br.readLine(); if (w.length() =...
Java
["1", "10"]
1 second
["11", "1001"]
NoteThe first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
Java 8
standard input
[ "constructive algorithms", "math" ]
bcf75978c9ef6202293773cf533afadf
The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).
1,000
Print the n-th even-length palindrome number.
standard output
PASSED
1698fe7f09696f5b9b0594e03718f4dd
train_000.jsonl
1467219900
Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Scanner; public class _360_B_ { static String a; public static void readData() { BufferedReader br = new BufferedReader(new InputStreamRea...
Java
["1", "10"]
1 second
["11", "1001"]
NoteThe first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
Java 8
standard input
[ "constructive algorithms", "math" ]
bcf75978c9ef6202293773cf533afadf
The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).
1,000
Print the n-th even-length palindrome number.
standard output
PASSED
85eafcf5df79b858b3864babff6ed69e
train_000.jsonl
1467219900
Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome...
256 megabytes
import java.util.Scanner; public class Problem688B { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String n = sc.next(); System.out.println(n + "" + new StringBuilder(n).reverse().toString()); } }
Java
["1", "10"]
1 second
["11", "1001"]
NoteThe first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
Java 8
standard input
[ "constructive algorithms", "math" ]
bcf75978c9ef6202293773cf533afadf
The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).
1,000
Print the n-th even-length palindrome number.
standard output
PASSED
d1ac8b70f2955c2f082c256f78bc2ba5
train_000.jsonl
1467219900
Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome...
256 megabytes
import java.util.Scanner; /* <a href="https://codeforces.com/problemset/problem/688/B"/> */ public class Problem688B { public static void main(String[] args) { Scanner sc = new Scanner(System.in); StringBuilder number = new StringBuilder(sc.next()); //because it's mutable and strings are immut...
Java
["1", "10"]
1 second
["11", "1001"]
NoteThe first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
Java 8
standard input
[ "constructive algorithms", "math" ]
bcf75978c9ef6202293773cf533afadf
The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).
1,000
Print the n-th even-length palindrome number.
standard output
PASSED
38c76f558070801be31a4e87dc3f6ddc
train_000.jsonl
1467219900
Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome...
256 megabytes
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); String s2 = new StringBuilder(s).reverse().toString(); System.out.print(s); System.out.println(s2); sc.close(); } }
Java
["1", "10"]
1 second
["11", "1001"]
NoteThe first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
Java 8
standard input
[ "constructive algorithms", "math" ]
bcf75978c9ef6202293773cf533afadf
The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).
1,000
Print the n-th even-length palindrome number.
standard output
PASSED
5d09468baa2a54430e301732ff87b208
train_000.jsonl
1467219900
Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome...
256 megabytes
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); String s2 = s + new StringBuilder(s).reverse().toString(); System.out.println(s2); sc.close(); } }
Java
["1", "10"]
1 second
["11", "1001"]
NoteThe first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
Java 8
standard input
[ "constructive algorithms", "math" ]
bcf75978c9ef6202293773cf533afadf
The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).
1,000
Print the n-th even-length palindrome number.
standard output
PASSED
80cfd1d80e6ebf33b53d1ce4bf8d7251
train_000.jsonl
1467219900
Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome...
256 megabytes
import java.util.*; public class Main2 { public static void main(String[] args) { Scanner in = new Scanner(System.in); String s = in.nextLine(); String new1 = new StringBuilder(s).reverse().toString(); System.out.println(s + new1); } }
Java
["1", "10"]
1 second
["11", "1001"]
NoteThe first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
Java 8
standard input
[ "constructive algorithms", "math" ]
bcf75978c9ef6202293773cf533afadf
The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).
1,000
Print the n-th even-length palindrome number.
standard output
PASSED
0985632516095b49c7703354be7dbdac
train_000.jsonl
1467219900
Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class div360b { BufferedReader in; PrintWriter ob; StringTokenizer st; public static void main(String[] args) throws IOException { new div360b().run(); } void run() throws IOException { in=new BufferedReader(new InputStreamReader(System.in)); ...
Java
["1", "10"]
1 second
["11", "1001"]
NoteThe first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
Java 8
standard input
[ "constructive algorithms", "math" ]
bcf75978c9ef6202293773cf533afadf
The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).
1,000
Print the n-th even-length palindrome number.
standard output
PASSED
61a3248d62e870edb3fe3e6965b5d115
train_000.jsonl
1467219900
Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome...
256 megabytes
import java.util.Scanner; public class LovelyPalindromes { public static void main(String[] args) { Scanner input = new Scanner(System.in); String n = input.next(); String Output=""+n; StringBuilder sb=new StringBuilder(n); sb.reverse(); Output+=sb.toString(); // ...
Java
["1", "10"]
1 second
["11", "1001"]
NoteThe first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
Java 8
standard input
[ "constructive algorithms", "math" ]
bcf75978c9ef6202293773cf533afadf
The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).
1,000
Print the n-th even-length palindrome number.
standard output
PASSED
0916ea3aae9ebc52b244b1a4bfbefb21
train_000.jsonl
1467219900
Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome...
256 megabytes
import java.util.Scanner; /** * * @author Soroor */ public class JumpingBall { public static void main(String[] args) { Scanner input=new Scanner(System.in); String n=input.next(); String s=n+new StringBuilder(n).reverse().toString(); System.out.println(s); } }
Java
["1", "10"]
1 second
["11", "1001"]
NoteThe first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
Java 8
standard input
[ "constructive algorithms", "math" ]
bcf75978c9ef6202293773cf533afadf
The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).
1,000
Print the n-th even-length palindrome number.
standard output
PASSED
fad270799a82ffadcf3d0b08a6d4bfea
train_000.jsonl
1467219900
Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome...
256 megabytes
import java.util.*; public class lovely_palindrom { public static void main(String[]adasd) { Scanner sc=new Scanner(System.in); String s=sc.next(); System.out.print(s+""+new StringBuilder(s).reverse().toString()); } }
Java
["1", "10"]
1 second
["11", "1001"]
NoteThe first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
Java 8
standard input
[ "constructive algorithms", "math" ]
bcf75978c9ef6202293773cf533afadf
The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).
1,000
Print the n-th even-length palindrome number.
standard output
PASSED
6d5270eb356e9f316a8a63ef667ccd4f
train_000.jsonl
1467219900
Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome...
256 megabytes
import java.io.*; import java.util.InputMismatchException; public class CF688 { static String filePath = "/home/bishoy/IdeaProjects/Arabic competetive programming/src/b/test"; public static void main(String args[]) { InputReader inputReader = Helper.readInput(Helper.Input.STD, filePath); Outp...
Java
["1", "10"]
1 second
["11", "1001"]
NoteThe first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
Java 8
standard input
[ "constructive algorithms", "math" ]
bcf75978c9ef6202293773cf533afadf
The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).
1,000
Print the n-th even-length palindrome number.
standard output
PASSED
3256f6cf1ec90b72932139c24486d366
train_000.jsonl
1467219900
Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome...
256 megabytes
import java.io.*; import java.util.InputMismatchException; public class CF688 { static String filePath = "/home/bishoy/IdeaProjects/Arabic competetive programming/src/b/test"; public static void main(String args[]) { InputReader inputReader = Helper.readInput(Helper.Input.STD, filePath); Outp...
Java
["1", "10"]
1 second
["11", "1001"]
NoteThe first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
Java 8
standard input
[ "constructive algorithms", "math" ]
bcf75978c9ef6202293773cf533afadf
The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).
1,000
Print the n-th even-length palindrome number.
standard output
PASSED
8b7f7e5f6f150dcc482a65bb06427277
train_000.jsonl
1467219900
Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome...
256 megabytes
import java.io.*; import java.util.InputMismatchException; public class CF688 { static String filePath = "/home/bishoy/IdeaProjects/Arabic competetive programming/src/b/test"; public static void main(String args[]) { InputReader inputReader = Helper.readInput(Helper.Input.STD, filePath); Outp...
Java
["1", "10"]
1 second
["11", "1001"]
NoteThe first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
Java 8
standard input
[ "constructive algorithms", "math" ]
bcf75978c9ef6202293773cf533afadf
The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).
1,000
Print the n-th even-length palindrome number.
standard output
PASSED
fa8568667475ed4c9169ecb36e10c0c7
train_000.jsonl
1467219900
Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome...
256 megabytes
import java.util.*; import java.io.*; public class Lovely_Palindrome { public static void main(String args[]) throws Exception { BufferedReader f=new BufferedReader(new InputStreamReader(System.in)); String input=f.readLine(); StringBuilder a=new StringBuilder(input); System.out.println(input+a.reverse().toSt...
Java
["1", "10"]
1 second
["11", "1001"]
NoteThe first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
Java 8
standard input
[ "constructive algorithms", "math" ]
bcf75978c9ef6202293773cf533afadf
The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).
1,000
Print the n-th even-length palindrome number.
standard output
PASSED
44860fa99403c71360188fb3653e33ac
train_000.jsonl
1467219900
Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class C1Problem21 { public static void main(String[] args) throws IOException { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); String s = bf.readLine(); StringBuffer r = new StringBuff...
Java
["1", "10"]
1 second
["11", "1001"]
NoteThe first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
Java 8
standard input
[ "constructive algorithms", "math" ]
bcf75978c9ef6202293773cf533afadf
The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).
1,000
Print the n-th even-length palindrome number.
standard output
PASSED
8d9761444e079b45d8992c01fc85cc6b
train_000.jsonl
1467219900
Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in))); StringBuilder x = new StringBuilder(sc.next()); System.out.println(x.toString() + x.reverse(...
Java
["1", "10"]
1 second
["11", "1001"]
NoteThe first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
Java 8
standard input
[ "constructive algorithms", "math" ]
bcf75978c9ef6202293773cf533afadf
The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).
1,000
Print the n-th even-length palindrome number.
standard output
PASSED
e9004d7a8b6212a8026ab1c01a1265c6
train_000.jsonl
1467219900
Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome...
256 megabytes
import java.io.*; import java.util.*; public class cf{ public static void main(String args[]) { Scanner m=new Scanner(System.in); String n=m.next(); StringBuilder n2=new StringBuilder(n); n=n+n2.reverse().toString(); System.out.println(n); } }
Java
["1", "10"]
1 second
["11", "1001"]
NoteThe first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
Java 8
standard input
[ "constructive algorithms", "math" ]
bcf75978c9ef6202293773cf533afadf
The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).
1,000
Print the n-th even-length palindrome number.
standard output
PASSED
2f397765060c1c373bd0bf1287e2de68
train_000.jsonl
1467219900
Pari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.Pari is trying to love them too, but only very special and gifted people can understand the beauty behind palindrome...
256 megabytes
import java.util.Scanner; public class LOVELY_POLINDROME { public static void main(String[] args) { Scanner scn=new Scanner(System.in); String number=scn.nextLine(); String ans=""; ans+=number; //for(int i=number.length()-1;i>=0;i--) //ans+=number.charAt(i); StringBuilder input1=new StringBuilder(); inp...
Java
["1", "10"]
1 second
["11", "1001"]
NoteThe first 10 even-length palindrome numbers are 11, 22, 33, ... , 88, 99 and 1001.
Java 8
standard input
[ "constructive algorithms", "math" ]
bcf75978c9ef6202293773cf533afadf
The only line of the input contains a single integer n (1 ≤ n ≤ 10100 000).
1,000
Print the n-th even-length palindrome number.
standard output