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 |
|---|---|---|---|---|---|---|---|---|---|
5f55ca8af46f5d6579c10f09189e234d | 24 Game | Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game.
Initially you have a sequence of *n* integers: 1,<=2,<=...,<=*n*. In a single step, you can pick two of them, let's denote them *a* and *b*, erase them from the sequence, and append to the sequence eit... | {"inputs": ["1", "8", "12", "100", "1000", "987", "2", "3", "4", "5", "6", "7", "100000", "99999", "99998", "99997", "580", "422", "116", "447", "62052", "25770", "56118", "86351", "48108", "33373", "9782", "19082", "4", "7", "3"], "outputs": ["NO", "YES\n8 * 7 = 56\n6 * 5 = 30\n3 - 4 = -1\n1 - 2 = -1\n30 - -1 = 31\n56... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 42 | codeforces | |
5f78c17e3e077560c33137901ccbd807 | Simple Subset | A tuple of positive integers {*x*1,<=*x*2,<=...,<=*x**k*} is called simple if for all pairs of positive integers (*i*,<=<=*j*) (1<=<=≤<=*i*<=<=<<=<=*j*<=≤<=*k*), *x**i*<=<=+<=<=*x**j* is a prime.
You are given an array *a* with *n* positive integers *a*1,<=<=*a*2,<=<=...,<=<=*a**n* (not necessary distinct). You wan... | {"inputs": ["2\n2 3", "2\n2 2", "3\n2 1 1", "2\n83 14", "10\n10 10 1 2 3 3 1 2 1 5", "100\n314 905 555 526 981 360 424 104 920 814 143 872 741 592 105 573 837 962 220 692 560 493 889 824 145 491 828 960 889 87 375 486 609 423 386 323 124 830 206 446 899 522 514 696 786 783 268 483 318 261 675 445 1000 896 812 277 131 2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
5f7f173ec7b8e0e45134a0c4d3a65ec4 | Winter Is Coming | The winter in Berland lasts *n* days. For each day we know the forecast for the average air temperature that day.
Vasya has a new set of winter tires which allows him to drive safely no more than *k* days at any average air temperature. After *k* days of using it (regardless of the temperature of these days) the set ... | {"inputs": ["4 3\n-5 20 -3 0", "4 2\n-5 20 -3 0", "10 6\n2 -5 1 3 0 0 -4 -3 1 0", "4 4\n-5 20 -3 0", "4 1\n-5 20 -3 0", "1 0\n-13", "2 0\n-12 -13", "3 1\n9 -16 -7", "5 5\n-15 -10 -20 -19 -14", "7 3\n-2 -14 3 -17 -20 -13 -17", "10 10\n-9 4 -3 16 -15 12 -12 8 -14 15", "30 9\n12 8 -20 0 11 -17 -11 -6 -2 -18 -19 -19 -18 -1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 7 | codeforces | |
5faca9bc5d53ce1b6775356223a21f65 | 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 *a**i* (0<=<<=*a*1<=<<=*a*2<=<<=...<=<<... | {"inputs": ["2\n4 5\n3\n12 13 15", "4\n1 2 3 4\n5\n10 11 12 13 14", "1\n1\n1\n1", "2\n1 2\n1\n1", "1\n1\n2\n1 2", "4\n3 7 11 13\n4\n51 119 187 221", "4\n2 3 4 5\n3\n1 2 3", "10\n6 12 13 20 48 53 74 92 96 97\n10\n1 21 32 36 47 54 69 75 95 97", "10\n5 9 10 14 15 17 19 22 24 26\n10\n2 11 17 19 21 22 24 25 27 28", "10\n24 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 414 | codeforces | |
5fb2747ed83e4c02b1581533dd4e7d2c | Mice | Modern researches has shown that a flock of hungry mice searching for a piece of cheese acts as follows: if there are several pieces of cheese then each mouse chooses the closest one. After that all mice start moving towards the chosen piece of cheese. When a mouse or several mice achieve the destination point and ther... | {"inputs": ["3 2 0 2\n0 1 3\n2 5", "7 11 10 20\n6 18 32 63 66 68 87\n6 8 15 23 25 41 53 59 60 75 90", "13 17 14 1\n6 9 10 12 17 25 91 100 118 136 145 163 172\n0 1 2 3 4 10 12 13 16 17 19 22 26 27 28 109 154", "19 23 13 11\n3 6 7 15 21 22 23 33 35 37 40 44 79 86 100 114 121 135 142\n2 3 5 6 7 14 15 17 18 19 20 22 25 27 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
5fca268576815fab64c58a47fbb928cc | Two Sets | Little X has *n* distinct integers: *p*1,<=*p*2,<=...,<=*p**n*. He wants to divide all of them into two sets *A* and *B*. The following two conditions must be satisfied:
- If number *x* belongs to set *A*, then number *a*<=-<=*x* must also belong to set *A*. - If number *x* belongs to set *B*, then number *b*<=-<=*x... | {"inputs": ["4 5 9\n2 3 4 5", "3 3 4\n1 2 4", "100 8883 915\n1599 4666 663 3646 754 2113 2200 3884 4082 1640 3795 2564 2711 2766 1122 4525 1779 2678 2816 2182 1028 2337 4918 1273 4141 217 2682 1756 309 4744 915 1351 3302 1367 3046 4032 4503 711 2860 890 2443 4819 4169 4721 3472 2900 239 3551 1977 2420 3361 3035 956 253... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
60122b5a7d52bc435984453c4c38584a | Mahmoud and Ehab and the bipartiteness | Mahmoud and Ehab continue their adventures! As everybody in the evil land knows, Dr. Evil likes bipartite graphs, especially trees.
A tree is a connected acyclic graph. A bipartite graph is a graph, whose vertices can be partitioned into 2 sets in such a way, that for each edge (*u*,<=*v*) that belongs to the graph, *... | {"inputs": ["3\n1 2\n1 3", "5\n1 2\n2 3\n3 4\n4 5", "10\n3 8\n6 2\n9 7\n10 1\n3 5\n1 3\n6 7\n5 4\n3 6", "10\n7 6\n2 7\n4 1\n8 5\n9 4\n5 3\n8 7\n10 8\n10 4", "10\n2 6\n3 7\n8 4\n4 10\n6 9\n9 7\n3 10\n1 2\n5 8", "10\n6 9\n9 7\n9 4\n10 9\n9 1\n9 8\n9 2\n9 5\n3 9", "2\n1 2"], "outputs": ["0", "2", "16", "16", "16", "0", "0... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 124 | codeforces | |
6014b9478d7f57ed59cdafd03fe47e3e | none | Johnny drives a truck and must deliver a package from his hometown to the district center. His hometown is located at point 0 on a number line, and the district center is located at the point *d*.
Johnny's truck has a gas tank that holds exactly *n* liters, and his tank is initially full. As he drives, the truck consu... | {"inputs": ["10 4 4\n3 5\n5 8\n6 3\n8 4", "16 5 2\n8 2\n5 1", "400000000 400000000 3\n1 139613\n19426 13509\n246298622 343529", "229 123 2\n170 270968\n76 734741", "153 105 1\n96 83995", "281 12 23\n178 650197\n129 288456\n34 924882\n43 472160\n207 957083\n103 724815\n167 308008\n135 906958\n74 242828\n229 146026\n85 2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
601619bbc1a70e0f37eec361a968484a | Rebus | You are given a rebus of form ? + ? - ? + ? = n, consisting of only question marks, separated by arithmetic operation '+' and '-', equality and positive integer *n*. The goal is to replace each question mark with some positive integer from 1 to *n*, such that equality holds.
The only line of the input contains a rebus.... | {"inputs": ["? + ? - ? + ? + ? = 42", "? - ? = 1", "? = 1000000", "? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? = 9", "? - ? + ? + ? + ? + ? - ? - ? - ? - ? + ? - ? - ? - ? + ? - ? + ? + ? + ? - ? + ? + ? + ? - ? + ? + ? - ? + ? - ? + ? - ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? + ? + ? - ? - ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 22 | codeforces | |
602b71ae265c6a9862d03253d3a2378a | Wizards and Minimal Spell | Let's dive into one of the most interesting areas of magic — writing spells. Learning this exciting but challenging science is very troublesome, so now you will not learn the magic words, but only get to know the basic rules of writing spells.
Each spell consists of several lines. The line, whose first non-space chara... | {"inputs": [" # include <cstdio>\n\nusing namespace std;\n\nint main ( ){\nputs(\"Hello # World\"); #\n#\n}", "#\n\n#", "#\n \n#", "#a\n#a\n\n#a\n\n\n#a\n \n#a\n \n\n#a\n\n \n#a\n \n \n#a", " # a \n # a \n\n # a \n\n\n # a ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
604fde0d7c396166ca579aaf2833553f | Hiking | A traveler is planning a water hike along the river. He noted the suitable rest points for the night and wrote out their distances from the starting point. Each of these locations is further characterized by its picturesqueness, so for the *i*-th rest point the distance from the start equals *x**i*, and its picturesque... | {"inputs": ["5 9\n10 10\n20 10\n30 1\n31 5\n40 10", "1 20\n9 1", "2 7\n1 9\n5 6", "3 2\n2 6\n3 9\n6 8", "4 3\n1 6\n5 10\n9 9\n10 6", "5 1\n2 3\n5 4\n7 9\n8 10\n10 7", "10 6\n1 16\n8 27\n23 2\n26 21\n32 50\n38 53\n51 79\n62 97\n77 18\n100 5", "11 6\n9 50\n10 56\n14 39\n17 91\n22 1\n25 65\n38 15\n39 93\n54 62\n62 31\n90 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
606225754191071a59ac3caab457cd3b | Jzzhu and Apples | Jzzhu has picked *n* apples from his big apple tree. All the apples are numbered from 1 to *n*. Now he wants to sell them to an apple store.
Jzzhu will pack his apples into groups and then sell them. Each group must contain two apples, and the greatest common divisor of numbers of the apples in each group must be gre... | {"inputs": ["6", "9", "2", "10", "100", "99998", "100000", "1", "3", "5", "98765", "52999", "99524", "99994", "5249", "99999", "10007", "30011", "60013", "99991"], "outputs": ["2\n6 3\n2 4", "3\n9 3\n2 4\n6 8", "0", "4\n2 4\n6 8\n10 5\n9 3", "44\n33 27\n22 11\n25 5\n64 66\n42 44\n31 62\n58 29\n43 86\n15 21\n6 99\n8 12\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
60697373d2b5fcb2993cba287677c38d | The Values You Can Make | Pari wants to buy an expensive chocolate from Arya. She has *n* coins, the value of the *i*-th coin is *c**i*. The price of the chocolate is *k*, so Pari will take a subset of her coins with sum equal to *k* and give it to Arya.
Looking at her coins, a question came to her mind: after giving the coins to Arya, what va... | {"inputs": ["6 18\n5 6 1 10 12 2", "3 50\n25 25 50", "1 79\n79", "1 114\n114", "5 1\n1 500 205 6 355", "8 42\n7 24 22 25 31 12 17 26", "8 91\n74 25 66 50 62 30 50 50", "8 15\n13 3 5 5 6 14 5 5", "8 39\n38 17 25 33 7 29 15 22", "15 185\n69 61 185 127 169 42 140 93 12 115 36 46 19 80 123", "15 109\n92 60 14 9 22 99 17 22... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 16 | codeforces | |
60834fd7364cc020a919b4ea17ddf492 | Testing Pants for Sadness | The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".
The test consists of *n* questions; the questions are to be answered strictly in the order in which they are given, from question 1 t... | {"inputs": ["2\n1 1", "2\n2 2", "1\n10", "3\n2 4 1", "4\n5 5 3 1", "2\n1000000000 1000000000", "10\n5 7 8 1 10 3 6 4 10 6", "100\n5 7 5 3 5 4 6 5 3 6 4 6 6 2 1 9 6 5 3 8 4 10 1 9 1 3 7 6 5 5 8 8 7 7 8 9 2 10 3 5 4 2 6 10 2 6 9 6 1 9 3 7 7 8 3 9 9 5 10 10 3 10 7 8 3 9 8 3 2 4 10 2 1 1 7 3 9 10 4 6 9 8 2 1 4 10 1 10 6 8 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 104 | codeforces | |
60d12ffdce709d46156de6423c7c6ee1 | Intercepted Message | Hacker Zhorik wants to decipher two secret messages he intercepted yesterday. Yeah message is a sequence of encrypted blocks, each of them consists of several bytes of information.
Zhorik knows that each of the messages is an archive containing one or more files. Zhorik knows how each of these archives was transferred... | {"inputs": ["7 6\n2 5 3 1 11 4 4\n7 8 2 4 1 8", "3 3\n1 10 100\n1 100 10", "1 4\n4\n1 1 1 1", "1 1\n1000000\n1000000", "3 5\n2 2 9\n2 1 4 2 4", "5 3\n1 1 4 1 2\n1 4 4", "30 50\n3 3 1 3 1 2 4 3 4 1 3 2 3 3 2 3 2 1 3 4 2 1 1 3 2 2 1 3 1 60\n4 4 1 2 2 2 3 1 3 2 1 2 4 4 2 1 2 3 1 3 4 4 3 3 4 4 4 1 2 1 3 3 1 1 3 3 4 3 2 3 2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 83 | codeforces | |
6100c1c63131367d738e0408b5f12c9d | Little Elephant and Numbers | The Little Elephant loves numbers.
He has a positive integer *x*. The Little Elephant wants to find the number of positive integers *d*, such that *d* is the divisor of *x*, and *x* and *d* have at least one common (the same) digit in their decimal representations.
Help the Little Elephant to find the described num... | {"inputs": ["1", "10", "47", "100", "128", "2", "17", "1000000", "1000000000", "4584725", "999999999", "9", "3", "4", "20", "24", "48", "2458450", "97648850", "96488450", "879541", "111111111", "222222222", "777777777", "211768200", "536870912", "654885000", "223092870", "901800900", "101871000", "49", "999999993", "99... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 53 | codeforces | |
61084951b3b6e5a68f9fc621f812352a | Fake News (easy) | As it's the first of April, Heidi is suspecting that the news she reads today are fake, and she does not want to look silly in front of all the contestants. She knows that a newspiece is fake if it contains heidi as a subsequence. Help Heidi assess whether the given piece is true, but please be discreet about it...
The... | {"inputs": ["abcheaibcdi", "hiedi", "ihied", "diehi", "deiih", "iheid", "eihdi", "ehdii", "edhii", "deiih", "ehdii", "eufyajkssayhjhqcwxmctecaeepjwmfoscqprpcxsqfwnlgzsmmuwuoruantipholrauvxydfvftwfzhnckxswussvlidcojiciflpvkcxkkcmmvtfvxrkwcpeelwsuzqgamamdtdgzscmikvojfvqehblmjczkvtdeymgertgkwfwfukafqlfdhtedcctixhyetdypswg... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 330 | codeforces | |
611d5edf1fac73722d75e675883f655e | Laboratory Work | Anya and Kirill are doing a physics laboratory work. In one of the tasks they have to measure some value *n* times, and then compute the average value to lower the error.
Kirill has already made his measurements, and has got the following integer values: *x*1, *x*2, ..., *x**n*. It is important that the values are clo... | {"inputs": ["6\n-1 1 1 0 0 -1", "3\n100 100 101", "7\n-10 -9 -10 -8 -10 -9 -9", "60\n-8536 -8536 -8536 -8535 -8536 -8536 -8536 -8536 -8536 -8536 -8536 -8535 -8536 -8535 -8536 -8536 -8536 -8536 -8536 -8536 -8536 -8536 -8536 -8536 -8536 -8536 -8536 -8535 -8536 -8536 -8535 -8536 -8536 -8536 -8536 -8536 -8536 -8536 -8536 -... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 28 | codeforces | |
61331892fdd37295b2e464408bc46a91 | Bear and Finding Criminals | There are *n* cities in Bearland, numbered 1 through *n*. Cities are arranged in one long row. The distance between cities *i* and *j* is equal to |*i*<=-<=*j*|.
Limak is a police officer. He lives in a city *a*. His job is to catch criminals. It's hard because he doesn't know in which cities criminals are. Though, he... | {"inputs": ["6 3\n1 1 1 0 1 0", "5 2\n0 0 0 1 0", "1 1\n1", "1 1\n0", "9 3\n1 1 1 1 1 1 1 1 0", "9 5\n1 0 1 0 1 0 1 0 1", "20 17\n1 1 0 1 1 1 1 0 1 0 1 1 1 0 1 1 0 0 0 0", "100 60\n1 1 1 1 1 1 0 1 0 0 1 1 0 1 1 1 1 1 0 0 1 1 0 0 0 0 0 1 0 1 1 0 1 0 1 0 1 0 1 1 0 0 0 0 0 1 1 1 0 1 1 0 0 0 1 0 0 0 1 1 1 0 1 0 0 1 1 1 0 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 292 | codeforces | |
6188ca22b8da96766b5b984e5b443947 | Effective Approach | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.
According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requ... | {"inputs": ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3", "9\n2 9 3 1 6 4 7 8 5\n9\n5 1 5 2 8 4 4 4 5", "10\n3 10 9 2 7 6 5 8 4 1\n1\n4", "10\n5 2 10 8 3 1 9 7 6 4\n9\n2 5 9 2 3 2 5 9 8", "9\n3 8 4 7 1 2 5 6 9\n3\n2 7 1", "9\n5 3 8 4 2 6 1 7 9\n4\n6 1 9 2", "4\n1 3 2 4\n4\n3 1 2 3", "3\n1 2 3\n8\n3 2 1 1 2 3 1 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 344 | codeforces | |
618e02f7384cdd19508ebd84ad809d18 | Union of Doubly Linked Lists | Doubly linked list is one of the fundamental data structures. A doubly linked list is a sequence of elements, each containing information about the previous and the next elements of the list. In this problem all lists have linear structure. I.e. each element except the first has exactly one previous element, each eleme... | {"inputs": ["7\n4 7\n5 0\n0 0\n6 1\n0 2\n0 4\n1 0", "2\n2 0\n0 1", "1\n0 0", "4\n0 2\n1 0\n0 4\n3 0", "5\n0 0\n0 0\n0 0\n0 0\n0 0", "2\n0 0\n0 0", "2\n0 2\n1 0", "5\n5 3\n4 0\n1 4\n3 2\n0 1", "5\n2 0\n0 1\n0 4\n3 5\n4 0", "5\n3 4\n0 0\n0 1\n1 0\n0 0", "5\n3 0\n0 0\n0 1\n0 0\n0 0", "10\n7 5\n5 0\n4 7\n10 3\n1 2\n0 9\n3 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 19 | codeforces | |
6199397c95c09acba408fadef4aae0c7 | Chips | There are *n* walruses sitting in a circle. All of them are numbered in the clockwise order: the walrus number 2 sits to the left of the walrus number 1, the walrus number 3 sits to the left of the walrus number 2, ..., the walrus number 1 sits to the left of the walrus number *n*.
The presenter has *m* chips. The pre... | {"inputs": ["4 11", "17 107", "3 8", "46 7262", "32 6864", "36 6218", "25 9712", "9 7601", "1 9058", "29 7772", "45 9465", "46 866", "29 1241", "17 4248", "20 8082", "50 9555", "4 7455", "36 880", "24 7440", "44 7888", "1 1", "50 10000", "1 10000", "50 1", "50 50"], "outputs": ["0", "2", "1", "35", "0", "14", "11", "5"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 517 | codeforces | |
61f4b3564579a1f7b930cb0ef135aa17 | Ilya and Bank Account | Ilya is a very clever lion, he lives in an unusual city ZooVille. In this city all the animals have their rights and obligations. Moreover, they even have their own bank accounts. The state of a bank account is an integer. The state of a bank account can be a negative number. This means that the owner of the account ow... | {"inputs": ["2230", "-10", "-100003", "544883178", "-847251738", "423654797", "-623563697", "645894116", "-384381709", "437587210", "-297534606", "891773002", "-56712976", "963662765", "-272656295", "383441522", "-477665112", "791725034", "-812168727", "528894922", "-479977172", "568044564", "-392784794", "925596634", ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 234 | codeforces | |
622f88a1bbe0ffe4c3d7e4698161b0f0 | Magic Matrix | You're given a matrix *A* of size *n*<=×<=*n*.
Let's call the matrix with nonnegative elements magic if it is symmetric (so *a**ij*<==<=*a**ji*), *a**ii*<==<=0 and *a**ij*<=≤<=*max*(*a**ik*,<=*a**jk*) for all triples *i*,<=*j*,<=*k*. Note that *i*,<=*j*,<=*k* do not need to be distinct.
Determine if the matrix is mag... | {"inputs": ["3\n0 1 2\n1 0 2\n2 2 0", "2\n0 1\n2 3", "4\n0 1 2 3\n1 0 3 4\n2 3 0 5\n3 4 5 0", "5\n0 2 5 9 5\n2 0 5 9 5\n5 5 0 9 4\n9 9 9 0 9\n5 5 4 9 0", "10\n0 16 5 14 14 17 14 14 9 14\n16 0 16 16 16 17 16 16 16 16\n5 16 0 14 14 17 14 14 9 14\n14 16 14 0 7 17 3 8 14 12\n14 16 14 7 0 17 7 8 14 12\n17 17 17 17 17 0 17 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
6252b2f7bbb9c359601f5f67e3a97eee | Artsem and Saunders | Artsem has a friend Saunders from University of Chicago. Saunders presented him with the following problem.
Let [*n*] denote the set {1,<=...,<=*n*}. We will also write *f*:<=[*x*]<=→<=[*y*] when a function *f* is defined in integer points 1, ..., *x*, and all its values are integers from 1 to *y*.
Now then, you are ... | {"inputs": ["3\n1 2 3", "3\n2 2 2", "2\n2 1", "1\n1", "2\n2 1", "2\n2 2", "5\n5 5 5 3 5", "10\n4 4 4 4 4 4 4 4 4 4", "2\n1 2", "3\n3 2 3", "3\n1 2 1", "4\n4 2 4 4", "5\n1 4 5 4 5", "4\n1 2 1 2", "5\n1 3 3 4 4", "4\n4 2 2 4", "7\n7 3 3 5 5 7 7", "6\n1 1 1 3 3 3", "4\n2 2 3 2", "6\n1 2 3 4 5 5", "3\n1 1 2", "4\n3 4 3 4",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 20 | codeforces | |
6254108ea889c419d9f8e2afba6f5ada | Babaei and Birthday Cake | As you know, every birthday party has a cake! This time, Babaei is going to prepare the very special birthday party's cake.
Simple cake is a cylinder of some radius and height. The volume of the simple cake is equal to the volume of corresponding cylinder. Babaei has *n* simple cakes and he is going to make a special ... | {"inputs": ["2\n100 30\n40 10", "4\n1 1\n9 7\n1 4\n10 7", "3\n2 2\n1 1\n3 3", "3\n2 2\n3 3\n1 1", "3\n3 3\n1 1\n2 2", "3\n1 1\n2 2\n3 3", "3\n1 1\n3 3\n2 2", "3\n3 3\n2 2\n1 1", "1\n1 1", "2\n1 1\n2 2", "2\n2 2\n1 1", "4\n1 1\n2 2\n3 3\n4 4", "4\n1 1\n2 2\n4 4\n3 3", "4\n1 1\n3 3\n2 2\n4 4", "4\n1 1\n3 3\n4 4\n2 2", "4... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
626718e6c98f6f2994a519cc90bf888d | Suit and Tie | Allen is hosting a formal dinner party. $2n$ people come to the event in $n$ pairs (couples). After a night of fun, Allen wants to line everyone up for a final picture. The $2n$ people line up, but Allen doesn't like the ordering. Allen prefers if each pair occupies adjacent positions in the line, as this makes the pic... | {"inputs": ["4\n1 1 2 3 3 2 4 4", "3\n1 1 2 2 3 3", "3\n3 1 2 3 1 2", "8\n7 6 2 1 4 3 3 7 2 6 5 1 8 5 8 4", "2\n1 2 1 2", "3\n1 2 3 3 1 2", "38\n26 28 23 34 33 14 38 15 35 36 30 1 19 17 18 28 22 15 9 27 11 16 17 32 7 21 6 8 32 26 33 23 18 4 2 25 29 3 35 8 38 37 31 37 12 25 3 27 16 24 5 20 12 13 29 11 30 22 9 19 2 24 7 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 75 | codeforces | |
62701aa73b10e5e72bb53185e0b68677 | Desk Disorder | A new set of desks just arrived, and it's about time! Things were getting quite cramped in the office. You've been put in charge of creating a new seating chart for the engineers. The desks are numbered, and you sent out a survey to the engineering team asking each engineer the number of the desk they currently sit at,... | {"inputs": ["4\n1 5\n5 2\n3 7\n7 3", "5\n1 10\n2 10\n3 10\n4 10\n5 5", "1\n1 2", "30\n22 37\n12 37\n37 58\n29 57\n43 57\n57 58\n58 53\n45 4\n1 4\n4 51\n35 31\n21 31\n31 51\n51 53\n53 48\n60 55\n52 55\n55 33\n36 9\n10 9\n9 33\n33 19\n5 23\n47 23\n23 32\n50 44\n26 44\n44 32\n32 19\n19 48", "50\n73 1\n65 73\n16 65\n57 65\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
6286823ddf5df5be20a2e19ef19da4f1 | War of the Corporations | A long time ago, in a galaxy far far away two giant IT-corporations Pineapple and Gogol continue their fierce competition. Crucial moment is just around the corner: Gogol is ready to release it's new tablet Lastus 3000.
This new device is equipped with specially designed artificial intelligence (AI). Employees of Pine... | {"inputs": ["intellect\ntell", "google\napple", "sirisiri\nsir", "sirisiri\nsiri", "aaaaaaa\naaaa", "bbbbbb\nbb", "abc\nabcabc", "kek\nkekekek", "aaaaa\naaa", "abcdabcv\nabcd", "abcabcabczabcabcabcz\ncab", "aatopotopotopotaa\ntopot", "abcabcabcabcabcabcabcabcabcabc\nabcabcabcabcabcabcabcabcabcabc", "sosossosos\nsos", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 221 | codeforces | |
629ace22bf13e54cf3019369032e4a31 | Buy a Ticket | Musicians of a popular band "Flayer" have announced that they are going to "make their exit" with a world tour. Of course, they will visit Berland as well.
There are *n* cities in Berland. People can travel between cities using two-directional train routes; there are exactly *m* routes, *i*-th route can be used to go ... | {"inputs": ["4 2\n1 2 4\n2 3 7\n6 20 1 25", "3 3\n1 2 1\n2 3 1\n1 3 1\n30 10 20", "7 7\n1 6 745325\n2 3 3581176\n2 4 19\n3 6 71263060078\n5 4 141198\n7 4 163953\n5 6 15994\n1 297404206755 82096176217 14663411 187389745 21385 704393"], "outputs": ["6 14 1 25 ", "12 10 12 ", "1 335807 7498159 335769 53373 21385 663675 "]... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
62ca0fdbd9cd503199fb21ff45877182 | Day at the Beach | One day Squidward, Spongebob and Patrick decided to go to the beach. Unfortunately, the weather was bad, so the friends were unable to ride waves. However, they decided to spent their time building sand castles.
At the end of the day there were *n* castles built by friends. Castles are numbered from 1 to *n*, and the ... | {"inputs": ["3\n1 2 3", "4\n2 1 3 2", "17\n1 45 22 39 28 23 23 100 500 778 777 778 1001 1002 1005 1003 1005", "101\n1 50 170 148 214 153 132 234 181 188 180 225 226 200 197 122 181 168 87 220 223 160 235 94 257 145 199 235 102 146 119 60 109 134 209 260 210 191 180 271 236 195 155 169 166 143 246 102 208 137 278 269 15... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 16 | codeforces | |
62fe0ebe0c4ab67b71ccafaf12746b83 | The Maths Lecture | Amr doesn't like Maths as he finds it really boring, so he usually sleeps in Maths lectures. But one day the teacher suspected that Amr is sleeping and asked him a question to make sure he wasn't.
First he gave Amr two positive integers *n* and *k*. Then he asked Amr, how many integer numbers *x*<=><=0 exist such t... | {"inputs": ["1 2 1000", "2 2 1000", "5 3 1103", "2 17 10000", "3 9 10000", "6 64 941761822", "183 3 46847167", "472 44 364550669", "510 76 811693420", "783 30 602209107", "863 47 840397713", "422 22 411212542", "370 9 385481464", "312 41 915197716", "261 32 49719977", "434 6 56571287", "355 3 945669623", "905 71 999142... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
6329ead462cbeae7d091ee0822fdf649 | Minimum Binary Number | String can be called correct if it consists of characters "0" and "1" and there are no redundant leading zeroes. Here are some examples: "0", "10", "1001".
You are given a correct string *s*.
You can perform two different operations on this string:
1. swap any pair of adjacent characters (for example, "101" "110"... | {"inputs": ["4\n1001", "1\n1", "100\n1110111100001111011111111010110011111111011110000111101101011100110110001011000000101010110101011100", "100\n1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "100\n11111111111111111111111111111111111111111111111111111111111111111... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 260 | codeforces | |
6345b9b6db25c4c6c108cbbca4514fab | Cheese Board | Not to be confused with [chessboard](https://en.wikipedia.org/wiki/Chessboard).
The first line of input contains a single integer *N* (1<=≤<=*N*<=≤<=100) — the number of cheeses you have.
The next *N* lines describe the cheeses you have. Each line contains two space-separated strings: the name of the cheese and its ty... | {"inputs": ["9\nbrie soft\ncamembert soft\nfeta soft\ngoat soft\nmuenster soft\nasiago hard\ncheddar hard\ngouda hard\nswiss hard", "6\nparmesan hard\nemmental hard\nedam hard\ncolby hard\ngruyere hard\nasiago hard", "9\ngorgonzola soft\ncambozola soft\nmascarpone soft\nricotta soft\nmozzarella soft\nbryndza soft\njarl... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
6359aabb4e475d8930450b9c7b8a244e | Buggy Sorting | Little boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of *n* integers *a*1,<=*a*2,<=...,<=*a**n* in the non-decreasing order. The pseudocode of the program, written by Valera, is given below. ... | {"inputs": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "50", "22", "34", "50", "12", "26", "38", "4", "18", "30", "46", "32"], "outputs": ["-1", "-1", "3 2 1 ", "4 3 2 1 ", "5 4 3 2 1 ", "6 5 4 3 2 1 ", "7 6 5 4 3 2 1 ", "8 7 6 5 4 3 2 1 ", "9 8 7 6 5 4 3 2 1 ", "50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 104 | codeforces | |
63797f23a28c31697c3a4221a9c9de1d | LionAge II | Vasya plays the LionAge II. He was bored of playing with a stupid computer, so he installed this popular MMORPG, to fight with his friends. Vasya came up with the name of his character — non-empty string *s*, consisting of a lowercase Latin letters. However, in order not to put up a front of friends, Vasya has decided ... | {"inputs": ["winner 4\n4\ns e 7\no s 8\nl o 13\no o 8", "abcdef 1\n5\na b -10\nb c 5\nc d 5\nd e 5\ne f 5", "akcbd 2\n3\na d 55\nb z 100\nb c 50", "adcbd 1\n3\na d 55\nb z 100\nb c 50", "abcbd 1\n3\na b 55\nb z 100\nb c 50", "vswlx 1\n3\nz l 509\nb i 287\na o 952", "srtlmx 2\n2\ne a -167\nc v -932", "dlcmexn 3\n3\no k ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
638c7aa6d07a25b3a8293cfb624a5cc6 | The Fibonacci Segment | You have array *a*1,<=*a*2,<=...,<=*a**n*. Segment [*l*,<=*r*] (1<=≤<=*l*<=≤<=*r*<=≤<=*n*) is good if *a**i*<==<=*a**i*<=-<=1<=+<=*a**i*<=-<=2, for all *i* (*l*<=+<=2<=≤<=*i*<=≤<=*r*).
Let's define *len*([*l*,<=*r*])<==<=*r*<=-<=*l*<=+<=1, *len*([*l*,<=*r*]) is the length of the segment [*l*,<=*r*]. Segment [*l*1,<=*r... | {"inputs": ["10\n1 2 3 5 8 13 21 34 55 89", "5\n1 1 1 1 1", "1\n1000", "51\n1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0", "1\n0", "2\n0 0", "3\n0 0 0", "4\n0 0 0 0", "5\n0 0 0 0 0", "6\n10 20 30 10 40 50", "5\n8 9 17 26 43", "12\n1 2 3 5 8 13 0 1 1 2 3 5", "13\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 36 | codeforces | |
63a39518a14342d2da52a6a26177fe6d | Neverending competitions | There are literally dozens of snooker competitions held each year, and team Jinotega tries to attend them all (for some reason they prefer name "snookah")! When a competition takes place somewhere far from their hometown, Ivan, Artsem and Konstantin take a flight to the contest and back.
Jinotega's best friends, team ... | {"inputs": ["4\nSVO\nSVO->CDG\nLHR->SVO\nSVO->LHR\nCDG->SVO", "3\nSVO\nSVO->HKT\nHKT->SVO\nSVO->RAP", "1\nESJ\nESJ->TSJ", "2\nXMR\nFAJ->XMR\nXMR->FAJ", "3\nZIZ\nDWJ->ZIZ\nZIZ->DWJ\nZIZ->DWJ", "10\nPVO\nDMN->PVO\nDMN->PVO\nPVO->DMN\nDMN->PVO\nPVO->DMN\nPVO->DMN\nPVO->DMN\nDMN->PVO\nPVO->DMN\nDMN->PVO", "11\nIAU\nIAU->RU... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 199 | codeforces | |
63a9cea7d9db70b77cff7f58c487ccdf | Number of Parallelograms | You are given *n* points on a plane. All the points are distinct and no three of them lie on the same line. Find the number of parallelograms with the vertices at the given points.
The first line of the input contains integer *n* (1<=≤<=*n*<=≤<=2000) — the number of points.
Each of the next *n* lines contains two inte... | {"inputs": ["4\n0 1\n1 0\n1 1\n2 0", "1\n0 0", "1\n6 6", "5\n1 5\n4 2\n4 4\n8 1\n8 2", "10\n1 7\n2 14\n3 7\n3 13\n5 13\n13 10\n15 12\n17 1\n18 8\n19 0", "20\n0 17\n1 8\n1 9\n2 5\n2 11\n3 0\n5 10\n5 13\n6 7\n7 3\n12 13\n13 7\n14 16\n15 10\n15 18\n17 2\n17 12\n18 14\n19 18\n20 17", "2\n2 5\n10 7", "4\n7 9\n10 2\n12 20\n1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 14 | codeforces | |
63b11bb3bcf044f70a1065e2688186d4 | Phone Number | Alas, finding one's true love is not easy. Masha has been unsuccessful in that yet. Her friend Dasha told Masha about a way to determine the phone number of one's Prince Charming through arithmancy.
The phone number is divined like that. First one needs to write down one's own phone numbers. For example, let's suppos... | {"inputs": ["12345", "09", "3", "55", "737", "21583", "33408349", "0180990956", "433488906230138", "00046142930690780976", "317579445234107659439645596", "95066916647678224147260013920", "36460576924876475371008334246121610", "429622625617508557672595893160462042433748844995", "17601120900014764776764048700928872725171... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 16 | codeforces | |
63b7d41690ec122f4af9a2a294f9cc0b | Protect Sheep | Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.
The pasture is a rectangle consisting of *R*<=×<=*C* cells. Each cell is either empty, contains a sheep, a wolf or... | {"inputs": ["1 2\nSW", "10 10\n....W.W.W.\n.........S\n.S.S...S..\nW.......SS\n.W..W.....\n.W...W....\nS..S...S.S\n....W...S.\n..S..S.S.S\nSS.......S", "10 10\n....W.W.W.\n...W.....S\n.S.S...S..\nW......WSS\n.W..W.....\n.W...W....\nS..S...S.S\n...WWW..S.\n..S..S.S.S\nSS.......S", "1 50\nW...S..............W.....S..S...... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 268 | codeforces | |
63bda1d48d73e74b0fb2315f69ff2346 | Watering System | Arkady wants to water his only flower. Unfortunately, he has a very poor watering system that was designed for $n$ flowers and so it looks like a pipe with $n$ holes. Arkady can only use the water that flows from the first hole.
Arkady can block some of the holes, and then pour $A$ liters of water into the pipe. After... | {"inputs": ["4 10 3\n2 2 2 2", "4 80 20\n3 2 1 4", "5 10 10\n1000 1 1 1 1", "10 300 100\n20 1 3 10 8 5 3 6 4 3", "10 300 100\n20 25 68 40 60 37 44 85 23 96", "1 1 1\n1", "1 2 1\n1", "2 2 2\n1 10000", "2 10000 1\n1 9999"], "outputs": ["1", "0", "4", "1", "8", "0", "0", "1", "0"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 183 | codeforces | |
63cefaf85dc9a9057a96f4a4b3cf46b4 | Sereja and Coat Rack | Sereja owns a restaurant for *n* people. The restaurant hall has a coat rack with *n* hooks. Each restaurant visitor can use a hook to hang his clothes on it. Using the *i*-th hook costs *a**i* rubles. Only one person can hang clothes on one hook.
Tonight Sereja expects *m* guests in the restaurant. Naturally, each gu... | {"inputs": ["2 1\n2 1\n2", "2 1\n2 1\n10", "1 1\n1\n2", "3 96\n83 22 17\n19", "8 4\n27 72 39 70 13 68 100 36\n95", "2 65\n23 34\n74", "2 48\n12 54\n69", "5 30\n63 58 38 60 24\n42", "9 47\n17 36 91 43 89 7 41 43 65\n49", "6 49\n91 30 71 51 7 2\n94", "57 27\n73 51 24 86 57 17 27 58 27 58 38 72 70 62 97 23 18 13 18 97 86 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 15 | codeforces | |
63fdf4925ed3ccbb06620158f797a41d | Photo to Remember | One day *n* friends met at a party, they hadn't seen each other for a long time and so they decided to make a group photo together.
Simply speaking, the process of taking photos can be described as follows. On the photo, each photographed friend occupies a rectangle of pixels: the *i*-th of them occupies the rectangl... | {"inputs": ["3\n1 10\n5 5\n10 1", "3\n2 1\n1 2\n2 1", "2\n1 5\n2 3", "2\n2 3\n1 1", "3\n1 10\n2 10\n3 10", "3\n2 10\n1 9\n3 7", "3\n1 1\n3 2\n2 3", "3\n3 123\n1 456\n2 789", "3\n2 987\n3 654\n1 321", "3\n3 143\n2 543\n1 893", "2\n1 1\n1 2", "3\n2 22\n1 11\n2 22", "3\n1 11\n1 12\n1 13", "3\n1 11\n1 12\n2 10", "10\n6 20\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 137 | codeforces | |
641a649f2f8006ce2ac9c06d92bc9009 | Vasya and Robot | Vasya has *n* items lying in a line. The items are consecutively numbered by numbers from 1 to *n* in such a way that the leftmost item has number 1, the rightmost item has number *n*. Each item has a weight, the *i*-th item weights *w**i* kilograms.
Vasya needs to collect all these items, however he won't do it by hi... | {"inputs": ["3 4 4 19 1\n42 3 99", "4 7 2 3 9\n1 2 3 4", "2 100 100 10000 10000\n100 100", "2 3 4 5 6\n1 2", "1 78 94 369 10000\n93", "1 94 78 369 10000\n93", "5 1 100 1 10000\n1 2 3 4 5", "5 100 1 10000 1\n1 2 3 4 5", "5 1 100 10000 1\n1 2 3 4 5", "5 100 1 1 10000\n1 2 3 4 5", "6 32 47 965 897\n7 4 1 3 5 4", "7 3 13 3... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 29 | codeforces | |
643c6163ecab0b811b51f719c5fe56c7 | Walking in the Rain | In Berland the opposition is going to arrange mass walking on the boulevard. The boulevard consists of *n* tiles that are lain in a row and are numbered from 1 to *n* from right to left. The opposition should start walking on the tile number 1 and the finish on the tile number *n*. During the walk it is allowed to move... | {"inputs": ["4\n10 3 5 10", "5\n10 2 8 3 5", "10\n10 3 1 6 7 1 3 3 8 1", "10\n26 72 10 52 2 5 61 2 39 64", "100\n8 2 1 2 8 3 5 8 5 1 9 3 4 1 5 6 4 2 9 10 6 10 10 3 9 4 10 5 3 1 5 10 7 6 8 10 2 6 4 4 2 2 10 7 2 7 3 2 6 3 6 4 7 6 2 5 5 8 6 9 5 2 7 5 8 6 5 8 10 6 10 8 5 3 1 10 6 1 7 5 1 8 10 5 1 3 10 7 10 5 7 1 4 3 8 6 3 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 75 | codeforces | |
646829dd4da9ab53be8b2b48c5fd1b6d | Perfectionist Arkadiy | Arkadiy has lots square photos with size *a*<=×<=*a*. He wants to put some of them on a rectangular wall with size *h*<=×<=*w*.
The photos which Arkadiy will put on the wall must form a rectangular grid and the distances between neighboring vertically and horizontally photos and also the distances between outside row... | {"inputs": ["2 18 13", "4 4 4", "3 4 3", "9 81 23", "11 21 21", "55 178 996", "8 81 60", "3 1000000000 1000000000", "1000000000 1000000000 1000000000", "1 1000000000 1000000000", "6 1000000000 1000000000", "6 1000000000 956431324", "546 182989 371991", "45 654489 357075", "97259 999895180 999895180", "453145 999531525 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 7 | codeforces | |
64708c20e20886405273495cf8cb8aa5 | Marco and GCD Sequence | In a dream Marco met an elderly man with a pair of black glasses. The man told him the key to immortality and then disappeared with the wind of time.
When he woke up, he only remembered that the key was a sequence of positive integers of some length *n*, but forgot the exact sequence. Let the elements of the sequence ... | {"inputs": ["4\n2 4 6 12", "2\n2 3", "2\n1 6", "3\n1 2 7", "1\n1", "2\n1 10", "3\n1 2 6", "15\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15", "14\n1 2 3 4 5 6 7 8 9 10 11 12 13 14", "5\n2 5 6 7 11", "11\n3 4 5 6 7 8 9 10 11 12 13", "3\n4 9 11", "6\n5 6 9 11 14 16", "12\n8 9 10 11 12 13 14 15 16 17 18 19", "3\n1007 397765 414884... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 10 | codeforces | |
6489c934b00a49add0189bfd59b6168f | Bear and Company | Bear Limak prepares problems for a programming competition. Of course, it would be unprofessional to mention the sponsor name in the statement. Limak takes it seriously and he is going to change some words. To make it still possible to read, he will try to modify each word as little as possible.
Limak has a string *s*... | {"inputs": ["4\nVKVK", "5\nBVVKV", "7\nVVKEVKK", "20\nVKVKVVVKVOVKVQKKKVVK", "5\nLIMAK", "1\nV", "1\nK", "1\nZ", "17\nVAKVAKLIMAKVVVKKK", "10\nVVKAVZVAAZ", "17\nQZVRZKDKMZZAKKZVA", "51\nAVVVVVVVVVVKKKKKKKKKKVVVVVVVVVVVVVVVKKKKKKKKKKKKKKK", "75\nVFZVZRVZAZJAKAZKAVVKZKVHZZZZAVAAKKAADKNAKRFKAAAZKZVAKAAAJAVKYAAZAKAVKASZAAK... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
648ebdda98e828fc28e38a9a29ff5be5 | QAQ | "QAQ" is a word to denote an expression of crying. Imagine "Q" as eyes with tears and "A" as a mouth.
Now Diamond has given Bort a string consisting of only uppercase English letters of length *n*. There is a great number of "QAQ" in the string (Diamond is so cute!).
Bort wants to know how many subsequences "QAQ" are... | {"inputs": ["QAQAQYSYIOIWIN", "QAQQQZZYNOIWIN", "QA", "IAQVAQZLQBQVQFTQQQADAQJA", "QQAAQASGAYAAAAKAKAQIQEAQAIAAIAQQQQQ", "AMVFNFJIAVNQJWIVONQOAOOQSNQSONOASONAONQINAONAOIQONANOIQOANOQINAONOQINAONOXJCOIAQOAOQAQAQAQAQWWWAQQAQ", "AAQQAXBQQBQQXBNQRJAQKQNAQNQVDQASAGGANQQQQTJFFQQQTQQA", "KAZXAVLPJQBQVQQQQQAPAQQGQTQVZQAAAOYA",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 821 | codeforces | |
649a7547be14ae924e629e397bbeab07 | Polo the Penguin and XOR operation | Little penguin Polo likes permutations. But most of all he likes permutations of integers from 0 to *n*, inclusive.
For permutation *p*<==<=*p*0,<=*p*1,<=...,<=*p**n*, Polo has defined its beauty — number .
Expression means applying the operation of bitwise excluding "OR" to numbers *x* and *y*. This operation exist... | {"inputs": ["4", "7", "1", "2", "3", "8", "10", "47", "74", "99", "128", "257", "1000000", "77845", "100000", "100001", "999999", "777777", "687500", "17", "18", "19", "20", "4587", "15475", "68450", "6100", "1047", "670041", "875495", "687548", "154781", "684501", "754810", "987548", "348754", "20", "11", "12", "13", ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
649aa1e191c627b051eaf6aa75a8fc29 | Buy a Shovel | Polycarp urgently needs a shovel! He comes to the shop and chooses an appropriate one. The shovel that Policarp chooses is sold for *k* burles. Assume that there is an unlimited number of such shovels in the shop.
In his pocket Polycarp has an unlimited number of "10-burle coins" and exactly one coin of *r* burles (1<... | {"inputs": ["117 3", "237 7", "15 2", "1 1", "1 9", "1000 3", "1000 1", "1000 9", "1 2", "999 9", "999 8", "105 6", "403 9", "546 4", "228 9", "57 2", "437 9", "997 6", "109 1", "998 9", "4 2", "9 3", "8 2", "1 3", "1 4", "1 5", "1 6", "1 7", "1 8", "100 3", "1000 2", "1000 4", "1000 5", "1000 6", "1000 7", "1000 8", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 657 | codeforces | |
64ae99b2640743d28b6f1af4965bdc8b | Petya and Divisors | Little Petya loves looking for numbers' divisors. One day Petya came across the following problem:
You are given *n* queries in the form "*x**i* *y**i*". For each query Petya should count how many divisors of number *x**i* divide none of the numbers *x**i*<=-<=*y**i*,<=*x**i*<=-<=*y**i*<=+<=1,<=...,<=*x**i*<=-<=1. Hel... | {"inputs": ["6\n4 0\n3 1\n5 2\n6 2\n18 4\n10000 3", "5\n10 0\n10 0\n10 0\n10 0\n10 0", "12\n41684 0\n95210 1\n60053 1\n32438 3\n97956 1\n21785 2\n14594 6\n17170 4\n93937 6\n70764 5\n13695 4\n14552 6", "10\n54972 0\n48015 1\n7114 1\n68273 2\n53650 4\n1716 1\n16165 2\n96062 5\n57750 1\n21071 5", "20\n68260 0\n819 1\n5417... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 8 | codeforces | |
653c4a2ac6666e63908c505220e30beb | Making a String | You are given an alphabet consisting of *n* letters, your task is to make a string of the maximum possible length so that the following conditions are satisfied:
- the *i*-th letter occurs in the string no more than *a**i* times; - the number of occurrences of each letter in the string must be distinct for all the ... | {"inputs": ["3\n2 5 5", "3\n1 1 2", "2\n1 1", "3\n1 1000000000 2", "26\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 100000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 109 | codeforces | |
6541177a52b00070ad9dd4343e4db7c8 | An impassioned circulation of affection | Nadeko's birthday is approaching! As she decorated the room for the party, a long garland of Dianthus-shaped paper pieces was placed on a prominent part of the wall. Brother Koyomi will like it!
Still unsatisfied with the garland, Nadeko decided to polish it again. The garland has *n* pieces numbered from 1 to *n* fro... | {"inputs": ["6\nkoyomi\n3\n1 o\n4 o\n4 m", "15\nyamatonadeshiko\n10\n1 a\n2 a\n3 a\n4 a\n5 a\n1 b\n2 b\n3 b\n4 b\n5 b", "10\naaaaaaaaaa\n2\n10 b\n10 z", "1\nc\n4\n1 x\n1 a\n1 e\n1 t", "20\naaaaaaaaaaaaaaaaaaaa\n1\n11 a", "4\ncbcc\n12\n4 b\n4 c\n1 b\n2 a\n3 b\n2 c\n4 a\n1 a\n2 b\n3 a\n1 c\n3 c", "4\nddbb\n16\n3 c\n3 b\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 16 | codeforces | |
65412f3683283e2c511a4c7a01346395 | Memory and Trident | Memory is performing a walk on the two-dimensional plane, starting at the origin. He is given a string *s* with his directions for motion:
- An 'L' indicates he should move one unit left. - An 'R' indicates he should move one unit right. - A 'U' indicates he should move one unit up. - A 'D' indicates he should move... | {"inputs": ["RRU", "UDUR", "RUUR", "DDDD", "RRRR", "RRRUUD", "UDURLRDURLRD", "RLRU", "RDDLLDLUUUDDRDRURLUUURLLDDLRLUURRLLRRLDRLLUDRLRULLDLRRLRLRLRUDUUDLULURLLDUURULURLLRRRURRRDRUUDLDRLRDRLRRDDLDLDLLUDRUDRLLLLDRDUULRUURRDLULLULDUDULRURRDDDLLUDRLUDDLDDDRRDDDULLLLDLDRLRRLRRDDRLULURRUDRDUUUULDURUDRDLDDUDUDRRURDULRRUDRLRRDL... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 164 | codeforces | |
6558f3871d816257c05bb8862dc490d2 | Nastya and a Wardrobe | Nastya received a gift on New Year — a magic wardrobe. It is magic because in the end of each month the number of dresses in it doubles (i.e. the number of dresses becomes twice as large as it is in the beginning of the month).
Unfortunately, right after the doubling the wardrobe eats one of the dresses (if any) with ... | {"inputs": ["2 0", "2 1", "3 2", "1 411", "1 692", "16 8", "18 12", "1 1000000000000000000", "0 24", "24 0", "1000000000000000000 1", "348612312017571993 87570063840727716", "314647997243943415 107188213956410843", "375000003 2", "451 938", "4 1669", "24 347", "1619 1813", "280 472", "1271 237", "626 560", "167 887", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 29 | codeforces | |
65627e8c97269b0e4c8570613a86125c | Large Bouquets | A flower shop has got *n* bouquets, and the *i*-th bouquet consists of *a**i* flowers. Vasya, the manager of the shop, decided to make large bouquets from these bouquets.
Vasya thinks that a bouquet is large if it is made of two or more initial bouquets, and there is a constraint: the total number of flowers in a lar... | {"inputs": ["5\n2 3 4 2 7", "6\n2 2 6 8 6 12", "3\n11 4 10", "1\n1", "1\n2", "1\n999999", "1\n1000000", "4\n943543 151729 379602 589828", "2\n468463 62253", "3\n352987 849349 967007", "20\n274039 899325 798709 157662 963297 276599 529230 80095 252956 980560 358150 82383 29856 901568 123794 275349 512273 508369 120076 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 61 | codeforces | |
6591fe9909df35ca605beeb5672d0d91 | Symmetric and Transitive | Little Johnny has recently learned about set theory. Now he is studying binary relations. You've probably heard the term "equivalence relation". These relations are very important in many areas of mathematics. For example, the equality of the two numbers is an equivalence relation.
A set ρ of pairs (*a*,<=*b*) of elem... | {"inputs": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "42", "2000", "4000", "2345", "2500", "2780", "2999", "3000", "20", "76", "133", "345", "555", "666", "777", "999", "1234", "1730", "3333", "3555", "3789", "3999"], "outputs": ["1", "3", "10", "37", "151", "674", "3263", "17007", "94828", "562595", "7381865... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
65a515ded91844bec4018832113063e5 | Video Cards | Little Vlad is fond of popular computer game Bota-2. Recently, the developers announced the new add-on named Bota-3. Of course, Vlad immediately bought only to find out his computer is too old for the new game and needs to be updated.
There are *n* video cards in the shop, the power of the *i*-th video card is equal t... | {"inputs": ["4\n3 2 15 9", "4\n8 2 2 7", "1\n1", "1\n123819", "10\n9 6 8 5 5 2 8 9 2 2", "100\n17 23 71 25 50 71 85 46 78 72 89 26 23 70 40 59 23 43 86 81 70 89 92 98 85 88 16 10 26 91 61 58 23 13 75 39 48 15 73 79 59 29 48 32 45 44 25 37 58 54 45 67 27 77 20 64 95 41 80 53 69 24 38 97 59 94 50 88 92 47 95 31 66 48 48 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
65e7b8d199c55a9034c457643be6e021 | Help Kingdom of Far Far Away 2 | For some time the program of rounding numbers that had been developed by the Codeforces participants during one of the previous rounds, helped the citizens of Far Far Away to convert numbers into a more easily readable format. However, as time went by, the economy of the Far Far Away developed and the scale of operatio... | {"inputs": ["2012", "0.000", "-0.00987654321", "-12345678.9", "0.99999999999999999999", "-999999999.9999999999", "4.30", "-3136", "47.849", "0", "-1", "5.3944", "-359789", "-999999", "50117.75", "-2717.859", "446900763", "-92.04295", "1000000000", "-4097961.5", "-83348637.91", "741968647.01", "8590210736.2", "-33732263... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 55 | codeforces | |
65f128e7e76e33b5ae2e810771d106aa | Alice, Bob, Two Teams | Alice and Bob are playing a game. The game involves splitting up game pieces into two teams. There are *n* pieces, and the *i*-th piece has a strength *p**i*.
The way to split up game pieces is split into several steps:
1. First, Alice will split the pieces into two different groups *A* and *B*. This can be seen as ... | {"inputs": ["5\n1 2 3 4 5\nABABA", "5\n1 2 3 4 5\nAAAAA", "1\n1\nB", "10\n1 9 7 6 2 4 7 8 1 3\nABBABAABBB", "100\n591 417 888 251 792 847 685 3 182 461 102 348 555 956 771 901 712 878 580 631 342 333 285 899 525 725 537 718 929 653 84 788 104 355 624 803 253 853 201 995 536 184 65 205 540 652 549 777 248 405 677 950 43... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 68 | codeforces | |
6647d15d8b35c41ac84591549e47957e | Guess the Tree | Iahub and Iahubina went to a picnic in a forest full of trees. Less than 5 minutes passed before Iahub remembered of trees from programming. Moreover, he invented a new problem and Iahubina has to solve it, otherwise Iahub won't give her the food.
Iahub asks Iahubina: can you build a rooted tree, such that
- each i... | {"inputs": ["4\n1 1 1 4", "5\n1 1 5 2 1", "13\n1 1 1 1 1 1 1 1 1 4 4 4 13", "4\n1 1 1 3", "24\n1 1 1 1 1 1 1 1 1 1 1 1 24 1 1 1 1 1 1 1 1 1 1 1", "24\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24", "10\n1 1 1 1 7 1 1 1 4 10", "24\n1 1 3 1 1 10 2 9 13 1 8 1 4 1 3 24 1 1 1 1 4 1 3 1", "24\n2 3 20 1 4 9 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
6672c1b44ded24c3820de2d7af58959a | Read Time | Mad scientist Mike does not use slow hard disks. His modification of a hard drive has not one, but *n* different heads that can read data in parallel.
When viewed from the side, Mike's hard drive is an endless array of tracks. The tracks of the array are numbered from left to right with integers, starting with 1. In t... | {"inputs": ["3 4\n2 5 6\n1 3 6 8", "3 3\n1 2 3\n1 2 3", "1 2\n165\n142 200", "1 2\n5000000000\n1 10000000000", "2 4\n3 12\n1 7 8 14", "3 3\n1 2 3\n2 3 4", "2 1\n1 10\n9", "3 19\n7 10 13\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19", "3 3\n2 3 4\n1 3 5", "10 11\n1 909090909 1818181817 2727272725 3636363633 454545454... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
669ea39a865cf70eb2919884abde7dbd | Capture Valerian | It's now 260 AD. Shapur, being extremely smart, became the King of Persia. He is now called Shapur, His majesty King of kings of Iran and Aniran.
Recently the Romans declared war on Persia. They dreamed to occupy Armenia. In the recent war, the Romans were badly defeated. Now their senior army general, Philip is captu... | {"inputs": ["10 2\n1", "16 R\n5", "5 R\n4", "2 2\n1111001", "12 13\nA", "6 7\n12345", "25 12\nABG", "17 10\nABACG", "18 R\nGH", "20 25\n4E32BB21D812", "15 11\n760595A635B24", "10 22\n956512026633000", "5 9\n1102101401441324123301", "23 4\nDL5K6H78CAH", "18 R\n36E", "13 2\n1B579528314B30", "8 13\n20043013541570572", "19... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
66a7f66baf08ce934bace8df2aaf42ee | Convenient For Everybody | In distant future on Earth day lasts for *n* hours and that's why there are *n* timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to *n* are used, i.e. there is no time "0 hours", instead of it "*n* hours" is used. When local time in the 1-st timezone is 1 ... | {"inputs": ["3\n1 2 3\n1 3", "5\n1 2 3 4 1\n1 3", "2\n5072 8422\n1 2", "10\n7171 2280 6982 9126 9490 2598 569 6744 5754 1855\n7 9", "10\n5827 8450 8288 5592 6627 8234 3557 7568 4607 6949\n2 10", "50\n2847 339 1433 128 5933 4805 4277 5697 2574 9638 6992 5045 2254 7675 7503 3802 4012 1388 5307 3652 4764 214 9507 1832 118... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
66b208b49de57d1fc0d9b8aaf388e993 | Mishka and Game | Mishka is a little polar bear. As known, little bears loves spending their free time playing dice for chocolates. Once in a wonderful sunny morning, walking around blocks of ice, Mishka met her friend Chris, and they started playing the game.
Rules of the game are very simple: at first number of rounds *n* is defined.... | {"inputs": ["3\n3 5\n2 1\n4 2", "2\n6 1\n1 6", "3\n1 5\n3 3\n2 2", "6\n4 1\n4 2\n5 3\n5 1\n5 3\n4 1", "8\n2 4\n1 4\n1 5\n2 6\n2 5\n2 5\n2 4\n2 5", "8\n4 1\n2 6\n4 2\n2 5\n5 2\n3 5\n5 2\n1 5", "9\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n2 1\n2 1\n1 3", "9\n2 1\n2 1\n2 1\n2 1\n2 1\n1 6\n1 6\n1 6\n1 6", "9\n1 2\n1 2\n1 2\n1 2\n1 2\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 584 | codeforces | |
6723baca5db7b202f4866cca6b94ad57 | Cubes | Let's imagine that you're playing the following simple computer game. The screen displays *n* lined-up cubes. Each cube is painted one of *m* colors. You are allowed to delete not more than *k* cubes (that do not necessarily go one after another). After that, the remaining cubes join together (so that the gaps are clos... | {"inputs": ["10 3 2\n1 2 1 1 3 2 1 1 2 2", "10 2 2\n1 2 1 2 1 1 2 1 1 2", "3 1 2\n1 1 1", "10 2 2\n1 1 1 2 1 2 1 2 1 1", "1 1 0\n1", "20 3 5\n2 2 3 1 2 2 3 3 3 2 1 2 3 1 1 3 3 3 2 3", "20 2 5\n2 2 1 2 1 2 1 2 1 1 2 1 2 2 1 2 2 1 2 1", "20 6 3\n4 1 2 6 3 3 2 5 2 5 2 1 1 4 1 2 2 1 1 4", "30 5 8\n1 4 1 5 3 4 4 1 1 4 1 3 5... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
672869e84817a94bff50a4be90966cd2 | Continued Fractions | A continued fraction of height *n* is a fraction of form . You are given two rational numbers, one is represented as and the other one is represented as a finite fraction of height *n*. Check if they are equal.
The first line contains two space-separated integers *p*,<=*q* (1<=≤<=*q*<=≤<=*p*<=≤<=1018) — the numerator ... | {"inputs": ["9 4\n2\n2 4", "9 4\n3\n2 3 1", "9 4\n3\n1 2 4", "39088169 24157817\n36\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2", "39088169 24157817\n36\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4", "61305790721611591 37889062373143906\n80\n1 1 1 1 1 1 1 1 1 1 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 65 | codeforces | |
67347f3321f7532c4e1985451bfacafe | Boredom | Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.
Given a sequence *a* consisting of *n* integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it *a*... | {"inputs": ["2\n1 2", "3\n1 2 3", "9\n1 2 1 3 2 2 2 2 3", "5\n3 3 4 5 4", "5\n5 3 5 3 4", "5\n4 2 3 2 5", "10\n10 5 8 9 5 6 8 7 2 8", "10\n1 1 1 1 1 1 2 3 4 4", "100\n6 6 8 9 7 9 6 9 5 7 7 4 5 3 9 1 10 3 4 5 8 9 6 5 6 4 10 9 1 4 1 7 1 4 9 10 8 2 9 9 10 5 8 9 5 6 8 7 2 8 7 6 2 6 10 8 6 2 5 5 3 2 8 8 5 3 6 2 1 4 7 2 7 3 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 359 | codeforces | |
6735696886855248ebfe10fd886b0fa1 | Draw Brackets! | A sequence of square brackets is regular if by inserting symbols "+" and "1" into it, you can get a regular mathematical expression from it. For example, sequences "[[]][]", "[]" and "[[][[]]]" — are regular, at the same time "][", "[[]" and "[[]]][" — are irregular.
Draw the given sequence using a minimalistic pseud... | {"inputs": ["8\n[[][]][]", "6\n[[[]]]", "6\n[[][]]", "2\n[]", "4\n[][]", "4\n[[]]", "6\n[][][]", "6\n[][[]]", "6\n[[]][]", "100\n[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]", "100\n[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
673feee697cb87c2999a30d43e4b7045 | Naming Company | Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.
To settle this problem, they've decided to play a game. The company name will consist of *n* letters. Oleg and Igor ... | {"inputs": ["tinkoff\nzscoder", "xxxxxx\nxxxxxx", "ioi\nimo", "abc\naaa", "reddit\nabcdef", "cbxz\naaaa", "bcdef\nabbbc", "z\ny", "y\nz"], "outputs": ["fzfsirk", "xxxxxx", "ioi", "aab", "dfdeed", "abac", "bccdb", "z", "y"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 15 | codeforces | |
674b04517890642f598b058b223c1c1c | A Problem about Polyline | There is a polyline going through points (0,<=0)<=–<=(*x*,<=*x*)<=–<=(2*x*,<=0)<=–<=(3*x*,<=*x*)<=–<=(4*x*,<=0)<=–<=...<=-<=(2*kx*,<=0)<=–<=(2*kx*<=+<=*x*,<=*x*)<=–<=....
We know that the polyline passes through the point (*a*,<=*b*). Find minimum positive value *x* such that it is true or determine that there is no ... | {"inputs": ["3 1", "1 3", "4 1", "1000000000 1000000000", "1000000000 1", "991691248 43166756", "973970808 679365826", "404878182 80324806", "405262931 391908625", "758323881 37209930", "405647680 36668977", "750322953 61458580", "406032429 31993512", "1000000000 111111111", "999999999 111111111", "999999998 111111111"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 31 | codeforces | |
6757acaebc046655e71b78e491135cbb | Olympiad | A boy named Vasya has taken part in an Olympiad. His teacher knows that in total Vasya got at least *x* points for both tours of the Olympiad. The teacher has the results of the first and the second tour of the Olympiad but the problem is, the results have only points, no names. The teacher has to know Vasya's chances.... | {"inputs": ["5 2\n1 1 1 1 1\n1 1 1 1 1", "6 7\n4 3 5 6 4 4\n8 6 0 4 3 4", "1 100\n56\n44", "5 1\n1 2 3 4 5\n1 2 3 4 5", "5 5\n2 2 2 2 2\n3 3 3 3 3", "4 100\n98 98 99 100\n1 1 2 2", "5 45\n1 2 3 4 5\n10 20 30 40 50", "10 5\n3 1 1 2 1 3 1 1 2 3\n2 1 3 2 1 3 3 3 3 1", "10 0\n3 3 1 1 1 2 3 0 0 3\n1 3 0 1 2 0 3 3 0 0", "10 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
6758ce3610d53f6a3784f8efd8e06410 | Qualifying Contest | Very soon Berland will hold a School Team Programming Olympiad. From each of the *m* Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by *n* Berland students. There were at least two schoolboys participating from each of th... | {"inputs": ["5 2\nIvanov 1 763\nAndreev 2 800\nPetrov 1 595\nSidorov 1 790\nSemenov 2 503", "5 2\nIvanov 1 800\nAndreev 2 763\nPetrov 1 800\nSidorov 1 800\nSemenov 2 503", "10 2\nSHiBIEz 2 628\nXxwaAxB 1 190\nXwR 2 290\nRKjOf 2 551\nTUP 1 333\nFarsFvyH 1 208\nCGDYnq 1 482\nqaM 2 267\nVfiLunRz 1 416\nuVMHLk 2 754", "10 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 17 | codeforces | |
675f42df09900c5ecbac9bbbc4961e7a | Merge Sort | Merge sort is a well-known sorting algorithm. The main function that sorts the elements of array *a* with indices from [*l*,<=*r*) can be implemented as follows:
1. If the segment [*l*,<=*r*) is already sorted in non-descending order (that is, for any *i* such that *l*<=≤<=*i*<=<<=*r*<=-<=1 *a*[*i*]<=≤<=*a*[*i*<=+... | {"inputs": ["3 3", "4 1", "5 6", "100 100", "10000 10001", "10000 20001", "10000 30001", "20000 10001", "20000 20001", "20000 30001", "30000 10001", "30000 20001", "30000 30001", "40000 10001", "40000 20001", "40000 30001", "50000 10001", "50000 20001", "50000 30001", "60000 10001", "60000 20001", "60000 30001", "70000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 40 | codeforces | |
676d7d8ba8d2e382fd2b536381577b77 | Almost Prime | A number is called almost prime if it has exactly two distinct prime divisors. For example, numbers 6, 18, 24 are almost prime, while 4, 8, 9, 42 are not. Find the amount of almost prime numbers which are between 1 and *n*, inclusive.
Input contains one integer number *n* (1<=≤<=*n*<=≤<=3000).
Output the amount of almo... | {"inputs": ["10", "21", "1", "2", "4", "3", "8", "19", "40", "77", "222", "987", "1000", "2000", "3000", "2999", "2998", "2997", "1429", "1673", "1500", "500", "856"], "outputs": ["2", "8", "0", "0", "0", "0", "1", "6", "19", "41", "125", "501", "508", "958", "1375", "1375", "1375", "1374", "706", "808", "732", "266", ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 586 | codeforces | |
6770639456b30696194d24f4aff1cfe0 | Board Game | Polycarp and Vasiliy love simple logical games. Today they play a game with infinite chessboard and one pawn for each player. Polycarp and Vasiliy move in turns, Polycarp starts. In each turn Polycarp can move his pawn from cell (*x*,<=*y*) to (*x*<=-<=1,<=*y*) or (*x*,<=*y*<=-<=1). Vasiliy can move his pawn from (*x*,... | {"inputs": ["2 1 2 2", "4 7 7 4", "20 0 7 22", "80 100 83 97", "80 100 77 103", "55000 60000 55003 60100", "100000 100000 100000 99999", "100000 99999 100000 100000", "0 100000 100000 99999", "0 100000 99999 100000", "0 90000 89999 89999", "0 1 0 2", "0 1 1 0", "0 1 1 1", "0 1 1 2", "0 1 2 0", "0 1 2 1", "0 1 2 2", "0 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 13 | codeforces | |
6770d28df371e4b6ceb7802e0142726f | Grasshopper And the String | One day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became interested what is the minimum jump ability he should have in order to be able to reach the far end of the string, jumping only on vowels of the English alphabet. Jump ability is the maximum possible length of ... | {"inputs": ["ABABBBACFEYUKOTT", "AAA", "A", "B", "AEYUIOAEIYAEOUIYOEIUYEAOIUEOEAYOEIUYAEOUIYEOIKLMJNHGTRWSDZXCVBNMHGFDSXVWRTPPPLKMNBXIUOIUOIUOIUOOIU", "AEYUIOAEIYAEOUIYOEIUYEAOIUEOEAYOEIUYAEOUIYEOIAEYUIOAEIYAEOUIYOEIUYEAOIUEOEAYOEIUYAEOUIYEOI", "KMLPTGFHNBVCDRFGHNMBVXWSQFDCVBNHTJKLPMNFVCKMLPTGFHNBVCDRFGHNMBVXWSQFDCVBNH... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 203 | codeforces | |
67881ae428f6a4036f08f27aa010df48 | Appleman and Card Game | Appleman has *n* cards. Each card has an uppercase letter written on it. Toastman must choose *k* cards from Appleman's cards. Then Appleman should give Toastman some coins depending on the chosen cards. Formally, for each Toastman's card *i* you should calculate how much Toastman's cards have the letter equal to lette... | {"inputs": ["15 10\nDZFDFZDFDDDDDDF", "6 4\nYJSNPI", "5 3\nAOWBY", "1 1\nV", "2 1\nWT", "2 2\nBL", "5 1\nFACJT", "5 5\nMJDIJ", "15 5\nAZBIPTOFTJCJJIK", "100 1\nEVEEVEEEGGECFEHEFVFVFHVHEEEEEFCVEEEEEEVFVEEVEEHEEVEFEVVEFEEEFEVECEHGHEEFGEEVCEECCECEFHEVEEEEEEGEEHVH", "100 15\nKKTFFUTFCKUIKKKKFIFFKTUKUUKUKKIKKKTIFKTKUCFFKKKI... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 292 | codeforces | |
67b8c70d7eeee85ba2167799826eef08 | Fafa and his Company | Fafa owns a company that works on huge projects. There are *n* employees in Fafa's company. Whenever the company has a new project to start working on, Fafa has to divide the tasks of this project among all the employees.
Fafa finds doing this every time is very tiring for him. So, he decided to choose the best *l* em... | {"inputs": ["2", "10", "3", "4", "6", "13", "100000", "1024", "99999", "10007", "4096", "65536", "40320", "30030", "161", "1000", "10000", "777", "121", "25", "40000", "99990", "98765", "56789", "13579", "97531", "12345", "54321", "83160", "9", "21", "11", "15"], "outputs": ["1", "3", "1", "2", "3", "1", "35", "10", "1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 649 | codeforces | |
67c7db44ad516d4d9637eea2d9ffa9ef | Cards | Catherine has a deck of *n* cards, each of which is either red, green, or blue. As long as there are at least two cards left, she can do one of two actions:
- take any two (not necessarily adjacent) cards with different colors and exchange them for a new card of the third color; - take any two (not necessarily adja... | {"inputs": ["2\nRB", "3\nGRG", "5\nBBBBB", "1\nR", "200\nBBRGRRBBRGGGBGBGBGRRGRGRGRBGRGRRBBGRGBGRRGRRRGGBBRGBGBGBRBBBBBBBGGBRGGRRRGGRGBGBGGBRRRRBRRRBRBBGGBGBRGRGBBBBGGBGBBBGBGRRBRRRGBGGBBBRBGRBRRGGGRRGBBBGBGRRRRRRGGRGRGBBBRGGGBGGGBRBBRRGBGRGRBRRRBRBGRGGBRBB", "101\nRRRRRRRRRRRRRRRRRRRBRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 62 | codeforces | |
67d44d56308d1ed231216c9f73dde7c5 | 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": ["3\ni\nlove\nyou\n<3i<3love<23you<3", "7\ni\nam\nnot\nmain\nin\nthe\nfamily\n<3i<>3am<3the<3<main<3in<3the<3><3family<3", "3\ni\nlove\nyou\n<3i<3lo<3ve<3y<<<<<<<ou3<3", "4\na\nb\nc\nd\n<3a<3b<3c<3d", "4\na\nb\nc\nd\na<3b<3c<3d<3", "3\ni\nlove\nyou\n<3i<3love<3you<3", "1\na\na", "1\na\n<3a<3b", "1\naa\n<3a<3... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 34 | codeforces | |
6811358b57ceb6396694af8cc77a194d | Buttons | Manao is trying to open a rather challenging lock. The lock has *n* buttons on it and to open it, you should press the buttons in a certain order to open the lock. When you push some button, it either stays pressed into the lock (that means that you've guessed correctly and pushed the button that goes next in the seque... | {"inputs": ["2", "3", "4", "1", "10", "2000", "1747", "889", "1999", "914", "996", "17", "50", "91", "92", "256", "512", "666", "667", "314", "1241", "1500", "1837", "1000"], "outputs": ["3", "7", "14", "1", "175", "1333335000", "888644743", "117099969", "1331335999", "127259419", "164675486", "833", "20875", "125671",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 130 | codeforces | |
6817ec8c524a6cdd6f48f850c1a03b5b | Modular Equations | Last week, Hamed learned about a new type of equations in his math class called Modular Equations. Lets define *i* modulo *j* as the remainder of division of *i* by *j* and denote it by . A Modular Equation, as Hamed's teacher described, is an equation of the form in which *a* and *b* are two non-negative integers and... | {"inputs": ["21 5", "9435152 272", "10 10", "0 1000000000", "11 2", "1 0", "0 0", "121 0", "772930485 686893955", "257424 24", "295138437 589952171", "223093836 966", "233758336 10665466", "223092887 17", "223094728 1858", "223092899 29", "997920 0", "887043 3", "124 24", "982901 101", "357987 35", "954374 1030", "4910... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 89 | codeforces | |
683c27dac16cdfe6eaa07b2cd1c495d6 | GukiZ hates Boxes | Professor GukiZ is concerned about making his way to school, because massive piles of boxes are blocking his way.
In total there are *n* piles of boxes, arranged in a line, from left to right, *i*-th pile (1<=≤<=*i*<=≤<=*n*) containing *a**i* boxes. Luckily, *m* students are willing to help GukiZ by removing all the ... | {"inputs": ["2 1\n1 1", "3 2\n1 0 2", "4 100\n3 4 5 4", "5 8\n121351 0 13513 0 165454", "6 6\n0 10 0 0 10 0", "1 1\n1", "1 100000\n1", "1 100000\n1000000000", "1 1\n1000000000", "20 20\n0 0 0 0 0 0 154 0 0 0 0 0 0 0 0 0 0 0 0 0", "10 10\n0 0 0 100 0 0 0 0 0 0", "15 20\n0 0 0 500 0 0 0 0 400 0 0 0 0 0 0", "5 3\n0 0 14 0... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
685766372374c5357654ecb9e8d5a092 | Fight Against Traffic | Little town Nsk consists of *n* junctions connected by *m* bidirectional roads. Each road connects two distinct junctions and no two roads connect the same pair of junctions. It is possible to get from any junction to any other junction by these roads. The distance between two junctions is equal to the minimum possible... | {"inputs": ["5 4 1 5\n1 2\n2 3\n3 4\n4 5", "5 4 3 5\n1 2\n2 3\n3 4\n4 5", "5 6 1 5\n1 2\n1 3\n1 4\n4 5\n3 5\n2 5", "2 1 2 1\n1 2", "3 2 2 3\n1 2\n2 3", "3 2 1 3\n1 2\n2 3", "3 3 2 3\n1 2\n2 3\n1 3"], "outputs": ["0", "5", "3", "0", "1", "0", "0"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 19 | codeforces | |
685a6673a4ee325db24fee9ffee225da | Ghd | John Doe offered his sister Jane Doe find the gcd of some set of numbers *a*.
Gcd is a positive integer *g*, such that all number from the set are evenly divisible by *g* and there isn't such *g*' (*g*'<=><=*g*), that all numbers of the set are evenly divisible by *g*'.
Unfortunately Jane couldn't cope with the ta... | {"inputs": ["6\n6 2 3 4 5 6", "5\n5 5 6 10 15", "100\n32 40 7 3 7560 21 7560 7560 10 12 3 7560 7560 7560 7560 5 7560 7560 6 7560 7560 7560 35 7560 18 7560 7560 7560 7560 7560 48 2 7 25 7560 2 2 49 7560 7560 15 16 7560 7560 2 7560 27 7560 7560 7560 7560 3 5 7560 8 7560 42 45 5 7560 5 7560 4 7 3 7560 7 3 7560 7 2 7560 75... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
685f668a8903dff2f2a9f3a5dcc24c21 | Nuclear Fusion | There is the following puzzle popular among nuclear physicists.
A reactor contains a set of *n* atoms of some chemical elements. We shall understand the phrase "atomic number" as the number of this atom's element in the periodic table of the chemical elements.
You are allowed to take any two different atoms and fuse ... | {"inputs": ["10 3\nMn Co Li Mg C P F Zn Sc K\nSn Pt Y", "2 1\nH H\nHe", "2 2\nBk Fm\nCf Es", "8 8\nTl Pb Bi Po Np Pu Am Cm\nAt Rn Fr Ra Ac Th Pa U", "4 2\nZr Nb Sr Zr\nHg Au", "8 1\nBe B N O Ne Na Al Si\nHf", "7 3\nH He Be O S Ge Gd\nIr Cr Fe", "6 3\nCl Ni Ti V Ar Cu\nRh Br La", "5 5\nOs Lu Ta Re W\nW Ta Re Os Lu", "8 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
6860f3118664ad3c940eaa801d33763f | Minimum and Maximum | This is an interactive problem. You have to use flush operation right after printing each line. For example, in C++ you should use function fflush(stdout), in Java — System.out.flush(), in Pascal — flush(output) and in Python — sys.stdout.flush().
In this problem, you need to find maximal and minimal elements of an ar... | {"inputs": ["2\n2\n2 1\n3\n1 1 1", "1\n4\n1 1 2 2", "2\n5\n1 1 2 1 1\n3\n3 2 1", "2\n6\n2 1 2 1 2 2\n3\n2 2 1", "2\n4\n2 3 3 3\n5\n4 4 4 3 2", "1\n10\n1 2 1 2 1 3 1 3 1 2", "1\n1\n1", "2\n2\n1 2\n2\n2 1", "6\n3\n1 2 3\n3\n1 3 2\n3\n2 1 3\n3\n2 3 1\n3\n3 1 2\n3\n3 2 1", "24\n4\n1 2 3 4\n4\n1 2 4 3\n4\n1 3 2 4\n4\n1 3 4 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
6898b78f6da5c9b53c37dff69497cf71 | none | Stepan had a favorite string *s* which consisted of the lowercase letters of the Latin alphabet.
After graduation, he decided to remember it, but it was a long time ago, so he can't now remember it. But Stepan remembers some information about the string, namely the sequence of integers *c*1,<=*c*2,<=...,<=*c**n*, whe... | {"inputs": ["6\n6 3 1 0 0 0", "4\n4 0 0 0", "1\n1", "5\n5 0 0 0 0", "10\n10 8 7 6 5 4 3 2 1 0", "20\n20 16 12 8 5 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0", "99\n99 26 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 11 | codeforces | |
689adc88f3b1fbc872a2e559e8d4e224 | Put Knight! | Petya and Gena play a very interesting game "Put a Knight!" on a chessboard *n*<=×<=*n* in size. In this game they take turns to put chess pieces called "knights" on the board so that no two knights could threat each other. A knight located in square (*r*,<=*c*) can threat squares (*r*<=-<=1,<=*c*<=+<=2), (*r*<=-<=1,<=... | {"inputs": ["2\n2\n1", "10\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10", "15\n10\n4\n7\n8\n9\n6\n2\n1\n3\n1\n5\n2\n3\n4\n5", "6\n10\n7\n10\n8\n5\n1", "100\n5\n6\n8\n7\n5\n7\n10\n2\n8\n3\n10\n3\n7\n3\n2\n7\n10\n3\n7\n3\n9\n5\n1\n1\n1\n5\n7\n5\n4\n8\n7\n3\n2\n10\n5\n10\n1\n10\n5\n2\n10\n6\n4\n10\n7\n6\n10\n8\n8\n5\n5\n7\n5\n7\n8\n6\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 25 | codeforces | |
68c4515d74411c8dc12e75c9f23458ad | Edge coloring of bipartite graph | You are given an undirected bipartite graph without multiple edges. You should paint the edges of graph to minimal number of colours, so that no two adjacent edges have the same colour.
The first line contains three integers *a*,<=*b*,<=*m* (1<=≤<=*a*,<=*b*<=≤<=1000, 0<=≤<=*m*<=≤<=105), *a* is the size of the first par... | {"inputs": ["4 3 5\n1 2\n2 2\n3 2\n4 1\n4 3", "4 3 5\n1 2\n2 2\n3 2\n4 1\n4 3", "4 3 0", "10 10 67\n1 1\n1 2\n1 3\n1 7\n1 9\n1 10\n2 1\n2 2\n2 3\n2 6\n2 8\n2 10\n3 2\n3 3\n3 6\n3 8\n3 9\n3 10\n4 1\n4 4\n4 5\n4 6\n4 7\n4 8\n5 2\n5 4\n5 7\n5 8\n5 9\n5 10\n6 1\n6 2\n6 3\n6 4\n6 6\n6 8\n6 9\n6 10\n7 2\n7 4\n7 6\n7 9\n7 10\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
68c89b5c6d3ad091555738ff9b320b01 | Urbanization | Local authorities have heard a lot about combinatorial abilities of Ostap Bender so they decided to ask his help in the question of urbanization. There are *n* people who plan to move to the cities. The wealth of the *i* of them is equal to *a**i*. Authorities plan to build two cities, first for *n*1 people and second ... | {"inputs": ["2 1 1\n1 5", "4 2 1\n1 4 2 3", "3 1 2\n1 2 3", "10 4 6\n3 5 7 9 12 25 67 69 83 96", "19 7 12\n1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 100000 100000", "100 9 6\n109 711 40 95 935 48 228 253 308 726 816 534 252 8 966 363 162 508 84 83 807 506 748 178 45 30 106 108 764 698 825 198 3... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 110 | codeforces | |
68d01f12124a47d6571ff3bdf392dfee | I'm bored with life | Holidays have finished. Thanks to the help of the hacker Leha, Noora managed to enter the university of her dreams which is located in a town Pavlopolis. It's well known that universities provide students with dormitory for the period of university studies. Consequently Noora had to leave Vičkopolis and move to Pavlopo... | {"inputs": ["4 3", "10 399603090", "6 973151934", "2 841668075", "7 415216919", "3 283733059", "11 562314608", "3 990639260", "11 859155400", "1 1", "5 3", "1 4", "5 4", "1 12", "9 7", "2 3", "6 11", "6 7", "11 11", "4 999832660", "7 999228288", "11 999257105", "11 999286606", "3 999279109", "999632727 11", "999625230 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 580 | codeforces | |
68f881cb48278b79a28b227309589ed8 | Generating Sets | You are given a set *Y* of *n* distinct positive integers *y*1,<=*y*2,<=...,<=*y**n*.
Set *X* of *n* distinct positive integers *x*1,<=*x*2,<=...,<=*x**n* is said to generate set *Y* if one can transform *X* to *Y* by applying some number of the following two operation to integers in *X*:
1. Take any integer *x**i* ... | {"inputs": ["5\n1 2 3 4 5", "6\n15 14 3 13 1 12", "6\n9 7 13 17 5 11", "10\n18 14 19 17 11 7 20 10 4 12", "100\n713 716 230 416 3 2 597 216 779 839 13 156 723 793 168 368 232 316 98 257 170 27 746 9 616 147 792 890 796 362 852 117 993 556 885 73 131 475 121 753 508 158 473 931 527 282 541 325 606 321 159 17 682 290 586... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 8 | codeforces | |
68fad3ac9deae97955c6f83d645d9847 | Divisibility Rules | Vasya studies divisibility rules at school. Here are some of them:
- Divisibility by 2. A number is divisible by 2 if and only if its last digit is divisible by 2 or in other words, is even.- Divisibility by 3. A number is divisible by 3 if and only if the sum of its digits is divisible by 3.- Divisibility by 4. A n... | {"inputs": ["10 10", "2 3", "2 2", "2 3", "2 4", "2 5", "2 6", "2 7", "2 8", "3 2", "3 3", "3 4", "3 5", "3 6", "3 7", "3 8", "4 2", "4 3", "4 4", "4 5", "4 6", "4 7", "4 8", "5 2", "5 3", "5 4", "5 5", "5 6", "5 7", "5 8", "6 2", "6 3", "6 4", "6 5", "6 6", "6 7", "6 8", "7 2", "7 3", "7 4", "7 5", "7 6", "7 7", "7 8"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
692e674495305d943f08aa56e354992d | Third Month Insanity | The annual college sports-ball tournament is approaching, which for trademark reasons we'll refer to as Third Month Insanity. There are a total of 2*N* teams participating in the tournament, numbered from 1 to 2*N*. The tournament lasts *N* rounds, with each round eliminating half the teams. The first round consists of... | {"inputs": ["2\n0 40 100 100\n60 0 40 40\n0 60 0 45\n0 60 55 0", "3\n0 0 100 0 100 0 0 0\n100 0 100 0 0 0 100 100\n0 0 0 100 100 0 0 0\n100 100 0 0 0 0 100 100\n0 100 0 100 0 0 100 0\n100 100 100 100 100 0 0 0\n100 0 100 0 0 100 0 0\n100 0 100 0 100 100 100 0", "2\n0 21 41 26\n79 0 97 33\n59 3 0 91\n74 67 9 0", "3\n0 7... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
693ab3157cd165892ac491541b2035b8 | Array | You've got an array *a*, consisting of *n* integers: *a*1,<=*a*2,<=...,<=*a**n*. Your task is to find a minimal by inclusion segment [*l*,<=*r*] (1<=≤<=*l*<=≤<=*r*<=≤<=*n*) such, that among numbers *a**l*,<= *a**l*<=+<=1,<= ...,<= *a**r* there are exactly *k* distinct numbers.
Segment [*l*,<=*r*] (1<=≤<=*l*<=≤<=*r*<=≤... | {"inputs": ["4 2\n1 2 2 3", "8 3\n1 1 2 2 3 3 4 5", "7 4\n4 7 7 4 7 4 7", "5 1\n1 7 2 3 2", "1 2\n666", "1 1\n5", "10 4\n1 1 2 2 3 3 4 4 4 4", "4 2\n3 3 4 3", "4 3\n4 4 4 2", "10 5\n15 17 2 13 3 16 4 5 9 12", "17 13\n34 15 156 11 183 147 192 112 145 30 88 37 1 98 3 162 148", "17 14\n271 158 573 88 792 767 392 646 392 3... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 96 | codeforces | |
696c1c749977e10e2eeedbc66e7b754f | Anfisa the Monkey | Anfisa the monkey learns to type. She is yet unfamiliar with the "space" key and can only type in lower-case Latin letters. Having typed for a fairly long line, Anfisa understood that it would be great to divide what she has written into *k* lines not shorter than *a* and not longer than *b*, for the text to resemble h... | {"inputs": ["3 2 5\nabrakadabra", "4 1 2\nabrakadabra", "3 1 2\nvgnfpo", "5 3 4\nvrrdnhazvexzjfv", "10 12 15\nctxgddcfdtllmpuxsjkubuqpldznulsilueakbwwlzgeyudyrjachmitfdcgyzszoejphrubpxzpdtgexaqpxgnoxwfjoikljudnoucirussumyhetfwgaoxfbugfiyjmp", "10 20 30\nbvdqvlxiyogiyimdlwdyxsummjgqxaxsucfeuegleetybsylpnepkqzbutibtlgqrb... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 89 | codeforces |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.