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 | 809e22f43d7442dc9a3b263b01590c06 | train_000.jsonl | 1540740900 | Janusz is a businessman. He owns a company "Januszex", which produces games for teenagers. Last hit of Januszex was a cool one-person game "Make it one". The player is given a sequence of $$$n$$$ integers $$$a_i$$$.It is allowed to select any subset of them, and the score is equal to the greatest common divisor of sele... | 256 megabytes | import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.System.exit;
import static java.util.Arrays.fill;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
im... | Java | ["3\n10 6 15", "3\n2 4 6", "7\n30 60 21 42 70 15 30"] | 3 seconds | ["3", "-1", "3"] | NoteIn the first example, selecting a subset of all numbers gives a gcd of $$$1$$$ and for all smaller subsets the gcd is greater than $$$1$$$.In the second example, for all subsets of numbers the gcd is at least $$$2$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"number theory",
"bitmasks",
"shortest paths",
"math"
] | 3baa00206d3bf03ce02a414747e2a633 | The first line contains an only integer $$$n$$$ ($$$1 \le n \le 300\,000$$$) — the number of integers in the sequence. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 300\,000$$$). | 2,500 | If there is no subset of the given sequence with gcd equal to $$$1$$$, output -1. Otherwise, output exactly one integer — the size of the smallest subset with gcd equal to $$$1$$$. | standard output | |
PASSED | 6273b8cd600e83dce2c543cf3a091a99 | train_000.jsonl | 1540740900 | Janusz is a businessman. He owns a company "Januszex", which produces games for teenagers. Last hit of Januszex was a cool one-person game "Make it one". The player is given a sequence of $$$n$$$ integers $$$a_i$$$.It is allowed to select any subset of them, and the score is equal to the greatest common divisor of sele... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Arrays;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.io.Closeable;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;
/**... | Java | ["3\n10 6 15", "3\n2 4 6", "7\n30 60 21 42 70 15 30"] | 3 seconds | ["3", "-1", "3"] | NoteIn the first example, selecting a subset of all numbers gives a gcd of $$$1$$$ and for all smaller subsets the gcd is greater than $$$1$$$.In the second example, for all subsets of numbers the gcd is at least $$$2$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"number theory",
"bitmasks",
"shortest paths",
"math"
] | 3baa00206d3bf03ce02a414747e2a633 | The first line contains an only integer $$$n$$$ ($$$1 \le n \le 300\,000$$$) — the number of integers in the sequence. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 300\,000$$$). | 2,500 | If there is no subset of the given sequence with gcd equal to $$$1$$$, output -1. Otherwise, output exactly one integer — the size of the smallest subset with gcd equal to $$$1$$$. | standard output | |
PASSED | 7194aba9d2ee6b56b797160b12d12a8b | train_000.jsonl | 1540740900 | Janusz is a businessman. He owns a company "Januszex", which produces games for teenagers. Last hit of Januszex was a cool one-person game "Make it one". The player is given a sequence of $$$n$$$ integers $$$a_i$$$.It is allowed to select any subset of them, and the score is equal to the greatest common divisor of sele... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Arrays;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.io.Closeable;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;
/**... | Java | ["3\n10 6 15", "3\n2 4 6", "7\n30 60 21 42 70 15 30"] | 3 seconds | ["3", "-1", "3"] | NoteIn the first example, selecting a subset of all numbers gives a gcd of $$$1$$$ and for all smaller subsets the gcd is greater than $$$1$$$.In the second example, for all subsets of numbers the gcd is at least $$$2$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"number theory",
"bitmasks",
"shortest paths",
"math"
] | 3baa00206d3bf03ce02a414747e2a633 | The first line contains an only integer $$$n$$$ ($$$1 \le n \le 300\,000$$$) — the number of integers in the sequence. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 300\,000$$$). | 2,500 | If there is no subset of the given sequence with gcd equal to $$$1$$$, output -1. Otherwise, output exactly one integer — the size of the smallest subset with gcd equal to $$$1$$$. | standard output | |
PASSED | 9de43b67cc465d569284aa253cd1be4f | train_000.jsonl | 1540740900 | Janusz is a businessman. He owns a company "Januszex", which produces games for teenagers. Last hit of Januszex was a cool one-person game "Make it one". The player is given a sequence of $$$n$$$ integers $$$a_i$$$.It is allowed to select any subset of them, and the score is equal to the greatest common divisor of sele... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.security.SecureRandom;
import java.util.Li... | Java | ["3\n10 6 15", "3\n2 4 6", "7\n30 60 21 42 70 15 30"] | 3 seconds | ["3", "-1", "3"] | NoteIn the first example, selecting a subset of all numbers gives a gcd of $$$1$$$ and for all smaller subsets the gcd is greater than $$$1$$$.In the second example, for all subsets of numbers the gcd is at least $$$2$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"number theory",
"bitmasks",
"shortest paths",
"math"
] | 3baa00206d3bf03ce02a414747e2a633 | The first line contains an only integer $$$n$$$ ($$$1 \le n \le 300\,000$$$) — the number of integers in the sequence. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 300\,000$$$). | 2,500 | If there is no subset of the given sequence with gcd equal to $$$1$$$, output -1. Otherwise, output exactly one integer — the size of the smallest subset with gcd equal to $$$1$$$. | standard output | |
PASSED | 40a88f95fce9c92b8b90fa3211ca0575 | train_000.jsonl | 1540740900 | Janusz is a businessman. He owns a company "Januszex", which produces games for teenagers. Last hit of Januszex was a cool one-person game "Make it one". The player is given a sequence of $$$n$$$ integers $$$a_i$$$.It is allowed to select any subset of them, and the score is equal to the greatest common divisor of sele... | 256 megabytes | //package com.company;
import java.io.*;
import java.util.*;
public class Main {
static long TIME_START, TIME_END;
public static class Task {
int N = 300001;
public class Factor {
int[] factors;
List<Integer> primes;
List<Integer>[] allDivisors;
... | Java | ["3\n10 6 15", "3\n2 4 6", "7\n30 60 21 42 70 15 30"] | 3 seconds | ["3", "-1", "3"] | NoteIn the first example, selecting a subset of all numbers gives a gcd of $$$1$$$ and for all smaller subsets the gcd is greater than $$$1$$$.In the second example, for all subsets of numbers the gcd is at least $$$2$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"number theory",
"bitmasks",
"shortest paths",
"math"
] | 3baa00206d3bf03ce02a414747e2a633 | The first line contains an only integer $$$n$$$ ($$$1 \le n \le 300\,000$$$) — the number of integers in the sequence. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 300\,000$$$). | 2,500 | If there is no subset of the given sequence with gcd equal to $$$1$$$, output -1. Otherwise, output exactly one integer — the size of the smallest subset with gcd equal to $$$1$$$. | standard output | |
PASSED | 368de4d3913800438eecca500658c34e | train_000.jsonl | 1540740900 | Janusz is a businessman. He owns a company "Januszex", which produces games for teenagers. Last hit of Januszex was a cool one-person game "Make it one". The player is given a sequence of $$$n$$$ integers $$$a_i$$$.It is allowed to select any subset of them, and the score is equal to the greatest common divisor of sele... | 256 megabytes | /**
* BaZ :D
*/
import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main
{
static Reader scan;
static PrintWriter pw;
static long MOD = 1_000_000_007, temp;
static long fact[] = new long[1000001];
static long invfact[] = new long[1000001];
static long inv[] = new... | Java | ["3\n10 6 15", "3\n2 4 6", "7\n30 60 21 42 70 15 30"] | 3 seconds | ["3", "-1", "3"] | NoteIn the first example, selecting a subset of all numbers gives a gcd of $$$1$$$ and for all smaller subsets the gcd is greater than $$$1$$$.In the second example, for all subsets of numbers the gcd is at least $$$2$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"number theory",
"bitmasks",
"shortest paths",
"math"
] | 3baa00206d3bf03ce02a414747e2a633 | The first line contains an only integer $$$n$$$ ($$$1 \le n \le 300\,000$$$) — the number of integers in the sequence. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 300\,000$$$). | 2,500 | If there is no subset of the given sequence with gcd equal to $$$1$$$, output -1. Otherwise, output exactly one integer — the size of the smallest subset with gcd equal to $$$1$$$. | standard output | |
PASSED | 1f9afe2fec674192d6b3262b604cb3d1 | train_000.jsonl | 1540740900 | Janusz is a businessman. He owns a company "Januszex", which produces games for teenagers. Last hit of Januszex was a cool one-person game "Make it one". The player is given a sequence of $$$n$$$ integers $$$a_i$$$.It is allowed to select any subset of them, and the score is equal to the greatest common divisor of sele... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashSet;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOExcep... | Java | ["3\n10 6 15", "3\n2 4 6", "7\n30 60 21 42 70 15 30"] | 3 seconds | ["3", "-1", "3"] | NoteIn the first example, selecting a subset of all numbers gives a gcd of $$$1$$$ and for all smaller subsets the gcd is greater than $$$1$$$.In the second example, for all subsets of numbers the gcd is at least $$$2$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"number theory",
"bitmasks",
"shortest paths",
"math"
] | 3baa00206d3bf03ce02a414747e2a633 | The first line contains an only integer $$$n$$$ ($$$1 \le n \le 300\,000$$$) — the number of integers in the sequence. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 300\,000$$$). | 2,500 | If there is no subset of the given sequence with gcd equal to $$$1$$$, output -1. Otherwise, output exactly one integer — the size of the smallest subset with gcd equal to $$$1$$$. | standard output | |
PASSED | 6dc8f3708279b1a2915f9ca1c4851c27 | train_000.jsonl | 1540740900 | Janusz is a businessman. He owns a company "Januszex", which produces games for teenagers. Last hit of Januszex was a cool one-person game "Make it one". The player is given a sequence of $$$n$$$ integers $$$a_i$$$.It is allowed to select any subset of them, and the score is equal to the greatest common divisor of sele... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
import static java.lang.Math.*;
public class Main implements Runnable {
static class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numCha... | Java | ["3\n10 6 15", "3\n2 4 6", "7\n30 60 21 42 70 15 30"] | 3 seconds | ["3", "-1", "3"] | NoteIn the first example, selecting a subset of all numbers gives a gcd of $$$1$$$ and for all smaller subsets the gcd is greater than $$$1$$$.In the second example, for all subsets of numbers the gcd is at least $$$2$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"number theory",
"bitmasks",
"shortest paths",
"math"
] | 3baa00206d3bf03ce02a414747e2a633 | The first line contains an only integer $$$n$$$ ($$$1 \le n \le 300\,000$$$) — the number of integers in the sequence. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 300\,000$$$). | 2,500 | If there is no subset of the given sequence with gcd equal to $$$1$$$, output -1. Otherwise, output exactly one integer — the size of the smallest subset with gcd equal to $$$1$$$. | standard output | |
PASSED | 34cadfc1e1e85625ad7bd8640e76406c | train_000.jsonl | 1540740900 | Janusz is a businessman. He owns a company "Januszex", which produces games for teenagers. Last hit of Januszex was a cool one-person game "Make it one". The player is given a sequence of $$$n$$$ integers $$$a_i$$$.It is allowed to select any subset of them, and the score is equal to the greatest common divisor of sele... | 256 megabytes | //package round519;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class F {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
int n = ni();
int... | Java | ["3\n10 6 15", "3\n2 4 6", "7\n30 60 21 42 70 15 30"] | 3 seconds | ["3", "-1", "3"] | NoteIn the first example, selecting a subset of all numbers gives a gcd of $$$1$$$ and for all smaller subsets the gcd is greater than $$$1$$$.In the second example, for all subsets of numbers the gcd is at least $$$2$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"number theory",
"bitmasks",
"shortest paths",
"math"
] | 3baa00206d3bf03ce02a414747e2a633 | The first line contains an only integer $$$n$$$ ($$$1 \le n \le 300\,000$$$) — the number of integers in the sequence. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 300\,000$$$). | 2,500 | If there is no subset of the given sequence with gcd equal to $$$1$$$, output -1. Otherwise, output exactly one integer — the size of the smallest subset with gcd equal to $$$1$$$. | standard output | |
PASSED | f8083a7927b48331f77991094331cacc | train_000.jsonl | 1540740900 | Janusz is a businessman. He owns a company "Januszex", which produces games for teenagers. Last hit of Januszex was a cool one-person game "Make it one". The player is given a sequence of $$$n$$$ integers $$$a_i$$$.It is allowed to select any subset of them, and the score is equal to the greatest common divisor of sele... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class A {
public static void main (String[] args) { new A(); }
Random rand = new Random();
int MOD = BigInteger.valueOf(1000000000 + rand.nextInt(100000000)).nextProbablePrime().intValue();
int MAX = 300300;
int[] fact, invFact;
A() {... | Java | ["3\n10 6 15", "3\n2 4 6", "7\n30 60 21 42 70 15 30"] | 3 seconds | ["3", "-1", "3"] | NoteIn the first example, selecting a subset of all numbers gives a gcd of $$$1$$$ and for all smaller subsets the gcd is greater than $$$1$$$.In the second example, for all subsets of numbers the gcd is at least $$$2$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"number theory",
"bitmasks",
"shortest paths",
"math"
] | 3baa00206d3bf03ce02a414747e2a633 | The first line contains an only integer $$$n$$$ ($$$1 \le n \le 300\,000$$$) — the number of integers in the sequence. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 300\,000$$$). | 2,500 | If there is no subset of the given sequence with gcd equal to $$$1$$$, output -1. Otherwise, output exactly one integer — the size of the smallest subset with gcd equal to $$$1$$$. | standard output | |
PASSED | 457a68cb14105fb271b686b023b76273 | train_000.jsonl | 1540740900 | Janusz is a businessman. He owns a company "Januszex", which produces games for teenagers. Last hit of Januszex was a cool one-person game "Make it one". The player is given a sequence of $$$n$$$ integers $$$a_i$$$.It is allowed to select any subset of them, and the score is equal to the greatest common divisor of sele... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOExcept... | Java | ["3\n10 6 15", "3\n2 4 6", "7\n30 60 21 42 70 15 30"] | 3 seconds | ["3", "-1", "3"] | NoteIn the first example, selecting a subset of all numbers gives a gcd of $$$1$$$ and for all smaller subsets the gcd is greater than $$$1$$$.In the second example, for all subsets of numbers the gcd is at least $$$2$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"number theory",
"bitmasks",
"shortest paths",
"math"
] | 3baa00206d3bf03ce02a414747e2a633 | The first line contains an only integer $$$n$$$ ($$$1 \le n \le 300\,000$$$) — the number of integers in the sequence. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 300\,000$$$). | 2,500 | If there is no subset of the given sequence with gcd equal to $$$1$$$, output -1. Otherwise, output exactly one integer — the size of the smallest subset with gcd equal to $$$1$$$. | standard output | |
PASSED | aca48f99fc4a536d6ae96c8907876790 | train_000.jsonl | 1540740900 | Janusz is a businessman. He owns a company "Januszex", which produces games for teenagers. Last hit of Januszex was a cool one-person game "Make it one". The player is given a sequence of $$$n$$$ integers $$$a_i$$$.It is allowed to select any subset of them, and the score is equal to the greatest common divisor of sele... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;
/**
* @author khokharnikunj8
*/
public class Main {
public static void main(String[] args) {
... | Java | ["3\n10 6 15", "3\n2 4 6", "7\n30 60 21 42 70 15 30"] | 3 seconds | ["3", "-1", "3"] | NoteIn the first example, selecting a subset of all numbers gives a gcd of $$$1$$$ and for all smaller subsets the gcd is greater than $$$1$$$.In the second example, for all subsets of numbers the gcd is at least $$$2$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"number theory",
"bitmasks",
"shortest paths",
"math"
] | 3baa00206d3bf03ce02a414747e2a633 | The first line contains an only integer $$$n$$$ ($$$1 \le n \le 300\,000$$$) — the number of integers in the sequence. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 300\,000$$$). | 2,500 | If there is no subset of the given sequence with gcd equal to $$$1$$$, output -1. Otherwise, output exactly one integer — the size of the smallest subset with gcd equal to $$$1$$$. | standard output | |
PASSED | 411c392e97db0926560b793910b92c0b | train_000.jsonl | 1540740900 | Janusz is a businessman. He owns a company "Januszex", which produces games for teenagers. Last hit of Januszex was a cool one-person game "Make it one". The player is given a sequence of $$$n$$$ integers $$$a_i$$$.It is allowed to select any subset of them, and the score is equal to the greatest common divisor of sele... | 256 megabytes | //package que_a;
import java.io.*;
import java.util.*;
import java.math.*;
public class utkarsh {
InputStream is;
PrintWriter out;
long mod = (long) (1e9 + 7), inf = (long) (3e18);
void solve() {
int n = ni();
int a[] = na(n);
int gcd = a[0];
for(int x : a) ... | Java | ["3\n10 6 15", "3\n2 4 6", "7\n30 60 21 42 70 15 30"] | 3 seconds | ["3", "-1", "3"] | NoteIn the first example, selecting a subset of all numbers gives a gcd of $$$1$$$ and for all smaller subsets the gcd is greater than $$$1$$$.In the second example, for all subsets of numbers the gcd is at least $$$2$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"number theory",
"bitmasks",
"shortest paths",
"math"
] | 3baa00206d3bf03ce02a414747e2a633 | The first line contains an only integer $$$n$$$ ($$$1 \le n \le 300\,000$$$) — the number of integers in the sequence. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 300\,000$$$). | 2,500 | If there is no subset of the given sequence with gcd equal to $$$1$$$, output -1. Otherwise, output exactly one integer — the size of the smallest subset with gcd equal to $$$1$$$. | standard output | |
PASSED | 09085302c5da533209da4defb95ae4e0 | train_000.jsonl | 1540740900 | Janusz is a businessman. He owns a company "Januszex", which produces games for teenagers. Last hit of Januszex was a cool one-person game "Make it one". The player is given a sequence of $$$n$$$ integers $$$a_i$$$.It is allowed to select any subset of them, and the score is equal to the greatest common divisor of sele... | 256 megabytes | import java.lang.*;
import java.math.*;
import java.util.*;
import java.io.*;
public class Main {
void solve() {
int n=ni();
HashSet<Integer>hs=new HashSet<>();
for(int i=1;i<=n;i++){
int a=ni();
int num=1;
for(int j=2;j*j<=a;j++){
if(a%j==... | Java | ["3\n10 6 15", "3\n2 4 6", "7\n30 60 21 42 70 15 30"] | 3 seconds | ["3", "-1", "3"] | NoteIn the first example, selecting a subset of all numbers gives a gcd of $$$1$$$ and for all smaller subsets the gcd is greater than $$$1$$$.In the second example, for all subsets of numbers the gcd is at least $$$2$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"number theory",
"bitmasks",
"shortest paths",
"math"
] | 3baa00206d3bf03ce02a414747e2a633 | The first line contains an only integer $$$n$$$ ($$$1 \le n \le 300\,000$$$) — the number of integers in the sequence. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 300\,000$$$). | 2,500 | If there is no subset of the given sequence with gcd equal to $$$1$$$, output -1. Otherwise, output exactly one integer — the size of the smallest subset with gcd equal to $$$1$$$. | standard output | |
PASSED | 4901c3a8cbc837be2d00611ae622b539 | train_000.jsonl | 1540740900 | Janusz is a businessman. He owns a company "Januszex", which produces games for teenagers. Last hit of Januszex was a cool one-person game "Make it one". The player is given a sequence of $$$n$$$ integers $$$a_i$$$.It is allowed to select any subset of them, and the score is equal to the greatest common divisor of sele... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper... | Java | ["3\n10 6 15", "3\n2 4 6", "7\n30 60 21 42 70 15 30"] | 3 seconds | ["3", "-1", "3"] | NoteIn the first example, selecting a subset of all numbers gives a gcd of $$$1$$$ and for all smaller subsets the gcd is greater than $$$1$$$.In the second example, for all subsets of numbers the gcd is at least $$$2$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"number theory",
"bitmasks",
"shortest paths",
"math"
] | 3baa00206d3bf03ce02a414747e2a633 | The first line contains an only integer $$$n$$$ ($$$1 \le n \le 300\,000$$$) — the number of integers in the sequence. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 300\,000$$$). | 2,500 | If there is no subset of the given sequence with gcd equal to $$$1$$$, output -1. Otherwise, output exactly one integer — the size of the smallest subset with gcd equal to $$$1$$$. | standard output | |
PASSED | f30c1a3d211a17086b7a46cf3d5317bf | train_000.jsonl | 1277823600 | Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of se... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
// static LinkedList<Integer> adj[];
// static boolean cats[];
// static boolean visited[];
public static void main(String[] args)
{
FastScanner sc = new FastScanner();
long n = sc.nextLong();
long m = sc.nextLong();
... | Java | ["5 6 3", "6 100 1"] | 1 second | ["1 2\n2 3\n3 4\n4 5\n1 3\n3 5", "-1"] | null | Java 8 | standard input | [
"graphs"
] | 959709bfe7b26a4b9f2e7430350650a9 | The first input line contains 3 space-separated integer numbers n, m, v (3 ≤ n ≤ 105, 0 ≤ m ≤ 105, 1 ≤ v ≤ n), n — amount of servers, m — amount of direct connections, v — index of the server that fails and leads to the failure of the whole system. | 1,700 | If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from ... | standard output | |
PASSED | 5ec6f2e851fa7024a99b96f7332e40c7 | train_000.jsonl | 1277823600 | Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of se... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
// static LinkedList<Integer> adj[];
// static boolean cats[];
// static boolean visited[];
public static void main(String[] args)
{
FastScanner sc = new FastScanner();
long n = sc.nextLong();
long m = sc.nextLong();
... | Java | ["5 6 3", "6 100 1"] | 1 second | ["1 2\n2 3\n3 4\n4 5\n1 3\n3 5", "-1"] | null | Java 8 | standard input | [
"graphs"
] | 959709bfe7b26a4b9f2e7430350650a9 | The first input line contains 3 space-separated integer numbers n, m, v (3 ≤ n ≤ 105, 0 ≤ m ≤ 105, 1 ≤ v ≤ n), n — amount of servers, m — amount of direct connections, v — index of the server that fails and leads to the failure of the whole system. | 1,700 | If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from ... | standard output | |
PASSED | 51297ece827c06da9285b0194881bbde | train_000.jsonl | 1277823600 | Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of se... | 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 system{
public static void main (String[]args) throws IOException{
PrintWriter out=new PrintWriter(System.out);
Scanne... | Java | ["5 6 3", "6 100 1"] | 1 second | ["1 2\n2 3\n3 4\n4 5\n1 3\n3 5", "-1"] | null | Java 8 | standard input | [
"graphs"
] | 959709bfe7b26a4b9f2e7430350650a9 | The first input line contains 3 space-separated integer numbers n, m, v (3 ≤ n ≤ 105, 0 ≤ m ≤ 105, 1 ≤ v ≤ n), n — amount of servers, m — amount of direct connections, v — index of the server that fails and leads to the failure of the whole system. | 1,700 | If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from ... | standard output | |
PASSED | 277f550027c2928392c0a184fc281592 | train_000.jsonl | 1277823600 | Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of se... | 256 megabytes |
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.util.Iterator;
import java.util.TreeSet... | Java | ["5 6 3", "6 100 1"] | 1 second | ["1 2\n2 3\n3 4\n4 5\n1 3\n3 5", "-1"] | null | Java 8 | standard input | [
"graphs"
] | 959709bfe7b26a4b9f2e7430350650a9 | The first input line contains 3 space-separated integer numbers n, m, v (3 ≤ n ≤ 105, 0 ≤ m ≤ 105, 1 ≤ v ≤ n), n — amount of servers, m — amount of direct connections, v — index of the server that fails and leads to the failure of the whole system. | 1,700 | If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from ... | standard output | |
PASSED | 525854291f3ea1033fdb300639306790 | train_000.jsonl | 1277823600 | Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of se... | 256 megabytes |
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays... | Java | ["5 6 3", "6 100 1"] | 1 second | ["1 2\n2 3\n3 4\n4 5\n1 3\n3 5", "-1"] | null | Java 8 | standard input | [
"graphs"
] | 959709bfe7b26a4b9f2e7430350650a9 | The first input line contains 3 space-separated integer numbers n, m, v (3 ≤ n ≤ 105, 0 ≤ m ≤ 105, 1 ≤ v ≤ n), n — amount of servers, m — amount of direct connections, v — index of the server that fails and leads to the failure of the whole system. | 1,700 | If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from ... | standard output | |
PASSED | e5018af40dddaae0ab9173ade504a557 | train_000.jsonl | 1277823600 | Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of se... | 256 megabytes | import java.io.*;
import java.util.*;
public class CF22C {
static int swap(int x, int a, int b) {
if (x == a)
return b;
if (x == b)
return a;
return x;
}
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
i... | Java | ["5 6 3", "6 100 1"] | 1 second | ["1 2\n2 3\n3 4\n4 5\n1 3\n3 5", "-1"] | null | Java 8 | standard input | [
"graphs"
] | 959709bfe7b26a4b9f2e7430350650a9 | The first input line contains 3 space-separated integer numbers n, m, v (3 ≤ n ≤ 105, 0 ≤ m ≤ 105, 1 ≤ v ≤ n), n — amount of servers, m — amount of direct connections, v — index of the server that fails and leads to the failure of the whole system. | 1,700 | If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from ... | standard output | |
PASSED | 4d82e7f7bdc3c1bd24dab7a960a40dcf | train_000.jsonl | 1277823600 | Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of se... | 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.Arrays;
import java.util.Collections;
import java.util.Stack;
import java.util.StringTokenizer;
public class Main
{
private static MyScanner sc;
... | Java | ["5 6 3", "6 100 1"] | 1 second | ["1 2\n2 3\n3 4\n4 5\n1 3\n3 5", "-1"] | null | Java 8 | standard input | [
"graphs"
] | 959709bfe7b26a4b9f2e7430350650a9 | The first input line contains 3 space-separated integer numbers n, m, v (3 ≤ n ≤ 105, 0 ≤ m ≤ 105, 1 ≤ v ≤ n), n — amount of servers, m — amount of direct connections, v — index of the server that fails and leads to the failure of the whole system. | 1,700 | If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from ... | standard output | |
PASSED | 74464dab8fba4572492c06a6cb6b31ba | train_000.jsonl | 1277823600 | Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of se... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main
{
static PrintWriter out;
static InputReader in;
static InputStream inputs;
public static void main(String[] args)
{
inputs = System.in;
in = new InputReader(inputs);
out = new PrintWriter(new BufferedOutputStrea... | Java | ["5 6 3", "6 100 1"] | 1 second | ["1 2\n2 3\n3 4\n4 5\n1 3\n3 5", "-1"] | null | Java 8 | standard input | [
"graphs"
] | 959709bfe7b26a4b9f2e7430350650a9 | The first input line contains 3 space-separated integer numbers n, m, v (3 ≤ n ≤ 105, 0 ≤ m ≤ 105, 1 ≤ v ≤ n), n — amount of servers, m — amount of direct connections, v — index of the server that fails and leads to the failure of the whole system. | 1,700 | If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from ... | standard output | |
PASSED | 12f48b89f1b41ceacdc0f4a5a235ecc2 | train_000.jsonl | 1277823600 | Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of se... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Random;
import java.util.StringTokeniz... | Java | ["5 6 3", "6 100 1"] | 1 second | ["1 2\n2 3\n3 4\n4 5\n1 3\n3 5", "-1"] | null | Java 8 | standard input | [
"graphs"
] | 959709bfe7b26a4b9f2e7430350650a9 | The first input line contains 3 space-separated integer numbers n, m, v (3 ≤ n ≤ 105, 0 ≤ m ≤ 105, 1 ≤ v ≤ n), n — amount of servers, m — amount of direct connections, v — index of the server that fails and leads to the failure of the whole system. | 1,700 | If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from ... | standard output | |
PASSED | 68ba5c40bf87911eb7f3eb9d58a5c7b4 | train_000.jsonl | 1277823600 | Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of se... | 256 megabytes | import java.io.*;
import java.util.*;
public class A {
public static void main(String[] args)throws Throwable {
MyScanner sc=new MyScanner();
PrintWriter pw=new PrintWriter(System.out);
int n=sc.nextInt();
int m=sc.nextInt();
int v=sc.nextInt()-1;
long max=1+(1L*(n-2)*(n-1))/2;
if(max<m || m<n-1){
... | Java | ["5 6 3", "6 100 1"] | 1 second | ["1 2\n2 3\n3 4\n4 5\n1 3\n3 5", "-1"] | null | Java 8 | standard input | [
"graphs"
] | 959709bfe7b26a4b9f2e7430350650a9 | The first input line contains 3 space-separated integer numbers n, m, v (3 ≤ n ≤ 105, 0 ≤ m ≤ 105, 1 ≤ v ≤ n), n — amount of servers, m — amount of direct connections, v — index of the server that fails and leads to the failure of the whole system. | 1,700 | If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from ... | standard output | |
PASSED | 3432f9046b67a246da2a4995b3d1b1f2 | train_000.jsonl | 1277823600 | Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of se... | 256 megabytes | // Name: Ibraheem Cazalas
// Date:
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
input.init(System.in);
int n = input.nextInt(), m = input.nextInt(), v = input.nextInt();
if (m < (n - 1) || m > ((n-1)+(n-3)*(n-3+1)/2)) {
System.out.p... | Java | ["5 6 3", "6 100 1"] | 1 second | ["1 2\n2 3\n3 4\n4 5\n1 3\n3 5", "-1"] | null | Java 8 | standard input | [
"graphs"
] | 959709bfe7b26a4b9f2e7430350650a9 | The first input line contains 3 space-separated integer numbers n, m, v (3 ≤ n ≤ 105, 0 ≤ m ≤ 105, 1 ≤ v ≤ n), n — amount of servers, m — amount of direct connections, v — index of the server that fails and leads to the failure of the whole system. | 1,700 | If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from ... | standard output | |
PASSED | e7ffacb15b53d0a6b5be155aa1822d49 | train_000.jsonl | 1277823600 | Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of se... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
InputStream inputStream = System.in;
// InputStream inputStream = new FileInputStream("sum.in");
OutputStream outputStream = System.out;
// OutputStream outputStream =... | Java | ["5 6 3", "6 100 1"] | 1 second | ["1 2\n2 3\n3 4\n4 5\n1 3\n3 5", "-1"] | null | Java 8 | standard input | [
"graphs"
] | 959709bfe7b26a4b9f2e7430350650a9 | The first input line contains 3 space-separated integer numbers n, m, v (3 ≤ n ≤ 105, 0 ≤ m ≤ 105, 1 ≤ v ≤ n), n — amount of servers, m — amount of direct connections, v — index of the server that fails and leads to the failure of the whole system. | 1,700 | If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from ... | standard output | |
PASSED | aea1859b0cc3058499730c4c0c31c1b9 | train_000.jsonl | 1277823600 | Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of se... | 256 megabytes | import java.io.*;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;
public class Graph {
static Scanner sc = new Scanner(System.in);
static PrintWriter pw = new PrintWriter(System.out), ... | Java | ["5 6 3", "6 100 1"] | 1 second | ["1 2\n2 3\n3 4\n4 5\n1 3\n3 5", "-1"] | null | Java 8 | standard input | [
"graphs"
] | 959709bfe7b26a4b9f2e7430350650a9 | The first input line contains 3 space-separated integer numbers n, m, v (3 ≤ n ≤ 105, 0 ≤ m ≤ 105, 1 ≤ v ≤ n), n — amount of servers, m — amount of direct connections, v — index of the server that fails and leads to the failure of the whole system. | 1,700 | If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from ... | standard output | |
PASSED | 3605a6fce21cdc0392e075b6e855dc01 | train_000.jsonl | 1277823600 | Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of se... | 256 megabytes | import java.io.*;
public class SystemAdministrator {
public static void main(String args[]) throws IOException
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
//BufferedReader reader = new BufferedReader(new FileReader("servers"));
Strin... | Java | ["5 6 3", "6 100 1"] | 1 second | ["1 2\n2 3\n3 4\n4 5\n1 3\n3 5", "-1"] | null | Java 8 | standard input | [
"graphs"
] | 959709bfe7b26a4b9f2e7430350650a9 | The first input line contains 3 space-separated integer numbers n, m, v (3 ≤ n ≤ 105, 0 ≤ m ≤ 105, 1 ≤ v ≤ n), n — amount of servers, m — amount of direct connections, v — index of the server that fails and leads to the failure of the whole system. | 1,700 | If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from ... | standard output | |
PASSED | c902b74c9e388c95b3decc9dc0b764b1 | train_000.jsonl | 1277823600 | Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of se... | 256 megabytes | import java.util.ArrayList;
import java.util.Scanner;
public class Problem3 {
public static void main (String [] args){
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int m = scan.nextInt();
int v = scan.nextInt();
if(m<n-1 || m>(n-1)*(n-2)/2 + 1){
System.out.println("-1");
}
else{
... | Java | ["5 6 3", "6 100 1"] | 1 second | ["1 2\n2 3\n3 4\n4 5\n1 3\n3 5", "-1"] | null | Java 8 | standard input | [
"graphs"
] | 959709bfe7b26a4b9f2e7430350650a9 | The first input line contains 3 space-separated integer numbers n, m, v (3 ≤ n ≤ 105, 0 ≤ m ≤ 105, 1 ≤ v ≤ n), n — amount of servers, m — amount of direct connections, v — index of the server that fails and leads to the failure of the whole system. | 1,700 | If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from ... | standard output | |
PASSED | f8fe8503ba6868793f4129c73ac2eb3e | train_000.jsonl | 1277823600 | Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of se... | 256 megabytes | import java.io.PrintWriter;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = scan.nextInt();
int m = scan.nextInt();
int v = scan.nextInt();
... | Java | ["5 6 3", "6 100 1"] | 1 second | ["1 2\n2 3\n3 4\n4 5\n1 3\n3 5", "-1"] | null | Java 8 | standard input | [
"graphs"
] | 959709bfe7b26a4b9f2e7430350650a9 | The first input line contains 3 space-separated integer numbers n, m, v (3 ≤ n ≤ 105, 0 ≤ m ≤ 105, 1 ≤ v ≤ n), n — amount of servers, m — amount of direct connections, v — index of the server that fails and leads to the failure of the whole system. | 1,700 | If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from ... | standard output | |
PASSED | 3bceb768df50ea5411d731ccba6b8f2b | train_000.jsonl | 1277823600 | Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of se... | 256 megabytes | import java.util.*;
import java.io.*;
// im so sorry
public class C22 {
public static void main(String[] args) throws IOException {
Scanner in = new Scanner(System.in);
PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
int n = in.nextInt();
int m = in.nextInt();
int v... | Java | ["5 6 3", "6 100 1"] | 1 second | ["1 2\n2 3\n3 4\n4 5\n1 3\n3 5", "-1"] | null | Java 8 | standard input | [
"graphs"
] | 959709bfe7b26a4b9f2e7430350650a9 | The first input line contains 3 space-separated integer numbers n, m, v (3 ≤ n ≤ 105, 0 ≤ m ≤ 105, 1 ≤ v ≤ n), n — amount of servers, m — amount of direct connections, v — index of the server that fails and leads to the failure of the whole system. | 1,700 | If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from ... | standard output | |
PASSED | c7369988aebca8a3cb2f12d8303d800e | train_000.jsonl | 1277823600 | Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of se... | 256 megabytes | import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
public class Main
{
public final static int OO = Integer.MAX_VALUE;
private static Reader r;
public static void main(String[] args)throws Exception
{
r = new Reader();
... | Java | ["5 6 3", "6 100 1"] | 1 second | ["1 2\n2 3\n3 4\n4 5\n1 3\n3 5", "-1"] | null | Java 8 | standard input | [
"graphs"
] | 959709bfe7b26a4b9f2e7430350650a9 | The first input line contains 3 space-separated integer numbers n, m, v (3 ≤ n ≤ 105, 0 ≤ m ≤ 105, 1 ≤ v ≤ n), n — amount of servers, m — amount of direct connections, v — index of the server that fails and leads to the failure of the whole system. | 1,700 | If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from ... | standard output | |
PASSED | dc614d5f46e5fbadc7076239e23f0f97 | train_000.jsonl | 1277823600 | Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of se... | 256 megabytes | import java.io.*;
import java.util.*;
/**
* BEGIN NO SAD
* Blessed are those who suffer for doing what is right.
* The kingdom of heaven belongs to them.
* (Matthew 5:10-12)
* @author Tran Anh Tai
* @template for CP codes
* END NO SAD
*/
public class ProbC {
public static void main(String[] args) {
... | Java | ["5 6 3", "6 100 1"] | 1 second | ["1 2\n2 3\n3 4\n4 5\n1 3\n3 5", "-1"] | null | Java 8 | standard input | [
"graphs"
] | 959709bfe7b26a4b9f2e7430350650a9 | The first input line contains 3 space-separated integer numbers n, m, v (3 ≤ n ≤ 105, 0 ≤ m ≤ 105, 1 ≤ v ≤ n), n — amount of servers, m — amount of direct connections, v — index of the server that fails and leads to the failure of the whole system. | 1,700 | If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from ... | standard output | |
PASSED | 555b8eba17b60c1632875639cb8bcce6 | train_000.jsonl | 1277823600 | Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of se... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
String line [] = ... | Java | ["5 6 3", "6 100 1"] | 1 second | ["1 2\n2 3\n3 4\n4 5\n1 3\n3 5", "-1"] | null | Java 8 | standard input | [
"graphs"
] | 959709bfe7b26a4b9f2e7430350650a9 | The first input line contains 3 space-separated integer numbers n, m, v (3 ≤ n ≤ 105, 0 ≤ m ≤ 105, 1 ≤ v ≤ n), n — amount of servers, m — amount of direct connections, v — index of the server that fails and leads to the failure of the whole system. | 1,700 | If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from ... | standard output | |
PASSED | b9a496a4bbd779a7ff0e9cc4244dae98 | train_000.jsonl | 1277823600 | Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of se... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line [] = in.readLine().split(" ");
int n = Intege... | Java | ["5 6 3", "6 100 1"] | 1 second | ["1 2\n2 3\n3 4\n4 5\n1 3\n3 5", "-1"] | null | Java 8 | standard input | [
"graphs"
] | 959709bfe7b26a4b9f2e7430350650a9 | The first input line contains 3 space-separated integer numbers n, m, v (3 ≤ n ≤ 105, 0 ≤ m ≤ 105, 1 ≤ v ≤ n), n — amount of servers, m — amount of direct connections, v — index of the server that fails and leads to the failure of the whole system. | 1,700 | If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from ... | standard output | |
PASSED | 1159e471ed50dc72d5f759998aaffcac | train_000.jsonl | 1277823600 | Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of se... | 256 megabytes | import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
public class C
{
public static void main(String[] args) throws IOException
{
Scanner sc=new Scanner(System.in);
PrintWriter pw=new PrintWriter(System.out);
int n=sc.nextInt(),m=sc.nextInt(),x=sc.n... | Java | ["5 6 3", "6 100 1"] | 1 second | ["1 2\n2 3\n3 4\n4 5\n1 3\n3 5", "-1"] | null | Java 8 | standard input | [
"graphs"
] | 959709bfe7b26a4b9f2e7430350650a9 | The first input line contains 3 space-separated integer numbers n, m, v (3 ≤ n ≤ 105, 0 ≤ m ≤ 105, 1 ≤ v ≤ n), n — amount of servers, m — amount of direct connections, v — index of the server that fails and leads to the failure of the whole system. | 1,700 | If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from ... | standard output | |
PASSED | c59c4933b84249a22b8f7401723acb2b | train_000.jsonl | 1277823600 | Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of se... | 256 megabytes |
import java.awt.Point;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
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.LinkedList;... | Java | ["5 6 3", "6 100 1"] | 1 second | ["1 2\n2 3\n3 4\n4 5\n1 3\n3 5", "-1"] | null | Java 8 | standard input | [
"graphs"
] | 959709bfe7b26a4b9f2e7430350650a9 | The first input line contains 3 space-separated integer numbers n, m, v (3 ≤ n ≤ 105, 0 ≤ m ≤ 105, 1 ≤ v ≤ n), n — amount of servers, m — amount of direct connections, v — index of the server that fails and leads to the failure of the whole system. | 1,700 | If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from ... | standard output | |
PASSED | d0c4b39aa159e94a029790d809fd940f | train_000.jsonl | 1277823600 | Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of se... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class SystemAdmin {
public static long nx(int n){
long c =0;
for(int i =1;i<n;i++){
if(i==2)continue;
c+=n-i;
}
return c;
}
public static void main(String[] args) thro... | Java | ["5 6 3", "6 100 1"] | 1 second | ["1 2\n2 3\n3 4\n4 5\n1 3\n3 5", "-1"] | null | Java 8 | standard input | [
"graphs"
] | 959709bfe7b26a4b9f2e7430350650a9 | The first input line contains 3 space-separated integer numbers n, m, v (3 ≤ n ≤ 105, 0 ≤ m ≤ 105, 1 ≤ v ≤ n), n — amount of servers, m — amount of direct connections, v — index of the server that fails and leads to the failure of the whole system. | 1,700 | If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from ... | standard output | |
PASSED | 4038dcbc2f1bfcd9edc5f08a0158fa2f | train_000.jsonl | 1277823600 | Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of se... | 256 megabytes | import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class TheNet {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int vert = sc.nextInt();
int edges = sc.nextInt();
int v = sc.nextInt() - 1;
if (edges < vert - 1... | Java | ["5 6 3", "6 100 1"] | 1 second | ["1 2\n2 3\n3 4\n4 5\n1 3\n3 5", "-1"] | null | Java 8 | standard input | [
"graphs"
] | 959709bfe7b26a4b9f2e7430350650a9 | The first input line contains 3 space-separated integer numbers n, m, v (3 ≤ n ≤ 105, 0 ≤ m ≤ 105, 1 ≤ v ≤ n), n — amount of servers, m — amount of direct connections, v — index of the server that fails and leads to the failure of the whole system. | 1,700 | If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from ... | standard output | |
PASSED | f338d92baf42fb67d1faf09d0b5e0737 | train_000.jsonl | 1277823600 | Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of se... | 256 megabytes | import java.util.*;
import java.io.*;
public class Driver {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(System.out);
String[] line = br.readLine().split("\\s+");
... | Java | ["5 6 3", "6 100 1"] | 1 second | ["1 2\n2 3\n3 4\n4 5\n1 3\n3 5", "-1"] | null | Java 8 | standard input | [
"graphs"
] | 959709bfe7b26a4b9f2e7430350650a9 | The first input line contains 3 space-separated integer numbers n, m, v (3 ≤ n ≤ 105, 0 ≤ m ≤ 105, 1 ≤ v ≤ n), n — amount of servers, m — amount of direct connections, v — index of the server that fails and leads to the failure of the whole system. | 1,700 | If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from ... | standard output | |
PASSED | 986f8cb52ab6080353e21665157c23f2 | train_000.jsonl | 1277823600 | Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of se... | 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 SystemAdministrator_CF22C {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(Syste... | Java | ["5 6 3", "6 100 1"] | 1 second | ["1 2\n2 3\n3 4\n4 5\n1 3\n3 5", "-1"] | null | Java 8 | standard input | [
"graphs"
] | 959709bfe7b26a4b9f2e7430350650a9 | The first input line contains 3 space-separated integer numbers n, m, v (3 ≤ n ≤ 105, 0 ≤ m ≤ 105, 1 ≤ v ≤ n), n — amount of servers, m — amount of direct connections, v — index of the server that fails and leads to the failure of the whole system. | 1,700 | If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from ... | standard output | |
PASSED | 3530e24fc528d893ff3709b584dec87d | train_000.jsonl | 1277823600 | Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of se... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class SystemAdminstrator {
public static void main(String[] args) throws IOException {
Scanner s... | Java | ["5 6 3", "6 100 1"] | 1 second | ["1 2\n2 3\n3 4\n4 5\n1 3\n3 5", "-1"] | null | Java 8 | standard input | [
"graphs"
] | 959709bfe7b26a4b9f2e7430350650a9 | The first input line contains 3 space-separated integer numbers n, m, v (3 ≤ n ≤ 105, 0 ≤ m ≤ 105, 1 ≤ v ≤ n), n — amount of servers, m — amount of direct connections, v — index of the server that fails and leads to the failure of the whole system. | 1,700 | If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from ... | standard output | |
PASSED | 3afa9b5a7f44cd8ea5e99a543934f3c2 | train_000.jsonl | 1277823600 | Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of se... | 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 C {
public static void main(String[] args) throws Exception
{
Scanner sc = new Scanner(System.in);
PrintWriter out ... | Java | ["5 6 3", "6 100 1"] | 1 second | ["1 2\n2 3\n3 4\n4 5\n1 3\n3 5", "-1"] | null | Java 8 | standard input | [
"graphs"
] | 959709bfe7b26a4b9f2e7430350650a9 | The first input line contains 3 space-separated integer numbers n, m, v (3 ≤ n ≤ 105, 0 ≤ m ≤ 105, 1 ≤ v ≤ n), n — amount of servers, m — amount of direct connections, v — index of the server that fails and leads to the failure of the whole system. | 1,700 | If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from ... | standard output | |
PASSED | cf12a690307c023097e8fbf7161aaff5 | train_000.jsonl | 1277823600 | Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible to transmit data from one server to any other server via these connections. Each direct connection has to link two different servers, each pair of se... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
public class SystemAdmin1 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] tt = b... | Java | ["5 6 3", "6 100 1"] | 1 second | ["1 2\n2 3\n3 4\n4 5\n1 3\n3 5", "-1"] | null | Java 8 | standard input | [
"graphs"
] | 959709bfe7b26a4b9f2e7430350650a9 | The first input line contains 3 space-separated integer numbers n, m, v (3 ≤ n ≤ 105, 0 ≤ m ≤ 105, 1 ≤ v ≤ n), n — amount of servers, m — amount of direct connections, v — index of the server that fails and leads to the failure of the whole system. | 1,700 | If it is impossible to connect the servers in the required way, output -1. Otherwise output m lines with 2 numbers each — description of all the direct connections in the system. Each direct connection is described by two numbers — indexes of two servers, linked by this direct connection. The servers are numbered from ... | standard output | |
PASSED | ff2fdfb96536e8aba0e0476f3e14ae92 | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes | import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;
import javafx.scene.input.TouchPoint.State;
import static java.l... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 8 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | 93bddaa79cb75c388ee0d309972f9598 | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
/**
* @author Don Li
*/
public class VanyaField {
void solve() {
int n = in.nextInt(), m = in.nextI... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 8 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | 911d996da4a17a3b281f2dcbd5a4f0f4 | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes | // practice with rainboy
import java.io.*;
import java.util.*;
public class CF492E extends PrintWriter {
CF492E() { super(System.out, true); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF492E o = new CF492E(); o.main(); o.flush();
}
static class V {
int x, y, z;
V(int x, in... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 8 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | c890abfb86595b66355c5dc985a411fe | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes | import java.io.*;
import java.util.*;
public class A{
public static void main(String[] args)throws Throwable {
MyScanner sc=new MyScanner();
PrintWriter pw=new PrintWriter(System.out);
int n=sc.nextInt();
int m=sc.nextInt();
int dx=sc.nextInt();
int dy=sc.nextInt();
int [] Y=new int [n];
int lastx=0... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 8 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | 1f46fa7e72110c16094c45fe9c20d1a6 | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class Main extends PrintWriter {
BufferedReader in;
StringTokenizer stok;
final Random rand = new Random(31);
final int inf = (int) 1e9;
final long linf = (long) 1e18;
class Item implements Comparable<Item> {
... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 8 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | 5eb5e7b91cd1b09e257c26a6ce888d1e | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes | import java.util.*;
import java.io.*;
public class E {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
int n = sc.nextInt();
int m = sc.nextInt();
long dx = sc.nextInt();
long dy = sc.nextInt();
long[] rs = gcdexarr(n, dx);
long d = dy * rs[1] % (long)n;
ArrayList<Pair>[] ... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 8 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | bd32df9808f6c367eb5ccb13a88b62fa | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes | import java.io.*;
import java.util.*;
class exteuclid
{
public long g,x,y;
public long gcd(long a,long b)
{
if (b==0)
{
g=a;
x=1;
y=0;
return g;
}
else
{
long g_=gcd(b,a%b);
long tem=x;
x=y;
y=tem-(long)(a/b)*y;
return g_;
}
}
exteuclid()
{
g=x=y=0;
}
};
public class Ma... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 8 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | 961b0ef0a4f38c584b285359aed4d144 | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes | import java.io.*;
import java.util.*;
class exteuclid
{
public long g,x,y;
public long gcd(long a,long b)
{
if (b==0)
{
g=a;
x=1;
y=0;
return g;
}
else
{
long g_=gcd(b,a%b);
long tem=x;
x=y;
y=tem-(long)(a/b)*y;
return g_;
}
}
exteuclid()
{
g=x=y=0;
}
};
public class ye... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 8 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | 406d5d5b53d691d2db5c249922ebb5bf | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes | import java.util.Scanner;
public class Main {
public static int[] Y, K;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int dx = sc.nextInt() % n;
int dy = sc.nextInt() % n;
Y = new int[n]... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 8 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | 8ab4ba76b7b0087e8e31cd590795db0b | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Pradyumn
*/
public class M... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 8 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | 62111742435b3791674aed0c5c427c40 | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes | import java.util.List;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Random;
import java.io.Reader;
import java.io.Writer;
import jav... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 8 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | 15329e9ab6192287491bff2a3b26e5fa | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes | import static java.lang.Math.*;
import static java.lang.System.currentTimeMillis;
import static java.lang.System.exit;
import static java.lang.System.arraycopy;
import static java.util.Arrays.sort;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.fill;
import java.util.*;
import java.io.*;
i... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 8 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | 5c14213c6b8a211498cae6752fd34f6e | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class CF280C {
public static void main(String[] args) throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer strto... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 8 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | 87f3a79efa288757f4057251418293c9 | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes | import java.io.PrintWriter;
import java.util.Scanner;
public final class E {
private static final Scanner in = new Scanner(System.in);
private static final PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) throws Exception {
final int n = in.nextInt();
... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 8 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | 23fbc9028e807a34e67164375d6a5a73 | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collecti... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 8 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | ee9926471fafb578b73364af3e9a8113 | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
/**
* Created by dhamada on 15/05/20.
*/
public class E {
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
Pr... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 8 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | 50d318c95013c8dc3cfe82dff0c56ef4 | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes | import java.io.BufferedInputStream;
import java.io.InputStream;
public class E280 {
public static void main(String[] args) {
Jolty scan = new Jolty(System.in);
int N = scan.nextInt(), M = scan.nextInt(), dx = scan.nextInt(), dy = scan.nextInt();
if(N==1){
System.out.println("0 0");
return;
}
long m = ... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 8 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | cf5c25c7a15f7f0fad15c51e6121b050 | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes | import java.io.*;
import java.util.*;
public class E {
void solve() throws IOException {
int n = nextInt(), m = nextInt();
long dx = nextLong(), dy = nextLong();
long[] steps_number = new long[n];
long x = 0;
for (int i = 1; i < n; ++i) {
x = (x + dx) % n;
if (x < 0) {
x = n + x;
}
steps_n... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 8 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | 33d9e800cc428daf129b46ca403f9b94 | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 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.util.ArrayList;
import java.util.List;
import java.io.Writer;
impo... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 8 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | 72d5c0373ba22628be0a827798d7d657 | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes | import java.util.*;
import java.io.*;
import java.awt.Point;
import java.math.BigDecimal;
import java.math.BigInteger;
import static java.lang.Math.*;
// Solution is at the bottom of code
public class E implements Runnable{
final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
BufferedReader... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 8 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | 47a92a35ac28bb8129cfe1182f00a806 | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class E {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
PrintWriter writer = new PrintWriter(System.out);
StringTokenizer strin... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 8 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | 37e872de3e212c730571282f92dfccd3 | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes |
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.Arrays;
import java.util.StringTokenizer;
public class E492 {
public static BufferedReader in;
public static Print... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 8 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | 21bad20c0fc33f4c8e46d1db48e91a56 | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Map.Entry;
import java.util.StringTokenizer;
import java.util.TreeMap;
public class VanyaAndField {
st... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 8 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | 37e2bca00d036f07dc163f77eca553da | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes | import java.awt.Point;
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 E {
static int N;
static void EE(int a, int b, Point p)
{
if(a%b == 0)
{
p... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 8 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | 81a9aca75b555424b1f146b428070191 | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes | import java.io.*;
import java.util.*;
public class E {
long pow(long a, long b, long mod) {
long ans = 1;
while (b > 0) {
if (b % 2 == 1) {
ans = (ans * a) % mod;
}
a = (a * a) % mod;
b /= 2;
}
return ans;
}
long phi(long n) {
long ans = n;
for (long i = 2; i * i <= n; i++) {
if (n ... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 8 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | c4af821662b14bd2061ca94ca5f7a4eb | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes | import java.io.*;
import java.util.*;
public class E {
long[] gcd(long a, long b) {
if (b == 0) {
return new long[] { a, 1, 0 };
}
long[] g = gcd(b, a % b);
return new long[] { g[0], g[2], g[1] - (a / b) * g[2] };
}
void run() throws IOException {
long n = ni();
int m = ni(), dx = ni(), dy = ni();... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 8 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | 612ee01ddaf80dbf987e10628079874b | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes | import java.io.*;
import java.util.*;
public class E {
void run() throws IOException {
int n = ni(), m = ni(), dx = ni(), dy = ni();
int[] px = new int[n], py = new int[n];
for (int i = 1; i < n; i++) {
px[i] = (px[i - 1] + dx) % n;
py[i] = (py[i - 1] + dy) % n;
}
int[] rx = new int[n], ry = new in... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 8 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | 3e180065ffaf69596112cfcc92596070 | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes | import java.util.Scanner;
public class E492
{
static int [] Y,K;
public static void main(String [] args)
{
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int m = in.nextInt();
int dx = in.nextInt()%n;
int dy = in.nextInt()%n;
Y = new int[n];
K = new int[n];
for(int i=0,sx=0,sy=0;i<n;i++)... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 8 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | bd609905f1f37e62b113121c69f4bc48 | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes | import java.util.Scanner;
public class E492
{
static int [] Y,K;
public static void main(String [] args)
{
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int m = in.nextInt();
int dx = in.nextInt()%n;
int dy = in.nextInt()%n;
Y = new int[n];
... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 8 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | 19de4c94949f65601c8f5e72d0a3cfce | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = br.read... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 6 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | 2dcb05d2bbc21d67339f30e56f665ca0 | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.StringTokenizer;
public class SolutionA {
FastScanner in;
PrintWriter out;
public static void main(String[] args){
new SolutionA().... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 6 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | ff0eeb8b1cf8bbc49734b9c8d04d8be9 | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes | import java.io.*;
import java.lang.Math;
import java.util.*;
public class Main
{
public BufferedReader in;
public PrintStream out;
public boolean log_enabled = true;
public void test()
{
int n = readInt();
int m = readInt();
int i, mx, r;
long dx = readInt();
long dy = readInt();
long x, y;
lon... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 6 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | a15b2edec64f4d8188d0a996306a26ce | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt(), m = s.nextInt(), dx = s.nextInt(),
dy = s.nextInt();
int[] x = new int[n], y = new int[n];
int cx = 0, cy = 0;
... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 6 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | f326ed57042196fbfcb9c10aa17148aa | train_000.jsonl | 1417451400 | Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates (xi, yi). Vanya moves towards vector (dx, dy). That means that if Vanya is now at the cell (x, y), then in a second he will be at cell . The following condition is satisfied for ... | 256 megabytes | import java.util.Arrays;
import java.util.TreeMap;
import java.util.ArrayList;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Random;
import java.util.HashMap;
import java.io.BufferedReader;
import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.io.OutputSt... | Java | ["5 5 2 3\n0 0\n1 2\n1 3\n2 4\n3 1", "2 3 1 1\n0 0\n0 1\n1 1"] | 2 seconds | ["1 3", "0 0"] | NoteIn the first sample Vanya's path will look like: (1, 3) - (3, 1) - (0, 4) - (2, 2) - (4, 0) - (1, 3)In the second sample: (0, 0) - (1, 1) - (0, 0) | Java 6 | standard input | [
"math"
] | 6a2fe1f7e767a508530e9d922740c450 | The first line contains integers n, m, dx, dy(1 ≤ n ≤ 106, 1 ≤ m ≤ 105, 1 ≤ dx, dy ≤ n) — the size of the field, the number of apple trees and the vector of Vanya's movement. Next m lines contain integers xi, yi (0 ≤ xi, yi ≤ n - 1) — the coordinates of apples. One cell may contain multiple apple trees. | 2,000 | Print two space-separated numbers — the coordinates of the cell from which you should start your path. If there are several answers you are allowed to print any of them. | standard output | |
PASSED | 8ff108ef5e0bbd4fa3f95d5bf4f42216 | train_000.jsonl | 1416238500 | The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves.We know that several boy&girl pairs are going to be invited to the ball. However, the partners' dancing skill in each pair... | 256 megabytes | import java.io.*;
import java.util.*;
public class CF {
public static void main(String[] args) throws IOException{
Scanner in=new Scanner(System.in);
int n=in.nextInt();
int[] A=new int[n];
for(int i=0;i<n;i++) {
A[i]=in.nextInt();
}
int m=in.nextInt();
int[] B=new int[100+100];
for(int i=0;i<... | Java | ["4\n1 4 6 2\n5\n5 1 5 7 9", "4\n1 2 3 4\n4\n10 11 12 13", "5\n1 1 1 1 1\n3\n1 2 3"] | 1 second | ["3", "0", "2"] | null | Java 8 | standard input | [
"dp",
"greedy",
"two pointers",
"graph matchings",
"sortings",
"dfs and similar"
] | 62766ef9a0751cbe7987020144de7512 | The first line contains an integer n (1 ≤ n ≤ 100) — the number of boys. The second line contains sequence a1, a2, ..., an (1 ≤ ai ≤ 100), where ai is the i-th boy's dancing skill. Similarly, the third line contains an integer m (1 ≤ m ≤ 100) — the number of girls. The fourth line contains sequence b1, b2, ..., bm (1 ≤... | 1,200 | Print a single number — the required maximum possible number of pairs. | standard output | |
PASSED | b808b766da014b0dd6f59371c81efa24 | train_000.jsonl | 1416238500 | The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves.We know that several boy&girl pairs are going to be invited to the ball. However, the partners' dancing skill in each pair... | 256 megabytes | /*Author LAVLESH*/
import java.util.*;
import java.io.*;
public class main{
static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
static StringTokenizer st=new StringTokenizer("");
static public String next() {
while (st == null || !st.hasMoreTokens()) {
try {
... | Java | ["4\n1 4 6 2\n5\n5 1 5 7 9", "4\n1 2 3 4\n4\n10 11 12 13", "5\n1 1 1 1 1\n3\n1 2 3"] | 1 second | ["3", "0", "2"] | null | Java 8 | standard input | [
"dp",
"greedy",
"two pointers",
"graph matchings",
"sortings",
"dfs and similar"
] | 62766ef9a0751cbe7987020144de7512 | The first line contains an integer n (1 ≤ n ≤ 100) — the number of boys. The second line contains sequence a1, a2, ..., an (1 ≤ ai ≤ 100), where ai is the i-th boy's dancing skill. Similarly, the third line contains an integer m (1 ≤ m ≤ 100) — the number of girls. The fourth line contains sequence b1, b2, ..., bm (1 ≤... | 1,200 | Print a single number — the required maximum possible number of pairs. | standard output | |
PASSED | 47004132a84fdeee857a06bf04d6bcb7 | train_000.jsonl | 1416238500 | The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves.We know that several boy&girl pairs are going to be invited to the ball. However, the partners' dancing skill in each pair... | 256 megabytes |
import java.io.*;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Random;
public class CF489 {
static String filePath = "/home/bishoy/IdeaProjects/Arabic competetive programming/src/b/test";
public static void main(String args[]) {
InputReader inputReader = Helper.r... | Java | ["4\n1 4 6 2\n5\n5 1 5 7 9", "4\n1 2 3 4\n4\n10 11 12 13", "5\n1 1 1 1 1\n3\n1 2 3"] | 1 second | ["3", "0", "2"] | null | Java 8 | standard input | [
"dp",
"greedy",
"two pointers",
"graph matchings",
"sortings",
"dfs and similar"
] | 62766ef9a0751cbe7987020144de7512 | The first line contains an integer n (1 ≤ n ≤ 100) — the number of boys. The second line contains sequence a1, a2, ..., an (1 ≤ ai ≤ 100), where ai is the i-th boy's dancing skill. Similarly, the third line contains an integer m (1 ≤ m ≤ 100) — the number of girls. The fourth line contains sequence b1, b2, ..., bm (1 ≤... | 1,200 | Print a single number — the required maximum possible number of pairs. | standard output | |
PASSED | 3ee3dbb2cb3d208a3bbd412e33a9f232 | train_000.jsonl | 1416238500 | The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves.We know that several boy&girl pairs are going to be invited to the ball. However, the partners' dancing skill in each pair... | 256 megabytes |
import java.io.*;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Random;
public class CF489 {
static String filePath = "/home/bishoy/IdeaProjects/Arabic competetive programming/src/b/test";
public static void main(String args[]) {
InputReader inputReader = Helper.r... | Java | ["4\n1 4 6 2\n5\n5 1 5 7 9", "4\n1 2 3 4\n4\n10 11 12 13", "5\n1 1 1 1 1\n3\n1 2 3"] | 1 second | ["3", "0", "2"] | null | Java 8 | standard input | [
"dp",
"greedy",
"two pointers",
"graph matchings",
"sortings",
"dfs and similar"
] | 62766ef9a0751cbe7987020144de7512 | The first line contains an integer n (1 ≤ n ≤ 100) — the number of boys. The second line contains sequence a1, a2, ..., an (1 ≤ ai ≤ 100), where ai is the i-th boy's dancing skill. Similarly, the third line contains an integer m (1 ≤ m ≤ 100) — the number of girls. The fourth line contains sequence b1, b2, ..., bm (1 ≤... | 1,200 | Print a single number — the required maximum possible number of pairs. | standard output | |
PASSED | 6cb0e2afd7acb94687778358acaa6609 | train_000.jsonl | 1416238500 | The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves.We know that several boy&girl pairs are going to be invited to the ball. However, the partners' dancing skill in each pair... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class CF489 {
// static String filePath = "/home/bishoy/IdeaProjects/Arabic competetive programming/src/b/test";
public static void main(String args[])... | Java | ["4\n1 4 6 2\n5\n5 1 5 7 9", "4\n1 2 3 4\n4\n10 11 12 13", "5\n1 1 1 1 1\n3\n1 2 3"] | 1 second | ["3", "0", "2"] | null | Java 8 | standard input | [
"dp",
"greedy",
"two pointers",
"graph matchings",
"sortings",
"dfs and similar"
] | 62766ef9a0751cbe7987020144de7512 | The first line contains an integer n (1 ≤ n ≤ 100) — the number of boys. The second line contains sequence a1, a2, ..., an (1 ≤ ai ≤ 100), where ai is the i-th boy's dancing skill. Similarly, the third line contains an integer m (1 ≤ m ≤ 100) — the number of girls. The fourth line contains sequence b1, b2, ..., bm (1 ≤... | 1,200 | Print a single number — the required maximum possible number of pairs. | standard output | |
PASSED | 4ea140240f7fcc783877c00836792be7 | train_000.jsonl | 1416238500 | The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves.We know that several boy&girl pairs are going to be invited to the ball. However, the partners' dancing skill in each pair... | 256 megabytes |
import java.io.*;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Random;
public class CF489 {
static String filePath = "/home/bishoy/IdeaProjects/Arabic competetive programming/src/b/test";
public static void main(String args[]) {
InputReader inputReader = Helper.r... | Java | ["4\n1 4 6 2\n5\n5 1 5 7 9", "4\n1 2 3 4\n4\n10 11 12 13", "5\n1 1 1 1 1\n3\n1 2 3"] | 1 second | ["3", "0", "2"] | null | Java 8 | standard input | [
"dp",
"greedy",
"two pointers",
"graph matchings",
"sortings",
"dfs and similar"
] | 62766ef9a0751cbe7987020144de7512 | The first line contains an integer n (1 ≤ n ≤ 100) — the number of boys. The second line contains sequence a1, a2, ..., an (1 ≤ ai ≤ 100), where ai is the i-th boy's dancing skill. Similarly, the third line contains an integer m (1 ≤ m ≤ 100) — the number of girls. The fourth line contains sequence b1, b2, ..., bm (1 ≤... | 1,200 | Print a single number — the required maximum possible number of pairs. | standard output | |
PASSED | 6b0d8c48afa8f11ee214f6bfbaeb75fe | train_000.jsonl | 1416238500 | The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves.We know that several boy&girl pairs are going to be invited to the ball. However, the partners' dancing skill in each pair... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class CF489 {
// static String filePath = "/home/bishoy/IdeaProjects/Arabic competetive programming/src/b/test";
public static void main(String args[])... | Java | ["4\n1 4 6 2\n5\n5 1 5 7 9", "4\n1 2 3 4\n4\n10 11 12 13", "5\n1 1 1 1 1\n3\n1 2 3"] | 1 second | ["3", "0", "2"] | null | Java 8 | standard input | [
"dp",
"greedy",
"two pointers",
"graph matchings",
"sortings",
"dfs and similar"
] | 62766ef9a0751cbe7987020144de7512 | The first line contains an integer n (1 ≤ n ≤ 100) — the number of boys. The second line contains sequence a1, a2, ..., an (1 ≤ ai ≤ 100), where ai is the i-th boy's dancing skill. Similarly, the third line contains an integer m (1 ≤ m ≤ 100) — the number of girls. The fourth line contains sequence b1, b2, ..., bm (1 ≤... | 1,200 | Print a single number — the required maximum possible number of pairs. | standard output | |
PASSED | 065e37a8b9df0881d3cc3da2e3258efd | train_000.jsonl | 1416238500 | The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves.We know that several boy&girl pairs are going to be invited to the ball. However, the partners' dancing skill in each pair... | 256 megabytes |
import java.io.*;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Random;
import java.util.StringTokenizer;
public class CF489 {
// static String filePath = "/home/bishoy/IdeaProjects/Arabic competetive programming/src/b/test";
public static void main(String args[]) throws I... | Java | ["4\n1 4 6 2\n5\n5 1 5 7 9", "4\n1 2 3 4\n4\n10 11 12 13", "5\n1 1 1 1 1\n3\n1 2 3"] | 1 second | ["3", "0", "2"] | null | Java 8 | standard input | [
"dp",
"greedy",
"two pointers",
"graph matchings",
"sortings",
"dfs and similar"
] | 62766ef9a0751cbe7987020144de7512 | The first line contains an integer n (1 ≤ n ≤ 100) — the number of boys. The second line contains sequence a1, a2, ..., an (1 ≤ ai ≤ 100), where ai is the i-th boy's dancing skill. Similarly, the third line contains an integer m (1 ≤ m ≤ 100) — the number of girls. The fourth line contains sequence b1, b2, ..., bm (1 ≤... | 1,200 | Print a single number — the required maximum possible number of pairs. | standard output | |
PASSED | f96164e004e7fa5679f9671e2f68450b | train_000.jsonl | 1416238500 | The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves.We know that several boy&girl pairs are going to be invited to the ball. However, the partners' dancing skill in each pair... | 256 megabytes |
import java.io.*;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Random;
import java.util.StringTokenizer;
public class CF489 {
// static String filePath = "/home/bishoy/IdeaProjects/Arabic competetive programming/src/b/test";
public static void main(String args[]) throws I... | Java | ["4\n1 4 6 2\n5\n5 1 5 7 9", "4\n1 2 3 4\n4\n10 11 12 13", "5\n1 1 1 1 1\n3\n1 2 3"] | 1 second | ["3", "0", "2"] | null | Java 8 | standard input | [
"dp",
"greedy",
"two pointers",
"graph matchings",
"sortings",
"dfs and similar"
] | 62766ef9a0751cbe7987020144de7512 | The first line contains an integer n (1 ≤ n ≤ 100) — the number of boys. The second line contains sequence a1, a2, ..., an (1 ≤ ai ≤ 100), where ai is the i-th boy's dancing skill. Similarly, the third line contains an integer m (1 ≤ m ≤ 100) — the number of girls. The fourth line contains sequence b1, b2, ..., bm (1 ≤... | 1,200 | Print a single number — the required maximum possible number of pairs. | standard output | |
PASSED | 68c2bb97bc83a97bb75a59d5f71431c4 | train_000.jsonl | 1416238500 | The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves.We know that several boy&girl pairs are going to be invited to the ball. However, the partners' dancing skill in each pair... | 256 megabytes |
import java.io.*;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Random;
import java.util.StringTokenizer;
public class CF489 {
static String filePath = "/home/bishoy/IdeaProjects/Arabic competetive programming/src/b/test";
public static void main(String args[]) throws IOE... | Java | ["4\n1 4 6 2\n5\n5 1 5 7 9", "4\n1 2 3 4\n4\n10 11 12 13", "5\n1 1 1 1 1\n3\n1 2 3"] | 1 second | ["3", "0", "2"] | null | Java 8 | standard input | [
"dp",
"greedy",
"two pointers",
"graph matchings",
"sortings",
"dfs and similar"
] | 62766ef9a0751cbe7987020144de7512 | The first line contains an integer n (1 ≤ n ≤ 100) — the number of boys. The second line contains sequence a1, a2, ..., an (1 ≤ ai ≤ 100), where ai is the i-th boy's dancing skill. Similarly, the third line contains an integer m (1 ≤ m ≤ 100) — the number of girls. The fourth line contains sequence b1, b2, ..., bm (1 ≤... | 1,200 | Print a single number — the required maximum possible number of pairs. | standard output | |
PASSED | 324f2c28e37243bc7f79efc2a0c05468 | train_000.jsonl | 1416238500 | The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves.We know that several boy&girl pairs are going to be invited to the ball. However, the partners' dancing skill in each pair... | 256 megabytes | import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
public class SydneyTest {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int boys = input.nextInt();
List<Integer> boysSkills = new ArrayList<>();
for (int... | Java | ["4\n1 4 6 2\n5\n5 1 5 7 9", "4\n1 2 3 4\n4\n10 11 12 13", "5\n1 1 1 1 1\n3\n1 2 3"] | 1 second | ["3", "0", "2"] | null | Java 8 | standard input | [
"dp",
"greedy",
"two pointers",
"graph matchings",
"sortings",
"dfs and similar"
] | 62766ef9a0751cbe7987020144de7512 | The first line contains an integer n (1 ≤ n ≤ 100) — the number of boys. The second line contains sequence a1, a2, ..., an (1 ≤ ai ≤ 100), where ai is the i-th boy's dancing skill. Similarly, the third line contains an integer m (1 ≤ m ≤ 100) — the number of girls. The fourth line contains sequence b1, b2, ..., bm (1 ≤... | 1,200 | Print a single number — the required maximum possible number of pairs. | standard output | |
PASSED | c144162d46acf0421cd173df5476991a | train_000.jsonl | 1416238500 | The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves.We know that several boy&girl pairs are going to be invited to the ball. However, the partners' dancing skill in each pair... | 256 megabytes | import java.util.Scanner;
import java.util.ArrayList;
public class Go {
static Scanner sc;
static ArrayList<Integer> x, y;
static ArrayList<Integer> read() {
ArrayList<Integer> ts = new ArrayList<>();
int size = sc.nextInt();
for(int i = 0; i < size; i++) {
ts.add(sc.nextInt());
}
ts.sort(null)... | Java | ["4\n1 4 6 2\n5\n5 1 5 7 9", "4\n1 2 3 4\n4\n10 11 12 13", "5\n1 1 1 1 1\n3\n1 2 3"] | 1 second | ["3", "0", "2"] | null | Java 8 | standard input | [
"dp",
"greedy",
"two pointers",
"graph matchings",
"sortings",
"dfs and similar"
] | 62766ef9a0751cbe7987020144de7512 | The first line contains an integer n (1 ≤ n ≤ 100) — the number of boys. The second line contains sequence a1, a2, ..., an (1 ≤ ai ≤ 100), where ai is the i-th boy's dancing skill. Similarly, the third line contains an integer m (1 ≤ m ≤ 100) — the number of girls. The fourth line contains sequence b1, b2, ..., bm (1 ≤... | 1,200 | Print a single number — the required maximum possible number of pairs. | standard output | |
PASSED | 606adfd28c6878288015b5fb297609c0 | train_000.jsonl | 1416238500 | The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves.We know that several boy&girl pairs are going to be invited to the ball. However, the partners' dancing skill in each pair... | 256 megabytes | import java.util.Scanner;
import java.lang.Math;
import java.util.Arrays;
public class Ball{
public static void main(String args[]){
Scanner scan = new Scanner(System.in);
int[] boys = new int[scan.nextInt()];
for(int i=0;i<boys.length;i++){
boys[i] = scan.next... | Java | ["4\n1 4 6 2\n5\n5 1 5 7 9", "4\n1 2 3 4\n4\n10 11 12 13", "5\n1 1 1 1 1\n3\n1 2 3"] | 1 second | ["3", "0", "2"] | null | Java 8 | standard input | [
"dp",
"greedy",
"two pointers",
"graph matchings",
"sortings",
"dfs and similar"
] | 62766ef9a0751cbe7987020144de7512 | The first line contains an integer n (1 ≤ n ≤ 100) — the number of boys. The second line contains sequence a1, a2, ..., an (1 ≤ ai ≤ 100), where ai is the i-th boy's dancing skill. Similarly, the third line contains an integer m (1 ≤ m ≤ 100) — the number of girls. The fourth line contains sequence b1, b2, ..., bm (1 ≤... | 1,200 | Print a single number — the required maximum possible number of pairs. | standard output | |
PASSED | c2b8d946e8020e001759864f23257799 | train_000.jsonl | 1416238500 | The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves.We know that several boy&girl pairs are going to be invited to the ball. However, the partners' dancing skill in each pair... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static Reader scan;
static PrintWriter out;
static int boysCount;
static int girlsCount;
static int[] boys;
static int[] girls;
public static void main(String[] args) throws IOException {
scan = new Reader();
ou... | Java | ["4\n1 4 6 2\n5\n5 1 5 7 9", "4\n1 2 3 4\n4\n10 11 12 13", "5\n1 1 1 1 1\n3\n1 2 3"] | 1 second | ["3", "0", "2"] | null | Java 8 | standard input | [
"dp",
"greedy",
"two pointers",
"graph matchings",
"sortings",
"dfs and similar"
] | 62766ef9a0751cbe7987020144de7512 | The first line contains an integer n (1 ≤ n ≤ 100) — the number of boys. The second line contains sequence a1, a2, ..., an (1 ≤ ai ≤ 100), where ai is the i-th boy's dancing skill. Similarly, the third line contains an integer m (1 ≤ m ≤ 100) — the number of girls. The fourth line contains sequence b1, b2, ..., bm (1 ≤... | 1,200 | Print a single number — the required maximum possible number of pairs. | standard output | |
PASSED | 672fc54e5a47e2572fae68dac65f813d | train_000.jsonl | 1416238500 | The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves.We know that several boy&girl pairs are going to be invited to the ball. However, the partners' dancing skill in each pair... | 256 megabytes | import java.util.*;
import java.io.*;
//http://codeforces.com/problemset/problem/489/B
public class Main {
static Reader scan;
static PrintWriter out;
static int boysCount;
static int girlsCount;
static int[] boys;
static int[] girls;
public static void main(String[] args) throws IOExce... | Java | ["4\n1 4 6 2\n5\n5 1 5 7 9", "4\n1 2 3 4\n4\n10 11 12 13", "5\n1 1 1 1 1\n3\n1 2 3"] | 1 second | ["3", "0", "2"] | null | Java 8 | standard input | [
"dp",
"greedy",
"two pointers",
"graph matchings",
"sortings",
"dfs and similar"
] | 62766ef9a0751cbe7987020144de7512 | The first line contains an integer n (1 ≤ n ≤ 100) — the number of boys. The second line contains sequence a1, a2, ..., an (1 ≤ ai ≤ 100), where ai is the i-th boy's dancing skill. Similarly, the third line contains an integer m (1 ≤ m ≤ 100) — the number of girls. The fourth line contains sequence b1, b2, ..., bm (1 ≤... | 1,200 | Print a single number — the required maximum possible number of pairs. | standard output | |
PASSED | a3c310e52f2ce9b9f7c6fe6016c10604 | train_000.jsonl | 1416238500 | The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves.We know that several boy&girl pairs are going to be invited to the ball. However, the partners' dancing skill in each pair... | 256 megabytes | import java.io.*;
import java.util.*;
public class maindp{
public static int getInt(String s){
return Integer.parseInt(s);
}
public static void main(String[] args)throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["4\n1 4 6 2\n5\n5 1 5 7 9", "4\n1 2 3 4\n4\n10 11 12 13", "5\n1 1 1 1 1\n3\n1 2 3"] | 1 second | ["3", "0", "2"] | null | Java 8 | standard input | [
"dp",
"greedy",
"two pointers",
"graph matchings",
"sortings",
"dfs and similar"
] | 62766ef9a0751cbe7987020144de7512 | The first line contains an integer n (1 ≤ n ≤ 100) — the number of boys. The second line contains sequence a1, a2, ..., an (1 ≤ ai ≤ 100), where ai is the i-th boy's dancing skill. Similarly, the third line contains an integer m (1 ≤ m ≤ 100) — the number of girls. The fourth line contains sequence b1, b2, ..., bm (1 ≤... | 1,200 | Print a single number — the required maximum possible number of pairs. | standard output | |
PASSED | f2207a465513e1fa3e621368540dcdc1 | train_000.jsonl | 1416238500 | The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves.We know that several boy&girl pairs are going to be invited to the ball. However, the partners' dancing skill in each pair... | 256 megabytes | import java.io.*;
import java.util.*;
public class main{
public static int getInt(String s){
return Integer.parseInt(s);
}
public static void main(String[] args)throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
in... | Java | ["4\n1 4 6 2\n5\n5 1 5 7 9", "4\n1 2 3 4\n4\n10 11 12 13", "5\n1 1 1 1 1\n3\n1 2 3"] | 1 second | ["3", "0", "2"] | null | Java 8 | standard input | [
"dp",
"greedy",
"two pointers",
"graph matchings",
"sortings",
"dfs and similar"
] | 62766ef9a0751cbe7987020144de7512 | The first line contains an integer n (1 ≤ n ≤ 100) — the number of boys. The second line contains sequence a1, a2, ..., an (1 ≤ ai ≤ 100), where ai is the i-th boy's dancing skill. Similarly, the third line contains an integer m (1 ≤ m ≤ 100) — the number of girls. The fourth line contains sequence b1, b2, ..., bm (1 ≤... | 1,200 | Print a single number — the required maximum possible number of pairs. | standard output | |
PASSED | d18aea106f85dffa276109c5e7759893 | train_000.jsonl | 1416238500 | The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves.We know that several boy&girl pairs are going to be invited to the ball. However, the partners' dancing skill in each pair... | 256 megabytes | import java.util.*;
import java.io.*;
public class BerSUBall{
static PrintWriter pw = new PrintWriter(System.out);
public static void main(String[] args){
FastReader sc = new FastReader();
int n = sc.nextInt();
int[] boys = new int[n];
for(int i = 0;i<n;i++)boys[i]=sc.nextInt();
int m = sc.nextInt();
int[... | Java | ["4\n1 4 6 2\n5\n5 1 5 7 9", "4\n1 2 3 4\n4\n10 11 12 13", "5\n1 1 1 1 1\n3\n1 2 3"] | 1 second | ["3", "0", "2"] | null | Java 8 | standard input | [
"dp",
"greedy",
"two pointers",
"graph matchings",
"sortings",
"dfs and similar"
] | 62766ef9a0751cbe7987020144de7512 | The first line contains an integer n (1 ≤ n ≤ 100) — the number of boys. The second line contains sequence a1, a2, ..., an (1 ≤ ai ≤ 100), where ai is the i-th boy's dancing skill. Similarly, the third line contains an integer m (1 ≤ m ≤ 100) — the number of girls. The fourth line contains sequence b1, b2, ..., bm (1 ≤... | 1,200 | Print a single number — the required maximum possible number of pairs. | standard output | |
PASSED | c68affe2948170fa1e1c78d749b339b0 | train_000.jsonl | 1416238500 | The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves.We know that several boy&girl pairs are going to be invited to the ball. However, the partners' dancing skill in each pair... | 256 megabytes | /*
Author: @__goku__
ssrivastava990@gmail.com
`\-. `
\ `. `
\ \ |
__.._ | \. S O N - G O K U
..---~~ ~ . | Y
~-. `| |
`. `~~--.
\ ... | Java | ["4\n1 4 6 2\n5\n5 1 5 7 9", "4\n1 2 3 4\n4\n10 11 12 13", "5\n1 1 1 1 1\n3\n1 2 3"] | 1 second | ["3", "0", "2"] | null | Java 8 | standard input | [
"dp",
"greedy",
"two pointers",
"graph matchings",
"sortings",
"dfs and similar"
] | 62766ef9a0751cbe7987020144de7512 | The first line contains an integer n (1 ≤ n ≤ 100) — the number of boys. The second line contains sequence a1, a2, ..., an (1 ≤ ai ≤ 100), where ai is the i-th boy's dancing skill. Similarly, the third line contains an integer m (1 ≤ m ≤ 100) — the number of girls. The fourth line contains sequence b1, b2, ..., bm (1 ≤... | 1,200 | Print a single number — the required maximum possible number of pairs. | standard output | |
PASSED | 4e93de3f7f9e79a40b036be1762cd048 | train_000.jsonl | 1416238500 | The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves.We know that several boy&girl pairs are going to be invited to the ball. However, the partners' dancing skill in each pair... | 256 megabytes | /*
Author: @__goku__
ssrivastava990@gmail.com
`\-. `
\ `. `
\ \ |
__.._ | \. S O N - G O K U
..---~~ ~ . | Y
~-. `| |
`. `~~--.
\ ... | Java | ["4\n1 4 6 2\n5\n5 1 5 7 9", "4\n1 2 3 4\n4\n10 11 12 13", "5\n1 1 1 1 1\n3\n1 2 3"] | 1 second | ["3", "0", "2"] | null | Java 8 | standard input | [
"dp",
"greedy",
"two pointers",
"graph matchings",
"sortings",
"dfs and similar"
] | 62766ef9a0751cbe7987020144de7512 | The first line contains an integer n (1 ≤ n ≤ 100) — the number of boys. The second line contains sequence a1, a2, ..., an (1 ≤ ai ≤ 100), where ai is the i-th boy's dancing skill. Similarly, the third line contains an integer m (1 ≤ m ≤ 100) — the number of girls. The fourth line contains sequence b1, b2, ..., bm (1 ≤... | 1,200 | Print a single number — the required maximum possible number of pairs. | standard output | |
PASSED | 2a6946ee9a7aca0df9182c6dcda5a268 | train_000.jsonl | 1416238500 | The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! n boys and m girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves.We know that several boy&girl pairs are going to be invited to the ball. However, the partners' dancing skill in each pair... | 256 megabytes | /*
Author: @__goku__
ssrivastava990@gmail.com
`\-. `
\ `. `
\ \ |
__.._ | \. S O N - G O K U
..---~~ ~ . | Y
~-. `| |
`. `~~--.
\ ... | Java | ["4\n1 4 6 2\n5\n5 1 5 7 9", "4\n1 2 3 4\n4\n10 11 12 13", "5\n1 1 1 1 1\n3\n1 2 3"] | 1 second | ["3", "0", "2"] | null | Java 8 | standard input | [
"dp",
"greedy",
"two pointers",
"graph matchings",
"sortings",
"dfs and similar"
] | 62766ef9a0751cbe7987020144de7512 | The first line contains an integer n (1 ≤ n ≤ 100) — the number of boys. The second line contains sequence a1, a2, ..., an (1 ≤ ai ≤ 100), where ai is the i-th boy's dancing skill. Similarly, the third line contains an integer m (1 ≤ m ≤ 100) — the number of girls. The fourth line contains sequence b1, b2, ..., bm (1 ≤... | 1,200 | Print a single number — the required maximum possible number of pairs. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.