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
0b5a8180b32f392b2dfd96897e3d2c7f
train_000.jsonl
1497539100
You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ...
256 megabytes
import java.util.*; public class Main{ public static long getImbalanceArray(int[] nums) { int len = nums.length; long result = 0, minSum = 0, maxSum = 0; Stack<Integer> stack1 = new Stack<>(); Stack<Integer> stack2 = new Stack<>(); stack1.push(-1); stack2.push(-1); for (int i = 0; i < len; i++) { whil...
Java
["3\n1 4 1"]
2 seconds
["9"]
null
Java 8
standard input
[ "data structures", "dsu", "divide and conquer", "sortings" ]
38210a3dcb16ce2bbc81aa1d39d23112
The first line contains one integer n (1 ≀ n ≀ 106) β€” size of the array a. The second line contains n integers a1, a2... an (1 ≀ ai ≀ 106) β€” elements of the array.
1,900
Print one integer β€” the imbalance value of a.
standard output
PASSED
cdd42d2e67dad669d4b9acf43da9b41e
train_000.jsonl
1497539100
You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ...
256 megabytes
/** * DA-IICT * Author : Savaliya Sagar */ import java.io.*; import java.math.*; import java.util.*; public class D817 { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni(); int[] a = na(n); long max = 0; long min = 0; int smax[] = new int[n]; int pmax[] = new int[n]; ...
Java
["3\n1 4 1"]
2 seconds
["9"]
null
Java 8
standard input
[ "data structures", "dsu", "divide and conquer", "sortings" ]
38210a3dcb16ce2bbc81aa1d39d23112
The first line contains one integer n (1 ≀ n ≀ 106) β€” size of the array a. The second line contains n integers a1, a2... an (1 ≀ ai ≀ 106) β€” elements of the array.
1,900
Print one integer β€” the imbalance value of a.
standard output
PASSED
143e6e5e098b9391c8756fd54f6b29af
train_000.jsonl
1497539100
You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Codechef{ static PrintWriter out = new PrintWriter(System.out); public static void main (String[] args) throws java.lang.Exception { InputReader sc = new InputReader(System.in); int n = sc.nextInt(); int[] a = new int[n], mn...
Java
["3\n1 4 1"]
2 seconds
["9"]
null
Java 8
standard input
[ "data structures", "dsu", "divide and conquer", "sortings" ]
38210a3dcb16ce2bbc81aa1d39d23112
The first line contains one integer n (1 ≀ n ≀ 106) β€” size of the array a. The second line contains n integers a1, a2... an (1 ≀ ai ≀ 106) β€” elements of the array.
1,900
Print one integer β€” the imbalance value of a.
standard output
PASSED
5a836179fd543f3b8d88e4cb239cccd6
train_000.jsonl
1497539100
You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ...
256 megabytes
import java.io.DataInputStream; import java.io.IOException; public class Educational23PD { public static void main(String... args) throws IOException { Reader reader = new Reader(); int n = reader.nextInt(); int a[] = new int[n]; for (int i = 0; i < n; i++) { a[i] = rea...
Java
["3\n1 4 1"]
2 seconds
["9"]
null
Java 8
standard input
[ "data structures", "dsu", "divide and conquer", "sortings" ]
38210a3dcb16ce2bbc81aa1d39d23112
The first line contains one integer n (1 ≀ n ≀ 106) β€” size of the array a. The second line contains n integers a1, a2... an (1 ≀ ai ≀ 106) β€” elements of the array.
1,900
Print one integer β€” the imbalance value of a.
standard output
PASSED
9fbd70493ec065944423873f8252a37f
train_000.jsonl
1497539100
You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Stack; import java.util.StringTokenizer; public class CF817D { public static void main(String[] args) throws IOException { FastScanner sc = new FastScanner(); Pr...
Java
["3\n1 4 1"]
2 seconds
["9"]
null
Java 8
standard input
[ "data structures", "dsu", "divide and conquer", "sortings" ]
38210a3dcb16ce2bbc81aa1d39d23112
The first line contains one integer n (1 ≀ n ≀ 106) β€” size of the array a. The second line contains n integers a1, a2... an (1 ≀ ai ≀ 106) β€” elements of the array.
1,900
Print one integer β€” the imbalance value of a.
standard output
PASSED
8cddc40b4bf9f0c6ad5e2d4a45919de2
train_000.jsonl
1497539100
You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ...
256 megabytes
import java.io.*; import java.util.*; import java.util.stream.Collectors; public class TestClass { static int MAX = 1000006; static int arr[] = new int[MAX]; static int st[] = new int[MAX]; static long vs[] = new long[MAX]; static long maxV(int n) { long result = 0; long prevV = 0; int curr; int t...
Java
["3\n1 4 1"]
2 seconds
["9"]
null
Java 8
standard input
[ "data structures", "dsu", "divide and conquer", "sortings" ]
38210a3dcb16ce2bbc81aa1d39d23112
The first line contains one integer n (1 ≀ n ≀ 106) β€” size of the array a. The second line contains n integers a1, a2... an (1 ≀ ai ≀ 106) β€” elements of the array.
1,900
Print one integer β€” the imbalance value of a.
standard output
PASSED
6750529baca26baa696d34fd96f47d51
train_000.jsonl
1497539100
You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayDeque; import java.util.StringTokenizer; public class Edu_23D { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))...
Java
["3\n1 4 1"]
2 seconds
["9"]
null
Java 8
standard input
[ "data structures", "dsu", "divide and conquer", "sortings" ]
38210a3dcb16ce2bbc81aa1d39d23112
The first line contains one integer n (1 ≀ n ≀ 106) β€” size of the array a. The second line contains n integers a1, a2... an (1 ≀ ai ≀ 106) β€” elements of the array.
1,900
Print one integer β€” the imbalance value of a.
standard output
PASSED
b78316d4542c3cce55b7216fee994805
train_000.jsonl
1497539100
You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ...
256 megabytes
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; import java.io.*; import java.math.*; public class Main { InputStream is; PrintWriter out; String INPUT = ""; //class Declaration static class pair implement...
Java
["3\n1 4 1"]
2 seconds
["9"]
null
Java 8
standard input
[ "data structures", "dsu", "divide and conquer", "sortings" ]
38210a3dcb16ce2bbc81aa1d39d23112
The first line contains one integer n (1 ≀ n ≀ 106) β€” size of the array a. The second line contains n integers a1, a2... an (1 ≀ ai ≀ 106) β€” elements of the array.
1,900
Print one integer β€” the imbalance value of a.
standard output
PASSED
f97090860228fa4b3d5405aadc680877
train_000.jsonl
1497539100
You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String args[]) {new Main().run();} FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); void run(){ work(); out.flush(); } long mod=998244353; long gcd(long a,long b) { return b==0?a:gcd(b,a%b); ...
Java
["3\n1 4 1"]
2 seconds
["9"]
null
Java 8
standard input
[ "data structures", "dsu", "divide and conquer", "sortings" ]
38210a3dcb16ce2bbc81aa1d39d23112
The first line contains one integer n (1 ≀ n ≀ 106) β€” size of the array a. The second line contains n integers a1, a2... an (1 ≀ ai ≀ 106) β€” elements of the array.
1,900
Print one integer β€” the imbalance value of a.
standard output
PASSED
a724a57aeb3da1d6b1e78bf5b048ddb9
train_000.jsonl
1497539100
You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ...
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.Arrays; import java.util.Stack; import java.util.StringTokenizer; public class D { public static void main(String[] args) throws IOException { Scanne...
Java
["3\n1 4 1"]
2 seconds
["9"]
null
Java 8
standard input
[ "data structures", "dsu", "divide and conquer", "sortings" ]
38210a3dcb16ce2bbc81aa1d39d23112
The first line contains one integer n (1 ≀ n ≀ 106) β€” size of the array a. The second line contains n integers a1, a2... an (1 ≀ ai ≀ 106) β€” elements of the array.
1,900
Print one integer β€” the imbalance value of a.
standard output
PASSED
d499db0911fba46776b12ca139a14b6f
train_000.jsonl
1497539100
You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.util.InputMismatchException; import java.util.Stack; public class ques4 { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; ...
Java
["3\n1 4 1"]
2 seconds
["9"]
null
Java 8
standard input
[ "data structures", "dsu", "divide and conquer", "sortings" ]
38210a3dcb16ce2bbc81aa1d39d23112
The first line contains one integer n (1 ≀ n ≀ 106) β€” size of the array a. The second line contains n integers a1, a2... an (1 ≀ ai ≀ 106) β€” elements of the array.
1,900
Print one integer β€” the imbalance value of a.
standard output
PASSED
c18a69dfca0d3800c2999e4c9b4c67a9
train_000.jsonl
1497539100
You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.Arrays; import java.util.ArrayList; public class D{ public static void main(String[] args)throws IOException { Reader.init(System.in); int n=...
Java
["3\n1 4 1"]
2 seconds
["9"]
null
Java 8
standard input
[ "data structures", "dsu", "divide and conquer", "sortings" ]
38210a3dcb16ce2bbc81aa1d39d23112
The first line contains one integer n (1 ≀ n ≀ 106) β€” size of the array a. The second line contains n integers a1, a2... an (1 ≀ ai ≀ 106) β€” elements of the array.
1,900
Print one integer β€” the imbalance value of a.
standard output
PASSED
f1dc0f348e9095164d56ad9e3b2ac7fd
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
import java.util.*; import java.util.Arrays; import java.io.IOException; import java.lang.*; import java.math.BigDecimal; import java.util.Scanner; /* Name of the class has to be "Main" only if the class is public. */ public class Main { static Scanner input = new Scanner(System.in); public static void main(Strin...
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
a861e68f62856270f295ed4427b22d3d
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
import java.util.*; public class IncreasingSequence { public static void main(String [] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); int d = input.nextInt(); int [] arr = new int [n]; for(int i = 0; i < n; i++) arr [i] = input.nextInt...
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
1287c69e50864e427a7882875f9c1f91
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
import java.util.Scanner; public class Ishu { public static void main(String[] args) { Scanner scan=new Scanner(System.in); int n,d,i,sum=0,diff,r; int[] b=new int[2000]; n=scan.nextInt(); d=scan.nextInt(); for(i=0;i<n;++i) { b[i]=scan.nextInt(); if(i>0) { if(b[i]<=b[i-1]) { ...
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
0e48847f9b6971b5b0ed8568111cae53
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int d = in.nextInt(); int cur = in.nextInt(); int moves = 0; for(int i = 1; i < n; i++){ int next = in.nextI...
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
d345b1cc569052ab0ef8cdbb69e4c87f
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
import java.util.*; public class Slotuin { public static void main(String[] args) { Scanner x = new Scanner(System.in); int n = x.nextInt(); long d = x.nextLong(); long A0 = x.nextLong(); long A = 0; long c = 0; for(int i = 1;i < n;i++) { A = x.nextLong(); if(A0 >= A) { long z = (A0 - A)/...
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
146db6e48316b21fb6aed1902054a4c1
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
import java.util.Scanner; public class Test { public static void main(String args[]) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int d = in.nextInt(); int move = 0; int a[] = new int[n]; for(int i=0;i<n;i++){ a[i] = in.nextInt(); ...
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
e3ab345f84946854876775a9589b38fb
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.PrintStream; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top * * @author captainTurtle */ public class Main { public static void main(Stri...
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
4734bb14c219160fd6f87a9affdc9c90
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
import java.util.Scanner; public class Codeforces { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int a = in.nextInt(); int result = 0; int[] arr = new int[n]; for (int i = 0; i < n; i++) { int k = in....
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
ae9e89f3806a4116ce28d2f6f7ec85f6
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
import java.util.*; import java.math.*; public class Main{ public static void main(String [] args) { Scanner scan=new Scanner(System.in); int n=scan.nextInt(); int d=scan.nextInt(); int a[]=new int[n]; for(int i=0;i<n;i++) { a[i]=scan.nextInt(); ...
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
14c65fe0cc338edccc14c02b7b73c08a
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
import java.util.*; //10:39 public class IncreasingSequence { public static void main(String s[]) { int nn,d; Scanner inp = new Scanner(System.in); int count=0; nn= inp.nextInt(); d= inp.nextInt(); int arr[] = new int[nn]; for(i...
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
82bdda081963b2e145071de59e811a3e
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
//package main; import java.io.*; import java.util.*; public class Main{ public static void main(String[] args) throws IOException { Reader.init(System.in); //StringBuffer outBuffer = new StringBuffer(); int N = Reader.nextInt(); int D = Reader.nextInt(); int[] B =...
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
a996c586ee1fbd80d82668dea0dcddbe
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
import java.util.Scanner; public class A11 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int d=sc.nextInt(); int res=0; int prev=sc.nextInt(); for(int i=1; i < n; i++) { int next=sc.ne...
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
9409456c5a61a97b6d83d58884855d4f
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
//http://codeforces.com/problemset/problem/11/A import java.util.Scanner; public class GrowingSequence { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int n = sc.nextInt(), d = Integer.parseInt(sc.nextLine().trim()), counter = 0; int[] elements = new int[...
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
4340852fc1989f805b5c8bb7a0ec0ae8
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
import java.io.*; public class CF11A { static int n, d, count = 0; static String[] in; static int[] b = new int[2001]; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWr...
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
80eb2fb2d7fe07d140deb828b30fd1df
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
//package kitsune; import java.util.*; public class increasingseq { public static void main(String[] args) { // TODO Auto-generated method stub Scanner s = new Scanner(System.in); int n = s.nextInt(); int d = s.nextInt(); int[] num = new int[n]; for(int i =0; i<n; i++){ num[i] = s.nextInt(); } int ...
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
6cc3ba37d6e66bb6bc40cb4589a2c2a0
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
import java.io.*; /** * Created by James on 1/29/2015. */ public class Driver { public static void main(String [] args) throws IOException { BufferedReader scanner = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); String [] pieces = s...
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
86958eb3f3e154cc36ec56b8dea27733
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
import java.awt.geom.AffineTransform; import java.io.*; import java.util.*; public class A1008 { public static void main(String [] args) /*throws Exception*/ { InputStream inputReader = System.in; OutputStream outputReader = System.out; InputReader in = new InputReader(inputReader);//new In...
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
4dadf88f97d06bda9b252800e5d9b74d
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
import java.util.ArrayList; import java.util.InputMismatchException; import java.util.Locale; import java.util.Scanner; import java.util.regex.Pattern; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; public class Main { public static void main(String[] args...
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
1cb56a4ef3d1037a18b10a82424f5128
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
import java.util.Scanner; public class Task11A { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int n = scn.nextInt(); int d = scn.nextInt(); int[] b = new int[n]; for (int i = 0; i < n; i++) { b[i] = scn.nextInt(); } ...
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
eb4cbba3283cb896359ee219f2279007
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
import java.util.Scanner; public class Increasing { static Scanner sr = new Scanner(System.in); public static void main(String args[]){ int n = sr.nextInt(); int d = sr.nextInt(); int a[] = new int[n]; for (int i = 0; i < n; i++){ a[i] = sr.nextInt(); } ...
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
9fdcf66ab736504a05ceb0a7c577d057
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { Reader sc = new Reader(); in...
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
ebfe32d835abdb1a37f3b6586b643b92
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
import java.util.Scanner; public class IncreasingSequence { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n=scan.nextInt(); int d=scan.nextInt(); int b0=0,c=0;; while(n-->0) { int b=scan.nextInt(); if(b<=b0) { int x=(b0-b)/d+1; c+=x; b0=b+x*d; ...
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
4365ab0b56916fb8644b8310d168d268
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = Integer.parseInt(scan.next()); int d = Integer.parseInt(scan.next()); int[] b = new int[n]; for(int i=0; i<n; i++) b[i] = Integer.parseInt(scan.next()); int moves = 0; ...
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
4607d7aebe4e455e1b37ce8806f2e6aa
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
public class IncreasingSequence { public static void main(String[] args) { try (java.util.Scanner sc = new java.util.Scanner(System.in)) { int n = sc.nextInt(); int d = sc.nextInt(); int s = 0; int bin = Integer.MIN_VALUE; for (int i = 0; i < n; i++) { int b = sc.nextInt(); if (b <= bin) {...
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
817f336fe275d5d304e947f16f78e7a9
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
import java.util.ArrayList; import java.util.Scanner; import java.util.stream.*; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub int n=0, d=0; ArrayList<Integer> container=new ArrayList<Integer>(); Scanner scn=new Scanner(System.in); n=scn.nextInt(); d=s...
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
6db7db20517dcb953566a196902a473d
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
import java.util.*; import java.io.*; public class P11A { private static void solve() { int n = nextInt(); int d = nextInt(); int last = nextInt(); long ans = 0; for (int i = 1; i < n; i++) { int cur = nextInt(); if (cur < last) { int diff = last - cur; int count = ...
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
68199e1c6f6eec86a09aeca0332924eb
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
import java.util.Scanner; public class IncreasingSequence { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(), d = in.nextInt(); int[] nums = new int[n]; int move = 0; for (int i = 0; i < n; i++) { nums[i] = in.ne...
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
ecd2b16006bdad221753325804272982
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { InputStream inputStream = System.in; // InputStream inputStream = new FileInputStream("sum.in"); OutputStream outputStream = System.out; // OutputStream outputStream =...
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
00dda7aa9d289528bbce05e9dea47814
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { FastScanner input = new FastScanner(); int N = input.nextI...
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
a3954c55fc7d0308d744d68688db4669
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
import java.util.Scanner; public class A11 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int i; int k=0,k1=0; int n=scan.nextInt(); int d=scan.nextInt(); scan.nextLine(); int []a=new int[n]; for(i=0;i<n;i++) a[i]=scan.nextInt(); for(i=1;i<n;i++) { if (a[i...
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
e539e277a8366efdb17cd458f37a0072
train_000.jsonl
1272294000
A sequence a0, a1, ..., at - 1 is called increasing if ai - 1 &lt; ai for each i: 0 &lt; i &lt; t.You are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequence and add d to it. What is the least number of moves required to make the given sequence in...
64 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; /** * * @author Haya */ public class JavaApplication141 { public static void main(String[] args) { FastReader in = new FastReader(); int n = in.next...
Java
["4 2\n1 3 3 2"]
1 second
["3"]
null
Java 8
standard input
[ "constructive algorithms", "implementation", "math" ]
0c5ae761b046c021a25b706644f0d3cd
The first line of the input contains two integer numbers n and d (2 ≀ n ≀ 2000, 1 ≀ d ≀ 106). The second line contains space separated sequence b0, b1, ..., bn - 1 (1 ≀ bi ≀ 106).
900
Output the minimal number of moves needed to make the sequence increasing.
standard output
PASSED
ea73b196c13c97910bc2efa58478f63b
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.util.Scanner; public class newyear { public static void main(String[] args) { Scanner s=new Scanner(System.in); int nq=s.nextInt(); while(nq-->0) { System.out.println((60*(23-s.nextInt()))+60-s.nextInt()); } } }
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
68d999b3b31fd9804b6854aea8146c66
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.io.*; import java.util.*; public class MinutesBeforetheNewYear { public static void main(String [] args) { Scanner sc=new Scanner(System.in); int n =sc.nextInt(); int i=0; for(i=0;i<n;i++) { int a=sc.nextInt(); int b=sc.nextInt(); ...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
3b2b8117108ded2a8b047ef5bdcf7d9c
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class stack { public static void main(String args[]) { Scanner s=new Scanner(System.in); int htm=0; int min=0; int n=s.nextInt(); for(int i=0;i<n;i++) { int h=s.nextInt(); int m=s.nextInt(); htm=((24-h)*60); min=htm-m; System.out....
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
063d0f194198d2f9e1d6217afc3aa291
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
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 { Scanner sc = new Scanner(System.in); int t =sc.nextInt(); while(t-- > 0){ int h = sc.n...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
cdaf2f0b1e43c2d4c0c6862b8d076f91
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.util.*; public class Solution{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0){ int h = sc.nextInt(); int m = sc.nextInt(); h *=60; System.out.println(1440-h-m); ...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
45fd1eb980c28bc53658372973372d9f
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.util.*; public class MyClass { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { int h=sc.nextInt(); int m=sc.nextInt(); int k=23-h; int p=60-m; System.out.println(k*60+p); } ...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
749a4b65b7478312d337131d8ca28ad6
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.util.*; public class file{ public static void main(String[] args){ Scanner s=new Scanner(System.in); int test =s.nextInt(); for(int i=0 ;i<test ;i++){ int h =s.nextInt(); int m =s.nextInt(); System.out.println(1440 - ( (h * 60)+m)); } } }
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
9999fb1e3372bfa50f273f04652af9e1
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.util.*; public class MinutesBeforeNewYear { static Scanner s1=new Scanner(System.in); public static void main(String[] args) { int x=s1.nextInt(); int[] y=new int[2]; for(int i=0;i<x;i++) { for(int a=0;a<2;a++) { y[a]=s1....
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
6929667f4caaf1287a8bab0521c142c5
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int testCases = sc.nextInt(),x,y,z; for (int i = 0; i < testCases; i++) { ...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
7a78d6671b4ce50eebdb342f641cc288
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class Main implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numCh...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
4facc8ff618ec981862a84737d9d354a
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
/****************************************************************************** Online Java Compiler. Code, Compile, Run and Debug java program online. Write your code in this editor and press "Run" button to execute it. *****************************************************...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
db1a031ae71b1d2b160151ffba0a8f4f
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.util.Scanner; public class Minute { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); for (; n >0; n--) { int hour = in.nextInt(); int minut = in.nextInt(); int total = 60 * (23 - hour) + (60 -...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
8b54f779f0881bb1cc0bf405712d72a5
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.util.Scanner; /** * * @author SAKIB UDDIN */ public class C19 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int p = 0; int n = in.nextInt(); for (int i = 0; i < n; i++) { int x = in.nextInt(); int y = in.ne...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
c6c59ed142d26eb39a5468d1647198b2
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; public class mins { public static void main(String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n=Integer.parseInt(br.readLine()); while(n-->0) { Stri...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
f130e08f42e91a7616d4683dbf262aa3
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.util.Scanner; public class mins { public static void main(String args[]) { Scanner scan=new Scanner(System.in); int n=scan.nextInt(); while(n-->0) { int h=scan.nextInt(); int min=scan.nextInt(); int l=(24-h)*60-min; System.out.println(l); } } }
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
16c9c2f821623b12612fd40fb8ffa952
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.util.*; public class newyear { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); int h,m; while(t>0) { --t; h=sc.nextInt(); m=sc.nextInt(); System.out.println((23-h)*...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
ba6f9e6a9ade8dfaa457f07550340fb0
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t>0){ int h=sc.nextInt(); int m=sc.nextInt(); int min=0; min=1440-((h*60)+m); System.out.println(min); t--; } } }
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
be8032bf26c5519472d476e5f7ef5b2e
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class newyear { public static void main(String[] args) { Scanner s=new Scanner(System.in); int t=s.nextInt(); int a=23; int b=60; int e=0; while (t!=0) { int c=s.nextInt(); int d=s.nextInt(); if(a-c>=0) { e=(a-c)*60...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
f41601d8b3101b0ee74a41e098b0ebe1
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top * * @author ch */ public class Main { public static void main(String[] args) { InputS...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
2e9aef2b938d5745b0dce13cdb37fd10
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.util.Scanner; public class NewYear { public static void main(String[] args) { NewYear newYear = new NewYear(); Scanner scanner = new Scanner(System.in); int T = scanner.nextInt(); for (int i = 0 ; i < T ; i++) { int h = scanner.nextInt(); int ...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
bcffdbfd055405279958b25b79e5d780
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int o =sc.nextInt(); while(o-->0) { int sum=24*60; int a=sc.nextInt()*60; int b=sc.nextInt(); System.out.println(sum-a-b); } } }
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
b1dbf611aa9f1e886fc41c03a1e4adce
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
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) { FastIO fastIO = new FastIO(); StringBuilder output = new StringBuilder(); int t,h,m; t=fastIO....
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
8f00e5520a13d9690baf9d2b13f344e3
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.util.Scanner; public class A { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); for (int i = 0 ; i < t ; i++) { int h = scan.nextInt(); int m = scan.nextInt(); System.out.println(((23 - h) * 60) + (60 - m)); } } }
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
df5d594e5144da8e2425320b4382ca43
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.util.*; public class A{ public static void main(String args[]){ Scanner s=new Scanner(System.in); int T=s.nextInt(); for(int y=0;y<T;y++){ int hr=s.nextInt(); int min=s.nextInt(); int ans=0; while(hr!=0||min!=0){ ...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
8ab925dbc1c67d59f2e8bb4b75dac4e2
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
/* If you want to aim high, aim high Don't let that studying and grades consume you Just live life young ****************************** If I'm the sun, you're the moon Because when I go up, you go down ******************************* I'm working for the day I will surpass you **************************************** *...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
79e9573cdd22826e5365ecebe452aa0b
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
public class Solution { public static void main(String[] args) { java.util.Scanner scanner = new java.util.Scanner(System.in); java.time.LocalTime ny = java.time.LocalTime.of(23, 59); int n = scanner.nextInt(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < n; i...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
7ab14c71984c3409ff7ea1975e9e227c
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
/* @nikhil_supertramp */ import java.awt.*; import java.io.*; import java.math.*; import java.util.*; public class MinutesBeforeTheNewYear { public static void main(String[] args)throws Exception { new Solver().solve(); } } class Solver { final Helper hp; final int MAXN = 1000_006; fi...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
fe29424eb1d2555f7c2374cd311fd929
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int T = scanner.nextInt(); while (T > 0) { T--; int answer = 0; int N = scanner.nextInt(); int K = scanner.ne...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
e365adb263dae88c86f2cb9b190e37c0
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.util.*; public class time { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n; n = sc.nextInt(); int hr[] = new int[n]; int min[] = new int[n]; int ans[] = new int[n]; for(int i=0;i<n;i++) { hr[i] = sc.nextInt(); min[i] = sc.nextInt(); ans[i] = ...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
121a2e9de483f23bfd91b0982a7e0309
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
//author @markysans import java.util.*; import java.io.*; public class a{ static Scanner sc=new Scanner(System.in); static int cnt; public static void main(String args[]){ int k=1; k=sc.nextInt(); while(k--!=0){ solve(); } } static void solve(){ int h=sc.nextInt(); int m=sc.nex...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
af2e0d8bb7b21a99a7fec5cb02a35dbb
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.lang.*; import java.io.*; import java.util.*; public class NewYear { public static void main(String args[]){ int n, hour, min, res; String inpTime=""; String[] timeParts; Scanner sc= new Scanner(System.in); if(sc.hasNextLine()) { n= Integer.parseInt(sc.nextLine()); while(n-->0 && sc.hasNex...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
9ccbddd2b5d7bbb2b90094d77c25923a
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.util.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class a{ static int[] count; // static int[] count1; static int[] arr; static char[] c,c1; static long[] darr; static long x; stat...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
f795f1b32a74cd48a4165272b931197b
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.io.*; import java.util.*; public class Solution{ public static void main(String args[]){ int t; Scanner sc=new Scanner(System.in); t=sc.nextInt(); sc.nextLine(); while(t!=0) { t--; int h,m; h=sc.nextInt(); ...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
10c64ebfb0b88b7973b6fe97b973a4ee
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.util.*; public class Solution { public static void main(String[] args) { Scanner x = new Scanner(System.in); int th=23, tm=60, th2, tm2; int t = x.nextInt(); for (int i = 0; i < t; i++) { th2=x.nextInt(); tm2=x.nextInt(); in...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
e3f8f3c42dccaab9aa0f86e816b1f746
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.stream.Collectors; public class p001283A { static public void main(String[] args) throw...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
3cec78071dba363c49ef98db833800a3
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintWriter; import java.util.Arrays; import java.util.List; import java.util.Scanner; import java.util.stream.Collectors; public class _p001283A { static public void main(final String[] args) throws jav...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
b25675979b8a2a6cb959e3b51664e8ad
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; public class Main { public static void main(String args[]){ Scanner obj=new Scanner(System.in); int t=0; t = obj.nextInt(); int i,h,m,c=1440; int f[] = new int[t]; for(i=0;i<t;i++) { h = obj.nextInt(); m = obj.nextInt(); f[i] = c-(h*60)-m...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
1ee3ab5acf8c805902c9da62b10513ea
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
/* ID: srihank1 LANG: JAVA PROG: template */ import java.util.*; import java.io.*; public class MinutesBeforeTheNewYear { public static class FastReader { // Fast class in order to quickly read inputs BufferedReader br; StringTokenizer st; public FastReader(String str) throws IOExceptio...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
69ba7870b95c965d9ab9015f3077e455
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
/* ID: srihank1 LANG: JAVA PROG: template */ import java.util.*; import java.io.*; public class MinutesBeforeTheNewYear { public static class FastReader { // Fast class in order to quickly read inputs BufferedReader br; StringTokenizer st; public FastReader(String str) throws IOExceptio...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
fe7d347e689fdbce28e0f5a746756a00
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.io.*; public class Solution{ public static void main(String args[]) throws IOException{ BufferedReader b=new BufferedReader(new InputStreamReader(System.in)); int t=Integer.parseInt(b.readLine()); while(t--!=0){ String s[]=b.readLine().split(" "); int a=In...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
78ecd0d7a94fd0f9d171fb1710c846fe
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.util.*; public class Main{ public static void main(String[] args) { // Use the Scanner class Scanner sc = new Scanner(System.in); /* int n = sc.nextInt(); // read input as integer long k = sc.nextLong(); // read input as long doubl...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
a176a2eccaa45fefa6fc20d65c1adc8e
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int numOfCases = s.nextInt(); for (int i = 0; i < numOfCases; i++) { int hour = s.nextInt(); int minute = s.nextInt(); System.out....
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
ecfc74f288642535444b75cef3df6540
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.util.*; public class test { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t =sc.nextInt(); while(t!=0) { int h=sc.nextInt(); int m=sc.nextInt(); int x = 23-h; int y = 60-m; ...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
da64cfaf1eb4af7b62b8d2daba09ba67
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.util.*; public class MinutesBeforeNewYear { public static Scanner scn = new Scanner(System.in); public static void main(String[] args) { int t = scn.nextInt(); while(t-->0) { int h = scn.nextInt(); int m = scn.nextInt(); int ans = ((23-h)*60)+(60-m) ; System.out.println(ans); } } }
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
7a01904125b315022c9f1a76f3ba524e
train_000.jsonl
1577552700
New Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $$$h$$$ hours and $$$m$$$ minutes, where $$$0 \le hh &lt; 24$$$ and $$$0 \le mm &lt; 60$$$. We use 24-hour time format!Your task is to find the number of minutes before the New Year. You k...
256 megabytes
import java.util.Scanner; public class problemSet1283A { public static void main(String[] args) { Scanner myInput = new Scanner(System.in); int trial = myInput.nextInt(); if(trial>0 && trial<1440){ for(int i=0;i<trial;i++){ int hour= myInput.nextInt()...
Java
["5\n23 55\n23 0\n0 1\n4 20\n23 59"]
1 second
["5\n60\n1439\n1180\n1"]
null
Java 8
standard input
[ "math" ]
f4982de28aca7080342eb1d0ff87734c
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1439$$$) β€” the number of test cases. The following $$$t$$$ lines describe test cases. The $$$i$$$-th line contains the time as two integers $$$h$$$ and $$$m$$$ ($$$0 \le h &lt; 24$$$, $$$0 \le m &lt; 60$$$). It is guaranteed that this time is not ...
800
For each test case, print the answer on it β€” the number of minutes before the New Year.
standard output
PASSED
89b9b8d7b6c6d19e98f273201990e3ec
train_000.jsonl
1286463600
In one little known, but very beautiful country called Waterland, lives a lovely shark Valerie. Like all the sharks, she has several rows of teeth, and feeds on crucians. One of Valerie's distinguishing features is that while eating one crucian she uses only one row of her teeth, the rest of the teeth are "relaxing".Fo...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; import java.util.*; public class whatIsForDinner { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new Buffered...
Java
["4 3 18\n2 3\n1 2\n3 6\n2 3", "2 2 13\n1 13\n2 12"]
2 seconds
["11", "13"]
null
Java 11
standard input
[ "implementation", "greedy" ]
65eb0f3ab35c4d95c1cbd39fc7a4227b
The first line contains three integers n, m, k (1 ≀ m ≀ n ≀ 1000, 0 ≀ k ≀ 106) β€” total amount of Valerie's teeth, amount of tooth rows and amount of crucians in Valerie's portion for dinner. Then follow n lines, each containing two integers: r (1 ≀ r ≀ m) β€” index of the row, where belongs the corresponding tooth, and c...
1,200
In the first line output the maximum amount of crucians that Valerie can consume for dinner.
standard output
PASSED
a6554050c6f2de2facff1a7f4dfe5b6d
train_000.jsonl
1286463600
In one little known, but very beautiful country called Waterland, lives a lovely shark Valerie. Like all the sharks, she has several rows of teeth, and feeds on crucians. One of Valerie's distinguishing features is that while eating one crucian she uses only one row of her teeth, the rest of the teeth are "relaxing".Fo...
256 megabytes
//package pkg33a; import static java.lang.Math.min; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(),m=sc.nextInt(),k=sc.nextInt(); int array[]=new int[m+1]; Arrays.fill(array,1000000); ...
Java
["4 3 18\n2 3\n1 2\n3 6\n2 3", "2 2 13\n1 13\n2 12"]
2 seconds
["11", "13"]
null
Java 11
standard input
[ "implementation", "greedy" ]
65eb0f3ab35c4d95c1cbd39fc7a4227b
The first line contains three integers n, m, k (1 ≀ m ≀ n ≀ 1000, 0 ≀ k ≀ 106) β€” total amount of Valerie's teeth, amount of tooth rows and amount of crucians in Valerie's portion for dinner. Then follow n lines, each containing two integers: r (1 ≀ r ≀ m) β€” index of the row, where belongs the corresponding tooth, and c...
1,200
In the first line output the maximum amount of crucians that Valerie can consume for dinner.
standard output
PASSED
9be287b95554f96dc4c5210a1dc96dd1
train_000.jsonl
1286463600
In one little known, but very beautiful country called Waterland, lives a lovely shark Valerie. Like all the sharks, she has several rows of teeth, and feeds on crucians. One of Valerie's distinguishing features is that while eating one crucian she uses only one row of her teeth, the rest of the teeth are "relaxing".Fo...
256 megabytes
import java.util.*; // Funny name public class WhatIsForDinner { static int[][] t = null; static int[] i = null; static void solve(){ Scanner sc = new Scanner(System.in); int c=sc.nextInt(), r=sc.nextInt(), n=sc.nextInt(), NOC=c, R=r, m=1000001, ans=0; t = new int[r][c]; ...
Java
["4 3 18\n2 3\n1 2\n3 6\n2 3", "2 2 13\n1 13\n2 12"]
2 seconds
["11", "13"]
null
Java 11
standard input
[ "implementation", "greedy" ]
65eb0f3ab35c4d95c1cbd39fc7a4227b
The first line contains three integers n, m, k (1 ≀ m ≀ n ≀ 1000, 0 ≀ k ≀ 106) β€” total amount of Valerie's teeth, amount of tooth rows and amount of crucians in Valerie's portion for dinner. Then follow n lines, each containing two integers: r (1 ≀ r ≀ m) β€” index of the row, where belongs the corresponding tooth, and c...
1,200
In the first line output the maximum amount of crucians that Valerie can consume for dinner.
standard output
PASSED
f7c2d5eb9c30f829d1dcb7df06ad6e7e
train_000.jsonl
1286463600
In one little known, but very beautiful country called Waterland, lives a lovely shark Valerie. Like all the sharks, she has several rows of teeth, and feeds on crucians. One of Valerie's distinguishing features is that while eating one crucian she uses only one row of her teeth, the rest of the teeth are "relaxing".Fo...
256 megabytes
import java.util.*; public class ExtraordinaryDice { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int k = sc.nextInt(); int[][] arr = new int[n][2]; for(int i=0; i<arr.length; i++...
Java
["4 3 18\n2 3\n1 2\n3 6\n2 3", "2 2 13\n1 13\n2 12"]
2 seconds
["11", "13"]
null
Java 11
standard input
[ "implementation", "greedy" ]
65eb0f3ab35c4d95c1cbd39fc7a4227b
The first line contains three integers n, m, k (1 ≀ m ≀ n ≀ 1000, 0 ≀ k ≀ 106) β€” total amount of Valerie's teeth, amount of tooth rows and amount of crucians in Valerie's portion for dinner. Then follow n lines, each containing two integers: r (1 ≀ r ≀ m) β€” index of the row, where belongs the corresponding tooth, and c...
1,200
In the first line output the maximum amount of crucians that Valerie can consume for dinner.
standard output
PASSED
6557baaf9c018154f69cd10b82d6ef0a
train_000.jsonl
1585233300
A number is ternary if it contains only digits $$$0$$$, $$$1$$$ and $$$2$$$. For example, the following numbers are ternary: $$$1022$$$, $$$11$$$, $$$21$$$, $$$2002$$$.You are given a long ternary number $$$x$$$. The first (leftmost) digit of $$$x$$$ is guaranteed to be $$$2$$$, the other digits of $$$x$$$ can be $$$0$...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class Main implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int...
Java
["4\n5\n22222\n5\n21211\n1\n2\n9\n220222021"]
1 second
["11111\n11111\n11000\n10211\n1\n1\n110111011\n110111010"]
null
Java 8
standard input
[ "implementation", "greedy" ]
c4c8cb860ea9a5b56bb35532989a9192
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) β€” the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^4$$$) β€” the length of $$$x$$$. The second line of the test case contains ternary number $$...
1,200
For each test case, print the answer β€” two ternary integers $$$a$$$ and $$$b$$$ both of length $$$n$$$ and both without leading zeros such that $$$a \odot b = x$$$ and $$$max(a, b)$$$ is the minimum possible. If there are several answers, you can print any.
standard output
PASSED
8e7b79d496f1b89cae6db7a8308f0474
train_000.jsonl
1585233300
A number is ternary if it contains only digits $$$0$$$, $$$1$$$ and $$$2$$$. For example, the following numbers are ternary: $$$1022$$$, $$$11$$$, $$$21$$$, $$$2002$$$.You are given a long ternary number $$$x$$$. The first (leftmost) digit of $$$x$$$ is guaranteed to be $$$2$$$, the other digits of $$$x$$$ can be $$$0$...
256 megabytes
import java.util.Scanner; public class xor { public static void main(String[] args) { Scanner s = new Scanner(System.in); int t = s.nextInt(); while(t-- > 0) { int n = s.nextInt(); String q = s.next(); StringBuilder a = new StringBuilder(""); StringBuilder b= new StringBuilder(""); for(int i...
Java
["4\n5\n22222\n5\n21211\n1\n2\n9\n220222021"]
1 second
["11111\n11111\n11000\n10211\n1\n1\n110111011\n110111010"]
null
Java 8
standard input
[ "implementation", "greedy" ]
c4c8cb860ea9a5b56bb35532989a9192
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) β€” the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^4$$$) β€” the length of $$$x$$$. The second line of the test case contains ternary number $$...
1,200
For each test case, print the answer β€” two ternary integers $$$a$$$ and $$$b$$$ both of length $$$n$$$ and both without leading zeros such that $$$a \odot b = x$$$ and $$$max(a, b)$$$ is the minimum possible. If there are several answers, you can print any.
standard output
PASSED
7010c92e528f2d9c68991ea0a17aa104
train_000.jsonl
1585233300
A number is ternary if it contains only digits $$$0$$$, $$$1$$$ and $$$2$$$. For example, the following numbers are ternary: $$$1022$$$, $$$11$$$, $$$21$$$, $$$2002$$$.You are given a long ternary number $$$x$$$. The first (leftmost) digit of $$$x$$$ is guaranteed to be $$$2$$$, the other digits of $$$x$$$ can be $$$0$...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; import java.math.*; public class B { public void run() throws Exception { FastScanner sc = new FastScanner(); int test = sc.nextInt(); outer: for (int q = 0; q<test; q++) { int n = sc.nextInt(); String s = sc.next(); StringBuilder a = new S...
Java
["4\n5\n22222\n5\n21211\n1\n2\n9\n220222021"]
1 second
["11111\n11111\n11000\n10211\n1\n1\n110111011\n110111010"]
null
Java 8
standard input
[ "implementation", "greedy" ]
c4c8cb860ea9a5b56bb35532989a9192
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) β€” the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^4$$$) β€” the length of $$$x$$$. The second line of the test case contains ternary number $$...
1,200
For each test case, print the answer β€” two ternary integers $$$a$$$ and $$$b$$$ both of length $$$n$$$ and both without leading zeros such that $$$a \odot b = x$$$ and $$$max(a, b)$$$ is the minimum possible. If there are several answers, you can print any.
standard output
PASSED
57ce9f0a3e0abe97044724e316ea6f3d
train_000.jsonl
1585233300
A number is ternary if it contains only digits $$$0$$$, $$$1$$$ and $$$2$$$. For example, the following numbers are ternary: $$$1022$$$, $$$11$$$, $$$21$$$, $$$2002$$$.You are given a long ternary number $$$x$$$. The first (leftmost) digit of $$$x$$$ is guaranteed to be $$$2$$$, the other digits of $$$x$$$ can be $$$0$...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { JScanner in = new JScanner(); StringBuilder out = new StringBuilder(); int t = in.nextInt(); while(t-->0) { int n = in.nextInt(); String s = in.nextLine(); StringBuilder a = new StringBuil...
Java
["4\n5\n22222\n5\n21211\n1\n2\n9\n220222021"]
1 second
["11111\n11111\n11000\n10211\n1\n1\n110111011\n110111010"]
null
Java 8
standard input
[ "implementation", "greedy" ]
c4c8cb860ea9a5b56bb35532989a9192
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) β€” the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^4$$$) β€” the length of $$$x$$$. The second line of the test case contains ternary number $$...
1,200
For each test case, print the answer β€” two ternary integers $$$a$$$ and $$$b$$$ both of length $$$n$$$ and both without leading zeros such that $$$a \odot b = x$$$ and $$$max(a, b)$$$ is the minimum possible. If there are several answers, you can print any.
standard output
PASSED
d7f45280d583188a1c7d75cb6d52b147
train_000.jsonl
1585233300
A number is ternary if it contains only digits $$$0$$$, $$$1$$$ and $$$2$$$. For example, the following numbers are ternary: $$$1022$$$, $$$11$$$, $$$21$$$, $$$2002$$$.You are given a long ternary number $$$x$$$. The first (leftmost) digit of $$$x$$$ is guaranteed to be $$$2$$$, the other digits of $$$x$$$ can be $$$0$...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.nio.Buffer; import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); // Scanner sc= new Scanner(Syste...
Java
["4\n5\n22222\n5\n21211\n1\n2\n9\n220222021"]
1 second
["11111\n11111\n11000\n10211\n1\n1\n110111011\n110111010"]
null
Java 8
standard input
[ "implementation", "greedy" ]
c4c8cb860ea9a5b56bb35532989a9192
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) β€” the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^4$$$) β€” the length of $$$x$$$. The second line of the test case contains ternary number $$...
1,200
For each test case, print the answer β€” two ternary integers $$$a$$$ and $$$b$$$ both of length $$$n$$$ and both without leading zeros such that $$$a \odot b = x$$$ and $$$max(a, b)$$$ is the minimum possible. If there are several answers, you can print any.
standard output
PASSED
f5a9bdd79005f24b3fc268fe2823e620
train_000.jsonl
1585233300
A number is ternary if it contains only digits $$$0$$$, $$$1$$$ and $$$2$$$. For example, the following numbers are ternary: $$$1022$$$, $$$11$$$, $$$21$$$, $$$2002$$$.You are given a long ternary number $$$x$$$. The first (leftmost) digit of $$$x$$$ is guaranteed to be $$$2$$$, the other digits of $$$x$$$ can be $$$0$...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; public class Contest1 { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int t = sc.nextInt(); while (t-->0){ ...
Java
["4\n5\n22222\n5\n21211\n1\n2\n9\n220222021"]
1 second
["11111\n11111\n11000\n10211\n1\n1\n110111011\n110111010"]
null
Java 8
standard input
[ "implementation", "greedy" ]
c4c8cb860ea9a5b56bb35532989a9192
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) β€” the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^4$$$) β€” the length of $$$x$$$. The second line of the test case contains ternary number $$...
1,200
For each test case, print the answer β€” two ternary integers $$$a$$$ and $$$b$$$ both of length $$$n$$$ and both without leading zeros such that $$$a \odot b = x$$$ and $$$max(a, b)$$$ is the minimum possible. If there are several answers, you can print any.
standard output
PASSED
7282846b440af73e3a9b95caef89ba61
train_000.jsonl
1585233300
A number is ternary if it contains only digits $$$0$$$, $$$1$$$ and $$$2$$$. For example, the following numbers are ternary: $$$1022$$$, $$$11$$$, $$$21$$$, $$$2002$$$.You are given a long ternary number $$$x$$$. The first (leftmost) digit of $$$x$$$ is guaranteed to be $$$2$$$, the other digits of $$$x$$$ can be $$$0$...
256 megabytes
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; public class TernaryXOR { static int mod = 1000000007; static long L_INF = (1L << 60L); static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private in...
Java
["4\n5\n22222\n5\n21211\n1\n2\n9\n220222021"]
1 second
["11111\n11111\n11000\n10211\n1\n1\n110111011\n110111010"]
null
Java 8
standard input
[ "implementation", "greedy" ]
c4c8cb860ea9a5b56bb35532989a9192
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) β€” the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^4$$$) β€” the length of $$$x$$$. The second line of the test case contains ternary number $$...
1,200
For each test case, print the answer β€” two ternary integers $$$a$$$ and $$$b$$$ both of length $$$n$$$ and both without leading zeros such that $$$a \odot b = x$$$ and $$$max(a, b)$$$ is the minimum possible. If there are several answers, you can print any.
standard output
PASSED
dc3b3da0b713fdbcfa1649686c8f0012
train_000.jsonl
1585233300
A number is ternary if it contains only digits $$$0$$$, $$$1$$$ and $$$2$$$. For example, the following numbers are ternary: $$$1022$$$, $$$11$$$, $$$21$$$, $$$2002$$$.You are given a long ternary number $$$x$$$. The first (leftmost) digit of $$$x$$$ is guaranteed to be $$$2$$$, the other digits of $$$x$$$ can be $$$0$...
256 megabytes
import java.io.*; import java.util.*; public class C629C { static PrintWriter out=new PrintWriter((System.out)); public static void main(String args[])throws IOException { Reader sc=new Reader(); int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); S...
Java
["4\n5\n22222\n5\n21211\n1\n2\n9\n220222021"]
1 second
["11111\n11111\n11000\n10211\n1\n1\n110111011\n110111010"]
null
Java 8
standard input
[ "implementation", "greedy" ]
c4c8cb860ea9a5b56bb35532989a9192
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) β€” the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^4$$$) β€” the length of $$$x$$$. The second line of the test case contains ternary number $$...
1,200
For each test case, print the answer β€” two ternary integers $$$a$$$ and $$$b$$$ both of length $$$n$$$ and both without leading zeros such that $$$a \odot b = x$$$ and $$$max(a, b)$$$ is the minimum possible. If there are several answers, you can print any.
standard output