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
f61a2b9213b50dae9202b17434459432
train_002.jsonl
1363879800
Permutation p is an ordered set of integers p1,  p2,  ...,  pn, consisting of n distinct positive integers, each of them doesn't exceed n. We'll denote the i-th element of permutation p as pi. We'll call number n the size or the length of permutation p1,  p2,  ...,  pn.You have a sequence of integers a1, a2, ..., an. I...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { Buffered...
Java
["2\n3 0", "3\n-1 -1 2"]
1 second
["2", "6"]
NoteIn the first sample you should decrease the first number by one and then increase the second number by one. The resulting permutation is (2, 1).In the second sample you need 6 moves to build permutation (1, 3, 2).
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
86d5da999415fa75b3ee754a2a28605c
The first line contains integer n (1 ≀ n ≀ 3Β·105) β€” the size of the sought permutation. The second line contains n integers a1, a2, ..., an ( - 109 ≀ ai ≀ 109).
1,200
Print a single number β€” the minimum number of moves. Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preferred to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
e26579594b80d2c5b20c7787e362136f
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.util.Scanner; public class Football { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t; t = scanner.nextInt(); scanner.nextLine(); int x = 0, y = 0; String first = null, second = null, temp; temp = scanner....
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
3dc69beb54fb0acb61e36f6f87e5a35f
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.util.Scanner; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author Zaid */ public class Football { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner s = new Scanner (System....
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
fa584cd8245424a0ddca00eda4cac20d
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.util.Scanner; public class sa { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); sc.nextLine(); String s=sc.nextLine(),g=""; int a=1,b=0; for(int i=1;i<n;i++) { String sa=sc.nextLine(); if(s.equals(sa)) { a++; } else { g=sa; b++; ...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
5db462871451a3c5f8a948de02c23d56
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.util.*; public class whictm { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int cnt1 = 0; int cnt2 = 0; String first = ""; String sec = ""; int n = Integer.valueOf(sc.nextLine()); while (n > 0) { String s = sc.nextLine(); if (first.equals("") || s.eq...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
6643b1693d96c64941a3d31b3faf8192
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Map<String,Integer> map= new HashMap<String,Integer>(); Scanner input= new Scanner(System.in); int n= input.nextInt();String temp; for(int i=0;i<n;i++){ temp=input.next(); if(!map.containsKey(temp)) map.put(temp,0); ...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
e6831b438ee5b455648df9b80450a6f4
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.util.Scanner; public class Football { public static void main(String[] args) { Scanner cin = new Scanner(System.in); String a; String b = ""; int n = cin.nextInt(); int m = 0; a = cin.next(); m++; for (int i = 1; i < n; i++) { ...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
dd1abb08c25e632172e07454a1ff8b14
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.util.*; public class F { public static void main(String[] args) { Scanner o = new Scanner(System.in); String[] s = new String[o.nextInt()]; String x = ""; int count = 0; for (int i = 0; i < s.length; i++) s[i] = o.next(); Arrays.sort(s); ...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
7a451c9fe6fd8e7222101b9742ed459b
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.util.HashMap; import java.util.Set; import java.io.OutputStream; import java.io.PrintWriter; import java.util.NoSuchElementException; import java.io.Writer; import java.math...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
88ff4beb69e8bd6aa7018a4747bb549b
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.Comparator; import java.util.InputMismatchException; import javax.swing.text.GapContent; public class Task { public static void main(String[] args) { solve(); } static void solve() { int n = ...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
f85d09df4c1162b480a6f2bf2bcfdcae
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String ar[])throws Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int n=Integer.parseInt(br.readLine()); Hashtable<String,Integer> goal=new Hashtable<String,Integer>(); String teamw=""; in...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
b05f407778a11404d40c2f6cc30b0d7c
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.util.Scanner; import java.util.ArrayList; public class Football{ public static void main(String args[]){ Scanner in = new Scanner(System.in); int n = in.nextInt(); int l[] = new int[n]; ArrayList<String> s = new ArrayList<String>(); for(int ...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
45ce7a4d927cf9d3bd5d5576a37eebfd
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.util.Scanner; public class Football{ public static void main(String args[]){ Scanner in = new Scanner(System.in); int n = in.nextInt(); int l[] = new int[2]; String temp = in.next(); l[0]++; String temp1 = ""; for(int...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
9a6fe7d31d5c13d3a91e95612801259c
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
//package Codeforces.Div2A_42.Code1; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Map; import java.util.StringTokenizer; import java.util.TreeMap; /* * some cheeky quote */ public class Main { FastScanner in; Print...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
0d7a721f6f7becb0aa6cbcf6229cd093
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.io.*; import java.util.*; public class Football2 { public static void main(String[] args) throws IOException { BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(f.readLine()); HashMap<String,Integer> hm = new HashMap<String,Integer...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
0c194ef9652afb2e341e800270f1c576
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.HashMap; import java.util.Iterator; public class Football { public static void main(String [] args) throws IOException { Buffe...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
406e482f48b50a9074336078eb2649ff
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.util.Scanner; /** * * @author Haddad */ public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int x = s.nextInt(); int count = 0; String a=s.next(); count+=1; String c = ""; for(int i=0;i<x-1;i++){ ...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
c7067c593e2a672daed4e1de6082fa3a
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.io.*; public class Football { public static void main(String[] args) throws IOException { BufferedReader ob=new BufferedReader(new InputStreamReader(System.in)); int n=Integer.parseInt(ob.readLine()); int i;int c1=0,c2=0;String s1=ob.readLine();c1++;String s2=""; for(...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
15eff527768470bd8ee2077033633cb4
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.util.Scanner; public class memo{ public static void main (String[]args){ Scanner sc = new Scanner(System.in); String s=sc.nextLine(); int num=Integer.parseInt(s); int g1=1; int g2=0; String team1; String team2=null; team1=sc.nextLine(); if(num==1)Sys...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
43bccfb04c9ea9af662e625968b5a48c
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String args[] ) throws Exception { Scanner in = new Scanner(System.in); int n = in.nextInt(),indexes[]=new int[n],index=0,max=0; String teams [] = new String [n]; ...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
7a49eb20a1f1585a521fad487ed0626d
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.util.Scanner; /** * * @author kai */ public class JavaApplication10 { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Scanner in = new Scanner(System.in); int n = in.nextInt(), c1 = 0,...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
32e839bed9358866e682208f5729c558
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io....
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
b8e51fd6a89331868e6f3ce6412f11a2
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.util.*; public class read { public static int count=0; public static int max=0; public static String win=""; //public static String re=""; public static void main(String[] args) throws Exception { Scanner input=new Scanner(System.in); // Scanner input = new Scanner(System.in)); ...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
0f15503d605e737d1f9e593afdeef809
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.util.Scanner; public class A_43_Football { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String sentence[] = new String[n]; sentence[0] = sc.next(); String first = sentence[0]; String second = ""; if (n == 1) { System.out.println(first...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
f17f061b8b8c310f5785067335b5d063
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.util.Scanner; public class Football { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n,counter=0,m=0; n=sc.nextInt(); String[]a=new String[n]; for(int i=0;i<n;i++) { a[i]=sc.next(); } ...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
1614e051eb36e165c473269d1ed40278
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.io.IOException; import java.util.Scanner; public class Main { public static void main(String[] args)throws IOException { Scanner sc=new Scanner(new java.io.BufferedInputStream(System.in)); int goals=sc.nextInt(); int score=1; String team1=sc.next(); String tea...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
94ce55e9bf366b29a9e614870d20c3ab
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.io.IOException; import java.util.Scanner; public class Main { public static void main(String[] args)throws IOException { Scanner sc=new Scanner(new java.io.BufferedInputStream(System.in)); int goals=sc.nextInt(); int score=1; String team1=sc.next(); String tea...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
e054f2521b86a5d05d51dfc627c3b296
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.io.IOException; import java.util.Scanner; public class Main { public static void main(String[] args)throws IOException { Scanner sc=new Scanner(new java.io.BufferedInputStream(System.in)); int goals=sc.nextInt(); int score=1; String team1=sc.next(); String tea...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
b7a5a4f2701b4fb62cfb39dfb890d5f2
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
//package codeforces; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.uti...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
e6a7a90e352d053dda45db8d04f113dc
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.util.Scanner; public class palin { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(), res = 1; String str = scan.next(), str2 = "", temp; for (int i = 0; i < n - 1; i++) { temp = scan.next(); if (str.equals(temp)) { res++; } else { ...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
316158e9688a93fb43ec6146f9cfd068
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class a { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); ArrayList<String> l=new ArrayList<String>(); for(int i=0;i<n;i++) l.add(sc.next()); Collections...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
7a765954a703271be55cc9b826403ef0
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.util.Scanner; public class Football { public static void main(String[] args) { Scanner sin = new Scanner(System.in); int n = sin.nextInt(), count1 = 1; String a = sin.next(), b = ""; for(int i = 1 ; i < n; i++) { String temp = sin.next(); i...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
095b2b4865a44aa88790bd3b1008c7b3
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class A43 { public static void main(String[] args) { Scanner input = new Scanner(System.in); int N = input.nextInt(); Map<String,Integer> map = new HashMap<String,Integer>(); for (int n=0; n<N; n++) { ...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
48a09a4fb33cba7804648161bace30e9
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class a { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); ArrayList<String> l=new ArrayList<String>(); for(int i=0;i<n;i++) l.add(sc.next()); Collections...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
36b354c5b25dbd6093502b443cea10d7
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.util.*; public class tmp { public static void main(String [] args){ Scanner scan = new Scanner(System.in); int n = scan.nextInt(); String team1 = scan.next(), team2=""; int s1=1, s2=0; String s; for(int i=1; i<n; i++){ s = s...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
11b7fa4a1cfec6d69f3cd736b58e35fd
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Reader.init(System.in); int n=Reader.nextInt(); String s=""; for (int i = 0; i < n; i++) s+=Reader.reader.readLine()+" "; {String ...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
ea9d30f7c1606b91ea0a250314a3417a
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.HashMap; import java.util.Set; public class HelpfulMath { public static void main(String[] agrs) throws IOException { BufferedReader reader = new BufferedReader(new InputS...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
457b86b9d3b0a8d37c1fcd98dbc22e3c
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Scanner; import java.util.Set; public class Main { public static String getMax(HashMap<String, Integer> map, String[] a) { if (a[1] == null) { ...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
4fe9c47145dcefc0199d6278f16b6ae2
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; public class Main { static int current = 0; public static void updateArray(String[][] arr, String s) { boolean b = true; for (int i = 0; i < arr.length; i++) { if (s.equals(arr[i][0])) { ...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
f792c1d80fbaa8323a93cf70c3676fee
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.util.Scanner; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author Twins */ public class Football { /** * @param args the command line argument...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
79c087d49379778947c158d55b7dac36
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.util.*; public class read { public static int count=0; public static int max=0; public static String win=""; //public static String re=""; public static void main(String[] args) throws Exception { Scanner input=new Scanner(System.in); // Scanner input = new Scanner(System.in)); ...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
ad527ccd830799f7f73378e3f086b9f5
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.util.HashMap; import java.util.Iterator; import java.util.Scanner; public class problem43A { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int n = sc.nextInt(); HashMap<String, Integer> hash = new HashMap<>(); for(int i=0;i<n...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
c9ae878b2b1bd8f721f41f33d232c565
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.util.Scanner; public class Main { public static Scanner leer = new Scanner(System.in); public static void main(String[] args) { int n = leer.nextInt(); int p = 0; String v[] = new String[n]; int ve[] = new int[n]; for (int i = 0; i < n; i++) { St...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
66b0ff3254bf5b9acf8c2d75273881c5
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; public class main { public static void main(String[] args) { // TODO Auto-generated method stub try { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readL...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
de0e71d26787d5672648e7bb900a0683
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; public class football { public static void main(String[] args) { try { BufferedReader br = new BufferedReader (new InputStreamReader (System.in)); String[] arr = new String [2]; ...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
3242d320f0eaca7a1f4822a640f02673
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
/* package whatever; // don't place package name! */ import java.io.*; import java.util.StringTokenizer; /* Name of the class has to be "Main" only if the class is public. */ public class Main { public static void main (String[] args) throws java.lang.Exception { BufferedReader r = new BufferedReader ...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
4b7cf94708280bdf8a506dd6683f31b6
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.util.Scanner; /** * * @author mohammad */ public class football2 { public static void main(String[] args) { ...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
26752d163d4f4739b58d5648bee34f74
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.util.*; public class Football{ public static void main(String[] args){ Scanner scan = new Scanner(System.in); int n = scan.nextInt(); Hashtable t = new Hashtable(); for(int i = 0; i < n; i++){ String team = scan.next(); if(t.containsKey(team)){ t.put(team, (int) t.get(team) + 1); }el...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
1c2ea8ea515265442b73bfb2d6c8016c
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.io.*; import java.util.*; public class anotherFootball { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String aux; int n = Integer.parseInt(br.readLine()); String word = br.readLine(); S...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
3eb6e2fb5d7327f8625559d64e79b41b
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
226a6962356e74975e097150586d71b4
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
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
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
85385dd82bd8fccfe60830853c765313
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
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.Iterator; import java.io.BufferedWriter; import java.util.Set; import java.util.HashMap; import java.util.InputMismatchException; import java.io.IOException; imp...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
cefdb277b6171a81d34100e3729a4dfb
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String tab[]= new String[n]; for(int i=0;i<n;i++) tab[i]=sc.next(); int a1=1,a2=0; String equ2=""; for(int i=1;i<n;i++) if(tab[i].equals(tab[0])) ...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
276025f7cc0e291f156b1eceee1feed7
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main{ public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int goals = Integer.parseInt(br.readLine()); int a = 0; String teamA ...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
eca46975e025b55ea4a88383386e2827
train_002.jsonl
1291046400
One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there are n lines in that description each of which described one goal. Eve...
256 megabytes
import java.util.Scanner; public class Football2 { public static void main(String[] args) { Scanner cs = new Scanner(System.in) ; short line = cs.nextShort() ; String [] arr = new String[line] ; short farst = 0 ; short scend = 0 ; for...
Java
["1\nABC", "5\nA\nABA\nABA\nA\nA"]
2 seconds
["ABC", "A"]
null
Java 7
standard input
[ "strings" ]
e3dcb1cf2186bf7e67fd8da20c1242a9
The first line contains an integer n (1 ≀ n ≀ 100) β€” the number of lines in the description. Then follow n lines β€” for each goal the names of the teams that scored it. The names are non-empty lines consisting of uppercase Latin letters whose lengths do not exceed 10 symbols. It is guaranteed that the match did not end ...
1,000
Print the name of the winning team. We remind you that in football the team that scores more goals is considered the winner.
standard output
PASSED
bb4ed861579e400f4991207a9c4e4311
train_002.jsonl
1598798100
T is playing a game with his friend, HL.There are $$$n$$$ piles of stones, the $$$i$$$-th pile initially has $$$a_i$$$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has bee...
256 megabytes
import java.io.*; import java.util.*; public class Manikya { BufferedReader br; PrintWriter out; void solve() { int t = ni(); while(t-- > 0) { int n = ni(); PriorityQueue<Integer> pq = new PriorityQueue<Integer>(Collections.reverseOrder()); for(in...
Java
["2\n1\n2\n2\n1 1"]
1 second
["T\nHL"]
NoteIn the first game, T removes a single stone from the only pile in his first turn. After that, although the pile still contains $$$1$$$ stone, HL cannot choose from this pile because it has been chosen by T in the previous turn. Therefore, T is the winner.
Java 11
standard input
[ "implementation", "greedy", "games", "brute force" ]
5bfce6c17af24959b4af3c9408536d05
The first line of the input contains a single integer $$$t$$$ $$$(1 \le t \le 100)$$$ β€” the number of games. The description of the games follows. Each description contains two lines: The first line contains a single integer $$$n$$$ $$$(1 \le n \le 100)$$$ β€” the number of piles. The second line contains $$$n$$$ integer...
1,800
For each game, print on a single line the name of the winner, "T" or "HL" (without quotes)
standard output
PASSED
2b0df97b67084f4da0c7c31b7a6b2096
train_002.jsonl
1598798100
T is playing a game with his friend, HL.There are $$$n$$$ piles of stones, the $$$i$$$-th pile initially has $$$a_i$$$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has bee...
256 megabytes
import java.io.*; public class StonedGames { public static void main(String []args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); for(int i=0;i<n;i++){ int arr_length = Integer.parseInt(br...
Java
["2\n1\n2\n2\n1 1"]
1 second
["T\nHL"]
NoteIn the first game, T removes a single stone from the only pile in his first turn. After that, although the pile still contains $$$1$$$ stone, HL cannot choose from this pile because it has been chosen by T in the previous turn. Therefore, T is the winner.
Java 11
standard input
[ "implementation", "greedy", "games", "brute force" ]
5bfce6c17af24959b4af3c9408536d05
The first line of the input contains a single integer $$$t$$$ $$$(1 \le t \le 100)$$$ β€” the number of games. The description of the games follows. Each description contains two lines: The first line contains a single integer $$$n$$$ $$$(1 \le n \le 100)$$$ β€” the number of piles. The second line contains $$$n$$$ integer...
1,800
For each game, print on a single line the name of the winner, "T" or "HL" (without quotes)
standard output
PASSED
05ac3c99921db61c1b7517b5ef1990f2
train_002.jsonl
1598798100
T is playing a game with his friend, HL.There are $$$n$$$ piles of stones, the $$$i$$$-th pile initially has $$$a_i$$$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has bee...
256 megabytes
import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.util.*; public class Main { public static void main(String[] args) { Problems problems = new Problems(); problems.solve(); } } class Problems { Parser parser = new Parser(); void...
Java
["2\n1\n2\n2\n1 1"]
1 second
["T\nHL"]
NoteIn the first game, T removes a single stone from the only pile in his first turn. After that, although the pile still contains $$$1$$$ stone, HL cannot choose from this pile because it has been chosen by T in the previous turn. Therefore, T is the winner.
Java 11
standard input
[ "implementation", "greedy", "games", "brute force" ]
5bfce6c17af24959b4af3c9408536d05
The first line of the input contains a single integer $$$t$$$ $$$(1 \le t \le 100)$$$ β€” the number of games. The description of the games follows. Each description contains two lines: The first line contains a single integer $$$n$$$ $$$(1 \le n \le 100)$$$ β€” the number of piles. The second line contains $$$n$$$ integer...
1,800
For each game, print on a single line the name of the winner, "T" or "HL" (without quotes)
standard output
PASSED
7673d5e937d92794b96bcebd7e9955a6
train_002.jsonl
1598798100
T is playing a game with his friend, HL.There are $$$n$$$ piles of stones, the $$$i$$$-th pile initially has $$$a_i$$$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has bee...
256 megabytes
/* Author: Anthony Ngene Created: 31/08/2020 - 06:38 */ import java.io.*; import java.util.*; public class D { // Do not take life too seriously. You will never get out of it alive. - Elbert Hubbard public static void main(String[] args) throws IOException { in = new FastScanner(); in...
Java
["2\n1\n2\n2\n1 1"]
1 second
["T\nHL"]
NoteIn the first game, T removes a single stone from the only pile in his first turn. After that, although the pile still contains $$$1$$$ stone, HL cannot choose from this pile because it has been chosen by T in the previous turn. Therefore, T is the winner.
Java 11
standard input
[ "implementation", "greedy", "games", "brute force" ]
5bfce6c17af24959b4af3c9408536d05
The first line of the input contains a single integer $$$t$$$ $$$(1 \le t \le 100)$$$ β€” the number of games. The description of the games follows. Each description contains two lines: The first line contains a single integer $$$n$$$ $$$(1 \le n \le 100)$$$ β€” the number of piles. The second line contains $$$n$$$ integer...
1,800
For each game, print on a single line the name of the winner, "T" or "HL" (without quotes)
standard output
PASSED
66a29424d383116aec6888b223d0f471
train_002.jsonl
1598798100
T is playing a game with his friend, HL.There are $$$n$$$ piles of stones, the $$$i$$$-th pile initially has $$$a_i$$$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has bee...
256 megabytes
import java.util.*; import java.io.*; public class A { static FastReader f = new FastReader(); static PrintWriter out = new PrintWriter(System.out); public static void main(String[] args) { int t = f.nextInt(); while(t-- > 0) { solve(); } out.close(); } static void solve() { int n = f.nextInt(); ...
Java
["2\n1\n2\n2\n1 1"]
1 second
["T\nHL"]
NoteIn the first game, T removes a single stone from the only pile in his first turn. After that, although the pile still contains $$$1$$$ stone, HL cannot choose from this pile because it has been chosen by T in the previous turn. Therefore, T is the winner.
Java 11
standard input
[ "implementation", "greedy", "games", "brute force" ]
5bfce6c17af24959b4af3c9408536d05
The first line of the input contains a single integer $$$t$$$ $$$(1 \le t \le 100)$$$ β€” the number of games. The description of the games follows. Each description contains two lines: The first line contains a single integer $$$n$$$ $$$(1 \le n \le 100)$$$ β€” the number of piles. The second line contains $$$n$$$ integer...
1,800
For each game, print on a single line the name of the winner, "T" or "HL" (without quotes)
standard output
PASSED
41dd02bcf76df4ce43186220cddce4e6
train_002.jsonl
1598798100
T is playing a game with his friend, HL.There are $$$n$$$ piles of stones, the $$$i$$$-th pile initially has $$$a_i$$$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has bee...
256 megabytes
/****************************************************************************** Online Java Compiler. Code, Compile, Run and Debug java program online. Write your code in this editor and press "Run" button to execute it. *****************************************************...
Java
["2\n1\n2\n2\n1 1"]
1 second
["T\nHL"]
NoteIn the first game, T removes a single stone from the only pile in his first turn. After that, although the pile still contains $$$1$$$ stone, HL cannot choose from this pile because it has been chosen by T in the previous turn. Therefore, T is the winner.
Java 11
standard input
[ "implementation", "greedy", "games", "brute force" ]
5bfce6c17af24959b4af3c9408536d05
The first line of the input contains a single integer $$$t$$$ $$$(1 \le t \le 100)$$$ β€” the number of games. The description of the games follows. Each description contains two lines: The first line contains a single integer $$$n$$$ $$$(1 \le n \le 100)$$$ β€” the number of piles. The second line contains $$$n$$$ integer...
1,800
For each game, print on a single line the name of the winner, "T" or "HL" (without quotes)
standard output
PASSED
ed13d07579794b57d4b8fc480464f049
train_002.jsonl
1598798100
T is playing a game with his friend, HL.There are $$$n$$$ piles of stones, the $$$i$$$-th pile initially has $$$a_i$$$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has bee...
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.Arrays; import java.util.Collections; import java.util.LinkedList; import java.util.PriorityQue...
Java
["2\n1\n2\n2\n1 1"]
1 second
["T\nHL"]
NoteIn the first game, T removes a single stone from the only pile in his first turn. After that, although the pile still contains $$$1$$$ stone, HL cannot choose from this pile because it has been chosen by T in the previous turn. Therefore, T is the winner.
Java 11
standard input
[ "implementation", "greedy", "games", "brute force" ]
5bfce6c17af24959b4af3c9408536d05
The first line of the input contains a single integer $$$t$$$ $$$(1 \le t \le 100)$$$ β€” the number of games. The description of the games follows. Each description contains two lines: The first line contains a single integer $$$n$$$ $$$(1 \le n \le 100)$$$ β€” the number of piles. The second line contains $$$n$$$ integer...
1,800
For each game, print on a single line the name of the winner, "T" or "HL" (without quotes)
standard output
PASSED
93750fdd603238baa186bb7750ac1d84
train_002.jsonl
1598798100
T is playing a game with his friend, HL.There are $$$n$$$ piles of stones, the $$$i$$$-th pile initially has $$$a_i$$$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has bee...
256 megabytes
import java.io.*; import java.util.*; public class d2666 implements Runnable { private boolean console=false; public void solve() { int i; int n=in.ni(); int a[]=new int[n]; int v=0; for(i=0;i<n;i++) { a[i]=in.ni(); v+=a[i]; } if(n==1) { out.println("T"); return; } else if(n==2)...
Java
["2\n1\n2\n2\n1 1"]
1 second
["T\nHL"]
NoteIn the first game, T removes a single stone from the only pile in his first turn. After that, although the pile still contains $$$1$$$ stone, HL cannot choose from this pile because it has been chosen by T in the previous turn. Therefore, T is the winner.
Java 11
standard input
[ "implementation", "greedy", "games", "brute force" ]
5bfce6c17af24959b4af3c9408536d05
The first line of the input contains a single integer $$$t$$$ $$$(1 \le t \le 100)$$$ β€” the number of games. The description of the games follows. Each description contains two lines: The first line contains a single integer $$$n$$$ $$$(1 \le n \le 100)$$$ β€” the number of piles. The second line contains $$$n$$$ integer...
1,800
For each game, print on a single line the name of the winner, "T" or "HL" (without quotes)
standard output
PASSED
83e1a9608831f17adea1dc03f5a15ef7
train_002.jsonl
1598798100
T is playing a game with his friend, HL.There are $$$n$$$ piles of stones, the $$$i$$$-th pile initially has $$$a_i$$$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has bee...
256 megabytes
import java.io.*; import java.util.*; public class Main { private static final boolean N_CASE = true; private void solve() { int n = sc.nextInt(); int[] a = sc.nextIntArray(n); if (n == 1) { out.println("T"); return; } int sum = 0; int...
Java
["2\n1\n2\n2\n1 1"]
1 second
["T\nHL"]
NoteIn the first game, T removes a single stone from the only pile in his first turn. After that, although the pile still contains $$$1$$$ stone, HL cannot choose from this pile because it has been chosen by T in the previous turn. Therefore, T is the winner.
Java 11
standard input
[ "implementation", "greedy", "games", "brute force" ]
5bfce6c17af24959b4af3c9408536d05
The first line of the input contains a single integer $$$t$$$ $$$(1 \le t \le 100)$$$ β€” the number of games. The description of the games follows. Each description contains two lines: The first line contains a single integer $$$n$$$ $$$(1 \le n \le 100)$$$ β€” the number of piles. The second line contains $$$n$$$ integer...
1,800
For each game, print on a single line the name of the winner, "T" or "HL" (without quotes)
standard output
PASSED
dabcb0ff0c3c687c937db4c5c29403e5
train_002.jsonl
1598798100
T is playing a game with his friend, HL.There are $$$n$$$ piles of stones, the $$$i$$$-th pile initially has $$$a_i$$$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has bee...
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
["2\n1\n2\n2\n1 1"]
1 second
["T\nHL"]
NoteIn the first game, T removes a single stone from the only pile in his first turn. After that, although the pile still contains $$$1$$$ stone, HL cannot choose from this pile because it has been chosen by T in the previous turn. Therefore, T is the winner.
Java 11
standard input
[ "implementation", "greedy", "games", "brute force" ]
5bfce6c17af24959b4af3c9408536d05
The first line of the input contains a single integer $$$t$$$ $$$(1 \le t \le 100)$$$ β€” the number of games. The description of the games follows. Each description contains two lines: The first line contains a single integer $$$n$$$ $$$(1 \le n \le 100)$$$ β€” the number of piles. The second line contains $$$n$$$ integer...
1,800
For each game, print on a single line the name of the winner, "T" or "HL" (without quotes)
standard output
PASSED
445fd7e44302d044a2b3e5042f2587b4
train_002.jsonl
1598798100
T is playing a game with his friend, HL.There are $$$n$$$ piles of stones, the $$$i$$$-th pile initially has $$$a_i$$$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has bee...
256 megabytes
import java.util.*; public class C { public static void main(String[] args) { Scanner sc = new Scanner(System.in); StringBuilder sb = new StringBuilder(); int testCases = sc.nextInt(); for (int t = 0; t < testCases; t++) { int n = sc.nextInt(); int arr[] = ...
Java
["2\n1\n2\n2\n1 1"]
1 second
["T\nHL"]
NoteIn the first game, T removes a single stone from the only pile in his first turn. After that, although the pile still contains $$$1$$$ stone, HL cannot choose from this pile because it has been chosen by T in the previous turn. Therefore, T is the winner.
Java 11
standard input
[ "implementation", "greedy", "games", "brute force" ]
5bfce6c17af24959b4af3c9408536d05
The first line of the input contains a single integer $$$t$$$ $$$(1 \le t \le 100)$$$ β€” the number of games. The description of the games follows. Each description contains two lines: The first line contains a single integer $$$n$$$ $$$(1 \le n \le 100)$$$ β€” the number of piles. The second line contains $$$n$$$ integer...
1,800
For each game, print on a single line the name of the winner, "T" or "HL" (without quotes)
standard output
PASSED
6829348202094e5fc7e75d8e79481a34
train_002.jsonl
1598798100
T is playing a game with his friend, HL.There are $$$n$$$ piles of stones, the $$$i$$$-th pile initially has $$$a_i$$$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has bee...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class d1 extends PrintWriter { static BufferedReader s = new BufferedReader(new InputStreamReader(System.in)); // static Scanner s=new Scanner(System.in); d1 ...
Java
["2\n1\n2\n2\n1 1"]
1 second
["T\nHL"]
NoteIn the first game, T removes a single stone from the only pile in his first turn. After that, although the pile still contains $$$1$$$ stone, HL cannot choose from this pile because it has been chosen by T in the previous turn. Therefore, T is the winner.
Java 11
standard input
[ "implementation", "greedy", "games", "brute force" ]
5bfce6c17af24959b4af3c9408536d05
The first line of the input contains a single integer $$$t$$$ $$$(1 \le t \le 100)$$$ β€” the number of games. The description of the games follows. Each description contains two lines: The first line contains a single integer $$$n$$$ $$$(1 \le n \le 100)$$$ β€” the number of piles. The second line contains $$$n$$$ integer...
1,800
For each game, print on a single line the name of the winner, "T" or "HL" (without quotes)
standard output
PASSED
da387856e098aa19dadaf0fe2403d08c
train_002.jsonl
1598798100
T is playing a game with his friend, HL.There are $$$n$$$ piles of stones, the $$$i$$$-th pile initially has $$$a_i$$$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has bee...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.uti...
Java
["2\n1\n2\n2\n1 1"]
1 second
["T\nHL"]
NoteIn the first game, T removes a single stone from the only pile in his first turn. After that, although the pile still contains $$$1$$$ stone, HL cannot choose from this pile because it has been chosen by T in the previous turn. Therefore, T is the winner.
Java 11
standard input
[ "implementation", "greedy", "games", "brute force" ]
5bfce6c17af24959b4af3c9408536d05
The first line of the input contains a single integer $$$t$$$ $$$(1 \le t \le 100)$$$ β€” the number of games. The description of the games follows. Each description contains two lines: The first line contains a single integer $$$n$$$ $$$(1 \le n \le 100)$$$ β€” the number of piles. The second line contains $$$n$$$ integer...
1,800
For each game, print on a single line the name of the winner, "T" or "HL" (without quotes)
standard output
PASSED
8b170f1f1637f62c4334c2b9de013b80
train_002.jsonl
1598798100
T is playing a game with his friend, HL.There are $$$n$$$ piles of stones, the $$$i$$$-th pile initially has $$$a_i$$$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has bee...
256 megabytes
import java.util.*; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(); int[] arr = new int[n]; for (int i = 0; i < n; i++) { a...
Java
["2\n1\n2\n2\n1 1"]
1 second
["T\nHL"]
NoteIn the first game, T removes a single stone from the only pile in his first turn. After that, although the pile still contains $$$1$$$ stone, HL cannot choose from this pile because it has been chosen by T in the previous turn. Therefore, T is the winner.
Java 11
standard input
[ "implementation", "greedy", "games", "brute force" ]
5bfce6c17af24959b4af3c9408536d05
The first line of the input contains a single integer $$$t$$$ $$$(1 \le t \le 100)$$$ β€” the number of games. The description of the games follows. Each description contains two lines: The first line contains a single integer $$$n$$$ $$$(1 \le n \le 100)$$$ β€” the number of piles. The second line contains $$$n$$$ integer...
1,800
For each game, print on a single line the name of the winner, "T" or "HL" (without quotes)
standard output
PASSED
283f476f354334fa3bf449dd4a2ff147
train_002.jsonl
1598798100
T is playing a game with his friend, HL.There are $$$n$$$ piles of stones, the $$$i$$$-th pile initially has $$$a_i$$$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has bee...
256 megabytes
// Author : AMIT KUMAR BARMAN (gearman_0712) import java.io.*; import java.util.*; public class Stoned{ static final long modp =1000000007; static long x_ec=1,y_ec=0,d_ec =1; static long maxi=0; static boolean v1 =false ,v2 = false; static InputReader in = new InputReader(System.in); static Outp...
Java
["2\n1\n2\n2\n1 1"]
1 second
["T\nHL"]
NoteIn the first game, T removes a single stone from the only pile in his first turn. After that, although the pile still contains $$$1$$$ stone, HL cannot choose from this pile because it has been chosen by T in the previous turn. Therefore, T is the winner.
Java 11
standard input
[ "implementation", "greedy", "games", "brute force" ]
5bfce6c17af24959b4af3c9408536d05
The first line of the input contains a single integer $$$t$$$ $$$(1 \le t \le 100)$$$ β€” the number of games. The description of the games follows. Each description contains two lines: The first line contains a single integer $$$n$$$ $$$(1 \le n \le 100)$$$ β€” the number of piles. The second line contains $$$n$$$ integer...
1,800
For each game, print on a single line the name of the winner, "T" or "HL" (without quotes)
standard output
PASSED
e0e5560ff27901dff9d68c1a336618f0
train_002.jsonl
1598798100
T is playing a game with his friend, HL.There are $$$n$$$ piles of stones, the $$$i$$$-th pile initially has $$$a_i$$$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has bee...
256 megabytes
import java.io.*; import java.util.*; /* By : SSD */ public class D { long mod = (long) (1e9 + 7); static class InputReader1 { private final InputStream st; private final byte[] buf = new byte[8192]; private int cc, sc; private SpaceCharFilter f; public InputReader1(InputStream st) { this.st = st; ...
Java
["2\n1\n2\n2\n1 1"]
1 second
["T\nHL"]
NoteIn the first game, T removes a single stone from the only pile in his first turn. After that, although the pile still contains $$$1$$$ stone, HL cannot choose from this pile because it has been chosen by T in the previous turn. Therefore, T is the winner.
Java 11
standard input
[ "implementation", "greedy", "games", "brute force" ]
5bfce6c17af24959b4af3c9408536d05
The first line of the input contains a single integer $$$t$$$ $$$(1 \le t \le 100)$$$ β€” the number of games. The description of the games follows. Each description contains two lines: The first line contains a single integer $$$n$$$ $$$(1 \le n \le 100)$$$ β€” the number of piles. The second line contains $$$n$$$ integer...
1,800
For each game, print on a single line the name of the winner, "T" or "HL" (without quotes)
standard output
PASSED
ed68f21a3c38abb9e1c5fa0fc35d421a
train_002.jsonl
1598798100
T is playing a game with his friend, HL.There are $$$n$$$ piles of stones, the $$$i$$$-th pile initially has $$$a_i$$$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has bee...
256 megabytes
import java.util.*; public class div2666{ public static void main(String []args){ Scanner sc = new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); int[] arr= new int[n]; int sum=0,max=0; for(int i=0;i<n;i++){ ...
Java
["2\n1\n2\n2\n1 1"]
1 second
["T\nHL"]
NoteIn the first game, T removes a single stone from the only pile in his first turn. After that, although the pile still contains $$$1$$$ stone, HL cannot choose from this pile because it has been chosen by T in the previous turn. Therefore, T is the winner.
Java 11
standard input
[ "implementation", "greedy", "games", "brute force" ]
5bfce6c17af24959b4af3c9408536d05
The first line of the input contains a single integer $$$t$$$ $$$(1 \le t \le 100)$$$ β€” the number of games. The description of the games follows. Each description contains two lines: The first line contains a single integer $$$n$$$ $$$(1 \le n \le 100)$$$ β€” the number of piles. The second line contains $$$n$$$ integer...
1,800
For each game, print on a single line the name of the winner, "T" or "HL" (without quotes)
standard output
PASSED
26eb0beb5cc4c15db74d49e2d6eda950
train_002.jsonl
1598798100
T is playing a game with his friend, HL.There are $$$n$$$ piles of stones, the $$$i$$$-th pile initially has $$$a_i$$$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has bee...
256 megabytes
import java.util.*; import java.util.stream.Collectors; public class problem3 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(int i=0; i < t; i++) { int n = sc.nextInt(); sc.nextLine(); ...
Java
["2\n1\n2\n2\n1 1"]
1 second
["T\nHL"]
NoteIn the first game, T removes a single stone from the only pile in his first turn. After that, although the pile still contains $$$1$$$ stone, HL cannot choose from this pile because it has been chosen by T in the previous turn. Therefore, T is the winner.
Java 11
standard input
[ "implementation", "greedy", "games", "brute force" ]
5bfce6c17af24959b4af3c9408536d05
The first line of the input contains a single integer $$$t$$$ $$$(1 \le t \le 100)$$$ β€” the number of games. The description of the games follows. Each description contains two lines: The first line contains a single integer $$$n$$$ $$$(1 \le n \le 100)$$$ β€” the number of piles. The second line contains $$$n$$$ integer...
1,800
For each game, print on a single line the name of the winner, "T" or "HL" (without quotes)
standard output
PASSED
55f3aa6b3df6c4d5b3fb353b0d833300
train_002.jsonl
1598798100
T is playing a game with his friend, HL.There are $$$n$$$ piles of stones, the $$$i$$$-th pile initially has $$$a_i$$$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has bee...
256 megabytes
import java.text.DecimalFormat; import java.util.*; public class Test { private static final Scanner sc = new Scanner(System.in); public static void main(String[] args) { int g = sc.nextInt(); for (int i = 0; i < g; i++) { int p = sc.nextInt(); boolean win = true; ...
Java
["2\n1\n2\n2\n1 1"]
1 second
["T\nHL"]
NoteIn the first game, T removes a single stone from the only pile in his first turn. After that, although the pile still contains $$$1$$$ stone, HL cannot choose from this pile because it has been chosen by T in the previous turn. Therefore, T is the winner.
Java 11
standard input
[ "implementation", "greedy", "games", "brute force" ]
5bfce6c17af24959b4af3c9408536d05
The first line of the input contains a single integer $$$t$$$ $$$(1 \le t \le 100)$$$ β€” the number of games. The description of the games follows. Each description contains two lines: The first line contains a single integer $$$n$$$ $$$(1 \le n \le 100)$$$ β€” the number of piles. The second line contains $$$n$$$ integer...
1,800
For each game, print on a single line the name of the winner, "T" or "HL" (without quotes)
standard output
PASSED
b3d0feb9267f9fdea9890beb60c14b84
train_002.jsonl
1598798100
T is playing a game with his friend, HL.There are $$$n$$$ piles of stones, the $$$i$$$-th pile initially has $$$a_i$$$ stones. T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has bee...
256 megabytes
import java.lang.reflect.Array; import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); while (t-- > 0) { int n = scanner.nextInt(); int[] arr = new int[n]; for ...
Java
["2\n1\n2\n2\n1 1"]
1 second
["T\nHL"]
NoteIn the first game, T removes a single stone from the only pile in his first turn. After that, although the pile still contains $$$1$$$ stone, HL cannot choose from this pile because it has been chosen by T in the previous turn. Therefore, T is the winner.
Java 11
standard input
[ "implementation", "greedy", "games", "brute force" ]
5bfce6c17af24959b4af3c9408536d05
The first line of the input contains a single integer $$$t$$$ $$$(1 \le t \le 100)$$$ β€” the number of games. The description of the games follows. Each description contains two lines: The first line contains a single integer $$$n$$$ $$$(1 \le n \le 100)$$$ β€” the number of piles. The second line contains $$$n$$$ integer...
1,800
For each game, print on a single line the name of the winner, "T" or "HL" (without quotes)
standard output
PASSED
b47073cd20720a07ba39f0c9327107bd
train_002.jsonl
1285340400
One warm and sunny day king Copa decided to visit the shooting gallery, located at the Central Park, and try to win the main prize β€” big pink plush panda. The king is not good at shooting, so he invited you to help him.The shooting gallery is an infinite vertical plane with Cartesian coordinate system on it. The target...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class ProblemC { static class Target implements Comparable<Target> { long x; long y; long time; double p...
Java
["1\n0 0 0 0.5", "2\n0 0 0 0.6\n5 0 5 0.7"]
2 seconds
["0.5000000000", "1.3000000000"]
null
Java 6
standard input
[ "dp", "probabilities" ]
1df8aad60e5dff95bffb9adee5f8c460
The first line contains integer n (1 ≀ n ≀ 1000) β€” amount of targets in the shooting gallery. Then n lines follow, each describing one target. Each description consists of four numbers xi, yi, ti, pi (where xi, yi, ti β€” integers,  - 1000 ≀ xi, yi ≀ 1000, 0 ≀ ti ≀ 109, real number pi is given with no more than 6 digits ...
1,800
Output the maximum expected value of the amount of targets that was shot by the king. Your answer will be accepted if it differs from the correct answer by not more than 10 - 6.
standard output
PASSED
f9c5b1104c0ff8174272f100c2b51f1d
train_002.jsonl
1285340400
One warm and sunny day king Copa decided to visit the shooting gallery, located at the Central Park, and try to win the main prize β€” big pink plush panda. The king is not good at shooting, so he invited you to help him.The shooting gallery is an infinite vertical plane with Cartesian coordinate system on it. The target...
256 megabytes
import java.io.*; import java.util.*; public class Main implements Runnable { public void _main() throws IOException { int n = nextInt(); int[] x = new int[n]; int[] y = new int[n]; int[] t = new int[n]; double[] p = new double[n]; for (int i = 0; i < n; i++) { x[i] = nextInt(); y[i] = nextInt(); ...
Java
["1\n0 0 0 0.5", "2\n0 0 0 0.6\n5 0 5 0.7"]
2 seconds
["0.5000000000", "1.3000000000"]
null
Java 6
standard input
[ "dp", "probabilities" ]
1df8aad60e5dff95bffb9adee5f8c460
The first line contains integer n (1 ≀ n ≀ 1000) β€” amount of targets in the shooting gallery. Then n lines follow, each describing one target. Each description consists of four numbers xi, yi, ti, pi (where xi, yi, ti β€” integers,  - 1000 ≀ xi, yi ≀ 1000, 0 ≀ ti ≀ 109, real number pi is given with no more than 6 digits ...
1,800
Output the maximum expected value of the amount of targets that was shot by the king. Your answer will be accepted if it differs from the correct answer by not more than 10 - 6.
standard output
PASSED
8d5d74aec79d0498c336f95cbd6a3fc5
train_002.jsonl
1285340400
One warm and sunny day king Copa decided to visit the shooting gallery, located at the Central Park, and try to win the main prize β€” big pink plush panda. The king is not good at shooting, so he invited you to help him.The shooting gallery is an infinite vertical plane with Cartesian coordinate system on it. The target...
256 megabytes
//package round30; import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; public class C { private Scanner in; private PrintWriter out; // private String INPUT = "1 0 0 0 0.5"; // private String INPUT = "2 0 0 0 0.6 5 0 5 0.7"; // private String INPUT = "3 0 0 0 0.6 4 0 4 0.85 2 0 5 0.8"; // ...
Java
["1\n0 0 0 0.5", "2\n0 0 0 0.6\n5 0 5 0.7"]
2 seconds
["0.5000000000", "1.3000000000"]
null
Java 6
standard input
[ "dp", "probabilities" ]
1df8aad60e5dff95bffb9adee5f8c460
The first line contains integer n (1 ≀ n ≀ 1000) β€” amount of targets in the shooting gallery. Then n lines follow, each describing one target. Each description consists of four numbers xi, yi, ti, pi (where xi, yi, ti β€” integers,  - 1000 ≀ xi, yi ≀ 1000, 0 ≀ ti ≀ 109, real number pi is given with no more than 6 digits ...
1,800
Output the maximum expected value of the amount of targets that was shot by the king. Your answer will be accepted if it differs from the correct answer by not more than 10 - 6.
standard output
PASSED
dcfdacf899b011bb15033b0f66d1a60c
train_002.jsonl
1285340400
One warm and sunny day king Copa decided to visit the shooting gallery, located at the Central Park, and try to win the main prize β€” big pink plush panda. The king is not good at shooting, so he invited you to help him.The shooting gallery is an infinite vertical plane with Cartesian coordinate system on it. The target...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class C { static class struct implements Comparable<struct> { int x, y, t; double prob; public struct(int xx, int yy, int tt, double p) { x = xx; y = yy; t = tt; prob = p; } public int compareTo(struct z) { if (z.t < t) return 1;...
Java
["1\n0 0 0 0.5", "2\n0 0 0 0.6\n5 0 5 0.7"]
2 seconds
["0.5000000000", "1.3000000000"]
null
Java 6
standard input
[ "dp", "probabilities" ]
1df8aad60e5dff95bffb9adee5f8c460
The first line contains integer n (1 ≀ n ≀ 1000) β€” amount of targets in the shooting gallery. Then n lines follow, each describing one target. Each description consists of four numbers xi, yi, ti, pi (where xi, yi, ti β€” integers,  - 1000 ≀ xi, yi ≀ 1000, 0 ≀ ti ≀ 109, real number pi is given with no more than 6 digits ...
1,800
Output the maximum expected value of the amount of targets that was shot by the king. Your answer will be accepted if it differs from the correct answer by not more than 10 - 6.
standard output
PASSED
26e1e4f79ce075c7bf1a85e0f22f6be7
train_002.jsonl
1285340400
One warm and sunny day king Copa decided to visit the shooting gallery, located at the Central Park, and try to win the main prize β€” big pink plush panda. The king is not good at shooting, so he invited you to help him.The shooting gallery is an infinite vertical plane with Cartesian coordinate system on it. The target...
256 megabytes
import java.util.Arrays; import java.util.Locale; import java.util.Scanner; /** * @author Sergey Kopeliovich (burunduk1@yandex-team.ru) */ public class C { private double res = 0; public static void main(String[] args) { new C().run(); } private void run() { Locale.setDefault(Locale...
Java
["1\n0 0 0 0.5", "2\n0 0 0 0.6\n5 0 5 0.7"]
2 seconds
["0.5000000000", "1.3000000000"]
null
Java 6
standard input
[ "dp", "probabilities" ]
1df8aad60e5dff95bffb9adee5f8c460
The first line contains integer n (1 ≀ n ≀ 1000) β€” amount of targets in the shooting gallery. Then n lines follow, each describing one target. Each description consists of four numbers xi, yi, ti, pi (where xi, yi, ti β€” integers,  - 1000 ≀ xi, yi ≀ 1000, 0 ≀ ti ≀ 109, real number pi is given with no more than 6 digits ...
1,800
Output the maximum expected value of the amount of targets that was shot by the king. Your answer will be accepted if it differs from the correct answer by not more than 10 - 6.
standard output
PASSED
9316c994809dc676e9e19b486e013287
train_002.jsonl
1285340400
One warm and sunny day king Copa decided to visit the shooting gallery, located at the Central Park, and try to win the main prize β€” big pink plush panda. The king is not good at shooting, so he invited you to help him.The shooting gallery is an infinite vertical plane with Cartesian coordinate system on it. The target...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class C { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String s = new String(in.readLine()); int n = Integer.parseInt(s); ...
Java
["1\n0 0 0 0.5", "2\n0 0 0 0.6\n5 0 5 0.7"]
2 seconds
["0.5000000000", "1.3000000000"]
null
Java 6
standard input
[ "dp", "probabilities" ]
1df8aad60e5dff95bffb9adee5f8c460
The first line contains integer n (1 ≀ n ≀ 1000) β€” amount of targets in the shooting gallery. Then n lines follow, each describing one target. Each description consists of four numbers xi, yi, ti, pi (where xi, yi, ti β€” integers,  - 1000 ≀ xi, yi ≀ 1000, 0 ≀ ti ≀ 109, real number pi is given with no more than 6 digits ...
1,800
Output the maximum expected value of the amount of targets that was shot by the king. Your answer will be accepted if it differs from the correct answer by not more than 10 - 6.
standard output
PASSED
7fbc246d0719470cebac1591cf7beda7
train_002.jsonl
1285340400
One warm and sunny day king Copa decided to visit the shooting gallery, located at the Central Park, and try to win the main prize β€” big pink plush panda. The king is not good at shooting, so he invited you to help him.The shooting gallery is an infinite vertical plane with Cartesian coordinate system on it. The target...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.Writer; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.List; public class Main { InputStreamReade...
Java
["1\n0 0 0 0.5", "2\n0 0 0 0.6\n5 0 5 0.7"]
2 seconds
["0.5000000000", "1.3000000000"]
null
Java 6
standard input
[ "dp", "probabilities" ]
1df8aad60e5dff95bffb9adee5f8c460
The first line contains integer n (1 ≀ n ≀ 1000) β€” amount of targets in the shooting gallery. Then n lines follow, each describing one target. Each description consists of four numbers xi, yi, ti, pi (where xi, yi, ti β€” integers,  - 1000 ≀ xi, yi ≀ 1000, 0 ≀ ti ≀ 109, real number pi is given with no more than 6 digits ...
1,800
Output the maximum expected value of the amount of targets that was shot by the king. Your answer will be accepted if it differs from the correct answer by not more than 10 - 6.
standard output
PASSED
e89dc76debcc9b33559f6b9da3a04f51
train_002.jsonl
1285340400
One warm and sunny day king Copa decided to visit the shooting gallery, located at the Central Park, and try to win the main prize β€” big pink plush panda. The king is not good at shooting, so he invited you to help him.The shooting gallery is an infinite vertical plane with Cartesian coordinate system on it. The target...
256 megabytes
import java.util.*; public class ShootingGallery { static double[] memo; static double[] p,t; static double[][] dis; static int N; public static void main(String[] args){ Scanner reader = new Scanner(System.in); N = reader.nextInt(); p = new double[N]; t = new double[N]; dis = new double[N][N]; memo = ...
Java
["1\n0 0 0 0.5", "2\n0 0 0 0.6\n5 0 5 0.7"]
2 seconds
["0.5000000000", "1.3000000000"]
null
Java 6
standard input
[ "dp", "probabilities" ]
1df8aad60e5dff95bffb9adee5f8c460
The first line contains integer n (1 ≀ n ≀ 1000) β€” amount of targets in the shooting gallery. Then n lines follow, each describing one target. Each description consists of four numbers xi, yi, ti, pi (where xi, yi, ti β€” integers,  - 1000 ≀ xi, yi ≀ 1000, 0 ≀ ti ≀ 109, real number pi is given with no more than 6 digits ...
1,800
Output the maximum expected value of the amount of targets that was shot by the king. Your answer will be accepted if it differs from the correct answer by not more than 10 - 6.
standard output
PASSED
2afd0ab6e6cf456e18117fec6bce9fb7
train_002.jsonl
1285340400
One warm and sunny day king Copa decided to visit the shooting gallery, located at the Central Park, and try to win the main prize β€” big pink plush panda. The king is not good at shooting, so he invited you to help him.The shooting gallery is an infinite vertical plane with Cartesian coordinate system on it. The target...
256 megabytes
import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintStream; import java.io.PrintWriter; import java.io.StreamTokenizer; import java.util.Arrays; import java.util....
Java
["1\n0 0 0 0.5", "2\n0 0 0 0.6\n5 0 5 0.7"]
2 seconds
["0.5000000000", "1.3000000000"]
null
Java 6
standard input
[ "dp", "probabilities" ]
1df8aad60e5dff95bffb9adee5f8c460
The first line contains integer n (1 ≀ n ≀ 1000) β€” amount of targets in the shooting gallery. Then n lines follow, each describing one target. Each description consists of four numbers xi, yi, ti, pi (where xi, yi, ti β€” integers,  - 1000 ≀ xi, yi ≀ 1000, 0 ≀ ti ≀ 109, real number pi is given with no more than 6 digits ...
1,800
Output the maximum expected value of the amount of targets that was shot by the king. Your answer will be accepted if it differs from the correct answer by not more than 10 - 6.
standard output
PASSED
abb6fd4aedc8118d64deb10090c16b9b
train_002.jsonl
1285340400
One warm and sunny day king Copa decided to visit the shooting gallery, located at the Central Park, and try to win the main prize β€” big pink plush panda. The king is not good at shooting, so he invited you to help him.The shooting gallery is an infinite vertical plane with Cartesian coordinate system on it. The target...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; public class Solution { BufferedReader in; PrintWriter out; StringTokenizer st; static class Pair implements Comparable<Pair> { int x, y, t; double p; public Pair(int x, int y, int t, double p) { ...
Java
["1\n0 0 0 0.5", "2\n0 0 0 0.6\n5 0 5 0.7"]
2 seconds
["0.5000000000", "1.3000000000"]
null
Java 6
standard input
[ "dp", "probabilities" ]
1df8aad60e5dff95bffb9adee5f8c460
The first line contains integer n (1 ≀ n ≀ 1000) β€” amount of targets in the shooting gallery. Then n lines follow, each describing one target. Each description consists of four numbers xi, yi, ti, pi (where xi, yi, ti β€” integers,  - 1000 ≀ xi, yi ≀ 1000, 0 ≀ ti ≀ 109, real number pi is given with no more than 6 digits ...
1,800
Output the maximum expected value of the amount of targets that was shot by the king. Your answer will be accepted if it differs from the correct answer by not more than 10 - 6.
standard output
PASSED
65daa898d1946da0d6df04df30434379
train_002.jsonl
1285340400
One warm and sunny day king Copa decided to visit the shooting gallery, located at the Central Park, and try to win the main prize β€” big pink plush panda. The king is not good at shooting, so he invited you to help him.The shooting gallery is an infinite vertical plane with Cartesian coordinate system on it. The target...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.fill; import static java.util.Arrays.binarySearch; import static java.util.Arrays.sort; public class Main { public static void main(String[] args) throws IOException { try { if (new File("input.txt").exists()) ...
Java
["1\n0 0 0 0.5", "2\n0 0 0 0.6\n5 0 5 0.7"]
2 seconds
["0.5000000000", "1.3000000000"]
null
Java 6
standard input
[ "dp", "probabilities" ]
1df8aad60e5dff95bffb9adee5f8c460
The first line contains integer n (1 ≀ n ≀ 1000) β€” amount of targets in the shooting gallery. Then n lines follow, each describing one target. Each description consists of four numbers xi, yi, ti, pi (where xi, yi, ti β€” integers,  - 1000 ≀ xi, yi ≀ 1000, 0 ≀ ti ≀ 109, real number pi is given with no more than 6 digits ...
1,800
Output the maximum expected value of the amount of targets that was shot by the king. Your answer will be accepted if it differs from the correct answer by not more than 10 - 6.
standard output
PASSED
75360cac4f13acefdb9864145e9bf765
train_002.jsonl
1285340400
One warm and sunny day king Copa decided to visit the shooting gallery, located at the Central Park, and try to win the main prize β€” big pink plush panda. The king is not good at shooting, so he invited you to help him.The shooting gallery is an infinite vertical plane with Cartesian coordinate system on it. The target...
256 megabytes
import java.util.*; public class C { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { final int N = sc.nextInt(); final int[] x = new int[N]; final int[] y = new int[N]; final int[] t = new int[N]; final double[] p = new double[N]; ...
Java
["1\n0 0 0 0.5", "2\n0 0 0 0.6\n5 0 5 0.7"]
2 seconds
["0.5000000000", "1.3000000000"]
null
Java 6
standard input
[ "dp", "probabilities" ]
1df8aad60e5dff95bffb9adee5f8c460
The first line contains integer n (1 ≀ n ≀ 1000) β€” amount of targets in the shooting gallery. Then n lines follow, each describing one target. Each description consists of four numbers xi, yi, ti, pi (where xi, yi, ti β€” integers,  - 1000 ≀ xi, yi ≀ 1000, 0 ≀ ti ≀ 109, real number pi is given with no more than 6 digits ...
1,800
Output the maximum expected value of the amount of targets that was shot by the king. Your answer will be accepted if it differs from the correct answer by not more than 10 - 6.
standard output
PASSED
fefc261e70f17e5c09c3e0e5ff36a31c
train_002.jsonl
1285340400
One warm and sunny day king Copa decided to visit the shooting gallery, located at the Central Park, and try to win the main prize β€” big pink plush panda. The king is not good at shooting, so he invited you to help him.The shooting gallery is an infinite vertical plane with Cartesian coordinate system on it. The target...
256 megabytes
import java.util.*; public class C { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { final int N = sc.nextInt(); final int[] x = new int[N]; final int[] y = new int[N]; final int[] t = new int[N]; final double[] p = new double[N]; ...
Java
["1\n0 0 0 0.5", "2\n0 0 0 0.6\n5 0 5 0.7"]
2 seconds
["0.5000000000", "1.3000000000"]
null
Java 6
standard input
[ "dp", "probabilities" ]
1df8aad60e5dff95bffb9adee5f8c460
The first line contains integer n (1 ≀ n ≀ 1000) β€” amount of targets in the shooting gallery. Then n lines follow, each describing one target. Each description consists of four numbers xi, yi, ti, pi (where xi, yi, ti β€” integers,  - 1000 ≀ xi, yi ≀ 1000, 0 ≀ ti ≀ 109, real number pi is given with no more than 6 digits ...
1,800
Output the maximum expected value of the amount of targets that was shot by the king. Your answer will be accepted if it differs from the correct answer by not more than 10 - 6.
standard output
PASSED
d99c4fd381910c146b55a378b7555f81
train_002.jsonl
1285340400
One warm and sunny day king Copa decided to visit the shooting gallery, located at the Central Park, and try to win the main prize β€” big pink plush panda. The king is not good at shooting, so he invited you to help him.The shooting gallery is an infinite vertical plane with Cartesian coordinate system on it. The target...
256 megabytes
import java.util.*; public class C { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { final int N = sc.nextInt(); final int[] x = new int[N]; final int[] y = new int[N]; final int[] t = new int[N]; final double[] p = new double[N]; ...
Java
["1\n0 0 0 0.5", "2\n0 0 0 0.6\n5 0 5 0.7"]
2 seconds
["0.5000000000", "1.3000000000"]
null
Java 6
standard input
[ "dp", "probabilities" ]
1df8aad60e5dff95bffb9adee5f8c460
The first line contains integer n (1 ≀ n ≀ 1000) β€” amount of targets in the shooting gallery. Then n lines follow, each describing one target. Each description consists of four numbers xi, yi, ti, pi (where xi, yi, ti β€” integers,  - 1000 ≀ xi, yi ≀ 1000, 0 ≀ ti ≀ 109, real number pi is given with no more than 6 digits ...
1,800
Output the maximum expected value of the amount of targets that was shot by the king. Your answer will be accepted if it differs from the correct answer by not more than 10 - 6.
standard output
PASSED
52b577a63086d86f5f3b4ec29c1bd719
train_002.jsonl
1285340400
One warm and sunny day king Copa decided to visit the shooting gallery, located at the Central Park, and try to win the main prize β€” big pink plush panda. The king is not good at shooting, so he invited you to help him.The shooting gallery is an infinite vertical plane with Cartesian coordinate system on it. The target...
256 megabytes
import java.util.*; public class C { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { final int N = sc.nextInt(); final int[] x = new int[N]; final int[] y = new int[N]; final int[] t = new int[N]; final double[] p = new double[N]; ...
Java
["1\n0 0 0 0.5", "2\n0 0 0 0.6\n5 0 5 0.7"]
2 seconds
["0.5000000000", "1.3000000000"]
null
Java 6
standard input
[ "dp", "probabilities" ]
1df8aad60e5dff95bffb9adee5f8c460
The first line contains integer n (1 ≀ n ≀ 1000) β€” amount of targets in the shooting gallery. Then n lines follow, each describing one target. Each description consists of four numbers xi, yi, ti, pi (where xi, yi, ti β€” integers,  - 1000 ≀ xi, yi ≀ 1000, 0 ≀ ti ≀ 109, real number pi is given with no more than 6 digits ...
1,800
Output the maximum expected value of the amount of targets that was shot by the king. Your answer will be accepted if it differs from the correct answer by not more than 10 - 6.
standard output
PASSED
1c30c8d142fe199f1cc53f3e7882754e
train_002.jsonl
1285340400
One warm and sunny day king Copa decided to visit the shooting gallery, located at the Central Park, and try to win the main prize β€” big pink plush panda. The king is not good at shooting, so he invited you to help him.The shooting gallery is an infinite vertical plane with Cartesian coordinate system on it. The target...
256 megabytes
import java.util.*; public class C { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { final int N = sc.nextInt(); final int[] x = new int[N]; final int[] y = new int[N]; final int[] t = new int[N]; final double[] p = new double[N]; ...
Java
["1\n0 0 0 0.5", "2\n0 0 0 0.6\n5 0 5 0.7"]
2 seconds
["0.5000000000", "1.3000000000"]
null
Java 6
standard input
[ "dp", "probabilities" ]
1df8aad60e5dff95bffb9adee5f8c460
The first line contains integer n (1 ≀ n ≀ 1000) β€” amount of targets in the shooting gallery. Then n lines follow, each describing one target. Each description consists of four numbers xi, yi, ti, pi (where xi, yi, ti β€” integers,  - 1000 ≀ xi, yi ≀ 1000, 0 ≀ ti ≀ 109, real number pi is given with no more than 6 digits ...
1,800
Output the maximum expected value of the amount of targets that was shot by the king. Your answer will be accepted if it differs from the correct answer by not more than 10 - 6.
standard output
PASSED
a9cabf83a85d611fec1fc57b0076c671
train_002.jsonl
1285340400
One warm and sunny day king Copa decided to visit the shooting gallery, located at the Central Park, and try to win the main prize β€” big pink plush panda. The king is not good at shooting, so he invited you to help him.The shooting gallery is an infinite vertical plane with Cartesian coordinate system on it. The target...
256 megabytes
import java.io.*; import java.util.Arrays; import static java.lang.Math.*; import static java.lang.Integer.*; import static java.lang.Double.*; @SuppressWarnings("unused") public class round30C { static class target implements Comparable<target>{ int x, y, time; double prob; public target(int xx, int yy, i...
Java
["1\n0 0 0 0.5", "2\n0 0 0 0.6\n5 0 5 0.7"]
2 seconds
["0.5000000000", "1.3000000000"]
null
Java 6
standard input
[ "dp", "probabilities" ]
1df8aad60e5dff95bffb9adee5f8c460
The first line contains integer n (1 ≀ n ≀ 1000) β€” amount of targets in the shooting gallery. Then n lines follow, each describing one target. Each description consists of four numbers xi, yi, ti, pi (where xi, yi, ti β€” integers,  - 1000 ≀ xi, yi ≀ 1000, 0 ≀ ti ≀ 109, real number pi is given with no more than 6 digits ...
1,800
Output the maximum expected value of the amount of targets that was shot by the king. Your answer will be accepted if it differs from the correct answer by not more than 10 - 6.
standard output
PASSED
a2314b0fa798e5ba8fba579f48825c91
train_002.jsonl
1302706800
Well, here is another math class task. In mathematics, GCD is the greatest common divisor, and it's an easy task to calculate the GCD between two positive integers.A common divisor for two positive numbers is a number which both numbers are divisible by.But your teacher wants to give you a harder task, in this task you...
256 megabytes
import java.io.*; import java.util.*; public class C { public static void main(String[] args)throws IOException { FastReader f=new FastReader(); StringBuffer sb=new StringBuffer(); int a=f.nextInt(); int b=f.nextInt(); int gcd=gcd(a,b); List<Integer> list=divisors(gcd); Collections.sor...
Java
["9 27\n3\n1 5\n10 11\n9 11"]
2 seconds
["3\n-1\n9"]
null
Java 8
standard input
[ "binary search", "number theory" ]
6551be8f4000da2288bf835169662aa2
The first line contains two integers a and b, the two integers as described above (1 ≀ a, b ≀ 109). The second line contains one integer n, the number of queries (1 ≀ n ≀ 104). Then n lines follow, each line contains one query consisting of two integers, low and high (1 ≀ low ≀ high ≀ 109).
1,600
Print n lines. The i-th of them should contain the result of the i-th query in the input. If there is no common divisor in the given range for any query, you should print -1 as a result for this query.
standard output
PASSED
22c9faff408be946d3e25df205e2edc1
train_002.jsonl
1475928900
There are k sensors located in the rectangular room of size n × m meters. The i-th sensor is located at point (xi, yi). All sensors are located at distinct points strictly inside the rectangle. Opposite corners of the room are located at points (0, 0) and (n, m). Walls of the room are parallel to coordinate axes.At the...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.IOException; import java.util.HashMap; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Collections; import java.io.InputStrea...
Java
["3 3 4\n1 1\n1 2\n2 1\n2 2", "3 4 6\n1 1\n2 1\n1 2\n2 2\n1 3\n2 3", "7 4 5\n1 3\n2 2\n5 1\n5 3\n4 3"]
2 seconds
["1\n-1\n-1\n2", "1\n-1\n-1\n2\n5\n-1", "13\n2\n9\n5\n-1"]
NoteIn the first sample, the ray will consequently pass through the points (0, 0), (1, 1), (2, 2), (3, 3). Thus, it will stop at the point (3, 3) after 3 seconds. In the second sample, the ray will consequently pass through the following points: (0, 0), (1, 1), (2, 2), (3, 3), (2, 4), (1, 3), (0, 2), (1, 1), (2, 0), (...
Java 8
standard input
[ "hashing", "greedy", "number theory", "math", "implementation", "sortings" ]
27a521d4d59066e50e870e7934d4b190
The first line of the input contains three integers n, m and k (2 ≀ n, m ≀ 100 000, 1 ≀ k ≀ 100 000)Β β€” lengths of the room's walls and the number of sensors. Each of the following k lines contains two integers xi and yi (1 ≀ xi ≀ n - 1, 1 ≀ yi ≀ m - 1)Β β€” coordinates of the sensors. It's guaranteed that no two sensors a...
1,800
Print k integers. The i-th of them should be equal to the number of seconds when the ray first passes through the point where the i-th sensor is located, or  - 1 if this will never happen.
standard output
PASSED
a34f1e145c9853ae74b685483d56a2bc
train_002.jsonl
1475928900
There are k sensors located in the rectangular room of size n × m meters. The i-th sensor is located at point (xi, yi). All sensors are located at distinct points strictly inside the rectangle. Opposite corners of the room are located at points (0, 0) and (n, m). Walls of the room are parallel to coordinate axes.At the...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.Closeable; import java.io.FileInputStream; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; impo...
Java
["3 3 4\n1 1\n1 2\n2 1\n2 2", "3 4 6\n1 1\n2 1\n1 2\n2 2\n1 3\n2 3", "7 4 5\n1 3\n2 2\n5 1\n5 3\n4 3"]
2 seconds
["1\n-1\n-1\n2", "1\n-1\n-1\n2\n5\n-1", "13\n2\n9\n5\n-1"]
NoteIn the first sample, the ray will consequently pass through the points (0, 0), (1, 1), (2, 2), (3, 3). Thus, it will stop at the point (3, 3) after 3 seconds. In the second sample, the ray will consequently pass through the following points: (0, 0), (1, 1), (2, 2), (3, 3), (2, 4), (1, 3), (0, 2), (1, 1), (2, 0), (...
Java 8
standard input
[ "hashing", "greedy", "number theory", "math", "implementation", "sortings" ]
27a521d4d59066e50e870e7934d4b190
The first line of the input contains three integers n, m and k (2 ≀ n, m ≀ 100 000, 1 ≀ k ≀ 100 000)Β β€” lengths of the room's walls and the number of sensors. Each of the following k lines contains two integers xi and yi (1 ≀ xi ≀ n - 1, 1 ≀ yi ≀ m - 1)Β β€” coordinates of the sensors. It's guaranteed that no two sensors a...
1,800
Print k integers. The i-th of them should be equal to the number of seconds when the ray first passes through the point where the i-th sensor is located, or  - 1 if this will never happen.
standard output
PASSED
3c5197e095033a9abd6065172a9096d5
train_002.jsonl
1475928900
There are k sensors located in the rectangular room of size n × m meters. The i-th sensor is located at point (xi, yi). All sensors are located at distinct points strictly inside the rectangle. Opposite corners of the room are located at points (0, 0) and (n, m). Walls of the room are parallel to coordinate axes.At the...
256 megabytes
import java.io.*; import java.util.*; public class C { @SuppressWarnings("unchecked") public static void solution(BufferedReader reader, PrintWriter out) throws IOException { In in = new In(reader); int n = in.nextInt(), m = in.nextInt(), k = in.nextInt(); int[][] point = ne...
Java
["3 3 4\n1 1\n1 2\n2 1\n2 2", "3 4 6\n1 1\n2 1\n1 2\n2 2\n1 3\n2 3", "7 4 5\n1 3\n2 2\n5 1\n5 3\n4 3"]
2 seconds
["1\n-1\n-1\n2", "1\n-1\n-1\n2\n5\n-1", "13\n2\n9\n5\n-1"]
NoteIn the first sample, the ray will consequently pass through the points (0, 0), (1, 1), (2, 2), (3, 3). Thus, it will stop at the point (3, 3) after 3 seconds. In the second sample, the ray will consequently pass through the following points: (0, 0), (1, 1), (2, 2), (3, 3), (2, 4), (1, 3), (0, 2), (1, 1), (2, 0), (...
Java 8
standard input
[ "hashing", "greedy", "number theory", "math", "implementation", "sortings" ]
27a521d4d59066e50e870e7934d4b190
The first line of the input contains three integers n, m and k (2 ≀ n, m ≀ 100 000, 1 ≀ k ≀ 100 000)Β β€” lengths of the room's walls and the number of sensors. Each of the following k lines contains two integers xi and yi (1 ≀ xi ≀ n - 1, 1 ≀ yi ≀ m - 1)Β β€” coordinates of the sensors. It's guaranteed that no two sensors a...
1,800
Print k integers. The i-th of them should be equal to the number of seconds when the ray first passes through the point where the i-th sensor is located, or  - 1 if this will never happen.
standard output
PASSED
18d2f7b041872957da247a7a42a13492
train_002.jsonl
1475928900
There are k sensors located in the rectangular room of size n × m meters. The i-th sensor is located at point (xi, yi). All sensors are located at distinct points strictly inside the rectangle. Opposite corners of the room are located at points (0, 0) and (n, m). Walls of the room are parallel to coordinate axes.At the...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashMap; import java.util.StringTokenizer; public class IntelDiv2C { static class Line{ int k,b,px1,py1,px2,py2; long t; public Line(int kk,int bb,int px11,int py11,int px22,int py22,long tt){ k=kk; ...
Java
["3 3 4\n1 1\n1 2\n2 1\n2 2", "3 4 6\n1 1\n2 1\n1 2\n2 2\n1 3\n2 3", "7 4 5\n1 3\n2 2\n5 1\n5 3\n4 3"]
2 seconds
["1\n-1\n-1\n2", "1\n-1\n-1\n2\n5\n-1", "13\n2\n9\n5\n-1"]
NoteIn the first sample, the ray will consequently pass through the points (0, 0), (1, 1), (2, 2), (3, 3). Thus, it will stop at the point (3, 3) after 3 seconds. In the second sample, the ray will consequently pass through the following points: (0, 0), (1, 1), (2, 2), (3, 3), (2, 4), (1, 3), (0, 2), (1, 1), (2, 0), (...
Java 8
standard input
[ "hashing", "greedy", "number theory", "math", "implementation", "sortings" ]
27a521d4d59066e50e870e7934d4b190
The first line of the input contains three integers n, m and k (2 ≀ n, m ≀ 100 000, 1 ≀ k ≀ 100 000)Β β€” lengths of the room's walls and the number of sensors. Each of the following k lines contains two integers xi and yi (1 ≀ xi ≀ n - 1, 1 ≀ yi ≀ m - 1)Β β€” coordinates of the sensors. It's guaranteed that no two sensors a...
1,800
Print k integers. The i-th of them should be equal to the number of seconds when the ray first passes through the point where the i-th sensor is located, or  - 1 if this will never happen.
standard output
PASSED
83598264c6f483faf057c779ec979ba3
train_002.jsonl
1475928900
There are k sensors located in the rectangular room of size n × m meters. The i-th sensor is located at point (xi, yi). All sensors are located at distinct points strictly inside the rectangle. Opposite corners of the room are located at points (0, 0) and (n, m). Walls of the room are parallel to coordinate axes.At the...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; import static java.util.Arrays.*; public class C { private static final int mod = (int)1e9+7; final Random random = new Random(0); final IOFast io = new IOFast(); /// MAIN CODE public void run() throws IOException { // int TEST_CASE = Integer.parseInt...
Java
["3 3 4\n1 1\n1 2\n2 1\n2 2", "3 4 6\n1 1\n2 1\n1 2\n2 2\n1 3\n2 3", "7 4 5\n1 3\n2 2\n5 1\n5 3\n4 3"]
2 seconds
["1\n-1\n-1\n2", "1\n-1\n-1\n2\n5\n-1", "13\n2\n9\n5\n-1"]
NoteIn the first sample, the ray will consequently pass through the points (0, 0), (1, 1), (2, 2), (3, 3). Thus, it will stop at the point (3, 3) after 3 seconds. In the second sample, the ray will consequently pass through the following points: (0, 0), (1, 1), (2, 2), (3, 3), (2, 4), (1, 3), (0, 2), (1, 1), (2, 0), (...
Java 8
standard input
[ "hashing", "greedy", "number theory", "math", "implementation", "sortings" ]
27a521d4d59066e50e870e7934d4b190
The first line of the input contains three integers n, m and k (2 ≀ n, m ≀ 100 000, 1 ≀ k ≀ 100 000)Β β€” lengths of the room's walls and the number of sensors. Each of the following k lines contains two integers xi and yi (1 ≀ xi ≀ n - 1, 1 ≀ yi ≀ m - 1)Β β€” coordinates of the sensors. It's guaranteed that no two sensors a...
1,800
Print k integers. The i-th of them should be equal to the number of seconds when the ray first passes through the point where the i-th sensor is located, or  - 1 if this will never happen.
standard output
PASSED
532c3bd4cc472f5c830c49fb221babae
train_002.jsonl
1475928900
There are k sensors located in the rectangular room of size n × m meters. The i-th sensor is located at point (xi, yi). All sensors are located at distinct points strictly inside the rectangle. Opposite corners of the room are located at points (0, 0) and (n, m). Walls of the room are parallel to coordinate axes.At the...
256 megabytes
import java.io.*; import java.util.*; /** * * @author Sourav Kumar Paul */ public class SolveC { public static void fn0() { int tx=0,ty=0; if(ptr==0) { int min = (n-xx < m-yy)? n-xx : m-yy; tx = xx+min; ty = yy+min; ...
Java
["3 3 4\n1 1\n1 2\n2 1\n2 2", "3 4 6\n1 1\n2 1\n1 2\n2 2\n1 3\n2 3", "7 4 5\n1 3\n2 2\n5 1\n5 3\n4 3"]
2 seconds
["1\n-1\n-1\n2", "1\n-1\n-1\n2\n5\n-1", "13\n2\n9\n5\n-1"]
NoteIn the first sample, the ray will consequently pass through the points (0, 0), (1, 1), (2, 2), (3, 3). Thus, it will stop at the point (3, 3) after 3 seconds. In the second sample, the ray will consequently pass through the following points: (0, 0), (1, 1), (2, 2), (3, 3), (2, 4), (1, 3), (0, 2), (1, 1), (2, 0), (...
Java 8
standard input
[ "hashing", "greedy", "number theory", "math", "implementation", "sortings" ]
27a521d4d59066e50e870e7934d4b190
The first line of the input contains three integers n, m and k (2 ≀ n, m ≀ 100 000, 1 ≀ k ≀ 100 000)Β β€” lengths of the room's walls and the number of sensors. Each of the following k lines contains two integers xi and yi (1 ≀ xi ≀ n - 1, 1 ≀ yi ≀ m - 1)Β β€” coordinates of the sensors. It's guaranteed that no two sensors a...
1,800
Print k integers. The i-th of them should be equal to the number of seconds when the ray first passes through the point where the i-th sensor is located, or  - 1 if this will never happen.
standard output
PASSED
047f12fe8bc0c705842722d733c475b1
train_002.jsonl
1475928900
There are k sensors located in the rectangular room of size n × m meters. The i-th sensor is located at point (xi, yi). All sensors are located at distinct points strictly inside the rectangle. Opposite corners of the room are located at points (0, 0) and (n, m). Walls of the room are parallel to coordinate axes.At the...
256 megabytes
import java.io.*; import java.util.*; public class Main { class Point{ int x; int y; long time = -1; public Point(int x, int y){ this.x = x; this.y = y; } public int plusIdx(){ return pIdx(x, y); } public int minusIdx(){ return mIdx(x, y); } } int N; int M; int K; Point[] poin...
Java
["3 3 4\n1 1\n1 2\n2 1\n2 2", "3 4 6\n1 1\n2 1\n1 2\n2 2\n1 3\n2 3", "7 4 5\n1 3\n2 2\n5 1\n5 3\n4 3"]
2 seconds
["1\n-1\n-1\n2", "1\n-1\n-1\n2\n5\n-1", "13\n2\n9\n5\n-1"]
NoteIn the first sample, the ray will consequently pass through the points (0, 0), (1, 1), (2, 2), (3, 3). Thus, it will stop at the point (3, 3) after 3 seconds. In the second sample, the ray will consequently pass through the following points: (0, 0), (1, 1), (2, 2), (3, 3), (2, 4), (1, 3), (0, 2), (1, 1), (2, 0), (...
Java 8
standard input
[ "hashing", "greedy", "number theory", "math", "implementation", "sortings" ]
27a521d4d59066e50e870e7934d4b190
The first line of the input contains three integers n, m and k (2 ≀ n, m ≀ 100 000, 1 ≀ k ≀ 100 000)Β β€” lengths of the room's walls and the number of sensors. Each of the following k lines contains two integers xi and yi (1 ≀ xi ≀ n - 1, 1 ≀ yi ≀ m - 1)Β β€” coordinates of the sensors. It's guaranteed that no two sensors a...
1,800
Print k integers. The i-th of them should be equal to the number of seconds when the ray first passes through the point where the i-th sensor is located, or  - 1 if this will never happen.
standard output