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
bf796dc82595dfd171f9e206568d083b
train_003.jsonl
1299340800
Brothers Fred and George Weasley once got into the sporting goods store and opened a box of Quidditch balls. After long and painful experiments they found out that the Golden Snitch is not enchanted at all. It is simply a programmed device. It always moves along the same trajectory, which is a polyline with vertices at...
256 megabytes
import java.text.NumberFormat; import java.util.Scanner; public class C { Scanner sc; public void init(){ sc = new Scanner(System.in); formatter.setMaximumFractionDigits(10); formatter.setMinimumFractionDigits(10); formatter.setGroupingUsed(false); } NumberFormat formatter = NumberFormat.getNumberInstance(...
Java
["4\n0 0 0\n0 10 0\n10 10 0\n10 0 0\n0 0 0\n1 1\n5 5 25", "4\n0 0 0\n0 10 0\n10 10 0\n10 0 0\n0 0 0\n1 1\n5 5 50", "1\n1 2 3\n4 5 6\n20 10\n1 2 3"]
2 seconds
["YES\n25.5000000000\n10.0000000000 4.5000000000 0.0000000000", "NO", "YES\n0.0000000000\n1.0000000000 2.0000000000 3.0000000000"]
null
Java 6
standard input
[ "binary search", "geometry" ]
6e2a8aa58ed8cd308cb482e4c24cbbbb
The first line contains a single integer n (1 ≀ n ≀ 10000). The following n + 1 lines contain the coordinates xi, yi, zi, separated by single spaces. The coordinates of any two consecutive points do not coincide. The next line contains the velocities vp and vs, the last line contains Px, Py, Pz, separated by single spa...
2,100
If Harry Potter can catch the snitch while it is moving along the polyline (including the end (xn, yn, zn)), print "YES" in the first line (without the quotes). Print in the second line t, which is the earliest moment of time, when Harry will be able to catch the snitch. On the third line print three numbers X, Y, Z, t...
standard output
PASSED
8a255601d55e9fc752b426779ed286e1
train_003.jsonl
1299340800
Brothers Fred and George Weasley once got into the sporting goods store and opened a box of Quidditch balls. After long and painful experiments they found out that the Golden Snitch is not enchanted at all. It is simply a programmed device. It always moves along the same trajectory, which is a polyline with vertices at...
256 megabytes
import java.io.*; import java.util.*; public class C { MyScanner in; PrintWriter out; final static String filename = ""; class MyScanner { BufferedReader br; StringTokenizer st; public MyScanner(String file) { try { br = new BufferedReader(new File...
Java
["4\n0 0 0\n0 10 0\n10 10 0\n10 0 0\n0 0 0\n1 1\n5 5 25", "4\n0 0 0\n0 10 0\n10 10 0\n10 0 0\n0 0 0\n1 1\n5 5 50", "1\n1 2 3\n4 5 6\n20 10\n1 2 3"]
2 seconds
["YES\n25.5000000000\n10.0000000000 4.5000000000 0.0000000000", "NO", "YES\n0.0000000000\n1.0000000000 2.0000000000 3.0000000000"]
null
Java 6
standard input
[ "binary search", "geometry" ]
6e2a8aa58ed8cd308cb482e4c24cbbbb
The first line contains a single integer n (1 ≀ n ≀ 10000). The following n + 1 lines contain the coordinates xi, yi, zi, separated by single spaces. The coordinates of any two consecutive points do not coincide. The next line contains the velocities vp and vs, the last line contains Px, Py, Pz, separated by single spa...
2,100
If Harry Potter can catch the snitch while it is moving along the polyline (including the end (xn, yn, zn)), print "YES" in the first line (without the quotes). Print in the second line t, which is the earliest moment of time, when Harry will be able to catch the snitch. On the third line print three numbers X, Y, Z, t...
standard output
PASSED
7dc2bc7e387f5394c4f790fbdbb58f72
train_003.jsonl
1301410800
A progress bar is an element of graphical interface that displays the progress of a process for this very moment before it is completed. Let's take a look at the following form of such a bar.A bar is represented as n squares, located in line. To add clarity, let's number them with positive integers from 1 to n from the...
256 megabytes
import java.util.Scanner; public class B_71_Progress_Bar { public static void main(String[] args){ Scanner input=new Scanner(System.in); int n=input.nextInt(),k=input.nextInt(),t=input.nextInt(); double x=n*k*t; x=x/100; int sum=(int)Math.floor(x); int[] sats=new int[n]; int n1=sum/k; int n2=sum%k; ...
Java
["10 10 54", "11 13 37"]
1 second
["10 10 10 10 10 4 0 0 0 0", "13 13 13 13 0 0 0 0 0 0 0"]
null
Java 7
standard input
[ "implementation", "math" ]
0ad96b6a8032d70df400bf2ad72174bf
We are given 3 space-separated integers n, k, t (1 ≀ n, k ≀ 100, 0 ≀ t ≀ 100).
1,300
Print n numbers. The i-th of them should be equal to ai.
standard output
PASSED
6b47a030290d9633789df36be93a4534
train_003.jsonl
1301410800
A progress bar is an element of graphical interface that displays the progress of a process for this very moment before it is completed. Let's take a look at the following form of such a bar.A bar is represented as n squares, located in line. To add clarity, let's number them with positive integers from 1 to n from the...
256 megabytes
/* * @author Sane */ import java.io.File; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.FileWriter; import java.util.Scanner; import java.io.FileOutputStream; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.OutputStreamWriter; public class TheMain { ...
Java
["10 10 54", "11 13 37"]
1 second
["10 10 10 10 10 4 0 0 0 0", "13 13 13 13 0 0 0 0 0 0 0"]
null
Java 7
standard input
[ "implementation", "math" ]
0ad96b6a8032d70df400bf2ad72174bf
We are given 3 space-separated integers n, k, t (1 ≀ n, k ≀ 100, 0 ≀ t ≀ 100).
1,300
Print n numbers. The i-th of them should be equal to ai.
standard output
PASSED
7e9f5e6838579003ad199b432dfabf6c
train_003.jsonl
1301410800
A progress bar is an element of graphical interface that displays the progress of a process for this very moment before it is completed. Let's take a look at the following form of such a bar.A bar is represented as n squares, located in line. To add clarity, let's number them with positive integers from 1 to n from the...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; /** * http://codeforces.com/contest/71/problem/B * * @author sultan.of.swing * */ public class TaskB { public FasterScanner mFScanner; public PrintWriter mOut; public TaskB() { mFS...
Java
["10 10 54", "11 13 37"]
1 second
["10 10 10 10 10 4 0 0 0 0", "13 13 13 13 0 0 0 0 0 0 0"]
null
Java 7
standard input
[ "implementation", "math" ]
0ad96b6a8032d70df400bf2ad72174bf
We are given 3 space-separated integers n, k, t (1 ≀ n, k ≀ 100, 0 ≀ t ≀ 100).
1,300
Print n numbers. The i-th of them should be equal to ai.
standard output
PASSED
7ef8a18d570be0158fb90d152a9f1115
train_003.jsonl
1301410800
A progress bar is an element of graphical interface that displays the progress of a process for this very moment before it is completed. Let's take a look at the following form of such a bar.A bar is represented as n squares, located in line. To add clarity, let's number them with positive integers from 1 to n from the...
256 megabytes
import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.util.StringTokenizer; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public stat...
Java
["10 10 54", "11 13 37"]
1 second
["10 10 10 10 10 4 0 0 0 0", "13 13 13 13 0 0 0 0 0 0 0"]
null
Java 7
standard input
[ "implementation", "math" ]
0ad96b6a8032d70df400bf2ad72174bf
We are given 3 space-separated integers n, k, t (1 ≀ n, k ≀ 100, 0 ≀ t ≀ 100).
1,300
Print n numbers. The i-th of them should be equal to ai.
standard output
PASSED
f95bc5db1ed900f8bbb729354b0cc127
train_003.jsonl
1301410800
A progress bar is an element of graphical interface that displays the progress of a process for this very moment before it is completed. Let's take a look at the following form of such a bar.A bar is represented as n squares, located in line. To add clarity, let's number them with positive integers from 1 to n from the...
256 megabytes
import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.util.Scanner; public class ProgressBar { public static void main(String[] args) throws IOException { Scanner x=new Scanner(System.in); int n,k,t; long sum; n=x.nextInt(); ...
Java
["10 10 54", "11 13 37"]
1 second
["10 10 10 10 10 4 0 0 0 0", "13 13 13 13 0 0 0 0 0 0 0"]
null
Java 7
standard input
[ "implementation", "math" ]
0ad96b6a8032d70df400bf2ad72174bf
We are given 3 space-separated integers n, k, t (1 ≀ n, k ≀ 100, 0 ≀ t ≀ 100).
1,300
Print n numbers. The i-th of them should be equal to ai.
standard output
PASSED
8ecdcec0652a0fe405d29936b83d044b
train_003.jsonl
1280761200
Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given n numbers differs from the others. Bob observed that one number usually differs from the others in evenness. Help Bob β€” to check his answers, he needs a program that among the given n numbers finds one that is di...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int index = 0; int even = 0; int odd = 0; ArrayList<Integer> x = new ArrayList<>...
Java
["5\n2 4 7 8 10", "4\n1 2 1 1"]
2 seconds
["3", "2"]
null
Java 8
standard input
[ "brute force" ]
dd84c2c3c429501208649ffaf5d91cee
The first line contains integer n (3 ≀ n ≀ 100) β€” amount of numbers in the task. The second line contains n space-separated natural numbers, not exceeding 100. It is guaranteed, that exactly one of these numbers differs from the others in evenness.
1,300
Output index of number that differs from the others in evenness. Numbers are numbered from 1 in the input order.
standard output
PASSED
dc4edcd42a517b54867d55d7d3dd97f5
train_003.jsonl
1280761200
Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given n numbers differs from the others. Bob observed that one number usually differs from the others in evenness. Help Bob β€” to check his answers, he needs a program that among the given n numbers finds one that is di...
256 megabytes
import java.util.*; public class sadd { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t=0,a=0,n=0,m=0,cont=0,cont2=0; t= in .nextInt(); for(int i=0;i<t;i++) { a= in .nextInt(); if(a%2==0) { cont++; ...
Java
["5\n2 4 7 8 10", "4\n1 2 1 1"]
2 seconds
["3", "2"]
null
Java 8
standard input
[ "brute force" ]
dd84c2c3c429501208649ffaf5d91cee
The first line contains integer n (3 ≀ n ≀ 100) β€” amount of numbers in the task. The second line contains n space-separated natural numbers, not exceeding 100. It is guaranteed, that exactly one of these numbers differs from the others in evenness.
1,300
Output index of number that differs from the others in evenness. Numbers are numbered from 1 in the input order.
standard output
PASSED
4e29afee73473b4246a38c3de7335d91
train_003.jsonl
1280761200
Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given n numbers differs from the others. Bob observed that one number usually differs from the others in evenness. Help Bob β€” to check his answers, he needs a program that among the given n numbers finds one that is di...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top * * @author Alice */ public class Main { public static void main(String[] args) { InputStream in...
Java
["5\n2 4 7 8 10", "4\n1 2 1 1"]
2 seconds
["3", "2"]
null
Java 8
standard input
[ "brute force" ]
dd84c2c3c429501208649ffaf5d91cee
The first line contains integer n (3 ≀ n ≀ 100) β€” amount of numbers in the task. The second line contains n space-separated natural numbers, not exceeding 100. It is guaranteed, that exactly one of these numbers differs from the others in evenness.
1,300
Output index of number that differs from the others in evenness. Numbers are numbered from 1 in the input order.
standard output
PASSED
f306a639a381882f2705211202506f9a
train_003.jsonl
1280761200
Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given n numbers differs from the others. Bob observed that one number usually differs from the others in evenness. Help Bob β€” to check his answers, he needs a program that among the given n numbers finds one that is di...
256 megabytes
import java.util.*; public class Problem { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); List<Integer> input = new ArrayList<>(); for (int i = 0; i < n; i++) { input.add(sc.nextInt()); } if (input.g...
Java
["5\n2 4 7 8 10", "4\n1 2 1 1"]
2 seconds
["3", "2"]
null
Java 8
standard input
[ "brute force" ]
dd84c2c3c429501208649ffaf5d91cee
The first line contains integer n (3 ≀ n ≀ 100) β€” amount of numbers in the task. The second line contains n space-separated natural numbers, not exceeding 100. It is guaranteed, that exactly one of these numbers differs from the others in evenness.
1,300
Output index of number that differs from the others in evenness. Numbers are numbered from 1 in the input order.
standard output
PASSED
09a8fae300bb2578fea0547c56a247cd
train_003.jsonl
1280761200
Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given n numbers differs from the others. Bob observed that one number usually differs from the others in evenness. Help Bob β€” to check his answers, he needs a program that among the given n numbers finds one that is di...
256 megabytes
import java.util.*; import java.util.stream.*; import java.io.*; public class Solution { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int[] arr = new int[n]; Arrays.setAll(arr, i -> s.nextInt()); int sum = IntStream.range(...
Java
["5\n2 4 7 8 10", "4\n1 2 1 1"]
2 seconds
["3", "2"]
null
Java 8
standard input
[ "brute force" ]
dd84c2c3c429501208649ffaf5d91cee
The first line contains integer n (3 ≀ n ≀ 100) β€” amount of numbers in the task. The second line contains n space-separated natural numbers, not exceeding 100. It is guaranteed, that exactly one of these numbers differs from the others in evenness.
1,300
Output index of number that differs from the others in evenness. Numbers are numbered from 1 in the input order.
standard output
PASSED
31d83a9add5e255dd46e5df747e91324
train_003.jsonl
1280761200
Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given n numbers differs from the others. Bob observed that one number usually differs from the others in evenness. Help Bob β€” to check his answers, he needs a program that among the given n numbers finds one that is di...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class Aibek { public static void main(String[] args) { Scanner in = new Scanner (System.in); int n=in.nextInt(); int [] a=new int[n]; int res=0; ArrayList<Integer> chet=new ArrayList<> (); ArrayList<Integer>...
Java
["5\n2 4 7 8 10", "4\n1 2 1 1"]
2 seconds
["3", "2"]
null
Java 8
standard input
[ "brute force" ]
dd84c2c3c429501208649ffaf5d91cee
The first line contains integer n (3 ≀ n ≀ 100) β€” amount of numbers in the task. The second line contains n space-separated natural numbers, not exceeding 100. It is guaranteed, that exactly one of these numbers differs from the others in evenness.
1,300
Output index of number that differs from the others in evenness. Numbers are numbered from 1 in the input order.
standard output
PASSED
361db59fe0371a98886ba8f15503f15c
train_003.jsonl
1280761200
Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given n numbers differs from the others. Bob observed that one number usually differs from the others in evenness. Help Bob β€” to check his answers, he needs a program that among the given n numbers finds one that is di...
256 megabytes
import java.util.ArrayList; import java.util.LinkedList; import java.util.Scanner; public class CodeforA { public static void main(String[] args) { int i = 0, j = 0,even =0 , odd=0; ArrayList<Integer> list = new ArrayList<>(); LinkedList<Character> linked = new LinkedList<Character>(); ...
Java
["5\n2 4 7 8 10", "4\n1 2 1 1"]
2 seconds
["3", "2"]
null
Java 8
standard input
[ "brute force" ]
dd84c2c3c429501208649ffaf5d91cee
The first line contains integer n (3 ≀ n ≀ 100) β€” amount of numbers in the task. The second line contains n space-separated natural numbers, not exceeding 100. It is guaranteed, that exactly one of these numbers differs from the others in evenness.
1,300
Output index of number that differs from the others in evenness. Numbers are numbered from 1 in the input order.
standard output
PASSED
12c57f61f46131bb4c00bf4af78c1867
train_003.jsonl
1280761200
Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given n numbers differs from the others. Bob observed that one number usually differs from the others in evenness. Help Bob β€” to check his answers, he needs a program that among the given n numbers finds one that is di...
256 megabytes
import java.util.Scanner; public class IQTest { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int even = sc.nextInt() % 2; int even2 = sc.nextInt() % 2; int even3 = sc.nextInt() % 2; if (even != even2) { if (even2 != even3) { System.out.print...
Java
["5\n2 4 7 8 10", "4\n1 2 1 1"]
2 seconds
["3", "2"]
null
Java 8
standard input
[ "brute force" ]
dd84c2c3c429501208649ffaf5d91cee
The first line contains integer n (3 ≀ n ≀ 100) β€” amount of numbers in the task. The second line contains n space-separated natural numbers, not exceeding 100. It is guaranteed, that exactly one of these numbers differs from the others in evenness.
1,300
Output index of number that differs from the others in evenness. Numbers are numbered from 1 in the input order.
standard output
PASSED
e969554acaa7c24486f02fcab03ba49d
train_003.jsonl
1280761200
Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given n numbers differs from the others. Bob observed that one number usually differs from the others in evenness. Help Bob β€” to check his answers, he needs a program that among the given n numbers finds one that is di...
256 megabytes
import java.util.*; import java.io.*; public class Main{ public static void main(String args[]) { Scanner sc = new Scanner(System.in); int a; int eve=0; int odd=0; a = sc.nextInt(); int arr[] = new int[a]; for(int i=0;i<a;i++) { arr[i]=...
Java
["5\n2 4 7 8 10", "4\n1 2 1 1"]
2 seconds
["3", "2"]
null
Java 8
standard input
[ "brute force" ]
dd84c2c3c429501208649ffaf5d91cee
The first line contains integer n (3 ≀ n ≀ 100) β€” amount of numbers in the task. The second line contains n space-separated natural numbers, not exceeding 100. It is guaranteed, that exactly one of these numbers differs from the others in evenness.
1,300
Output index of number that differs from the others in evenness. Numbers are numbered from 1 in the input order.
standard output
PASSED
d3f637d73a509d27229e757aacaee733
train_003.jsonl
1280761200
Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given n numbers differs from the others. Bob observed that one number usually differs from the others in evenness. Help Bob β€” to check his answers, he needs a program that among the given n numbers finds one that is di...
256 megabytes
import java.util.*; import java.io.*; public class Main{ public static void main(String args[]) { Scanner sc = new Scanner(System.in); int a; int eve=0; int odd=0; a = sc.nextInt(); int arr[] = new int[a]; for(int i=0;i<a;i++) { arr[i]=...
Java
["5\n2 4 7 8 10", "4\n1 2 1 1"]
2 seconds
["3", "2"]
null
Java 8
standard input
[ "brute force" ]
dd84c2c3c429501208649ffaf5d91cee
The first line contains integer n (3 ≀ n ≀ 100) β€” amount of numbers in the task. The second line contains n space-separated natural numbers, not exceeding 100. It is guaranteed, that exactly one of these numbers differs from the others in evenness.
1,300
Output index of number that differs from the others in evenness. Numbers are numbered from 1 in the input order.
standard output
PASSED
bacee0f6620f69fb59f5776aad5379ad
train_003.jsonl
1280761200
Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given n numbers differs from the others. Bob observed that one number usually differs from the others in evenness. Help Bob β€” to check his answers, he needs a program that among the given n numbers finds one that is di...
256 megabytes
/* Comment block here ... */ import java.util.Scanner; public class prog_6 { public static void main(String[] args) { Scanner keyb = new Scanner(System.in); int [] eed = new int [100]; int kammarra,var; int x=0; kammarra=keyb.nextInt(); for(int i=0;i<kammarra;i++) { var=keyb.nextInt(); eed [i]=var%2; } for(int i=ka...
Java
["5\n2 4 7 8 10", "4\n1 2 1 1"]
2 seconds
["3", "2"]
null
Java 8
standard input
[ "brute force" ]
dd84c2c3c429501208649ffaf5d91cee
The first line contains integer n (3 ≀ n ≀ 100) β€” amount of numbers in the task. The second line contains n space-separated natural numbers, not exceeding 100. It is guaranteed, that exactly one of these numbers differs from the others in evenness.
1,300
Output index of number that differs from the others in evenness. Numbers are numbered from 1 in the input order.
standard output
PASSED
2434d41d163ffd2104c282dc8ddba1db
train_003.jsonl
1280761200
Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given n numbers differs from the others. Bob observed that one number usually differs from the others in evenness. Help Bob β€” to check his answers, he needs a program that among the given n numbers finds one that is di...
256 megabytes
import java.util.Scanner; import java.lang.Math; public class IQTest{ public static void main(String args[]){ Scanner scan = new Scanner(System.in); int numbers = scan.nextInt(); int numEvens = 0; int even_index = -1; int odd_index = -1; fo...
Java
["5\n2 4 7 8 10", "4\n1 2 1 1"]
2 seconds
["3", "2"]
null
Java 8
standard input
[ "brute force" ]
dd84c2c3c429501208649ffaf5d91cee
The first line contains integer n (3 ≀ n ≀ 100) β€” amount of numbers in the task. The second line contains n space-separated natural numbers, not exceeding 100. It is guaranteed, that exactly one of these numbers differs from the others in evenness.
1,300
Output index of number that differs from the others in evenness. Numbers are numbered from 1 in the input order.
standard output
PASSED
b0e37e41bf7a0a8a0df2357beb4ddcef
train_003.jsonl
1280761200
Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given n numbers differs from the others. Bob observed that one number usually differs from the others in evenness. Help Bob β€” to check his answers, he needs a program that among the given n numbers finds one that is di...
256 megabytes
import java.util.*; public class A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; int[] b = new int[n]; int as = 0; int bs = 0; for(int i = 0;i < n;i++) { a[i] = sc.nextInt(); if(a[i] % 2 == 0) { as++; } else { ...
Java
["5\n2 4 7 8 10", "4\n1 2 1 1"]
2 seconds
["3", "2"]
null
Java 8
standard input
[ "brute force" ]
dd84c2c3c429501208649ffaf5d91cee
The first line contains integer n (3 ≀ n ≀ 100) β€” amount of numbers in the task. The second line contains n space-separated natural numbers, not exceeding 100. It is guaranteed, that exactly one of these numbers differs from the others in evenness.
1,300
Output index of number that differs from the others in evenness. Numbers are numbered from 1 in the input order.
standard output
PASSED
abac776ba597fd54d4e25cf011da85d1
train_003.jsonl
1280761200
Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given n numbers differs from the others. Bob observed that one number usually differs from the others in evenness. Help Bob β€” to check his answers, he needs a program that among the given n numbers finds one that is di...
256 megabytes
import java.io.*; import java.util.*; public class Example { public static void main(String[] args) { Scanner in=new Scanner(System.in); int n=in.nextInt(); int[] num= new int[n]; int flag=0; for(int i=0;i<n;i++){ num[i]=in.nextInt(); } boolean count=false; for(int i=0; i<...
Java
["5\n2 4 7 8 10", "4\n1 2 1 1"]
2 seconds
["3", "2"]
null
Java 8
standard input
[ "brute force" ]
dd84c2c3c429501208649ffaf5d91cee
The first line contains integer n (3 ≀ n ≀ 100) β€” amount of numbers in the task. The second line contains n space-separated natural numbers, not exceeding 100. It is guaranteed, that exactly one of these numbers differs from the others in evenness.
1,300
Output index of number that differs from the others in evenness. Numbers are numbered from 1 in the input order.
standard output
PASSED
c387f33ac4e821c96e698770a24b377d
train_003.jsonl
1280761200
Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given n numbers differs from the others. Bob observed that one number usually differs from the others in evenness. Help Bob β€” to check his answers, he needs a program that among the given n numbers finds one that is di...
256 megabytes
import java.util.Scanner; /** * * @author Leonidas */ public class IQTest { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = 4, c = 0, pos = 0, i = 0, cpar = 0,cimpar = 0; String sec; ...
Java
["5\n2 4 7 8 10", "4\n1 2 1 1"]
2 seconds
["3", "2"]
null
Java 8
standard input
[ "brute force" ]
dd84c2c3c429501208649ffaf5d91cee
The first line contains integer n (3 ≀ n ≀ 100) β€” amount of numbers in the task. The second line contains n space-separated natural numbers, not exceeding 100. It is guaranteed, that exactly one of these numbers differs from the others in evenness.
1,300
Output index of number that differs from the others in evenness. Numbers are numbered from 1 in the input order.
standard output
PASSED
84fa3336d7916f59c660fa2e07b8611e
train_003.jsonl
1280761200
Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given n numbers differs from the others. Bob observed that one number usually differs from the others in evenness. Help Bob β€” to check his answers, he needs a program that among the given n numbers finds one that is di...
256 megabytes
import java.util.Scanner; public class IQ_test { public static void main(String[] args) { Scanner in = new Scanner(System.in); int size = in.nextInt(); int [] input = new int [size]; for ( int i=0 ; i<size ; i++) { input[i]=in.nextInt(); } in...
Java
["5\n2 4 7 8 10", "4\n1 2 1 1"]
2 seconds
["3", "2"]
null
Java 8
standard input
[ "brute force" ]
dd84c2c3c429501208649ffaf5d91cee
The first line contains integer n (3 ≀ n ≀ 100) β€” amount of numbers in the task. The second line contains n space-separated natural numbers, not exceeding 100. It is guaranteed, that exactly one of these numbers differs from the others in evenness.
1,300
Output index of number that differs from the others in evenness. Numbers are numbered from 1 in the input order.
standard output
PASSED
9e02376ec8ac8472122c8e164c6c5827
train_003.jsonl
1280761200
Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given n numbers differs from the others. Bob observed that one number usually differs from the others in evenness. Help Bob β€” to check his answers, he needs a program that among the given n numbers finds one that is di...
256 megabytes
import java.util.Scanner; public class IQ { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int arr[] = new int[n]; for (int i=0;i<n;i++){ arr[i]= s.nextInt(); } int e=0; int o =0; int ans =-1; for(int i=1;i<n-1;i++){ if(i-1>=0 && arr[i-1]%2==0){ e=1;...
Java
["5\n2 4 7 8 10", "4\n1 2 1 1"]
2 seconds
["3", "2"]
null
Java 8
standard input
[ "brute force" ]
dd84c2c3c429501208649ffaf5d91cee
The first line contains integer n (3 ≀ n ≀ 100) β€” amount of numbers in the task. The second line contains n space-separated natural numbers, not exceeding 100. It is guaranteed, that exactly one of these numbers differs from the others in evenness.
1,300
Output index of number that differs from the others in evenness. Numbers are numbered from 1 in the input order.
standard output
PASSED
7cb9c4db4c64d5007783a7796e5b75e3
train_003.jsonl
1592491500
This is a harder version of the problem H with modification queries.Lester and Delbert work at an electronics company. They are currently working on a microchip component serving to connect two independent parts of a large supercomputer.The component is built on top of a breadboardΒ β€” a grid-like base for a microchip. T...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Writer; import java.io.OutputStreamWri...
Java
["4 5 4\nBBRR\nRBBR\nBBBBB\nRRRRR\nL 2 3\nR 3 4\nU 1 5\nD 1 5"]
2 seconds
["7\n7\n9\n4\n9"]
null
Java 11
standard input
[]
64b942d23386ab53af7a4a02243248ce
The first line contains three integers $$$n, m, q$$$ ($$$1 \leq n, m \leq 10^5$$$, $$$0 \leq q \leq 10^5$$$)Β β€” the number of rows and columns of the breadboard, and the number of modifications respectively. The next four lines describe initial coloring of the ports. Each character in these lines is either R or B, depen...
3,500
Print $$$q + 1$$$ integers, one per lineΒ β€” the breadboard capacity after $$$0, \ldots, q$$$ modifications have been made to the initial coloring.
standard output
PASSED
2b7b859d66df9d1c2d5cda5387827dbd
train_003.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.*; import java.io.*; public class a { public static PrintWriter out; public static FS sc; public static void main(String[] Args) throws Exception { sc = new FS(System.in); out = new PrintWriter( new BufferedWriter( new OutputStreamW...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 11
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
002d507986bf4335df1ed124e0a32c9d
train_003.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class TestJava { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); ArrayList<String> lines = new ArrayList<String>()...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 11
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
ddfec0d9a38ae566a3ffbccfb6b5bca0
train_003.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Erasing_Zeroes { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.read...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 11
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
cdbd8492e4383190ca8e0d417d6862fa
train_003.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
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){ String s = sc.next(); char ch[]=s.toCharArray(); if(ch.length==1){ System.out.println(0); } else{ int count=0; ...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 11
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
09d479ba2d871a6594dd058af5a1ae9a
train_003.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.Scanner; public class b3abes { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0) { int cnt = 0; String str = sc.next(); int start = str.indexOf("1"); int end = str.lastIndexOf("1"); ...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 11
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
5100a887b7fc478fe66b789e3368413a
train_003.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
/*package whatever //do not write package name here */ import java.io.*; import java.util.*; public class GFG { public static void main (String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ String A=sc.next(); char ch[]=A.toCharArray(); int i,one=-1,count0=0; bo...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 11
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
5ceb3301f034cfb011e482c81d0f5d63
train_003.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.io.*; import java.util.*; public class Erasing_Zeroes { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while(st == null || !st.hasMoreElements()) { try { st ...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 11
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
002d0de6030ff9081e78f19fd1b10196
train_003.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.*; public class Solution { public static void main(String args[]) { Scanner in = new Scanner(System.in); int n = in.nextInt(); String t; for(int i = 0; i < n; i++) { t = in.next(); int check1 = -1; int check2 = -1; for(int j = 0; j < t.length(...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 11
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
a1bb7c55894c8a0fdf01c89e5af48739
train_003.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class codeforces { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for(int i = 0 ; i <n ;i++) { int count = 0; String s = sc.next(); ...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 11
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
57515162d0aeb46575eea31952473030
train_003.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.*; public class PhoenixA { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int i=0;i<t;i++) { String s=sc.next(); int flag=0; int l=0; ...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 11
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
ffbce9dff9e1cf23e341af7f2a72ced5
train_003.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
//package com.company; import java.io.*; import java.util.*; public class ErasingZeroes { public static void main(String[] args) { out = new PrintWriter(new BufferedOutputStream(System.out)); MyScanner sc = new MyScanner();//start int size = sc.nextInt(); for (int i = 0; i < size...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 11
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
a1f1a89b5952d80855e4bebb9e53f527
train_003.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.*; public class Test { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); for (int i = 0; i < t; i++) { String s = in.next(); int start = 0; int end = 0; int count =...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 11
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
47d1f9a19ee78f59c5003d7e041ce65d
train_003.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Solution{ public static void main(String []args) throws IOException{ BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); int t=Integer.parseInt(in.readLine()); while(t-->0) { Stri...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 11
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
000254e0f64e3fffe312fe8961e3b9cc
train_003.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; public class ErasingZeroes { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int amountOfTestCases = Integer.parseInt(reader.readLine()); ...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 11
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
567250ecc616fcd9dea534d82b07ce26
train_003.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; public class ErasingZeroes { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int amountOfTestCases = Integer.parseInt(reader.readLine()); ...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 11
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
2ae9e83609740a6554c97b14d8bbe59a
train_003.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.*; import java.io.*; public class A { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); int t = Integer.parseInt(br.readLine()); while(t-->0) { String s =...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 11
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
2d7d37d7543b050ae3c9b47179ce2eee
train_003.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.io.*; import java.util.*; public class ErasingZeroes { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { String s=sc.next(); int prev=-1,sum=0; for(int i=0;i<s.length();i+...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 11
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
0f49dd48783a943e889ddceff7229353
train_003.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.Scanner; public class CF1303AImproved { public static void main(String[] args) { Scanner s = new Scanner(System.in); int cases = Integer.parseInt(s.nextLine()); for (int c = 0; c < cases; c++) { String input = s.nextLine().trim(); System.out.println(numToErase(input)); }...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 11
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
5724bb59fc38fa709e37f86f30bba194
train_003.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.Scanner; public class CF1303A { public static void main(String[] args) { Scanner s = new Scanner(System.in); int numCases = Integer.parseInt(s.nextLine()); for (int c = 0; c < numCases; c++) { String input = s.nextLine().trim(); System.out.println(numZerosToErase(input)); ...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 11
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
9cfec75853f0beb3a538efa5cd86927d
train_003.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.*; public class a{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-- >0){ int count = 0; String s = sc.next(); int first = Integer.MAX_VALUE; int last = 0; ...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 11
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
f3720ccaf3e6ab2931b8f2bbf155b813
train_003.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.*; public class a{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-- >0){ int count = 0; String s = sc.next(); int first = Integer.MAX_VALUE; int last = 0; ...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 11
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
6d867ea34e4214c53cc1571bc953c827
train_003.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.*; public class ErasingZeroes { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int q=10,count=0,Ocount=0; for(int i=0;i<n;i++) { String s=sc.next(); String r[]=s.split(""); for(int j=0;j<r.length;j++) { if(r[j].equals("1")) { fo...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 11
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
afb2422026d096ffc236890bc80225a5
train_003.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Main { public static void main(String[] args) { FastReader f = new FastReader(); int t = f.nextInt(); while (t-- > 0) { String s = f.next(); ...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 11
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
71828683b709ca2eab1ab99850a0c40d
train_003.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.Scanner; public class Erasing_Zeros { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String test = scanner.nextLine(); int t = Integer.parseInt(test); for (int i = 1; i <= t; i++) { String x = scanner.nextLine(); ...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 11
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
8062c5b214b3a07dbd3f581eeccd09e2
train_003.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.Scanner; public class erasing { public static void main(String args[]) { Scanner s=new Scanner(System.in); int test_size=s.nextInt(); for(int i=0;i<test_size;i++) { String temp=s.next(); erasing.solver(temp); } } private static void s...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 11
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
c368947f1a76a2131add1ff038fb4ff0
train_003.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int testCase = scanner.nextInt(); scanner.nextLine(); while(testCase > 0) { String string = scanner.nextLine(); int le...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 11
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
b4a332c095336c575e17ac42e75e5d3a
train_003.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.util.Scanner; public class ErasingZeros { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int tc = Integer.parseInt(scanner.nextLine()); while (tc-- > 0) { String input = scanner.nextLine(); System.out.println(findMinZe...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 11
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
c3a86b942de2d90b88583a4668fab901
train_003.jsonl
1581518100
You are given a string $$$s$$$. Each character is either 0 or 1.You want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegment, and if the string is 0101, 100001 or 11111111111101, then this condition is not met.You may er...
256 megabytes
import java.lang.*; import java.io.*; import java.util.*; public class Code{ public static void main(String args[]){ Scanner br=new Scanner(System.in); int t=br.nextInt(); while(t-->0){ String s=br.next(); int c=0; int k=0; int m=0; for(int i=0;i<s.length();i++){ if(s.charAt(i)=='1'){ k=i; break; } } for(int j=s.lengt...
Java
["3\n010011\n0\n1111000"]
1 second
["2\n0\n0"]
NoteIn the first test case you have to delete the third and forth symbols from string 010011 (it turns into 0111).
Java 11
standard input
[ "implementation", "strings" ]
5de66fbb594bb317654366fd2290c4d3
The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) β€” the number of test cases. Then $$$t$$$ lines follow, each representing a test case. Each line contains one string $$$s$$$ ($$$1 \le |s| \le 100$$$); each character of $$$s$$$ is either 0 or 1.
800
Print $$$t$$$ integers, where the $$$i$$$-th integer is the answer to the $$$i$$$-th testcase (the minimum number of 0's that you have to erase from $$$s$$$).
standard output
PASSED
95dfb0413090aa784b17f62d70283949
train_003.jsonl
1459353900
Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by n Berland students. There were at least two schoolboys participating from each of the m ...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; import java.util.stream.*; @SuppressWarnings("unchecked") public class P659B { public void run() throws Exception { int n = nextInt(); int m = nextInt(); TreeMap<Integer, List<String>> [] rof = new TreeMap [m]; while ((n--) > 0) { Stri...
Java
["5 2\nIvanov 1 763\nAndreev 2 800\nPetrov 1 595\nSidorov 1 790\nSemenov 2 503", "5 2\nIvanov 1 800\nAndreev 2 763\nPetrov 1 800\nSidorov 1 800\nSemenov 2 503"]
1 second
["Sidorov Ivanov\nAndreev Semenov", "?\nAndreev Semenov"]
NoteIn the first sample region teams are uniquely determined.In the second sample the team from region 2 is uniquely determined and the team from region 1 can have three teams: "Petrov"-"Sidorov", "Ivanov"-"Sidorov", "Ivanov" -"Petrov", so it is impossible to determine a team uniquely.
Java 8
standard input
[ "constructive algorithms", "sortings" ]
a1ea9eb8db25289958a6f730c555362f
The first line of the input contains two integers n and m (2 ≀ n ≀ 100 000, 1 ≀ m ≀ 10 000, n β‰₯ 2m)Β β€” the number of participants of the qualifying contest and the number of regions in Berland. Next n lines contain the description of the participants of the qualifying contest in the following format: Surname (a string o...
1,300
Print m lines. On the i-th line print the team of the i-th regionΒ β€” the surnames of the two team members in an arbitrary order, or a single character "?" (without the quotes) if you need to spend further qualifying contests in the region.
standard output
PASSED
ef157456279d9fe5174b4b5bd11041ee
train_003.jsonl
1459353900
Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by n Berland students. There were at least two schoolboys participating from each of the m ...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; import java.util.stream.*; @SuppressWarnings("unchecked") public class P659B { public void run() throws Exception { int n = nextInt(); int m = nextInt(); TreeMap<Integer, TreeMap<Integer, ArrayList<String>>> rof = new TreeMap(); for (int i =...
Java
["5 2\nIvanov 1 763\nAndreev 2 800\nPetrov 1 595\nSidorov 1 790\nSemenov 2 503", "5 2\nIvanov 1 800\nAndreev 2 763\nPetrov 1 800\nSidorov 1 800\nSemenov 2 503"]
1 second
["Sidorov Ivanov\nAndreev Semenov", "?\nAndreev Semenov"]
NoteIn the first sample region teams are uniquely determined.In the second sample the team from region 2 is uniquely determined and the team from region 1 can have three teams: "Petrov"-"Sidorov", "Ivanov"-"Sidorov", "Ivanov" -"Petrov", so it is impossible to determine a team uniquely.
Java 8
standard input
[ "constructive algorithms", "sortings" ]
a1ea9eb8db25289958a6f730c555362f
The first line of the input contains two integers n and m (2 ≀ n ≀ 100 000, 1 ≀ m ≀ 10 000, n β‰₯ 2m)Β β€” the number of participants of the qualifying contest and the number of regions in Berland. Next n lines contain the description of the participants of the qualifying contest in the following format: Surname (a string o...
1,300
Print m lines. On the i-th line print the team of the i-th regionΒ β€” the surnames of the two team members in an arbitrary order, or a single character "?" (without the quotes) if you need to spend further qualifying contests in the region.
standard output
PASSED
847deebc2babd29d1018134ed2d48b89
train_003.jsonl
1459353900
Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by n Berland students. There were at least two schoolboys participating from each of the m ...
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.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; import java.io.BufferedReader; import java.util.Collections; import java.io.InputSt...
Java
["5 2\nIvanov 1 763\nAndreev 2 800\nPetrov 1 595\nSidorov 1 790\nSemenov 2 503", "5 2\nIvanov 1 800\nAndreev 2 763\nPetrov 1 800\nSidorov 1 800\nSemenov 2 503"]
1 second
["Sidorov Ivanov\nAndreev Semenov", "?\nAndreev Semenov"]
NoteIn the first sample region teams are uniquely determined.In the second sample the team from region 2 is uniquely determined and the team from region 1 can have three teams: "Petrov"-"Sidorov", "Ivanov"-"Sidorov", "Ivanov" -"Petrov", so it is impossible to determine a team uniquely.
Java 8
standard input
[ "constructive algorithms", "sortings" ]
a1ea9eb8db25289958a6f730c555362f
The first line of the input contains two integers n and m (2 ≀ n ≀ 100 000, 1 ≀ m ≀ 10 000, n β‰₯ 2m)Β β€” the number of participants of the qualifying contest and the number of regions in Berland. Next n lines contain the description of the participants of the qualifying contest in the following format: Surname (a string o...
1,300
Print m lines. On the i-th line print the team of the i-th regionΒ β€” the surnames of the two team members in an arbitrary order, or a single character "?" (without the quotes) if you need to spend further qualifying contests in the region.
standard output
PASSED
01e8105ce73ea4cec5a4bd4b4f42a819
train_003.jsonl
1459353900
Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by n Berland students. There were at least two schoolboys participating from each of the m ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.Objects; import javafx.util.Pair; public class B659 { sta...
Java
["5 2\nIvanov 1 763\nAndreev 2 800\nPetrov 1 595\nSidorov 1 790\nSemenov 2 503", "5 2\nIvanov 1 800\nAndreev 2 763\nPetrov 1 800\nSidorov 1 800\nSemenov 2 503"]
1 second
["Sidorov Ivanov\nAndreev Semenov", "?\nAndreev Semenov"]
NoteIn the first sample region teams are uniquely determined.In the second sample the team from region 2 is uniquely determined and the team from region 1 can have three teams: "Petrov"-"Sidorov", "Ivanov"-"Sidorov", "Ivanov" -"Petrov", so it is impossible to determine a team uniquely.
Java 8
standard input
[ "constructive algorithms", "sortings" ]
a1ea9eb8db25289958a6f730c555362f
The first line of the input contains two integers n and m (2 ≀ n ≀ 100 000, 1 ≀ m ≀ 10 000, n β‰₯ 2m)Β β€” the number of participants of the qualifying contest and the number of regions in Berland. Next n lines contain the description of the participants of the qualifying contest in the following format: Surname (a string o...
1,300
Print m lines. On the i-th line print the team of the i-th regionΒ β€” the surnames of the two team members in an arbitrary order, or a single character "?" (without the quotes) if you need to spend further qualifying contests in the region.
standard output
PASSED
90f0b5121fdde342a58b7fbeb81d95d3
train_003.jsonl
1459353900
Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by n Berland students. There were at least two schoolboys participating from each of the m ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; /** * Created by Shurikat on 09.07.16. */ public class Codeforces { public static void main(String[] args) throws Exception { Scanner scanner = new Scanner(); int n = scanner.nextInt(), m = scanner.nextInt(); ...
Java
["5 2\nIvanov 1 763\nAndreev 2 800\nPetrov 1 595\nSidorov 1 790\nSemenov 2 503", "5 2\nIvanov 1 800\nAndreev 2 763\nPetrov 1 800\nSidorov 1 800\nSemenov 2 503"]
1 second
["Sidorov Ivanov\nAndreev Semenov", "?\nAndreev Semenov"]
NoteIn the first sample region teams are uniquely determined.In the second sample the team from region 2 is uniquely determined and the team from region 1 can have three teams: "Petrov"-"Sidorov", "Ivanov"-"Sidorov", "Ivanov" -"Petrov", so it is impossible to determine a team uniquely.
Java 8
standard input
[ "constructive algorithms", "sortings" ]
a1ea9eb8db25289958a6f730c555362f
The first line of the input contains two integers n and m (2 ≀ n ≀ 100 000, 1 ≀ m ≀ 10 000, n β‰₯ 2m)Β β€” the number of participants of the qualifying contest and the number of regions in Berland. Next n lines contain the description of the participants of the qualifying contest in the following format: Surname (a string o...
1,300
Print m lines. On the i-th line print the team of the i-th regionΒ β€” the surnames of the two team members in an arbitrary order, or a single character "?" (without the quotes) if you need to spend further qualifying contests in the region.
standard output
PASSED
33239914221a1e5cba791bf4f24f1212
train_003.jsonl
1459353900
Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by n Berland students. There were at least two schoolboys participating from each of the m ...
256 megabytes
import java.util.*; public class XKSegments { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int total_reg = s.nextInt(); List<Data> list = new ArrayList<>(); HashMap<Integer, Integer> h = new HashMap<>(); for(int i=0; i<n; i++) { S...
Java
["5 2\nIvanov 1 763\nAndreev 2 800\nPetrov 1 595\nSidorov 1 790\nSemenov 2 503", "5 2\nIvanov 1 800\nAndreev 2 763\nPetrov 1 800\nSidorov 1 800\nSemenov 2 503"]
1 second
["Sidorov Ivanov\nAndreev Semenov", "?\nAndreev Semenov"]
NoteIn the first sample region teams are uniquely determined.In the second sample the team from region 2 is uniquely determined and the team from region 1 can have three teams: "Petrov"-"Sidorov", "Ivanov"-"Sidorov", "Ivanov" -"Petrov", so it is impossible to determine a team uniquely.
Java 8
standard input
[ "constructive algorithms", "sortings" ]
a1ea9eb8db25289958a6f730c555362f
The first line of the input contains two integers n and m (2 ≀ n ≀ 100 000, 1 ≀ m ≀ 10 000, n β‰₯ 2m)Β β€” the number of participants of the qualifying contest and the number of regions in Berland. Next n lines contain the description of the participants of the qualifying contest in the following format: Surname (a string o...
1,300
Print m lines. On the i-th line print the team of the i-th regionΒ β€” the surnames of the two team members in an arbitrary order, or a single character "?" (without the quotes) if you need to spend further qualifying contests in the region.
standard output
PASSED
cff8234e602cf24c0aeca2273be539ad
train_003.jsonl
1459353900
Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by n Berland students. There were at least two schoolboys participating from each of the m ...
256 megabytes
import java.io.*; import java.util.*; public class QualifyingContest{ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] tmp = br.readLine().split(" "); int n = Integer.parseInt(tmp[0]); int m = Integer.parseInt(tmp...
Java
["5 2\nIvanov 1 763\nAndreev 2 800\nPetrov 1 595\nSidorov 1 790\nSemenov 2 503", "5 2\nIvanov 1 800\nAndreev 2 763\nPetrov 1 800\nSidorov 1 800\nSemenov 2 503"]
1 second
["Sidorov Ivanov\nAndreev Semenov", "?\nAndreev Semenov"]
NoteIn the first sample region teams are uniquely determined.In the second sample the team from region 2 is uniquely determined and the team from region 1 can have three teams: "Petrov"-"Sidorov", "Ivanov"-"Sidorov", "Ivanov" -"Petrov", so it is impossible to determine a team uniquely.
Java 8
standard input
[ "constructive algorithms", "sortings" ]
a1ea9eb8db25289958a6f730c555362f
The first line of the input contains two integers n and m (2 ≀ n ≀ 100 000, 1 ≀ m ≀ 10 000, n β‰₯ 2m)Β β€” the number of participants of the qualifying contest and the number of regions in Berland. Next n lines contain the description of the participants of the qualifying contest in the following format: Surname (a string o...
1,300
Print m lines. On the i-th line print the team of the i-th regionΒ β€” the surnames of the two team members in an arbitrary order, or a single character "?" (without the quotes) if you need to spend further qualifying contests in the region.
standard output
PASSED
c4f6646f4ab12cf085d227e189431a89
train_003.jsonl
1459353900
Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by n Berland students. There were at least two schoolboys participating from each of the m ...
256 megabytes
import java.io.*; import java.util.*; public class QualifyingContest{ public static void main(String[] args){ Scanner scn = new Scanner(System.in); int n=scn.nextInt(); int m=scn.nextInt(); String[][] std = new String[n][3]; scn.nextLine(); for(int i=0; i<n; i++){ std[i]=scn.nextLine().split(" "...
Java
["5 2\nIvanov 1 763\nAndreev 2 800\nPetrov 1 595\nSidorov 1 790\nSemenov 2 503", "5 2\nIvanov 1 800\nAndreev 2 763\nPetrov 1 800\nSidorov 1 800\nSemenov 2 503"]
1 second
["Sidorov Ivanov\nAndreev Semenov", "?\nAndreev Semenov"]
NoteIn the first sample region teams are uniquely determined.In the second sample the team from region 2 is uniquely determined and the team from region 1 can have three teams: "Petrov"-"Sidorov", "Ivanov"-"Sidorov", "Ivanov" -"Petrov", so it is impossible to determine a team uniquely.
Java 8
standard input
[ "constructive algorithms", "sortings" ]
a1ea9eb8db25289958a6f730c555362f
The first line of the input contains two integers n and m (2 ≀ n ≀ 100 000, 1 ≀ m ≀ 10 000, n β‰₯ 2m)Β β€” the number of participants of the qualifying contest and the number of regions in Berland. Next n lines contain the description of the participants of the qualifying contest in the following format: Surname (a string o...
1,300
Print m lines. On the i-th line print the team of the i-th regionΒ β€” the surnames of the two team members in an arbitrary order, or a single character "?" (without the quotes) if you need to spend further qualifying contests in the region.
standard output
PASSED
2fc62b8ee5427174aa9cbf9f088a0d53
train_003.jsonl
1459353900
Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by n Berland students. There were at least two schoolboys participating from each of the m ...
256 megabytes
import java.io.*; import java.util.*; public class QualifyingContest{ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] tmp = br.readLine().split(" "); int n = Integer.parseInt(tmp[0]); int m = Integer.parseInt(tmp...
Java
["5 2\nIvanov 1 763\nAndreev 2 800\nPetrov 1 595\nSidorov 1 790\nSemenov 2 503", "5 2\nIvanov 1 800\nAndreev 2 763\nPetrov 1 800\nSidorov 1 800\nSemenov 2 503"]
1 second
["Sidorov Ivanov\nAndreev Semenov", "?\nAndreev Semenov"]
NoteIn the first sample region teams are uniquely determined.In the second sample the team from region 2 is uniquely determined and the team from region 1 can have three teams: "Petrov"-"Sidorov", "Ivanov"-"Sidorov", "Ivanov" -"Petrov", so it is impossible to determine a team uniquely.
Java 8
standard input
[ "constructive algorithms", "sortings" ]
a1ea9eb8db25289958a6f730c555362f
The first line of the input contains two integers n and m (2 ≀ n ≀ 100 000, 1 ≀ m ≀ 10 000, n β‰₯ 2m)Β β€” the number of participants of the qualifying contest and the number of regions in Berland. Next n lines contain the description of the participants of the qualifying contest in the following format: Surname (a string o...
1,300
Print m lines. On the i-th line print the team of the i-th regionΒ β€” the surnames of the two team members in an arbitrary order, or a single character "?" (without the quotes) if you need to spend further qualifying contests in the region.
standard output
PASSED
ed7248e90b994dee4857ed6db4c884a9
train_003.jsonl
1459353900
Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by n Berland students. There were at least two schoolboys participating from each of the m ...
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.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; import java.io.BufferedReader; import java.util.Comparator; import java.util.Collec...
Java
["5 2\nIvanov 1 763\nAndreev 2 800\nPetrov 1 595\nSidorov 1 790\nSemenov 2 503", "5 2\nIvanov 1 800\nAndreev 2 763\nPetrov 1 800\nSidorov 1 800\nSemenov 2 503"]
1 second
["Sidorov Ivanov\nAndreev Semenov", "?\nAndreev Semenov"]
NoteIn the first sample region teams are uniquely determined.In the second sample the team from region 2 is uniquely determined and the team from region 1 can have three teams: "Petrov"-"Sidorov", "Ivanov"-"Sidorov", "Ivanov" -"Petrov", so it is impossible to determine a team uniquely.
Java 8
standard input
[ "constructive algorithms", "sortings" ]
a1ea9eb8db25289958a6f730c555362f
The first line of the input contains two integers n and m (2 ≀ n ≀ 100 000, 1 ≀ m ≀ 10 000, n β‰₯ 2m)Β β€” the number of participants of the qualifying contest and the number of regions in Berland. Next n lines contain the description of the participants of the qualifying contest in the following format: Surname (a string o...
1,300
Print m lines. On the i-th line print the team of the i-th regionΒ β€” the surnames of the two team members in an arbitrary order, or a single character "?" (without the quotes) if you need to spend further qualifying contests in the region.
standard output
PASSED
0f2f5714bb2848a9d12dddbd955e3682
train_003.jsonl
1459353900
Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by n Berland students. There were at least two schoolboys participating from each of the m ...
256 megabytes
import java.util.*; public class A { static class Cons implements Comparator<Cons>, Comparable<Cons> { private String name; private int points; Cons() { } Cons(String n, int a) { name = n; points = a; } public int compareTo(Cons d) { return (this.name).compareTo(d.name); } public int c...
Java
["5 2\nIvanov 1 763\nAndreev 2 800\nPetrov 1 595\nSidorov 1 790\nSemenov 2 503", "5 2\nIvanov 1 800\nAndreev 2 763\nPetrov 1 800\nSidorov 1 800\nSemenov 2 503"]
1 second
["Sidorov Ivanov\nAndreev Semenov", "?\nAndreev Semenov"]
NoteIn the first sample region teams are uniquely determined.In the second sample the team from region 2 is uniquely determined and the team from region 1 can have three teams: "Petrov"-"Sidorov", "Ivanov"-"Sidorov", "Ivanov" -"Petrov", so it is impossible to determine a team uniquely.
Java 8
standard input
[ "constructive algorithms", "sortings" ]
a1ea9eb8db25289958a6f730c555362f
The first line of the input contains two integers n and m (2 ≀ n ≀ 100 000, 1 ≀ m ≀ 10 000, n β‰₯ 2m)Β β€” the number of participants of the qualifying contest and the number of regions in Berland. Next n lines contain the description of the participants of the qualifying contest in the following format: Surname (a string o...
1,300
Print m lines. On the i-th line print the team of the i-th regionΒ β€” the surnames of the two team members in an arbitrary order, or a single character "?" (without the quotes) if you need to spend further qualifying contests in the region.
standard output
PASSED
e344b8c5534b78879d8b7d61befcc798
train_003.jsonl
1459353900
Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by n Berland students. There were at least two schoolboys participating from each of the m ...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.StringTokenizer; public class Shit { static class Scanner { StringTokenizer st; ...
Java
["5 2\nIvanov 1 763\nAndreev 2 800\nPetrov 1 595\nSidorov 1 790\nSemenov 2 503", "5 2\nIvanov 1 800\nAndreev 2 763\nPetrov 1 800\nSidorov 1 800\nSemenov 2 503"]
1 second
["Sidorov Ivanov\nAndreev Semenov", "?\nAndreev Semenov"]
NoteIn the first sample region teams are uniquely determined.In the second sample the team from region 2 is uniquely determined and the team from region 1 can have three teams: "Petrov"-"Sidorov", "Ivanov"-"Sidorov", "Ivanov" -"Petrov", so it is impossible to determine a team uniquely.
Java 8
standard input
[ "constructive algorithms", "sortings" ]
a1ea9eb8db25289958a6f730c555362f
The first line of the input contains two integers n and m (2 ≀ n ≀ 100 000, 1 ≀ m ≀ 10 000, n β‰₯ 2m)Β β€” the number of participants of the qualifying contest and the number of regions in Berland. Next n lines contain the description of the participants of the qualifying contest in the following format: Surname (a string o...
1,300
Print m lines. On the i-th line print the team of the i-th regionΒ β€” the surnames of the two team members in an arbitrary order, or a single character "?" (without the quotes) if you need to spend further qualifying contests in the region.
standard output
PASSED
83ee94f3b5f194f78b07c6bd70e69b23
train_003.jsonl
1459353900
Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by n Berland students. There were at least two schoolboys participating from each of the m ...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.StringTokenizer; public class Shit { static class Scanner { StringTokenizer st; ...
Java
["5 2\nIvanov 1 763\nAndreev 2 800\nPetrov 1 595\nSidorov 1 790\nSemenov 2 503", "5 2\nIvanov 1 800\nAndreev 2 763\nPetrov 1 800\nSidorov 1 800\nSemenov 2 503"]
1 second
["Sidorov Ivanov\nAndreev Semenov", "?\nAndreev Semenov"]
NoteIn the first sample region teams are uniquely determined.In the second sample the team from region 2 is uniquely determined and the team from region 1 can have three teams: "Petrov"-"Sidorov", "Ivanov"-"Sidorov", "Ivanov" -"Petrov", so it is impossible to determine a team uniquely.
Java 8
standard input
[ "constructive algorithms", "sortings" ]
a1ea9eb8db25289958a6f730c555362f
The first line of the input contains two integers n and m (2 ≀ n ≀ 100 000, 1 ≀ m ≀ 10 000, n β‰₯ 2m)Β β€” the number of participants of the qualifying contest and the number of regions in Berland. Next n lines contain the description of the participants of the qualifying contest in the following format: Surname (a string o...
1,300
Print m lines. On the i-th line print the team of the i-th regionΒ β€” the surnames of the two team members in an arbitrary order, or a single character "?" (without the quotes) if you need to spend further qualifying contests in the region.
standard output
PASSED
4fad52b955b06ca5b554a9af94beb14b
train_003.jsonl
1459353900
Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by n Berland students. There were at least two schoolboys participating from each of the m ...
256 megabytes
import java.util.*; import java.io.*; public class Contest { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int m=sc.nextInt(); P arr[]=new P[n]; for(int i=0;i<n;i++) { String s=sc.next(); int v=sc.nextInt();...
Java
["5 2\nIvanov 1 763\nAndreev 2 800\nPetrov 1 595\nSidorov 1 790\nSemenov 2 503", "5 2\nIvanov 1 800\nAndreev 2 763\nPetrov 1 800\nSidorov 1 800\nSemenov 2 503"]
1 second
["Sidorov Ivanov\nAndreev Semenov", "?\nAndreev Semenov"]
NoteIn the first sample region teams are uniquely determined.In the second sample the team from region 2 is uniquely determined and the team from region 1 can have three teams: "Petrov"-"Sidorov", "Ivanov"-"Sidorov", "Ivanov" -"Petrov", so it is impossible to determine a team uniquely.
Java 8
standard input
[ "constructive algorithms", "sortings" ]
a1ea9eb8db25289958a6f730c555362f
The first line of the input contains two integers n and m (2 ≀ n ≀ 100 000, 1 ≀ m ≀ 10 000, n β‰₯ 2m)Β β€” the number of participants of the qualifying contest and the number of regions in Berland. Next n lines contain the description of the participants of the qualifying contest in the following format: Surname (a string o...
1,300
Print m lines. On the i-th line print the team of the i-th regionΒ β€” the surnames of the two team members in an arbitrary order, or a single character "?" (without the quotes) if you need to spend further qualifying contests in the region.
standard output
PASSED
9e8ad07131e30affe4b972be4d713a1d
train_003.jsonl
1459353900
Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by n Berland students. There were at least two schoolboys participating from each of the m ...
256 megabytes
import java.util.*; public class QualifyingContest { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int m = scan.nextInt(); Triplet[] arr = new Triplet[n]; for(int i=0;i<n;i++){ Triplet t = new Triplet(); ...
Java
["5 2\nIvanov 1 763\nAndreev 2 800\nPetrov 1 595\nSidorov 1 790\nSemenov 2 503", "5 2\nIvanov 1 800\nAndreev 2 763\nPetrov 1 800\nSidorov 1 800\nSemenov 2 503"]
1 second
["Sidorov Ivanov\nAndreev Semenov", "?\nAndreev Semenov"]
NoteIn the first sample region teams are uniquely determined.In the second sample the team from region 2 is uniquely determined and the team from region 1 can have three teams: "Petrov"-"Sidorov", "Ivanov"-"Sidorov", "Ivanov" -"Petrov", so it is impossible to determine a team uniquely.
Java 8
standard input
[ "constructive algorithms", "sortings" ]
a1ea9eb8db25289958a6f730c555362f
The first line of the input contains two integers n and m (2 ≀ n ≀ 100 000, 1 ≀ m ≀ 10 000, n β‰₯ 2m)Β β€” the number of participants of the qualifying contest and the number of regions in Berland. Next n lines contain the description of the participants of the qualifying contest in the following format: Surname (a string o...
1,300
Print m lines. On the i-th line print the team of the i-th regionΒ β€” the surnames of the two team members in an arbitrary order, or a single character "?" (without the quotes) if you need to spend further qualifying contests in the region.
standard output
PASSED
568afff59959ea7c7be964eed64aa5a5
train_003.jsonl
1459353900
Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by n Berland students. There were at least two schoolboys participating from each of the m ...
256 megabytes
/** * @author kunal05 */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.Arrays; public class B { public static void main(String[] args) { InputReader in = new InputReader(); PrintWriter ...
Java
["5 2\nIvanov 1 763\nAndreev 2 800\nPetrov 1 595\nSidorov 1 790\nSemenov 2 503", "5 2\nIvanov 1 800\nAndreev 2 763\nPetrov 1 800\nSidorov 1 800\nSemenov 2 503"]
1 second
["Sidorov Ivanov\nAndreev Semenov", "?\nAndreev Semenov"]
NoteIn the first sample region teams are uniquely determined.In the second sample the team from region 2 is uniquely determined and the team from region 1 can have three teams: "Petrov"-"Sidorov", "Ivanov"-"Sidorov", "Ivanov" -"Petrov", so it is impossible to determine a team uniquely.
Java 8
standard input
[ "constructive algorithms", "sortings" ]
a1ea9eb8db25289958a6f730c555362f
The first line of the input contains two integers n and m (2 ≀ n ≀ 100 000, 1 ≀ m ≀ 10 000, n β‰₯ 2m)Β β€” the number of participants of the qualifying contest and the number of regions in Berland. Next n lines contain the description of the participants of the qualifying contest in the following format: Surname (a string o...
1,300
Print m lines. On the i-th line print the team of the i-th regionΒ β€” the surnames of the two team members in an arbitrary order, or a single character "?" (without the quotes) if you need to spend further qualifying contests in the region.
standard output
PASSED
e350b184684cf467348753cbb6e02137
train_003.jsonl
1459353900
Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by n Berland students. There were at least two schoolboys participating from each of the m ...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { FastReader input = new FastReader(); int n = input.nextInt(); int m = input.nextInt(); StringBuilder out = new StringBuilder(); Map<Integer, ArrayList<Stude...
Java
["5 2\nIvanov 1 763\nAndreev 2 800\nPetrov 1 595\nSidorov 1 790\nSemenov 2 503", "5 2\nIvanov 1 800\nAndreev 2 763\nPetrov 1 800\nSidorov 1 800\nSemenov 2 503"]
1 second
["Sidorov Ivanov\nAndreev Semenov", "?\nAndreev Semenov"]
NoteIn the first sample region teams are uniquely determined.In the second sample the team from region 2 is uniquely determined and the team from region 1 can have three teams: "Petrov"-"Sidorov", "Ivanov"-"Sidorov", "Ivanov" -"Petrov", so it is impossible to determine a team uniquely.
Java 8
standard input
[ "constructive algorithms", "sortings" ]
a1ea9eb8db25289958a6f730c555362f
The first line of the input contains two integers n and m (2 ≀ n ≀ 100 000, 1 ≀ m ≀ 10 000, n β‰₯ 2m)Β β€” the number of participants of the qualifying contest and the number of regions in Berland. Next n lines contain the description of the participants of the qualifying contest in the following format: Surname (a string o...
1,300
Print m lines. On the i-th line print the team of the i-th regionΒ β€” the surnames of the two team members in an arbitrary order, or a single character "?" (without the quotes) if you need to spend further qualifying contests in the region.
standard output
PASSED
a6c7650b94bb7f1fdfcbf98a25c9d24f
train_003.jsonl
1459353900
Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by n Berland students. There were at least two schoolboys participating from each of the m ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Writer; import java.io.OutputStreamWri...
Java
["5 2\nIvanov 1 763\nAndreev 2 800\nPetrov 1 595\nSidorov 1 790\nSemenov 2 503", "5 2\nIvanov 1 800\nAndreev 2 763\nPetrov 1 800\nSidorov 1 800\nSemenov 2 503"]
1 second
["Sidorov Ivanov\nAndreev Semenov", "?\nAndreev Semenov"]
NoteIn the first sample region teams are uniquely determined.In the second sample the team from region 2 is uniquely determined and the team from region 1 can have three teams: "Petrov"-"Sidorov", "Ivanov"-"Sidorov", "Ivanov" -"Petrov", so it is impossible to determine a team uniquely.
Java 8
standard input
[ "constructive algorithms", "sortings" ]
a1ea9eb8db25289958a6f730c555362f
The first line of the input contains two integers n and m (2 ≀ n ≀ 100 000, 1 ≀ m ≀ 10 000, n β‰₯ 2m)Β β€” the number of participants of the qualifying contest and the number of regions in Berland. Next n lines contain the description of the participants of the qualifying contest in the following format: Surname (a string o...
1,300
Print m lines. On the i-th line print the team of the i-th regionΒ β€” the surnames of the two team members in an arbitrary order, or a single character "?" (without the quotes) if you need to spend further qualifying contests in the region.
standard output
PASSED
2c90720f089edfce5dcbd6c85ad626e1
train_003.jsonl
1459353900
Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by n Berland students. There were at least two schoolboys participating from each of the m ...
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.Collections; import java.util.Comparator; import java.util.List; import ...
Java
["5 2\nIvanov 1 763\nAndreev 2 800\nPetrov 1 595\nSidorov 1 790\nSemenov 2 503", "5 2\nIvanov 1 800\nAndreev 2 763\nPetrov 1 800\nSidorov 1 800\nSemenov 2 503"]
1 second
["Sidorov Ivanov\nAndreev Semenov", "?\nAndreev Semenov"]
NoteIn the first sample region teams are uniquely determined.In the second sample the team from region 2 is uniquely determined and the team from region 1 can have three teams: "Petrov"-"Sidorov", "Ivanov"-"Sidorov", "Ivanov" -"Petrov", so it is impossible to determine a team uniquely.
Java 8
standard input
[ "constructive algorithms", "sortings" ]
a1ea9eb8db25289958a6f730c555362f
The first line of the input contains two integers n and m (2 ≀ n ≀ 100 000, 1 ≀ m ≀ 10 000, n β‰₯ 2m)Β β€” the number of participants of the qualifying contest and the number of regions in Berland. Next n lines contain the description of the participants of the qualifying contest in the following format: Surname (a string o...
1,300
Print m lines. On the i-th line print the team of the i-th regionΒ β€” the surnames of the two team members in an arbitrary order, or a single character "?" (without the quotes) if you need to spend further qualifying contests in the region.
standard output
PASSED
6ef9268dd727f9b9bd6262e78d075b1c
train_003.jsonl
1459353900
Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by n Berland students. There were at least two schoolboys participating from each of the m ...
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.Collections; import java.util.Comparator; import java.util.List; import ...
Java
["5 2\nIvanov 1 763\nAndreev 2 800\nPetrov 1 595\nSidorov 1 790\nSemenov 2 503", "5 2\nIvanov 1 800\nAndreev 2 763\nPetrov 1 800\nSidorov 1 800\nSemenov 2 503"]
1 second
["Sidorov Ivanov\nAndreev Semenov", "?\nAndreev Semenov"]
NoteIn the first sample region teams are uniquely determined.In the second sample the team from region 2 is uniquely determined and the team from region 1 can have three teams: "Petrov"-"Sidorov", "Ivanov"-"Sidorov", "Ivanov" -"Petrov", so it is impossible to determine a team uniquely.
Java 8
standard input
[ "constructive algorithms", "sortings" ]
a1ea9eb8db25289958a6f730c555362f
The first line of the input contains two integers n and m (2 ≀ n ≀ 100 000, 1 ≀ m ≀ 10 000, n β‰₯ 2m)Β β€” the number of participants of the qualifying contest and the number of regions in Berland. Next n lines contain the description of the participants of the qualifying contest in the following format: Surname (a string o...
1,300
Print m lines. On the i-th line print the team of the i-th regionΒ β€” the surnames of the two team members in an arbitrary order, or a single character "?" (without the quotes) if you need to spend further qualifying contests in the region.
standard output
PASSED
832c8ebf8f44af4f64060ddbb92c02e8
train_003.jsonl
1459353900
Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by n Berland students. There were at least two schoolboys participating from each of the m ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; //run time public class QualifyingContest659 { public static void main(String[] args) throws IOException{ BufferedReader r=new BufferedReader(new InputStreamReader(...
Java
["5 2\nIvanov 1 763\nAndreev 2 800\nPetrov 1 595\nSidorov 1 790\nSemenov 2 503", "5 2\nIvanov 1 800\nAndreev 2 763\nPetrov 1 800\nSidorov 1 800\nSemenov 2 503"]
1 second
["Sidorov Ivanov\nAndreev Semenov", "?\nAndreev Semenov"]
NoteIn the first sample region teams are uniquely determined.In the second sample the team from region 2 is uniquely determined and the team from region 1 can have three teams: "Petrov"-"Sidorov", "Ivanov"-"Sidorov", "Ivanov" -"Petrov", so it is impossible to determine a team uniquely.
Java 8
standard input
[ "constructive algorithms", "sortings" ]
a1ea9eb8db25289958a6f730c555362f
The first line of the input contains two integers n and m (2 ≀ n ≀ 100 000, 1 ≀ m ≀ 10 000, n β‰₯ 2m)Β β€” the number of participants of the qualifying contest and the number of regions in Berland. Next n lines contain the description of the participants of the qualifying contest in the following format: Surname (a string o...
1,300
Print m lines. On the i-th line print the team of the i-th regionΒ β€” the surnames of the two team members in an arbitrary order, or a single character "?" (without the quotes) if you need to spend further qualifying contests in the region.
standard output
PASSED
dfd217373368d3a55a2c1f3419f14749
train_003.jsonl
1459353900
Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by n Berland students. There were at least two schoolboys participating from each of the m ...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class B { public static void main(String args[]) { try { InputReader in = new InputReader(System.in); int n = in.readInt(); int m = in.readInt(); Vector<Participant> res[] = new Vector[m]; ...
Java
["5 2\nIvanov 1 763\nAndreev 2 800\nPetrov 1 595\nSidorov 1 790\nSemenov 2 503", "5 2\nIvanov 1 800\nAndreev 2 763\nPetrov 1 800\nSidorov 1 800\nSemenov 2 503"]
1 second
["Sidorov Ivanov\nAndreev Semenov", "?\nAndreev Semenov"]
NoteIn the first sample region teams are uniquely determined.In the second sample the team from region 2 is uniquely determined and the team from region 1 can have three teams: "Petrov"-"Sidorov", "Ivanov"-"Sidorov", "Ivanov" -"Petrov", so it is impossible to determine a team uniquely.
Java 8
standard input
[ "constructive algorithms", "sortings" ]
a1ea9eb8db25289958a6f730c555362f
The first line of the input contains two integers n and m (2 ≀ n ≀ 100 000, 1 ≀ m ≀ 10 000, n β‰₯ 2m)Β β€” the number of participants of the qualifying contest and the number of regions in Berland. Next n lines contain the description of the participants of the qualifying contest in the following format: Surname (a string o...
1,300
Print m lines. On the i-th line print the team of the i-th regionΒ β€” the surnames of the two team members in an arbitrary order, or a single character "?" (without the quotes) if you need to spend further qualifying contests in the region.
standard output
PASSED
de6c3d2ed626ac251445b99a9e6c8b31
train_003.jsonl
1459353900
Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by n Berland students. There were at least two schoolboys participating from each of the m ...
256 megabytes
import java.io.*; import java.util.*; /* * CodeForces Round 346 Div 2 Qualifying Contest * @derrick20 */ public class QualifyingContest { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int M = sc.nextInt(); Arr...
Java
["5 2\nIvanov 1 763\nAndreev 2 800\nPetrov 1 595\nSidorov 1 790\nSemenov 2 503", "5 2\nIvanov 1 800\nAndreev 2 763\nPetrov 1 800\nSidorov 1 800\nSemenov 2 503"]
1 second
["Sidorov Ivanov\nAndreev Semenov", "?\nAndreev Semenov"]
NoteIn the first sample region teams are uniquely determined.In the second sample the team from region 2 is uniquely determined and the team from region 1 can have three teams: "Petrov"-"Sidorov", "Ivanov"-"Sidorov", "Ivanov" -"Petrov", so it is impossible to determine a team uniquely.
Java 8
standard input
[ "constructive algorithms", "sortings" ]
a1ea9eb8db25289958a6f730c555362f
The first line of the input contains two integers n and m (2 ≀ n ≀ 100 000, 1 ≀ m ≀ 10 000, n β‰₯ 2m)Β β€” the number of participants of the qualifying contest and the number of regions in Berland. Next n lines contain the description of the participants of the qualifying contest in the following format: Surname (a string o...
1,300
Print m lines. On the i-th line print the team of the i-th regionΒ β€” the surnames of the two team members in an arbitrary order, or a single character "?" (without the quotes) if you need to spend further qualifying contests in the region.
standard output
PASSED
64b0146d782de5826de6efa95bc54d67
train_003.jsonl
1459353900
Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by n Berland students. There were at least two schoolboys participating from each of the m ...
256 megabytes
import java.util.*; import java.io.*; /** * * @author umang */ public class B659 { public static int mod = 1000000007; public static long gcd(long x,long y){ if(x%y==0) return y; else return gcd(y,x%y); } public static int gcd(int x,int y){ if(x%y==0) return y; else ret...
Java
["5 2\nIvanov 1 763\nAndreev 2 800\nPetrov 1 595\nSidorov 1 790\nSemenov 2 503", "5 2\nIvanov 1 800\nAndreev 2 763\nPetrov 1 800\nSidorov 1 800\nSemenov 2 503"]
1 second
["Sidorov Ivanov\nAndreev Semenov", "?\nAndreev Semenov"]
NoteIn the first sample region teams are uniquely determined.In the second sample the team from region 2 is uniquely determined and the team from region 1 can have three teams: "Petrov"-"Sidorov", "Ivanov"-"Sidorov", "Ivanov" -"Petrov", so it is impossible to determine a team uniquely.
Java 8
standard input
[ "constructive algorithms", "sortings" ]
a1ea9eb8db25289958a6f730c555362f
The first line of the input contains two integers n and m (2 ≀ n ≀ 100 000, 1 ≀ m ≀ 10 000, n β‰₯ 2m)Β β€” the number of participants of the qualifying contest and the number of regions in Berland. Next n lines contain the description of the participants of the qualifying contest in the following format: Surname (a string o...
1,300
Print m lines. On the i-th line print the team of the i-th regionΒ β€” the surnames of the two team members in an arbitrary order, or a single character "?" (without the quotes) if you need to spend further qualifying contests in the region.
standard output
PASSED
614f37d56682efd67bdb5e68d163dca0
train_003.jsonl
1459353900
Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by n Berland students. There were at least two schoolboys participating from each of the m ...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.PriorityQueue; import java.util.stream.IntStream; /** * Created by andrei on 30.03.2016. */ public class CodeforcesB { public static class Participant implements Comparable{ private String name; ...
Java
["5 2\nIvanov 1 763\nAndreev 2 800\nPetrov 1 595\nSidorov 1 790\nSemenov 2 503", "5 2\nIvanov 1 800\nAndreev 2 763\nPetrov 1 800\nSidorov 1 800\nSemenov 2 503"]
1 second
["Sidorov Ivanov\nAndreev Semenov", "?\nAndreev Semenov"]
NoteIn the first sample region teams are uniquely determined.In the second sample the team from region 2 is uniquely determined and the team from region 1 can have three teams: "Petrov"-"Sidorov", "Ivanov"-"Sidorov", "Ivanov" -"Petrov", so it is impossible to determine a team uniquely.
Java 8
standard input
[ "constructive algorithms", "sortings" ]
a1ea9eb8db25289958a6f730c555362f
The first line of the input contains two integers n and m (2 ≀ n ≀ 100 000, 1 ≀ m ≀ 10 000, n β‰₯ 2m)Β β€” the number of participants of the qualifying contest and the number of regions in Berland. Next n lines contain the description of the participants of the qualifying contest in the following format: Surname (a string o...
1,300
Print m lines. On the i-th line print the team of the i-th regionΒ β€” the surnames of the two team members in an arbitrary order, or a single character "?" (without the quotes) if you need to spend further qualifying contests in the region.
standard output
PASSED
d3f23b9c0d18ac646b291399ca520cd6
train_003.jsonl
1459353900
Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by n Berland students. There were at least two schoolboys participating from each of the m ...
256 megabytes
import java.util.*; import java.util.stream.Stream; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); // int brr[] = {6, 5}; // // for(int i = 0; i < brr.length; i++){ // if(i - 1 >= 0 && i + 1 < brr.length){ // if(brr[i - 1] != brr[i] && brr[i + 1] !=...
Java
["5 2\nIvanov 1 763\nAndreev 2 800\nPetrov 1 595\nSidorov 1 790\nSemenov 2 503", "5 2\nIvanov 1 800\nAndreev 2 763\nPetrov 1 800\nSidorov 1 800\nSemenov 2 503"]
1 second
["Sidorov Ivanov\nAndreev Semenov", "?\nAndreev Semenov"]
NoteIn the first sample region teams are uniquely determined.In the second sample the team from region 2 is uniquely determined and the team from region 1 can have three teams: "Petrov"-"Sidorov", "Ivanov"-"Sidorov", "Ivanov" -"Petrov", so it is impossible to determine a team uniquely.
Java 8
standard input
[ "constructive algorithms", "sortings" ]
a1ea9eb8db25289958a6f730c555362f
The first line of the input contains two integers n and m (2 ≀ n ≀ 100 000, 1 ≀ m ≀ 10 000, n β‰₯ 2m)Β β€” the number of participants of the qualifying contest and the number of regions in Berland. Next n lines contain the description of the participants of the qualifying contest in the following format: Surname (a string o...
1,300
Print m lines. On the i-th line print the team of the i-th regionΒ β€” the surnames of the two team members in an arbitrary order, or a single character "?" (without the quotes) if you need to spend further qualifying contests in the region.
standard output
PASSED
92aa12e47aa8925a2421230ec7b6741d
train_003.jsonl
1459353900
Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by n Berland students. There were at least two schoolboys participating from each of the m ...
256 megabytes
import java.util.*; import java.util.stream.Stream; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); // int brr[] = {6, 5}; // // for(int i = 0; i < brr.length; i++){ // if(i - 1 >= 0 && i + 1 < brr.length){ // if(brr[i - 1] != brr[i] && brr[i + 1] !=...
Java
["5 2\nIvanov 1 763\nAndreev 2 800\nPetrov 1 595\nSidorov 1 790\nSemenov 2 503", "5 2\nIvanov 1 800\nAndreev 2 763\nPetrov 1 800\nSidorov 1 800\nSemenov 2 503"]
1 second
["Sidorov Ivanov\nAndreev Semenov", "?\nAndreev Semenov"]
NoteIn the first sample region teams are uniquely determined.In the second sample the team from region 2 is uniquely determined and the team from region 1 can have three teams: "Petrov"-"Sidorov", "Ivanov"-"Sidorov", "Ivanov" -"Petrov", so it is impossible to determine a team uniquely.
Java 8
standard input
[ "constructive algorithms", "sortings" ]
a1ea9eb8db25289958a6f730c555362f
The first line of the input contains two integers n and m (2 ≀ n ≀ 100 000, 1 ≀ m ≀ 10 000, n β‰₯ 2m)Β β€” the number of participants of the qualifying contest and the number of regions in Berland. Next n lines contain the description of the participants of the qualifying contest in the following format: Surname (a string o...
1,300
Print m lines. On the i-th line print the team of the i-th regionΒ β€” the surnames of the two team members in an arbitrary order, or a single character "?" (without the quotes) if you need to spend further qualifying contests in the region.
standard output
PASSED
1237d7082b991ceeeebe454f44bedf24
train_003.jsonl
1459353900
Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by n Berland students. There were at least two schoolboys participating from each of the m ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; public class QualifyingContest { public static void main(String[] args) throws IOException { BufferedReader reader=new BufferedRea...
Java
["5 2\nIvanov 1 763\nAndreev 2 800\nPetrov 1 595\nSidorov 1 790\nSemenov 2 503", "5 2\nIvanov 1 800\nAndreev 2 763\nPetrov 1 800\nSidorov 1 800\nSemenov 2 503"]
1 second
["Sidorov Ivanov\nAndreev Semenov", "?\nAndreev Semenov"]
NoteIn the first sample region teams are uniquely determined.In the second sample the team from region 2 is uniquely determined and the team from region 1 can have three teams: "Petrov"-"Sidorov", "Ivanov"-"Sidorov", "Ivanov" -"Petrov", so it is impossible to determine a team uniquely.
Java 8
standard input
[ "constructive algorithms", "sortings" ]
a1ea9eb8db25289958a6f730c555362f
The first line of the input contains two integers n and m (2 ≀ n ≀ 100 000, 1 ≀ m ≀ 10 000, n β‰₯ 2m)Β β€” the number of participants of the qualifying contest and the number of regions in Berland. Next n lines contain the description of the participants of the qualifying contest in the following format: Surname (a string o...
1,300
Print m lines. On the i-th line print the team of the i-th regionΒ β€” the surnames of the two team members in an arbitrary order, or a single character "?" (without the quotes) if you need to spend further qualifying contests in the region.
standard output
PASSED
8127e2e2e76f48ee53ff596ef5b03f0c
train_003.jsonl
1459353900
Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by n Berland students. There were at least two schoolboys participating from each of the m ...
256 megabytes
import java.io.*; import java.util.*; public class CodeF659B { public static void main(String args[]) throws IOException { InputReader in = new InputReader(System.in); PrintWriter w = new PrintWriter(System.out); int n=in.nextInt(); ArrayList<Triplet> ar=new ArrayList<Tr...
Java
["5 2\nIvanov 1 763\nAndreev 2 800\nPetrov 1 595\nSidorov 1 790\nSemenov 2 503", "5 2\nIvanov 1 800\nAndreev 2 763\nPetrov 1 800\nSidorov 1 800\nSemenov 2 503"]
1 second
["Sidorov Ivanov\nAndreev Semenov", "?\nAndreev Semenov"]
NoteIn the first sample region teams are uniquely determined.In the second sample the team from region 2 is uniquely determined and the team from region 1 can have three teams: "Petrov"-"Sidorov", "Ivanov"-"Sidorov", "Ivanov" -"Petrov", so it is impossible to determine a team uniquely.
Java 8
standard input
[ "constructive algorithms", "sortings" ]
a1ea9eb8db25289958a6f730c555362f
The first line of the input contains two integers n and m (2 ≀ n ≀ 100 000, 1 ≀ m ≀ 10 000, n β‰₯ 2m)Β β€” the number of participants of the qualifying contest and the number of regions in Berland. Next n lines contain the description of the participants of the qualifying contest in the following format: Surname (a string o...
1,300
Print m lines. On the i-th line print the team of the i-th regionΒ β€” the surnames of the two team members in an arbitrary order, or a single character "?" (without the quotes) if you need to spend further qualifying contests in the region.
standard output
PASSED
d4a88bd487d6411aa51c0db3da93f1f4
train_003.jsonl
1606633500
Arkady owns a non-decreasing array $$$a_1, a_2, \ldots, a_n$$$. You are jealous of its beauty and want to destroy this property. You have a so-called XOR-gun that you can use one or more times.In one step you can select two consecutive elements of the array, let's say $$$x$$$ and $$$y$$$, remove them from the array and...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; import java.util.List; import java.util.*; public class realfast implements Runnable { private static final int INF = (int) 1e9; long in= 998244353; long fac[]= new long[3000]; public void solv...
Java
["4\n2 5 6 8", "3\n1 2 3", "5\n1 2 4 6 20"]
2 seconds
["1", "-1", "2"]
NoteIn the first example you can select $$$2$$$ and $$$5$$$ and the array becomes $$$[7, 6, 8]$$$.In the second example you can only obtain arrays $$$[1, 1]$$$, $$$[3, 3]$$$ and $$$[0]$$$ which are all non-decreasing.In the third example you can select $$$1$$$ and $$$2$$$ and the array becomes $$$[3, 4, 6, 20]$$$. Then...
Java 8
standard input
[ "constructive algorithms", "bitmasks", "brute force", "math" ]
51ad613842de8eff6226c97812118b61
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$)Β β€” the initial length of the array. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 10^9$$$)Β β€” the elements of the array. It is guaranteed that $$$a_i \le a_{i + 1}$$$ for all $$$1 \le i &lt; n$$$.
null
Print a single integerΒ β€” the minimum number of steps needed. If there is no solution, print $$$-1$$$.
standard output
PASSED
fe7de2cc938cfc5464bafc059337d669
train_003.jsonl
1606633500
Arkady owns a non-decreasing array $$$a_1, a_2, \ldots, a_n$$$. You are jealous of its beauty and want to destroy this property. You have a so-called XOR-gun that you can use one or more times.In one step you can select two consecutive elements of the array, let's say $$$x$$$ and $$$y$$$, remove them from the array and...
256 megabytes
import java.util.*; import java.io.*; public class B1456 { static int[] xor; public static int getxor(int i, int j) { return xor[j] ^ (i == 0 ? 0 : xor[i - 1]); } public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); ...
Java
["4\n2 5 6 8", "3\n1 2 3", "5\n1 2 4 6 20"]
2 seconds
["1", "-1", "2"]
NoteIn the first example you can select $$$2$$$ and $$$5$$$ and the array becomes $$$[7, 6, 8]$$$.In the second example you can only obtain arrays $$$[1, 1]$$$, $$$[3, 3]$$$ and $$$[0]$$$ which are all non-decreasing.In the third example you can select $$$1$$$ and $$$2$$$ and the array becomes $$$[3, 4, 6, 20]$$$. Then...
Java 8
standard input
[ "constructive algorithms", "bitmasks", "brute force", "math" ]
51ad613842de8eff6226c97812118b61
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$)Β β€” the initial length of the array. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 10^9$$$)Β β€” the elements of the array. It is guaranteed that $$$a_i \le a_{i + 1}$$$ for all $$$1 \le i &lt; n$$$.
null
Print a single integerΒ β€” the minimum number of steps needed. If there is no solution, print $$$-1$$$.
standard output
PASSED
04cbc14acc4e85ccb20328454d85a864
train_003.jsonl
1606633500
Arkady owns a non-decreasing array $$$a_1, a_2, \ldots, a_n$$$. You are jealous of its beauty and want to destroy this property. You have a so-called XOR-gun that you can use one or more times.In one step you can select two consecutive elements of the array, let's say $$$x$$$ and $$$y$$$, remove them from the array and...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Momo { static PrintWriter pw = new PrintWriter(System.out); public static void main(String[] args) throws IOException, InterruptedException { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[n]; for (int i ...
Java
["4\n2 5 6 8", "3\n1 2 3", "5\n1 2 4 6 20"]
2 seconds
["1", "-1", "2"]
NoteIn the first example you can select $$$2$$$ and $$$5$$$ and the array becomes $$$[7, 6, 8]$$$.In the second example you can only obtain arrays $$$[1, 1]$$$, $$$[3, 3]$$$ and $$$[0]$$$ which are all non-decreasing.In the third example you can select $$$1$$$ and $$$2$$$ and the array becomes $$$[3, 4, 6, 20]$$$. Then...
Java 8
standard input
[ "constructive algorithms", "bitmasks", "brute force", "math" ]
51ad613842de8eff6226c97812118b61
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$)Β β€” the initial length of the array. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 10^9$$$)Β β€” the elements of the array. It is guaranteed that $$$a_i \le a_{i + 1}$$$ for all $$$1 \le i &lt; n$$$.
null
Print a single integerΒ β€” the minimum number of steps needed. If there is no solution, print $$$-1$$$.
standard output
PASSED
2a372d5d9f47c276f41aeb981a518f15
train_003.jsonl
1606633500
Arkady owns a non-decreasing array $$$a_1, a_2, \ldots, a_n$$$. You are jealous of its beauty and want to destroy this property. You have a so-called XOR-gun that you can use one or more times.In one step you can select two consecutive elements of the array, let's say $$$x$$$ and $$$y$$$, remove them from the array and...
256 megabytes
import java.util.*; import java.io.*; public class B { public static void main(String[] args) { FastScanner sc = new FastScanner(); int n = sc.nextInt(); int[] arr = new int[n]; int[] acc = new int[n]; for(int i = 0; i < n; i++){ arr[i] = sc.nextInt(); acc[i] = arr[i]; if(i > 0) acc[i] ^= acc[i-1];...
Java
["4\n2 5 6 8", "3\n1 2 3", "5\n1 2 4 6 20"]
2 seconds
["1", "-1", "2"]
NoteIn the first example you can select $$$2$$$ and $$$5$$$ and the array becomes $$$[7, 6, 8]$$$.In the second example you can only obtain arrays $$$[1, 1]$$$, $$$[3, 3]$$$ and $$$[0]$$$ which are all non-decreasing.In the third example you can select $$$1$$$ and $$$2$$$ and the array becomes $$$[3, 4, 6, 20]$$$. Then...
Java 8
standard input
[ "constructive algorithms", "bitmasks", "brute force", "math" ]
51ad613842de8eff6226c97812118b61
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$)Β β€” the initial length of the array. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 10^9$$$)Β β€” the elements of the array. It is guaranteed that $$$a_i \le a_{i + 1}$$$ for all $$$1 \le i &lt; n$$$.
null
Print a single integerΒ β€” the minimum number of steps needed. If there is no solution, print $$$-1$$$.
standard output
PASSED
259df864410666be81adfbb7fbebf5c5
train_003.jsonl
1606633500
Arkady owns a non-decreasing array $$$a_1, a_2, \ldots, a_n$$$. You are jealous of its beauty and want to destroy this property. You have a so-called XOR-gun that you can use one or more times.In one step you can select two consecutive elements of the array, let's say $$$x$$$ and $$$y$$$, remove them from the array and...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.IOException; import java.io.UncheckedIOException; import java.io.Closeable; import java.io.Writer; import java.io.OutputStreamWriter; import java.io.InputStream; /** * Built using CHelper p...
Java
["4\n2 5 6 8", "3\n1 2 3", "5\n1 2 4 6 20"]
2 seconds
["1", "-1", "2"]
NoteIn the first example you can select $$$2$$$ and $$$5$$$ and the array becomes $$$[7, 6, 8]$$$.In the second example you can only obtain arrays $$$[1, 1]$$$, $$$[3, 3]$$$ and $$$[0]$$$ which are all non-decreasing.In the third example you can select $$$1$$$ and $$$2$$$ and the array becomes $$$[3, 4, 6, 20]$$$. Then...
Java 8
standard input
[ "constructive algorithms", "bitmasks", "brute force", "math" ]
51ad613842de8eff6226c97812118b61
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$)Β β€” the initial length of the array. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 10^9$$$)Β β€” the elements of the array. It is guaranteed that $$$a_i \le a_{i + 1}$$$ for all $$$1 \le i &lt; n$$$.
null
Print a single integerΒ β€” the minimum number of steps needed. If there is no solution, print $$$-1$$$.
standard output
PASSED
7118d2027045894890411024104cb060
train_003.jsonl
1606633500
Arkady owns a non-decreasing array $$$a_1, a_2, \ldots, a_n$$$. You are jealous of its beauty and want to destroy this property. You have a so-called XOR-gun that you can use one or more times.In one step you can select two consecutive elements of the array, let's say $$$x$$$ and $$$y$$$, remove them from the array and...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main { static PrintWriter out; static Reader in; public static void main(String[] args) throws IOException { //in = new Reader(new FileInputStream(args[0])); // for test. input_output(); Main solver = new Main()...
Java
["4\n2 5 6 8", "3\n1 2 3", "5\n1 2 4 6 20"]
2 seconds
["1", "-1", "2"]
NoteIn the first example you can select $$$2$$$ and $$$5$$$ and the array becomes $$$[7, 6, 8]$$$.In the second example you can only obtain arrays $$$[1, 1]$$$, $$$[3, 3]$$$ and $$$[0]$$$ which are all non-decreasing.In the third example you can select $$$1$$$ and $$$2$$$ and the array becomes $$$[3, 4, 6, 20]$$$. Then...
Java 8
standard input
[ "constructive algorithms", "bitmasks", "brute force", "math" ]
51ad613842de8eff6226c97812118b61
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$)Β β€” the initial length of the array. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 10^9$$$)Β β€” the elements of the array. It is guaranteed that $$$a_i \le a_{i + 1}$$$ for all $$$1 \le i &lt; n$$$.
null
Print a single integerΒ β€” the minimum number of steps needed. If there is no solution, print $$$-1$$$.
standard output
PASSED
b9b91c5324259a8279a1571ced5f1786
train_003.jsonl
1606633500
Arkady owns a non-decreasing array $$$a_1, a_2, \ldots, a_n$$$. You are jealous of its beauty and want to destroy this property. You have a so-called XOR-gun that you can use one or more times.In one step you can select two consecutive elements of the array, let's say $$$x$$$ and $$$y$$$, remove them from the array and...
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
["4\n2 5 6 8", "3\n1 2 3", "5\n1 2 4 6 20"]
2 seconds
["1", "-1", "2"]
NoteIn the first example you can select $$$2$$$ and $$$5$$$ and the array becomes $$$[7, 6, 8]$$$.In the second example you can only obtain arrays $$$[1, 1]$$$, $$$[3, 3]$$$ and $$$[0]$$$ which are all non-decreasing.In the third example you can select $$$1$$$ and $$$2$$$ and the array becomes $$$[3, 4, 6, 20]$$$. Then...
Java 8
standard input
[ "constructive algorithms", "bitmasks", "brute force", "math" ]
51ad613842de8eff6226c97812118b61
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$)Β β€” the initial length of the array. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 10^9$$$)Β β€” the elements of the array. It is guaranteed that $$$a_i \le a_{i + 1}$$$ for all $$$1 \le i &lt; n$$$.
null
Print a single integerΒ β€” the minimum number of steps needed. If there is no solution, print $$$-1$$$.
standard output
PASSED
11374b9109f169cd0151e1cb7cdedf1e
train_003.jsonl
1606633500
Arkady owns a non-decreasing array $$$a_1, a_2, \ldots, a_n$$$. You are jealous of its beauty and want to destroy this property. You have a so-called XOR-gun that you can use one or more times.In one step you can select two consecutive elements of the array, let's say $$$x$$$ and $$$y$$$, remove them from the array and...
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
["4\n2 5 6 8", "3\n1 2 3", "5\n1 2 4 6 20"]
2 seconds
["1", "-1", "2"]
NoteIn the first example you can select $$$2$$$ and $$$5$$$ and the array becomes $$$[7, 6, 8]$$$.In the second example you can only obtain arrays $$$[1, 1]$$$, $$$[3, 3]$$$ and $$$[0]$$$ which are all non-decreasing.In the third example you can select $$$1$$$ and $$$2$$$ and the array becomes $$$[3, 4, 6, 20]$$$. Then...
Java 8
standard input
[ "constructive algorithms", "bitmasks", "brute force", "math" ]
51ad613842de8eff6226c97812118b61
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$)Β β€” the initial length of the array. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 10^9$$$)Β β€” the elements of the array. It is guaranteed that $$$a_i \le a_{i + 1}$$$ for all $$$1 \le i &lt; n$$$.
null
Print a single integerΒ β€” the minimum number of steps needed. If there is no solution, print $$$-1$$$.
standard output
PASSED
d642459a7bb175846ee678d4ba2288f7
train_003.jsonl
1606633500
Arkady owns a non-decreasing array $$$a_1, a_2, \ldots, a_n$$$. You are jealous of its beauty and want to destroy this property. You have a so-called XOR-gun that you can use one or more times.In one step you can select two consecutive elements of the array, let's say $$$x$$$ and $$$y$$$, remove them from the array and...
256 megabytes
import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import java.util.*; import java.io.*; import java.math.*; public class B { public static void main(String hi[]) throws Exception { BufferedReader infile = new BufferedReader(new InputStreamR...
Java
["4\n2 5 6 8", "3\n1 2 3", "5\n1 2 4 6 20"]
2 seconds
["1", "-1", "2"]
NoteIn the first example you can select $$$2$$$ and $$$5$$$ and the array becomes $$$[7, 6, 8]$$$.In the second example you can only obtain arrays $$$[1, 1]$$$, $$$[3, 3]$$$ and $$$[0]$$$ which are all non-decreasing.In the third example you can select $$$1$$$ and $$$2$$$ and the array becomes $$$[3, 4, 6, 20]$$$. Then...
Java 8
standard input
[ "constructive algorithms", "bitmasks", "brute force", "math" ]
51ad613842de8eff6226c97812118b61
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$)Β β€” the initial length of the array. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 10^9$$$)Β β€” the elements of the array. It is guaranteed that $$$a_i \le a_{i + 1}$$$ for all $$$1 \le i &lt; n$$$.
null
Print a single integerΒ β€” the minimum number of steps needed. If there is no solution, print $$$-1$$$.
standard output
PASSED
677c94a4b7a471f6684dbdf12dd09c1d
train_003.jsonl
1606633500
Arkady owns a non-decreasing array $$$a_1, a_2, \ldots, a_n$$$. You are jealous of its beauty and want to destroy this property. You have a so-called XOR-gun that you can use one or more times.In one step you can select two consecutive elements of the array, let's say $$$x$$$ and $$$y$$$, remove them from the array and...
256 megabytes
import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import java.util.*; import java.io.*; import java.math.*; public class B { public static void main(String hi[]) throws Exception { BufferedReader infile = new BufferedReader(new InputStreamR...
Java
["4\n2 5 6 8", "3\n1 2 3", "5\n1 2 4 6 20"]
2 seconds
["1", "-1", "2"]
NoteIn the first example you can select $$$2$$$ and $$$5$$$ and the array becomes $$$[7, 6, 8]$$$.In the second example you can only obtain arrays $$$[1, 1]$$$, $$$[3, 3]$$$ and $$$[0]$$$ which are all non-decreasing.In the third example you can select $$$1$$$ and $$$2$$$ and the array becomes $$$[3, 4, 6, 20]$$$. Then...
Java 8
standard input
[ "constructive algorithms", "bitmasks", "brute force", "math" ]
51ad613842de8eff6226c97812118b61
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$)Β β€” the initial length of the array. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 10^9$$$)Β β€” the elements of the array. It is guaranteed that $$$a_i \le a_{i + 1}$$$ for all $$$1 \le i &lt; n$$$.
null
Print a single integerΒ β€” the minimum number of steps needed. If there is no solution, print $$$-1$$$.
standard output
PASSED
6a29ac86a2a45411ffba36fdf23dcc46
train_003.jsonl
1606633500
Arkady owns a non-decreasing array $$$a_1, a_2, \ldots, a_n$$$. You are jealous of its beauty and want to destroy this property. You have a so-called XOR-gun that you can use one or more times.In one step you can select two consecutive elements of the array, let's say $$$x$$$ and $$$y$$$, remove them from the array and...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { static int MOD = 1000000007; // After writing solution, quick scan for: // array out of bounds // special cases e.g. n=1? // // Big numbers arithmetic bugs: // int overflow // sorting, or tak...
Java
["4\n2 5 6 8", "3\n1 2 3", "5\n1 2 4 6 20"]
2 seconds
["1", "-1", "2"]
NoteIn the first example you can select $$$2$$$ and $$$5$$$ and the array becomes $$$[7, 6, 8]$$$.In the second example you can only obtain arrays $$$[1, 1]$$$, $$$[3, 3]$$$ and $$$[0]$$$ which are all non-decreasing.In the third example you can select $$$1$$$ and $$$2$$$ and the array becomes $$$[3, 4, 6, 20]$$$. Then...
Java 8
standard input
[ "constructive algorithms", "bitmasks", "brute force", "math" ]
51ad613842de8eff6226c97812118b61
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$)Β β€” the initial length of the array. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 10^9$$$)Β β€” the elements of the array. It is guaranteed that $$$a_i \le a_{i + 1}$$$ for all $$$1 \le i &lt; n$$$.
null
Print a single integerΒ β€” the minimum number of steps needed. If there is no solution, print $$$-1$$$.
standard output
PASSED
4f710c3aaa3ad35aed65569e58d97df2
train_003.jsonl
1329750000
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≀ i &lt; j ≀ n,...
256 megabytes
import java.io.*; import java.util.*; public class C { public static void main(String[] args)throws IOException { BufferedReader ob = new BufferedReader(new InputStreamReader(System.in)); StringBuffer sb = new StringBuffer(); String s[]=ob.readLine().split(" "); int n=Integer.parseInt(s[0]); lon...
Java
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
2 seconds
["4", "216"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
Java 8
standard input
[ "combinatorics" ]
a37df9b239a40473516d1525d56a0da7
The first input line contains two integers n and m (1 ≀ n, m ≀ 100) β€” the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
1,400
Print the single number β€” the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
standard output
PASSED
baf1683fcd6377d7046b4ba6d34a4792
train_003.jsonl
1329750000
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≀ i &lt; j ≀ n,...
256 megabytes
import java.io.*; import java.util.*; public class C { public static void main(String[] args)throws IOException { BufferedReader ob = new BufferedReader(new InputStreamReader(System.in)); StringBuffer sb = new StringBuffer(); String s[]=ob.readLine().split(" "); int n=Integer.parseInt(s[0]); lon...
Java
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
2 seconds
["4", "216"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
Java 8
standard input
[ "combinatorics" ]
a37df9b239a40473516d1525d56a0da7
The first input line contains two integers n and m (1 ≀ n, m ≀ 100) β€” the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
1,400
Print the single number β€” the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
standard output
PASSED
21c58d5c5c3dba3e8ce322b89443537b
train_003.jsonl
1329750000
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≀ i &lt; j ≀ n,...
256 megabytes
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; /** * @author johnny16 * */ public class PocketBook { static int mod = 1000000007; static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int buf...
Java
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
2 seconds
["4", "216"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
Java 8
standard input
[ "combinatorics" ]
a37df9b239a40473516d1525d56a0da7
The first input line contains two integers n and m (1 ≀ n, m ≀ 100) β€” the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
1,400
Print the single number β€” the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
standard output
PASSED
e4472c484008bc56e4f8d4000a853b4f
train_003.jsonl
1329750000
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≀ i &lt; j ≀ n,...
256 megabytes
import java.util.*; public class PocketBook { static final int MODULO = 1000000007; public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); char[][] book = new char[n][m]; for (int i = 0; i < n; i++) { book[i] = in.next().toChar...
Java
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
2 seconds
["4", "216"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
Java 8
standard input
[ "combinatorics" ]
a37df9b239a40473516d1525d56a0da7
The first input line contains two integers n and m (1 ≀ n, m ≀ 100) β€” the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
1,400
Print the single number β€” the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
standard output
PASSED
a7ee840276cb94bea23a120182766415
train_003.jsonl
1329750000
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≀ i &lt; j ≀ n,...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.URISyntaxException; import java.util.StringTokenizer; public class Main { public static void main(String[] args)throws IOExcepti...
Java
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
2 seconds
["4", "216"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
Java 8
standard input
[ "combinatorics" ]
a37df9b239a40473516d1525d56a0da7
The first input line contains two integers n and m (1 ≀ n, m ≀ 100) β€” the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
1,400
Print the single number β€” the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
standard output
PASSED
9800b4bb3552df81c391a99227ac5100
train_003.jsonl
1329750000
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≀ i &lt; j ≀ n,...
256 megabytes
import java.util.Arrays; import java.util.Scanner; import java.util.stream.IntStream; public class Main { static final int MODULUS = 1_000_000_007; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); String[] names = new String[n]; for...
Java
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
2 seconds
["4", "216"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
Java 8
standard input
[ "combinatorics" ]
a37df9b239a40473516d1525d56a0da7
The first input line contains two integers n and m (1 ≀ n, m ≀ 100) β€” the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
1,400
Print the single number β€” the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
standard output
PASSED
8df19847964e078fc57cdab3f150d8d8
train_003.jsonl
1329750000
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≀ i &lt; j ≀ n,...
256 megabytes
/** * ******* Created on 5/12/19 7:57 PM******* */ import java.io.*; import java.util.*; public class C152 implements Runnable { private static final int MAX = (int) (1E5 + 5); private static final int MOD = (int) (1E9 + 7); private static final int Inf = (int) (1E9 + 10); private void solve() th...
Java
["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"]
2 seconds
["4", "216"]
NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB".
Java 8
standard input
[ "combinatorics" ]
a37df9b239a40473516d1525d56a0da7
The first input line contains two integers n and m (1 ≀ n, m ≀ 100) β€” the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters.
1,400
Print the single number β€” the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7).
standard output