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
39fba6199e49da8ef6c248d675f422f5
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; public class Main { static List<Integer> al[]; private static void solver(InputReader sc, PrintWriter out) { int n = sc.nextInt(); al = new ArrayList[n]; for(int i=0; i<n; i++) al[i] = new ArrayList<>(); List<P...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
a69532bb8158d3ddde3e71d7019eac86
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main { //static int p = 1000000007; static int p = 998244353; static int[] arr1, arr2, arr3, ans; static boolean fill(int u, int i) { if(arr1[u]==0) arr1[u]=i; else if(arr2[u]==0) arr2[u]=i; else { arr3[u]=i; ans[arr1[u]...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
358c7373a6f2bf34cf71d1f224a16d28
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.*; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; import java.util.Arrays; import java.util.List; import java.util.StringTokenizer; import java.util.fu...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
91468a970700d7c197b5dd90a7e89806
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.*; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.StringTo...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
438f6bad99701934663004dc61f9d6e5
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import java.util.*; public class MEX { public static void main(String args[]) { Scanner s = new Scanner(System.in); int n = s.nextInt(); Node[] nodes = new Node[n]; Edge[] edges = new Edge[n-1]; for (int i = 0; i < n; i++) { nodes[i] = new Node(i); } ...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
a138f43af41335fd5061dc38af0a4c96
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import java.io.*; import java.util.*; // tau is superior public class C { class Edge { int v, id; Edge(int vv, int ii) { v = vv; id = ii; } } int dfs(int u, int p) { int num = 1; for (Edge e : adj[u]) { if ...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
95e688a67bd9f74dcf16b5bc4f040c12
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String []args) throws IOException { FastScanner in = new FastScanner(System.in); PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false); solve(in, out); in.close(); o...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
9c39e8ad982754d27759994683aba73d
train_001.jsonl
1584196500
You are given a tree consisting of $$$n$$$ nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between $$$0$$$ and $$$n-2$$$ inclusive. All the written labels are distinct. The largest value among $$$MEX(u,v)$$$ over all pairs of nodes $$$(u,v)$...
256 megabytes
import java.util.*; import java.io.*; public class C628 { static long vals []; static long children []; static boolean visited []; static int parent []; static ArrayList <Integer> [] adj; static int n; public static void main(String [] args) { MyScanner sc = new MyScanner(); ...
Java
["3\n1 2\n1 3", "6\n1 2\n1 3\n2 4\n2 5\n5 6"]
1 second
["0\n1", "0\n3\n2\n4\n1"]
NoteThe tree from the second sample:
Java 11
standard input
[ "constructive algorithms", "greedy", "dfs and similar", "trees" ]
5ef966b7d9fbf27e6197b074eca31b15
The first line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of nodes in the tree. Each of the next $$$n-1$$$ lines contains two space-separated integers $$$u$$$ and $$$v$$$ ($$$1 \le u,v \le n$$$) that mean there's an edge between nodes $$$u$$$ and $$$v$$$. It's guaranteed that the given graph is ...
1,500
Output $$$n-1$$$ integers. The $$$i^{th}$$$ of them will be the number written on the $$$i^{th}$$$ edge (in the input order).
standard output
PASSED
ea7a5dbecda2501913d45f96a913318f
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
import java.io.*; import java.util.*; public class D { public static void main(String[] args) throws IOException { FastReader f=new FastReader(); StringBuffer sb = new StringBuffer(); int test=f.nextInt(); while(test-->0) { int n=f.nextInt(); int k=f.nextInt(); int mat[][]=new int[n][n];...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 8
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
3bd213a56be317370f1d066a333dd793
train_001.jsonl
1520696100
Alice likes snow a lot! Unfortunately, this year's winter is already over, and she can't expect to have any more of it. Bob has thus bought her a gift — a large snow maker. He plans to make some amount of snow every day. On day i he will make a pile of snow of volume Vi and put it in her garden.Each day, every pile wil...
256 megabytes
// practice with kaiboy import java.io.*; import java.util.*; public class CF948C extends PrintWriter { CF948C() { super(System.out, true); } Scanner sc = new Scanner(System.in); public static void main(String[] $) { CF948C o = new CF948C(); o.main(); o.flush(); } void main() { int n = sc.nextInt(); long[]...
Java
["3\n10 10 5\n5 7 2", "5\n30 25 20 15 10\n9 10 12 4 13"]
1 second
["5 12 4", "9 20 35 11 25"]
NoteIn the first sample, Bob first makes a snow pile of volume 10, which melts to the size of 5 on the same day. On the second day, he makes another pile of size 10. Since it is a bit warmer than the day before, the first pile disappears completely while the second pile shrinks to 3. At the end of the second day, he ha...
Java 11
standard input
[ "data structures", "binary search" ]
e3bc82acf70071b0e6d20a5b4fccbfba
The first line contains a single integer N (1 ≤ N ≤ 105) — the number of days. The second line contains N integers V1, V2, ..., VN (0 ≤ Vi ≤ 109), where Vi is the initial size of a snow pile made on the day i. The third line contains N integers T1, T2, ..., TN (0 ≤ Ti ≤ 109), where Ti is the temperature on the day i.
1,600
Output a single line with N integers, where the i-th integer represents the total volume of snow melted on day i.
standard output
PASSED
6b4e6ecb6d3d438084b4c9245dc7c4f1
train_001.jsonl
1520696100
Alice likes snow a lot! Unfortunately, this year's winter is already over, and she can't expect to have any more of it. Bob has thus bought her a gift — a large snow maker. He plans to make some amount of snow every day. On day i he will make a pile of snow of volume Vi and put it in her garden.Each day, every pile wil...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class d { static BufferedReader s = new BufferedReader(new InputStreamReader(System.in));; public static void main(String[] args) throws IOException { StringBuilder sb = new StringBu...
Java
["3\n10 10 5\n5 7 2", "5\n30 25 20 15 10\n9 10 12 4 13"]
1 second
["5 12 4", "9 20 35 11 25"]
NoteIn the first sample, Bob first makes a snow pile of volume 10, which melts to the size of 5 on the same day. On the second day, he makes another pile of size 10. Since it is a bit warmer than the day before, the first pile disappears completely while the second pile shrinks to 3. At the end of the second day, he ha...
Java 11
standard input
[ "data structures", "binary search" ]
e3bc82acf70071b0e6d20a5b4fccbfba
The first line contains a single integer N (1 ≤ N ≤ 105) — the number of days. The second line contains N integers V1, V2, ..., VN (0 ≤ Vi ≤ 109), where Vi is the initial size of a snow pile made on the day i. The third line contains N integers T1, T2, ..., TN (0 ≤ Ti ≤ 109), where Ti is the temperature on the day i.
1,600
Output a single line with N integers, where the i-th integer represents the total volume of snow melted on day i.
standard output
PASSED
845c5de01fd309a598af8a96ecc372bd
train_001.jsonl
1374679800
Insurgents accidentally got hold of the plan of a top secret research polygon created on a distant planet for the needs of the Galaxy Empire. The insurgents suppose that this polygon is developing new deadly weapon. The polygon consists of n missile silos connected by bidirectional underground passages. The passages ar...
256 megabytes
import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.Comparator; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.io.IOException; import java.util.Arrays; import java.util.InputMismatchException; import java.util.NoSuchElementException; import jav...
Java
["6 1\n-1 -1 -1 8 -1\n-1 5 -1 -1\n-1 -1 3\n-1 -1\n-1", "3 2\n10 0\n11"]
3 seconds
["5", "14"]
NoteIn the first sample there are 6 one-element sets of silos. For sets {1}, {5} the operation danger will equal 8, for sets {3}, {6} — 3, for sets {2}, {4} — 5. The mathematical average equals .In the second sample there are 3 two-elements sets of silos: {1, 3} (danger equals 21), {1, 2} (danger equals 11), {2, 3} (da...
Java 7
standard input
[ "math", "graphs" ]
48b232b9d836b0be91d41e548a9fcefc
The first line contains two integers n and k (2 ≤ n ≤ 2000, 1 ≤ k ≤ n - 1) — the number of silos and the number of scout groups, correspondingly. The next n - 1 lines describe the polygon plan: the i-th of these lines contains n - i integers ci, i + 1, ci, i + 2, ..., ci, n — the number of droids that patrol the corres...
2,400
Print the average danger of the scouting operation, rounded down to an integer. Note that at the given limits the answer to the problem always fits into the standard integer 64-bit data type. Please do not use the %lld specifier to write 64-bit integers in С++. It is preferred to use the cout stream or the %I64d specif...
standard output
PASSED
7a69f1984f8e76d3cc51312b8891ec2c
train_001.jsonl
1374679800
Insurgents accidentally got hold of the plan of a top secret research polygon created on a distant planet for the needs of the Galaxy Empire. The insurgents suppose that this polygon is developing new deadly weapon. The polygon consists of n missile silos connected by bidirectional underground passages. The passages ar...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.InputMismatchException; /** * @author pvasilyev * @date 7/27/13 */ public class MainD { public static final String FILE_IN = "std.in"; public static final String FILE_OUT = "std.out"; private static boolean debugMode = true; public st...
Java
["6 1\n-1 -1 -1 8 -1\n-1 5 -1 -1\n-1 -1 3\n-1 -1\n-1", "3 2\n10 0\n11"]
3 seconds
["5", "14"]
NoteIn the first sample there are 6 one-element sets of silos. For sets {1}, {5} the operation danger will equal 8, for sets {3}, {6} — 3, for sets {2}, {4} — 5. The mathematical average equals .In the second sample there are 3 two-elements sets of silos: {1, 3} (danger equals 21), {1, 2} (danger equals 11), {2, 3} (da...
Java 7
standard input
[ "math", "graphs" ]
48b232b9d836b0be91d41e548a9fcefc
The first line contains two integers n and k (2 ≤ n ≤ 2000, 1 ≤ k ≤ n - 1) — the number of silos and the number of scout groups, correspondingly. The next n - 1 lines describe the polygon plan: the i-th of these lines contains n - i integers ci, i + 1, ci, i + 2, ..., ci, n — the number of droids that patrol the corres...
2,400
Print the average danger of the scouting operation, rounded down to an integer. Note that at the given limits the answer to the problem always fits into the standard integer 64-bit data type. Please do not use the %lld specifier to write 64-bit integers in С++. It is preferred to use the cout stream or the %I64d specif...
standard output
PASSED
a5874be18c4ff225f5cf0437b01d8782
train_001.jsonl
1374679800
Insurgents accidentally got hold of the plan of a top secret research polygon created on a distant planet for the needs of the Galaxy Empire. The insurgents suppose that this polygon is developing new deadly weapon. The polygon consists of n missile silos connected by bidirectional underground passages. The passages ar...
256 megabytes
import java.io.*; import java.util.*; /** * @author pvasilyev * @date 7/25/13 */ public class ProblemD { public static final String FILE_IN = "std.in"; public static final String FILE_OUT = "std.out"; private static boolean debugMode = true; public static void main(String[] args) throws IOException...
Java
["6 1\n-1 -1 -1 8 -1\n-1 5 -1 -1\n-1 -1 3\n-1 -1\n-1", "3 2\n10 0\n11"]
3 seconds
["5", "14"]
NoteIn the first sample there are 6 one-element sets of silos. For sets {1}, {5} the operation danger will equal 8, for sets {3}, {6} — 3, for sets {2}, {4} — 5. The mathematical average equals .In the second sample there are 3 two-elements sets of silos: {1, 3} (danger equals 21), {1, 2} (danger equals 11), {2, 3} (da...
Java 7
standard input
[ "math", "graphs" ]
48b232b9d836b0be91d41e548a9fcefc
The first line contains two integers n and k (2 ≤ n ≤ 2000, 1 ≤ k ≤ n - 1) — the number of silos and the number of scout groups, correspondingly. The next n - 1 lines describe the polygon plan: the i-th of these lines contains n - i integers ci, i + 1, ci, i + 2, ..., ci, n — the number of droids that patrol the corres...
2,400
Print the average danger of the scouting operation, rounded down to an integer. Note that at the given limits the answer to the problem always fits into the standard integer 64-bit data type. Please do not use the %lld specifier to write 64-bit integers in С++. It is preferred to use the cout stream or the %I64d specif...
standard output
PASSED
ea457544f4039000ad5403609af28316
train_001.jsonl
1374679800
Insurgents accidentally got hold of the plan of a top secret research polygon created on a distant planet for the needs of the Galaxy Empire. The insurgents suppose that this polygon is developing new deadly weapon. The polygon consists of n missile silos connected by bidirectional underground passages. The passages ar...
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.util.StringTokenizer; public class Round_193_D { public static void main(String[] args) { FastS...
Java
["6 1\n-1 -1 -1 8 -1\n-1 5 -1 -1\n-1 -1 3\n-1 -1\n-1", "3 2\n10 0\n11"]
3 seconds
["5", "14"]
NoteIn the first sample there are 6 one-element sets of silos. For sets {1}, {5} the operation danger will equal 8, for sets {3}, {6} — 3, for sets {2}, {4} — 5. The mathematical average equals .In the second sample there are 3 two-elements sets of silos: {1, 3} (danger equals 21), {1, 2} (danger equals 11), {2, 3} (da...
Java 7
standard input
[ "math", "graphs" ]
48b232b9d836b0be91d41e548a9fcefc
The first line contains two integers n and k (2 ≤ n ≤ 2000, 1 ≤ k ≤ n - 1) — the number of silos and the number of scout groups, correspondingly. The next n - 1 lines describe the polygon plan: the i-th of these lines contains n - i integers ci, i + 1, ci, i + 2, ..., ci, n — the number of droids that patrol the corres...
2,400
Print the average danger of the scouting operation, rounded down to an integer. Note that at the given limits the answer to the problem always fits into the standard integer 64-bit data type. Please do not use the %lld specifier to write 64-bit integers in С++. It is preferred to use the cout stream or the %I64d specif...
standard output
PASSED
766c652ae8317dba4d7da8c8955705f8
train_001.jsonl
1374679800
Insurgents accidentally got hold of the plan of a top secret research polygon created on a distant planet for the needs of the Galaxy Empire. The insurgents suppose that this polygon is developing new deadly weapon. The polygon consists of n missile silos connected by bidirectional underground passages. The passages ar...
256 megabytes
//package cf.train; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.Arrays; import java.util.Comparator; import java.util.PriorityQueue; import java.util.Queue; public class PrD { BufferedReader ...
Java
["6 1\n-1 -1 -1 8 -1\n-1 5 -1 -1\n-1 -1 3\n-1 -1\n-1", "3 2\n10 0\n11"]
3 seconds
["5", "14"]
NoteIn the first sample there are 6 one-element sets of silos. For sets {1}, {5} the operation danger will equal 8, for sets {3}, {6} — 3, for sets {2}, {4} — 5. The mathematical average equals .In the second sample there are 3 two-elements sets of silos: {1, 3} (danger equals 21), {1, 2} (danger equals 11), {2, 3} (da...
Java 7
standard input
[ "math", "graphs" ]
48b232b9d836b0be91d41e548a9fcefc
The first line contains two integers n and k (2 ≤ n ≤ 2000, 1 ≤ k ≤ n - 1) — the number of silos and the number of scout groups, correspondingly. The next n - 1 lines describe the polygon plan: the i-th of these lines contains n - i integers ci, i + 1, ci, i + 2, ..., ci, n — the number of droids that patrol the corres...
2,400
Print the average danger of the scouting operation, rounded down to an integer. Note that at the given limits the answer to the problem always fits into the standard integer 64-bit data type. Please do not use the %lld specifier to write 64-bit integers in С++. It is preferred to use the cout stream or the %I64d specif...
standard output
PASSED
77356331bd98d4a054fe17b83c16cbff
train_001.jsonl
1374679800
Insurgents accidentally got hold of the plan of a top secret research polygon created on a distant planet for the needs of the Galaxy Empire. The insurgents suppose that this polygon is developing new deadly weapon. The polygon consists of n missile silos connected by bidirectional underground passages. The passages ar...
256 megabytes
import java.io.*; import java.util.*; public class D { static final double EPS = 1e-7; BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof; void solve() throws IOException { int n = nextInt(); int k = nextInt(); int[][] c = new int[n][n]; for (int i = 0; i < n; i++) { c[i][i] = -1; ...
Java
["6 1\n-1 -1 -1 8 -1\n-1 5 -1 -1\n-1 -1 3\n-1 -1\n-1", "3 2\n10 0\n11"]
3 seconds
["5", "14"]
NoteIn the first sample there are 6 one-element sets of silos. For sets {1}, {5} the operation danger will equal 8, for sets {3}, {6} — 3, for sets {2}, {4} — 5. The mathematical average equals .In the second sample there are 3 two-elements sets of silos: {1, 3} (danger equals 21), {1, 2} (danger equals 11), {2, 3} (da...
Java 7
standard input
[ "math", "graphs" ]
48b232b9d836b0be91d41e548a9fcefc
The first line contains two integers n and k (2 ≤ n ≤ 2000, 1 ≤ k ≤ n - 1) — the number of silos and the number of scout groups, correspondingly. The next n - 1 lines describe the polygon plan: the i-th of these lines contains n - i integers ci, i + 1, ci, i + 2, ..., ci, n — the number of droids that patrol the corres...
2,400
Print the average danger of the scouting operation, rounded down to an integer. Note that at the given limits the answer to the problem always fits into the standard integer 64-bit data type. Please do not use the %lld specifier to write 64-bit integers in С++. It is preferred to use the cout stream or the %I64d specif...
standard output
PASSED
81f0922fbf91c5416a4d0324afe64f22
train_001.jsonl
1374679800
Insurgents accidentally got hold of the plan of a top secret research polygon created on a distant planet for the needs of the Galaxy Empire. The insurgents suppose that this polygon is developing new deadly weapon. The polygon consists of n missile silos connected by bidirectional underground passages. The passages ar...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Zad4 { public static void main(String... args) throws IOException { MyScanner sc = new MyScanner(); int n = sc.nextInt(); int k = sc.nextInt(); ...
Java
["6 1\n-1 -1 -1 8 -1\n-1 5 -1 -1\n-1 -1 3\n-1 -1\n-1", "3 2\n10 0\n11"]
3 seconds
["5", "14"]
NoteIn the first sample there are 6 one-element sets of silos. For sets {1}, {5} the operation danger will equal 8, for sets {3}, {6} — 3, for sets {2}, {4} — 5. The mathematical average equals .In the second sample there are 3 two-elements sets of silos: {1, 3} (danger equals 21), {1, 2} (danger equals 11), {2, 3} (da...
Java 7
standard input
[ "math", "graphs" ]
48b232b9d836b0be91d41e548a9fcefc
The first line contains two integers n and k (2 ≤ n ≤ 2000, 1 ≤ k ≤ n - 1) — the number of silos and the number of scout groups, correspondingly. The next n - 1 lines describe the polygon plan: the i-th of these lines contains n - i integers ci, i + 1, ci, i + 2, ..., ci, n — the number of droids that patrol the corres...
2,400
Print the average danger of the scouting operation, rounded down to an integer. Note that at the given limits the answer to the problem always fits into the standard integer 64-bit data type. Please do not use the %lld specifier to write 64-bit integers in С++. It is preferred to use the cout stream or the %I64d specif...
standard output
PASSED
4090197e49f9a444174bc58ff4e08bc8
train_001.jsonl
1374679800
Insurgents accidentally got hold of the plan of a top secret research polygon created on a distant planet for the needs of the Galaxy Empire. The insurgents suppose that this polygon is developing new deadly weapon. The polygon consists of n missile silos connected by bidirectional underground passages. The passages ar...
256 megabytes
import java.io.BufferedReader; import java.io.OutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.Reader; import java.math.BigInteger; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main...
Java
["6 1\n-1 -1 -1 8 -1\n-1 5 -1 -1\n-1 -1 3\n-1 -1\n-1", "3 2\n10 0\n11"]
3 seconds
["5", "14"]
NoteIn the first sample there are 6 one-element sets of silos. For sets {1}, {5} the operation danger will equal 8, for sets {3}, {6} — 3, for sets {2}, {4} — 5. The mathematical average equals .In the second sample there are 3 two-elements sets of silos: {1, 3} (danger equals 21), {1, 2} (danger equals 11), {2, 3} (da...
Java 7
standard input
[ "math", "graphs" ]
48b232b9d836b0be91d41e548a9fcefc
The first line contains two integers n and k (2 ≤ n ≤ 2000, 1 ≤ k ≤ n - 1) — the number of silos and the number of scout groups, correspondingly. The next n - 1 lines describe the polygon plan: the i-th of these lines contains n - i integers ci, i + 1, ci, i + 2, ..., ci, n — the number of droids that patrol the corres...
2,400
Print the average danger of the scouting operation, rounded down to an integer. Note that at the given limits the answer to the problem always fits into the standard integer 64-bit data type. Please do not use the %lld specifier to write 64-bit integers in С++. It is preferred to use the cout stream or the %I64d specif...
standard output
PASSED
bd2758c3b0c75ac432c3d5fca8891032
train_001.jsonl
1374679800
Insurgents accidentally got hold of the plan of a top secret research polygon created on a distant planet for the needs of the Galaxy Empire. The insurgents suppose that this polygon is developing new deadly weapon. The polygon consists of n missile silos connected by bidirectional underground passages. The passages ar...
256 megabytes
/* Codeforces Template */ import java.io.*; import java.math.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.fill; import static java.util.Arrays.binarySearch; import static java.util.Arrays.sort; public class Main { static long initTime; static final Random rnd = new Random...
Java
["6 1\n-1 -1 -1 8 -1\n-1 5 -1 -1\n-1 -1 3\n-1 -1\n-1", "3 2\n10 0\n11"]
3 seconds
["5", "14"]
NoteIn the first sample there are 6 one-element sets of silos. For sets {1}, {5} the operation danger will equal 8, for sets {3}, {6} — 3, for sets {2}, {4} — 5. The mathematical average equals .In the second sample there are 3 two-elements sets of silos: {1, 3} (danger equals 21), {1, 2} (danger equals 11), {2, 3} (da...
Java 7
standard input
[ "math", "graphs" ]
48b232b9d836b0be91d41e548a9fcefc
The first line contains two integers n and k (2 ≤ n ≤ 2000, 1 ≤ k ≤ n - 1) — the number of silos and the number of scout groups, correspondingly. The next n - 1 lines describe the polygon plan: the i-th of these lines contains n - i integers ci, i + 1, ci, i + 2, ..., ci, n — the number of droids that patrol the corres...
2,400
Print the average danger of the scouting operation, rounded down to an integer. Note that at the given limits the answer to the problem always fits into the standard integer 64-bit data type. Please do not use the %lld specifier to write 64-bit integers in С++. It is preferred to use the cout stream or the %I64d specif...
standard output
PASSED
c74ce0f00c8fca2794cf5f6363a7ba79
train_001.jsonl
1374679800
Reforms continue entering Berland. For example, during yesterday sitting the Berland Parliament approved as much as n laws (each law has been assigned a unique number from 1 to n). Today all these laws were put on the table of the President of Berland, G.W. Boosch, to be signed.This time mr. Boosch plans to sign 2k law...
256 megabytes
import java.util.*; import java.io.*; public class Main { static class Scan { private byte[] buf=new byte[1024]; private int index; private InputStream in; private int total; public Scan() { in=System.in; } public int scan()throws IOExcepti...
Java
["5 2\n3 6 1 1 6", "6 2\n1 1 1 1 1 1"]
2 seconds
["1 4", "1 3"]
NoteIn the first sample mr. Boosch signs laws with numbers from segments [1;2] and [4;5]. The total absurdity of the signed laws equals 3 + 6 + 1 + 6 = 16.In the second sample mr. Boosch signs laws with numbers from segments [1;2] and [3;4]. The total absurdity of the signed laws equals 1 + 1 + 1 + 1 = 4.
Java 11
standard input
[ "dp", "implementation", "data structures" ]
74095fe82bd22257eeb97e1caf586499
The first line contains two integers n and k (2 ≤ n ≤ 2·105, 0 &lt; 2k ≤ n) — the number of laws accepted by the parliament and the length of one segment in the law list, correspondingly. The next line contains n integers x1, x2, ..., xn — the absurdity of each law (1 ≤ xi ≤ 109).
1,500
Print two integers a, b — the beginning of segments that mr. Boosch should choose. That means that the president signs laws with numbers from segments [a; a + k - 1] and [b; b + k - 1]. If there are multiple solutions, print the one with the minimum number a. If there still are multiple solutions, print the one with th...
standard output
PASSED
cbd5a9ef7d0f70e3e39f1cdbe809d6d1
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); int TT = Integer.parseInt(in.readLine()); int currTT = 0; ...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
4ca6bcb815be4e8a2755c2fa867c78e8
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { new Thread(null, new Runnable() { public void run() { solve(); } ...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
1e7fd307688850e4d358efb3e2f359dd
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
/* [ ( ^ _ ^ ) ] */ // problem: cf/1337/D import java.io.*; import java.util.*; public class d { int INF = (int)1e9; long MOD = 1000000007; long sq(long n) { return n*n; } long min(long a, long b) {return a<=b?a:b;} long min(long a, long b, long c) {return min(a, min(b, c));} ...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
4cb0a41ae92d8ef41c535df57b64c0ef
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class codechef { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
a091e473f3d34b6cdf3e75cac912647d
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int h=0;h<t;h++) { int r=sc.nextInt(); int g=sc.nextInt(); int b=sc.nextInt(); long ra[]=new long[r]; long ga[]=new long[g]; long ba[]=...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
1c86eb75ce1b1038b48cd904010b941c
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.util.Arrays; import java.util.Scanner; import java.util.TreeSet; import java.util.concurrent.atomic.AtomicLong; /** * created at 18/04/20 4:11 PM */ public class P1337D { public static void main(String[] args) { Scanner input = new Scanner(System.in); int tests = input.nextInt(); while (...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
fbad23e582e3f7f550992bc3d3d56dcf
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.util.*; public class C635_PD { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner(System.in); int t = in.nextInt(); while(t-->0) { int na = in.nextInt(); int nb = in.nextInt(); int nc = in.nextInt(); TreeSet<Integer> a = new TreeSe...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
9d947c772a544d4efb6221d94561337f
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.awt.*; import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { FastReader sc = new FastReader(); StringBuilder sb=new StringBuilder(); int t=sc.nextInt(); while(t-->0){ int r=sc.nextInt(),g=sc.nextIn...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
f6ebb952cca6dbc1d7004861a00804d1
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.awt.*; import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { FastReader sc = new FastReader(); StringBuilder sb=new StringBuilder(); int t=sc.nextInt(); while(t-->0){ int r=sc.nextInt(),g=sc.nextIn...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
527a00af1dc3f9c48e73369be0ccd443
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.util.*; public class xenia2{ public static void main(String[] args) { Scanner scan = new Scanner(System.in); int test = scan.nextInt(); while(test-->0){ int r = scan.nextInt(); int g = scan.nextInt(); int b = scan.nextInt(); long r...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
354406fd11c4f59427f8958cd1d220d3
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
//package CodeForces; import java.math.BigInteger; import java.util.Iterator; import java.util.Scanner; import java.util.TreeSet; public class Solution4 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); for (int t = 0; t < T; t++) { int nr = sc.nextInt(); ...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
9ad64e0834ead38e269c11feca32b559
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
//ARNAV KUMAR MANDAL// //XYPHER// import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.text.DecimalFormat; import java.util.*; import java.util.concurrent.ConcurrentH...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
152cf84fcc02f65564aebe618f07c061
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.util.*; import java.io.*; public class Q3Div3 { static Long ans; private static void meth(TreeSet<Long> r,TreeSet<Long> b,TreeSet<Long> g) { Iterator<Long> iterator=b.iterator(); while (iterator.hasNext()) { Long val=iterator.next(); Long temp1=r.ceiling(val); Long temp2=g.floor(val); ...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
f1c85a70af3b9538a8b9e493b988d5f2
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.io.*; import java.util.*; public class CodeForce { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine()); while (t-- > 0) { String[] str = br.re...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
cefb5e0ca3ecc6783a439f60b2e48f41
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; import java.lang.*; public class Main implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private SpaceCharFilte...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
58e765f3b24f6ed05d3a617630963836
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); StringBuilder ans = new StringBuilder(); int t = sc.nextInt(); while (t-- > 0) { int nr = sc.nextInt(); int ng = sc.nextInt(); ...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
594f95602f7ef22b999f6bb141e8bfeb
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.util.*; import java.io.*; public class gems{ public static void main(String[] main) throws Exception{ BufferedReader b = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(b.readLine()); int t = Integer.parseInt(st.nextToken()); for(int ...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
fed6c1d638bcc434cfb42b3e8cc8339a
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
//import com.sun.org.apache.xpath.internal.operations.String; //import com.sun.org.apache.xpath.internal.operations.String; import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; import java.math.RoundingMode; import java.util.*; import java.util.concurrent.LinkedBlockingDeque; public cla...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
40b17529308ceea5a42d463d389b6a0d
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
// package Div2635; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.StringTokenizer; public class ProblemD { public static void main(String[] args)throws IOException { ...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
8312eda7e16011241fdf163c50ad2bae
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class D { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader file = new BufferedRe...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
7ba660b9b1a8dcc7581f47130753a775
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.InputMismatchException; import java.util.*; import java.io.*; import java.lang.*; public class Main{ public static class InputReader { private InputStream stream; ...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
3926264b078c186939b0b8613245eeac
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.awt.*; import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { FastReader sc = new FastReader(); StringBuilder sb=new StringBuilder(); int t=sc.nextInt(); while(t-->0){ int r=sc.nextInt(),g=sc.nextIn...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
9475ae4833024496121779e5d9c57373
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.util.*; import java.io.*; public class Main{ static class InputReader { private final InputStream stream; private final byte[] buf = new byte[8192]; private int curChar, snumChars; private SpaceCharFilter filter; public InputReader(InputStream stream) { ...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
5a7e8043be911f93a890c729f505becd
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class ProblemD { public static void main(String[] args) { Scanner scn=new Scanner(System.in); int T=scn.nextInt(); for(int t=0;t<T;t++){ int Nr=scn.nextInt(); int Ng=scn.nextInt(); int Nb=scn.next...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
5cddec93638eac144ae2a87d9084f14c
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.util.*; import java.io.*; public class D { public static void main(String[] args) throws IOException{ BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); int t = Integer.parseInt(f.readLi...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
a007fb81225b5755ee605dc1e46f7549
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
//package learning; import java.util.*; import java.io.*; import java.lang.*; import java.text.*; import java.math.*; import java.util.regex.*; public class NitsLocal { static ArrayList<String> s1; static boolean[] prime; static int n = (int)1e7; static void sieve() { Arrays.fill(prime , true); pr...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
e288529ef5a7dbecf5e83d0d0fe37549
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import javax.print.DocFlavor; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.util.TreeSet; public class NifflerD { static long ans = Long.MAX_VALUE; public static void main(String[] args) thro...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
22857078532d11385caffbfcad1f6133
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class BufferReader{ static int dp[]; static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() {...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
9fdc62e090d887b9fa6652ab800e308c
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
//package practice.codeforce.round_635.problem4; import java.io.*; import java.math.BigInteger; import java.util.Arrays; import java.util.InputMismatchException; import java.util.Scanner; public class Solution { class Solver { public void solve(InputReader in, OutputWriter out) { int t = in.re...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
507e0a243d20fc780125043b10cacb95
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; import java.math.BigInteger; public class Main { InputReader in; Printer out; ArrayList<Integer>[] tree; long[] height; long[] subtreeCount; long[] res; boolean[] mark; private void start() throws Exception { // ...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
d59447d8e13f938eeb6dc564347405b7
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class D { public static void main(String[] args) throws IOException { Reader scn = new Reader(); int t = scn.nextInt(); StringBuilder sb = new StringBuilder(); D: while (t-- > 0) { int nr = scn.nextInt(); int ng = scn.nextInt(); int nb...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
790288f33bbb034b6737ef259f811753
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
// package Round_635; import java.io.*; import java.math.BigInteger; import java.util.*; public class Xenia_Colorful { public static void main(String[] args) { FastReader in = new FastReader(); int numTrials = in.nextInt(); while(numTrials --> 0) { int r = in.nextInt...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
8bbc6b788138ca2797f4e3ff1045784a
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import jdk.nashorn.internal.runtime.linker.LinkerCallSite; import java.io.*; import java.lang.reflect.Array; import java.util.*; public class D { public static void main(String[] args) throws IOException { PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); InputReader re=new In...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
17abf077964e5b76db52cf2b1495fb0d
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.util.*; import java.io.*; public class Solution{ public static void main (String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); PrintWriter out=new PrintWriter(System.out); String[] temp=br.readLine().trim().split(" "); int numTestCases=Integ...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
b67b63bc8d9405fc23a4e7c769306f5c
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class D { public static void main (String[] args) throws java.lang.Exception { new Solution(); } } class Solution { Reader reader; PrintWriter out; public Solution() { reader = new Reader(); out = new PrintWriter(System.out); int t = reader....
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
60dc371f3a984bf894eebeef987deb55
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.awt.Font; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class D { public static long f(long x,long y,long z) { return (x-y)*(x-y)+(x-z)*(x-...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
eb8b289d0cf04e55f4e9fae931194503
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintStream; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.StringTokenizer; public class D2 { static long[] first; static long[] second; static long...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
b14bc675f6f5140252545461a5bbaa87
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; import java.util.TreeSet; public class r635d { public static void main(String[] args) { FastScanner scan=new FastScanner(); int t=scan.nextInt(); for(int tt=0;t...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
af93a25fb713e3a3f791b64baa925314
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
b67e8880cd0fa3cc54a2e89e8394c1ac
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.util.*; import java.io.*; public class R633D2D { public static void main(String[] args) throws Exception{ int num = 998244353; // TODO Auto-generated method stub BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(bf.readLine()); for(int i = ...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
e82ab624b9764a8976ef8b5186e4a94e
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
/* / フフ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ム / )\⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ Y (⠀⠀| ( ͡° ͜ʖ ͡°)⠀⌒(⠀ ノ (⠀ ノ⌒ Y ⌒ヽ-く __/ | _⠀。ノ| ノ。 |/ (⠀ー '_人`ー ノ ⠀|\  ̄ _人'彡ノ ⠀ )\⠀⠀ 。⠀⠀ / ⠀⠀(\⠀ #⠀ / ⠀/⠀⠀⠀/ὣ====================D- /⠀⠀⠀/⠀ \ \⠀⠀\ ( (⠀)⠀⠀⠀⠀ ) ).⠀) (⠀⠀)⠀⠀⠀⠀⠀( | / |⠀ /⠀⠀⠀⠀⠀⠀ | / [_] ⠀⠀⠀⠀⠀[___] */ // Main Code at th...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
68330075a7b588e90b35052ea5254347
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; public class D { public static void main(String []args) throws Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String input; String []splited; int q,n,m,t; int []arr,arr1,arr2; i...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
103d5b3f30d7f621672c2deff19ea890
train_001.jsonl
1586961300
Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought $$$n_r$$$ red gems, $$$n_g$$$ green gems and $$$n_b$$$ blue gems. Each of the gems has a weight.Now, she is going to pick three gems.Xenia loves colorful thin...
256 megabytes
//package codeforces.round635div2; import java.io.*; import java.util.*; public class CF635D { public static void main(String[] args) { // try { // FastScanner in = new FastScanner(new FileInputStream("src/input.in")); // PrintWriter out = new PrintWriter(new FileOutputStream("src/out...
Java
["5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n1 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n6"]
3 seconds
["14\n1999999996000000002\n24\n24\n14"]
NoteIn the first test case, Xenia has the following gems:If she picks the red gem with weight $$$7$$$, the green gem with weight $$$6$$$, and the blue gem with weight $$$4$$$, she will achieve the most balanced selection with $$$(x-y)^2+(y-z)^2+(z-x)^2=(7-6)^2+(6-4)^2+(4-7)^2=14$$$.
Java 8
standard input
[ "math", "implementation", "sortings", "data structures", "binary search" ]
79b58eb781cd73ccf7994866b9a8b695
The first line contains a single integer $$$t$$$ ($$$1\le t \le 100$$$)  — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains three integers $$$n_r,n_g,n_b$$$ ($$$1\le n_r,n_g,n_b\le 10^5$$$)  — the number of red gems, green gems and blue gems respectively. The second li...
1,700
For each test case, print a line contains one integer  — the minimum value which Xenia wants to find.
standard output
PASSED
6ae237ac03e6dc5659f086a3b3336e3d
train_001.jsonl
1517403900
Suppose that you are in a campus and have to go for classes day by day. As you may see, when you hurry to a classroom, you surprisingly find that many seats there are already occupied. Today you and your friends went for class, and found out that some of the seats were occupied.The classroom contains $$$n$$$ rows of se...
256 megabytes
import java.io.*; import java.util.*; import java.nio.charset.StandardCharsets; // import java.math.BigInteger; public class C { static Writer wr; public static void main(String[] args) throws Exception { // long startTime = System.nanoTime(); // String testString = ""; // InputStream...
Java
["2 3 2\n**.\n...", "1 2 2\n..", "3 3 4\n.*.\n*.*\n.*."]
1 second
["3", "1", "0"]
NoteIn the first sample, there are three ways to arrange those seats. You can take the following seats for your arrangement. $$$(1,3)$$$, $$$(2,3)$$$ $$$(2,2)$$$, $$$(2,3)$$$ $$$(2,1)$$$, $$$(2,2)$$$
Java 8
standard input
[ "implementation", "brute force" ]
c1f247150831e9b52389bae697a1ca3d
The first line contains three positive integers $$$n,m,k$$$ ($$$1 \leq n, m, k \leq 2\,000$$$), where $$$n,m$$$ represent the sizes of the classroom and $$$k$$$ is the number of consecutive seats you need to find. Each of the next $$$n$$$ lines contains $$$m$$$ characters '.' or '*'. They form a matrix representing the...
1,300
A single number, denoting the number of ways to find $$$k$$$ empty seats in the same row or column.
standard output
PASSED
5dbd543ca40fc75d6b1fa09913a0da54
train_001.jsonl
1517403900
Suppose that you are in a campus and have to go for classes day by day. As you may see, when you hurry to a classroom, you surprisingly find that many seats there are already occupied. Today you and your friends went for class, and found out that some of the seats were occupied.The classroom contains $$$n$$$ rows of se...
256 megabytes
/* Author: prakashn Date : 1/31/2018 */ import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class _919C { InputStream is; PrintWriter out; String INPUT = "1 1 1 ."...
Java
["2 3 2\n**.\n...", "1 2 2\n..", "3 3 4\n.*.\n*.*\n.*."]
1 second
["3", "1", "0"]
NoteIn the first sample, there are three ways to arrange those seats. You can take the following seats for your arrangement. $$$(1,3)$$$, $$$(2,3)$$$ $$$(2,2)$$$, $$$(2,3)$$$ $$$(2,1)$$$, $$$(2,2)$$$
Java 8
standard input
[ "implementation", "brute force" ]
c1f247150831e9b52389bae697a1ca3d
The first line contains three positive integers $$$n,m,k$$$ ($$$1 \leq n, m, k \leq 2\,000$$$), where $$$n,m$$$ represent the sizes of the classroom and $$$k$$$ is the number of consecutive seats you need to find. Each of the next $$$n$$$ lines contains $$$m$$$ characters '.' or '*'. They form a matrix representing the...
1,300
A single number, denoting the number of ways to find $$$k$$$ empty seats in the same row or column.
standard output
PASSED
78c72839f987d856d4fc57ebb8dfb847
train_001.jsonl
1517403900
Suppose that you are in a campus and have to go for classes day by day. As you may see, when you hurry to a classroom, you surprisingly find that many seats there are already occupied. Today you and your friends went for class, and found out that some of the seats were occupied.The classroom contains $$$n$$$ rows of se...
256 megabytes
import java.util.Scanner; public class Seat_Arrangements { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); // row int m = sc.nextInt(); // column int k = sc.nextInt(); sc.nextLine(); char[][] arr = new char[n][m]; ...
Java
["2 3 2\n**.\n...", "1 2 2\n..", "3 3 4\n.*.\n*.*\n.*."]
1 second
["3", "1", "0"]
NoteIn the first sample, there are three ways to arrange those seats. You can take the following seats for your arrangement. $$$(1,3)$$$, $$$(2,3)$$$ $$$(2,2)$$$, $$$(2,3)$$$ $$$(2,1)$$$, $$$(2,2)$$$
Java 8
standard input
[ "implementation", "brute force" ]
c1f247150831e9b52389bae697a1ca3d
The first line contains three positive integers $$$n,m,k$$$ ($$$1 \leq n, m, k \leq 2\,000$$$), where $$$n,m$$$ represent the sizes of the classroom and $$$k$$$ is the number of consecutive seats you need to find. Each of the next $$$n$$$ lines contains $$$m$$$ characters '.' or '*'. They form a matrix representing the...
1,300
A single number, denoting the number of ways to find $$$k$$$ empty seats in the same row or column.
standard output
PASSED
4b083ab743d6ac268f981657713f1b83
train_001.jsonl
1517403900
Suppose that you are in a campus and have to go for classes day by day. As you may see, when you hurry to a classroom, you surprisingly find that many seats there are already occupied. Today you and your friends went for class, and found out that some of the seats were occupied.The classroom contains $$$n$$$ rows of se...
256 megabytes
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; public class C { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni(), m = ni(), k = ni(); String ar[] = new String[n]; ...
Java
["2 3 2\n**.\n...", "1 2 2\n..", "3 3 4\n.*.\n*.*\n.*."]
1 second
["3", "1", "0"]
NoteIn the first sample, there are three ways to arrange those seats. You can take the following seats for your arrangement. $$$(1,3)$$$, $$$(2,3)$$$ $$$(2,2)$$$, $$$(2,3)$$$ $$$(2,1)$$$, $$$(2,2)$$$
Java 8
standard input
[ "implementation", "brute force" ]
c1f247150831e9b52389bae697a1ca3d
The first line contains three positive integers $$$n,m,k$$$ ($$$1 \leq n, m, k \leq 2\,000$$$), where $$$n,m$$$ represent the sizes of the classroom and $$$k$$$ is the number of consecutive seats you need to find. Each of the next $$$n$$$ lines contains $$$m$$$ characters '.' or '*'. They form a matrix representing the...
1,300
A single number, denoting the number of ways to find $$$k$$$ empty seats in the same row or column.
standard output
PASSED
c50e6661ee122dc7db4aff81bb16f172
train_001.jsonl
1517403900
Suppose that you are in a campus and have to go for classes day by day. As you may see, when you hurry to a classroom, you surprisingly find that many seats there are already occupied. Today you and your friends went for class, and found out that some of the seats were occupied.The classroom contains $$$n$$$ rows of se...
256 megabytes
import java.util.Scanner; public class Main{ public static void main(String[] args) { int max = 0; int c = 0; Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); int k = in.nextInt(); in.nextLine(); char[][] room = new char[m][n]; ...
Java
["2 3 2\n**.\n...", "1 2 2\n..", "3 3 4\n.*.\n*.*\n.*."]
1 second
["3", "1", "0"]
NoteIn the first sample, there are three ways to arrange those seats. You can take the following seats for your arrangement. $$$(1,3)$$$, $$$(2,3)$$$ $$$(2,2)$$$, $$$(2,3)$$$ $$$(2,1)$$$, $$$(2,2)$$$
Java 8
standard input
[ "implementation", "brute force" ]
c1f247150831e9b52389bae697a1ca3d
The first line contains three positive integers $$$n,m,k$$$ ($$$1 \leq n, m, k \leq 2\,000$$$), where $$$n,m$$$ represent the sizes of the classroom and $$$k$$$ is the number of consecutive seats you need to find. Each of the next $$$n$$$ lines contains $$$m$$$ characters '.' or '*'. They form a matrix representing the...
1,300
A single number, denoting the number of ways to find $$$k$$$ empty seats in the same row or column.
standard output
PASSED
f84ffd465dcba36dfb20d907da7fbdbe
train_001.jsonl
1517403900
Suppose that you are in a campus and have to go for classes day by day. As you may see, when you hurry to a classroom, you surprisingly find that many seats there are already occupied. Today you and your friends went for class, and found out that some of the seats were occupied.The classroom contains $$$n$$$ rows of se...
256 megabytes
import java.io.*; import java.util.*; public class C { FastScanner in; PrintWriter out; boolean systemIO = true; public void solve() throws IOException { int n = in.nextInt(); int m = in.nextInt(); int k = in.nextInt(); boolean table[][] = new boolean[n][m]; for (int i = ...
Java
["2 3 2\n**.\n...", "1 2 2\n..", "3 3 4\n.*.\n*.*\n.*."]
1 second
["3", "1", "0"]
NoteIn the first sample, there are three ways to arrange those seats. You can take the following seats for your arrangement. $$$(1,3)$$$, $$$(2,3)$$$ $$$(2,2)$$$, $$$(2,3)$$$ $$$(2,1)$$$, $$$(2,2)$$$
Java 8
standard input
[ "implementation", "brute force" ]
c1f247150831e9b52389bae697a1ca3d
The first line contains three positive integers $$$n,m,k$$$ ($$$1 \leq n, m, k \leq 2\,000$$$), where $$$n,m$$$ represent the sizes of the classroom and $$$k$$$ is the number of consecutive seats you need to find. Each of the next $$$n$$$ lines contains $$$m$$$ characters '.' or '*'. They form a matrix representing the...
1,300
A single number, denoting the number of ways to find $$$k$$$ empty seats in the same row or column.
standard output
PASSED
9da015eb1cde8138e4b817e887436a6c
train_001.jsonl
1517403900
Suppose that you are in a campus and have to go for classes day by day. As you may see, when you hurry to a classroom, you surprisingly find that many seats there are already occupied. Today you and your friends went for class, and found out that some of the seats were occupied.The classroom contains $$$n$$$ rows of se...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in...
Java
["2 3 2\n**.\n...", "1 2 2\n..", "3 3 4\n.*.\n*.*\n.*."]
1 second
["3", "1", "0"]
NoteIn the first sample, there are three ways to arrange those seats. You can take the following seats for your arrangement. $$$(1,3)$$$, $$$(2,3)$$$ $$$(2,2)$$$, $$$(2,3)$$$ $$$(2,1)$$$, $$$(2,2)$$$
Java 8
standard input
[ "implementation", "brute force" ]
c1f247150831e9b52389bae697a1ca3d
The first line contains three positive integers $$$n,m,k$$$ ($$$1 \leq n, m, k \leq 2\,000$$$), where $$$n,m$$$ represent the sizes of the classroom and $$$k$$$ is the number of consecutive seats you need to find. Each of the next $$$n$$$ lines contains $$$m$$$ characters '.' or '*'. They form a matrix representing the...
1,300
A single number, denoting the number of ways to find $$$k$$$ empty seats in the same row or column.
standard output
PASSED
b3a3dcc54a580b4e3c209d2a521b0bf7
train_001.jsonl
1517403900
Suppose that you are in a campus and have to go for classes day by day. As you may see, when you hurry to a classroom, you surprisingly find that many seats there are already occupied. Today you and your friends went for class, and found out that some of the seats were occupied.The classroom contains $$$n$$$ rows of se...
256 megabytes
import java.util.*; import java.io.*; public class test{ public static void main(String[] args) { int x,y; FastReader scan=new FastReader(); OutputStream output=System.out; PrintWriter out=new PrintWriter(output); int n=scan.nextInt(); int m=scan.nextInt(); int k=scan.nextInt(); char[][] arr=new char[...
Java
["2 3 2\n**.\n...", "1 2 2\n..", "3 3 4\n.*.\n*.*\n.*."]
1 second
["3", "1", "0"]
NoteIn the first sample, there are three ways to arrange those seats. You can take the following seats for your arrangement. $$$(1,3)$$$, $$$(2,3)$$$ $$$(2,2)$$$, $$$(2,3)$$$ $$$(2,1)$$$, $$$(2,2)$$$
Java 8
standard input
[ "implementation", "brute force" ]
c1f247150831e9b52389bae697a1ca3d
The first line contains three positive integers $$$n,m,k$$$ ($$$1 \leq n, m, k \leq 2\,000$$$), where $$$n,m$$$ represent the sizes of the classroom and $$$k$$$ is the number of consecutive seats you need to find. Each of the next $$$n$$$ lines contains $$$m$$$ characters '.' or '*'. They form a matrix representing the...
1,300
A single number, denoting the number of ways to find $$$k$$$ empty seats in the same row or column.
standard output
PASSED
52c003ac913cc4570e7b5432025e38e9
train_001.jsonl
1517403900
Suppose that you are in a campus and have to go for classes day by day. As you may see, when you hurry to a classroom, you surprisingly find that many seats there are already occupied. Today you and your friends went for class, and found out that some of the seats were occupied.The classroom contains $$$n$$$ rows of se...
256 megabytes
import java.util.*; public class Codeforces { public static void main(String []args) { Scanner cin = new Scanner(System.in); boolean a[][] = new boolean[2001][2001] ; int answer = 0; int n = cin.nextInt(); int m = cin.nextInt(); int k = cin.nextInt(); ///Max linii for(int i = 0; ...
Java
["2 3 2\n**.\n...", "1 2 2\n..", "3 3 4\n.*.\n*.*\n.*."]
1 second
["3", "1", "0"]
NoteIn the first sample, there are three ways to arrange those seats. You can take the following seats for your arrangement. $$$(1,3)$$$, $$$(2,3)$$$ $$$(2,2)$$$, $$$(2,3)$$$ $$$(2,1)$$$, $$$(2,2)$$$
Java 8
standard input
[ "implementation", "brute force" ]
c1f247150831e9b52389bae697a1ca3d
The first line contains three positive integers $$$n,m,k$$$ ($$$1 \leq n, m, k \leq 2\,000$$$), where $$$n,m$$$ represent the sizes of the classroom and $$$k$$$ is the number of consecutive seats you need to find. Each of the next $$$n$$$ lines contains $$$m$$$ characters '.' or '*'. They form a matrix representing the...
1,300
A single number, denoting the number of ways to find $$$k$$$ empty seats in the same row or column.
standard output
PASSED
dd574afd13b65b2663085fefa85ed0eb
train_001.jsonl
1517403900
Suppose that you are in a campus and have to go for classes day by day. As you may see, when you hurry to a classroom, you surprisingly find that many seats there are already occupied. Today you and your friends went for class, and found out that some of the seats were occupied.The classroom contains $$$n$$$ rows of se...
256 megabytes
import java.util.*; import java.util.ArrayList; public class Main{ static class Pair { int x; int y; Pair(int x, int y){ this.x=x; this.y=y; } } public static void main(String[] args){ Scanner param=new Scanner(Syst...
Java
["2 3 2\n**.\n...", "1 2 2\n..", "3 3 4\n.*.\n*.*\n.*."]
1 second
["3", "1", "0"]
NoteIn the first sample, there are three ways to arrange those seats. You can take the following seats for your arrangement. $$$(1,3)$$$, $$$(2,3)$$$ $$$(2,2)$$$, $$$(2,3)$$$ $$$(2,1)$$$, $$$(2,2)$$$
Java 8
standard input
[ "implementation", "brute force" ]
c1f247150831e9b52389bae697a1ca3d
The first line contains three positive integers $$$n,m,k$$$ ($$$1 \leq n, m, k \leq 2\,000$$$), where $$$n,m$$$ represent the sizes of the classroom and $$$k$$$ is the number of consecutive seats you need to find. Each of the next $$$n$$$ lines contains $$$m$$$ characters '.' or '*'. They form a matrix representing the...
1,300
A single number, denoting the number of ways to find $$$k$$$ empty seats in the same row or column.
standard output
PASSED
3a8cf93bb266d090b7a16f881b7325db
train_001.jsonl
1517403900
Suppose that you are in a campus and have to go for classes day by day. As you may see, when you hurry to a classroom, you surprisingly find that many seats there are already occupied. Today you and your friends went for class, and found out that some of the seats were occupied.The classroom contains $$$n$$$ rows of se...
256 megabytes
import java.util.*; import java.io.*; // public class Solution implements Runnable class Solution implements Runnable { public static void main(String[] args) throws IOException { br=new BufferedReader(new InputStreamReader(System.in)); nextIntBuffer = new String[0]; bos = new OutputStreamWriter(new BufferedOu...
Java
["2 3 2\n**.\n...", "1 2 2\n..", "3 3 4\n.*.\n*.*\n.*."]
1 second
["3", "1", "0"]
NoteIn the first sample, there are three ways to arrange those seats. You can take the following seats for your arrangement. $$$(1,3)$$$, $$$(2,3)$$$ $$$(2,2)$$$, $$$(2,3)$$$ $$$(2,1)$$$, $$$(2,2)$$$
Java 8
standard input
[ "implementation", "brute force" ]
c1f247150831e9b52389bae697a1ca3d
The first line contains three positive integers $$$n,m,k$$$ ($$$1 \leq n, m, k \leq 2\,000$$$), where $$$n,m$$$ represent the sizes of the classroom and $$$k$$$ is the number of consecutive seats you need to find. Each of the next $$$n$$$ lines contains $$$m$$$ characters '.' or '*'. They form a matrix representing the...
1,300
A single number, denoting the number of ways to find $$$k$$$ empty seats in the same row or column.
standard output
PASSED
8f700d7f209f293ff1bf71b4b481ab4c
train_001.jsonl
1411918500
One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr...
256 megabytes
import java.util.*; public class wrgreg { public static int isPrime(int n) { int count=0; for(int i=1;i<n;i++) { if(n%i ==0 && i!=1 ) { count++; break; } } //System.out.println(count); if(count==0 || n==2) { return 1; } return 0; } public static void main(St...
Java
["12", "15", "23", "1000000"]
1 second
["4 8", "6 9", "8 15", "500000 500000"]
NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number.
Java 8
standard input
[ "number theory", "math" ]
3ea971165088fae130d866180c6c868b
The only line contains an integer n (12 ≤ n ≤ 106).
800
Output two composite integers x and y (1 &lt; x, y &lt; n) such that x + y = n. If there are multiple solutions, you can output any of them.
standard output
PASSED
4d16cddb3c1852817d45b0d5fe9f1950
train_001.jsonl
1411918500
One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr...
256 megabytes
public class learnfrommath2 { protected static int[] getAns(int x) { if(x % 2 != 0 || !checkComp(x/2)) { // System.out.println("odd or /2 !comp"); for(int i = 1; i < x; i++) { if(checkComp(i) && checkComp(x-i)) { return new int[] { i, x-i }; } } // System.out.println("youre an idiot"); ...
Java
["12", "15", "23", "1000000"]
1 second
["4 8", "6 9", "8 15", "500000 500000"]
NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number.
Java 8
standard input
[ "number theory", "math" ]
3ea971165088fae130d866180c6c868b
The only line contains an integer n (12 ≤ n ≤ 106).
800
Output two composite integers x and y (1 &lt; x, y &lt; n) such that x + y = n. If there are multiple solutions, you can output any of them.
standard output
PASSED
524ae1afbbf8cf2116902f575a56dd27
train_001.jsonl
1411918500
One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintStream; public class learnMath_472A { public static void main(String args[]) throws NumberFormatException, IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); PrintStrea...
Java
["12", "15", "23", "1000000"]
1 second
["4 8", "6 9", "8 15", "500000 500000"]
NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number.
Java 8
standard input
[ "number theory", "math" ]
3ea971165088fae130d866180c6c868b
The only line contains an integer n (12 ≤ n ≤ 106).
800
Output two composite integers x and y (1 &lt; x, y &lt; n) such that x + y = n. If there are multiple solutions, you can output any of them.
standard output
PASSED
5e111d0f51b62cf5b1f0f458bae8ef71
train_001.jsonl
1411918500
One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr...
256 megabytes
import java.io.PrintStream; import java.util.Scanner; public class learnMath_472A { public static void main(String args[]){ Scanner sc=new Scanner(System.in); PrintStream sOut=new PrintStream(System.out); int n=sc.nextInt(); if(n%2==0){ if(n%4==0) sOut.println(n/2+" "+n/2); else sOut.println(n/2-1+" "+...
Java
["12", "15", "23", "1000000"]
1 second
["4 8", "6 9", "8 15", "500000 500000"]
NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number.
Java 8
standard input
[ "number theory", "math" ]
3ea971165088fae130d866180c6c868b
The only line contains an integer n (12 ≤ n ≤ 106).
800
Output two composite integers x and y (1 &lt; x, y &lt; n) such that x + y = n. If there are multiple solutions, you can output any of them.
standard output
PASSED
d4cc808820922be7c0b4358faff3b486
train_001.jsonl
1411918500
One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr...
256 megabytes
import java.io.PrintStream; import java.util.Scanner; public class learnMath_472A { public static void main(String args[]){ Scanner sc=new Scanner(System.in); PrintStream sOut=new PrintStream(System.out); int n=sc.nextInt(); if(n%2==0){ if(n%4==0) sOut.println(n/2+" "+n/2); else sOut.println(n/2-1+" "+(...
Java
["12", "15", "23", "1000000"]
1 second
["4 8", "6 9", "8 15", "500000 500000"]
NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number.
Java 8
standard input
[ "number theory", "math" ]
3ea971165088fae130d866180c6c868b
The only line contains an integer n (12 ≤ n ≤ 106).
800
Output two composite integers x and y (1 &lt; x, y &lt; n) such that x + y = n. If there are multiple solutions, you can output any of them.
standard output
PASSED
1bfd376765d2a1cd8876ba25a31eb1de
train_001.jsonl
1411918500
One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.Arrays; import java.util.StringTokenizer; public class MathText { static class FastReader { BufferedReader br; StringTokenizer st; public FastReade...
Java
["12", "15", "23", "1000000"]
1 second
["4 8", "6 9", "8 15", "500000 500000"]
NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number.
Java 8
standard input
[ "number theory", "math" ]
3ea971165088fae130d866180c6c868b
The only line contains an integer n (12 ≤ n ≤ 106).
800
Output two composite integers x and y (1 &lt; x, y &lt; n) such that x + y = n. If there are multiple solutions, you can output any of them.
standard output
PASSED
365f7c1dce2128d87d9e4c8e5dbb635d
train_001.jsonl
1411918500
One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner ler = new Scanner(System.in); int t,x=4,y,px=0,py=0; boolean primos=true; t=ler.nextInt(); y=t-x; while(primos){ for(int c=y;c!=0;c--){ if(y%c=...
Java
["12", "15", "23", "1000000"]
1 second
["4 8", "6 9", "8 15", "500000 500000"]
NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number.
Java 8
standard input
[ "number theory", "math" ]
3ea971165088fae130d866180c6c868b
The only line contains an integer n (12 ≤ n ≤ 106).
800
Output two composite integers x and y (1 &lt; x, y &lt; n) such that x + y = n. If there are multiple solutions, you can output any of them.
standard output
PASSED
3ac365d20d3ef3e015c240d1a1c0a0c9
train_001.jsonl
1411918500
One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr...
256 megabytes
public class DesignTutorialLearnFromMath { public static void main (String[] args) { int n = new java.util.Scanner(System.in).nextInt(); for (int x = 4; (n-x) > 4; x += 2) { if ((n-x) % 2 == 0 || (n-x) % 3 == 0) { System.out.println(x + " " + (n-x)); ...
Java
["12", "15", "23", "1000000"]
1 second
["4 8", "6 9", "8 15", "500000 500000"]
NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number.
Java 8
standard input
[ "number theory", "math" ]
3ea971165088fae130d866180c6c868b
The only line contains an integer n (12 ≤ n ≤ 106).
800
Output two composite integers x and y (1 &lt; x, y &lt; n) such that x + y = n. If there are multiple solutions, you can output any of them.
standard output
PASSED
db87bf0ceb8bdcae433dc66f3a95380e
train_001.jsonl
1411918500
One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr...
256 megabytes
import java.util.*; public class Codechef { public static void main (String[] args) throws java.lang.Exception { Scanner in=new Scanner(System.in); int n=in.nextInt(); if(n%2==0 && isPrime(n/2)) System.out.println(n/2+" "+n/2); else{ for(int i=4;i<=n/2;i++){ ...
Java
["12", "15", "23", "1000000"]
1 second
["4 8", "6 9", "8 15", "500000 500000"]
NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number.
Java 8
standard input
[ "number theory", "math" ]
3ea971165088fae130d866180c6c868b
The only line contains an integer n (12 ≤ n ≤ 106).
800
Output two composite integers x and y (1 &lt; x, y &lt; n) such that x + y = n. If there are multiple solutions, you can output any of them.
standard output
PASSED
44023d67a32c7d95e91cb71da4a6aedd
train_001.jsonl
1411918500
One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr...
256 megabytes
import java.util.Scanner; public class a { public static void main (String[] args){ Scanner input=new Scanner (System.in); int n=input.nextInt(); int c=0; int v=0; for (int i=n-1;i>1;i--){ if ((isPrime(i)==false)&&(isPrime(n-i)==false) ){ System.out.print (i+" "+(n-i)); break ; } } } public static boolea...
Java
["12", "15", "23", "1000000"]
1 second
["4 8", "6 9", "8 15", "500000 500000"]
NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number.
Java 8
standard input
[ "number theory", "math" ]
3ea971165088fae130d866180c6c868b
The only line contains an integer n (12 ≤ n ≤ 106).
800
Output two composite integers x and y (1 &lt; x, y &lt; n) such that x + y = n. If there are multiple solutions, you can output any of them.
standard output
PASSED
eb2c59c84f42043f7080a1fae8f05619
train_001.jsonl
1411918500
One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.math.BigInteger; import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; import java.util.InputMismatchException; import java.util.Map; import java.util.Map.Entry; import java.util.Scanner; public cl...
Java
["12", "15", "23", "1000000"]
1 second
["4 8", "6 9", "8 15", "500000 500000"]
NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number.
Java 8
standard input
[ "number theory", "math" ]
3ea971165088fae130d866180c6c868b
The only line contains an integer n (12 ≤ n ≤ 106).
800
Output two composite integers x and y (1 &lt; x, y &lt; n) such that x + y = n. If there are multiple solutions, you can output any of them.
standard output
PASSED
babd800a23af7a3a3c27bd3e5087d622
train_001.jsonl
1411918500
One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr...
256 megabytes
//package CF_270; import java.util.*; public class a { public static boolean isPrime(int n){ for(int i = 2; i <= Math.sqrt(n); i++){ if(n % i == 0) return false; } return true; } public static void main(String[] args) throws Exception{ Scanner sc=new Scanner(Sys...
Java
["12", "15", "23", "1000000"]
1 second
["4 8", "6 9", "8 15", "500000 500000"]
NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number.
Java 8
standard input
[ "number theory", "math" ]
3ea971165088fae130d866180c6c868b
The only line contains an integer n (12 ≤ n ≤ 106).
800
Output two composite integers x and y (1 &lt; x, y &lt; n) such that x + y = n. If there are multiple solutions, you can output any of them.
standard output
PASSED
be3a087de5eb4f26842035741ed7e813
train_001.jsonl
1411918500
One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr...
256 megabytes
import java.util.*; public class Math { public static void main(String []args){ Scanner input=new Scanner(System.in); int num=input.nextInt(); int composite1=4; int composite2=num-4; while((isComposite(composite1)&&isComposite(composite2))==false){ composite1++; composite2--; } System.out.printl...
Java
["12", "15", "23", "1000000"]
1 second
["4 8", "6 9", "8 15", "500000 500000"]
NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number.
Java 8
standard input
[ "number theory", "math" ]
3ea971165088fae130d866180c6c868b
The only line contains an integer n (12 ≤ n ≤ 106).
800
Output two composite integers x and y (1 &lt; x, y &lt; n) such that x + y = n. If there are multiple solutions, you can output any of them.
standard output
PASSED
468a41f79c4857eeab1e57702ef2ee44
train_001.jsonl
1411918500
One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr...
256 megabytes
import java.util.*; public class LearnfromMath { public static void main (String [] args){ Scanner input=new Scanner (System.in); int n=input.nextInt(); int num1=n-4; int num2=4; while((composite(num1)==false) || (composite(num2)==false)){ num1--; num2++; } System.out.print(num1+" "+num2); } ...
Java
["12", "15", "23", "1000000"]
1 second
["4 8", "6 9", "8 15", "500000 500000"]
NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number.
Java 8
standard input
[ "number theory", "math" ]
3ea971165088fae130d866180c6c868b
The only line contains an integer n (12 ≤ n ≤ 106).
800
Output two composite integers x and y (1 &lt; x, y &lt; n) such that x + y = n. If there are multiple solutions, you can output any of them.
standard output
PASSED
ed12b09e68fcb4c8f3458695ef36791a
train_001.jsonl
1411918500
One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr...
256 megabytes
import java.util.*; public class LearnMath { public static void main (String [] args) { Scanner input = new Scanner (System.in); int n = input.nextInt(),i = 0; while(n > 0) { n--; i++; if(prime(n) == false && prime(i) == false) break; } System.out.println(n + " " + i); } public static boolean...
Java
["12", "15", "23", "1000000"]
1 second
["4 8", "6 9", "8 15", "500000 500000"]
NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number.
Java 8
standard input
[ "number theory", "math" ]
3ea971165088fae130d866180c6c868b
The only line contains an integer n (12 ≤ n ≤ 106).
800
Output two composite integers x and y (1 &lt; x, y &lt; n) such that x + y = n. If there are multiple solutions, you can output any of them.
standard output
PASSED
44ff31a2673063baf7af59b39d3b8214
train_001.jsonl
1411918500
One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr...
256 megabytes
import java.util.*; public class Math2 { public static void main(String args[]) { int n,p,t; Scanner in=new Scanner(System.in); n=in.nextInt(); p=n%2+8; t=n-p; System.out.println(+p+ " "+t); } }
Java
["12", "15", "23", "1000000"]
1 second
["4 8", "6 9", "8 15", "500000 500000"]
NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number.
Java 8
standard input
[ "number theory", "math" ]
3ea971165088fae130d866180c6c868b
The only line contains an integer n (12 ≤ n ≤ 106).
800
Output two composite integers x and y (1 &lt; x, y &lt; n) such that x + y = n. If there are multiple solutions, you can output any of them.
standard output
PASSED
9eac242068222b9b47679f8e0b6c3eb5
train_001.jsonl
1411918500
One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr...
256 megabytes
import java.util.*; public class Design { public static void main(String args[]) { int n,a,b; Scanner in= new Scanner(System.in); n=in.nextInt(); a=n/3; if(a%2!=0) { a=a+1; } b=n-a; if((b%2!=0)&&(b%3!=0)&&(b%7!=0)&&(b%5!=0)) { a=a-5; b=b+5; if((a%2!=0)&&(a...
Java
["12", "15", "23", "1000000"]
1 second
["4 8", "6 9", "8 15", "500000 500000"]
NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number.
Java 8
standard input
[ "number theory", "math" ]
3ea971165088fae130d866180c6c868b
The only line contains an integer n (12 ≤ n ≤ 106).
800
Output two composite integers x and y (1 &lt; x, y &lt; n) such that x + y = n. If there are multiple solutions, you can output any of them.
standard output
PASSED
4e6a60e313710759e12fd85d052928c3
train_001.jsonl
1411918500
One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Demo demo = new Demo(); Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); demo.solution4(n); } static class Demo { public void solution4(int n) { ...
Java
["12", "15", "23", "1000000"]
1 second
["4 8", "6 9", "8 15", "500000 500000"]
NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number.
Java 8
standard input
[ "number theory", "math" ]
3ea971165088fae130d866180c6c868b
The only line contains an integer n (12 ≤ n ≤ 106).
800
Output two composite integers x and y (1 &lt; x, y &lt; n) such that x + y = n. If there are multiple solutions, you can output any of them.
standard output
PASSED
055f115439f970706be025fb18c767b9
train_001.jsonl
1411918500
One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr...
256 megabytes
import java.util.Scanner; public class Problem_472 { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n=input.nextInt(); int temp1=0,temp2=0,find1=0,find2=0; if(n%2==0){ temp1=(n-8); temp2=(n-temp1); } ...
Java
["12", "15", "23", "1000000"]
1 second
["4 8", "6 9", "8 15", "500000 500000"]
NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number.
Java 8
standard input
[ "number theory", "math" ]
3ea971165088fae130d866180c6c868b
The only line contains an integer n (12 ≤ n ≤ 106).
800
Output two composite integers x and y (1 &lt; x, y &lt; n) such that x + y = n. If there are multiple solutions, you can output any of them.
standard output
PASSED
062ecf42479823269cdb7dd6e3ba3a2e
train_001.jsonl
1411918500
One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr...
256 megabytes
import java.util.Scanner; public class Problem_472 { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n=input.nextInt(); int temp1=0,temp2=0,find1=0,find2=0; if(n%2==0){ temp1=(n-6); temp2=(n-temp1); } ...
Java
["12", "15", "23", "1000000"]
1 second
["4 8", "6 9", "8 15", "500000 500000"]
NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number.
Java 8
standard input
[ "number theory", "math" ]
3ea971165088fae130d866180c6c868b
The only line contains an integer n (12 ≤ n ≤ 106).
800
Output two composite integers x and y (1 &lt; x, y &lt; n) such that x + y = n. If there are multiple solutions, you can output any of them.
standard output
PASSED
5299c8959602f1a7aadfcfb1112b9f69
train_001.jsonl
1411918500
One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { int n, v1, v2; boolean prime; Scanner input = new Scanner(System.in); n = input.nextInt(); for (int i = 4; i < n-4; i++) { if(!(isprime(n-i))&&!(isprime(i))){ ...
Java
["12", "15", "23", "1000000"]
1 second
["4 8", "6 9", "8 15", "500000 500000"]
NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number.
Java 8
standard input
[ "number theory", "math" ]
3ea971165088fae130d866180c6c868b
The only line contains an integer n (12 ≤ n ≤ 106).
800
Output two composite integers x and y (1 &lt; x, y &lt; n) such that x + y = n. If there are multiple solutions, you can output any of them.
standard output
PASSED
6c1d547870a16ddbfff6bd76957b0483
train_001.jsonl
1411918500
One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr...
256 megabytes
import java.util.*; public class Stringproplm { public static void main(String[] args) { Scanner in=new Scanner(System.in); int n=in.nextInt(); if(n%2==0){ int x=n/2; if(x%2==0){ int y=n/2; int z=n-y; if(y==2){ y+=2; ...
Java
["12", "15", "23", "1000000"]
1 second
["4 8", "6 9", "8 15", "500000 500000"]
NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number.
Java 8
standard input
[ "number theory", "math" ]
3ea971165088fae130d866180c6c868b
The only line contains an integer n (12 ≤ n ≤ 106).
800
Output two composite integers x and y (1 &lt; x, y &lt; n) such that x + y = n. If there are multiple solutions, you can output any of them.
standard output
PASSED
accd489cdba8f668446c9efa456b1ccf
train_001.jsonl
1411918500
One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr...
256 megabytes
import java.util.Scanner; public class DesignTutorialLearnFromMath { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(), x, y; scanner.close(); if (n % 2 == 0) { comp(n / 2, n / 2); } else { x ...
Java
["12", "15", "23", "1000000"]
1 second
["4 8", "6 9", "8 15", "500000 500000"]
NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number.
Java 8
standard input
[ "number theory", "math" ]
3ea971165088fae130d866180c6c868b
The only line contains an integer n (12 ≤ n ≤ 106).
800
Output two composite integers x and y (1 &lt; x, y &lt; n) such that x + y = n. If there are multiple solutions, you can output any of them.
standard output
PASSED
34b9ac7611fbf6df03a63db9f456bf35
train_001.jsonl
1411918500
One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr...
256 megabytes
import java.util.*; public class Matematics{ public static void main(String[] args){ Scanner scan = new Scanner(System.in); int a = scan.nextInt(); //int b = a/2; for(int i=4;i<a;i++){ int b=a-i; if((i%2==0&&b%2==0)||(i%2==0&&b%3==0)||(i%3==0&&b%2==0)||(i%3==0&&b%3==0)){ System.out.println(i+" "+b); ...
Java
["12", "15", "23", "1000000"]
1 second
["4 8", "6 9", "8 15", "500000 500000"]
NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number.
Java 8
standard input
[ "number theory", "math" ]
3ea971165088fae130d866180c6c868b
The only line contains an integer n (12 ≤ n ≤ 106).
800
Output two composite integers x and y (1 &lt; x, y &lt; n) such that x + y = n. If there are multiple solutions, you can output any of them.
standard output
PASSED
c34fd1179e8291586e1f4b10fb77460c
train_001.jsonl
1454605500
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to complete the picture by composing a graph G with the following properties: G has exactly n vertices, numbered from 1 to n. ...
256 megabytes
import java.io.InputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.InputMismatchException; import java.util.NoSuchElementException; import java.math.BigInteger; public class Main{ static PrintWriter out...
Java
["2 1\n1 2", "4 3\n1 2\n1 3\n1 4"]
2 seconds
["Yes\naa", "No"]
NoteIn the first sample you are given a graph made of two vertices with an edge between them. So, these vertices can correspond to both the same and adjacent letters. Any of the following strings "aa", "ab", "ba", "bb", "bc", "cb", "cc" meets the graph's conditions. In the second sample the first vertex is connected to...
Java 8
standard input
[ "constructive algorithms", "dfs and similar", "graphs" ]
e71640f715f353e49745eac5f72e682a
The first line of the input contains two integers n and m  — the number of vertices and edges in the graph found by Petya, respectively. Each of the next m lines contains two integers ui and vi (1 ≤ ui, vi ≤ n, ui ≠ vi) — the edges of the graph G. It is guaranteed, that there are no multiple edges, that is any pair of ...
1,800
In the first line print "Yes" (without the quotes), if the string s Petya is interested in really exists and "No" (without the quotes) otherwise. If the string s exists, then print it on the second line of the output. The length of s must be exactly n, it must consist of only letters "a", "b" and "c" only, and the grap...
standard output