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
707f6fc959fe81d96752b9b6675ed3a6
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class D { public static void main(String[] args)throws IOException { FastIO sc = new FastIO(System.in); PrintWriter out = new PrintWriter(System.out); int t = sc.nextInt(); while(t-->0) { int n = sc.nextInt(); int k = sc.nextInt(); int b...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 11
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
22ba90354606ece1910b810e0fdced80
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Learning { static PrintWriter out; public static void main(String[] args) throws Exception { FastInput in = new FastInput(); ...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 11
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
541730a35503d4813bf6401b83043950
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; public class Main { public static void main(String[] args) { final int mod = (int) 1e9 + 7; InputReader in = new InputReader(System.in); PrintWriter out = new PrintWriter(System.o...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 11
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
637d7e8b3ea3a4f4e022f694e4456d96
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
import java.io.*; import java.util.*; public class Solution { public void run() { real(); // test(); } void real() { for (int test = reader.nextInt(); test > 0; test--) { int n = reader.nextInt(); int k = reader.nextInt(); find(n, k); } ...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 11
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
6e8bbe2c41fc3fdf7c32c4f16196704a
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
import java.io.*; import java.util.*; public class Solution { public static void main(String[] args)throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(System.out)); int t=Integer.par...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 11
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
85b525bd225383bc32380ecf6535cc29
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
import java.io.*; import java.util.*; /** * Built using my Brain * Actual solution is at the bottom * * @author Lenard Hoffstader */ public class cfjava { public static void main(String[] args) { OutputStream outputStream = System.out; FastReader in = new FastReader(); PrintWriter out = new Pr...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 11
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
d2206720b5071cf221df685d25167cb2
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
import java.util.*; import java.io.*; public class Grid00100 { // https://codeforces.com/contest/1371/problem/D public static void main(String[] args) throws IOException, FileNotFoundException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); //BufferedReader in = new BufferedReade...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 11
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
6c70e06f1dea4f384e41b0b5bdd04759
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
import java.util.*; import java.io.*; //Captain on duty! public class Main { static void compare(Main.pair a[], int n) { Arrays.sort(a, new Comparator<Main.pair>() { @Override public int compare(Main.pair p1, Main.pair p2) { return p1.f - p2.f; } ...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 11
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
9039866bdd1bd6b7d3bd3d65ca6acbc5
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.*; public class sa { public static void main(String[] args) throws IOException { // TODO Auto-generated method stub Scanner sc=new Scanner(System.in); int t=sc.nextInt()...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 11
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
42cf8bff6e8c2d194aecaf1078a2b94c
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
import java.io.*; import java.util.*; //import javafx.util.*; import java.math.*; //import java.lang.*; public class Main { // static int n; // static HashSet<Integer> adj[]; // static int dist[]; // static int remove[]; // static boolean isLeaf[]; // static Long dp[][]; // static int arr...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 11
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
b6b9ef1c4b52770bab13f4e4eb5639f8
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.TreeSet; public class Task4 { public static void main(String[] args) { try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) { int t = Integer.valueOf(br.readLine()); outer: ...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 11
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
b9a5d79d8576f8f67f0b573546d65c4a
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.lang.reflect.AnnotatedArrayType; import java.lang.reflect.Array; import java.util.*; public class NTI { public static void main(String[] args) throws IOException { BufferedRe...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 11
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
00836474fc0cc0f64018be20c251258b
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.*; public class Practice1 { public static void main(String[] args) throws Exception { FastInput in = new FastInput(); int t = in.nextInt(); ...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 11
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
c2cbc7df59349b6933d4e5e2ec429bbf
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class B { public static void main(String[] args) { FastScanner fs = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int T =...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 11
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
ef1234ec25a412c2fae5cb2e002f1fed
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
import java.io.*; import java.util.*; public class Main { private static void solver(InputReader sc, PrintWriter out) throws Exception { int test = sc.nextInt(); for (int ii = 0; ii < test; ii++) { int n = sc.nextInt(); int k = sc.nextInt(); int arr[][] = new in...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 11
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
78ed38c55c7d9a185b940c0e34b11624
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
//package div2_654; import java.util.Scanner; public class d { public static void main(String[] args) { int t, n, k,a[][]; Scanner in = new Scanner(System.in); t = in.nextInt(); for (int iTest = 0; iTest < t; iTest++) { n = in.nextInt(); k = in.nextInt(); a=new int[n][n]; System.out.println(chec...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 11
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
1374921394e8dc0220ae68f775dd9991
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int T = Integer.parseInt(in.readLine()); for (int t = 0; t < T; ++t) { StringTokenizer st = new StringTok...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 11
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
38d8e2c28cf31972f4ba8fd4ae9ca7cf
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
import java.io.*; import java.util.*; public class GridZeroOne { static class OutputWriter { private final PrintWriter writer; public OutputWriter(OutputStream outputStream) { writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); ...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 11
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
8cad9a0432911315afc996fd3e8f11c6
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
import java.util.*; import java.io.*; public class D{ private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); private static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); public static void main (String[] args) throws IOException{ int t = Integer.pa...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 11
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
54fbacfe1b98d90aef15dc0ffd540ec0
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
import java.util.*; import java.io.*; public class Main { static List<Integer>[] gp; static int cnt1=0; static int cnt2=0; public static void main(String[] args) { try{ PrintWriter out = new PrintWriter(System.out); int t=in.nextInt(); while(t-->0){ int n=in.ne...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 11
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
e61840f9f640289b8062001ff1e444fa
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; public class C{ public static void main(String[] args)throws IOException{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(in.readLine()); while(t-->0){ String[] temp = in.readLine().split(" "); ...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 11
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
54270b0a293095d2297dd9fa826f1ab9
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
import java.util.Scanner; public class GridZeroZeroOneZeroZero { public static void main(String[] args) { Scanner read = new Scanner(System.in); int t = read.nextInt(); while(t-- > 0){ int n = read.nextInt(); int k = read.nextInt(); int[][] a = new int[n...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 11
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
64c63f68a35cd3a7a66efb675ba69602
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws FileNotFoundException { FastReader f = new FastReader(); int t = f.nextInt(); while (t-- > 0) { int n = f.nextInt(); int k = f.nextInt(); int[][] arr = ne...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 11
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
4a751f8d1555701c3bbe6dcdb8f8b0f9
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class Solution implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private SpaceCharF...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 11
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
83ea3ce7305ed92181a9bb5bbb64029f
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
import java.util.*;import java.io.*;import java.math.*; public class Grid1010 { public static void process()throws IOException { int n = ni(); int k = ni(); int[][] a = new int[n][n]; if(k % n == 0){ pn(0); } else{ pn(2); } ...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 11
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
f7c87d841e4d5bf3e8264bfab36adca4
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; public class Codechef { PrintWriter out; StringTokenizer st; BufferedReader br; class Pair implements Comparable<Pair> { int f; int s; Pair(int t, int r) { f = t; s = r; } public int compareTo(Pair p) ...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 11
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
c2f7260542b80c31356a78eaa01d7ae0
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; impor...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 11
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
9fa46dbf8ff0bf08489fea83055d620d
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
import java.util.*; public class D654{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); int x=sc.nextInt(); int[][] ar=new int[n][n]; int z=0,c=0; if(x%n==0){System.out.println("0");} els...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 11
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
6f8335ad33953ffc33e83825d1a18b38
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Scanner; public class Task654D { public static void main(String[] args) { Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); int t = in.nextInt(); // Scanner has functions to read ints, ...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 11
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
5386e73207ffc958cf09736b33f1c1fe
train_001.jsonl
1593610500
A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it!You are given integers $$$n,k$$$. Construct a grid $$$A$$$ with size $$$n \times n$$$ consisting of integers $$$0$$$ and $$$1$$$. The very important condition should be satisfied: the sum of all elements in the grid is exactly $$$k$$$. In...
256 megabytes
import java.io.*; import java.sql.Array; import java.util.*; public class Grid00100 { public static void main(String[] args) throws Exception { BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); int t = Integer.parseInt(buff...
Java
["4\n2 2\n3 8\n1 0\n4 16"]
1 second
["0\n10\n01\n2\n111\n111\n101\n0\n0\n0\n1111\n1111\n1111\n1111"]
NoteIn the first test case, the sum of all elements in the grid is equal to $$$2$$$, so the condition is satisfied. $$$R_1 = 1, R_2 = 1$$$ and $$$C_1 = 1, C_2 = 1$$$. Then, $$$f(A) = (1-1)^2 + (1-1)^2 = 0$$$, which is the minimum possible value of $$$f(A)$$$.In the second test case, the sum of all elements in the grid ...
Java 11
standard input
[ "constructive algorithms", "implementation", "greedy" ]
0f18382d450be90edf1fd1a3770b232b
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$)Β β€” the number of test cases. Next $$$t$$$ lines contain descriptions of test cases. For each test case the only line contains two integers $$$n$$$, $$$k$$$ $$$(1 \le n \le 300, 0 \le k \le n^2)$$$. It is g...
1,600
For each test case, firstly print the minimum possible value of $$$f(A)$$$ among all tables, for which the condition is satisfied. After that, print $$$n$$$ lines contain $$$n$$$ characters each. The $$$j$$$-th character in the $$$i$$$-th line should be equal to $$$A_{i,j}$$$. If there are multiple answers you can prin...
standard output
PASSED
605731d2f3e73cb727813099adafbf50
train_001.jsonl
1509113100
You are given a matrix of size n × m. Each element of the matrix is either 1 or 0. You have to determine the number of connected components consisting of 1's. Two cells belong to the same component if they have a common border, and both elements in these cells are 1's.Note that the memory limit is unusual!
16 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; Out...
Java
["3 4\n1\nA\n8", "2 8\n5F\nE3", "1 4\n0"]
3 seconds
["3", "2", "0"]
NoteIn the first example the matrix is: 000110101000It is clear that it has three components.The second example: 0101111111100011It is clear that the number of components is 2.There are no 1's in the third example, so the answer is 0.
Java 8
standard input
[ "dsu" ]
78b319ee682fa8c4dab53e0fcd018255
The first line contains two numbers n and m (1 ≀ n ≀ 212, 4 ≀ m ≀ 214) β€” the number of rows and columns, respectively. It is guaranteed that m is divisible by 4. Then the representation of matrix follows. Each of n next lines contains one-digit hexadecimal numbers (that is, these numbers can be represented either as d...
2,500
Print the number of connected components consisting of 1's.
standard output
PASSED
c9132dc137ec5d3f962871012c07328f
train_001.jsonl
1509113100
You are given a matrix of size n × m. Each element of the matrix is either 1 or 0. You have to determine the number of connected components consisting of 1's. Two cells belong to the same component if they have a common border, and both elements in these cells are 1's.Note that the memory limit is unusual!
16 megabytes
import java.io.*; import java.util.*; public class Program { static byte[] buffer = new byte[524288]; static int end = 0; static int ptr = 0; static int[] parent; static int Find(int t) { return parent[t] == t ? t : (parent[t] = Find(parent[t])); } static boolean Union(int a,...
Java
["3 4\n1\nA\n8", "2 8\n5F\nE3", "1 4\n0"]
3 seconds
["3", "2", "0"]
NoteIn the first example the matrix is: 000110101000It is clear that it has three components.The second example: 0101111111100011It is clear that the number of components is 2.There are no 1's in the third example, so the answer is 0.
Java 8
standard input
[ "dsu" ]
78b319ee682fa8c4dab53e0fcd018255
The first line contains two numbers n and m (1 ≀ n ≀ 212, 4 ≀ m ≀ 214) β€” the number of rows and columns, respectively. It is guaranteed that m is divisible by 4. Then the representation of matrix follows. Each of n next lines contains one-digit hexadecimal numbers (that is, these numbers can be represented either as d...
2,500
Print the number of connected components consisting of 1's.
standard output
PASSED
8a1814011016743b1bfef927677b6b4b
train_001.jsonl
1509113100
You are given a matrix of size n × m. Each element of the matrix is either 1 or 0. You have to determine the number of connected components consisting of 1's. Two cells belong to the same component if they have a common border, and both elements in these cells are 1's.Note that the memory limit is unusual!
16 megabytes
import java.io.*; import java.util.*; public class E31 { static byte[] buffer = new byte[524288]; static int end = 0; static int ptr = 0; static int[] parent; static int FindParent(int v) { return parent[v] == v ? v : (parent[v] = FindParent(parent[v])); } static boolean ...
Java
["3 4\n1\nA\n8", "2 8\n5F\nE3", "1 4\n0"]
3 seconds
["3", "2", "0"]
NoteIn the first example the matrix is: 000110101000It is clear that it has three components.The second example: 0101111111100011It is clear that the number of components is 2.There are no 1's in the third example, so the answer is 0.
Java 8
standard input
[ "dsu" ]
78b319ee682fa8c4dab53e0fcd018255
The first line contains two numbers n and m (1 ≀ n ≀ 212, 4 ≀ m ≀ 214) β€” the number of rows and columns, respectively. It is guaranteed that m is divisible by 4. Then the representation of matrix follows. Each of n next lines contains one-digit hexadecimal numbers (that is, these numbers can be represented either as d...
2,500
Print the number of connected components consisting of 1's.
standard output
PASSED
a7742adf06be769c0ae006e8f2d57595
train_001.jsonl
1509113100
You are given a matrix of size n × m. Each element of the matrix is either 1 or 0. You have to determine the number of connected components consisting of 1's. Two cells belong to the same component if they have a common border, and both elements in these cells are 1's.Note that the memory limit is unusual!
16 megabytes
import java.util.*; import java.io.*; public class E884 { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int n = Integer.parseInt(st.nextToken()); int ...
Java
["3 4\n1\nA\n8", "2 8\n5F\nE3", "1 4\n0"]
3 seconds
["3", "2", "0"]
NoteIn the first example the matrix is: 000110101000It is clear that it has three components.The second example: 0101111111100011It is clear that the number of components is 2.There are no 1's in the third example, so the answer is 0.
Java 8
standard input
[ "dsu" ]
78b319ee682fa8c4dab53e0fcd018255
The first line contains two numbers n and m (1 ≀ n ≀ 212, 4 ≀ m ≀ 214) β€” the number of rows and columns, respectively. It is guaranteed that m is divisible by 4. Then the representation of matrix follows. Each of n next lines contains one-digit hexadecimal numbers (that is, these numbers can be represented either as d...
2,500
Print the number of connected components consisting of 1's.
standard output
PASSED
e1df42989f3948655466294470954819
train_001.jsonl
1308236400
It is nighttime and Joe the Elusive got into the country's main bank's safe. The safe has n cells positioned in a row, each of them contains some amount of diamonds. Let's make the problem more comfortable to work with and mark the cells with positive numbers from 1 to n from the left to the right.Unfortunately, Joe di...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = sc.nextInt(); int m = sc.nextInt(); int k = sc.ne...
Java
["2 3 1\n2 3", "3 2 2\n4 1 3"]
1 second
["0", "2"]
NoteIn the second sample Joe can act like this:The diamonds' initial positions are 4 1 3.During the first period of time Joe moves a diamond from the 1-th cell to the 2-th one and a diamond from the 3-th cell to his pocket.By the end of the first period the diamonds' positions are 3 2 2. The check finds no difference a...
Java 8
standard input
[ "greedy", "math" ]
b81e7a786e4083cf7188f718bc045a85
The first line contains integers n, m and k (1 ≀ n ≀ 104, 1 ≀ m, k ≀ 109). The next line contains n numbers. The i-th number is equal to the amount of diamonds in the i-th cell β€” it is an integer from 0 to 105.
1,800
Print a single number β€” the maximum number of diamonds Joe can steal.
standard output
PASSED
dad935bcb6ba7aa5f3aa3a5b0970ee7a
train_001.jsonl
1308236400
It is nighttime and Joe the Elusive got into the country's main bank's safe. The safe has n cells positioned in a row, each of them contains some amount of diamonds. Let's make the problem more comfortable to work with and mark the cells with positive numbers from 1 to n from the left to the right.Unfortunately, Joe di...
256 megabytes
// /cf/74/2/practice/ROBBERY import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n_cells = sc.nextInt(); long n_ops = sc.nextLong(), n_mins = sc.nextLong(); long min_diamonds = Long.MAX_VALUE; ...
Java
["2 3 1\n2 3", "3 2 2\n4 1 3"]
1 second
["0", "2"]
NoteIn the second sample Joe can act like this:The diamonds' initial positions are 4 1 3.During the first period of time Joe moves a diamond from the 1-th cell to the 2-th one and a diamond from the 3-th cell to his pocket.By the end of the first period the diamonds' positions are 3 2 2. The check finds no difference a...
Java 8
standard input
[ "greedy", "math" ]
b81e7a786e4083cf7188f718bc045a85
The first line contains integers n, m and k (1 ≀ n ≀ 104, 1 ≀ m, k ≀ 109). The next line contains n numbers. The i-th number is equal to the amount of diamonds in the i-th cell β€” it is an integer from 0 to 105.
1,800
Print a single number β€” the maximum number of diamonds Joe can steal.
standard output
PASSED
884bb1432d994bf62c11bc17a1c62e7f
train_001.jsonl
1308236400
It is nighttime and Joe the Elusive got into the country's main bank's safe. The safe has n cells positioned in a row, each of them contains some amount of diamonds. Let's make the problem more comfortable to work with and mark the cells with positive numbers from 1 to n from the left to the right.Unfortunately, Joe di...
256 megabytes
import java.io.*; import java.util.*; public class C { String line = null; public void run() throws Exception{ BufferedReader br = null; File file = new File("input.txt"); if(file.exists()){ br = new BufferedReader(new FileReader("input.txt")); } else{ br = new BufferedReader(new InputStreamRead...
Java
["2 3 1\n2 3", "3 2 2\n4 1 3"]
1 second
["0", "2"]
NoteIn the second sample Joe can act like this:The diamonds' initial positions are 4 1 3.During the first period of time Joe moves a diamond from the 1-th cell to the 2-th one and a diamond from the 3-th cell to his pocket.By the end of the first period the diamonds' positions are 3 2 2. The check finds no difference a...
Java 6
standard input
[ "greedy", "math" ]
b81e7a786e4083cf7188f718bc045a85
The first line contains integers n, m and k (1 ≀ n ≀ 104, 1 ≀ m, k ≀ 109). The next line contains n numbers. The i-th number is equal to the amount of diamonds in the i-th cell β€” it is an integer from 0 to 105.
1,800
Print a single number β€” the maximum number of diamonds Joe can steal.
standard output
PASSED
eb0d7796567ff0e4a67bec9cf5148677
train_001.jsonl
1308236400
It is nighttime and Joe the Elusive got into the country's main bank's safe. The safe has n cells positioned in a row, each of them contains some amount of diamonds. Let's make the problem more comfortable to work with and mark the cells with positive numbers from 1 to n from the left to the right.Unfortunately, Joe di...
256 megabytes
import java.io.*; public class cbr74c { private StreamTokenizer in; private PrintWriter out = new PrintWriter(System.out); public static void main(String[] args) throws IOException { new cbr74c().run(); } private void run() throws IOException { in = new StreamTokenizer(new Buffere...
Java
["2 3 1\n2 3", "3 2 2\n4 1 3"]
1 second
["0", "2"]
NoteIn the second sample Joe can act like this:The diamonds' initial positions are 4 1 3.During the first period of time Joe moves a diamond from the 1-th cell to the 2-th one and a diamond from the 3-th cell to his pocket.By the end of the first period the diamonds' positions are 3 2 2. The check finds no difference a...
Java 6
standard input
[ "greedy", "math" ]
b81e7a786e4083cf7188f718bc045a85
The first line contains integers n, m and k (1 ≀ n ≀ 104, 1 ≀ m, k ≀ 109). The next line contains n numbers. The i-th number is equal to the amount of diamonds in the i-th cell β€” it is an integer from 0 to 105.
1,800
Print a single number β€” the maximum number of diamonds Joe can steal.
standard output
PASSED
19e725f90bc5df03a6614082201accd1
train_001.jsonl
1308236400
It is nighttime and Joe the Elusive got into the country's main bank's safe. The safe has n cells positioned in a row, each of them contains some amount of diamonds. Let's make the problem more comfortable to work with and mark the cells with positive numbers from 1 to n from the left to the right.Unfortunately, Joe di...
256 megabytes
//package Round_74_div2; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; import static java.lang.Math.*; public class c implements Runnable { String input = ""; String output = ""; Buffere...
Java
["2 3 1\n2 3", "3 2 2\n4 1 3"]
1 second
["0", "2"]
NoteIn the second sample Joe can act like this:The diamonds' initial positions are 4 1 3.During the first period of time Joe moves a diamond from the 1-th cell to the 2-th one and a diamond from the 3-th cell to his pocket.By the end of the first period the diamonds' positions are 3 2 2. The check finds no difference a...
Java 6
standard input
[ "greedy", "math" ]
b81e7a786e4083cf7188f718bc045a85
The first line contains integers n, m and k (1 ≀ n ≀ 104, 1 ≀ m, k ≀ 109). The next line contains n numbers. The i-th number is equal to the amount of diamonds in the i-th cell β€” it is an integer from 0 to 105.
1,800
Print a single number β€” the maximum number of diamonds Joe can steal.
standard output
PASSED
77f26e5421940d20291c3e4cecf2e458
train_001.jsonl
1308236400
It is nighttime and Joe the Elusive got into the country's main bank's safe. The safe has n cells positioned in a row, each of them contains some amount of diamonds. Let's make the problem more comfortable to work with and mark the cells with positive numbers from 1 to n from the left to the right.Unfortunately, Joe di...
256 megabytes
import java.util.*; public class a { public static void main(String[] args) { Scanner in = new Scanner(System.in); long n = in.nextLong(); long m = in.nextLong(); long k = in.nextLong(); long[] v = new long[(int)n]; long min = (long...
Java
["2 3 1\n2 3", "3 2 2\n4 1 3"]
1 second
["0", "2"]
NoteIn the second sample Joe can act like this:The diamonds' initial positions are 4 1 3.During the first period of time Joe moves a diamond from the 1-th cell to the 2-th one and a diamond from the 3-th cell to his pocket.By the end of the first period the diamonds' positions are 3 2 2. The check finds no difference a...
Java 6
standard input
[ "greedy", "math" ]
b81e7a786e4083cf7188f718bc045a85
The first line contains integers n, m and k (1 ≀ n ≀ 104, 1 ≀ m, k ≀ 109). The next line contains n numbers. The i-th number is equal to the amount of diamonds in the i-th cell β€” it is an integer from 0 to 105.
1,800
Print a single number β€” the maximum number of diamonds Joe can steal.
standard output
PASSED
f4a6be7d29968e487a83b10aba3b8ac2
train_001.jsonl
1308236400
It is nighttime and Joe the Elusive got into the country's main bank's safe. The safe has n cells positioned in a row, each of them contains some amount of diamonds. Let's make the problem more comfortable to work with and mark the cells with positive numbers from 1 to n from the left to the right.Unfortunately, Joe di...
256 megabytes
import java.beans.beancontext.BeanContext; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int m = scanner.nextInt(); int k = scanner.nextInt(); int a[] = new int[n];...
Java
["2 3 1\n2 3", "3 2 2\n4 1 3"]
1 second
["0", "2"]
NoteIn the second sample Joe can act like this:The diamonds' initial positions are 4 1 3.During the first period of time Joe moves a diamond from the 1-th cell to the 2-th one and a diamond from the 3-th cell to his pocket.By the end of the first period the diamonds' positions are 3 2 2. The check finds no difference a...
Java 6
standard input
[ "greedy", "math" ]
b81e7a786e4083cf7188f718bc045a85
The first line contains integers n, m and k (1 ≀ n ≀ 104, 1 ≀ m, k ≀ 109). The next line contains n numbers. The i-th number is equal to the amount of diamonds in the i-th cell β€” it is an integer from 0 to 105.
1,800
Print a single number β€” the maximum number of diamonds Joe can steal.
standard output
PASSED
50057c8628332f0ae744e6b1d1bd438f
train_001.jsonl
1308236400
It is nighttime and Joe the Elusive got into the country's main bank's safe. The safe has n cells positioned in a row, each of them contains some amount of diamonds. Let's make the problem more comfortable to work with and mark the cells with positive numbers from 1 to n from the left to the right.Unfortunately, Joe di...
256 megabytes
import java.util.*; import java.io.*; public class Main{ StreamTokenizer in; private long nextInt() throws Exception{ in.nextToken(); return (long)in.nval; } public void run() throws Exception{ in = new StreamTokenizer(System.in); int n = (int)nextInt(); long m = nextInt(); long k = nextInt(); l...
Java
["2 3 1\n2 3", "3 2 2\n4 1 3"]
1 second
["0", "2"]
NoteIn the second sample Joe can act like this:The diamonds' initial positions are 4 1 3.During the first period of time Joe moves a diamond from the 1-th cell to the 2-th one and a diamond from the 3-th cell to his pocket.By the end of the first period the diamonds' positions are 3 2 2. The check finds no difference a...
Java 6
standard input
[ "greedy", "math" ]
b81e7a786e4083cf7188f718bc045a85
The first line contains integers n, m and k (1 ≀ n ≀ 104, 1 ≀ m, k ≀ 109). The next line contains n numbers. The i-th number is equal to the amount of diamonds in the i-th cell β€” it is an integer from 0 to 105.
1,800
Print a single number β€” the maximum number of diamonds Joe can steal.
standard output
PASSED
ffbde3f8bddae5adc5b7a52c0d833479
train_001.jsonl
1308236400
It is nighttime and Joe the Elusive got into the country's main bank's safe. The safe has n cells positioned in a row, each of them contains some amount of diamonds. Let's make the problem more comfortable to work with and mark the cells with positive numbers from 1 to n from the left to the right.Unfortunately, Joe di...
256 megabytes
import java.util.Scanner; public class Robbery { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int k = sc.nextInt(); int[] diamonds = new int[n]; for (int i = 0; i < n; i++) { diamonds[i] = sc.nextInt(); } // if n is ev...
Java
["2 3 1\n2 3", "3 2 2\n4 1 3"]
1 second
["0", "2"]
NoteIn the second sample Joe can act like this:The diamonds' initial positions are 4 1 3.During the first period of time Joe moves a diamond from the 1-th cell to the 2-th one and a diamond from the 3-th cell to his pocket.By the end of the first period the diamonds' positions are 3 2 2. The check finds no difference a...
Java 6
standard input
[ "greedy", "math" ]
b81e7a786e4083cf7188f718bc045a85
The first line contains integers n, m and k (1 ≀ n ≀ 104, 1 ≀ m, k ≀ 109). The next line contains n numbers. The i-th number is equal to the amount of diamonds in the i-th cell β€” it is an integer from 0 to 105.
1,800
Print a single number β€” the maximum number of diamonds Joe can steal.
standard output
PASSED
2c3882884be058ee66af8a20476aae7f
train_001.jsonl
1308236400
It is nighttime and Joe the Elusive got into the country's main bank's safe. The safe has n cells positioned in a row, each of them contains some amount of diamonds. Let's make the problem more comfortable to work with and mark the cells with positive numbers from 1 to n from the left to the right.Unfortunately, Joe di...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class Robbery { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(in.readLine()); int n = Integer.parseInt(st.nextToken()); ...
Java
["2 3 1\n2 3", "3 2 2\n4 1 3"]
1 second
["0", "2"]
NoteIn the second sample Joe can act like this:The diamonds' initial positions are 4 1 3.During the first period of time Joe moves a diamond from the 1-th cell to the 2-th one and a diamond from the 3-th cell to his pocket.By the end of the first period the diamonds' positions are 3 2 2. The check finds no difference a...
Java 6
standard input
[ "greedy", "math" ]
b81e7a786e4083cf7188f718bc045a85
The first line contains integers n, m and k (1 ≀ n ≀ 104, 1 ≀ m, k ≀ 109). The next line contains n numbers. The i-th number is equal to the amount of diamonds in the i-th cell β€” it is an integer from 0 to 105.
1,800
Print a single number β€” the maximum number of diamonds Joe can steal.
standard output
PASSED
3f40862ec3b553e2e4a9bbea1fe8a407
train_001.jsonl
1308236400
It is nighttime and Joe the Elusive got into the country's main bank's safe. The safe has n cells positioned in a row, each of them contains some amount of diamonds. Let's make the problem more comfortable to work with and mark the cells with positive numbers from 1 to n from the left to the right.Unfortunately, Joe di...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner r = new Scanner(System.in); int n = r.nextInt(); long m = r.nextInt(); long k = r.nextInt(); int[] a = new int[n]; for(int i = 0; i < n; i++) a[i] = r.nextInt(); if(n == 1){ System.out.printl...
Java
["2 3 1\n2 3", "3 2 2\n4 1 3"]
1 second
["0", "2"]
NoteIn the second sample Joe can act like this:The diamonds' initial positions are 4 1 3.During the first period of time Joe moves a diamond from the 1-th cell to the 2-th one and a diamond from the 3-th cell to his pocket.By the end of the first period the diamonds' positions are 3 2 2. The check finds no difference a...
Java 6
standard input
[ "greedy", "math" ]
b81e7a786e4083cf7188f718bc045a85
The first line contains integers n, m and k (1 ≀ n ≀ 104, 1 ≀ m, k ≀ 109). The next line contains n numbers. The i-th number is equal to the amount of diamonds in the i-th cell β€” it is an integer from 0 to 105.
1,800
Print a single number β€” the maximum number of diamonds Joe can steal.
standard output
PASSED
61364c4dc1057f5834ae43ac5ae573ea
train_001.jsonl
1308236400
It is nighttime and Joe the Elusive got into the country's main bank's safe. The safe has n cells positioned in a row, each of them contains some amount of diamonds. Let's make the problem more comfortable to work with and mark the cells with positive numbers from 1 to n from the left to the right.Unfortunately, Joe di...
256 megabytes
import java.util.Scanner; public class P3 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); long m = in.nextInt(); long k = in.nextInt(); int[] b = new int[n]; for (int i = 0; i < n; i++) { b[i] = in.ne...
Java
["2 3 1\n2 3", "3 2 2\n4 1 3"]
1 second
["0", "2"]
NoteIn the second sample Joe can act like this:The diamonds' initial positions are 4 1 3.During the first period of time Joe moves a diamond from the 1-th cell to the 2-th one and a diamond from the 3-th cell to his pocket.By the end of the first period the diamonds' positions are 3 2 2. The check finds no difference a...
Java 6
standard input
[ "greedy", "math" ]
b81e7a786e4083cf7188f718bc045a85
The first line contains integers n, m and k (1 ≀ n ≀ 104, 1 ≀ m, k ≀ 109). The next line contains n numbers. The i-th number is equal to the amount of diamonds in the i-th cell β€” it is an integer from 0 to 105.
1,800
Print a single number β€” the maximum number of diamonds Joe can steal.
standard output
PASSED
7450882d4d6d889580c51222394c56e5
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.util.Scanner; public class Letter { public static void main(String[] args) { Scanner in = new Scanner(System.in); String s = in.nextLine(); String check = in.nextLine(); for(int i=0;i<check.length();i++){ if(check.charAt(i)==' ') continue; if((!s.contains(check.charAt(i)+""))|| (count(s,...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
5279cfbfdf748e9dc5edc8ac703a7226
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; public class A1008 { public static void main(String [] args) /*throws Exception*/ { InputStream inputReader = System.in; OutputStream outputReader = System.out; InputReader in = new InputReader(inputReader);//new InputRe...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
fdb20af26e32d6540a7a35ea50cc17f6
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; public class A1008 { public static void main(String [] args) /*throws Exception*/ { InputStream inputReader = System.in; OutputStream outputReader = System.out; InputReader in = new InputReader(inputReader);//new InputRe...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
8f12584e86cb9af3b4257d8702905d5e
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ //package b.letter.cf; import java.util.HashMap; import java.util.Scanner; /** * * @author karim */ public class BLetterCF { p...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
f3e4ef800812d4d5c2cfcea50bf13687
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.util.*; public class Solution{ public static void main(String []args){ Scanner sc=new Scanner(System.in); String head=sc.nextLine(); String text=sc.nextLine(); int i,flag=1; int count[]=new int[60]; for(i=0;i<head.length();i++){ if(head.charAt(i)==' ') continue; ...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
8b401c8f3aec0fa32c2d5eae3a01748a
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.util.Scanner; public class Letter { public static void main(String[] args) { String s1, s2; Scanner n = new Scanner(System.in); s1 = n.nextLine(); s2 = n.nextLine(); n.close(); s2 = s2.replaceAll(" ", ""); boolean flag = true; for (int i = 0; i < s2.length(); i++) { Character ch = s2.c...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
d20a7a4c4526a45fd0a22d608e2c23fd
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { String str, strWithoutSpace,str2,strWithoutSpace2; Scanner scan = new Scanner(System.in); str = scan.nextLine(); strWithoutSpace = str.replaceAll(" ", ""); //System.out.println(strWithoutSpace); str2 = scan.nextLine(...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
a338dbf261c56b2a076b6f87f15d4952
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.util.Scanner; import java.util.Set; public class bufferedTry { public static void main (String args[]) { Scanner key = new Scanner (System.in); String input1 = key.nextLine(); String input2 = key.nextLine(); int checker1=0; int checker2=0; boolean check =...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
9210386d7bddf421fe3a9f1797ef7325
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.util.Scanner; public class Letter { public static void main(String[] args) { // TODO Auto-generated method stub Scanner s = new Scanner(System.in); int comp = 0; int flag = 1; String let = s.nextLine(); String l = s.nextLine(); int[] small = new int[26]; int[] cap = new int[26]; char[] ...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
a4af611f705cdce1e94c2be7afd96431
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.util.Scanner; public class Letter { public static void main(String[] args) { // TODO Auto-generated method stub Scanner s = new Scanner(System.in); int comp = 0; int flag = 1; String let = s.nextLine(); String l = s.nextLine(); int[] small = new int[26]; int[] cap = new int[26]; char[] ...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
6bb6cbc1d0abd4b5cc8567bbe853474a
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.util.Scanner; //BLetter public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] caps = new int[26]; int[] small = new int[26]; for (char c : sc.nextLine().toCharArray()) { if (c == ' ') continue...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
935e896cd9752aa25b893512e501a9db
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class Letter { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String s1=scan.nextLine(); String s2=scan.nextLine(); s1=s1.replace(" ", ""); s2=s2.replace(" ", ""); ArrayList<Character> a = new ArrayList<Characte...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
4b9cdd60745991a43ee76a115ec26fe2
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
//package session1; import java.util.HashMap; import java.util.Scanner; public class Letter { public static void letter(String s1, String s2){ //making a hashmap HashMap<Character, Integer> hm = new HashMap<Character,Integer>(52); char c = 'a'; while(true){ hm.put(c, Character.getNumericValue(c)-10)...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
91985d73328272c7eba6107a1572df56
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s1 = sc.nextLine(); String s2 = sc.nextLine(); int l1 = s1.length(); int l2 = s2.length(); int xs1[] =...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
033c84e39bddf78afc3b45d8207b9c88
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s1 = sc.nextLine(); String s2 = sc.nextLine(); String [] words = s1.split(" "); String [] words2 = s2.split(" "...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
7db358320f3d58f62bbe978a47a01690
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.util.Scanner; public class letter { public static void main(String[] args) { Scanner scan = new Scanner(System.in); boolean found = false; StringBuilder x = new StringBuilder(scan.nextLine()); StringBuilder y = new StringBuilder(scan.nextLine()); for (int i = 0; i < y.length(); i++) {...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
0f1b8a7232e02ea5791e3498925784d0
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.util.Scanner; /** * * @author KCc */ public class ACM_Letter { /** * @param args the command line argumen...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
4a066fcb90fc59a788e0c9c65b77fd66
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.util.Scanner; /** * * @author KCc */ public class ACM_Letter { /** * @param args the command line arguments...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
8d450f12f777017c5079233266d0fc7c
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.io.*; import java.util.*; public class Letter { public static void main(String args[]) { FastReader sc = new FastReader(); PrintWriter out = new PrintWriter(System.out); int t, n, i, j,flag=0; String s,s2; s= sc.nextLine(); s2= sc.nextLine(); ...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
c34d0f594634867b852ca236deb264b9
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Solve3 { public static void main(String[] args) throws IOException { new Solve3().solve(); } public void solve() throws IOExcepti...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
147e30ab6788ee5b0767f27274e4aaa9
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub ArrayList<Character> source=new ArrayList<Character>(); ArrayList<Character> letter=new ArrayList<Character>(); Scanner scn = new Scanner(System.in); for(cha...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
95cc628531cbce5e0c82fe4d592af2a9
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scn = new Scanner(System.in); StringBuilder heading = new StringBuilder(); StringBuilder text = new StringBuilder(); for(char item: scn.nextLine().toCharArray()) if(item!=' ...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
8e750f15ab2f9f82e5295ed691683f07
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.util.*; public class Letter { static Scanner scn = new Scanner(System.in); public static void main(String[] args) { helper(); } public static void helper() { String s1 = input(1); String s2 = input(1); int[] freq_1 = Freq(s1); int[] freq_2 = Freq(s2); for (int i = 0; i < 256; i++) { ...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
2478dc1a4ade8f88971cca9860f41a94
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.util.Scanner; public class Letter { public static void main(String args[]){ Scanner in = new Scanner(System.in); String s1 = in.nextLine(); String s2 = in.nextLine(); if(s1.length() > 200 || s2.length() > 200) { System.out.prin...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
2471e357a74806438b36fe2b8d641761
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.util.*; public class Boboniu { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String s1 = scanner.nextLine(); String s2 = scanner.nextLine(); int[] arr1 = new int[100]; int[] arr2 = new int[100]; for(int i=0;i<s1....
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
ca0249f6961606d1ecd58fb20e2698f9
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.util.Scanner; import java.io.PrintWriter; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); String str1 = sc.nextLine(); String str2 = sc.nextLine(); int arr[] = new in...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
8161512794567a13f724bd06d769d186
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.util.*; public class Letter { public static void main(String[] args) { Scanner in = new Scanner(System.in); String s1 = in.nextLine(); String s2 = in.nextLine(); int[] freq1 = new int[128]; int[] freq2 = new int[128]; for (int i = 0; i < s1.length(); i++) ...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
6e5a148d2f3252326ed007b9b519a075
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.util.*; public class Letter2 { public static void main(String[] args) { Scanner in = new Scanner(System.in); String st1 = in.nextLine(); String st2 = in.nextLine(); int[] freq1 = new int[123]; for (int i = 0; i < st1.length(); i++) { if(st1.charAt(i) =...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
3a10e8e84af8b835e67ab2962a4fc6df
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.util.*; public class Letter { public static void main(String[] args) { Scanner in = new Scanner(System.in); String s1 = in.nextLine(); String s2 = in.nextLine(); boolean done; for (int i = 0; i < s2.length(); i++) { if (s2.charAt(i) == ' ') { ...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
f8c0bdd74039b94ce3604464a2397700
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.util.Scanner; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author Pollock */ public class Letter { public static void main(String[] args) { S...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
600ade51a19b1d7d8440ae520c3b913a
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.io.*; import java.util.*; public class Mohammad { //---------------------------------------------Main-----------------------------------------------// public static void Mohammad_AboHasan() throws IOException{ FastReader fr = new FastReader(); String s = fr.nextLine(); Strin...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
fd3683a46b339f2a8eaf43931e984ffc
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String Head = in.readLine(); String Title...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
a588ff406c3bc7e8e02939b598d7a045
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); String str = input.nextLine(); String str2 = input.nextLine(); int no = 0; str = str.replaceAll(" ", ""); str2...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
11d9cb49c1de6d0eb3c2ffba759c2174
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner x=new Scanner(System.in); String s=x.nextLine(); String y=x.nextLine(); int i; int b[]=new int[256]; for(i=0;i<y.length();i++) { if(y.charAt(i)!=' ') b[(int)(y.charAt(i))]++; } for(i=0;i<s.le...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
38ba708d0bc72e6338f7c335896032b4
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.util.Scanner; import java.util.Set; public class bufferedTry { public static void main (String args[]) { Scanner key = new Scanner (System.in); String input1 = key.nextLine(); String input2 = key.nextLine(); int checker1=0; int checker2=0; boolean check =...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
fbc71f290f4760807477cf9ce912c51b
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.io.*; import java.util.*; import java.util.Map.*; public class j { public static void main(String args[] ) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str = br.readLine(); int[] a = new int[130]; String str1 = br.readLi...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
b9074ab9c25c3133b31523deaf68c9cd
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.util.Scanner; public class Main { static int[] charCounter(String word) { int[] alphabet = new int[52]; for (int i = 0; i < word.length(); i++) { int indx = (int) word.charAt(i); if (indx > 64 && indx < 91) { indx = indx - 65; alphabet[indx]++; } else if (indx > 96 && indx < ...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
e97ed303cd94e3c4aeea33d1db2eb335
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
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.*; public class Solution { private static final Scanner input = new Scanner(System.in); public static void main(String[] args) { String s1 = input.nextLine(...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
eafd589268be045b2897e192e1545522
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
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.*; public class Solution { private static final Scanner input = new Scanner(System.in); public static void main(String[] args) { String s1 = input.nextLine(...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
62b1a540235e50fc6dce50e7358ba639
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; import java.math.BigInteger; import java.util.Array...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
880d3ded3fa3bdce64ccf1c750d379be
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.util.HashMap; import java.util.Scanner; public class Letter { public static void main(String[] args) { Scanner scan=new Scanner(System.in); String s1=scan.nextLine().replace(" ", ""); String s2=scan.nextLine().replace(" ", ""); HashMap<Character,Integer> hm=new HashMap<Character,Integer>(); f...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
1555d9b83dd2cda7f71855f8d5dc1343
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.io.*; public class J { public static void main(String[] args) throws IOException { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); String firstLine = input.readLine().replace(" ...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
2cfd939d049be757c4ff7ade3fe86c0d
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; public class J { public static void main(String[] args) throws IOException { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new Pr...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
974575d9bc9d87f70c4143a48f392eee
train_001.jsonl
1291046400
Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading β€” he just leaves some blank space to mark them. Help him;...
256 megabytes
import java.util.Scanner; public class Letter { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String s1 = scanner.nextLine(); String s2 = scanner.nextLine(); boolean[] visited = new boolean[s1.length()]; boolean pas...
Java
["Instead of dogging Your footsteps it disappears but you dont notice anything\nwhere is your dog", "Instead of dogging Your footsteps it disappears but you dont notice anything\nYour dog is upstears", "Instead of dogging your footsteps it disappears but you dont notice anything\nYour dog is upstears", "abcdefg hijk\nk...
2 seconds
["NO", "YES", "NO", "YES"]
null
Java 8
standard input
[ "implementation", "strings" ]
b1ef19d7027dc82d76859d64a6f43439
The first line contains a newspaper heading s1. The second line contains the letter text s2. s1 ΠΈ s2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of th...
1,100
If Vasya can write the given anonymous letter, print YES, otherwise print NO
standard output
PASSED
c0de3d9291560651af753ef953931c5f
train_001.jsonl
1298908800
In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc...
256 megabytes
import java.util.*; public class SettlersTraining { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); int[] ranks = new int[k]; for (int i = 0; i < n; ++i) { int rank = in.nextInt() - 1; ++ranks[rank]; } int coins ...
Java
["4 4\n1 2 2 3", "4 3\n1 1 1 1"]
2 seconds
["4", "5"]
NoteIn the first example the ranks will be raised in the following manner:1 2 2 3  →  2 2 3 4  →  2 3 4 4  →  3 4 4 4  →  4 4 4 4Thus totals to 4 training sessions that require 4 golden coins.
Java 7
standard input
[ "implementation" ]
3d6411d67c85f6293f1999ccff2cd8ba
The first line contains two integers n and k (1 ≀ n, k ≀ 100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1 ≀ i ≀ n, 1 ≀ ai...
1,200
Print a single integer β€” the number of golden coins needed to raise all the soldiers to the maximal rank.
standard output
PASSED
3b8fa39f09c378c89dc1798c9d5fcbde
train_001.jsonl
1298908800
In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc...
256 megabytes
import java.util.*; import java.io.*; import static java.lang.Math.*; public class Main { FastIO in; PrintWriter out; // File names!!! void solve() throws IOException { int n = in.nextInt(), k = in.nextInt(); int[] a = new int[k]; for (int i = 0; i < n; i++) { a[i...
Java
["4 4\n1 2 2 3", "4 3\n1 1 1 1"]
2 seconds
["4", "5"]
NoteIn the first example the ranks will be raised in the following manner:1 2 2 3  →  2 2 3 4  →  2 3 4 4  →  3 4 4 4  →  4 4 4 4Thus totals to 4 training sessions that require 4 golden coins.
Java 7
standard input
[ "implementation" ]
3d6411d67c85f6293f1999ccff2cd8ba
The first line contains two integers n and k (1 ≀ n, k ≀ 100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1 ≀ i ≀ n, 1 ≀ ai...
1,200
Print a single integer β€” the number of golden coins needed to raise all the soldiers to the maximal rank.
standard output
PASSED
e1f0bbcf6f8407c964029cffca991096
train_001.jsonl
1298908800
In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc...
256 megabytes
import java.util.Scanner; public class B_63_Settlers_Training { public static void main(String[] argrs) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); int[] freq = new int[k+1]; for(int i=0; i<n; i++) freq[in.nextInt()]++; int cnt = 0; while(freq[k] != n) { for(...
Java
["4 4\n1 2 2 3", "4 3\n1 1 1 1"]
2 seconds
["4", "5"]
NoteIn the first example the ranks will be raised in the following manner:1 2 2 3  →  2 2 3 4  →  2 3 4 4  →  3 4 4 4  →  4 4 4 4Thus totals to 4 training sessions that require 4 golden coins.
Java 7
standard input
[ "implementation" ]
3d6411d67c85f6293f1999ccff2cd8ba
The first line contains two integers n and k (1 ≀ n, k ≀ 100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1 ≀ i ≀ n, 1 ≀ ai...
1,200
Print a single integer β€” the number of golden coins needed to raise all the soldiers to the maximal rank.
standard output
PASSED
0902282cfb5079f4c11acaf771912560
train_001.jsonl
1298908800
In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc...
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(); int k=sc.nextInt(); int a[]=new int [n+1]; boolean used[]=new boolean [n+1]; for (int i = 0; i < a.length-1; i++) { a[i]=sc.nextInt(); if(a[i]==k) used[i]=true;...
Java
["4 4\n1 2 2 3", "4 3\n1 1 1 1"]
2 seconds
["4", "5"]
NoteIn the first example the ranks will be raised in the following manner:1 2 2 3  →  2 2 3 4  →  2 3 4 4  →  3 4 4 4  →  4 4 4 4Thus totals to 4 training sessions that require 4 golden coins.
Java 7
standard input
[ "implementation" ]
3d6411d67c85f6293f1999ccff2cd8ba
The first line contains two integers n and k (1 ≀ n, k ≀ 100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1 ≀ i ≀ n, 1 ≀ ai...
1,200
Print a single integer β€” the number of golden coins needed to raise all the soldiers to the maximal rank.
standard output
PASSED
e3192782bc4e4c497a74973ccd8fd79a
train_001.jsonl
1298908800
In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; import java.util.concurrent.*; public class P63B { int n, k; void inc(TreeMap<Integer, Integer> map, int value) { if (value < k) { Integer count = map.get(value); map.put(value, (count == null) ? 1 : count + 1); } } void dec(TreeM...
Java
["4 4\n1 2 2 3", "4 3\n1 1 1 1"]
2 seconds
["4", "5"]
NoteIn the first example the ranks will be raised in the following manner:1 2 2 3  →  2 2 3 4  →  2 3 4 4  →  3 4 4 4  →  4 4 4 4Thus totals to 4 training sessions that require 4 golden coins.
Java 7
standard input
[ "implementation" ]
3d6411d67c85f6293f1999ccff2cd8ba
The first line contains two integers n and k (1 ≀ n, k ≀ 100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1 ≀ i ≀ n, 1 ≀ ai...
1,200
Print a single integer β€” the number of golden coins needed to raise all the soldiers to the maximal rank.
standard output
PASSED
4af225549bec1e1a65767db3706b0349
train_001.jsonl
1298908800
In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc...
256 megabytes
import java.util.Scanner; public class B { static Scanner in = new Scanner(System.in); public static void main(String[] args) { int n = in.nextInt(), k = in.nextInt(); int[] v = new int[n+1]; int sum = 0; for(int i = 0 ; i < n ; i++) { v[i] = in.nextInt(); sum += v[i]; } v[n] = k; int res = 0; ...
Java
["4 4\n1 2 2 3", "4 3\n1 1 1 1"]
2 seconds
["4", "5"]
NoteIn the first example the ranks will be raised in the following manner:1 2 2 3  →  2 2 3 4  →  2 3 4 4  →  3 4 4 4  →  4 4 4 4Thus totals to 4 training sessions that require 4 golden coins.
Java 7
standard input
[ "implementation" ]
3d6411d67c85f6293f1999ccff2cd8ba
The first line contains two integers n and k (1 ≀ n, k ≀ 100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1 ≀ i ≀ n, 1 ≀ ai...
1,200
Print a single integer β€” the number of golden coins needed to raise all the soldiers to the maximal rank.
standard output
PASSED
62c001911fe5612c6ffa63aed35a7634
train_001.jsonl
1298908800
In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc...
256 megabytes
/* * @author Sane */ import java.util.*; import java.util.Scanner; import java.io.File; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.FileOutputStream; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.OutputStreamWriter; p...
Java
["4 4\n1 2 2 3", "4 3\n1 1 1 1"]
2 seconds
["4", "5"]
NoteIn the first example the ranks will be raised in the following manner:1 2 2 3  →  2 2 3 4  →  2 3 4 4  →  3 4 4 4  →  4 4 4 4Thus totals to 4 training sessions that require 4 golden coins.
Java 7
standard input
[ "implementation" ]
3d6411d67c85f6293f1999ccff2cd8ba
The first line contains two integers n and k (1 ≀ n, k ≀ 100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1 ≀ i ≀ n, 1 ≀ ai...
1,200
Print a single integer β€” the number of golden coins needed to raise all the soldiers to the maximal rank.
standard output
PASSED
f3282a9ed389a510a3c908f1756d649e
train_001.jsonl
1298908800
In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc...
256 megabytes
import java.util.*; import java.io.*; public class Main{ BufferedReader in; StringTokenizer str = null; PrintWriter out; private String next() throws Exception{ while (str == null || !str.hasMoreElements()) str = new StringTokenizer(in.readLine()); return str.nextToken(); } ...
Java
["4 4\n1 2 2 3", "4 3\n1 1 1 1"]
2 seconds
["4", "5"]
NoteIn the first example the ranks will be raised in the following manner:1 2 2 3  →  2 2 3 4  →  2 3 4 4  →  3 4 4 4  →  4 4 4 4Thus totals to 4 training sessions that require 4 golden coins.
Java 7
standard input
[ "implementation" ]
3d6411d67c85f6293f1999ccff2cd8ba
The first line contains two integers n and k (1 ≀ n, k ≀ 100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1 ≀ i ≀ n, 1 ≀ ai...
1,200
Print a single integer β€” the number of golden coins needed to raise all the soldiers to the maximal rank.
standard output
PASSED
b50d964895d44cee4ac7cbb084cb4b98
train_001.jsonl
1298908800
In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc...
256 megabytes
import java.io.*; import java.util.*; public class j { public static void main(String a[])throws IOException { BufferedReader b=new BufferedReader(new InputStreamReader(System.in)); int k=0,m=0,n=0,i=0; String s; StringTokenizer c=new StringTokenizer(b.readLine()); n=Integer.parseInt(c.nextToken()); k=Integer.parseInt(...
Java
["4 4\n1 2 2 3", "4 3\n1 1 1 1"]
2 seconds
["4", "5"]
NoteIn the first example the ranks will be raised in the following manner:1 2 2 3  →  2 2 3 4  →  2 3 4 4  →  3 4 4 4  →  4 4 4 4Thus totals to 4 training sessions that require 4 golden coins.
Java 7
standard input
[ "implementation" ]
3d6411d67c85f6293f1999ccff2cd8ba
The first line contains two integers n and k (1 ≀ n, k ≀ 100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1 ≀ i ≀ n, 1 ≀ ai...
1,200
Print a single integer β€” the number of golden coins needed to raise all the soldiers to the maximal rank.
standard output
PASSED
2787a7743e22cfccbd5da369656e2668
train_001.jsonl
1298908800
In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc...
256 megabytes
import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Scanner; public class Solution3 { public static void main(String[] args){ Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int k = scanner.nextInt(); int rank[] = new int[k]; for(int ...
Java
["4 4\n1 2 2 3", "4 3\n1 1 1 1"]
2 seconds
["4", "5"]
NoteIn the first example the ranks will be raised in the following manner:1 2 2 3  →  2 2 3 4  →  2 3 4 4  →  3 4 4 4  →  4 4 4 4Thus totals to 4 training sessions that require 4 golden coins.
Java 7
standard input
[ "implementation" ]
3d6411d67c85f6293f1999ccff2cd8ba
The first line contains two integers n and k (1 ≀ n, k ≀ 100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1 ≀ i ≀ n, 1 ≀ ai...
1,200
Print a single integer β€” the number of golden coins needed to raise all the soldiers to the maximal rank.
standard output