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 | 70a02728101c155aed2decb13823b485 | train_003.jsonl | 1394033400 | Inna and Dima decided to surprise Sereja. They brought a really huge candy matrix, it's big even for Sereja! Let's number the rows of the giant matrix from 1 to n from top to bottom and the columns — from 1 to m, from left to right. We'll represent the cell on the intersection of the i-th row and j-th column as (i, j).... | 256 megabytes | public class Main {
public static void main(String[] args) throws java.io.IOException {
java.io.BufferedReader r = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
String[] t = r.readLine().split(" ");
int N = Integer.parseInt(t[0]);
int M = Integer.parseInt(t[... | Java | ["3 3 3 1 1 9\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3"] | 2 seconds | ["1 3\n1 2\n1 1\n2 3\n2 2\n2 1\n3 3\n3 2\n3 1"] | NoteJust for clarity. Horizontal rotating is like a mirroring of the matrix. For matrix:QWER REWQ ASDF -> FDSAZXCV VCXZ | Java 6 | standard input | [
"implementation",
"math"
] | 14a56443e48c52c118788bd5c0031b0c | The first line of the input contains fix integers n, m, x, y, z, p (1 ≤ n, m ≤ 109; 0 ≤ x, y, z ≤ 109; 1 ≤ p ≤ 105). Each of the following p lines contains two integers xk, yk (1 ≤ xk ≤ n; 1 ≤ yk ≤ m) — the initial coordinates of the k-th candy. Two candies can lie on the same cell. | 1,500 | For each of the p candies, print on a single line its space-separated new coordinates. | standard output | |
PASSED | c8072d91f0270407bf46eff1605f2c89 | train_003.jsonl | 1394033400 | Inna and Dima decided to surprise Sereja. They brought a really huge candy matrix, it's big even for Sereja! Let's number the rows of the giant matrix from 1 to n from top to bottom and the columns — from 1 to m, from left to right. We'll represent the cell on the intersection of the i-th row and j-th column as (i, j).... | 256 megabytes | public class Main {
public static void main(String[] args) throws java.io.IOException {
java.io.BufferedReader r = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
String[] t = r.readLine().split(" ");
int N = Integer.parseInt(t[0]);
int M = Integer.parseInt(t[... | Java | ["3 3 3 1 1 9\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3"] | 2 seconds | ["1 3\n1 2\n1 1\n2 3\n2 2\n2 1\n3 3\n3 2\n3 1"] | NoteJust for clarity. Horizontal rotating is like a mirroring of the matrix. For matrix:QWER REWQ ASDF -> FDSAZXCV VCXZ | Java 6 | standard input | [
"implementation",
"math"
] | 14a56443e48c52c118788bd5c0031b0c | The first line of the input contains fix integers n, m, x, y, z, p (1 ≤ n, m ≤ 109; 0 ≤ x, y, z ≤ 109; 1 ≤ p ≤ 105). Each of the following p lines contains two integers xk, yk (1 ≤ xk ≤ n; 1 ≤ yk ≤ m) — the initial coordinates of the k-th candy. Two candies can lie on the same cell. | 1,500 | For each of the p candies, print on a single line its space-separated new coordinates. | standard output | |
PASSED | 0fe852fbb1dbc1856eea667f7a6d7d71 | train_003.jsonl | 1394033400 | Inna and Dima decided to surprise Sereja. They brought a really huge candy matrix, it's big even for Sereja! Let's number the rows of the giant matrix from 1 to n from top to bottom and the columns — from 1 to m, from left to right. We'll represent the cell on the intersection of the i-th row and j-th column as (i, j).... | 256 megabytes |
public class Main {
public static void main(String[] args) throws java.io.IOException {
java.io.BufferedReader r = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
String[] t = r.readLine().split(" ");
int N = Integer.parseInt(t[0]);
int M = Integer.parseInt(... | Java | ["3 3 3 1 1 9\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3"] | 2 seconds | ["1 3\n1 2\n1 1\n2 3\n2 2\n2 1\n3 3\n3 2\n3 1"] | NoteJust for clarity. Horizontal rotating is like a mirroring of the matrix. For matrix:QWER REWQ ASDF -> FDSAZXCV VCXZ | Java 6 | standard input | [
"implementation",
"math"
] | 14a56443e48c52c118788bd5c0031b0c | The first line of the input contains fix integers n, m, x, y, z, p (1 ≤ n, m ≤ 109; 0 ≤ x, y, z ≤ 109; 1 ≤ p ≤ 105). Each of the following p lines contains two integers xk, yk (1 ≤ xk ≤ n; 1 ≤ yk ≤ m) — the initial coordinates of the k-th candy. Two candies can lie on the same cell. | 1,500 | For each of the p candies, print on a single line its space-separated new coordinates. | standard output | |
PASSED | 9aaa65826605eee2536d8f3d79891841 | train_003.jsonl | 1394033400 | Inna and Dima decided to surprise Sereja. They brought a really huge candy matrix, it's big even for Sereja! Let's number the rows of the giant matrix from 1 to n from top to bottom and the columns — from 1 to m, from left to right. We'll represent the cell on the intersection of the i-th row and j-th column as (i, j).... | 256 megabytes | public class Main {
public static void main(String[] args) throws java.io.IOException {
java.io.BufferedReader r = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
String[] t = r.readLine().split(" ");
int N = Integer.parseInt(t[0]);
int M = Integer.parseInt(t[... | Java | ["3 3 3 1 1 9\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3"] | 2 seconds | ["1 3\n1 2\n1 1\n2 3\n2 2\n2 1\n3 3\n3 2\n3 1"] | NoteJust for clarity. Horizontal rotating is like a mirroring of the matrix. For matrix:QWER REWQ ASDF -> FDSAZXCV VCXZ | Java 6 | standard input | [
"implementation",
"math"
] | 14a56443e48c52c118788bd5c0031b0c | The first line of the input contains fix integers n, m, x, y, z, p (1 ≤ n, m ≤ 109; 0 ≤ x, y, z ≤ 109; 1 ≤ p ≤ 105). Each of the following p lines contains two integers xk, yk (1 ≤ xk ≤ n; 1 ≤ yk ≤ m) — the initial coordinates of the k-th candy. Two candies can lie on the same cell. | 1,500 | For each of the p candies, print on a single line its space-separated new coordinates. | standard output | |
PASSED | b57825d4589e97c0152e1fbd97a35e7a | train_003.jsonl | 1394033400 | Inna and Dima decided to surprise Sereja. They brought a really huge candy matrix, it's big even for Sereja! Let's number the rows of the giant matrix from 1 to n from top to bottom and the columns — from 1 to m, from left to right. We'll represent the cell on the intersection of the i-th row and j-th column as (i, j).... | 256 megabytes | public class Main {
public static void main(String[] args) throws java.io.IOException {
java.io.BufferedReader r = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
String[] t = r.readLine().split(" ");
int N = Integer.parseInt(t[0]);
int M = Integer.parseInt(t[... | Java | ["3 3 3 1 1 9\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3"] | 2 seconds | ["1 3\n1 2\n1 1\n2 3\n2 2\n2 1\n3 3\n3 2\n3 1"] | NoteJust for clarity. Horizontal rotating is like a mirroring of the matrix. For matrix:QWER REWQ ASDF -> FDSAZXCV VCXZ | Java 6 | standard input | [
"implementation",
"math"
] | 14a56443e48c52c118788bd5c0031b0c | The first line of the input contains fix integers n, m, x, y, z, p (1 ≤ n, m ≤ 109; 0 ≤ x, y, z ≤ 109; 1 ≤ p ≤ 105). Each of the following p lines contains two integers xk, yk (1 ≤ xk ≤ n; 1 ≤ yk ≤ m) — the initial coordinates of the k-th candy. Two candies can lie on the same cell. | 1,500 | For each of the p candies, print on a single line its space-separated new coordinates. | standard output | |
PASSED | 9d8c871778e83596e1e8d6d1da8d019c | train_003.jsonl | 1394033400 | Inna and Dima decided to surprise Sereja. They brought a really huge candy matrix, it's big even for Sereja! Let's number the rows of the giant matrix from 1 to n from top to bottom and the columns — from 1 to m, from left to right. We'll represent the cell on the intersection of the i-th row and j-th column as (i, j).... | 256 megabytes | import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
public class Main {
static BufferedReader br;
static StringTokenizer st;
static PrintWriter pw;
public static void main(String[] args) throws IOException {
br = new BufferedReader(new ... | Java | ["3 3 3 1 1 9\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3"] | 2 seconds | ["1 3\n1 2\n1 1\n2 3\n2 2\n2 1\n3 3\n3 2\n3 1"] | NoteJust for clarity. Horizontal rotating is like a mirroring of the matrix. For matrix:QWER REWQ ASDF -> FDSAZXCV VCXZ | Java 6 | standard input | [
"implementation",
"math"
] | 14a56443e48c52c118788bd5c0031b0c | The first line of the input contains fix integers n, m, x, y, z, p (1 ≤ n, m ≤ 109; 0 ≤ x, y, z ≤ 109; 1 ≤ p ≤ 105). Each of the following p lines contains two integers xk, yk (1 ≤ xk ≤ n; 1 ≤ yk ≤ m) — the initial coordinates of the k-th candy. Two candies can lie on the same cell. | 1,500 | For each of the p candies, print on a single line its space-separated new coordinates. | standard output | |
PASSED | 2d088b11690fd60d6bf62b788efc275c | train_003.jsonl | 1394033400 | Inna and Dima decided to surprise Sereja. They brought a really huge candy matrix, it's big even for Sereja! Let's number the rows of the giant matrix from 1 to n from top to bottom and the columns — from 1 to m, from left to right. We'll represent the cell on the intersection of the i-th row and j-th column as (i, j).... | 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.StringTokenizer;
public class InnaAndHugeCandyMatrix {
public static void main(String[] args) {
InputReader r = new InputReader(System.in);
... | Java | ["3 3 3 1 1 9\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3"] | 2 seconds | ["1 3\n1 2\n1 1\n2 3\n2 2\n2 1\n3 3\n3 2\n3 1"] | NoteJust for clarity. Horizontal rotating is like a mirroring of the matrix. For matrix:QWER REWQ ASDF -> FDSAZXCV VCXZ | Java 6 | standard input | [
"implementation",
"math"
] | 14a56443e48c52c118788bd5c0031b0c | The first line of the input contains fix integers n, m, x, y, z, p (1 ≤ n, m ≤ 109; 0 ≤ x, y, z ≤ 109; 1 ≤ p ≤ 105). Each of the following p lines contains two integers xk, yk (1 ≤ xk ≤ n; 1 ≤ yk ≤ m) — the initial coordinates of the k-th candy. Two candies can lie on the same cell. | 1,500 | For each of the p candies, print on a single line its space-separated new coordinates. | standard output | |
PASSED | d5dd77ffa7e22bfc93901e7c19a452c5 | train_003.jsonl | 1394033400 | Inna and Dima decided to surprise Sereja. They brought a really huge candy matrix, it's big even for Sereja! Let's number the rows of the giant matrix from 1 to n from top to bottom and the columns — from 1 to m, from left to right. We'll represent the cell on the intersection of the i-th row and j-th column as (i, j).... | 256 megabytes | import java.io.IOException;
public class C {
private static final int IN_BUFFER_SIZE = 1 << 16;
private static final int OUT_BUFFER_SIZE = 1 << 16;
private byte[] input = new byte[IN_BUFFER_SIZE];
private int ix = IN_BUFFER_SIZE;
private int bytesRead = ix;
private byte[] output = new byte[OUT_BUFFER_SIZE];
pr... | Java | ["3 3 3 1 1 9\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3"] | 2 seconds | ["1 3\n1 2\n1 1\n2 3\n2 2\n2 1\n3 3\n3 2\n3 1"] | NoteJust for clarity. Horizontal rotating is like a mirroring of the matrix. For matrix:QWER REWQ ASDF -> FDSAZXCV VCXZ | Java 6 | standard input | [
"implementation",
"math"
] | 14a56443e48c52c118788bd5c0031b0c | The first line of the input contains fix integers n, m, x, y, z, p (1 ≤ n, m ≤ 109; 0 ≤ x, y, z ≤ 109; 1 ≤ p ≤ 105). Each of the following p lines contains two integers xk, yk (1 ≤ xk ≤ n; 1 ≤ yk ≤ m) — the initial coordinates of the k-th candy. Two candies can lie on the same cell. | 1,500 | For each of the p candies, print on a single line its space-separated new coordinates. | standard output | |
PASSED | c263dd58b490829c94cd0e6c433642dd | train_003.jsonl | 1394033400 | Inna and Dima decided to surprise Sereja. They brought a really huge candy matrix, it's big even for Sereja! Let's number the rows of the giant matrix from 1 to n from top to bottom and the columns — from 1 to m, from left to right. We'll represent the cell on the intersection of the i-th row and j-th column as (i, j).... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
BufferedReader in;
StringTokenizer str = null;
PrintWriter out;
private String next() throws Exception{
if (str == null || !str.hasMoreElements())
str = new StringTokenizer(in.readLine());
return str.nextToken();
}
private int nextInt() throws... | Java | ["3 3 3 1 1 9\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3"] | 2 seconds | ["1 3\n1 2\n1 1\n2 3\n2 2\n2 1\n3 3\n3 2\n3 1"] | NoteJust for clarity. Horizontal rotating is like a mirroring of the matrix. For matrix:QWER REWQ ASDF -> FDSAZXCV VCXZ | Java 6 | standard input | [
"implementation",
"math"
] | 14a56443e48c52c118788bd5c0031b0c | The first line of the input contains fix integers n, m, x, y, z, p (1 ≤ n, m ≤ 109; 0 ≤ x, y, z ≤ 109; 1 ≤ p ≤ 105). Each of the following p lines contains two integers xk, yk (1 ≤ xk ≤ n; 1 ≤ yk ≤ m) — the initial coordinates of the k-th candy. Two candies can lie on the same cell. | 1,500 | For each of the p candies, print on a single line its space-separated new coordinates. | standard output | |
PASSED | 6cd0c6813935d68f4c608703a2269a85 | train_003.jsonl | 1394033400 | Inna and Dima decided to surprise Sereja. They brought a really huge candy matrix, it's big even for Sereja! Let's number the rows of the giant matrix from 1 to n from top to bottom and the columns — from 1 to m, from left to right. We'll represent the cell on the intersection of the i-th row and j-th column as (i, j).... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class C {
BufferedReader reader;
StringTokenizer tokenizer;
PrintWriter out;
public void rotate90 (int N, int M, int[] in) {
int oldX = in[0];
... | Java | ["3 3 3 1 1 9\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3"] | 2 seconds | ["1 3\n1 2\n1 1\n2 3\n2 2\n2 1\n3 3\n3 2\n3 1"] | NoteJust for clarity. Horizontal rotating is like a mirroring of the matrix. For matrix:QWER REWQ ASDF -> FDSAZXCV VCXZ | Java 6 | standard input | [
"implementation",
"math"
] | 14a56443e48c52c118788bd5c0031b0c | The first line of the input contains fix integers n, m, x, y, z, p (1 ≤ n, m ≤ 109; 0 ≤ x, y, z ≤ 109; 1 ≤ p ≤ 105). Each of the following p lines contains two integers xk, yk (1 ≤ xk ≤ n; 1 ≤ yk ≤ m) — the initial coordinates of the k-th candy. Two candies can lie on the same cell. | 1,500 | For each of the p candies, print on a single line its space-separated new coordinates. | standard output | |
PASSED | 3dfc176387172131793e9864502f4a3a | train_003.jsonl | 1394033400 | Inna and Dima decided to surprise Sereja. They brought a really huge candy matrix, it's big even for Sereja! Let's number the rows of the giant matrix from 1 to n from top to bottom and the columns — from 1 to m, from left to right. We'll represent the cell on the intersection of the i-th row and j-th column as (i, j).... | 256 megabytes | import java.util.*;
import java.io.*;
public class C234 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
long n = sc.nextLong();
long m = sc.nextLong();
int x = sc.nextInt();
int y = s... | Java | ["3 3 3 1 1 9\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3"] | 2 seconds | ["1 3\n1 2\n1 1\n2 3\n2 2\n2 1\n3 3\n3 2\n3 1"] | NoteJust for clarity. Horizontal rotating is like a mirroring of the matrix. For matrix:QWER REWQ ASDF -> FDSAZXCV VCXZ | Java 6 | standard input | [
"implementation",
"math"
] | 14a56443e48c52c118788bd5c0031b0c | The first line of the input contains fix integers n, m, x, y, z, p (1 ≤ n, m ≤ 109; 0 ≤ x, y, z ≤ 109; 1 ≤ p ≤ 105). Each of the following p lines contains two integers xk, yk (1 ≤ xk ≤ n; 1 ≤ yk ≤ m) — the initial coordinates of the k-th candy. Two candies can lie on the same cell. | 1,500 | For each of the p candies, print on a single line its space-separated new coordinates. | standard output | |
PASSED | 4b1ca26496cb24b2aff114d89c2388a3 | train_003.jsonl | 1394033400 | Inna and Dima decided to surprise Sereja. They brought a really huge candy matrix, it's big even for Sereja! Let's number the rows of the giant matrix from 1 to n from top to bottom and the columns — from 1 to m, from left to right. We'll represent the cell on the intersection of the i-th row and j-th column as (i, j).... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class C {
void solve() throws Exception {
int n = nextInt();
int m = nextInt();
int x = nextInt();
int y = nextInt();
int z = nextInt();
int p = nextInt();
StringBuil... | Java | ["3 3 3 1 1 9\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3"] | 2 seconds | ["1 3\n1 2\n1 1\n2 3\n2 2\n2 1\n3 3\n3 2\n3 1"] | NoteJust for clarity. Horizontal rotating is like a mirroring of the matrix. For matrix:QWER REWQ ASDF -> FDSAZXCV VCXZ | Java 6 | standard input | [
"implementation",
"math"
] | 14a56443e48c52c118788bd5c0031b0c | The first line of the input contains fix integers n, m, x, y, z, p (1 ≤ n, m ≤ 109; 0 ≤ x, y, z ≤ 109; 1 ≤ p ≤ 105). Each of the following p lines contains two integers xk, yk (1 ≤ xk ≤ n; 1 ≤ yk ≤ m) — the initial coordinates of the k-th candy. Two candies can lie on the same cell. | 1,500 | For each of the p candies, print on a single line its space-separated new coordinates. | standard output | |
PASSED | 37c275a2d57db18726a31863c9869188 | train_003.jsonl | 1394033400 | Inna and Dima decided to surprise Sereja. They brought a really huge candy matrix, it's big even for Sereja! Let's number the rows of the giant matrix from 1 to n from top to bottom and the columns — from 1 to m, from left to right. We'll represent the cell on the intersection of the i-th row and j-th column as (i, j).... | 256 megabytes | import java.util.*;
import java.io.*;
public class c {
public static void main(String[] args) throws IOException
{
input.init(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = input.nextInt(), m = input.nextInt(), x = input.nextInt() & 3, y = input.nextInt() & 3, z = input.nextInt() & ... | Java | ["3 3 3 1 1 9\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3"] | 2 seconds | ["1 3\n1 2\n1 1\n2 3\n2 2\n2 1\n3 3\n3 2\n3 1"] | NoteJust for clarity. Horizontal rotating is like a mirroring of the matrix. For matrix:QWER REWQ ASDF -> FDSAZXCV VCXZ | Java 6 | standard input | [
"implementation",
"math"
] | 14a56443e48c52c118788bd5c0031b0c | The first line of the input contains fix integers n, m, x, y, z, p (1 ≤ n, m ≤ 109; 0 ≤ x, y, z ≤ 109; 1 ≤ p ≤ 105). Each of the following p lines contains two integers xk, yk (1 ≤ xk ≤ n; 1 ≤ yk ≤ m) — the initial coordinates of the k-th candy. Two candies can lie on the same cell. | 1,500 | For each of the p candies, print on a single line its space-separated new coordinates. | standard output | |
PASSED | 5cea4661dd1915d5e2f8a5670c719a7d | train_003.jsonl | 1394033400 | Inna and Dima decided to surprise Sereja. They brought a really huge candy matrix, it's big even for Sereja! Let's number the rows of the giant matrix from 1 to n from top to bottom and the columns — from 1 to m, from left to right. We'll represent the cell on the intersection of the i-th row and j-th column as (i, j).... | 256 megabytes | import java.util.*;
public class CodeForces5thmarch003 {
public static void main(String[] args) {
int i,j,n,m,x,y,z,p,a,b,temp,temp1,t;
boolean chk = true;
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
m = sc.nextInt();
x = sc.nextInt();
y = sc.nextI... | Java | ["3 3 3 1 1 9\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3"] | 2 seconds | ["1 3\n1 2\n1 1\n2 3\n2 2\n2 1\n3 3\n3 2\n3 1"] | NoteJust for clarity. Horizontal rotating is like a mirroring of the matrix. For matrix:QWER REWQ ASDF -> FDSAZXCV VCXZ | Java 6 | standard input | [
"implementation",
"math"
] | 14a56443e48c52c118788bd5c0031b0c | The first line of the input contains fix integers n, m, x, y, z, p (1 ≤ n, m ≤ 109; 0 ≤ x, y, z ≤ 109; 1 ≤ p ≤ 105). Each of the following p lines contains two integers xk, yk (1 ≤ xk ≤ n; 1 ≤ yk ≤ m) — the initial coordinates of the k-th candy. Two candies can lie on the same cell. | 1,500 | For each of the p candies, print on a single line its space-separated new coordinates. | standard output | |
PASSED | e95c6f219c69d5ff1fb9e9ace75a1981 | train_003.jsonl | 1394033400 | Inna and Dima decided to surprise Sereja. They brought a really huge candy matrix, it's big even for Sereja! Let's number the rows of the giant matrix from 1 to n from top to bottom and the columns — from 1 to m, from left to right. We'll represent the cell on the intersection of the i-th row and j-th column as (i, j).... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class C {
public static void main(String[] args) throws IOException {
BufferedReader buf = new BufferedReader(
new InputStreamRead... | Java | ["3 3 3 1 1 9\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3"] | 2 seconds | ["1 3\n1 2\n1 1\n2 3\n2 2\n2 1\n3 3\n3 2\n3 1"] | NoteJust for clarity. Horizontal rotating is like a mirroring of the matrix. For matrix:QWER REWQ ASDF -> FDSAZXCV VCXZ | Java 6 | standard input | [
"implementation",
"math"
] | 14a56443e48c52c118788bd5c0031b0c | The first line of the input contains fix integers n, m, x, y, z, p (1 ≤ n, m ≤ 109; 0 ≤ x, y, z ≤ 109; 1 ≤ p ≤ 105). Each of the following p lines contains two integers xk, yk (1 ≤ xk ≤ n; 1 ≤ yk ≤ m) — the initial coordinates of the k-th candy. Two candies can lie on the same cell. | 1,500 | For each of the p candies, print on a single line its space-separated new coordinates. | standard output | |
PASSED | 91a2f8b2f4d158c1be005348b67a678a | train_003.jsonl | 1394033400 | Inna and Dima decided to surprise Sereja. They brought a really huge candy matrix, it's big even for Sereja! Let's number the rows of the giant matrix from 1 to n from top to bottom and the columns — from 1 to m, from left to right. We'll represent the cell on the intersection of the i-th row and j-th column as (i, j).... | 256 megabytes | import java.util.Scanner;
public class C2 {
static int H,W;
static int h, w, x, y, z;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
H = h = sc.nextInt();
W = w = sc.nextInt();
x = sc.nextInt()%4;
y = sc.nextInt()%2;
z = sc.next... | Java | ["3 3 3 1 1 9\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3"] | 2 seconds | ["1 3\n1 2\n1 1\n2 3\n2 2\n2 1\n3 3\n3 2\n3 1"] | NoteJust for clarity. Horizontal rotating is like a mirroring of the matrix. For matrix:QWER REWQ ASDF -> FDSAZXCV VCXZ | Java 6 | standard input | [
"implementation",
"math"
] | 14a56443e48c52c118788bd5c0031b0c | The first line of the input contains fix integers n, m, x, y, z, p (1 ≤ n, m ≤ 109; 0 ≤ x, y, z ≤ 109; 1 ≤ p ≤ 105). Each of the following p lines contains two integers xk, yk (1 ≤ xk ≤ n; 1 ≤ yk ≤ m) — the initial coordinates of the k-th candy. Two candies can lie on the same cell. | 1,500 | For each of the p candies, print on a single line its space-separated new coordinates. | standard output | |
PASSED | e95cf410fd35daa853b812b4818aeb6f | train_003.jsonl | 1394033400 | Inna and Dima decided to surprise Sereja. They brought a really huge candy matrix, it's big even for Sereja! Let's number the rows of the giant matrix from 1 to n from top to bottom and the columns — from 1 to m, from left to right. We'll represent the cell on the intersection of the i-th row and j-th column as (i, j).... | 256 megabytes |
import java.util.Scanner;
public class C {
static int N,M;
static int n,m,x,y,z;
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
N = n = sc.nextInt();
M = m = sc.nextInt();
x = sc.nextInt();
y = sc.nextInt();
z = sc.nextInt();
... | Java | ["3 3 3 1 1 9\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3"] | 2 seconds | ["1 3\n1 2\n1 1\n2 3\n2 2\n2 1\n3 3\n3 2\n3 1"] | NoteJust for clarity. Horizontal rotating is like a mirroring of the matrix. For matrix:QWER REWQ ASDF -> FDSAZXCV VCXZ | Java 6 | standard input | [
"implementation",
"math"
] | 14a56443e48c52c118788bd5c0031b0c | The first line of the input contains fix integers n, m, x, y, z, p (1 ≤ n, m ≤ 109; 0 ≤ x, y, z ≤ 109; 1 ≤ p ≤ 105). Each of the following p lines contains two integers xk, yk (1 ≤ xk ≤ n; 1 ≤ yk ≤ m) — the initial coordinates of the k-th candy. Two candies can lie on the same cell. | 1,500 | For each of the p candies, print on a single line its space-separated new coordinates. | standard output | |
PASSED | 665c52fe720eb4004d7d2e5090e48c49 | train_003.jsonl | 1394033400 | Inna and Dima decided to surprise Sereja. They brought a really huge candy matrix, it's big even for Sereja! Let's number the rows of the giant matrix from 1 to n from top to bottom and the columns — from 1 to m, from left to right. We'll represent the cell on the intersection of the i-th row and j-th column as (i, j).... | 256 megabytes |
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.StringTokenizer;
/**
*
*
* @author pttrung
*/
public class C {
// public static long x, y, gcd;
publi... | Java | ["3 3 3 1 1 9\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3"] | 2 seconds | ["1 3\n1 2\n1 1\n2 3\n2 2\n2 1\n3 3\n3 2\n3 1"] | NoteJust for clarity. Horizontal rotating is like a mirroring of the matrix. For matrix:QWER REWQ ASDF -> FDSAZXCV VCXZ | Java 6 | standard input | [
"implementation",
"math"
] | 14a56443e48c52c118788bd5c0031b0c | The first line of the input contains fix integers n, m, x, y, z, p (1 ≤ n, m ≤ 109; 0 ≤ x, y, z ≤ 109; 1 ≤ p ≤ 105). Each of the following p lines contains two integers xk, yk (1 ≤ xk ≤ n; 1 ≤ yk ≤ m) — the initial coordinates of the k-th candy. Two candies can lie on the same cell. | 1,500 | For each of the p candies, print on a single line its space-separated new coordinates. | standard output | |
PASSED | 2da2a15f960ad88e9d6150e7a23aa912 | train_003.jsonl | 1394033400 | Inna and Dima decided to surprise Sereja. They brought a really huge candy matrix, it's big even for Sereja! Let's number the rows of the giant matrix from 1 to n from top to bottom and the columns — from 1 to m, from left to right. We'll represent the cell on the intersection of the i-th row and j-th column as (i, j).... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.StringBuilder;
public class C_InnaHugeMatrix {
static int[] d = new int[2];
static void swap () {
d[0] = d[0] ^ d[1];
d[1] = d[0] ^ d[1];
d[0] = d[0] ^ d[1];
}
public static void main (String[] args) {
try {
BufferedReader br = new BufferedReader... | Java | ["3 3 3 1 1 9\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3"] | 2 seconds | ["1 3\n1 2\n1 1\n2 3\n2 2\n2 1\n3 3\n3 2\n3 1"] | NoteJust for clarity. Horizontal rotating is like a mirroring of the matrix. For matrix:QWER REWQ ASDF -> FDSAZXCV VCXZ | Java 6 | standard input | [
"implementation",
"math"
] | 14a56443e48c52c118788bd5c0031b0c | The first line of the input contains fix integers n, m, x, y, z, p (1 ≤ n, m ≤ 109; 0 ≤ x, y, z ≤ 109; 1 ≤ p ≤ 105). Each of the following p lines contains two integers xk, yk (1 ≤ xk ≤ n; 1 ≤ yk ≤ m) — the initial coordinates of the k-th candy. Two candies can lie on the same cell. | 1,500 | For each of the p candies, print on a single line its space-separated new coordinates. | standard output | |
PASSED | c9e139a69ac910b77f9590d531577662 | train_003.jsonl | 1394033400 | Inna and Dima decided to surprise Sereja. They brought a really huge candy matrix, it's big even for Sereja! Let's number the rows of the giant matrix from 1 to n from top to bottom and the columns — from 1 to m, from left to right. We'll represent the cell on the intersection of the i-th row and j-th column as (i, j).... | 256 megabytes | import java.util.Scanner;
import java.util.Arrays;
import java.lang.String;
public class JavaApplication1 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner sc = new Scanner(System.in);... | Java | ["3 3 3 1 1 9\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3"] | 2 seconds | ["1 3\n1 2\n1 1\n2 3\n2 2\n2 1\n3 3\n3 2\n3 1"] | NoteJust for clarity. Horizontal rotating is like a mirroring of the matrix. For matrix:QWER REWQ ASDF -> FDSAZXCV VCXZ | Java 6 | standard input | [
"implementation",
"math"
] | 14a56443e48c52c118788bd5c0031b0c | The first line of the input contains fix integers n, m, x, y, z, p (1 ≤ n, m ≤ 109; 0 ≤ x, y, z ≤ 109; 1 ≤ p ≤ 105). Each of the following p lines contains two integers xk, yk (1 ≤ xk ≤ n; 1 ≤ yk ≤ m) — the initial coordinates of the k-th candy. Two candies can lie on the same cell. | 1,500 | For each of the p candies, print on a single line its space-separated new coordinates. | standard output | |
PASSED | 0c70e0fca2de8e9ceeed63cb1cc9afea | train_003.jsonl | 1596810900 | One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal. The game starts on a square flat grid, which initially has the outline borders built up. Rainbow Dash and Fluttershy have flat square blocks with size... | 256 megabytes | import java.util.*;
public class RainbowDashFluttershyandChessColoring {
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
for(int t1=1;t1<=t;t1++)
{
long n=sc.nextLong();
long res=0;
if(n==1)
System.out.println(1);
else
{
if(n>=4)
res=(n/... | Java | ["2\n3\n4"] | 1 second | ["2\n3"] | NoteFor $$$3\times3$$$ grid ponies can make two following moves: | Java 8 | standard input | [
"greedy",
"math"
] | eb39ac8d703516c7f81f95a989791b21 | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of grids of the games. Each of the next $$$T$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^9$$$): the size of the side of the grid of the game. | 800 | For each grid of the game print the minimum number of turns required to build a chess coloring pattern out of blocks on it. | standard output | |
PASSED | 5868a9a0c898c026f2c9fa567c6c35dc | train_003.jsonl | 1596810900 | One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal. The game starts on a square flat grid, which initially has the outline borders built up. Rainbow Dash and Fluttershy have flat square blocks with size... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static final long M = (long) 1e9 + 7;
static FastReader in;
static int ans = 0;
public static void main(String[] args) {
in = new FastReader();
int t = ni();
while (t-- > 0) {
long n = nl();
if ... | Java | ["2\n3\n4"] | 1 second | ["2\n3"] | NoteFor $$$3\times3$$$ grid ponies can make two following moves: | Java 8 | standard input | [
"greedy",
"math"
] | eb39ac8d703516c7f81f95a989791b21 | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of grids of the games. Each of the next $$$T$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^9$$$): the size of the side of the grid of the game. | 800 | For each grid of the game print the minimum number of turns required to build a chess coloring pattern out of blocks on it. | standard output | |
PASSED | 6d14a52573276931614754bb9de1cee5 | train_003.jsonl | 1596810900 | One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal. The game starts on a square flat grid, which initially has the outline borders built up. Rainbow Dash and Fluttershy have flat square blocks with size... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Codechef
{
static boolean isPrime(int n)
{
if (n <= 1)
return false;
if (n <= 3)
return true;
if (n % 2 == 0 || n % 3 == 0)
return false;
for (int i = 5; i * i <= n; i = i + 6)
if (n % i == 0 || n % (i + 2) == 0) ... | Java | ["2\n3\n4"] | 1 second | ["2\n3"] | NoteFor $$$3\times3$$$ grid ponies can make two following moves: | Java 8 | standard input | [
"greedy",
"math"
] | eb39ac8d703516c7f81f95a989791b21 | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of grids of the games. Each of the next $$$T$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^9$$$): the size of the side of the grid of the game. | 800 | For each grid of the game print the minimum number of turns required to build a chess coloring pattern out of blocks on it. | standard output | |
PASSED | 6bb922611f115ce9ebacedba84d29b0f | train_003.jsonl | 1596810900 | One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal. The game starts on a square flat grid, which initially has the outline borders built up. Rainbow Dash and Fluttershy have flat square blocks with size... | 256 megabytes | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Hp
*/
import java.io.*;
import java.util.*;
public class ProblemA {
public static void main(String args[])throw... | Java | ["2\n3\n4"] | 1 second | ["2\n3"] | NoteFor $$$3\times3$$$ grid ponies can make two following moves: | Java 8 | standard input | [
"greedy",
"math"
] | eb39ac8d703516c7f81f95a989791b21 | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of grids of the games. Each of the next $$$T$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^9$$$): the size of the side of the grid of the game. | 800 | For each grid of the game print the minimum number of turns required to build a chess coloring pattern out of blocks on it. | standard output | |
PASSED | d1772b7e8464f99b8a5aa56bfc06fb62 | train_003.jsonl | 1596810900 | One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal. The game starts on a square flat grid, which initially has the outline borders built up. Rainbow Dash and Fluttershy have flat square blocks with size... | 256 megabytes | /*
⣿⣿⣿⣿⣿⣿⡷⣯⢿⣿⣷⣻⢯⣿⡽⣻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠸⣿⣿⣆⠹⣿⣿⢾⣟⣯⣿⣿⣿⣿⣿⣿⣽⣻⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣻⣽⡿⣿⣎⠙⣿⣞⣷⡌⢻⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⡄⠹⣿⣿⡆⠻⣿⣟⣯⡿⣽⡿⣿⣿⣿⣿⣽⡷⣯⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣟⣷⣿⣿⣿⡀⠹⣟⣾⣟⣆⠹⣯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢠⡘⣿⣿⡄⠉⢿⣿⣽⡷⣿⣻⣿⣿⣿⣿⡝⣷⣯⢿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣯⢿⣾⢿⣿⡄⢄⠘⢿⣞⡿⣧⡈⢷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⣧⠘⣿⣷⠈⣦⠙⢿⣽⣷⣻⣽⣿⣿⣿⣿⣌⢿⣯⢿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣟⣯⣿⢿⣿⡆⢸⡷⡈⢻⡽⣷⡷⡄⠻⣽⣿⣿⡿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣏⢰⣯⢷⠈⣿⡆⢹⢷⡌⠻⡾⢋⣱⣯⣿⣿⣿⣿⡆⢻⡿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⡎... | Java | ["2\n3\n4"] | 1 second | ["2\n3"] | NoteFor $$$3\times3$$$ grid ponies can make two following moves: | Java 8 | standard input | [
"greedy",
"math"
] | eb39ac8d703516c7f81f95a989791b21 | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of grids of the games. Each of the next $$$T$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^9$$$): the size of the side of the grid of the game. | 800 | For each grid of the game print the minimum number of turns required to build a chess coloring pattern out of blocks on it. | standard output | |
PASSED | 12eaccd7095887062ba554b02a8f3924 | train_003.jsonl | 1596810900 | One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal. The game starts on a square flat grid, which initially has the outline borders built up. Rainbow Dash and Fluttershy have flat square blocks with size... | 256 megabytes |
import java.util.Scanner;
/**
* @author hypnos
* @date 2020/11/13
*/
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for (int i = 0; i < t; i++) {
int a = sc.nextInt();
System.out.println(a/... | Java | ["2\n3\n4"] | 1 second | ["2\n3"] | NoteFor $$$3\times3$$$ grid ponies can make two following moves: | Java 8 | standard input | [
"greedy",
"math"
] | eb39ac8d703516c7f81f95a989791b21 | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of grids of the games. Each of the next $$$T$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^9$$$): the size of the side of the grid of the game. | 800 | For each grid of the game print the minimum number of turns required to build a chess coloring pattern out of blocks on it. | standard output | |
PASSED | 1f3bba91953237250f4a476915e2b2e7 | train_003.jsonl | 1596810900 | One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal. The game starts on a square flat grid, which initially has the outline borders built up. Rainbow Dash and Fluttershy have flat square blocks with size... | 256 megabytes | /**
*
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
/**
* @author b
*
*/
public class A {
public static void main(String[] args) throws IOException {
Scanner scanner = new Scanner();
int tests = scanner.nextInt();
f... | Java | ["2\n3\n4"] | 1 second | ["2\n3"] | NoteFor $$$3\times3$$$ grid ponies can make two following moves: | Java 8 | standard input | [
"greedy",
"math"
] | eb39ac8d703516c7f81f95a989791b21 | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of grids of the games. Each of the next $$$T$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^9$$$): the size of the side of the grid of the game. | 800 | For each grid of the game print the minimum number of turns required to build a chess coloring pattern out of blocks on it. | standard output | |
PASSED | a1e3f99130859eb800a7ff8ee8b7389a | train_003.jsonl | 1596810900 | One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal. The game starts on a square flat grid, which initially has the outline borders built up. Rainbow Dash and Fluttershy have flat square blocks with size... | 256 megabytes | import java.io.*;
public class hold{
public static void main(String[] args) throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int cases = Integer.parseInt(br.readLine());
for(int i=0;i<cases;i++){
int num = Integer.parseInt(br.readLine());
if(num%2 == 1){
Syste... | Java | ["2\n3\n4"] | 1 second | ["2\n3"] | NoteFor $$$3\times3$$$ grid ponies can make two following moves: | Java 8 | standard input | [
"greedy",
"math"
] | eb39ac8d703516c7f81f95a989791b21 | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of grids of the games. Each of the next $$$T$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^9$$$): the size of the side of the grid of the game. | 800 | For each grid of the game print the minimum number of turns required to build a chess coloring pattern out of blocks on it. | standard output | |
PASSED | b8aee4de31897ae0ed848e6bca49db00 | train_003.jsonl | 1596810900 | One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal. The game starts on a square flat grid, which initially has the outline borders built up. Rainbow Dash and Fluttershy have flat square blocks with 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.StringTokenizer;
public class CodeForce_662 {
public static void main(String[] args) throws IOException
{
FastScanner sc = new FastScanner();
Print... | Java | ["2\n3\n4"] | 1 second | ["2\n3"] | NoteFor $$$3\times3$$$ grid ponies can make two following moves: | Java 8 | standard input | [
"greedy",
"math"
] | eb39ac8d703516c7f81f95a989791b21 | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of grids of the games. Each of the next $$$T$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^9$$$): the size of the side of the grid of the game. | 800 | For each grid of the game print the minimum number of turns required to build a chess coloring pattern out of blocks on it. | standard output | |
PASSED | 29f313eddbba9084ccbe642eac92981d | train_003.jsonl | 1596810900 | One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal. The game starts on a square flat grid, which initially has the outline borders built up. Rainbow Dash and Fluttershy have flat square blocks with size... | 256 megabytes | import java.util.*;
public class cfchess{
public static void main(String[]args)
{
Scanner scn=new Scanner(System.in);
int tc=scn.nextInt();
for(int i9=0;i9<tc;i9++)
{
int n=scn.nextInt();
if(n==1)
{System.out.println(1);
continue;}
System.out.println((n/2)+1);
}
}
} | Java | ["2\n3\n4"] | 1 second | ["2\n3"] | NoteFor $$$3\times3$$$ grid ponies can make two following moves: | Java 8 | standard input | [
"greedy",
"math"
] | eb39ac8d703516c7f81f95a989791b21 | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of grids of the games. Each of the next $$$T$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^9$$$): the size of the side of the grid of the game. | 800 | For each grid of the game print the minimum number of turns required to build a chess coloring pattern out of blocks on it. | standard output | |
PASSED | 5889d8532c0ffe73cd35bc6005fe882b | train_003.jsonl | 1596810900 | One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal. The game starts on a square flat grid, which initially has the outline borders built up. Rainbow Dash and Fluttershy have flat square blocks with size... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Input... | Java | ["2\n3\n4"] | 1 second | ["2\n3"] | NoteFor $$$3\times3$$$ grid ponies can make two following moves: | Java 8 | standard input | [
"greedy",
"math"
] | eb39ac8d703516c7f81f95a989791b21 | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of grids of the games. Each of the next $$$T$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^9$$$): the size of the side of the grid of the game. | 800 | For each grid of the game print the minimum number of turns required to build a chess coloring pattern out of blocks on it. | standard output | |
PASSED | c9e213e8a620d0a71e986c42ed74b4b6 | train_003.jsonl | 1596810900 | One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal. The game starts on a square flat grid, which initially has the outline borders built up. Rainbow Dash and Fluttershy have flat square blocks with size... | 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();
for(int t=0;t<T;t++){
System.out.println((sc.nextInt()/2)+1);
}
}
} | Java | ["2\n3\n4"] | 1 second | ["2\n3"] | NoteFor $$$3\times3$$$ grid ponies can make two following moves: | Java 8 | standard input | [
"greedy",
"math"
] | eb39ac8d703516c7f81f95a989791b21 | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of grids of the games. Each of the next $$$T$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^9$$$): the size of the side of the grid of the game. | 800 | For each grid of the game print the minimum number of turns required to build a chess coloring pattern out of blocks on it. | standard output | |
PASSED | 7f1e1dc6dd9c3b003230f54a1754c7a9 | train_003.jsonl | 1596810900 | One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal. The game starts on a square flat grid, which initially has the outline borders built up. Rainbow Dash and Fluttershy have flat square blocks with size... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public final class codeForces
{
static long gcd(long a,long b)
{
if(b==0)return a;
else return gcd(b,a%b);
}
public static void main(String args[])throws IOException
{
BufferedReader in=new BufferedReader(new InputSt... | Java | ["2\n3\n4"] | 1 second | ["2\n3"] | NoteFor $$$3\times3$$$ grid ponies can make two following moves: | Java 8 | standard input | [
"greedy",
"math"
] | eb39ac8d703516c7f81f95a989791b21 | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of grids of the games. Each of the next $$$T$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^9$$$): the size of the side of the grid of the game. | 800 | For each grid of the game print the minimum number of turns required to build a chess coloring pattern out of blocks on it. | standard output | |
PASSED | 8e8263e89462ccfb6e079be5605601fe | train_003.jsonl | 1596810900 | One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal. The game starts on a square flat grid, which initially has the outline borders built up. Rainbow Dash and Fluttershy have flat square blocks with size... | 256 megabytes | import java.io.*;
import java.util.Random;
import java.util.StringTokenizer;
public class A {
//Solution by Sathvik Kuthuru
public static void main(String[] args) {
FastReader scan = new FastReader();
PrintWriter out = new PrintWriter(System.out);
Task solver = new Task();
int t... | Java | ["2\n3\n4"] | 1 second | ["2\n3"] | NoteFor $$$3\times3$$$ grid ponies can make two following moves: | Java 8 | standard input | [
"greedy",
"math"
] | eb39ac8d703516c7f81f95a989791b21 | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of grids of the games. Each of the next $$$T$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^9$$$): the size of the side of the grid of the game. | 800 | For each grid of the game print the minimum number of turns required to build a chess coloring pattern out of blocks on it. | standard output | |
PASSED | 022dd84fe632ce0c1865a47eff697d72 | train_003.jsonl | 1596810900 | One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal. The game starts on a square flat grid, which initially has the outline borders built up. Rainbow Dash and Fluttershy have flat square blocks with size... | 256 megabytes | import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class RainbowDashFluttershyAndChessColoring {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- > 0)... | Java | ["2\n3\n4"] | 1 second | ["2\n3"] | NoteFor $$$3\times3$$$ grid ponies can make two following moves: | Java 8 | standard input | [
"greedy",
"math"
] | eb39ac8d703516c7f81f95a989791b21 | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of grids of the games. Each of the next $$$T$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^9$$$): the size of the side of the grid of the game. | 800 | For each grid of the game print the minimum number of turns required to build a chess coloring pattern out of blocks on it. | standard output | |
PASSED | a268d0f4b48dbab1290c85e11a84170e | train_003.jsonl | 1596810900 | One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal. The game starts on a square flat grid, which initially has the outline borders built up. Rainbow Dash and Fluttershy have flat square blocks with size... | 256 megabytes | import java.util.Scanner;
/**
* q1
*/
public class q1 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while (t-->0) {
int n=sc.nextInt();
if (n==1) {
System.out.println(1);
} else if (n=... | Java | ["2\n3\n4"] | 1 second | ["2\n3"] | NoteFor $$$3\times3$$$ grid ponies can make two following moves: | Java 8 | standard input | [
"greedy",
"math"
] | eb39ac8d703516c7f81f95a989791b21 | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of grids of the games. Each of the next $$$T$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^9$$$): the size of the side of the grid of the game. | 800 | For each grid of the game print the minimum number of turns required to build a chess coloring pattern out of blocks on it. | standard output | |
PASSED | 3e01be5696759f792200f43e10b1aebf | train_003.jsonl | 1596810900 | One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal. The game starts on a square flat grid, which initially has the outline borders built up. Rainbow Dash and Fluttershy have flat square blocks with size... | 256 megabytes | //package contest662;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
import java.util.Stack;
import java.util.HashMap;
public class ProblemA {
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int... | Java | ["2\n3\n4"] | 1 second | ["2\n3"] | NoteFor $$$3\times3$$$ grid ponies can make two following moves: | Java 8 | standard input | [
"greedy",
"math"
] | eb39ac8d703516c7f81f95a989791b21 | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of grids of the games. Each of the next $$$T$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^9$$$): the size of the side of the grid of the game. | 800 | For each grid of the game print the minimum number of turns required to build a chess coloring pattern out of blocks on it. | standard output | |
PASSED | 60c71c2aa4f42f7da0d304c9b6916109 | train_003.jsonl | 1596810900 | One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal. The game starts on a square flat grid, which initially has the outline borders built up. Rainbow Dash and Fluttershy have flat square blocks with size... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.*;
public class codeforces
{
public static void main(String[] args) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw= new PrintWriter(System.out);
int t=Integer.parseInt(br... | Java | ["2\n3\n4"] | 1 second | ["2\n3"] | NoteFor $$$3\times3$$$ grid ponies can make two following moves: | Java 8 | standard input | [
"greedy",
"math"
] | eb39ac8d703516c7f81f95a989791b21 | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of grids of the games. Each of the next $$$T$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^9$$$): the size of the side of the grid of the game. | 800 | For each grid of the game print the minimum number of turns required to build a chess coloring pattern out of blocks on it. | standard output | |
PASSED | c00b87e5dd9e3684ea0e2616fc6995b1 | train_003.jsonl | 1596810900 | One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal. The game starts on a square flat grid, which initially has the outline borders built up. Rainbow Dash and Fluttershy have flat square blocks with size... | 256 megabytes | import java.util.*;
public class MyClass {
public static int f1(int n){
return n/2+1;
}
public static void f(int[] arr,int n){
for(int i = 0 ; i < n ; i++){
if(arr[i] <= 2)
System.out.println(arr[i]);
else
System.... | Java | ["2\n3\n4"] | 1 second | ["2\n3"] | NoteFor $$$3\times3$$$ grid ponies can make two following moves: | Java 8 | standard input | [
"greedy",
"math"
] | eb39ac8d703516c7f81f95a989791b21 | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of grids of the games. Each of the next $$$T$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^9$$$): the size of the side of the grid of the game. | 800 | For each grid of the game print the minimum number of turns required to build a chess coloring pattern out of blocks on it. | standard output | |
PASSED | 0d5e97abada00956fd7f084e866b695d | train_003.jsonl | 1596810900 | One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal. The game starts on a square flat grid, which initially has the outline borders built up. Rainbow Dash and Fluttershy have flat square blocks with size... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.Input... | Java | ["2\n3\n4"] | 1 second | ["2\n3"] | NoteFor $$$3\times3$$$ grid ponies can make two following moves: | Java 8 | standard input | [
"greedy",
"math"
] | eb39ac8d703516c7f81f95a989791b21 | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of grids of the games. Each of the next $$$T$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^9$$$): the size of the side of the grid of the game. | 800 | For each grid of the game print the minimum number of turns required to build a chess coloring pattern out of blocks on it. | standard output | |
PASSED | 014bc31f577125ac23671efd8b72e0bc | train_003.jsonl | 1596810900 | One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal. The game starts on a square flat grid, which initially has the outline borders built up. Rainbow Dash and Fluttershy have flat square blocks with size... | 256 megabytes | import java.util.*;
import java.io.*;
public class A_1393 {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
int t = sc.nextInt();
while(t-->0) {
int n = sc.nextInt();
pw.println((n + 2) / 2);
}
pw.flus... | Java | ["2\n3\n4"] | 1 second | ["2\n3"] | NoteFor $$$3\times3$$$ grid ponies can make two following moves: | Java 8 | standard input | [
"greedy",
"math"
] | eb39ac8d703516c7f81f95a989791b21 | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of grids of the games. Each of the next $$$T$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^9$$$): the size of the side of the grid of the game. | 800 | For each grid of the game print the minimum number of turns required to build a chess coloring pattern out of blocks on it. | standard output | |
PASSED | ea072ae4e79b62e233ac3688597402b2 | train_003.jsonl | 1596810900 | One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal. The game starts on a square flat grid, which initially has the outline borders built up. Rainbow Dash and Fluttershy have flat square blocks with size... | 256 megabytes | import java.lang.*;
import java.io.*;
import java.math.*;
import java.util.*;
public final class CF
{
public static void main(String[]args)throws IOException
{
FastReader ob=new FastReader();
int t=ob.nextInt();
while(t-->0)
{
int n=ob.nextInt();
if(n==1)
... | Java | ["2\n3\n4"] | 1 second | ["2\n3"] | NoteFor $$$3\times3$$$ grid ponies can make two following moves: | Java 8 | standard input | [
"greedy",
"math"
] | eb39ac8d703516c7f81f95a989791b21 | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of grids of the games. Each of the next $$$T$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^9$$$): the size of the side of the grid of the game. | 800 | For each grid of the game print the minimum number of turns required to build a chess coloring pattern out of blocks on it. | standard output | |
PASSED | 8cf2d0ec14caebc20d072a98fbf2b4a4 | train_003.jsonl | 1596810900 | One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal. The game starts on a square flat grid, which initially has the outline borders built up. Rainbow Dash and Fluttershy have flat square blocks with size... | 256 megabytes | import java.io.*;
import java.util.*;
public class C{
public static void main(String args[]) throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
while(T-->0){
int N = sc.ne... | Java | ["2\n3\n4"] | 1 second | ["2\n3"] | NoteFor $$$3\times3$$$ grid ponies can make two following moves: | Java 8 | standard input | [
"greedy",
"math"
] | eb39ac8d703516c7f81f95a989791b21 | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of grids of the games. Each of the next $$$T$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^9$$$): the size of the side of the grid of the game. | 800 | For each grid of the game print the minimum number of turns required to build a chess coloring pattern out of blocks on it. | standard output | |
PASSED | 38b48467d448205c41ba223f537c96b1 | train_003.jsonl | 1596810900 | One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal. The game starts on a square flat grid, which initially has the outline borders built up. Rainbow Dash and Fluttershy have flat square blocks with size... | 256 megabytes | import java.io.*;
import java.util.*;
public class codeForces {
public static void main(String[] args) throws IOException{
FastReader scan = new FastReader(System.in);
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
int T = scan.nextInt();
for(int l = 0;... | Java | ["2\n3\n4"] | 1 second | ["2\n3"] | NoteFor $$$3\times3$$$ grid ponies can make two following moves: | Java 8 | standard input | [
"greedy",
"math"
] | eb39ac8d703516c7f81f95a989791b21 | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of grids of the games. Each of the next $$$T$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^9$$$): the size of the side of the grid of the game. | 800 | For each grid of the game print the minimum number of turns required to build a chess coloring pattern out of blocks on it. | standard output | |
PASSED | 6c86839aeb02bc356c4c1262b508a08c | train_003.jsonl | 1596810900 | One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal. The game starts on a square flat grid, which initially has the outline borders built up. Rainbow Dash and Fluttershy have flat square blocks with size... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static StringTokenizer st;
static StringBuilder sb = new StringBuilder();
p... | Java | ["2\n3\n4"] | 1 second | ["2\n3"] | NoteFor $$$3\times3$$$ grid ponies can make two following moves: | Java 8 | standard input | [
"greedy",
"math"
] | eb39ac8d703516c7f81f95a989791b21 | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of grids of the games. Each of the next $$$T$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^9$$$): the size of the side of the grid of the game. | 800 | For each grid of the game print the minimum number of turns required to build a chess coloring pattern out of blocks on it. | standard output | |
PASSED | 376a8317e07bd10ce4c1cc894f50b9a2 | train_003.jsonl | 1596810900 | One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal. The game starts on a square flat grid, which initially has the outline borders built up. Rainbow Dash and Fluttershy have flat square blocks with size... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public final class CodeForces658A {
public static void pr(String st){
System.out.println(st);
}
public static vo... | Java | ["2\n3\n4"] | 1 second | ["2\n3"] | NoteFor $$$3\times3$$$ grid ponies can make two following moves: | Java 8 | standard input | [
"greedy",
"math"
] | eb39ac8d703516c7f81f95a989791b21 | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of grids of the games. Each of the next $$$T$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^9$$$): the size of the side of the grid of the game. | 800 | For each grid of the game print the minimum number of turns required to build a chess coloring pattern out of blocks on it. | standard output | |
PASSED | c421315f45963dd9c598d5f005c99a9f | train_003.jsonl | 1596810900 | One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal. The game starts on a square flat grid, which initially has the outline borders built up. Rainbow Dash and Fluttershy have flat square blocks with size... | 256 megabytes | import java.util.*;
public class Array {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int X = in.nextInt();
int arr[] = new int[X];
for(int i = 0 ; i<X ; i++) {
arr[i] = in.nextInt();
System.out.println((arr[i]/... | Java | ["2\n3\n4"] | 1 second | ["2\n3"] | NoteFor $$$3\times3$$$ grid ponies can make two following moves: | Java 8 | standard input | [
"greedy",
"math"
] | eb39ac8d703516c7f81f95a989791b21 | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of grids of the games. Each of the next $$$T$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^9$$$): the size of the side of the grid of the game. | 800 | For each grid of the game print the minimum number of turns required to build a chess coloring pattern out of blocks on it. | standard output | |
PASSED | c4bc71db0e9a96824795d6956b9cb2b0 | train_003.jsonl | 1596810900 | One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal. The game starts on a square flat grid, which initially has the outline borders built up. Rainbow Dash and Fluttershy have flat square blocks with size... | 256 megabytes | import java.util.*;
public class Solution{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
int t = input.nextInt();
for(int i = 0; i < t; i++){
int n = input.nextInt();
System.out.println(n/2 + 1);
}
}
} | Java | ["2\n3\n4"] | 1 second | ["2\n3"] | NoteFor $$$3\times3$$$ grid ponies can make two following moves: | Java 8 | standard input | [
"greedy",
"math"
] | eb39ac8d703516c7f81f95a989791b21 | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of grids of the games. Each of the next $$$T$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^9$$$): the size of the side of the grid of the game. | 800 | For each grid of the game print the minimum number of turns required to build a chess coloring pattern out of blocks on it. | standard output | |
PASSED | ec062cd180e1ff715a47443e08dfe948 | train_003.jsonl | 1326899100 | A Ministry for Defense sent a general to inspect the Super Secret Military Squad under the command of the Colonel SuperDuper. Having learned the news, the colonel ordered to all n squad soldiers to line up on the parade ground.By the military charter the soldiers should stand in the order of non-increasing of their hei... | 256 megabytes | import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
int n;
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
int ai[] = new int[... | Java | ["4\n33 44 11 22", "7\n10 10 58 31 63 40 76"] | 2 seconds | ["2", "10"] | NoteIn the first sample the colonel will need to swap the first and second soldier and then the third and fourth soldier. That will take 2 seconds. The resulting position of the soldiers is (44, 33, 22, 11).In the second sample the colonel may swap the soldiers in the following sequence: (10, 10, 58, 31, 63, 40, 76) ... | Java 8 | standard input | [
"implementation"
] | ef9ff63d225811868e786e800ce49c92 | The first input line contains the only integer n (2 ≤ n ≤ 100) which represents the number of soldiers in the line. The second line contains integers a1, a2, ..., an (1 ≤ ai ≤ 100) the values of the soldiers' heights in the order of soldiers' heights' increasing in the order from the beginning of the line to its end. T... | 800 | Print the only integer — the minimum number of seconds the colonel will need to form a line-up the general will like. | standard output | |
PASSED | edfd8ea2b6da0f6d0eb357c67b630218 | train_003.jsonl | 1326899100 | A Ministry for Defense sent a general to inspect the Super Secret Military Squad under the command of the Colonel SuperDuper. Having learned the news, the colonel ordered to all n squad soldiers to line up on the parade ground.By the military charter the soldiers should stand in the order of non-increasing of their hei... | 256 megabytes | import java.util.Scanner;
public class Road14 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int max = 1;
int min = 100;
int indexmax = 0;
int indexmin = 0;
int act;
for (int i = 0; i <n ; i++) {
... | Java | ["4\n33 44 11 22", "7\n10 10 58 31 63 40 76"] | 2 seconds | ["2", "10"] | NoteIn the first sample the colonel will need to swap the first and second soldier and then the third and fourth soldier. That will take 2 seconds. The resulting position of the soldiers is (44, 33, 22, 11).In the second sample the colonel may swap the soldiers in the following sequence: (10, 10, 58, 31, 63, 40, 76) ... | Java 8 | standard input | [
"implementation"
] | ef9ff63d225811868e786e800ce49c92 | The first input line contains the only integer n (2 ≤ n ≤ 100) which represents the number of soldiers in the line. The second line contains integers a1, a2, ..., an (1 ≤ ai ≤ 100) the values of the soldiers' heights in the order of soldiers' heights' increasing in the order from the beginning of the line to its end. T... | 800 | Print the only integer — the minimum number of seconds the colonel will need to form a line-up the general will like. | standard output | |
PASSED | a596c56e82a19d3b72630454ce06f3ef | train_003.jsonl | 1326899100 | A Ministry for Defense sent a general to inspect the Super Secret Military Squad under the command of the Colonel SuperDuper. Having learned the news, the colonel ordered to all n squad soldiers to line up on the parade ground.By the military charter the soldiers should stand in the order of non-increasing of their hei... | 256 megabytes | import java.util.*;
public class Main{
public static void main(String[] args){
// input
Scanner scan = new Scanner(System.in);
int numSoldiers = scan.nextInt();
int heights[] = new int[numSoldiers];
for(int i = 0; i < heights.length; i++)
heights[i] = sc... | Java | ["4\n33 44 11 22", "7\n10 10 58 31 63 40 76"] | 2 seconds | ["2", "10"] | NoteIn the first sample the colonel will need to swap the first and second soldier and then the third and fourth soldier. That will take 2 seconds. The resulting position of the soldiers is (44, 33, 22, 11).In the second sample the colonel may swap the soldiers in the following sequence: (10, 10, 58, 31, 63, 40, 76) ... | Java 8 | standard input | [
"implementation"
] | ef9ff63d225811868e786e800ce49c92 | The first input line contains the only integer n (2 ≤ n ≤ 100) which represents the number of soldiers in the line. The second line contains integers a1, a2, ..., an (1 ≤ ai ≤ 100) the values of the soldiers' heights in the order of soldiers' heights' increasing in the order from the beginning of the line to its end. T... | 800 | Print the only integer — the minimum number of seconds the colonel will need to form a line-up the general will like. | standard output | |
PASSED | 1df6bc93604b80441f31dcf27d6d8e8b | train_003.jsonl | 1326899100 | A Ministry for Defense sent a general to inspect the Super Secret Military Squad under the command of the Colonel SuperDuper. Having learned the news, the colonel ordered to all n squad soldiers to line up on the parade ground.By the military charter the soldiers should stand in the order of non-increasing of their hei... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class codeForces {
public static void main (String []args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int [] a = new int[n];
int [] c = new int[n];
for ( int i = 0 ; i < n ; i++) {
c[i] = sc.nextInt();
a[i]... | Java | ["4\n33 44 11 22", "7\n10 10 58 31 63 40 76"] | 2 seconds | ["2", "10"] | NoteIn the first sample the colonel will need to swap the first and second soldier and then the third and fourth soldier. That will take 2 seconds. The resulting position of the soldiers is (44, 33, 22, 11).In the second sample the colonel may swap the soldiers in the following sequence: (10, 10, 58, 31, 63, 40, 76) ... | Java 8 | standard input | [
"implementation"
] | ef9ff63d225811868e786e800ce49c92 | The first input line contains the only integer n (2 ≤ n ≤ 100) which represents the number of soldiers in the line. The second line contains integers a1, a2, ..., an (1 ≤ ai ≤ 100) the values of the soldiers' heights in the order of soldiers' heights' increasing in the order from the beginning of the line to its end. T... | 800 | Print the only integer — the minimum number of seconds the colonel will need to form a line-up the general will like. | standard output | |
PASSED | 249c287634f7e9bf097e97fcfb0a82e0 | train_003.jsonl | 1326899100 | A Ministry for Defense sent a general to inspect the Super Secret Military Squad under the command of the Colonel SuperDuper. Having learned the news, the colonel ordered to all n squad soldiers to line up on the parade ground.By the military charter the soldiers should stand in the order of non-increasing of their hei... | 256 megabytes | import java.util.Scanner;
public class Practice {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int n =sc.nextInt();
int[] arr = new int[n];
int min=0,max=0;
for(int i =0;i<n;i++)
{
arr[i]=sc.nextInt();
if(arr[i]>arr[max])
{
... | Java | ["4\n33 44 11 22", "7\n10 10 58 31 63 40 76"] | 2 seconds | ["2", "10"] | NoteIn the first sample the colonel will need to swap the first and second soldier and then the third and fourth soldier. That will take 2 seconds. The resulting position of the soldiers is (44, 33, 22, 11).In the second sample the colonel may swap the soldiers in the following sequence: (10, 10, 58, 31, 63, 40, 76) ... | Java 8 | standard input | [
"implementation"
] | ef9ff63d225811868e786e800ce49c92 | The first input line contains the only integer n (2 ≤ n ≤ 100) which represents the number of soldiers in the line. The second line contains integers a1, a2, ..., an (1 ≤ ai ≤ 100) the values of the soldiers' heights in the order of soldiers' heights' increasing in the order from the beginning of the line to its end. T... | 800 | Print the only integer — the minimum number of seconds the colonel will need to form a line-up the general will like. | standard output | |
PASSED | 296e900259790368a352717544b78aa1 | train_003.jsonl | 1326899100 | A Ministry for Defense sent a general to inspect the Super Secret Military Squad under the command of the Colonel SuperDuper. Having learned the news, the colonel ordered to all n squad soldiers to line up on the parade ground.By the military charter the soldiers should stand in the order of non-increasing of their hei... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int numSoldiers = in.nextInt();
int[] list = new int[numSoldiers];
int high = 0;
int low = 10000;
int lowIndex = -1;
int highIndex = 0;
... | Java | ["4\n33 44 11 22", "7\n10 10 58 31 63 40 76"] | 2 seconds | ["2", "10"] | NoteIn the first sample the colonel will need to swap the first and second soldier and then the third and fourth soldier. That will take 2 seconds. The resulting position of the soldiers is (44, 33, 22, 11).In the second sample the colonel may swap the soldiers in the following sequence: (10, 10, 58, 31, 63, 40, 76) ... | Java 8 | standard input | [
"implementation"
] | ef9ff63d225811868e786e800ce49c92 | The first input line contains the only integer n (2 ≤ n ≤ 100) which represents the number of soldiers in the line. The second line contains integers a1, a2, ..., an (1 ≤ ai ≤ 100) the values of the soldiers' heights in the order of soldiers' heights' increasing in the order from the beginning of the line to its end. T... | 800 | Print the only integer — the minimum number of seconds the colonel will need to form a line-up the general will like. | standard output | |
PASSED | a71dae2c23dff9c4da8140fcc480c4fa | train_003.jsonl | 1326899100 | A Ministry for Defense sent a general to inspect the Super Secret Military Squad under the command of the Colonel SuperDuper. Having learned the news, the colonel ordered to all n squad soldiers to line up on the parade ground.By the military charter the soldiers should stand in the order of non-increasing of their hei... | 256 megabytes |
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
/**
*
* @author ONE BY ONE
*/
public class ArrivalOfTheGeneral {
public static void insertionSort(int array[]) {
int n = array.length;
for (int j = 1; j < n; j++) {
int key = array[j];
int... | Java | ["4\n33 44 11 22", "7\n10 10 58 31 63 40 76"] | 2 seconds | ["2", "10"] | NoteIn the first sample the colonel will need to swap the first and second soldier and then the third and fourth soldier. That will take 2 seconds. The resulting position of the soldiers is (44, 33, 22, 11).In the second sample the colonel may swap the soldiers in the following sequence: (10, 10, 58, 31, 63, 40, 76) ... | Java 8 | standard input | [
"implementation"
] | ef9ff63d225811868e786e800ce49c92 | The first input line contains the only integer n (2 ≤ n ≤ 100) which represents the number of soldiers in the line. The second line contains integers a1, a2, ..., an (1 ≤ ai ≤ 100) the values of the soldiers' heights in the order of soldiers' heights' increasing in the order from the beginning of the line to its end. T... | 800 | Print the only integer — the minimum number of seconds the colonel will need to form a line-up the general will like. | standard output | |
PASSED | cd940053ef3e5c94757f9ac2ffbe8ac0 | train_003.jsonl | 1326899100 | A Ministry for Defense sent a general to inspect the Super Secret Military Squad under the command of the Colonel SuperDuper. Having learned the news, the colonel ordered to all n squad soldiers to line up on the parade ground.By the military charter the soldiers should stand in the order of non-increasing of their hei... | 256 megabytes | import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
/**
*
* @author ONE BY ONE
*/
public class ArrivalOfTheGeneral {
public static void insertionSort(int array[]) {
int n = array.length;
for (int j = 1; j < n; j++) {
int key = array[j];
int ... | Java | ["4\n33 44 11 22", "7\n10 10 58 31 63 40 76"] | 2 seconds | ["2", "10"] | NoteIn the first sample the colonel will need to swap the first and second soldier and then the third and fourth soldier. That will take 2 seconds. The resulting position of the soldiers is (44, 33, 22, 11).In the second sample the colonel may swap the soldiers in the following sequence: (10, 10, 58, 31, 63, 40, 76) ... | Java 8 | standard input | [
"implementation"
] | ef9ff63d225811868e786e800ce49c92 | The first input line contains the only integer n (2 ≤ n ≤ 100) which represents the number of soldiers in the line. The second line contains integers a1, a2, ..., an (1 ≤ ai ≤ 100) the values of the soldiers' heights in the order of soldiers' heights' increasing in the order from the beginning of the line to its end. T... | 800 | Print the only integer — the minimum number of seconds the colonel will need to form a line-up the general will like. | standard output | |
PASSED | 4af34069768fc1abd4034f54527362f4 | train_003.jsonl | 1326899100 | A Ministry for Defense sent a general to inspect the Super Secret Military Squad under the command of the Colonel SuperDuper. Having learned the news, the colonel ordered to all n squad soldiers to line up on the parade ground.By the military charter the soldiers should stand in the order of non-increasing of their hei... | 256 megabytes | import java.util.Scanner;
public class Class1{
public static void main(String[] args) {
int n;
Scanner in = new Scanner(System.in);
n = in.nextInt();
int[] a = new int[100];
int i;
for(i=0;i<n;i++) {
a[i]=in.nextInt();
}
int l=a[0],s=a[0],li=0,si=0;
for(i=0;i<n;i++) {
if(a[i]<s) {
s=a[i];
... | Java | ["4\n33 44 11 22", "7\n10 10 58 31 63 40 76"] | 2 seconds | ["2", "10"] | NoteIn the first sample the colonel will need to swap the first and second soldier and then the third and fourth soldier. That will take 2 seconds. The resulting position of the soldiers is (44, 33, 22, 11).In the second sample the colonel may swap the soldiers in the following sequence: (10, 10, 58, 31, 63, 40, 76) ... | Java 8 | standard input | [
"implementation"
] | ef9ff63d225811868e786e800ce49c92 | The first input line contains the only integer n (2 ≤ n ≤ 100) which represents the number of soldiers in the line. The second line contains integers a1, a2, ..., an (1 ≤ ai ≤ 100) the values of the soldiers' heights in the order of soldiers' heights' increasing in the order from the beginning of the line to its end. T... | 800 | Print the only integer — the minimum number of seconds the colonel will need to form a line-up the general will like. | standard output | |
PASSED | 99a137d2b22106cfe11e0913f2d2e117 | train_003.jsonl | 1326899100 | A Ministry for Defense sent a general to inspect the Super Secret Military Squad under the command of the Colonel SuperDuper. Having learned the news, the colonel ordered to all n squad soldiers to line up on the parade ground.By the military charter the soldiers should stand in the order of non-increasing of their hei... | 256 megabytes | import java.util.Scanner;
/**
* Name: Saleh Alolayan
* ID: 201411029
*/
public class ArrivalOfTheGeneral {
public static void main(String[] args) {
Scanner uIN = new Scanner(System.in);
int Snum = 0;
int min = 100;
int indexMin = 0;
int max = 0;
int indexMax =0;
... | Java | ["4\n33 44 11 22", "7\n10 10 58 31 63 40 76"] | 2 seconds | ["2", "10"] | NoteIn the first sample the colonel will need to swap the first and second soldier and then the third and fourth soldier. That will take 2 seconds. The resulting position of the soldiers is (44, 33, 22, 11).In the second sample the colonel may swap the soldiers in the following sequence: (10, 10, 58, 31, 63, 40, 76) ... | Java 8 | standard input | [
"implementation"
] | ef9ff63d225811868e786e800ce49c92 | The first input line contains the only integer n (2 ≤ n ≤ 100) which represents the number of soldiers in the line. The second line contains integers a1, a2, ..., an (1 ≤ ai ≤ 100) the values of the soldiers' heights in the order of soldiers' heights' increasing in the order from the beginning of the line to its end. T... | 800 | Print the only integer — the minimum number of seconds the colonel will need to form a line-up the general will like. | standard output | |
PASSED | 40fafcbb203b22d7d294c52d7c81d865 | train_003.jsonl | 1326899100 | A Ministry for Defense sent a general to inspect the Super Secret Military Squad under the command of the Colonel SuperDuper. Having learned the news, the colonel ordered to all n squad soldiers to line up on the parade ground.By the military charter the soldiers should stand in the order of non-increasing of their hei... | 256 megabytes |
import java.util.Scanner;
public class JavaApplication3 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
int max=0,min=0;
int [] arr = new int[t];
for (int j = 0; j < arr.length; j++) {
int tt = in.nextInt(... | Java | ["4\n33 44 11 22", "7\n10 10 58 31 63 40 76"] | 2 seconds | ["2", "10"] | NoteIn the first sample the colonel will need to swap the first and second soldier and then the third and fourth soldier. That will take 2 seconds. The resulting position of the soldiers is (44, 33, 22, 11).In the second sample the colonel may swap the soldiers in the following sequence: (10, 10, 58, 31, 63, 40, 76) ... | Java 8 | standard input | [
"implementation"
] | ef9ff63d225811868e786e800ce49c92 | The first input line contains the only integer n (2 ≤ n ≤ 100) which represents the number of soldiers in the line. The second line contains integers a1, a2, ..., an (1 ≤ ai ≤ 100) the values of the soldiers' heights in the order of soldiers' heights' increasing in the order from the beginning of the line to its end. T... | 800 | Print the only integer — the minimum number of seconds the colonel will need to form a line-up the general will like. | standard output | |
PASSED | b7ed16976495b8e8fba320c58ead2a09 | train_003.jsonl | 1326899100 | A Ministry for Defense sent a general to inspect the Super Secret Military Squad under the command of the Colonel SuperDuper. Having learned the news, the colonel ordered to all n squad soldiers to line up on the parade ground.By the military charter the soldiers should stand in the order of non-increasing of their hei... | 256 megabytes | import java.util.Scanner;
import java.util.*;
import java.io.*;
import java.math.*;
//********************************************************K.S.J _@@@@@@@@@@@@@@@@@@@@@@@@@******************************
public class soilder{
static BufferedReader reader;
static StringTokenizer tokenizer;
static void init(... | Java | ["4\n33 44 11 22", "7\n10 10 58 31 63 40 76"] | 2 seconds | ["2", "10"] | NoteIn the first sample the colonel will need to swap the first and second soldier and then the third and fourth soldier. That will take 2 seconds. The resulting position of the soldiers is (44, 33, 22, 11).In the second sample the colonel may swap the soldiers in the following sequence: (10, 10, 58, 31, 63, 40, 76) ... | Java 8 | standard input | [
"implementation"
] | ef9ff63d225811868e786e800ce49c92 | The first input line contains the only integer n (2 ≤ n ≤ 100) which represents the number of soldiers in the line. The second line contains integers a1, a2, ..., an (1 ≤ ai ≤ 100) the values of the soldiers' heights in the order of soldiers' heights' increasing in the order from the beginning of the line to its end. T... | 800 | Print the only integer — the minimum number of seconds the colonel will need to form a line-up the general will like. | standard output | |
PASSED | 17edbaaff4cb97d088ba308508b70839 | train_003.jsonl | 1442939400 | Kefa decided to celebrate his first big salary by going to the restaurant. He lives by an unusual park. The park is a rooted tree consisting of n vertices with the root at vertex 1. Vertex 1 also contains Kefa's house. Unfortunaely for our hero, the park also contains cats. Kefa has already found out what are the verti... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import static java.lang.Integer.parseInt;
public class C_Kefa_and_Park {
static int n,m,ok[],cats[],ans;
static ArrayList<Integer> adj[];
public stati... | Java | ["4 1\n1 1 0 0\n1 2\n1 3\n1 4", "7 1\n1 0 1 1 0 0 0\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7"] | 2 seconds | ["2", "2"] | NoteLet us remind you that a tree is a connected graph on n vertices and n - 1 edge. A rooted tree is a tree with a special vertex called root. In a rooted tree among any two vertices connected by an edge, one vertex is a parent (the one closer to the root), and the other one is a child. A vertex is called a leaf, if i... | Java 8 | standard input | [
"dfs and similar",
"trees",
"graphs"
] | 875e7048b7a254992b9f62b9365fcf9b | The first line contains two integers, n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ n) — the number of vertices of the tree and the maximum number of consecutive vertices with cats that is still ok for Kefa. The second line contains n integers a1, a2, ..., an, where each ai either equals to 0 (then vertex i has no cat), or equals to 1... | 1,500 | A single integer — the number of distinct leaves of a tree the path to which from Kefa's home contains at most m consecutive vertices with cats. | standard output | |
PASSED | d18c77642582f4d39f00a8371dfd23b4 | train_003.jsonl | 1442939400 | Kefa decided to celebrate his first big salary by going to the restaurant. He lives by an unusual park. The park is a rooted tree consisting of n vertices with the root at vertex 1. Vertex 1 also contains Kefa's house. Unfortunaely for our hero, the park also contains cats. Kefa has already found out what are the verti... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import static java.lang.Integer.parseInt;
public class C_Kefa_and_Park {
static int n,m,ok[],inn[],ans;
static ArrayList<Integer> adj[];
public stati... | Java | ["4 1\n1 1 0 0\n1 2\n1 3\n1 4", "7 1\n1 0 1 1 0 0 0\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7"] | 2 seconds | ["2", "2"] | NoteLet us remind you that a tree is a connected graph on n vertices and n - 1 edge. A rooted tree is a tree with a special vertex called root. In a rooted tree among any two vertices connected by an edge, one vertex is a parent (the one closer to the root), and the other one is a child. A vertex is called a leaf, if i... | Java 8 | standard input | [
"dfs and similar",
"trees",
"graphs"
] | 875e7048b7a254992b9f62b9365fcf9b | The first line contains two integers, n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ n) — the number of vertices of the tree and the maximum number of consecutive vertices with cats that is still ok for Kefa. The second line contains n integers a1, a2, ..., an, where each ai either equals to 0 (then vertex i has no cat), or equals to 1... | 1,500 | A single integer — the number of distinct leaves of a tree the path to which from Kefa's home contains at most m consecutive vertices with cats. | standard output | |
PASSED | 0808315ea07624c1265a1709b7b59101 | train_003.jsonl | 1442939400 | Kefa decided to celebrate his first big salary by going to the restaurant. He lives by an unusual park. The park is a rooted tree consisting of n vertices with the root at vertex 1. Vertex 1 also contains Kefa's house. Unfortunaely for our hero, the park also contains cats. Kefa has already found out what are the verti... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import static java.lang.Integer.parseInt;
public class C_Kefa_and_Park {
static int n,m,ok[],inn[],cats[],ans;
static ArrayList<Integer> adj[];
public... | Java | ["4 1\n1 1 0 0\n1 2\n1 3\n1 4", "7 1\n1 0 1 1 0 0 0\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7"] | 2 seconds | ["2", "2"] | NoteLet us remind you that a tree is a connected graph on n vertices and n - 1 edge. A rooted tree is a tree with a special vertex called root. In a rooted tree among any two vertices connected by an edge, one vertex is a parent (the one closer to the root), and the other one is a child. A vertex is called a leaf, if i... | Java 8 | standard input | [
"dfs and similar",
"trees",
"graphs"
] | 875e7048b7a254992b9f62b9365fcf9b | The first line contains two integers, n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ n) — the number of vertices of the tree and the maximum number of consecutive vertices with cats that is still ok for Kefa. The second line contains n integers a1, a2, ..., an, where each ai either equals to 0 (then vertex i has no cat), or equals to 1... | 1,500 | A single integer — the number of distinct leaves of a tree the path to which from Kefa's home contains at most m consecutive vertices with cats. | standard output | |
PASSED | 923175deec349640ba7ccb910ed2bafe | train_003.jsonl | 1442939400 | Kefa decided to celebrate his first big salary by going to the restaurant. He lives by an unusual park. The park is a rooted tree consisting of n vertices with the root at vertex 1. Vertex 1 also contains Kefa's house. Unfortunaely for our hero, the park also contains cats. Kefa has already found out what are the verti... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import static java.lang.Integer.parseInt;
public class C_Kefa_and_Park {
static int n,m,ok[],inn[],cats[],ans;
static ArrayList<Integer> adj[];
public ... | Java | ["4 1\n1 1 0 0\n1 2\n1 3\n1 4", "7 1\n1 0 1 1 0 0 0\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7"] | 2 seconds | ["2", "2"] | NoteLet us remind you that a tree is a connected graph on n vertices and n - 1 edge. A rooted tree is a tree with a special vertex called root. In a rooted tree among any two vertices connected by an edge, one vertex is a parent (the one closer to the root), and the other one is a child. A vertex is called a leaf, if i... | Java 8 | standard input | [
"dfs and similar",
"trees",
"graphs"
] | 875e7048b7a254992b9f62b9365fcf9b | The first line contains two integers, n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ n) — the number of vertices of the tree and the maximum number of consecutive vertices with cats that is still ok for Kefa. The second line contains n integers a1, a2, ..., an, where each ai either equals to 0 (then vertex i has no cat), or equals to 1... | 1,500 | A single integer — the number of distinct leaves of a tree the path to which from Kefa's home contains at most m consecutive vertices with cats. | standard output | |
PASSED | 96a965735accb2f8aaa7a01bd927ca0b | train_003.jsonl | 1442939400 | Kefa decided to celebrate his first big salary by going to the restaurant. He lives by an unusual park. The park is a rooted tree consisting of n vertices with the root at vertex 1. Vertex 1 also contains Kefa's house. Unfortunaely for our hero, the park also contains cats. Kefa has already found out what are the verti... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static void main(String[]args){
FastReader in=new FastReader();
int n=in.nextInt();
int m=in.nextInt();
int[]x=new int[n];
for(int i=0;i<x.length;i++){
x[i]=in.nextInt();
}
List <Integer> [] g=new List[n];
for(int i=0;i<... | Java | ["4 1\n1 1 0 0\n1 2\n1 3\n1 4", "7 1\n1 0 1 1 0 0 0\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7"] | 2 seconds | ["2", "2"] | NoteLet us remind you that a tree is a connected graph on n vertices and n - 1 edge. A rooted tree is a tree with a special vertex called root. In a rooted tree among any two vertices connected by an edge, one vertex is a parent (the one closer to the root), and the other one is a child. A vertex is called a leaf, if i... | Java 8 | standard input | [
"dfs and similar",
"trees",
"graphs"
] | 875e7048b7a254992b9f62b9365fcf9b | The first line contains two integers, n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ n) — the number of vertices of the tree and the maximum number of consecutive vertices with cats that is still ok for Kefa. The second line contains n integers a1, a2, ..., an, where each ai either equals to 0 (then vertex i has no cat), or equals to 1... | 1,500 | A single integer — the number of distinct leaves of a tree the path to which from Kefa's home contains at most m consecutive vertices with cats. | standard output | |
PASSED | 2fc37574e9a376d5784613c379e61374 | train_003.jsonl | 1442939400 | Kefa decided to celebrate his first big salary by going to the restaurant. He lives by an unusual park. The park is a rooted tree consisting of n vertices with the root at vertex 1. Vertex 1 also contains Kefa's house. Unfortunaely for our hero, the park also contains cats. Kefa has already found out what are the verti... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
static HashSet<Integer> set=new HashSet<Integer>();
static int count=0;
static int citi=0;
static int cat[];
static int ans=0;
static ArrayList<Integer> g[];
public static void main(String[] args) throws IOException
{
... | Java | ["4 1\n1 1 0 0\n1 2\n1 3\n1 4", "7 1\n1 0 1 1 0 0 0\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7"] | 2 seconds | ["2", "2"] | NoteLet us remind you that a tree is a connected graph on n vertices and n - 1 edge. A rooted tree is a tree with a special vertex called root. In a rooted tree among any two vertices connected by an edge, one vertex is a parent (the one closer to the root), and the other one is a child. A vertex is called a leaf, if i... | Java 8 | standard input | [
"dfs and similar",
"trees",
"graphs"
] | 875e7048b7a254992b9f62b9365fcf9b | The first line contains two integers, n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ n) — the number of vertices of the tree and the maximum number of consecutive vertices with cats that is still ok for Kefa. The second line contains n integers a1, a2, ..., an, where each ai either equals to 0 (then vertex i has no cat), or equals to 1... | 1,500 | A single integer — the number of distinct leaves of a tree the path to which from Kefa's home contains at most m consecutive vertices with cats. | standard output | |
PASSED | 892a5be5c5a476f00dcc91690429df78 | train_003.jsonl | 1442939400 | Kefa decided to celebrate his first big salary by going to the restaurant. He lives by an unusual park. The park is a rooted tree consisting of n vertices with the root at vertex 1. Vertex 1 also contains Kefa's house. Unfortunaely for our hero, the park also contains cats. Kefa has already found out what are the verti... | 256 megabytes | import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
/**
* Created by Мила on 04.01.2017.
*/
public class problem580C {
static int DFS(int n, Set<Integer>[] graph, boolean[] visited, int node, int parent, int cat_row, Set<Integer> cats, int m) {
if (cat_row > m) return 0;
if... | Java | ["4 1\n1 1 0 0\n1 2\n1 3\n1 4", "7 1\n1 0 1 1 0 0 0\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7"] | 2 seconds | ["2", "2"] | NoteLet us remind you that a tree is a connected graph on n vertices and n - 1 edge. A rooted tree is a tree with a special vertex called root. In a rooted tree among any two vertices connected by an edge, one vertex is a parent (the one closer to the root), and the other one is a child. A vertex is called a leaf, if i... | Java 8 | standard input | [
"dfs and similar",
"trees",
"graphs"
] | 875e7048b7a254992b9f62b9365fcf9b | The first line contains two integers, n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ n) — the number of vertices of the tree and the maximum number of consecutive vertices with cats that is still ok for Kefa. The second line contains n integers a1, a2, ..., an, where each ai either equals to 0 (then vertex i has no cat), or equals to 1... | 1,500 | A single integer — the number of distinct leaves of a tree the path to which from Kefa's home contains at most m consecutive vertices with cats. | standard output | |
PASSED | 09ee952405ab2243174ce3d0f859d843 | train_003.jsonl | 1442939400 | Kefa decided to celebrate his first big salary by going to the restaurant. He lives by an unusual park. The park is a rooted tree consisting of n vertices with the root at vertex 1. Vertex 1 also contains Kefa's house. Unfortunaely for our hero, the park also contains cats. Kefa has already found out what are the verti... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static int n;
static int m;
static int res;
// static int[] in;
static boolean[] isCat;
static boolean[] vis;
static ArrayList<Integer> G[];
static int calculate() {
dfs(0, 0);
return res;
}
static ... | Java | ["4 1\n1 1 0 0\n1 2\n1 3\n1 4", "7 1\n1 0 1 1 0 0 0\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7"] | 2 seconds | ["2", "2"] | NoteLet us remind you that a tree is a connected graph on n vertices and n - 1 edge. A rooted tree is a tree with a special vertex called root. In a rooted tree among any two vertices connected by an edge, one vertex is a parent (the one closer to the root), and the other one is a child. A vertex is called a leaf, if i... | Java 8 | standard input | [
"dfs and similar",
"trees",
"graphs"
] | 875e7048b7a254992b9f62b9365fcf9b | The first line contains two integers, n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ n) — the number of vertices of the tree and the maximum number of consecutive vertices with cats that is still ok for Kefa. The second line contains n integers a1, a2, ..., an, where each ai either equals to 0 (then vertex i has no cat), or equals to 1... | 1,500 | A single integer — the number of distinct leaves of a tree the path to which from Kefa's home contains at most m consecutive vertices with cats. | standard output | |
PASSED | d08a165739cbf5ba75540a1ebb1dddb6 | train_003.jsonl | 1442939400 | Kefa decided to celebrate his first big salary by going to the restaurant. He lives by an unusual park. The park is a rooted tree consisting of n vertices with the root at vertex 1. Vertex 1 also contains Kefa's house. Unfortunaely for our hero, the park also contains cats. Kefa has already found out what are the verti... | 256 megabytes | import java.io.BufferedInputStream;
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
private static class Graph{
public int n;
public int m;
public int res;
public int[] in;
public boolean[] isCat;
public boolean[] vis;
public Array... | Java | ["4 1\n1 1 0 0\n1 2\n1 3\n1 4", "7 1\n1 0 1 1 0 0 0\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7"] | 2 seconds | ["2", "2"] | NoteLet us remind you that a tree is a connected graph on n vertices and n - 1 edge. A rooted tree is a tree with a special vertex called root. In a rooted tree among any two vertices connected by an edge, one vertex is a parent (the one closer to the root), and the other one is a child. A vertex is called a leaf, if i... | Java 8 | standard input | [
"dfs and similar",
"trees",
"graphs"
] | 875e7048b7a254992b9f62b9365fcf9b | The first line contains two integers, n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ n) — the number of vertices of the tree and the maximum number of consecutive vertices with cats that is still ok for Kefa. The second line contains n integers a1, a2, ..., an, where each ai either equals to 0 (then vertex i has no cat), or equals to 1... | 1,500 | A single integer — the number of distinct leaves of a tree the path to which from Kefa's home contains at most m consecutive vertices with cats. | standard output | |
PASSED | 3f6a3037174360a485a9cc69ff2ea3d3 | train_003.jsonl | 1442939400 | Kefa decided to celebrate his first big salary by going to the restaurant. He lives by an unusual park. The park is a rooted tree consisting of n vertices with the root at vertex 1. Vertex 1 also contains Kefa's house. Unfortunaely for our hero, the park also contains cats. Kefa has already found out what are the verti... | 256 megabytes |
import java.io.BufferedInputStream;
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
private static class Graph{
public int n;
public int m;
public int res;
// public int[] in;
public boolean[] isCat;
public boolean[] vis;
public A... | Java | ["4 1\n1 1 0 0\n1 2\n1 3\n1 4", "7 1\n1 0 1 1 0 0 0\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7"] | 2 seconds | ["2", "2"] | NoteLet us remind you that a tree is a connected graph on n vertices and n - 1 edge. A rooted tree is a tree with a special vertex called root. In a rooted tree among any two vertices connected by an edge, one vertex is a parent (the one closer to the root), and the other one is a child. A vertex is called a leaf, if i... | Java 8 | standard input | [
"dfs and similar",
"trees",
"graphs"
] | 875e7048b7a254992b9f62b9365fcf9b | The first line contains two integers, n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ n) — the number of vertices of the tree and the maximum number of consecutive vertices with cats that is still ok for Kefa. The second line contains n integers a1, a2, ..., an, where each ai either equals to 0 (then vertex i has no cat), or equals to 1... | 1,500 | A single integer — the number of distinct leaves of a tree the path to which from Kefa's home contains at most m consecutive vertices with cats. | standard output | |
PASSED | 3f04a4ee64ea51f9a8bc9d2101ac8a7b | train_003.jsonl | 1442939400 | Kefa decided to celebrate his first big salary by going to the restaurant. He lives by an unusual park. The park is a rooted tree consisting of n vertices with the root at vertex 1. Vertex 1 also contains Kefa's house. Unfortunaely for our hero, the park also contains cats. Kefa has already found out what are the verti... | 256 megabytes | import java.awt.dnd.Autoscroll;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
import java.util.Stack;
import java.util.Set;
import java.util.HashSet;
import java.util.Arr... | Java | ["4 1\n1 1 0 0\n1 2\n1 3\n1 4", "7 1\n1 0 1 1 0 0 0\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7"] | 2 seconds | ["2", "2"] | NoteLet us remind you that a tree is a connected graph on n vertices and n - 1 edge. A rooted tree is a tree with a special vertex called root. In a rooted tree among any two vertices connected by an edge, one vertex is a parent (the one closer to the root), and the other one is a child. A vertex is called a leaf, if i... | Java 8 | standard input | [
"dfs and similar",
"trees",
"graphs"
] | 875e7048b7a254992b9f62b9365fcf9b | The first line contains two integers, n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ n) — the number of vertices of the tree and the maximum number of consecutive vertices with cats that is still ok for Kefa. The second line contains n integers a1, a2, ..., an, where each ai either equals to 0 (then vertex i has no cat), or equals to 1... | 1,500 | A single integer — the number of distinct leaves of a tree the path to which from Kefa's home contains at most m consecutive vertices with cats. | standard output | |
PASSED | ef5dd419c4d0d2938c657423f3dde556 | train_003.jsonl | 1442939400 | Kefa decided to celebrate his first big salary by going to the restaurant. He lives by an unusual park. The park is a rooted tree consisting of n vertices with the root at vertex 1. Vertex 1 also contains Kefa's house. Unfortunaely for our hero, the park also contains cats. Kefa has already found out what are the verti... | 256 megabytes | import java.awt.dnd.Autoscroll;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
import java.util.Stack;
import java.util.Set;
import java.util.HashSet;
import java.util.Arr... | Java | ["4 1\n1 1 0 0\n1 2\n1 3\n1 4", "7 1\n1 0 1 1 0 0 0\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7"] | 2 seconds | ["2", "2"] | NoteLet us remind you that a tree is a connected graph on n vertices and n - 1 edge. A rooted tree is a tree with a special vertex called root. In a rooted tree among any two vertices connected by an edge, one vertex is a parent (the one closer to the root), and the other one is a child. A vertex is called a leaf, if i... | Java 8 | standard input | [
"dfs and similar",
"trees",
"graphs"
] | 875e7048b7a254992b9f62b9365fcf9b | The first line contains two integers, n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ n) — the number of vertices of the tree and the maximum number of consecutive vertices with cats that is still ok for Kefa. The second line contains n integers a1, a2, ..., an, where each ai either equals to 0 (then vertex i has no cat), or equals to 1... | 1,500 | A single integer — the number of distinct leaves of a tree the path to which from Kefa's home contains at most m consecutive vertices with cats. | standard output | |
PASSED | 0a0ab0f3cb3f3b48e049db66fe1c2c9a | train_003.jsonl | 1442939400 | Kefa decided to celebrate his first big salary by going to the restaurant. He lives by an unusual park. The park is a rooted tree consisting of n vertices with the root at vertex 1. Vertex 1 also contains Kefa's house. Unfortunaely for our hero, the park also contains cats. Kefa has already found out what are the verti... | 256 megabytes | import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;
public class park {
public static void main(String[] arg) {
Scanner scan = new Scanner(System.in);
int n = Integer.valueOf(scan.next());
int m = Integer.valueOf(scan.next());
boolean[] cats = new boolean[... | Java | ["4 1\n1 1 0 0\n1 2\n1 3\n1 4", "7 1\n1 0 1 1 0 0 0\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7"] | 2 seconds | ["2", "2"] | NoteLet us remind you that a tree is a connected graph on n vertices and n - 1 edge. A rooted tree is a tree with a special vertex called root. In a rooted tree among any two vertices connected by an edge, one vertex is a parent (the one closer to the root), and the other one is a child. A vertex is called a leaf, if i... | Java 8 | standard input | [
"dfs and similar",
"trees",
"graphs"
] | 875e7048b7a254992b9f62b9365fcf9b | The first line contains two integers, n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ n) — the number of vertices of the tree and the maximum number of consecutive vertices with cats that is still ok for Kefa. The second line contains n integers a1, a2, ..., an, where each ai either equals to 0 (then vertex i has no cat), or equals to 1... | 1,500 | A single integer — the number of distinct leaves of a tree the path to which from Kefa's home contains at most m consecutive vertices with cats. | standard output | |
PASSED | f11c27062df8257a6df7bd88a8f2bfc4 | train_003.jsonl | 1442939400 | Kefa decided to celebrate his first big salary by going to the restaurant. He lives by an unusual park. The park is a rooted tree consisting of n vertices with the root at vertex 1. Vertex 1 also contains Kefa's house. Unfortunaely for our hero, the park also contains cats. Kefa has already found out what are the verti... | 256 megabytes |
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
im... | Java | ["4 1\n1 1 0 0\n1 2\n1 3\n1 4", "7 1\n1 0 1 1 0 0 0\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7"] | 2 seconds | ["2", "2"] | NoteLet us remind you that a tree is a connected graph on n vertices and n - 1 edge. A rooted tree is a tree with a special vertex called root. In a rooted tree among any two vertices connected by an edge, one vertex is a parent (the one closer to the root), and the other one is a child. A vertex is called a leaf, if i... | Java 8 | standard input | [
"dfs and similar",
"trees",
"graphs"
] | 875e7048b7a254992b9f62b9365fcf9b | The first line contains two integers, n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ n) — the number of vertices of the tree and the maximum number of consecutive vertices with cats that is still ok for Kefa. The second line contains n integers a1, a2, ..., an, where each ai either equals to 0 (then vertex i has no cat), or equals to 1... | 1,500 | A single integer — the number of distinct leaves of a tree the path to which from Kefa's home contains at most m consecutive vertices with cats. | standard output | |
PASSED | 6ef54580206d28c3fffa0d2ef53e08f9 | train_003.jsonl | 1442939400 | Kefa decided to celebrate his first big salary by going to the restaurant. He lives by an unusual park. The park is a rooted tree consisting of n vertices with the root at vertex 1. Vertex 1 also contains Kefa's house. Unfortunaely for our hero, the park also contains cats. Kefa has already found out what are the verti... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import... | Java | ["4 1\n1 1 0 0\n1 2\n1 3\n1 4", "7 1\n1 0 1 1 0 0 0\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7"] | 2 seconds | ["2", "2"] | NoteLet us remind you that a tree is a connected graph on n vertices and n - 1 edge. A rooted tree is a tree with a special vertex called root. In a rooted tree among any two vertices connected by an edge, one vertex is a parent (the one closer to the root), and the other one is a child. A vertex is called a leaf, if i... | Java 8 | standard input | [
"dfs and similar",
"trees",
"graphs"
] | 875e7048b7a254992b9f62b9365fcf9b | The first line contains two integers, n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ n) — the number of vertices of the tree and the maximum number of consecutive vertices with cats that is still ok for Kefa. The second line contains n integers a1, a2, ..., an, where each ai either equals to 0 (then vertex i has no cat), or equals to 1... | 1,500 | A single integer — the number of distinct leaves of a tree the path to which from Kefa's home contains at most m consecutive vertices with cats. | standard output | |
PASSED | e5c6aeb5cce2149cf0098f547fc1e3d6 | train_003.jsonl | 1442939400 | Kefa decided to celebrate his first big salary by going to the restaurant. He lives by an unusual park. The park is a rooted tree consisting of n vertices with the root at vertex 1. Vertex 1 also contains Kefa's house. Unfortunaely for our hero, the park also contains cats. Kefa has already found out what are the verti... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.HashSet;
import static java.lang.System.exit;
public class trial1
{
static int[] isone;
static int[] counts;
... | Java | ["4 1\n1 1 0 0\n1 2\n1 3\n1 4", "7 1\n1 0 1 1 0 0 0\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7"] | 2 seconds | ["2", "2"] | NoteLet us remind you that a tree is a connected graph on n vertices and n - 1 edge. A rooted tree is a tree with a special vertex called root. In a rooted tree among any two vertices connected by an edge, one vertex is a parent (the one closer to the root), and the other one is a child. A vertex is called a leaf, if i... | Java 8 | standard input | [
"dfs and similar",
"trees",
"graphs"
] | 875e7048b7a254992b9f62b9365fcf9b | The first line contains two integers, n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ n) — the number of vertices of the tree and the maximum number of consecutive vertices with cats that is still ok for Kefa. The second line contains n integers a1, a2, ..., an, where each ai either equals to 0 (then vertex i has no cat), or equals to 1... | 1,500 | A single integer — the number of distinct leaves of a tree the path to which from Kefa's home contains at most m consecutive vertices with cats. | standard output | |
PASSED | d06adf41ccbbcd2ed447090af4879725 | train_003.jsonl | 1442939400 | Kefa decided to celebrate his first big salary by going to the restaurant. He lives by an unusual park. The park is a rooted tree consisting of n vertices with the root at vertex 1. Vertex 1 also contains Kefa's house. Unfortunaely for our hero, the park also contains cats. Kefa has already found out what are the verti... | 256 megabytes | import java.util.*;
public class bucky{
public static int result;
public static ArrayList<Integer> [] graph;
public static int[]cats;
public static boolean vizitat[];
public static void main (String args[]) {
Scanner input=new Scanner(System.in);
HashMap<Integer, Integer> map= new HashMap<Integer, Integer>();... | Java | ["4 1\n1 1 0 0\n1 2\n1 3\n1 4", "7 1\n1 0 1 1 0 0 0\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7"] | 2 seconds | ["2", "2"] | NoteLet us remind you that a tree is a connected graph on n vertices and n - 1 edge. A rooted tree is a tree with a special vertex called root. In a rooted tree among any two vertices connected by an edge, one vertex is a parent (the one closer to the root), and the other one is a child. A vertex is called a leaf, if i... | Java 8 | standard input | [
"dfs and similar",
"trees",
"graphs"
] | 875e7048b7a254992b9f62b9365fcf9b | The first line contains two integers, n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ n) — the number of vertices of the tree and the maximum number of consecutive vertices with cats that is still ok for Kefa. The second line contains n integers a1, a2, ..., an, where each ai either equals to 0 (then vertex i has no cat), or equals to 1... | 1,500 | A single integer — the number of distinct leaves of a tree the path to which from Kefa's home contains at most m consecutive vertices with cats. | standard output | |
PASSED | b1329f60769c24866a1dc26f40376035 | train_003.jsonl | 1442939400 | Kefa decided to celebrate his first big salary by going to the restaurant. He lives by an unusual park. The park is a rooted tree consisting of n vertices with the root at vertex 1. Vertex 1 also contains Kefa's house. Unfortunaely for our hero, the park also contains cats. Kefa has already found out what are the verti... | 256 megabytes | import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;
public class KefaAndPark {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
n = scan.nextInt();
m = scan.nextInt();
adj = new ArrayList[n];
hm = new HashMap<>();
cat = new int[n];
for (int i ... | Java | ["4 1\n1 1 0 0\n1 2\n1 3\n1 4", "7 1\n1 0 1 1 0 0 0\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7"] | 2 seconds | ["2", "2"] | NoteLet us remind you that a tree is a connected graph on n vertices and n - 1 edge. A rooted tree is a tree with a special vertex called root. In a rooted tree among any two vertices connected by an edge, one vertex is a parent (the one closer to the root), and the other one is a child. A vertex is called a leaf, if i... | Java 8 | standard input | [
"dfs and similar",
"trees",
"graphs"
] | 875e7048b7a254992b9f62b9365fcf9b | The first line contains two integers, n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ n) — the number of vertices of the tree and the maximum number of consecutive vertices with cats that is still ok for Kefa. The second line contains n integers a1, a2, ..., an, where each ai either equals to 0 (then vertex i has no cat), or equals to 1... | 1,500 | A single integer — the number of distinct leaves of a tree the path to which from Kefa's home contains at most m consecutive vertices with cats. | standard output | |
PASSED | 0f915c96b372256e606af71c3e17e99b | train_003.jsonl | 1442939400 | Kefa decided to celebrate his first big salary by going to the restaurant. He lives by an unusual park. The park is a rooted tree consisting of n vertices with the root at vertex 1. Vertex 1 also contains Kefa's house. Unfortunaely for our hero, the park also contains cats. Kefa has already found out what are the verti... | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.concurrent.CountDownLatch;
public class Main {
static PrintWriter w = new PrintWriter(System.out);
static Reader sc = new Reader();
public static void main(String args[]) throws IOException {
int tc = 1;
for (int i = 0; i < tc; i++) {
... | Java | ["4 1\n1 1 0 0\n1 2\n1 3\n1 4", "7 1\n1 0 1 1 0 0 0\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7"] | 2 seconds | ["2", "2"] | NoteLet us remind you that a tree is a connected graph on n vertices and n - 1 edge. A rooted tree is a tree with a special vertex called root. In a rooted tree among any two vertices connected by an edge, one vertex is a parent (the one closer to the root), and the other one is a child. A vertex is called a leaf, if i... | Java 8 | standard input | [
"dfs and similar",
"trees",
"graphs"
] | 875e7048b7a254992b9f62b9365fcf9b | The first line contains two integers, n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ n) — the number of vertices of the tree and the maximum number of consecutive vertices with cats that is still ok for Kefa. The second line contains n integers a1, a2, ..., an, where each ai either equals to 0 (then vertex i has no cat), or equals to 1... | 1,500 | A single integer — the number of distinct leaves of a tree the path to which from Kefa's home contains at most m consecutive vertices with cats. | standard output | |
PASSED | 36914cc73cb713ec33883ffae65f6c04 | train_003.jsonl | 1442939400 | Kefa decided to celebrate his first big salary by going to the restaurant. He lives by an unusual park. The park is a rooted tree consisting of n vertices with the root at vertex 1. Vertex 1 also contains Kefa's house. Unfortunaely for our hero, the park also contains cats. Kefa has already found out what are the verti... | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.concurrent.CountDownLatch;
public class Main {
static PrintWriter w = new PrintWriter(System.out);
static Reader sc = new Reader();
public static void main(String args[]) throws IOException {
int tc = 1;
for (int i = 0; i < tc; i++) {
... | Java | ["4 1\n1 1 0 0\n1 2\n1 3\n1 4", "7 1\n1 0 1 1 0 0 0\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7"] | 2 seconds | ["2", "2"] | NoteLet us remind you that a tree is a connected graph on n vertices and n - 1 edge. A rooted tree is a tree with a special vertex called root. In a rooted tree among any two vertices connected by an edge, one vertex is a parent (the one closer to the root), and the other one is a child. A vertex is called a leaf, if i... | Java 8 | standard input | [
"dfs and similar",
"trees",
"graphs"
] | 875e7048b7a254992b9f62b9365fcf9b | The first line contains two integers, n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ n) — the number of vertices of the tree and the maximum number of consecutive vertices with cats that is still ok for Kefa. The second line contains n integers a1, a2, ..., an, where each ai either equals to 0 (then vertex i has no cat), or equals to 1... | 1,500 | A single integer — the number of distinct leaves of a tree the path to which from Kefa's home contains at most m consecutive vertices with cats. | standard output | |
PASSED | 5846aacc205466cd56aa43ee990f0eb5 | train_003.jsonl | 1442939400 | Kefa decided to celebrate his first big salary by going to the restaurant. He lives by an unusual park. The park is a rooted tree consisting of n vertices with the root at vertex 1. Vertex 1 also contains Kefa's house. Unfortunaely for our hero, the park also contains cats. Kefa has already found out what are the verti... | 256 megabytes | import java.io.*;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class _Rough{
static int n, k, cats[], ans;
static ArrayList<Integer> matrix[];
static boolean visited[];
public static class InputReader {
private BufferedReader reader;
private StringTokenizer to... | Java | ["4 1\n1 1 0 0\n1 2\n1 3\n1 4", "7 1\n1 0 1 1 0 0 0\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7"] | 2 seconds | ["2", "2"] | NoteLet us remind you that a tree is a connected graph on n vertices and n - 1 edge. A rooted tree is a tree with a special vertex called root. In a rooted tree among any two vertices connected by an edge, one vertex is a parent (the one closer to the root), and the other one is a child. A vertex is called a leaf, if i... | Java 8 | standard input | [
"dfs and similar",
"trees",
"graphs"
] | 875e7048b7a254992b9f62b9365fcf9b | The first line contains two integers, n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ n) — the number of vertices of the tree and the maximum number of consecutive vertices with cats that is still ok for Kefa. The second line contains n integers a1, a2, ..., an, where each ai either equals to 0 (then vertex i has no cat), or equals to 1... | 1,500 | A single integer — the number of distinct leaves of a tree the path to which from Kefa's home contains at most m consecutive vertices with cats. | standard output | |
PASSED | caf78b9f4236ed0b0f1bb237383875fd | train_003.jsonl | 1587653100 | Nastya just made a huge mistake and dropped a whole package of rice on the floor. Mom will come soon. If she sees this, then Nastya will be punished.In total, Nastya dropped $$$n$$$ grains. Nastya read that each grain weighs some integer number of grams from $$$a - b$$$ to $$$a + b$$$, inclusive (numbers $$$a$$$ and $$... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String firstline = scanner.nextLine();
int test_cases = Integer.parseInt(firstline);
for (int i = 0; i < test_cases; i++) {
String[] nextline... | Java | ["5\n7 20 3 101 18\n11 11 10 234 2\n8 9 7 250 122\n19 41 21 321 10\n3 10 8 6 1"] | 1 second | ["Yes\nNo\nYes\nNo\nYes"] | NoteIn the first test case of the example, we can assume that each grain weighs $$$17$$$ grams, and a pack $$$119$$$ grams, then really Nastya could collect the whole pack.In the third test case of the example, we can assume that each grain weighs $$$16$$$ grams, and a pack $$$128$$$ grams, then really Nastya could col... | Java 8 | standard input | [
"math"
] | 30cfce44a7a0922929fbe54446986748 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The next $$$t$$$ lines contain descriptions of the test cases, each line contains $$$5$$$ integers: $$$n$$$ $$$(1 \leq n \leq 1000)$$$ — the number of grains that Nastya ... | 900 | For each test case given in the input print "Yes", if the information about the weights is not inconsistent, and print "No" if $$$n$$$ grains with masses from $$$a - b$$$ to $$$a + b$$$ cannot make a package with a total mass from $$$c - d$$$ to $$$c + d$$$. | standard output | |
PASSED | ece5d44140ea3293d8d230b08d48961b | train_003.jsonl | 1587653100 | Nastya just made a huge mistake and dropped a whole package of rice on the floor. Mom will come soon. If she sees this, then Nastya will be punished.In total, Nastya dropped $$$n$$$ grains. Nastya read that each grain weighs some integer number of grams from $$$a - b$$$ to $$$a + b$$$, inclusive (numbers $$$a$$$ and $$... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
int t = in.readInt();
while(t-- > 0) {
int n = in.readInt();
int a = in.readInt();
int b = in.readInt();
int c = in.readInt();
... | Java | ["5\n7 20 3 101 18\n11 11 10 234 2\n8 9 7 250 122\n19 41 21 321 10\n3 10 8 6 1"] | 1 second | ["Yes\nNo\nYes\nNo\nYes"] | NoteIn the first test case of the example, we can assume that each grain weighs $$$17$$$ grams, and a pack $$$119$$$ grams, then really Nastya could collect the whole pack.In the third test case of the example, we can assume that each grain weighs $$$16$$$ grams, and a pack $$$128$$$ grams, then really Nastya could col... | Java 8 | standard input | [
"math"
] | 30cfce44a7a0922929fbe54446986748 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The next $$$t$$$ lines contain descriptions of the test cases, each line contains $$$5$$$ integers: $$$n$$$ $$$(1 \leq n \leq 1000)$$$ — the number of grains that Nastya ... | 900 | For each test case given in the input print "Yes", if the information about the weights is not inconsistent, and print "No" if $$$n$$$ grains with masses from $$$a - b$$$ to $$$a + b$$$ cannot make a package with a total mass from $$$c - d$$$ to $$$c + d$$$. | standard output | |
PASSED | 40083f30925bd5c2bb60bbea175a00de | train_003.jsonl | 1587653100 | Nastya just made a huge mistake and dropped a whole package of rice on the floor. Mom will come soon. If she sees this, then Nastya will be punished.In total, Nastya dropped $$$n$$$ grains. Nastya read that each grain weighs some integer number of grams from $$$a - b$$$ to $$$a + b$$$, inclusive (numbers $$$a$$$ and $$... | 256 megabytes |
import java.util.Scanner;
public class Main {
public static void main(String[] args){
int tests,n,a,b,c,d,counter;
n = 0 ; a= 0; b = 0; c = 0 ; d = 0;counter=0;
boolean valid1 = false;
boolean valid2 = false;
Scanner cc = new Scanner(System.in);
tests = cc.nextI... | Java | ["5\n7 20 3 101 18\n11 11 10 234 2\n8 9 7 250 122\n19 41 21 321 10\n3 10 8 6 1"] | 1 second | ["Yes\nNo\nYes\nNo\nYes"] | NoteIn the first test case of the example, we can assume that each grain weighs $$$17$$$ grams, and a pack $$$119$$$ grams, then really Nastya could collect the whole pack.In the third test case of the example, we can assume that each grain weighs $$$16$$$ grams, and a pack $$$128$$$ grams, then really Nastya could col... | Java 8 | standard input | [
"math"
] | 30cfce44a7a0922929fbe54446986748 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The next $$$t$$$ lines contain descriptions of the test cases, each line contains $$$5$$$ integers: $$$n$$$ $$$(1 \leq n \leq 1000)$$$ — the number of grains that Nastya ... | 900 | For each test case given in the input print "Yes", if the information about the weights is not inconsistent, and print "No" if $$$n$$$ grains with masses from $$$a - b$$$ to $$$a + b$$$ cannot make a package with a total mass from $$$c - d$$$ to $$$c + d$$$. | standard output | |
PASSED | c32809de6b93dae634edc88dd525cf72 | train_003.jsonl | 1587653100 | Nastya just made a huge mistake and dropped a whole package of rice on the floor. Mom will come soon. If she sees this, then Nastya will be punished.In total, Nastya dropped $$$n$$$ grains. Nastya read that each grain weighs some integer number of grams from $$$a - b$$$ to $$$a + b$$$, inclusive (numbers $$$a$$$ and $$... | 256 megabytes | import java.io.PrintWriter;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.*;
import java.io.InputStream;
public class Afile {
static class InputReader {
private final InputStream stream;
private final byte[] buf = new byte[8192];
private int curChar, snumChars;
pu... | Java | ["5\n7 20 3 101 18\n11 11 10 234 2\n8 9 7 250 122\n19 41 21 321 10\n3 10 8 6 1"] | 1 second | ["Yes\nNo\nYes\nNo\nYes"] | NoteIn the first test case of the example, we can assume that each grain weighs $$$17$$$ grams, and a pack $$$119$$$ grams, then really Nastya could collect the whole pack.In the third test case of the example, we can assume that each grain weighs $$$16$$$ grams, and a pack $$$128$$$ grams, then really Nastya could col... | Java 8 | standard input | [
"math"
] | 30cfce44a7a0922929fbe54446986748 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The next $$$t$$$ lines contain descriptions of the test cases, each line contains $$$5$$$ integers: $$$n$$$ $$$(1 \leq n \leq 1000)$$$ — the number of grains that Nastya ... | 900 | For each test case given in the input print "Yes", if the information about the weights is not inconsistent, and print "No" if $$$n$$$ grains with masses from $$$a - b$$$ to $$$a + b$$$ cannot make a package with a total mass from $$$c - d$$$ to $$$c + d$$$. | standard output | |
PASSED | 98eb982c31e8cd671a3bf55f406fcf01 | train_003.jsonl | 1587653100 | Nastya just made a huge mistake and dropped a whole package of rice on the floor. Mom will come soon. If she sees this, then Nastya will be punished.In total, Nastya dropped $$$n$$$ grains. Nastya read that each grain weighs some integer number of grams from $$$a - b$$$ to $$$a + b$$$, inclusive (numbers $$$a$$$ and $$... | 256 megabytes | import java.util.Scanner;
public class Solution {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int t=sc.nextInt();
for(int i=0;i<t;i++) {
int n=sc.nextInt();
int a=sc.nextInt();
int b=sc.nextInt();
int c=sc.nextInt();
int d=sc.nextInt();
long min,max;... | Java | ["5\n7 20 3 101 18\n11 11 10 234 2\n8 9 7 250 122\n19 41 21 321 10\n3 10 8 6 1"] | 1 second | ["Yes\nNo\nYes\nNo\nYes"] | NoteIn the first test case of the example, we can assume that each grain weighs $$$17$$$ grams, and a pack $$$119$$$ grams, then really Nastya could collect the whole pack.In the third test case of the example, we can assume that each grain weighs $$$16$$$ grams, and a pack $$$128$$$ grams, then really Nastya could col... | Java 8 | standard input | [
"math"
] | 30cfce44a7a0922929fbe54446986748 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The next $$$t$$$ lines contain descriptions of the test cases, each line contains $$$5$$$ integers: $$$n$$$ $$$(1 \leq n \leq 1000)$$$ — the number of grains that Nastya ... | 900 | For each test case given in the input print "Yes", if the information about the weights is not inconsistent, and print "No" if $$$n$$$ grains with masses from $$$a - b$$$ to $$$a + b$$$ cannot make a package with a total mass from $$$c - d$$$ to $$$c + d$$$. | standard output | |
PASSED | 9def23b1ee68eb20d4cd3f94f6ef7bbe | train_003.jsonl | 1587653100 | Nastya just made a huge mistake and dropped a whole package of rice on the floor. Mom will come soon. If she sees this, then Nastya will be punished.In total, Nastya dropped $$$n$$$ grains. Nastya read that each grain weighs some integer number of grams from $$$a - b$$$ to $$$a + b$$$, inclusive (numbers $$$a$$$ and $$... | 256 megabytes |
import java.util.*;
public class Main {
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0)
{
int n=sc.nextInt();
int a=sc.nextInt();
int b=sc.nextInt();
int c=sc.nextInt();
int d=sc.nextInt();
int max=(a+b)*n;
int min=(a-b)*... | Java | ["5\n7 20 3 101 18\n11 11 10 234 2\n8 9 7 250 122\n19 41 21 321 10\n3 10 8 6 1"] | 1 second | ["Yes\nNo\nYes\nNo\nYes"] | NoteIn the first test case of the example, we can assume that each grain weighs $$$17$$$ grams, and a pack $$$119$$$ grams, then really Nastya could collect the whole pack.In the third test case of the example, we can assume that each grain weighs $$$16$$$ grams, and a pack $$$128$$$ grams, then really Nastya could col... | Java 8 | standard input | [
"math"
] | 30cfce44a7a0922929fbe54446986748 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The next $$$t$$$ lines contain descriptions of the test cases, each line contains $$$5$$$ integers: $$$n$$$ $$$(1 \leq n \leq 1000)$$$ — the number of grains that Nastya ... | 900 | For each test case given in the input print "Yes", if the information about the weights is not inconsistent, and print "No" if $$$n$$$ grains with masses from $$$a - b$$$ to $$$a + b$$$ cannot make a package with a total mass from $$$c - d$$$ to $$$c + d$$$. | standard output | |
PASSED | 75c8559b7c7e2119120c8dfbf378414a | train_003.jsonl | 1587653100 | Nastya just made a huge mistake and dropped a whole package of rice on the floor. Mom will come soon. If she sees this, then Nastya will be punished.In total, Nastya dropped $$$n$$$ grains. Nastya read that each grain weighs some integer number of grams from $$$a - b$$$ to $$$a + b$$$, inclusive (numbers $$$a$$$ and $$... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main
{
public static void main(String[] args) throws IOException
{
Scan in = new Scan();
Print out = new Print();
int t = in.scanInt();
while(t-- > 0) {
int n = in.scanInt();
int a = in.scanInt();
int b = in.scanInt();
int c = in.scanInt();
i... | Java | ["5\n7 20 3 101 18\n11 11 10 234 2\n8 9 7 250 122\n19 41 21 321 10\n3 10 8 6 1"] | 1 second | ["Yes\nNo\nYes\nNo\nYes"] | NoteIn the first test case of the example, we can assume that each grain weighs $$$17$$$ grams, and a pack $$$119$$$ grams, then really Nastya could collect the whole pack.In the third test case of the example, we can assume that each grain weighs $$$16$$$ grams, and a pack $$$128$$$ grams, then really Nastya could col... | Java 8 | standard input | [
"math"
] | 30cfce44a7a0922929fbe54446986748 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The next $$$t$$$ lines contain descriptions of the test cases, each line contains $$$5$$$ integers: $$$n$$$ $$$(1 \leq n \leq 1000)$$$ — the number of grains that Nastya ... | 900 | For each test case given in the input print "Yes", if the information about the weights is not inconsistent, and print "No" if $$$n$$$ grains with masses from $$$a - b$$$ to $$$a + b$$$ cannot make a package with a total mass from $$$c - d$$$ to $$$c + d$$$. | standard output | |
PASSED | 09ab8d38f2a09ba0c02d2a2f32869c1d | train_003.jsonl | 1587653100 | Nastya just made a huge mistake and dropped a whole package of rice on the floor. Mom will come soon. If she sees this, then Nastya will be punished.In total, Nastya dropped $$$n$$$ grains. Nastya read that each grain weighs some integer number of grams from $$$a - b$$$ to $$$a + b$$$, inclusive (numbers $$$a$$$ and $$... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.*;
public class Main
{
public static void main(String[] args) throws IOException
{
Scanner input = new Scanner(System.in);
int test=input.nex... | Java | ["5\n7 20 3 101 18\n11 11 10 234 2\n8 9 7 250 122\n19 41 21 321 10\n3 10 8 6 1"] | 1 second | ["Yes\nNo\nYes\nNo\nYes"] | NoteIn the first test case of the example, we can assume that each grain weighs $$$17$$$ grams, and a pack $$$119$$$ grams, then really Nastya could collect the whole pack.In the third test case of the example, we can assume that each grain weighs $$$16$$$ grams, and a pack $$$128$$$ grams, then really Nastya could col... | Java 8 | standard input | [
"math"
] | 30cfce44a7a0922929fbe54446986748 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The next $$$t$$$ lines contain descriptions of the test cases, each line contains $$$5$$$ integers: $$$n$$$ $$$(1 \leq n \leq 1000)$$$ — the number of grains that Nastya ... | 900 | For each test case given in the input print "Yes", if the information about the weights is not inconsistent, and print "No" if $$$n$$$ grains with masses from $$$a - b$$$ to $$$a + b$$$ cannot make a package with a total mass from $$$c - d$$$ to $$$c + d$$$. | standard output | |
PASSED | 5cff12d022ba0954933f1f6d2bc1e1d5 | train_003.jsonl | 1587653100 | Nastya just made a huge mistake and dropped a whole package of rice on the floor. Mom will come soon. If she sees this, then Nastya will be punished.In total, Nastya dropped $$$n$$$ grains. Nastya read that each grain weighs some integer number of grams from $$$a - b$$$ to $$$a + b$$$, inclusive (numbers $$$a$$$ and $$... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String [] args ) {
Scanner scanner = new Scanner(System.in);
int t = scanner.nextInt();
for(int tt=0;tt<t;tt++) {
int n = scanner.nextInt();
int a = scanner.nextInt();
int b = scanner.nex... | Java | ["5\n7 20 3 101 18\n11 11 10 234 2\n8 9 7 250 122\n19 41 21 321 10\n3 10 8 6 1"] | 1 second | ["Yes\nNo\nYes\nNo\nYes"] | NoteIn the first test case of the example, we can assume that each grain weighs $$$17$$$ grams, and a pack $$$119$$$ grams, then really Nastya could collect the whole pack.In the third test case of the example, we can assume that each grain weighs $$$16$$$ grams, and a pack $$$128$$$ grams, then really Nastya could col... | Java 8 | standard input | [
"math"
] | 30cfce44a7a0922929fbe54446986748 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The next $$$t$$$ lines contain descriptions of the test cases, each line contains $$$5$$$ integers: $$$n$$$ $$$(1 \leq n \leq 1000)$$$ — the number of grains that Nastya ... | 900 | For each test case given in the input print "Yes", if the information about the weights is not inconsistent, and print "No" if $$$n$$$ grains with masses from $$$a - b$$$ to $$$a + b$$$ cannot make a package with a total mass from $$$c - d$$$ to $$$c + d$$$. | standard output | |
PASSED | f4c4233a433cc40a0ebf732ef845e3e0 | train_003.jsonl | 1587653100 | Nastya just made a huge mistake and dropped a whole package of rice on the floor. Mom will come soon. If she sees this, then Nastya will be punished.In total, Nastya dropped $$$n$$$ grains. Nastya read that each grain weighs some integer number of grams from $$$a - b$$$ to $$$a + b$$$, inclusive (numbers $$$a$$$ and $$... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
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.IOExc... | Java | ["5\n7 20 3 101 18\n11 11 10 234 2\n8 9 7 250 122\n19 41 21 321 10\n3 10 8 6 1"] | 1 second | ["Yes\nNo\nYes\nNo\nYes"] | NoteIn the first test case of the example, we can assume that each grain weighs $$$17$$$ grams, and a pack $$$119$$$ grams, then really Nastya could collect the whole pack.In the third test case of the example, we can assume that each grain weighs $$$16$$$ grams, and a pack $$$128$$$ grams, then really Nastya could col... | Java 8 | standard input | [
"math"
] | 30cfce44a7a0922929fbe54446986748 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The next $$$t$$$ lines contain descriptions of the test cases, each line contains $$$5$$$ integers: $$$n$$$ $$$(1 \leq n \leq 1000)$$$ — the number of grains that Nastya ... | 900 | For each test case given in the input print "Yes", if the information about the weights is not inconsistent, and print "No" if $$$n$$$ grains with masses from $$$a - b$$$ to $$$a + b$$$ cannot make a package with a total mass from $$$c - d$$$ to $$$c + d$$$. | standard output | |
PASSED | b25b4f10ca5514f28a2b895f7f2ff82a | train_003.jsonl | 1587653100 | Nastya just made a huge mistake and dropped a whole package of rice on the floor. Mom will come soon. If she sees this, then Nastya will be punished.In total, Nastya dropped $$$n$$$ grains. Nastya read that each grain weighs some integer number of grams from $$$a - b$$$ to $$$a + b$$$, inclusive (numbers $$$a$$$ and $$... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main
{
public static void main(String args[])throws Exception
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw=new PrintWriter(System.out);
int t=Integer.parseInt(br.readLine());
for(int x=... | Java | ["5\n7 20 3 101 18\n11 11 10 234 2\n8 9 7 250 122\n19 41 21 321 10\n3 10 8 6 1"] | 1 second | ["Yes\nNo\nYes\nNo\nYes"] | NoteIn the first test case of the example, we can assume that each grain weighs $$$17$$$ grams, and a pack $$$119$$$ grams, then really Nastya could collect the whole pack.In the third test case of the example, we can assume that each grain weighs $$$16$$$ grams, and a pack $$$128$$$ grams, then really Nastya could col... | Java 8 | standard input | [
"math"
] | 30cfce44a7a0922929fbe54446986748 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The next $$$t$$$ lines contain descriptions of the test cases, each line contains $$$5$$$ integers: $$$n$$$ $$$(1 \leq n \leq 1000)$$$ — the number of grains that Nastya ... | 900 | For each test case given in the input print "Yes", if the information about the weights is not inconsistent, and print "No" if $$$n$$$ grains with masses from $$$a - b$$$ to $$$a + b$$$ cannot make a package with a total mass from $$$c - d$$$ to $$$c + d$$$. | standard output | |
PASSED | 90d3c37303b92428b09d6602e055e784 | train_003.jsonl | 1587653100 | Nastya just made a huge mistake and dropped a whole package of rice on the floor. Mom will come soon. If she sees this, then Nastya will be punished.In total, Nastya dropped $$$n$$$ grains. Nastya read that each grain weighs some integer number of grams from $$$a - b$$$ to $$$a + b$$$, inclusive (numbers $$$a$$$ and $$... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
public class NastyaandRice_CodeForces {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System... | Java | ["5\n7 20 3 101 18\n11 11 10 234 2\n8 9 7 250 122\n19 41 21 321 10\n3 10 8 6 1"] | 1 second | ["Yes\nNo\nYes\nNo\nYes"] | NoteIn the first test case of the example, we can assume that each grain weighs $$$17$$$ grams, and a pack $$$119$$$ grams, then really Nastya could collect the whole pack.In the third test case of the example, we can assume that each grain weighs $$$16$$$ grams, and a pack $$$128$$$ grams, then really Nastya could col... | Java 8 | standard input | [
"math"
] | 30cfce44a7a0922929fbe54446986748 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The next $$$t$$$ lines contain descriptions of the test cases, each line contains $$$5$$$ integers: $$$n$$$ $$$(1 \leq n \leq 1000)$$$ — the number of grains that Nastya ... | 900 | For each test case given in the input print "Yes", if the information about the weights is not inconsistent, and print "No" if $$$n$$$ grains with masses from $$$a - b$$$ to $$$a + b$$$ cannot make a package with a total mass from $$$c - d$$$ to $$$c + d$$$. | standard output | |
PASSED | ffbc68bd87b3faf9e7d25b61d1b265ea | train_003.jsonl | 1587653100 | Nastya just made a huge mistake and dropped a whole package of rice on the floor. Mom will come soon. If she sees this, then Nastya will be punished.In total, Nastya dropped $$$n$$$ grains. Nastya read that each grain weighs some integer number of grams from $$$a - b$$$ to $$$a + b$$$, inclusive (numbers $$$a$$$ and $$... | 256 megabytes | import java.util.Scanner;
public class NastyaAndRice {
static void findAnswer(int n, int a, int b, int c, int d) {
int L = n*(a-b);
int R = n*(a+b);
if(R < (c-d) || (c+d) < L) {
System.out.println("No");
}else {
System.out.println("Yes");
}
}
public static void main(String [] args) {
Scanner sc... | Java | ["5\n7 20 3 101 18\n11 11 10 234 2\n8 9 7 250 122\n19 41 21 321 10\n3 10 8 6 1"] | 1 second | ["Yes\nNo\nYes\nNo\nYes"] | NoteIn the first test case of the example, we can assume that each grain weighs $$$17$$$ grams, and a pack $$$119$$$ grams, then really Nastya could collect the whole pack.In the third test case of the example, we can assume that each grain weighs $$$16$$$ grams, and a pack $$$128$$$ grams, then really Nastya could col... | Java 8 | standard input | [
"math"
] | 30cfce44a7a0922929fbe54446986748 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The next $$$t$$$ lines contain descriptions of the test cases, each line contains $$$5$$$ integers: $$$n$$$ $$$(1 \leq n \leq 1000)$$$ — the number of grains that Nastya ... | 900 | For each test case given in the input print "Yes", if the information about the weights is not inconsistent, and print "No" if $$$n$$$ grains with masses from $$$a - b$$$ to $$$a + b$$$ cannot make a package with a total mass from $$$c - d$$$ to $$$c + d$$$. | standard output | |
PASSED | 3dae6c79ff877ff6f8f1c6c5a12a62fe | train_003.jsonl | 1587653100 | Nastya just made a huge mistake and dropped a whole package of rice on the floor. Mom will come soon. If she sees this, then Nastya will be punished.In total, Nastya dropped $$$n$$$ grains. Nastya read that each grain weighs some integer number of grams from $$$a - b$$$ to $$$a + b$$$, inclusive (numbers $$$a$$$ and $$... | 256 megabytes | import java.io.*;
import java.util.*;
public class Rice
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0)
{
int n=sc.nextInt();
int a=sc.nextInt();
int b=sc.nextInt();
int... | Java | ["5\n7 20 3 101 18\n11 11 10 234 2\n8 9 7 250 122\n19 41 21 321 10\n3 10 8 6 1"] | 1 second | ["Yes\nNo\nYes\nNo\nYes"] | NoteIn the first test case of the example, we can assume that each grain weighs $$$17$$$ grams, and a pack $$$119$$$ grams, then really Nastya could collect the whole pack.In the third test case of the example, we can assume that each grain weighs $$$16$$$ grams, and a pack $$$128$$$ grams, then really Nastya could col... | Java 8 | standard input | [
"math"
] | 30cfce44a7a0922929fbe54446986748 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The next $$$t$$$ lines contain descriptions of the test cases, each line contains $$$5$$$ integers: $$$n$$$ $$$(1 \leq n \leq 1000)$$$ — the number of grains that Nastya ... | 900 | For each test case given in the input print "Yes", if the information about the weights is not inconsistent, and print "No" if $$$n$$$ grains with masses from $$$a - b$$$ to $$$a + b$$$ cannot make a package with a total mass from $$$c - d$$$ to $$$c + d$$$. | standard output | |
PASSED | fe42600b8fbf2c752a052e74dd7fd284 | train_003.jsonl | 1587653100 | Nastya just made a huge mistake and dropped a whole package of rice on the floor. Mom will come soon. If she sees this, then Nastya will be punished.In total, Nastya dropped $$$n$$$ grains. Nastya read that each grain weighs some integer number of grams from $$$a - b$$$ to $$$a + b$$$, inclusive (numbers $$$a$$$ and $$... | 256 megabytes | import java.util.*;
public class CD2
{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t =sc.nextInt();
while(t-->0)
{
int n =sc.nextInt();
int a =sc.nextInt();
int b =sc.nextInt();
int c =sc.nextInt();
int d =sc.nextInt();
int r1=n*(a-b);
int r2=n*(a+b);
if(c-d>r2 || c+d<r1)
System.out... | Java | ["5\n7 20 3 101 18\n11 11 10 234 2\n8 9 7 250 122\n19 41 21 321 10\n3 10 8 6 1"] | 1 second | ["Yes\nNo\nYes\nNo\nYes"] | NoteIn the first test case of the example, we can assume that each grain weighs $$$17$$$ grams, and a pack $$$119$$$ grams, then really Nastya could collect the whole pack.In the third test case of the example, we can assume that each grain weighs $$$16$$$ grams, and a pack $$$128$$$ grams, then really Nastya could col... | Java 8 | standard input | [
"math"
] | 30cfce44a7a0922929fbe54446986748 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The next $$$t$$$ lines contain descriptions of the test cases, each line contains $$$5$$$ integers: $$$n$$$ $$$(1 \leq n \leq 1000)$$$ — the number of grains that Nastya ... | 900 | For each test case given in the input print "Yes", if the information about the weights is not inconsistent, and print "No" if $$$n$$$ grains with masses from $$$a - b$$$ to $$$a + b$$$ cannot make a package with a total mass from $$$c - d$$$ to $$$c + d$$$. | standard output | |
PASSED | 81705e3e78f083523ab1c67c5e1f94e0 | train_003.jsonl | 1587653100 | Nastya just made a huge mistake and dropped a whole package of rice on the floor. Mom will come soon. If she sees this, then Nastya will be punished.In total, Nastya dropped $$$n$$$ grains. Nastya read that each grain weighs some integer number of grams from $$$a - b$$$ to $$$a + b$$$, inclusive (numbers $$$a$$$ and $$... | 256 megabytes | import java.util.Scanner;
public class que1 {
public static void main(String[] args) {
Scanner scn=new Scanner(System.in);
int test=scn.nextInt();
StringBuilder sb=new StringBuilder();
for(int t=0;t<test;t++){
int n=scn.nextInt();
int a=scn.nextInt();
int b=scn.nextInt();
int c=sc... | Java | ["5\n7 20 3 101 18\n11 11 10 234 2\n8 9 7 250 122\n19 41 21 321 10\n3 10 8 6 1"] | 1 second | ["Yes\nNo\nYes\nNo\nYes"] | NoteIn the first test case of the example, we can assume that each grain weighs $$$17$$$ grams, and a pack $$$119$$$ grams, then really Nastya could collect the whole pack.In the third test case of the example, we can assume that each grain weighs $$$16$$$ grams, and a pack $$$128$$$ grams, then really Nastya could col... | Java 8 | standard input | [
"math"
] | 30cfce44a7a0922929fbe54446986748 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The next $$$t$$$ lines contain descriptions of the test cases, each line contains $$$5$$$ integers: $$$n$$$ $$$(1 \leq n \leq 1000)$$$ — the number of grains that Nastya ... | 900 | For each test case given in the input print "Yes", if the information about the weights is not inconsistent, and print "No" if $$$n$$$ grains with masses from $$$a - b$$$ to $$$a + b$$$ cannot make a package with a total mass from $$$c - d$$$ to $$$c + d$$$. | standard output | |
PASSED | 137d9df52d0966684c560f0c5ed4cf03 | train_003.jsonl | 1587653100 | Nastya just made a huge mistake and dropped a whole package of rice on the floor. Mom will come soon. If she sees this, then Nastya will be punished.In total, Nastya dropped $$$n$$$ grains. Nastya read that each grain weighs some integer number of grams from $$$a - b$$$ to $$$a + b$$$, inclusive (numbers $$$a$$$ and $$... | 256 megabytes |
import java.util.*;
public class file{
public static void main(String[] args){
Scanner scan=new Scanner(System.in);
int test=scan.nextInt();
for(int i=0;i<test;i++){
int num=scan.nextInt();
int a=scan.nextInt();
int b=scan.nextInt();
int c=scan.nextInt();
int d=scan.nextInt();
int m=Math.abs(a-b);
int n=a+b;
int o=Ma... | Java | ["5\n7 20 3 101 18\n11 11 10 234 2\n8 9 7 250 122\n19 41 21 321 10\n3 10 8 6 1"] | 1 second | ["Yes\nNo\nYes\nNo\nYes"] | NoteIn the first test case of the example, we can assume that each grain weighs $$$17$$$ grams, and a pack $$$119$$$ grams, then really Nastya could collect the whole pack.In the third test case of the example, we can assume that each grain weighs $$$16$$$ grams, and a pack $$$128$$$ grams, then really Nastya could col... | Java 8 | standard input | [
"math"
] | 30cfce44a7a0922929fbe54446986748 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The next $$$t$$$ lines contain descriptions of the test cases, each line contains $$$5$$$ integers: $$$n$$$ $$$(1 \leq n \leq 1000)$$$ — the number of grains that Nastya ... | 900 | For each test case given in the input print "Yes", if the information about the weights is not inconsistent, and print "No" if $$$n$$$ grains with masses from $$$a - b$$$ to $$$a + b$$$ cannot make a package with a total mass from $$$c - d$$$ to $$$c + d$$$. | standard output | |
PASSED | 350072e55c87e5621c116189070d99ef | train_003.jsonl | 1587653100 | Nastya just made a huge mistake and dropped a whole package of rice on the floor. Mom will come soon. If she sees this, then Nastya will be punished.In total, Nastya dropped $$$n$$$ grains. Nastya read that each grain weighs some integer number of grams from $$$a - b$$$ to $$$a + b$$$, inclusive (numbers $$$a$$$ and $$... | 256 megabytes |
import java.util.*;
public class nastyaAndRice {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t,a,b,c,d,n;
t=sc.nextInt();
while(t-->0)
{
n=sc.nextInt();
a=sc.nextInt();
b=sc.nextInt();
c=sc.nextInt();
d=sc.nextInt();
if((a-b)*n<=(c+d) ... | Java | ["5\n7 20 3 101 18\n11 11 10 234 2\n8 9 7 250 122\n19 41 21 321 10\n3 10 8 6 1"] | 1 second | ["Yes\nNo\nYes\nNo\nYes"] | NoteIn the first test case of the example, we can assume that each grain weighs $$$17$$$ grams, and a pack $$$119$$$ grams, then really Nastya could collect the whole pack.In the third test case of the example, we can assume that each grain weighs $$$16$$$ grams, and a pack $$$128$$$ grams, then really Nastya could col... | Java 8 | standard input | [
"math"
] | 30cfce44a7a0922929fbe54446986748 | The input consists of multiple test cases. The first line contains a single integer $$$t$$$ $$$(1 \leq t \leq 1000)$$$ — the number of test cases. The next $$$t$$$ lines contain descriptions of the test cases, each line contains $$$5$$$ integers: $$$n$$$ $$$(1 \leq n \leq 1000)$$$ — the number of grains that Nastya ... | 900 | For each test case given in the input print "Yes", if the information about the weights is not inconsistent, and print "No" if $$$n$$$ grains with masses from $$$a - b$$$ to $$$a + b$$$ cannot make a package with a total mass from $$$c - d$$$ to $$$c + d$$$. | standard output | |
PASSED | 2a7c1b8c73d36c1c3e85e7c84b4a3278 | train_003.jsonl | 1499958300 | Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i. e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol... | 256 megabytes | import java.io.*;
import java.util.*;
public class Codeforces831C {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int k = Integer.parseInt(st.nextToken());
int n = ... | Java | ["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"] | 2 seconds | ["3", "1"] | NoteThe answer for the first example is 3 because initially the participant could have - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000. | Java 8 | standard input | [
"constructive algorithms",
"brute force"
] | 6e5b5d357e01d86e1a6dfe7957f57876 | The first line contains two integers k and n (1 ≤ n ≤ k ≤ 2 000) — the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≤ ai ≤ 2 000) — jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ... | 1,700 | Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes). | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.