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
8271439cc5ac756f9c7f540601048ce0
train_002.jsonl
1546007700
You are given a range of positive integers from $$$l$$$ to $$$r$$$.Find such a pair of integers $$$(x, y)$$$ that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$.If there are multiple answers, print any of them.You are also asked to answer $$$T$$$ independent queries.
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.IOException; import java.io.BufferedReader; import java.io.Reader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at th...
Java
["3\n1 10\n3 14\n1 10"]
2 seconds
["1 7\n3 9\n5 10"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
a9cd97046e27d799c894d8514e90a377
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 1000$$$) β€” the number of queries. Each of the next $$$T$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 998244353$$$) β€” inclusive borders of the range. It is guaranteed that testset only includes queries, which have at least one s...
800
Print $$$T$$$ lines, each line should contain the answer β€” two integers $$$x$$$ and $$$y$$$ such that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$. The answer in the $$$i$$$-th line should correspond to the $$$i$$$-th query from the input. If there are multiple answers, print any of them.
standard output
PASSED
4d49e8e42ce192eda490b5162d0824de
train_002.jsonl
1546007700
You are given a range of positive integers from $$$l$$$ to $$$r$$$.Find such a pair of integers $$$(x, y)$$$ that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$.If there are multiple answers, print any of them.You are also asked to answer $$$T$$$ independent queries.
256 megabytes
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int T = scanner.nextInt(); while (T-- > 0) { int l = scanner.nextInt(); int r = scan...
Java
["3\n1 10\n3 14\n1 10"]
2 seconds
["1 7\n3 9\n5 10"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
a9cd97046e27d799c894d8514e90a377
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 1000$$$) β€” the number of queries. Each of the next $$$T$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 998244353$$$) β€” inclusive borders of the range. It is guaranteed that testset only includes queries, which have at least one s...
800
Print $$$T$$$ lines, each line should contain the answer β€” two integers $$$x$$$ and $$$y$$$ such that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$. The answer in the $$$i$$$-th line should correspond to the $$$i$$$-th query from the input. If there are multiple answers, print any of them.
standard output
PASSED
cc50f9e1819eed36059af9e3aa7f49bf
train_002.jsonl
1546007700
You are given a range of positive integers from $$$l$$$ to $$$r$$$.Find such a pair of integers $$$(x, y)$$$ that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$.If there are multiple answers, print any of them.You are also asked to answer $$$T$$$ independent queries.
256 megabytes
import java.util.Scanner; public class sisxth { public static void main(String ards[]) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t!=0) { long l,r,x,y; l=sc.nextLong(); r=sc.nextLong(); if(l==1) { x=1; y=r; } else { long mod=r%l; x=l; y=r-mod; ...
Java
["3\n1 10\n3 14\n1 10"]
2 seconds
["1 7\n3 9\n5 10"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
a9cd97046e27d799c894d8514e90a377
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 1000$$$) β€” the number of queries. Each of the next $$$T$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 998244353$$$) β€” inclusive borders of the range. It is guaranteed that testset only includes queries, which have at least one s...
800
Print $$$T$$$ lines, each line should contain the answer β€” two integers $$$x$$$ and $$$y$$$ such that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$. The answer in the $$$i$$$-th line should correspond to the $$$i$$$-th query from the input. If there are multiple answers, print any of them.
standard output
PASSED
a5437cf46b7f66a061013ad809875b0b
train_002.jsonl
1546007700
You are given a range of positive integers from $$$l$$$ to $$$r$$$.Find such a pair of integers $$$(x, y)$$$ that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$.If there are multiple answers, print any of them.You are also asked to answer $$$T$$$ independent queries.
256 megabytes
import java.util.Scanner; public class FindingVisible { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); for (int i = 0; i < n; i++) { int x= in.nextInt(),y=in.nextInt(); findVis(x,y); } } private s...
Java
["3\n1 10\n3 14\n1 10"]
2 seconds
["1 7\n3 9\n5 10"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
a9cd97046e27d799c894d8514e90a377
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 1000$$$) β€” the number of queries. Each of the next $$$T$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 998244353$$$) β€” inclusive borders of the range. It is guaranteed that testset only includes queries, which have at least one s...
800
Print $$$T$$$ lines, each line should contain the answer β€” two integers $$$x$$$ and $$$y$$$ such that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$. The answer in the $$$i$$$-th line should correspond to the $$$i$$$-th query from the input. If there are multiple answers, print any of them.
standard output
PASSED
da260395ec635e6aa8f65edefcd91ca6
train_002.jsonl
1546007700
You are given a range of positive integers from $$$l$$$ to $$$r$$$.Find such a pair of integers $$$(x, y)$$$ that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$.If there are multiple answers, print any of them.You are also asked to answer $$$T$$$ independent queries.
256 megabytes
import java.util.*; public class A { public static void main(String... args) { Scanner s = new Scanner(System.in); int t = s.nextInt(); while (t-- > 0) { int a, b; a = s.nextInt(); b = s.nextInt(); if (b%a==0) System.out.println(a+...
Java
["3\n1 10\n3 14\n1 10"]
2 seconds
["1 7\n3 9\n5 10"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
a9cd97046e27d799c894d8514e90a377
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 1000$$$) β€” the number of queries. Each of the next $$$T$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 998244353$$$) β€” inclusive borders of the range. It is guaranteed that testset only includes queries, which have at least one s...
800
Print $$$T$$$ lines, each line should contain the answer β€” two integers $$$x$$$ and $$$y$$$ such that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$. The answer in the $$$i$$$-th line should correspond to the $$$i$$$-th query from the input. If there are multiple answers, print any of them.
standard output
PASSED
61453b9d06c40eab8715d090bd64e14b
train_002.jsonl
1546007700
You are given a range of positive integers from $$$l$$$ to $$$r$$$.Find such a pair of integers $$$(x, y)$$$ that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$.If there are multiple answers, print any of them.You are also asked to answer $$$T$$$ independent queries.
256 megabytes
import java.util.*; public class Div { public static void main(String args[]) throws Exception { Scanner scan=new Scanner(System.in); int t=scan.nextInt(); for(int i=1;i<=t;i++) { int l=scan.nextInt(); int r=scan.nextInt(); System.out.print...
Java
["3\n1 10\n3 14\n1 10"]
2 seconds
["1 7\n3 9\n5 10"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
a9cd97046e27d799c894d8514e90a377
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 1000$$$) β€” the number of queries. Each of the next $$$T$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 998244353$$$) β€” inclusive borders of the range. It is guaranteed that testset only includes queries, which have at least one s...
800
Print $$$T$$$ lines, each line should contain the answer β€” two integers $$$x$$$ and $$$y$$$ such that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$. The answer in the $$$i$$$-th line should correspond to the $$$i$$$-th query from the input. If there are multiple answers, print any of them.
standard output
PASSED
aba9cf44f58ea3dfa7902c6eb760af25
train_002.jsonl
1546007700
You are given a range of positive integers from $$$l$$$ to $$$r$$$.Find such a pair of integers $$$(x, y)$$$ that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$.If there are multiple answers, print any of them.You are also asked to answer $$$T$$$ independent queries.
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner scan = new Scanner(System.in); int n = scan.nextInt(); while(n-->0){ int l = scan.nextInt(); int r = scan.nextInt(); System.out.println(l+" "+l*2); } ...
Java
["3\n1 10\n3 14\n1 10"]
2 seconds
["1 7\n3 9\n5 10"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
a9cd97046e27d799c894d8514e90a377
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 1000$$$) β€” the number of queries. Each of the next $$$T$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 998244353$$$) β€” inclusive borders of the range. It is guaranteed that testset only includes queries, which have at least one s...
800
Print $$$T$$$ lines, each line should contain the answer β€” two integers $$$x$$$ and $$$y$$$ such that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$. The answer in the $$$i$$$-th line should correspond to the $$$i$$$-th query from the input. If there are multiple answers, print any of them.
standard output
PASSED
cf4220244132a2a5b261197f67e84e8e
train_002.jsonl
1546007700
You are given a range of positive integers from $$$l$$$ to $$$r$$$.Find such a pair of integers $$$(x, y)$$$ that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$.If there are multiple answers, print any of them.You are also asked to answer $$$T$$$ independent queries.
256 megabytes
import java.util.*; public class Solution { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); StringBuilder result = new StringBuilder(); for(int i = 0; i < t; i++) { int l = scan.nextInt(); int r = scan.nextInt(); int p = r % l; int x = Math.m...
Java
["3\n1 10\n3 14\n1 10"]
2 seconds
["1 7\n3 9\n5 10"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
a9cd97046e27d799c894d8514e90a377
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 1000$$$) β€” the number of queries. Each of the next $$$T$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 998244353$$$) β€” inclusive borders of the range. It is guaranteed that testset only includes queries, which have at least one s...
800
Print $$$T$$$ lines, each line should contain the answer β€” two integers $$$x$$$ and $$$y$$$ such that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$. The answer in the $$$i$$$-th line should correspond to the $$$i$$$-th query from the input. If there are multiple answers, print any of them.
standard output
PASSED
68d91422366d8b776f257240d526d6cb
train_002.jsonl
1546007700
You are given a range of positive integers from $$$l$$$ to $$$r$$$.Find such a pair of integers $$$(x, y)$$$ that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$.If there are multiple answers, print any of them.You are also asked to answer $$$T$$$ independent queries.
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 l=sc.nextInt(); int r=sc.nextInt(); ...
Java
["3\n1 10\n3 14\n1 10"]
2 seconds
["1 7\n3 9\n5 10"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
a9cd97046e27d799c894d8514e90a377
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 1000$$$) β€” the number of queries. Each of the next $$$T$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 998244353$$$) β€” inclusive borders of the range. It is guaranteed that testset only includes queries, which have at least one s...
800
Print $$$T$$$ lines, each line should contain the answer β€” two integers $$$x$$$ and $$$y$$$ such that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$. The answer in the $$$i$$$-th line should correspond to the $$$i$$$-th query from the input. If there are multiple answers, print any of them.
standard output
PASSED
c5cf6ef73e9332832bc6593397c3befb
train_002.jsonl
1546007700
You are given a range of positive integers from $$$l$$$ to $$$r$$$.Find such a pair of integers $$$(x, y)$$$ that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$.If there are multiple answers, print any of them.You are also asked to answer $$$T$$$ independent queries.
256 megabytes
import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner scan=new Scanner(System.in); int n=scan.nextInt(); for(int ...
Java
["3\n1 10\n3 14\n1 10"]
2 seconds
["1 7\n3 9\n5 10"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
a9cd97046e27d799c894d8514e90a377
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 1000$$$) β€” the number of queries. Each of the next $$$T$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 998244353$$$) β€” inclusive borders of the range. It is guaranteed that testset only includes queries, which have at least one s...
800
Print $$$T$$$ lines, each line should contain the answer β€” two integers $$$x$$$ and $$$y$$$ such that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$. The answer in the $$$i$$$-th line should correspond to the $$$i$$$-th query from the input. If there are multiple answers, print any of them.
standard output
PASSED
4b09e422cd197ebceb6ab07925dcbf4f
train_002.jsonl
1546007700
You are given a range of positive integers from $$$l$$$ to $$$r$$$.Find such a pair of integers $$$(x, y)$$$ that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$.If there are multiple answers, print any of them.You are also asked to answer $$$T$$$ independent queries.
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class FNDV { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine()); for(int k = 0;k<t;k++){ Stri...
Java
["3\n1 10\n3 14\n1 10"]
2 seconds
["1 7\n3 9\n5 10"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
a9cd97046e27d799c894d8514e90a377
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 1000$$$) β€” the number of queries. Each of the next $$$T$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 998244353$$$) β€” inclusive borders of the range. It is guaranteed that testset only includes queries, which have at least one s...
800
Print $$$T$$$ lines, each line should contain the answer β€” two integers $$$x$$$ and $$$y$$$ such that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$. The answer in the $$$i$$$-th line should correspond to the $$$i$$$-th query from the input. If there are multiple answers, print any of them.
standard output
PASSED
d348bd76cbf9934933f482d2204ef775
train_002.jsonl
1546007700
You are given a range of positive integers from $$$l$$$ to $$$r$$$.Find such a pair of integers $$$(x, y)$$$ that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$.If there are multiple answers, print any of them.You are also asked to answer $$$T$$$ independent queries.
256 megabytes
import java.util.Scanner; public class FindDivisible { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t=scan.nextInt(); while(t-->0) { int l=scan.nextInt(); int r=scan.nextInt(); if(r%l==0) System.out.println(l+" "+r); else { r=l*2; System.out.prin...
Java
["3\n1 10\n3 14\n1 10"]
2 seconds
["1 7\n3 9\n5 10"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
a9cd97046e27d799c894d8514e90a377
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 1000$$$) β€” the number of queries. Each of the next $$$T$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 998244353$$$) β€” inclusive borders of the range. It is guaranteed that testset only includes queries, which have at least one s...
800
Print $$$T$$$ lines, each line should contain the answer β€” two integers $$$x$$$ and $$$y$$$ such that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$. The answer in the $$$i$$$-th line should correspond to the $$$i$$$-th query from the input. If there are multiple answers, print any of them.
standard output
PASSED
eb2baf10f519b74618e3ae54ffe05ef8
train_002.jsonl
1546007700
You are given a range of positive integers from $$$l$$$ to $$$r$$$.Find such a pair of integers $$$(x, y)$$$ that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$.If there are multiple answers, print any of them.You are also asked to answer $$$T$$$ independent queries.
256 megabytes
import java.util.Scanner; public class Vasya_Vershini { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); long t, l, r; t = scanner.nextLong(); for (int i = 0; i < t; i++) { l = scanner.nextLong(); r = scanner.nextLong(); ...
Java
["3\n1 10\n3 14\n1 10"]
2 seconds
["1 7\n3 9\n5 10"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
a9cd97046e27d799c894d8514e90a377
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 1000$$$) β€” the number of queries. Each of the next $$$T$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 998244353$$$) β€” inclusive borders of the range. It is guaranteed that testset only includes queries, which have at least one s...
800
Print $$$T$$$ lines, each line should contain the answer β€” two integers $$$x$$$ and $$$y$$$ such that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$. The answer in the $$$i$$$-th line should correspond to the $$$i$$$-th query from the input. If there are multiple answers, print any of them.
standard output
PASSED
13a4a6f3341e6cfd8fa54bb86a0a79ba
train_002.jsonl
1546007700
You are given a range of positive integers from $$$l$$$ to $$$r$$$.Find such a pair of integers $$$(x, y)$$$ that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$.If there are multiple answers, print any of them.You are also asked to answer $$$T$$$ independent queries.
256 megabytes
import java.util.Scanner; public class Vasya_Vershini { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); long t, l, r; t = scanner.nextLong(); for (int i = 0; i < t; i++) { l = scanner.nextLong(); r = scanner.nextLong(); ...
Java
["3\n1 10\n3 14\n1 10"]
2 seconds
["1 7\n3 9\n5 10"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
a9cd97046e27d799c894d8514e90a377
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 1000$$$) β€” the number of queries. Each of the next $$$T$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 998244353$$$) β€” inclusive borders of the range. It is guaranteed that testset only includes queries, which have at least one s...
800
Print $$$T$$$ lines, each line should contain the answer β€” two integers $$$x$$$ and $$$y$$$ such that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$. The answer in the $$$i$$$-th line should correspond to the $$$i$$$-th query from the input. If there are multiple answers, print any of them.
standard output
PASSED
e7fc274ce50c8edd93210a82967f2d74
train_002.jsonl
1546007700
You are given a range of positive integers from $$$l$$$ to $$$r$$$.Find such a pair of integers $$$(x, y)$$$ that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$.If there are multiple answers, print any of them.You are also asked to answer $$$T$$$ independent queries.
256 megabytes
import java.util.Scanner; public class App { public static void main(String[] args) throws Exception { Scanner scanner = new Scanner(System.in); int testcaseAmount = scanner.nextInt(); scanner.nextLine(); String[] testcases = new String[testcaseAmount]; for (int i = 0; i ...
Java
["3\n1 10\n3 14\n1 10"]
2 seconds
["1 7\n3 9\n5 10"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
a9cd97046e27d799c894d8514e90a377
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 1000$$$) β€” the number of queries. Each of the next $$$T$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 998244353$$$) β€” inclusive borders of the range. It is guaranteed that testset only includes queries, which have at least one s...
800
Print $$$T$$$ lines, each line should contain the answer β€” two integers $$$x$$$ and $$$y$$$ such that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$. The answer in the $$$i$$$-th line should correspond to the $$$i$$$-th query from the input. If there are multiple answers, print any of them.
standard output
PASSED
30aab179c42bfffd8176f0e305d6ad85
train_002.jsonl
1546007700
You are given a range of positive integers from $$$l$$$ to $$$r$$$.Find such a pair of integers $$$(x, y)$$$ that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$.If there are multiple answers, print any of them.You are also asked to answer $$$T$$$ independent queries.
256 megabytes
import java.util.Scanner; public class App { public static void main(String[] args) throws Exception { Scanner scanner = new Scanner(System.in); int testcaseAmount = scanner.nextInt(); scanner.nextLine(); String[] testcases = new String[testcaseAmount]; for (int i = 0; i ...
Java
["3\n1 10\n3 14\n1 10"]
2 seconds
["1 7\n3 9\n5 10"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
a9cd97046e27d799c894d8514e90a377
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 1000$$$) β€” the number of queries. Each of the next $$$T$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 998244353$$$) β€” inclusive borders of the range. It is guaranteed that testset only includes queries, which have at least one s...
800
Print $$$T$$$ lines, each line should contain the answer β€” two integers $$$x$$$ and $$$y$$$ such that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$. The answer in the $$$i$$$-th line should correspond to the $$$i$$$-th query from the input. If there are multiple answers, print any of them.
standard output
PASSED
615326484a4be4821662bf676fda6526
train_002.jsonl
1546007700
You are given a range of positive integers from $$$l$$$ to $$$r$$$.Find such a pair of integers $$$(x, y)$$$ that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$.If there are multiple answers, print any of them.You are also asked to answer $$$T$$$ independent queries.
256 megabytes
import java.util.Scanner; public class probA1096 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int n= sc.nextInt(); for(int i=0;i<n;i++) { int l= sc.nextInt(); int r= sc.nextInt(); System.out.println(l+" "+l*2); } } }
Java
["3\n1 10\n3 14\n1 10"]
2 seconds
["1 7\n3 9\n5 10"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
a9cd97046e27d799c894d8514e90a377
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 1000$$$) β€” the number of queries. Each of the next $$$T$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 998244353$$$) β€” inclusive borders of the range. It is guaranteed that testset only includes queries, which have at least one s...
800
Print $$$T$$$ lines, each line should contain the answer β€” two integers $$$x$$$ and $$$y$$$ such that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$. The answer in the $$$i$$$-th line should correspond to the $$$i$$$-th query from the input. If there are multiple answers, print any of them.
standard output
PASSED
4f7c9225919a0b51673ba411a8b84d43
train_002.jsonl
1546007700
You are given a range of positive integers from $$$l$$$ to $$$r$$$.Find such a pair of integers $$$(x, y)$$$ that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$.If there are multiple answers, print any of them.You are also asked to answer $$$T$$$ independent queries.
256 megabytes
import java.util.Scanner; public class CF_contest_1096A { public static void main(String[] args) { Scanner input = new Scanner(System.in); int t = input.nextInt(); for (int i = 1; i <= t; i++) { int l = input.nextInt(); int r = input.nextInt(); ...
Java
["3\n1 10\n3 14\n1 10"]
2 seconds
["1 7\n3 9\n5 10"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
a9cd97046e27d799c894d8514e90a377
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 1000$$$) β€” the number of queries. Each of the next $$$T$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 998244353$$$) β€” inclusive borders of the range. It is guaranteed that testset only includes queries, which have at least one s...
800
Print $$$T$$$ lines, each line should contain the answer β€” two integers $$$x$$$ and $$$y$$$ such that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$. The answer in the $$$i$$$-th line should correspond to the $$$i$$$-th query from the input. If there are multiple answers, print any of them.
standard output
PASSED
7edff86aef5c5bc5addbaed0da0e1ade
train_002.jsonl
1546007700
You are given a range of positive integers from $$$l$$$ to $$$r$$$.Find such a pair of integers $$$(x, y)$$$ that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$.If there are multiple answers, print any of them.You are also asked to answer $$$T$$$ independent queries.
256 megabytes
import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Scanner; public class A1096 { public static void main(String[] args) throws FileNotFoundException { Scanner scan = new Scanner(System.in); int queries = scan.nextInt(); for(int i =0 ; i < queries; i ++) { ...
Java
["3\n1 10\n3 14\n1 10"]
2 seconds
["1 7\n3 9\n5 10"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
a9cd97046e27d799c894d8514e90a377
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 1000$$$) β€” the number of queries. Each of the next $$$T$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 998244353$$$) β€” inclusive borders of the range. It is guaranteed that testset only includes queries, which have at least one s...
800
Print $$$T$$$ lines, each line should contain the answer β€” two integers $$$x$$$ and $$$y$$$ such that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$. The answer in the $$$i$$$-th line should correspond to the $$$i$$$-th query from the input. If there are multiple answers, print any of them.
standard output
PASSED
2162786ecc71b51513315797392b7063
train_002.jsonl
1546007700
You are given a range of positive integers from $$$l$$$ to $$$r$$$.Find such a pair of integers $$$(x, y)$$$ that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$.If there are multiple answers, print any of them.You are also asked to answer $$$T$$$ independent queries.
256 megabytes
import java.util.*; public class Solution{ public static void main(String[] args){ Scanner s=new Scanner(System.in); int t=s.nextInt(); while(t-->0){ int a=s.nextInt(),b=s.nextInt(); int x=a,y=2*a; System.out.println(""+x+" "+y); } ...
Java
["3\n1 10\n3 14\n1 10"]
2 seconds
["1 7\n3 9\n5 10"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
a9cd97046e27d799c894d8514e90a377
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 1000$$$) β€” the number of queries. Each of the next $$$T$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 998244353$$$) β€” inclusive borders of the range. It is guaranteed that testset only includes queries, which have at least one s...
800
Print $$$T$$$ lines, each line should contain the answer β€” two integers $$$x$$$ and $$$y$$$ such that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$. The answer in the $$$i$$$-th line should correspond to the $$$i$$$-th query from the input. If there are multiple answers, print any of them.
standard output
PASSED
9f3ce18dc3ab9612fc510f7fd8b6cc9a
train_002.jsonl
1546007700
You are given a range of positive integers from $$$l$$$ to $$$r$$$.Find such a pair of integers $$$(x, y)$$$ that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$.If there are multiple answers, print any of them.You are also asked to answer $$$T$$$ independent queries.
256 megabytes
/* A. Find Divisible http://codeforces.com/problemset/problem/1096/A */ import java.util.Scanner; public class A08 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); for (int k = 0; k < n; k++) { int r = in.nextInt(); int l = in.nextInt(); Syste...
Java
["3\n1 10\n3 14\n1 10"]
2 seconds
["1 7\n3 9\n5 10"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
a9cd97046e27d799c894d8514e90a377
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 1000$$$) β€” the number of queries. Each of the next $$$T$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 998244353$$$) β€” inclusive borders of the range. It is guaranteed that testset only includes queries, which have at least one s...
800
Print $$$T$$$ lines, each line should contain the answer β€” two integers $$$x$$$ and $$$y$$$ such that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$. The answer in the $$$i$$$-th line should correspond to the $$$i$$$-th query from the input. If there are multiple answers, print any of them.
standard output
PASSED
ded1bd4f804a1c24a384cb7997e2d4c8
train_002.jsonl
1546007700
You are given a range of positive integers from $$$l$$$ to $$$r$$$.Find such a pair of integers $$$(x, y)$$$ that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$.If there are multiple answers, print any of them.You are also asked to answer $$$T$$$ independent queries.
256 megabytes
import java.util.Scanner; public class AA { public static void main(String args[]) { Scanner scan=new Scanner(System.in); int n=scan.nextInt(); for(int i=0;i<n;i++) { boolean found=false; int l=scan.nextInt(); int r=scan.nextInt(); for(int q=l;q<=r;q++) { if(q*2<=r){ System.out.prin...
Java
["3\n1 10\n3 14\n1 10"]
2 seconds
["1 7\n3 9\n5 10"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
a9cd97046e27d799c894d8514e90a377
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 1000$$$) β€” the number of queries. Each of the next $$$T$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 998244353$$$) β€” inclusive borders of the range. It is guaranteed that testset only includes queries, which have at least one s...
800
Print $$$T$$$ lines, each line should contain the answer β€” two integers $$$x$$$ and $$$y$$$ such that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$. The answer in the $$$i$$$-th line should correspond to the $$$i$$$-th query from the input. If there are multiple answers, print any of them.
standard output
PASSED
185e88d3b9bf3690c52e41f5483622ba
train_002.jsonl
1546007700
You are given a range of positive integers from $$$l$$$ to $$$r$$$.Find such a pair of integers $$$(x, y)$$$ that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$.If there are multiple answers, print any of them.You are also asked to answer $$$T$$$ independent queries.
256 megabytes
public class A { public static void main (String arg[]){ java.util.Scanner sc = new java.util.Scanner(System.in); int t = sc.nextInt(); while(t-->0){ int l = sc.nextInt(); int r = sc.nextInt(); System.out.println(l+" "+2*l); } } }
Java
["3\n1 10\n3 14\n1 10"]
2 seconds
["1 7\n3 9\n5 10"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
a9cd97046e27d799c894d8514e90a377
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 1000$$$) β€” the number of queries. Each of the next $$$T$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 998244353$$$) β€” inclusive borders of the range. It is guaranteed that testset only includes queries, which have at least one s...
800
Print $$$T$$$ lines, each line should contain the answer β€” two integers $$$x$$$ and $$$y$$$ such that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$. The answer in the $$$i$$$-th line should correspond to the $$$i$$$-th query from the input. If there are multiple answers, print any of them.
standard output
PASSED
9e0f9ebb7585a73268197300c07e1d20
train_002.jsonl
1546007700
You are given a range of positive integers from $$$l$$$ to $$$r$$$.Find such a pair of integers $$$(x, y)$$$ that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$.If there are multiple answers, print any of them.You are also asked to answer $$$T$$$ independent queries.
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.net.*; import java.applet.*; import java.awt.*; import java.awt.event.*; public class cf { public static void main(String args[]) { Scanner in=new Scanner(System.in); int t=in.nextInt(); while(t>0) { ...
Java
["3\n1 10\n3 14\n1 10"]
2 seconds
["1 7\n3 9\n5 10"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
a9cd97046e27d799c894d8514e90a377
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 1000$$$) β€” the number of queries. Each of the next $$$T$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 998244353$$$) β€” inclusive borders of the range. It is guaranteed that testset only includes queries, which have at least one s...
800
Print $$$T$$$ lines, each line should contain the answer β€” two integers $$$x$$$ and $$$y$$$ such that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$. The answer in the $$$i$$$-th line should correspond to the $$$i$$$-th query from the input. If there are multiple answers, print any of them.
standard output
PASSED
2a0f971ea12a7d90b906d63b87116dd7
train_002.jsonl
1546007700
You are given a range of positive integers from $$$l$$$ to $$$r$$$.Find such a pair of integers $$$(x, y)$$$ that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$.If there are multiple answers, print any of them.You are also asked to answer $$$T$$$ independent queries.
256 megabytes
import java.util.*; public class find { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int i=0;i<t;i++) { long x=sc.nextLong(); long y=sc.nextLong(); System.out.println(x+" "+(2*x))...
Java
["3\n1 10\n3 14\n1 10"]
2 seconds
["1 7\n3 9\n5 10"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
a9cd97046e27d799c894d8514e90a377
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 1000$$$) β€” the number of queries. Each of the next $$$T$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 998244353$$$) β€” inclusive borders of the range. It is guaranteed that testset only includes queries, which have at least one s...
800
Print $$$T$$$ lines, each line should contain the answer β€” two integers $$$x$$$ and $$$y$$$ such that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$. The answer in the $$$i$$$-th line should correspond to the $$$i$$$-th query from the input. If there are multiple answers, print any of them.
standard output
PASSED
e8ed89f87e2bf5dbbdde4c0e5ad5de35
train_002.jsonl
1546007700
You are given a range of positive integers from $$$l$$$ to $$$r$$$.Find such a pair of integers $$$(x, y)$$$ that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$.If there are multiple answers, print any of them.You are also asked to answer $$$T$$$ independent queries.
256 megabytes
import java.util.*; public class xbyy { public static void main(String ag[]) { Scanner sc=new Scanner(System.in); int T,l,r,i; T=sc.nextInt(); while((T--)>0) { l=sc.nextInt(); r=sc.nextInt(); for(i=l;i<=r/2;i++) { if((2*i)%i==0&&(2*i)<=r) { System.out.println(i+" "+(2*i)); ...
Java
["3\n1 10\n3 14\n1 10"]
2 seconds
["1 7\n3 9\n5 10"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
a9cd97046e27d799c894d8514e90a377
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 1000$$$) β€” the number of queries. Each of the next $$$T$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 998244353$$$) β€” inclusive borders of the range. It is guaranteed that testset only includes queries, which have at least one s...
800
Print $$$T$$$ lines, each line should contain the answer β€” two integers $$$x$$$ and $$$y$$$ such that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$. The answer in the $$$i$$$-th line should correspond to the $$$i$$$-th query from the input. If there are multiple answers, print any of them.
standard output
PASSED
c9bffe5aaa3059dca20f63f0ecc010c0
train_002.jsonl
1546007700
You are given a range of positive integers from $$$l$$$ to $$$r$$$.Find such a pair of integers $$$(x, y)$$$ that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$.If there are multiple answers, print any of them.You are also asked to answer $$$T$$$ independent queries.
256 megabytes
import java.util.Scanner; public class main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int num = in.nextInt(); for (int i = 0; i < num; i++) { int l = in.nextInt(); int r = in.nextInt(); System.out.print(l + " "+ l*2+ "\n"); } } }
Java
["3\n1 10\n3 14\n1 10"]
2 seconds
["1 7\n3 9\n5 10"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
a9cd97046e27d799c894d8514e90a377
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 1000$$$) β€” the number of queries. Each of the next $$$T$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 998244353$$$) β€” inclusive borders of the range. It is guaranteed that testset only includes queries, which have at least one s...
800
Print $$$T$$$ lines, each line should contain the answer β€” two integers $$$x$$$ and $$$y$$$ such that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$. The answer in the $$$i$$$-th line should correspond to the $$$i$$$-th query from the input. If there are multiple answers, print any of them.
standard output
PASSED
d3466e19ad9225660b375a3be6df8d44
train_002.jsonl
1293552000
Cheaterius is a famous in all the Berland astrologist, magician and wizard, and he also is a liar and a cheater. One of his latest inventions is Cheaterius' amulets! They bring luck and wealth, but are rather expensive. Cheaterius makes them himself. The technology of their making is kept secret. But we know that throu...
256 megabytes
import java.util.*; public class FortuneTelling { static Set<Integer> s = new HashSet<Integer>(); static void permute(char[] a, char[] b) { s.add(Integer.parseInt(""+a[1]+a[0]+b[0]+b[1])); s.add(Integer.parseInt(""+a[0]+b[0]+b[1]+a[1])); // 90 s.add(Integer.parseInt(""+b[0]+b[1]+a...
Java
["4\n31\n23\n**\n31\n23\n**\n13\n32\n**\n32\n13", "4\n51\n26\n**\n54\n35\n**\n25\n61\n**\n45\n53"]
2 seconds
["1", "2"]
null
Java 11
standard input
[ "implementation" ]
3de36638239deacac56e104d3dce1670
The first line contains an integer n (1 ≀ n ≀ 1000), where n is the number of amulets. Then the amulet's descriptions are contained. Every description occupies two lines and contains two numbers (from 1 to 6) in each line. Between every pair of amulets the line "**" is located.
1,300
Print the required number of piles.
standard output
PASSED
8a71c8caf64a04712a6647d96938cda9
train_002.jsonl
1531578900
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,...
256 megabytes
import java.util.*; public class Main { public static void main(String args[]){ Scanner in = new Scanner(System.in); int n = in.nextInt(), m = in.nextInt(), gam[] = new int[n], mon[] = new int[m]; for (int i = 0; i < n; i++) gam[i] = in.nextInt(); for (int i = 0; i < m; i++) mon[i] =...
Java
["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"]
1 second
["3", "0", "4"]
NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti...
Java 8
standard input
[ "implementation" ]
c3f080681e3da5e1290ef935ff91f364
The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) β€” the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g...
800
Print a single integer β€” the number of games Maxim will buy.
standard output
PASSED
7b25453dbe3e5576b291ca905cd1acb3
train_002.jsonl
1531578900
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,...
256 megabytes
import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; public class Main{ public static void main(String[] args)throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System....
Java
["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"]
1 second
["3", "0", "4"]
NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti...
Java 8
standard input
[ "implementation" ]
c3f080681e3da5e1290ef935ff91f364
The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) β€” the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g...
800
Print a single integer β€” the number of games Maxim will buy.
standard output
PASSED
fe2b70e9a7a5061867c2cb52ce5ef493
train_002.jsonl
1531578900
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,...
256 megabytes
import java.io.*; import java.util.*; public class GameShopping { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int n = Integer.parseInt(st.nextToken()); int m = Inte...
Java
["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"]
1 second
["3", "0", "4"]
NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti...
Java 8
standard input
[ "implementation" ]
c3f080681e3da5e1290ef935ff91f364
The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) β€” the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g...
800
Print a single integer β€” the number of games Maxim will buy.
standard output
PASSED
1566eeefcb0c41737a597ceb7da0e683
train_002.jsonl
1531578900
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,...
256 megabytes
import java.util.Scanner; public class Ishu { public static void main(String[] args) { Scanner scan=new Scanner(System.in); int n,m,i,j=0,games=0; int[] c=new int[1000]; int[] a=new int[1000]; n=scan.nextInt(); m=scan.nextInt(); for(i=0;i<n;++i) c[i]=scan.nextInt(); for(i=0;i<m;++i) a[i]=scan.nextInt(); ...
Java
["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"]
1 second
["3", "0", "4"]
NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti...
Java 8
standard input
[ "implementation" ]
c3f080681e3da5e1290ef935ff91f364
The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) β€” the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g...
800
Print a single integer β€” the number of games Maxim will buy.
standard output
PASSED
9511648e68db38a80f9f222f28530c78
train_002.jsonl
1531578900
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,...
256 megabytes
import java.io.PrintWriter; import java.util.ArrayList; import java.util.Scanner; public class EducationalCodeforcesRound47_A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int[] kolVo = new int[sc.nex...
Java
["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"]
1 second
["3", "0", "4"]
NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti...
Java 8
standard input
[ "implementation" ]
c3f080681e3da5e1290ef935ff91f364
The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) β€” the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g...
800
Print a single integer β€” the number of games Maxim will buy.
standard output
PASSED
29b2e2674919bf8642e350da279494fc
train_002.jsonl
1531578900
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,...
256 megabytes
//package problem; import java.util.Scanner; public class array { public static void main(String[] args) { Scanner in_t=new Scanner(System.in); //Scanner in_t2=new Scanner(System.in); int t1=in_t.nextInt(); int t2=in_t.nextInt(); int count=0; //System.out.println(t1+" "+t2); int[] a1=new int[t1+1]; int[] a2=...
Java
["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"]
1 second
["3", "0", "4"]
NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti...
Java 8
standard input
[ "implementation" ]
c3f080681e3da5e1290ef935ff91f364
The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) β€” the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g...
800
Print a single integer β€” the number of games Maxim will buy.
standard output
PASSED
c692f747e08970355f0fd72bede466be
train_002.jsonl
1531578900
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,...
256 megabytes
import java.util.Scanner; import java.util.Arrays; public class x{ public static void main(String[] args){ Scanner in=new Scanner(System.in); int n=in.nextInt(),m=in.nextInt(); int[] a=new int[n],b=new int[m]; for(int i=0;i<n;i++) a[i]=in.nextInt(); for(int i=0;i...
Java
["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"]
1 second
["3", "0", "4"]
NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti...
Java 8
standard input
[ "implementation" ]
c3f080681e3da5e1290ef935ff91f364
The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) β€” the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g...
800
Print a single integer β€” the number of games Maxim will buy.
standard output
PASSED
85f24ce3f83ac24d3aa718fd7ad73f45
train_002.jsonl
1531578900
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,...
256 megabytes
import java.util.Scanner; import java.util.Arrays; public class x{ public static void main(String[] args){ Scanner in=new Scanner(System.in); int n=in.nextInt(),m=in.nextInt(); int[] a=new int[n],b=new int[m]; for(int i=0;i<n;i++) a[i]=in.nextInt(); for(int i=0;i...
Java
["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"]
1 second
["3", "0", "4"]
NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti...
Java 8
standard input
[ "implementation" ]
c3f080681e3da5e1290ef935ff91f364
The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) β€” the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g...
800
Print a single integer β€” the number of games Maxim will buy.
standard output
PASSED
6e1eaaa7a92371f62c7a88a6390bb284
train_002.jsonl
1531578900
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String []args) { Scanner in = new Scanner(System.in); int numOfGames = in.nextInt(); int numOfBills = in.nextInt(); int [] gameCost = new int [numOfGames]; int [] billValue = new int [numOfBills]; for(int i=0;i<numOfGames;...
Java
["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"]
1 second
["3", "0", "4"]
NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti...
Java 8
standard input
[ "implementation" ]
c3f080681e3da5e1290ef935ff91f364
The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) β€” the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g...
800
Print a single integer β€” the number of games Maxim will buy.
standard output
PASSED
c2a8148edf6a48d5a974856b40143839
train_002.jsonl
1531578900
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,...
256 megabytes
import javafx.util.*; import java.util.*; import java.io.*; import java.math.*; public class Test5 { static StreamTokenizer st = new StreamTokenizer(new InputStreamReader(System.in)); public static void main(String[] z) throws Exception { Scanner s = new Scanner(System.in); PrintWriter pw =...
Java
["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"]
1 second
["3", "0", "4"]
NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti...
Java 8
standard input
[ "implementation" ]
c3f080681e3da5e1290ef935ff91f364
The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) β€” the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g...
800
Print a single integer β€” the number of games Maxim will buy.
standard output
PASSED
b246437a6079c67c0ebabde2bcfbbaa2
train_002.jsonl
1531578900
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,...
256 megabytes
import java.util.Scanner; public class testt { public static void main(String[] args) { Scanner in = new Scanner(System.in); int NumberOfGames,NumberOfBills,Counter=0,k=0; NumberOfGames=in.nextInt(); NumberOfBills=in.nextInt(); int[] Games = new int[NumberOfGames]; int[] Bills = new int[NumberOfBills]; ...
Java
["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"]
1 second
["3", "0", "4"]
NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti...
Java 8
standard input
[ "implementation" ]
c3f080681e3da5e1290ef935ff91f364
The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) β€” the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g...
800
Print a single integer β€” the number of games Maxim will buy.
standard output
PASSED
4355837fd46de6fda4123d8688d6bcdc
train_002.jsonl
1531578900
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,...
256 megabytes
import java.util.LinkedList; import java.util.Scanner; public class A1009 { public static void main(String q[]){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(),m=sc.nextInt(); int ar[]=new int[n]; for (int i=0;i<n;i++) ar[i]=sc.nextInt(); LinkedList<Intege...
Java
["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"]
1 second
["3", "0", "4"]
NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti...
Java 8
standard input
[ "implementation" ]
c3f080681e3da5e1290ef935ff91f364
The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) β€” the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g...
800
Print a single integer β€” the number of games Maxim will buy.
standard output
PASSED
e626e6c679988cca4e2a8c256deaec05
train_002.jsonl
1531578900
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Game { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int cost[] = new int[n]; int wallet[] = new int[m]; for (int i=0; ...
Java
["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"]
1 second
["3", "0", "4"]
NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti...
Java 8
standard input
[ "implementation" ]
c3f080681e3da5e1290ef935ff91f364
The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) β€” the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g...
800
Print a single integer β€” the number of games Maxim will buy.
standard output
PASSED
4e09c74866d5360dc5de12e35806e074
train_002.jsonl
1531578900
Maxim wants to buy some games at the local game shop. There are $$$n$$$ games in the shop, the $$$i$$$-th game costs $$$c_i$$$.Maxim has a wallet which can be represented as an array of integers. His wallet contains $$$m$$$ bills, the $$$j$$$-th bill has value $$$a_j$$$.Games in the shop are ordered from left to right,...
256 megabytes
import java.util.Arrays; import java.util.Scanner; import java.io.*; import java.io.BufferedWriter; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.util.Scanner; import java.util.*; import java.util.LinkedList; public class hackerearth{ public static void main...
Java
["5 4\n2 4 5 2 4\n5 3 4 6", "5 2\n20 40 50 20 40\n19 20", "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000"]
1 second
["3", "0", "4"]
NoteThe first example is described in the problem statement.In the second example Maxim cannot buy any game because the value of the first bill in his wallet is smaller than the cost of any game in the shop.In the third example the values of the bills in Maxim's wallet are large enough to buy any game he encounter unti...
Java 8
standard input
[ "implementation" ]
c3f080681e3da5e1290ef935ff91f364
The first line of the input contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) β€” the number of games and the number of bills in Maxim's wallet. The second line of the input contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 1000$$$), where $$$c_i$$$ is the cost of the $$$i$$$-th g...
800
Print a single integer β€” the number of games Maxim will buy.
standard output
PASSED
e0c15d4b1f41112803f280f8ac0cf904
train_002.jsonl
1444149000
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.More formally, you are given two strings s1, s2 of length n and number t. Let's denote as f(a, b) the number of characters in which strings a and b ...
256 megabytes
import java.io.IOException; import java.util.ArrayList; import java.util.InputMismatchException; public class MarinaAndVasya { public static void main(String[] args) { FasterScanner sc = new FasterScanner(); int N = sc.nextInt(); int T = sc.nextInt(); char[] S1 = sc.nextLin...
Java
["3 2\nabc\nxyc", "1 0\nc\nb"]
1 second
["ayd", "-1"]
null
Java 8
standard input
[ "constructive algorithms", "greedy", "strings" ]
8ba3a7f7cb955478481c74cd4a4eed14
The first line contains two integers n and t (1 ≀ n ≀ 105, 0 ≀ t ≀ n). The second line contains string s1 of length n, consisting of lowercase English letters. The third line contain string s2 of length n, consisting of lowercase English letters.
1,700
Print a string of length n, differing from string s1 and from s2 in exactly t characters. Your string should consist only from lowercase English letters. If such string doesn't exist, print -1.
standard output
PASSED
ac9670c510739365b4ab48230a08af70
train_002.jsonl
1444149000
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.More formally, you are given two strings s1, s2 of length n and number t. Let's denote as f(a, b) the number of characters in which strings a and b ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.io.Writer; impo...
Java
["3 2\nabc\nxyc", "1 0\nc\nb"]
1 second
["ayd", "-1"]
null
Java 8
standard input
[ "constructive algorithms", "greedy", "strings" ]
8ba3a7f7cb955478481c74cd4a4eed14
The first line contains two integers n and t (1 ≀ n ≀ 105, 0 ≀ t ≀ n). The second line contains string s1 of length n, consisting of lowercase English letters. The third line contain string s2 of length n, consisting of lowercase English letters.
1,700
Print a string of length n, differing from string s1 and from s2 in exactly t characters. Your string should consist only from lowercase English letters. If such string doesn't exist, print -1.
standard output
PASSED
4ad3c1a79c0fd68623c6864a6c283f15
train_002.jsonl
1444149000
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.More formally, you are given two strings s1, s2 of length n and number t. Let's denote as f(a, b) the number of characters in which strings a and b ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /** * Created by pallavi on 6/10/15. */ public class B584 { static int n; static int t; public static char df(char a, char b) { int aa = a-97; int bb = b-97; int cc = (aa+1)%26; if...
Java
["3 2\nabc\nxyc", "1 0\nc\nb"]
1 second
["ayd", "-1"]
null
Java 8
standard input
[ "constructive algorithms", "greedy", "strings" ]
8ba3a7f7cb955478481c74cd4a4eed14
The first line contains two integers n and t (1 ≀ n ≀ 105, 0 ≀ t ≀ n). The second line contains string s1 of length n, consisting of lowercase English letters. The third line contain string s2 of length n, consisting of lowercase English letters.
1,700
Print a string of length n, differing from string s1 and from s2 in exactly t characters. Your string should consist only from lowercase English letters. If such string doesn't exist, print -1.
standard output
PASSED
b67502c488276e65eadc3d363124f325
train_002.jsonl
1444149000
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.More formally, you are given two strings s1, s2 of length n and number t. Let's denote as f(a, b) the number of characters in which strings a and b ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class TaskC { public static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); public static StringTokenizer tok; public static int nextInt() throws...
Java
["3 2\nabc\nxyc", "1 0\nc\nb"]
1 second
["ayd", "-1"]
null
Java 8
standard input
[ "constructive algorithms", "greedy", "strings" ]
8ba3a7f7cb955478481c74cd4a4eed14
The first line contains two integers n and t (1 ≀ n ≀ 105, 0 ≀ t ≀ n). The second line contains string s1 of length n, consisting of lowercase English letters. The third line contain string s2 of length n, consisting of lowercase English letters.
1,700
Print a string of length n, differing from string s1 and from s2 in exactly t characters. Your string should consist only from lowercase English letters. If such string doesn't exist, print -1.
standard output
PASSED
d66dd2528830890554300c2e7bb5787f
train_002.jsonl
1444149000
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.More formally, you are given two strings s1, s2 of length n and number t. Let's denote as f(a, b) the number of characters in which strings a and b ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; public class Prob03 { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] s0=br.readLine().split(" ");int n = Integer.parseInt(s0[0]);int t...
Java
["3 2\nabc\nxyc", "1 0\nc\nb"]
1 second
["ayd", "-1"]
null
Java 8
standard input
[ "constructive algorithms", "greedy", "strings" ]
8ba3a7f7cb955478481c74cd4a4eed14
The first line contains two integers n and t (1 ≀ n ≀ 105, 0 ≀ t ≀ n). The second line contains string s1 of length n, consisting of lowercase English letters. The third line contain string s2 of length n, consisting of lowercase English letters.
1,700
Print a string of length n, differing from string s1 and from s2 in exactly t characters. Your string should consist only from lowercase English letters. If such string doesn't exist, print -1.
standard output
PASSED
9acf1690dd82f30fd4c0fd91bf4703b4
train_002.jsonl
1444149000
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.More formally, you are given two strings s1, s2 of length n and number t. Let's denote as f(a, b) the number of characters in which strings a and b ...
256 megabytes
import java.io.*; import java.util.*; public class Main { static InputReader in; static PrintWriter out; public static void main(String[] args) throws IOException{ //InputStream ins = new FileInputStream("E:\\rush.txt"); InputStream ins = System.in; in = new Input...
Java
["3 2\nabc\nxyc", "1 0\nc\nb"]
1 second
["ayd", "-1"]
null
Java 8
standard input
[ "constructive algorithms", "greedy", "strings" ]
8ba3a7f7cb955478481c74cd4a4eed14
The first line contains two integers n and t (1 ≀ n ≀ 105, 0 ≀ t ≀ n). The second line contains string s1 of length n, consisting of lowercase English letters. The third line contain string s2 of length n, consisting of lowercase English letters.
1,700
Print a string of length n, differing from string s1 and from s2 in exactly t characters. Your string should consist only from lowercase English letters. If such string doesn't exist, print -1.
standard output
PASSED
808e46f140029d6b5209e521c22241e2
train_002.jsonl
1444149000
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.More formally, you are given two strings s1, s2 of length n and number t. Let's denote as f(a, b) the number of characters in which strings a and b ...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class Div2_324_B { public static void main(String[] args) throws IOException { BufferedInputStream bis = new BufferedInputStream(System.in); BufferedReader br = new BufferedReader(new InputStreamReader(bis)); StringTokenizer s...
Java
["3 2\nabc\nxyc", "1 0\nc\nb"]
1 second
["ayd", "-1"]
null
Java 8
standard input
[ "constructive algorithms", "greedy", "strings" ]
8ba3a7f7cb955478481c74cd4a4eed14
The first line contains two integers n and t (1 ≀ n ≀ 105, 0 ≀ t ≀ n). The second line contains string s1 of length n, consisting of lowercase English letters. The third line contain string s2 of length n, consisting of lowercase English letters.
1,700
Print a string of length n, differing from string s1 and from s2 in exactly t characters. Your string should consist only from lowercase English letters. If such string doesn't exist, print -1.
standard output
PASSED
da392e17c2131a6825c78e173b0d3418
train_002.jsonl
1444149000
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.More formally, you are given two strings s1, s2 of length n and number t. Let's denote as f(a, b) the number of characters in which strings a and b ...
256 megabytes
import javax.swing.text.MutableAttributeSet; import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { Scanner input = new Scanner(System.in); int n = input.nextInt(); int t = input.nextInt(); input.nextLine(...
Java
["3 2\nabc\nxyc", "1 0\nc\nb"]
1 second
["ayd", "-1"]
null
Java 8
standard input
[ "constructive algorithms", "greedy", "strings" ]
8ba3a7f7cb955478481c74cd4a4eed14
The first line contains two integers n and t (1 ≀ n ≀ 105, 0 ≀ t ≀ n). The second line contains string s1 of length n, consisting of lowercase English letters. The third line contain string s2 of length n, consisting of lowercase English letters.
1,700
Print a string of length n, differing from string s1 and from s2 in exactly t characters. Your string should consist only from lowercase English letters. If such string doesn't exist, print -1.
standard output
PASSED
7cc033fc2b9f285e6beafc82a7a4387d
train_002.jsonl
1444149000
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.More formally, you are given two strings s1, s2 of length n and number t. Let's denote as f(a, b) the number of characters in which strings a and b ...
256 megabytes
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; import java.lang.*; public class Third { //static long m=1000000007; static BigInteger ways(int N, int K) { BigInteger ret = BigInteger.ONE; for(int i=N;i>=N-K+1;i--) { ...
Java
["3 2\nabc\nxyc", "1 0\nc\nb"]
1 second
["ayd", "-1"]
null
Java 8
standard input
[ "constructive algorithms", "greedy", "strings" ]
8ba3a7f7cb955478481c74cd4a4eed14
The first line contains two integers n and t (1 ≀ n ≀ 105, 0 ≀ t ≀ n). The second line contains string s1 of length n, consisting of lowercase English letters. The third line contain string s2 of length n, consisting of lowercase English letters.
1,700
Print a string of length n, differing from string s1 and from s2 in exactly t characters. Your string should consist only from lowercase English letters. If such string doesn't exist, print -1.
standard output
PASSED
371733cf309334673a444d724163c269
train_002.jsonl
1444149000
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.More formally, you are given two strings s1, s2 of length n and number t. Let's denote as f(a, b) the number of characters in which strings a and b ...
256 megabytes
import java.util.*; public class C { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = n - in.nextInt(); in.nextLine(); String s1 = in.nextLine(); String s2 = in.nextLine(); int d = 0; for (int i = 0; i < n; i++) if (s1.charAt(i) != s2.char...
Java
["3 2\nabc\nxyc", "1 0\nc\nb"]
1 second
["ayd", "-1"]
null
Java 8
standard input
[ "constructive algorithms", "greedy", "strings" ]
8ba3a7f7cb955478481c74cd4a4eed14
The first line contains two integers n and t (1 ≀ n ≀ 105, 0 ≀ t ≀ n). The second line contains string s1 of length n, consisting of lowercase English letters. The third line contain string s2 of length n, consisting of lowercase English letters.
1,700
Print a string of length n, differing from string s1 and from s2 in exactly t characters. Your string should consist only from lowercase English letters. If such string doesn't exist, print -1.
standard output
PASSED
0f9c74bddf896e11f339792d30c73369
train_002.jsonl
1444149000
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.More formally, you are given two strings s1, s2 of length n and number t. Let's denote as f(a, b) the number of characters in which strings a and b ...
256 megabytes
import java.io.BufferedReader; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.Map; import java.util....
Java
["3 2\nabc\nxyc", "1 0\nc\nb"]
1 second
["ayd", "-1"]
null
Java 8
standard input
[ "constructive algorithms", "greedy", "strings" ]
8ba3a7f7cb955478481c74cd4a4eed14
The first line contains two integers n and t (1 ≀ n ≀ 105, 0 ≀ t ≀ n). The second line contains string s1 of length n, consisting of lowercase English letters. The third line contain string s2 of length n, consisting of lowercase English letters.
1,700
Print a string of length n, differing from string s1 and from s2 in exactly t characters. Your string should consist only from lowercase English letters. If such string doesn't exist, print -1.
standard output
PASSED
e69f4551a5821eb17d90185f00181668
train_002.jsonl
1444149000
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.More formally, you are given two strings s1, s2 of length n and number t. Let's denote as f(a, b) the number of characters in which strings a and b ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; public class MarinaAndVasya { public static char diffChar(char c1,char c2) { if (c1==c2) { if (c1 == 'a') return 'b'; return 'a'; } if (c1!='a' ...
Java
["3 2\nabc\nxyc", "1 0\nc\nb"]
1 second
["ayd", "-1"]
null
Java 8
standard input
[ "constructive algorithms", "greedy", "strings" ]
8ba3a7f7cb955478481c74cd4a4eed14
The first line contains two integers n and t (1 ≀ n ≀ 105, 0 ≀ t ≀ n). The second line contains string s1 of length n, consisting of lowercase English letters. The third line contain string s2 of length n, consisting of lowercase English letters.
1,700
Print a string of length n, differing from string s1 and from s2 in exactly t characters. Your string should consist only from lowercase English letters. If such string doesn't exist, print -1.
standard output
PASSED
6d5f876bcf925ba79159dc58faec24fe
train_002.jsonl
1444149000
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.More formally, you are given two strings s1, s2 of length n and number t. Let's denote as f(a, b) the number of characters in which strings a and b ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { Input...
Java
["3 2\nabc\nxyc", "1 0\nc\nb"]
1 second
["ayd", "-1"]
null
Java 8
standard input
[ "constructive algorithms", "greedy", "strings" ]
8ba3a7f7cb955478481c74cd4a4eed14
The first line contains two integers n and t (1 ≀ n ≀ 105, 0 ≀ t ≀ n). The second line contains string s1 of length n, consisting of lowercase English letters. The third line contain string s2 of length n, consisting of lowercase English letters.
1,700
Print a string of length n, differing from string s1 and from s2 in exactly t characters. Your string should consist only from lowercase English letters. If such string doesn't exist, print -1.
standard output
PASSED
6202e1f7eab43e4a29f5c2547b0623ae
train_002.jsonl
1444149000
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.More formally, you are given two strings s1, s2 of length n and number t. Let's denote as f(a, b) the number of characters in which strings a and b ...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main1 { static class Reader { private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;} public int read() {if (n...
Java
["3 2\nabc\nxyc", "1 0\nc\nb"]
1 second
["ayd", "-1"]
null
Java 8
standard input
[ "constructive algorithms", "greedy", "strings" ]
8ba3a7f7cb955478481c74cd4a4eed14
The first line contains two integers n and t (1 ≀ n ≀ 105, 0 ≀ t ≀ n). The second line contains string s1 of length n, consisting of lowercase English letters. The third line contain string s2 of length n, consisting of lowercase English letters.
1,700
Print a string of length n, differing from string s1 and from s2 in exactly t characters. Your string should consist only from lowercase English letters. If such string doesn't exist, print -1.
standard output
PASSED
7f3696dfffa9ab3ec1f2594502520d14
train_002.jsonl
1444149000
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.More formally, you are given two strings s1, s2 of length n and number t. Let's denote as f(a, b) the number of characters in which strings a and b ...
256 megabytes
import java.io.InputStream; import java.io.OutputStream; import java.io.IOException; import java.util.LinkedList; import java.io.InputStream; import java.io.BufferedReader; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStreamReader; import java.io.IOException; /** * Built using CHe...
Java
["3 2\nabc\nxyc", "1 0\nc\nb"]
1 second
["ayd", "-1"]
null
Java 8
standard input
[ "constructive algorithms", "greedy", "strings" ]
8ba3a7f7cb955478481c74cd4a4eed14
The first line contains two integers n and t (1 ≀ n ≀ 105, 0 ≀ t ≀ n). The second line contains string s1 of length n, consisting of lowercase English letters. The third line contain string s2 of length n, consisting of lowercase English letters.
1,700
Print a string of length n, differing from string s1 and from s2 in exactly t characters. Your string should consist only from lowercase English letters. If such string doesn't exist, print -1.
standard output
PASSED
2144111872730da089d10cf2e685bad2
train_002.jsonl
1444149000
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.More formally, you are given two strings s1, s2 of length n and number t. Let's denote as f(a, b) the number of characters in which strings a and b ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; public class C { public static void main(String[] args) throws Exception { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); String[] l = bf.readLine().split(" "); int n = Integer.parseInt(l[0]); ...
Java
["3 2\nabc\nxyc", "1 0\nc\nb"]
1 second
["ayd", "-1"]
null
Java 8
standard input
[ "constructive algorithms", "greedy", "strings" ]
8ba3a7f7cb955478481c74cd4a4eed14
The first line contains two integers n and t (1 ≀ n ≀ 105, 0 ≀ t ≀ n). The second line contains string s1 of length n, consisting of lowercase English letters. The third line contain string s2 of length n, consisting of lowercase English letters.
1,700
Print a string of length n, differing from string s1 and from s2 in exactly t characters. Your string should consist only from lowercase English letters. If such string doesn't exist, print -1.
standard output
PASSED
03e4417b4c35d3359fc186585e471522
train_002.jsonl
1444149000
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.More formally, you are given two strings s1, s2 of length n and number t. Let's denote as f(a, b) the number of characters in which strings a and b ...
256 megabytes
import java.util.Scanner; public class MarinaandVasya { private static int countDifferences (String s1, String s2) { int count = 0; for (int i = 0 ; i < s1.length(); i++) { if (s1.charAt(i) != s2.charAt(i)) { count++; } } return count ++; } static String solveMarinAndVasya (String s1, String s2, ...
Java
["3 2\nabc\nxyc", "1 0\nc\nb"]
1 second
["ayd", "-1"]
null
Java 8
standard input
[ "constructive algorithms", "greedy", "strings" ]
8ba3a7f7cb955478481c74cd4a4eed14
The first line contains two integers n and t (1 ≀ n ≀ 105, 0 ≀ t ≀ n). The second line contains string s1 of length n, consisting of lowercase English letters. The third line contain string s2 of length n, consisting of lowercase English letters.
1,700
Print a string of length n, differing from string s1 and from s2 in exactly t characters. Your string should consist only from lowercase English letters. If such string doesn't exist, print -1.
standard output
PASSED
3a4e51cab171c340fc6ed5a01d2f00d0
train_002.jsonl
1444149000
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.More formally, you are given two strings s1, s2 of length n and number t. Let's denote as f(a, b) the number of characters in which strings a and b ...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; public class Main { public static long mod= (long) (1e9 +7); public static void main(String args[]) { InputReader s= new InputReader(System.in); OutputStream outputStream= System.out; PrintWriter out= new PrintWriter(outputStream); int n= s.n...
Java
["3 2\nabc\nxyc", "1 0\nc\nb"]
1 second
["ayd", "-1"]
null
Java 8
standard input
[ "constructive algorithms", "greedy", "strings" ]
8ba3a7f7cb955478481c74cd4a4eed14
The first line contains two integers n and t (1 ≀ n ≀ 105, 0 ≀ t ≀ n). The second line contains string s1 of length n, consisting of lowercase English letters. The third line contain string s2 of length n, consisting of lowercase English letters.
1,700
Print a string of length n, differing from string s1 and from s2 in exactly t characters. Your string should consist only from lowercase English letters. If such string doesn't exist, print -1.
standard output
PASSED
8942fcdb43eaf8040e195cac70a7482d
train_002.jsonl
1444149000
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.More formally, you are given two strings s1, s2 of length n and number t. Let's denote as f(a, b) the number of characters in which strings a and b ...
256 megabytes
import java.io.*; import java.util.*; public class Main { BufferedReader br; PrintWriter out; StringTokenizer st; String next() throws IOException { while (st == null || !st.hasMoreTokens()) { String s = br.readLine(); st = new StringTokenizer(s); } ret...
Java
["3 2\nabc\nxyc", "1 0\nc\nb"]
1 second
["ayd", "-1"]
null
Java 8
standard input
[ "constructive algorithms", "greedy", "strings" ]
8ba3a7f7cb955478481c74cd4a4eed14
The first line contains two integers n and t (1 ≀ n ≀ 105, 0 ≀ t ≀ n). The second line contains string s1 of length n, consisting of lowercase English letters. The third line contain string s2 of length n, consisting of lowercase English letters.
1,700
Print a string of length n, differing from string s1 and from s2 in exactly t characters. Your string should consist only from lowercase English letters. If such string doesn't exist, print -1.
standard output
PASSED
770becd08e8f1a7517010b08f7ec4833
train_002.jsonl
1444149000
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.More formally, you are given two strings s1, s2 of length n and number t. Let's denote as f(a, b) the number of characters in which strings a and b ...
256 megabytes
import java.util.*; import java.math.*; import java.io.*; public class Luck{ public static InputReader sc; public static PrintWriter out; public static final long MOD = (long) (1e9 + 7); static int n; static int m; static int q; public static void main(String[] args){ sc=new InputReader(Sy...
Java
["3 2\nabc\nxyc", "1 0\nc\nb"]
1 second
["ayd", "-1"]
null
Java 8
standard input
[ "constructive algorithms", "greedy", "strings" ]
8ba3a7f7cb955478481c74cd4a4eed14
The first line contains two integers n and t (1 ≀ n ≀ 105, 0 ≀ t ≀ n). The second line contains string s1 of length n, consisting of lowercase English letters. The third line contain string s2 of length n, consisting of lowercase English letters.
1,700
Print a string of length n, differing from string s1 and from s2 in exactly t characters. Your string should consist only from lowercase English letters. If such string doesn't exist, print -1.
standard output
PASSED
1f2a200f320e7be2675896e7e4336ca4
train_002.jsonl
1444149000
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.More formally, you are given two strings s1, s2 of length n and number t. Let's denote as f(a, b) the number of characters in which strings a and b ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Random; import java.util.StringTokenizer; public class MarinaAndVasya { public static void main(String[] args) { FastReader fs = new FastReader(); int n = fs.nextInt(), t = fs.nextInt(); String a = fs...
Java
["3 2\nabc\nxyc", "1 0\nc\nb"]
1 second
["ayd", "-1"]
null
Java 8
standard input
[ "constructive algorithms", "greedy", "strings" ]
8ba3a7f7cb955478481c74cd4a4eed14
The first line contains two integers n and t (1 ≀ n ≀ 105, 0 ≀ t ≀ n). The second line contains string s1 of length n, consisting of lowercase English letters. The third line contain string s2 of length n, consisting of lowercase English letters.
1,700
Print a string of length n, differing from string s1 and from s2 in exactly t characters. Your string should consist only from lowercase English letters. If such string doesn't exist, print -1.
standard output
PASSED
a3bc6e1435658cab76aa7e2f08d5a524
train_002.jsonl
1444149000
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.More formally, you are given two strings s1, s2 of length n and number t. Let's denote as f(a, b) the number of characters in which strings a and b ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Java
["3 2\nabc\nxyc", "1 0\nc\nb"]
1 second
["ayd", "-1"]
null
Java 8
standard input
[ "constructive algorithms", "greedy", "strings" ]
8ba3a7f7cb955478481c74cd4a4eed14
The first line contains two integers n and t (1 ≀ n ≀ 105, 0 ≀ t ≀ n). The second line contains string s1 of length n, consisting of lowercase English letters. The third line contain string s2 of length n, consisting of lowercase English letters.
1,700
Print a string of length n, differing from string s1 and from s2 in exactly t characters. Your string should consist only from lowercase English letters. If such string doesn't exist, print -1.
standard output
PASSED
94cb96611cdc5c508c5056313e848381
train_002.jsonl
1444149000
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.More formally, you are given two strings s1, s2 of length n and number t. Let's denote as f(a, b) the number of characters in which strings a and b ...
256 megabytes
/** * Created by ckboss on 15-10-7. */ import java.util.*; public class CF584C { int n,t; int t1,t2; String s1,s2; StringBuffer s3; char getChar(char c1,char c2) { char c; for(c='a';c<='z';c++) { if(c!=c1&&c!=c2) { break; } } ...
Java
["3 2\nabc\nxyc", "1 0\nc\nb"]
1 second
["ayd", "-1"]
null
Java 8
standard input
[ "constructive algorithms", "greedy", "strings" ]
8ba3a7f7cb955478481c74cd4a4eed14
The first line contains two integers n and t (1 ≀ n ≀ 105, 0 ≀ t ≀ n). The second line contains string s1 of length n, consisting of lowercase English letters. The third line contain string s2 of length n, consisting of lowercase English letters.
1,700
Print a string of length n, differing from string s1 and from s2 in exactly t characters. Your string should consist only from lowercase English letters. If such string doesn't exist, print -1.
standard output
PASSED
a733b157fe382c7e7de16da4eeda9385
train_002.jsonl
1444149000
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.More formally, you are given two strings s1, s2 of length n and number t. Let's denote as f(a, b) the number of characters in which strings a and b ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; ...
Java
["3 2\nabc\nxyc", "1 0\nc\nb"]
1 second
["ayd", "-1"]
null
Java 8
standard input
[ "constructive algorithms", "greedy", "strings" ]
8ba3a7f7cb955478481c74cd4a4eed14
The first line contains two integers n and t (1 ≀ n ≀ 105, 0 ≀ t ≀ n). The second line contains string s1 of length n, consisting of lowercase English letters. The third line contain string s2 of length n, consisting of lowercase English letters.
1,700
Print a string of length n, differing from string s1 and from s2 in exactly t characters. Your string should consist only from lowercase English letters. If such string doesn't exist, print -1.
standard output
PASSED
b3da0ea13928acc2eb09bf4d627edf87
train_002.jsonl
1505833500
Mahmoud and Ehab continue their adventures! As everybody in the evil land knows, Dr. Evil likes bipartite graphs, especially trees.A tree is a connected acyclic graph. A bipartite graph is a graph, whose vertices can be partitioned into 2 sets in such a way, that for each edge (u, v) that belongs to the graph, u and v ...
256 megabytes
import java.io.*; import java.util.*; public class B { Inputter in = new Inputter(new BufferedReader(new InputStreamReader(System.in))); PrintWriter out = new PrintWriter(System.out); boolean debug = false; private void solve() { int n = in.nextInt(); List[] edges = new List[n + 1]; for (int i = ...
Java
["3\n1 2\n1 3", "5\n1 2\n2 3\n3 4\n4 5"]
2 seconds
["0", "2"]
NoteTree definition: https://en.wikipedia.org/wiki/Tree_(graph_theory)Bipartite graph definition: https://en.wikipedia.org/wiki/Bipartite_graphIn the first test case the only edge that can be added in such a way, that graph won't contain loops or multiple edges is (2, 3), but adding this edge will make the graph non-bi...
Java 8
standard input
[ "dfs and similar", "trees", "graphs" ]
44b9adcc9d672221bda3a1cada81b3d0
The first line of input contains an integer nΒ β€” the number of nodes in the tree (1 ≀ n ≀ 105). The next n - 1 lines contain integers u and v (1 ≀ u, v ≀ n, u ≠ v)Β β€” the description of the edges of the tree. It's guaranteed that the given graph is a tree.
1,300
Output one integerΒ β€” the maximum number of edges that Mahmoud and Ehab can add to the tree while fulfilling the conditions.
standard output
PASSED
628c928b0be23457542a2c7059d351b0
train_002.jsonl
1505833500
Mahmoud and Ehab continue their adventures! As everybody in the evil land knows, Dr. Evil likes bipartite graphs, especially trees.A tree is a connected acyclic graph. A bipartite graph is a graph, whose vertices can be partitioned into 2 sets in such a way, that for each edge (u, v) that belongs to the graph, u and v ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.StringTokenizer; public class B { public static void main(String[] args) { FastScanner scan = new FastScanner(); PrintWriter out = new PrintWriter...
Java
["3\n1 2\n1 3", "5\n1 2\n2 3\n3 4\n4 5"]
2 seconds
["0", "2"]
NoteTree definition: https://en.wikipedia.org/wiki/Tree_(graph_theory)Bipartite graph definition: https://en.wikipedia.org/wiki/Bipartite_graphIn the first test case the only edge that can be added in such a way, that graph won't contain loops or multiple edges is (2, 3), but adding this edge will make the graph non-bi...
Java 8
standard input
[ "dfs and similar", "trees", "graphs" ]
44b9adcc9d672221bda3a1cada81b3d0
The first line of input contains an integer nΒ β€” the number of nodes in the tree (1 ≀ n ≀ 105). The next n - 1 lines contain integers u and v (1 ≀ u, v ≀ n, u ≠ v)Β β€” the description of the edges of the tree. It's guaranteed that the given graph is a tree.
1,300
Output one integerΒ β€” the maximum number of edges that Mahmoud and Ehab can add to the tree while fulfilling the conditions.
standard output
PASSED
1b6ffea79cf5286c50ea270b74735ae1
train_002.jsonl
1505833500
Mahmoud and Ehab continue their adventures! As everybody in the evil land knows, Dr. Evil likes bipartite graphs, especially trees.A tree is a connected acyclic graph. A bipartite graph is a graph, whose vertices can be partitioned into 2 sets in such a way, that for each edge (u, v) that belongs to the graph, u and v ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; import java.util.StringTokenizer; public class Solution2 { ArrayList<ArrayList<Integer>> arr; long [] color = new l...
Java
["3\n1 2\n1 3", "5\n1 2\n2 3\n3 4\n4 5"]
2 seconds
["0", "2"]
NoteTree definition: https://en.wikipedia.org/wiki/Tree_(graph_theory)Bipartite graph definition: https://en.wikipedia.org/wiki/Bipartite_graphIn the first test case the only edge that can be added in such a way, that graph won't contain loops or multiple edges is (2, 3), but adding this edge will make the graph non-bi...
Java 8
standard input
[ "dfs and similar", "trees", "graphs" ]
44b9adcc9d672221bda3a1cada81b3d0
The first line of input contains an integer nΒ β€” the number of nodes in the tree (1 ≀ n ≀ 105). The next n - 1 lines contain integers u and v (1 ≀ u, v ≀ n, u ≠ v)Β β€” the description of the edges of the tree. It's guaranteed that the given graph is a tree.
1,300
Output one integerΒ β€” the maximum number of edges that Mahmoud and Ehab can add to the tree while fulfilling the conditions.
standard output
PASSED
6c06f5f2bb680659b7e89f182817c36f
train_002.jsonl
1505833500
Mahmoud and Ehab continue their adventures! As everybody in the evil land knows, Dr. Evil likes bipartite graphs, especially trees.A tree is a connected acyclic graph. A bipartite graph is a graph, whose vertices can be partitioned into 2 sets in such a way, that for each edge (u, v) that belongs to the graph, u and v ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; import java.util.StringTokenizer; public class Solution2 { ArrayList<ArrayList<Integer>> arr; long [] color = new l...
Java
["3\n1 2\n1 3", "5\n1 2\n2 3\n3 4\n4 5"]
2 seconds
["0", "2"]
NoteTree definition: https://en.wikipedia.org/wiki/Tree_(graph_theory)Bipartite graph definition: https://en.wikipedia.org/wiki/Bipartite_graphIn the first test case the only edge that can be added in such a way, that graph won't contain loops or multiple edges is (2, 3), but adding this edge will make the graph non-bi...
Java 8
standard input
[ "dfs and similar", "trees", "graphs" ]
44b9adcc9d672221bda3a1cada81b3d0
The first line of input contains an integer nΒ β€” the number of nodes in the tree (1 ≀ n ≀ 105). The next n - 1 lines contain integers u and v (1 ≀ u, v ≀ n, u ≠ v)Β β€” the description of the edges of the tree. It's guaranteed that the given graph is a tree.
1,300
Output one integerΒ β€” the maximum number of edges that Mahmoud and Ehab can add to the tree while fulfilling the conditions.
standard output
PASSED
0118752057bbbb69debd34fed9567096
train_002.jsonl
1505833500
Mahmoud and Ehab continue their adventures! As everybody in the evil land knows, Dr. Evil likes bipartite graphs, especially trees.A tree is a connected acyclic graph. A bipartite graph is a graph, whose vertices can be partitioned into 2 sets in such a way, that for each edge (u, v) that belongs to the graph, u and v ...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class loser { static class InputReader { public BufferedReader br; public StringTokenizer token; public InputReader(InputStream stream) { br=new BufferedReader(new InputStreamReader(stream),32768); ...
Java
["3\n1 2\n1 3", "5\n1 2\n2 3\n3 4\n4 5"]
2 seconds
["0", "2"]
NoteTree definition: https://en.wikipedia.org/wiki/Tree_(graph_theory)Bipartite graph definition: https://en.wikipedia.org/wiki/Bipartite_graphIn the first test case the only edge that can be added in such a way, that graph won't contain loops or multiple edges is (2, 3), but adding this edge will make the graph non-bi...
Java 8
standard input
[ "dfs and similar", "trees", "graphs" ]
44b9adcc9d672221bda3a1cada81b3d0
The first line of input contains an integer nΒ β€” the number of nodes in the tree (1 ≀ n ≀ 105). The next n - 1 lines contain integers u and v (1 ≀ u, v ≀ n, u ≠ v)Β β€” the description of the edges of the tree. It's guaranteed that the given graph is a tree.
1,300
Output one integerΒ β€” the maximum number of edges that Mahmoud and Ehab can add to the tree while fulfilling the conditions.
standard output
PASSED
1198fdceba3edc18f4d0e5240c4901de
train_002.jsonl
1505833500
Mahmoud and Ehab continue their adventures! As everybody in the evil land knows, Dr. Evil likes bipartite graphs, especially trees.A tree is a connected acyclic graph. A bipartite graph is a graph, whose vertices can be partitioned into 2 sets in such a way, that for each edge (u, v) that belongs to the graph, u and v ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.S...
Java
["3\n1 2\n1 3", "5\n1 2\n2 3\n3 4\n4 5"]
2 seconds
["0", "2"]
NoteTree definition: https://en.wikipedia.org/wiki/Tree_(graph_theory)Bipartite graph definition: https://en.wikipedia.org/wiki/Bipartite_graphIn the first test case the only edge that can be added in such a way, that graph won't contain loops or multiple edges is (2, 3), but adding this edge will make the graph non-bi...
Java 8
standard input
[ "dfs and similar", "trees", "graphs" ]
44b9adcc9d672221bda3a1cada81b3d0
The first line of input contains an integer nΒ β€” the number of nodes in the tree (1 ≀ n ≀ 105). The next n - 1 lines contain integers u and v (1 ≀ u, v ≀ n, u ≠ v)Β β€” the description of the edges of the tree. It's guaranteed that the given graph is a tree.
1,300
Output one integerΒ β€” the maximum number of edges that Mahmoud and Ehab can add to the tree while fulfilling the conditions.
standard output
PASSED
fa2be4e848b70a3dfe02b180e5e2a3ea
train_002.jsonl
1505833500
Mahmoud and Ehab continue their adventures! As everybody in the evil land knows, Dr. Evil likes bipartite graphs, especially trees.A tree is a connected acyclic graph. A bipartite graph is a graph, whose vertices can be partitioned into 2 sets in such a way, that for each edge (u, v) that belongs to the graph, u and v ...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; import java.text.DateFormat; import java.text.SimpleDateFormat; public class Main{ ArrayList<Integer>[] graph; Set<Integer>[] setGraph; public Main(int n){ graph = new ArrayList[n+1]; setGraph = new HashSet[n+1]; for(int...
Java
["3\n1 2\n1 3", "5\n1 2\n2 3\n3 4\n4 5"]
2 seconds
["0", "2"]
NoteTree definition: https://en.wikipedia.org/wiki/Tree_(graph_theory)Bipartite graph definition: https://en.wikipedia.org/wiki/Bipartite_graphIn the first test case the only edge that can be added in such a way, that graph won't contain loops or multiple edges is (2, 3), but adding this edge will make the graph non-bi...
Java 8
standard input
[ "dfs and similar", "trees", "graphs" ]
44b9adcc9d672221bda3a1cada81b3d0
The first line of input contains an integer nΒ β€” the number of nodes in the tree (1 ≀ n ≀ 105). The next n - 1 lines contain integers u and v (1 ≀ u, v ≀ n, u ≠ v)Β β€” the description of the edges of the tree. It's guaranteed that the given graph is a tree.
1,300
Output one integerΒ β€” the maximum number of edges that Mahmoud and Ehab can add to the tree while fulfilling the conditions.
standard output
PASSED
c5e4c8d4208beb7c8b7ef749ca00fd0b
train_002.jsonl
1505833500
Mahmoud and Ehab continue their adventures! As everybody in the evil land knows, Dr. Evil likes bipartite graphs, especially trees.A tree is a connected acyclic graph. A bipartite graph is a graph, whose vertices can be partitioned into 2 sets in such a way, that for each edge (u, v) that belongs to the graph, u and v ...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; import java.math.MathContext; public class Es { static class Pair implements Comparable { int first; double second; public Pair(int f, double s) { first = f; second = s; } public String toString()...
Java
["3\n1 2\n1 3", "5\n1 2\n2 3\n3 4\n4 5"]
2 seconds
["0", "2"]
NoteTree definition: https://en.wikipedia.org/wiki/Tree_(graph_theory)Bipartite graph definition: https://en.wikipedia.org/wiki/Bipartite_graphIn the first test case the only edge that can be added in such a way, that graph won't contain loops or multiple edges is (2, 3), but adding this edge will make the graph non-bi...
Java 8
standard input
[ "dfs and similar", "trees", "graphs" ]
44b9adcc9d672221bda3a1cada81b3d0
The first line of input contains an integer nΒ β€” the number of nodes in the tree (1 ≀ n ≀ 105). The next n - 1 lines contain integers u and v (1 ≀ u, v ≀ n, u ≠ v)Β β€” the description of the edges of the tree. It's guaranteed that the given graph is a tree.
1,300
Output one integerΒ β€” the maximum number of edges that Mahmoud and Ehab can add to the tree while fulfilling the conditions.
standard output
PASSED
aae949f11193f68efd0ebd426019dec6
train_002.jsonl
1505833500
Mahmoud and Ehab continue their adventures! As everybody in the evil land knows, Dr. Evil likes bipartite graphs, especially trees.A tree is a connected acyclic graph. A bipartite graph is a graph, whose vertices can be partitioned into 2 sets in such a way, that for each edge (u, v) that belongs to the graph, u and v ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.List; import java.util.Scanner; import java.util.ArrayList; /** * Built using CHelper plug-in * Actual solution is at the top * * @author Mouna Cheikhna */ public class Main { publ...
Java
["3\n1 2\n1 3", "5\n1 2\n2 3\n3 4\n4 5"]
2 seconds
["0", "2"]
NoteTree definition: https://en.wikipedia.org/wiki/Tree_(graph_theory)Bipartite graph definition: https://en.wikipedia.org/wiki/Bipartite_graphIn the first test case the only edge that can be added in such a way, that graph won't contain loops or multiple edges is (2, 3), but adding this edge will make the graph non-bi...
Java 8
standard input
[ "dfs and similar", "trees", "graphs" ]
44b9adcc9d672221bda3a1cada81b3d0
The first line of input contains an integer nΒ β€” the number of nodes in the tree (1 ≀ n ≀ 105). The next n - 1 lines contain integers u and v (1 ≀ u, v ≀ n, u ≠ v)Β β€” the description of the edges of the tree. It's guaranteed that the given graph is a tree.
1,300
Output one integerΒ β€” the maximum number of edges that Mahmoud and Ehab can add to the tree while fulfilling the conditions.
standard output
PASSED
604b44acb821433fa1633a9ac0c5063a
train_002.jsonl
1505833500
Mahmoud and Ehab continue their adventures! As everybody in the evil land knows, Dr. Evil likes bipartite graphs, especially trees.A tree is a connected acyclic graph. A bipartite graph is a graph, whose vertices can be partitioned into 2 sets in such a way, that for each edge (u, v) that belongs to the graph, u and v ...
256 megabytes
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); List<Integer> adj[] = new ArrayList[n + 2]; for(int i = 0; i <= n; i++){ adj[i] = new ArrayList<>(); } f...
Java
["3\n1 2\n1 3", "5\n1 2\n2 3\n3 4\n4 5"]
2 seconds
["0", "2"]
NoteTree definition: https://en.wikipedia.org/wiki/Tree_(graph_theory)Bipartite graph definition: https://en.wikipedia.org/wiki/Bipartite_graphIn the first test case the only edge that can be added in such a way, that graph won't contain loops or multiple edges is (2, 3), but adding this edge will make the graph non-bi...
Java 8
standard input
[ "dfs and similar", "trees", "graphs" ]
44b9adcc9d672221bda3a1cada81b3d0
The first line of input contains an integer nΒ β€” the number of nodes in the tree (1 ≀ n ≀ 105). The next n - 1 lines contain integers u and v (1 ≀ u, v ≀ n, u ≠ v)Β β€” the description of the edges of the tree. It's guaranteed that the given graph is a tree.
1,300
Output one integerΒ β€” the maximum number of edges that Mahmoud and Ehab can add to the tree while fulfilling the conditions.
standard output
PASSED
f0eff5948e3610eb93dc5c2b14503e9c
train_002.jsonl
1505833500
Mahmoud and Ehab continue their adventures! As everybody in the evil land knows, Dr. Evil likes bipartite graphs, especially trees.A tree is a connected acyclic graph. A bipartite graph is a graph, whose vertices can be partitioned into 2 sets in such a way, that for each edge (u, v) that belongs to the graph, u and v ...
256 megabytes
/** https://codeforces.com/problemset/problem/862/B * idea: dfs and similar: create sets of graph, * and check number of vertexes in set 2 that each vertex in set 1 can connect with. */ import java.util.Scanner; import java.util.HashSet; import java.util.ArrayList; import java.util.Deque; import java.util.Linked...
Java
["3\n1 2\n1 3", "5\n1 2\n2 3\n3 4\n4 5"]
2 seconds
["0", "2"]
NoteTree definition: https://en.wikipedia.org/wiki/Tree_(graph_theory)Bipartite graph definition: https://en.wikipedia.org/wiki/Bipartite_graphIn the first test case the only edge that can be added in such a way, that graph won't contain loops or multiple edges is (2, 3), but adding this edge will make the graph non-bi...
Java 8
standard input
[ "dfs and similar", "trees", "graphs" ]
44b9adcc9d672221bda3a1cada81b3d0
The first line of input contains an integer nΒ β€” the number of nodes in the tree (1 ≀ n ≀ 105). The next n - 1 lines contain integers u and v (1 ≀ u, v ≀ n, u ≠ v)Β β€” the description of the edges of the tree. It's guaranteed that the given graph is a tree.
1,300
Output one integerΒ β€” the maximum number of edges that Mahmoud and Ehab can add to the tree while fulfilling the conditions.
standard output
PASSED
2791938e004aa7b94012b9fe4120c759
train_002.jsonl
1505833500
Mahmoud and Ehab continue their adventures! As everybody in the evil land knows, Dr. Evil likes bipartite graphs, especially trees.A tree is a connected acyclic graph. A bipartite graph is a graph, whose vertices can be partitioned into 2 sets in such a way, that for each edge (u, v) that belongs to the graph, u and v ...
256 megabytes
import java.io.*; import java.lang.annotation.Native; import java.math.BigInteger; import java.util.*; import java.util.ArrayList; import java.util.Scanner; public class main { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new...
Java
["3\n1 2\n1 3", "5\n1 2\n2 3\n3 4\n4 5"]
2 seconds
["0", "2"]
NoteTree definition: https://en.wikipedia.org/wiki/Tree_(graph_theory)Bipartite graph definition: https://en.wikipedia.org/wiki/Bipartite_graphIn the first test case the only edge that can be added in such a way, that graph won't contain loops or multiple edges is (2, 3), but adding this edge will make the graph non-bi...
Java 8
standard input
[ "dfs and similar", "trees", "graphs" ]
44b9adcc9d672221bda3a1cada81b3d0
The first line of input contains an integer nΒ β€” the number of nodes in the tree (1 ≀ n ≀ 105). The next n - 1 lines contain integers u and v (1 ≀ u, v ≀ n, u ≠ v)Β β€” the description of the edges of the tree. It's guaranteed that the given graph is a tree.
1,300
Output one integerΒ β€” the maximum number of edges that Mahmoud and Ehab can add to the tree while fulfilling the conditions.
standard output
PASSED
0bd8a4a0cda5118ea4b99b42254fe72a
train_002.jsonl
1505833500
Mahmoud and Ehab continue their adventures! As everybody in the evil land knows, Dr. Evil likes bipartite graphs, especially trees.A tree is a connected acyclic graph. A bipartite graph is a graph, whose vertices can be partitioned into 2 sets in such a way, that for each edge (u, v) that belongs to the graph, u and v ...
256 megabytes
import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.regex.*; import java.util.Arrays; import java.util.ArrayList; import java.lang.Math; import java.util.Arrays; import java.util.Comparator; public class Main { ...
Java
["3\n1 2\n1 3", "5\n1 2\n2 3\n3 4\n4 5"]
2 seconds
["0", "2"]
NoteTree definition: https://en.wikipedia.org/wiki/Tree_(graph_theory)Bipartite graph definition: https://en.wikipedia.org/wiki/Bipartite_graphIn the first test case the only edge that can be added in such a way, that graph won't contain loops or multiple edges is (2, 3), but adding this edge will make the graph non-bi...
Java 8
standard input
[ "dfs and similar", "trees", "graphs" ]
44b9adcc9d672221bda3a1cada81b3d0
The first line of input contains an integer nΒ β€” the number of nodes in the tree (1 ≀ n ≀ 105). The next n - 1 lines contain integers u and v (1 ≀ u, v ≀ n, u ≠ v)Β β€” the description of the edges of the tree. It's guaranteed that the given graph is a tree.
1,300
Output one integerΒ β€” the maximum number of edges that Mahmoud and Ehab can add to the tree while fulfilling the conditions.
standard output
PASSED
17b6d387c5b5a4700ab0e6ba3d175a01
train_002.jsonl
1505833500
Mahmoud and Ehab continue their adventures! As everybody in the evil land knows, Dr. Evil likes bipartite graphs, especially trees.A tree is a connected acyclic graph. A bipartite graph is a graph, whose vertices can be partitioned into 2 sets in such a way, that for each edge (u, v) that belongs to the graph, u and v ...
256 megabytes
import java.util.Scanner; import java.util.ArrayList; import java.util.LinkedList; import java.util.Queue; public class thing{ static class pair { int a,b; pair(int a,int b) { this.a = a; this.b = b; } } public static void main(String[] args){ ...
Java
["3\n1 2\n1 3", "5\n1 2\n2 3\n3 4\n4 5"]
2 seconds
["0", "2"]
NoteTree definition: https://en.wikipedia.org/wiki/Tree_(graph_theory)Bipartite graph definition: https://en.wikipedia.org/wiki/Bipartite_graphIn the first test case the only edge that can be added in such a way, that graph won't contain loops or multiple edges is (2, 3), but adding this edge will make the graph non-bi...
Java 8
standard input
[ "dfs and similar", "trees", "graphs" ]
44b9adcc9d672221bda3a1cada81b3d0
The first line of input contains an integer nΒ β€” the number of nodes in the tree (1 ≀ n ≀ 105). The next n - 1 lines contain integers u and v (1 ≀ u, v ≀ n, u ≠ v)Β β€” the description of the edges of the tree. It's guaranteed that the given graph is a tree.
1,300
Output one integerΒ β€” the maximum number of edges that Mahmoud and Ehab can add to the tree while fulfilling the conditions.
standard output
PASSED
942571506c3e1bc553c34dad0ccc07de
train_002.jsonl
1505833500
Mahmoud and Ehab continue their adventures! As everybody in the evil land knows, Dr. Evil likes bipartite graphs, especially trees.A tree is a connected acyclic graph. A bipartite graph is a graph, whose vertices can be partitioned into 2 sets in such a way, that for each edge (u, v) that belongs to the graph, u and v ...
256 megabytes
import java.io.*; import java.util.*; public class CF4352 { static long[] count=new long[2]; static LinkedList<Integer> a[]=new LinkedList[100005]; static int visited[]=new int[100005]; public static void main(String[] args)throws IOException { BufferedReader br=new BufferedReader(new InputS...
Java
["3\n1 2\n1 3", "5\n1 2\n2 3\n3 4\n4 5"]
2 seconds
["0", "2"]
NoteTree definition: https://en.wikipedia.org/wiki/Tree_(graph_theory)Bipartite graph definition: https://en.wikipedia.org/wiki/Bipartite_graphIn the first test case the only edge that can be added in such a way, that graph won't contain loops or multiple edges is (2, 3), but adding this edge will make the graph non-bi...
Java 8
standard input
[ "dfs and similar", "trees", "graphs" ]
44b9adcc9d672221bda3a1cada81b3d0
The first line of input contains an integer nΒ β€” the number of nodes in the tree (1 ≀ n ≀ 105). The next n - 1 lines contain integers u and v (1 ≀ u, v ≀ n, u ≠ v)Β β€” the description of the edges of the tree. It's guaranteed that the given graph is a tree.
1,300
Output one integerΒ β€” the maximum number of edges that Mahmoud and Ehab can add to the tree while fulfilling the conditions.
standard output
PASSED
393126c6a4e41fc5a37397044e96a2bb
train_002.jsonl
1505833500
Mahmoud and Ehab continue their adventures! As everybody in the evil land knows, Dr. Evil likes bipartite graphs, especially trees.A tree is a connected acyclic graph. A bipartite graph is a graph, whose vertices can be partitioned into 2 sets in such a way, that for each edge (u, v) that belongs to the graph, u and v ...
256 megabytes
import java.util.*; public class MahmoudBipartiteness { static ArrayList<Integer>[] graph; static int s1; static int s2; static boolean[] visited; public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int N = scanner.nextInt(); graph = new ArrayLi...
Java
["3\n1 2\n1 3", "5\n1 2\n2 3\n3 4\n4 5"]
2 seconds
["0", "2"]
NoteTree definition: https://en.wikipedia.org/wiki/Tree_(graph_theory)Bipartite graph definition: https://en.wikipedia.org/wiki/Bipartite_graphIn the first test case the only edge that can be added in such a way, that graph won't contain loops or multiple edges is (2, 3), but adding this edge will make the graph non-bi...
Java 8
standard input
[ "dfs and similar", "trees", "graphs" ]
44b9adcc9d672221bda3a1cada81b3d0
The first line of input contains an integer nΒ β€” the number of nodes in the tree (1 ≀ n ≀ 105). The next n - 1 lines contain integers u and v (1 ≀ u, v ≀ n, u ≠ v)Β β€” the description of the edges of the tree. It's guaranteed that the given graph is a tree.
1,300
Output one integerΒ β€” the maximum number of edges that Mahmoud and Ehab can add to the tree while fulfilling the conditions.
standard output
PASSED
af65e63e381de7c49ce1d0b14d3ce7a8
train_002.jsonl
1505833500
Mahmoud and Ehab continue their adventures! As everybody in the evil land knows, Dr. Evil likes bipartite graphs, especially trees.A tree is a connected acyclic graph. A bipartite graph is a graph, whose vertices can be partitioned into 2 sets in such a way, that for each edge (u, v) that belongs to the graph, u and v ...
256 megabytes
//package codeforce3; import java.math.BigInteger; import java.util.ArrayList; import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; import java.util.TreeSet; public class gragh { static class node { int v; boolean red; public node(int v, boolean red) { this.v = v; this.r...
Java
["3\n1 2\n1 3", "5\n1 2\n2 3\n3 4\n4 5"]
2 seconds
["0", "2"]
NoteTree definition: https://en.wikipedia.org/wiki/Tree_(graph_theory)Bipartite graph definition: https://en.wikipedia.org/wiki/Bipartite_graphIn the first test case the only edge that can be added in such a way, that graph won't contain loops or multiple edges is (2, 3), but adding this edge will make the graph non-bi...
Java 8
standard input
[ "dfs and similar", "trees", "graphs" ]
44b9adcc9d672221bda3a1cada81b3d0
The first line of input contains an integer nΒ β€” the number of nodes in the tree (1 ≀ n ≀ 105). The next n - 1 lines contain integers u and v (1 ≀ u, v ≀ n, u ≠ v)Β β€” the description of the edges of the tree. It's guaranteed that the given graph is a tree.
1,300
Output one integerΒ β€” the maximum number of edges that Mahmoud and Ehab can add to the tree while fulfilling the conditions.
standard output
PASSED
1db9dd037674a7e3a6ab298f5a7bdffe
train_002.jsonl
1363188600
The classic programming language of Bitland is Bit++. This language is so peculiar and complicated.The language is that peculiar as it has exactly one variable, called x. Also, there are two operations: Operation ++ increases the value of variable x by 1. Operation -- decreases the value of variable x by 1. A stateme...
256 megabytes
import java.util.*; public class MyClass { public static void main(String args[]) { Scanner f=new Scanner(System.in); int x=0; int g=f.nextInt(); char k='+'; char t='-'; char b; String s[]=new String[g]; for(int i=0; i<g; i++) { s[i]=f...
Java
["1\n++X", "2\nX++\n--X"]
1 second
["1", "0"]
null
Java 8
standard input
[ "implementation" ]
f3cf7726739290b280230b562cac7a74
The first line contains a single integer n (1 ≀ n ≀ 150) β€” the number of statements in the programme. Next n lines contain a statement each. Each statement contains exactly one operation (++ or --) and exactly one variable x (denoted as letter Β«XΒ»). Thus, there are no empty statements. The operation and the variable ca...
800
Print a single integer β€” the final value of x.
standard output
PASSED
96cd7bfd89ff64c01a5cef764e88635c
train_002.jsonl
1363188600
The classic programming language of Bitland is Bit++. This language is so peculiar and complicated.The language is that peculiar as it has exactly one variable, called x. Also, there are two operations: Operation ++ increases the value of variable x by 1. Operation -- decreases the value of variable x by 1. A stateme...
256 megabytes
import java.util.Scanner; public class A282BitPlusPlus { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = 0; n = in.nextInt(); int ans = 0; for (int i = 0; i < n; i++) { if (in.next().contains("+")) { ans++; } else { ans--; } } System.out.println(...
Java
["1\n++X", "2\nX++\n--X"]
1 second
["1", "0"]
null
Java 8
standard input
[ "implementation" ]
f3cf7726739290b280230b562cac7a74
The first line contains a single integer n (1 ≀ n ≀ 150) β€” the number of statements in the programme. Next n lines contain a statement each. Each statement contains exactly one operation (++ or --) and exactly one variable x (denoted as letter Β«XΒ»). Thus, there are no empty statements. The operation and the variable ca...
800
Print a single integer β€” the final value of x.
standard output
PASSED
589563a9ab0556c44b24701ac313d1cd
train_002.jsonl
1363188600
The classic programming language of Bitland is Bit++. This language is so peculiar and complicated.The language is that peculiar as it has exactly one variable, called x. Also, there are two operations: Operation ++ increases the value of variable x by 1. Operation -- decreases the value of variable x by 1. A stateme...
256 megabytes
import java.util.*; public class help { public static void main(String[] args) { Scanner in = new Scanner(System.in); int num = in.nextInt(); String stm = "",test=""; int var = 0; for (int i = 0; i < num; i++) { stm += in.next(); } for (int i = 0; i < stm.len...
Java
["1\n++X", "2\nX++\n--X"]
1 second
["1", "0"]
null
Java 8
standard input
[ "implementation" ]
f3cf7726739290b280230b562cac7a74
The first line contains a single integer n (1 ≀ n ≀ 150) β€” the number of statements in the programme. Next n lines contain a statement each. Each statement contains exactly one operation (++ or --) and exactly one variable x (denoted as letter Β«XΒ»). Thus, there are no empty statements. The operation and the variable ca...
800
Print a single integer β€” the final value of x.
standard output
PASSED
8bdfd8c9bba84ed78bb42f813de7862c
train_002.jsonl
1363188600
The classic programming language of Bitland is Bit++. This language is so peculiar and complicated.The language is that peculiar as it has exactly one variable, called x. Also, there are two operations: Operation ++ increases the value of variable x by 1. Operation -- decreases the value of variable x by 1. A stateme...
256 megabytes
import java.util.Scanner; public class Test{ public static void main(String args[]){ Scanner in =new Scanner(System.in); int T=in.nextInt(); String s; int x=0; while(T-->0){ s=in.next(); if((s.charAt(1))=='+') x++; else x--; } Syste...
Java
["1\n++X", "2\nX++\n--X"]
1 second
["1", "0"]
null
Java 8
standard input
[ "implementation" ]
f3cf7726739290b280230b562cac7a74
The first line contains a single integer n (1 ≀ n ≀ 150) β€” the number of statements in the programme. Next n lines contain a statement each. Each statement contains exactly one operation (++ or --) and exactly one variable x (denoted as letter Β«XΒ»). Thus, there are no empty statements. The operation and the variable ca...
800
Print a single integer β€” the final value of x.
standard output
PASSED
cb2491c1fb4b89c68c5d8def14a15f29
train_002.jsonl
1363188600
The classic programming language of Bitland is Bit++. This language is so peculiar and complicated.The language is that peculiar as it has exactly one variable, called x. Also, there are two operations: Operation ++ increases the value of variable x by 1. Operation -- decreases the value of variable x by 1. A stateme...
256 megabytes
import java.util.*; public class Bit_pp { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); sc.nextLine(); int x = 0; while(t-- > 0) { String str = sc.nextLine(); if(str.charAt(1) == '+') x++; else x--; } System.out.pr...
Java
["1\n++X", "2\nX++\n--X"]
1 second
["1", "0"]
null
Java 8
standard input
[ "implementation" ]
f3cf7726739290b280230b562cac7a74
The first line contains a single integer n (1 ≀ n ≀ 150) β€” the number of statements in the programme. Next n lines contain a statement each. Each statement contains exactly one operation (++ or --) and exactly one variable x (denoted as letter Β«XΒ»). Thus, there are no empty statements. The operation and the variable ca...
800
Print a single integer β€” the final value of x.
standard output
PASSED
89646efe397409ce8616b016c901667b
train_002.jsonl
1363188600
The classic programming language of Bitland is Bit++. This language is so peculiar and complicated.The language is that peculiar as it has exactly one variable, called x. Also, there are two operations: Operation ++ increases the value of variable x by 1. Operation -- decreases the value of variable x by 1. A stateme...
256 megabytes
import java.util.Scanner; public class bit { public static void main(String [ ] args){ Scanner input = new Scanner(System.in); int n = input.nextInt(); String x[] =new String[n] ; int sum =0; for (int i= 0; i <=n-1;i++){ x[i]= input.next(); x[i] = x...
Java
["1\n++X", "2\nX++\n--X"]
1 second
["1", "0"]
null
Java 8
standard input
[ "implementation" ]
f3cf7726739290b280230b562cac7a74
The first line contains a single integer n (1 ≀ n ≀ 150) β€” the number of statements in the programme. Next n lines contain a statement each. Each statement contains exactly one operation (++ or --) and exactly one variable x (denoted as letter Β«XΒ»). Thus, there are no empty statements. The operation and the variable ca...
800
Print a single integer β€” the final value of x.
standard output
PASSED
876d664079ec9a017524bc1823b31b48
train_002.jsonl
1363188600
The classic programming language of Bitland is Bit++. This language is so peculiar and complicated.The language is that peculiar as it has exactly one variable, called x. Also, there are two operations: Operation ++ increases the value of variable x by 1. Operation -- decreases the value of variable x by 1. A stateme...
256 megabytes
import java.util.Scanner; public class Bit{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int lines = sc.nextInt(); int num = 0; sc.nextLine(); for(int i = 0; i < lines; i++){ String k = sc.nextLine(); if(k.charAt(0) == '...
Java
["1\n++X", "2\nX++\n--X"]
1 second
["1", "0"]
null
Java 8
standard input
[ "implementation" ]
f3cf7726739290b280230b562cac7a74
The first line contains a single integer n (1 ≀ n ≀ 150) β€” the number of statements in the programme. Next n lines contain a statement each. Each statement contains exactly one operation (++ or --) and exactly one variable x (denoted as letter Β«XΒ»). Thus, there are no empty statements. The operation and the variable ca...
800
Print a single integer β€” the final value of x.
standard output
PASSED
455652937a1ba8b359bd55dbe83eaa6c
train_002.jsonl
1363188600
The classic programming language of Bitland is Bit++. This language is so peculiar and complicated.The language is that peculiar as it has exactly one variable, called x. Also, there are two operations: Operation ++ increases the value of variable x by 1. Operation -- decreases the value of variable x by 1. A stateme...
256 megabytes
import java.util.Scanner; public class first{ public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int s = 0; String a = "++X"; String b = "X++"; String str[] = new String[n]; for(int i = 0; i < n...
Java
["1\n++X", "2\nX++\n--X"]
1 second
["1", "0"]
null
Java 8
standard input
[ "implementation" ]
f3cf7726739290b280230b562cac7a74
The first line contains a single integer n (1 ≀ n ≀ 150) β€” the number of statements in the programme. Next n lines contain a statement each. Each statement contains exactly one operation (++ or --) and exactly one variable x (denoted as letter Β«XΒ»). Thus, there are no empty statements. The operation and the variable ca...
800
Print a single integer β€” the final value of x.
standard output
PASSED
be0ee8fd8241f7746c2619271f128f46
train_002.jsonl
1363188600
The classic programming language of Bitland is Bit++. This language is so peculiar and complicated.The language is that peculiar as it has exactly one variable, called x. Also, there are two operations: Operation ++ increases the value of variable x by 1. Operation -- decreases the value of variable x by 1. A stateme...
256 megabytes
/*import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner milan = new Scanner(System.in); int n=milan.nextInt(); int y=0; for(int i=0;i<n;i++){ String s=milan.nextLine(); if(s.charAt(1)=='+'){ ++y; ...
Java
["1\n++X", "2\nX++\n--X"]
1 second
["1", "0"]
null
Java 8
standard input
[ "implementation" ]
f3cf7726739290b280230b562cac7a74
The first line contains a single integer n (1 ≀ n ≀ 150) β€” the number of statements in the programme. Next n lines contain a statement each. Each statement contains exactly one operation (++ or --) and exactly one variable x (denoted as letter Β«XΒ»). Thus, there are no empty statements. The operation and the variable ca...
800
Print a single integer β€” the final value of x.
standard output
PASSED
21689e11d96387601a4608978559887b
train_002.jsonl
1363188600
The classic programming language of Bitland is Bit++. This language is so peculiar and complicated.The language is that peculiar as it has exactly one variable, called x. Also, there are two operations: Operation ++ increases the value of variable x by 1. Operation -- decreases the value of variable x by 1. A stateme...
256 megabytes
import java.util.Scanner; public class milann{ public static void main(String[] args){ Scanner milan = new Scanner(System.in); int n=milan.nextInt(); milan.nextLine(); int ans=0; for(int i=0;i<n;i++){ String s; s=milan.nextLine(); if(s.char...
Java
["1\n++X", "2\nX++\n--X"]
1 second
["1", "0"]
null
Java 8
standard input
[ "implementation" ]
f3cf7726739290b280230b562cac7a74
The first line contains a single integer n (1 ≀ n ≀ 150) β€” the number of statements in the programme. Next n lines contain a statement each. Each statement contains exactly one operation (++ or --) and exactly one variable x (denoted as letter Β«XΒ»). Thus, there are no empty statements. The operation and the variable ca...
800
Print a single integer β€” the final value of x.
standard output
PASSED
afad856e92fd38ac25e70e5892aa7950
train_002.jsonl
1363188600
The classic programming language of Bitland is Bit++. This language is so peculiar and complicated.The language is that peculiar as it has exactly one variable, called x. Also, there are two operations: Operation ++ increases the value of variable x by 1. Operation -- decreases the value of variable x by 1. A stateme...
256 megabytes
import java.util.*; public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x = 0; int input = sc.nextInt(); String s = ""; for (int i = 0; i < input; i ++) { s = sc.next(); for (int j = 0; j < input; j+...
Java
["1\n++X", "2\nX++\n--X"]
1 second
["1", "0"]
null
Java 8
standard input
[ "implementation" ]
f3cf7726739290b280230b562cac7a74
The first line contains a single integer n (1 ≀ n ≀ 150) β€” the number of statements in the programme. Next n lines contain a statement each. Each statement contains exactly one operation (++ or --) and exactly one variable x (denoted as letter Β«XΒ»). Thus, there are no empty statements. The operation and the variable ca...
800
Print a single integer β€” the final value of x.
standard output
PASSED
7dc8fe9f05a586938bb5487439b95fdb
train_002.jsonl
1363188600
The classic programming language of Bitland is Bit++. This language is so peculiar and complicated.The language is that peculiar as it has exactly one variable, called x. Also, there are two operations: Operation ++ increases the value of variable x by 1. Operation -- decreases the value of variable x by 1. A stateme...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner input = new Scanner(System.in); int n,x =0; n = input.nextInt(); String[] str = new String [n]; input.nextLine (); for(int i = 0;i<n;i++){ str[i] = input.nextLine (); switch(str[i]){ case "X++": ...
Java
["1\n++X", "2\nX++\n--X"]
1 second
["1", "0"]
null
Java 8
standard input
[ "implementation" ]
f3cf7726739290b280230b562cac7a74
The first line contains a single integer n (1 ≀ n ≀ 150) β€” the number of statements in the programme. Next n lines contain a statement each. Each statement contains exactly one operation (++ or --) and exactly one variable x (denoted as letter Β«XΒ»). Thus, there are no empty statements. The operation and the variable ca...
800
Print a single integer β€” the final value of x.
standard output
PASSED
5536cab8bf6134d5329d92ae815b0be8
train_002.jsonl
1533994500
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to the server room.The buil...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); long n, h, k, a, b, ta, fa, tb, fb, result=-1, min=0; n = in.nextLong(); h = in.nextLong(); a = in.nextLong(); ...
Java
["3 6 2 3 3\n1 2 1 3\n1 4 3 4\n1 2 2 3"]
1 second
["1\n4\n2"]
null
Java 8
standard input
[ "math" ]
bdce4761496c88a3de00aa863ba7308d
The first line of the input contains following integers: n: the number of towers in the building (1 ≀ n ≀ 108), h: the number of floors in each tower (1 ≀ h ≀ 108), a and b: the lowest and highest floor where it's possible to move between adjacent towers (1 ≀ a ≀ b ≀ h), k: total number of queries (1 ≀ k ≀ 104). ...
1,000
For each query print a single integer: the minimum walking time between the locations in minutes.
standard output
PASSED
0625caf6229827c784c7aebb6daa743c
train_002.jsonl
1533994500
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to the server room.The buil...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int h = sc.nextInt(); int a = sc.nextInt(); int b = sc.nextInt(); int k = sc.nextInt(); int[] result = new int[k...
Java
["3 6 2 3 3\n1 2 1 3\n1 4 3 4\n1 2 2 3"]
1 second
["1\n4\n2"]
null
Java 8
standard input
[ "math" ]
bdce4761496c88a3de00aa863ba7308d
The first line of the input contains following integers: n: the number of towers in the building (1 ≀ n ≀ 108), h: the number of floors in each tower (1 ≀ h ≀ 108), a and b: the lowest and highest floor where it's possible to move between adjacent towers (1 ≀ a ≀ b ≀ h), k: total number of queries (1 ≀ k ≀ 104). ...
1,000
For each query print a single integer: the minimum walking time between the locations in minutes.
standard output
PASSED
f0c0ccdc16cefbf1a0dd42b826e81960
train_002.jsonl
1533994500
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to the server room.The buil...
256 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 h = in.nextInt(); int a = in.nextInt(); int b = in.nextInt(); int k = in.nextInt(); while(k-->0) { int ta = in.nextInt(); int fa = in.nextInt(...
Java
["3 6 2 3 3\n1 2 1 3\n1 4 3 4\n1 2 2 3"]
1 second
["1\n4\n2"]
null
Java 8
standard input
[ "math" ]
bdce4761496c88a3de00aa863ba7308d
The first line of the input contains following integers: n: the number of towers in the building (1 ≀ n ≀ 108), h: the number of floors in each tower (1 ≀ h ≀ 108), a and b: the lowest and highest floor where it's possible to move between adjacent towers (1 ≀ a ≀ b ≀ h), k: total number of queries (1 ≀ k ≀ 104). ...
1,000
For each query print a single integer: the minimum walking time between the locations in minutes.
standard output
PASSED
bbf6ac62d3803e84a69411cc42c437e0
train_002.jsonl
1533994500
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to the server room.The buil...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Java
["3 6 2 3 3\n1 2 1 3\n1 4 3 4\n1 2 2 3"]
1 second
["1\n4\n2"]
null
Java 8
standard input
[ "math" ]
bdce4761496c88a3de00aa863ba7308d
The first line of the input contains following integers: n: the number of towers in the building (1 ≀ n ≀ 108), h: the number of floors in each tower (1 ≀ h ≀ 108), a and b: the lowest and highest floor where it's possible to move between adjacent towers (1 ≀ a ≀ b ≀ h), k: total number of queries (1 ≀ k ≀ 104). ...
1,000
For each query print a single integer: the minimum walking time between the locations in minutes.
standard output
PASSED
650c30f02a1832cc10e598d339fb9242
train_002.jsonl
1533994500
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lecture room to the canteen, or from the gym to the server room.The buil...
256 megabytes
import java.util.Scanner; public class New_Building_For_SIS { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int h = sc.nextInt(); int a = sc.nextInt(); int b = sc.nextInt(); int k = sc.nextInt(); int ausgabe[] = new int[k]; for (int i = 0; i < ...
Java
["3 6 2 3 3\n1 2 1 3\n1 4 3 4\n1 2 2 3"]
1 second
["1\n4\n2"]
null
Java 8
standard input
[ "math" ]
bdce4761496c88a3de00aa863ba7308d
The first line of the input contains following integers: n: the number of towers in the building (1 ≀ n ≀ 108), h: the number of floors in each tower (1 ≀ h ≀ 108), a and b: the lowest and highest floor where it's possible to move between adjacent towers (1 ≀ a ≀ b ≀ h), k: total number of queries (1 ≀ k ≀ 104). ...
1,000
For each query print a single integer: the minimum walking time between the locations in minutes.
standard output