Search is not available for this dataset
problem_id
stringlengths
32
32
name
stringlengths
2
112
problem
stringlengths
200
14k
test_cases
stringlengths
33
79.2M
difficulty
stringclasses
33 values
language
listlengths
1
1
source
stringclasses
14 values
num_solutions
int64
2
1.9M
starter_code
stringlengths
0
1.47k
subset
stringclasses
3 values
c95ec8bbce763fd036c37dea65abd276
Paths and Trees
Little girl Susie accidentally found her elder brother's notebook. She has many things to do, more important than solving problems, but she found this problem too interesting, so she wanted to know its solution and decided to ask you about it. So, the problem statement is as follows. Let's assume that we are given a c...
{"inputs": ["3 3\n1 2 1\n2 3 1\n1 3 2\n3", "4 4\n1 2 1\n2 3 1\n3 4 1\n4 1 2\n4", "4 5\n1 2 1\n1 3 1\n2 4 1\n3 4 1\n2 3 10\n1", "6 8\n1 2 30\n1 3 20\n2 3 50\n4 2 100\n2 5 40\n3 5 10\n3 6 50\n5 6 60\n4", "1 0\n1", "2 1\n1 2 1000000000\n2"], "outputs": ["2\n1 2 ", "4\n2 3 4 ", "3\n1 2 3 ", "230\n1 4 5 6 7 ", "0", "1000000...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
1
codeforces
c9bd2ecc84eee31c97d701505f902d35
Bad Luck Island
The Bad Luck Island is inhabited by three kinds of species: *r* rocks, *s* scissors and *p* papers. At some moments of time two random individuals meet (all pairs of individuals can meet equiprobably), and if they belong to different species, then one individual kills the other one: a rock kills scissors, scissors kill...
{"inputs": ["2 2 2", "2 1 2", "1 1 3", "3 2 1", "100 100 100", "1 100 100", "100 1 100", "100 100 1", "1 100 99", "99 1 100", "100 99 1", "100 1 99", "1 99 100", "99 100 1", "1 1 1", "100 100 2", "100 2 100", "2 100 100", "3 3 3", "44 54 32", "100 90 5", "90 5 100", "5 100 90", "100 5 90", "5 90 100", "90 100 5", "4 4 ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
14
codeforces
c9c7b9f7d69ec1a2adb6957425033f52
Maximum in Table
An *n*<=×<=*n* table *a* is defined as follows: - The first row and the first column contain ones, that is: *a**i*,<=1<==<=*a*1,<=*i*<==<=1 for all *i*<==<=1,<=2,<=...,<=*n*. - Each of the remaining numbers in the table is equal to the sum of the number above it and the number to the left of it. In other words, the ...
{"inputs": ["1", "5", "2", "3", "4", "6", "7", "9", "10", "8"], "outputs": ["1", "70", "2", "6", "20", "252", "924", "12870", "48620", "3432"]}
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
869
codeforces
c9db3ceceb2ff1f67aefc2459bf97dc9
Wallpaper
Having bought his own apartment, Boris decided to paper the walls in every room. Boris's flat has *n* rooms, each of which has the form of a rectangular parallelepiped. For every room we known its length, width and height of the walls in meters (different rooms can have different dimensions, including height). Boris c...
{"inputs": ["1\n5 5 3\n3\n10 1 100\n15 2 320\n3 19 500", "1\n9 10 7\n1\n7 1 3", "1\n6 9 5\n3\n8 5 10\n8 5 2\n6 3 7", "1\n3 3 10\n3\n5 5 1\n9 9 2\n10 1 500", "3\n29 30 29\n30 15 28\n27 30 23\n3\n30 27 21\n11 24 30\n25 20 12", "5\n4 4 1\n3 1 4\n4 1 3\n5 1 1\n1 1 1\n5\n5 3 3\n4 3 4\n5 2 3\n2 1 5\n3 1 3", "10\n57 66 71\n14...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
4
codeforces
ca115b811848bef818685ad440e1ead2
Tufurama
One day Polycarp decided to rewatch his absolute favourite episode of well-known TV series "Tufurama". He was pretty surprised when he got results only for season 7 episode 3 with his search query of "Watch Tufurama season 3 episode 7 online full hd free". This got Polycarp confused — what if he decides to rewatch the ...
{"inputs": ["5\n1 2 3 4 5", "3\n8 12 7", "3\n3 2 1", "5\n2 3 4 5 6", "8\n7 2 6 6 5 1 4 9", "10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000", "1\n1"], "outputs": ["0", "3", "2", "4", "9", "45", "0"]}
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
3
codeforces
ca1dfc506b7bb53a74ad35faa89dd5c1
Taymyr is calling you
Comrade Dujikov is busy choosing artists for Timofey's birthday and is recieving calls from Taymyr from Ilia-alpinist. Ilia-alpinist calls every *n* minutes, i.e. in minutes *n*, 2*n*, 3*n* and so on. Artists come to the comrade every *m* minutes, i.e. in minutes *m*, 2*m*, 3*m* and so on. The day is *z* minutes long,...
{"inputs": ["1 1 10", "1 2 5", "2 3 9", "4 8 9", "7 9 2", "10000 10000 10000", "24 22 9235", "74 8 417", "972 1 203", "550 1 754", "860 1 884", "358 2 809", "33 27 216", "2940 1 9311", "4624 1 1953", "2696 2 7345", "3443 2 6701", "3 613 2275", "1 10000 10000", "10000 1 10000", "1 1 1", "1 1 10000", "34 27 10000", "2 2 ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
473
codeforces
ca2e11a194b5b6dd6e1572ac699a94bb
Maximal GCD
You are given positive integer number *n*. You should create such strictly increasing sequence of *k* positive numbers *a*1,<=*a*2,<=...,<=*a**k*, that their sum is equal to *n* and greatest common divisor is maximal. Greatest common divisor of sequence is maximum of such numbers that every element of sequence is divi...
{"inputs": ["6 3", "8 2", "5 3", "1 1", "1 2", "2 1", "2 10000000000", "5 1", "6 2", "24 2", "24 3", "24 4", "24 5", "479001600 2", "479001600 3", "479001600 4", "479001600 5", "479001600 6", "3000000021 1", "3000000021 2", "3000000021 3", "3000000021 4", "3000000021 50000", "3000000021 100000", "10000000000 100", "100...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
70
codeforces
ca337d70fd33ab768399ea1ce6e1e0cd
T-primes
We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer *t* Т-prime, if *t* has exactly three distinct positive divisors. You are given an array of *n* positive integers. For each of them determine whether it is Т-prime or not. The fir...
{"inputs": ["3\n4 5 6", "2\n48 49", "10\n10 9 8 7 6 5 4 3 2 1", "1\n36", "1\n999966000289", "1\n999993399999", "9\n111 121 131 111 121 131 111 121 131", "1\n1", "1\n10", "1\n976197352729", "1\n1000000000000", "1\n9", "6\n549755813888 847288609443 762939453125 678223072849 285311670611 137858491849", "3\n223092870 64696...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
61
codeforces
ca3947b67c3a6a10a16078700522a212
Statistics of Recompressing Videos
A social network for dogs called DH (DogHouse) has *k* special servers to recompress uploaded videos of cute cats. After each video is uploaded, it should be recompressed on one (any) of the servers, and only after that it can be saved in the social network. We know that each server takes one second to recompress a on...
{"inputs": ["3 2\n1 5\n2 5\n3 5", "6 1\n1 1000000000\n2 1000000000\n3 1000000000\n4 1000000000\n5 1000000000\n6 3", "1 1\n1 1", "1 1\n1000000000 10000", "10 6\n1 1\n2 1\n3 1\n4 1\n5 1\n6 1\n7 1\n8 1\n9 1\n10 1", "10 4\n1 1\n2 2\n3 1\n4 1\n5 1\n6 1\n7 1\n8 2\n9 1\n10 1", "10 2\n1 5650\n2 4753\n3 7632\n4 688\n5 8853\n6 2...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
7
codeforces
ca3d6467bdb990da04d4d92e4273bb4d
Room Leader
Let us remind you part of the rules of Codeforces. The given rules slightly simplified, use the problem statement as a formal document. In the beginning of the round the contestants are divided into rooms. Each room contains exactly *n* participants. During the contest the participants are suggested to solve five prob...
{"inputs": ["5\nPetr 3 1 490 920 1000 1200 0\ntourist 2 0 490 950 1100 1400 0\nEgor 7 0 480 900 950 0 1000\nc00lH4x0R 0 10 150 0 0 0 0\nsome_participant 2 1 450 720 900 0 0", "1\nA 0 0 200 0 0 0 0", "2\n12345678901234567890 1 0 200 0 0 0 0\n_ 1 0 201 0 0 0 0", "5\nAb 0 0 481 900 1200 1600 2000\nCd 0 0 480 899 1200 1600...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
86
codeforces
ca4164560911dd7263a284d68b508ad5
Writing Code
Programmers working on a large project have just received a task to write exactly *m* lines of code. There are *n* programmers working on a project, the *i*-th of them makes exactly *a**i* bugs in every line of code that he writes. Let's call a sequence of non-negative integers *v*1,<=*v*2,<=...,<=*v**n* a plan, if *...
{"inputs": ["3 3 3 100\n1 1 1", "3 6 5 1000000007\n1 2 3", "3 5 6 11\n1 2 1", "2 3 3 1000\n1 2", "3 10 10 150691913\n8 7 10", "100 500 500 895583345\n20 39 5 5 41 47 36 33 34 22 21 33 7 4 15 35 16 37 39 46 27 4 12 35 43 26 23 40 16 50 27 7 49 28 17 28 16 22 18 12 25 34 28 24 10 21 38 10 40 50 35 18 23 38 10 42 22 19 24...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
16
codeforces
ca67f81524362b2d19d014c461c2397c
As Fast As Possible
On vacations *n* pupils decided to go on excursion and gather all together. They need to overcome the path with the length *l* meters. Each of the pupils will go with the speed equal to *v*1. To get to the excursion quickly, it was decided to rent a bus, which has seats for *k* people (it means that it can't fit more t...
{"inputs": ["5 10 1 2 5", "3 6 1 2 1", "39 252 51 98 26", "59 96 75 98 9", "87 237 3 21 40", "11 81 31 90 1", "39 221 55 94 1", "59 770 86 94 2", "10000 1000000000 1 2 1", "10000 1 999999999 1000000000 1", "9102 808807765 95894 96529 2021", "87 422 7 90 3", "15 563 38 51 5", "39 407 62 63 2", "18 518 99 100 4", "8367 5...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
16
codeforces
ca82c102c0674d5c724b69c7a9077362
Dima and Salad
Dima, Inna and Seryozha have gathered in a room. That's right, someone's got to go. To cheer Seryozha up and inspire him to have a walk, Inna decided to cook something. Dima and Seryozha have *n* fruits in the fridge. Each fruit has two parameters: the taste and the number of calories. Inna decided to make a fruit sa...
{"inputs": ["3 2\n10 8 1\n2 7 1", "5 3\n4 4 4 4 4\n2 2 2 2 2", "1 1\n1\n1", "1 1\n1\n2", "2 1\n75 65\n16 60", "21 8\n50 39 28 27 58 46 95 46 50 8 28 94 61 58 57 7 1 38 9 34 12\n94 1 77 1 17 40 99 31 26 1 1 1 15 7 6 1 85 3 32 65 78", "16 2\n60 5 39 38 43 10 99 2 88 24 2 73 21 57 60 69\n59 92 96 9 1 15 4 42 23 7 100 10 9...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
11
codeforces
ca8f6ab2803cb58d95f89fdce4108ac1
Anniversary
There are less than 60 years left till the 900-th birthday anniversary of a famous Italian mathematician Leonardo Fibonacci. Of course, such important anniversary needs much preparations. Dima is sure that it'll be great to learn to solve the following problem by the Big Day: You're given a set *A*, consisting of numb...
{"inputs": ["10 1 8 2", "10 1 8 3", "10 1 20 2", "4 1 10 2", "1000000000 999000000000 1000000000000 1000000001", "643354696 8 9 2", "829051283 4 9 2", "549070627 2 6 2", "275299363 7 8 2", "232100782 7 9 2", "466253512 1 10 2", "828885826 8 10 2", "572252279 9 10 2", "888775378 3 6 2", "524357331 2 4 3", "467730377 5 8...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
2
codeforces
caa61827937e47f0ebc44c0a38d8d796
More Cowbell
Kevin Sun wants to move his precious collection of *n* cowbells from Naperthrill to Exeter, where there is actually grass instead of corn. Before moving, he must pack his cowbells into *k* boxes of a fixed size. In order to keep his collection safe during transportation, he won't place more than two cowbells into a sin...
{"inputs": ["2 1\n2 5", "4 3\n2 3 5 9", "3 2\n3 5 7", "20 11\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1", "10 10\n3 15 31 61 63 63 68 94 98 100", "100 97\n340 402 415 466 559 565 649 689 727 771 774 776 789 795 973 1088 1212 1293 1429 1514 1587 1599 1929 1997 2278 2529 2656 2677 2839 2894 2951 3079 3237 3250 3556 3568 35...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
117
codeforces
caabb5fbf0ee08c9833cf9b20aa2cdd4
Journey
There are *n* cities and *n*<=-<=1 roads in the Seven Kingdoms, each road connects two cities and we can reach any city from any other by the roads. Theon and Yara Greyjoy are on a horse in the first city, they are starting traveling through the roads. But the weather is foggy, so they can’t see where the horse brings...
{"inputs": ["4\n1 2\n1 3\n2 4", "5\n1 2\n1 3\n3 4\n2 5", "70\n1 25\n57 1\n18 1\n65 1\n38 1\n1 41\n1 5\n1 69\n1 3\n31 1\n1 8\n1 9\n53 1\n70 1\n45 1\n1 24\n1 42\n1 30\n1 12\n1 37\n64 1\n1 28\n1 58\n1 22\n11 1\n1 4\n1 27\n1 16\n1 21\n54 1\n1 51\n1 43\n29 1\n56 1\n1 39\n32 1\n1 15\n1 17\n1 19\n1 40\n36 1\n48 1\n63 1\n1 7\n...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
68
codeforces
caadddf957eac691420c3d53c94444e8
none
In the year of $30XX$ participants of some world programming championship live in a single large hotel. The hotel has $n$ floors. Each floor has $m$ sections with a single corridor connecting all of them. The sections are enumerated from $1$ to $m$ along the corridor, and all sections with equal numbers on different fl...
{"inputs": ["5 6 1 1 3\n2\n5\n3\n1 1 5 6\n1 3 5 4\n3 3 5 3", "2 2 0 1 1\n\n1\n1\n1 2 2 2", "4 4 1 0 1\n4\n\n5\n1 1 2 2\n1 3 2 2\n3 3 4 3\n3 2 2 2\n1 2 2 3", "10 10 1 8 4\n10\n2 3 4 5 6 7 8 9\n10\n1 1 3 1\n2 1 7 1\n1 1 9 1\n7 1 4 1\n10 1 7 1\n2 1 7 1\n3 1 2 1\n5 1 2 1\n10 1 5 1\n6 1 9 1", "2 5 1 0 1\n2\n\n1\n1 4 1 5", "...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
4
codeforces
cab62735c2bdf05556c35b9dc9b289cd
Robot's Task
Robot Doc is located in the hall, with *n* computers stand in a line, numbered from left to right from 1 to *n*. Each computer contains exactly one piece of information, each of which Doc wants to get eventually. The computers are equipped with a security system, so to crack the *i*-th of them, the robot needs to colle...
{"inputs": ["3\n0 2 0", "5\n4 2 3 0 1", "7\n0 3 1 0 5 2 6", "1\n0", "2\n0 1", "10\n0 0 0 0 0 0 0 0 0 0", "3\n0 2 1", "10\n7 1 9 3 5 8 6 0 2 4", "10\n1 3 5 7 9 8 6 4 2 0", "10\n5 0 0 1 3 2 2 2 5 7", "10\n8 6 5 3 9 7 1 4 2 0", "10\n1 2 4 5 0 1 3 7 1 4", "10\n3 4 8 9 5 1 2 0 6 7", "10\n2 2 0 0 6 2 9 0 2 0", "10\n1 7 5 3 2...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
128
codeforces
cab72222040910bb0a4ac88e83a6f633
Let's Go Rolling!
On a number axis directed from the left rightwards, *n* marbles with coordinates *x*1,<=*x*2,<=...,<=*x**n* are situated. Let's assume that the sizes of the marbles are infinitely small, that is in this task each of them is assumed to be a material point. You can stick pins in some of them and the cost of sticking in t...
{"inputs": ["3\n2 3\n3 4\n1 2", "4\n1 7\n3 1\n5 10\n6 1", "1\n-948943148 10", "5\n864449017 54\n864449026 504\n864449027 308\n864449028 284\n864449030 249", "10\n439333887 2\n439333930 1\n439333947 2\n439333949 3\n439333950 1\n439333952 3\n439333953 1\n439333954 2\n439333955 2\n439333956 1", "15\n-793387817 -4\n-793387...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
9
codeforces
cae5a1f13eb5f93ac2ee925307fd5622
Cheaterius's Problem
Cheaterius is a famous in all the Berland astrologist, magician and wizard, and he also is a liar and a cheater. One of his latest inventions is Cheaterius' amulets! They bring luck and wealth, but are rather expensive. Cheaterius makes them himself. The technology of their making is kept secret. But we know that throu...
{"inputs": ["4\n31\n23\n**\n31\n23\n**\n13\n32\n**\n32\n13", "4\n51\n26\n**\n54\n35\n**\n25\n61\n**\n45\n53", "4\n56\n61\n**\n31\n31\n**\n33\n11\n**\n11\n33", "4\n36\n44\n**\n32\n46\n**\n66\n41\n**\n64\n34", "3\n63\n63\n**\n66\n33\n**\n36\n36", "3\n11\n54\n**\n42\n63\n**\n42\n63", "3\n14\n54\n**\n45\n41\n**\n12\n22", "...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
38
codeforces
cb03cf99183747b6f7f40626d1e6f888
Binary String Constructing
You are given three integers $a$, $b$ and $x$. Your task is to construct a binary string $s$ of length $n = a + b$ such that there are exactly $a$ zeroes, exactly $b$ ones and exactly $x$ indices $i$ (where $1 \le i &lt; n$) such that $s_i \ne s_{i + 1}$. It is guaranteed that the answer always exists. For example, fo...
{"inputs": ["2 2 1", "3 3 3", "5 3 6", "100 1 2", "100 1 1", "1 100 1", "1 100 2", "7 8 7", "100 100 199", "50 47 18", "2 3 3", "100 100 100", "2 2 2", "3 4 6", "1 1 1", "5 6 2", "5 4 2", "2 3 4", "3 3 2", "100 99 100", "3 2 1", "12 74 22", "6 84 12", "3 2 4", "66 11 22", "83 83 83", "9 89 18", "2 1 2", "52 12 17", "55...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
68
codeforces
cb102d5bedfb81d7278cc148c8fbc106
none
You are given an infinite checkered field. You should get from a square (*x*1; *y*1) to a square (*x*2; *y*2). Using the shortest path is not necessary. You can move on the field squares in four directions. That is, when you are positioned in any square, you can move to any other side-neighboring one. A square (*x*; ...
{"inputs": ["2 2 1 0 0 1", "2 2 10 11 0 1", "2 4 3 -1 3 7", "2 2 9 10 -10 -11", "3 2 -11 -10 10 11", "3 2 11 -12 -12 11", "3 3 12 11 -12 -11", "2 3 -12 13 13 -12", "3 4 -8 5 6 -3", "2 3 2 -1 -10 -1", "4 4 3 2 10 -1", "3 2 -8 -9 -14 -1", "4 4 0 -3 11 -4", "5 3 6 3 3 12", "3 5 -4 -7 5 0", "3 5 -20 19 21 16", "5 6 23 -10 ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
10
codeforces
cb10bc64a38e5cbbb28229c038a03616
Robin Hood
We all know the impressive story of Robin Hood. Robin Hood uses his archery skills and his wits to steal the money from rich, and return it to the poor. There are *n* citizens in Kekoland, each person has *c**i* coins. Each day, Robin Hood will take exactly 1 coin from the richest person in the city and he will give i...
{"inputs": ["4 1\n1 1 4 2", "3 1\n2 2 2", "10 20\n6 4 7 10 4 5 5 3 7 10", "30 7\n3 3 2 2 2 2 3 4 4 5 2 1 1 5 5 3 4 3 2 1 3 4 3 2 2 5 2 5 1 2", "2 0\n182 2", "123 54564\n38 44 41 42 59 3 95 15 45 32 44 69 35 83 94 57 65 85 64 47 24 20 34 86 26 91 98 12 36 96 80 4 70 40 95 38 70 22 58 50 34 84 80 45 14 60 61 43 11 56 19 ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
3
codeforces
cb10e3687854c6f485432e7332948d67
New Year and Hurry
Limak is going to participate in a contest on the last day of the 2016. The contest will start at 20:00 and will last four hours, exactly until midnight. There will be *n* problems, sorted by difficulty, i.e. problem 1 is the easiest and problem *n* is the hardest. Limak knows it will take him 5·*i* minutes to solve th...
{"inputs": ["3 222", "4 190", "7 1", "10 135", "10 136", "1 1", "1 240", "10 1", "10 240", "9 240", "9 1", "9 235", "9 236", "5 225", "5 226", "4 210", "4 211", "4 191", "10 165", "10 166", "8 100", "8 101", "8 60", "8 61", "10 15", "10 16", "4 100", "4 101", "7 167", "10 164", "9 170", "8 160", "1 100", "8 123", "2 99...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
765
codeforces
cb263938720825c045f25d273e28aa47
Pythagorean Triples
Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positive integers such that you can construct a right triangle with segments of lengths corresponding to triple. Such triples are called Pythagorean triples. For example, tripl...
{"inputs": ["3", "6", "1", "17", "67", "10", "14", "22", "23", "246", "902", "1000000000", "1998", "2222222", "2222226", "1111110", "9999998", "1024", "8388608", "4", "8", "16", "492", "493824", "493804", "493800", "2048", "8388612", "44", "444", "4444", "44444", "444444", "4444444", "100000000", "2", "3", "5", "7", "9...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
35
codeforces
cb29bcdc75039540bb7686e4763a4ad0
A Twisty Movement
A dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people model a dragon with bamboo strips and clothes, raise them with rods, and hold the rods high and low to resemble a flying dragon. A performer holding the rod low is represented by a 1, while one holding it high is represented by a 2. Thus, th...
{"inputs": ["4\n1 2 1 2", "10\n1 1 2 2 2 1 1 2 2 1", "200\n2 1 1 2 1 2 2 2 2 2 1 2 2 1 1 2 2 1 1 1 2 1 1 2 2 2 2 2 1 1 2 1 2 1 1 2 1 1 1 1 2 1 2 2 1 2 1 1 1 2 1 1 1 2 2 2 1 1 1 1 2 2 2 1 2 2 2 1 2 2 2 1 2 1 2 1 2 1 1 1 1 2 2 2 1 1 2 1 2 1 2 1 2 2 1 1 1 2 2 2 2 1 2 2 2 1 1 1 1 2 1 1 1 2 2 1 2 1 2 2 2 1 2 1 2 1 2 1 2 2 2...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
33
codeforces
cb38fa4528d2503a145a641662196af3
Dancing Lessons
There are *n* people taking dancing lessons. Every person is characterized by his/her dancing skill *a**i*. At the beginning of the lesson they line up from left to right. While there is at least one couple of a boy and a girl in the line, the following process is repeated: the boy and girl who stand next to each other...
{"inputs": ["4\nBGBG\n4 2 4 3", "4\nBBGG\n4 6 1 5", "4\nBGBB\n1 1 2 3", "1\nB\n490297", "2\nBB\n2518190 6313112", "3\nBBB\n3146681 8599398 1571560", "10\nGBBBBGBBGG\n9448959 6234076 8008159 4440374 4736443 255932 6568554 4544108 54187 1105310", "10\nBGGBBGBGBG\n9892816 3514007 5425956 5241945 9171176 3351177 2772494 28...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
10
codeforces
cb8618f8fcb1feb01437682b6e177e54
Delivery Bears
Niwel is a little golden bear. As everyone knows, bears live in forests, but Niwel got tired of seeing all the trees so he decided to move to the city. In the city, Niwel took on a job managing bears to deliver goods. The city that he lives in can be represented as a directed graph with *n* nodes and *m* edges. Each e...
{"inputs": ["4 4 3\n1 2 2\n2 4 1\n1 3 1\n3 4 2", "5 11 23\n1 2 3\n2 3 4\n3 4 5\n4 5 6\n1 3 4\n2 4 5\n3 5 6\n1 4 2\n2 5 3\n1 5 2\n3 2 30", "10 16 63\n1 2 1\n2 10 1\n1 3 1\n3 10 1\n1 4 1\n4 10 1\n1 5 1\n5 10 1\n1 6 1\n6 10 1\n1 7 1\n7 10 1\n1 8 1\n8 10 1\n1 9 1\n9 10 1", "2 1 3\n1 2 301", "2 2 1\n1 2 48\n2 1 39", "5 9 5\...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
2
codeforces
cb9186b9a4e23f221c547dc20fa1cbd3
Heap Operations
Petya has recently learned data structure named "Binary heap". The heap he is now operating with allows the following operations: - put the given number into the heap; - get the value of the minimum element in the heap; - extract the minimum element from the heap; Thus, at any moment of time the heap contains se...
{"inputs": ["2\ninsert 3\ngetMin 4", "4\ninsert 1\ninsert 1\nremoveMin\ngetMin 2", "1\ninsert 1", "1\ngetMin 31", "1\nremoveMin", "2\ninsert 2\ngetMin 2", "2\ninsert 31\nremoveMin", "2\ngetMin 31\nremoveMin", "2\nremoveMin\ngetMin 31", "8\ninsert 219147240\nremoveMin\ngetMin 923854124\nremoveMin\ngetMin -876779400\nrem...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
12
codeforces
cbb676850d743a009c1cd41772a6d438
Masha and Bears
A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bear can climb into the smallest car and he likes it. It's known that the largest car is strictly larg...
{"inputs": ["50 30 10 10", "100 50 10 21", "100 50 19 10", "99 50 25 49", "3 2 1 1", "100 99 98 100", "100 40 30 40", "100 50 19 25", "100 50 19 30", "49 48 25 49", "48 47 23 46", "37 23 16 20", "98 2 1 1", "99 22 13 14", "97 95 3 2", "27 3 2 3", "13 7 6 2", "19 17 11 6", "15 6 4 5", "21 3 1 3", "100 99 98 97", "99 32 ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
92
codeforces
cbc0daf7ec2b8a32eed497f9d63ecf29
Stepan's Series
Well, the series which Stepan watched for a very long time, ended. In total, the series had *n* episodes. For each of them, Stepan remembers either that he definitely has watched it, or that he definitely hasn't watched it, or he is unsure, has he watched this episode or not. Stepan's dissatisfaction is the maximum n...
{"inputs": ["5 2\nNYNNY", "6 1\n????NN", "100 8\nNYNNY?YNNNNNN?NNNNNYNY?YYNYNN?NNNY??NNYNYNNNYNNNYNNNNNNNNY?NNNYNYN?NNNY?YY?NNYNN?NNNYNNYNNYN?NNYNYNN", "10 1\nNY???NY?Y?", "20 7\nN?N??NNN?NNN?Y???Y??", "30 1\nNYYYNYYY?Y?YY?YYYYYYYYYYYYYNYY", "40 14\nNNNNNNNNNNNNNNNNNYNNNNYNNYNNNNNNYNNNNNNN", "51 1\nYYYNYNYNNYYNNY?YNYYY...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
7
codeforces
cbc8bc5adddd9ff53f82afb50a6c38e8
Heidi and Library (easy)
Your search for Heidi is over – you finally found her at a library, dressed up as a human. In fact, she has spent so much time there that she now runs the place! Her job is to buy books and keep them at the library so that people can borrow and read them. There are *n* different books, numbered 1 through *n*. We will ...
{"inputs": ["4 80\n1 2 2 1", "4 1\n1 2 2 1", "4 2\n1 2 3 1", "11 1\n1 2 3 5 1 10 10 1 1 3 5", "5 2\n1 2 3 1 2", "4 2\n1 2 3 2", "1 1\n1", "80 4\n9 9 2 6 3 10 2 5 4 9 6 7 5 5 3 8 5 3 2 10 7 8 5 3 4 9 4 3 9 5 2 10 8 4 7 3 8 3 5 2 3 7 8 4 2 4 4 7 2 2 5 7 5 8 10 10 5 1 1 3 5 2 10 8 7 9 7 4 8 3 2 8 7 9 10 9 7 1 5 5", "80 4\...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
2
codeforces
cbd3bd36a78afd98ce39b978953fe69c
Posterized
Professor Ibrahim has prepared the final homework for his algorithm’s class. He asked his students to implement the Posterization Image Filter. Their algorithm will be tested on an array of integers, where the $i$-th integer represents the color of the $i$-th pixel in the image. The image is in black and white, theref...
{"inputs": ["4 3\n2 14 3 4", "5 2\n0 2 1 255 254", "10 3\n112 184 161 156 118 231 191 128 91 229", "9 3\n174 149 118 124 166 146 219 233 107", "8 4\n180 195 13 195 61 24 132 160", "1 4\n51", "2 4\n218 213", "3 3\n212 167 3", "100 7\n39 242 238 155 95 30 129 132 72 59 22 61 133 113 99 81 253 204 160 109 92 187 11 227 14...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
22
codeforces
cbd781d42f2b14ec31bd058e858ae936
Help Shrek and Donkey 2
Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring card games and play with toy soldiers. The rules of the game are as f...
{"inputs": ["2 3 1\nR-G\nRG-", "3 3 2\nG-R\nR-G\nG-R", "2 3 1\n-R-\n-G-", "2 5 2\n-G-R-\n-R-G-", "3 3 1\nG-R\nR-G\nG-R", "2 5 1\n-G-R-\n-R-G-", "2 2 1\nGG\n-R", "2 2 2\nR-\nGG", "3 2 1\nRR\n--\nG-", "3 2 2\n--\n-G\nRR", "2 2 2\nRR\nGG", "2 1 1\nG\nR", "1 1 1\n-", "3 5 2\n-R--G\nG---R\n-R-G-", "3 5 1\n-R--G\nG---R\n-R-G...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
1
codeforces
cbe46e8904a05d3d4188f09dd4ace78c
Fox and Card Game
Fox Ciel is playing a card game with her friend Fox Jiro. There are *n* piles of cards on the table. And there is a positive integer on each card. The players take turns and Ciel takes the first turn. In Ciel's turn she takes a card from the top of any non-empty pile, and in Jiro's turn he takes a card from the bottom...
{"inputs": ["2\n1 100\n2 1 10", "1\n9 2 8 6 5 9 4 7 1 3", "3\n3 1 3 2\n3 5 4 6\n2 8 7", "3\n3 1000 1000 1000\n6 1000 1000 1000 1000 1000 1000\n5 1000 1000 1000 1000 1000", "1\n1 1", "5\n1 3\n1 2\n1 8\n1 1\n1 4", "3\n5 1 2 3 4 5\n4 1 2 3 4\n8 1 2 3 4 5 6 7 8", "5\n5 1 1 1 1 1\n4 1 1 1 1\n3 1 1 1\n2 1 1\n1 1", "6\n2 1 1\...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
19
codeforces
cbee248948dd04736c1c417697f70d86
Young Table
You've got table *a*, consisting of *n* rows, numbered from 1 to *n*. The *i*-th line of table *a* contains *c**i* cells, at that for all *i* (1<=&lt;<=*i*<=≤<=*n*) holds *c**i*<=≤<=*c**i*<=-<=1. Let's denote *s* as the total number of cells of table *a*, that is, . We know that each cell of the table contains a sing...
{"inputs": ["3\n3 2 1\n4 3 5\n6 1\n2", "1\n4\n4 3 2 1", "5\n4 4 3 3 1\n14 13 4 15\n11 1 2 5\n7 6 10\n8 9 3\n12", "2\n8 6\n1 2 3 13 10 4 11 7\n9 12 8 5 14 6", "6\n10 9 7 6 4 3\n18 20 29 19 5 28 31 30 32 15\n38 33 11 8 39 2 6 9 3\n13 37 27 24 26 1 17\n36 10 35 21 7 16\n22 23 4 12\n34 25 14", "8\n2 2 2 2 1 1 1 1\n10 9\n11...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
4
codeforces
cbefa8ce4237f3212920f6d2b168800e
Shortest path of the king
The king is left alone on the chessboard. In spite of this loneliness, he doesn't lose heart, because he has business of national importance. For example, he has to pay an official visit to square *t*. As the king is not in habit of wasting his time, he wants to get from his current position *s* to square *t* in the le...
{"inputs": ["a8\nh1", "b2\nb4", "a5\na5", "h1\nb2", "c5\nh2", "e1\nf2", "g4\nd2", "a8\nb2", "d4\nh2", "c5\na2", "h5\nf8", "e6\nb6", "a6\ng4", "f7\nc2", "b7\nh8", "g7\nd6", "c8\na3", "h8\nf1", "d1\nb7", "a7\ne5", "d6\nb1", "f5\ng5", "h4\nd1", "b3\na5", "d2\nf1", "f1\nc5", "a8\nh1", "c7\ne5", "e7\nb1", "g8\na8", "g6\nf2"...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
273
codeforces
cbf2401bef0f45c21901b34f0c5649fa
Kalila and Dimna in the Logging Industry
Kalila and Dimna are two jackals living in a huge jungle. One day they decided to join a logging factory in order to make money. The manager of logging factory wants them to go to the jungle and cut *n* trees with heights *a*1,<=*a*2,<=...,<=*a**n*. They bought a chain saw from a shop. Each time they use the chain sa...
{"inputs": ["5\n1 2 3 4 5\n5 4 3 2 0", "6\n1 2 3 10 20 30\n6 5 4 3 2 0"], "outputs": ["25", "138"]}
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
16
codeforces
cbf4ad8bd05b36fab2101dcda7d9b6c9
Iahub and Permutations
Iahub is so happy about inventing bubble sort graphs that he's staying all day long at the office and writing permutations. Iahubina is angry that she is no more important for Iahub. When Iahub goes away, Iahubina comes to his office and sabotage his research work. The girl finds an important permutation for the resea...
{"inputs": ["5\n-1 -1 4 3 -1", "8\n2 4 5 3 -1 8 -1 6", "7\n-1 -1 4 -1 7 1 6", "6\n-1 -1 -1 -1 -1 -1", "2\n-1 -1", "10\n4 10 -1 1 6 8 9 2 -1 -1", "20\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1"], "outputs": ["2", "1", "4", "265", "1", "4", "927799753"]}
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
6
codeforces
cc22c937dd57137fe8ae380fccc12c66
Dynasty Puzzles
The ancient Berlanders believed that the longer the name, the more important its bearer is. Thus, Berland kings were famous for their long names. But long names are somewhat inconvenient, so the Berlanders started to abbreviate the names of their kings. They called every king by the first letters of its name. Thus, the...
{"inputs": ["3\nabc\nca\ncba", "4\nvvp\nvvp\ndam\nvvp", "3\nab\nc\ndef", "5\nab\nbc\ncd\nde\nffffffffff", "5\ncab\nbbc\ncaa\nccc\naca", "10\nabdcced\nbdacdac\necb\ndc\neaeeebdd\nadcdbadcac\neb\naadecccde\nedbaeacad\naccd", "50\nagecd\ncghafi\nfiide\niecc\njbdcfjhgd\ndiee\nhfeg\nehc\ngfijgjh\ngacaifebg\ndicbbddc\nhjgcia...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
10
codeforces
cc2ed94d2164907de60a5c20c496a2e5
Car Repair Shop
Polycarp starts his own business. Tomorrow will be the first working day of his car repair shop. For now the car repair shop is very small and only one car can be repaired at a given time. Polycarp is good at marketing, so he has already collected *n* requests from clients. The requests are numbered from 1 to *n* in o...
{"inputs": ["3\n9 2\n7 3\n2 4", "4\n1000000000 1000000\n1000000000 1000000\n100000000 1000000\n1000000000 1000000", "1\n1 1", "1\n1000000000 1", "1\n1000000000 5000000", "5\n6 2\n10 1\n10 2\n9 2\n5 1", "10\n1 3\n77 8\n46 5\n83 4\n61 7\n8 4\n54 7\n80 7\n33 7\n13 4", "10\n588 12\n560 10\n593 14\n438 15\n761 11\n984 6\n50...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
4
codeforces
cc32fd5210a68b5474019c046d82478b
PolandBall and Forest
PolandBall lives in a forest with his family. There are some trees in the forest. Trees are undirected acyclic graphs with *k* vertices and *k*<=-<=1 edges, where *k* is some integer. Note that one vertex is a valid tree. There is exactly one relative living in each vertex of each tree, they have unique ids from 1 to ...
{"inputs": ["5 3\n1 2\n3 4\n4 5", "1 0", "5 1\n4 5", "10 3\n2 8\n5 9\n6 10", "18 2\n9 17\n1 18", "1 0", "2 1\n1 2", "2 0", "3 1\n2 3", "3 2\n1 2\n2 3", "3 0", "10000 1\n1725 10000", "5 4\n1 3\n1 4\n4 2\n5 2", "4 3\n3 1\n1 2\n2 4", "5 4\n3 2\n2 5\n5 1\n1 4", "5 4\n1 2\n1 3\n1 4\n3 5", "6 5\n1 4\n2 3\n3 4\n4 5\n5 6"], "o...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
77
codeforces
cc3d4bf0993f096240a30911a45cbe0e
Swaps in Permutation
You are given a permutation of the numbers 1,<=2,<=...,<=*n* and *m* pairs of positions (*a**j*,<=*b**j*). At each step you can choose a pair from the given positions and swap the numbers in that positions. What is the lexicographically maximal permutation one can get? Let *p* and *q* be two permutations of the numbe...
{"inputs": ["9 6\n1 2 3 4 5 6 7 8 9\n1 4\n4 7\n2 5\n5 8\n3 6\n6 9", "1 1\n1\n1 1", "2 10\n2 1\n2 1\n1 2\n1 1\n2 1\n1 1\n2 1\n1 1\n1 1\n2 1\n2 1", "3 10\n1 2 3\n2 2\n1 1\n2 2\n3 3\n1 1\n3 3\n3 3\n3 3\n2 2\n1 1", "4 20\n4 2 3 1\n2 2\n1 4\n2 2\n1 1\n3 3\n3 3\n1 4\n3 3\n2 2\n3 3\n4 1\n2 2\n1 4\n3 3\n4 1\n1 1\n3 3\n2 2\n2 2...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
5
codeforces
cc5c1d4e139eb29e530d93e1760c9634
The Race
Every year a race takes place on the motorway between cities A and B. This year Vanya decided to take part in the race and drive his own car that has been around and bears its own noble name — The Huff-puffer. So, Vasya leaves city A on the Huff-puffer, besides, at the very beginning he fills the petrol tank with α li...
{"inputs": ["3\n1 2 4", "2\n1 2", "1\n5", "3\n1 3 4", "5\n1 2 3 5 6", "6\n1 2 3 5 6 7", "10\n1 2 4 5 7 8 9 11 12 14", "10\n1 3 5 6 8 10 12 13 15 17", "9\n2 5 7 10 12 15 17 20 22", "10\n7 14 21 28 35 42 49 56 63 70", "15\n5 11 16 22 28 33 39 45 50 56 62 67 73 79 84", "17\n5 11 16 22 28 33 39 45 50 56 62 67 73 79 84 90 9...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
8
codeforces
cc5c29e25f4a62e672d02de221aa504b
Divisiblity of Differences
You are given a multiset of *n* integers. You should select exactly *k* of them in a such way that the difference between any two of them is divisible by *m*, or tell that it is impossible. Numbers can be repeated in the original multiset and in the multiset of selected numbers, but number of occurrences of any number...
{"inputs": ["3 2 3\n1 8 4", "3 3 3\n1 8 4", "4 3 5\n2 7 7 7", "9 9 5\n389149775 833127990 969340400 364457730 48649145 316121525 640054660 924273385 973207825", "15 8 10\n216175135 15241965 611723934 987180005 151601897 403701727 533996295 207637446 875331635 46172555 604086315 350146655 401084142 156540458 982110455",...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
129
codeforces
cc71101bf1a32ac7a83f342726de0a60
Lucky Year
Apart from having lots of holidays throughout the year, residents of Berland also have whole lucky years. Year is considered lucky if it has no more than 1 non-zero digit in its number. So years 100, 40000, 5 are lucky and 12, 3001 and 12345 are not. You are given current year in Berland. Your task is to find how long...
{"inputs": ["4", "201", "4000", "9", "10", "1", "100000000", "900000000", "999999999", "1000000000", "9999999", "100000001", "3660", "21", "900000001", "62911", "11", "940302010", "91", "101", "1090", "987654321", "703450474", "1091", "89", "109", "190", "19", "8", "482", "1", "2", "3", "4", "5", "6", "7", "8", "9", "1...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
282
codeforces
cc711c4080333b9f14e986ed9ffc24fa
Heroes
The year of 2012 is coming... According to an ancient choradrican legend in this very year, in 2012, Diablo and his brothers Mephisto and Baal will escape from hell, and innumerable hordes of demons will enslave the human world. But seven brave heroes have already gathered on the top of a mountain Arreat to protect us...
{"inputs": ["3\nTroll likes Dracul\nDracul likes Anka\nSnowy likes Hexadecimal\n210 200 180", "2\nAnka likes Chapay\nChapay likes Anka\n10000 50 50", "11\nSnowy likes Dracul\nAnka likes Dracul\nChapay likes Snowy\nHexadecimal likes Troll\nAnka likes Cleo\nChapay likes Dracul\nAnka likes Chapay\nSnowy likes Troll\nAnka ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
12
codeforces
cc9a6194b46b75af2a7ecae3f3b268ef
Tournament
The tournament «Sleepyhead-2010» in the rapid falling asleep has just finished in Berland. *n* best participants from the country have participated in it. The tournament consists of games, each of them is a match between two participants. *n*·(*n*<=-<=1)<=/<=2 games were played during the tournament, and each participa...
{"inputs": ["3\n3 2\n1 2", "4\n2 4\n3 4\n1 2\n1 4\n1 3", "5\n3 5\n2 5\n1 5\n1 4\n4 3\n1 3\n2 3\n4 5\n4 2", "6\n3 4\n3 5\n5 4\n1 2\n5 6\n2 6\n5 2\n3 6\n3 2\n4 6\n2 4\n1 3\n1 5\n1 4", "7\n2 4\n6 1\n6 5\n3 4\n6 3\n2 6\n6 4\n3 7\n7 1\n1 4\n7 4\n7 5\n2 7\n2 3\n5 4\n3 5\n3 1\n5 1\n6 7\n2 1", "8\n4 3\n6 8\n1 5\n8 3\n1 4\n1 7\...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
63
codeforces
cc9dd4e6b5f4255387e96f4f9d873077
Alphabetic Removals
You are given a string $s$ consisting of $n$ lowercase Latin letters. Polycarp wants to remove exactly $k$ characters ($k \le n$) from the string $s$. Polycarp uses the following algorithm $k$ times: - if there is at least one letter 'a', remove the leftmost occurrence and stop the algorithm, otherwise go to next ite...
{"inputs": ["15 3\ncccaabababaccbc", "15 9\ncccaabababaccbc", "5 2\nzyzyx", "4 3\nhack", "4 3\nzzzz", "6 5\naaccdd", "2 1\nzz", "14 5\nhxehmvkybeklnj"], "outputs": ["cccbbabaccbc", "cccccc", "zzy", "k", "z", "d", "z", "xmvkyklnj"]}
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
98
codeforces
cca086aaaaa8acaf7ee3d71ae7350ac6
none
Disclaimer: there are lots of untranslateable puns in the Russian version of the statement, so there is one more reason for you to learn Russian :) Rick and Morty like to go to the ridge High Cry for crying loudly — there is an extraordinary echo. Recently they discovered an interesting acoustic characteristic of this...
{"inputs": ["5\n3 2 1 6 5", "4\n3 3 3 3", "1\n0", "1\n1", "1\n1000000000", "1\n6", "228\n1 3 1 7 1 3 1 15 1 3 1 7 1 3 1 31 1 3 1 7 1 3 1 15 1 3 1 7 1 3 1 63 1 3 1 7 1 3 1 15 1 3 1 7 1 3 1 31 1 3 1 7 1 3 1 15 1 3 1 7 1 3 1 127 1 3 1 7 1 3 1 15 1 3 1 7 1 3 1 31 1 3 1 7 1 3 1 15 1 3 1 7 1 3 1 63 1 3 1 7 1 3 1 15 1 3 1 7 1...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
4
codeforces
ccab9113e4676fc4e63aefdba473c54e
Non-Secret Cypher
Berland starts to seize the initiative on the war with Flatland. To drive the enemy from their native land, the berlanders need to know exactly how many more flatland soldiers are left in the enemy's reserve. Fortunately, the scouts captured an enemy in the morning, who had a secret encrypted message with the informati...
{"inputs": ["4 2\n1 2 1 2", "5 3\n1 2 1 1 3", "3 1\n1 1 1", "20 2\n6 7 2 4 6 8 4 3 10 5 3 5 7 9 1 2 8 1 9 10", "63 2\n1 2 1 2 4 5 1 1 1 1 1 2 3 1 2 3 3 1 1 3 1 1 1 1 2 1 1 6 3 2 1 1 1 1 2 2 3 2 1 1 1 2 1 4 2 1 2 3 2 1 1 1 1 2 4 3 4 2 5 1 1 2 1", "63 5\n76826 79919 83599 93821 79919 46132 46132 46132 79919 76826 79919 7...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
43
codeforces
ccb33a039bf5e61811f4bf46ba0c1b6c
Powers of Two
You are given *n* integers *a*1,<=*a*2,<=...,<=*a**n*. Find the number of pairs of indexes *i*,<=*j* (*i*<=&lt;<=*j*) that *a**i*<=+<=*a**j* is a power of 2 (i. e. some integer *x* exists so that *a**i*<=+<=*a**j*<==<=2*x*). The first line contains the single positive integer *n* (1<=≤<=*n*<=≤<=105) — the number of int...
{"inputs": ["4\n7 3 2 1", "3\n1 1 1", "1\n1000000000", "10\n2827343 1373647 96204862 723505 796619138 71550121 799843967 5561265 402690754 446173607", "10\n6 6 7 3 9 14 15 7 2 2", "100\n3 6 12 1 16 4 9 5 4 4 5 8 12 4 6 14 5 1 2 2 2 1 7 1 9 10 6 13 7 8 3 11 8 11 7 5 15 6 14 10 4 2 10 9 1 8 14 9 5 11 3 4 1 12 6 8 13 4 8 ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
26
codeforces
cceb3418316a02ad44067bef5d4dfbc8
Olympiad
The recent All-Berland Olympiad in Informatics featured *n* participants with each scoring a certain amount of points. As the head of the programming committee, you are to determine the set of participants to be awarded with diplomas with respect to the following criteria: - At least one participant should get a di...
{"inputs": ["4\n1 3 3 2", "3\n1 1 1", "4\n42 0 0 42", "10\n1 0 1 0 1 0 0 0 0 1", "10\n572 471 540 163 50 30 561 510 43 200", "100\n122 575 426 445 172 81 247 429 97 202 175 325 382 384 417 356 132 502 328 537 57 339 518 211 479 306 140 168 268 16 140 263 593 249 391 310 555 468 231 180 157 18 334 328 276 155 21 280 322...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
763
codeforces
ccf90e94056e7f71bca90c97428d0854
DZY Loves Chessboard
DZY loves chessboard, and he enjoys playing with it. He has a chessboard of *n* rows and *m* columns. Some cells of the chessboard are bad, others are good. For every good cell, DZY wants to put a chessman on it. Each chessman is either white or black. After putting all chessmen, DZY wants that no two chessmen with th...
{"inputs": ["1 1\n.", "2 2\n..\n..", "3 3\n.-.\n---\n--.", "3 1\n-\n.\n.", "11 11\n-----------\n-----------\n-----------\n-----------\n-----------\n-----------\n-----------\n-----------\n-----------\n-----------\n-----------", "1 1\n-", "4 2\n..\n..\n..\n..", "5 1\n.\n.\n.\n.\n."], "outputs": ["B", "BW\nWB", "B-B\n---\...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
323
codeforces
ccfde368ce481926b7fe8da6a5a19d86
Maxim and Matrix
Maxim loves to fill in a matrix in a special manner. Here is a pseudocode of filling in a matrix of size (*m*<=+<=1)<=×<=(*m*<=+<=1): Maxim asks you to count, how many numbers *m* (1<=≤<=*m*<=≤<=*n*) are there, such that the sum of values in the cells in the row number *m*<=+<=1 of the resulting matrix equals *t*. ...
{"inputs": ["1 1", "3 2", "3 3", "1000000000000 1048576", "35 4", "70 32", "79 32", "63 16", "6 4", "82 16", "4890852 16", "473038165 2", "326051437 4", "170427799 16", "168544291 8", "82426873 1", "175456797 16384", "257655784 16384", "9581849 1024", "8670529 16384", "621597009 268435456", "163985731 33554432", "75864...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
2
codeforces
cd1341a74edf0fecdcc915ce6739938a
Well-known Numbers
Numbers *k*-bonacci (*k* is integer, *k*<=&gt;<=1) are a generalization of Fibonacci numbers and are determined as follows: - *F*(*k*,<=*n*)<==<=0, for integer *n*, 1<=≤<=*n*<=&lt;<=*k*; - *F*(*k*,<=*k*)<==<=1; - *F*(*k*,<=*n*)<==<=*F*(*k*,<=*n*<=-<=1)<=+<=*F*(*k*,<=*n*<=-<=2)<=+<=...<=+<=*F*(*k*,<=*n*<=-<=*k*), fo...
{"inputs": ["5 2", "21 5", "1 1000", "1000000000 1000000000", "122 7", "4 3", "321123 3211232", "1 2", "2 2", "3 2", "8 2", "17 2", "137 2", "7298 2", "76754 2", "12345678 2", "987654321 2", "1000000000 2", "701408733 2", "1 3", "2 3", "3 3", "100 3", "87783 3", "615693473 3", "615693474 3", "1000000000 3", "1 4", "2 4...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
19
codeforces
cd3089bf322bec62b4b20e5acd4e4a51
Little Robber Girl's Zoo
Little Robber Girl likes to scare animals in her zoo for fun. She decided to arrange the animals in a row in the order of non-decreasing height. However, the animals were so scared that they couldn't stay in the right places. The robber girl was angry at first, but then she decided to arrange the animals herself. She ...
{"inputs": ["4\n2 1 4 3", "7\n36 28 57 39 66 69 68", "5\n1 2 1 2 1", "78\n7 3 8 8 9 8 10 9 12 11 16 14 17 17 18 18 20 20 25 22 27 26 29 27 35 35 36 36 37 37 38 38 40 39 42 42 48 46 49 49 58 50 60 58 65 61 68 66 69 69 69 69 70 69 71 71 77 73 78 77 80 79 85 83 86 86 86 86 88 87 91 90 96 91 98 97 99 98", "99\n5 5 5 5 5 5 ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
26
codeforces
cd3bf5d29eadbcf458616c8f199d7895
Borya and Hanabi
Have you ever played Hanabi? If not, then you've got to try it out! This problem deals with a simplified version of the game. Overall, the game has 25 types of cards (5 distinct colors and 5 distinct values). Borya is holding *n* cards. The game is somewhat complicated by the fact that everybody sees Borya's cards exc...
{"inputs": ["2\nG3 G3", "4\nG4 R4 R3 B3", "5\nB1 Y1 W1 G1 R1", "10\nY4 B1 R3 G5 R5 W3 W5 W2 R1 Y1", "3\nG4 G3 B4", "2\nW3 Y5", "2\nW5 Y5", "100\nW4 Y1 W5 R4 W3 Y1 R4 W2 G3 G1 B5 Y5 Y2 Y3 G4 B5 W1 G5 Y5 Y3 G2 Y5 Y5 G5 R2 B3 B1 W5 Y1 W5 B4 W4 R4 B1 R1 W3 R5 R4 G2 W3 W3 R2 W5 Y2 B2 R3 R3 Y1 G5 G2 Y1 R4 Y5 W5 G5 B3 W2 R1 B...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
13
codeforces
cd70c7ee2dfbd1f686f64c9d0ed3c074
Quarrel
Friends Alex and Bob live in Bertown. In this town there are *n* crossroads, some of them are connected by bidirectional roads of equal length. Bob lives in a house at the crossroads number 1, Alex — in a house at the crossroads number *n*. One day Alex and Bob had a big quarrel, and they refused to see each other. It...
{"inputs": ["2 1\n1 2", "7 5\n1 2\n2 7\n7 6\n2 3\n3 4", "7 6\n1 2\n2 7\n7 6\n2 3\n3 4\n1 5", "6 10\n3 6\n3 5\n1 3\n2 6\n5 4\n6 4\n6 5\n5 1\n2 3\n1 2", "5 7\n5 2\n1 3\n4 2\n3 4\n5 3\n2 3\n4 1", "10 7\n3 4\n8 6\n4 8\n3 1\n9 10\n10 6\n9 4", "10 16\n9 8\n1 2\n9 5\n5 4\n9 2\n3 2\n1 6\n5 10\n7 2\n8 2\n3 7\n4 9\n5 7\n10 3\n10...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
1
codeforces
cd8569e989f67f116902d5f72934bb5a
Remainders Game
Today Pari and Arya are playing a game called Remainders. Pari chooses two positive integer *x* and *k*, and tells Arya *k* but not *x*. Arya have to find the value . There are *n* ancient numbers *c*1,<=*c*2,<=...,<=*c**n* and Pari has to tell Arya if Arya wants. Given *k* and the ancient values, tell us if Arya has...
{"inputs": ["4 5\n2 3 5 12", "2 7\n2 3", "1 6\n8", "2 3\n9 4", "4 16\n19 16 13 9", "5 10\n5 16 19 9 17", "11 95\n31 49 8 139 169 121 71 17 43 29 125", "17 71\n173 43 139 73 169 199 49 81 11 89 131 107 23 29 125 152 17", "13 86\n41 64 17 31 13 97 19 25 81 47 61 37 71", "15 91\n49 121 83 67 128 125 27 113 41 169 149 19 3...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
26
codeforces
cdab43ee10fbd94cbd611a337801b847
Mahmoud and Ehab and the MEX
Dr. Evil kidnapped Mahmoud and Ehab in the evil land because of their performance in the Evil Olympiad in Informatics (EOI). He decided to give them some problems to let them go. Dr. Evil is interested in sets, He has a set of *n* integers. Dr. Evil calls a set of integers evil if the MEX of it is exactly *x*. the MEX...
{"inputs": ["5 3\n0 4 5 6 7", "1 0\n0", "5 0\n1 2 3 4 5", "10 5\n57 1 47 9 93 37 76 70 78 15", "10 5\n99 98 93 97 95 100 92 94 91 96", "10 5\n1 2 3 4 59 45 0 58 51 91", "100 100\n79 13 21 11 3 87 28 40 29 4 96 34 8 78 61 46 33 45 99 30 92 67 22 97 39 86 73 31 74 44 62 55 57 2 54 63 80 69 25 48 77 98 17 93 15 16 89 12 4...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
160
codeforces
cdd53a40de34107ec869a299815ab410
Embassy Queue
In an embassy of a well-known kingdom an electronic queue is organised. Every person who comes to the embassy, needs to make the following three actions: show the ID, pay money to the cashier and be fingerprinted. Besides, the actions should be performed in the given order. For each action several separate windows are...
{"inputs": ["1 1 1\n1 1 1\n5\n1 1 1 1 1", "2 1 1\n5 1 1\n5\n1 2 3 3 5", "1 1 1\n1 1 1\n5\n1 2 3 4 5", "1 1 1\n1 1 1\n5\n1 2 3 3 4", "9 5 6\n8 2 2\n1\n5", "2 7 3\n8 10 5\n5\n5 6 7 8 9", "3 9 10\n3 10 4\n5\n2 2 2 2 2", "2 7 1\n10 3 10\n100\n3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 3...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
3
codeforces
ce078bca9cb34927fa29762b3a352266
Fraction
Petya is a big fan of mathematics, especially its part related to fractions. Recently he learned that a fraction is called proper iff its numerator is smaller than its denominator (*a*<=&lt;<=*b*) and that the fraction is called irreducible if its numerator and its denominator are coprime (they do not have positive co...
{"inputs": ["3", "4", "12", "34", "13", "11", "24", "17", "10", "69", "100", "57", "1000", "999", "998", "997", "996", "995", "994", "5", "6", "8", "9", "423", "876", "29"], "outputs": ["1 2", "1 3", "5 7", "15 19", "6 7", "5 6", "11 13", "8 9", "3 7", "34 35", "49 51", "28 29", "499 501", "499 500", "497 501", "498 49...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
325
codeforces
ce18d7053c8a3377aad3bca251aa0bc6
Event Dates
On a history lesson the teacher asked Vasya to name the dates when *n* famous events took place. He doesn't remembers the exact dates but he remembers a segment of days [*l**i*,<=*r**i*] (inclusive) on which the event could have taken place. However Vasya also remembers that there was at most one event in one day. Help...
{"inputs": ["3\n1 2\n2 3\n3 4", "2\n1 3\n1 3", "10\n1 10\n3 4\n8 10\n3 4\n5 9\n1 4\n7 10\n1 9\n1 8\n4 10", "10\n1 1\n8 10\n1 7\n6 8\n5 7\n1 9\n8 8\n6 10\n1 4\n3 4", "10\n1 2\n1 3\n1 9\n10 10\n4 4\n5 9\n2 5\n7 8\n2 10\n7 10", "10\n4 12\n2 8\n1 12\n6 8\n4 6\n12 12\n3 10\n1 10\n3 3\n1 10", "10\n6 7\n5 11\n5 10\n9 10\n11 1...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
13
codeforces
ce33750da56e1793b724225fd29caf3f
Diversity
Calculate the minimum number of characters you need to change in the string *s*, so that it contains at least *k* different letters, or print that it is impossible. String *s* consists only of lowercase Latin letters, and it is allowed to change characters only to lowercase Latin letters too. First line of input conta...
{"inputs": ["yandex\n6", "yahoo\n5", "google\n7", "a\n1", "z\n2", "fwgfrwgkuwghfiruhewgirueguhergiqrbvgrgf\n26", "nfevghreuoghrueighoqghbnebvnejbvnbgneluqe\n26", "a\n3", "smaxpqplaqqbxuqxalqmbmmgubbpspxhawbxsuqhhegpmmpebqmqpbbeplwaepxmsahuepuhuhwxeqmmlgqubuaxehwuwasgxpqmugbmuawuhwqlswllssueglbxepbmwgs\n1", "cuguccgcugc...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
236
codeforces
ce3c021d36b6ba21396a789329d9a43d
Prime Matrix
You've got an *n*<=×<=*m* matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times. You are really curious about prime numbers. Let us remind you ...
{"inputs": ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2", "1 1\n14", "5 3\n2 14 8\n8 8 2\n8 10 10\n1 2 1\n100 100 8", "6 5\n8 8 8 8 20\n13 8 16 13 9\n11 5 3 14 18\n13 8 6 18 6\n6 8 9 14 7\n2 14 14 9 3", "5 7\n9 5 3 9 2 8 2\n15 7 9 8 18 4 6\n2 9 14 3 6 13 18\n4 13 3 14 11 13 8\n14 10 1 14 18 5 6", "3...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
7
codeforces
ce51e9e2bf9e9d028f33636c885eb53c
Black Square
Quite recently, a very smart student named Jury decided that lectures are boring, so he downloaded a game called "Black Square" on his super cool touchscreen phone. In this game, the phone's screen is divided into four vertical strips. Each second, a black square appears on some of the strips. According to the rules o...
{"inputs": ["1 2 3 4\n123214", "1 5 3 2\n11221", "5 5 5 1\n3422", "4 3 2 1\n2", "5651 6882 6954 4733\n2442313421", "0 0 0 0\n4132", "3163 5778 83 7640\n11141442444", "1809 1302 7164 6122\n3144121413113111223311232232114144321414421243443243422322144324121433444342231344234443332241322442", "0 0 0 0\n1", "1 2 3 4\n4", "...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
1,034
codeforces
ceae7eedfe1a4cc59e25f381a4377cac
Famil Door and Roads
Famil Door’s City map looks like a tree (undirected connected acyclic graph) so other people call it Treeland. There are *n* intersections in the city connected by *n*<=-<=1 bidirectional roads. There are *m* friends of Famil Door living in the city. The *i*-th friend lives at the intersection *u**i* and works at the ...
{"inputs": ["4 3\n2 4\n4 1\n3 2\n3 1\n2 3\n4 1", "3 3\n1 2\n1 3\n1 2\n1 3\n2 3", "10 5\n8 10\n3 6\n7 3\n7 4\n8 9\n9 4\n5 1\n10 5\n6 2\n9 1\n7 6\n5 1\n6 9\n10 2"], "outputs": ["4.00000000\n3.00000000\n3.00000000", "2.50000000\n2.50000000\n3.00000000", "7.50000000\n6.50000000\n6.00000000\n7.50000000\n9.00000000"]}
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
1
codeforces
cecc17339e00c6d82bab06b3a807d63d
Delete Them
Polycarp is a beginner programmer. He is studying how to use a command line. Polycarp faced the following problem. There are *n* files in a directory and he needs to delete some of them. Polycarp wants to run a single delete command with filename pattern as an argument. All the files to be deleted should match the pat...
{"inputs": ["3 2\nab\nac\ncd\n1 2", "5 3\ntest\ntezt\ntest.\n.est\ntes.\n1 4 5", "4 4\na\nb\nc\ndd\n1 2 3 4", "6 3\n.svn\n.git\n....\n...\n..\n.\n1 2 3", "4 2\n.b\n.c\ndbt\ne.\n2 4", "27 27\na\nb\nc\nd\ne\nf\ng\nh\ni\nj\nk\nl\nm\nn\no\np\nq\nr\ns\nt\nu\nv\nw\nx\ny\nz\n.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
20
codeforces
cedb194ead074bf927d95693dde3edb3
none
Edo has got a collection of *n* refrigerator magnets! He decided to buy a refrigerator and hang the magnets on the door. The shop can make the refrigerator with any size of the door that meets the following restrictions: the refrigerator door must be rectangle, and both the length and the width of the door must be pos...
{"inputs": ["3 1\n1 1 2 2\n2 2 3 3\n3 3 4 4", "4 1\n1 1 2 2\n1 9 2 10\n9 9 10 10\n9 1 10 2", "3 0\n1 1 2 2\n1 1 1000000000 1000000000\n1 3 8 12", "11 8\n9 1 11 5\n2 2 8 12\n3 8 23 10\n2 1 10 5\n7 1 19 5\n1 8 3 10\n1 5 3 9\n1 2 3 4\n1 2 3 4\n4 2 12 16\n8 5 12 9", "20 5\n1 12 21 22\n9 10 15 20\n10 12 12 20\n1 1 25 29\n5 ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
2
codeforces
cedf23f9cd9f0334094c4c443a3b28cd
Sum
Vasya studies positional numeral systems. Unfortunately, he often forgets to write the base of notation in which the expression is written. Once he saw a note in his notebook saying *a*<=+<=*b*<==<=?, and that the base of the positional notation wasn’t written anywhere. Now Vasya has to choose a base *p* and regard the...
{"inputs": ["78 87", "1 1", "9 7", "11 11", "43 21", "84 89", "12 34", "99 11", "11 99", "99 99", "1 2", "1 3", "2 1", "2 2", "2 3", "3 1", "3 2", "3 3", "1 466", "1 1000", "1 999", "149 1", "999 1", "1000 1", "998 998", "998 999", "998 1000", "999 998", "999 999", "999 1000", "1000 998", "1000 999", "1000 1000", "1000...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
52
codeforces
cee4791929f0bd6034bfc5e68fc4deda
Vanya and Label
While walking down the street Vanya saw a label "Hide&amp;Seek". Because he is a programmer, he used &amp; as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string *s* and wants to know the number of pairs of words of length |*s*| (length of *s*), such ...
{"inputs": ["z", "V_V", "Codeforces", "zHsIINYjVtU71kmM9E", "fRRNAdMvLFTX21T0FG5gyn7NG0SaIvzGG_g_SO", "Lb1T3sA4BcTx4KAgLIsl-dNOGDvimpxZOxJfMz6VC3nQkB3Y780qqX_1dnjjb59H9X", "2kdYy5-G2-TL5dtLRKcp0ScPGQMrEjwsXuxJHZb4EOd7g7NSQYiAuX2O40PKVyMGEQ1WzW6TvQqbrM1O6e3TdduRsk", "kuCerLoRuMSm6wa_YM", "_", "0123456789ABCDEFGHIJKLMNOP...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
3
codeforces
ceedf38faa444936a913b20e9cd7d9c4
Connected Components
We already know of the large corporation where Polycarpus works as a system administrator. The computer network there consists of *n* computers and *m* cables that connect some pairs of computers. In other words, the computer network can be represented as some non-directed graph with *n* nodes and *m* edges. Let's inde...
{"inputs": ["6 5\n1 2\n5 4\n2 3\n3 1\n3 6\n6\n1 3\n2 5\n1 5\n5 5\n2 4\n3 3", "2 1\n2 1\n2\n1 1\n1 1", "3 2\n3 2\n3 1\n4\n1 1\n1 2\n2 2\n2 2", "3 3\n2 3\n3 1\n2 1\n5\n2 3\n3 3\n2 2\n2 2\n2 2", "4 5\n1 4\n2 1\n4 3\n2 1\n3 4\n5\n4 5\n2 4\n4 4\n1 3\n4 4", "5 4\n3 2\n5 2\n5 3\n2 3\n8\n4 4\n1 1\n3 4\n1 1\n3 3\n3 4\n3 4\n4 4"...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
2
codeforces
cefd9888a7d526cca46b7a86b3deefbb
Hot Days
The official capital and the cultural capital of Berland are connected by a single road running through *n* regions. Each region has a unique climate, so the *i*-th (1<=≤<=*i*<=≤<=*n*) region has a stable temperature of *t**i* degrees in summer. This summer a group of *m* schoolchildren wants to get from the official ...
{"inputs": ["2 10\n30 35 1 100\n20 35 10 10", "3 100\n10 30 1000 1\n5 10 1000 3\n10 40 1000 100000", "10 1\n8 6 3 4\n9 10 7 7\n1 3 9 5\n10 9 4 2\n1 10 2 10\n1 1 8 5\n5 5 9 2\n5 8 4 3\n4 4 9 7\n5 7 5 10", "5 5\n100 29 49 77\n34 74 41 8\n32 21 24 91\n45 52 16 51\n50 87 90 94", "1 1000000\n4 4 6 2", "20 102\n73 79 75 27\n...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
2
codeforces
cf1cc557666d64e45d88d252152147db
Restore Graph
Valera had an undirected connected graph without self-loops and multiple edges consisting of *n* vertices. The graph had an interesting property: there were at most *k* edges adjacent to each of its vertices. For convenience, we will assume that the graph vertices were indexed by integers from 1 to *n*. One day Valera...
{"inputs": ["3 2\n0 1 1", "4 2\n2 0 1 3", "3 1\n0 0 0", "5 3\n0 2 1 2 1", "7 3\n2 2 0 1 3 2 1", "9 4\n2 1 1 3 1 2 2 1 0", "3 1\n0 1 2", "2 1\n1 0", "2 1\n1 1", "2 1\n0 0", "4 2\n0 1 0 1", "5 3\n3 1 4 2 1", "5 4\n1 2 2 2 3", "4 3\n1 1 1 2", "4 3\n1 2 2 3", "4 3\n1 2 3 3", "7 6\n1 1 2 2 3 3 3", "10 5\n0 1 1 1 1 1 1 2 2 2...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
7
codeforces
cf438485b6500f7040d2da54b017d318
The Queue
Finally! Vasya have come of age and that means he can finally get a passport! To do it, he needs to visit the passport office, but it's not that simple. There's only one receptionist at the passport office and people can queue up long before it actually opens. Vasya wants to visit the passport office tomorrow. He know...
{"inputs": ["10 15 2\n2\n10 13", "8 17 3\n4\n3 4 5 8", "7 14 3\n2\n1 2", "30 70 10\n3\n30 32 35", "21 56 7\n5\n1 2 3 4 5", "10 1000000000 25\n20\n1 1 5 7 8 10 12 22 44 47 73 77 82 83 89 141 142 168 195 199", "30 60 3\n10\n1 5 6 10 12 13 18 23 24 25", "61 1000000000 13\n55\n29 72 85 94 103 123 125 144 147 153 154 184 18...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
4
codeforces
cf4da4092ec76b45e3e4ddde8e8a0056
Infinite Sequence
Vasya likes everything infinite. Now he is studying the properties of a sequence *s*, such that its first element is equal to *a* (*s*1<==<=*a*), and the difference between any two neighbouring elements is equal to *c* (*s**i*<=-<=*s**i*<=-<=1<==<=*c*). In particular, Vasya wonders if his favourite integer *b* appears ...
{"inputs": ["1 7 3", "10 10 0", "1 -4 5", "0 60 50", "1 -4 -5", "0 1 0", "10 10 42", "-1000000000 1000000000 -1", "10 16 4", "-1000000000 1000000000 5", "1000000000 -1000000000 5", "1000000000 -1000000000 0", "1000000000 1000000000 0", "115078364 -899474523 -1", "-245436499 416383245 992", "-719636354 536952440 2", "-1...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
136
codeforces
cf4fdddf06155690a7e8cf32013d2821
Set of Points
Convexity of a set of points on the plane is the size of the largest subset of points that form a convex polygon. Your task is to build a set of *n* points with the convexity of exactly *m*. Your set of points should not contain three points that lie on a straight line. The single line contains two integers *n* and *m*...
{"inputs": ["4 3", "6 3", "6 6", "7 4", "3 3", "5 3", "4 4", "5 4", "6 4", "8 4", "8 6", "10 5", "5 5", "10 6", "11 7", "16 8", "9 5", "200 100", "199 100", "198 100", "102 100", "101 100", "100 100", "198 99", "197 99", "100 99", "99 99", "50 37", "150 100", "181 95", "100 50", "101 99", "6 5", "7 5", "8 5", "43 24", ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
1
codeforces
cf61c7272e1736a69a692641b0e542a9
Okabe and Future Gadget Laboratory
Okabe needs to renovate the Future Gadget Laboratory after he tried doing some crazy experiments! The lab is represented as an *n* by *n* square grid of integers. A good lab is defined as a lab in which every number not equal to 1 can be expressed as the sum of a number in the same row and a number in the same column. ...
{"inputs": ["3\n1 1 2\n2 3 1\n6 4 1", "3\n1 5 2\n1 1 1\n1 2 3", "1\n1", "4\n1 1 1 1\n1 11 1 2\n2 5 1 4\n3 9 4 1", "4\n1 1 1 1\n1 7 1 1\n1 3 1 2\n2 6 3 1", "4\n1 1 1 1\n1 12 1 2\n4 4 1 3\n5 10 6 1", "4\n1 1 1 1\n1 13 1 2\n4 5 1 3\n5 11 6 1", "4\n1 1 1 1\n1 13 1 2\n4 5 1 3\n7 11 6 1", "4\n1 1 1 1\n1 14 1 6\n4 5 1 5\n3 8 ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
171
codeforces
cf630697f1a656cbd30ea39d80be45d2
Orchestra
Paul is at the orchestra. The string section is arranged in an *r*<=×<=*c* rectangular grid and is filled with violinists with the exception of *n* violists. Paul really likes violas, so he would like to take a picture including at least *k* of them. Paul can take a picture of any axis-parallel rectangle in the orchest...
{"inputs": ["2 2 1 1\n1 2", "3 2 3 3\n1 1\n3 1\n2 2", "3 2 3 2\n1 1\n3 1\n2 2", "1 1 1 1\n1 1", "10 10 10 10\n6 1\n3 8\n10 6\n10 3\n10 4\n8 9\n2 3\n5 7\n5 9\n5 1", "10 10 10 1\n8 2\n9 10\n6 8\n10 7\n1 8\n4 4\n6 3\n2 3\n8 8\n7 2", "5 9 2 2\n4 6\n1 5", "6 4 10 2\n2 3\n2 1\n1 2\n6 1\n1 4\n4 4\n2 4\n1 1\n6 3\n4 2", "8 2 4 ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
54
codeforces
cf63babc63476bee39388e4e1d25d2b4
Trees
On Bertown's main street *n* trees are growing, the tree number *i* has the height of *a**i* meters (1<=≤<=*i*<=≤<=*n*). By the arrival of the President of Berland these trees were decided to be changed so that their heights formed a beautiful sequence. This means that the heights of trees on ends (the 1st one and the ...
{"inputs": ["3\n2 2 2", "4\n1 2 2 1", "3\n61452 50974 73849", "4\n86002 1199 86003 86002", "5\n92605 92606 41969 98774 92605", "10\n1 1 2 3 4 4 3 2 1 10", "10\n73905 73906 73907 85732 73909 73909 73908 73907 73906 73905", "10\n60718 99414 65042 65043 65044 38495 95782 65042 65041 65040", "7\n1 2 3 7 6 5 4", "5\n4 5 6 5...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
7
codeforces
cf6b0edd29a966dde1de8aa4a4467b6b
Mike and Geometry Problem
Mike wants to prepare for IMO but he doesn't know geometry, so his teacher gave him an interesting geometry problem. Let's define *f*([*l*,<=*r*])<==<=*r*<=-<=*l*<=+<=1 to be the number of integer points in the segment [*l*,<=*r*] with *l*<=≤<=*r* (say that ). You are given two integers *n* and *k* and *n* closed inter...
{"inputs": ["3 2\n1 2\n1 3\n2 3", "3 3\n1 3\n1 3\n1 3", "3 1\n1 2\n2 3\n3 4", "1 1\n45 70", "1 1\n-35 -8", "1 1\n-79 -51", "2 2\n26 99\n-56 40", "9 6\n-44 -29\n-11 85\n11 84\n-63 1\n75 89\n-37 61\n14 73\n78 88\n-22 -18", "2 2\n-93 -22\n12 72"], "outputs": ["5", "3", "6", "26", "28", "29", "15", "0", "0"]}
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
4
codeforces
cf86a8bbd6a48bb925bc9ed62354e875
World Cup
The last stage of Football World Cup is played using the play-off system. There are *n* teams left in this stage, they are enumerated from 1 to *n*. Several rounds are held, in each round the remaining teams are sorted in the order of their ids, then the first in this order plays with the second, the third — with the ...
{"inputs": ["4 1 2", "8 2 6", "8 7 5", "128 30 98", "256 128 256", "256 2 127", "2 1 2", "2 2 1", "4 1 3", "4 1 4", "4 2 1", "4 2 3", "4 2 4", "4 3 1", "4 3 2", "4 3 4", "4 4 1", "4 4 2", "4 4 3", "8 8 7", "8 8 5", "8 8 1", "16 4 3", "16 2 4", "16 14 11", "16 3 11", "32 10 9", "32 25 28", "32 22 18", "32 17 25", "32 18...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
173
codeforces
cf9bfbf389d9d8bdc2c282638d92b467
Dasha and Very Difficult Problem
Dasha logged into the system and began to solve problems. One of them is as follows: Given two sequences *a* and *b* of length *n* each you need to write a sequence *c* of length *n*, the *i*-th element of which is calculated as follows: *c**i*<==<=*b**i*<=-<=*a**i*. About sequences *a* and *b* we know that their ele...
{"inputs": ["5 1 5\n1 1 1 1 1\n3 1 5 4 2", "4 2 9\n3 4 8 9\n3 2 1 4", "6 1 5\n1 1 1 1 1 1\n2 3 5 4 1 6", "5 1 7\n1 4 4 6 5\n5 2 1 4 3", "5 10 100\n12 14 15 11 13\n4 2 1 5 3", "2 1 1000000000\n1000000000 1\n2 1", "2 1 1000000000\n1000000000 1\n1 2", "5 1 5\n1 1 1 1 1\n1 2 3 4 5", "5 1 5\n1 1 1 1 1\n2 3 1 5 4", "1 100000...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
24
codeforces
cfa14502e4800d652733f9b4ec565760
Permutation
"Hey, it's homework time" — thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some considerable time, the boy asked you to help him. The sequence of *n* integers is cal...
{"inputs": ["3\n3 1 2", "2\n2 2", "5\n5 3 3 3 1", "5\n6 6 6 6 6", "10\n1 1 2 2 8 8 7 7 9 9", "8\n9 8 7 6 5 4 3 2", "15\n1 2 3 4 5 5 4 3 2 1 1 2 3 4 5", "1\n1", "1\n5000", "4\n5000 5000 5000 5000", "5\n3366 3461 4 5 4370", "10\n8 2 10 3 4 6 1 7 9 5", "10\n551 3192 3213 2846 3068 1224 3447 1 10 9", "15\n4 1459 12 4281 32...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
245
codeforces
d0040d13ef457ac6407a514ec877584c
Arpa's loud Owf and Mehrdad's evil plan
As you have noticed, there are lovely girls in Arpa’s land. People in Arpa's land are numbered from 1 to *n*. Everyone has exactly one crush, *i*-th person's crush is person with the number *crush**i*. Someday Arpa shouted Owf loudly from the top of the palace and a funny game started in Arpa's land. The rules are as...
{"inputs": ["4\n2 3 1 4", "4\n4 4 4 4", "4\n2 1 4 3", "5\n2 4 3 1 2", "5\n2 2 4 4 5", "5\n2 4 5 4 2", "10\n8 10 4 3 2 1 9 6 5 7", "10\n10 1 4 8 5 2 3 7 9 6", "10\n6 4 3 9 5 2 1 10 8 7", "100\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
29
codeforces
d01820987d411523356abffd769f2c7f
Vasily the Bear and Triangle
Vasily the bear has a favorite rectangle, it has one vertex at point (0,<=0), and the opposite vertex at point (*x*,<=*y*). Of course, the sides of Vasya's favorite rectangle are parallel to the coordinate axes. Vasya also loves triangles, if the triangles have one vertex at point *B*<==<=(0,<=0). That's why today he...
{"inputs": ["10 5", "-10 5", "20 -10", "-10 -1000000000", "-1000000000 -1000000000", "1000000000 1000000000", "-123131 3123141", "-23423 -243242423", "123112 4560954", "1321 -23131", "1000000000 999999999", "54543 432423", "1 1", "-1 -1", "-1 1", "1 -1", "42 -2", "2 -435", "76 -76", "1000000000 1", "1000000000 -1", "-1...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
183
codeforces
d02c5691f75073b585c6a0d403fb8188
Martian Dollar
One day Vasya got hold of information on the Martian dollar course in bourles for the next *n* days. The buying prices and the selling prices for one dollar on day *i* are the same and are equal to *a**i*. Vasya has *b* bourles. He can buy a certain number of dollars and then sell it no more than once in *n* days. Acco...
{"inputs": ["2 4\n3 7", "4 10\n4 3 2 1", "4 10\n4 2 3 1", "2 755\n51 160", "3 385\n978 1604 1888", "4 1663\n1904 1049 1622 472", "5 1293\n1183 142 1356 889 134", "1 1472\n784", "1 478\n1955", "1 1483\n1126", "10 595\n881 832 1159 171 230 750 361 1800 516 567", "93 867\n97 1270 616 1027 1685 27 1662 947 1480 20 1394 152...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
35
codeforces
d08494093811abd7a4cbf604871ae8f9
Network Configuration
The R1 company wants to hold a web search championship. There were *n* computers given for the competition, each of them is connected to the Internet. The organizers believe that the data transfer speed directly affects the result. The higher the speed of the Internet is, the faster the participant will find the necess...
{"inputs": ["3 2\n40 20 30", "6 4\n100 20 40 20 50 50", "1 1\n16", "2 1\n10000 17", "2 2\n200 300", "3 1\n21 25 16", "3 2\n23 20 26", "3 3\n19 29 28", "100 2\n82 37 88 28 98 30 38 76 90 68 79 29 67 93 19 71 122 103 110 79 20 75 68 101 16 120 114 68 73 71 103 114 99 70 73 18 36 31 32 87 32 79 44 72 58 25 44 72 106 38 47...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
179
codeforces
d09e0f1b9d617f27cfe3d68024706ed8
Single-use Stones
A lot of frogs want to cross a river. A river is $w$ units width, but frogs can only jump $l$ units long, where $l &lt; w$. Frogs can also jump on lengths shorter than $l$. but can't jump longer. Hopefully, there are some stones in the river to help them. The stones are located at integer distances from the banks. The...
{"inputs": ["10 5\n0 0 1 0 2 0 0 1 0", "10 3\n1 1 1 1 2 1 1 1 1", "2 1\n0", "2 1\n5", "10 4\n0 0 6 2 7 1 6 4 0", "100 15\n0 0 1 1 1 0 1 1 1 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 0 1 1 0 0 1 0 0 1 0 0 1 0 1 0 1 0 1 1 0 0 0 1 0 0 0 0 0 1 0 1 1 1 1 1 0 1 0 1 0 1 0 0 0 0 1 1 0 1 1 0 0 1 0 1 0 1 0 0 1 0 0 1 0 0 1 1 0 1 0 1 0 0 1 0"...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
51
codeforces
d0ae2caa308c79b1dd056ce059c51365
Trace
One day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had several concentric circles that divided the wall into several parts. Some parts were painted red and all the other were painted blue. Besides,...
{"inputs": ["1\n1", "3\n1 4 2", "4\n4 1 3 2", "4\n100 10 2 1", "10\n10 9 8 7 6 5 4 3 2 1", "1\n1000", "8\n8 1 7 2 6 3 5 4", "100\n1000 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 9...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
314
codeforces
d0af4a8c1ee35c1950cff7a2dcfd802f
Felicity's Big Secret Revealed
The gym leaders were fascinated by the evolutions which took place at Felicity camp. So, they were curious to know about the secret behind evolving Pokemon. The organizers of the camp gave the gym leaders a PokeBlock, a sequence of *n* ingredients. Each ingredient can be of type 0 or 1. Now the organizers told the gy...
{"inputs": ["4\n1011", "2\n10", "7\n0110011", "10\n0100011101", "12\n010010101011", "31\n1000000010111001111000111001110", "62\n00010011000110010011110110011001110110010011110110111100100010", "51\n100010110000000110000101100110111110001001011000000", "75\n011001100010010010100010011010001000110010011010100111110110100...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
1
codeforces
d0b4203b9ff07c161d2aaec568cce045
Chess For Three
Alex, Bob and Carl will soon participate in a team chess tournament. Since they are all in the same team, they have decided to practise really hard before the tournament. But it's a bit difficult for them because chess is a game for two players, not three. So they play with each other according to following rules: - ...
{"inputs": ["3\n1\n1\n2", "2\n1\n2", "100\n2\n3\n1\n2\n3\n3\n3\n1\n1\n1\n1\n3\n3\n3\n3\n1\n2\n3\n3\n3\n3\n3\n3\n3\n1\n2\n2\n2\n3\n1\n1\n3\n3\n3\n3\n3\n3\n3\n3\n1\n2\n3\n3\n3\n1\n1\n1\n1\n3\n3\n3\n3\n1\n2\n3\n1\n2\n2\n2\n3\n3\n2\n1\n3\n3\n1\n2\n3\n1\n1\n1\n2\n2\n2\n3\n1\n1\n1\n1\n1\n1\n3\n2\n2\n2\n2\n2\n2\n3\n1\n2\n2\n2...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
76
codeforces
d0d6dc4057d27406033bbafafb50a4ec
If at first you don't succeed...
Each student eagerly awaits the day he would pass the exams successfully. Thus, Vasya was ready to celebrate, but, alas, he didn't pass it. However, many of Vasya's fellow students from the same group were more successful and celebrated after the exam. Some of them celebrated in the BugDonalds restaurant, some of them...
{"inputs": ["10 10 5 20", "2 2 0 4", "2 2 2 1", "98 98 97 100", "1 5 2 10", "5 1 2 10", "6 7 5 8", "6 7 5 9", "6 7 5 7", "50 50 1 100", "8 3 2 12", "10 19 6 25", "1 0 0 99", "0 1 0 98", "1 1 0 97", "1 1 1 96", "0 0 0 0", "100 0 0 0", "0 100 0 0", "100 100 0 0", "0 0 100 0", "100 0 100 0", "0 100 100 0", "100 100 100 0"...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
93
codeforces
d0e23c6e96b781e15b7393a41c955eb8
Chores
Petya and Vasya are brothers. Today is a special day for them as their parents left them home alone and commissioned them to do *n* chores. Each chore is characterized by a single parameter — its complexity. The complexity of the *i*-th chore equals *h**i*. As Petya is older, he wants to take the chores with complexit...
{"inputs": ["5 2 3\n6 2 3 100 1", "7 3 4\n1 1 9 1 1 1 1", "2 1 1\n10 2", "2 1 1\n7 7", "2 1 1\n1 1000000000", "3 1 2\n6 5 5", "3 2 1\n10 10 8", "8 3 5\n42 55 61 72 83 10 22 33", "10 5 5\n1 2 3 4 5 999999999 999999998 999999997 999999996 999999995", "4 1 3\n10 8 7 3", "4 2 2\n402 10 10 402", "4 1 3\n10 402 402 10", "4 3...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
282
codeforces
d0eadd1af5500f9da5e84a894556b641
Table Tennis Game 2
Misha and Vanya have played several table tennis sets. Each set consists of several serves, each serve is won by one of the players, he receives one point and the loser receives nothing. Once one of the players scores exactly *k* points, the score is reset and a new set begins. Across all the sets Misha scored *a* poi...
{"inputs": ["11 11 5", "11 2 3", "1 5 9", "2 3 3", "1 1000000000 1000000000", "2 3 5", "1000000000 1000000000 1000000000", "1 0 1", "101 99 97", "1000000000 0 1", "137 137 136", "255 255 255", "1 0 1000000000", "123 456 789", "666666 6666666 666665", "1000000000 999999999 999999999", "100000000 100000001 99999999", "3 ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
85
codeforces
d10c82725280342c8fff8d5450f16947
To Add or Not to Add
A piece of paper contains an array of *n* integers *a*1,<=*a*2,<=...,<=*a**n*. Your task is to find a number that occurs the maximum number of times in this array. However, before looking for such number, you are allowed to perform not more than *k* following operations — choose an arbitrary element from the array and...
{"inputs": ["5 3\n6 3 4 0 2", "3 4\n5 5 5", "5 3\n3 1 2 2 1", "6 0\n3 2 3 2 3 2", "10 15\n1 1 1 4 4 1 4 4 1 4", "5 100000\n0 5 5 4 3", "20 10\n-12 28 0 -27 16 25 -17 -25 9 -15 -38 19 33 20 -18 22 14 36 33 29", "100 100\n92 -6 67 92 65 -32 67 -31 91 -63 52 -81 -98 -12 48 86 -72 95 -50 66 79 89 -1 0 -33 -27 -23 -71 1 19 ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
1
codeforces
d111139ff1607a1c8f702d05c3344b7a
Vasya and Polynomial
Vasya is studying in the last class of school and soon he will take exams. He decided to study polynomials. Polynomial is a function *P*(*x*)<==<=*a*0<=+<=*a*1*x*1<=+<=...<=+<=*a**n**x**n*. Numbers *a**i* are called coefficients of a polynomial, non-negative integer *n* is called a degree of a polynomial. Vasya has ma...
{"inputs": ["2 2 2", "2 3 3", "1 1 1", "3 5 10", "2 3 1000000000000000000", "7 8 9", "8 10 11", "5 30 930", "3 3 3", "1 5 5", "1 2 2", "1 2 5", "1 2 4", "1000000000000000000 1000000000000000000 1000000000000000000", "1 125 15625", "1000000000000 1000000000000000 1000000000000000000", "5 2 2", "1 3 6561", "3 6 5", "1 5 ...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
1
codeforces
d11a14b8d0336ac43a0a902e5921aa27
BerSU Ball
The Berland State University is hosting a ballroom dance in celebration of its 100500-th anniversary! *n* boys and *m* girls are already busy rehearsing waltz, minuet, polonaise and quadrille moves. We know that several boy&amp;girl pairs are going to be invited to the ball. However, the partners' dancing skill in eac...
{"inputs": ["4\n1 4 6 2\n5\n5 1 5 7 9", "4\n1 2 3 4\n4\n10 11 12 13", "5\n1 1 1 1 1\n3\n1 2 3", "1\n1\n1\n1", "2\n1 10\n1\n9", "4\n4 5 4 4\n5\n5 3 4 2 4", "1\n2\n1\n1", "1\n3\n2\n3 2", "1\n4\n3\n4 4 4", "1\n2\n4\n3 1 4 2", "1\n4\n5\n2 5 5 3 1", "2\n2 2\n1\n2", "2\n4 2\n2\n4 4", "2\n4 1\n3\n2 3 2", "2\n4 3\n4\n5 5 5 6",...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
173
codeforces
d14d76ed6f3fbd0cf793d69b8bbffa64
Growing Mushrooms
Each year in the castle of Dwarven King there is a competition in growing mushrooms among the dwarves. The competition is one of the most prestigious ones, and the winner gets a wooden salad bowl. This year's event brought together the best mushroom growers from around the world, so we had to slightly change the rules ...
{"inputs": ["2 3 3 50\n2 4\n4 2", "4 1 1 1\n544 397\n280 101\n280 101\n693 970", "10 1 1 25\n981 1\n352 276\n164 691\n203 853\n599 97\n901 688\n934 579\n910 959\n317 624\n440 737", "10 6 1 48\n239 632\n976 315\n797 112\n1 835\n938 862\n531 884\n422 607\n152 331\n413 677\n622 978", "8 1 4 55\n507 82\n681 492\n602 849\n3...
UNKNOWN
[ "PYTHON3" ]
CODEFORCES
60
codeforces