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 | a11ff78bac8ad80256979b564133364a | train_002.jsonl | 1412609400 | It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ... | 256 megabytes | import java.util.ArrayList;
import java.util.Scanner;
public class B_Worms_271 {
static int [] list = new int [1000010];
public static void main(String[] args) {
Scanner x = new Scanner(System.in);
int k = x.nextInt(), temp;
// ArrayList<Integer> slon = new ArrayList<Integer>();
for (int i = 0 , t = 0; i... | Java | ["5\n2 7 3 4 9\n3\n1 25 11"] | 1 second | ["1\n5\n3"] | NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi... | Java 7 | standard input | [
"binary search",
"implementation"
] | 10f4fc5cc2fcec02ebfb7f34d83debac | The first line contains a single integer n (1ββ€βnββ€β105), the number of piles. The second line contains n integers a1,βa2,β...,βan (1ββ€βaiββ€β103, a1β+βa2β+β...β+βanββ€β106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1ββ€βmββ€β105), the number of juicy worms said by Marmot.... | 1,200 | Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is. | standard output | |
PASSED | 261d616fedc5ba0ee23bc28a25dc2ea8 | train_002.jsonl | 1412609400 | It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Cf271b {
public static void main(String[] args) throws IOException {
InputStreamReader fin = new InputStreamReader(System.in);
Scanner scr = new Scanner(fin);
int n = scr.nextInt();
int [] a = new int [n];
... | Java | ["5\n2 7 3 4 9\n3\n1 25 11"] | 1 second | ["1\n5\n3"] | NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi... | Java 7 | standard input | [
"binary search",
"implementation"
] | 10f4fc5cc2fcec02ebfb7f34d83debac | The first line contains a single integer n (1ββ€βnββ€β105), the number of piles. The second line contains n integers a1,βa2,β...,βan (1ββ€βaiββ€β103, a1β+βa2β+β...β+βanββ€β106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1ββ€βmββ€β105), the number of juicy worms said by Marmot.... | 1,200 | Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is. | standard output | |
PASSED | 50cb54b1abf54a03317d3f0c19f4938b | train_002.jsonl | 1412609400 | It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ... | 256 megabytes | import java.util.Scanner;
public class Worms {
public static void main(String args[]){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] piles = new int[n + 1];
for (int i = 1; i <= n; i++) {
piles[i] = in.nextInt();
}
... | Java | ["5\n2 7 3 4 9\n3\n1 25 11"] | 1 second | ["1\n5\n3"] | NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi... | Java 7 | standard input | [
"binary search",
"implementation"
] | 10f4fc5cc2fcec02ebfb7f34d83debac | The first line contains a single integer n (1ββ€βnββ€β105), the number of piles. The second line contains n integers a1,βa2,β...,βan (1ββ€βaiββ€β103, a1β+βa2β+β...β+βanββ€β106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1ββ€βmββ€β105), the number of juicy worms said by Marmot.... | 1,200 | Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is. | standard output | |
PASSED | fec303a4d92e641da543234cce5eba80 | train_002.jsonl | 1412609400 | It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ... | 256 megabytes | import java.util.Scanner;
public class worns {
public static void main(String[] args) {
//http://codeforces.com/problemset/problem/474/B
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
//int b=input.nextInt();
int[] res = new int[1000001];//mi 10^6
int at = 0;
... | Java | ["5\n2 7 3 4 9\n3\n1 25 11"] | 1 second | ["1\n5\n3"] | NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi... | Java 7 | standard input | [
"binary search",
"implementation"
] | 10f4fc5cc2fcec02ebfb7f34d83debac | The first line contains a single integer n (1ββ€βnββ€β105), the number of piles. The second line contains n integers a1,βa2,β...,βan (1ββ€βaiββ€β103, a1β+βa2β+β...β+βanββ€β106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1ββ€βmββ€β105), the number of juicy worms said by Marmot.... | 1,200 | Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is. | standard output | |
PASSED | aa5bb5cb6dddf9dab3765a5e51216737 | train_002.jsonl | 1412609400 | It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ... | 256 megabytes | import java.util.Scanner;
public class C_474B {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int [] ans = new int[(int)1e6+1];
int sum = 0, k = 0;
for (int i = 1; i <= n; i++) {
int x = sc.nextInt();
sum+=x;
for (int j = k; j <= sum; j... | Java | ["5\n2 7 3 4 9\n3\n1 25 11"] | 1 second | ["1\n5\n3"] | NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi... | Java 7 | standard input | [
"binary search",
"implementation"
] | 10f4fc5cc2fcec02ebfb7f34d83debac | The first line contains a single integer n (1ββ€βnββ€β105), the number of piles. The second line contains n integers a1,βa2,β...,βan (1ββ€βaiββ€β103, a1β+βa2β+β...β+βanββ€β106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1ββ€βmββ€β105), the number of juicy worms said by Marmot.... | 1,200 | Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is. | standard output | |
PASSED | fa4d98e4651a8ce6e803988bf4987ec7 | train_002.jsonl | 1412609400 | It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ... | 256 megabytes | //package Codeforces.Div2B_271.Code1;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
/*
* some cheeky quote
*/
public class Main
{
FastScanner in;
PrintWriter out;
private int a[] = new int[10000... | Java | ["5\n2 7 3 4 9\n3\n1 25 11"] | 1 second | ["1\n5\n3"] | NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi... | Java 7 | standard input | [
"binary search",
"implementation"
] | 10f4fc5cc2fcec02ebfb7f34d83debac | The first line contains a single integer n (1ββ€βnββ€β105), the number of piles. The second line contains n integers a1,βa2,β...,βan (1ββ€βaiββ€β103, a1β+βa2β+β...β+βanββ€β106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1ββ€βmββ€β105), the number of juicy worms said by Marmot.... | 1,200 | Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is. | standard output | |
PASSED | 4e1b475d4005b9862ce2b6e9130409b8 | train_002.jsonl | 1412609400 | It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] worms = new int[1000001];
int k = 1;
int lastIdx = 1;
for (int i = 0; i < n; i++) {
int a = in.nextInt();
... | Java | ["5\n2 7 3 4 9\n3\n1 25 11"] | 1 second | ["1\n5\n3"] | NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi... | Java 7 | standard input | [
"binary search",
"implementation"
] | 10f4fc5cc2fcec02ebfb7f34d83debac | The first line contains a single integer n (1ββ€βnββ€β105), the number of piles. The second line contains n integers a1,βa2,β...,βan (1ββ€βaiββ€β103, a1β+βa2β+β...β+βanββ€β106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1ββ€βmββ€β105), the number of juicy worms said by Marmot.... | 1,200 | Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is. | standard output | |
PASSED | e0abe1365a3f6088db7063c314cb8072 | train_002.jsonl | 1412609400 | It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int numPiles, numJuicy, label;
int numWorms[] = new int[100000];
int juicyLabels[] = new int[100000];
while (s.hasNextInt()) {
... | Java | ["5\n2 7 3 4 9\n3\n1 25 11"] | 1 second | ["1\n5\n3"] | NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi... | Java 7 | standard input | [
"binary search",
"implementation"
] | 10f4fc5cc2fcec02ebfb7f34d83debac | The first line contains a single integer n (1ββ€βnββ€β105), the number of piles. The second line contains n integers a1,βa2,β...,βan (1ββ€βaiββ€β103, a1β+βa2β+β...β+βanββ€β106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1ββ€βmββ€β105), the number of juicy worms said by Marmot.... | 1,200 | Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is. | standard output | |
PASSED | 52778faad9b1286fc3582f6eb7681f0b | train_002.jsonl | 1412609400 | It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ... | 256 megabytes |
import java.util.Arrays;
import java.util.Scanner;
public class Worms {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
int i;
int n=console.nextInt();
int arr[]=new int [n];
for(i=0;i<arr.length;i++)
arr[i]=console.... | Java | ["5\n2 7 3 4 9\n3\n1 25 11"] | 1 second | ["1\n5\n3"] | NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi... | Java 7 | standard input | [
"binary search",
"implementation"
] | 10f4fc5cc2fcec02ebfb7f34d83debac | The first line contains a single integer n (1ββ€βnββ€β105), the number of piles. The second line contains n integers a1,βa2,β...,βan (1ββ€βaiββ€β103, a1β+βa2β+β...β+βanββ€β106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1ββ€βmββ€β105), the number of juicy worms said by Marmot.... | 1,200 | Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is. | standard output | |
PASSED | 54d1e28bd7fddec77be78a51f838a542 | train_002.jsonl | 1412609400 | It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.StreamTokenizer;
/*
import doge.wow.Shibeforces;
βββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββ
βββββββ... | Java | ["5\n2 7 3 4 9\n3\n1 25 11"] | 1 second | ["1\n5\n3"] | NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi... | Java 7 | standard input | [
"binary search",
"implementation"
] | 10f4fc5cc2fcec02ebfb7f34d83debac | The first line contains a single integer n (1ββ€βnββ€β105), the number of piles. The second line contains n integers a1,βa2,β...,βan (1ββ€βaiββ€β103, a1β+βa2β+β...β+βanββ€β106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1ββ€βmββ€β105), the number of juicy worms said by Marmot.... | 1,200 | Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is. | standard output | |
PASSED | 331386526ee7c8805f87438339e53c23 | train_002.jsonl | 1412609400 | It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ... | 256 megabytes | import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
import java.util.Arrays;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public cla... | Java | ["5\n2 7 3 4 9\n3\n1 25 11"] | 1 second | ["1\n5\n3"] | NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi... | Java 7 | standard input | [
"binary search",
"implementation"
] | 10f4fc5cc2fcec02ebfb7f34d83debac | The first line contains a single integer n (1ββ€βnββ€β105), the number of piles. The second line contains n integers a1,βa2,β...,βan (1ββ€βaiββ€β103, a1β+βa2β+β...β+βanββ€β106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1ββ€βmββ€β105), the number of juicy worms said by Marmot.... | 1,200 | Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is. | standard output | |
PASSED | ea455c311f0da94da377dd6f54437077 | train_002.jsonl | 1412609400 | It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ... | 256 megabytes | import java.util.*;
public class CS474B {
static class Pair{
public int i;
public int j;
}
public static int binarySearch(Pair[] arr, int size, int target) {
int lo = 0;
int hi = size-1;
int mid = 0;
while (lo <= hi) {
mid = lo + (hi-lo) / 2;
if (arr[mid].i <= target && arr[mid].j >= target) {
... | Java | ["5\n2 7 3 4 9\n3\n1 25 11"] | 1 second | ["1\n5\n3"] | NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi... | Java 7 | standard input | [
"binary search",
"implementation"
] | 10f4fc5cc2fcec02ebfb7f34d83debac | The first line contains a single integer n (1ββ€βnββ€β105), the number of piles. The second line contains n integers a1,βa2,β...,βan (1ββ€βaiββ€β103, a1β+βa2β+β...β+βanββ€β106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1ββ€βmββ€β105), the number of juicy worms said by Marmot.... | 1,200 | Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is. | standard output | |
PASSED | 4c7187acf005d77bc537e8196c653051 | train_002.jsonl | 1412609400 | It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ... | 256 megabytes | import java.util.*;
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] plates = new int[n + 1];
int[] d = new int[3000000];
int sum = 0;
int k = 1;
for (int i = 1; i <= n; i++) {
... | Java | ["5\n2 7 3 4 9\n3\n1 25 11"] | 1 second | ["1\n5\n3"] | NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi... | Java 7 | standard input | [
"binary search",
"implementation"
] | 10f4fc5cc2fcec02ebfb7f34d83debac | The first line contains a single integer n (1ββ€βnββ€β105), the number of piles. The second line contains n integers a1,βa2,β...,βan (1ββ€βaiββ€β103, a1β+βa2β+β...β+βanββ€β106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1ββ€βmββ€β105), the number of juicy worms said by Marmot.... | 1,200 | Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is. | standard output | |
PASSED | e042be9c64ed1a4fbd152debf7f10949 | train_002.jsonl | 1412609400 | It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ... | 256 megabytes | //package CodeforcesRoundN271;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class B {
private static BufferedReader in;
private static StringTokenizer st;
public static void main(String[] args) throws IOException {
InputSt... | Java | ["5\n2 7 3 4 9\n3\n1 25 11"] | 1 second | ["1\n5\n3"] | NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi... | Java 7 | standard input | [
"binary search",
"implementation"
] | 10f4fc5cc2fcec02ebfb7f34d83debac | The first line contains a single integer n (1ββ€βnββ€β105), the number of piles. The second line contains n integers a1,βa2,β...,βan (1ββ€βaiββ€β103, a1β+βa2β+β...β+βanββ€β106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1ββ€βmββ€β105), the number of juicy worms said by Marmot.... | 1,200 | Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is. | standard output | |
PASSED | c863f423ac43a8e6c6d257ffaf976dd5 | train_002.jsonl | 1412609400 | It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ... | 256 megabytes | //package com.codeforces.p474;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
public class Main {
private StreamTokenizer in;
private PrintWriter out;
private ... | Java | ["5\n2 7 3 4 9\n3\n1 25 11"] | 1 second | ["1\n5\n3"] | NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi... | Java 7 | standard input | [
"binary search",
"implementation"
] | 10f4fc5cc2fcec02ebfb7f34d83debac | The first line contains a single integer n (1ββ€βnββ€β105), the number of piles. The second line contains n integers a1,βa2,β...,βan (1ββ€βaiββ€β103, a1β+βa2β+β...β+βanββ€β106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1ββ€βmββ€β105), the number of juicy worms said by Marmot.... | 1,200 | Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is. | standard output | |
PASSED | e8671791ca4aaaec799de2fd0ea7052e | train_002.jsonl | 1412609400 | It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ... | 256 megabytes | import java.util.Random;
import java.util.*;
import java.util.Scanner;
public class Main {
public static String binary = "";
//System.out.println(ans);
public static int gcd(int a,int b){
if(a == 0)
return b;
return gcd(b % a, a);
}
private static void Binaryform(int number) {
int rem... | Java | ["5\n2 7 3 4 9\n3\n1 25 11"] | 1 second | ["1\n5\n3"] | NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi... | Java 7 | standard input | [
"binary search",
"implementation"
] | 10f4fc5cc2fcec02ebfb7f34d83debac | The first line contains a single integer n (1ββ€βnββ€β105), the number of piles. The second line contains n integers a1,βa2,β...,βan (1ββ€βaiββ€β103, a1β+βa2β+β...β+βanββ€β106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1ββ€βmββ€β105), the number of juicy worms said by Marmot.... | 1,200 | Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is. | standard output | |
PASSED | a1f03a3afe9a45d15349284a45a3f545 | train_002.jsonl | 1412609400 | It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class B474 {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.p... | Java | ["5\n2 7 3 4 9\n3\n1 25 11"] | 1 second | ["1\n5\n3"] | NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi... | Java 7 | standard input | [
"binary search",
"implementation"
] | 10f4fc5cc2fcec02ebfb7f34d83debac | The first line contains a single integer n (1ββ€βnββ€β105), the number of piles. The second line contains n integers a1,βa2,β...,βan (1ββ€βaiββ€β103, a1β+βa2β+β...β+βanββ€β106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1ββ€βmββ€β105), the number of juicy worms said by Marmot.... | 1,200 | Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is. | standard output | |
PASSED | ca1cd744e80076cce10bd7aa815b3e4e | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 256 megabytes |
/**
*
*/
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
/**
* @author moham
*
*/
public class D {
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | ff1977c2a7f2ea586fd323f3dc7f5c8f | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 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.HashMap;
import java.util.Scanner;
/**
* @Created by sbhowmik on 04/03/19
*/
public class PolycarpSNewJob {
static public class PolycarpSNewJobOb... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | 1a98967d3a1600e3e541c32303486a82 | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 256 megabytes | import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;
public class Solution {
private static final Scanner sc = new Scanner(System.in);
public static void main(String[] args) throws IOException {
... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | ebfd1301c832faa0256ef379e0c49efe | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Educational {
public static void main(String[] args) throws IOException {
Educational c = new Educational();
c.start();
}
private void... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | 71296e09096e1bc0b9cbb596d9b129ce | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Map;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at t... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | dd5320f512e295e6eb765481dac4af6a | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 256 megabytes | //package codeforces.ECR58;
import java.io.*;
import java.util.InputMismatchException;
public class D {
public static final String yes = "YES";
public static final String no = "NO";
public static void main(String args[]) throws Exception {
int n = scn.nextInt();
int max = Integer.MIN_VA... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | e58b9f2304dad9eba009386646c38f70 | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 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;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Jenish
*/
public class Ma... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | 339a8b9beeb5ceeefa9053974d0b2c34 | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 256 megabytes |
import java.util.*;
public class CF1101D {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int ascaksclkasl = Integer.MIN_VALUE;
int n = s.nextInt();
int skcakscmaskcakcjk = Integer.MIN_VALUE;
StringBuilder qwdqwdlq = new StringBuilder();
... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | 304aeb9e3a9695db48bd50914562c780 | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 256 megabytes | import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
StringBuilder stringBuilder = new StringBuilder();
long xx = 0;
long yy = 0;
while(n-- > 0) {
String q = scanner.next();
if(q.equals("?")) ... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | 6bc139a989ac8c27a0f7cbdded956b5d | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
public class Main{
public static void main(String[] args) throws IOException{
StringTokenizer stringTokenizer;
BufferedReader bufferedReader = new Buffere... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | e6c2581914337df9cf4b6e947e10c23d | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
public class E {
public static void main(String[] args) {
PrintWriter out = new PrintWriter(System.out);
FastIn in = FastIn.wrapSystemIn();
int Q = in.nextInt();
int minD = 0;
int maxD = 0;
for (int qi = 0; qi < Q; ... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | 77d7fdbaa40c5586dac1b9530f2072f3 | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
import java.util.TreeSet;
public class E {
public static void main(String[] args) {
PrintWriter out = new PrintWriter(System.out);
FastIn in = FastIn.wrapSystemIn();
int Q = in.nextInt();
TreeSet<Integer> min = new TreeSet<>();
... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | 031edae4b4b36cfa866b7796146efbfa | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 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 MaxHeap
*/
public class Main ... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | 13124c628cb1c281a8af6f8a9775621b | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 256 megabytes | //created by Whiplash99
import java.io.*;
import java.util.*;
public class E
{
public static void main(String[] args) throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int i,N;
int l1=0,r1=0;
N=Integer.parseInt(br.readLine().trim());
... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | ad704ca7b0b40bd8942fe70f4e32f56d | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.Input... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | 51bb959390c587fd4ce4b4f1ce2ea36f | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 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.*;
public class Soly
{
static final int INF = Integer.MAX_VALUE;
static void mergeSort(int[] a,int [] c, int b, int e)
{
if(b < e)... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | 27a778c517f15a31ca7ec44cc47624a6 | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 256 megabytes | import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Scanner;
public class e {
public static void main(String[] args) {
JS in = new JS();
PrintWriter out = new PrintWriter(System.out);
new e().... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | 60ed6ba25dc785f9ed8f65b3bd20f318 | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 256 megabytes |
import java.io.*;
import java.math.*;
import java.util.*;
import javafx.util.Pair;
public class Level {
public static DS.Scanner in = new DS.Scanner();
public static DS.Print out = new DS.Print();
public static int[] parent = null;
public static void main(String[] args) throws IOException {
... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | 241581991724d2f252142b82add6a68b | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 256 megabytes |
import java.io.*;
import java.util.*;
public class Q4 {
static class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader() {
reader = new BufferedReader(new InputStreamReader(System.in), 32768);
tokenizer = null;
... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | 36339499e10b2a678919caf7c614ef1d | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 256 megabytes |
import java.io.*;
import java.util.*;
public class Code534B
{
public static void main(String[] args) throws IOException
{
BufferedReader jk = new BufferedReader(new InputStreamReader(System.in)) ;
StringTokenizer ana = new StringTokenizer(jk.readLine()) ;
OutputStream out = new BufferedOutputStream ( System... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | 5f5cffe887f50db23342306d1ea13243 | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
public class PolycarpNewJob {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int n = Integer.pa... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | 77ec33543cb4ed99dbb516199db01841 | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 256 megabytes | import java.math.BigInteger;
import java.text.DecimalFormat;
import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | 5fc5b97d7297002444fa2ff11052c6be | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | e59cac41dc6146d95fcc01e2a4a749f7 | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 256 megabytes |
import java.io.*;
import java.util.*;
//Mann Shah [ DAIICT ].
//fast io
public class Main {
static int mod = (int) (1e9+7);
static InputReader in;
static PrintWriter out;
public static boolean check(int x ,int y , int h , int w) {
if( x<=h && y<=w || y<=h && x<=w)
{
return true;
}
else {
... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | 8703b19f2059d5fe8b4aea029b3789b9 | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 256 megabytes | import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution
{
static class InputReader
{
private final InputStream stream;
private final byte[] buf = new byte[8192];
private int curChar, snumChars;
public InputReader(InputStream ... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | 62630c1b4f900e3730dfa9a079f3b324 | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
StreamTokenizer in=new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));
in.nextToken();
... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | 9ec323a393c7c7f1271984533ea93b76 | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
PrintWriter printWriter = new PrintWriter(System.out);
int n = Integer.parseInt(buffer... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | 5d6400723facbc3bdae82028c116f59d | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
/**
* @author Andrei Chugunov
*/
public class Main {
private static class Solution {
private... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | 8dd01f7efaccaed99e11baa1fe23f45a | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 256 megabytes | import java.io.*;
import java.util.*;
public class E
{
public static void main(String[] args) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(System.out);
int q = Integer.parseInt(br.readLine());
int x_ = 0, y_ = 0;
while (q-... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | f621078c05511022df760e8d3fb9044a | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 256 megabytes | /*
yeet
*/
import java.util.*;
import java.io.*;
public class E
{
public static void main(String args[]) throws Exception
{
BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
String str = infile.readLine();
int Q = Integer.parseInt(str);
... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | 352958a5517b83ac225278c102303964 | train_002.jsonl | 1547217300 | Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).A bi... | 256 megabytes | // Working program using Reader Class
import java.io.*;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.StringTokenizer;
public class Main
{
static class Reader
{
final private int BUFFER_S... | Java | ["9\n+ 3 2\n+ 2 3\n? 1 20\n? 3 3\n? 2 3\n+ 1 5\n? 10 10\n? 1 5\n+ 1 1"] | 3 seconds | ["NO\nYES\nYES\nYES\nNO"] | NoteThe queries of type $$$2$$$ of the example: Neither bill fits; Both bills fit (just checking that you got that bills can overlap); Both bills fit (both bills are actually the same); All bills fit (too much of free space in a wallet is not a problem); Only bill $$$1 \times 5$$$ fit (all the others don't, thus i... | Java 8 | standard input | [
"implementation"
] | fe939f7503f928ff4dbe8d05c5643f38 | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^5$$$) β the number of queries. Each of the next $$$n$$$ lines contains a query of one of these two types: $$$+~x~y$$$ ($$$1 \le x, y \le 10^9$$$) β Polycarp earns a bill of size $$$x \times y$$$; $$$?~h~w$$$ ($$$1 \le h, w \le 10^9$$$) β Pol... | 1,500 | For each query of type $$$2$$$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise. | standard output | |
PASSED | 8c4af3c299d9524a2ad3795ad7732f45 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.io.*;
import java.util.*;
public class Code0911 {
public static void main(String[] args) {
Reader s = new Reader();
int t = s.nextInt();
while (t-- > 0){
long a = s.nextLong();
long m = s.nextLong();
long d = gcd(a,m);
long k1... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 272c7e081bdd84ef16292524e47d4c3d | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 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
*/
public class Main {
public static... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 8cdca4b1d94db8d88d8eb5fba1f87c7b | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
new Main().run();}
int ct = 0;
void add(int u,int v){
to[ct] = v;
ne[ct] = h[u];
h[u] = ct++;
}
... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 4f1d924f219da00ce92bad9f5a4641b5 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
new Main().run();}
int ct = 0;
void add(int u,int v){
to[ct] = v;
ne[ct] = h[u];
h[u] = ct++;
}
... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | eb8d99b936b5d996006235755db93fde | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
new Main().run();}
int ct = 0;
void add(int u,int v){
to[ct] = v;
ne[ct] = h[u];
h[u] = ct++;
}
... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | bba37921b209e8c29b3cd8c448e9c987 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
new Main().run();}
int ct = 0;
void add(int u,int v){
to[ct] = v;
ne[ct] = h[u];
h[u] = ct++;
}
... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 8a3a0d24b2d292768c0442d7088b6f49 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.ArrayList;
public class Main
{
public static void main(String[] args) {
new Thread(null, new Runnable() {
public void run() {
... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | e06ed1cceb7cbf76826adab30eb58a65 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 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.Arrays;
import java.util.InputMismatchException;
import java.util.Map;
import java.util.Stack;
import java.util.TreeMap;
impor... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 320cac7c47354e0dfeeac03333ae74a6 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
// taken from
// https://www.geeksforgeeks.org/eulers-totient-function/
static long gcd(long a, long b)
{
if(a==0 || b==0)
return a+b;
return gcd(b,a%b);
}
static long phi(long n)
{
long result = n;
for (long p = 2; p * p <= n; ++p)
{
... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 0dc72a43178a44409612cb849d3d6499 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.util.*;
public final class D1295 {
private static long gcd(long a, long b) {
if (b == 0) return a;
return gcd(b, a % b);
}
private static long phi(long n) {
long answer = n;
for (long i = 2; i * i <= n; i++) {
if (n % i == 0) {
while (n % i == 0) {
n /= i;
... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 2441ed4f5b45dbdac7dc8f2f574b33e0 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.io.*;
public class Solution {
public static void main(String []args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int not = Integer.parseInt(br.readLine());
while(not--!=0) {
String input[] = br.readLine().split(" ");... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 554588f4a9d25ef4fe194d687f04a5fc | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import sun.dc.pr.PRError;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
i... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 32ea8a186686f62086beccc532f93d25 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.awt.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*;
import java.util.List;
public class Main {
static int mod = (int) 1e9 + 7;
public static void main(String[] args){
FastReader sc = new FastRea... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | d897cfde532dbd1aa44706670d371cd9 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | //package main;
import java.io.*;
import java.util.*;
import java.lang.*;
import java.math.*;
public class Submission {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter (System.... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 3ae7ce1867d0c0fc1bf154b43c897607 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
private static void execute(ContestReader reader, PrintWriter out) {
int t = reader.nextInt();
for (int i = 0; i < t; i++) {
long a = reader.nextLong();
long m = reader.nextLong();
out.println(new Solver(a, m).solve());
}
}
... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 9a3952e702dae5e1cbfdac82c928839c | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.io.*;
public class Solution {
public static void main(String []args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int not = Integer.parseInt(br.readLine());
while(not--!=0) {
String in... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 28e992df9c88bb1a275cd241582eb014 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 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.HashMap;
import java.util.Map;
import java.util.SortedSet;
import java.util.StringTokenizer;
import java.util.TreeSet;
/**
*
*/
public class TaskD {
... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 9ae18070466ebef43214a4589a9cdee6 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.util.*;
public class HelloWorld{
public static void main(String []args){
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0)
{
long a=sc.nextLong();
long m=sc.nextLong();
long g=gcd(a,m);
long x=m/g;
... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 33ca3a7a4f6e58b9bf45f4876e014e28 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.io.*;
import java.util.*;
public class D implements Runnable {
boolean judge = false;
FastReader scn;
PrintWriter out;
String INPUT = "";
void solve() {
int t = scn.nextInt();
while (t-- > 0) {
long a = scn.nextLong(), m = scn.nextLong();
long g = gcd(a, m);
m /= g;
long[] pr = ne... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 3710af47a12dabf4e922256dd4be36ff | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | // package Quarantine;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class SameGCDs {
public static void main(String[] args)throws IOException {
BufferedReader br=new BufferedReader(new Inpu... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 94016ac4a133fda4868ba13212456e66 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static void main(String[] args) {
Input... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | a6d433264e7da2c9ff21b062f690a0b9 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.io.*;
import java.util.*;
public class D implements Runnable {
FastReader sc;
PrintWriter out;
long mod = (long)1e9 + 7;
long gcd(long a,long b)
{
if(a == 0) return b;
if(b == 0) return a;
return gcd(b,a%b);
}
long phi(long n)
{
long result = n;
for(long i = 2; i*i <= n; i++)
{ ... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 0dfeeffc6388026d154aa4d6161b7493 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.util.*;
import java.io.*;
public class SameGCDs {
public static void main(String[] args) throws IOException{
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
int t = Integer.parseInt(f... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 80a117758354c161f559e61b6409edf7 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Main m = new Main();
// int count = 0;
// long a = 1;
// long b = 30;
// long g = m.gcd(a, b);
//
// for (int i = 0; i <b; i++) {
// if (m.gcd(b, a + i) == g) {... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | ad8dc702c356f3749b20ec510e65a9cd | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | //package learning;
import java.util.*;
import java.io.*;
import java.lang.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class NitsLocal {
static ArrayList<String> s1;
static boolean[] prime;
static int n = (int)1e7;
static void sieve() {
Arrays.fill(prime , true);
pr... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | e239d9b4b1058c44d7a3eb28985ae947 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.io.*;
import java.util.*;
public class D {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
int T = sc.nextInt();
for(int _t = 0; _t < T; _t++) {
long a = sc.nextLong();
long m = sc.nextLong();
long g = gcd(a, m);
long x = m / g;
long sqx = (long)Math.sqrt... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 2ca61b6f4e083ad9d6261f23b7e04686 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes |
import java.util.*;
import java.lang.*;
import java.lang.reflect.Array;
import java.io.*;
import java.math.*;
import java.text.DecimalFormat;
public class Prac{
static class InputReader {
private final InputStream stream;
private final byte[] buf = new byte[8192];
private int curChar... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | ffc254cb1fc4ae36c5fe19190feeebae | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | /**
* BaZ :D
*/
import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main
{
static MyScanner scan;
static PrintWriter pw;
static long MOD = 1_000_000_007;
static long INF = 1_000_000_000_000_000_000L;
static long inf = 2_000_000_000;
public static void main(Stri... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | cab47d54715dfbd144beb1093c0271fc | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | /*
Solution: If gcd(a, m) != 1, divide both the #s by that GCD to get the same
problem, but with a GCD of 1. Now, just check how many #s from [a, a+m) are
coprime with m to get your answer. m will never be 1 (a < m), so no need to
worry about this case.
To count the numbers that are coprime with x, find the prime fact... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 62182f3e595ebe5f10c7d00c2f72f63f | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.util.*;
import java.math.*;
import java.io.*;
public class d {
// no duplicates
List<Long> prime_f(long n) {
List<Long> primef = new ArrayList<>();
for(long i = 2 ; i * i <= n ; i++) {
if(n % i == 0) {
primef.add(i);
while(n % i == 0) {
n /= i;
}
}
}
if(n > 1) primef.add(n)... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | d8e0a300baf4abec952d6db6879d25a1 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 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\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | c19d7d97b0d08b1a8abb942bfa02d889 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.util.*;
import java.io.*;
public class Solution{
static PrintWriter out=new PrintWriter(System.out);
public static void main (String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String[] input=br.readLine().trim().split(" ");
int numTest... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 575d3c24c6b066421c80ab7a279eb44b | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.TreeMap;
import java.util.StringTokenizer;
import java.util.Map;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 1f7eced2eb5863cfc5e6db600038c646 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;
public class realfast implements Runnable {
private static final int INF = (int) 1e9;
public void solve() throws IOException
{
int t = readInt();
for(int f =0... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 68f1c1d72380a9f9b899c77fbf4038c7 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
public class D {
public static void main(String[] args) {
FastScanner fs... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | b176b85e703067ae079276ba3fbe6051 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.util.*;
public class Main {
static long gcd(long a,long b) {
long temp;
while ((temp=a%b)!=0) {
a=b;
b=temp;
}
return b;
}
static ArrayList<long[]> factorization (long n) {
ArrayList<long[]> list = new ArrayList<long[]>();
... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 4e65d21e5a1917c8b4114ae409d80f21 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | //Same GCD's
import java.io.*;
import java.util.*;
public class D1295{
public static void main(String[] args)throws IOException{
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
int t = Integer.parseInt(f.readLine())... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | c6349c682a027703196f818a664e2c50 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | /* / οΎοΎβ β β β β β β β β β β β γ
/ )\β β β β β β β β β β β β Y
(β β | ( Ν‘Β° ΝΚ Ν‘Β°οΌβ β(β γ
(β οΎβ Y βγ½-γ __οΌ
| _β qγ| γq |/
(β γΌ '_δΊΊ`γΌ οΎ
β |\ οΏ£ _δΊΊ'彑οΎ
β )\β β qβ β /
β β (\β #β /
β /β β β /α½£====================D-
/β β β /β \ \β β \
( (β )β β β β ) ).β )
(β β )β β β β β ( | /
|β /β β β β β β | /
[_] β β β β β [___] */
// Main Code at the Bottom
import ... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 4470b3d4d1e4c0576875c8dc3fa74ad4 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | /*package whatever //do not write package name here */
import java.io.*;
import java.util.*;
public class GFG {
private static long gcd(long a,long b){
if(a<b)
return gcd(b,a);
if(a%b==0)
return b;
return gcd(b,a%b);
}
public static void main (String[] arg... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | fe25a129631e13d8876f60961c61e944 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.util.*;
import java.io.*;
public class Task{
static long gcd(long a,long b){if(b==0){return a;}return gcd(b,a%b);}
static long phi(long n){
int k=(int)Math.sqrt(n);
long x=1,y=n;
for(int i=2;i<=k;i++){
boolean b=false;
while(n%i==0){
n/=i;b=true;
}
if(b){
y/=i;
x*=(... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 3c9f7c258104a454852b2b9161c8f83f | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.util.*;
import java.io.*;
public class Task{
static long gcd(long a,long b){if(b==0){return a;}return gcd(b,a%b);}
static long phi(long n){
int k=(int)Math.sqrt(n);
long x=1,y=n;
for(int i=2;i<=k;i++){
boolean b=false;
while(n%i==0){
n/=i;b=true;
}
if(b){
y/=i;
x*=(... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 80c7312efb6988141d30673530fecabb | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | /* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner s = new Sca... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | da21d937bb6f5ac63a7b2665a6320d66 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Reader_ {
static class Reader {
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferPointer, bytesRead;
public Reader() {
... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 63d8184c0e3f401ffe4e40e8be854213 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Arr... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 994eca4aef3a80f53d6db23c58528e64 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 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;
/**
* Built using CHelper plug-in
* Actual soluti... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | dea8f7a77813b07c5e8e38def60f74fb | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | /*
* Remember a 6.72 student can know more than a 10.0 student.
* Grades don't determine intelligence, they test obedience.
* I Never Give Up.
* I will become Candidate Master today.
* I will defeat Saurabh Anand.
* Skills are Cheap,Passion is Priceless.
*/
import java.util.*;
import java.util.Map.Entry;
import... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 46944d76ab927adbcc350d35c4bdb575 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.io.*;
import java.util.*;
public class MainClass
{
public static void main(String[] args)throws IOException
{
Reader in = new Reader();
int t = in.nextInt();
StringBuilder stringBuilder = new StringBuilder();
while (t-- > 0)
{
long a = in.nextLong... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 8c9a6df73bdaef4e68419ff246efb48d | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitS... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 4a801395d6a19b7089be876fde71aae6 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.util.*;
import java.io.*;
public class SameGCDs {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
int T = Integer.parseInt(in.readLine());
for(int i = 0; i < T; ++i)... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 9f50d3f8329ba629f319eae9e1cdd470 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.awt.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.List;
public class Drogon {
public static void main(String[] args) throws IOException {
FastReader sc = new FastReader();
int t=sc.nextInt();
... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 6a2ac5b9b3b449708a5119ebda7611cc | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes |
import java.util.*;
import java.io.*;
public class two {
// https://codeforces.com/contest/1295/problem/D
public static void main(String[] args) throws IOException, FileNotFoundException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
//BufferedReader in = new BufferedReader(new F... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | ffb6de9132a2ec059dd40c06f75b3893 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.math.BigInteger;
import java.util.*;
import java.io.*;
import java.text.*;
public class Main{
//SOLUTION BEGIN
//Into the Hardware Mode
void pre() throws Exception{}
void solve(int TC)throws Exception {
long a = nl(), m = nl();
long g = gcd(a, m);
m /= g;
pn(p... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) β the number of test cases. Next $$$T$$$ lines contain test cases β one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers β one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.