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
f4161376f9732ca13713f53cff241b89
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.io.*; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.*; /* Прокрастинирую */ public class Main { static FastReader in; static PrintWriter out; static Random rand = new Random(); static final int INF = (int) (1e9 + 10); static final int MOD = (int) (1e9 + ...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ — endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
58187cb86ae6a67bf4e7db6d025dde5a
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; /* procrastinating */ public class Main { static FastReader in; static PrintWriter out; static Random rand = new Random(); static final int INF = (int) (1e9 + 10), MOD = (int) (998244353), LOGN = 60; static final long IINF = (long...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ — endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
21badc72a2def8b536985de68968e79f
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
//package Contest1296; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashMap; import java.util.List; public class YetAnotherButWithDPThisTime { public static void main(String[] args) throws IOException { BufferedReader br =...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ — endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
6f26235ce33c81bd831a705d4279f717
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; /** * * @author Saju * */ public class Main { private static int dx[] = { -2, -3, -2, -1, -1, 1}; private static int dy[] = { 1, -1, -1, -2, -3, -2}; private static final long INF = (long) (1e15); private static final int INT_INF = Integer.MAX_VALUE;...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ — endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
df838b0d62311bd9aa8880a4b25831a5
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; /** * * @author Saju * */ public class Main { private static int dx[] = { -2, -3, -2, -1, -1, 1}; private static int dy[] = { 1, -1, -1, -2, -3, -2}; private static final long INF = (long) (1e15); private static final int INT_INF = Integer.MAX_VALUE;...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ — endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
9297a3c224c1b8a239ed807d67ba137c
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.regex.*; import java.util.Arrays; import java.util.ArrayList; import java.lang.Math; import java.util.Arrays; import java.util.Comparator; public class Main { ...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ — endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
30aa7e0927bb51fb266a4b9da7aff1a9
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; public class YetAnotherWalkingRobot { // Template for CF public static class ListComparator im...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ — endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
115aff3ff869768f692da0995ed4d693
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; public class YetAnotherWalkingRobot { // Template for CF public st...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ — endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
a3ccf058bf726000cca7b44b5186640e
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Stack; public class Main { static int n; static String s; static class POINT { char c; int pos; public POINT(char c, int pos) { this....
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ — endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
d69244132846ed2bc4593b5dd08901dc
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.stream.Collectors; public class Main { static Long max = (long) (2 * 10E5); static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); stati...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ — endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
a3282f0683f41540e968c8543e949c0a
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; import java.math.*; import java.text.*; public class Prac{ static class InputReader { private final InputStream stream; private final byte[] buf = new byte[8192]; private int curChar, snumChars; public InputReader(Input...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ — endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
4f20b886fc24d6c902a87c2de5d19eee
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.io.*; import java.util.*; public class Main { static PrintWriter pw; static int[] visit; static int max; static int[] arr; static void dfs(int i, int c) { visit[i-1]=c; max=Math.max(c, max); int lim=arr.length/i; for(int j=2; j<=lim; j++){ if(visit[...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ — endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
7fe3f4a64ebd4473ed0fc4f8f9e840a0
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class Cf182 implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private SpaceC...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ — endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
4ed8563b1203427c7a15094149e17515
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Main { static int t; static int n; static String s; public static void main(String[] args) { PrintWriter pw = new PrintWriter(System.out)...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ — endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
1645f58c7877a7592e5d2c1f076fa8a5
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import javafx.util.Pair; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Main { static int t; static int n; static String s; public static void main(String[] args) { PrintWriter pw = n...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ — endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
b412fcf79f9b7bc806079dc7664d20d3
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import javafx.util.Pair; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Main { static int t; static int n; static String s; public static void main(String[] args) { PrintWriter pw = n...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ — endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
8482546ad6594d8b91a5e09eeab5b953
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Set; import java.util.StringTokenizer; public class q3 { public static void main(String[] args) { FastReader s = new FastRe...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ — endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
2b6cfd83d49bea27ae290cc481b2cd34
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.util.*; import javafx.util.Pair; public class YetAnotherWalkingRobot { static class Node { int x; int y; int index; public Node(int x, int y) { this.x = x; this.y = y; // this.index=index; } @Override publi...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ — endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
4f46ab99a6e373c0b568bebcb94074fe
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.util.*; import javafx.util.Pair; public class YetAnotherWalkingRobot { static class Node { int x; int y; int index; public Node(int x, int y) { this.x = x; this.y = y; // this.index=index; } @Override publi...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ — endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
516cb7b005a300cae9ae35c9658543b7
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
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 j=0;j<t;j++) { int x=0,y=0,flag=0,len=0,w=0,r=0,min=Integer.MAX_VALUE; int n=sc.nextInt(); String s=sc.next(); Pair arr[]=new Pair[n+1]; ...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ — endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
69422302b889807e432695bb3146524c
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.util.HashMap; import java.util.Scanner; public class Robot { public static void main(String[] args) { int tc; int n; String str; Scanner input = new Scanner(System.in); tc = input.nextInt(); for(int i=0; i<tc; i++) { n = input.nextInt(); input.nextLine(); str = input.nextLine(...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ — endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
9d1199ea73829aff72f028b0d70c2d88
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.util.*; public final class C1296 { // private static class Pair { // int x; // int y; // Pair(int x, int y) { // this.x = x; // this.y = y; // } // @Override // public int hashCode() { // return x * 1000000 + y; // } // @Override // public boolean...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ — endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
4ee68feb7ab597177509ceada14c6e65
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.util.*; public final class C1296 { private static class Pair { int x; int y; Pair(int x, int y) { this.x = x; this.y = y; } @Override public int hashCode() { return x * 67 + y * 67 * 67; } @Override public boolean equals(Object p) { if (p ==...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ — endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
226ee039fa6f0b3004b8226fdb04b805
train_001.jsonl
1349105400
We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not.
256 megabytes
import java.util.*; import java.io.*; public final class TestClass { private static Set<Long> getPrimeSquares(){ Set<Long> primeSquares = new HashSet<>(); int n = 1000000; boolean[] compBool = new boolean[n]; for (int i = 2; i < n; i++){ if (compBool[i]) continue; ...
Java
["3\n4 5 6"]
2 seconds
["YES\nNO\nNO"]
NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO".
Java 11
standard input
[ "binary search", "number theory", "implementation", "math" ]
6cebf9af5cfbb949f22e8b336bf07044
The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec...
1,300
Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't.
standard output
PASSED
4529d8e3ab1bbb7ff1a3282ce983256e
train_001.jsonl
1349105400
We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not.
256 megabytes
import java.util.*; import java.io.*; public class Main{ public static boolean isPrime(long x) { if(x<2) return false; else if(x==2) return true; else if(x%2==0) return false; int n=(int)Math.sqrt(x); for(int i=3;i<=n;i=i+2) if(x%i==0) return false; ...
Java
["3\n4 5 6"]
2 seconds
["YES\nNO\nNO"]
NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO".
Java 11
standard input
[ "binary search", "number theory", "implementation", "math" ]
6cebf9af5cfbb949f22e8b336bf07044
The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec...
1,300
Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't.
standard output
PASSED
f7f05650acf57f46c4122d22d3d57410
train_001.jsonl
1349105400
We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not.
256 megabytes
import java.math.BigInteger; import java.util.Scanner; public class test2 { public static void main(String[] args) { Scanner insert = new Scanner(System.in); int n = insert.nextInt(); int[] a=new int[10000001]; for(int i=2;i<=1000000;i++) { a[i]=1; } ...
Java
["3\n4 5 6"]
2 seconds
["YES\nNO\nNO"]
NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO".
Java 11
standard input
[ "binary search", "number theory", "implementation", "math" ]
6cebf9af5cfbb949f22e8b336bf07044
The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec...
1,300
Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't.
standard output
PASSED
2d6f41ee1f6cb1e2b0cf2fa65b9891a4
train_001.jsonl
1349105400
We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not.
256 megabytes
import com.sun.source.tree.Tree; import java.lang.reflect.Array; import java.util.*; import java.lang.*; import java.util.regex.Pattern; public class Example { public static int Max(int[] p) { int Max=0; int j=0; for(int i=0;i<p.length;i++) { if(p[i]>Max) ...
Java
["3\n4 5 6"]
2 seconds
["YES\nNO\nNO"]
NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO".
Java 11
standard input
[ "binary search", "number theory", "implementation", "math" ]
6cebf9af5cfbb949f22e8b336bf07044
The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec...
1,300
Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't.
standard output
PASSED
14e19b2789e38e1e3d945aca074a2e9e
train_001.jsonl
1349105400
We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not.
256 megabytes
import java.util.*; import java.awt.List; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.*; public class Nfactor { public static boolean[] countPrimes(int n) { boolean[] k = new boolean[n + 1]; if (n == 0) ret...
Java
["3\n4 5 6"]
2 seconds
["YES\nNO\nNO"]
NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO".
Java 11
standard input
[ "binary search", "number theory", "implementation", "math" ]
6cebf9af5cfbb949f22e8b336bf07044
The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec...
1,300
Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't.
standard output
PASSED
ed0b89840126065c1bd5459b816b6575
train_001.jsonl
1349105400
We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader inb = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(inb.readLine()); ...
Java
["3\n4 5 6"]
2 seconds
["YES\nNO\nNO"]
NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO".
Java 11
standard input
[ "binary search", "number theory", "implementation", "math" ]
6cebf9af5cfbb949f22e8b336bf07044
The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec...
1,300
Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't.
standard output
PASSED
74e169b05286018085fe21d934d8b4cd
train_001.jsonl
1349105400
We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not.
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int a = 1000007; boolean[] prime = new boolean[a]; int c = (int) Math.sqrt(a) + 2; prime[0]=true; prime[1]=true; ...
Java
["3\n4 5 6"]
2 seconds
["YES\nNO\nNO"]
NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO".
Java 11
standard input
[ "binary search", "number theory", "implementation", "math" ]
6cebf9af5cfbb949f22e8b336bf07044
The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec...
1,300
Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't.
standard output
PASSED
295d9087413094909509205b4c83d855
train_001.jsonl
1349105400
We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not.
256 megabytes
import java.util.*; public class MyClass { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); long a[]=new long[n]; long var; for(int i=0;i<n;i++) { a[i]=sc.nextLong(); } long[] prime = ne...
Java
["3\n4 5 6"]
2 seconds
["YES\nNO\nNO"]
NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO".
Java 11
standard input
[ "binary search", "number theory", "implementation", "math" ]
6cebf9af5cfbb949f22e8b336bf07044
The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec...
1,300
Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't.
standard output
PASSED
e57b4f1422e1fd26b372bf0f8abdd76d
train_001.jsonl
1349105400
We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not.
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class test { public static void main(String[] args) { int test = fs.nextInt(); // int test = 1; for (int cases = 0; cases < test; cases++) { long n = fs.nextLong(); double sq = Math.sqrt(n); if (Math.floor(sq) == Math.ceil(sq)) { int ...
Java
["3\n4 5 6"]
2 seconds
["YES\nNO\nNO"]
NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO".
Java 11
standard input
[ "binary search", "number theory", "implementation", "math" ]
6cebf9af5cfbb949f22e8b336bf07044
The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec...
1,300
Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't.
standard output
PASSED
6e92d6f7c7ee1531d47e8fbc6c2fa5ea
train_001.jsonl
1349105400
We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not.
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class test { public static void main(String[] args) { int test = fs.nextInt(); // int test = 1; for (int cases = 0; cases < test; cases++) { long n = fs.nextLong(); double sq = Math.sqrt(n); if (Math.floor(sq) == Math.ceil(sq)) { long...
Java
["3\n4 5 6"]
2 seconds
["YES\nNO\nNO"]
NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO".
Java 11
standard input
[ "binary search", "number theory", "implementation", "math" ]
6cebf9af5cfbb949f22e8b336bf07044
The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec...
1,300
Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't.
standard output
PASSED
dc0ba2dc0d8641f6a593a3f7e35bb6a1
train_001.jsonl
1349105400
We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not.
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class test { public static void main(String[] args) { int test = fs.nextInt(); // int test = 1; for (int cases = 0; cases < test; cases++) { long n = fs.nextLong(); double sq = Math.sqrt(n); if (Math.floor(sq) == Math.ceil(sq)) { int ...
Java
["3\n4 5 6"]
2 seconds
["YES\nNO\nNO"]
NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO".
Java 11
standard input
[ "binary search", "number theory", "implementation", "math" ]
6cebf9af5cfbb949f22e8b336bf07044
The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec...
1,300
Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't.
standard output
PASSED
3d6053826e41f72a4b39418683a56119
train_001.jsonl
1349105400
We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not.
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class P1 implements Runnable { public static void main(String args[]) throws Exception { new Thread(null, new P1(),"P1",1<<27).start(); } public void run() { In...
Java
["3\n4 5 6"]
2 seconds
["YES\nNO\nNO"]
NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO".
Java 11
standard input
[ "binary search", "number theory", "implementation", "math" ]
6cebf9af5cfbb949f22e8b336bf07044
The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec...
1,300
Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't.
standard output
PASSED
2fab2ac45cc62615ae7693bdd7c0675e
train_001.jsonl
1349105400
We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not.
256 megabytes
//note: 0<=|int|<=2 * 10^9 //note: 0<=|long|<= 9 * 10^18 import java.io.*; import java.util.*; public class MyProgram{ public static void main(String[] args) { MyScanner sc = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); boolean[] prime = new boolean[(int) ...
Java
["3\n4 5 6"]
2 seconds
["YES\nNO\nNO"]
NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO".
Java 11
standard input
[ "binary search", "number theory", "implementation", "math" ]
6cebf9af5cfbb949f22e8b336bf07044
The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec...
1,300
Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't.
standard output
PASSED
eb8f6df9b45788ceb6ed5db75625fcd9
train_001.jsonl
1349105400
We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not.
256 megabytes
import java.util.*; public class TPrimes { static void sieve(boolean a[]) { int n = 1_000_000; for(int i =0;i<n;i++) { a[i] = true; } a[0] = a[1] = false; for(int i =2;i<n;i++) { if(a[i] == true) { long j = (long)i*i; while(j<n) { a[(int)j] = false; j+=i; } } } } ...
Java
["3\n4 5 6"]
2 seconds
["YES\nNO\nNO"]
NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO".
Java 11
standard input
[ "binary search", "number theory", "implementation", "math" ]
6cebf9af5cfbb949f22e8b336bf07044
The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec...
1,300
Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't.
standard output
PASSED
3f5d8553337930a6ae228842955f0132
train_001.jsonl
1349105400
We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not.
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Saturday{ public static void main(String args[]) throws IOException{ Scanner in = new Scanner(System.in); long n = in.nextLong(); long x; int rt; boolean prime; boolean ar[] = new boolean[10...
Java
["3\n4 5 6"]
2 seconds
["YES\nNO\nNO"]
NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO".
Java 11
standard input
[ "binary search", "number theory", "implementation", "math" ]
6cebf9af5cfbb949f22e8b336bf07044
The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec...
1,300
Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't.
standard output
PASSED
3c8907a3adab3e44c496483320166f2b
train_001.jsonl
1349105400
We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not.
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Saturday{ public static void main(String args[]) throws IOException{ Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); long n = in.nextInt(); long x; int rt; boolean pr...
Java
["3\n4 5 6"]
2 seconds
["YES\nNO\nNO"]
NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO".
Java 11
standard input
[ "binary search", "number theory", "implementation", "math" ]
6cebf9af5cfbb949f22e8b336bf07044
The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec...
1,300
Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't.
standard output
PASSED
aa13a4a51139c5c5cdc6fa4232a11b65
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Baskets { private static void outputOdd(int totalBaskets, int totalBalls) { int centre = (totalBaskets + 1)/2; int offset = 0; for(int i = 0; i<totalBalls; i++) { if(offset==0) { System.out.print...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
63d00b93abdcceebd9c06935c3a4032d
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; public class Round123_B { public static void main(String[] args) throws IOException { BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = ...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
c06bbd98346e1fe48babe6807378a543
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class con123_B { public static void main( final String[] args ) throws IOException { final BufferedReader br = new BufferedReader( new InputStreamReader( System.in ) ); final String[] parts = br.rea...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
54f190fef5cf6552a4dbbb89516cbd5f
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { FastScanner in = new FastScanner(System.in); int n = in.nextInt(), m = in.nextInt(); int last = m, c; for (int i = 1; i <= n; i++) { if (m % 2 == 0) { i...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
26a0384cfde318cc6758934899ae1a04
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.util.PriorityQueue; import java.util.Scanner; public class two { public static void main(String[] args) { PriorityQueue<obj> q = new PriorityQueue<obj>(); Scanner sc = new Scanner(System.in); n = sc.nextInt(); m = sc.nextInt(); for (int i = 1; i <= m; i++) ...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
f1d5bb583cf15739a237e68d1b9eb300
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.util.Scanner; public class Prob195B { public static void main(String[] Args) { Scanner in = new Scanner(System.in); int balls = in.nextInt(); int baskets = in.nextInt(); int[] arr = new int[baskets]; if (baskets % 2 == 0) { arr[0] = (baskets) / 2; arr[1] = (baskets) / 2 + 1; for (int i...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
c7b937841bb6230fac3245d6ba34d9a7
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.io.PrintWriter; import java.util.Scanner; public class B { public static void main(String[] args) throws Exception{ // TODO Auto-generated method stub Scanner in=new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); PrintWriter out=new Pri...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
fefab308e2f11a366eeebd55a86d1ca8
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.StringTokenizer; public class Main implements Runnable { void solution() throws IOException { int n = nextInt(); int m = nextInt(); int[] p = new int[m]; int k = 0; if (m % 2 == 1) { int middle = m / 2;...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
560f85792b3a57f7a56b8dc35e484667
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.io.*; import java.util.*; public class Main { BufferedReader br; int[] a; int n, m, mid; public class Node implements Comparable<Node> { int id; public Node(int id) { this.id = id; } public int compareTo(Node node) { if (Math.abs(mid - 2 * this.id) < Math.abs(mid - 2 ...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
3bc68070ab32ffeb10af04e703c2b6f4
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.io.BufferedInputStream; import java.io.IOException; import java.util.Arrays; import java.util.Comparator; import java.util.Scanner; public class B195 { public static void main(String[] args) throws IOException { solve(); } public static void solve()throws IOException{ Scanner scan = new Scanner(ne...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
b4b385a8ca22c8a13e732c0d393241fb
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class B implements Runnable { BufferedReader in; PrintWriter out; StringTokenizer st; Random rnd; int[] already, distances; void solve() throws IOException { int n = nextInt(), m = nextInt(); already = new int[m]; distances = new i...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
aa9a4f4ac34347e5dce5b49b82bdc432
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.util.*; import java.text.*; import java.io.BufferedReader;import java.math.*; import java.util.regex.*; import java.awt.geom.*; import static java.lang.Math.*; import static java.lang.Character.*; import static java.lang.Integer.*; import static java.lang.Double.*; import static java.lang.Long.*; import sta...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
9e64f3d23ca8bf9fe330fb458bd254e4
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; /** * */ /** * @author antonio081014 * @date Jun 10, 2012, 8:31:50 AM * */ public class A { public int[] map; public int[] count; public static void main(String[] args) throws Exception { A main = new A(); main.run(); System.exit(0); ...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
dbd060b24a6750089d68c2e348f877a8
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.io.PrintWriter; import java.util.Scanner; public class AfterTraining { public static void solve(int n, int m, PrintWriter out) { if (m % 2 == 1) { int middle = (m + 1) / 2; int count = 0; while (count < n) { out.println(middle); count++; if (count == n) { return; } f...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
8d26147a271af77457193b1213e5f40d
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), m = sc.nextInt(), count = m, last = (m + 1) / 2; Queue<Integer> que = new LinkedList<Integer>(); if (count % 2 == 1) { que.add(last...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
5b48ac780a7e0dc58f42980735fd3f78
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.PriorityQueue; import java.util.StringTokenizer; /* * To change this template, choose Tools | Templates * and open the template in the editor. ...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
33343155668b4de5e63fa8fe9f5900fb
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.io.*; import java.util.*; /** * */ public class Solution { public static Integer nBalls=0; public static Integer nBaskets=0; public class BasketComparator implements Comparator<Integer>{ @Override public int compare(Integer arg0, Integer arg1) { Double c0=Math.abs((((double)nBaskets+1)/2)-(d...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
2871c87a427d3b7941428dd6ee6ff17c
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.util.Scanner; public class B { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), m = sc.nextInt(); int cnt = 0; int l = (int) Math.ceil(1d * n / m); if ((m & 1) == 1) { for (int i = 0; ...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
377045bfa2329114c916c866390ff040
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.util.*; import java.math.*; import java.io.*; public class Main { public static void main(String args[]) throws IOException { Scanner c=new Scanner(System.in); int N=c.nextInt(); int M=c.nextInt(); PriorityQueue<basket> Q=new PriorityQueue<basket>(); for(int i=0;i<M;i++) Q.add(new basket(0...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
63917387ac51fda13c979f882b4840e8
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.awt.Point; import java.io.*; import java.math.BigInteger; import java.util.*; import static java.lang.Math.*; public class A { final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE")!=null; BufferedReader in; PrintWriter out; StringTokenizer tok = new Strin...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
323d1e2a1aa228eb97b34d57019ab95e
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.util.Scanner; public class B { public int [] solve( int a , int b) { int [] res = new int[a]; if( b == 1 ) { for( int i=0 ; i<a ; i ++){ res[i] = 1; } return res; } int mid = ( b + 1 ) / 2; int beg = mid ; int end = mid+1 > b ? b : mid +1; int suma = 0 ; int sumb = 0 ; f...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
b77b9dde2c72448658800a58e88b36a1
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
//package contest_123_div2; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.Reader; import java.io.StreamTokenizer; import java.io.Writer; import java.util.Arrays; /** *...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
2774f6b7dd4887044222c94d9337d7fe
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
//package round123; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; import java.util.PriorityQueue; import java.util.Queue; public class B { InputStream is; PrintWriter out; String INPUT = ...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
7e0a5172ffc3507c3cc991f522e3fc88
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.InputMismatchException; import java.io.Writer; import java.math.BigInteger; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author lwc626 */ public class Main { ...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
ebb52ae5fa28ebd72e954c0757078307
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.util.*; public class P195B { public static void main(String[] args) { Scanner in = new Scanner(System.in); int N = in.nextInt(); int M = in.nextInt(); double mid = (M+1)/2; int pos = 0; if (M%2 == 0) pos = -1; for (int n = 0; ...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
16c3f8c47bd7475eb00a1768653d95a4
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.SortedSet; import java.util.StringTokenizer; public class ProblemB { public static void main(St...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
f3b20e8ce657a50c2e80348e43ddbd24
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Scanner; public class Sourcecode { public static void main(String[] args) { Scanner input = new Scanner(System.in); int ballnumber= input.nextInt(); int basketnumber = input.n...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
43fec7c6e688b1cf01d535cb18f18625
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.io.*; import java.util.*; public class B { String line; StringTokenizer inputParser; BufferedReader is; FileInputStream fstream; DataInputStream in; String FInput=""; void openInput(String file) { if(file==null)is = ...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
559eb4f7f9219f0e374e922561e23b11
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.util.*; /** * Created by IntelliJ IDEA. * User: piyushd * Date: 3/26/11 * Time: 10:53 PM * To change this template use File | Settings | File Templates. */ public class TaskB { void run() { int N = nextInt(), M = nextInt(); int [] pos = new int[M]; if (M % 2 == 0) { ...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
2bf565297d9edcbf5f971e5aff505091
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.io.*; import java.util.*; public class B { public static void main(String[] args) throws Exception { new B().solve(); } void solve() throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String[] sp = in.readLine().split(" "); ...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
c783c1f403cf71400d300f5d137146ea
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n=s.nextInt(); int N[]=new int[n]; int m=s.nextInt(); int mn=0; int mid=(m-1)/2; Boolean dec=false; in...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
e7c6d58bf1246709648b5dcb80766a96
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; import java.util.TreeSet; public class b123 { public static void debug(Object... obs) { System.out.println(Arrays.deepToString(obs)); } public static void main(String[] args) { Scanner sc = new Scanner(System.in); ...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
11c4fd07d8d5901839234aff7b47989e
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.util.*; public class B { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); final int m = in.nextInt(); TreeSet<Integer> X = new TreeSet<Integer>(new Comparator<Integer>() { public int compare(Integer A, Integer B) { double sa = Math.abs((m+1)...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
e786ffa709b06d82030e812775912306
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.io.*; public class B { public static void main(String[] args) throws IOException { BufferedReader r; r = new BufferedReader(new InputStreamReader(System.in)); //r = new BufferedReader(new FileReader(new File("in.txt"))); String[] line = r.readLine().split(" "); int n = Integer.parseInt(line[0]...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
d3787b194192037aec5ce47f69537fbb
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.StreamTokenizer; public class B { public static void main(String[] args) throws Exception { int n = nextInt(), m = nextInt(); ...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
618df0d43015c68c96af3a3e74789173
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.io.PrintStream; import java.util.Scanner; /** Nov 10, 2012 **/ /** * @author DOAN Minh Quy * @email mquy.doan@gmail.com */ public class B195 { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub new B195().run(); } void run(){ Scanner scanner ...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
086522f42d57b3a271a647fc8ff58136
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.io.*; import java.util.*; public class Main { int n, m; class Pair implements Comparable< Pair > { int idx, balls; public Pair( int i, int b ) { idx = i; balls = b; } public int compareTo( Pair p ) { if ( balls != p.balls ) { ...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
90ddc4f790e35153cb9d6b734e5ae7f0
train_001.jsonl
1339342200
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The ...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; import java.util.Map.Entry; public class Main { public static void main(String[] args) throws IOException { (new Main()).solve(); } public void Main() { } void solve() throws IOException { // BufferedReader in = new BufferedReader(new // I...
Java
["4 3", "3 1"]
2 seconds
["2\n1\n3\n2", "1\n1\n1"]
null
Java 6
standard input
[ "data structures", "implementation", "math" ]
907893a0a78a7444d26bdd793d9c7499
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.
1,300
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.
standard output
PASSED
ac06c4f1aaac56370240afff2475141d
train_001.jsonl
1590503700
Maria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus.She has $$$n$$$ friends who are also grannies (Maria is not included in this number). The $$$i$$$-th granny is ready to attend the ceremony, provided that at the time of her appea...
256 megabytes
import java.util.*; public class S { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t=sc.nextInt(); for(int i=0;i<t;i++) { int n=sc.nextInt(); int a[]=new int[n]; for(int j=0;j<n;j++) { ...
Java
["4\n5\n1 1 2 2 1\n6\n2 3 4 5 6 7\n6\n1 5 4 5 1 9\n5\n1 2 3 5 6"]
2 seconds
["6\n1\n6\n4"]
NoteIn the first test case in the example, on the first step Maria can call all the grannies. Then each of them will see five grannies when they come out. Therefore, Maria and five other grannies will be in the yard.In the second test case in the example, no one can be in the yard, so Maria will remain there alone.The ...
Java 8
standard input
[ "sortings", "greedy" ]
718cea81f609055cece58cae5310f703
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then test cases follow. The first line of a test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of grannies (Maria is not included in this number). The second line contains $$...
1,000
For each test case, print a single integer $$$k$$$ ($$$1 \le k \le n + 1$$$) — the maximum possible number of grannies in the courtyard.
standard output
PASSED
17203a61e598d0cb53c1d5864c6a7c24
train_001.jsonl
1590503700
Maria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus.She has $$$n$$$ friends who are also grannies (Maria is not included in this number). The $$$i$$$-th granny is ready to attend the ceremony, provided that at the time of her appea...
256 megabytes
import java.util.*; public class T { public static void main(String[] args) { int loop; // System.out.println("1st"); Scanner sc = new Scanner(System.in); loop = sc.nextInt(); ArrayList<Integer> ans=new ArrayList<Integer>(); while(loop>0){//System.out.println("2t"); ...
Java
["4\n5\n1 1 2 2 1\n6\n2 3 4 5 6 7\n6\n1 5 4 5 1 9\n5\n1 2 3 5 6"]
2 seconds
["6\n1\n6\n4"]
NoteIn the first test case in the example, on the first step Maria can call all the grannies. Then each of them will see five grannies when they come out. Therefore, Maria and five other grannies will be in the yard.In the second test case in the example, no one can be in the yard, so Maria will remain there alone.The ...
Java 8
standard input
[ "sortings", "greedy" ]
718cea81f609055cece58cae5310f703
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then test cases follow. The first line of a test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of grannies (Maria is not included in this number). The second line contains $$...
1,000
For each test case, print a single integer $$$k$$$ ($$$1 \le k \le n + 1$$$) — the maximum possible number of grannies in the courtyard.
standard output
PASSED
dd3ca7b6fa056d8cf8a3275b493af322
train_001.jsonl
1590503700
Maria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus.She has $$$n$$$ friends who are also grannies (Maria is not included in this number). The $$$i$$$-th granny is ready to attend the ceremony, provided that at the time of her appea...
256 megabytes
import java.util.* ; public class SelfIsolation{ public static void main(String []args){ Scanner sc1 = new Scanner(System.in); int t = sc1.nextInt(); while(t>0) { int n = sc1.nextInt(); int array[] = new int[n] ; for(...
Java
["4\n5\n1 1 2 2 1\n6\n2 3 4 5 6 7\n6\n1 5 4 5 1 9\n5\n1 2 3 5 6"]
2 seconds
["6\n1\n6\n4"]
NoteIn the first test case in the example, on the first step Maria can call all the grannies. Then each of them will see five grannies when they come out. Therefore, Maria and five other grannies will be in the yard.In the second test case in the example, no one can be in the yard, so Maria will remain there alone.The ...
Java 8
standard input
[ "sortings", "greedy" ]
718cea81f609055cece58cae5310f703
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then test cases follow. The first line of a test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of grannies (Maria is not included in this number). The second line contains $$...
1,000
For each test case, print a single integer $$$k$$$ ($$$1 \le k \le n + 1$$$) — the maximum possible number of grannies in the courtyard.
standard output
PASSED
87e52ee3edd042e7fcf0f4650834692c
train_001.jsonl
1590503700
Maria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus.She has $$$n$$$ friends who are also grannies (Maria is not included in this number). The $$$i$$$-th granny is ready to attend the ceremony, provided that at the time of her appea...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void solve(InputReader in) { int n = in.readInt(); int a[] = new int[n]; for(int i = 0; i<n; i++) a[i] = in.readInt(); Arrays.sort(a); for(int i = n-1; i>= 0; i--) { if(a[i] <= i+1) { System.out.println(i+2); r...
Java
["4\n5\n1 1 2 2 1\n6\n2 3 4 5 6 7\n6\n1 5 4 5 1 9\n5\n1 2 3 5 6"]
2 seconds
["6\n1\n6\n4"]
NoteIn the first test case in the example, on the first step Maria can call all the grannies. Then each of them will see five grannies when they come out. Therefore, Maria and five other grannies will be in the yard.In the second test case in the example, no one can be in the yard, so Maria will remain there alone.The ...
Java 8
standard input
[ "sortings", "greedy" ]
718cea81f609055cece58cae5310f703
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then test cases follow. The first line of a test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of grannies (Maria is not included in this number). The second line contains $$...
1,000
For each test case, print a single integer $$$k$$$ ($$$1 \le k \le n + 1$$$) — the maximum possible number of grannies in the courtyard.
standard output
PASSED
44588e51bac57e95b0186f3322a7fcd4
train_001.jsonl
1590503700
Maria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus.She has $$$n$$$ friends who are also grannies (Maria is not included in this number). The $$$i$$$-th granny is ready to attend the ceremony, provided that at the time of her appea...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void solve(InputReader in) { int n = in.readInt(); int a[] = new int[n]; for(int i = 0; i<n; i++) a[i] = in.readInt(); Arrays.sort(a); int ans1 = 1; for(int i = 0; i<n; i++) { if(a[i] <= ans1) { ans1++; } } ...
Java
["4\n5\n1 1 2 2 1\n6\n2 3 4 5 6 7\n6\n1 5 4 5 1 9\n5\n1 2 3 5 6"]
2 seconds
["6\n1\n6\n4"]
NoteIn the first test case in the example, on the first step Maria can call all the grannies. Then each of them will see five grannies when they come out. Therefore, Maria and five other grannies will be in the yard.In the second test case in the example, no one can be in the yard, so Maria will remain there alone.The ...
Java 8
standard input
[ "sortings", "greedy" ]
718cea81f609055cece58cae5310f703
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then test cases follow. The first line of a test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of grannies (Maria is not included in this number). The second line contains $$...
1,000
For each test case, print a single integer $$$k$$$ ($$$1 \le k \le n + 1$$$) — the maximum possible number of grannies in the courtyard.
standard output
PASSED
2f60f5ca3a5d7d52e0a880768697bed5
train_001.jsonl
1590503700
Maria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus.She has $$$n$$$ friends who are also grannies (Maria is not included in this number). The $$$i$$$-th granny is ready to attend the ceremony, provided that at the time of her appea...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top * * @author Tanzim Ibn Patowary */ public class Main { public static void main(S...
Java
["4\n5\n1 1 2 2 1\n6\n2 3 4 5 6 7\n6\n1 5 4 5 1 9\n5\n1 2 3 5 6"]
2 seconds
["6\n1\n6\n4"]
NoteIn the first test case in the example, on the first step Maria can call all the grannies. Then each of them will see five grannies when they come out. Therefore, Maria and five other grannies will be in the yard.In the second test case in the example, no one can be in the yard, so Maria will remain there alone.The ...
Java 8
standard input
[ "sortings", "greedy" ]
718cea81f609055cece58cae5310f703
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then test cases follow. The first line of a test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of grannies (Maria is not included in this number). The second line contains $$...
1,000
For each test case, print a single integer $$$k$$$ ($$$1 \le k \le n + 1$$$) — the maximum possible number of grannies in the courtyard.
standard output
PASSED
afbe4a4dd740daa3ecccc79b6ad091c5
train_001.jsonl
1590503700
Maria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus.She has $$$n$$$ friends who are also grannies (Maria is not included in this number). The $$$i$$$-th granny is ready to attend the ceremony, provided that at the time of her appea...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Train { static class InputReader { BufferedReader reader; StringTokenizer tokenizer; public InputReader(InputStream stream) { reader = new BufferedReader(new InputStreamReader(stream), 32768); ...
Java
["4\n5\n1 1 2 2 1\n6\n2 3 4 5 6 7\n6\n1 5 4 5 1 9\n5\n1 2 3 5 6"]
2 seconds
["6\n1\n6\n4"]
NoteIn the first test case in the example, on the first step Maria can call all the grannies. Then each of them will see five grannies when they come out. Therefore, Maria and five other grannies will be in the yard.In the second test case in the example, no one can be in the yard, so Maria will remain there alone.The ...
Java 8
standard input
[ "sortings", "greedy" ]
718cea81f609055cece58cae5310f703
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then test cases follow. The first line of a test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of grannies (Maria is not included in this number). The second line contains $$...
1,000
For each test case, print a single integer $$$k$$$ ($$$1 \le k \le n + 1$$$) — the maximum possible number of grannies in the courtyard.
standard output
PASSED
d3b893190ac2030b3088a2ce78fcc4be
train_001.jsonl
1590503700
Maria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus.She has $$$n$$$ friends who are also grannies (Maria is not included in this number). The $$$i$$$-th granny is ready to attend the ceremony, provided that at the time of her appea...
256 megabytes
import java.util.*; public class C645_PB { 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 n = in.nextInt(); int[] a = new int[n]; for(int i =0;i<n;i++) a[i] = in.nextInt(); Arrays.sort(a...
Java
["4\n5\n1 1 2 2 1\n6\n2 3 4 5 6 7\n6\n1 5 4 5 1 9\n5\n1 2 3 5 6"]
2 seconds
["6\n1\n6\n4"]
NoteIn the first test case in the example, on the first step Maria can call all the grannies. Then each of them will see five grannies when they come out. Therefore, Maria and five other grannies will be in the yard.In the second test case in the example, no one can be in the yard, so Maria will remain there alone.The ...
Java 8
standard input
[ "sortings", "greedy" ]
718cea81f609055cece58cae5310f703
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then test cases follow. The first line of a test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of grannies (Maria is not included in this number). The second line contains $$...
1,000
For each test case, print a single integer $$$k$$$ ($$$1 \le k \le n + 1$$$) — the maximum possible number of grannies in the courtyard.
standard output
PASSED
5ee480b89f81cb118c96e0f1fa94018c
train_001.jsonl
1590503700
Maria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus.She has $$$n$$$ friends who are also grannies (Maria is not included in this number). The $$$i$$$-th granny is ready to attend the ceremony, provided that at the time of her appea...
256 megabytes
import java.util.*; public class Solution { public static void main(String ar[]) { Scanner scan=new Scanner(System.in); int test=scan.nextInt(); while(test-->0) { int n=scan.nextInt(); int arr[]=new int[n]; for(int i=0;i<n;i++) ...
Java
["4\n5\n1 1 2 2 1\n6\n2 3 4 5 6 7\n6\n1 5 4 5 1 9\n5\n1 2 3 5 6"]
2 seconds
["6\n1\n6\n4"]
NoteIn the first test case in the example, on the first step Maria can call all the grannies. Then each of them will see five grannies when they come out. Therefore, Maria and five other grannies will be in the yard.In the second test case in the example, no one can be in the yard, so Maria will remain there alone.The ...
Java 8
standard input
[ "sortings", "greedy" ]
718cea81f609055cece58cae5310f703
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then test cases follow. The first line of a test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of grannies (Maria is not included in this number). The second line contains $$...
1,000
For each test case, print a single integer $$$k$$$ ($$$1 \le k \le n + 1$$$) — the maximum possible number of grannies in the courtyard.
standard output
PASSED
babdddb2ec7719ec7b1762317dda6373
train_001.jsonl
1590503700
Maria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus.She has $$$n$$$ friends who are also grannies (Maria is not included in this number). The $$$i$$$-th granny is ready to attend the ceremony, provided that at the time of her appea...
256 megabytes
import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.time.LocalTime; import java.util.*; import java.util.concurrent.*; import java.util.regex.*; import java.math.*; public class A { public static void main(String[] args) { FastScanner scan = new FastScanner()...
Java
["4\n5\n1 1 2 2 1\n6\n2 3 4 5 6 7\n6\n1 5 4 5 1 9\n5\n1 2 3 5 6"]
2 seconds
["6\n1\n6\n4"]
NoteIn the first test case in the example, on the first step Maria can call all the grannies. Then each of them will see five grannies when they come out. Therefore, Maria and five other grannies will be in the yard.In the second test case in the example, no one can be in the yard, so Maria will remain there alone.The ...
Java 8
standard input
[ "sortings", "greedy" ]
718cea81f609055cece58cae5310f703
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then test cases follow. The first line of a test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of grannies (Maria is not included in this number). The second line contains $$...
1,000
For each test case, print a single integer $$$k$$$ ($$$1 \le k \le n + 1$$$) — the maximum possible number of grannies in the courtyard.
standard output
PASSED
54dd0713f3b383732153a1edcf9e04ea
train_001.jsonl
1590503700
Maria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus.She has $$$n$$$ friends who are also grannies (Maria is not included in this number). The $$$i$$$-th granny is ready to attend the ceremony, provided that at the time of her appea...
256 megabytes
import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Map.Entry; import java.util.Scanner; import java.util.Set; public class Gd { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt...
Java
["4\n5\n1 1 2 2 1\n6\n2 3 4 5 6 7\n6\n1 5 4 5 1 9\n5\n1 2 3 5 6"]
2 seconds
["6\n1\n6\n4"]
NoteIn the first test case in the example, on the first step Maria can call all the grannies. Then each of them will see five grannies when they come out. Therefore, Maria and five other grannies will be in the yard.In the second test case in the example, no one can be in the yard, so Maria will remain there alone.The ...
Java 8
standard input
[ "sortings", "greedy" ]
718cea81f609055cece58cae5310f703
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then test cases follow. The first line of a test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of grannies (Maria is not included in this number). The second line contains $$...
1,000
For each test case, print a single integer $$$k$$$ ($$$1 \le k \le n + 1$$$) — the maximum possible number of grannies in the courtyard.
standard output
PASSED
f1579216c2108c4f6de07834f5d070f4
train_001.jsonl
1590503700
Maria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus.She has $$$n$$$ friends who are also grannies (Maria is not included in this number). The $$$i$$$-th granny is ready to attend the ceremony, provided that at the time of her appea...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class r645b { public static void main(String[] args) { Scanner scan=new Scanner(System.in); int t=scan.nextInt(); for(int tt=0;tt<t;tt++) { int n=scan.nextInt(); ArrayList<Integer> temp=new ArrayList<>(); int[] a...
Java
["4\n5\n1 1 2 2 1\n6\n2 3 4 5 6 7\n6\n1 5 4 5 1 9\n5\n1 2 3 5 6"]
2 seconds
["6\n1\n6\n4"]
NoteIn the first test case in the example, on the first step Maria can call all the grannies. Then each of them will see five grannies when they come out. Therefore, Maria and five other grannies will be in the yard.In the second test case in the example, no one can be in the yard, so Maria will remain there alone.The ...
Java 8
standard input
[ "sortings", "greedy" ]
718cea81f609055cece58cae5310f703
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then test cases follow. The first line of a test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of grannies (Maria is not included in this number). The second line contains $$...
1,000
For each test case, print a single integer $$$k$$$ ($$$1 \le k \le n + 1$$$) — the maximum possible number of grannies in the courtyard.
standard output
PASSED
2ce3cefad5343c3e5dfafa9ab4dee9b7
train_001.jsonl
1590503700
Maria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus.She has $$$n$$$ friends who are also grannies (Maria is not included in this number). The $$$i$$$-th granny is ready to attend the ceremony, provided that at the time of her appea...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.Col...
Java
["4\n5\n1 1 2 2 1\n6\n2 3 4 5 6 7\n6\n1 5 4 5 1 9\n5\n1 2 3 5 6"]
2 seconds
["6\n1\n6\n4"]
NoteIn the first test case in the example, on the first step Maria can call all the grannies. Then each of them will see five grannies when they come out. Therefore, Maria and five other grannies will be in the yard.In the second test case in the example, no one can be in the yard, so Maria will remain there alone.The ...
Java 8
standard input
[ "sortings", "greedy" ]
718cea81f609055cece58cae5310f703
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then test cases follow. The first line of a test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of grannies (Maria is not included in this number). The second line contains $$...
1,000
For each test case, print a single integer $$$k$$$ ($$$1 \le k \le n + 1$$$) — the maximum possible number of grannies in the courtyard.
standard output
PASSED
afe004bfdae3aa635ebc2114d458b85b
train_001.jsonl
1590503700
Maria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus.She has $$$n$$$ friends who are also grannies (Maria is not included in this number). The $$$i$$$-th granny is ready to attend the ceremony, provided that at the time of her appea...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.valueOf(reader.readLine()); while((t--) != 0) { int n = Integer.valu...
Java
["4\n5\n1 1 2 2 1\n6\n2 3 4 5 6 7\n6\n1 5 4 5 1 9\n5\n1 2 3 5 6"]
2 seconds
["6\n1\n6\n4"]
NoteIn the first test case in the example, on the first step Maria can call all the grannies. Then each of them will see five grannies when they come out. Therefore, Maria and five other grannies will be in the yard.In the second test case in the example, no one can be in the yard, so Maria will remain there alone.The ...
Java 8
standard input
[ "sortings", "greedy" ]
718cea81f609055cece58cae5310f703
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then test cases follow. The first line of a test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of grannies (Maria is not included in this number). The second line contains $$...
1,000
For each test case, print a single integer $$$k$$$ ($$$1 \le k \le n + 1$$$) — the maximum possible number of grannies in the courtyard.
standard output
PASSED
acd16d511aa36f27bd03d5b53881fdbf
train_001.jsonl
1590503700
Maria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus.She has $$$n$$$ friends who are also grannies (Maria is not included in this number). The $$$i$$$-th granny is ready to attend the ceremony, provided that at the time of her appea...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class Main{ public static void main(String[] args) throws Exception { IO io = new IO(); PrintWriter out = new PrintWriter(System.out); Solver sr = new Solver(); sr.solve(io,out); out.flush(); out.close(); } static class Solver { ...
Java
["4\n5\n1 1 2 2 1\n6\n2 3 4 5 6 7\n6\n1 5 4 5 1 9\n5\n1 2 3 5 6"]
2 seconds
["6\n1\n6\n4"]
NoteIn the first test case in the example, on the first step Maria can call all the grannies. Then each of them will see five grannies when they come out. Therefore, Maria and five other grannies will be in the yard.In the second test case in the example, no one can be in the yard, so Maria will remain there alone.The ...
Java 8
standard input
[ "sortings", "greedy" ]
718cea81f609055cece58cae5310f703
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then test cases follow. The first line of a test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of grannies (Maria is not included in this number). The second line contains $$...
1,000
For each test case, print a single integer $$$k$$$ ($$$1 \le k \le n + 1$$$) — the maximum possible number of grannies in the courtyard.
standard output
PASSED
ba4f8453a174d42956705e689485522c
train_001.jsonl
1590503700
Maria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus.She has $$$n$$$ friends who are also grannies (Maria is not included in this number). The $$$i$$$-th granny is ready to attend the ceremony, provided that at the time of her appea...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class Main { public static void main(String args[]) throws Exception { MyScanner sc = new MyScanner(); PrintWriter pr = new ...
Java
["4\n5\n1 1 2 2 1\n6\n2 3 4 5 6 7\n6\n1 5 4 5 1 9\n5\n1 2 3 5 6"]
2 seconds
["6\n1\n6\n4"]
NoteIn the first test case in the example, on the first step Maria can call all the grannies. Then each of them will see five grannies when they come out. Therefore, Maria and five other grannies will be in the yard.In the second test case in the example, no one can be in the yard, so Maria will remain there alone.The ...
Java 8
standard input
[ "sortings", "greedy" ]
718cea81f609055cece58cae5310f703
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then test cases follow. The first line of a test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of grannies (Maria is not included in this number). The second line contains $$...
1,000
For each test case, print a single integer $$$k$$$ ($$$1 \le k \le n + 1$$$) — the maximum possible number of grannies in the courtyard.
standard output
PASSED
2dff2c3e1fbbdcf9771ee369c50243f8
train_001.jsonl
1590503700
Maria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus.She has $$$n$$$ friends who are also grannies (Maria is not included in this number). The $$$i$$$-th granny is ready to attend the ceremony, provided that at the time of her appea...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class my{ public static void main(String[] args) { Scanner s = new Scanner(System.in); int t = s.nextInt(); while (t-- > 0) { int n = s.nextInt(); int[] arr = new int[n]; int[] ans = ...
Java
["4\n5\n1 1 2 2 1\n6\n2 3 4 5 6 7\n6\n1 5 4 5 1 9\n5\n1 2 3 5 6"]
2 seconds
["6\n1\n6\n4"]
NoteIn the first test case in the example, on the first step Maria can call all the grannies. Then each of them will see five grannies when they come out. Therefore, Maria and five other grannies will be in the yard.In the second test case in the example, no one can be in the yard, so Maria will remain there alone.The ...
Java 8
standard input
[ "sortings", "greedy" ]
718cea81f609055cece58cae5310f703
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then test cases follow. The first line of a test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of grannies (Maria is not included in this number). The second line contains $$...
1,000
For each test case, print a single integer $$$k$$$ ($$$1 \le k \le n + 1$$$) — the maximum possible number of grannies in the courtyard.
standard output
PASSED
e8e74e04e93a9cd14443c102652a2d61
train_001.jsonl
1590503700
Maria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus.She has $$$n$$$ friends who are also grannies (Maria is not included in this number). The $$$i$$$-th granny is ready to attend the ceremony, provided that at the time of her appea...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String args[])throws Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw=new PrintWriter(System.out); int t=Integer.parseInt(br.readLine()); for(int x=...
Java
["4\n5\n1 1 2 2 1\n6\n2 3 4 5 6 7\n6\n1 5 4 5 1 9\n5\n1 2 3 5 6"]
2 seconds
["6\n1\n6\n4"]
NoteIn the first test case in the example, on the first step Maria can call all the grannies. Then each of them will see five grannies when they come out. Therefore, Maria and five other grannies will be in the yard.In the second test case in the example, no one can be in the yard, so Maria will remain there alone.The ...
Java 8
standard input
[ "sortings", "greedy" ]
718cea81f609055cece58cae5310f703
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then test cases follow. The first line of a test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of grannies (Maria is not included in this number). The second line contains $$...
1,000
For each test case, print a single integer $$$k$$$ ($$$1 \le k \le n + 1$$$) — the maximum possible number of grannies in the courtyard.
standard output
PASSED
3d7958042fb410338cb3b11101a79972
train_001.jsonl
1590503700
Maria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus.She has $$$n$$$ friends who are also grannies (Maria is not included in this number). The $$$i$$$-th granny is ready to attend the ceremony, provided that at the time of her appea...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class Main1 { BufferedReader br = new BufferedReader(new Input...
Java
["4\n5\n1 1 2 2 1\n6\n2 3 4 5 6 7\n6\n1 5 4 5 1 9\n5\n1 2 3 5 6"]
2 seconds
["6\n1\n6\n4"]
NoteIn the first test case in the example, on the first step Maria can call all the grannies. Then each of them will see five grannies when they come out. Therefore, Maria and five other grannies will be in the yard.In the second test case in the example, no one can be in the yard, so Maria will remain there alone.The ...
Java 8
standard input
[ "sortings", "greedy" ]
718cea81f609055cece58cae5310f703
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then test cases follow. The first line of a test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of grannies (Maria is not included in this number). The second line contains $$...
1,000
For each test case, print a single integer $$$k$$$ ($$$1 \le k \le n + 1$$$) — the maximum possible number of grannies in the courtyard.
standard output
PASSED
87abf343fb2e8dd727a31961af6ed7eb
train_001.jsonl
1590503700
Maria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus.She has $$$n$$$ friends who are also grannies (Maria is not included in this number). The $$$i$$$-th granny is ready to attend the ceremony, provided that at the time of her appea...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class Test2 { static FastScanner sc = new FastScanner(System.in); static PrintWriter out = new P...
Java
["4\n5\n1 1 2 2 1\n6\n2 3 4 5 6 7\n6\n1 5 4 5 1 9\n5\n1 2 3 5 6"]
2 seconds
["6\n1\n6\n4"]
NoteIn the first test case in the example, on the first step Maria can call all the grannies. Then each of them will see five grannies when they come out. Therefore, Maria and five other grannies will be in the yard.In the second test case in the example, no one can be in the yard, so Maria will remain there alone.The ...
Java 8
standard input
[ "sortings", "greedy" ]
718cea81f609055cece58cae5310f703
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then test cases follow. The first line of a test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of grannies (Maria is not included in this number). The second line contains $$...
1,000
For each test case, print a single integer $$$k$$$ ($$$1 \le k \le n + 1$$$) — the maximum possible number of grannies in the courtyard.
standard output
PASSED
43f199e98d6c7bd0cbfa628e2fc9ebc9
train_001.jsonl
1590503700
Maria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus.She has $$$n$$$ friends who are also grannies (Maria is not included in this number). The $$$i$$$-th granny is ready to attend the ceremony, provided that at the time of her appea...
256 megabytes
//package Round; 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 B { InputStream is; PrintWriter out; String INPUT =""; void solve() { for...
Java
["4\n5\n1 1 2 2 1\n6\n2 3 4 5 6 7\n6\n1 5 4 5 1 9\n5\n1 2 3 5 6"]
2 seconds
["6\n1\n6\n4"]
NoteIn the first test case in the example, on the first step Maria can call all the grannies. Then each of them will see five grannies when they come out. Therefore, Maria and five other grannies will be in the yard.In the second test case in the example, no one can be in the yard, so Maria will remain there alone.The ...
Java 8
standard input
[ "sortings", "greedy" ]
718cea81f609055cece58cae5310f703
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then test cases follow. The first line of a test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of grannies (Maria is not included in this number). The second line contains $$...
1,000
For each test case, print a single integer $$$k$$$ ($$$1 \le k \le n + 1$$$) — the maximum possible number of grannies in the courtyard.
standard output
PASSED
22ae632687031ebc4bd13af4ddd61559
train_001.jsonl
1590503700
Maria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus.She has $$$n$$$ friends who are also grannies (Maria is not included in this number). The $$$i$$$-th granny is ready to attend the ceremony, provided that at the time of her appea...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top * * @author @maxximus */ public class Main { public static void main(String[] ar...
Java
["4\n5\n1 1 2 2 1\n6\n2 3 4 5 6 7\n6\n1 5 4 5 1 9\n5\n1 2 3 5 6"]
2 seconds
["6\n1\n6\n4"]
NoteIn the first test case in the example, on the first step Maria can call all the grannies. Then each of them will see five grannies when they come out. Therefore, Maria and five other grannies will be in the yard.In the second test case in the example, no one can be in the yard, so Maria will remain there alone.The ...
Java 8
standard input
[ "sortings", "greedy" ]
718cea81f609055cece58cae5310f703
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then test cases follow. The first line of a test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of grannies (Maria is not included in this number). The second line contains $$...
1,000
For each test case, print a single integer $$$k$$$ ($$$1 \le k \le n + 1$$$) — the maximum possible number of grannies in the courtyard.
standard output
PASSED
3f94c0b1f14576b114b55a44d00751ae
train_001.jsonl
1590503700
Maria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus.She has $$$n$$$ friends who are also grannies (Maria is not included in this number). The $$$i$$$-th granny is ready to attend the ceremony, provided that at the time of her appea...
256 megabytes
import java.util.*; import java.io.*; public class maria { public static void main(String []Args)throws Exception { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); int arr[]=new int[n+1]; arr[0]=1...
Java
["4\n5\n1 1 2 2 1\n6\n2 3 4 5 6 7\n6\n1 5 4 5 1 9\n5\n1 2 3 5 6"]
2 seconds
["6\n1\n6\n4"]
NoteIn the first test case in the example, on the first step Maria can call all the grannies. Then each of them will see five grannies when they come out. Therefore, Maria and five other grannies will be in the yard.In the second test case in the example, no one can be in the yard, so Maria will remain there alone.The ...
Java 8
standard input
[ "sortings", "greedy" ]
718cea81f609055cece58cae5310f703
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. Then test cases follow. The first line of a test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of grannies (Maria is not included in this number). The second line contains $$...
1,000
For each test case, print a single integer $$$k$$$ ($$$1 \le k \le n + 1$$$) — the maximum possible number of grannies in the courtyard.
standard output