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
1d4943df93ca1b4473aa3d31f89dc14a
train_003.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.util.Scanner; public class TreasureHunt { public static String Solve() { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.nextLine(); String kuro = sc.nextLine(), shiro = sc.nextLine(), katie = sc.nextLine(); sc.close(); String[] output = {"Kuro", "Shiro", "Katie", "Draw"}; if...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
96ea7ac089df022c684a80d2fb47efa2
train_003.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
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.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { InputStrea...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
08aeda0ba6afea9739fbc402eee1c3a3
train_003.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.util.*; public class B { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String s1 = sc.next(); String s2 = sc.next(); String s3 = sc.next(); int a1 = beauty(s1, n); int a2 = beauty(s2, n); int a3 = beauty(s3, n); if(a1>a2 && a1...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
86f784cdbe57c949b83805ef524e4b2c
train_003.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Comparator; import java.util.StringTokenizer; public class BB { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedRe...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
0e018e34feb90b5517b7570dafc629fe
train_003.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.util.*; import java.io.*; public class Main { void solve(){ int n=ni(); char s[][]=new char[3][]; int cc[]=new int[3]; int cnt[]=new int[123]; // pw.println((int)('a')+" "+((int)('z'))+" "+((int)('A'))+" "+((int)('Z'))); for(int i=0;i<3;i++) { s[i]=...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
66e35f358262528cd48444e0c7ddea09
train_003.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.util.*; import java.io.*; public class Main { void solve(){ int n=ni(); char s[][]=new char[3][]; int cc[]=new int[3]; int cnt[]=new int[123]; // pw.println((int)('a')+" "+((int)('z'))+" "+((int)('A'))+" "+((int)('Z'))); for(int i=0;i<3;i++) { s[i]=...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$) — the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
2bd132f2dfaed2cd56a56eaf05538ff3
train_003.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.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.PrintStream; import java.util.Scanner; public class Main implements Runnable, AutoCloseable { Scanner in = new Scanner(new BufferedInputStream(System.in)); // StreamTokenizer in = new StreamTokenizer(new BufferedReader(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
0c1d6337ce7265d44644155d37c7ad8b
train_003.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.BigInteger; import java.util.*; import javax.swing.plaf.synth.SynthSeparatorUI; public class temp1 { static long sx = 0, sy = 0, t = 0; public static void main(String[] args) throws IOException { Reader scn = new Reader(); // Scanner scn = new Scanner(System.in); int t ...
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
7ba5b617c780ddd84d4dbd923ff4e8a2
train_003.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 HackerEarth { 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"); } else if((x==1&&y!=1)||(x==3&&y!=3)||(x==2&&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
a9c6cc42df44730c0db9d5cac2a26cd7
train_003.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.BigInteger; import java.util.HashSet; import java.util.InputMismatchException; import java.util.StringTokenizer; public class B { static class FastWriter { private final BufferedWriter bw; public FastWriter() { this.bw = new BufferedWriter(new OutputS...
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
d1819bf227d0ab014adf5c299afab709
train_003.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.BufferedOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.HashSet; public class Magic { public static void main(String[] args) { FastIO sc = new FastIO(); ...
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
b0057a23f2b2069a8d2356c7d4928f71
train_003.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 prob { public static void main(String[] args) { Scanner input = new Scanner(System.in); long t,i; t=input.nextInt(); while(t-->0){ long n,a,m,sum=1,b; a=input.nextInt(); b=in...
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
5a2bd1e51ea5f68504cb0e2074b767f6
train_003.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 MyProgram { public static FastIO file = new FastIO(); private static void solve() { int tt = nextInt(); while (tt-- > 0) { int x = nextInt(), y = nextInt(); if ((x < y && x > 3) || x > y || 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
a6dc222a38d6ea64f4eb5c3c6a2fef1b
train_003.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.BigInteger; import java.util.*; import static java.lang.Math.sqrt; import static java.lang.Math.floor; import static java.lang.Math.abs; public class cf { static final double EPS = 1e-6; final static BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); ...
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
1adce5217b15bd977370eb64b14a3ac8
train_003.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.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringT...
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
9b56701b8a71dda12b9c86fb3e6fdc40
train_003.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 magicstick { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for(int i=0;i<n;i++) { int a = sc.nextInt(); int b = sc.nextInt(); if(a==1 && b==1) { System.out.println("YES"); continue; } else if((a>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
77e0131b27cdc78f321b9d7474946cc1
train_003.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.HashSet; import java.util.LinkedList; public class Main { static BufferedReader input = new BufferedReader( new InputStreamReader(System.in) ); public static void main(String[] args) t...
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
7ade55295ed71924b79039b4772b28fb
train_003.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 spell { static String proc(int x, int y){ if (x==y) return "YES"; else if ((x==2 && y==3)) return "YES"; else if (x==1 && y>x) return "NO"; else if ((x==2 || x==3) && y>3) return "NO"; else return "YES"; } public static void m...
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
afffac4b0666543ebff4fc66b984340c
train_003.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.PrintWriter; import java.util.Scanner; public class Spell { public static void main(String args[]) { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int t = sc.nextInt(); while (t-- > 0) { int x = sc.nextInt(), y = sc.ne...
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
7275aaf808cb3f2e19c5dd7226e3741e
train_003.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.PrintWriter; import java.util.Scanner; public class Spell { public static void main(String args[]) { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int t = sc.nextInt(); while (t-- > 0) { int x = sc.nextInt(), y = sc.ne...
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
ad60c6a8db775aae6b5e5a009ecd8efb
train_003.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 javax.swing.*; import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { int T = 0; File f = new File("input.txt"); Scanner sc = new Scanner(System.in); T = sc.nextInt(); ...
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
65161b0183255a3aaf955c3de3cd931a
train_003.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.util.Map; import java.util.HashMap; import java.lang.Math; public class s { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc=new Scanner(System.in); int testcases=sc.nextInt(); for(int testcase=0;testcase<testcases;testcase++) { ...
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
3b8910a97974f220b6fa3b7c4c03db42
train_003.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 Solution1257B { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); while (t-- > 0) { int x = scanner.nextInt(); int y = scanner.nextInt(); 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
e18b6807e5c3608e888dd9d26f909492
train_003.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 q = in.nextInt(); while (q-- > 0) { int x = in.nextInt(); int y = in.nextInt(); if (x == 1) System.out.println((...
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
ddc2643609b5566d26ff683afe12fc15
train_003.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
// ___. .__ __ .__ __ // \_ |__ | | _____ ____ | | _____ _|__|__ __ ____ | | __ // | __ \| | \__ \ _/ ___\| |/ /\ \/ / \ \/ // __ \| |/ / // | \_\ \ |__/ __ \ \___| < \ /| |\ /\ ___/| < // |___ /____(____ /\___ >__|_ \ \_/ |__| \_/ \__...
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
2182fda4dfe9607250dfd5247c00aae1
train_003.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 com.company; import java.text.DecimalFormat; import java.util.*; import java.io.*; import java.lang.*; public class Main{ /* ** || ॐ श्री गणेशाय नमः || ** @𝙖𝙪𝙩𝙝𝙤𝙧 𝙅𝙞𝙜𝙖𝙧_𝙉𝙖𝙞𝙣𝙪𝙟𝙞 ** 𝙎𝙑𝙉𝙄𝙏-𝙎𝙐𝙍𝘼𝙏 */ public static void main(String args[]){ PrintWr...
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
a7929e4bb3726aa3285230bc7c4496e9
train_003.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.HashMap; import java.util.Map; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); while (N-- > 0) { int a = sc.nextInt(), b = sc.nextInt(); if (a == 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
b0948b4a92569bb09b5ec8143e7ad9ce
train_003.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
//normal import java.util.*; import java.lang.*; import java.io.*; // String Tokenizer public class Main { public static void main(String[] args) { // code Scanner scn = new Scanner(System.in); // System.out.println("Jai"); int t = scn.nextInt(); while (t > 0) { t--; long a = scn.nextLong(); long b...
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
a74483dea3aa9b9cd9f5fb627b4e64d6
train_003.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 MagicStick { public static void main(String[] args) { Scanner scan = new Scanner( System.in ); int t = scan.nextInt(); int x, y; for( int i = 0; i < t; i++ ) { x = scan.nextInt(); y = scan.nextInt(); if( x >= y ) { System.out.println("YES"); } else if...
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
e7dcc9b8fc379f7dd54c7f68a5683b0b
train_003.jsonl
1543934100
You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0.
256 megabytes
////b ////import javax.swing.plaf.synth.SynthDesktopIconUI; //import com.sun.source.tree.Tree; // //import java.lang.reflect.Array; import java.util.*; import java .io.*; public class Yahia { public static void main(String[] args) throws IOException, InterruptedException { Scanner sc = new Scanner(System.i...
Java
["3 5\n1 2 3", "4 2\n10 3 5 3"]
1 second
["1\n1\n1\n0\n0", "3\n2"]
NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ...
Java 8
standard input
[ "implementation", "sortings" ]
0f100199a720b0fdead5f03e1882f2f3
The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array.
1,000
Print the minimum non-zero element before each operation in a new line.
standard output
PASSED
130f4c332840fa17d8beba7cf8f3f5d7
train_003.jsonl
1543934100
You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0.
256 megabytes
import java.util.*; import static java.lang.Math.*; public class m { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(), k = in.nextInt(); TreeSet<Integer> gg = new TreeSet<Integer>(); for (int i = 0;i < n;i++) { int q; q = in.nextInt(); gg.add(new Inte...
Java
["3 5\n1 2 3", "4 2\n10 3 5 3"]
1 second
["1\n1\n1\n0\n0", "3\n2"]
NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ...
Java 8
standard input
[ "implementation", "sortings" ]
0f100199a720b0fdead5f03e1882f2f3
The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array.
1,000
Print the minimum non-zero element before each operation in a new line.
standard output
PASSED
090f0558158da4a7472a1111f8094792
train_003.jsonl
1543934100
You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0.
256 megabytes
import java.util.*; import static java.lang.Math.*; public class m { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(), k = in.nextInt(); SortedSet<Integer> gg = new TreeSet<Integer>(); for (int i = 0;i < n;i++) { int q; q = in.nextInt(); gg.add(new In...
Java
["3 5\n1 2 3", "4 2\n10 3 5 3"]
1 second
["1\n1\n1\n0\n0", "3\n2"]
NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ...
Java 8
standard input
[ "implementation", "sortings" ]
0f100199a720b0fdead5f03e1882f2f3
The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array.
1,000
Print the minimum non-zero element before each operation in a new line.
standard output
PASSED
c27413a3d6235ab948652ea4ee0f9452
train_003.jsonl
1543934100
You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0.
256 megabytes
import java.util.*; public class m { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(), k = in.nextInt(); int a[] = new int[n + 1]; for (int i = 0;i < n;i++) { a[i] = in.nextInt(); } a[n] = 0; Arrays.sort(a); for (int i = 1;i <= n;i++) { if (k == ...
Java
["3 5\n1 2 3", "4 2\n10 3 5 3"]
1 second
["1\n1\n1\n0\n0", "3\n2"]
NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ...
Java 8
standard input
[ "implementation", "sortings" ]
0f100199a720b0fdead5f03e1882f2f3
The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array.
1,000
Print the minimum non-zero element before each operation in a new line.
standard output
PASSED
d9a09cda5e9417e640a8b6f5f6e05a83
train_003.jsonl
1543934100
You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0.
256 megabytes
import java.io.*; import java.util.*; public class Task { public static void main(String[] args) throws Exception { new Task().go(); } PrintWriter out; Reader in; BufferedReader br; Task() throws IOException { try { //br = new BufferedReader( new FileReader("in...
Java
["3 5\n1 2 3", "4 2\n10 3 5 3"]
1 second
["1\n1\n1\n0\n0", "3\n2"]
NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ...
Java 8
standard input
[ "implementation", "sortings" ]
0f100199a720b0fdead5f03e1882f2f3
The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array.
1,000
Print the minimum non-zero element before each operation in a new line.
standard output
PASSED
97838984795343a1abfc840c80bb3ae2
train_003.jsonl
1543934100
You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0.
256 megabytes
import java.util.*; public class C { static Scanner k = new Scanner(System.in); static long [] y; static int n, m; static int bs(int index, long sum){ int low = index; int high = y.length - 1; //long ans = Long.MAX_VALUE; int ansIndex = -1; while(low <= high){ ...
Java
["3 5\n1 2 3", "4 2\n10 3 5 3"]
1 second
["1\n1\n1\n0\n0", "3\n2"]
NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ...
Java 8
standard input
[ "implementation", "sortings" ]
0f100199a720b0fdead5f03e1882f2f3
The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array.
1,000
Print the minimum non-zero element before each operation in a new line.
standard output
PASSED
0329fca2cb2d069301faeb7f032941fb
train_003.jsonl
1543934100
You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0.
256 megabytes
/* BY - LAXMIKANT KATRE (laxmikant2000) */ import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { MyScanner sc = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); int n = sc.nextInt(); int k =...
Java
["3 5\n1 2 3", "4 2\n10 3 5 3"]
1 second
["1\n1\n1\n0\n0", "3\n2"]
NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ...
Java 8
standard input
[ "implementation", "sortings" ]
0f100199a720b0fdead5f03e1882f2f3
The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array.
1,000
Print the minimum non-zero element before each operation in a new line.
standard output
PASSED
daee2e8762c64c2e811cdf9429acd5c2
train_003.jsonl
1543934100
You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0.
256 megabytes
import java.util.Arrays; import java.util.HashMap; import java.util.Scanner; public class Akele { public static void main(String args[]) { Scanner s=new Scanner(System.in); int n=s.nextInt(); int k=s.nextInt(); int arr[]=new int[n]; for(int i=0;i<n;i++)arr[i]=s.nextInt(); ...
Java
["3 5\n1 2 3", "4 2\n10 3 5 3"]
1 second
["1\n1\n1\n0\n0", "3\n2"]
NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ...
Java 8
standard input
[ "implementation", "sortings" ]
0f100199a720b0fdead5f03e1882f2f3
The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array.
1,000
Print the minimum non-zero element before each operation in a new line.
standard output
PASSED
fcec3de3aa5b10c5be1664a92f1285b1
train_003.jsonl
1543934100
You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0.
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.HashSet; import java.util.StringTokenizer; /** * @author Andrei Chugunov */ public class A { private BufferedReader br; private PrintWriter out; ...
Java
["3 5\n1 2 3", "4 2\n10 3 5 3"]
1 second
["1\n1\n1\n0\n0", "3\n2"]
NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ...
Java 8
standard input
[ "implementation", "sortings" ]
0f100199a720b0fdead5f03e1882f2f3
The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array.
1,000
Print the minimum non-zero element before each operation in a new line.
standard output
PASSED
9fbc6585280ac2e8412e17d87649062a
train_003.jsonl
1543934100
You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0.
256 megabytes
import java.util.Scanner; import java.util.ArrayList; import java.util.Collections; import java.util.Arrays; public class Subs{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int[] arr = new int[n]; for(int i=0;i<n;i++) { arr[i]=s...
Java
["3 5\n1 2 3", "4 2\n10 3 5 3"]
1 second
["1\n1\n1\n0\n0", "3\n2"]
NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ...
Java 8
standard input
[ "implementation", "sortings" ]
0f100199a720b0fdead5f03e1882f2f3
The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array.
1,000
Print the minimum non-zero element before each operation in a new line.
standard output
PASSED
c908753c9c462368d5625315e247a87c
train_003.jsonl
1543934100
You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0.
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.Scanner; import java.util.Collections; import java.util.ArrayList; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { pub...
Java
["3 5\n1 2 3", "4 2\n10 3 5 3"]
1 second
["1\n1\n1\n0\n0", "3\n2"]
NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ...
Java 8
standard input
[ "implementation", "sortings" ]
0f100199a720b0fdead5f03e1882f2f3
The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array.
1,000
Print the minimum non-zero element before each operation in a new line.
standard output
PASSED
9680bcb50c75db55301a8e65967c20fe
train_003.jsonl
1543934100
You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0.
256 megabytes
import java.util.*; public class a{ public static void main(String[] args) { Scanner in=new Scanner(System.in); int n=in.nextInt(); int k=in.nextInt(); ArrayList<Integer> ar=new ArrayList<Integer>(); for(int i=0;i<n;i++) ar.add(in.nextInt()); Collections.sort(ar); LinkedHashSet<Integer> set=new L...
Java
["3 5\n1 2 3", "4 2\n10 3 5 3"]
1 second
["1\n1\n1\n0\n0", "3\n2"]
NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ...
Java 8
standard input
[ "implementation", "sortings" ]
0f100199a720b0fdead5f03e1882f2f3
The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array.
1,000
Print the minimum non-zero element before each operation in a new line.
standard output
PASSED
43c8b7fe569c9b5c9d8242384c67201b
train_003.jsonl
1543934100
You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class tG { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new ...
Java
["3 5\n1 2 3", "4 2\n10 3 5 3"]
1 second
["1\n1\n1\n0\n0", "3\n2"]
NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ...
Java 8
standard input
[ "implementation", "sortings" ]
0f100199a720b0fdead5f03e1882f2f3
The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array.
1,000
Print the minimum non-zero element before each operation in a new line.
standard output
PASSED
04e56d2e5555a14dec5e7c9c23cb3158
train_003.jsonl
1543934100
You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0.
256 megabytes
import java.util.*; public class a{ public static void main(String[] args) { Scanner in=new Scanner(System.in); int n=in.nextInt(); int k=in.nextInt(); ArrayList<Integer> ar=new ArrayList<Integer>(); for(int i=0;i<n;i++) ar.add(in.nextInt()); Collections.sort(ar); LinkedHashSet<Integer> set=new L...
Java
["3 5\n1 2 3", "4 2\n10 3 5 3"]
1 second
["1\n1\n1\n0\n0", "3\n2"]
NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ...
Java 8
standard input
[ "implementation", "sortings" ]
0f100199a720b0fdead5f03e1882f2f3
The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array.
1,000
Print the minimum non-zero element before each operation in a new line.
standard output
PASSED
ffe6c674c9b7a3fecd860e3091269008
train_003.jsonl
1543934100
You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0.
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; import java.math.BigInteger; public class Main { private static final FS scanner = new FS(System.in); //private static final Scanner scanner = new Scanner(System.in); public static void main(String[] args) throws IOException { int n = scanner...
Java
["3 5\n1 2 3", "4 2\n10 3 5 3"]
1 second
["1\n1\n1\n0\n0", "3\n2"]
NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ...
Java 8
standard input
[ "implementation", "sortings" ]
0f100199a720b0fdead5f03e1882f2f3
The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array.
1,000
Print the minimum non-zero element before each operation in a new line.
standard output
PASSED
66481679d518e518fd5b2fb4b379c601
train_003.jsonl
1543934100
You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0.
256 megabytes
//package CodeForces; import java.io.*; import java.util.*; public class Main { public class Haha { /* _____ ___ /\ /\ | | | | /\ /\ /\ /\ /\ /\ | \ محمد أ...
Java
["3 5\n1 2 3", "4 2\n10 3 5 3"]
1 second
["1\n1\n1\n0\n0", "3\n2"]
NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ...
Java 8
standard input
[ "implementation", "sortings" ]
0f100199a720b0fdead5f03e1882f2f3
The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array.
1,000
Print the minimum non-zero element before each operation in a new line.
standard output
PASSED
ed2ca870d03820d068b2d3c0d7f56615
train_003.jsonl
1543934100
You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0.
256 megabytes
import java.io.*; import java.util.StringTokenizer; import java.util.TreeMap; import java.util.TreeSet; public class Today { public static void main(String[] args) throws IOException, InterruptedException { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int n = sc.nextInt(); ...
Java
["3 5\n1 2 3", "4 2\n10 3 5 3"]
1 second
["1\n1\n1\n0\n0", "3\n2"]
NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ...
Java 8
standard input
[ "implementation", "sortings" ]
0f100199a720b0fdead5f03e1882f2f3
The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array.
1,000
Print the minimum non-zero element before each operation in a new line.
standard output
PASSED
6ffffbe1f40caf14f9986b973707f210
train_003.jsonl
1543934100
You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0.
256 megabytes
import java.util.*; public class pl { public static long result(long num) { long ctr = 0; for(long i=1; i<=(long)Math.sqrt(num); i++) { if(num%i==0 && i*i!=num) { ctr+=2; } else if (i*i==num) { ctr++; } } ret...
Java
["3 5\n1 2 3", "4 2\n10 3 5 3"]
1 second
["1\n1\n1\n0\n0", "3\n2"]
NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ...
Java 8
standard input
[ "implementation", "sortings" ]
0f100199a720b0fdead5f03e1882f2f3
The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array.
1,000
Print the minimum non-zero element before each operation in a new line.
standard output
PASSED
a96e3213691503263402493b19745179
train_003.jsonl
1543934100
You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0.
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int k = scanner.nextInt(); ArrayList<Integer> arrayList = new Arra...
Java
["3 5\n1 2 3", "4 2\n10 3 5 3"]
1 second
["1\n1\n1\n0\n0", "3\n2"]
NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ...
Java 8
standard input
[ "implementation", "sortings" ]
0f100199a720b0fdead5f03e1882f2f3
The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array.
1,000
Print the minimum non-zero element before each operation in a new line.
standard output
PASSED
ad266052f4cccc1d5a8477fe6868953e
train_003.jsonl
1543934100
You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0.
256 megabytes
import java.util.*; public class Sub { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int[] arr = new int[n]; for(int i = 0; i<n; i++) { arr[i] = sc.nextInt(); } ...
Java
["3 5\n1 2 3", "4 2\n10 3 5 3"]
1 second
["1\n1\n1\n0\n0", "3\n2"]
NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ...
Java 8
standard input
[ "implementation", "sortings" ]
0f100199a720b0fdead5f03e1882f2f3
The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array.
1,000
Print the minimum non-zero element before each operation in a new line.
standard output
PASSED
8ef5fd8c51b070a592bdde15f633feac
train_003.jsonl
1543934100
You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0.
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; public class Main { static final long mod=(int)1e9+7; public static void main(String[] args) throws Exception { FastReader in=new FastReader(); PrintWriter pw=new PrintWriter(System.out); int n=in.nextInt(); int k=in.nex...
Java
["3 5\n1 2 3", "4 2\n10 3 5 3"]
1 second
["1\n1\n1\n0\n0", "3\n2"]
NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ...
Java 8
standard input
[ "implementation", "sortings" ]
0f100199a720b0fdead5f03e1882f2f3
The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array.
1,000
Print the minimum non-zero element before each operation in a new line.
standard output
PASSED
3f65ed5cd0b45d8d308c703545522ec3
train_003.jsonl
1543934100
You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0.
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.util.Arrays; import java.util.StringTokenizer; public class Main{ public static void main(String[] args) throws IOException{ boolean check = false; BufferedReader br = new BufferedReader(new InputStreamReader(...
Java
["3 5\n1 2 3", "4 2\n10 3 5 3"]
1 second
["1\n1\n1\n0\n0", "3\n2"]
NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ...
Java 8
standard input
[ "implementation", "sortings" ]
0f100199a720b0fdead5f03e1882f2f3
The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array.
1,000
Print the minimum non-zero element before each operation in a new line.
standard output
PASSED
911fbbd7506f72cc87dd1e22daae69d9
train_003.jsonl
1543934100
You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0.
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner s=new Scanner(System.in); int n=s.nextInt(); int k=s.nextInt(); ArrayList<Integer> p=new ArrayList<Integer>(); for(int i=0;i<n;i++) { p.add(s.nextInt()); } Collections.sort(p); int i=0; ...
Java
["3 5\n1 2 3", "4 2\n10 3 5 3"]
1 second
["1\n1\n1\n0\n0", "3\n2"]
NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ...
Java 8
standard input
[ "implementation", "sortings" ]
0f100199a720b0fdead5f03e1882f2f3
The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array.
1,000
Print the minimum non-zero element before each operation in a new line.
standard output
PASSED
842cd8797a4dd51eddacad9aad6bfc06
train_003.jsonl
1543934100
You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0.
256 megabytes
import java.io.*; import java.util.*; public class Ehabandsubtraction { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); ArrayList<Integer> intlist = new ArrayList<...
Java
["3 5\n1 2 3", "4 2\n10 3 5 3"]
1 second
["1\n1\n1\n0\n0", "3\n2"]
NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ...
Java 8
standard input
[ "implementation", "sortings" ]
0f100199a720b0fdead5f03e1882f2f3
The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array.
1,000
Print the minimum non-zero element before each operation in a new line.
standard output
PASSED
a64f8bf781b31f07c55f94865455c6ab
train_003.jsonl
1543934100
You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.math.BigInteger; import java.util.Arrays; import java.util.Random; import java.util.StringTokenizer; public class Jetch { static...
Java
["3 5\n1 2 3", "4 2\n10 3 5 3"]
1 second
["1\n1\n1\n0\n0", "3\n2"]
NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ...
Java 8
standard input
[ "implementation", "sortings" ]
0f100199a720b0fdead5f03e1882f2f3
The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array.
1,000
Print the minimum non-zero element before each operation in a new line.
standard output
PASSED
fa145064f7774a03335d614d00b24005
train_003.jsonl
1405256400
DZY owns 2m islands near his home, numbered from 1 to 2m. He loves building bridges to connect the islands. Every bridge he builds takes one day's time to walk across.DZY has a strange rule of building the bridges. For every pair of islands u, v (u ≠ v), he has built 2k different bridges connecting them, where (a|b me...
512 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.util.Arrays; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public cla...
Java
["2 1 4\n1 1 1 2", "3 5 6\n389094 705719 547193 653800 947499 17024"]
5 seconds
["1", "556970"]
NoteIn the first sample, ans = [6, 7, 6, 6].If he wants to be at island 1 after one day, he has 6 different ways: home —&gt; 1 -(stay)-&gt; 1 home —&gt; 2 —&gt; 1 home —&gt; 3 —&gt; 1 home —&gt; 3 —&gt; 1 (note that there are two different bridges between 1 and 3) home —&gt; 4 —&gt; 1 home —&gt; 4 —&gt; 1 (note t...
Java 8
standard input
[ "math", "matrices" ]
2a7bc7a9fd37fdc729770697959bff33
To avoid huge input, we use the following way to generate the array a. You are given the first s elements of array: a1, a2, ..., as. All the other elements should be calculated by formula: ai = (101·ai - s + 10007) mod 1051131 (s &lt; i ≤ 2m). The first line contains three integers m, t, s (1 ≤ m ≤ 25; 1 ≤ t ≤ 1018; 1 ...
3,100
To avoid huge output, you only need to output xor-sum of all the answers for all i modulo 1051131 (1 ≤ i ≤ 2m), i.e. (ans[1] mod 1051131) xor (ans[2] mod 1051131) xor... xor (ans[n] mod 1051131).
standard output
PASSED
9a29673423a45840dc0d4a4c4d65b085
train_003.jsonl
1405256400
DZY owns 2m islands near his home, numbered from 1 to 2m. He loves building bridges to connect the islands. Every bridge he builds takes one day's time to walk across.DZY has a strange rule of building the bridges. For every pair of islands u, v (u ≠ v), he has built 2k different bridges connecting them, where (a|b me...
512 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.util.Arrays; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public cla...
Java
["2 1 4\n1 1 1 2", "3 5 6\n389094 705719 547193 653800 947499 17024"]
5 seconds
["1", "556970"]
NoteIn the first sample, ans = [6, 7, 6, 6].If he wants to be at island 1 after one day, he has 6 different ways: home —&gt; 1 -(stay)-&gt; 1 home —&gt; 2 —&gt; 1 home —&gt; 3 —&gt; 1 home —&gt; 3 —&gt; 1 (note that there are two different bridges between 1 and 3) home —&gt; 4 —&gt; 1 home —&gt; 4 —&gt; 1 (note t...
Java 6
standard input
[ "math", "matrices" ]
2a7bc7a9fd37fdc729770697959bff33
To avoid huge input, we use the following way to generate the array a. You are given the first s elements of array: a1, a2, ..., as. All the other elements should be calculated by formula: ai = (101·ai - s + 10007) mod 1051131 (s &lt; i ≤ 2m). The first line contains three integers m, t, s (1 ≤ m ≤ 25; 1 ≤ t ≤ 1018; 1 ...
3,100
To avoid huge output, you only need to output xor-sum of all the answers for all i modulo 1051131 (1 ≤ i ≤ 2m), i.e. (ans[1] mod 1051131) xor (ans[2] mod 1051131) xor... xor (ans[n] mod 1051131).
standard output
PASSED
3c74980cec461e906a911a2f6624c53f
train_003.jsonl
1448382900
When Xellos was doing a practice course in university, he once had to measure the intensity of an effect that slowly approached equilibrium. A good way to determine the equilibrium intensity would be choosing a sufficiently large number of consecutive data points that seems as constant as possible and taking their aver...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; import java.awt.Point; // SHIVAM GUPTA : //NSIT //decoder_1671 // STOP NOT TILL IT IS DONE OR U DIE . // U KNOW THAT IF THIS DAY WILL BE URS THEN NO ONE CAN DEFEAT U HERE................ // ASCII = 48 + i ;// 2^28 = 268,435,456 > 2* 10^8 // log 10 base 2 = ...
Java
["5\n1 2 3 3 2", "11\n5 4 5 5 6 7 8 8 8 7 6"]
2 seconds
["4", "5"]
NoteIn the first sample, the longest almost constant range is [2, 5]; its length (the number of data points in it) is 4.In the second sample, there are three almost constant ranges of length 4: [1, 4], [6, 9] and [7, 10]; the only almost constant range of the maximum length 5 is [6, 10].
Java 11
standard input
[ "dp", "two pointers", "implementation" ]
b784cebc7e50cc831fde480171b9eb84
The first line of the input contains a single integer n (2 ≤ n ≤ 100 000) — the number of data points. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 100 000).
1,400
Print a single number — the maximum length of an almost constant range of the given sequence.
standard output
PASSED
9a679200ac2789d7af06930e67870268
train_003.jsonl
1448382900
When Xellos was doing a practice course in university, he once had to measure the intensity of an effect that slowly approached equilibrium. A good way to determine the equilibrium intensity would be choosing a sufficiently large number of consecutive data points that seems as constant as possible and taking their aver...
256 megabytes
import java.util.Scanner; public class ApproximatingaConstantRange { static Scanner sc; public static void main(String[] args) { sc = new Scanner(System.in); int n = sc.nextInt(); //initial values int prev = -1; int current, next; int prevCount = 0, currentCount = 1; //longest constant range leng...
Java
["5\n1 2 3 3 2", "11\n5 4 5 5 6 7 8 8 8 7 6"]
2 seconds
["4", "5"]
NoteIn the first sample, the longest almost constant range is [2, 5]; its length (the number of data points in it) is 4.In the second sample, there are three almost constant ranges of length 4: [1, 4], [6, 9] and [7, 10]; the only almost constant range of the maximum length 5 is [6, 10].
Java 11
standard input
[ "dp", "two pointers", "implementation" ]
b784cebc7e50cc831fde480171b9eb84
The first line of the input contains a single integer n (2 ≤ n ≤ 100 000) — the number of data points. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 100 000).
1,400
Print a single number — the maximum length of an almost constant range of the given sequence.
standard output
PASSED
c62a0f8a260c7d3a63ea2fc0509a11f1
train_003.jsonl
1448382900
When Xellos was doing a practice course in university, he once had to measure the intensity of an effect that slowly approached equilibrium. A good way to determine the equilibrium intensity would be choosing a sufficiently large number of consecutive data points that seems as constant as possible and taking their aver...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Solution { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); PrintWriter out = new Prin...
Java
["5\n1 2 3 3 2", "11\n5 4 5 5 6 7 8 8 8 7 6"]
2 seconds
["4", "5"]
NoteIn the first sample, the longest almost constant range is [2, 5]; its length (the number of data points in it) is 4.In the second sample, there are three almost constant ranges of length 4: [1, 4], [6, 9] and [7, 10]; the only almost constant range of the maximum length 5 is [6, 10].
Java 11
standard input
[ "dp", "two pointers", "implementation" ]
b784cebc7e50cc831fde480171b9eb84
The first line of the input contains a single integer n (2 ≤ n ≤ 100 000) — the number of data points. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 100 000).
1,400
Print a single number — the maximum length of an almost constant range of the given sequence.
standard output
PASSED
c5da394508abbdc157e65314b127d37a
train_003.jsonl
1448382900
When Xellos was doing a practice course in university, he once had to measure the intensity of an effect that slowly approached equilibrium. A good way to determine the equilibrium intensity would be choosing a sufficiently large number of consecutive data points that seems as constant as possible and taking their aver...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.*; public class cf602b { public static void main(String[] args) throws IOException { int n = ri(), a[] = ria(n), i = 0, j = 0, last = 0, ans = 0; while(i < n) { while(j < n && a[j] == ...
Java
["5\n1 2 3 3 2", "11\n5 4 5 5 6 7 8 8 8 7 6"]
2 seconds
["4", "5"]
NoteIn the first sample, the longest almost constant range is [2, 5]; its length (the number of data points in it) is 4.In the second sample, there are three almost constant ranges of length 4: [1, 4], [6, 9] and [7, 10]; the only almost constant range of the maximum length 5 is [6, 10].
Java 11
standard input
[ "dp", "two pointers", "implementation" ]
b784cebc7e50cc831fde480171b9eb84
The first line of the input contains a single integer n (2 ≤ n ≤ 100 000) — the number of data points. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 100 000).
1,400
Print a single number — the maximum length of an almost constant range of the given sequence.
standard output
PASSED
04a886c26ecbf1a1f8ab485f7c09a691
train_003.jsonl
1448382900
When Xellos was doing a practice course in university, he once had to measure the intensity of an effect that slowly approached equilibrium. A good way to determine the equilibrium intensity would be choosing a sufficiently large number of consecutive data points that seems as constant as possible and taking their aver...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static int longestSubarray(int[] input) { int prev = -1; int current, next; int prevCount = 0, currentCount = 1; // longest constant range length int longest = 1; // first number ...
Java
["5\n1 2 3 3 2", "11\n5 4 5 5 6 7 8 8 8 7 6"]
2 seconds
["4", "5"]
NoteIn the first sample, the longest almost constant range is [2, 5]; its length (the number of data points in it) is 4.In the second sample, there are three almost constant ranges of length 4: [1, 4], [6, 9] and [7, 10]; the only almost constant range of the maximum length 5 is [6, 10].
Java 11
standard input
[ "dp", "two pointers", "implementation" ]
b784cebc7e50cc831fde480171b9eb84
The first line of the input contains a single integer n (2 ≤ n ≤ 100 000) — the number of data points. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 100 000).
1,400
Print a single number — the maximum length of an almost constant range of the given sequence.
standard output
PASSED
253d1e28cd26956e3f5490e6e9904765
train_003.jsonl
1448382900
When Xellos was doing a practice course in university, he once had to measure the intensity of an effect that slowly approached equilibrium. A good way to determine the equilibrium intensity would be choosing a sufficiently large number of consecutive data points that seems as constant as possible and taking their aver...
256 megabytes
/* package codechef; // don't place package name! */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.*; public class HelloWorld{ public static void main(String[] args) throws IOException { Sca...
Java
["5\n1 2 3 3 2", "11\n5 4 5 5 6 7 8 8 8 7 6"]
2 seconds
["4", "5"]
NoteIn the first sample, the longest almost constant range is [2, 5]; its length (the number of data points in it) is 4.In the second sample, there are three almost constant ranges of length 4: [1, 4], [6, 9] and [7, 10]; the only almost constant range of the maximum length 5 is [6, 10].
Java 11
standard input
[ "dp", "two pointers", "implementation" ]
b784cebc7e50cc831fde480171b9eb84
The first line of the input contains a single integer n (2 ≤ n ≤ 100 000) — the number of data points. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 100 000).
1,400
Print a single number — the maximum length of an almost constant range of the given sequence.
standard output
PASSED
a8b31e728c5f9b163300d840f834466c
train_003.jsonl
1448382900
When Xellos was doing a practice course in university, he once had to measure the intensity of an effect that slowly approached equilibrium. A good way to determine the equilibrium intensity would be choosing a sufficiently large number of consecutive data points that seems as constant as possible and taking their aver...
256 megabytes
/** * @author : Kshitij */ import java.io.*; import java.util.InputMismatchException; public class Main { public static void main(String[] xps){ InputReader in = new InputReader(System.in); OutputWriter out = new OutputWriter(System.out); StringBuilder stringBuilder = new StringBuilder();...
Java
["5\n1 2 3 3 2", "11\n5 4 5 5 6 7 8 8 8 7 6"]
2 seconds
["4", "5"]
NoteIn the first sample, the longest almost constant range is [2, 5]; its length (the number of data points in it) is 4.In the second sample, there are three almost constant ranges of length 4: [1, 4], [6, 9] and [7, 10]; the only almost constant range of the maximum length 5 is [6, 10].
Java 11
standard input
[ "dp", "two pointers", "implementation" ]
b784cebc7e50cc831fde480171b9eb84
The first line of the input contains a single integer n (2 ≤ n ≤ 100 000) — the number of data points. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 100 000).
1,400
Print a single number — the maximum length of an almost constant range of the given sequence.
standard output
PASSED
d587e4656807946c235af2164a0d3c0d
train_003.jsonl
1448382900
When Xellos was doing a practice course in university, he once had to measure the intensity of an effect that slowly approached equilibrium. A good way to determine the equilibrium intensity would be choosing a sufficiently large number of consecutive data points that seems as constant as possible and taking their aver...
256 megabytes
import java.util.StringTokenizer; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; public class Main{ public static void main(String[]args) { FastReader in = new FastReader(); PrintWriter b=new PrintW...
Java
["5\n1 2 3 3 2", "11\n5 4 5 5 6 7 8 8 8 7 6"]
2 seconds
["4", "5"]
NoteIn the first sample, the longest almost constant range is [2, 5]; its length (the number of data points in it) is 4.In the second sample, there are three almost constant ranges of length 4: [1, 4], [6, 9] and [7, 10]; the only almost constant range of the maximum length 5 is [6, 10].
Java 11
standard input
[ "dp", "two pointers", "implementation" ]
b784cebc7e50cc831fde480171b9eb84
The first line of the input contains a single integer n (2 ≤ n ≤ 100 000) — the number of data points. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 100 000).
1,400
Print a single number — the maximum length of an almost constant range of the given sequence.
standard output
PASSED
b982ded0343c4c829bdaecdc524dcdec
train_003.jsonl
1448382900
When Xellos was doing a practice course in university, he once had to measure the intensity of an effect that slowly approached equilibrium. A good way to determine the equilibrium intensity would be choosing a sufficiently large number of consecutive data points that seems as constant as possible and taking their aver...
256 megabytes
import java.util.*; import java.math.*; import java.io.*; public class A{ final int N = 10000; static int cnt[]=new int[27]; static int n; public static void main(String[] args) throws IOException { InputReader scan=new InputReader(System.in); PrintWriter out=new PrintWriter(System.out); int n=scan.nextInt()...
Java
["5\n1 2 3 3 2", "11\n5 4 5 5 6 7 8 8 8 7 6"]
2 seconds
["4", "5"]
NoteIn the first sample, the longest almost constant range is [2, 5]; its length (the number of data points in it) is 4.In the second sample, there are three almost constant ranges of length 4: [1, 4], [6, 9] and [7, 10]; the only almost constant range of the maximum length 5 is [6, 10].
Java 11
standard input
[ "dp", "two pointers", "implementation" ]
b784cebc7e50cc831fde480171b9eb84
The first line of the input contains a single integer n (2 ≤ n ≤ 100 000) — the number of data points. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 100 000).
1,400
Print a single number — the maximum length of an almost constant range of the given sequence.
standard output
PASSED
313bd7e00844384914ecd647a11e02fb
train_003.jsonl
1448382900
When Xellos was doing a practice course in university, he once had to measure the intensity of an effect that slowly approached equilibrium. A good way to determine the equilibrium intensity would be choosing a sufficiently large number of consecutive data points that seems as constant as possible and taking their aver...
256 megabytes
// package endsem; import java.util.*; import java.lang.Math; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Cf { public static void main(String[] args) throws IOException{ //Scanner sc=new Scan...
Java
["5\n1 2 3 3 2", "11\n5 4 5 5 6 7 8 8 8 7 6"]
2 seconds
["4", "5"]
NoteIn the first sample, the longest almost constant range is [2, 5]; its length (the number of data points in it) is 4.In the second sample, there are three almost constant ranges of length 4: [1, 4], [6, 9] and [7, 10]; the only almost constant range of the maximum length 5 is [6, 10].
Java 11
standard input
[ "dp", "two pointers", "implementation" ]
b784cebc7e50cc831fde480171b9eb84
The first line of the input contains a single integer n (2 ≤ n ≤ 100 000) — the number of data points. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 100 000).
1,400
Print a single number — the maximum length of an almost constant range of the given sequence.
standard output
PASSED
a06d95e2a1b63dc8ad6f884336e876c9
train_003.jsonl
1448382900
When Xellos was doing a practice course in university, he once had to measure the intensity of an effect that slowly approached equilibrium. A good way to determine the equilibrium intensity would be choosing a sufficiently large number of consecutive data points that seems as constant as possible and taking their aver...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Ideone { public static void main (String[] args) throws java.lang.Exception { // your code goes here Scanner in=new Scanner(System.in); int n=in.nextInt(); int a[]=new ...
Java
["5\n1 2 3 3 2", "11\n5 4 5 5 6 7 8 8 8 7 6"]
2 seconds
["4", "5"]
NoteIn the first sample, the longest almost constant range is [2, 5]; its length (the number of data points in it) is 4.In the second sample, there are three almost constant ranges of length 4: [1, 4], [6, 9] and [7, 10]; the only almost constant range of the maximum length 5 is [6, 10].
Java 11
standard input
[ "dp", "two pointers", "implementation" ]
b784cebc7e50cc831fde480171b9eb84
The first line of the input contains a single integer n (2 ≤ n ≤ 100 000) — the number of data points. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 100 000).
1,400
Print a single number — the maximum length of an almost constant range of the given sequence.
standard output
PASSED
9f6994850a658dfba099a9a65ba503b2
train_003.jsonl
1533737100
After the war, the supersonic rocket became the most common public transportation.Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has $$$n$$$ power sources, and the second one has $$$m$$$ power sources. A power source can be described as a point $$$(x_i, y_i)$...
256 megabytes
import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Collections; public class E { static int A,B; static ArrayList<Vector> hull1; static ArrayList<Vector> hull2; static long dist1[]; static lon...
Java
["3 4\n0 0\n0 2\n2 0\n0 2\n2 2\n2 0\n1 1", "3 4\n0 0\n0 2\n2 0\n0 2\n2 2\n2 0\n0 0"]
1 second
["YES", "NO"]
NoteThe first sample: Those near pairs of blue and orange points actually coincide. First, manipulate the first engine: use the second operation with $$$\theta = \pi$$$ (to rotate all power sources $$$180$$$ degrees).The power sources in the first engine become $$$(0, 0)$$$, $$$(0, -2)$$$, and $$$(-2, 0)$$$. Second...
Java 8
standard input
[ "hashing", "geometry", "strings" ]
aeda11f32911d256fb6263635b738e99
The first line contains two integers $$$n$$$, $$$m$$$ ($$$3 \le n, m \le 10^5$$$) — the number of power sources in each engine. Each of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$0\leq x_i, y_i\leq 10^8$$$) — the coordinates of the $$$i$$$-th power source in the first engine. Each of the n...
2,400
Print "YES" if the supersonic rocket is safe, otherwise "NO". You can print each letter in an arbitrary case (upper or lower).
standard output
PASSED
4b0b1f0d608d43163e756c7ba77aa5fc
train_003.jsonl
1533737100
After the war, the supersonic rocket became the most common public transportation.Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has $$$n$$$ power sources, and the second one has $$$m$$$ power sources. A power source can be described as a point $$$(x_i, y_i)$...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class CF1017_E { public static void main(String[] args)throws Throwable { MyScanner sc=new MyScanner(); PrintWriter pw=new PrintWriter(System.out); int n=sc.nextInt(); int m=sc.nextInt(); Point [] a=ne...
Java
["3 4\n0 0\n0 2\n2 0\n0 2\n2 2\n2 0\n1 1", "3 4\n0 0\n0 2\n2 0\n0 2\n2 2\n2 0\n0 0"]
1 second
["YES", "NO"]
NoteThe first sample: Those near pairs of blue and orange points actually coincide. First, manipulate the first engine: use the second operation with $$$\theta = \pi$$$ (to rotate all power sources $$$180$$$ degrees).The power sources in the first engine become $$$(0, 0)$$$, $$$(0, -2)$$$, and $$$(-2, 0)$$$. Second...
Java 8
standard input
[ "hashing", "geometry", "strings" ]
aeda11f32911d256fb6263635b738e99
The first line contains two integers $$$n$$$, $$$m$$$ ($$$3 \le n, m \le 10^5$$$) — the number of power sources in each engine. Each of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$0\leq x_i, y_i\leq 10^8$$$) — the coordinates of the $$$i$$$-th power source in the first engine. Each of the n...
2,400
Print "YES" if the supersonic rocket is safe, otherwise "NO". You can print each letter in an arbitrary case (upper or lower).
standard output
PASSED
9287670a674423ba485e33aa342ad6f0
train_003.jsonl
1533737100
After the war, the supersonic rocket became the most common public transportation.Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has $$$n$$$ power sources, and the second one has $$$m$$$ power sources. A power source can be described as a point $$$(x_i, y_i)$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; public class Main { public static boolean kmp(double[] s, double[] w){ ...
Java
["3 4\n0 0\n0 2\n2 0\n0 2\n2 2\n2 0\n1 1", "3 4\n0 0\n0 2\n2 0\n0 2\n2 2\n2 0\n0 0"]
1 second
["YES", "NO"]
NoteThe first sample: Those near pairs of blue and orange points actually coincide. First, manipulate the first engine: use the second operation with $$$\theta = \pi$$$ (to rotate all power sources $$$180$$$ degrees).The power sources in the first engine become $$$(0, 0)$$$, $$$(0, -2)$$$, and $$$(-2, 0)$$$. Second...
Java 8
standard input
[ "hashing", "geometry", "strings" ]
aeda11f32911d256fb6263635b738e99
The first line contains two integers $$$n$$$, $$$m$$$ ($$$3 \le n, m \le 10^5$$$) — the number of power sources in each engine. Each of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$0\leq x_i, y_i\leq 10^8$$$) — the coordinates of the $$$i$$$-th power source in the first engine. Each of the n...
2,400
Print "YES" if the supersonic rocket is safe, otherwise "NO". You can print each letter in an arbitrary case (upper or lower).
standard output
PASSED
21279c09efb9de077e5f0a55f3460381
train_003.jsonl
1533737100
After the war, the supersonic rocket became the most common public transportation.Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has $$$n$$$ power sources, and the second one has $$$m$$$ power sources. A power source can be described as a point $$$(x_i, y_i)$...
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.util.Comparator; import java.io.InputStreamReader; import java.io.InputStream...
Java
["3 4\n0 0\n0 2\n2 0\n0 2\n2 2\n2 0\n1 1", "3 4\n0 0\n0 2\n2 0\n0 2\n2 2\n2 0\n0 0"]
1 second
["YES", "NO"]
NoteThe first sample: Those near pairs of blue and orange points actually coincide. First, manipulate the first engine: use the second operation with $$$\theta = \pi$$$ (to rotate all power sources $$$180$$$ degrees).The power sources in the first engine become $$$(0, 0)$$$, $$$(0, -2)$$$, and $$$(-2, 0)$$$. Second...
Java 8
standard input
[ "hashing", "geometry", "strings" ]
aeda11f32911d256fb6263635b738e99
The first line contains two integers $$$n$$$, $$$m$$$ ($$$3 \le n, m \le 10^5$$$) — the number of power sources in each engine. Each of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$0\leq x_i, y_i\leq 10^8$$$) — the coordinates of the $$$i$$$-th power source in the first engine. Each of the n...
2,400
Print "YES" if the supersonic rocket is safe, otherwise "NO". You can print each letter in an arbitrary case (upper or lower).
standard output
PASSED
f11f81515f3e47d41ec23b6737dba2e5
train_003.jsonl
1533737100
After the war, the supersonic rocket became the most common public transportation.Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has $$$n$$$ power sources, and the second one has $$$m$$$ power sources. A power source can be described as a point $$$(x_i, y_i)$...
256 megabytes
import java.util.*; import java.io.*; public class A { final static boolean debug=false; public static void main(String[] args) { FastScanner fs=new FastScanner(); int n1=fs.nextInt(), n2=fs.nextInt(); Vec[] vecs1=new Vec[n1], vecs2=new Vec[n2]; for (int i=0; i<n1; i++) vecs1[i]=new Vec(fs.nextInt(), ...
Java
["3 4\n0 0\n0 2\n2 0\n0 2\n2 2\n2 0\n1 1", "3 4\n0 0\n0 2\n2 0\n0 2\n2 2\n2 0\n0 0"]
1 second
["YES", "NO"]
NoteThe first sample: Those near pairs of blue and orange points actually coincide. First, manipulate the first engine: use the second operation with $$$\theta = \pi$$$ (to rotate all power sources $$$180$$$ degrees).The power sources in the first engine become $$$(0, 0)$$$, $$$(0, -2)$$$, and $$$(-2, 0)$$$. Second...
Java 8
standard input
[ "hashing", "geometry", "strings" ]
aeda11f32911d256fb6263635b738e99
The first line contains two integers $$$n$$$, $$$m$$$ ($$$3 \le n, m \le 10^5$$$) — the number of power sources in each engine. Each of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$0\leq x_i, y_i\leq 10^8$$$) — the coordinates of the $$$i$$$-th power source in the first engine. Each of the n...
2,400
Print "YES" if the supersonic rocket is safe, otherwise "NO". You can print each letter in an arbitrary case (upper or lower).
standard output
PASSED
529b03cf5b5c87fd1785f5f6e09a1362
train_003.jsonl
1533737100
After the war, the supersonic rocket became the most common public transportation.Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has $$$n$$$ power sources, and the second one has $$$m$$$ power sources. A power source can be described as a point $$$(x_i, y_i)$...
256 megabytes
//package round502; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; import java.util.InputMismatchException; public class E { InputStream is; PrintWriter out; String INPUT = ""; void sol...
Java
["3 4\n0 0\n0 2\n2 0\n0 2\n2 2\n2 0\n1 1", "3 4\n0 0\n0 2\n2 0\n0 2\n2 2\n2 0\n0 0"]
1 second
["YES", "NO"]
NoteThe first sample: Those near pairs of blue and orange points actually coincide. First, manipulate the first engine: use the second operation with $$$\theta = \pi$$$ (to rotate all power sources $$$180$$$ degrees).The power sources in the first engine become $$$(0, 0)$$$, $$$(0, -2)$$$, and $$$(-2, 0)$$$. Second...
Java 8
standard input
[ "hashing", "geometry", "strings" ]
aeda11f32911d256fb6263635b738e99
The first line contains two integers $$$n$$$, $$$m$$$ ($$$3 \le n, m \le 10^5$$$) — the number of power sources in each engine. Each of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$0\leq x_i, y_i\leq 10^8$$$) — the coordinates of the $$$i$$$-th power source in the first engine. Each of the n...
2,400
Print "YES" if the supersonic rocket is safe, otherwise "NO". You can print each letter in an arbitrary case (upper or lower).
standard output
PASSED
afac6521b264cf702e86a153ff50699c
train_003.jsonl
1533737100
After the war, the supersonic rocket became the most common public transportation.Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has $$$n$$$ power sources, and the second one has $$$m$$$ power sources. A power source can be described as a point $$$(x_i, y_i)$...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class DivCmb_502E { public static void main(String[] args) throw...
Java
["3 4\n0 0\n0 2\n2 0\n0 2\n2 2\n2 0\n1 1", "3 4\n0 0\n0 2\n2 0\n0 2\n2 2\n2 0\n0 0"]
1 second
["YES", "NO"]
NoteThe first sample: Those near pairs of blue and orange points actually coincide. First, manipulate the first engine: use the second operation with $$$\theta = \pi$$$ (to rotate all power sources $$$180$$$ degrees).The power sources in the first engine become $$$(0, 0)$$$, $$$(0, -2)$$$, and $$$(-2, 0)$$$. Second...
Java 8
standard input
[ "hashing", "geometry", "strings" ]
aeda11f32911d256fb6263635b738e99
The first line contains two integers $$$n$$$, $$$m$$$ ($$$3 \le n, m \le 10^5$$$) — the number of power sources in each engine. Each of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$0\leq x_i, y_i\leq 10^8$$$) — the coordinates of the $$$i$$$-th power source in the first engine. Each of the n...
2,400
Print "YES" if the supersonic rocket is safe, otherwise "NO". You can print each letter in an arbitrary case (upper or lower).
standard output
PASSED
a47c4ce5ddb21dc093d92104e8b60fb3
train_003.jsonl
1533737100
After the war, the supersonic rocket became the most common public transportation.Each supersonic rocket consists of two "engines". Each engine is a set of "power sources". The first engine has $$$n$$$ power sources, and the second one has $$$m$$$ power sources. A power source can be described as a point $$$(x_i, y_i)$...
256 megabytes
import java.io.*; import java.util.*; public class E502 { public static void main(String[] args) { new E502(); } FS in = new FS(); PrintWriter out = new PrintWriter(System.out); int n, m; vec[] A, hullA, B, hullB; E502() { n = in.nextInt(); m = in.nextInt(); A = new vec[n]; for (int i = 0; i < n; i+...
Java
["3 4\n0 0\n0 2\n2 0\n0 2\n2 2\n2 0\n1 1", "3 4\n0 0\n0 2\n2 0\n0 2\n2 2\n2 0\n0 0"]
1 second
["YES", "NO"]
NoteThe first sample: Those near pairs of blue and orange points actually coincide. First, manipulate the first engine: use the second operation with $$$\theta = \pi$$$ (to rotate all power sources $$$180$$$ degrees).The power sources in the first engine become $$$(0, 0)$$$, $$$(0, -2)$$$, and $$$(-2, 0)$$$. Second...
Java 8
standard input
[ "hashing", "geometry", "strings" ]
aeda11f32911d256fb6263635b738e99
The first line contains two integers $$$n$$$, $$$m$$$ ($$$3 \le n, m \le 10^5$$$) — the number of power sources in each engine. Each of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$0\leq x_i, y_i\leq 10^8$$$) — the coordinates of the $$$i$$$-th power source in the first engine. Each of the n...
2,400
Print "YES" if the supersonic rocket is safe, otherwise "NO". You can print each letter in an arbitrary case (upper or lower).
standard output
PASSED
0d3d94bd9bfa2fd653c6297b6aa5bd23
train_003.jsonl
1314111600
The German University in Cairo (GUC) dorm houses are numbered from 1 to n. Underground water pipes connect these houses together. Each pipe has certain direction (water can flow only in this direction and not vice versa), and diameter (which characterizes the maximal amount of water it can handle).For each house, there...
256 megabytes
import static java.lang.Math.*; import static java.lang.System.currentTimeMillis; import static java.lang.System.exit; import static java.lang.System.arraycopy; import static java.util.Arrays.sort; import static java.util.Arrays.binarySearch; import static java.util.Arrays.fill; import java.util.*; import java.io.*; p...
Java
["3 2\n1 2 10\n2 3 20", "3 3\n1 2 20\n2 3 10\n3 1 5", "4 2\n1 2 60\n3 4 50"]
1 second
["1\n1 3 10", "0", "2\n1 2 60\n3 4 50"]
null
Java 6
standard input
[ "implementation", "dfs and similar", "graphs" ]
e83a8bfabd7ea096fae66dcc8c243be7
The first line contains two space-separated integers n and p (1 ≤ n ≤ 1000, 0 ≤ p ≤ n) — the number of houses and the number of pipes correspondingly. Then p lines follow — the description of p pipes. The i-th line contains three integers ai bi di, indicating a pipe of diameter di going from house ai to house bi (1 ≤ ...
1,400
Print integer t in the first line — the number of tank-tap pairs of houses. For the next t lines, print 3 integers per line, separated by spaces: tanki, tapi, and diameteri, where tanki ≠ tapi (1 ≤ i ≤ t). Here tanki and tapi are indexes of tank and tap houses respectively, and diameteri is the maximum amount of water ...
standard output
PASSED
86cc904cfb656c4a8604a5f6aaad2b25
train_003.jsonl
1314111600
The German University in Cairo (GUC) dorm houses are numbered from 1 to n. Underground water pipes connect these houses together. Each pipe has certain direction (water can flow only in this direction and not vice versa), and diameter (which characterizes the maximal amount of water it can handle).For each house, there...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String [] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); args = br.readLine().split(" "); int n = Integer.parseInt(args[0]), p = Integer.parseInt(args[1]); ...
Java
["3 2\n1 2 10\n2 3 20", "3 3\n1 2 20\n2 3 10\n3 1 5", "4 2\n1 2 60\n3 4 50"]
1 second
["1\n1 3 10", "0", "2\n1 2 60\n3 4 50"]
null
Java 6
standard input
[ "implementation", "dfs and similar", "graphs" ]
e83a8bfabd7ea096fae66dcc8c243be7
The first line contains two space-separated integers n and p (1 ≤ n ≤ 1000, 0 ≤ p ≤ n) — the number of houses and the number of pipes correspondingly. Then p lines follow — the description of p pipes. The i-th line contains three integers ai bi di, indicating a pipe of diameter di going from house ai to house bi (1 ≤ ...
1,400
Print integer t in the first line — the number of tank-tap pairs of houses. For the next t lines, print 3 integers per line, separated by spaces: tanki, tapi, and diameteri, where tanki ≠ tapi (1 ≤ i ≤ t). Here tanki and tapi are indexes of tank and tap houses respectively, and diameteri is the maximum amount of water ...
standard output
PASSED
9c48a6d4051e11d013cfd44a5a370a72
train_003.jsonl
1314111600
The German University in Cairo (GUC) dorm houses are numbered from 1 to n. Underground water pipes connect these houses together. Each pipe has certain direction (water can flow only in this direction and not vice versa), and diameter (which characterizes the maximal amount of water it can handle).For each house, there...
256 megabytes
import java.io.PrintWriter; import java.util.*; public class C { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), m = sc.nextInt(); int res=0; PrintWriter out=new PrintWriter(System.out); int[][] grid = new int[n][n]; ...
Java
["3 2\n1 2 10\n2 3 20", "3 3\n1 2 20\n2 3 10\n3 1 5", "4 2\n1 2 60\n3 4 50"]
1 second
["1\n1 3 10", "0", "2\n1 2 60\n3 4 50"]
null
Java 6
standard input
[ "implementation", "dfs and similar", "graphs" ]
e83a8bfabd7ea096fae66dcc8c243be7
The first line contains two space-separated integers n and p (1 ≤ n ≤ 1000, 0 ≤ p ≤ n) — the number of houses and the number of pipes correspondingly. Then p lines follow — the description of p pipes. The i-th line contains three integers ai bi di, indicating a pipe of diameter di going from house ai to house bi (1 ≤ ...
1,400
Print integer t in the first line — the number of tank-tap pairs of houses. For the next t lines, print 3 integers per line, separated by spaces: tanki, tapi, and diameteri, where tanki ≠ tapi (1 ≤ i ≤ t). Here tanki and tapi are indexes of tank and tap houses respectively, and diameteri is the maximum amount of water ...
standard output
PASSED
beb3765891acb7376c2c5839602b6092
train_003.jsonl
1314111600
The German University in Cairo (GUC) dorm houses are numbered from 1 to n. Underground water pipes connect these houses together. Each pipe has certain direction (water can flow only in this direction and not vice versa), and diameter (which characterizes the maximal amount of water it can handle).For each house, there...
256 megabytes
import java.util.*; import java.io.*; public class C{ static int[][] a= new int[1001][1001]; static int[] d1 = new int[1001], d2 = new int[1001],xx = new int[1001],yy = new int[1001],zz = new int[1001]; static boolean[] use = new boolean[1001]; static int v, u, s,n,m,len=0; public static void solve(int i){ u=...
Java
["3 2\n1 2 10\n2 3 20", "3 3\n1 2 20\n2 3 10\n3 1 5", "4 2\n1 2 60\n3 4 50"]
1 second
["1\n1 3 10", "0", "2\n1 2 60\n3 4 50"]
null
Java 6
standard input
[ "implementation", "dfs and similar", "graphs" ]
e83a8bfabd7ea096fae66dcc8c243be7
The first line contains two space-separated integers n and p (1 ≤ n ≤ 1000, 0 ≤ p ≤ n) — the number of houses and the number of pipes correspondingly. Then p lines follow — the description of p pipes. The i-th line contains three integers ai bi di, indicating a pipe of diameter di going from house ai to house bi (1 ≤ ...
1,400
Print integer t in the first line — the number of tank-tap pairs of houses. For the next t lines, print 3 integers per line, separated by spaces: tanki, tapi, and diameteri, where tanki ≠ tapi (1 ≤ i ≤ t). Here tanki and tapi are indexes of tank and tap houses respectively, and diameteri is the maximum amount of water ...
standard output
PASSED
8d48451f5e9e0903f1a87bddba80d7b4
train_003.jsonl
1314111600
The German University in Cairo (GUC) dorm houses are numbered from 1 to n. Underground water pipes connect these houses together. Each pipe has certain direction (water can flow only in this direction and not vice versa), and diameter (which characterizes the maximal amount of water it can handle).For each house, there...
256 megabytes
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ import java.util.Scanner; /** * * @author JAVA */ public class c { static boolean t[]; static boolean a[][]; static int n; static int diam[][]; static int way[][]; static int count = 0; ...
Java
["3 2\n1 2 10\n2 3 20", "3 3\n1 2 20\n2 3 10\n3 1 5", "4 2\n1 2 60\n3 4 50"]
1 second
["1\n1 3 10", "0", "2\n1 2 60\n3 4 50"]
null
Java 6
standard input
[ "implementation", "dfs and similar", "graphs" ]
e83a8bfabd7ea096fae66dcc8c243be7
The first line contains two space-separated integers n and p (1 ≤ n ≤ 1000, 0 ≤ p ≤ n) — the number of houses and the number of pipes correspondingly. Then p lines follow — the description of p pipes. The i-th line contains three integers ai bi di, indicating a pipe of diameter di going from house ai to house bi (1 ≤ ...
1,400
Print integer t in the first line — the number of tank-tap pairs of houses. For the next t lines, print 3 integers per line, separated by spaces: tanki, tapi, and diameteri, where tanki ≠ tapi (1 ≤ i ≤ t). Here tanki and tapi are indexes of tank and tap houses respectively, and diameteri is the maximum amount of water ...
standard output
PASSED
9ee22b15080e6aa80df9b218c5479e15
train_003.jsonl
1314111600
The German University in Cairo (GUC) dorm houses are numbered from 1 to n. Underground water pipes connect these houses together. Each pipe has certain direction (water can flow only in this direction and not vice versa), and diameter (which characterizes the maximal amount of water it can handle).For each house, there...
256 megabytes
import java.io.BufferedReader; import java.io.FileInputStream; import java.io.InputStreamReader; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.LinkedList; import java.util.Queue; import javax.management.Query; public class C { s...
Java
["3 2\n1 2 10\n2 3 20", "3 3\n1 2 20\n2 3 10\n3 1 5", "4 2\n1 2 60\n3 4 50"]
1 second
["1\n1 3 10", "0", "2\n1 2 60\n3 4 50"]
null
Java 6
standard input
[ "implementation", "dfs and similar", "graphs" ]
e83a8bfabd7ea096fae66dcc8c243be7
The first line contains two space-separated integers n and p (1 ≤ n ≤ 1000, 0 ≤ p ≤ n) — the number of houses and the number of pipes correspondingly. Then p lines follow — the description of p pipes. The i-th line contains three integers ai bi di, indicating a pipe of diameter di going from house ai to house bi (1 ≤ ...
1,400
Print integer t in the first line — the number of tank-tap pairs of houses. For the next t lines, print 3 integers per line, separated by spaces: tanki, tapi, and diameteri, where tanki ≠ tapi (1 ≤ i ≤ t). Here tanki and tapi are indexes of tank and tap houses respectively, and diameteri is the maximum amount of water ...
standard output
PASSED
d9120ae3eb71ff4fb6457fd884951c07
train_003.jsonl
1314111600
The German University in Cairo (GUC) dorm houses are numbered from 1 to n. Underground water pipes connect these houses together. Each pipe has certain direction (water can flow only in this direction and not vice versa), and diameter (which characterizes the maximal amount of water it can handle).For each house, there...
256 megabytes
import java.io.*; import java.util.*; public class Main { static int[] d=new int[1001]; static int[] w=new int[1001]; static int n,p,k=0; static boolean[] bak=new boolean[1001]; static void dfs(int v,int u,int min) { if (d[u]>0) { if (w[u]<min) dfs(v,d[u],w[u]); else dfs(v,d[u...
Java
["3 2\n1 2 10\n2 3 20", "3 3\n1 2 20\n2 3 10\n3 1 5", "4 2\n1 2 60\n3 4 50"]
1 second
["1\n1 3 10", "0", "2\n1 2 60\n3 4 50"]
null
Java 6
standard input
[ "implementation", "dfs and similar", "graphs" ]
e83a8bfabd7ea096fae66dcc8c243be7
The first line contains two space-separated integers n and p (1 ≤ n ≤ 1000, 0 ≤ p ≤ n) — the number of houses and the number of pipes correspondingly. Then p lines follow — the description of p pipes. The i-th line contains three integers ai bi di, indicating a pipe of diameter di going from house ai to house bi (1 ≤ ...
1,400
Print integer t in the first line — the number of tank-tap pairs of houses. For the next t lines, print 3 integers per line, separated by spaces: tanki, tapi, and diameteri, where tanki ≠ tapi (1 ≤ i ≤ t). Here tanki and tapi are indexes of tank and tap houses respectively, and diameteri is the maximum amount of water ...
standard output
PASSED
d096f762ca8efa9ce058da208182e5b5
train_003.jsonl
1314111600
The German University in Cairo (GUC) dorm houses are numbered from 1 to n. Underground water pipes connect these houses together. Each pipe has certain direction (water can flow only in this direction and not vice versa), and diameter (which characterizes the maximal amount of water it can handle).For each house, there...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.List; public class ProblemC { static class Pipe { int to; int dia; ...
Java
["3 2\n1 2 10\n2 3 20", "3 3\n1 2 20\n2 3 10\n3 1 5", "4 2\n1 2 60\n3 4 50"]
1 second
["1\n1 3 10", "0", "2\n1 2 60\n3 4 50"]
null
Java 6
standard input
[ "implementation", "dfs and similar", "graphs" ]
e83a8bfabd7ea096fae66dcc8c243be7
The first line contains two space-separated integers n and p (1 ≤ n ≤ 1000, 0 ≤ p ≤ n) — the number of houses and the number of pipes correspondingly. Then p lines follow — the description of p pipes. The i-th line contains three integers ai bi di, indicating a pipe of diameter di going from house ai to house bi (1 ≤ ...
1,400
Print integer t in the first line — the number of tank-tap pairs of houses. For the next t lines, print 3 integers per line, separated by spaces: tanki, tapi, and diameteri, where tanki ≠ tapi (1 ≤ i ≤ t). Here tanki and tapi are indexes of tank and tap houses respectively, and diameteri is the maximum amount of water ...
standard output
PASSED
8a5ab014a2b902de8e75946c6c609254
train_003.jsonl
1314111600
The German University in Cairo (GUC) dorm houses are numbered from 1 to n. Underground water pipes connect these houses together. Each pipe has certain direction (water can flow only in this direction and not vice versa), and diameter (which characterizes the maximal amount of water it can handle).For each house, there...
256 megabytes
import java.awt.Point; import java.io.*; import java.math.BigInteger; import java.util.*; import static java.lang.Math.*; public class _C { final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE")!=null; BufferedReader in; PrintWriter out; StringTokenizer tok = new Stri...
Java
["3 2\n1 2 10\n2 3 20", "3 3\n1 2 20\n2 3 10\n3 1 5", "4 2\n1 2 60\n3 4 50"]
1 second
["1\n1 3 10", "0", "2\n1 2 60\n3 4 50"]
null
Java 6
standard input
[ "implementation", "dfs and similar", "graphs" ]
e83a8bfabd7ea096fae66dcc8c243be7
The first line contains two space-separated integers n and p (1 ≤ n ≤ 1000, 0 ≤ p ≤ n) — the number of houses and the number of pipes correspondingly. Then p lines follow — the description of p pipes. The i-th line contains three integers ai bi di, indicating a pipe of diameter di going from house ai to house bi (1 ≤ ...
1,400
Print integer t in the first line — the number of tank-tap pairs of houses. For the next t lines, print 3 integers per line, separated by spaces: tanki, tapi, and diameteri, where tanki ≠ tapi (1 ≤ i ≤ t). Here tanki and tapi are indexes of tank and tap houses respectively, and diameteri is the maximum amount of water ...
standard output
PASSED
f126428ecaf5f60da53d6e03fe215e50
train_003.jsonl
1314111600
The German University in Cairo (GUC) dorm houses are numbered from 1 to n. Underground water pipes connect these houses together. Each pipe has certain direction (water can flow only in this direction and not vice versa), and diameter (which characterizes the maximal amount of water it can handle).For each house, there...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; /** * Created by IntelliJ IDEA. * User: piyushd * Date: 3/26/11 * Time: 10:53 PM * To change this template use File | Settings | File Templates. */ public class TaskA { int[] par; int[] limit; ...
Java
["3 2\n1 2 10\n2 3 20", "3 3\n1 2 20\n2 3 10\n3 1 5", "4 2\n1 2 60\n3 4 50"]
1 second
["1\n1 3 10", "0", "2\n1 2 60\n3 4 50"]
null
Java 6
standard input
[ "implementation", "dfs and similar", "graphs" ]
e83a8bfabd7ea096fae66dcc8c243be7
The first line contains two space-separated integers n and p (1 ≤ n ≤ 1000, 0 ≤ p ≤ n) — the number of houses and the number of pipes correspondingly. Then p lines follow — the description of p pipes. The i-th line contains three integers ai bi di, indicating a pipe of diameter di going from house ai to house bi (1 ≤ ...
1,400
Print integer t in the first line — the number of tank-tap pairs of houses. For the next t lines, print 3 integers per line, separated by spaces: tanki, tapi, and diameteri, where tanki ≠ tapi (1 ≤ i ≤ t). Here tanki and tapi are indexes of tank and tap houses respectively, and diameteri is the maximum amount of water ...
standard output
PASSED
03769f667ff3de5f0814ea6a4f1d4e8e
train_003.jsonl
1314111600
The German University in Cairo (GUC) dorm houses are numbered from 1 to n. Underground water pipes connect these houses together. Each pipe has certain direction (water can flow only in this direction and not vice versa), and diameter (which characterizes the maximal amount of water it can handle).For each house, there...
256 megabytes
import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintStream; import java.util.ArrayList; import java.util....
Java
["3 2\n1 2 10\n2 3 20", "3 3\n1 2 20\n2 3 10\n3 1 5", "4 2\n1 2 60\n3 4 50"]
1 second
["1\n1 3 10", "0", "2\n1 2 60\n3 4 50"]
null
Java 6
standard input
[ "implementation", "dfs and similar", "graphs" ]
e83a8bfabd7ea096fae66dcc8c243be7
The first line contains two space-separated integers n and p (1 ≤ n ≤ 1000, 0 ≤ p ≤ n) — the number of houses and the number of pipes correspondingly. Then p lines follow — the description of p pipes. The i-th line contains three integers ai bi di, indicating a pipe of diameter di going from house ai to house bi (1 ≤ ...
1,400
Print integer t in the first line — the number of tank-tap pairs of houses. For the next t lines, print 3 integers per line, separated by spaces: tanki, tapi, and diameteri, where tanki ≠ tapi (1 ≤ i ≤ t). Here tanki and tapi are indexes of tank and tap houses respectively, and diameteri is the maximum amount of water ...
standard output
PASSED
5f660ef45e44422be7d60be5fb5a7c25
train_003.jsonl
1314111600
The German University in Cairo (GUC) dorm houses are numbered from 1 to n. Underground water pipes connect these houses together. Each pipe has certain direction (water can flow only in this direction and not vice versa), and diameter (which characterizes the maximal amount of water it can handle).For each house, there...
256 megabytes
import java.awt.Point; import java.io.*; import java.util.Arrays; //BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); public class p108c { public static void main(String[] args) throws Exception { p108cc in = new p108cc (System.in); int h = in.nextLong(); int p = in....
Java
["3 2\n1 2 10\n2 3 20", "3 3\n1 2 20\n2 3 10\n3 1 5", "4 2\n1 2 60\n3 4 50"]
1 second
["1\n1 3 10", "0", "2\n1 2 60\n3 4 50"]
null
Java 6
standard input
[ "implementation", "dfs and similar", "graphs" ]
e83a8bfabd7ea096fae66dcc8c243be7
The first line contains two space-separated integers n and p (1 ≤ n ≤ 1000, 0 ≤ p ≤ n) — the number of houses and the number of pipes correspondingly. Then p lines follow — the description of p pipes. The i-th line contains three integers ai bi di, indicating a pipe of diameter di going from house ai to house bi (1 ≤ ...
1,400
Print integer t in the first line — the number of tank-tap pairs of houses. For the next t lines, print 3 integers per line, separated by spaces: tanki, tapi, and diameteri, where tanki ≠ tapi (1 ≤ i ≤ t). Here tanki and tapi are indexes of tank and tap houses respectively, and diameteri is the maximum amount of water ...
standard output
PASSED
94b1af874e672dad81de7e64310515ab
train_003.jsonl
1314111600
The German University in Cairo (GUC) dorm houses are numbered from 1 to n. Underground water pipes connect these houses together. Each pipe has certain direction (water can flow only in this direction and not vice versa), and diameter (which characterizes the maximal amount of water it can handle).For each house, there...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; /** * Author - * User: kansal * Date: 8/23/11 * Time: 8:40 PM */ public class DormWaterSupply { public static void main(String[] args) { reader = new ...
Java
["3 2\n1 2 10\n2 3 20", "3 3\n1 2 20\n2 3 10\n3 1 5", "4 2\n1 2 60\n3 4 50"]
1 second
["1\n1 3 10", "0", "2\n1 2 60\n3 4 50"]
null
Java 6
standard input
[ "implementation", "dfs and similar", "graphs" ]
e83a8bfabd7ea096fae66dcc8c243be7
The first line contains two space-separated integers n and p (1 ≤ n ≤ 1000, 0 ≤ p ≤ n) — the number of houses and the number of pipes correspondingly. Then p lines follow — the description of p pipes. The i-th line contains three integers ai bi di, indicating a pipe of diameter di going from house ai to house bi (1 ≤ ...
1,400
Print integer t in the first line — the number of tank-tap pairs of houses. For the next t lines, print 3 integers per line, separated by spaces: tanki, tapi, and diameteri, where tanki ≠ tapi (1 ≤ i ≤ t). Here tanki and tapi are indexes of tank and tap houses respectively, and diameteri is the maximum amount of water ...
standard output
PASSED
105e3f1acfee6ee367170bc668dc9d97
train_003.jsonl
1314111600
The German University in Cairo (GUC) dorm houses are numbered from 1 to n. Underground water pipes connect these houses together. Each pipe has certain direction (water can flow only in this direction and not vice versa), and diameter (which characterizes the maximal amount of water it can handle).For each house, there...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.StreamTokenizer; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; public class C { private static StreamTokenizer in; private static PrintWriter out; private static B...
Java
["3 2\n1 2 10\n2 3 20", "3 3\n1 2 20\n2 3 10\n3 1 5", "4 2\n1 2 60\n3 4 50"]
1 second
["1\n1 3 10", "0", "2\n1 2 60\n3 4 50"]
null
Java 6
standard input
[ "implementation", "dfs and similar", "graphs" ]
e83a8bfabd7ea096fae66dcc8c243be7
The first line contains two space-separated integers n and p (1 ≤ n ≤ 1000, 0 ≤ p ≤ n) — the number of houses and the number of pipes correspondingly. Then p lines follow — the description of p pipes. The i-th line contains three integers ai bi di, indicating a pipe of diameter di going from house ai to house bi (1 ≤ ...
1,400
Print integer t in the first line — the number of tank-tap pairs of houses. For the next t lines, print 3 integers per line, separated by spaces: tanki, tapi, and diameteri, where tanki ≠ tapi (1 ≤ i ≤ t). Here tanki and tapi are indexes of tank and tap houses respectively, and diameteri is the maximum amount of water ...
standard output
PASSED
95fbedad276a27636fea33255692a8f1
train_003.jsonl
1314111600
The German University in Cairo (GUC) dorm houses are numbered from 1 to n. Underground water pipes connect these houses together. Each pipe has certain direction (water can flow only in this direction and not vice versa), and diameter (which characterizes the maximal amount of water it can handle).For each house, there...
256 megabytes
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ import java.util.Arrays; import java.util.Scanner; /** * * @author joshuahm */ public class CodeForce83C { public static void main(String[] args) { Scanner in=new Scanner(System.in); int n=in.nextI...
Java
["3 2\n1 2 10\n2 3 20", "3 3\n1 2 20\n2 3 10\n3 1 5", "4 2\n1 2 60\n3 4 50"]
1 second
["1\n1 3 10", "0", "2\n1 2 60\n3 4 50"]
null
Java 6
standard input
[ "implementation", "dfs and similar", "graphs" ]
e83a8bfabd7ea096fae66dcc8c243be7
The first line contains two space-separated integers n and p (1 ≤ n ≤ 1000, 0 ≤ p ≤ n) — the number of houses and the number of pipes correspondingly. Then p lines follow — the description of p pipes. The i-th line contains three integers ai bi di, indicating a pipe of diameter di going from house ai to house bi (1 ≤ ...
1,400
Print integer t in the first line — the number of tank-tap pairs of houses. For the next t lines, print 3 integers per line, separated by spaces: tanki, tapi, and diameteri, where tanki ≠ tapi (1 ≤ i ≤ t). Here tanki and tapi are indexes of tank and tap houses respectively, and diameteri is the maximum amount of water ...
standard output
PASSED
16557fbfa1d950f43ad894932d9f2536
train_003.jsonl
1314111600
The German University in Cairo (GUC) dorm houses are numbered from 1 to n. Underground water pipes connect these houses together. Each pipe has certain direction (water can flow only in this direction and not vice versa), and diameter (which characterizes the maximal amount of water it can handle).For each house, there...
256 megabytes
import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Locale; import java.util.Scanner; public class C { private void processInput() throws IOException { Scanner in = new Scanner(System.in); int n = in.nextInt(); ...
Java
["3 2\n1 2 10\n2 3 20", "3 3\n1 2 20\n2 3 10\n3 1 5", "4 2\n1 2 60\n3 4 50"]
1 second
["1\n1 3 10", "0", "2\n1 2 60\n3 4 50"]
null
Java 6
standard input
[ "implementation", "dfs and similar", "graphs" ]
e83a8bfabd7ea096fae66dcc8c243be7
The first line contains two space-separated integers n and p (1 ≤ n ≤ 1000, 0 ≤ p ≤ n) — the number of houses and the number of pipes correspondingly. Then p lines follow — the description of p pipes. The i-th line contains three integers ai bi di, indicating a pipe of diameter di going from house ai to house bi (1 ≤ ...
1,400
Print integer t in the first line — the number of tank-tap pairs of houses. For the next t lines, print 3 integers per line, separated by spaces: tanki, tapi, and diameteri, where tanki ≠ tapi (1 ≤ i ≤ t). Here tanki and tapi are indexes of tank and tap houses respectively, and diameteri is the maximum amount of water ...
standard output
PASSED
ea2ade101590100709f8470db79d9595
train_003.jsonl
1314111600
The German University in Cairo (GUC) dorm houses are numbered from 1 to n. Underground water pipes connect these houses together. Each pipe has certain direction (water can flow only in this direction and not vice versa), and diameter (which characterizes the maximal amount of water it can handle).For each house, there...
256 megabytes
import java.io.*; import java.util.Arrays; public class round83C { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = 0, p = 0; String[] use = br.readLine().split(" "); n = Integer.parseInt(use[0]); p = Integer.parse...
Java
["3 2\n1 2 10\n2 3 20", "3 3\n1 2 20\n2 3 10\n3 1 5", "4 2\n1 2 60\n3 4 50"]
1 second
["1\n1 3 10", "0", "2\n1 2 60\n3 4 50"]
null
Java 6
standard input
[ "implementation", "dfs and similar", "graphs" ]
e83a8bfabd7ea096fae66dcc8c243be7
The first line contains two space-separated integers n and p (1 ≤ n ≤ 1000, 0 ≤ p ≤ n) — the number of houses and the number of pipes correspondingly. Then p lines follow — the description of p pipes. The i-th line contains three integers ai bi di, indicating a pipe of diameter di going from house ai to house bi (1 ≤ ...
1,400
Print integer t in the first line — the number of tank-tap pairs of houses. For the next t lines, print 3 integers per line, separated by spaces: tanki, tapi, and diameteri, where tanki ≠ tapi (1 ≤ i ≤ t). Here tanki and tapi are indexes of tank and tap houses respectively, and diameteri is the maximum amount of water ...
standard output
PASSED
3e086a2e0f3c8033ffef765885d48958
train_003.jsonl
1598798100
Ziota found a video game called "Monster Invaders".Similar to every other shooting RPG game, "Monster Invaders" involves killing monsters and bosses with guns.For the sake of simplicity, we only consider two different types of monsters and three different types of guns.Namely, the two types of monsters are: a normal ...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Java
["4 1 3 4 3\n3 2 5 1", "4 2 4 4 1\n4 5 1 2"]
2 seconds
["34", "31"]
NoteIn the first test case, the optimal strategy is: Use the pistol to kill three normal monsters and AWP to kill the boss (Total time $$$1\cdot3+4=7$$$) Move to stage two (Total time $$$7+3=10$$$) Use the pistol twice and AWP to kill the boss (Total time $$$10+1\cdot2+4=16$$$) Move to stage three (Total time $$$16...
Java 11
standard input
[ "dp", "greedy" ]
b532deda90a4edc6e97b207cb05d3843
The first line of the input contains five integers separated by single spaces: $$$n$$$ $$$(2 \le n \le 10^6)$$$ — the number of stages, $$$r_1, r_2, r_3$$$ $$$(1 \le r_1 \le r_2 \le r_3 \le 10^9)$$$ — the reload time of the three guns respectively, $$$d$$$ $$$(1 \le d \le 10^9)$$$ — the time of moving between adjacent ...
2,300
Print one integer, the minimum time to finish the game.
standard output
PASSED
b811fc9f5eceb0bdcd57ea9b5865acef
train_003.jsonl
1402241400
Valera has got a rectangle table consisting of n rows and m columns. Valera numbered the table rows starting from one, from top to bottom and the columns – starting from one, from left to right. We will represent cell that is on the intersection of row x and column y by a pair of integers (x, y).Valera wants to place e...
256 megabytes
import java.util.Scanner; public class ValeraandTubes { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); int k = in.nextInt(); solve(n, m, k); } private static void solve(int n, int m, int k)...
Java
["3 3 3", "2 3 1"]
1 second
["3 1 1 1 2 1 3\n3 2 1 2 2 2 3\n3 3 1 3 2 3 3", "6 1 1 1 2 1 3 2 3 2 2 2 1"]
NotePicture for the first sample: Picture for the second sample:
Java 7
standard input
[ "constructive algorithms", "implementation", "dfs and similar" ]
779e73c2f5eba950a20e6af9b53a643a
The first line contains three space-separated integers n, m, k (2 ≤ n, m ≤ 300; 2 ≤ 2k ≤ n·m) — the number of rows, the number of columns and the number of tubes, correspondingly.
1,500
Print k lines. In the i-th line print the description of the i-th tube: first print integer ri (the number of tube cells), then print 2ri integers xi1, yi1, xi2, yi2, ..., xiri, yiri (the sequence of table cells). If there are multiple solutions, you can print any of them. It is guaranteed that at least one solution ex...
standard output
PASSED
7f158a5c1618792ceae79697721f2bdd
train_003.jsonl
1402241400
Valera has got a rectangle table consisting of n rows and m columns. Valera numbered the table rows starting from one, from top to bottom and the columns – starting from one, from left to right. We will represent cell that is on the intersection of row x and column y by a pair of integers (x, y).Valera wants to place e...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.*; public class C implements Runnable { private void solve() throws IOException { int n = nextInt(); int m = nextInt(); int...
Java
["3 3 3", "2 3 1"]
1 second
["3 1 1 1 2 1 3\n3 2 1 2 2 2 3\n3 3 1 3 2 3 3", "6 1 1 1 2 1 3 2 3 2 2 2 1"]
NotePicture for the first sample: Picture for the second sample:
Java 7
standard input
[ "constructive algorithms", "implementation", "dfs and similar" ]
779e73c2f5eba950a20e6af9b53a643a
The first line contains three space-separated integers n, m, k (2 ≤ n, m ≤ 300; 2 ≤ 2k ≤ n·m) — the number of rows, the number of columns and the number of tubes, correspondingly.
1,500
Print k lines. In the i-th line print the description of the i-th tube: first print integer ri (the number of tube cells), then print 2ri integers xi1, yi1, xi2, yi2, ..., xiri, yiri (the sequence of table cells). If there are multiple solutions, you can print any of them. It is guaranteed that at least one solution ex...
standard output
PASSED
faa197dc2a9eec7cd506513b8ccb3ef4
train_003.jsonl
1402241400
Valera has got a rectangle table consisting of n rows and m columns. Valera numbered the table rows starting from one, from top to bottom and the columns – starting from one, from left to right. We will represent cell that is on the intersection of row x and column y by a pair of integers (x, y).Valera wants to place e...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); Task solver = new Task(); solver.s...
Java
["3 3 3", "2 3 1"]
1 second
["3 1 1 1 2 1 3\n3 2 1 2 2 2 3\n3 3 1 3 2 3 3", "6 1 1 1 2 1 3 2 3 2 2 2 1"]
NotePicture for the first sample: Picture for the second sample:
Java 7
standard input
[ "constructive algorithms", "implementation", "dfs and similar" ]
779e73c2f5eba950a20e6af9b53a643a
The first line contains three space-separated integers n, m, k (2 ≤ n, m ≤ 300; 2 ≤ 2k ≤ n·m) — the number of rows, the number of columns and the number of tubes, correspondingly.
1,500
Print k lines. In the i-th line print the description of the i-th tube: first print integer ri (the number of tube cells), then print 2ri integers xi1, yi1, xi2, yi2, ..., xiri, yiri (the sequence of table cells). If there are multiple solutions, you can print any of them. It is guaranteed that at least one solution ex...
standard output
PASSED
959ff096d4bd6006482a09853a3ec95c
train_003.jsonl
1402241400
Valera has got a rectangle table consisting of n rows and m columns. Valera numbered the table rows starting from one, from top to bottom and the columns – starting from one, from left to right. We will represent cell that is on the intersection of row x and column y by a pair of integers (x, y).Valera wants to place e...
256 megabytes
import java.io.*; import java.util.*; public class Test { public static void main(String[] args) throws Exception{ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int k = sc.nextInt(); int curI = 1; int curJ = 1; int directio...
Java
["3 3 3", "2 3 1"]
1 second
["3 1 1 1 2 1 3\n3 2 1 2 2 2 3\n3 3 1 3 2 3 3", "6 1 1 1 2 1 3 2 3 2 2 2 1"]
NotePicture for the first sample: Picture for the second sample:
Java 7
standard input
[ "constructive algorithms", "implementation", "dfs and similar" ]
779e73c2f5eba950a20e6af9b53a643a
The first line contains three space-separated integers n, m, k (2 ≤ n, m ≤ 300; 2 ≤ 2k ≤ n·m) — the number of rows, the number of columns and the number of tubes, correspondingly.
1,500
Print k lines. In the i-th line print the description of the i-th tube: first print integer ri (the number of tube cells), then print 2ri integers xi1, yi1, xi2, yi2, ..., xiri, yiri (the sequence of table cells). If there are multiple solutions, you can print any of them. It is guaranteed that at least one solution ex...
standard output
PASSED
f491455dd36f1d64bc23ca3e7a77de42
train_003.jsonl
1402241400
Valera has got a rectangle table consisting of n rows and m columns. Valera numbered the table rows starting from one, from top to bottom and the columns – starting from one, from left to right. We will represent cell that is on the intersection of row x and column y by a pair of integers (x, y).Valera wants to place e...
256 megabytes
import java.util.*; public class Tubes { public static int nextX(int x, int y, int n, int m) { if (y == m && x % 2 == 1) { return x + 1; } else if (y == 1 && x % 2 == 0) { return x + 1; } return x; } public static int nextY(int x, int y, int n...
Java
["3 3 3", "2 3 1"]
1 second
["3 1 1 1 2 1 3\n3 2 1 2 2 2 3\n3 3 1 3 2 3 3", "6 1 1 1 2 1 3 2 3 2 2 2 1"]
NotePicture for the first sample: Picture for the second sample:
Java 7
standard input
[ "constructive algorithms", "implementation", "dfs and similar" ]
779e73c2f5eba950a20e6af9b53a643a
The first line contains three space-separated integers n, m, k (2 ≤ n, m ≤ 300; 2 ≤ 2k ≤ n·m) — the number of rows, the number of columns and the number of tubes, correspondingly.
1,500
Print k lines. In the i-th line print the description of the i-th tube: first print integer ri (the number of tube cells), then print 2ri integers xi1, yi1, xi2, yi2, ..., xiri, yiri (the sequence of table cells). If there are multiple solutions, you can print any of them. It is guaranteed that at least one solution ex...
standard output
PASSED
aa46d7615b653330621471cd72808855
train_003.jsonl
1402241400
Valera has got a rectangle table consisting of n rows and m columns. Valera numbered the table rows starting from one, from top to bottom and the columns – starting from one, from left to right. We will represent cell that is on the intersection of row x and column y by a pair of integers (x, y).Valera wants to place e...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Comparator; import java.util.LinkedList; import java.util.PriorityQueue; public class hals { public static void main(String[] args)throws Exception { BufferedReader br = new BufferedReader(new InputStreamR...
Java
["3 3 3", "2 3 1"]
1 second
["3 1 1 1 2 1 3\n3 2 1 2 2 2 3\n3 3 1 3 2 3 3", "6 1 1 1 2 1 3 2 3 2 2 2 1"]
NotePicture for the first sample: Picture for the second sample:
Java 7
standard input
[ "constructive algorithms", "implementation", "dfs and similar" ]
779e73c2f5eba950a20e6af9b53a643a
The first line contains three space-separated integers n, m, k (2 ≤ n, m ≤ 300; 2 ≤ 2k ≤ n·m) — the number of rows, the number of columns and the number of tubes, correspondingly.
1,500
Print k lines. In the i-th line print the description of the i-th tube: first print integer ri (the number of tube cells), then print 2ri integers xi1, yi1, xi2, yi2, ..., xiri, yiri (the sequence of table cells). If there are multiple solutions, you can print any of them. It is guaranteed that at least one solution ex...
standard output
PASSED
365aa08684837a2813d901c1afa888b4
train_003.jsonl
1402241400
Valera has got a rectangle table consisting of n rows and m columns. Valera numbered the table rows starting from one, from top to bottom and the columns – starting from one, from left to right. We will represent cell that is on the intersection of row x and column y by a pair of integers (x, y).Valera wants to place e...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; public class ValeraandTubes { public static void main(String[] args) throws IOException { ValeraandT...
Java
["3 3 3", "2 3 1"]
1 second
["3 1 1 1 2 1 3\n3 2 1 2 2 2 3\n3 3 1 3 2 3 3", "6 1 1 1 2 1 3 2 3 2 2 2 1"]
NotePicture for the first sample: Picture for the second sample:
Java 7
standard input
[ "constructive algorithms", "implementation", "dfs and similar" ]
779e73c2f5eba950a20e6af9b53a643a
The first line contains three space-separated integers n, m, k (2 ≤ n, m ≤ 300; 2 ≤ 2k ≤ n·m) — the number of rows, the number of columns and the number of tubes, correspondingly.
1,500
Print k lines. In the i-th line print the description of the i-th tube: first print integer ri (the number of tube cells), then print 2ri integers xi1, yi1, xi2, yi2, ..., xiri, yiri (the sequence of table cells). If there are multiple solutions, you can print any of them. It is guaranteed that at least one solution ex...
standard output