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
8f0d4e59d60defc026c9a9e9dd986473
train_000.jsonl
1369582200
SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is for SmallR while for Zanoes. The one who shoots in the target first should be the winner.Output the probability that SmallR will w...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Hashtable; import java.util.StringTokenizer; public class Main { public static void main(String args[]) throws IOException { ...
Java
["1 2 1 2"]
2 seconds
["0.666666666667"]
null
Java 7
standard input
[ "probabilities", "math" ]
7b932b2d3ab65a353b18d81cf533a54e
A single line contains four integers .
1,300
Print a single real number, the probability that SmallR will win the match. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6.
standard output
PASSED
a882eb76ce131148e1fc83fe1d0526f7
train_000.jsonl
1369582200
SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is for SmallR while for Zanoes. The one who shoots in the target first should be the winner.Output the probability that SmallR will w...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Hashtable; import java.util.StringTokenizer; public class Main { public static void main(String args[]) throws IOException { ...
Java
["1 2 1 2"]
2 seconds
["0.666666666667"]
null
Java 7
standard input
[ "probabilities", "math" ]
7b932b2d3ab65a353b18d81cf533a54e
A single line contains four integers .
1,300
Print a single real number, the probability that SmallR will win the match. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6.
standard output
PASSED
11a0edc349b85bc7f3af5bf54b269bdd
train_000.jsonl
1559399700
There are $$$n$$$ stones arranged on an axis. Initially the $$$i$$$-th stone is located at the coordinate $$$s_i$$$. There may be more than one stone in a single place.You can perform zero or more operations of the following type: take two stones with indices $$$i$$$ and $$$j$$$ so that $$$s_i \leq s_j$$$, choose an ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper...
Java
["5\n2 2 7 4 9\n5 4 5 5 5", "3\n1 5 10\n3 5 7"]
4 seconds
["YES\n4\n4 3 1\n2 3 1\n2 5 2\n1 5 2", "NO"]
NoteConsider the first example. After the first move the locations of stones is $$$[2, 2, 6, 5, 9]$$$. After the second move the locations of stones is $$$[2, 3, 5, 5, 9]$$$. After the third move the locations of stones is $$$[2, 5, 5, 5, 7]$$$. After the last move the locations of stones is $$$[4, 5, 5, 5, 5]$$$....
Java 8
standard input
[ "greedy", "constructive algorithms", "two pointers", "math", "sortings" ]
f236c4110a973d1c9f63cbbcc74b9e0b
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) – the number of stones. The second line contains integers $$$s_1, s_2, \ldots, s_n$$$ ($$$1 \le s_i \le 10^9$$$) — the initial positions of the stones. The second line contains integers $$$t_1, t_2, \ldots, t_n$$$ ($$$1 \le t_i \le 10^9$$...
2,300
If it is impossible to move the stones this way, print "NO". Otherwise, on the first line print "YES", on the second line print the number of operations $$$m$$$ ($$$0 \le m \le 5 \cdot n$$$) required. You don't have to minimize the number of operations. Then print $$$m$$$ lines, each containing integers $$$i, j, d$$$ (...
standard output
PASSED
814d8f2d2e5f24c959225ee3bf50517c
train_000.jsonl
1559399700
There are $$$n$$$ stones arranged on an axis. Initially the $$$i$$$-th stone is located at the coordinate $$$s_i$$$. There may be more than one stone in a single place.You can perform zero or more operations of the following type: take two stones with indices $$$i$$$ and $$$j$$$ so that $$$s_i \leq s_j$$$, choose an ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper...
Java
["5\n2 2 7 4 9\n5 4 5 5 5", "3\n1 5 10\n3 5 7"]
4 seconds
["YES\n4\n4 3 1\n2 3 1\n2 5 2\n1 5 2", "NO"]
NoteConsider the first example. After the first move the locations of stones is $$$[2, 2, 6, 5, 9]$$$. After the second move the locations of stones is $$$[2, 3, 5, 5, 9]$$$. After the third move the locations of stones is $$$[2, 5, 5, 5, 7]$$$. After the last move the locations of stones is $$$[4, 5, 5, 5, 5]$$$....
Java 8
standard input
[ "greedy", "constructive algorithms", "two pointers", "math", "sortings" ]
f236c4110a973d1c9f63cbbcc74b9e0b
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) – the number of stones. The second line contains integers $$$s_1, s_2, \ldots, s_n$$$ ($$$1 \le s_i \le 10^9$$$) — the initial positions of the stones. The second line contains integers $$$t_1, t_2, \ldots, t_n$$$ ($$$1 \le t_i \le 10^9$$...
2,300
If it is impossible to move the stones this way, print "NO". Otherwise, on the first line print "YES", on the second line print the number of operations $$$m$$$ ($$$0 \le m \le 5 \cdot n$$$) required. You don't have to minimize the number of operations. Then print $$$m$$$ lines, each containing integers $$$i, j, d$$$ (...
standard output
PASSED
4bab41763e7920bd4035e5fe9f8ab1cc
train_000.jsonl
1559399700
There are $$$n$$$ stones arranged on an axis. Initially the $$$i$$$-th stone is located at the coordinate $$$s_i$$$. There may be more than one stone in a single place.You can perform zero or more operations of the following type: take two stones with indices $$$i$$$ and $$$j$$$ so that $$$s_i \leq s_j$$$, choose an ...
256 megabytes
import java.util.*; import java.io.*; import java.text.*; public class Main{ //SOLUTION BEGIN //Spread AC, not hacks void pre() throws Exception{} void solve(int TC) throws Exception{ int n = ni(); long[][] s = new long[n][];long[] t = new long[n]; for(int i = 0; i< n; i++)s[i] =...
Java
["5\n2 2 7 4 9\n5 4 5 5 5", "3\n1 5 10\n3 5 7"]
4 seconds
["YES\n4\n4 3 1\n2 3 1\n2 5 2\n1 5 2", "NO"]
NoteConsider the first example. After the first move the locations of stones is $$$[2, 2, 6, 5, 9]$$$. After the second move the locations of stones is $$$[2, 3, 5, 5, 9]$$$. After the third move the locations of stones is $$$[2, 5, 5, 5, 7]$$$. After the last move the locations of stones is $$$[4, 5, 5, 5, 5]$$$....
Java 8
standard input
[ "greedy", "constructive algorithms", "two pointers", "math", "sortings" ]
f236c4110a973d1c9f63cbbcc74b9e0b
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) – the number of stones. The second line contains integers $$$s_1, s_2, \ldots, s_n$$$ ($$$1 \le s_i \le 10^9$$$) — the initial positions of the stones. The second line contains integers $$$t_1, t_2, \ldots, t_n$$$ ($$$1 \le t_i \le 10^9$$...
2,300
If it is impossible to move the stones this way, print "NO". Otherwise, on the first line print "YES", on the second line print the number of operations $$$m$$$ ($$$0 \le m \le 5 \cdot n$$$) required. You don't have to minimize the number of operations. Then print $$$m$$$ lines, each containing integers $$$i, j, d$$$ (...
standard output
PASSED
deeacaee6fe17a9e81a104fe955cb2e8
train_000.jsonl
1559399700
There are $$$n$$$ stones arranged on an axis. Initially the $$$i$$$-th stone is located at the coordinate $$$s_i$$$. There may be more than one stone in a single place.You can perform zero or more operations of the following type: take two stones with indices $$$i$$$ and $$$j$$$ so that $$$s_i \leq s_j$$$, choose an ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; import java.util.TreeSet; public class First { public static class dist im...
Java
["5\n2 2 7 4 9\n5 4 5 5 5", "3\n1 5 10\n3 5 7"]
4 seconds
["YES\n4\n4 3 1\n2 3 1\n2 5 2\n1 5 2", "NO"]
NoteConsider the first example. After the first move the locations of stones is $$$[2, 2, 6, 5, 9]$$$. After the second move the locations of stones is $$$[2, 3, 5, 5, 9]$$$. After the third move the locations of stones is $$$[2, 5, 5, 5, 7]$$$. After the last move the locations of stones is $$$[4, 5, 5, 5, 5]$$$....
Java 8
standard input
[ "greedy", "constructive algorithms", "two pointers", "math", "sortings" ]
f236c4110a973d1c9f63cbbcc74b9e0b
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) – the number of stones. The second line contains integers $$$s_1, s_2, \ldots, s_n$$$ ($$$1 \le s_i \le 10^9$$$) — the initial positions of the stones. The second line contains integers $$$t_1, t_2, \ldots, t_n$$$ ($$$1 \le t_i \le 10^9$$...
2,300
If it is impossible to move the stones this way, print "NO". Otherwise, on the first line print "YES", on the second line print the number of operations $$$m$$$ ($$$0 \le m \le 5 \cdot n$$$) required. You don't have to minimize the number of operations. Then print $$$m$$$ lines, each containing integers $$$i, j, d$$$ (...
standard output
PASSED
6ed4795c5d65ea97d6ffa38124e13878
train_000.jsonl
1559399700
There are $$$n$$$ stones arranged on an axis. Initially the $$$i$$$-th stone is located at the coordinate $$$s_i$$$. There may be more than one stone in a single place.You can perform zero or more operations of the following type: take two stones with indices $$$i$$$ and $$$j$$$ so that $$$s_i \leq s_j$$$, choose an ...
256 megabytes
//package round003; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.InputMismatchException; import java.util.List; public class E { InputStream is...
Java
["5\n2 2 7 4 9\n5 4 5 5 5", "3\n1 5 10\n3 5 7"]
4 seconds
["YES\n4\n4 3 1\n2 3 1\n2 5 2\n1 5 2", "NO"]
NoteConsider the first example. After the first move the locations of stones is $$$[2, 2, 6, 5, 9]$$$. After the second move the locations of stones is $$$[2, 3, 5, 5, 9]$$$. After the third move the locations of stones is $$$[2, 5, 5, 5, 7]$$$. After the last move the locations of stones is $$$[4, 5, 5, 5, 5]$$$....
Java 8
standard input
[ "greedy", "constructive algorithms", "two pointers", "math", "sortings" ]
f236c4110a973d1c9f63cbbcc74b9e0b
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) – the number of stones. The second line contains integers $$$s_1, s_2, \ldots, s_n$$$ ($$$1 \le s_i \le 10^9$$$) — the initial positions of the stones. The second line contains integers $$$t_1, t_2, \ldots, t_n$$$ ($$$1 \le t_i \le 10^9$$...
2,300
If it is impossible to move the stones this way, print "NO". Otherwise, on the first line print "YES", on the second line print the number of operations $$$m$$$ ($$$0 \le m \le 5 \cdot n$$$) required. You don't have to minimize the number of operations. Then print $$$m$$$ lines, each containing integers $$$i, j, d$$$ (...
standard output
PASSED
6e3119e6d473b542ab93670a79eec7c3
train_000.jsonl
1559399700
There are $$$n$$$ stones arranged on an axis. Initially the $$$i$$$-th stone is located at the coordinate $$$s_i$$$. There may be more than one stone in a single place.You can perform zero or more operations of the following type: take two stones with indices $$$i$$$ and $$$j$$$ so that $$$s_i \leq s_j$$$, choose an ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; import java.io.IOException; import java.util.Stack; import java.util.ArrayList; import java.util.Vector; import java.util.Comparator; import ...
Java
["5\n2 2 7 4 9\n5 4 5 5 5", "3\n1 5 10\n3 5 7"]
4 seconds
["YES\n4\n4 3 1\n2 3 1\n2 5 2\n1 5 2", "NO"]
NoteConsider the first example. After the first move the locations of stones is $$$[2, 2, 6, 5, 9]$$$. After the second move the locations of stones is $$$[2, 3, 5, 5, 9]$$$. After the third move the locations of stones is $$$[2, 5, 5, 5, 7]$$$. After the last move the locations of stones is $$$[4, 5, 5, 5, 5]$$$....
Java 8
standard input
[ "greedy", "constructive algorithms", "two pointers", "math", "sortings" ]
f236c4110a973d1c9f63cbbcc74b9e0b
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) – the number of stones. The second line contains integers $$$s_1, s_2, \ldots, s_n$$$ ($$$1 \le s_i \le 10^9$$$) — the initial positions of the stones. The second line contains integers $$$t_1, t_2, \ldots, t_n$$$ ($$$1 \le t_i \le 10^9$$...
2,300
If it is impossible to move the stones this way, print "NO". Otherwise, on the first line print "YES", on the second line print the number of operations $$$m$$$ ($$$0 \le m \le 5 \cdot n$$$) required. You don't have to minimize the number of operations. Then print $$$m$$$ lines, each containing integers $$$i, j, d$$$ (...
standard output
PASSED
986dfae0fab987299f6412d67543ecb3
train_000.jsonl
1559399700
There are $$$n$$$ stones arranged on an axis. Initially the $$$i$$$-th stone is located at the coordinate $$$s_i$$$. There may be more than one stone in a single place.You can perform zero or more operations of the following type: take two stones with indices $$$i$$$ and $$$j$$$ so that $$$s_i \leq s_j$$$, choose an ...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.NoSuchElementException; public class Main { private static FastScanner sc = new FastScanner(); private static boolean DEBUG_FLG = false; public static void main(String[] args) { ...
Java
["5\n2 2 7 4 9\n5 4 5 5 5", "3\n1 5 10\n3 5 7"]
4 seconds
["YES\n4\n4 3 1\n2 3 1\n2 5 2\n1 5 2", "NO"]
NoteConsider the first example. After the first move the locations of stones is $$$[2, 2, 6, 5, 9]$$$. After the second move the locations of stones is $$$[2, 3, 5, 5, 9]$$$. After the third move the locations of stones is $$$[2, 5, 5, 5, 7]$$$. After the last move the locations of stones is $$$[4, 5, 5, 5, 5]$$$....
Java 8
standard input
[ "greedy", "constructive algorithms", "two pointers", "math", "sortings" ]
f236c4110a973d1c9f63cbbcc74b9e0b
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) – the number of stones. The second line contains integers $$$s_1, s_2, \ldots, s_n$$$ ($$$1 \le s_i \le 10^9$$$) — the initial positions of the stones. The second line contains integers $$$t_1, t_2, \ldots, t_n$$$ ($$$1 \le t_i \le 10^9$$...
2,300
If it is impossible to move the stones this way, print "NO". Otherwise, on the first line print "YES", on the second line print the number of operations $$$m$$$ ($$$0 \le m \le 5 \cdot n$$$) required. You don't have to minimize the number of operations. Then print $$$m$$$ lines, each containing integers $$$i, j, d$$$ (...
standard output
PASSED
fa0e5f69e88de0adc6001daedbae53b7
train_000.jsonl
1559399700
There are $$$n$$$ stones arranged on an axis. Initially the $$$i$$$-th stone is located at the coordinate $$$s_i$$$. There may be more than one stone in a single place.You can perform zero or more operations of the following type: take two stones with indices $$$i$$$ and $$$j$$$ so that $$$s_i \leq s_j$$$, choose an ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.StringTokenizer...
Java
["5\n2 2 7 4 9\n5 4 5 5 5", "3\n1 5 10\n3 5 7"]
4 seconds
["YES\n4\n4 3 1\n2 3 1\n2 5 2\n1 5 2", "NO"]
NoteConsider the first example. After the first move the locations of stones is $$$[2, 2, 6, 5, 9]$$$. After the second move the locations of stones is $$$[2, 3, 5, 5, 9]$$$. After the third move the locations of stones is $$$[2, 5, 5, 5, 7]$$$. After the last move the locations of stones is $$$[4, 5, 5, 5, 5]$$$....
Java 8
standard input
[ "greedy", "constructive algorithms", "two pointers", "math", "sortings" ]
f236c4110a973d1c9f63cbbcc74b9e0b
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) – the number of stones. The second line contains integers $$$s_1, s_2, \ldots, s_n$$$ ($$$1 \le s_i \le 10^9$$$) — the initial positions of the stones. The second line contains integers $$$t_1, t_2, \ldots, t_n$$$ ($$$1 \le t_i \le 10^9$$...
2,300
If it is impossible to move the stones this way, print "NO". Otherwise, on the first line print "YES", on the second line print the number of operations $$$m$$$ ($$$0 \le m \le 5 \cdot n$$$) required. You don't have to minimize the number of operations. Then print $$$m$$$ lines, each containing integers $$$i, j, d$$$ (...
standard output
PASSED
88c26bdb6d2ad1f6352143a1e7c3ba5c
train_000.jsonl
1559399700
There are $$$n$$$ stones arranged on an axis. Initially the $$$i$$$-th stone is located at the coordinate $$$s_i$$$. There may be more than one stone in a single place.You can perform zero or more operations of the following type: take two stones with indices $$$i$$$ and $$$j$$$ so that $$$s_i \leq s_j$$$, choose an ...
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.Random; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.io.BufferedReader; import java.util.Comparator; i...
Java
["5\n2 2 7 4 9\n5 4 5 5 5", "3\n1 5 10\n3 5 7"]
4 seconds
["YES\n4\n4 3 1\n2 3 1\n2 5 2\n1 5 2", "NO"]
NoteConsider the first example. After the first move the locations of stones is $$$[2, 2, 6, 5, 9]$$$. After the second move the locations of stones is $$$[2, 3, 5, 5, 9]$$$. After the third move the locations of stones is $$$[2, 5, 5, 5, 7]$$$. After the last move the locations of stones is $$$[4, 5, 5, 5, 5]$$$....
Java 8
standard input
[ "greedy", "constructive algorithms", "two pointers", "math", "sortings" ]
f236c4110a973d1c9f63cbbcc74b9e0b
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 3 \cdot 10^5$$$) – the number of stones. The second line contains integers $$$s_1, s_2, \ldots, s_n$$$ ($$$1 \le s_i \le 10^9$$$) — the initial positions of the stones. The second line contains integers $$$t_1, t_2, \ldots, t_n$$$ ($$$1 \le t_i \le 10^9$$...
2,300
If it is impossible to move the stones this way, print "NO". Otherwise, on the first line print "YES", on the second line print the number of operations $$$m$$$ ($$$0 \le m \le 5 \cdot n$$$) required. You don't have to minimize the number of operations. Then print $$$m$$$ lines, each containing integers $$$i, j, d$$$ (...
standard output
PASSED
0e11a5458fb3377f6c0eccc55a22b9e1
train_000.jsonl
1438273200
As you must know, the maximum clique problem in an arbitrary graph is NP-hard. Nevertheless, for some graphs of specific kinds it can be solved effectively.Just in case, let us remind you that a clique in a non-directed graph is a subset of the vertices of a graph, such that any two vertices of this subset are connecte...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.*; public class cf566f_2 { public static void main(String[] args) throws IOException { int n = ri(), ans = 1, dp[] = new int[1000001]; r(); for (int i = 0; i < n; ++i) { ++dp[n...
Java
["8\n3 4 6 8 10 18 21 24"]
1 second
["3"]
NoteIn the first sample test a clique of size 3 is, for example, a subset of vertexes {3, 6, 18}. A clique of a larger size doesn't exist in this graph.
Java 11
standard input
[ "dp", "number theory", "math" ]
f33991da3b4a57dd6535af86edeeddc0
The first line contains integer n (1 ≤ n ≤ 106), that sets the size of set A. The second line contains n distinct positive integers a1, a2, ..., an (1 ≤ ai ≤ 106) — elements of subset A. The numbers in the line follow in the ascending order.
1,500
Print a single number — the maximum size of a clique in a divisibility graph for set A.
standard output
PASSED
0642303f3b09839d3e58249aae1c43df
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class A { public static void main(String[] agrs) { FastScanner sc = new FastScanner(); int yo = sc.nextInt(); while(yo-->0) { long n = sc.nextLong(); if(n%4 == 0) { System.out.println("YES"); } else { System.out.println("NO"...
Java
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
b48bc8f7e48b1b48de43f11e86714674
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
256 megabytes
import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; Scanner in =...
Java
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
25ef3fe56fbc344c849d3021da2c4cf1
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
256 megabytes
import java.util.*; public class gay { public static void main (String [] args) { Scanner kb = new Scanner (System.in); int num = kb.nextInt(); for (int i=0; i<num; i++) { if (kb.nextInt()%4==0) { System.out.println("YES"); } e...
Java
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
3e6406c15268654b481da7a840c77d6b
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
256 megabytes
import java.util.*; public class Solution{ public static void main(String args[]){ Scanner sc=new Scanner(System.in); int T=sc.nextInt(); for(int t=0;t<T;t++){ long n=sc.nextLong(); if(n%4==0) System.out.println("YES"); else System.out.println...
Java
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
64a197401464564fad7850e14ae81633
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Scanner; public class C { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextI...
Java
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
2a66508a22e8e901c222edbb71c8b8ed
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
256 megabytes
import java.util.Scanner; public class fashionablee { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scanner = new Scanner(System.in); int length = scanner.nextInt(); int i; for(i=0;i<length;i++) { int n = scanner.nextInt(); if((n%4)==0) { System.out.pr...
Java
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
a3b6fd9cade4f97d9cdf65f7dfa46f71
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
256 megabytes
import java.io.*; import java.util.*; public class CP { static Scanner sc = new Scanner(System.in); static class FastReader{ BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
8d90b75dd7b95aab24b4c645905c12f7
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
256 megabytes
import java.util.*; import java.io.*; @SuppressWarnings("unused") public class HelloWorld { static class InputReader{ BufferedReader reader; StringTokenizer tokenizer; public InputReader(InputStream stream) { reader = new BufferedReader(new InputStreamReader(stream), 32768); tokenizer = null; } String next(...
Java
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
a644b1f6be7fafcbbf384c72fd0ad367
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class FashionabLee { public static void main(String[] args) throws IOException { BufferedReader f = new BufferedReader( new InputStreamReader(System.in)); int cases =...
Java
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
35a067cf0d34b67f01a323a843abeaa0
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[]args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); if(n%4==0) System.out.println("YES"); else ...
Java
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
6b90ee4ac027119b33fbd6cf2046daae
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
256 megabytes
import java.util.Scanner; public class maxGCD { public static void main(String[] args) { // TODO Auto-generated method stub Scanner s = new Scanner(System.in); int T = s.nextInt(); while(T>0) { int n = s.nextInt(); if((n-2)%2==0) { if(((n-2)/2)%2 !=0 ) System.out.println("YES"); el...
Java
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
02fa38d1910b0a0cd3091883b3cd35a0
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
256 megabytes
import java.util.*; public class try2{ public static void main(String[] args) { Scanner input=new Scanner(System.in); int t=input.nextInt(); while(t!=0){ int n=input.nextInt(); // // int each=((2*n)-4)*90; // int allangle=((n-2)*180)/n; // System.o...
Java
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
b16b1f02e2b9bac6b75c64bf2639dd74
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.util.StringTokenizer; import java.io.OutputStreamWriter; import java.io.InputStreamReader; import java.io.FileOutputStream; public class Pa{ public static void main(String[] args)throws IOException{ FastReader sc = ...
Java
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
29fd3b56d3ede51fdf7b28bc8f2af871
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); int n = 0; for (int i = 0; i < t; i++) { n = scan.nextInt(); if (n < 4) { ...
Java
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
7e5b6e20a3b4f352cfe2e53d18e0b8ca
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
256 megabytes
import java.util.*; public class Main { public static void main(String args[]) { int i; Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int a[]=new int[n]; for(i=0;i<n;i++) { a[i]=sc.nextInt(); } for(i=0;i<n;i++) { ...
Java
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
8b7a6f124674fa8ca299be7e890bc3d9
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
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
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
ded982859d649f51de436f7c75b81f22
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
256 megabytes
//package com.company; import java.io.*; import java.util.*; public class Main { static int isprime(long n) { int flag = 0; for (int i = 2; i <= (Math.sqrt(n)); i++) { if (n % i == 0) { flag = 1; break; } } if (flag == 0) ...
Java
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
5ffe68397b5697734f290f95b04133d8
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
256 megabytes
//package com.company; import java.io.*; import java.util.*; public class Main { static int isprime(long n) { int flag = 0; for (int i = 2; i <= (Math.sqrt(n)); i++) { if (n % i == 0) { flag = 1; break; } } if (flag == 0) ...
Java
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
425fa996a5e0ef3a0148bd3b4767b2cb
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
256 megabytes
import java.util.*; import java.io.*; public class Problem{ public static void main(String[] args) throws NumberFormatException, IOException{ BufferedReader br =new BufferedReader(new InputStreamReader(System.in)); int t=Integer.parseInt(br.readLine()); while(t-->0) { int n=Integer.pa...
Java
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
cf9ea8bf9e20eec88ce8e2b5d009f09d
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
256 megabytes
import java.util.Scanner; //Solve No 5 public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int t = input.nextInt(); for (int i = 0; i <t; i++) { int a = input.nextInt(); if (a%4==0) { System.out.println("YES"); } else { System.out.println("NO");...
Java
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
d5e0489aaadc565aa4b1109f25f49ab4
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
256 megabytes
import java.io.IOException; import java.util.Scanner; public class Codeforces { public static void main(String[] args){ Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int x = 0; while (n > 0) { x = scanner.nextInt(); String answer = x%4...
Java
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
d3b98cf3a9d7e10458ed2db631a1d86a
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { public static int r(int n){ while(n%2==0){ n=n/2; } return n; } public static int r2(int a){ if(a==0){ a=1; } else{ a=0; } ...
Java
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
00b2feb2056171fa193f6276dd16e0e3
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
256 megabytes
import java.io.*; import java.sql.Array; import java.util.*; public class Main { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public Reader() { ...
Java
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
183d1700febaa19621b8dc099263c203
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
256 megabytes
import java.io.*; import java.util.*; import java.math.BigInteger; import java.math.BigDecimal; import java.math.RoundingMode; public class forces{ public static void main(String args[])throws IOException{ //DataInputStream ins = new DataInputStream(System.in); Scanner sc = new Scanner(System.in); int t = ...
Java
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
e0bd81778ac65767a91e1e8d220373b0
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
256 megabytes
import java.util.*; import java.io.*; import static java.lang.Math.*; public class Solution { public static void main(String[] args) { Scanner s = new Scanner(System.in); //System.out.println("Kickstart baby!!"); int test=s.nextInt(); while(test-->0) { long n=s....
Java
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
a66e31ef937f789160e066cfdd856ef8
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
256 megabytes
import java.util.*; public class CodeForces { public static void main(String[] args) { Scanner in=new Scanner(System.in); int m,n; n=in.nextInt(); for(int i=0;i<n;i++) { m=in.nextInt(); if(m%4!=0) System.out.println("NO"); ...
Java
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
49efc8a2e458bf39d0aa82b7c7d67ce3
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
256 megabytes
import java.math.BigDecimal; import java.math.MathContext; import java.util.Scanner; public class Fashinablee { public static void main(String[] args) { // TODO Auto-generated method stub Scanner s=new Scanner(System.in); int t=s.nextInt(); for(int i=0;i<t;i++) { int n=s.nextInt(); if((n%4)==0) { ...
Java
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
99746434007b9f973b833e59c9707077
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
256 megabytes
//package Codeforces; import java.util.*; public class Codeforces { public static void main(String[] args){ Scanner scan = new Scanner(System.in); int t; t = scan.nextInt(); while(t != 0){ long n; n = scan.nextLong(); if(n%4 == 0){ ...
Java
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
e2a69b75c15ee9b6b78e6fcc3b5b490a
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
256 megabytes
import java.util.*; import java.io.*; public class WeirdAlgorithm { public static void main(String[] args) { FastReader sc = new FastReader(); int t = sc.nextInt(); Map<String, Boolean> map=new HashMap<>(); while (t-->0) { int n = sc.nextInt(); System.out....
Java
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
bb1e0757441675de7685e5e8f1c90896
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
256 megabytes
import java.util.*; public class Convex{ public static void main(String []args){ Scanner sc = new Scanner(System.in); int test=sc.nextInt(); for(int i=0;i<test;i++){ long n=sc.nextLong(); if(((n-2)*180)/n<180 && n%4==0){ ...
Java
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
1d2b734d71ea5bb6de6b03d277d52cfd
train_000.jsonl
1592921100
Lee is going to fashionably decorate his house for a party, using some regular convex polygons...Lee thinks a regular $$$n$$$-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least one of its edges is parallel to the $$$OX$$$-axis and at least one of its edges is parallel to the...
256 megabytes
import java.util.*; public class Demo { public static void main(String args[]) { Scanner s=new Scanner(System.in); int n=s.nextInt(); for(int i=0;i<n;i++) { int a=s.nextInt(); if(a%4==0) { System.out.println("YES")...
Java
["4\n3\n4\n12\n1000000000"]
2 seconds
["NO\nYES\nYES\nYES"]
NoteIn the example, there are $$$4$$$ polygons in the market. It's easy to see that an equilateral triangle (a regular $$$3$$$-sided polygon) is not beautiful, a square (a regular $$$4$$$-sided polygon) is beautiful and a regular $$$12$$$-sided polygon (is shown below) is beautiful as well.
Java 11
standard input
[ "geometry", "math" ]
07e56d4031bcb119d2f684203f7ed133
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of polygons in the market. Each of the next $$$t$$$ lines contains a single integer $$$n_i$$$ ($$$3 \le n_i \le 10^9$$$): it means that the $$$i$$$-th polygon is a regular $$$n_i$$$-sided polygon.
800
For each polygon, print YES if it's beautiful or NO otherwise (case insensitive).
standard output
PASSED
82fa63af728613ca187dcf8520c99436
train_000.jsonl
1348500600
There are n piles of stones of sizes a1, a2, ..., an lying on the table in front of you.During one move you can take one pile and add it to the other. As you add pile i to pile j, the size of pile j increases by the current size of pile i, and pile i stops existing. The cost of the adding operation equals the size of t...
256 megabytes
import java.io.*; import java.util.*; public class P226B { public static StringTokenizer st; public static void nextLine(BufferedReader br) throws IOException { st = new StringTokenizer(br.readLine()); } public static String next() { return st.nextToken(); } pu...
Java
["5\n2 3 4 1 1\n2\n2 3"]
2 seconds
["9 8"]
NoteIn the first sample one way to get the optimal answer goes like this: we add in turns the 4-th and the 5-th piles to the 2-nd one; then we add the 1-st pile to the 3-rd one; we add the 2-nd pile to the 3-rd one. The first two operations cost 1 each; the third one costs 2, the fourth one costs 5 (the size of the 2-n...
Java 7
standard input
[ "greedy" ]
87045c4df69110642122f2c114476947
The first line contains integer n (1 ≤ n ≤ 105) — the number of stone piles. The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 109) — the initial sizes of the stone piles. The third line contains integer q (1 ≤ q ≤ 105) — the number of queries. The last line contains q space-separated inte...
1,900
Print q whitespace-separated integers — the answers to the queries in the order, in which the queries are given in the input. 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
5bc9b8bb02539e444db8d90284b4c982
train_000.jsonl
1348500600
There are n piles of stones of sizes a1, a2, ..., an lying on the table in front of you.During one move you can take one pile and add it to the other. As you add pile i to pile j, the size of pile j increases by the current size of pile i, and pile i stops existing. The cost of the adding operation equals the size of t...
256 megabytes
import java.io.*; import java.util.*; public class B { public static void main(String[] args) throws Exception { new B().solve(); // new FileInputStream(new File("input.txt")), // new PrintStream(new FileOutputStream(new File("output.txt")))); } void solve() throws IOException { ...
Java
["5\n2 3 4 1 1\n2\n2 3"]
2 seconds
["9 8"]
NoteIn the first sample one way to get the optimal answer goes like this: we add in turns the 4-th and the 5-th piles to the 2-nd one; then we add the 1-st pile to the 3-rd one; we add the 2-nd pile to the 3-rd one. The first two operations cost 1 each; the third one costs 2, the fourth one costs 5 (the size of the 2-n...
Java 7
standard input
[ "greedy" ]
87045c4df69110642122f2c114476947
The first line contains integer n (1 ≤ n ≤ 105) — the number of stone piles. The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 109) — the initial sizes of the stone piles. The third line contains integer q (1 ≤ q ≤ 105) — the number of queries. The last line contains q space-separated inte...
1,900
Print q whitespace-separated integers — the answers to the queries in the order, in which the queries are given in the input. 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
abcfb53c6ec2550fd44ffd8d5e1f7a53
train_000.jsonl
1348500600
There are n piles of stones of sizes a1, a2, ..., an lying on the table in front of you.During one move you can take one pile and add it to the other. As you add pile i to pile j, the size of pile j increases by the current size of pile i, and pile i stops existing. The cost of the adding operation equals the size of t...
256 megabytes
/* Codeforces Template */ 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 { static long initTime; static final Random rnd = new Random(7777L); static boo...
Java
["5\n2 3 4 1 1\n2\n2 3"]
2 seconds
["9 8"]
NoteIn the first sample one way to get the optimal answer goes like this: we add in turns the 4-th and the 5-th piles to the 2-nd one; then we add the 1-st pile to the 3-rd one; we add the 2-nd pile to the 3-rd one. The first two operations cost 1 each; the third one costs 2, the fourth one costs 5 (the size of the 2-n...
Java 7
standard input
[ "greedy" ]
87045c4df69110642122f2c114476947
The first line contains integer n (1 ≤ n ≤ 105) — the number of stone piles. The second line contains n space-separated integers: a1, a2, ..., an (1 ≤ ai ≤ 109) — the initial sizes of the stone piles. The third line contains integer q (1 ≤ q ≤ 105) — the number of queries. The last line contains q space-separated inte...
1,900
Print q whitespace-separated integers — the answers to the queries in the order, in which the queries are given in the input. 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
f0b0bc2b27ed94634a6476941d379f3c
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; public class codeforces{ public static void main(String[] args) throws IOException{ InputStreamReader isr=new InputStreamReader(System.in); BufferedReader br=new Buffer...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
41b83aa200d2c1ee0248c3573350141d
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.io.*; import java.util.Arrays; public class Codechef { public static void main(String args[]) throws NumberFormatException, IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String line[]=br.readLine().split(" "); int n=Integer.parseInt(line[0]); i...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
33f6298f143443bfa2bb66f16f99e926
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main { static PrintWriter out; static Reader in; public static void main(String[] args) throws IOException { //out = new PrintWriter(new File("out.txt")); //PrintWriter out = new PrintWriter(System.out); //in = ...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
32da5c7bb1c390fa0570d966698a19ce
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
//package round_574; import java.util.*; public class test { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in=new Scanner(System.in); int n=in.nextInt(); int k=in.nextInt(); int[] a=new int[n]; int[] cnt=new int[k+1]; for(int i=0;i<n;i++) { a[i]=in.nextInt(); ...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
84823dd388ccfdff1526aceecc1a7809
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.util.*; //574 public class qa { public static void main(String ... args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int k=sc.nextInt(); int arr[]=new int[n]; for(int i=0;i<n;i++) arr[i]=sc.nextInt(); HashMap<Integer,Integer>hm=new HashMap<Integer,Integer>(); for(int i=0;i<n;...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
d21110e3590caa15bd99046b84471cfe
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.util.*; import java.lang.*; public class problem1 { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int n=scn.nextInt(); int k=scn.nextInt(); int limit=n/2; if(n%2==0) limit=n/2; else limit=(n/2)+1; int[] arr=new int[k+1]; for(int i=0;i<n;i++) { int ...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
31484ee5cf90f90601ae274f385c7e9e
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class DrinksChoosing { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); HashMap<Integer, Integer> map = new HashMap<>(); ...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
abed2e33e978addb7cef1c00bf55a01c
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.util.Arrays; import java.util.HashMap; import java.util.Scanner; public class Watermelon { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int a[] =new int [1001]; for(int i=0;i<n...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
07cacaedc88425dfc9d210d1ec5943b2
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class test1 { public static void main(String[] args) { Scanner s =new Scanner(System.in); int n = s.nextInt(); int k = s.nextInt(); int[] inp = new int[n]; for(int i = 0;i<n;++i) { inp[i] = s.nextInt(); } Arrays.sort(inp); int co...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
2cba6bfd3ecdc4856122bad626c0c113
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.util.Scanner; public class DrinksChoosing { public static void main(String[] args) { Scanner scan=new Scanner(System.in); int n=scan.nextInt(); int k=scan.nextInt(); int a[]=new int[n]; int count[]=new int[k+1]; for(int i=0;i<n;i++) { a[i]=scan.nextInt(); count[a[i]]++; }int ans=0; for(int i=1...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
dd0d172db1b3ae32c4bcb37a7996c091
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
/*package whatever //do not write package name here */ import java.io.*; import java.util.*; public class GFG { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int K = sc.nextInt(); int pairs = (int)Math.round((N*1.0)/2.0); int count = 0; ...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
7e3cc47ca1f84c28f43b2ac10a426dbc
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
f578ede398e5e89ca3cac132bbbc8b75
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.util.*; public class Main{ public static void main(String[] args){ Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); int[] freq = new int[k]; ArrayList<Integer> arr = new ArrayList<>(); for(int i=0;i<n;i++) { ar...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
fc01ad2db771d438ec3108520fc71f84
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.util.Scanner; public class Cf { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int students = scan.nextInt(); int choices = scan.nextInt(); int hashie[] = new int[choices+1]; for(int i=0; i< students; i++) { int temp = scan.nextInt(); hashie...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
f7cb052aebe3811b10b43c19bcce75f7
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; import java.util.concurrent.LinkedBlockingQueue; import java.util.zip.Inflater; public class Main { private static AWriter writer = new AWriter(System.out); private static AReader reader = new AReader(System.in); ...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
33687bf509802cd53c2dfa19c8466150
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedList; import java.util.Queue; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.Random; import java.io.PrintWriter; /* Solution Created: 02:52:34 18/07/2019 Custom Compet...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
94b8819cb072adb0e04a66f074221935
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.util.Scanner; public class CodeForces { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int[] a = new int[k]; for (int i = 0; i < n; i++) { a[sc.nextInt()-1]++; } int ans = 0; ...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
96a4d27e69c7e75a2c5cbc4a43395b16
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner=new Scanner(System.in); int n = scanner.nextInt(); int k = scanner.nextInt(); int choices[] = new int[n]; for(int i=0;i<n;i++) { choices[i]=scanner.nextInt(); } Arrays.p...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
5fef524a5f4f89a6f71a10c877af2026
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.util.*; import java.io.*; import static java.lang.System.out; public class Main { private Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); public static void main(String[] args) { System.out.println(new Main().solveTest()); } void solveAll(){ ...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
56617583510eb3d58b19d5e36e12fe9b
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.util.HashMap; import java.util.Map; import java.util.Scanner; import java.util.*; public class DigitPair { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int k=sc.nextInt(); int a[]=new int[k+1]; ...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
fa3574b936d96d4af4a6be827ef091fd
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.util.Scanner; public class SportMafia { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); long n = sc.nextLong(); long k = sc.nextLong(); int arr[] = new int[10000]; for(int i = 0 ; i < n ; i++){ int s = sc.nextInt(); a...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
39ddfd7baef4fd16c4d58ce0e0f10f08
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.util.Scanner; public class SportMafia { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); long n = sc.nextLong(); long k = sc.nextLong(); int arr[] = new int[10000]; for(int i = 0 ; i < n ; i++){ int s = sc.nextInt(); a...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
e823576504e71a03d237207e472da052
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
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. */ //package coding; import java.util.*; /** * * @author Dell */ public class cdfctest { public static Scanner in = new Scanner(...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
c324949545a24b6988ea45c4a33254d5
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class DrinksChoosing { public static void main(String[] args) { DrinksChoosing single = new DrinksChoosing(); single.solve(); } private void solve() { BufferedReader reader = ...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
f012b756e3e4bd32a8a1b940f2d00767
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; public class Drinkschoosing { static class pair { private int fi; private int se; public pair(int fi,int se) { this.fi=fi; this.se=se; } public static Comparator<pair> compare = new Comparator<pair>() { @Override public int com...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
208e15f9620e0e0f70e2f70bdf1e5b7f
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
/*Author: Satyajeet Singh, Delhi Technological University*/ import java.io.*; import java.util.*; import java.text.*; import java.lang.*; import java.math.*; public class Main{ /*********************************************Constants******************************************/ static PrintWriter ...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
3637ebd2aefb6f573c73f469f0d32b69
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.HashMap; import java.util.Map; import java.util.StringTokenizer; public class Main { public static void main(String[] ar...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
2fb03b3a44307ca05afb310f54334c6e
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.util.*; public class A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), k = sc.nextInt(); int a; int[] cnt = new int[k + 1]; int res = 0; for (int i = 0; i < n; i++) { a = sc.nextInt(); cnt[a]++; } int l = 0;...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
1c5762441ce518c0ac8d19710b27906d
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
//package codeforce; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.HashMap; import java.util.Map; public class drinks { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new In...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
5545a85f34460a9c32c28b3da774e8bd
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.*; public class A { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[]...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
cacf78d4c47a8788c9cac5a58ce1cbaa
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { static final int N = 1050; static int[] a = new int[N]; public static void main (String[] args) throws java.lang.Exception { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputR...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
104e2a974c758d0b9f5868b98db795a8
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class A574{ public static void main(String args[]){ FastReader sc = new FastReader(); StringBuilder sb=new StringBuilder(); int t,i,n,k,a; t=1; while(t-->0){ n=sc.nextInt(); k=sc.nextInt();...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
5a8bef2202992e79c85ff21da73e283d
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.StringTokenizer; public class A { public static void main(String[] args) throws FileNotFoundException { int toFile = 0; InputStream inputStream; OutputStream outputStream; if (toFile == 0) { input...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
bb2d6cf8c77c2c2879c4fedccff721c1
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.util.Scanner; public class m { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); int[] a = new int[n]; for (int i=0;i<a.length;i++) { a[i]=in.nextInt(); } in.close(); int[] loveList= new int[k]; for(int i=0;i<a.len...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
53c86033558522e3a328fb5f033bebe1
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.util.*; public class TEST{ public static void main(String args []){ Scanner sc = new Scanner(System.in); int n=sc.nextInt(); int k=sc.nextInt(); int d[]=new int[k+1]; for(int i=0;i<n;i++) { int q=sc.nextInt(); d[q]++; } /*for(int i=1;i<=k;i++) { //System.out.println(i+" "+d[i]); }*...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
5d7a97d3e4f30d772ea8461c0217a538
train_000.jsonl
1563374100
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?There are $$$n$$$ students living in a building, and for each of them the favorite drink $$$a_i$$$ is known. So you know...
256 megabytes
import java.util.Scanner; public class CodeA { public static void main(String[] args) { Scanner scanner=new Scanner(System.in); int n,k; n=scanner.nextInt(); k=scanner.nextInt(); int a[]=new int[n]; int b[]=new int[1001]; int totalSets=(n%2==0?(n/2):((n/2)+1)); int count=0; for(int i=0;i<n;i+...
Java
["5 3\n1\n3\n1\n1\n2", "10 3\n2\n1\n3\n2\n3\n3\n1\n3\n1\n2"]
2 seconds
["4", "9"]
NoteIn the first example, students could choose three sets with drinks $$$1$$$, $$$1$$$ and $$$2$$$ (so they will have two sets with two drinks of the type $$$1$$$ each and one set with two drinks of the type $$$2$$$, so portions will be $$$1, 1, 1, 1, 2, 2$$$). This way all students except the second one will get thei...
Java 8
standard input
[ "greedy", "math" ]
dceeb739a56bb799550138aa8c127996
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 1\,000$$$) — the number of students in the building and the number of different drinks. The next $$$n$$$ lines contain student's favorite drinks. The $$$i$$$-th line contains a single integer from $$$1$$$ to $$$k$$$ — the type of t...
1,000
Print exactly one integer — the maximum number of students that can get a favorite drink.
standard output
PASSED
e26be158cacfd6a007636c829b0f7af6
train_000.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.*; import java.util.*; public class Codeforces { public static void main(String args[])throws Exception { BufferedReader bu=new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb=new StringBuilder(); String s[]=bu.readLine().split(" "); int n=Integ...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 11
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
773b9240869049bcf0901ec145974f36
train_000.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.HashMap; import java.util.Map; import java.util.PriorityQueue; import java.util.Scanner; public class Rank { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int[] p = new int[n]; int[] t = new int[n]; ...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 11
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
d3ef90017b16e086fba82937f810faf1
train_000.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.ArrayList; import java.util.Comparator; import java.util.Scanner; public class A166sol2 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(), //No. of teams k = in.nextInt(); //look for place ArrayList<Integer> ar...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 11
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
c287d991e507d871cd61253177e61c58
train_000.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.Arrays; import java.util.Comparator; import java.util.Scanner; public class A166 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(), //No. of teams k = in.nextInt(); //look for place int[][] arr = new int[n][2];...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 11
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
ea9fc03efdf96d20e035956e0a28313c
train_000.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
//https://codeforces.com/problemset/problem/166/A //A. Rank List import java.util.*; import java.io.*; public class Rank_List{ public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(new OutputStreamWrite...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 11
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
203467d61006899e40795968f861838f
train_000.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Ideone { public static void main (String[] args) throws java.lang.Exception { Scanner in = new Scanner(System.in); int n = in.nextInt();int g = 0; int h = 0; ...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 11
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
f6a6feb6b9aeb6f999c5a7d95f026813
train_001.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class Main { //Fast Reader private static class FastReader { BufferedReader br; StringTokenizer st; ...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 11
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
2dc25a847ed11b9c8e47581b8353aaec
train_001.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.*; import java.util.Arrays; public class RankList { static class Team implements Comparable<Team> { int problemsSolved; int penaltyTime; public Team(int x, int y) { this.problemsSolved = x; this.penaltyTime = y; } // descending order public int compareTo(Team otherTeam) { i...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 11
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
c2c4578d0a3b6355cdf48e05348676d5
train_001.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.*; import java.util.*; public class S { static class x implements Comparable<x>{ int s; int d; @Override public int compareTo(x o) { if(o.s > this.s) { return 1; }else if(o.s == this.s){ if(o.d < this.d) { return 1; }else { return -1; } }else { return -1; } ...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 11
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
a3c90ce5f5d4aa6a7a5e9e49fefeb984
train_001.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.*; public class S { static BufferedReader reader; static StringTokenizer tokenizer; /** call this method to initialize reader for InputStream */ static void init(I...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 11
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
067a9cc6d4fe171994b5e6d0242d2dc4
train_001.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.*; import java.util.*; public class Main { static class Solver { // long[][] dp; int n,k; int mod = (int)1e9 + 7; public void solve(MyReader in, PrintWriter out) { n = in.nextInt(); k = in.nextInt(); Pair<Integer,Integer>[] pairs ...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 11
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
3ae482debd3f7a9aba77d2c18f38f4fd
train_001.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.*; import java.io.*; public class A { public static class SortMarks implements Comparator<ArrayList<Integer>> { public int compare(ArrayList<Integer> a1, ArrayList<Integer> a2) { if (a1.get(0) < a2.get(0)) return 1; else if (a1.get(0) == a2.get(0) &...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 11
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
fa78c78cec1f7fa94641a4be45f99aab
train_001.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.*; import java.io.*; public class Codeforces { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public Reader() { din ...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 11
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
d55c0b09ffbfdb6de78ff43f033443e7
train_001.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.*; import java.io.*; public class Codeforces { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public Reader() { din ...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 11
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
6ac5aa3541d6e472d7b3efef37a9f7ec
train_001.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; import java.awt.geom.*; import static java.lang.Math.*; public class Solution implements Runnable { public void solve() throws Exception { // int t=sc.nextInt(); // long mod=(long)1e9+7; // // while(t-->0) // ...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 11
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
baced0dbeb84647674fcbd790099c728
train_001.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.*; import java.util.*; public class Test { public static void main(String[] args)throws IOException { Reader sc= new Reader(); PrintWriter w= new PrintWriter(System.out); int n=sc.nextInt(); int k=sc.nextInt(); int a[]= new int[n]; for(int i=0;i<n;i++) { a[i]= sc.nextInt() * 1...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 11
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
1199583f7a46e3d2291b714881ce3960
train_001.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.io.*; import java.util.*; /** * 03/05/20 * Created by Himanshu **/ public class RankList { static class pair implements Comparator<pair>{ int a,b; pair(int a , int b) { this.a = a; this.b = b; } pair() {} public int hash() { ...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 11
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output
PASSED
c5dcbd470f028e00dac5b7ea198ca24c
train_001.jsonl
1332516600
Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ...
256 megabytes
import java.util.*; import java.io.*; public class codf { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int k = s.nextInt(); ArrayList<ArrayList<Integer>> A = new ArrayList<>(); for (int i = 0; i < n; i++) { in...
Java
["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"]
2 seconds
["3", "4"]
NoteThe final results' table for the first sample is: 1-3 places — 4 solved problems, the penalty time equals 10 4 place — 3 solved problems, the penalty time equals 20 5-6 places — 2 solved problems, the penalty time equals 1 7 place — 1 solved problem, the penalty time equals 10 The table shows that the second p...
Java 11
standard input
[ "sortings", "binary search", "implementation" ]
63e03361531999db408dc0d02de93579
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1 ≤ pi, ti ≤ 50) — the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces...
1,100
In the only line print the sought number of teams that got the k-th place in the final results' table.
standard output