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
78d569fe093bb57fece12443b00be267
train_000.jsonl
1443430800
Petya loves computer games. Finally a game that he's been waiting for so long came out!The main character of this game has n different skills, each of which is characterized by an integer ai from 0 to 100. The higher the number ai is, the higher is the i-th skill of the character. The total rating of the character is c...
256 megabytes
import java.io.*; import java.util.*; public class C322C { public static StringTokenizer st; public static void nextLine(BufferedReader br) throws IOException { st = new StringTokenizer(br.readLine()); } public static String next() { return st.nextToken(); } pu...
Java
["2 4\n7 9", "3 8\n17 15 19", "2 2\n99 100"]
1 second
["2", "5", "20"]
NoteIn the first test case the optimal strategy is as follows. Petya has to improve the first skill to 10 by spending 3 improvement units, and the second skill to 10, by spending one improvement unit. Thus, Petya spends all his improvement units and the total rating of the character becomes equal to lfloor frac{100}{1...
Java 7
standard input
[ "implementation", "sortings", "math" ]
b4341e1b0ec0b7341fdbe6edfe81a0d4
The first line of the input contains two positive integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 107) — the number of skills of the character and the number of units of improvements at Petya's disposal. The second line of the input contains a sequence of n integers ai (0 ≤ ai ≤ 100), where ai characterizes the level of the i-t...
1,400
The first line of the output should contain a single non-negative integer — the maximum total rating of the character that Petya can get using k or less improvement units.
standard output
PASSED
3dd5b8afe2cb85d412ab647178cba65d
train_000.jsonl
1443430800
Petya loves computer games. Finally a game that he's been waiting for so long came out!The main character of this game has n different skills, each of which is characterized by an integer ai from 0 to 100. The higher the number ai is, the higher is the i-th skill of the character. The total rating of the character is c...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class ProblemC { public static void main(String[] args) { InputReader in = new InputReader(); PrintWriter out = ...
Java
["2 4\n7 9", "3 8\n17 15 19", "2 2\n99 100"]
1 second
["2", "5", "20"]
NoteIn the first test case the optimal strategy is as follows. Petya has to improve the first skill to 10 by spending 3 improvement units, and the second skill to 10, by spending one improvement unit. Thus, Petya spends all his improvement units and the total rating of the character becomes equal to lfloor frac{100}{1...
Java 7
standard input
[ "implementation", "sortings", "math" ]
b4341e1b0ec0b7341fdbe6edfe81a0d4
The first line of the input contains two positive integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 107) — the number of skills of the character and the number of units of improvements at Petya's disposal. The second line of the input contains a sequence of n integers ai (0 ≤ ai ≤ 100), where ai characterizes the level of the i-t...
1,400
The first line of the output should contain a single non-negative integer — the maximum total rating of the character that Petya can get using k or less improvement units.
standard output
PASSED
0a632f0004c486b1fc04ed2bad6f7e31
train_000.jsonl
1443430800
Petya loves computer games. Finally a game that he's been waiting for so long came out!The main character of this game has n different skills, each of which is characterized by an integer ai from 0 to 100. The higher the number ai is, the higher is the i-th skill of the character. The total rating of the character is c...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class tree { public static void main(String []args) throws IOException{ BufferedReader in = new BufferedReader( new InputStreamReader(System.in)); String lines[]; int n,k; lines = in.readLine().trim().split("\\s+"); n = Integer.parseInt(lines...
Java
["2 4\n7 9", "3 8\n17 15 19", "2 2\n99 100"]
1 second
["2", "5", "20"]
NoteIn the first test case the optimal strategy is as follows. Petya has to improve the first skill to 10 by spending 3 improvement units, and the second skill to 10, by spending one improvement unit. Thus, Petya spends all his improvement units and the total rating of the character becomes equal to lfloor frac{100}{1...
Java 7
standard input
[ "implementation", "sortings", "math" ]
b4341e1b0ec0b7341fdbe6edfe81a0d4
The first line of the input contains two positive integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 107) — the number of skills of the character and the number of units of improvements at Petya's disposal. The second line of the input contains a sequence of n integers ai (0 ≤ ai ≤ 100), where ai characterizes the level of the i-t...
1,400
The first line of the output should contain a single non-negative integer — the maximum total rating of the character that Petya can get using k or less improvement units.
standard output
PASSED
bd52452c438e8527bac0bf5fd7381066
train_000.jsonl
1443430800
Petya loves computer games. Finally a game that he's been waiting for so long came out!The main character of this game has n different skills, each of which is characterized by an integer ai from 0 to 100. The higher the number ai is, the higher is the i-th skill of the character. The total rating of the character is c...
256 megabytes
import java.util.Arrays; import java.util.Comparator; import java.util.Scanner; public class C { public static void main(String[] args) { Scanner x=new Scanner (System.in); int n=x.nextInt(); int k=x.nextInt(); Integer arr[]=ne...
Java
["2 4\n7 9", "3 8\n17 15 19", "2 2\n99 100"]
1 second
["2", "5", "20"]
NoteIn the first test case the optimal strategy is as follows. Petya has to improve the first skill to 10 by spending 3 improvement units, and the second skill to 10, by spending one improvement unit. Thus, Petya spends all his improvement units and the total rating of the character becomes equal to lfloor frac{100}{1...
Java 7
standard input
[ "implementation", "sortings", "math" ]
b4341e1b0ec0b7341fdbe6edfe81a0d4
The first line of the input contains two positive integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 107) — the number of skills of the character and the number of units of improvements at Petya's disposal. The second line of the input contains a sequence of n integers ai (0 ≤ ai ≤ 100), where ai characterizes the level of the i-t...
1,400
The first line of the output should contain a single non-negative integer — the maximum total rating of the character that Petya can get using k or less improvement units.
standard output
PASSED
eb72cac3dd7b37e04c7bb6d0fe895758
train_000.jsonl
1443430800
Petya loves computer games. Finally a game that he's been waiting for so long came out!The main character of this game has n different skills, each of which is characterized by an integer ai from 0 to 100. The higher the number ai is, the higher is the i-th skill of the character. The total rating of the character is c...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Comparator; import java.util.TreeSet; /** * Created by Tkachi on 2015/9/28. */ public class Task3 { public static void main(String[] arg) throws IOException { Task3 task = new Task3(); ta...
Java
["2 4\n7 9", "3 8\n17 15 19", "2 2\n99 100"]
1 second
["2", "5", "20"]
NoteIn the first test case the optimal strategy is as follows. Petya has to improve the first skill to 10 by spending 3 improvement units, and the second skill to 10, by spending one improvement unit. Thus, Petya spends all his improvement units and the total rating of the character becomes equal to lfloor frac{100}{1...
Java 7
standard input
[ "implementation", "sortings", "math" ]
b4341e1b0ec0b7341fdbe6edfe81a0d4
The first line of the input contains two positive integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 107) — the number of skills of the character and the number of units of improvements at Petya's disposal. The second line of the input contains a sequence of n integers ai (0 ≤ ai ≤ 100), where ai characterizes the level of the i-t...
1,400
The first line of the output should contain a single non-negative integer — the maximum total rating of the character that Petya can get using k or less improvement units.
standard output
PASSED
dfed396b78dbd0879e674f6eae2eb9af
train_000.jsonl
1443430800
Petya loves computer games. Finally a game that he's been waiting for so long came out!The main character of this game has n different skills, each of which is characterized by an integer ai from 0 to 100. The higher the number ai is, the higher is the i-th skill of the character. The total rating of the character is c...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; import java.util.StringTokenizer; public class DevSkills581C { public static void main(String[] args) {...
Java
["2 4\n7 9", "3 8\n17 15 19", "2 2\n99 100"]
1 second
["2", "5", "20"]
NoteIn the first test case the optimal strategy is as follows. Petya has to improve the first skill to 10 by spending 3 improvement units, and the second skill to 10, by spending one improvement unit. Thus, Petya spends all his improvement units and the total rating of the character becomes equal to lfloor frac{100}{1...
Java 7
standard input
[ "implementation", "sortings", "math" ]
b4341e1b0ec0b7341fdbe6edfe81a0d4
The first line of the input contains two positive integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 107) — the number of skills of the character and the number of units of improvements at Petya's disposal. The second line of the input contains a sequence of n integers ai (0 ≤ ai ≤ 100), where ai characterizes the level of the i-t...
1,400
The first line of the output should contain a single non-negative integer — the maximum total rating of the character that Petya can get using k or less improvement units.
standard output
PASSED
6e7a02c48335e4eecf68abe0e44e8f5e
train_000.jsonl
1443430800
Petya loves computer games. Finally a game that he's been waiting for so long came out!The main character of this game has n different skills, each of which is characterized by an integer ai from 0 to 100. The higher the number ai is, the higher is the i-th skill of the character. The total rating of the character is c...
256 megabytes
import java.io.*; import java.util.Arrays; public class Main { static StreamTokenizer in=new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); static int nextInt() throws IOException { in.nextToken(); return (int)in.nval; } static int n,k,a,ans; static Pair[] aa=new P...
Java
["2 4\n7 9", "3 8\n17 15 19", "2 2\n99 100"]
1 second
["2", "5", "20"]
NoteIn the first test case the optimal strategy is as follows. Petya has to improve the first skill to 10 by spending 3 improvement units, and the second skill to 10, by spending one improvement unit. Thus, Petya spends all his improvement units and the total rating of the character becomes equal to lfloor frac{100}{1...
Java 7
standard input
[ "implementation", "sortings", "math" ]
b4341e1b0ec0b7341fdbe6edfe81a0d4
The first line of the input contains two positive integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 107) — the number of skills of the character and the number of units of improvements at Petya's disposal. The second line of the input contains a sequence of n integers ai (0 ≤ ai ≤ 100), where ai characterizes the level of the i-t...
1,400
The first line of the output should contain a single non-negative integer — the maximum total rating of the character that Petya can get using k or less improvement units.
standard output
PASSED
974bab4d8bdc3288a5005109b1e5f74b
train_000.jsonl
1443430800
Petya loves computer games. Finally a game that he's been waiting for so long came out!The main character of this game has n different skills, each of which is characterized by an integer ai from 0 to 100. The higher the number ai is, the higher is the i-th skill of the character. The total rating of the character is c...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.Arrays; import java.util.StringTokenizer; /** * Created by Юля on 28.09.2015. */ public class SolverC581 { public static void main(String[] args) throws IOException { new SolverC581().run(); } BufferedReader br; PrintWriter...
Java
["2 4\n7 9", "3 8\n17 15 19", "2 2\n99 100"]
1 second
["2", "5", "20"]
NoteIn the first test case the optimal strategy is as follows. Petya has to improve the first skill to 10 by spending 3 improvement units, and the second skill to 10, by spending one improvement unit. Thus, Petya spends all his improvement units and the total rating of the character becomes equal to lfloor frac{100}{1...
Java 7
standard input
[ "implementation", "sortings", "math" ]
b4341e1b0ec0b7341fdbe6edfe81a0d4
The first line of the input contains two positive integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 107) — the number of skills of the character and the number of units of improvements at Petya's disposal. The second line of the input contains a sequence of n integers ai (0 ≤ ai ≤ 100), where ai characterizes the level of the i-t...
1,400
The first line of the output should contain a single non-negative integer — the maximum total rating of the character that Petya can get using k or less improvement units.
standard output
PASSED
cc6d89bedc42ee15931fa1a71fdd5b93
train_000.jsonl
1443430800
Petya loves computer games. Finally a game that he's been waiting for so long came out!The main character of this game has n different skills, each of which is characterized by an integer ai from 0 to 100. The higher the number ai is, the higher is the i-th skill of the character. The total rating of the character is c...
256 megabytes
import java.util.*; public class Solution { static Scanner scan = new Scanner(System.in); static Random x = new Random(); public static void main(String[] args) throws Exception{ Solution sol = new Solution(); sol.run(); } private void run() throws Exception { int n = scan...
Java
["2 4\n7 9", "3 8\n17 15 19", "2 2\n99 100"]
1 second
["2", "5", "20"]
NoteIn the first test case the optimal strategy is as follows. Petya has to improve the first skill to 10 by spending 3 improvement units, and the second skill to 10, by spending one improvement unit. Thus, Petya spends all his improvement units and the total rating of the character becomes equal to lfloor frac{100}{1...
Java 7
standard input
[ "implementation", "sortings", "math" ]
b4341e1b0ec0b7341fdbe6edfe81a0d4
The first line of the input contains two positive integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 107) — the number of skills of the character and the number of units of improvements at Petya's disposal. The second line of the input contains a sequence of n integers ai (0 ≤ ai ≤ 100), where ai characterizes the level of the i-t...
1,400
The first line of the output should contain a single non-negative integer — the maximum total rating of the character that Petya can get using k or less improvement units.
standard output
PASSED
a69e959f14f6a21f59b714220de1c4b9
train_000.jsonl
1443430800
Petya loves computer games. Finally a game that he's been waiting for so long came out!The main character of this game has n different skills, each of which is characterized by an integer ai from 0 to 100. The higher the number ai is, the higher is the i-th skill of the character. The total rating of the character is c...
256 megabytes
import java.io.*; import java.util.*; public class Main { static Scanner in; static PrintWriter out; public static void main(String[] args) { in = new Scanner(System.in); new Main().solve(); } void solve() { int n = in.nextInt(), k = in.nextInt(); Integer[] arr = new Integer[n]; for (int i = 0; i < n...
Java
["2 4\n7 9", "3 8\n17 15 19", "2 2\n99 100"]
1 second
["2", "5", "20"]
NoteIn the first test case the optimal strategy is as follows. Petya has to improve the first skill to 10 by spending 3 improvement units, and the second skill to 10, by spending one improvement unit. Thus, Petya spends all his improvement units and the total rating of the character becomes equal to lfloor frac{100}{1...
Java 7
standard input
[ "implementation", "sortings", "math" ]
b4341e1b0ec0b7341fdbe6edfe81a0d4
The first line of the input contains two positive integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 107) — the number of skills of the character and the number of units of improvements at Petya's disposal. The second line of the input contains a sequence of n integers ai (0 ≤ ai ≤ 100), where ai characterizes the level of the i-t...
1,400
The first line of the output should contain a single non-negative integer — the maximum total rating of the character that Petya can get using k or less improvement units.
standard output
PASSED
43dcb944d9d6cb4a540f78b88ddc9a93
train_000.jsonl
1501425300
Slastyona and her loyal dog Pushok are playing a meaningless game that is indeed very interesting.The game consists of multiple rounds. Its rules are very simple: in each round, a natural number k is chosen. Then, the one who says (or barks) it faster than the other wins the round. After that, the winner's score is m...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Main { public static void main(String args[])throws IOException { BufferedReader sc=new BufferedReader(new InputStreamReader(System.in)); PrintWr...
Java
["6\n2 4\n75 45\n8 8\n16 16\n247 994\n1000000000 1000000"]
1 second
["Yes\nYes\nYes\nNo\nNo\nYes"]
NoteFirst game might have been consisted of one round, in which the number 2 would have been chosen and Pushok would have won.The second game needs exactly two rounds to finish with such result: in the first one, Slastyona would have said the number 5, and in the second one, Pushok would have barked the number 3.
Java 8
standard input
[ "math" ]
933135ef124b35028c1f309d69515e44
In the first string, the number of games n (1 ≤ n ≤ 350000) is given. Each game is represented by a pair of scores a, b (1 ≤ a, b ≤ 109) – the results of Slastyona and Pushok, correspondingly.
1,700
For each pair of scores, answer "Yes" if it's possible for a game to finish with given score, and "No" otherwise. You can output each letter in arbitrary case (upper or lower).
standard output
PASSED
31cd2433946709c9d7830a9d1dc8ec00
train_000.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.Scanner; public class solii_runner{ static class helper { public int Parent(int index) { return index >> 1; } public int Left(int index) { return (index << 1); } public int Right(int index) { return (index << 1) | 1; } } static class min_...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
56f9f0b0a4858d1460f14b7683a8a544
train_000.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.*; import java.io.*; public class CF545D{ public static void main(String[] args)throws Exception { InputReader in = new InputReader(System.in); PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out)); int n = in.nextInt(); int a[] = new int[n]; for(int i = 0; i < n;...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
97cf7630676f9c759d3c178bfa0943b0
train_000.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.*; import java.io.*; public class CF545D{ public static boolean[] bol; public static void main(String[] args)throws Exception { InputReader in = new InputReader(System.in); PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out)); int n = in.nextInt(); int a[] = new in...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
ba5ba654fb4bd04a194ef9068c3311a8
train_000.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.StreamTokenizer; import java.util.Arrays; public class Main_545D { public static void main(String[] args) throws IOException { StreamTokenizer tokenizer = new StreamTokenizer(new BufferedReader(new ...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
7c1d260c7beabbc774ec98eaf8596444
train_000.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.*; public class q { public static void main(String args[]) { Scanner s=new Scanner(System.in); String a=s.nextLine(); String t=s.nextLine(); String b[]=t.split(" "); int c[]=new int[b.length]; for(int i=0;i<b.length;i++) { c[i]...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
81b06ecec8dc1efeb345108f1b3af727
train_000.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
//package helloworld; import java.util.*; import java.io.*; public class QueueTime { public static void main(String[] args)throws Throwable { PrintWriter pw = new PrintWriter(System.out); BufferedReader bf =new BufferedReader(new InputStreamReader(System.in)); ArrayList<Integer> t = new ArrayList<Integer>(); ...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
04aa3e207815be3952e8d46ed76cbbcf
train_000.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
// package CodeForces; import java.util.*; import java.io.*; public class Problem_545D { public static void main(String[] args)throws Throwable { PrintWriter pw = new PrintWriter(System.out); BufferedReader bf =new BufferedReader(new InputStreamReader(System.in)); ArrayList<Integer> t = new ArrayList<Integer>(...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
ce227df9741db7269e39d24d2d731352
train_000.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
//package helloworld; import java.util.*; import java.io.*; public class QueueTime { public static void main(String[] args)throws Throwable { PrintWriter pw = new PrintWriter(System.out); BufferedReader bf =new BufferedReader(new InputStreamReader(System.in)); ArrayList<Integer> t = new ArrayList<Integer>(); ...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
546444c2a513ec8b42146edeaf4786b5
train_000.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
// Queues // Codeforces code - 545D import java.util.Arrays; import java.util.Scanner; public class q { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); long arr[] = new long[n]; for (int i= 0;i<n;i++) { arr[i] = scan.nextLong(); } Arrays.sort(a...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
d0abc05fdd30870119b7fc45ac7f1e25
train_000.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.*; public class SolutionC { public static void main(String args[]){ Scanner s1=new Scanner(System.in); int n=s1.nextInt(); int arr[]=new int[n]; for(int i=0;i<n;i++){ arr[i]=s1.nextInt(); } Arrays.sort(arr); long sum=0,count=0; for(int i=0;i<n;i++){ int ext=arr[i]; if(sum<=ex...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
a225553d5ad751dbffd0c3d1b4a23cb7
train_000.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class pre422 { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new Buff...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
0fe4dbc0566efe0a6a1d3a7fca31db8e
train_000.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
bb92be94a877aecd36ee008831bbe78d
train_000.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.List; import java.util.Arrays; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; impo...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
3d8d3654f897cd2b988f6ad9e30f302d
train_000.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
//package Queue; import java.util.PriorityQueue; import java.util.Scanner; /** * Created by kanghuang on 5/23/15. */ public class D { //greedy idea is biased public static void main(String[] args){ Scanner reader = new Scanner(System.in); int n = reader.nextInt(); PriorityQueue<Integ...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
4d9b660722a6aa6847aa01b6b82b6241
train_000.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.awt.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Main { public static void main(String[] args) throws IOException { FastReader sc = new FastReader(); int n=sc.nextInt(); Integer arr[]=new Integer...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
7859ceaac2dda603b6aabe88ab4866b4
train_000.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); ArrayList<Integer> time = new ArrayList<Integer>(); for (int i = 0; i < n;...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
30fdd63733c5d26bc4f37d8f7f389c72
train_000.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int[] time = new int[n]; for (int i = 0; i < n; i++) { time[i] = scan.nextInt(); } ...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
72348270a767e81c5d7595428b7368f7
train_000.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.*; public class Permatation { public static void main(String[] args) { Scanner sc=new Scanner(System.in); long c=0; long max=0; long n=sc.nextLong(); List<Long> timeForBeenServed = new ArrayList<Long>(); for(int i=0;i<n;i++) { timeForBeenServed.add(sc.nextL...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
d1d1675951a93371b06f269e9c2ae39b
train_000.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class _18Queue { public static void main(String[] args) { FastInput input = new FastInput(); PrintWriter output ...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
efad1ec14dbfc5bc2c158f328a61f73f
train_000.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.*; public class Solution{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int t; t = 1;//sc.nextInt(); while (t-->0){ solve(sc); } } public static void solve(Scanner sc){ int ...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
47204e0fc6b1b25b5bd1b040a3579f50
train_000.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.ArrayList; import java.util.Comparator; import java.util.Scanner; /** * Created by William on 10/22/16. */ public class main { public static void main(String[] args){ Scanner in = new Scanner(System.in); int size = in.nextInt(); int[] a = new int[size]; ArrayList<...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
94e6057a72ddd99b605d066df4fce424
train_000.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Fff { /** * @param args the command line arguments */ public static void main(String[] args) throws IOException { BufferedReader bf=new BufferedReader(new InputStreamReader(System.in)); int q=Integer.parseInt(bf.read...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
2fa0929f882a500bc13417931d72e997
train_000.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Integer.parseInt; public class Main { public static void main(String[] args) throws IOException { Reader.init(System.in); int n=Reader.nextInt(); Integer []a=new Integer[n]; for (int i = 0; i < n; i++) { ...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
89bcce5f6bdb310ea52018558e0f37eb
train_000.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Integer.parseInt; public class Main { public static void main(String[] args) throws IOException { Reader.init(System.in); int n=Reader.nextInt(); int[]time=new int[n]; for (int i = 0; i < n; i++) { time[i]=...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
389ac89e93bd0c2a13e4aad2fa125494
train_000.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Integer.parseInt; public class Main { public static void main(String[] args) throws IOException { Reader.init(System.in); int n=Reader.nextInt(); int []a=new int[n]; for (int i = 0; i < n; i++) { ...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
2b5c25b06135a2dae7441573a8e40112
train_000.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.io.*; import static java.lang.Integer.sum; import java.lang.reflect.Array; import java.util.*; import java.math.*; //import static java.lang.Math.*; //import static java.lang.Integer.parseInt; //import static java.lang.Long.parseLong; //import static java.lang.Double.parseDouble; //import static java.lang...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
cbc511b5a1a6ecc912a417577a3735fc
train_000.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Integer.parseInt; public class Main { public static void main(String[] args) throws IOException { Reader.init(System.in); int n=Reader.nextInt(); int[]time=new int[n]; for (int i = 0; i < n; i++) { time[i]=...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
716080e074b282d1d6e55cdcdda9899a
train_000.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.PriorityQueue; import java.util.StringTokenizer; public class D545 { public static void main(String[] args) throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
6704609d1722d9b6cfbafc4151ca999e
train_000.jsonl
1432053000
Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in= new Scanner (System.in); int a[]=new int[in.nextInt()]; for (int i = 0; i < a.length; i++) a[i]=in.nextInt(); ...
Java
["5\n15 2 1 5 3"]
1 second
["4"]
NoteValue 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
08c4d8db40a49184ad26c7d8098a8992
The first line contains integer n (1 ≤ n ≤ 105). The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.
1,300
Print a single number — the maximum number of not disappointed people in the queue.
standard output
PASSED
96e80a552cea83f7765e6ef19026b1be
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.HashSet; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top * * @author legionary */ public class Main { public static void main(String[] a...
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
8ec15315ddb0ca3d65f4222752d197c9
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
256 megabytes
import java.util.Scanner; public class Problem1257B { public static int magicStick1(int x, int y) { return (x % 2 == 0) ? x = x * 3 / 2 : x > 1 ? x - 1 : 0; } public static void main(String[] args) { Scanner key = new Scanner(System.in); var num = key.nextInt(); var x = n...
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
227847cb3faad421a069e44c1f5423a4
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
256 megabytes
import java.util.Scanner; public class Problem1257Bv2 { public static int magicStick1(int x, int y) { if (x % 2 == 0) { x = x*3/2; return x; } else if (x>1){ x--; return x; } return 0; } public static void main(String[] args) ...
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
f249fdc101628c7004e8967f05ac304b
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
256 megabytes
import java.util.Scanner; public class Problem1257Bv2 { public static int magicStick1(int x, int y) { if (x % 2 == 0) { x = x * 3 / 2; return x; } else { return x > 1 ? x - 1 : 0; } } public static void main(String[] args) { var entrada = new Scanner(System.in); int num =...
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
6c6ced483871564242d40fd1976d59f5
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
256 megabytes
import java.util.Scanner; public class Problem1257B { public static int magicStick1(int x, int y) { if (x % 2 == 0) { x = x*3/2; return x; } return 0; } public static int magicStick2(int x, int y){ if (x > 1) { x--; return x; ...
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
9dbc85fd9d4df81c0a2bf0ab086adf73
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
256 megabytes
import java.util.Scanner; public class codeforces_1257B { public static void main(String[] args) { Scanner sc= new Scanner(System.in); int t= sc. nextInt(); while(t-->0) { int x=sc.nextInt(); int y=sc.nextInt(); if(x==1 && y!=1) { ...
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
4564b8a6700aaaa47c1ca540a1ffa9b0
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
256 megabytes
import java.util.*; public class ED_R_76B { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int t = Integer.parseInt(sc.nextLine()); for(int i =0;i<t;i++) { String xy = sc.nextLine(); String[] numbers = xy.split(" "); ...
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
6a76b7bf84b74e1553916717b1661af9
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.util.HashSet; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.util.Set; import java.io.OutputStreamWriter; import java.util.InputMismatchException; ...
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
fa9ffef337ec27002d48bb1d0f1f8be7
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.util.HashSet; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.util.Set; import java.io.OutputStreamWriter; import java.util.InputMismatchException; ...
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
ae9d3d75de731375e750e4dcbb702c13
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
256 megabytes
import java.util.*; import java.io.*; public class Main { static class FastReader { BufferedReader br; StringTokenizer st; FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreEl...
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
adaa3062c8fb065374c0b2c67c5ace16
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
256 megabytes
import java.io.*; import static java.lang.Math.abs; import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.pow; import java.util.*; public class Kaudo { static Reader in =new Reader(); static List<Integer>[] gr; static StringBuilder sd=new StringBuilder(); ...
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
57d04d6ce08127fc2acc3c42ad5717b1
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
256 megabytes
import java.util.Scanner; import java.util.ArrayList; import java.util.List; public class MagicSpell { public static String Spell(int x,int y) { if(x==0) { if(y==0) { return "YES"; } return "NO"; } else if(x==1) { i...
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
99cd07d1e8b426a6720aa87715dc54d7
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
256 megabytes
import java.util.*;import java.io.*;import java.math.BigInteger; public class Main { public static void process()throws IOException { //Your code here int x=ni(); int y=ni(); if(x==1) { if(y==1) pn("YES"); else pn("N...
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
ba80740c42300e76f60d1143d6df9e7e
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
256 megabytes
import java.util.*; public class Main { public static void main(String args[]){ Scanner in = new Scanner(System.in); int n = in.nextInt(); for(int i=0;i<n;i++){ String ans="NO"; long x=Long.parseLong(String.valueOf(in.nextInt())); lo...
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
c970de4724a7c9e4b3fb196eff45df7b
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.StreamTokenizer; public class Main { public static StreamTokenizer sc=new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); public static int nextint() throws...
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
24bd487c442123ab3e6acb932f2a2356
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
256 megabytes
import java.util.Scanner; public class B { public static void main(String[] args) { Scanner in = new Scanner(System.in); int cases = Integer.parseInt(in.nextLine()); for (int i = 0; i < cases; i++) { String[] input = in.nextLine().split(" "); int x = Integer.parseIn...
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
0a85a4cc108c03fb6c60a590373be360
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t>0){ int x = sc.nextInt(); int y = sc.nextInt(); boolean ans = false; int cnt = 0; if(y<=x){ ans = true; } else{ ...
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
8b6b2f8197cc4dbbfe1e7e77e397ea35
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
256 megabytes
import java.util.Scanner; public class mqgic_stick { public static void main(String[] args) { Scanner s = new Scanner(System.in); int t = s.nextInt(); while(t-->0) { int x = s.nextInt(); int y = s.nextInt(); if (x>=y) { System.out.println("YES"); }else if((x==1 && y>1) || (x==3 && y>3) || (x==2 &&y>3))...
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
26bae37686192e6b056dc2f6d518c660
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
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.StringTokenizer; import java.util.*; import static java.lang.System.*; /* Shortcut--> Arrays.stream(n).parallel().sum(); string builder fast...
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
07bf211775eccc07ced573d4a7559401
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
256 megabytes
import java.util.Scanner; public class Task{ private int arr[][]; private int T; public Task(){ fill(); for(int i=0; i<T; i++){ System.out.println(test(arr[i][0], arr[i][1])); } } public static void main(String args[]){ new Task(); } String test(int x, int y){ String ret = "NO"; if(x>=y){ ...
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
8f568cd16caff8fb7a83c708230e516e
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
256 megabytes
import java.util.*; public class Cf1257B { public static void main(String[] args) { Scanner sc =new Scanner(System.in); int t,x,y; t=sc.nextInt(); while(t>0) { x=sc.nextInt(); y=sc.nextInt(); if(x>3) System.out.println("YES"); else if(x==1) { if(y==1) System.out.println("YES"); el...
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
eabddd166b26d38df01b2541e672feab
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; public class Main implements Runnable { boolean multiple = true; long MOD; @SuppressWarnings({"Duplicates", "ConstantConditions"}) void solve() throws Exception { long x = sc.nextLong(); long y = sc.nextLong(); ...
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
353a43a8046523e840f3049ed36d9d1c
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
256 megabytes
import java.util.Scanner; public class Wand { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int x = scanner.nextInt(); String[] out = new String[x]; for (int i = 0; i < x; i++) { int a = scanner.nextInt(); int b = scanner....
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
9d6a5a0aaa31a57fb0fd77185eb73b25
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
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 Y6 { public static void fx(long a,long b) { if(a==b) System.out.println("YES"); else { if(a>b) System....
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
3a41d06fc28fe636e17a9cab7616ce8b
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
256 megabytes
import java.util.*; import java.lang.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t--!=0) { int x=sc.nextInt(); int y=sc.nextInt(); if(x>=y) System.out.println("YES"); e...
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
17f08f1f6c9b2aced8b34c7847c5d4a9
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
256 megabytes
import java.io.*; import java.util.*; public class A { static int x, y; static int[] arr; static char[] s; public static void main(String[] args) throws IOException { Flash f = new Flash(); int T = f.ni(); for(int tc = 1; tc <= T; tc++){ x = f.ni(); y = f.ni(); s...
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
2c3225b6b7d9e7101bb31bed46792f8b
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
256 megabytes
import java.io.*; import java.util.*; public class A { static int x, y; static int[] arr; static char[] s; public static void main(String[] args) throws IOException { Flash f = new Flash(); int T = f.ni(); for(int tc = 1; tc <= T; tc++){ x = f.ni(); y = f.ni(); s...
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
48791b1214d2348578f6a1f91bc51796
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class test { /* * array list * * ArrayList<Integer> al=new ArrayList<>(); creating BigIntegers * * BigInteger a=new BigInteger(); BigInteger b=new BigInteger(); * * hash map * * HashMap<Integer,Integer> hm=new HashMap<Integer,Integ...
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
a578edab64175c4d2ff167173c7584f1
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
256 megabytes
import java.util.*;import java.io.*;import java.math.*; public class Main { public static void process()throws IOException { int x=ni(),y=ni(); if(y<=x){ pn("YES");return; } if(x==2 && y>3){ pn("NO"); return; } if(x==3 && y...
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
5d7bca23da80aa21a3a6db743c05235b
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
256 megabytes
//package cp; import java.io.*; import java.math.*; import java.util.*; public class Solution{ long gcd(long a,long b) {if(b==0)return a;else return gcd(b,a%b);} void swap(long a,long b) {long temp=a;a=b;b=temp;} StringBuilder sb=new StringBuilder(); Integer[] ARR=new Integer[5]; //Integer sort-TLE-Initialize obj...
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
358913f9ef15b32116b8d313b3af206e
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
256 megabytes
import java.util.*; public class Solution_1 { public static void main(String[] args) { // solution start :-) //filling shape Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0) { int x = sc.nextInt(); int y = sc.nextInt(); if(x>=y) System.out.println("YES"); else { if(x...
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
4c8eb60aa68af4ecb5432ce8c09ece23
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
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
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
e7f411464947f0c083067695e9007e4f
train_000.jsonl
1573655700
Recently Petya walked in the forest and found a magic stick.Since Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a positive integer: If the chosen number $$$a$$$ is even, then the spell will turn it into $$$\frac{3a}{2}$$...
256 megabytes
import java.io.BufferedReader; import java.io.EOFException; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.UncheckedIOException; import java.lang.reflect.Array; import java.util.ArrayDeque; import java.util.Arrays; import java.util.Deque; import java.util.Object...
Java
["7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234"]
1 second
["YES\nYES\nNO\nYES\nNO\nYES\nYES"]
null
Java 11
standard input
[ "math" ]
b3978805756262e17df738e049830427
The first line contains single integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^9$$$) — the current number and the number that Petya wants to get.
1,000
For the $$$i$$$-th test case print the answer on it — YES if Petya can get the number $$$y$$$ from the number $$$x$$$ using known spells, and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).
standard output
PASSED
2fc34e2afa98a0480c4fa8c2fc3ae617
train_000.jsonl
1595149200
Acacius is studying strings theory. Today he came with the following problem.You are given a string $$$s$$$ of length $$$n$$$ consisting of lowercase English letters and question marks. It is possible to replace question marks with lowercase English letters in such a way that a string "abacaba" occurs as a substring in...
512 megabytes
import java.util.*; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; public class Solution { public static void main(String[] args) throws IOException { int i, j; FastReader in = new FastReader(System.in); StringBuilder sb = new StringBuilder(); b...
Java
["6\n7\nabacaba\n7\n???????\n11\naba?abacaba\n11\nabacaba?aba\n15\nasdf???f???qwer\n11\nabacabacaba"]
1 second
["Yes\nabacaba\nYes\nabacaba\nYes\nabadabacaba\nYes\nabacabadaba\nNo\nNo"]
NoteIn first example there is exactly one occurrence of a string "abacaba" in the string "abacaba" as a substring.In second example seven question marks can be replaced with any seven lowercase English letters and with "abacaba" in particular.In sixth example there are two occurrences of a string "abacaba" as a substri...
Java 11
standard input
[ "implementation", "brute force", "strings" ]
f6b7ad10382135b293bd3f2f3257d4d3
First line of input contains an integer $$$T$$$ ($$$1 \leq T \leq 5000$$$), number of test cases. $$$T$$$ pairs of lines with test case descriptions follow. The first line of a test case description contains a single integer $$$n$$$ ($$$7 \leq n \leq 50$$$), length of a string $$$s$$$. The second line of a test case de...
1,500
For each test case output an answer for it. In case if there is no way to replace question marks in string $$$s$$$ with a lowercase English letters in such a way that there is exactly one occurrence of a string "abacaba" in the resulting string as a substring output "No". Otherwise output "Yes" and in the next line out...
standard output
PASSED
328437fb7e0cf0a1a2e501de43170aae
train_000.jsonl
1595149200
Acacius is studying strings theory. Today he came with the following problem.You are given a string $$$s$$$ of length $$$n$$$ consisting of lowercase English letters and question marks. It is possible to replace question marks with lowercase English letters in such a way that a string "abacaba" occurs as a substring in...
512 megabytes
import java.util.Scanner; public class Main { static final int N = 100; static final char aba[] = { 'a', 'b', 'a', 'c', 'a', 'b', 'a' }; static int check_num(int n, String str) { int num = 0; for (int i = 0; i + 7 <= n; i++) { if (str.substring(i, i + 7).equals("abacaba")) num++; } return num; } ...
Java
["6\n7\nabacaba\n7\n???????\n11\naba?abacaba\n11\nabacaba?aba\n15\nasdf???f???qwer\n11\nabacabacaba"]
1 second
["Yes\nabacaba\nYes\nabacaba\nYes\nabadabacaba\nYes\nabacabadaba\nNo\nNo"]
NoteIn first example there is exactly one occurrence of a string "abacaba" in the string "abacaba" as a substring.In second example seven question marks can be replaced with any seven lowercase English letters and with "abacaba" in particular.In sixth example there are two occurrences of a string "abacaba" as a substri...
Java 11
standard input
[ "implementation", "brute force", "strings" ]
f6b7ad10382135b293bd3f2f3257d4d3
First line of input contains an integer $$$T$$$ ($$$1 \leq T \leq 5000$$$), number of test cases. $$$T$$$ pairs of lines with test case descriptions follow. The first line of a test case description contains a single integer $$$n$$$ ($$$7 \leq n \leq 50$$$), length of a string $$$s$$$. The second line of a test case de...
1,500
For each test case output an answer for it. In case if there is no way to replace question marks in string $$$s$$$ with a lowercase English letters in such a way that there is exactly one occurrence of a string "abacaba" in the resulting string as a substring output "No". Otherwise output "Yes" and in the next line out...
standard output
PASSED
3c44efcb7f7dde0995f83c225c5a9aa6
train_000.jsonl
1595149200
Acacius is studying strings theory. Today he came with the following problem.You are given a string $$$s$$$ of length $$$n$$$ consisting of lowercase English letters and question marks. It is possible to replace question marks with lowercase English letters in such a way that a string "abacaba" occurs as a substring in...
512 megabytes
import java.util.*; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0){ int n = sc.nextInt(); String s = sc.next(); String toCheck = "abacaba"; int occura...
Java
["6\n7\nabacaba\n7\n???????\n11\naba?abacaba\n11\nabacaba?aba\n15\nasdf???f???qwer\n11\nabacabacaba"]
1 second
["Yes\nabacaba\nYes\nabacaba\nYes\nabadabacaba\nYes\nabacabadaba\nNo\nNo"]
NoteIn first example there is exactly one occurrence of a string "abacaba" in the string "abacaba" as a substring.In second example seven question marks can be replaced with any seven lowercase English letters and with "abacaba" in particular.In sixth example there are two occurrences of a string "abacaba" as a substri...
Java 11
standard input
[ "implementation", "brute force", "strings" ]
f6b7ad10382135b293bd3f2f3257d4d3
First line of input contains an integer $$$T$$$ ($$$1 \leq T \leq 5000$$$), number of test cases. $$$T$$$ pairs of lines with test case descriptions follow. The first line of a test case description contains a single integer $$$n$$$ ($$$7 \leq n \leq 50$$$), length of a string $$$s$$$. The second line of a test case de...
1,500
For each test case output an answer for it. In case if there is no way to replace question marks in string $$$s$$$ with a lowercase English letters in such a way that there is exactly one occurrence of a string "abacaba" in the resulting string as a substring output "No". Otherwise output "Yes" and in the next line out...
standard output
PASSED
1ed899137f3e6ef9cf35194e361dfda2
train_000.jsonl
1595149200
Acacius is studying strings theory. Today he came with the following problem.You are given a string $$$s$$$ of length $$$n$$$ consisting of lowercase English letters and question marks. It is possible to replace question marks with lowercase English letters in such a way that a string "abacaba" occurs as a substring in...
512 megabytes
//https://codeforces.com/contest/1379/problem/A //package com.bhavesh.Round657; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class A { private static int count(StringBuilder sb, String pattern, int n) { int count = 0; for (int k = 0; k <= n ...
Java
["6\n7\nabacaba\n7\n???????\n11\naba?abacaba\n11\nabacaba?aba\n15\nasdf???f???qwer\n11\nabacabacaba"]
1 second
["Yes\nabacaba\nYes\nabacaba\nYes\nabadabacaba\nYes\nabacabadaba\nNo\nNo"]
NoteIn first example there is exactly one occurrence of a string "abacaba" in the string "abacaba" as a substring.In second example seven question marks can be replaced with any seven lowercase English letters and with "abacaba" in particular.In sixth example there are two occurrences of a string "abacaba" as a substri...
Java 11
standard input
[ "implementation", "brute force", "strings" ]
f6b7ad10382135b293bd3f2f3257d4d3
First line of input contains an integer $$$T$$$ ($$$1 \leq T \leq 5000$$$), number of test cases. $$$T$$$ pairs of lines with test case descriptions follow. The first line of a test case description contains a single integer $$$n$$$ ($$$7 \leq n \leq 50$$$), length of a string $$$s$$$. The second line of a test case de...
1,500
For each test case output an answer for it. In case if there is no way to replace question marks in string $$$s$$$ with a lowercase English letters in such a way that there is exactly one occurrence of a string "abacaba" in the resulting string as a substring output "No". Otherwise output "Yes" and in the next line out...
standard output
PASSED
b79acd5f839836521be2cad2b69bb4e8
train_000.jsonl
1595149200
Acacius is studying strings theory. Today he came with the following problem.You are given a string $$$s$$$ of length $$$n$$$ consisting of lowercase English letters and question marks. It is possible to replace question marks with lowercase English letters in such a way that a string "abacaba" occurs as a substring in...
512 megabytes
import java.io.*; import java.util.*; public class A { static String t = "abacaba"; public static void main(String[] args) { FastScanner sc = new FastScanner(); int x = sc.nextInt(); while(x-->0) { int n = sc.nextInt(); String str = sc.next(); solve(str,n); } } static void solve(String str,...
Java
["6\n7\nabacaba\n7\n???????\n11\naba?abacaba\n11\nabacaba?aba\n15\nasdf???f???qwer\n11\nabacabacaba"]
1 second
["Yes\nabacaba\nYes\nabacaba\nYes\nabadabacaba\nYes\nabacabadaba\nNo\nNo"]
NoteIn first example there is exactly one occurrence of a string "abacaba" in the string "abacaba" as a substring.In second example seven question marks can be replaced with any seven lowercase English letters and with "abacaba" in particular.In sixth example there are two occurrences of a string "abacaba" as a substri...
Java 11
standard input
[ "implementation", "brute force", "strings" ]
f6b7ad10382135b293bd3f2f3257d4d3
First line of input contains an integer $$$T$$$ ($$$1 \leq T \leq 5000$$$), number of test cases. $$$T$$$ pairs of lines with test case descriptions follow. The first line of a test case description contains a single integer $$$n$$$ ($$$7 \leq n \leq 50$$$), length of a string $$$s$$$. The second line of a test case de...
1,500
For each test case output an answer for it. In case if there is no way to replace question marks in string $$$s$$$ with a lowercase English letters in such a way that there is exactly one occurrence of a string "abacaba" in the resulting string as a substring output "No". Otherwise output "Yes" and in the next line out...
standard output
PASSED
d3ea1bc08ba091e7904b2c875f7725fb
train_000.jsonl
1595149200
Acacius is studying strings theory. Today he came with the following problem.You are given a string $$$s$$$ of length $$$n$$$ consisting of lowercase English letters and question marks. It is possible to replace question marks with lowercase English letters in such a way that a string "abacaba" occurs as a substring in...
512 megabytes
/** * @author vivek * programming is thinking, not typing */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; //todo public class Main { private static void solveTC(int __) { ...
Java
["6\n7\nabacaba\n7\n???????\n11\naba?abacaba\n11\nabacaba?aba\n15\nasdf???f???qwer\n11\nabacabacaba"]
1 second
["Yes\nabacaba\nYes\nabacaba\nYes\nabadabacaba\nYes\nabacabadaba\nNo\nNo"]
NoteIn first example there is exactly one occurrence of a string "abacaba" in the string "abacaba" as a substring.In second example seven question marks can be replaced with any seven lowercase English letters and with "abacaba" in particular.In sixth example there are two occurrences of a string "abacaba" as a substri...
Java 11
standard input
[ "implementation", "brute force", "strings" ]
f6b7ad10382135b293bd3f2f3257d4d3
First line of input contains an integer $$$T$$$ ($$$1 \leq T \leq 5000$$$), number of test cases. $$$T$$$ pairs of lines with test case descriptions follow. The first line of a test case description contains a single integer $$$n$$$ ($$$7 \leq n \leq 50$$$), length of a string $$$s$$$. The second line of a test case de...
1,500
For each test case output an answer for it. In case if there is no way to replace question marks in string $$$s$$$ with a lowercase English letters in such a way that there is exactly one occurrence of a string "abacaba" in the resulting string as a substring output "No". Otherwise output "Yes" and in the next line out...
standard output
PASSED
3704752ff5b482b7beb3c2de384e2b29
train_000.jsonl
1595149200
Acacius is studying strings theory. Today he came with the following problem.You are given a string $$$s$$$ of length $$$n$$$ consisting of lowercase English letters and question marks. It is possible to replace question marks with lowercase English letters in such a way that a string "abacaba" occurs as a substring in...
512 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.*; public class cf1379a { public static void main(String[] args) throws IOException { int t = ri(); tt: while(t --> 0) { int n = ri(), cnt = 0; char[] s = rcha(), pat = "ab...
Java
["6\n7\nabacaba\n7\n???????\n11\naba?abacaba\n11\nabacaba?aba\n15\nasdf???f???qwer\n11\nabacabacaba"]
1 second
["Yes\nabacaba\nYes\nabacaba\nYes\nabadabacaba\nYes\nabacabadaba\nNo\nNo"]
NoteIn first example there is exactly one occurrence of a string "abacaba" in the string "abacaba" as a substring.In second example seven question marks can be replaced with any seven lowercase English letters and with "abacaba" in particular.In sixth example there are two occurrences of a string "abacaba" as a substri...
Java 11
standard input
[ "implementation", "brute force", "strings" ]
f6b7ad10382135b293bd3f2f3257d4d3
First line of input contains an integer $$$T$$$ ($$$1 \leq T \leq 5000$$$), number of test cases. $$$T$$$ pairs of lines with test case descriptions follow. The first line of a test case description contains a single integer $$$n$$$ ($$$7 \leq n \leq 50$$$), length of a string $$$s$$$. The second line of a test case de...
1,500
For each test case output an answer for it. In case if there is no way to replace question marks in string $$$s$$$ with a lowercase English letters in such a way that there is exactly one occurrence of a string "abacaba" in the resulting string as a substring output "No". Otherwise output "Yes" and in the next line out...
standard output
PASSED
eb193c87d99acbc450154791e87955b0
train_000.jsonl
1595149200
Acacius is studying strings theory. Today he came with the following problem.You are given a string $$$s$$$ of length $$$n$$$ consisting of lowercase English letters and question marks. It is possible to replace question marks with lowercase English letters in such a way that a string "abacaba" occurs as a substring in...
512 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 boolean countOccurences(String s, String T) { int cnt=0; for(int i=0;i<=s.length()-7;i++) { i...
Java
["6\n7\nabacaba\n7\n???????\n11\naba?abacaba\n11\nabacaba?aba\n15\nasdf???f???qwer\n11\nabacabacaba"]
1 second
["Yes\nabacaba\nYes\nabacaba\nYes\nabadabacaba\nYes\nabacabadaba\nNo\nNo"]
NoteIn first example there is exactly one occurrence of a string "abacaba" in the string "abacaba" as a substring.In second example seven question marks can be replaced with any seven lowercase English letters and with "abacaba" in particular.In sixth example there are two occurrences of a string "abacaba" as a substri...
Java 11
standard input
[ "implementation", "brute force", "strings" ]
f6b7ad10382135b293bd3f2f3257d4d3
First line of input contains an integer $$$T$$$ ($$$1 \leq T \leq 5000$$$), number of test cases. $$$T$$$ pairs of lines with test case descriptions follow. The first line of a test case description contains a single integer $$$n$$$ ($$$7 \leq n \leq 50$$$), length of a string $$$s$$$. The second line of a test case de...
1,500
For each test case output an answer for it. In case if there is no way to replace question marks in string $$$s$$$ with a lowercase English letters in such a way that there is exactly one occurrence of a string "abacaba" in the resulting string as a substring output "No". Otherwise output "Yes" and in the next line out...
standard output
PASSED
dee7680ca3244ca568eecaad8a0ee500
train_000.jsonl
1595149200
Acacius is studying strings theory. Today he came with the following problem.You are given a string $$$s$$$ of length $$$n$$$ consisting of lowercase English letters and question marks. It is possible to replace question marks with lowercase English letters in such a way that a string "abacaba" occurs as a substring in...
512 megabytes
import java.util.Scanner; public class Main{ public static final String pattern = "abacaba"; public static void main(String[] args){ Scanner sc = new Scanner(System.in); int k = sc.nextInt(); sc.nextLine(); for (int i = 0; i < k; i++){ sc.nextInt(); sc.ne...
Java
["6\n7\nabacaba\n7\n???????\n11\naba?abacaba\n11\nabacaba?aba\n15\nasdf???f???qwer\n11\nabacabacaba"]
1 second
["Yes\nabacaba\nYes\nabacaba\nYes\nabadabacaba\nYes\nabacabadaba\nNo\nNo"]
NoteIn first example there is exactly one occurrence of a string "abacaba" in the string "abacaba" as a substring.In second example seven question marks can be replaced with any seven lowercase English letters and with "abacaba" in particular.In sixth example there are two occurrences of a string "abacaba" as a substri...
Java 11
standard input
[ "implementation", "brute force", "strings" ]
f6b7ad10382135b293bd3f2f3257d4d3
First line of input contains an integer $$$T$$$ ($$$1 \leq T \leq 5000$$$), number of test cases. $$$T$$$ pairs of lines with test case descriptions follow. The first line of a test case description contains a single integer $$$n$$$ ($$$7 \leq n \leq 50$$$), length of a string $$$s$$$. The second line of a test case de...
1,500
For each test case output an answer for it. In case if there is no way to replace question marks in string $$$s$$$ with a lowercase English letters in such a way that there is exactly one occurrence of a string "abacaba" in the resulting string as a substring output "No". Otherwise output "Yes" and in the next line out...
standard output
PASSED
ad1c69fa6fb422cc1c2ac79ed7a6270c
train_000.jsonl
1595149200
Acacius is studying strings theory. Today he came with the following problem.You are given a string $$$s$$$ of length $$$n$$$ consisting of lowercase English letters and question marks. It is possible to replace question marks with lowercase English letters in such a way that a string "abacaba" occurs as a substring in...
512 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; public class A1379{ static int gcd(int a, int b) { if (a == 0) return b; if (b == 0) return a; int k; for (k = 0; ((a | b) & 1) == 0; ++k) { a >>= 1; ...
Java
["6\n7\nabacaba\n7\n???????\n11\naba?abacaba\n11\nabacaba?aba\n15\nasdf???f???qwer\n11\nabacabacaba"]
1 second
["Yes\nabacaba\nYes\nabacaba\nYes\nabadabacaba\nYes\nabacabadaba\nNo\nNo"]
NoteIn first example there is exactly one occurrence of a string "abacaba" in the string "abacaba" as a substring.In second example seven question marks can be replaced with any seven lowercase English letters and with "abacaba" in particular.In sixth example there are two occurrences of a string "abacaba" as a substri...
Java 11
standard input
[ "implementation", "brute force", "strings" ]
f6b7ad10382135b293bd3f2f3257d4d3
First line of input contains an integer $$$T$$$ ($$$1 \leq T \leq 5000$$$), number of test cases. $$$T$$$ pairs of lines with test case descriptions follow. The first line of a test case description contains a single integer $$$n$$$ ($$$7 \leq n \leq 50$$$), length of a string $$$s$$$. The second line of a test case de...
1,500
For each test case output an answer for it. In case if there is no way to replace question marks in string $$$s$$$ with a lowercase English letters in such a way that there is exactly one occurrence of a string "abacaba" in the resulting string as a substring output "No". Otherwise output "Yes" and in the next line out...
standard output
PASSED
9256af70293a531b6394199b7499f9d2
train_000.jsonl
1595149200
Acacius is studying strings theory. Today he came with the following problem.You are given a string $$$s$$$ of length $$$n$$$ consisting of lowercase English letters and question marks. It is possible to replace question marks with lowercase English letters in such a way that a string "abacaba" occurs as a substring in...
512 megabytes
import javax.swing.*; import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { static PrintWriter out = new PrintWriter(System.out); static long[] tree; static int m = 100000000; static int k1,k2; static boolean[] vis; static tuple[] tuples; public static void...
Java
["6\n7\nabacaba\n7\n???????\n11\naba?abacaba\n11\nabacaba?aba\n15\nasdf???f???qwer\n11\nabacabacaba"]
1 second
["Yes\nabacaba\nYes\nabacaba\nYes\nabadabacaba\nYes\nabacabadaba\nNo\nNo"]
NoteIn first example there is exactly one occurrence of a string "abacaba" in the string "abacaba" as a substring.In second example seven question marks can be replaced with any seven lowercase English letters and with "abacaba" in particular.In sixth example there are two occurrences of a string "abacaba" as a substri...
Java 11
standard input
[ "implementation", "brute force", "strings" ]
f6b7ad10382135b293bd3f2f3257d4d3
First line of input contains an integer $$$T$$$ ($$$1 \leq T \leq 5000$$$), number of test cases. $$$T$$$ pairs of lines with test case descriptions follow. The first line of a test case description contains a single integer $$$n$$$ ($$$7 \leq n \leq 50$$$), length of a string $$$s$$$. The second line of a test case de...
1,500
For each test case output an answer for it. In case if there is no way to replace question marks in string $$$s$$$ with a lowercase English letters in such a way that there is exactly one occurrence of a string "abacaba" in the resulting string as a substring output "No". Otherwise output "Yes" and in the next line out...
standard output
PASSED
4890b55227d2084ee5baa23db8ff6299
train_000.jsonl
1595149200
Acacius is studying strings theory. Today he came with the following problem.You are given a string $$$s$$$ of length $$$n$$$ consisting of lowercase English letters and question marks. It is possible to replace question marks with lowercase English letters in such a way that a string "abacaba" occurs as a substring in...
512 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { public static void main (String[] args) throws java.lang.Exception { Scanner sc=new Scanner(System.in); // Reader re=new Reader(); Writer w=new PrintWriter(System.out); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(...
Java
["6\n7\nabacaba\n7\n???????\n11\naba?abacaba\n11\nabacaba?aba\n15\nasdf???f???qwer\n11\nabacabacaba"]
1 second
["Yes\nabacaba\nYes\nabacaba\nYes\nabadabacaba\nYes\nabacabadaba\nNo\nNo"]
NoteIn first example there is exactly one occurrence of a string "abacaba" in the string "abacaba" as a substring.In second example seven question marks can be replaced with any seven lowercase English letters and with "abacaba" in particular.In sixth example there are two occurrences of a string "abacaba" as a substri...
Java 11
standard input
[ "implementation", "brute force", "strings" ]
f6b7ad10382135b293bd3f2f3257d4d3
First line of input contains an integer $$$T$$$ ($$$1 \leq T \leq 5000$$$), number of test cases. $$$T$$$ pairs of lines with test case descriptions follow. The first line of a test case description contains a single integer $$$n$$$ ($$$7 \leq n \leq 50$$$), length of a string $$$s$$$. The second line of a test case de...
1,500
For each test case output an answer for it. In case if there is no way to replace question marks in string $$$s$$$ with a lowercase English letters in such a way that there is exactly one occurrence of a string "abacaba" in the resulting string as a substring output "No". Otherwise output "Yes" and in the next line out...
standard output
PASSED
2fb40a8f402e81fa3fc9bb0359237c21
train_000.jsonl
1595149200
Acacius is studying strings theory. Today he came with the following problem.You are given a string $$$s$$$ of length $$$n$$$ consisting of lowercase English letters and question marks. It is possible to replace question marks with lowercase English letters in such a way that a string "abacaba" occurs as a substring in...
512 megabytes
import java.util.Scanner; public class codeforces1 { final static String T = "abacaba"; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int tt = 0; tt < t; tt++) { int n = sc.nextInt(); sc.nextLine(); String s = sc.nextLine(); boolean bo...
Java
["6\n7\nabacaba\n7\n???????\n11\naba?abacaba\n11\nabacaba?aba\n15\nasdf???f???qwer\n11\nabacabacaba"]
1 second
["Yes\nabacaba\nYes\nabacaba\nYes\nabadabacaba\nYes\nabacabadaba\nNo\nNo"]
NoteIn first example there is exactly one occurrence of a string "abacaba" in the string "abacaba" as a substring.In second example seven question marks can be replaced with any seven lowercase English letters and with "abacaba" in particular.In sixth example there are two occurrences of a string "abacaba" as a substri...
Java 11
standard input
[ "implementation", "brute force", "strings" ]
f6b7ad10382135b293bd3f2f3257d4d3
First line of input contains an integer $$$T$$$ ($$$1 \leq T \leq 5000$$$), number of test cases. $$$T$$$ pairs of lines with test case descriptions follow. The first line of a test case description contains a single integer $$$n$$$ ($$$7 \leq n \leq 50$$$), length of a string $$$s$$$. The second line of a test case de...
1,500
For each test case output an answer for it. In case if there is no way to replace question marks in string $$$s$$$ with a lowercase English letters in such a way that there is exactly one occurrence of a string "abacaba" in the resulting string as a substring output "No". Otherwise output "Yes" and in the next line out...
standard output
PASSED
ae8d0fae581a226c160a3c2f98b6b024
train_000.jsonl
1595149200
Acacius is studying strings theory. Today he came with the following problem.You are given a string $$$s$$$ of length $$$n$$$ consisting of lowercase English letters and question marks. It is possible to replace question marks with lowercase English letters in such a way that a string "abacaba" occurs as a substring in...
512 megabytes
import java.io.*; import java.util.InputMismatchException; import java.util.*; public class Acacius{ public static void main(String[] args) throws IOException{ FastReader sc = new FastReader(); char[] temp = "abacaba".toCharArray(); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStr...
Java
["6\n7\nabacaba\n7\n???????\n11\naba?abacaba\n11\nabacaba?aba\n15\nasdf???f???qwer\n11\nabacabacaba"]
1 second
["Yes\nabacaba\nYes\nabacaba\nYes\nabadabacaba\nYes\nabacabadaba\nNo\nNo"]
NoteIn first example there is exactly one occurrence of a string "abacaba" in the string "abacaba" as a substring.In second example seven question marks can be replaced with any seven lowercase English letters and with "abacaba" in particular.In sixth example there are two occurrences of a string "abacaba" as a substri...
Java 11
standard input
[ "implementation", "brute force", "strings" ]
f6b7ad10382135b293bd3f2f3257d4d3
First line of input contains an integer $$$T$$$ ($$$1 \leq T \leq 5000$$$), number of test cases. $$$T$$$ pairs of lines with test case descriptions follow. The first line of a test case description contains a single integer $$$n$$$ ($$$7 \leq n \leq 50$$$), length of a string $$$s$$$. The second line of a test case de...
1,500
For each test case output an answer for it. In case if there is no way to replace question marks in string $$$s$$$ with a lowercase English letters in such a way that there is exactly one occurrence of a string "abacaba" in the resulting string as a substring output "No". Otherwise output "Yes" and in the next line out...
standard output
PASSED
4fe3524f5fc52cd8dd3ca488054f6599
train_000.jsonl
1595149200
Acacius is studying strings theory. Today he came with the following problem.You are given a string $$$s$$$ of length $$$n$$$ consisting of lowercase English letters and question marks. It is possible to replace question marks with lowercase English letters in such a way that a string "abacaba" occurs as a substring in...
512 megabytes
import java.io.*; import java.util.Arrays; import java.util.StringTokenizer; public class Demo61 { public static class FastScanner { BufferedReader br; StringTokenizer st; public FastScanner(String s) { try { br = new BufferedReader(new FileReader(s)); ...
Java
["6\n7\nabacaba\n7\n???????\n11\naba?abacaba\n11\nabacaba?aba\n15\nasdf???f???qwer\n11\nabacabacaba"]
1 second
["Yes\nabacaba\nYes\nabacaba\nYes\nabadabacaba\nYes\nabacabadaba\nNo\nNo"]
NoteIn first example there is exactly one occurrence of a string "abacaba" in the string "abacaba" as a substring.In second example seven question marks can be replaced with any seven lowercase English letters and with "abacaba" in particular.In sixth example there are two occurrences of a string "abacaba" as a substri...
Java 11
standard input
[ "implementation", "brute force", "strings" ]
f6b7ad10382135b293bd3f2f3257d4d3
First line of input contains an integer $$$T$$$ ($$$1 \leq T \leq 5000$$$), number of test cases. $$$T$$$ pairs of lines with test case descriptions follow. The first line of a test case description contains a single integer $$$n$$$ ($$$7 \leq n \leq 50$$$), length of a string $$$s$$$. The second line of a test case de...
1,500
For each test case output an answer for it. In case if there is no way to replace question marks in string $$$s$$$ with a lowercase English letters in such a way that there is exactly one occurrence of a string "abacaba" in the resulting string as a substring output "No". Otherwise output "Yes" and in the next line out...
standard output
PASSED
7a0f2b9e75486e2e137e2c8b4a7ae28b
train_000.jsonl
1595149200
Acacius is studying strings theory. Today he came with the following problem.You are given a string $$$s$$$ of length $$$n$$$ consisting of lowercase English letters and question marks. It is possible to replace question marks with lowercase English letters in such a way that a string "abacaba" occurs as a substring in...
512 megabytes
// import java.util.HashMap; import java.util.Scanner; public class Solution{ public static boolean check(int si , int ei , char ch[]){ String str = "abacaba"; for(int i = si ; i <= ei ; i++){ if(ch[i] != str.charAt(i - si)){ return false; } } ...
Java
["6\n7\nabacaba\n7\n???????\n11\naba?abacaba\n11\nabacaba?aba\n15\nasdf???f???qwer\n11\nabacabacaba"]
1 second
["Yes\nabacaba\nYes\nabacaba\nYes\nabadabacaba\nYes\nabacabadaba\nNo\nNo"]
NoteIn first example there is exactly one occurrence of a string "abacaba" in the string "abacaba" as a substring.In second example seven question marks can be replaced with any seven lowercase English letters and with "abacaba" in particular.In sixth example there are two occurrences of a string "abacaba" as a substri...
Java 11
standard input
[ "implementation", "brute force", "strings" ]
f6b7ad10382135b293bd3f2f3257d4d3
First line of input contains an integer $$$T$$$ ($$$1 \leq T \leq 5000$$$), number of test cases. $$$T$$$ pairs of lines with test case descriptions follow. The first line of a test case description contains a single integer $$$n$$$ ($$$7 \leq n \leq 50$$$), length of a string $$$s$$$. The second line of a test case de...
1,500
For each test case output an answer for it. In case if there is no way to replace question marks in string $$$s$$$ with a lowercase English letters in such a way that there is exactly one occurrence of a string "abacaba" in the resulting string as a substring output "No". Otherwise output "Yes" and in the next line out...
standard output
PASSED
f902602de0a59fb261b9c53c5ab61b4b
train_000.jsonl
1595149200
Acacius is studying strings theory. Today he came with the following problem.You are given a string $$$s$$$ of length $$$n$$$ consisting of lowercase English letters and question marks. It is possible to replace question marks with lowercase English letters in such a way that a string "abacaba" occurs as a substring in...
512 megabytes
import java.util.Scanner; public class Main { public static String a = "abacaba"; public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); while(t-->0) { int n = scan.nextInt(),j=-1; String s = scan.next(),x=""; boolean b = true; if(n<7)b=false; ...
Java
["6\n7\nabacaba\n7\n???????\n11\naba?abacaba\n11\nabacaba?aba\n15\nasdf???f???qwer\n11\nabacabacaba"]
1 second
["Yes\nabacaba\nYes\nabacaba\nYes\nabadabacaba\nYes\nabacabadaba\nNo\nNo"]
NoteIn first example there is exactly one occurrence of a string "abacaba" in the string "abacaba" as a substring.In second example seven question marks can be replaced with any seven lowercase English letters and with "abacaba" in particular.In sixth example there are two occurrences of a string "abacaba" as a substri...
Java 11
standard input
[ "implementation", "brute force", "strings" ]
f6b7ad10382135b293bd3f2f3257d4d3
First line of input contains an integer $$$T$$$ ($$$1 \leq T \leq 5000$$$), number of test cases. $$$T$$$ pairs of lines with test case descriptions follow. The first line of a test case description contains a single integer $$$n$$$ ($$$7 \leq n \leq 50$$$), length of a string $$$s$$$. The second line of a test case de...
1,500
For each test case output an answer for it. In case if there is no way to replace question marks in string $$$s$$$ with a lowercase English letters in such a way that there is exactly one occurrence of a string "abacaba" in the resulting string as a substring output "No". Otherwise output "Yes" and in the next line out...
standard output
PASSED
fbd781c7c410e0945f4938f828dc9c8c
train_000.jsonl
1595149200
Acacius is studying strings theory. Today he came with the following problem.You are given a string $$$s$$$ of length $$$n$$$ consisting of lowercase English letters and question marks. It is possible to replace question marks with lowercase English letters in such a way that a string "abacaba" occurs as a substring in...
512 megabytes
import java.util.*; import java.io.*; public class A { static Scanner sc = new Scanner(System.in); static PrintWriter pw = new PrintWriter(System.out); static int find(String s){ int start = 0; int count = 0; while (start != -1){ start = s.indexOf("abacaba", start); ...
Java
["6\n7\nabacaba\n7\n???????\n11\naba?abacaba\n11\nabacaba?aba\n15\nasdf???f???qwer\n11\nabacabacaba"]
1 second
["Yes\nabacaba\nYes\nabacaba\nYes\nabadabacaba\nYes\nabacabadaba\nNo\nNo"]
NoteIn first example there is exactly one occurrence of a string "abacaba" in the string "abacaba" as a substring.In second example seven question marks can be replaced with any seven lowercase English letters and with "abacaba" in particular.In sixth example there are two occurrences of a string "abacaba" as a substri...
Java 11
standard input
[ "implementation", "brute force", "strings" ]
f6b7ad10382135b293bd3f2f3257d4d3
First line of input contains an integer $$$T$$$ ($$$1 \leq T \leq 5000$$$), number of test cases. $$$T$$$ pairs of lines with test case descriptions follow. The first line of a test case description contains a single integer $$$n$$$ ($$$7 \leq n \leq 50$$$), length of a string $$$s$$$. The second line of a test case de...
1,500
For each test case output an answer for it. In case if there is no way to replace question marks in string $$$s$$$ with a lowercase English letters in such a way that there is exactly one occurrence of a string "abacaba" in the resulting string as a substring output "No". Otherwise output "Yes" and in the next line out...
standard output
PASSED
d8d08d8b4f83def3ee8ce71a10beaf2d
train_000.jsonl
1595149200
Acacius is studying strings theory. Today he came with the following problem.You are given a string $$$s$$$ of length $$$n$$$ consisting of lowercase English letters and question marks. It is possible to replace question marks with lowercase English letters in such a way that a string "abacaba" occurs as a substring in...
512 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String args[]) { FastScanner fs=new FastScanner(); PrintWriter out=new PrintWriter(System.out); int t=fs.nextInt(); while(t-->0) { int n=fs.nextInt(); String str=fs.next();...
Java
["6\n7\nabacaba\n7\n???????\n11\naba?abacaba\n11\nabacaba?aba\n15\nasdf???f???qwer\n11\nabacabacaba"]
1 second
["Yes\nabacaba\nYes\nabacaba\nYes\nabadabacaba\nYes\nabacabadaba\nNo\nNo"]
NoteIn first example there is exactly one occurrence of a string "abacaba" in the string "abacaba" as a substring.In second example seven question marks can be replaced with any seven lowercase English letters and with "abacaba" in particular.In sixth example there are two occurrences of a string "abacaba" as a substri...
Java 11
standard input
[ "implementation", "brute force", "strings" ]
f6b7ad10382135b293bd3f2f3257d4d3
First line of input contains an integer $$$T$$$ ($$$1 \leq T \leq 5000$$$), number of test cases. $$$T$$$ pairs of lines with test case descriptions follow. The first line of a test case description contains a single integer $$$n$$$ ($$$7 \leq n \leq 50$$$), length of a string $$$s$$$. The second line of a test case de...
1,500
For each test case output an answer for it. In case if there is no way to replace question marks in string $$$s$$$ with a lowercase English letters in such a way that there is exactly one occurrence of a string "abacaba" in the resulting string as a substring output "No". Otherwise output "Yes" and in the next line out...
standard output
PASSED
ab54284e10c43b6b577b013712581420
train_000.jsonl
1595149200
Acacius is studying strings theory. Today he came with the following problem.You are given a string $$$s$$$ of length $$$n$$$ consisting of lowercase English letters and question marks. It is possible to replace question marks with lowercase English letters in such a way that a string "abacaba" occurs as a substring in...
512 megabytes
import java.util.*; public class Div_2_657_A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); boolean test = t == 4744; for (int tt = 1; tt <= t; tt++) { sc.nextInt(); char[] s = sc.next().toCharArray(); char[] sub = "abacaba".toCharArray(); // ...
Java
["6\n7\nabacaba\n7\n???????\n11\naba?abacaba\n11\nabacaba?aba\n15\nasdf???f???qwer\n11\nabacabacaba"]
1 second
["Yes\nabacaba\nYes\nabacaba\nYes\nabadabacaba\nYes\nabacabadaba\nNo\nNo"]
NoteIn first example there is exactly one occurrence of a string "abacaba" in the string "abacaba" as a substring.In second example seven question marks can be replaced with any seven lowercase English letters and with "abacaba" in particular.In sixth example there are two occurrences of a string "abacaba" as a substri...
Java 11
standard input
[ "implementation", "brute force", "strings" ]
f6b7ad10382135b293bd3f2f3257d4d3
First line of input contains an integer $$$T$$$ ($$$1 \leq T \leq 5000$$$), number of test cases. $$$T$$$ pairs of lines with test case descriptions follow. The first line of a test case description contains a single integer $$$n$$$ ($$$7 \leq n \leq 50$$$), length of a string $$$s$$$. The second line of a test case de...
1,500
For each test case output an answer for it. In case if there is no way to replace question marks in string $$$s$$$ with a lowercase English letters in such a way that there is exactly one occurrence of a string "abacaba" in the resulting string as a substring output "No". Otherwise output "Yes" and in the next line out...
standard output
PASSED
0108719402e542ca42cd403229557a0e
train_000.jsonl
1595149200
Acacius is studying strings theory. Today he came with the following problem.You are given a string $$$s$$$ of length $$$n$$$ consisting of lowercase English letters and question marks. It is possible to replace question marks with lowercase English letters in such a way that a string "abacaba" occurs as a substring in...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Div_2_657_A { public static void main(String[] args) { FastScanner sc = new FastScanner(); int t = sc.nextInt(); for (int tt = 1; tt <= t; tt++) { sc.nextInt(); char[] s = sc.next...
Java
["6\n7\nabacaba\n7\n???????\n11\naba?abacaba\n11\nabacaba?aba\n15\nasdf???f???qwer\n11\nabacabacaba"]
1 second
["Yes\nabacaba\nYes\nabacaba\nYes\nabadabacaba\nYes\nabacabadaba\nNo\nNo"]
NoteIn first example there is exactly one occurrence of a string "abacaba" in the string "abacaba" as a substring.In second example seven question marks can be replaced with any seven lowercase English letters and with "abacaba" in particular.In sixth example there are two occurrences of a string "abacaba" as a substri...
Java 11
standard input
[ "implementation", "brute force", "strings" ]
f6b7ad10382135b293bd3f2f3257d4d3
First line of input contains an integer $$$T$$$ ($$$1 \leq T \leq 5000$$$), number of test cases. $$$T$$$ pairs of lines with test case descriptions follow. The first line of a test case description contains a single integer $$$n$$$ ($$$7 \leq n \leq 50$$$), length of a string $$$s$$$. The second line of a test case de...
1,500
For each test case output an answer for it. In case if there is no way to replace question marks in string $$$s$$$ with a lowercase English letters in such a way that there is exactly one occurrence of a string "abacaba" in the resulting string as a substring output "No". Otherwise output "Yes" and in the next line out...
standard output
PASSED
a08b8a4f4d31dcd8a84b690a5344b051
train_000.jsonl
1595149200
Acacius is studying strings theory. Today he came with the following problem.You are given a string $$$s$$$ of length $$$n$$$ consisting of lowercase English letters and question marks. It is possible to replace question marks with lowercase English letters in such a way that a string "abacaba" occurs as a substring in...
512 megabytes
import java.util.*; public class Solutiona { static String ansString = "abacaba"; private static void findAns(String s) { int count =0; for(int i =0;i<=s.length()-7;i++) { if(s.substring(i,i+7).equals(ansString)) { count++; } } if(count==1) { System.out.println("Yes"); ...
Java
["6\n7\nabacaba\n7\n???????\n11\naba?abacaba\n11\nabacaba?aba\n15\nasdf???f???qwer\n11\nabacabacaba"]
1 second
["Yes\nabacaba\nYes\nabacaba\nYes\nabadabacaba\nYes\nabacabadaba\nNo\nNo"]
NoteIn first example there is exactly one occurrence of a string "abacaba" in the string "abacaba" as a substring.In second example seven question marks can be replaced with any seven lowercase English letters and with "abacaba" in particular.In sixth example there are two occurrences of a string "abacaba" as a substri...
Java 11
standard input
[ "implementation", "brute force", "strings" ]
f6b7ad10382135b293bd3f2f3257d4d3
First line of input contains an integer $$$T$$$ ($$$1 \leq T \leq 5000$$$), number of test cases. $$$T$$$ pairs of lines with test case descriptions follow. The first line of a test case description contains a single integer $$$n$$$ ($$$7 \leq n \leq 50$$$), length of a string $$$s$$$. The second line of a test case de...
1,500
For each test case output an answer for it. In case if there is no way to replace question marks in string $$$s$$$ with a lowercase English letters in such a way that there is exactly one occurrence of a string "abacaba" in the resulting string as a substring output "No". Otherwise output "Yes" and in the next line out...
standard output
PASSED
afec1a0e65bd3eec20206ef747475477
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.util.Scanner; public class Crosswords { public static void main( String[] args ) { Scanner hi = new Scanner( System.in ); String[] badoof = hi.nextLine().split(" "); String[] badyoof = hi.nextLine().split(" "); int[] oof = new int[2]; int[] yoof = new int[badyoof....
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≤ n ≤ 100000, 1 ≤ x ≤ 109) — the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 10000) — the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
7fccf3c0306a1b840749d23b8562ca0d
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.io.File; import java.io.FileNotFoundException; import java.nio.file.FileAlreadyExistsException; import java.util.Scanner; public class Main { public static void main(String[] args) throws FileNotFoundException{ Scanner scan = new Scanner(System.in); // Scanner scan = new Scanner(new File...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≤ n ≤ 100000, 1 ≤ x ≤ 109) — the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 10000) — the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
480e9387c000013590dfb480da4663e7
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.util.*; public class JapaneseCrosswordsStrikeBack { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int x = sc.nextInt(); int sum = 0; sc.nextLine(); for(int i = 0; i < n; i++) ...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≤ n ≤ 100000, 1 ≤ x ≤ 109) — the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 10000) — the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
452335c9f4fab75a7b0ae00249cbabd5
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Main main = new Main(); main.run(args); } private void run(String[] args) throws Exception { Scanner sc = new Scanner(System.in); // Scanner sc = new Scanner(new...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≤ n ≤ 100000, 1 ≤ x ≤ 109) — the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 10000) — the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
db91661a995bc84f9ee23de43233946b
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.io.*; import java.util.*; public class CF884B { 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.parseInt(st.nextToken()); int x = Integer.p...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≤ n ≤ 100000, 1 ≤ x ≤ 109) — the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 10000) — the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output