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 | 69514596f9713178f76b4eccafbe48c5 | train_002.jsonl | 1508773500 | One day Nikita found the string containing letters "a" and "b" only. Nikita thinks that string is beautiful if it can be cut into 3 strings (possibly empty) without changing the order of the letters, where the 1-st and the 3-rd one contain only letters "a" and the 2-nd contains only letters "b".Nikita wants to make the... | 256 megabytes |
import java.io.*;
import java.util.*;
public class NikitaAndString {
public static void main(String[] args) throws Exception {
FastScanner sc = new FastScanner(System.in);
PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
run(sc, out);
out.close();
}
public static... | Java | ["abba", "bab"] | 2 seconds | ["4", "2"] | NoteIt the first sample the string is already beautiful.In the second sample he needs to delete one of "b" to make it beautiful. | Java 8 | standard input | [
"dp",
"brute force"
] | c768f3e52e562ae1fd47502a60dbadfe | The first line contains a non-empty string of length not greater than 5 000 containing only lowercase English letters "a" and "b". | 1,500 | Print a single integer — the maximum possible size of beautiful string Nikita can get. | standard output | |
PASSED | 4858fcafb30d93af2d2fad57eb5fa32e | train_002.jsonl | 1508773500 | One day Nikita found the string containing letters "a" and "b" only. Nikita thinks that string is beautiful if it can be cut into 3 strings (possibly empty) without changing the order of the letters, where the 1-st and the 3-rd one contain only letters "a" and the 2-nd contains only letters "b".Nikita wants to make the... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
Ta... | Java | ["abba", "bab"] | 2 seconds | ["4", "2"] | NoteIt the first sample the string is already beautiful.In the second sample he needs to delete one of "b" to make it beautiful. | Java 8 | standard input | [
"dp",
"brute force"
] | c768f3e52e562ae1fd47502a60dbadfe | The first line contains a non-empty string of length not greater than 5 000 containing only lowercase English letters "a" and "b". | 1,500 | Print a single integer — the maximum possible size of beautiful string Nikita can get. | standard output | |
PASSED | 94b63ca1c9da8d741d0a0d599460b434 | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes | import java.io.*;
import java.util.*;
public class ORInMatrix {
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
int m = in.nextInt();
int n = in.nextInt();
int[][] B = new int[m][n];
for (int i = 0; i < m; ++i)
... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | c8d56fc400f3bec2494bd5bef7ce1d89 | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
public class Main {
public static void main(String[] args) throws NumberFormatExc... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | 69e79f6d8e9d1774058d1a890b13e759 | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes | import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.InputMismatchException;
public class OrInMatrix {
public static void main(String[] args) {
I... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | e360bc03933e189e3b779ce0aaa6a5f5 | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes |
import java.util.Arrays;
import java.util.Scanner;
public class ORinMatrix
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
int m = in.nextInt(), n = in.nextInt();
int[][] a = new int[m][n];
for (int i = 0; i < m; i++)
for (int j = 0; ... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | dcc9220852f8a991b5ec2565e5c7508d | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class B486 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int m = in.nextInt();
int n = in.nextInt();
int col[] = new int[n];
int row[] = new int[m];
Arrays.fill(col, 1);
... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | d46851dea32b484f8b345d255eaaf755 | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Main {
public static void main(String args[]) {
InputStream inputStream = System... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | e508e84f80075034d32c653ed1dd14d4 | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes | import java.io.*;
import java.util.*;
public class Task {
public static void main(String[] args) throws IOException {
new Task().solve();
}
PrintWriter out;
int cnt = 0;
int n;
boolean[] used;
int[] use;
ArrayList<Integer>[] rg;
ArrayList<Integer> tsort = new ArrayList<Integer>();
int[] comp;
int[] c... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | befd2762b49f5e052bf2e7b7fd259ca6 | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class B {
MyScanner sc = new MyScanner();
Scanner sc2 = new Scanner(System.in);
long start = System.currentTimeMillis();
long fin = System.currentTimeMillis();
final int MOD = 1000000007;
int[] dx = { 1, 0, 0, -1 };
int[] dy = { 0, 1, -1, 0 };
void run... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | 411973ea89082d278836748359e65302 | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
public class ORMatrix {
public static void main(String[] Args) throws IOException{
BufferedReader in= new BufferedReader(new InputStreamReader(Syst... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | 3d65f43f8ab992bb6fb2e630b396653a | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
import java.util.concurrent.*;
public class P486B {
@SuppressWarnings("unchecked")
public void run() throws Exception {
int n = nextInt();
int m = nextInt();
int [][] a = new int [n][];
for (int i = 0; i < n; i++) {
a[i] = readInt(m);... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | 452a9f5614ea0b9ef2bd950d25b272a2 | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class B {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] in = br.readLine().split(" ");
int m = Integer.par... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | 2f88f05477a26d0b32b8b6d43c13e579 | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes | import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;
public class SolB {
public static void main... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | 76d41e7dc118c2ac3385e2f5bb9ad4e3 | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes | import java.util.*;
public class ORinMatrix {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int m = in.nextInt();
int A1[][] = new int[n][m];
int A2[][] = new int[n][m];
for (int i = 0; i < n; i++)
for... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | da5a901c8206e2a12fd3a25dc9407c9b | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes | import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.math.BigDecimal;
import java.io.BufferedWriter;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
import java.math.B... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | f4471960d51dc192956f820416dde1fa | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes | import java.util.*;
public class Main {
static int n,m;
static int[][] a,ans;
static boolean[] row,col;
public static void main(String[] args){
Scanner cin=new Scanner(System.in);
n=cin.nextInt(); m=cin.nextInt();
row=new boolean[n]; for (int i=0;i<n;i++) row[i]=true;
co... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | 8bed13275eb31605975154066aaada66 | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes | import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.InputMismatchException;
public class Main {
static InputStream is;
static PrintWriter out;
static String INPUT = "";
st... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | 40cdb34aea43408c2835621c7c25f4fd | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes |
import java.io.*;
import java.io.FileReader;
import java.util.Scanner;
public class Main
{
public static int a[][],row,clm,flag;
public static int b[][];
public static boolean dd;
public static int row_visit(int r)
{
for(int i=1;i<=clm;i++)
{
if(b[r][i]==0)return 0;... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | 49c5d1e9ca64f67901f24857b08f5945 | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes |
//package calculating_function;
import java.io.*;
import java.io.FileReader;
import java.util.Scanner;
public class Main {
public static int a[][],row,clm,flag;
public static int b[][];
public static boolean dd;
public static int row_visit(int r)
{
for(int i=1;i<=clm;i++)
{... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | b6c0f59f245c44d8a3be7ccc67f498c1 | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes |
import java.io.*;
import java.io.FileReader;
import java.util.Scanner;
public class Main
{
public static int a[][],row,clm,flag;
public static int b[][];
public static boolean dd;
public static int row_visit(int r)
{
for(int i=1;i<=clm;i++)
{
if(b[r][i]==0)return 0;
... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | 9d015cdca41bd82903255cc856ddd1cf | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int m = sc.nextInt();
int n = sc.nextInt();
int a[][] = new int[m+1][n+1];
for (int i = 1; i <= m; i++) {
for (int j = 1; j <= n; j++) {
a[i][j] = sc.nextInt();
}
}
... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | b72b93a3cfd16f54e23138e670864874 | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes | import java.util.*;
import java.lang.reflect.Array;
import java.math.*;
import java.io.*;
import java.awt.*;
public class Main{
static FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in)));
static PrintWriter out = new PrintWriter(System.out);
static final int maxn = (int)1e2... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | 08011e31e3e78248a5bab19885c57916 | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class OrMatrix {
public static void printMatrix(int[][] a) {
for (int i = 0; i < a.length; i++) {
for (int j = 0; j < a[0].length; j++)
System.out.print(a[i][j] + " ");
System.out.println();
}
}
... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | e992efba55ea00cac997cfc39856ab54 | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes | import java.util.* ;
import java.io.*;
public class main {
static int sol [] [] ;
static void fillit(int r , int c , int x , int sol [][]){
for(int i = 0 ; i < sol.length ; i++)
sol[i][c] = x ;
for(int i = 0 ; i < sol[r].length ; i++)
sol[r][i] = x ;
}
static void print2D(int n , int m , int ar [... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | 8cc688f76e042236e2fe74460cc3563c | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes | import java.util.Scanner;
public class CF486B {
static int n;
static int m;
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
n = in.nextInt();
m = in.nextInt();
int[][] b = new int[n][m];
int[][] a = new int[n][m];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j+... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | f2105f2eea09c7f77b3129af26bf660b | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes | import java.io.IOException;
import java.io.InputStream;
import java.util.InputMismatchException;
public class Main {
public static void main(String[] args) throws Exception {
new Main().solve();
}
void solve() throws Exception {
FastScanner in = new FastScanner(System.in);
int s = in.nextInt();
int t = i... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | f61a8c58b475c9ffa792f3dc5d1040ee | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes | // Forza Juve
import java.io.*;
import java.util.*;
import java.awt.Point;
public class Template {
BufferedReader in;
PrintWriter out;
StringTokenizer st;
String next() {
while (st == null || !st.hasMoreTokens()) {
try {
st = new StringTokenizer(in.readLine());
... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | 4abfc9bc3bff2f291ef365c404d6c1d3 | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes | import java.util.Scanner;
public class Problem_486B
{
// B. OR in Matrix
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
int m = input.nextInt();
int n = input.nextInt();
int[][] matrixA = new int[m][n];
int[][] matrixB = new int[m][n];
int[][] matrixC = new int[m... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | c4ecb6f91f6bf7b9c86b351da9af12da | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
public class B {
public static void main(String[] args) throws Exception {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
// Scanner scan = new Scanner(System.in);
// PrintWriter out = ne... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | f520fd3a926fcf0097489513c66ef7f8 | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
//package orinmatrix;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
/**
*
* @author PrudhviNIT
*/
public class Main{
/**
* @param ar... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | fcf1131bac2884ad64340920d4fba28f | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the templa... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | caa2d0f1934488fbfb631b1531560ceb | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main implements Runnable {
// leave empty to read from stdin/stdout
private static final String TASK_NAME_FOR_IO = "";
// file names
private static final String FILE_IN = TASK_NAME_FOR_IO + ".in";
private static final... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | 521f10f028d0f1a8c1c17f2a7aa02fdd | train_002.jsonl | 1415718000 | Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis... | 256 megabytes | import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
Scanner t =new Scanner(System.in);
int m=t.nextInt();
int n=t.nextInt();
boolean[][] b=new boolean[m][n];
... | Java | ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"] | 1 second | ["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"] | null | Java 7 | standard input | [
"implementation",
"hashing",
"greedy"
] | bacd613dc8a91cee8bef87b787e878ca | The first line contains two integer m and n (1 ≤ m, n ≤ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1). | 1,300 | In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one. | standard output | |
PASSED | 8c9e4d80a2c95b4d02c113d1269b4d56 | train_002.jsonl | 1590676500 | The game of Berland poker is played with a deck of $$$n$$$ cards, $$$m$$$ of which are jokers. $$$k$$$ players play this game ($$$n$$$ is divisible by $$$k$$$).At the beginning of the game, each player takes $$$\frac{n}{k}$$$ cards from the deck (so each card is taken by exactly one player). The player who has the maxi... | 256 megabytes | import java.util.*;
public class Contest{
public static void main(String[]args){
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t>0){
int n=sc.nextInt();//total cards
int m=sc.nextInt();//joker
int k=sc.nextInt();//players
int c;//cards each player has
c=n/k;//cards e... | Java | ["4\n8 3 2\n4 2 4\n9 6 3\n42 0 7"] | 2 seconds | ["3\n0\n1\n0"] | NoteTest cases of the example are described in the statement. | Java 8 | standard input | [
"greedy",
"math",
"brute force"
] | 6324ca46b6f072f8952d2619cb4f73e6 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 500$$$) — the number of test cases. Then the test cases follow. Each test case contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$2 \le n \le 50$$$, $$$0 \le m \le n$$$, $$$2 \le k \le n$$$, $$$k$$$ is a divisors of $$$n$$$). | 1,000 | For each test case, print one integer — the maximum number of points a player can get for winning the game. | standard output | |
PASSED | 46ed3077fbc4336310b7410cbcd5a0e5 | train_002.jsonl | 1590676500 | The game of Berland poker is played with a deck of $$$n$$$ cards, $$$m$$$ of which are jokers. $$$k$$$ players play this game ($$$n$$$ is divisible by $$$k$$$).At the beginning of the game, each player takes $$$\frac{n}{k}$$$ cards from the deck (so each card is taken by exactly one player). The player who has the maxi... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String args[]) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(br.readLine().trim());
... | Java | ["4\n8 3 2\n4 2 4\n9 6 3\n42 0 7"] | 2 seconds | ["3\n0\n1\n0"] | NoteTest cases of the example are described in the statement. | Java 8 | standard input | [
"greedy",
"math",
"brute force"
] | 6324ca46b6f072f8952d2619cb4f73e6 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 500$$$) — the number of test cases. Then the test cases follow. Each test case contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$2 \le n \le 50$$$, $$$0 \le m \le n$$$, $$$2 \le k \le n$$$, $$$k$$$ is a divisors of $$$n$$$). | 1,000 | For each test case, print one integer — the maximum number of points a player can get for winning the game. | standard output | |
PASSED | 6d7243d0bcb0f6629eef3ac7e62480d5 | train_002.jsonl | 1590676500 | The game of Berland poker is played with a deck of $$$n$$$ cards, $$$m$$$ of which are jokers. $$$k$$$ players play this game ($$$n$$$ is divisible by $$$k$$$).At the beginning of the game, each player takes $$$\frac{n}{k}$$$ cards from the deck (so each card is taken by exactly one player). The player who has the maxi... | 256 megabytes | import java.util.*;
import java.io.*;
public class Solution {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int t = scn.nextInt();
while(t-- > 0) {
int n = scn.nextInt();
int m = scn.nextInt();
int k = scn.nextInt();
System.out.println(ans(n,m,k));
}
}
pub... | Java | ["4\n8 3 2\n4 2 4\n9 6 3\n42 0 7"] | 2 seconds | ["3\n0\n1\n0"] | NoteTest cases of the example are described in the statement. | Java 8 | standard input | [
"greedy",
"math",
"brute force"
] | 6324ca46b6f072f8952d2619cb4f73e6 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 500$$$) — the number of test cases. Then the test cases follow. Each test case contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$2 \le n \le 50$$$, $$$0 \le m \le n$$$, $$$2 \le k \le n$$$, $$$k$$$ is a divisors of $$$n$$$). | 1,000 | For each test case, print one integer — the maximum number of points a player can get for winning the game. | standard output | |
PASSED | f72764a6d60dfb49ddb78afb42e27a8f | train_002.jsonl | 1590676500 | The game of Berland poker is played with a deck of $$$n$$$ cards, $$$m$$$ of which are jokers. $$$k$$$ players play this game ($$$n$$$ is divisible by $$$k$$$).At the beginning of the game, each player takes $$$\frac{n}{k}$$$ cards from the deck (so each card is taken by exactly one player). The player who has the maxi... | 256 megabytes | import java.util.*;
import java.io.*;
public class HelloWorld{
public static void main(String []args){
Scanner scanner = new Scanner(System.in);
int test = scanner.nextInt();
while(test>0)
{
int n=scanner.nextInt();
... | Java | ["4\n8 3 2\n4 2 4\n9 6 3\n42 0 7"] | 2 seconds | ["3\n0\n1\n0"] | NoteTest cases of the example are described in the statement. | Java 8 | standard input | [
"greedy",
"math",
"brute force"
] | 6324ca46b6f072f8952d2619cb4f73e6 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 500$$$) — the number of test cases. Then the test cases follow. Each test case contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$2 \le n \le 50$$$, $$$0 \le m \le n$$$, $$$2 \le k \le n$$$, $$$k$$$ is a divisors of $$$n$$$). | 1,000 | For each test case, print one integer — the maximum number of points a player can get for winning the game. | standard output | |
PASSED | e84c37c80700a27ce49a47a4e6bb329b | train_002.jsonl | 1590676500 | The game of Berland poker is played with a deck of $$$n$$$ cards, $$$m$$$ of which are jokers. $$$k$$$ players play this game ($$$n$$$ is divisible by $$$k$$$).At the beginning of the game, each player takes $$$\frac{n}{k}$$$ cards from the deck (so each card is taken by exactly one player). The player who has the maxi... | 256 megabytes |
import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- > 0) {
int tc = sc.nextInt();
int j = sc.nextInt();
int p = sc.nextInt();
if (j==0) {
System.out.println(0);
continue;
}
if... | Java | ["4\n8 3 2\n4 2 4\n9 6 3\n42 0 7"] | 2 seconds | ["3\n0\n1\n0"] | NoteTest cases of the example are described in the statement. | Java 8 | standard input | [
"greedy",
"math",
"brute force"
] | 6324ca46b6f072f8952d2619cb4f73e6 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 500$$$) — the number of test cases. Then the test cases follow. Each test case contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$2 \le n \le 50$$$, $$$0 \le m \le n$$$, $$$2 \le k \le n$$$, $$$k$$$ is a divisors of $$$n$$$). | 1,000 | For each test case, print one integer — the maximum number of points a player can get for winning the game. | standard output | |
PASSED | e9d543ce00d668ba6e2ac16e06589f91 | train_002.jsonl | 1590676500 | The game of Berland poker is played with a deck of $$$n$$$ cards, $$$m$$$ of which are jokers. $$$k$$$ players play this game ($$$n$$$ is divisible by $$$k$$$).At the beginning of the game, each player takes $$$\frac{n}{k}$$$ cards from the deck (so each card is taken by exactly one player). The player who has the maxi... | 256 megabytes | import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
import java.util.Scanner;
import java.util.Set;
public class TaskA {
static Scanner in = new Scanner(System.in);
static PrintWriter w = new PrintWriter(System.ou... | Java | ["4\n8 3 2\n4 2 4\n9 6 3\n42 0 7"] | 2 seconds | ["3\n0\n1\n0"] | NoteTest cases of the example are described in the statement. | Java 8 | standard input | [
"greedy",
"math",
"brute force"
] | 6324ca46b6f072f8952d2619cb4f73e6 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 500$$$) — the number of test cases. Then the test cases follow. Each test case contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$2 \le n \le 50$$$, $$$0 \le m \le n$$$, $$$2 \le k \le n$$$, $$$k$$$ is a divisors of $$$n$$$). | 1,000 | For each test case, print one integer — the maximum number of points a player can get for winning the game. | standard output | |
PASSED | af58beb5cde9fed5ee30a83f04a5a605 | train_002.jsonl | 1590676500 | The game of Berland poker is played with a deck of $$$n$$$ cards, $$$m$$$ of which are jokers. $$$k$$$ players play this game ($$$n$$$ is divisible by $$$k$$$).At the beginning of the game, each player takes $$$\frac{n}{k}$$$ cards from the deck (so each card is taken by exactly one player). The player who has the maxi... | 256 megabytes |
import java.util.*;
public class codfor {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int t = s.nextInt();
while (t-- > 0) {
int n = s.nextInt(), m = s.nextInt(), k = s.nextInt();
int ans = 0;
if (n / k >= m) {
... | Java | ["4\n8 3 2\n4 2 4\n9 6 3\n42 0 7"] | 2 seconds | ["3\n0\n1\n0"] | NoteTest cases of the example are described in the statement. | Java 8 | standard input | [
"greedy",
"math",
"brute force"
] | 6324ca46b6f072f8952d2619cb4f73e6 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 500$$$) — the number of test cases. Then the test cases follow. Each test case contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$2 \le n \le 50$$$, $$$0 \le m \le n$$$, $$$2 \le k \le n$$$, $$$k$$$ is a divisors of $$$n$$$). | 1,000 | For each test case, print one integer — the maximum number of points a player can get for winning the game. | standard output | |
PASSED | a2c36443323fb3fcc4c277727d32e8fb | train_002.jsonl | 1590676500 | The game of Berland poker is played with a deck of $$$n$$$ cards, $$$m$$$ of which are jokers. $$$k$$$ players play this game ($$$n$$$ is divisible by $$$k$$$).At the beginning of the game, each player takes $$$\frac{n}{k}$$$ cards from the deck (so each card is taken by exactly one player). The player who has the maxi... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
... | Java | ["4\n8 3 2\n4 2 4\n9 6 3\n42 0 7"] | 2 seconds | ["3\n0\n1\n0"] | NoteTest cases of the example are described in the statement. | Java 8 | standard input | [
"greedy",
"math",
"brute force"
] | 6324ca46b6f072f8952d2619cb4f73e6 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 500$$$) — the number of test cases. Then the test cases follow. Each test case contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$2 \le n \le 50$$$, $$$0 \le m \le n$$$, $$$2 \le k \le n$$$, $$$k$$$ is a divisors of $$$n$$$). | 1,000 | For each test case, print one integer — the maximum number of points a player can get for winning the game. | standard output | |
PASSED | e59a91bb14c1ca5a04839d88f64b7e35 | train_002.jsonl | 1590676500 | The game of Berland poker is played with a deck of $$$n$$$ cards, $$$m$$$ of which are jokers. $$$k$$$ players play this game ($$$n$$$ is divisible by $$$k$$$).At the beginning of the game, each player takes $$$\frac{n}{k}$$$ cards from the deck (so each card is taken by exactly one player). The player who has the maxi... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static BufferedReader br ;
public static void main(String[] args) throws Exception {
// write your code here
Scanner sc = new Scanner(System.in);
int tc =sc.nextInt();
while(tc-->0){
int n =sc.n... | Java | ["4\n8 3 2\n4 2 4\n9 6 3\n42 0 7"] | 2 seconds | ["3\n0\n1\n0"] | NoteTest cases of the example are described in the statement. | Java 8 | standard input | [
"greedy",
"math",
"brute force"
] | 6324ca46b6f072f8952d2619cb4f73e6 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 500$$$) — the number of test cases. Then the test cases follow. Each test case contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$2 \le n \le 50$$$, $$$0 \le m \le n$$$, $$$2 \le k \le n$$$, $$$k$$$ is a divisors of $$$n$$$). | 1,000 | For each test case, print one integer — the maximum number of points a player can get for winning the game. | standard output | |
PASSED | ea04951f7b19bc782d24da94fc30a6b9 | train_002.jsonl | 1590676500 | The game of Berland poker is played with a deck of $$$n$$$ cards, $$$m$$$ of which are jokers. $$$k$$$ players play this game ($$$n$$$ is divisible by $$$k$$$).At the beginning of the game, each player takes $$$\frac{n}{k}$$$ cards from the deck (so each card is taken by exactly one player). The player who has the maxi... | 256 megabytes | //package main;
import java.io.*;
import java.util.*;
import java.lang.*;
import java.math.*;
public class Submission {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter (System.... | Java | ["4\n8 3 2\n4 2 4\n9 6 3\n42 0 7"] | 2 seconds | ["3\n0\n1\n0"] | NoteTest cases of the example are described in the statement. | Java 8 | standard input | [
"greedy",
"math",
"brute force"
] | 6324ca46b6f072f8952d2619cb4f73e6 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 500$$$) — the number of test cases. Then the test cases follow. Each test case contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$2 \le n \le 50$$$, $$$0 \le m \le n$$$, $$$2 \le k \le n$$$, $$$k$$$ is a divisors of $$$n$$$). | 1,000 | For each test case, print one integer — the maximum number of points a player can get for winning the game. | standard output | |
PASSED | 69c0dd7a8790f640a3c2041f667af8f1 | train_002.jsonl | 1590676500 | The game of Berland poker is played with a deck of $$$n$$$ cards, $$$m$$$ of which are jokers. $$$k$$$ players play this game ($$$n$$$ is divisible by $$$k$$$).At the beginning of the game, each player takes $$$\frac{n}{k}$$$ cards from the deck (so each card is taken by exactly one player). The player who has the maxi... | 256 megabytes | import java.util.Scanner;
public class A88 {
public static void main(String[] args) {
Scanner obj=new Scanner(System.in);
int t=obj.nextInt();
while(t-->0)
{
int n=obj.nextInt();
int m=obj.nextInt();
int k=obj.nextInt();
int ca=n/k;
if(ca>=m)
{
int max=m;
System.out.println(m-0);
... | Java | ["4\n8 3 2\n4 2 4\n9 6 3\n42 0 7"] | 2 seconds | ["3\n0\n1\n0"] | NoteTest cases of the example are described in the statement. | Java 8 | standard input | [
"greedy",
"math",
"brute force"
] | 6324ca46b6f072f8952d2619cb4f73e6 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 500$$$) — the number of test cases. Then the test cases follow. Each test case contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$2 \le n \le 50$$$, $$$0 \le m \le n$$$, $$$2 \le k \le n$$$, $$$k$$$ is a divisors of $$$n$$$). | 1,000 | For each test case, print one integer — the maximum number of points a player can get for winning the game. | standard output | |
PASSED | 712978ce4b7f78bd1944b51717c2d94e | train_002.jsonl | 1590676500 | The game of Berland poker is played with a deck of $$$n$$$ cards, $$$m$$$ of which are jokers. $$$k$$$ players play this game ($$$n$$$ is divisible by $$$k$$$).At the beginning of the game, each player takes $$$\frac{n}{k}$$$ cards from the deck (so each card is taken by exactly one player). The player who has the maxi... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
public class cdfer88a
{
static void merge(int arr[], int l, int m, int r)
{
int n1 = m - l + 1;
int n2 = r - m;
int L[] = new int [n1];
int R[] = new int [n2];
for (int i=0; i<n1; ++i)... | Java | ["4\n8 3 2\n4 2 4\n9 6 3\n42 0 7"] | 2 seconds | ["3\n0\n1\n0"] | NoteTest cases of the example are described in the statement. | Java 8 | standard input | [
"greedy",
"math",
"brute force"
] | 6324ca46b6f072f8952d2619cb4f73e6 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 500$$$) — the number of test cases. Then the test cases follow. Each test case contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$2 \le n \le 50$$$, $$$0 \le m \le n$$$, $$$2 \le k \le n$$$, $$$k$$$ is a divisors of $$$n$$$). | 1,000 | For each test case, print one integer — the maximum number of points a player can get for winning the game. | standard output | |
PASSED | 4fa1404978691c5bb2de10e147e49075 | train_002.jsonl | 1590676500 | The game of Berland poker is played with a deck of $$$n$$$ cards, $$$m$$$ of which are jokers. $$$k$$$ players play this game ($$$n$$$ is divisible by $$$k$$$).At the beginning of the game, each player takes $$$\frac{n}{k}$$$ cards from the deck (so each card is taken by exactly one player). The player who has the maxi... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
public class cdfer88a
{
static void merge(int arr[], int l, int m, int r)
{
int n1 = m - l + 1;
int n2 = r - m;
int L[] = new int [n1];
int R[] = new int [n2];
for (int i=0; i<n1; ++i)... | Java | ["4\n8 3 2\n4 2 4\n9 6 3\n42 0 7"] | 2 seconds | ["3\n0\n1\n0"] | NoteTest cases of the example are described in the statement. | Java 8 | standard input | [
"greedy",
"math",
"brute force"
] | 6324ca46b6f072f8952d2619cb4f73e6 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 500$$$) — the number of test cases. Then the test cases follow. Each test case contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$2 \le n \le 50$$$, $$$0 \le m \le n$$$, $$$2 \le k \le n$$$, $$$k$$$ is a divisors of $$$n$$$). | 1,000 | For each test case, print one integer — the maximum number of points a player can get for winning the game. | standard output | |
PASSED | 12dab3df4bebc07bc2ce4424a71f650c | train_002.jsonl | 1590676500 | The game of Berland poker is played with a deck of $$$n$$$ cards, $$$m$$$ of which are jokers. $$$k$$$ players play this game ($$$n$$$ is divisible by $$$k$$$).At the beginning of the game, each player takes $$$\frac{n}{k}$$$ cards from the deck (so each card is taken by exactly one player). The player who has the maxi... | 256 megabytes | //ARNAV KUMAR MANDAL//
//XYPHER//
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.text.DecimalFormat;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
... | Java | ["4\n8 3 2\n4 2 4\n9 6 3\n42 0 7"] | 2 seconds | ["3\n0\n1\n0"] | NoteTest cases of the example are described in the statement. | Java 8 | standard input | [
"greedy",
"math",
"brute force"
] | 6324ca46b6f072f8952d2619cb4f73e6 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 500$$$) — the number of test cases. Then the test cases follow. Each test case contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$2 \le n \le 50$$$, $$$0 \le m \le n$$$, $$$2 \le k \le n$$$, $$$k$$$ is a divisors of $$$n$$$). | 1,000 | For each test case, print one integer — the maximum number of points a player can get for winning the game. | standard output | |
PASSED | 674c0c4de5d6752983a3f416e7452f37 | train_002.jsonl | 1590676500 | The game of Berland poker is played with a deck of $$$n$$$ cards, $$$m$$$ of which are jokers. $$$k$$$ players play this game ($$$n$$$ is divisible by $$$k$$$).At the beginning of the game, each player takes $$$\frac{n}{k}$$$ cards from the deck (so each card is taken by exactly one player). The player who has the maxi... | 256 megabytes | /*
Aman Agarwal
algo.java
*/
import java.util.*;
import java.io.*;
public class A
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["4\n8 3 2\n4 2 4\n9 6 3\n42 0 7"] | 2 seconds | ["3\n0\n1\n0"] | NoteTest cases of the example are described in the statement. | Java 8 | standard input | [
"greedy",
"math",
"brute force"
] | 6324ca46b6f072f8952d2619cb4f73e6 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 500$$$) — the number of test cases. Then the test cases follow. Each test case contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$2 \le n \le 50$$$, $$$0 \le m \le n$$$, $$$2 \le k \le n$$$, $$$k$$$ is a divisors of $$$n$$$). | 1,000 | For each test case, print one integer — the maximum number of points a player can get for winning the game. | standard output | |
PASSED | 9edec66c380df9f4a5d0802f052e662e | train_002.jsonl | 1590676500 | The game of Berland poker is played with a deck of $$$n$$$ cards, $$$m$$$ of which are jokers. $$$k$$$ players play this game ($$$n$$$ is divisible by $$$k$$$).At the beginning of the game, each player takes $$$\frac{n}{k}$$$ cards from the deck (so each card is taken by exactly one player). The player who has the maxi... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class BazingaA {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer ... | Java | ["4\n8 3 2\n4 2 4\n9 6 3\n42 0 7"] | 2 seconds | ["3\n0\n1\n0"] | NoteTest cases of the example are described in the statement. | Java 8 | standard input | [
"greedy",
"math",
"brute force"
] | 6324ca46b6f072f8952d2619cb4f73e6 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 500$$$) — the number of test cases. Then the test cases follow. Each test case contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$2 \le n \le 50$$$, $$$0 \le m \le n$$$, $$$2 \le k \le n$$$, $$$k$$$ is a divisors of $$$n$$$). | 1,000 | For each test case, print one integer — the maximum number of points a player can get for winning the game. | standard output | |
PASSED | 8adbad4605de0a9a8116e0a5ce270cef | train_002.jsonl | 1590676500 | The game of Berland poker is played with a deck of $$$n$$$ cards, $$$m$$$ of which are jokers. $$$k$$$ players play this game ($$$n$$$ is divisible by $$$k$$$).At the beginning of the game, each player takes $$$\frac{n}{k}$$$ cards from the deck (so each card is taken by exactly one player). The player who has the maxi... | 256 megabytes |
import java.io.*;
import java.util.*;
import java.lang.*;
public class poker {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out,true);
int t= Integer.parseInt(b... | Java | ["4\n8 3 2\n4 2 4\n9 6 3\n42 0 7"] | 2 seconds | ["3\n0\n1\n0"] | NoteTest cases of the example are described in the statement. | Java 8 | standard input | [
"greedy",
"math",
"brute force"
] | 6324ca46b6f072f8952d2619cb4f73e6 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 500$$$) — the number of test cases. Then the test cases follow. Each test case contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$2 \le n \le 50$$$, $$$0 \le m \le n$$$, $$$2 \le k \le n$$$, $$$k$$$ is a divisors of $$$n$$$). | 1,000 | For each test case, print one integer — the maximum number of points a player can get for winning the game. | standard output | |
PASSED | 6efb906dafa4c00387c5c518085fcabc | train_002.jsonl | 1590676500 | The game of Berland poker is played with a deck of $$$n$$$ cards, $$$m$$$ of which are jokers. $$$k$$$ players play this game ($$$n$$$ is divisible by $$$k$$$).At the beginning of the game, each player takes $$$\frac{n}{k}$$$ cards from the deck (so each card is taken by exactly one player). The player who has the maxi... | 256 megabytes | import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class A
{
static InputReader in=new InputReader(System.in);
static OutputWriter out=new OutputWriter(System.out);
static StringBuilder sb=new StringBuilder();
static long MOD = (long)(998244353);
// Main Class Start... | Java | ["4\n8 3 2\n4 2 4\n9 6 3\n42 0 7"] | 2 seconds | ["3\n0\n1\n0"] | NoteTest cases of the example are described in the statement. | Java 8 | standard input | [
"greedy",
"math",
"brute force"
] | 6324ca46b6f072f8952d2619cb4f73e6 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 500$$$) — the number of test cases. Then the test cases follow. Each test case contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$2 \le n \le 50$$$, $$$0 \le m \le n$$$, $$$2 \le k \le n$$$, $$$k$$$ is a divisors of $$$n$$$). | 1,000 | For each test case, print one integer — the maximum number of points a player can get for winning the game. | standard output | |
PASSED | 934e31d2eea7e61848bf909ddd7cae02 | train_002.jsonl | 1590676500 | The game of Berland poker is played with a deck of $$$n$$$ cards, $$$m$$$ of which are jokers. $$$k$$$ players play this game ($$$n$$$ is divisible by $$$k$$$).At the beginning of the game, each player takes $$$\frac{n}{k}$$$ cards from the deck (so each card is taken by exactly one player). The player who has the maxi... | 256 megabytes | import java.util.*;
public class Joker
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int T=sc.nextInt();
for(int iter1=0;iter1<T;iter1++)
{
int n=sc.nextInt();
int m=sc.nextInt();
int k=sc.nextInt();
... | Java | ["4\n8 3 2\n4 2 4\n9 6 3\n42 0 7"] | 2 seconds | ["3\n0\n1\n0"] | NoteTest cases of the example are described in the statement. | Java 8 | standard input | [
"greedy",
"math",
"brute force"
] | 6324ca46b6f072f8952d2619cb4f73e6 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 500$$$) — the number of test cases. Then the test cases follow. Each test case contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$2 \le n \le 50$$$, $$$0 \le m \le n$$$, $$$2 \le k \le n$$$, $$$k$$$ is a divisors of $$$n$$$). | 1,000 | For each test case, print one integer — the maximum number of points a player can get for winning the game. | standard output | |
PASSED | f64b50e5097b9967067295900e9e5060 | train_002.jsonl | 1590676500 | The game of Berland poker is played with a deck of $$$n$$$ cards, $$$m$$$ of which are jokers. $$$k$$$ players play this game ($$$n$$$ is divisible by $$$k$$$).At the beginning of the game, each player takes $$$\frac{n}{k}$$$ cards from the deck (so each card is taken by exactly one player). The player who has the maxi... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main implements Runnable{
FastScanner sc;
PrintWriter pw;
final class FastScanner {
BufferedReader br;
StringTokenizer st;
public FastScanner() {
try {
br = new BufferedReader(new InputStreamReader(Syst... | Java | ["4\n8 3 2\n4 2 4\n9 6 3\n42 0 7"] | 2 seconds | ["3\n0\n1\n0"] | NoteTest cases of the example are described in the statement. | Java 8 | standard input | [
"greedy",
"math",
"brute force"
] | 6324ca46b6f072f8952d2619cb4f73e6 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 500$$$) — the number of test cases. Then the test cases follow. Each test case contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$2 \le n \le 50$$$, $$$0 \le m \le n$$$, $$$2 \le k \le n$$$, $$$k$$$ is a divisors of $$$n$$$). | 1,000 | For each test case, print one integer — the maximum number of points a player can get for winning the game. | standard output | |
PASSED | 8184fb53d71a735d7d8653b38ad82db6 | train_002.jsonl | 1590676500 | The game of Berland poker is played with a deck of $$$n$$$ cards, $$$m$$$ of which are jokers. $$$k$$$ players play this game ($$$n$$$ is divisible by $$$k$$$).At the beginning of the game, each player takes $$$\frac{n}{k}$$$ cards from the deck (so each card is taken by exactly one player). The player who has the maxi... | 256 megabytes |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int t = s.nextInt();
while (t>0){
t--;
float n = s.nextInt();
float m = s.nextInt();
float k = s.nextInt();
... | Java | ["4\n8 3 2\n4 2 4\n9 6 3\n42 0 7"] | 2 seconds | ["3\n0\n1\n0"] | NoteTest cases of the example are described in the statement. | Java 8 | standard input | [
"greedy",
"math",
"brute force"
] | 6324ca46b6f072f8952d2619cb4f73e6 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 500$$$) — the number of test cases. Then the test cases follow. Each test case contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$2 \le n \le 50$$$, $$$0 \le m \le n$$$, $$$2 \le k \le n$$$, $$$k$$$ is a divisors of $$$n$$$). | 1,000 | For each test case, print one integer — the maximum number of points a player can get for winning the game. | standard output | |
PASSED | 7c2d1664548d9bef19368bd3daed8959 | train_002.jsonl | 1590676500 | The game of Berland poker is played with a deck of $$$n$$$ cards, $$$m$$$ of which are jokers. $$$k$$$ players play this game ($$$n$$$ is divisible by $$$k$$$).At the beginning of the game, each player takes $$$\frac{n}{k}$$$ cards from the deck (so each card is taken by exactly one player). The player who has the maxi... | 256 megabytes |
import java.util.Scanner;
public class BerlandPoker {
public static void main(String[] args) {
Scanner scan=new Scanner(System.in);
int t=scan.nextInt();
while(t-->0) {
int n=scan.nextInt();
int m=scan.nextInt();
int k=scan.nextInt();
if(n==k) {
if(m==1)System.out.println("1");
else System.out.... | Java | ["4\n8 3 2\n4 2 4\n9 6 3\n42 0 7"] | 2 seconds | ["3\n0\n1\n0"] | NoteTest cases of the example are described in the statement. | Java 8 | standard input | [
"greedy",
"math",
"brute force"
] | 6324ca46b6f072f8952d2619cb4f73e6 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 500$$$) — the number of test cases. Then the test cases follow. Each test case contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$2 \le n \le 50$$$, $$$0 \le m \le n$$$, $$$2 \le k \le n$$$, $$$k$$$ is a divisors of $$$n$$$). | 1,000 | For each test case, print one integer — the maximum number of points a player can get for winning the game. | standard output | |
PASSED | f1748c812d202e452500b6345e4d84bd | train_002.jsonl | 1590676500 | The game of Berland poker is played with a deck of $$$n$$$ cards, $$$m$$$ of which are jokers. $$$k$$$ players play this game ($$$n$$$ is divisible by $$$k$$$).At the beginning of the game, each player takes $$$\frac{n}{k}$$$ cards from the deck (so each card is taken by exactly one player). The player who has the maxi... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class q1
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc = new Scanner(System.in);
int t= Integer.par... | Java | ["4\n8 3 2\n4 2 4\n9 6 3\n42 0 7"] | 2 seconds | ["3\n0\n1\n0"] | NoteTest cases of the example are described in the statement. | Java 8 | standard input | [
"greedy",
"math",
"brute force"
] | 6324ca46b6f072f8952d2619cb4f73e6 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 500$$$) — the number of test cases. Then the test cases follow. Each test case contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$2 \le n \le 50$$$, $$$0 \le m \le n$$$, $$$2 \le k \le n$$$, $$$k$$$ is a divisors of $$$n$$$). | 1,000 | For each test case, print one integer — the maximum number of points a player can get for winning the game. | standard output | |
PASSED | e9a503ed9d9b2381110c41ccba18b89e | train_002.jsonl | 1590676500 | The game of Berland poker is played with a deck of $$$n$$$ cards, $$$m$$$ of which are jokers. $$$k$$$ players play this game ($$$n$$$ is divisible by $$$k$$$).At the beginning of the game, each player takes $$$\frac{n}{k}$$$ cards from the deck (so each card is taken by exactly one player). The player who has the maxi... | 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);
int t =scn.nextInt();
while(t-->0){
int n=scn.nextInt();
int m =scn.nextInt();
int k =scn.nextInt();
int val = n/k;
int min = Math.min(... | Java | ["4\n8 3 2\n4 2 4\n9 6 3\n42 0 7"] | 2 seconds | ["3\n0\n1\n0"] | NoteTest cases of the example are described in the statement. | Java 8 | standard input | [
"greedy",
"math",
"brute force"
] | 6324ca46b6f072f8952d2619cb4f73e6 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 500$$$) — the number of test cases. Then the test cases follow. Each test case contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$2 \le n \le 50$$$, $$$0 \le m \le n$$$, $$$2 \le k \le n$$$, $$$k$$$ is a divisors of $$$n$$$). | 1,000 | For each test case, print one integer — the maximum number of points a player can get for winning the game. | standard output | |
PASSED | 9b12c4f32e2a459bd87880c6aa94e483 | train_002.jsonl | 1535122200 | You are given an array $$$a$$$, consisting of $$$n$$$ positive integers.Let's call a concatenation of numbers $$$x$$$ and $$$y$$$ the number that is obtained by writing down numbers $$$x$$$ and $$$y$$$ one right after another without changing the order. For example, a concatenation of numbers $$$12$$$ and $$$3456$$$ is... | 256 megabytes | import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int n=in.nextInt();
int k=in.nextInt();
int[] a=new int[n];
int[] l=new int[n];
List<HashMap<Integer,Integ... | Java | ["6 11\n45 1 10 12 11 7", "4 2\n2 78 4 10", "5 2\n3 7 19 3 3"] | 2 seconds | ["7", "12", "0"] | NoteIn the first example pairs $$$(1, 2)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(3, 1)$$$, $$$(3, 4)$$$, $$$(4, 2)$$$, $$$(4, 3)$$$ suffice. They produce numbers $$$451$$$, $$$4510$$$, $$$110$$$, $$$1045$$$, $$$1012$$$, $$$121$$$, $$$1210$$$, respectively, each of them is divisible by $$$11$$$.In the second example all $$$... | Java 8 | standard input | [
"implementation",
"math"
] | 1eb41e764a4248744edce6a9e7e3517a | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$2 \le k \le 10^9$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$). | 1,900 | Print a single integer — the number of ordered pairs of positions $$$(i, j)$$$ ($$$i \neq j$$$) in array $$$a$$$ such that the concatenation of $$$a_i$$$ and $$$a_j$$$ is divisible by $$$k$$$. | standard output | |
PASSED | e0c8513490167601e5e770439b6386d4 | train_002.jsonl | 1535122200 | You are given an array $$$a$$$, consisting of $$$n$$$ positive integers.Let's call a concatenation of numbers $$$x$$$ and $$$y$$$ the number that is obtained by writing down numbers $$$x$$$ and $$$y$$$ one right after another without changing the order. For example, a concatenation of numbers $$$12$$$ and $$$3456$$$ is... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
import static java.lang.Math.*;
import java.util.concurrent.ThreadLocalRandom;
public class Sol implements Runnable {
long mod = (long) 1e9 + 7;
void solve(InputReader in, PrintWriter w) {
int n = in.nextInt();
l... | Java | ["6 11\n45 1 10 12 11 7", "4 2\n2 78 4 10", "5 2\n3 7 19 3 3"] | 2 seconds | ["7", "12", "0"] | NoteIn the first example pairs $$$(1, 2)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(3, 1)$$$, $$$(3, 4)$$$, $$$(4, 2)$$$, $$$(4, 3)$$$ suffice. They produce numbers $$$451$$$, $$$4510$$$, $$$110$$$, $$$1045$$$, $$$1012$$$, $$$121$$$, $$$1210$$$, respectively, each of them is divisible by $$$11$$$.In the second example all $$$... | Java 8 | standard input | [
"implementation",
"math"
] | 1eb41e764a4248744edce6a9e7e3517a | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$2 \le k \le 10^9$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$). | 1,900 | Print a single integer — the number of ordered pairs of positions $$$(i, j)$$$ ($$$i \neq j$$$) in array $$$a$$$ such that the concatenation of $$$a_i$$$ and $$$a_j$$$ is divisible by $$$k$$$. | standard output | |
PASSED | 10aa9311b081a5b643271310f99f09cb | train_002.jsonl | 1535122200 | You are given an array $$$a$$$, consisting of $$$n$$$ positive integers.Let's call a concatenation of numbers $$$x$$$ and $$$y$$$ the number that is obtained by writing down numbers $$$x$$$ and $$$y$$$ one right after another without changing the order. For example, a concatenation of numbers $$$12$$$ and $$$3456$$$ is... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
import static java.util.Arrays.fill;
import static java.lang.Math.*;
import static java.util.Arrays.sort;
import static java.util.Collections.sort;
public class D {
static int mod = 1000000007;
static InputReader in = new InputReader(System.in);
static Prin... | Java | ["6 11\n45 1 10 12 11 7", "4 2\n2 78 4 10", "5 2\n3 7 19 3 3"] | 2 seconds | ["7", "12", "0"] | NoteIn the first example pairs $$$(1, 2)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(3, 1)$$$, $$$(3, 4)$$$, $$$(4, 2)$$$, $$$(4, 3)$$$ suffice. They produce numbers $$$451$$$, $$$4510$$$, $$$110$$$, $$$1045$$$, $$$1012$$$, $$$121$$$, $$$1210$$$, respectively, each of them is divisible by $$$11$$$.In the second example all $$$... | Java 8 | standard input | [
"implementation",
"math"
] | 1eb41e764a4248744edce6a9e7e3517a | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$2 \le k \le 10^9$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$). | 1,900 | Print a single integer — the number of ordered pairs of positions $$$(i, j)$$$ ($$$i \neq j$$$) in array $$$a$$$ such that the concatenation of $$$a_i$$$ and $$$a_j$$$ is divisible by $$$k$$$. | standard output | |
PASSED | 3df45b399843b60a592263e75fbd611f | train_002.jsonl | 1535122200 | You are given an array $$$a$$$, consisting of $$$n$$$ positive integers.Let's call a concatenation of numbers $$$x$$$ and $$$y$$$ the number that is obtained by writing down numbers $$$x$$$ and $$$y$$$ one right after another without changing the order. For example, a concatenation of numbers $$$12$$$ and $$$3456$$$ is... | 256 megabytes |
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.stream.Stream;
public class Main implements Runnable {
static final int MOD = (int) 1e9 + 7;
static final int MI = (int) 1e9;
static final long ML = (long) 1e18;
static final Reader in = new Reader();
static final... | Java | ["6 11\n45 1 10 12 11 7", "4 2\n2 78 4 10", "5 2\n3 7 19 3 3"] | 2 seconds | ["7", "12", "0"] | NoteIn the first example pairs $$$(1, 2)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(3, 1)$$$, $$$(3, 4)$$$, $$$(4, 2)$$$, $$$(4, 3)$$$ suffice. They produce numbers $$$451$$$, $$$4510$$$, $$$110$$$, $$$1045$$$, $$$1012$$$, $$$121$$$, $$$1210$$$, respectively, each of them is divisible by $$$11$$$.In the second example all $$$... | Java 8 | standard input | [
"implementation",
"math"
] | 1eb41e764a4248744edce6a9e7e3517a | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$2 \le k \le 10^9$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$). | 1,900 | Print a single integer — the number of ordered pairs of positions $$$(i, j)$$$ ($$$i \neq j$$$) in array $$$a$$$ such that the concatenation of $$$a_i$$$ and $$$a_j$$$ is divisible by $$$k$$$. | standard output | |
PASSED | c314f1bebcd7b4a81dfead3b38a65e7f | train_002.jsonl | 1535122200 | You are given an array $$$a$$$, consisting of $$$n$$$ positive integers.Let's call a concatenation of numbers $$$x$$$ and $$$y$$$ the number that is obtained by writing down numbers $$$x$$$ and $$$y$$$ one right after another without changing the order. For example, a concatenation of numbers $$$12$$$ and $$$3456$$$ is... | 256 megabytes | import java.util.*;
import java.io.*;
public class D {
static int size(int x)
{
int size = 0 ;
for( ; x > 0 ; x /= 10) size ++;
return size ;
}
static int mult (int x , int y , int k)
{
return (int)((1l * x * y) % k );
}
public static void main(String[] args) throws Exception
{
Scanner... | Java | ["6 11\n45 1 10 12 11 7", "4 2\n2 78 4 10", "5 2\n3 7 19 3 3"] | 2 seconds | ["7", "12", "0"] | NoteIn the first example pairs $$$(1, 2)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(3, 1)$$$, $$$(3, 4)$$$, $$$(4, 2)$$$, $$$(4, 3)$$$ suffice. They produce numbers $$$451$$$, $$$4510$$$, $$$110$$$, $$$1045$$$, $$$1012$$$, $$$121$$$, $$$1210$$$, respectively, each of them is divisible by $$$11$$$.In the second example all $$$... | Java 8 | standard input | [
"implementation",
"math"
] | 1eb41e764a4248744edce6a9e7e3517a | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$2 \le k \le 10^9$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$). | 1,900 | Print a single integer — the number of ordered pairs of positions $$$(i, j)$$$ ($$$i \neq j$$$) in array $$$a$$$ such that the concatenation of $$$a_i$$$ and $$$a_j$$$ is divisible by $$$k$$$. | standard output | |
PASSED | 30fe2d67501e8f68936ba5948ed2ce40 | train_002.jsonl | 1535122200 | You are given an array $$$a$$$, consisting of $$$n$$$ positive integers.Let's call a concatenation of numbers $$$x$$$ and $$$y$$$ the number that is obtained by writing down numbers $$$x$$$ and $$$y$$$ one right after another without changing the order. For example, a concatenation of numbers $$$12$$$ and $$$3456$$$ is... | 256 megabytes | import java.util.HashMap;
import java.util.Scanner;
public class test {
public static void main(String[] args) {
// TODO Auto-generated method stub
//long val1 = 922337204,val = 56950000;
//System.out.println(val1*val);
Scanner s= new Scanner(System.in);
int N = s.nextInt();
int K = s.nextInt();
int... | Java | ["6 11\n45 1 10 12 11 7", "4 2\n2 78 4 10", "5 2\n3 7 19 3 3"] | 2 seconds | ["7", "12", "0"] | NoteIn the first example pairs $$$(1, 2)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(3, 1)$$$, $$$(3, 4)$$$, $$$(4, 2)$$$, $$$(4, 3)$$$ suffice. They produce numbers $$$451$$$, $$$4510$$$, $$$110$$$, $$$1045$$$, $$$1012$$$, $$$121$$$, $$$1210$$$, respectively, each of them is divisible by $$$11$$$.In the second example all $$$... | Java 8 | standard input | [
"implementation",
"math"
] | 1eb41e764a4248744edce6a9e7e3517a | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$2 \le k \le 10^9$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$). | 1,900 | Print a single integer — the number of ordered pairs of positions $$$(i, j)$$$ ($$$i \neq j$$$) in array $$$a$$$ such that the concatenation of $$$a_i$$$ and $$$a_j$$$ is divisible by $$$k$$$. | standard output | |
PASSED | d7b724253afe0dfd4b7da9dd8d447700 | train_002.jsonl | 1535122200 | You are given an array $$$a$$$, consisting of $$$n$$$ positive integers.Let's call a concatenation of numbers $$$x$$$ and $$$y$$$ the number that is obtained by writing down numbers $$$x$$$ and $$$y$$$ one right after another without changing the order. For example, a concatenation of numbers $$$12$$$ and $$$3456$$$ is... | 256 megabytes | import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class A
{
public static void main(String ar[]) throws Exception
{
BufferedReader s=new BufferedReader(new InputStreamReader(System.in));
String v[]=s.readLine().split(" ");
int n=... | Java | ["6 11\n45 1 10 12 11 7", "4 2\n2 78 4 10", "5 2\n3 7 19 3 3"] | 2 seconds | ["7", "12", "0"] | NoteIn the first example pairs $$$(1, 2)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(3, 1)$$$, $$$(3, 4)$$$, $$$(4, 2)$$$, $$$(4, 3)$$$ suffice. They produce numbers $$$451$$$, $$$4510$$$, $$$110$$$, $$$1045$$$, $$$1012$$$, $$$121$$$, $$$1210$$$, respectively, each of them is divisible by $$$11$$$.In the second example all $$$... | Java 8 | standard input | [
"implementation",
"math"
] | 1eb41e764a4248744edce6a9e7e3517a | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$2 \le k \le 10^9$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$). | 1,900 | Print a single integer — the number of ordered pairs of positions $$$(i, j)$$$ ($$$i \neq j$$$) in array $$$a$$$ such that the concatenation of $$$a_i$$$ and $$$a_j$$$ is divisible by $$$k$$$. | standard output | |
PASSED | 2a45c8c54973b18e5f05c6f54b8e54a7 | train_002.jsonl | 1535122200 | You are given an array $$$a$$$, consisting of $$$n$$$ positive integers.Let's call a concatenation of numbers $$$x$$$ and $$$y$$$ the number that is obtained by writing down numbers $$$x$$$ and $$$y$$$ one right after another without changing the order. For example, a concatenation of numbers $$$12$$$ and $$$3456$$$ is... | 256 megabytes |
import java.util.*;
import java.io.*;
public class p1029D {
public static void main(String[] args) {
int n, k;
Scanner input = new Scanner(System.in);
//long tStart = System.currentTimeMillis();
//long tEnd;
String l1 = input.nextLine();
String[] l1L = l1.split(" ");
n = Integer.parseInt(l1L[0])... | Java | ["6 11\n45 1 10 12 11 7", "4 2\n2 78 4 10", "5 2\n3 7 19 3 3"] | 2 seconds | ["7", "12", "0"] | NoteIn the first example pairs $$$(1, 2)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(3, 1)$$$, $$$(3, 4)$$$, $$$(4, 2)$$$, $$$(4, 3)$$$ suffice. They produce numbers $$$451$$$, $$$4510$$$, $$$110$$$, $$$1045$$$, $$$1012$$$, $$$121$$$, $$$1210$$$, respectively, each of them is divisible by $$$11$$$.In the second example all $$$... | Java 8 | standard input | [
"implementation",
"math"
] | 1eb41e764a4248744edce6a9e7e3517a | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$2 \le k \le 10^9$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$). | 1,900 | Print a single integer — the number of ordered pairs of positions $$$(i, j)$$$ ($$$i \neq j$$$) in array $$$a$$$ such that the concatenation of $$$a_i$$$ and $$$a_j$$$ is divisible by $$$k$$$. | standard output | |
PASSED | 5cf8b5740ea285e639ad0896b6321988 | train_002.jsonl | 1535122200 | You are given an array $$$a$$$, consisting of $$$n$$$ positive integers.Let's call a concatenation of numbers $$$x$$$ and $$$y$$$ the number that is obtained by writing down numbers $$$x$$$ and $$$y$$$ one right after another without changing the order. For example, a concatenation of numbers $$$12$$$ and $$$3456$$$ is... | 256 megabytes |
import java.util.*;
import java.io.*;
public class p1029D {
public static void main(String[] args) {
int n, k;
Scanner input = new Scanner(System.in);
String l1 = input.nextLine();
String[] l1L = l1.split(" ");
n = Integer.parseInt(l1L[0]);
k = Integer.parseInt(l1L[1]);
String l2 = input.nextLine()... | Java | ["6 11\n45 1 10 12 11 7", "4 2\n2 78 4 10", "5 2\n3 7 19 3 3"] | 2 seconds | ["7", "12", "0"] | NoteIn the first example pairs $$$(1, 2)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(3, 1)$$$, $$$(3, 4)$$$, $$$(4, 2)$$$, $$$(4, 3)$$$ suffice. They produce numbers $$$451$$$, $$$4510$$$, $$$110$$$, $$$1045$$$, $$$1012$$$, $$$121$$$, $$$1210$$$, respectively, each of them is divisible by $$$11$$$.In the second example all $$$... | Java 8 | standard input | [
"implementation",
"math"
] | 1eb41e764a4248744edce6a9e7e3517a | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$2 \le k \le 10^9$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$). | 1,900 | Print a single integer — the number of ordered pairs of positions $$$(i, j)$$$ ($$$i \neq j$$$) in array $$$a$$$ such that the concatenation of $$$a_i$$$ and $$$a_j$$$ is divisible by $$$k$$$. | standard output | |
PASSED | 66bcbc392da8661c19ef9785f70510cc | train_002.jsonl | 1535122200 | You are given an array $$$a$$$, consisting of $$$n$$$ positive integers.Let's call a concatenation of numbers $$$x$$$ and $$$y$$$ the number that is obtained by writing down numbers $$$x$$$ and $$$y$$$ one right after another without changing the order. For example, a concatenation of numbers $$$12$$$ and $$$3456$$$ is... | 256 megabytes |
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.util.Locale;
public class D {
public static void main(String[] args) {... | Java | ["6 11\n45 1 10 12 11 7", "4 2\n2 78 4 10", "5 2\n3 7 19 3 3"] | 2 seconds | ["7", "12", "0"] | NoteIn the first example pairs $$$(1, 2)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(3, 1)$$$, $$$(3, 4)$$$, $$$(4, 2)$$$, $$$(4, 3)$$$ suffice. They produce numbers $$$451$$$, $$$4510$$$, $$$110$$$, $$$1045$$$, $$$1012$$$, $$$121$$$, $$$1210$$$, respectively, each of them is divisible by $$$11$$$.In the second example all $$$... | Java 8 | standard input | [
"implementation",
"math"
] | 1eb41e764a4248744edce6a9e7e3517a | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$2 \le k \le 10^9$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$). | 1,900 | Print a single integer — the number of ordered pairs of positions $$$(i, j)$$$ ($$$i \neq j$$$) in array $$$a$$$ such that the concatenation of $$$a_i$$$ and $$$a_j$$$ is divisible by $$$k$$$. | standard output | |
PASSED | 4e52a576ff47846f9c925d71007fc9a4 | train_002.jsonl | 1535122200 | You are given an array $$$a$$$, consisting of $$$n$$$ positive integers.Let's call a concatenation of numbers $$$x$$$ and $$$y$$$ the number that is obtained by writing down numbers $$$x$$$ and $$$y$$$ one right after another without changing the order. For example, a concatenation of numbers $$$12$$$ and $$$3456$$$ is... | 256 megabytes | import java.math.BigInteger;
import java.util.*;
import static java.lang.StrictMath.pow;
public class Q506D {
public static void main(String [] args) {
Scanner in = new Scanner(System.in);
Integer itemCount = in.nextInt();
Integer divisor = in.nextInt();
Integer[] intArr = new I... | Java | ["6 11\n45 1 10 12 11 7", "4 2\n2 78 4 10", "5 2\n3 7 19 3 3"] | 2 seconds | ["7", "12", "0"] | NoteIn the first example pairs $$$(1, 2)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(3, 1)$$$, $$$(3, 4)$$$, $$$(4, 2)$$$, $$$(4, 3)$$$ suffice. They produce numbers $$$451$$$, $$$4510$$$, $$$110$$$, $$$1045$$$, $$$1012$$$, $$$121$$$, $$$1210$$$, respectively, each of them is divisible by $$$11$$$.In the second example all $$$... | Java 8 | standard input | [
"implementation",
"math"
] | 1eb41e764a4248744edce6a9e7e3517a | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$2 \le k \le 10^9$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$). | 1,900 | Print a single integer — the number of ordered pairs of positions $$$(i, j)$$$ ($$$i \neq j$$$) in array $$$a$$$ such that the concatenation of $$$a_i$$$ and $$$a_j$$$ is divisible by $$$k$$$. | standard output | |
PASSED | 17d4acf43a999bc675a4c6fb42007c82 | train_002.jsonl | 1535122200 | You are given an array $$$a$$$, consisting of $$$n$$$ positive integers.Let's call a concatenation of numbers $$$x$$$ and $$$y$$$ the number that is obtained by writing down numbers $$$x$$$ and $$$y$$$ one right after another without changing the order. For example, a concatenation of numbers $$$12$$$ and $$$3456$$$ is... | 256 megabytes | import java.util.HashMap;
import java.util.Scanner;
public class ConcatenatedMultiples {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
HashMap<Integer,Integer>[] single = new HashMap[11];
for (int p = 0; p < single.length; p++){
single[p] = new Has... | Java | ["6 11\n45 1 10 12 11 7", "4 2\n2 78 4 10", "5 2\n3 7 19 3 3"] | 2 seconds | ["7", "12", "0"] | NoteIn the first example pairs $$$(1, 2)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(3, 1)$$$, $$$(3, 4)$$$, $$$(4, 2)$$$, $$$(4, 3)$$$ suffice. They produce numbers $$$451$$$, $$$4510$$$, $$$110$$$, $$$1045$$$, $$$1012$$$, $$$121$$$, $$$1210$$$, respectively, each of them is divisible by $$$11$$$.In the second example all $$$... | Java 8 | standard input | [
"implementation",
"math"
] | 1eb41e764a4248744edce6a9e7e3517a | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$2 \le k \le 10^9$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$). | 1,900 | Print a single integer — the number of ordered pairs of positions $$$(i, j)$$$ ($$$i \neq j$$$) in array $$$a$$$ such that the concatenation of $$$a_i$$$ and $$$a_j$$$ is divisible by $$$k$$$. | standard output | |
PASSED | e3ead102f6e2f125a69e83cf479f779f | train_002.jsonl | 1535122200 | You are given an array $$$a$$$, consisting of $$$n$$$ positive integers.Let's call a concatenation of numbers $$$x$$$ and $$$y$$$ the number that is obtained by writing down numbers $$$x$$$ and $$$y$$$ one right after another without changing the order. For example, a concatenation of numbers $$$12$$$ and $$$3456$$$ is... | 256 megabytes | import java.awt.*;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.List;
public class Main implements Runnable {
int maxn = (int)3e5+111;
long n,m,k;
long a[] = new long[maxn];
void solve() throws Exception {
n = in.nextInt();
k = in.nextInt();
... | Java | ["6 11\n45 1 10 12 11 7", "4 2\n2 78 4 10", "5 2\n3 7 19 3 3"] | 2 seconds | ["7", "12", "0"] | NoteIn the first example pairs $$$(1, 2)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(3, 1)$$$, $$$(3, 4)$$$, $$$(4, 2)$$$, $$$(4, 3)$$$ suffice. They produce numbers $$$451$$$, $$$4510$$$, $$$110$$$, $$$1045$$$, $$$1012$$$, $$$121$$$, $$$1210$$$, respectively, each of them is divisible by $$$11$$$.In the second example all $$$... | Java 8 | standard input | [
"implementation",
"math"
] | 1eb41e764a4248744edce6a9e7e3517a | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$2 \le k \le 10^9$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$). | 1,900 | Print a single integer — the number of ordered pairs of positions $$$(i, j)$$$ ($$$i \neq j$$$) in array $$$a$$$ such that the concatenation of $$$a_i$$$ and $$$a_j$$$ is divisible by $$$k$$$. | standard output | |
PASSED | 35688b2b5f3980fec194d7a8bc33e17b | train_002.jsonl | 1535122200 | You are given an array $$$a$$$, consisting of $$$n$$$ positive integers.Let's call a concatenation of numbers $$$x$$$ and $$$y$$$ the number that is obtained by writing down numbers $$$x$$$ and $$$y$$$ one right after another without changing the order. For example, a concatenation of numbers $$$12$$$ and $$$3456$$$ is... | 256 megabytes | import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
public class Main {
public void sort(long b[]){
Random rd = new Random();
for(int i=1;i<b.length;++i){
int c = rd.nextInt(i);
long v = b[c];
b[c] = b[i];
b... | Java | ["6 11\n45 1 10 12 11 7", "4 2\n2 78 4 10", "5 2\n3 7 19 3 3"] | 2 seconds | ["7", "12", "0"] | NoteIn the first example pairs $$$(1, 2)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(3, 1)$$$, $$$(3, 4)$$$, $$$(4, 2)$$$, $$$(4, 3)$$$ suffice. They produce numbers $$$451$$$, $$$4510$$$, $$$110$$$, $$$1045$$$, $$$1012$$$, $$$121$$$, $$$1210$$$, respectively, each of them is divisible by $$$11$$$.In the second example all $$$... | Java 8 | standard input | [
"implementation",
"math"
] | 1eb41e764a4248744edce6a9e7e3517a | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$2 \le k \le 10^9$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$). | 1,900 | Print a single integer — the number of ordered pairs of positions $$$(i, j)$$$ ($$$i \neq j$$$) in array $$$a$$$ such that the concatenation of $$$a_i$$$ and $$$a_j$$$ is divisible by $$$k$$$. | standard output | |
PASSED | 83231fc15806ab2796bc77960c4ed3f0 | train_002.jsonl | 1535122200 | You are given an array $$$a$$$, consisting of $$$n$$$ positive integers.Let's call a concatenation of numbers $$$x$$$ and $$$y$$$ the number that is obtained by writing down numbers $$$x$$$ and $$$y$$$ one right after another without changing the order. For example, a concatenation of numbers $$$12$$$ and $$$3456$$$ is... | 256 megabytes |
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
public class Main {
public void sort(long b[]){
Random rd = new Random();
for(int i=1;i<b.length;++i){
int c = rd.nextInt(i);
long v = b[c];
b[c] = b[i];
... | Java | ["6 11\n45 1 10 12 11 7", "4 2\n2 78 4 10", "5 2\n3 7 19 3 3"] | 2 seconds | ["7", "12", "0"] | NoteIn the first example pairs $$$(1, 2)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(3, 1)$$$, $$$(3, 4)$$$, $$$(4, 2)$$$, $$$(4, 3)$$$ suffice. They produce numbers $$$451$$$, $$$4510$$$, $$$110$$$, $$$1045$$$, $$$1012$$$, $$$121$$$, $$$1210$$$, respectively, each of them is divisible by $$$11$$$.In the second example all $$$... | Java 8 | standard input | [
"implementation",
"math"
] | 1eb41e764a4248744edce6a9e7e3517a | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$2 \le k \le 10^9$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$). | 1,900 | Print a single integer — the number of ordered pairs of positions $$$(i, j)$$$ ($$$i \neq j$$$) in array $$$a$$$ such that the concatenation of $$$a_i$$$ and $$$a_j$$$ is divisible by $$$k$$$. | standard output | |
PASSED | b8c18c6350824d273291a37bf755bc3e | train_002.jsonl | 1535122200 | You are given an array $$$a$$$, consisting of $$$n$$$ positive integers.Let's call a concatenation of numbers $$$x$$$ and $$$y$$$ the number that is obtained by writing down numbers $$$x$$$ and $$$y$$$ one right after another without changing the order. For example, a concatenation of numbers $$$12$$$ and $$$3456$$$ is... | 256 megabytes | import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
public class Main {
public void sort(long b[]){
Random rd = new Random();
for(int i=1;i<b.length;++i){
int c = rd.nextInt(i);
long v = b[c];
b[c] = b[i];
b... | Java | ["6 11\n45 1 10 12 11 7", "4 2\n2 78 4 10", "5 2\n3 7 19 3 3"] | 2 seconds | ["7", "12", "0"] | NoteIn the first example pairs $$$(1, 2)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(3, 1)$$$, $$$(3, 4)$$$, $$$(4, 2)$$$, $$$(4, 3)$$$ suffice. They produce numbers $$$451$$$, $$$4510$$$, $$$110$$$, $$$1045$$$, $$$1012$$$, $$$121$$$, $$$1210$$$, respectively, each of them is divisible by $$$11$$$.In the second example all $$$... | Java 8 | standard input | [
"implementation",
"math"
] | 1eb41e764a4248744edce6a9e7e3517a | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$2 \le k \le 10^9$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$). | 1,900 | Print a single integer — the number of ordered pairs of positions $$$(i, j)$$$ ($$$i \neq j$$$) in array $$$a$$$ such that the concatenation of $$$a_i$$$ and $$$a_j$$$ is divisible by $$$k$$$. | standard output | |
PASSED | 5ef8c8043f1500d427421b155d01cb7d | train_002.jsonl | 1535122200 | You are given an array $$$a$$$, consisting of $$$n$$$ positive integers.Let's call a concatenation of numbers $$$x$$$ and $$$y$$$ the number that is obtained by writing down numbers $$$x$$$ and $$$y$$$ one right after another without changing the order. For example, a concatenation of numbers $$$12$$$ and $$$3456$$$ is... | 256 megabytes | import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
public class Main {
public void sort(long b[]){
Random rd = new Random();
for(int i=1;i<b.length;++i){
int c = rd.nextInt(i);
long v = b[c];
b[c] = b[i];
b... | Java | ["6 11\n45 1 10 12 11 7", "4 2\n2 78 4 10", "5 2\n3 7 19 3 3"] | 2 seconds | ["7", "12", "0"] | NoteIn the first example pairs $$$(1, 2)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(3, 1)$$$, $$$(3, 4)$$$, $$$(4, 2)$$$, $$$(4, 3)$$$ suffice. They produce numbers $$$451$$$, $$$4510$$$, $$$110$$$, $$$1045$$$, $$$1012$$$, $$$121$$$, $$$1210$$$, respectively, each of them is divisible by $$$11$$$.In the second example all $$$... | Java 8 | standard input | [
"implementation",
"math"
] | 1eb41e764a4248744edce6a9e7e3517a | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$2 \le k \le 10^9$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$). | 1,900 | Print a single integer — the number of ordered pairs of positions $$$(i, j)$$$ ($$$i \neq j$$$) in array $$$a$$$ such that the concatenation of $$$a_i$$$ and $$$a_j$$$ is divisible by $$$k$$$. | standard output | |
PASSED | ee21d5ec775bd81885ad7d3600c5765c | train_002.jsonl | 1535122200 | You are given an array $$$a$$$, consisting of $$$n$$$ positive integers.Let's call a concatenation of numbers $$$x$$$ and $$$y$$$ the number that is obtained by writing down numbers $$$x$$$ and $$$y$$$ one right after another without changing the order. For example, a concatenation of numbers $$$12$$$ and $$$3456$$$ is... | 256 megabytes |
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
public class Main {
public void sort(long b[]){
Random rd = new Random();
for(int i=1;i<b.length;++i){
int c = rd.nextInt(i);
long v = b[c];
b[c] = b[i];
... | Java | ["6 11\n45 1 10 12 11 7", "4 2\n2 78 4 10", "5 2\n3 7 19 3 3"] | 2 seconds | ["7", "12", "0"] | NoteIn the first example pairs $$$(1, 2)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(3, 1)$$$, $$$(3, 4)$$$, $$$(4, 2)$$$, $$$(4, 3)$$$ suffice. They produce numbers $$$451$$$, $$$4510$$$, $$$110$$$, $$$1045$$$, $$$1012$$$, $$$121$$$, $$$1210$$$, respectively, each of them is divisible by $$$11$$$.In the second example all $$$... | Java 8 | standard input | [
"implementation",
"math"
] | 1eb41e764a4248744edce6a9e7e3517a | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$2 \le k \le 10^9$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$). | 1,900 | Print a single integer — the number of ordered pairs of positions $$$(i, j)$$$ ($$$i \neq j$$$) in array $$$a$$$ such that the concatenation of $$$a_i$$$ and $$$a_j$$$ is divisible by $$$k$$$. | standard output | |
PASSED | 3c77e795749c85f583176f6943148ce8 | train_002.jsonl | 1535122200 | You are given an array $$$a$$$, consisting of $$$n$$$ positive integers.Let's call a concatenation of numbers $$$x$$$ and $$$y$$$ the number that is obtained by writing down numbers $$$x$$$ and $$$y$$$ one right after another without changing the order. For example, a concatenation of numbers $$$12$$$ and $$$3456$$$ is... | 256 megabytes | import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
public class Main {
public void sort(long b[]){
Random rd = new Random();
for(int i=1;i<b.length;++i){
int c = rd.nextInt(i);
long v = b[c];
b[c] = b[i];
b... | Java | ["6 11\n45 1 10 12 11 7", "4 2\n2 78 4 10", "5 2\n3 7 19 3 3"] | 2 seconds | ["7", "12", "0"] | NoteIn the first example pairs $$$(1, 2)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(3, 1)$$$, $$$(3, 4)$$$, $$$(4, 2)$$$, $$$(4, 3)$$$ suffice. They produce numbers $$$451$$$, $$$4510$$$, $$$110$$$, $$$1045$$$, $$$1012$$$, $$$121$$$, $$$1210$$$, respectively, each of them is divisible by $$$11$$$.In the second example all $$$... | Java 8 | standard input | [
"implementation",
"math"
] | 1eb41e764a4248744edce6a9e7e3517a | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$2 \le k \le 10^9$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$). | 1,900 | Print a single integer — the number of ordered pairs of positions $$$(i, j)$$$ ($$$i \neq j$$$) in array $$$a$$$ such that the concatenation of $$$a_i$$$ and $$$a_j$$$ is divisible by $$$k$$$. | standard output | |
PASSED | 090d43e6efefd704029975b308dd6b20 | train_002.jsonl | 1535122200 | You are given an array $$$a$$$, consisting of $$$n$$$ positive integers.Let's call a concatenation of numbers $$$x$$$ and $$$y$$$ the number that is obtained by writing down numbers $$$x$$$ and $$$y$$$ one right after another without changing the order. For example, a concatenation of numbers $$$12$$$ and $$$3456$$$ is... | 256 megabytes | import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.util.*;
import java.util.Map.Entry;
public class Main
{
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private SpaceCharFilter filter;... | Java | ["6 11\n45 1 10 12 11 7", "4 2\n2 78 4 10", "5 2\n3 7 19 3 3"] | 2 seconds | ["7", "12", "0"] | NoteIn the first example pairs $$$(1, 2)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(3, 1)$$$, $$$(3, 4)$$$, $$$(4, 2)$$$, $$$(4, 3)$$$ suffice. They produce numbers $$$451$$$, $$$4510$$$, $$$110$$$, $$$1045$$$, $$$1012$$$, $$$121$$$, $$$1210$$$, respectively, each of them is divisible by $$$11$$$.In the second example all $$$... | Java 8 | standard input | [
"implementation",
"math"
] | 1eb41e764a4248744edce6a9e7e3517a | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$2 \le k \le 10^9$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$). | 1,900 | Print a single integer — the number of ordered pairs of positions $$$(i, j)$$$ ($$$i \neq j$$$) in array $$$a$$$ such that the concatenation of $$$a_i$$$ and $$$a_j$$$ is divisible by $$$k$$$. | standard output | |
PASSED | 2558d0f2c9d0aebe7e1de0ddffbc5380 | train_002.jsonl | 1535122200 | You are given an array $$$a$$$, consisting of $$$n$$$ positive integers.Let's call a concatenation of numbers $$$x$$$ and $$$y$$$ the number that is obtained by writing down numbers $$$x$$$ and $$$y$$$ one right after another without changing the order. For example, a concatenation of numbers $$$12$$$ and $$$3456$$$ is... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.BigDecimal;
public class R506D {
public static void main (String[] args) throws java.lang.Exception {
InputReader in = new InputReader(System.in);
PrintWriter w = new PrintWriter(System.out);
int n = in.nextInt();lon... | Java | ["6 11\n45 1 10 12 11 7", "4 2\n2 78 4 10", "5 2\n3 7 19 3 3"] | 2 seconds | ["7", "12", "0"] | NoteIn the first example pairs $$$(1, 2)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(3, 1)$$$, $$$(3, 4)$$$, $$$(4, 2)$$$, $$$(4, 3)$$$ suffice. They produce numbers $$$451$$$, $$$4510$$$, $$$110$$$, $$$1045$$$, $$$1012$$$, $$$121$$$, $$$1210$$$, respectively, each of them is divisible by $$$11$$$.In the second example all $$$... | Java 8 | standard input | [
"implementation",
"math"
] | 1eb41e764a4248744edce6a9e7e3517a | The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$2 \le k \le 10^9$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$). | 1,900 | Print a single integer — the number of ordered pairs of positions $$$(i, j)$$$ ($$$i \neq j$$$) in array $$$a$$$ such that the concatenation of $$$a_i$$$ and $$$a_j$$$ is divisible by $$$k$$$. | standard output | |
PASSED | e9fc60c048459910cfc20f1388653f0b | train_002.jsonl | 1526574900 | You're given a tree with $$$n$$$ vertices.Your task is to determine the maximum possible number of edges that can be removed in such a way that all the remaining connected components will have even size. | 256 megabytes |
import java.io.*;
import java.util.*;
public class C
{
static ArrayList<Integer> g[];
static int[] vis,size;
public static void main(String[] args)throws IOException
{
FastReader f=new FastReader();
StringBuffer sb=new StringBuffer();
int n=f.nextInt();
g=new ArrayList[n+1];
for(int i=1;i<=n;i++... | Java | ["4\n2 4\n4 1\n3 1", "3\n1 2\n1 3", "10\n7 1\n8 4\n8 10\n4 7\n6 5\n9 3\n3 5\n2 10\n2 5", "2\n1 2"] | 1 second | ["1", "-1", "4", "0"] | NoteIn the first example you can remove the edge between vertices $$$1$$$ and $$$4$$$. The graph after that will have two connected components with two vertices in each.In the second example you can't remove edges in such a way that all components have even number of vertices, so the answer is $$$-1$$$. | Java 8 | standard input | [
"dp",
"greedy",
"graphs",
"dfs and similar",
"trees"
] | 711896281f4beff55a8826771eeccb81 | The first line contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) denoting the size of the tree. The next $$$n - 1$$$ lines contain two integers $$$u$$$, $$$v$$$ ($$$1 \le u, v \le n$$$) each, describing the vertices connected by the $$$i$$$-th edge. It's guaranteed that the given edges form a tree. | 1,500 | Output a single integer $$$k$$$ — the maximum number of edges that can be removed to leave all connected components with even size, or $$$-1$$$ if it is impossible to remove edges in order to satisfy this property. | standard output | |
PASSED | a7d8ced30f646665e586b50e6ebc0eb0 | train_002.jsonl | 1526574900 | You're given a tree with $$$n$$$ vertices.Your task is to determine the maximum possible number of edges that can be removed in such a way that all the remaining connected components will have even size. | 256 megabytes | import java.util.*;
import java.io.*;
public class _982_C_CutemAll {
public static void main(String[] args) throws IOException {
int N = readInt(); if(N%2 == 1) {println(-1); exit();}
ArrayList<Integer> graph[] = new ArrayList[N+1]; for(int i = 1; i<=N; i++) graph[i] = new ArrayList<>();
for(int i = 1; i<N; i... | Java | ["4\n2 4\n4 1\n3 1", "3\n1 2\n1 3", "10\n7 1\n8 4\n8 10\n4 7\n6 5\n9 3\n3 5\n2 10\n2 5", "2\n1 2"] | 1 second | ["1", "-1", "4", "0"] | NoteIn the first example you can remove the edge between vertices $$$1$$$ and $$$4$$$. The graph after that will have two connected components with two vertices in each.In the second example you can't remove edges in such a way that all components have even number of vertices, so the answer is $$$-1$$$. | Java 8 | standard input | [
"dp",
"greedy",
"graphs",
"dfs and similar",
"trees"
] | 711896281f4beff55a8826771eeccb81 | The first line contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) denoting the size of the tree. The next $$$n - 1$$$ lines contain two integers $$$u$$$, $$$v$$$ ($$$1 \le u, v \le n$$$) each, describing the vertices connected by the $$$i$$$-th edge. It's guaranteed that the given edges form a tree. | 1,500 | Output a single integer $$$k$$$ — the maximum number of edges that can be removed to leave all connected components with even size, or $$$-1$$$ if it is impossible to remove edges in order to satisfy this property. | standard output | |
PASSED | b0920d12cc49d1ad924396b045659b1e | train_002.jsonl | 1526574900 | You're given a tree with $$$n$$$ vertices.Your task is to determine the maximum possible number of edges that can be removed in such a way that all the remaining connected components will have even size. | 256 megabytes | import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class CutEmAll {
static int[] num;
static int rc;
static List<Integer>[] adj;
public static void main(String[] args) throws IOExc... | Java | ["4\n2 4\n4 1\n3 1", "3\n1 2\n1 3", "10\n7 1\n8 4\n8 10\n4 7\n6 5\n9 3\n3 5\n2 10\n2 5", "2\n1 2"] | 1 second | ["1", "-1", "4", "0"] | NoteIn the first example you can remove the edge between vertices $$$1$$$ and $$$4$$$. The graph after that will have two connected components with two vertices in each.In the second example you can't remove edges in such a way that all components have even number of vertices, so the answer is $$$-1$$$. | Java 8 | standard input | [
"dp",
"greedy",
"graphs",
"dfs and similar",
"trees"
] | 711896281f4beff55a8826771eeccb81 | The first line contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) denoting the size of the tree. The next $$$n - 1$$$ lines contain two integers $$$u$$$, $$$v$$$ ($$$1 \le u, v \le n$$$) each, describing the vertices connected by the $$$i$$$-th edge. It's guaranteed that the given edges form a tree. | 1,500 | Output a single integer $$$k$$$ — the maximum number of edges that can be removed to leave all connected components with even size, or $$$-1$$$ if it is impossible to remove edges in order to satisfy this property. | standard output | |
PASSED | ddab17a0f55e9b35c1e4e6fb6327b5f2 | train_002.jsonl | 1526574900 | You're given a tree with $$$n$$$ vertices.Your task is to determine the maximum possible number of edges that can be removed in such a way that all the remaining connected components will have even size. | 256 megabytes | import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class CutEmAll {
static int[] num;
static int rc;
static List<Integer>[] adj;
//static int[] parents;
public static void main(St... | Java | ["4\n2 4\n4 1\n3 1", "3\n1 2\n1 3", "10\n7 1\n8 4\n8 10\n4 7\n6 5\n9 3\n3 5\n2 10\n2 5", "2\n1 2"] | 1 second | ["1", "-1", "4", "0"] | NoteIn the first example you can remove the edge between vertices $$$1$$$ and $$$4$$$. The graph after that will have two connected components with two vertices in each.In the second example you can't remove edges in such a way that all components have even number of vertices, so the answer is $$$-1$$$. | Java 8 | standard input | [
"dp",
"greedy",
"graphs",
"dfs and similar",
"trees"
] | 711896281f4beff55a8826771eeccb81 | The first line contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) denoting the size of the tree. The next $$$n - 1$$$ lines contain two integers $$$u$$$, $$$v$$$ ($$$1 \le u, v \le n$$$) each, describing the vertices connected by the $$$i$$$-th edge. It's guaranteed that the given edges form a tree. | 1,500 | Output a single integer $$$k$$$ — the maximum number of edges that can be removed to leave all connected components with even size, or $$$-1$$$ if it is impossible to remove edges in order to satisfy this property. | standard output | |
PASSED | 24efda9ce544793b2785cce813408d14 | train_002.jsonl | 1526574900 | You're given a tree with $$$n$$$ vertices.Your task is to determine the maximum possible number of edges that can be removed in such a way that all the remaining connected components will have even size. | 256 megabytes | //package Mura;
/***** BY MURAD ******/
import com.sun.javafx.collections.MappingChange;
import com.sun.org.apache.xerces.internal.util.SymbolHash;
import javafx.util.Pair;
import java.io.*;
import java.math.BigInteger;
import java.security.PublicKey;
import java.util.*;
import java.io.File;
import java.io.PrintStr... | Java | ["4\n2 4\n4 1\n3 1", "3\n1 2\n1 3", "10\n7 1\n8 4\n8 10\n4 7\n6 5\n9 3\n3 5\n2 10\n2 5", "2\n1 2"] | 1 second | ["1", "-1", "4", "0"] | NoteIn the first example you can remove the edge between vertices $$$1$$$ and $$$4$$$. The graph after that will have two connected components with two vertices in each.In the second example you can't remove edges in such a way that all components have even number of vertices, so the answer is $$$-1$$$. | Java 8 | standard input | [
"dp",
"greedy",
"graphs",
"dfs and similar",
"trees"
] | 711896281f4beff55a8826771eeccb81 | The first line contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) denoting the size of the tree. The next $$$n - 1$$$ lines contain two integers $$$u$$$, $$$v$$$ ($$$1 \le u, v \le n$$$) each, describing the vertices connected by the $$$i$$$-th edge. It's guaranteed that the given edges form a tree. | 1,500 | Output a single integer $$$k$$$ — the maximum number of edges that can be removed to leave all connected components with even size, or $$$-1$$$ if it is impossible to remove edges in order to satisfy this property. | standard output | |
PASSED | bd74b27dabf75294d2b2228704601248 | train_002.jsonl | 1526574900 | You're given a tree with $$$n$$$ vertices.Your task is to determine the maximum possible number of edges that can be removed in such a way that all the remaining connected components will have even size. | 256 megabytes | //package com.himanshu.practice.july22.hour7;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
/**
* Created by himanshubhardwaj on 22/07/18.
*/
public class CutThemAll {
public static void main(String[] args) throws IOException {
... | Java | ["4\n2 4\n4 1\n3 1", "3\n1 2\n1 3", "10\n7 1\n8 4\n8 10\n4 7\n6 5\n9 3\n3 5\n2 10\n2 5", "2\n1 2"] | 1 second | ["1", "-1", "4", "0"] | NoteIn the first example you can remove the edge between vertices $$$1$$$ and $$$4$$$. The graph after that will have two connected components with two vertices in each.In the second example you can't remove edges in such a way that all components have even number of vertices, so the answer is $$$-1$$$. | Java 8 | standard input | [
"dp",
"greedy",
"graphs",
"dfs and similar",
"trees"
] | 711896281f4beff55a8826771eeccb81 | The first line contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) denoting the size of the tree. The next $$$n - 1$$$ lines contain two integers $$$u$$$, $$$v$$$ ($$$1 \le u, v \le n$$$) each, describing the vertices connected by the $$$i$$$-th edge. It's guaranteed that the given edges form a tree. | 1,500 | Output a single integer $$$k$$$ — the maximum number of edges that can be removed to leave all connected components with even size, or $$$-1$$$ if it is impossible to remove edges in order to satisfy this property. | standard output | |
PASSED | d19f03dd805469dcba95012ba841c6ae | train_002.jsonl | 1526574900 | You're given a tree with $$$n$$$ vertices.Your task is to determine the maximum possible number of edges that can be removed in such a way that all the remaining connected components will have even size. | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.BigDecimal;
public class R484C {
static ArrayList<Integer>[] graph;
static boolean[] visited;
static int[] child;
static long ans = 0;
public static void main (String[] args) throws java.lang.Exception {
InputReader ... | Java | ["4\n2 4\n4 1\n3 1", "3\n1 2\n1 3", "10\n7 1\n8 4\n8 10\n4 7\n6 5\n9 3\n3 5\n2 10\n2 5", "2\n1 2"] | 1 second | ["1", "-1", "4", "0"] | NoteIn the first example you can remove the edge between vertices $$$1$$$ and $$$4$$$. The graph after that will have two connected components with two vertices in each.In the second example you can't remove edges in such a way that all components have even number of vertices, so the answer is $$$-1$$$. | Java 8 | standard input | [
"dp",
"greedy",
"graphs",
"dfs and similar",
"trees"
] | 711896281f4beff55a8826771eeccb81 | The first line contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) denoting the size of the tree. The next $$$n - 1$$$ lines contain two integers $$$u$$$, $$$v$$$ ($$$1 \le u, v \le n$$$) each, describing the vertices connected by the $$$i$$$-th edge. It's guaranteed that the given edges form a tree. | 1,500 | Output a single integer $$$k$$$ — the maximum number of edges that can be removed to leave all connected components with even size, or $$$-1$$$ if it is impossible to remove edges in order to satisfy this property. | standard output | |
PASSED | 6b17ba806a3dcd3686ab8d65fdedd144 | train_002.jsonl | 1526574900 | You're given a tree with $$$n$$$ vertices.Your task is to determine the maximum possible number of edges that can be removed in such a way that all the remaining connected components will have even size. | 256 megabytes | import java.io.*;
import java.util.*;
public class CutEmAll {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
... | Java | ["4\n2 4\n4 1\n3 1", "3\n1 2\n1 3", "10\n7 1\n8 4\n8 10\n4 7\n6 5\n9 3\n3 5\n2 10\n2 5", "2\n1 2"] | 1 second | ["1", "-1", "4", "0"] | NoteIn the first example you can remove the edge between vertices $$$1$$$ and $$$4$$$. The graph after that will have two connected components with two vertices in each.In the second example you can't remove edges in such a way that all components have even number of vertices, so the answer is $$$-1$$$. | Java 8 | standard input | [
"dp",
"greedy",
"graphs",
"dfs and similar",
"trees"
] | 711896281f4beff55a8826771eeccb81 | The first line contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) denoting the size of the tree. The next $$$n - 1$$$ lines contain two integers $$$u$$$, $$$v$$$ ($$$1 \le u, v \le n$$$) each, describing the vertices connected by the $$$i$$$-th edge. It's guaranteed that the given edges form a tree. | 1,500 | Output a single integer $$$k$$$ — the maximum number of edges that can be removed to leave all connected components with even size, or $$$-1$$$ if it is impossible to remove edges in order to satisfy this property. | standard output | |
PASSED | 75350ff085097eb8caed73b3aed14e8a | train_002.jsonl | 1526574900 | You're given a tree with $$$n$$$ vertices.Your task is to determine the maximum possible number of edges that can be removed in such a way that all the remaining connected components will have even size. | 256 megabytes | import java.util.*;
import java.lang.*;
public class Practice {
// static int[] cnt;
// static boolean[] visited;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
if(n%2!=0) {
System.out.println("-1");
return;
}
// cnt = new i... | Java | ["4\n2 4\n4 1\n3 1", "3\n1 2\n1 3", "10\n7 1\n8 4\n8 10\n4 7\n6 5\n9 3\n3 5\n2 10\n2 5", "2\n1 2"] | 1 second | ["1", "-1", "4", "0"] | NoteIn the first example you can remove the edge between vertices $$$1$$$ and $$$4$$$. The graph after that will have two connected components with two vertices in each.In the second example you can't remove edges in such a way that all components have even number of vertices, so the answer is $$$-1$$$. | Java 8 | standard input | [
"dp",
"greedy",
"graphs",
"dfs and similar",
"trees"
] | 711896281f4beff55a8826771eeccb81 | The first line contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) denoting the size of the tree. The next $$$n - 1$$$ lines contain two integers $$$u$$$, $$$v$$$ ($$$1 \le u, v \le n$$$) each, describing the vertices connected by the $$$i$$$-th edge. It's guaranteed that the given edges form a tree. | 1,500 | Output a single integer $$$k$$$ — the maximum number of edges that can be removed to leave all connected components with even size, or $$$-1$$$ if it is impossible to remove edges in order to satisfy this property. | standard output | |
PASSED | d9c889f4491d8f32c77e36b33acad9fd | train_002.jsonl | 1526574900 | You're given a tree with $$$n$$$ vertices.Your task is to determine the maximum possible number of edges that can be removed in such a way that all the remaining connected components will have even size. | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashSet;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOExcep... | Java | ["4\n2 4\n4 1\n3 1", "3\n1 2\n1 3", "10\n7 1\n8 4\n8 10\n4 7\n6 5\n9 3\n3 5\n2 10\n2 5", "2\n1 2"] | 1 second | ["1", "-1", "4", "0"] | NoteIn the first example you can remove the edge between vertices $$$1$$$ and $$$4$$$. The graph after that will have two connected components with two vertices in each.In the second example you can't remove edges in such a way that all components have even number of vertices, so the answer is $$$-1$$$. | Java 8 | standard input | [
"dp",
"greedy",
"graphs",
"dfs and similar",
"trees"
] | 711896281f4beff55a8826771eeccb81 | The first line contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) denoting the size of the tree. The next $$$n - 1$$$ lines contain two integers $$$u$$$, $$$v$$$ ($$$1 \le u, v \le n$$$) each, describing the vertices connected by the $$$i$$$-th edge. It's guaranteed that the given edges form a tree. | 1,500 | Output a single integer $$$k$$$ — the maximum number of edges that can be removed to leave all connected components with even size, or $$$-1$$$ if it is impossible to remove edges in order to satisfy this property. | standard output | |
PASSED | ad6b1c8143d2fc74a44e1864d75a49b0 | train_002.jsonl | 1526574900 | You're given a tree with $$$n$$$ vertices.Your task is to determine the maximum possible number of edges that can be removed in such a way that all the remaining connected components will have even size. | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.BigInteger;
import java.text.*;
public class cf1 {
static long mod = (long)1e9 + 7;
static long mod1 = 998244353;
static FastScanner f;
static PrintWriter pw = new PrintWriter(System.out);
static Scanner S = new Scanner(System.in);
static lo... | Java | ["4\n2 4\n4 1\n3 1", "3\n1 2\n1 3", "10\n7 1\n8 4\n8 10\n4 7\n6 5\n9 3\n3 5\n2 10\n2 5", "2\n1 2"] | 1 second | ["1", "-1", "4", "0"] | NoteIn the first example you can remove the edge between vertices $$$1$$$ and $$$4$$$. The graph after that will have two connected components with two vertices in each.In the second example you can't remove edges in such a way that all components have even number of vertices, so the answer is $$$-1$$$. | Java 8 | standard input | [
"dp",
"greedy",
"graphs",
"dfs and similar",
"trees"
] | 711896281f4beff55a8826771eeccb81 | The first line contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) denoting the size of the tree. The next $$$n - 1$$$ lines contain two integers $$$u$$$, $$$v$$$ ($$$1 \le u, v \le n$$$) each, describing the vertices connected by the $$$i$$$-th edge. It's guaranteed that the given edges form a tree. | 1,500 | Output a single integer $$$k$$$ — the maximum number of edges that can be removed to leave all connected components with even size, or $$$-1$$$ if it is impossible to remove edges in order to satisfy this property. | standard output | |
PASSED | 4c0b364d6c3d0d442cd294736078ba30 | train_002.jsonl | 1526574900 | You're given a tree with $$$n$$$ vertices.Your task is to determine the maximum possible number of edges that can be removed in such a way that all the remaining connected components will have even size. | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import... | Java | ["4\n2 4\n4 1\n3 1", "3\n1 2\n1 3", "10\n7 1\n8 4\n8 10\n4 7\n6 5\n9 3\n3 5\n2 10\n2 5", "2\n1 2"] | 1 second | ["1", "-1", "4", "0"] | NoteIn the first example you can remove the edge between vertices $$$1$$$ and $$$4$$$. The graph after that will have two connected components with two vertices in each.In the second example you can't remove edges in such a way that all components have even number of vertices, so the answer is $$$-1$$$. | Java 8 | standard input | [
"dp",
"greedy",
"graphs",
"dfs and similar",
"trees"
] | 711896281f4beff55a8826771eeccb81 | The first line contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) denoting the size of the tree. The next $$$n - 1$$$ lines contain two integers $$$u$$$, $$$v$$$ ($$$1 \le u, v \le n$$$) each, describing the vertices connected by the $$$i$$$-th edge. It's guaranteed that the given edges form a tree. | 1,500 | Output a single integer $$$k$$$ — the maximum number of edges that can be removed to leave all connected components with even size, or $$$-1$$$ if it is impossible to remove edges in order to satisfy this property. | standard output | |
PASSED | ace80f3e509f7f01eebbbe27a135e1bd | train_002.jsonl | 1526574900 | You're given a tree with $$$n$$$ vertices.Your task is to determine the maximum possible number of edges that can be removed in such a way that all the remaining connected components will have even size. | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.*;
public class A_GENERAL {
// for fast output printing : use printwriter or stringbuilder
// remember to close pw using pw.close()
stati... | Java | ["4\n2 4\n4 1\n3 1", "3\n1 2\n1 3", "10\n7 1\n8 4\n8 10\n4 7\n6 5\n9 3\n3 5\n2 10\n2 5", "2\n1 2"] | 1 second | ["1", "-1", "4", "0"] | NoteIn the first example you can remove the edge between vertices $$$1$$$ and $$$4$$$. The graph after that will have two connected components with two vertices in each.In the second example you can't remove edges in such a way that all components have even number of vertices, so the answer is $$$-1$$$. | Java 8 | standard input | [
"dp",
"greedy",
"graphs",
"dfs and similar",
"trees"
] | 711896281f4beff55a8826771eeccb81 | The first line contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) denoting the size of the tree. The next $$$n - 1$$$ lines contain two integers $$$u$$$, $$$v$$$ ($$$1 \le u, v \le n$$$) each, describing the vertices connected by the $$$i$$$-th edge. It's guaranteed that the given edges form a tree. | 1,500 | Output a single integer $$$k$$$ — the maximum number of edges that can be removed to leave all connected components with even size, or $$$-1$$$ if it is impossible to remove edges in order to satisfy this property. | standard output | |
PASSED | e7f899ec0c72ac47b84aa326984bd787 | train_002.jsonl | 1526574900 | You're given a tree with $$$n$$$ vertices.Your task is to determine the maximum possible number of edges that can be removed in such a way that all the remaining connected components will have even size. | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
public class A {
static List<List<Integer>> adj = new ArrayList<>(100000);
static int cuts = 0;
static int n;
static int[] cnt;
static boolea... | Java | ["4\n2 4\n4 1\n3 1", "3\n1 2\n1 3", "10\n7 1\n8 4\n8 10\n4 7\n6 5\n9 3\n3 5\n2 10\n2 5", "2\n1 2"] | 1 second | ["1", "-1", "4", "0"] | NoteIn the first example you can remove the edge between vertices $$$1$$$ and $$$4$$$. The graph after that will have two connected components with two vertices in each.In the second example you can't remove edges in such a way that all components have even number of vertices, so the answer is $$$-1$$$. | Java 8 | standard input | [
"dp",
"greedy",
"graphs",
"dfs and similar",
"trees"
] | 711896281f4beff55a8826771eeccb81 | The first line contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) denoting the size of the tree. The next $$$n - 1$$$ lines contain two integers $$$u$$$, $$$v$$$ ($$$1 \le u, v \le n$$$) each, describing the vertices connected by the $$$i$$$-th edge. It's guaranteed that the given edges form a tree. | 1,500 | Output a single integer $$$k$$$ — the maximum number of edges that can be removed to leave all connected components with even size, or $$$-1$$$ if it is impossible to remove edges in order to satisfy this property. | standard output | |
PASSED | 22363f43141e4213acb2377998dad5b6 | train_002.jsonl | 1526574900 | You're given a tree with $$$n$$$ vertices.Your task is to determine the maximum possible number of edges that can be removed in such a way that all the remaining connected components will have even size. | 256 megabytes | import java.io.*;
import java.util.*;
public class Graph
{
ArrayList<Integer> adj[];
static int V;
Graph(int v)
{
V=v;
adj=new ArrayList[v];
for(int i=0;i<v;i++)
adj[i] = new ArrayList<>();
}
void addEdge(int u,int v)
{
adj[u].add(v);
... | Java | ["4\n2 4\n4 1\n3 1", "3\n1 2\n1 3", "10\n7 1\n8 4\n8 10\n4 7\n6 5\n9 3\n3 5\n2 10\n2 5", "2\n1 2"] | 1 second | ["1", "-1", "4", "0"] | NoteIn the first example you can remove the edge between vertices $$$1$$$ and $$$4$$$. The graph after that will have two connected components with two vertices in each.In the second example you can't remove edges in such a way that all components have even number of vertices, so the answer is $$$-1$$$. | Java 8 | standard input | [
"dp",
"greedy",
"graphs",
"dfs and similar",
"trees"
] | 711896281f4beff55a8826771eeccb81 | The first line contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) denoting the size of the tree. The next $$$n - 1$$$ lines contain two integers $$$u$$$, $$$v$$$ ($$$1 \le u, v \le n$$$) each, describing the vertices connected by the $$$i$$$-th edge. It's guaranteed that the given edges form a tree. | 1,500 | Output a single integer $$$k$$$ — the maximum number of edges that can be removed to leave all connected components with even size, or $$$-1$$$ if it is impossible to remove edges in order to satisfy this property. | standard output | |
PASSED | d2ecb67f367b83653d8d85fe9bfab6fb | train_002.jsonl | 1526574900 | You're given a tree with $$$n$$$ vertices.Your task is to determine the maximum possible number of edges that can be removed in such a way that all the remaining connected components will have even size. | 256 megabytes | import java.util.ArrayList;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.OutputStream;
public class CutEmAll {
static int total ... | Java | ["4\n2 4\n4 1\n3 1", "3\n1 2\n1 3", "10\n7 1\n8 4\n8 10\n4 7\n6 5\n9 3\n3 5\n2 10\n2 5", "2\n1 2"] | 1 second | ["1", "-1", "4", "0"] | NoteIn the first example you can remove the edge between vertices $$$1$$$ and $$$4$$$. The graph after that will have two connected components with two vertices in each.In the second example you can't remove edges in such a way that all components have even number of vertices, so the answer is $$$-1$$$. | Java 8 | standard input | [
"dp",
"greedy",
"graphs",
"dfs and similar",
"trees"
] | 711896281f4beff55a8826771eeccb81 | The first line contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) denoting the size of the tree. The next $$$n - 1$$$ lines contain two integers $$$u$$$, $$$v$$$ ($$$1 \le u, v \le n$$$) each, describing the vertices connected by the $$$i$$$-th edge. It's guaranteed that the given edges form a tree. | 1,500 | Output a single integer $$$k$$$ — the maximum number of edges that can be removed to leave all connected components with even size, or $$$-1$$$ if it is impossible to remove edges in order to satisfy this property. | standard output | |
PASSED | 60cee5133a3fce216cde8831114eba58 | train_002.jsonl | 1526574900 | You're given a tree with $$$n$$$ vertices.Your task is to determine the maximum possible number of edges that can be removed in such a way that all the remaining connected components will have even size. | 256 megabytes | // package CF;
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.StringTokenizer;
public class D {
static ArrayList<Integer> [] adj;
public stati... | Java | ["4\n2 4\n4 1\n3 1", "3\n1 2\n1 3", "10\n7 1\n8 4\n8 10\n4 7\n6 5\n9 3\n3 5\n2 10\n2 5", "2\n1 2"] | 1 second | ["1", "-1", "4", "0"] | NoteIn the first example you can remove the edge between vertices $$$1$$$ and $$$4$$$. The graph after that will have two connected components with two vertices in each.In the second example you can't remove edges in such a way that all components have even number of vertices, so the answer is $$$-1$$$. | Java 8 | standard input | [
"dp",
"greedy",
"graphs",
"dfs and similar",
"trees"
] | 711896281f4beff55a8826771eeccb81 | The first line contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) denoting the size of the tree. The next $$$n - 1$$$ lines contain two integers $$$u$$$, $$$v$$$ ($$$1 \le u, v \le n$$$) each, describing the vertices connected by the $$$i$$$-th edge. It's guaranteed that the given edges form a tree. | 1,500 | Output a single integer $$$k$$$ — the maximum number of edges that can be removed to leave all connected components with even size, or $$$-1$$$ if it is impossible to remove edges in order to satisfy this property. | standard output | |
PASSED | c0ffd190f479533422722856eaab77d6 | train_002.jsonl | 1526574900 | You're given a tree with $$$n$$$ vertices.Your task is to determine the maximum possible number of edges that can be removed in such a way that all the remaining connected components will have even size. | 256 megabytes |
import java.io.*;
import java.util.*;
public class Dispatcher {
static final int DIM = 100010;
static List<Integer> g[]=new List[DIM];
static boolean vis[] = new boolean[DIM];
static int res=0;
public static int dfs(int v)
{
vis[v]=true;
int c=0;
for(int k:g[v])
... | Java | ["4\n2 4\n4 1\n3 1", "3\n1 2\n1 3", "10\n7 1\n8 4\n8 10\n4 7\n6 5\n9 3\n3 5\n2 10\n2 5", "2\n1 2"] | 1 second | ["1", "-1", "4", "0"] | NoteIn the first example you can remove the edge between vertices $$$1$$$ and $$$4$$$. The graph after that will have two connected components with two vertices in each.In the second example you can't remove edges in such a way that all components have even number of vertices, so the answer is $$$-1$$$. | Java 8 | standard input | [
"dp",
"greedy",
"graphs",
"dfs and similar",
"trees"
] | 711896281f4beff55a8826771eeccb81 | The first line contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) denoting the size of the tree. The next $$$n - 1$$$ lines contain two integers $$$u$$$, $$$v$$$ ($$$1 \le u, v \le n$$$) each, describing the vertices connected by the $$$i$$$-th edge. It's guaranteed that the given edges form a tree. | 1,500 | Output a single integer $$$k$$$ — the maximum number of edges that can be removed to leave all connected components with even size, or $$$-1$$$ if it is impossible to remove edges in order to satisfy this property. | standard output | |
PASSED | ca631d5d7b3dc29c465a57c480cf2d49 | train_002.jsonl | 1526574900 | You're given a tree with $$$n$$$ vertices.Your task is to determine the maximum possible number of edges that can be removed in such a way that all the remaining connected components will have even size. | 256 megabytes |
import java.io.*;
import java.util.*;
public class Dispatcher {
static final int DIM = 100010;
static List<Integer> g[]=new List[DIM];
static boolean vis[] = new boolean[DIM];
static int res=0;
int k=0;
public static int dfs(int v)
{
vis[v]=true;
int c=0;
for(int k:... | Java | ["4\n2 4\n4 1\n3 1", "3\n1 2\n1 3", "10\n7 1\n8 4\n8 10\n4 7\n6 5\n9 3\n3 5\n2 10\n2 5", "2\n1 2"] | 1 second | ["1", "-1", "4", "0"] | NoteIn the first example you can remove the edge between vertices $$$1$$$ and $$$4$$$. The graph after that will have two connected components with two vertices in each.In the second example you can't remove edges in such a way that all components have even number of vertices, so the answer is $$$-1$$$. | Java 8 | standard input | [
"dp",
"greedy",
"graphs",
"dfs and similar",
"trees"
] | 711896281f4beff55a8826771eeccb81 | The first line contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) denoting the size of the tree. The next $$$n - 1$$$ lines contain two integers $$$u$$$, $$$v$$$ ($$$1 \le u, v \le n$$$) each, describing the vertices connected by the $$$i$$$-th edge. It's guaranteed that the given edges form a tree. | 1,500 | Output a single integer $$$k$$$ — the maximum number of edges that can be removed to leave all connected components with even size, or $$$-1$$$ if it is impossible to remove edges in order to satisfy this property. | standard output | |
PASSED | b9b1a313d1b6ac1fcc5827efe83f0b39 | train_002.jsonl | 1526574900 | You're given a tree with $$$n$$$ vertices.Your task is to determine the maximum possible number of edges that can be removed in such a way that all the remaining connected components will have even size. | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class C {
public static void main(String[] args) {
FastScanner scanner = new FastScanner();
int n = scanner.nextInt();
Map<Integer, Set<Integer>> tree = new HashMap<>();
... | Java | ["4\n2 4\n4 1\n3 1", "3\n1 2\n1 3", "10\n7 1\n8 4\n8 10\n4 7\n6 5\n9 3\n3 5\n2 10\n2 5", "2\n1 2"] | 1 second | ["1", "-1", "4", "0"] | NoteIn the first example you can remove the edge between vertices $$$1$$$ and $$$4$$$. The graph after that will have two connected components with two vertices in each.In the second example you can't remove edges in such a way that all components have even number of vertices, so the answer is $$$-1$$$. | Java 8 | standard input | [
"dp",
"greedy",
"graphs",
"dfs and similar",
"trees"
] | 711896281f4beff55a8826771eeccb81 | The first line contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) denoting the size of the tree. The next $$$n - 1$$$ lines contain two integers $$$u$$$, $$$v$$$ ($$$1 \le u, v \le n$$$) each, describing the vertices connected by the $$$i$$$-th edge. It's guaranteed that the given edges form a tree. | 1,500 | Output a single integer $$$k$$$ — the maximum number of edges that can be removed to leave all connected components with even size, or $$$-1$$$ if it is impossible to remove edges in order to satisfy this property. | standard output | |
PASSED | facf1ec57375e8d1fbb7fde16991fe1a | train_002.jsonl | 1526574900 | You're given a tree with $$$n$$$ vertices.Your task is to determine the maximum possible number of edges that can be removed in such a way that all the remaining connected components will have even size. | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.InputMismatchException;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Queue;
... | Java | ["4\n2 4\n4 1\n3 1", "3\n1 2\n1 3", "10\n7 1\n8 4\n8 10\n4 7\n6 5\n9 3\n3 5\n2 10\n2 5", "2\n1 2"] | 1 second | ["1", "-1", "4", "0"] | NoteIn the first example you can remove the edge between vertices $$$1$$$ and $$$4$$$. The graph after that will have two connected components with two vertices in each.In the second example you can't remove edges in such a way that all components have even number of vertices, so the answer is $$$-1$$$. | Java 8 | standard input | [
"dp",
"greedy",
"graphs",
"dfs and similar",
"trees"
] | 711896281f4beff55a8826771eeccb81 | The first line contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) denoting the size of the tree. The next $$$n - 1$$$ lines contain two integers $$$u$$$, $$$v$$$ ($$$1 \le u, v \le n$$$) each, describing the vertices connected by the $$$i$$$-th edge. It's guaranteed that the given edges form a tree. | 1,500 | Output a single integer $$$k$$$ — the maximum number of edges that can be removed to leave all connected components with even size, or $$$-1$$$ if it is impossible to remove edges in order to satisfy this property. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.