problem_id
stringlengths
32
32
name
stringlengths
2
112
problem
stringlengths
200
14k
test_cases
stringlengths
33
79.2M
difficulty
stringclasses
34 values
language
listlengths
1
1
source
stringclasses
15 values
num_solutions
int64
1
1.12M
starter_code
stringlengths
0
1.47k
subset
stringclasses
4 values
f87a7953fce36436ddfe884f30b6e86a
traveler
Chef likes to travel very much. He plans some travel routes and wants to know their lengths. He hired you to make these calculations. But be careful, some of the routes are incorrect. There may be some misspelling in city names or there will be no road between some two consecutive cities in the route. Also note that Ch...
{"inputs": ["5\nDonetsk Kiev New-York Miami Hollywood\n9\nDonetsk Kiev 560\nKiev New-York 7507\nNew-York Miami 1764\nMiami Hollywood 28\nHollywood Miami 30\nMiami New-York 1764\nKiev Donetsk 550\nHollywood New-York 1736\nNew-York Hollywood 1738\n13\n5 Donetsk Kiev New-York Miami Hollywood\n5 Hollywood Miami New-York Ki...
2
[ "PYTHON3" ]
1
2
code_contests
c56880c191fa1cfd05916638ee25d681
1016_C. Vasya And The Mushrooms
Vasya's house is situated in a forest, and there is a mushroom glade near it. The glade consists of two rows, each of which can be divided into n consecutive cells. For each cell Vasya knows how fast the mushrooms grow in this cell (more formally, how many grams of mushrooms grow in this cell each minute). Vasya spends...
{"inputs": ["3\n1 2 3\n6 5 4\n", "3\n1 1000 10000\n10 100 100000\n", "6\n12 8 12 17 20 5\n17 4 8 8 8 4\n", "6\n4 1 12 9 3 11\n12 20 19 12 19 11\n", "1\n1\n1\n", "2\n1 2\n1 1\n", "1\n7\n5\n", "6\n16 20 18 7 14 2\n17 12 4 10 7 4\n", "6\n20 8 12 17 20 5\n17 4 8 8 8 4\n", "6\n4 1 11 9 3 11\n12 20 19 12 19 11\n", "1\n2\n1\n...
9
[ "PYTHON3" ]
2
2
code_contests
936a37f84f486d4f6c63819493411268
103_C. Russian Roulette
After all the events in Orlando we all know, Sasha and Roma decided to find out who is still the team's biggest loser. Thankfully, Masha found somewhere a revolver with a rotating cylinder of n bullet slots able to contain exactly k bullets, now the boys have a chance to resolve the problem once and for all. Sasha se...
{"inputs": ["5 2 5\n1\n2\n3\n4\n5\n", "6 3 6\n1\n2\n3\n4\n5\n6\n", "3 1 3\n1\n2\n3\n", "7 7 7\n1\n2\n3\n4\n5\n6\n7\n", "4 2 8\n1\n3\n4\n2\n3\n4\n1\n2\n", "9 4 9\n1\n2\n3\n4\n5\n6\n7\n8\n9\n", "7 5 7\n1\n2\n3\n4\n5\n6\n7\n", "15 10 15\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n", "4 0 4\n1\n2\n3\n4\n", "12 2 12...
9
[ "PYTHON3" ]
2
2
code_contests
6a20fb5bec0b027b4f91e62479236fbc
1062_D. Fun with Integers
You are given a positive integer n greater or equal to 2. For every pair of integers a and b (2 ≤ |a|, |b| ≤ n), you can transform a into b if and only if there exists an integer x such that 1 < |x| and (a ⋅ x = b or b ⋅ x = a), where |x| denotes the absolute value of x. After such a transformation, your score increas...
{"inputs": ["2\n", "4\n", "6\n", "28237\n", "13190\n", "39914\n", "81367\n", "8554\n", "61106\n", "67448\n", "39004\n", "22308\n", "16054\n", "71468\n", "60501\n", "100\n", "300\n", "59632\n", "90783\n", "5611\n", "1000\n", "69475\n", "69753\n", "10\n", "5\n", "582\n", "8\n", "36961\n", "5071\n", "20\n", "53213\n", "92...
10
[ "PYTHON3" ]
2
2
code_contests
dbc519056285b51b56c80e3acd9a3c10
1084_C. The Fair Nut and String
The Fair Nut found a string s. The string consists of lowercase Latin letters. The Nut is a curious guy, so he wants to find the number of strictly increasing sequences p_1, p_2, …, p_k, such that: 1. For each i (1 ≤ i ≤ k), s_{p_i} = 'a'. 2. For each i (1 ≤ i < k), there is such j that p_i < j < p_{i + 1} and s...
{"inputs": ["agaa\n", "baaaa\n", "abbaa\n", "aaaaabb\n", "aabaaaa\n", "babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb\n", "baaahbbbba\n", "ababavvvv\n", "abnxabbaab\n", "krflnzhter\n", "amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaa...
9
[ "PYTHON3" ]
2
2
code_contests
0fd057952da5aefc484fd3c0aa35ab98
1103_E. Radix sum
Let's define radix sum of number a consisting of digits a_1, … ,a_k and number b consisting of digits b_1, … ,b_k(we add leading zeroes to the shorter number to match longer length) as number s(a,b) consisting of digits (a_1+b_1)mod 10, … ,(a_k+b_k)mod 10. The radix sum of several integers is defined as follows: s(t_1,...
{"inputs": ["2\n5 6\n", "4\n5 7 5 7\n", "2\n0 1\n", "1\n0\n", "2\n0 2\n", "1\n1\n", "2\n7 6\n", "4\n5 7 5 13\n", "4\n0 7 5 13\n", "4\n0 7 6 23\n", "4\n1 7 6 23\n", "4\n2 7 6 23\n", "4\n3 7 6 23\n", "4\n3 7 9 27\n", "4\n3 7 10 27\n", "4\n3 1 10 27\n", "4\n3 0 10 27\n", "4\n3 0 10 94\n", "4\n5 0 10 131\n", "4\n9 0 10 131...
11
[ "PYTHON3" ]
2
2
code_contests
2639f3eaceb993e800933a0a17eee3f0
1131_E. String Multiplication
Roman and Denis are on the trip to the programming competition. Since the trip was long, they soon got bored, and hence decided to came up with something. Roman invented a pizza's recipe, while Denis invented a string multiplication. According to Denis, the result of multiplication (product) of strings s of length m an...
{"inputs": ["2\nbnn\na\n", "3\na\nb\na\n", "9\nlfpgbnlzyn\nc\ns\nw\nr\nm\nq\ny\nyinfblfcdhidphyfvgkxyuwomahiibbhnigdslsguhjkplibnhhrshtekwgefxeugyyyyy\n", "6\nu\np\nm\nz\nv\nvv\n", "4\nqe\nnd\niqryhukieskfvaeettersinksrmazelxtgvartuz\nvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv...
11
[ "PYTHON3" ]
2
2
code_contests
0dffc96edf93b13404f57e4891aaea34
1152_A. Neko Finds Grapes
On a random day, Neko found n treasure chests and m keys. The i-th chest has an integer a_i written on it and the j-th key has an integer b_j on it. Neko knows those chests contain the powerful mysterious green Grapes, thus Neko wants to open as many treasure chests as possible. The j-th key can be used to unlock the ...
{"inputs": ["5 1\n2 4 6 8 10\n5\n", "1 4\n10\n20 30 40 50\n", "5 4\n9 14 6 2 11\n8 4 7 20\n", "4 1\n3 5 7 8\n2\n", "5 1\n2 2 2 3 3\n3\n", "4 1\n1 1 2 2\n2\n", "10 10\n522312461 931001459 598654597 488228616 544064902 21923894 329635457 980089248 988262691 654502493\n967529230 543358150 835120075 128123793 809901567 613...
7
[ "PYTHON3" ]
2
2
code_contests
6d54c178ae1180df2db7a8960ee614cd
1173_E2. Nauuo and Pictures (hard version)
The only difference between easy and hard versions is constraints. Nauuo is a girl who loves random picture websites. One day she made a random picture website by herself which includes n pictures. When Nauuo visits the website, she sees exactly one picture. The website does not display each picture with equal proba...
{"inputs": ["3 3\n0 1 1\n4 3 5\n", "1 2\n1\n1\n", "2 1\n0 1\n2 1\n", "20 30\n1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n1 2 1 3 1 4 1 5 1 1 2 3 1 1 3 3 2 2 1 2\n", "20 30\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n765 451 7275 385 1686 78 554 114 1980 394 776 232 627 760 782 7 486 32 1100 1516\n", "20 30\n1 1 1 1 1 1 1 1 ...
11
[ "PYTHON3" ]
2
2
code_contests
7c83ccc76748743ca2c79ea949adc083
1191_C. Tokitsukaze and Discard Items
Recently, Tokitsukaze found an interesting game. Tokitsukaze had n items at the beginning of this game. However, she thought there were too many items, so now she wants to discard m (1 ≤ m ≤ n) special items of them. These n items are marked with indices from 1 to n. In the beginning, the item with index i is placed o...
{"inputs": ["13 4 5\n7 8 9 10\n", "10 4 5\n3 5 7 10\n", "10 5 5\n2 3 4 5 6\n", "1 1 1\n1\n", "1000000000000000000 10 68\n9818112234872670 233245257111863071 266483628625876079 375103213040049805 431982380866113633 489732004669478331 501030096787260719 541800997319766183 551892546260532408 696178619227890200\n", "100000...
9
[ "PYTHON3" ]
2
2
code_contests
c25fd6b3e4ee7a2f435feac1219619ff
120_C. Winnie-the-Pooh and honey
As we all know, Winnie-the-Pooh just adores honey. Ones he and the Piglet found out that the Rabbit has recently gotten hold of an impressive amount of this sweet and healthy snack. As you may guess, Winnie and the Piglet asked to come at the Rabbit's place. Thus, there are n jars of honey lined up in front of Winnie-t...
{"inputs": ["3 3\n15 8 10\n", "100 1\n85 75 55 65 39 26 47 16 9 11 3 4 70 23 56 64 36 34 16 13 18 28 32 80 8 79 76 4 21 75 93 51 85 86 100 88 91 71 97 28 66 22 47 87 91 95 3 56 81 53 88 90 21 30 74 45 58 73 36 40 70 51 28 75 20 54 69 52 14 48 52 53 91 81 32 68 16 48 60 66 91 32 55 42 93 51 3 46 23 64 39 1 30 42 20 83 9...
9
[ "PYTHON3" ]
2
2
code_contests
81a03b4218254d7fd26a0580b530d7e3
1230_A. Dawid and Bags of Candies
Dawid has four bags of candies. The i-th of them contains a_i candies. Also, Dawid has two friends. He wants to give each bag to one of his two friends. Is it possible to distribute the bags in such a way that each friend receives the same amount of candies in total? Note, that you can't keep bags for yourself or thro...
{"inputs": ["1 7 11 5\n", "7 3 2 5\n", "44 58 90 53\n", "20 14 37 71\n", "4 2 4 2\n", "1 2 5 5\n", "1 2 8 9\n", "99 100 3 98\n", "92 69 83 97\n", "3 1 1 1\n", "18 88 18 18\n", "1 1 1 1\n", "69 7 44 30\n", "90 30 30 30\n", "1 2 3 5\n", "1 1 3 1\n", "6 3 6 6\n", "26 52 7 19\n", "6 4 8 6\n", "10 2 3 5\n", "34 11 84 39\n",...
7
[ "PYTHON3" ]
2
2
code_contests
04c449e5f35fa6bd492244b62afb1f6c
1251_E1. Voting (Easy Version)
The only difference between easy and hard versions is constraints. Now elections are held in Berland and you want to win them. More precisely, you want everyone to vote for you. There are n voters, and two ways to convince each of them to vote for you. The first way to convince the i-th voter is to pay him p_i coins....
{"inputs": ["3\n3\n1 5\n2 10\n2 8\n7\n0 1\n3 1\n1 1\n6 1\n1 1\n4 1\n4 1\n6\n2 6\n2 3\n2 8\n2 7\n4 4\n5 5\n", "3\n3\n1 5\n2 10\n2 4\n7\n0 1\n3 1\n1 1\n6 1\n1 1\n4 1\n4 1\n6\n2 6\n2 3\n2 8\n2 7\n4 4\n5 5\n", "3\n3\n1 5\n2 10\n2 8\n7\n0 1\n1 1\n1 1\n6 1\n1 1\n4 1\n4 1\n6\n2 6\n2 3\n2 8\n2 7\n4 4\n5 5\n", "3\n3\n1 5\n2 10\...
11
[ "PYTHON3" ]
2
2
code_contests
633c86bad5e1137dc011524ce268ee17
1271_C. Shawarma Tent
The map of the capital of Berland can be viewed on the infinite coordinate plane. Each point with integer coordinates contains a building, and there are streets connecting every building to four neighbouring buildings. All streets are parallel to the coordinate axes. The main school of the capital is located in (s_x, ...
{"inputs": ["7 10 12\n5 6\n20 23\n15 4\n16 5\n4 54\n12 1\n4 15\n", "4 3 2\n1 3\n4 2\n5 1\n4 1\n", "3 100 100\n0 0\n0 0\n100 200\n", "1 1000000000 7\n1000000000 9\n", "3 2 2\n2 4\n2 1\n3 6\n", "2 1000000000 100000\n1000000000 1000000\n1000000000 10000\n", "1 100 100\n50 70\n", "1 100 100\n101 100\n", "3 2 2\n0 4\n2 1\n3...
9
[ "PYTHON3" ]
2
2
code_contests
61173bb90a821a3c47c40b5170ab9422
1294_D. MEX maximizing
Recall that MEX of an array is a minimum non-negative integer that does not belong to the array. Examples: * for the array [0, 0, 1, 0, 2] MEX equals to 3 because numbers 0, 1 and 2 are presented in the array and 3 is the minimum non-negative integer not presented in the array; * for the array [1, 2, 3, 4] MEX eq...
{"inputs": ["4 3\n1\n2\n1\n2\n", "7 3\n0\n1\n2\n2\n0\n0\n10\n", "4 3\n1\n2\n1\n3\n", "3 3\n0\n1\n2\n2\n0\n0\n10\n", "4 2\n1\n2\n1\n0\n", "4 2\n1\n3\n1\n0\n", "4 2\n1\n3\n2\n0\n", "4 2\n0\n3\n2\n0\n", "3 2\n0\n6\n2\n0\n", "2 3\n0\n0\n3\n-1\n", "3 3\n0\n0\n1\n-2\n", "3 3\n1\n0\n1\n-2\n", "1 3\n1\n0\n1\n1\n", "1 5\n0\n0\n...
10
[ "PYTHON3" ]
2
2
code_contests
5d6ec565f22be60c8c72428e98f9e44e
1315_D. Recommendations
VK news recommendation system daily selects interesting publications of one of n disjoint categories for each user. Each publication belongs to exactly one category. For each category i batch algorithm selects a_i publications. The latest A/B test suggests that users are reading recommended publications more actively ...
{"inputs": ["5\n3 7 9 7 8\n5 2 5 7 5\n", "5\n1 2 3 4 5\n1 1 1 1 1\n", "5\n1000000000 1000000000 1000000000 1000000000 1000000000\n100000 100000 100000 100000 100000\n", "10\n14 31 50 67 42 44 86 82 35 63\n76 17 26 44 60 54 50 73 71 70\n", "10\n4 4 1 2 2 2 5 4 1 5\n28 81 36 44 2 40 39 43 36 33\n", "10\n69564153 55882163...
10
[ "PYTHON3" ]
2
2
code_contests
a8f6c99613426c46e64cb1e1fd263b48
1336_F. Journey
In the wilds far beyond lies the Land of Sacredness, which can be viewed as a tree — connected undirected graph consisting of n nodes and n-1 edges. The nodes are numbered from 1 to n. There are m travelers attracted by its prosperity and beauty. Thereupon, they set off their journey on this land. The i-th traveler w...
{"inputs": ["13 8 3\n7 6\n9 11\n5 6\n11 3\n9 7\n2 12\n4 3\n1 2\n5 8\n6 13\n5 10\n3 1\n10 4\n10 11\n8 11\n4 9\n2 5\n3 5\n7 3\n8 10\n", "8 4 1\n1 7\n1 2\n2 5\n4 6\n6 3\n6 2\n6 8\n7 8\n3 8\n2 6\n4 1\n", "10 4 2\n3 10\n9 3\n4 9\n4 6\n8 2\n1 7\n2 1\n4 5\n6 7\n7 1\n8 7\n9 2\n10 3\n", "30 30 10\n6 1\n8 27\n5 1\n21 6\n24 15\n1...
12
[ "PYTHON3" ]
2
2
code_contests
1d1619160b86a55fc8983f63ecab7829
1359_D. Yet Another Yet Another Task
Alice and Bob are playing yet another card game. This time the rules are the following. There are n cards lying in a row in front of them. The i-th card has value a_i. First, Alice chooses a non-empty consecutive segment of cards [l; r] (l ≤ r). After that Bob removes a single card j from that segment (l ≤ j ≤ r). Th...
{"inputs": ["3\n-10 6 -15\n", "8\n5 2 5 3 -30 -30 6 9\n", "5\n5 -2 10 -1 4\n", "10\n-3 4 -4 1 1 -4 -5 3 -4 -2\n", "10\n8 9 -10 -10 -4 -3 5 9 -9 9\n", "6\n5 -4 2 -1 2 -2\n", "11\n3 0 1 -2 5 -5 -1 0 3 2 2\n", "10\n4 -2 -2 -2 2 0 1 0 -4 -1\n", "4\n2 2 -3 4\n", "11\n-11 -7 -2 -24 30 -26 24 9 -8 -9 23\n", "6\n30 -29 5 5 -29...
10
[ "PYTHON3" ]
2
2
code_contests
edf45e441c425d79224128722e9ceb3b
1379_F1. Chess Strikes Back (easy version)
Note that the difference between easy and hard versions is that in hard version unavailable cells can become available again and in easy version can't. You can make hacks only if all versions are solved. Ildar and Ivan are tired of chess, but they really like the chessboard, so they invented a new game. The field is a...
{"inputs": ["1 3 3\n1 1\n1 5\n2 4\n", "3 2 7\n4 2\n6 4\n1 3\n2 2\n2 4\n4 4\n3 1\n", "3 3 20\n4 4\n2 4\n2 2\n2 2\n2 2\n5 5\n2 2\n2 2\n2 2\n5 5\n5 5\n3 5\n4 2\n2 2\n5 5\n5 5\n3 5\n5 5\n2 2\n3 3\n", "1 10 10\n1 19\n2 12\n2 8\n2 16\n2 2\n2 4\n1 9\n2 18\n2 14\n2 10\n", "10 10 10\n2 6\n17 7\n5 19\n14 14\n10 10\n16 2\n6 10\n7...
12
[ "PYTHON3" ]
2
2
code_contests
f97f0bd5333a017f38253c741e6a9781
139_D. Digits Permutations
Andrey's favourite number is n. Andrey's friends gave him two identical numbers n as a New Year present. He hung them on a wall and watched them adoringly. Then Andrey got bored from looking at the same number and he started to swap digits first in one, then in the other number, then again in the first number and so o...
{"inputs": ["500\n", "198\n", "545\n", "2603340571199714716025114079373828413509944752618962350632892540710372640383149198328312562980217104434880337288055817064\n", "670042\n", "1099\n", "8679647744\n", "5057017252180797906185\n", "404\n", "4877\n", "7665711\n", "346762409573609367635944363650432097309\n", "87417\n", ...
10
[ "PYTHON3" ]
2
2
code_contests
e642a5545ccbe4a29689c8091d20a6d7
1423_H. Virus
In Bubbleland a group of special programming forces gets a top secret job to calculate the number of potentially infected people by a new unknown virus. The state has a population of n people and every day there is new information about new contacts between people. The job of special programming forces is to calculate ...
{"inputs": ["10 25 2\n1 9 3\n2 5\n1 1 3\n1 3 1\n2 2\n1 8 3\n1 5 6\n3\n1 9 2\n1 8 3\n2 9\n1 3 1\n2 5\n1 6 4\n3\n3\n2 4\n3\n1 10 9\n1 1 7\n3\n2 2\n3\n1 5 6\n1 1 4\n", "5 12 1\n1 1 2\n1 1 3\n1 3 4\n2 4\n2 5\n3\n2 1\n1 1 2\n1 3 2\n2 1\n3\n2 1\n", "5 12 2\n1 1 2\n1 1 3\n1 3 4\n2 4\n2 5\n3\n2 1\n1 1 2\n1 3 2\n2 1\n3\n2 1\n",...
14
[ "PYTHON3" ]
2
2
code_contests
0b7b90d7ceae73d7c8fc4dbdf3b86188
1443_A. Kids Seating
Today the kindergarten has a new group of n kids who need to be seated at the dinner table. The chairs at the table are numbered from 1 to 4n. Two kids can't sit on the same chair. It is known that two kids who sit on chairs with numbers a and b (a ≠ b) will indulge if: 1. gcd(a, b) = 1 or, 2. a divides b or b d...
{"inputs": ["3\n2\n3\n4\n", "3\n2\n3\n4\n", "100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n...
7
[ "PYTHON3" ]
2
2
code_contests
8fd5d9b58bf708a4b78264716c2fc53b
1468_J. Road Reform
There are n cities and m bidirectional roads in Berland. The i-th road connects the cities x_i and y_i, and has the speed limit s_i. The road network allows everyone to get from any city to any other city. The Berland Transport Ministry is planning a road reform. First of all, maintaining all m roads is too costly, ...
{"inputs": ["4\n4 5 7\n4 1 3\n1 2 5\n2 3 8\n2 4 1\n3 4 4\n4 6 5\n1 2 1\n1 3 1\n1 4 2\n2 4 1\n4 3 1\n3 2 1\n3 2 10\n1 2 8\n1 3 10\n5 5 15\n1 2 17\n3 1 15\n2 3 10\n1 4 14\n2 5 8\n", "4\n4 5 7\n4 2 3\n1 2 5\n2 3 8\n2 4 1\n3 4 4\n4 6 5\n1 2 1\n1 3 1\n1 4 2\n2 4 1\n4 3 1\n3 2 1\n3 2 10\n1 2 8\n1 3 10\n5 5 15\n1 2 17\n3 1 15...
16
[ "PYTHON3" ]
2
2
code_contests
7d27ec3bd285223abd7e956e4ccf3d07
1493_C. K-beautiful Strings
You are given a string s consisting of lowercase English letters and a number k. Let's call a string consisting of lowercase English letters beautiful if the number of occurrences of each letter in that string is divisible by k. You are asked to find the lexicographically smallest beautiful string of length n, which is...
{"inputs": ["4\n4 2\nabcd\n3 1\nabc\n4 3\naaaa\n9 3\nabaabaaaa\n", "12\n12 3\nzazasqzqsasq\n1 1\nz\n1 1\na\n15 4\nabccbaabccbazaa\n16 8\ncadjfdsljfdkljds\n6 2\nbaazaa\n6 3\nbosszb\n6 1\nqwerty\n7 7\ndaaaaaa\n14 2\nacabcbdeffewzd\n18 6\nzzzzzzzzzzzzyyyyyz\n9 4\naabaabbbc\n", "12\n12 3\nzazasqzqsasq\n1 1\nz\n1 1\na\n15 6...
9
[ "PYTHON3" ]
2
2
code_contests
04fc22dc85727ff7d056e1d545fa975e
1515_I. Phoenix and Diamonds
Phoenix wonders what it is like to rob diamonds from a jewelry store! There are n types of diamonds. The i-th type has weight w_i and value v_i. The store initially has a_i diamonds of the i-th type. Each day, for q days, one of the following will happen: 1. A new shipment of k_i diamonds of type d_i arrive. 2...
{"inputs": ["3 5\n2 3 4\n1 5 1\n0 2 4\n3 6\n1 3 3\n3 10\n2 2 3\n3 30\n", "2 8\n2 15 400\n1 13 100\n3 26\n3 27\n3 28\n3 29\n3 30\n3 31\n3 32\n3 33\n", "3 8\n2 15 400\n1 1 200\n1 13 100\n3 26\n3 27\n3 28\n3 29\n3 30\n3 31\n3 32\n3 33\n", "3 8\n2 15 400\n1 1 200\n1 13 110\n3 26\n3 27\n3 28\n3 29\n3 30\n3 31\n3 32\n3 33\n"...
15
[ "PYTHON3" ]
2
2
code_contests
e393a8e3b6649c8c3eca813e1bb42c8c
1543_B. Customising the Track
Highway 201 is the most busy street in Rockport. Traffic cars cause a lot of hindrances to races, especially when there are a lot of them. The track which passes through this highway can be divided into n sub-tracks. You are given an array a where a_i represents the number of traffic cars in the i-th sub-track. You def...
{"inputs": ["3\n3\n1 2 3\n4\n0 1 1 0\n10\n8 3 6 11 5 2 1 7 10 4\n", "3\n3\n1 2 3\n4\n0 1 1 0\n10\n8 3 6 11 4 2 1 7 10 4\n", "3\n3\n1 2 3\n4\n1 1 1 0\n10\n8 3 6 11 4 2 1 7 10 4\n", "3\n3\n1 1 3\n4\n1 1 1 0\n10\n8 3 6 11 4 2 1 7 10 4\n", "3\n3\n1 1 3\n4\n1 1 1 0\n10\n8 3 6 11 4 2 1 3 10 4\n", "3\n3\n1 1 3\n4\n1 1 1 0\n10...
8
[ "PYTHON3" ]
2
2
code_contests
d10d8b823b47748b2efb472e4b6098ca
171_C. A Piece of Cake
How to make a cake you'll never eat. Ingredients. * 2 carrots * 0 calories * 100 g chocolate spread * 1 pack of flour * 1 egg Method. 1. Put calories into the mixing bowl. 2. Take carrots from refrigerator. 3. Chop carrots. 4. Take chocolate spread from refrigerator. 5. Put chocolate spread ...
{"inputs": ["4 1 2 3 4\n", "20 228 779 225 819 142 849 24 494 45 172 95 207 908 510 424 78 100 166 869 456\n", "4 220 380 729 969\n", "23 486 261 249 312 592 411 874 397 18 70 417 512 338 679 517 997 938 328 418 793 522 745 59\n", "17 644 532 255 57 108 413 51 284 364 300 597 646 712 470 42 730 231\n", "16 29 672 601 1...
9
[ "PYTHON3" ]
2
2
code_contests
4bf0d66a44200f4826be87a9ce12f162
191_A. 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": ["4\nvvp\nvvp\ndam\nvvp\n", "3\nab\nc\ndef\n", "3\nabc\nca\ncba\n", "10\nabdcced\nbdacdac\necb\ndc\neaeeebdd\nadcdbadcac\neb\naadecccde\nedbaeacad\naccd\n", "100\nd\na\ne\neb\nc\nd\nd\ne\nc\ne\nac\nd\nc\naa\na\ne\nda\ne\ne\nc\ne\na\nc\nc\nbc\nbd\nd\nda\ncc\nbe\nb\na\nee\nd\nbe\nbe\ne\nb\na\ned\ncb\nab\na\nea...
7
[ "PYTHON3" ]
2
2
code_contests
cfc93774eaa0aeaf20d4cff5b7b95684
215_A. Bicycle Chain
Vasya's bicycle chain drive consists of two parts: n stars are attached to the pedal axle, m stars are attached to the rear wheel axle. The chain helps to rotate the rear wheel by transmitting the pedal rotation. We know that the i-th star on the pedal axle has ai (0 < a1 < a2 < ... < an) teeth, and the j-th star on t...
{"inputs": ["4\n1 2 3 4\n5\n10 11 12 13 14\n", "2\n4 5\n3\n12 13 15\n", "1\n1\n2\n1 2\n", "50\n17 20 22 28 36 38 46 47 48 50 52 57 58 62 63 69 70 74 75 78 79 81 82 86 87 90 93 95 103 202 292 442 1756 1769 2208 2311 2799 2957 3483 4280 4324 4932 5109 5204 6225 6354 6561 7136 8754 9670\n40\n68 214 957 1649 1940 2078 2134...
7
[ "PYTHON3" ]
2
2
code_contests
e812bb96a513d338dd5f325c637b2e11
239_A. Two Bags of Potatoes
Valera had two bags of potatoes, the first of these bags contains x (x ≥ 1) potatoes, and the second — y (y ≥ 1) potatoes. Valera — very scattered boy, so the first bag of potatoes (it contains x potatoes) Valera lost. Valera remembers that the total amount of potatoes (x + y) in the two bags, firstly, was not gerater ...
{"inputs": ["10 6 40\n", "10 1 10\n", "78 7 15\n", "10 4 9174\n", "1 999999999 1000000000\n", "17 28 532\n", "1 100000007 1000000000\n", "30351 86 424\n", "100000000 1000000000 1000000000\n", "1000000000 1 1\n", "15946 76 360\n", "46592 52 232\n", "48 6 50\n", "123 2 50000\n", "500000000 500000000 1000000000\n", "33 7 ...
7
[ "PYTHON3" ]
2
2
code_contests
3f939d5238d768d92f1f48a56dabc60e
263_D. Cycle in Graph
You've got a undirected graph G, consisting of n nodes. We will consider the nodes of the graph indexed by integers from 1 to n. We know that each node of graph G is connected by edges with at least k other nodes of this graph. Your task is to find in the given graph a simple cycle of length of at least k + 1. A simpl...
{"inputs": ["4 6 3\n4 3\n1 2\n1 3\n1 4\n2 3\n2 4\n", "3 3 2\n1 2\n2 3\n3 1\n", "30 70 4\n22 1\n1 25\n27 5\n25 10\n10 2\n29 4\n29 26\n28 18\n15 18\n25 11\n11 10\n11 28\n4 11\n4 26\n26 7\n26 18\n18 21\n14 17\n17 30\n30 9\n30 6\n30 27\n27 22\n22 15\n22 8\n8 4\n8 17\n17 16\n16 19\n16 12\n12 23\n23 20\n20 1\n1 23\n23 15\n15...
10
[ "PYTHON3" ]
2
2
code_contests
61203f8fc1fd0d532100431300b1c74f
287_D. Shifting
John Doe has found the beautiful permutation formula. Let's take permutation p = p1, p2, ..., pn. Let's define transformation f of this permutation: <image> where k (k > 1) is an integer, the transformation parameter, r is such maximum integer that rk ≤ n. If rk = n, then elements prk + 1, prk + 2 and so on are omi...
{"inputs": ["4\n", "2\n", "3\n", "2000\n", "2000\n", "1000\n", "5000\n", "100\n", "16\n", "17\n", "11\n", "10000\n", "12\n", "100\n", "5000\n", "10001\n", "10\n", "10001\n", "13\n", "15\n", "14\n", "1000\n", "10000\n", "18\n", "2030\n", "1868\n", "1100\n", "7560\n", "110\n", "31\n", "5\n", "11001\n", "111\n", "8643\n",...
10
[ "PYTHON3" ]
2
2
code_contests
c0a4563f0cef9a6168afe00be592f80b
312_D. Cats Transport
Zxr960115 is owner of a large farm. He feeds m cute cats and employs p feeders. There's a straight road across the farm and n hills along the road, numbered from 1 to n from left to right. The distance between hill i and (i - 1) is di meters. The feeders live in hill 1. One day, the cats went out to play. Cat i went o...
{"inputs": ["4 6 2\n1 3 5\n1 0\n2 1\n4 9\n1 10\n2 10\n3 12\n", "4 6 2\n1 3 5\n1 0\n2 1\n4 4\n1 10\n2 10\n3 12\n", "4 6 2\n1 3 1\n1 0\n2 1\n4 4\n1 10\n2 10\n3 12\n", "4 6 2\n1 3 2\n1 0\n2 1\n4 4\n1 10\n2 10\n3 12\n", "4 6 2\n1 3 5\n1 0\n4 1\n4 4\n1 10\n2 10\n3 12\n", "4 6 2\n1 3 1\n1 0\n2 1\n4 4\n1 17\n2 10\n3 12\n", "4...
10
[ "PYTHON3" ]
2
2
code_contests
d9e35bde08a33972e5af793e052d8496
335_B. Palindrome
Given a string s, determine if it contains any palindrome of length exactly 100 as a subsequence. If it has any, print any one of them. If it doesn't have any, print a palindrome that is a subsequence of s and is as long as possible. Input The only line of the input contains one string s of length n (1 ≤ n ≤ 5·104) c...
{"inputs": ["rquwmzexectvnbanemsmdufrg\n", "bbbabcbbb\n", "gamjuklsvzwddaocadujdmvlenyyvlflipneqofeyipmtunbdmbdyhkovnpdetueeiunsipowrhxrhtastjniqdhmehcumdcrghewljvpikcraoouhfwtnoaukbnykjapkvyakdnckkypargamvnsqtchesbmuffqqycnjvolmtpjfykvkeexkpdxjexrvdzpcbthhkxuucermkaebrvcxoovidpqnpkgbhiatyjvumihptrigqxsemqbbxwmyunmmayu...
8
[ "PYTHON3" ]
2
2
code_contests
0bf3e1886d598a3cbc1d5880285b477c
358_B. Dima and Text Messages
Seryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (her hame is Inna, by the way). However, the two lovebirds can always find a way to communicate. Today they are writing text messages to each other. Dima and Inna are using a secret code in their text messages. ...
{"inputs": ["7\ni\nam\nnot\nmain\nin\nthe\nfamily\n&lt;3i&lt;&gt;3am&lt;3the&lt;3&lt;main&lt;3in&lt;3the&lt;3&gt;&lt;3family&lt;3\n", "3\ni\nlove\nyou\n&lt;3i&lt;3love&lt;23you&lt;3\n", "3\ni\nlove\nyou\n<3i<3love<23you<3ww\n", "1\na\n<3a<3b\n", "4\na\nb\nc\nd\n<3a<3b<3c<3d\n", "3\ni\nlove\nyou\n<3i<3love<3you<3\n", "4...
8
[ "PYTHON3" ]
2
2
code_contests
ae888c388147425ff1cb36d2e78e8eea
381_A. Sereja and Dima
Sereja and Dima play a game. The rules of the game are very simple. The players have n cards in a row. Each card contains a number, all numbers on the cards are distinct. The players take turns, Sereja moves first. During his turn a player can take one card: either the leftmost card in a row, or the rightmost one. The ...
{"inputs": ["7\n1 2 3 4 5 6 7\n", "4\n4 1 2 10\n", "1\n1\n", "30\n334 443 223 424 168 549 189 303 429 559 516 220 459 134 344 346 316 446 209 148 487 526 69 286 102 366 518 280 392 325\n", "95\n122 29 188 265 292 287 183 225 222 187 155 256 64 148 173 278 218 136 290 17 31 130 2 87 57 283 255 280 68 166 174 142 102 39 ...
7
[ "PYTHON3" ]
2
2
code_contests
84bda7cc29bcf1c5cc109f0a331c5508
42_A. Guilty — to the kitchen!
It's a very unfortunate day for Volodya today. He got bad mark in algebra and was therefore forced to do some work in the kitchen, namely to cook borscht (traditional Russian soup). This should also improve his algebra skills. According to the borscht recipe it consists of n ingredients that have to be mixed in propor...
{"inputs": ["1 100\n1\n40\n", "2 100\n1 1\n60 60\n", "2 100\n1 1\n25 30\n", "5 5005\n5 53 65 52 99\n21 49 9 3 66\n", "14 3615\n81 79 13 94 54 69 92 5 47 98 40 64 44 88\n52 73 7 12 29 40 46 47 60 66 63 68 71 4\n", "7 529\n77 18 67 64 43 51 30\n35 87 17 52 1 97 84\n", "16 1718\n42 68 96 52 47 31 89 5 87 70 25 69 35 86 86...
7
[ "PYTHON3" ]
2
2
code_contests
e62a501285927979187962f1c5554114
451_D. Count Good Substrings
We call a string good, if after merging all the consecutive equal characters, the resulting string is palindrome. For example, "aabba" is good, because after the merging step it will become "aba". Given a string, you have to find two values: 1. the number of good substrings of even length; 2. the number of good ...
{"inputs": ["babaa\n", "bb\n", "baab\n", "babb\n", "bbabaaabaaaabaabbababbbabababaabaaaaabbaabbbbbaababaabbbaabaabaaaababaabaabbabaaabaabbbabbaaaaaaabaabababaaabaaabbbabbabbaabaaabaabbbbbabbababbbbbbbababbababbbabbbbbababaaaababaabbabaaabbaaabaabbbbabbaaababbbbbbaaabbaaabbaaabaaaaaababaabababaabaaabaaaabaabbabbabbbbabb...
10
[ "PYTHON3" ]
2
2
code_contests
e196f43ab8cea0adce265f3b09d63581
474_C. Captain Marmot
Captain Marmot wants to prepare a huge and important battle against his enemy, Captain Snake. For this battle he has n regiments, each consisting of 4 moles. Initially, each mole i (1 ≤ i ≤ 4n) is placed at some position (xi, yi) in the Cartesian plane. Captain Marmot wants to move some moles to make the regiments com...
{"inputs": ["4\n1 1 0 0\n-1 1 0 0\n-1 1 0 0\n1 -1 0 0\n1 1 0 0\n-2 1 0 0\n-1 1 0 0\n1 -1 0 0\n1 1 0 0\n-1 1 0 0\n-1 1 0 0\n-1 1 0 0\n2 2 0 1\n-1 0 0 -2\n3 0 0 -2\n-1 1 -2 0\n", "1\n1 0 2 0\n-1 0 -2 0\n0 1 0 2\n0 -1 0 -2\n", "4\n1 0 0 0\n0 2 0 0\n-1 0 0 0\n0 -2 0 0\n1 0 0 0\n0 1 0 0\n-1 0 0 0\n0 -1 0 0\n1 2 0 0\n-1 2 0 ...
9
[ "PYTHON3" ]
2
2
code_contests
745e6cebed3c5e49aa246bdd9fb53cb3
498_B. Name That Tune
It turns out that you are a great fan of rock band AC/PE. Peter learned that and started the following game: he plays the first song of the list of n songs of the group, and you have to find out the name of the song. After you tell the song name, Peter immediately plays the following song in order, and so on. The i-th...
{"inputs": ["2 2\n50 2\n10 1\n", "2 2\n0 2\n0 2\n", "3 3\n50 3\n50 2\n25 2\n", "2 2\n0 2\n100 2\n", "37 4648\n53 3169\n66 4152\n81 4540\n98 4302\n51 4427\n42 2556\n35 2288\n56 2401\n12 3864\n45 4223\n93 1809\n4 2372\n17 4357\n67 1700\n19 4508\n5 2586\n99 2754\n4 3163\n97 4171\n27 4345\n82 4509\n29 2008\n85 4266\n25 209...
8
[ "PYTHON3" ]
2
2
code_contests
4b43ea1a294188523df525878b1f3e6d
521_C. Pluses everywhere
Vasya is sitting on an extremely boring math class. To have fun, he took a piece of paper and wrote out n numbers on a single line. After that, Vasya began to write out different ways to put pluses ("+") in the line between certain digits in the line so that the result was a correct arithmetic expression; formally, no ...
{"inputs": ["3 1\n108\n", "3 2\n108\n", "57 13\n177946005798852216692528643323484389368821547834013121843\n", "16 15\n8086179429588546\n", "14 6\n00000000000001\n", "200 100\n5698871975581557589328225408146769846248580378214263136938518099974663962255455988428119336734228355923883410691738816604802005685291129339437794...
9
[ "PYTHON3" ]
2
2
code_contests
b1bf93d41ca131fd4fc15e3a6fa0cf39
548_E. Mike and Foam
Mike is a bartender at Rico's bar. At Rico's, they put beer glasses in a special shelf. There are n kinds of beer at Rico's numbered from 1 to n. i-th kind of beer has ai milliliters of foam on it. <image> Maxim is Mike's boss. Today he told Mike to perform q queries. Initially the shelf is empty. In each request, Ma...
{"inputs": ["5 6\n1 2 3 4 6\n1\n2\n3\n4\n5\n1\n", "5 10\n1 1 1 1 1\n1\n2\n3\n4\n5\n5\n4\n3\n2\n1\n", "1 1\n1\n1\n", "1 2\n499590\n1\n1\n", "3 3\n151790 360570 1\n2\n3\n3\n", "5 10\n1 1 1 1 1\n1\n2\n3\n4\n5\n1\n4\n3\n2\n1\n", "5 6\n1 2 3 4 6\n1\n2\n4\n4\n5\n1\n", "5 6\n1 2 3 4 6\n1\n2\n3\n5\n5\n1\n", "3 3\n45085 360570 ...
11
[ "PYTHON3" ]
2
2
code_contests
8d75f1fb52bdb41c14ce44cad9c9da41
575_B. Bribes
Ruritania is a country with a very badly maintained road network, which is not exactly good news for lorry drivers that constantly have to do deliveries. In fact, when roads are maintained, they become one-way. It turns out that it is sometimes impossible to get from one town to another in a legal way – however, we kno...
{"inputs": ["5\n1 2 0\n2 3 0\n5 1 1\n3 4 1\n5\n5 4 5 2 2\n", "4\n1 2 1\n3 2 0\n2 4 0\n10\n3 4 1 3 1 4 2 3 1 4\n", "4\n1 2 1\n3 2 0\n2 4 0\n10\n3 4 2 3 4 2 3 4 2 4\n", "8\n2 1 1\n2 3 1\n8 7 0\n5 6 0\n7 5 1\n1 5 0\n2 4 0\n15\n3 7 1 1 2 2 7 6 4 4 3 8 6 3 7\n", "4\n1 2 1\n3 2 0\n3 4 0\n10\n3 4 2 3 4 2 3 4 2 4\n", "8\n2 1 1...
8
[ "PYTHON3" ]
2
2
code_contests
1b9f4a210db3fd138f53c4dcb0151198
596_E. Wilbur and Strings
Wilbur the pig now wants to play with strings. He has found an n by m table consisting only of the digits from 0 to 9 where the rows are numbered 1 to n and the columns are numbered 1 to m. Wilbur starts at some square and makes certain moves. If he is at square (x, y) and the digit d (0 ≤ d ≤ 9) is written at position...
{"inputs": ["4 2 5\n01\n23\n45\n67\n0 1\n0 -1\n0 1\n0 -1\n0 1\n0 -1\n0 1\n0 -1\n0 1\n0 -1\n0000000000\n010101011101\n32232232322\n44343222342444324\n6767\n", "1 1 2\n0\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n0000000000000\n2413423432432\n", "4 9 66\n948394151\n570018719\n639380858\n297865879\n1 8\n0 9\n-3 8\...
11
[ "PYTHON3" ]
2
2
code_contests
41b762cac2de866564f976528010ce3a
618_B. Guess the Permutation
Bob has a permutation of integers from 1 to n. Denote this permutation as p. The i-th element of p will be denoted as pi. For all pairs of distinct integers i, j between 1 and n, he wrote the number ai, j = min(pi, pj). He writes ai, i = 0 for all integer i from 1 to n. Bob gave you all the values of ai, j that he wro...
{"inputs": ["2\n0 1\n1 0\n", "5\n0 2 2 1 2\n2 0 4 1 3\n2 4 0 1 3\n1 1 1 0 1\n2 3 3 1 0\n", "10\n0 1 5 2 5 3 4 5 5 5\n1 0 1 1 1 1 1 1 1 1\n5 1 0 2 6 3 4 6 6 6\n2 1 2 0 2 2 2 2 2 2\n5 1 6 2 0 3 4 8 8 7\n3 1 3 2 3 0 3 3 3 3\n4 1 4 2 4 3 0 4 4 4\n5 1 6 2 8 3 4 0 9 7\n5 1 6 2 8 3 4 9 0 7\n5 1 6 2 7 3 4 7 7 0\n", "4\n0 1 3 2...
8
[ "PYTHON3" ]
2
2
code_contests
119667258f49b108f01a04d12ddb9903
638_D. Three-dimensional Turtle Super Computer
A super computer has been built in the Turtle Academy of Sciences. The computer consists of n·m·k CPUs. The architecture was the paralellepiped of size n × m × k, split into 1 × 1 × 1 cells, each cell contains exactly one CPU. Thus, each CPU can be simultaneously identified as a group of three numbers from the layer nu...
{"inputs": ["1 1 10\n0101010101\n", "2 2 3\n000\n000\n\n111\n111\n", "3 3 3\n111\n111\n111\n\n111\n111\n111\n\n111\n111\n111\n", "1 1 3\n111\n", "1 3 1\n1\n1\n1\n", "3 1 1\n1\n\n1\n\n1\n", "3 1 1\n1\n\n0\n\n1\n", "1 1 3\n011\n", "1 3 1\n1\n0\n1\n", "6 8 3\n011\n001\n000\n100\n111\n110\n100\n100\n\n000\n100\n011\n001\n0...
10
[ "PYTHON3" ]
2
2
code_contests
5a22137b431a9ced2c763e7adac23ac4
666_B. World Tour
A famous sculptor Cicasso goes to a world tour! Well, it is not actually a world-wide. But not everyone should have the opportunity to see works of sculptor, shouldn't he? Otherwise there will be no any exclusivity. So Cicasso will entirely hold the world tour in his native country — Berland. Cicasso is very devoted ...
{"inputs": ["8 9\n1 2\n2 3\n3 4\n4 1\n4 5\n5 6\n6 7\n7 8\n8 5\n", "4 15\n1 2\n1 4\n1 2\n1 4\n1 1\n1 3\n2 1\n2 4\n3 1\n3 2\n4 1\n4 2\n4 2\n4 4\n4 3\n", "4 3\n3 2\n2 1\n1 4\n", "4 14\n1 3\n1 1\n2 4\n2 2\n2 3\n2 4\n2 1\n3 3\n3 1\n3 4\n3 4\n4 1\n4 4\n4 1\n", "4 6\n1 2\n1 3\n1 4\n2 3\n3 4\n4 2\n", "9 20\n2 5\n3 2\n3 4\n4 8\...
8
[ "PYTHON3" ]
2
2
code_contests
656126f55e965bfd2d7288e83dfad62a
690_A1. Collective Mindsets (easy)
Tonight is brain dinner night and all zombies will gather together to scarf down some delicious brains. The artful Heidi plans to crash the party, incognito, disguised as one of them. Her objective is to get away with at least one brain, so she can analyze the zombies' mindset back home and gain a strategic advantage. ...
{"inputs": ["1\n", "4\n", "1000000000\n", "536870912\n", "16\n", "6\n", "18\n", "13\n", "20\n", "7\n", "10\n", "8\n", "2\n", "21736\n", "12\n", "9\n", "9999\n", "873467\n", "536870910\n", "17\n", "4124980\n", "15\n", "5\n", "876543210\n", "987654321\n", "3\n", "14\n", "100\n", "19\n", "11\n", "1001000000\n", "307584080...
7
[ "PYTHON3" ]
2
2
code_contests
95b40342c1a747c2a6c8aa09b4659acf
712_D. Memory and Scores
Memory and his friend Lexa are competing to get higher score in one popular computer game. Memory starts with score a and Lexa starts with score b. In a single turn, both Memory and Lexa get some integer in the range [ - k;k] (i.e. one integer among - k, - k + 1, - k + 2, ..., - 2, - 1, 0, 1, 2, ..., k - 1, k) and add...
{"inputs": ["1 2 2 1\n", "1 1 1 2\n", "2 12 3 1\n", "38 38 701 74\n", "10 10 1000 100\n", "2 56 438 41\n", "40 94 510 53\n", "69 69 443 53\n", "60 60 86 51\n", "40 40 955 95\n", "14 47 184 49\n", "3 7 8 6\n", "81 13 607 21\n", "1 8 1 4\n", "45 54 4 5\n", "5 3 1 1\n", "99 99 913 42\n", "44 80 814 26\n", "35 79 128 21\n"...
10
[ "PYTHON3" ]
2
2
code_contests
cdcb646bc9961e6a32cc1a57cc638de5
733_C. Epidemic in Monstropolis
There was an epidemic in Monstropolis and all monsters became sick. To recover, all monsters lined up in queue for an appointment to the only doctor in the city. Soon, monsters became hungry and began to eat each other. One monster can eat other monster if its weight is strictly greater than the weight of the monste...
{"inputs": ["5\n1 1 1 3 3\n3\n2 1 6\n", "6\n1 2 2 2 1 2\n2\n5 5\n", "5\n1 2 3 4 5\n1\n15\n", "3\n2 1 3\n1\n6\n", "3\n3 2 1\n1\n6\n", "3\n1 2 2\n1\n5\n", "2\n1 1\n1\n1\n", "5\n1 2 3 4 5\n3\n1 2 3\n", "5\n3 3 2 2 1\n2\n8 3\n", "3\n3 2 5\n1\n10\n", "6\n2 1 2 2 1 2\n2\n5 5\n", "2\n5 5\n1\n5\n", "14\n5 5 5 5 4 4 4 3 3 3 4 4...
9
[ "PYTHON3" ]
2
2
code_contests
8582439be556720f0a66c7a2f3fc6ca1
757_D. 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 gym ...
{"inputs": ["4\n1011\n", "2\n10\n", "75\n010110111011010010011101000010001010011111100101000101001100110010001010100\n", "75\n111111111111111111111111111111111111111111111111111111111111111111111111111\n", "60\n001100010011100010101011000011101010111101011101111101001001\n", "75\n000000000100000000000000001000000101000...
10
[ "PYTHON3" ]
2
2
code_contests
f5b6c108436a5416c903fd979966766d
779_A. Pupils Redistribution
In Berland each high school student is characterized by academic performance — integer value between 1 and 5. In high school 0xFF there are two groups of pupils: the group A and the group B. Each group consists of exactly n students. An academic performance of each student is known — integer value between 1 and 5. Th...
{"inputs": ["6\n1 1 1 1 1 1\n5 5 5 5 5 5\n", "4\n5 4 4 4\n5 5 4 5\n", "9\n3 2 5 5 2 3 3 3 2\n4 1 4 1 1 2 4 4 1\n", "1\n5\n3\n", "100\n3 4 5 3 5 4 5 4 4 4 2 4 5 4 3 2 3 4 3 5 2 5 2 5 4 3 4 2 5 2 5 3 4 5 2 5 4 2 4 5 4 3 2 4 4 5 2 5 5 3 3 5 2 4 4 2 3 3 2 5 5 5 2 4 5 5 4 2 2 5 3 3 2 4 4 2 4 5 5 2 5 5 3 2 5 2 4 4 3 3 5 4 5 ...
7
[ "PYTHON3" ]
2
2
code_contests
8e5826fe5a4b5e208d8d25e687f363a4
802_I. Fake News (hard)
Now that you have proposed a fake post for the HC2 Facebook page, Heidi wants to measure the quality of the post before actually posting it. She recently came across a (possibly fake) article about the impact of fractal structure on multimedia messages and she is now trying to measure the self-similarity of the message...
{"inputs": ["4\naa\nabcd\nccc\nabcc\n", "1\na\n", "10\ncclbvczicnbrvrzzcvtp\nqpppmppmwppoypywqbxi\nfoftxsfvvdoxffvfslsp\najddklkkladeqjqmkmlq\ncmxmhccmrrccmoxpyfpf\nknnadqaoxaoxmnmexodo\nnbwtjvwsluntlwplnwbn\nbbrpsovbuuwvfsrzfuru\nfhntkhwunnsfhknnnwfn\nxxxxcxdkakxnankxfndx\n", "10\ncccjcuuquj\nhththataff\nyywwywyndy\nr...
15
[ "PYTHON3" ]
2
2
code_contests
3104eb81cea5deb7ad67ce5818c7e678
825_E. Minimal Labels
You are given a directed acyclic graph with n vertices and m edges. There are no self-loops or multiple edges between any pair of vertices. Graph can be disconnected. You should assign labels to all vertices in such a way that: * Labels form a valid permutation of length n — an integer sequence such that each integ...
{"inputs": ["3 3\n1 2\n1 3\n3 2\n", "4 5\n3 1\n4 1\n2 3\n3 4\n2 4\n", "5 4\n3 1\n2 1\n2 3\n4 5\n", "2 1\n2 1\n", "100 10\n73 55\n29 76\n15 12\n94 46\n77 67\n76 16\n72 50\n41 40\n89 75\n27 22\n", "5 10\n5 2\n4 1\n2 1\n3 4\n2 4\n3 2\n5 4\n3 5\n3 1\n5 1\n", "100 10\n73 41\n29 76\n15 12\n94 46\n77 67\n76 16\n72 50\n41 40\n...
11
[ "PYTHON3" ]
2
2
code_contests
27e628044f6165fcea58a62f3b68fae5
848_C. Goodbye Souvenir
I won't feel lonely, nor will I be sorrowful... not before everything is buried. A string of n beads is left as the message of leaving. The beads are numbered from 1 to n from left to right, each having a shape numbered by integers between 1 and n inclusive. Some beads may have the same shapes. The memory of a shape ...
{"inputs": ["7 5\n1 3 2 1 4 2 3\n1 1 4\n2 2 3\n1 1 7\n2 4 5\n1 1 7\n", "7 6\n1 2 3 1 3 2 1\n2 3 7\n2 1 3\n1 7 2\n1 3 2\n2 1 6\n2 5 7\n", "10 10\n8 10 1 4 4 2 1 2 10 1\n1 5 6\n1 6 8\n1 6 1\n1 10 5\n1 5 8\n1 2 8\n2 5 6\n2 1 5\n2 1 2\n2 5 8\n", "1 1\n1\n2 1 1\n", "7 6\n1 2 3 1 3 2 1\n2 3 7\n2 1 3\n1 7 2\n1 2 2\n2 1 6\n2 5...
9
[ "PYTHON3" ]
2
2
code_contests
455e6c4671eead808c08f59c3af9f3f9
870_A. Search for Pretty Integers
You are given two lists of non-zero digits. Let's call an integer pretty if its (base 10) representation has at least one digit from the first list and at least one digit from the second list. What is the smallest positive pretty integer? Input The first line contains two integers n and m (1 ≤ n, m ≤ 9) — the length...
{"inputs": ["8 8\n1 2 3 4 5 6 7 8\n8 7 6 5 4 3 2 1\n", "2 3\n4 2\n5 7 6\n", "4 3\n1 3 5 9\n2 8 9\n", "1 2\n5\n2 5\n", "2 4\n8 9\n1 2 3 9\n", "9 9\n9 8 7 6 5 4 3 2 1\n9 8 7 6 5 4 3 2 1\n", "2 2\n1 5\n2 5\n", "3 2\n4 5 6\n1 5\n", "9 9\n5 4 3 2 1 6 7 8 9\n3 2 1 5 4 7 8 9 6\n", "3 3\n3 5 6\n1 5 9\n", "3 3\n2 4 9\n7 8 9\n",...
7
[ "PYTHON3" ]
2
2
code_contests
12c7465be2c08de439c6f48b6a90b9b6
896_E. Welcome home, Chtholly
— I... I survived. — Welcome home, Chtholly. — I kept my promise... — I made it... I really made it! After several days of fighting, Chtholly Nota Seniorious miraculously returned from the fierce battle. As promised, Willem is now baking butter cake for her. However, although Willem is skilled in making dessert, ...
{"inputs": ["5 6\n1 5 5 5 8\n2 2 5 5\n1 2 4 3\n2 2 5 2\n2 2 5 5\n1 3 5 1\n2 1 5 1\n", "8 13\n75 85 88 100 105 120 122 128\n1 1 8 70\n2 3 8 30\n1 3 8 3\n2 2 5 15\n1 2 4 10\n2 1 5 5\n1 2 7 27\n2 1 5 5\n1 3 7 12\n1 1 7 4\n2 1 8 1\n1 4 8 5\n2 1 8 1\n", "7 7\n1 9 2 6 8 1 7\n2 1 7 1\n2 2 5 2\n1 4 7 7\n2 2 4 2\n1 3 4 5\n2 3 3...
11
[ "PYTHON3" ]
2
2
code_contests
7786bbf62f380717e94d1583d393d73b
918_A. Eleven
Eleven wants to choose a new name for herself. As a bunch of geeks, her friends suggested an algorithm to choose a name for her. Eleven wants her name to have exactly n characters. <image> Her friend suggested that her name should only consist of uppercase and lowercase letters 'O'. More precisely, they suggested th...
{"inputs": ["8\n", "15\n", "381\n", "1000\n", "5\n", "781\n", "999\n", "805\n", "3\n", "61\n", "256\n", "512\n", "1\n", "17\n", "2\n", "933\n", "85\n", "49\n", "431\n", "9\n", "859\n", "339\n", "6\n", "7\n", "254\n", "78\n", "898\n", "136\n", "47\n", "4\n", "27\n", "485\n", "33\n", "681\n", "97\n", "10\n", "22\n", "141...
7
[ "PYTHON3" ]
2
2
code_contests
8ee5b7c67e147f05c382ced645a9f798
940_A. Points on the line
We've got no test cases. A big olympiad is coming up. But the problemsetters' number one priority should be adding another problem to the round. The diameter of a multiset of points on the line is the largest distance between two points from this set. For example, the diameter of the multiset {1, 3, 2, 1} is 2. Diame...
{"inputs": ["6 3\n1 3 4 6 9 10\n", "3 1\n2 1 4\n", "3 0\n7 7 7\n", "1 100\n22\n", "3 2\n1 50 99\n", "100 56\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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 7...
7
[ "PYTHON3" ]
2
2
code_contests
00816785acd464c405fe3648dc1d7060
967_D. Resource Distribution
One department of some software company has n servers of different specifications. Servers are indexed with consecutive integers from 1 to n. Suppose that the specifications of the j-th server may be expressed with a single integer number c_j of artificial resource units. In order for production to work, it is needed ...
{"inputs": ["4 20 32\n21 11 11 12\n", "4 11 32\n5 5 16 16\n", "6 8 16\n3 5 2 9 8 7\n", "5 12 20\n7 8 4 11 9\n", "2 1 1\n1 1000000\n", "2 1 1\n1 1\n", "2 1 2\n1 1\n", "6 8 16\n3 5 2 9 8 7\n", "15 250 200\n71 2 77 69 100 53 54 40 73 32 82 58 24 82 41\n", "4 12 11\n4 4 6 11\n", "2 1 1\n1000000000 1000000000\n", "2 1 2\n1 ...
10
[ "PYTHON3" ]
2
2
code_contests
b5267b19035481f4850c36cd3e1c9150
993_D. Compute Power
You need to execute several tasks, each associated with number of processors it needs, and the compute power it will consume. You have sufficient number of analog computers, each with enough processors for any task. Each computer can execute up to one task at a time, and no more than two tasks total. The first task ca...
{"inputs": ["6\n8 10 9 9 8 10\n1 1 1 1 1 1\n", "6\n8 10 9 9 8 10\n1 10 5 5 1 10\n", "5\n21581303 73312811 99923326 93114466 53291492\n32 75 75 33 5\n", "10\n7 9 8 9 4 8 5 2 10 5\n6 6 7 8 9 7 10 1 1 7\n", "50\n2 10 10 6 8 1 5 10 3 4 3 5 5 8 4 5 8 2 3 3 3 8 8 5 5 5 5 8 2 5 1 5 4 8 3 7 10 8 6 1 4 9 4 9 1 9 2 7 9 9\n10 6 2...
10
[ "PYTHON3" ]
2
2
code_contests
fc68064f7600511bdee0494ff478a8f5
attack-or-be-attacked
You are given an NxM chessboard. Find the number of pairs of different positions of a bishop and a PQ-knight where they don't attack each other modulo 10^9 + 7. A bishop can move to square if it's on the same diagonal with it. A PQ-knight with given integers P and Q (P doesn't equals Q) can move to the square if the ...
{"inputs": ["2 5 1 2\n\nSAMPLE", "92891 8181 398 787", "1 10 3 4"], "outputs": ["62", "353972355", "90"]}
0
[ "PYTHON3" ]
3
2
code_contests
44b9396e187db9904b03c85f94ff738a
chintu-and-his-girlfriend
Like other girlfriends Chintu's girlfriend is also very demanding. This time she is demanding for bracelet having atleast k special beads. A bracelet is composed of N strands. Each strand can have any number of beads and each bead has a letter engraved on it. A bead is called a special bead if the letter engraved on it...
{"inputs": ["3 2\nabcde\naabaa\nasdba\n\nSAMPLE", "46 2\nymivskswbowdlmyctckjfnmagbhvoucvtfjxbhyymxbfju\naxasehtiojbldsutdlgsblytjflcqqdcwgou\nituvqxeukxkpufrijyaerhhgu\nybitfkyuvfsrthawrgvjkoitdugua\nklaaprrnbrfjiwjawcfwxeexdubtvutjwplscuovbhtbjcytbxnvjauu\nnfouyprrydhuehcbemulvbmdjkaspmixnupkuejfkqevkbnu\nonjwyounhvj...
0
[ "PYTHON3" ]
3
2
code_contests
2c4e150e4d25790095cbb83371a74047
dummy-3-1
In this problem, you are given list of N numbers from 1 to N. They may be written in any order. You are to create a special list out of the given list. It should be such that the position of integer i is the i-th number in the given list. We will call this new list an inverse list. If the given list is an inverse list ...
{"inputs": ["2\n3\n3 1 2\n3\n1 2 3\n\nSAMPLE", "35\n44\n31 39 40 21 12 32 7 35 2 20 15 4 33 9 27 29 42 17 25 10 37 18 8 1 34 44 6 26 5 23 41 36 28 16 13 14 43 11 19 38 3 22 24 30 \n19\n18 2 9 14 6 15 10 7 5 4 19 17 3 12 16 11 1 8 13 \n52\n17 42 3 33 11 2 32 44 8 6 43 15 4 51 40 28 38 25 21 46 20 18 29 19 52 23 36 12 24...
0
[ "PYTHON3" ]
3
2
code_contests
03bd78e84153288a9cbff79cf86cade7
guess-the-permutation-easy-contest
In this problem your goal is to guess some secret permutation A of integers from 1 to 16. There are 17 tests in this problem. Test number i for 1 ≤ i ≤ 16 will have the following form: the first line of the input contains string "ELEMENT" (without quotes) the second line of the input of the test i contains two intege...
{"inputs": ["ELEMENT\n1 13", "ELEMENT\n6 4", "ELEMENT\n2 15", "ELEMENT\n9 2", "ELEMENT\n16 3", "ELEMENT\n4 6"], "outputs": ["13\n", "4\n", "15\n", "2\n", "3\n", "6\n"]}
0
[ "PYTHON3" ]
3
2
code_contests
1f0119c3fd147e813cd4cfd04a6727b9
little-stuart-and-evil-hackers-2
Evil hackers are trying to hack the database of HackerEarth.com. After a lot of work they figure out that the encryption key used by HackerEarth to securely store the data is really just a random large number. After a bit more work they figure out that the key is in form of a^b( a power b). So now they call in the evil...
{"inputs": ["4\n1 2\n1 1\n2 1\n2 3\n\nSAMPLE", "1000\n73004 67426\n91627 69478\n61297 68278\n24234 83945\n47637 96401\n94242 97144\n85353 14705\n99269 44776\n88928 91446\n52876 40296\n37601 12385\n93013 8451\n18937 66949\n7883 75710\n6581 60221\n4664 95936\n43998 12643\n65414 5294\n80920 5999\n5590 44908\n18751 99831\n...
0
[ "PYTHON3" ]
3
2
code_contests
c58c64f732971b46bd6fca2482f35c06
mystery-12
Lets think of an infinite series of numbers such that the difference between any two consecutive numbers is d. Let the first number in the sequence be a. Now your task is to find the multiple that occurs first in the sequence of a given number n and print its index in the output. Input 1st line T denoting test cases....
{"inputs": ["2\n5 6\n7\n4 9\n11\n\nSAMPLE", "10\n844452700697263162 119646220083568392\n617\n624716331013886830 420232882599498616\n263\n371747750780382310 31328662274583882\n151\n155589359406144136 349833477687741817\n263\n890649303306320035 470504750916794312\n509\n172858306891107873 404374317528704778\n179\n48689731...
0
[ "PYTHON3" ]
3
2
code_contests
bf016ece42cd6317648a8d6d8292a5d0
primestring
Alice has just learnt about primeStrings. A string is a primeString if the number of distinct alphabets used in the string is a prime and also the number of occurrences of each alphabet in the string is also a prime. Given a String you need to tell if it is a primeString or not. Input: First line contains T which is t...
{"inputs": ["3\nababb\nabcab\naabbccdd\n\nSAMPLE", "3\nababb\nabcab\naabbccdd\n\nS@MPLE", "3\nababc\nabcab\nddccbbaa\n\nS@MPLE", "3\nababc\nbabba\ndcdcbbaa\n\nS@MPLE", "3\naabbb\nbabba\naabbccdd\n\nEAMOSL", "3\nbbaba\nabcbc\nccbcbbaa\n\nSM>OLD", "3\ncbaac\nbacab\nacaccadd\n\nELPM@S", "3\nababb\nabcab\nddccbbaa\n\nS@MPL...
0
[ "PYTHON3" ]
3
2
code_contests
f0cdb1514f5617dd6c6b818c214ea625
saxie-and-strings
Saxie is a programming enthusiast. He has always been amazed by the beauty of strings. He always dreams of going to Byteland and playing with strings. One day he had a nightmare that Dr. Evil had attacked the strings. When he came forward to protect the strings, Dr. Evil asked him if every substring of S has its revers...
{"inputs": ["2\naba\nax\n\nSAMPLE", "2\naba\nxa\n\nSAMPLE", "2\naab\n`x\n\nTAMPLE", "2\naba\nx`\n\nSAMPLE", "2\naba\n`x\n\nSAMPLE", "2\naba\n`x\n\nTAMPLE", "2\naab\nx`\n\nTAMPLE", "2\nbaa\nx`\n\nTAMPLE", "2\naab\nxa\n\nTAMPLE", "2\nbaa\nxa\n\nTAMPLE", "2\nbaa\nxa\n\nTMAPLE", "2\nbaa\nxb\n\nTMAPLE", "2\nbaa\nxb\n\nELPAM...
0
[ "PYTHON3" ]
3
2
code_contests
835c3cbdd7847e580b52a64a19122fba
tablets
Therasa is a Nurse. She wants to give some tablets to the patients in her practice. All the patients sit in a line and each of them has a rating score according to his or her health score. Therasa wants to give at least 1 tablet for each patient. Patients get jealous of their immediate neighbors, so if two patients s...
{"inputs": ["3\n1\n2\n2\n\nSAMPLE", "3\n1\n2\n2", "3\n2\n2\n2", "3\n1\n2\n2\n\nSAMPME", "3\n2\n0\n2\n\nSAMPME", "3\n2\n1\n0\n\nSAMQLE", "3\n2\n2\n4", "3\n2\n2\n2\n\nSAMPME", "3\n1\n3\n2\n\nSAMPME", "3\n1\n3\n2\n\nSAMPLE", "3\n1\n3\n2\n\nSAMQLE", "3\n1\n1\n2\n\nSAMQLE", "3\n1\n1\n2\n\nELQMAS", "3\n1\n1\n3\n\nELQMAS", "3...
0
[ "PYTHON3" ]
3
2
code_contests
44088a67d4932fd992920f41a5954682
who-will-survive-in-the-end
Ali baba did a trick on the forty thieves and was able to trap them inside a big cave which was the home of wild wolves. The thieves are without any weapons, only the chief of the thieves has knife. With no weapons they will not be able to fight with the wolves, so they decide to kill themselves rather than being eate...
{"inputs": ["4\n5\n11\n45\n23987443\n\nSAMPLE", "4\n5\n11\n45\n28960650\n\nSAMPLE", "4\n5\n11\n45\n19738501\n\nSAMPLE", "4\n5\n6\n45\n19738501\n\nSAMPLE", "4\n5\n6\n73\n19738501\n\nRALPME", "4\n5\n6\n73\n28777926\n\nRALPME", "4\n7\n6\n73\n28777926\n\nEMPLAR", "4\n7\n6\n88\n28777926\n\nEMPLAR", "4\n7\n6\n88\n10757916\n\...
0
[ "PYTHON3" ]
3
2
code_contests
de91f1f3210c8514411c9af946686604
p02630 AtCoder Beginner Contest 171 - Replacing
You have a sequence A composed of N positive integers: A_{1}, A_{2}, \cdots, A_{N}. You will now successively do the following Q operations: * In the i-th operation, you replace every element whose value is B_{i} with C_{i}. For each i (1 \leq i \leq Q), find S_{i}: the sum of all elements in A just after the i-th...
{"inputs": ["2\n1 2\n3\n1 100\n2 100\n100 1000", "4\n1 2 3 4\n3\n1 2\n3 4\n2 4", "4\n1 1 1 1\n3\n1 2\n2 1\n3 5", "4\n1 2 3 3\n3\n1 2\n3 4\n2 4", "4\n2 1 1 1\n3\n1 2\n2 1\n3 5", "4\n1 2 3 3\n3\n1 2\n3 4\n0 4", "4\n0 1 1 1\n3\n1 2\n2 1\n3 5", "4\n1 3 3 3\n3\n1 2\n3 4\n0 4", "4\n1 3 4 3\n3\n1 2\n3 4\n0 4", "4\n0 1 1 1\n3\...
0
[ "PYTHON3" ]
5
2
code_contests
94ab984516205d03e5a883be21fdeff3
p02761 AtCoder Beginner Contest 157 - Guess The Number
If there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print `-1`. * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.) * The s_i-th digit from the left is c_i. \left(i ...
{"inputs": ["3 1\n1 0", "3 3\n1 7\n3 2\n1 7", "3 2\n2 1\n2 3", "3 3\n1 14\n3 2\n1 7", "3 0\n2 1\n2 3", "3 1\n2 1\n1 3", "3 1\n0 1\n1 0", "3 3\n1 7\n3 4\n1 7", "3 2\n2 0\n1 3", "3 3\n0 2\n3 2\n1 1", "3 2\n3 0\n2 6", "1 1\n0 1\n1 0", "2 1\n0 1\n1 0", "2 0\n0 0\n2 3", "3 3\n2 7\n3 2\n1 1", "3 2\n2 0\n3 6", "3 1\n2 2\n1 0"...
0
[ "PYTHON3" ]
5
2
code_contests
d1910e65c83908f5c27b56e26972bdab
p02896 AtCoder Grand Contest 039 - Min Product Sum
For each of the K^{NM} ways to write an integer between 1 and K (inclusive) in every square in a square grid with N rows and M columns, find the value defined below, then compute the sum of all those K^{NM} values, modulo D. * For each of the NM squares, find the minimum among the N+M-1 integers written in the square'...
{"inputs": ["2 3 4 998244353", "31 41 59 998244353", "2 2 2 998244353", "2 3 2 998244353", "31 27 59 998244353", "2 5 2 998244353", "36 27 59 998244353", "2 5 3 998244353", "36 48 59 998244353", "1 5 3 998244353", "36 48 23 998244353", "1 4 3 998244353", "36 83 23 998244353", "34 83 23 998244353", "14 83 23 998244353",...
0
[ "PYTHON3" ]
5
2
code_contests
8521d361a1c6a8b93aee9d8e07742c29
p03031 AtCoder Beginner Contest 128 - Switches
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M. Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are "on" among these switches is congruent to p_i modulo 2. How ...
{"inputs": ["2 2\n2 1 2\n1 2\n0 1", "5 2\n3 1 2 5\n2 2 3\n1 0", "2 3\n2 1 2\n1 1\n1 2\n0 0 1", "2 2\n2 1 2\n1 2\n0 0", "4 2\n2 1 2\n1 2\n0 1", "5 2\n1 1 2 5\n2 2 3\n1 0", "2 3\n2 1 2\n1 1\n1 2\n0 0 -1", "4 0\n1 1 2\n1 2\n0 1", "1 0\n0 1 4\n1 1\n0 1\n0 0 -1", "9 2\n3 1 2 5\n2 2 3\n1 0", "7 2\n2 1 2\n1 1\n0 1", "8 0\n2 1...
0
[ "PYTHON3" ]
5
2
code_contests
7ba0441f408655041f8c211ebac17c33
p03172 Educational DP Contest - Candies
There are N children, numbered 1, 2, \ldots, N. They have decided to share K candies among themselves. Here, for each i (1 \leq i \leq N), Child i must receive between 0 and a_i candies (inclusive). Also, no candies should be left over. Find the number of ways for them to share candies, modulo 10^9 + 7. Here, two way...
{"inputs": ["2 0\n0 0", "1 10\n9", "4 100000\n100000 100000 100000 100000", "3 4\n1 2 3", "1 10\n17", "4 100000\n101000 100000 100000 100000", "1 10\n3", "4 101000\n101000 100000 100100 101000", "4 110000\n101000 100000 100000 100000", "4 100100\n101000 100000 100100 101000", "4 001000\n101000 100000 100100 101000", "4...
0
[ "PYTHON3" ]
5
2
code_contests
b90e9835b179e0dae466b4d33bdd5913
p03318 AtCoder Beginner Contest 101 - Snuke Numbers
Let S(n) denote the sum of the digits in the decimal notation of n. For example, S(123) = 1 + 2 + 3 = 6. We will call an integer n a Snuke number when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds. Given an integer K, list the K smallest Snuke numbers. Constraints * 1 \leq K...
{"inputs": ["10", "18", "7", "5", "8", "2", "6", "15", "4", "1", "11", "17", "3", "12", "9", "13", "20", "16", "14", "23", "29", "22", "35", "25", "26", "28", "41", "37", "31", "19", "21", "44", "72", "52", "24", "47", "54", "113", "63", "30", "39", "175", "36", "42", "43", "46", "32", "33", "51", "64", "34", "40", "27...
0
[ "PYTHON3" ]
5
2
code_contests
9bbf190ed68ef1bc1d0feb28e0c50898
p03474 AtCoder Beginner Contest 084 - Postal Code
The postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are digits from `0` through `9`. You are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom. Constraints * 1≤A,B≤5 * |S|=A+B+1 * S consists of `-` and di...
{"inputs": ["1 2\n7444", "3 4\n269-6650", "1 1\n---", "2 2\n7444", "6 4\n269-6650", "1 2\n---", "0 2\n7444", "6 8\n269-6650", "1 0\n---", "0 2\n5343", "6 1\n269-6650", "1 0\n-,-", "0 1\n5343", "6 2\n269-6650", "1 0\n-+-", "-1 1\n5343", "6 2\n0566-962", "1 -1\n-+-", "-1 1\n10506", "6 3\n0566-962", "0 -1\n-+-", "-1 1\n17...
0
[ "PYTHON3" ]
5
2
code_contests
3e6becd9a8b98f58b69e7c4d18378f73
p03637 AtCoder Beginner Contest 069 - 4-adjacent
We have a sequence of length N, a = (a_1, a_2, ..., a_N). Each a_i is a positive integer. Snuke's objective is to permute the element in a so that the following condition is satisfied: * For each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4. Determine whether Snuke can achieve his objective. ...
{"inputs": ["6\n2 7 1 8 2 8", "3\n1 4 1", "3\n1 10 100", "2\n1 1", "4\n1 2 3 4", "6\n2 7 2 8 2 8", "3\n-1 1 1", "3\n0 4 1", "3\n2 10 100", "4\n2 2 3 4", "6\n4 7 2 8 2 8", "3\n0 1 1", "3\n0 10 100", "4\n0 2 3 4", "6\n6 7 2 8 2 8", "3\n0 11 100", "4\n0 2 3 7", "6\n6 7 0 8 2 8", "3\n-1 1 0", "3\n0 11 101", "6\n6 7 0 8 2 5...
0
[ "PYTHON3" ]
5
2
code_contests
bab464fbd5b08c769b114e4f633c232c
p03794 Mujin Programming Challenge 2017 - Oriented Tree
There is a tree T with N vertices, numbered 1 through N. For each 1 ≤ i ≤ N - 1, the i-th edge connects vertices a_i and b_i. Snuke is constructing a directed graph T' by arbitrarily assigning direction to each edge in T. (There are 2^{N - 1} different ways to construct T'.) For a fixed T', we will define d(s,\ t) fo...
{"inputs": ["4\n1 2\n2 3\n3 4", "10\n2 4\n2 5\n8 3\n10 7\n1 6\n2 8\n9 5\n8 6\n10 6", "4\n1 2\n1 3\n1 4", "6\n1 2\n1 3\n1 4\n2 5\n2 6", "10\n2 4\n2 5\n1 3\n10 7\n1 6\n2 8\n9 5\n8 6\n10 6", "4\n1 2\n1 3\n2 4", "10\n2 4\n2 5\n1 3\n3 7\n1 6\n2 8\n9 5\n8 6\n10 6", "10\n2 4\n2 5\n8 3\n10 7\n1 6\n2 8\n9 7\n8 6\n10 6", "10\n2 ...
0
[ "PYTHON3" ]
5
2
code_contests
5a6cfa116712ce6a6ec6c1b22b4044c6
p03963 AtCoder Beginner Contest 046 - Painting Balls with AtCoDeer
There are N balls placed in a row. AtCoDeer the deer is painting each of these in one of the K colors of his paint cans. For aesthetic reasons, any two adjacent balls must be painted in different colors. Find the number of the possible ways to paint the balls. Constraints * 1≦N≦1000 * 2≦K≦1000 * The correct answer i...
{"inputs": ["2 2", "1 10", "1 2", "1 1", "1 4", "1 8", "0 8", "0 13", "0 7", "0 12", "1 12", "1 3", "0 3", "0 0", "0 -1", "1 -1", "1 0", "-1 -1", "-2 -1", "-3 -1", "-3 0", "1 -2", "2 3", "0 -2", "0 4", "2 8", "0 5", "0 9", "-1 4", "1 15", "1 9", "4 3", "0 6", "3 -1", "-1 -2", "1 -3", "0 -3", "-2 -2", "4 4", "-1 -3", "2...
0
[ "PYTHON3" ]
5
2
code_contests
daaa520ead92a0ba70ed411181b94968
p00054 Sum of Nth decimal places
Assume that a, b, and n are all positive integers. Let f (i) be the i-th fraction of the fraction a / b (0 ≤ f (i) ≤ 9). At this time, let s be the sum of f (i) from i = 1 to n. s = f (1) + f (2) + ... + f (n) Create a program that reads a, b, n, outputs s, and exits. Input The input consists of multiple dataset...
{"inputs": ["1 2 3\n2 3 4\n5 4 3\n4 3 2", "1 2 1\n2 3 4\n5 4 3\n4 3 2", "1 2 1\n2 3 4\n5 4 3\n7 4 2", "1 2 1\n2 3 2\n5 4 3\n7 3 2", "1 2 1\n2 3 3\n5 4 3\n7 3 2", "1 2 1\n2 4 3\n5 4 3\n7 3 2", "1 2 1\n2 4 3\n5 4 3\n7 3 1", "1 2 1\n2 4 3\n5 1 3\n7 3 1", "2 2 1\n2 4 3\n5 1 3\n7 3 1", "2 1 1\n2 4 2\n5 1 3\n8 3 1", "2 1 1\n...
0
[ "PYTHON3" ]
6
2
code_contests
4f193ec1af17fac25efe0fa7a9f4a06a
p00184 Tsuruga Castle
Tsuruga Castle, a symbol of Aizuwakamatsu City, was named "Tsuruga Castle" after Gamo Ujisato built a full-scale castle tower. You can overlook the Aizu basin from the castle tower. On a clear day, you can see Tsuruga Castle from the summit of Mt. Iimori, which is famous for Byakkotai. <image> We decided to conduct...
{"inputs": ["8\n71\n34\n65\n11\n41\n39\n6\n5\n4\n67\n81\n78\n65\n0", "8\n71\n34\n65\n11\n41\n39\n3\n5\n4\n67\n81\n78\n65\n0", "8\n71\n34\n65\n11\n12\n39\n6\n5\n4\n67\n81\n78\n65\n0", "8\n71\n34\n65\n0\n41\n39\n3\n5\n4\n67\n81\n78\n65\n0", "8\n71\n34\n65\n11\n12\n39\n6\n5\n4\n16\n81\n78\n65\n0", "8\n71\n34\n65\n0\n41\n3...
0
[ "PYTHON3" ]
6
2
code_contests
152287be8f41521b4a4a2b353012ebd1
p00340 Rectangle
The educational program (AHK Education) of the Aiz Broadcasting Association broadcasts a handicraft program for children, "Play with Tsukuro". Today is the time to make a rectangle with sticks, but I would like to see if I can make a rectangle using the four sticks I prepared. However, the stick must not be cut or brok...
{"inputs": ["1 1 2 2", "4 4 4 10", "2 1 1 2", "1 1 3 4", "0 1 2 2", "0 0 2 2", "0 4 4 10", "2 0 1 2", "1 1 0 4", "-1 1 2 2", "1 4 4 10", "2 0 2 2", "1 1 0 6", "-1 4 4 10", "2 0 2 4", "0 1 0 6", "-1 0 2 2", "-1 1 4 10", "2 0 3 4", "0 1 1 6", "-1 0 3 2", "-2 1 4 10", "2 0 3 2", "0 0 0 6", "-2 1 8 10", "2 0 4 2", "0 -1 0 ...
0
[ "PYTHON3" ]
6
2
code_contests
0aed8f164cb91d42ed6644f4b9cc732f
p00534 Silk Road
problem In the area where Kazakhstan is now located, there used to be a trade route called the "Silk Road". There are N + 1 cities on the Silk Road, numbered from west as city 0, city 1, ..., city N. The distance between city i -1 and city i (1 ≤ i ≤ N) is Di. JOI, a trader, decided to start from city 0, go through ...
{"inputs": ["3 5\n10\n25\n15\n50\n30\n15\n40\n30", "3 5\n10\n25\n15\n50\n30\n6\n40\n30", "3 5\n10\n38\n15\n50\n30\n6\n40\n30", "3 5\n10\n38\n7\n50\n30\n6\n40\n30", "1 5\n10\n38\n7\n50\n30\n6\n40\n30", "3 5\n10\n25\n15\n50\n30\n15\n12\n30", "3 5\n1\n25\n15\n50\n30\n6\n40\n30", "3 5\n10\n38\n18\n50\n30\n6\n40\n30", "3 5\...
0
[ "PYTHON3" ]
6
2
code_contests
f21f6200f4e4c0235348cbf705aa8682
p00698 Missing Numbers
Toshizo is the manager of a convenience store chain in Hakodate. Every day, each of the stores in his chain sends him a table of the products that they have sold. Toshizo's job is to compile these figures and calculate how much the stores have sold in total. The type of a table that is sent to Toshizo by the stores lo...
{"inputs": ["3 3\n? ? 70 105\n? 50 ? 150\n30 60 90 180\n45 150 240 435\n\n2 2\n? ? 40\n? ? 40\n40 40 80\n\n2 3\n? 30 40 90\n50 60 70 180\n70 90 110 270\n\n0", "3 3\n? ? 70 105\n? 50 ? 150\n30 60 90 180\n45 150 240 435\n\n2 2\n? ? 40\n? ? 40\n40 40 80\n\n2 3\n? 30 40 90\n50 100 70 180\n70 90 110 270\n\n0", "3 3\n? ? 70 ...
0
[ "PYTHON3" ]
6
2
code_contests
35f090bee533f107b33986d404fe124b
p00839 Organize Your Train
In the good old Hachioji railroad station located in the west of Tokyo, there are several parking lines, and lots of freight trains come and go every day. All freight trains travel at night, so these trains containing various types of cars are settled in your parking lines early in the morning. Then, during the daytim...
{"inputs": ["3 5\n0W 1W\n0W 2W\n0W 2E\n0E 1E\n1E 2E\naabbccdee\n-\n-\n-\n-\nbbaadeecc\n3 3\n0E 1W\n1E 2W\n2E 0W\naabb\nbbcc\naa\nbbbb\ncc\naaaa\n3 4\n0E 1W\n0E 2E\n1E 2W\n2E 0W\nababab\n-\n-\naaabbb\n-\n-\n0 0", "3 5\n0W 1W\n0W 2W\n0W 2E\n0E 1E\n1E 2E\naabbcdcee\n-\n-\n-\n-\nbbaadeecc\n3 3\n0E 1W\n1E 2W\n2E 0W\naabb\nb...
0
[ "PYTHON3" ]
6
2
code_contests
c7f621d73ccc9d04eb5677b4d8e26c41
p00971 Shortest Common Non-Subsequence
Shortest Common Non-Subsequence A subsequence of a sequence $P$ is a sequence that can be derived from the original sequence $P$ by picking up some or no elements of $P$ preserving the order. For example, "ICPC" is a subsequence of "MICROPROCESSOR". A common subsequence of two sequences is a subsequence of both seque...
{"inputs": ["0101\n1100001", "0101\n1101001", "0101\n1100000", "0101\n1101000", "0101\n0001000", "0101\n0011001", "0101\n0110001", "0101\n1111001", "0101\n1001001", "0101\n0001101", "0101\n0101001", "0101\n0100101", "0101\n1000110", "0101\n1001010", "0101\n0110010", "0101\n0101010", "0101\n0101000", "0101\n0111000", "0...
0
[ "PYTHON3" ]
6
2
code_contests
84b03419b5ae37349e392a9d411c1cab
p01103 A Garden with Ponds
A Garden with Ponds Mr. Gardiner is a modern garden designer who is excellent at utilizing the terrain features. His design method is unique: he first decides the location of ponds and design them with the terrain features intact. According to his unique design procedure, all of his ponds are rectangular with simple ...
{"inputs": ["3 3\n2 3 2\n2 1 2\n2 3 1\n3 5\n3 3 4 3 3\n3 1 0 2 3\n3 3 4 3 2\n7 7\n1 1 1 1 1 0 0\n1 0 0 0 1 0 0\n1 0 1 1 1 1 1\n1 0 1 0 1 0 1\n1 1 1 1 1 0 1\n0 0 1 0 0 0 1\n0 0 1 1 1 1 1\n6 6\n1 1 1 1 2 2\n1 0 0 2 0 2\n1 0 0 2 0 2\n3 3 3 9 9 9\n3 0 0 9 0 9\n3 3 3 9 9 9\n0 0", "3 3\n2 3 2\n2 1 2\n2 3 1\n3 5\n3 3 4 3 3\n3...
0
[ "PYTHON3" ]
6
2
code_contests
18aaca2b9698abaa53f73d5227af41c5
p01240 Oil Company
Irving & Cohen Petroleum Corporation has decided to develop a new oil field in an area. A preliminary survey has been done and they created a detailed grid map of the area which indicates the reserve of oil. They are now planning to construct mining plants on several grid blocks according this map, but they decided no...
{"inputs": ["2\n2 2\n2 3\n3 5\n3 2\n4 1 1\n2 1 4", "2\n2 2\n2 3\n3 5\n3 2\n4 1 1\n2 1 0", "2\n2 0\n2 3\n3 5\n3 2\n4 1 1\n2 1 0", "2\n2 0\n2 3\n3 5\n3 3\n4 1 1\n2 1 0", "2\n1 1\n2 3\n3 5\n3 3\n4 1 1\n2 2 0", "2\n1 1\n2 2\n3 5\n3 3\n4 1 1\n2 2 0", "2\n1 1\n2 2\n3 5\n3 3\n6 1 1\n2 2 0", "2\n1 1\n2 3\n3 5\n5 3\n6 1 1\n4 2 ...
0
[ "PYTHON3" ]
6
2
code_contests
81b3a56bb1ecc9bffc704ffc053d64ef
p01402 Anipero
Problem E: Anipero The long and short summer, which had been hot, was about to end. One day in late August, a person who likes 2D and his senior slip participated in an event called Anipero Summer Live, commonly known as Anipero. Anipero is the largest anime song live event in Japan where various anime song artists ga...
{"inputs": ["100 2 2 2\nA 5 6\nB 7 8\nC 1 2\nD 3 4\n27 2 3 3\nA 8 10\nB 8 10\nC 6 7\nD 5 4\nE 8 9\n27 2 3 2\nA 8 10\nB 8 10\nC 6 7\nD 5 4\nE 8 9\n44 3 6 5\nYamatoNoHito 9 10\nZettoNoHito 9 10\nTMR 10 10\nSkillNoGroup 8 10\nNanaSama 6 9\nFRPSD 6 8\nMagi3rdDeshi 5 7\nMagi13thDeshi 2 2\nMagicalItoh 4 6\n0 0 0 0", "100 2 2...
0
[ "PYTHON3" ]
6
2
code_contests
daf3d962806270a7dee09a19bd39e934
p01556 ConvexCut
A convex polygon consisting of N vertices is given. The coordinates of each vertex are represented counterclockwise by (X1, Y1), (X2, Y2), ……, (XN, YN). No matter what straight line passes through the point P, find the coordinates of the point P so that the areas of the two convex polygons obtained after cutting are eq...
{"inputs": ["4\n100 100\n0 100\n0 0\n100 0", "3\n100 100\n0 100\n0 0", "4\n000 100\n0 100\n0 0\n100 0", "3\n100 100\n0 100\n1 0", "4\n000 101\n0 100\n0 0\n100 0", "3\n100 100\n0 100\n1 1", "4\n000 101\n0 000\n0 0\n100 0", "3\n100 100\n0 000\n1 1", "4\n000 101\n0 000\n0 0\n110 0", "3\n100 100\n1 000\n1 1", "4\n000 100\n...
0
[ "PYTHON3" ]
6
2
code_contests
96e9f0489b6998590e9a5fc040d3e116
p01711 Idempotent Filter
Problem Statement Let's consider operations on monochrome images that consist of hexagonal pixels, each of which is colored in either black or white. Because of the shape of pixels, each of them has exactly six neighbors (e.g. pixels that share an edge with it.) "Filtering" is an operation to determine the color of a...
{"inputs": ["00000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000111111111\n10000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111\n01010101010101010101010101010101010101010101010...
0
[ "PYTHON3" ]
6
2
code_contests
0408ac8bad276c248ba1bb312327411a
p01856 Typhoon
Problem statement There is a town with a size of H in the north-south direction and W in the east-west direction. In the town, square plots with a side length of 1 are maintained without gaps, and one house is built in each plot. A typhoon broke out over a section of the town, causing damage and then changing to an e...
{"inputs": ["7 5\n0 0 0 0 0\n0 1 1 1 0\n0 2 2 2 0\n0 3 3 3 0\n0 2 2 2 0\n0 1 1 1 0\n0 0 0 0 0", "14 5\n0 0 0 0 0\n0 1 1 1 0\n0 2 2 2 0\n0 3 3 3 0\n0 2 2 2 0\n0 1 1 1 0\n0 0 0 0 0", "10 5\n0 0 0 0 0\n0 1 1 1 0\n0 2 2 2 0\n0 3 3 3 0\n0 2 2 2 0\n0 1 1 1 0\n0 0 0 0 0", "18 5\n0 0 0 0 0\n0 1 1 1 0\n0 2 2 2 0\n0 3 3 3 0\n0 2...
0
[ "PYTHON3" ]
6
2
code_contests
73f92ba6e3a057d686f41f429b564265
p01991 Namo.. Cut
C: Namo .. Cut problem -Defeat the mysterious giant jellyfish, codenamed "Nari"- "Nari" has a very strong vitality, so if you don't keep cutting quickly, it will be revived in a blink of an eye. We are making trial and error every day to find out how to cut "Nari" efficiently. In the process, you needed the help of ...
{"inputs": ["3\n1 2\n1 3\n2 3\n1\n1 3", "3\n1 2\n1 3\n2 3\n1\n1 2", "3\n1 2\n1 3\n3 3\n1\n1 2", "3\n2 2\n1 3\n2 1\n2\n2 3", "3\n1 2\n1 3\n2 3\n2\n2 3", "3\n2 2\n1 3\n3 3\n1\n1 2", "3\n2 2\n1 3\n3 3\n1\n1 4", "3\n2 2\n1 3\n2 3\n1\n1 4", "3\n1 2\n1 1\n2 3\n1\n1 3", "3\n2 2\n1 3\n2 3\n1\n1 8", "3\n1 1\n1 1\n2 3\n1\n1 3", ...
0
[ "PYTHON3" ]
6
2
code_contests
30f3517bb740c93550d3c43442fc8c66
p02137 Special Chat
Problem The popular video posting site "ZouTube" is now in the midst of an unprecedented "virtual ZouTuber" boom. Among them, the one that has been attracting particular attention recently is the junior virtual ZouTuber "Aizumarim (commonly known as Azurim)". As a big fan of Azlim, you're going to send her a "special...
{"inputs": ["1333", "5700", "100000", "2178", "9648", "000000", "1978", "3066", "4226", "2548", "5031", "1305", "110000", "5613", "638", "3852", "10955", "7666", "6581", "12541", "6338", "12473", "9117", "4887", "15157", "21170", "10359", "38878", "45981", "35434", "18840", "36304", "52135", "46520", "79934", "19439", ...
0
[ "PYTHON3" ]
6
2
code_contests
7d8439409e167ee8507923518353cca2
p02278 Minimum Cost Sort
You are given $n$ integers $w_i (i = 0, 1, ..., n-1)$ to be sorted in ascending order. You can swap two integers $w_i$ and $w_j$. Each swap operation has a cost, which is the sum of the two integers $w_i + w_j$. You can perform the operations any number of times. Write a program which reports the minimal total cost to...
{"inputs": ["4\n4 3 2 1", "5\n1 5 3 4 2", "4\n8 3 2 1", "5\n0 5 3 4 2", "5\n0 5 3 1 2", "5\n1 8 3 4 2", "5\n0 9 3 1 2", "5\n1 8 3 4 0", "5\n0 15 3 1 2", "5\n1 5 3 8 2", "5\n0 5 6 4 2", "5\n0 5 3 1 4", "5\n0 19 3 1 2", "4\n3 5 2 1", "5\n0 5 6 4 3", "5\n0 12 3 1 4", "5\n0 17 3 1 4", "4\n4 0 2 1", "5\n0 17 3 1 8", "5\n0 1...
0
[ "PYTHON3" ]
6
2
code_contests
65d6d194ab93a87745fdc0378b70ebfa
p02425 Bit Flag
A state with $n$ flags of ON or OFF can be represented by a sequence of bits where $0, 1, ..., n-1$ -th flag corresponds to 1 (ON) or 0 (OFF). The state can be managed by the corresponding decimal integer, because the sequence of bits is a binary representation where each bit is 0 or 1. Given a sequence of bits with 6...
{"inputs": ["14\n1 0\n1 1\n1 2\n2 1\n0 0\n0 1\n0 2\n0 3\n3 3\n4\n5\n6\n7\n8", "14\n1 0\n1 1\n1 2\n2 1\n0 0\n0 1\n1 2\n0 3\n3 3\n4\n5\n6\n7\n8", "14\n1 0\n1 1\n1 2\n2 1\n0 0\n0 1\n0 2\n0 6\n3 3\n4\n5\n6\n7\n8", "14\n1 0\n1 1\n2 2\n2 1\n0 0\n0 1\n0 2\n0 6\n3 3\n4\n5\n6\n7\n8", "14\n1 0\n1 1\n1 2\n2 1\n0 0\n0 1\n0 2\n0 3\...
0
[ "PYTHON3" ]
6
2
code_contests
5fd073c65bf37186b3df4e588316b8b3
appuzzle
Arithmetic and geometric Progressions are 2 of the well known progressions in maths. Arithmetic progression (AP) is a set in which the difference between 2 numbers in constant. for eg, 1,3,5,7,9....In this series the difference between 2 numbers is 2.The task here is very simple indeed. You will be given the 3rd term ,...
{"inputs": ["1\n3 8 55", "1\n3 14 55", "1\n3 14 83", "1\n3 14 99", "1\n3 4 95", "1\n6 4 95", "1\n6 4 142", "1\n6 4 261", "1\n1 4 261", "1\n1 4 240", "1\n1 4 228", "1\n1 4 245", "1\n1 4 448", "1\n1 6 448", "1\n1 6 482", "1\n1 2 482", "1\n2 2 482", "1\n2 2 3", "1\n4 2 3", "1\n3 4 3", "1\n3 8 -1", "1\n2 1 -2", "1\n0 1 -2"...
6
[ "PYTHON3" ]
1
2
code_contests
4869e8c24c4f7b0a6eb110b7ecdea57b
cielrcpt
Tomya is a girl. She loves Chef Ciel very much. Tomya like a positive integer p, and now she wants to get a receipt of Ciel's restaurant whose total price is exactly p. The current menus of Ciel's restaurant are shown the following table. Name of Menuprice eel flavored water1 deep-fried eel bones2 clear soup made w...
{"inputs": ["4\n10\n256\n255\n4096", "4\n10\n376\n255\n4096", "4\n10\n376\n255\n3088", "4\n11\n376\n255\n3088", "4\n11\n376\n255\n4598", "4\n11\n73\n255\n4598", "4\n11\n73\n255\n2919", "4\n8\n73\n255\n2919", "4\n8\n73\n94\n2919", "4\n14\n73\n94\n2919", "4\n14\n92\n94\n2919", "4\n17\n92\n94\n2919", "4\n17\n92\n94\n1562"...
1
[ "PYTHON3" ]
1
2
code_contests