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 |
|---|---|---|---|---|---|---|---|---|---|
a3f1a98e1d913a9a756aac7c1010239d | Matching Names | Teachers of one programming summer school decided to make a surprise for the students by giving them names in the style of the "Hobbit" movie. Each student must get a pseudonym maximally similar to his own name. The pseudonym must be a name of some character of the popular saga and now the teachers are busy matching ps... | {"inputs": ["5\ngennady\ngalya\nboris\nbill\ntoshik\nbilbo\ntorin\ngendalf\nsmaug\ngaladriel", "1\na\na", "2\na\na\na\na", "2\na\nb\na\na", "2\nb\nb\na\na", "2\na\nb\na\nb", "10\nbaa\na\nba\naabab\naa\nbaab\nbb\nabbbb\na\na\na\nba\nba\nbaabbb\nba\na\naabb\nbaa\nab\nb", "10\nabaabbaaa\nacccccaacabc\nacbaabaaabbca\naaccc... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
a3f7d08d933ed661efd4b6e37e7599db | Minimum Difficulty | Mike is trying rock climbing but he is awful at it.
There are *n* holds on the wall, *i*-th hold is at height *a**i* off the ground. Besides, let the sequence *a**i* increase, that is, *a**i*<=<<=*a**i*<=+<=1 for all *i* from 1 to *n*<=-<=1; we will call such sequence a track. Mike thinks that the track *a*1, ...,... | {"inputs": ["3\n1 4 6", "5\n1 2 3 4 5", "5\n1 2 3 7 8", "3\n1 500 1000", "10\n1 2 3 4 5 6 7 8 9 10", "10\n1 4 9 16 25 36 49 64 81 100", "10\n300 315 325 338 350 365 379 391 404 416", "15\n87 89 91 92 93 95 97 99 101 103 105 107 109 111 112", "60\n3 5 7 8 15 16 18 21 24 26 40 41 43 47 48 49 50 51 52 54 55 60 62 71 74 84... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 416 | codeforces | |
a4657b14d49366265fcbca7ce5474e37 | Roman and Numbers | Roman is a young mathematician, very famous in Uzhland. Unfortunately, Sereja doesn't think so. To make Sereja change his mind, Roman is ready to solve any mathematical problem. After some thought, Sereja asked Roma to find, how many numbers are close to number *n*, modulo *m*.
Number *x* is considered close to number... | {"inputs": ["104 2", "223 4", "7067678 8", "202 10", "1306432 9", "9653092 9", "600038 6", "4064044 4", "5899025 7", "2496234323687 2", "1 1", "123456789123456789 2", "123 1", "6328128 6", "8966261 5", "8900064 4", "576021249 86", "682459775 6", "458498549 4", "511736928 87", "275126649 81", "576279776452 33", "4504977... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
a475ab27993339a77c13dc5ef2a69e3c | Diverse Team | There are $n$ students in a school class, the rating of the $i$-th student on Codehorses is $a_i$. You have to form a team consisting of $k$ students ($1 \le k \le n$) such that the ratings of all team members are distinct.
If it is impossible to form a suitable team, print "NO" (without quotes). Otherwise print "YES"... | {"inputs": ["5 3\n15 13 15 15 12", "5 4\n15 13 15 15 12", "4 4\n20 10 40 30", "1 1\n1", "100 53\n16 17 1 2 27 5 9 9 53 24 17 33 35 24 20 48 56 73 12 14 39 55 58 13 59 73 29 26 40 33 22 29 34 22 55 38 63 66 36 13 60 42 10 15 21 9 11 5 23 37 79 47 26 3 79 53 44 8 71 75 42 11 34 39 79 33 10 26 23 23 17 14 54 41 60 31 83 5... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 184 | codeforces | |
a4bd2375265606dcb3fc9755ddcf11e7 | Wonder Room | The start of the new academic year brought about the problem of accommodation students into dormitories. One of such dormitories has a *a*<=×<=*b* square meter wonder room. The caretaker wants to accommodate exactly *n* students there. But the law says that there must be at least 6 square meters per student in a room (... | {"inputs": ["3 3 5", "2 4 4", "1 1 1", "1 1000000000 1000000000", "8 7 5", "1000000000 1 1", "1000000000 1000000000 1000000000", "800000003 7 7", "11 7 7", "1000000000 1 1", "100000 100 1000", "1000000000 6000 1000000", "1 1000000000 1000000000", "980000000 2 100000", "13 7 6", "16 19 5", "258180623 16000 16000", "9999... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
a4c73b1bebe0b753f5fd0adb2bd62c52 | Jeff and Permutation | Jeff's friends know full well that the boy likes to get sequences and arrays for his birthday. Thus, Jeff got sequence *p*1,<=*p*2,<=...,<=*p**n* for his birthday.
Jeff hates inversions in sequences. An inversion in sequence *a*1,<=*a*2,<=...,<=*a**n* is a pair of indexes *i*,<=*j* (1<=≤<=*i*<=<<=*j*<=≤<=*n*), such... | {"inputs": ["2\n2 1", "9\n-2 0 -1 0 -1 2 1 0 -1", "9\n0 0 1 1 0 0 1 0 1", "8\n0 1 2 -1 -2 1 -2 2", "24\n-1 -1 2 2 0 -2 2 -1 0 0 2 -2 3 0 2 -3 0 -3 -1 1 0 0 -1 -2", "1\n0", "31\n-2 2 -2 -1 0 0 1 2 1 1 -1 -2 1 -1 -2 2 0 1 -1 -2 -1 -2 -1 2 2 2 2 1 1 0 1", "9\n1 -1 -1 0 -1 0 1 1 1", "5\n1 0 1 -2 1", "31\n-5 -5 5 3 -1 3 1 -... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
a4cc49fca72a78529802e27c6dbba97f | Bracket Sequences Concatenation Problem | A bracket sequence is a string containing only characters "(" and ")".
A regular bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters "1" and "+" between the original characters of the sequence. For example, bracket sequences "()()", "(())" are reg... | {"inputs": ["3\n)\n()\n(", "2\n()\n()", "7\n()(\n)\n)(\n())\n(((\n()()()\n()", "6\n(\n((\n(((\n))))\n)))))\n))))))", "9\n(()\n((())\n(\n)\n(()()(()())))\n)\n)(()(\n)())(\n)()(", "2\n(((((((((()\n)))))))))", "1\n)(", "1\n()", "2\n(((\n)))", "10\n()()(\n)((\n)()(((()(\n(((()(\n)(()((\n))\n()()()()\n))()))((\n)\n))())(", ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 44 | codeforces | |
a4d1149733c96e064b611faa2a965482 | Useful Decomposition | Ramesses knows a lot about problems involving trees (undirected connected graphs without cycles)!
He created a new useful tree decomposition, but he does not know how to construct it, so he asked you for help!
The decomposition is the splitting the edges of the tree in some simple paths in such a way that each two pa... | {"inputs": ["4\n1 2\n2 3\n3 4", "6\n1 2\n2 3\n3 4\n2 5\n3 6", "5\n1 2\n1 3\n1 4\n1 5", "2\n1 2", "8\n1 2\n1 3\n1 4\n1 8\n7 8\n6 8\n5 8", "9\n1 2\n1 3\n1 4\n1 5\n1 6\n6 7\n7 8\n7 9", "3\n2 3\n1 2"], "outputs": ["Yes\n1\n1 4", "No", "Yes\n4\n1 2\n1 3\n1 4\n1 5", "Yes\n1\n1 2", "No", "No", "Yes\n1\n1 3"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 21 | codeforces | |
a4f83e70290499e2174902d149702f3e | Keyboard | Vasya learns to type. He has an unusual keyboard at his disposal: it is rectangular and it has *n* rows of keys containing *m* keys in each row. Besides, the keys are of two types. Some of the keys have lowercase Latin letters on them and some of the keys work like the "Shift" key on standard keyboards, that is, they m... | {"inputs": ["2 2 1\nab\ncd\n1\nA", "2 2 1\nab\ncd\n1\ne", "2 2 1\nab\ncS\n5\nabcBA", "3 9 4\nqwertyuio\nasdfghjkl\nSzxcvbnmS\n35\nTheQuIcKbRoWnFOXjummsovertHeLazYDOG", "10 9 3\noboxlgpey\nyxcuwkkmp\njuqeflhwq\nsfnxqtjqS\nkkudcnyjl\nhgjlcrkjq\njnofqksxn\nqbhsnuguv\nlvahnifao\nebwnnlrwe\n35\nCodeforcesBetaRoundproblemAte... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 32 | codeforces | |
a51153791f483833a64b7568e351adfb | Mishka and Contest | Mishka started participating in a programming contest. There are $n$ problems in the contest. Mishka's problem-solving skill is equal to $k$.
Mishka arranges all problems from the contest into a list. Because of his weird principles, Mishka only solves problems from one of the ends of the list. Every time, he chooses ... | {"inputs": ["8 4\n4 2 3 1 5 1 6 4", "5 2\n3 1 2 1 3", "5 100\n12 34 55 43 21", "100 100\n44 47 36 83 76 94 86 69 31 2 22 77 37 51 10 19 25 78 53 25 1 29 48 95 35 53 22 72 49 86 60 38 13 91 89 18 54 19 71 2 25 33 65 49 53 5 95 90 100 68 25 5 87 48 45 72 34 14 100 44 94 75 80 26 25 7 57 82 49 73 55 43 42 60 34 8 51 11 71... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 265 | codeforces | |
a54faeb0d9470c4cfd362bc7fddfe085 | Coloring Brackets | Once Petya read a problem about a bracket sequence. He gave it much thought but didn't find a solution. Today you will face it.
You are given string *s*. It represents a correct bracket sequence. A correct bracket sequence is the sequence of opening ("(") and closing (")") brackets, such that it is possible to obtain ... | {"inputs": ["(())", "(()())", "()", "((()))", "()(())", "()()()", "(())(())", "()()()()()()()()()()()(())", "()(())()((()))", "()()(())()(())", "()()()()()()()()()()()()()()()()", "(()()())", "()(()())()", "(())()(())()", "()()(()())(())()()()", "()()()((((())))())()()()()()((()))()()(())()(((())))()(()())((())())((()(... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
a59b13d5653d4598ad0c3212f76b67ab | Mashmokh and ACM | Mashmokh's boss, Bimokh, didn't like Mashmokh. So he fired him. Mashmokh decided to go to university and participate in ACM instead of finding a new job. He wants to become a member of Bamokh's team. In order to join he was given some programming tasks and one week to solve them. Mashmokh is not a very experienced prog... | {"inputs": ["3 2", "6 4", "2 1", "1478 194", "1415 562", "1266 844", "680 1091", "1229 1315", "1766 1038", "1000 1", "2000 100", "1 1", "2000 1000", "1928 1504", "2000 2000", "29 99", "56 48", "209 370", "83 37", "49 110", "217 3", "162 161", "273 871", "43 1640", "1472 854", "1639 1056", "359 896", "1544 648", "436 13... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 79 | codeforces | |
a5a3bb978243d6aaa482cd809f293382 | Ilya and Sticks | In the evening, after the contest Ilya was bored, and he really felt like maximizing. He remembered that he had a set of *n* sticks and an instrument. Each stick is characterized by its length *l**i*.
Ilya decided to make a rectangle from the sticks. And due to his whim, he decided to make rectangles in such a way tha... | {"inputs": ["4\n2 4 4 2", "4\n2 2 3 5", "4\n100003 100004 100005 100006", "8\n5 3 3 3 3 4 4 4", "10\n123 124 123 124 2 2 2 2 9 9", "8\n10 10 10 10 11 10 11 10", "1\n1000000", "10\n10519 10519 10520 10520 10520 10521 10521 10521 10522 10523", "100\n4116 4116 4117 4117 4117 4117 4118 4119 4119 4119 4119 4120 4120 4120 41... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 53 | codeforces | |
a5bae04f5bb19ba1e9501f2a8499e803 | Number of Ways | You've got array *a*[1],<=*a*[2],<=...,<=*a*[*n*], consisting of *n* integers. Count the number of ways to split all the elements of the array into three contiguous parts so that the sum of elements in each part is the same.
More formally, you need to find the number of such pairs of indices *i*,<=*j* (2<=≤<=*i*<=≤<=... | {"inputs": ["5\n1 2 3 0 3", "4\n0 1 -1 0", "2\n4 1", "9\n0 0 0 0 0 0 0 0 0", "10\n2 5 -2 2 -3 -2 3 5 -5 -2", "1\n1", "3\n1 2 3", "100\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 1 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 | 103 | codeforces | |
a5e4fdeedafed69e2a72d16220c9c4f7 | Inna and Pink Pony | Dima and Inna are doing so great! At the moment, Inna is sitting on the magic lawn playing with a pink pony. Dima wanted to play too. He brought an *n*<=×<=*m* chessboard, a very tasty candy and two numbers *a* and *b*.
Dima put the chessboard in front of Inna and placed the candy in position (*i*,<=*j*) on the board.... | {"inputs": ["5 7 1 3 2 2", "5 5 2 3 1 1", "1 1 1 1 1 1", "23000 15500 100 333 9 1", "33999 99333 33000 99000 3 9", "5 7 1 3 1 2", "1 100 1 50 1 50", "1000 1 1 1 1 500", "304 400 12 20 4 4", "1000000 1000000 1000000 1000000 1000000 1000000", "1000000 99999 12345 23456 23 54", "50000 100000 500 1000 500 1000", "50000 100... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 8 | codeforces | |
a605b693f3432e792d6baf61b184cb2d | Fish | *n* fish, numbered from 1 to *n*, live in a lake. Every day right one pair of fish meet, and the probability of each other pair meeting is the same. If two fish with indexes i and j meet, the first will eat up the second with the probability *a**ij*, and the second will eat up the first with the probability *a**ji*<==<... | {"inputs": ["2\n0 0.5\n0.5 0", "4\n0 0.5 0.5 0.5\n0.5 0 0.5 0.5\n0.5 0.5 0 0.5\n0.5 0.5 0.5 0", "5\n0 1 1 1 1\n0 0 0.5 0.5 0.5\n0 0.5 0 0.5 0.5\n0 0.5 0.5 0 0.5\n0 0.5 0.5 0.5 0", "1\n0.000", "2\n0.000 0.551\n0.449 0.000", "3\n0.000 0.817 0.584\n0.183 0.000 0.665\n0.416 0.335 0.000", "4\n0.000 0.083 0.548 0.503\n0.917 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 9 | codeforces | |
a619d42eed633f3050df62f94d10b7c1 | King's Path | The black king is standing on a chess field consisting of 109 rows and 109 columns. We will consider the rows of the field numbered with integers from 1 to 109 from top to bottom. The columns are similarly numbered with integers from 1 to 109 from left to right. We will denote a cell of the field that is located in the... | {"inputs": ["5 7 6 11\n3\n5 3 8\n6 7 11\n5 2 5", "3 4 3 10\n3\n3 1 4\n4 5 9\n3 10 10", "1 1 2 10\n2\n1 1 3\n2 6 10", "9 8 7 8\n9\n10 6 6\n10 6 6\n7 7 8\n9 5 6\n8 9 9\n9 5 5\n9 8 8\n8 5 6\n9 10 10", "6 15 7 15\n9\n6 15 15\n7 14 14\n6 15 15\n9 14 14\n7 14 16\n6 15 15\n6 15 15\n7 14 14\n8 15 15", "13 16 20 10\n18\n13 16 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 68 | codeforces | |
a645e12baf8641d60fc64287c60ce752 | Trains | Vasya the programmer lives in the middle of the Programming subway branch. He has two girlfriends: Dasha and Masha, who live at the different ends of the branch, each one is unaware of the other one's existence.
When Vasya has some free time, he goes to one of his girlfriends. He descends into the subway at some time,... | {"inputs": ["3 7", "5 3", "2 3", "31 88", "8 75", "32 99", "77 4", "27 1", "84 11", "4 6", "52 53", "397 568", "22 332", "419 430", "638 619", "393 325", "876 218", "552 551", "906 912", "999 996", "652 653", "3647 7698", "2661 8975", "251 9731", "9886 8671", "8545 7312", "4982 2927", "7660 7658", "9846 9844", "9632 96... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 91 | codeforces | |
a64bde11b9445dc1e39be04d2fceef00 | Modified GCD | Well, here is another math class task. In mathematics, GCD is the greatest common divisor, and it's an easy task to calculate the GCD between two positive integers.
A common divisor for two positive numbers is a number which both numbers are divisible by.
But your teacher wants to give you a harder task, in this task... | {"inputs": ["9 27\n3\n1 5\n10 11\n9 11", "48 72\n2\n8 29\n29 37", "90 100\n10\n51 61\n6 72\n1 84\n33 63\n37 69\n18 21\n9 54\n49 90\n14 87\n37 90", "84 36\n1\n18 32", "90 36\n16\n13 15\n5 28\n11 30\n26 35\n2 8\n19 36\n3 17\n5 14\n4 26\n22 33\n16 33\n18 27\n4 17\n1 2\n29 31\n18 36", "84 90\n18\n10 75\n2 40\n30 56\n49 62\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 62 | codeforces | |
a65a8ddec22e98a4bdf4fef23ccebc2e | Animals | Once upon a time DravDe, an outstanding person famous for his professional achievements (as you must remember, he works in a warehouse storing Ogudar-Olok, a magical but non-alcoholic drink) came home after a hard day. That day he had to drink 9875 boxes of the drink and, having come home, he went to bed at once.
Drav... | {"inputs": ["3 4\n1 1 1", "3 6\n1 1 1", "1 12\n1", "3 100\n1 1 1", "5 75\n1 1 1 1 1", "7 115\n1 1 1 1 1 1 1", "10 1055\n7 1 1 2 8 7 8 2 5 8", "7 3623\n20 14 24 4 14 14 24", "10 3234\n24 2 28 18 6 15 31 2 28 16", "15 402\n3 3 3 3 2 2 3 3 3 3 3 3 2 2 1", "25 5523\n24 29 6 35 11 7 24 10 17 43 2 25 15 36 31 8 22 40 23 23 7... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 23 | codeforces | |
a67247ddc642337fb665ffad33a5c619 | Lunch Rush | Having written another programming contest, three Rabbits decided to grab some lunch. The coach gave the team exactly *k* time units for the lunch break.
The Rabbits have a list of *n* restaurants to lunch in: the *i*-th restaurant is characterized by two integers *f**i* and *t**i*. Value *t**i* shows the time the Rab... | {"inputs": ["2 5\n3 3\n4 5", "4 6\n5 8\n3 6\n2 3\n2 2", "1 5\n1 7", "4 9\n10 13\n4 18\n13 3\n10 6", "1 1\n1 1000000000", "1 1\n1000000000 1000000000", "1 1\n1000000000 1", "2 3\n1000000000 1\n2 2", "2 5\n1 7\n1 1000000000"], "outputs": ["4", "3", "-1", "13", "-999999998", "1", "1000000000", "1000000000", "-1"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 208 | codeforces | |
a67a70733c91214a0387239b6c5f3b0b | The Great Game | Two teams meet in The Game World Championship. Some scientists consider this game to be the most intellectually challenging game in the world. You are given two strings describing the teams' actions in the final battle. Figure out who became the champion.
The input contains two strings of equal length (between 2 and 20... | {"inputs": ["[]()[]8<\n8<[]()8<", "8<8<()\n[]8<[]", "()\n[]", "()\n8<", "8<\n[]", "[]8<()()()()8<8<8<[]\n()()[][][]8<[]()8<8<", "()[]()()()\n[]()[][]8<", "()\n8<", "()[][]()()[][]()8<8<\n8<[]()()()8<[][]()()", "()[][]8<\n8<()8<()", "8<()8<8<8<8<()8<\n[]()()8<()[][][]", "[][]8<8<8<8<\n8<[][]()8<()", "[]\n()", "8<8<8<[]\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 18 | codeforces | |
a6836333c0cd74c9f9fb81e34f53cab5 | Testing Robots | The Cybernetics Failures (CF) organisation made a prototype of a bomb technician robot. To find the possible problems it was decided to carry out a series of tests. At the beginning of each test the robot prototype will be placed in cell (*x*0,<=*y*0) of a rectangular squared field of size *x*<=×<=*y*, after that a min... | {"inputs": ["3 4 2 2\nUURDRDRL", "2 2 2 2\nULD", "1 1 1 1\nURDLUURRDDLLURDL", "15 17 8 9\nURRDLUULLDD", "15 17 8 9\nURRDLUULLDDDRRUR", "15 17 8 9\nURRDLUULLDDDRRURR", "1 2 1 1\nR", "2 1 1 1\nD", "1 2 1 2\nLR", "2 1 2 1\nUD", "4 4 2 2\nDRUL", "4 4 3 3\nLUDRUL", "15 17 8 9\nURRDLU", "15 17 8 9\nURRDLUULLDDR", "15 17 8 9\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 31 | codeforces | |
a6be5c5b3f940ae34740357bd4512ea4 | Petya and Strings | Little Petya loves presents. His mum bought him two strings of the same size for his birthday. The strings consist of uppercase and lowercase Latin letters. Now Petya wants to compare those two strings lexicographically. The letters' case does not matter, that is an uppercase letter is considered equivalent to the corr... | {"inputs": ["aaaa\naaaA", "abs\nAbz", "abcdefg\nAbCdEfF", "asadasdasd\nasdwasdawd", "aslkjlkasdd\nasdlkjdajwi", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "aAaaaAAaAaaAzZsssSsdDfeEaeqZlpP\nAaaaAaaAaaAaZzSSSSsDdFeeAeQZLpp", "bwuEhEveouaTECagLZiqmUdxEmhRSOzMauJRWLQMppZOumxhAmwuG... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 534 | codeforces | |
a6c0ec0f94b080801d3e32b45ed8ec9c | How Many Squares? | You are given a 0-1 rectangular matrix. What is the number of squares in it? A square is a solid square frame (border) with linewidth equal to 1. A square should be at least 2<=×<=2. We are only interested in two types of squares:
1. squares with each side parallel to a side of the matrix; 1. squares with each side... | {"inputs": ["2\n8 8\n00010001\n00101000\n01000100\n10000010\n01000100\n00101000\n11010011\n11000011\n10 10\n1111111000\n1000001000\n1011001000\n1011001010\n1000001101\n1001001010\n1010101000\n1001001000\n1000001000\n1111111000", "1\n12 11\n11111111111\n10000000001\n10111111101\n10100000101\n10101100101\n10101100101\n10... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
a6c41ea9c9ce50b21113df8a612d7106 | Nearest Minimums | You are given an array of *n* integer numbers *a*0,<=*a*1,<=...,<=*a**n*<=-<=1. Find the distance between two closest (nearest) minimums in it. It is guaranteed that in the array a minimum occurs at least two times.
The first line contains positive integer *n* (2<=≤<=*n*<=≤<=105) — size of the given array. The second l... | {"inputs": ["2\n3 3", "3\n5 6 5", "9\n2 1 3 5 4 1 2 3 1", "6\n4 6 7 8 6 4", "2\n1000000000 1000000000", "42\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 1 1 1 1 1 1 1", "2\n10000000 10000000", "5\n100000000 100000001 100000000 100000001 100000000", "9\n4 3 4 3 4 1 3 3 1", "3\n10000000 10000000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 217 | codeforces | |
a6cab46b8ce1e78c5fa12073774b1b7d | Alyona and Strings | After returned from forest, Alyona started reading a book. She noticed strings *s* and *t*, lengths of which are *n* and *m* respectively. As usual, reading bored Alyona and she decided to pay her attention to strings *s* and *t*, which she considered very similar.
Alyona has her favourite positive integer *k* and bec... | {"inputs": ["3 2 2\nabc\nab", "9 12 4\nbbaaababb\nabbbabbaaaba", "11 11 4\naaababbabbb\nbbbaaaabaab", "15 9 4\nababaaabbaaaabb\nbbaababbb", "2 7 1\nbb\nbbaabaa", "13 4 3\nabbaababaaaab\naaab", "2 3 2\nab\naab", "13 9 1\noaflomxegekyv\nbgwwqizfo", "5 9 1\nbabcb\nabbcbaacb", "8 12 2\nbccbbaac\nabccbcaccaaa", "11 2 2\nbcb... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
a6dbb69f10ce63f83e7b2804af0bd856 | The Golden Age | Unlucky year in Berland is such a year that its number *n* can be represented as *n*<==<=*x**a*<=+<=*y**b*, where *a* and *b* are non-negative integer numbers.
For example, if *x*<==<=2 and *y*<==<=3 then the years 4 and 17 are unlucky (4<==<=20<=+<=31, 17<==<=23<=+<=32<==<=24<=+<=30) and year 18 isn't unlucky as the... | {"inputs": ["2 3 1 10", "3 5 10 22", "2 3 3 5", "2 2 1 10", "2 2 1 1000000", "2 2 1 1000000000000000000", "2 3 1 1000000", "2 3 1 1000000000000000000", "12345 54321 1 1000000", "54321 12345 1 1000000000000000000", "2 3 100000000 1000000000000", "2 14 732028847861235712 732028847861235712", "14 2 732028847861235713 7320... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 93 | codeforces | |
a70764fb4fd16794e40aeac14235d364 | Berland National Library | Berland National Library has recently been built in the capital of Berland. In addition, in the library you can take any of the collected works of Berland leaders, the library has a reading room.
Today was the pilot launch of an automated reading room visitors' accounting system! The scanner of the system is installed... | {"inputs": ["6\n+ 12001\n- 12001\n- 1\n- 1200\n+ 1\n+ 7", "2\n- 1\n- 2", "2\n+ 1\n- 1", "5\n+ 1\n- 1\n+ 2\n+ 3\n- 4", "3\n- 1\n- 2\n- 3", "4\n+ 1\n+ 2\n- 1\n+ 3", "6\n+ 1\n+ 2\n- 1\n+ 3\n- 2\n+ 4", "3\n+ 1\n+ 2\n- 3", "3\n- 1\n+ 2\n- 2", "4\n- 1\n- 2\n+ 3\n+ 4", "1\n+ 1", "1\n- 1", "3\n- 1\n+ 1\n- 1", "10\n+ 1\n+ 2\n+ ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 37 | codeforces | |
a7154105f6f9c9c7b051cbe3640e655a | Mobile Communications | A sum of *p* rubles is charged from Arkady's mobile phone account every day in the morning. Among the following *m* days, there are *n* days when Arkady will top up the account: in the day *d**i* he will deposit *t**i* rubles on his mobile phone account. Arkady will always top up the account before the daily payment wi... | {"inputs": ["3 6 7\n2 13\n4 20\n7 9", "5 4 100\n10 70\n15 76\n21 12\n30 100\n67 85", "14 25 100\n1 209\n2 224\n3 58\n4 31\n5 135\n6 16\n7 130\n8 113\n9 230\n10 60\n11 209\n12 185\n13 118\n14 16", "1 1 1\n1 1", "1 2 1\n1 1", "1 2 1\n1 3", "1 1000000000 1\n1 1000000000", "1 100000000 1\n1 99999999", "10 1 10\n1 100000000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
a7575a52a521f677485b619b19b3277a | Toy Army | The hero of our story, Valera, and his best friend Arcady are still in school, and therefore they spend all the free time playing turn-based strategy "GAGA: Go And Go Again". The gameplay is as follows.
There are two armies on the playing field each of which consists of *n* men (*n* is always even). The current playe... | {"inputs": ["2", "4", "6", "8", "10", "140", "500", "1000", "2000", "50000", "10000", "25460", "54646", "59790", "578456", "56798056", "8457980", "5687986", "10984932", "99999994", "99999996", "99999998", "100000000"], "outputs": ["3", "6", "9", "12", "15", "210", "750", "1500", "3000", "75000", "15000", "38190", "8196... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 270 | codeforces | |
a75c2796222c96034eb516cffb9cd766 | Yet Another Number Game | Since most contestants do not read this part, I have to repeat that Bitlandians are quite weird. They have their own jobs, their own working method, their own lives, their own sausages and their own games!
Since you are so curious about Bitland, I'll give you the chance of peeking at one of these games.
BitLGM and Bi... | {"inputs": ["2\n1 1", "2\n1 2", "3\n1 2 1", "2\n1 3", "2\n3 5", "2\n9 10", "2\n6 8", "3\n0 0 0", "2\n223 58", "2\n106 227", "2\n125 123", "3\n31 132 7", "2\n41 29", "3\n103 286 100", "3\n9 183 275", "3\n19 88 202", "3\n234 44 69", "3\n244 241 295", "1\n6", "1\n231", "2\n241 289", "2\n200 185", "2\n218 142", "3\n124 47 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
a769601d5a0746ed3aedd5004fa7c43c | The Door Problem | Moriarty has trapped *n* people in *n* distinct rooms in a hotel. Some rooms are locked, others are unlocked. But, there is a condition that the people in the hotel can only escape when all the doors are unlocked at the same time. There are *m* switches. Each switch control doors of some rooms, but each door is control... | {"inputs": ["3 3\n1 0 1\n2 1 3\n2 1 2\n2 2 3", "3 3\n1 0 1\n3 1 2 3\n1 2\n2 1 3", "3 3\n1 0 1\n3 1 2 3\n2 1 2\n1 3", "11 10\n0 0 1 0 0 0 0 1 1 0 1\n3 2 3 11\n1 3\n2 6 7\n1 5\n1 11\n1 10\n5 4 6 8 9 10\n2 1 5\n1 7\n5 1 2 4 8 9", "10 9\n1 0 1 1 0 1 0 0 1 0\n4 2 3 9 10\n4 3 4 5 8\n2 1 6\n2 7 8\n1 7\n1 5\n1 10\n2 2 4\n3 1 6... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 13 | codeforces | |
a776432a650f3bf651bc2f3fd6206d17 | Volatile Kite | You are given a convex polygon *P* with *n* distinct vertices *p*1,<=*p*2,<=...,<=*p**n*. Vertex *p**i* has coordinates (*x**i*,<=*y**i*) in the 2D plane. These vertices are listed in clockwise order.
You can choose a real number *D* and move each vertex of the polygon a distance of at most *D* from their original pos... | {"inputs": ["4\n0 0\n0 1\n1 1\n1 0", "6\n5 0\n10 0\n12 -4\n10 -8\n5 -8\n3 -4", "19\n449447997 711296339\n530233434 692216537\n535464528 613140435\n535533467 100893188\n530498867 -265063956\n519107979 -271820709\n482156929 -287792333\n-303730271 -287970295\n-416935204 -263348201\n-443613873 -249980523\n-453444829 -17390... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 23 | codeforces | |
a797ac3b124c17d4c2c31ee0aba85c2c | The Way to Home | A frog lives on the axis *Ox* and needs to reach home which is in the point *n*. She starts from the point 1. The frog can jump to the right at a distance not more than *d*. So, after she jumped from the point *x* she can reach the point *x*<=+<=*a*, where *a* is an integer from 1 to *d*.
For each point from 1 to *n* ... | {"inputs": ["8 4\n10010101", "4 2\n1001", "8 4\n11100101", "12 3\n101111100101", "5 4\n11011", "5 4\n10001", "10 7\n1101111011", "10 9\n1110000101", "10 9\n1100000001", "20 5\n11111111110111101001", "20 11\n11100000111000011011", "20 19\n10100000000000000001", "50 13\n10011010100010100111010000010000000000010100000101"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 553 | codeforces | |
a7ac01ff36356b6ef5d9d6b3571169af | Approximating a Constant Range | When Xellos was doing a practice course in university, he once had to measure the intensity of an effect that slowly approached equilibrium. A good way to determine the equilibrium intensity would be choosing a sufficiently large number of consecutive data points that seems as constant as possible and taking their aver... | {"inputs": ["5\n1 2 3 3 2", "11\n5 4 5 5 6 7 8 8 8 7 6", "2\n3 2", "4\n1001 1000 1000 1001", "4\n1 1 2 3", "3\n1 2 1", "3\n1 2 3", "18\n10 9 8 7 6 5 4 3 2 1 2 3 4 5 6 7 8 9", "3\n1 2 2", "4\n10 9 10 9", "4\n4 3 2 3", "4\n8 8 7 7", "3\n99998 99999 100000", "3\n100000 99999 99998", "3\n1 1 1", "2\n99999 100000", "2\n1000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 188 | codeforces | |
a7b83f74c9b94bdf5a673fec7894c3ad | Down the Hatch! | Everybody knows that the Berland citizens are keen on health, especially students. Berland students are so tough that all they drink is orange juice!
Yesterday one student, Vasya and his mates made some barbecue and they drank this healthy drink only. After they ran out of the first barrel of juice, they decided to pl... | {"inputs": ["4\nabbba", "4\nabbab", "4\naaa", "4\naab", "4\naabaabbba", "6\naaaaaaaaaaaaaaaa", "7\nabbbaaabbbaaaab", "9\naaaabaaaaa", "4\na", "4\nb", "4\nab", "4\nbb", "4\naba", "4\nbbb", "4\nabab", "4\nabaa", "4\nabbbaaabba", "4\nababba", "4\naaaaaa", "5\nbbbbaabaaa", "2000\na", "2000\naabaaabaabababbbbbbabbbbb", "4\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 38 | codeforces | |
a7b9003851fc4cb8632f1823cb585985 | Clear The Matrix | You are given a matrix *f* with 4 rows and *n* columns. Each element of the matrix is either an asterisk (*) or a dot (.).
You may perform the following operation arbitrary number of times: choose a square submatrix of *f* with size *k*<=×<=*k* (where 1<=≤<=*k*<=≤<=4) and replace each element of the chosen submatrix w... | {"inputs": ["4\n1 10 8 20\n***.\n***.\n***.\n...*", "7\n2 1 8 2\n.***...\n.***..*\n.***...\n....*..", "4\n10 10 1 10\n***.\n*..*\n*..*\n.***", "5\n4 3 4 4\n.....\n****.\n..***\n...**", "6\n15 3 18 16\n.*.***\n...**.\n*.....\n**..*.", "5\n2 1 2 1\n*.***\n***.*\n.*..*\n***..", "4\n2 23 19 1\n..**\n*...\n**.*\n.*.*", "4\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
a7f405ddb27670ecb47318df840304fc | Bus Video System | The busses in Berland are equipped with a video surveillance system. The system records information about changes in the number of passengers in a bus after stops.
If $x$ is the number of passengers in a bus just before the current bus stop and $y$ is the number of passengers in the bus just after current bus stop, th... | {"inputs": ["3 5\n2 1 -3", "2 4\n-1 1", "4 10\n2 4 1 2", "2 10\n-1 2", "3 4\n-3 -4 4", "10 1\n-1 -1 3 -4 2 3 0 -3 3 2", "5 21\n-3 2 -4 -1 -5", "5 9\n-2 -1 2 -1 -2", "8 7\n-5 0 -3 1 -1 5 0 -6", "3 4\n-2 -1 0", "1 1000000000\n0", "2 1000000000\n-1000000 -1000000", "2 1000000000\n1000000 -1000000", "2 1000000000\n-1000000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 20 | codeforces | |
a81e7d7125035b8f7bdaadf1cc9b1c92 | ACM ICPC | In a small but very proud high school it was decided to win ACM ICPC. This goal requires to compose as many teams of three as possible, but since there were only 6 students who wished to participate, the decision was to build exactly two teams.
After practice competition, participant number *i* got a score of *a**i*. ... | {"inputs": ["1 3 2 1 2 1", "1 1 1 1 1 99", "1000 1000 1000 1000 1000 1000", "0 0 0 0 0 0", "633 609 369 704 573 416", "353 313 327 470 597 31", "835 638 673 624 232 266", "936 342 19 398 247 874", "417 666 978 553 271 488", "71 66 124 199 67 147", "54 26 0 171 239 12", "72 8 186 92 267 69", "180 179 188 50 75 214", "16... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 279 | codeforces | |
a83d76638f25ffd2fcd9c09cc652d2c2 | Artem and Array | Artem has an array of *n* positive integers. Artem decided to play with it. The game consists of *n* moves. Each move goes like this. Artem chooses some element of the array and removes it. For that, he gets *min*(*a*,<=*b*) points, where *a* and *b* are numbers that were adjacent with the removed number. If the number... | {"inputs": ["5\n3 1 5 2 6", "5\n1 2 3 4 5", "5\n1 100 101 100 1", "10\n96 66 8 18 30 48 34 11 37 42", "1\n87", "2\n93 51", "3\n31 19 5", "4\n86 21 58 60", "5\n21 6 54 69 32", "6\n46 30 38 9 65 23", "7\n82 60 92 4 2 13 15", "8\n77 84 26 34 17 56 76 3", "9\n72 49 39 50 68 35 75 94 56", "10\n4 2 2 4 1 2 2 4 2 1", "1\n4", ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
a84f6423a5d54508f5988f076c9607ab | Magical Array | Valery is very interested in magic. Magic attracts him so much that he sees it everywhere. He explains any strange and weird phenomenon through intervention of supernatural forces. But who would have thought that even in a regular array of numbers Valera manages to see something beautiful and magical.
Valera absolutel... | {"inputs": ["4\n2 1 1 4", "5\n-2 -2 -2 0 1", "1\n10", "2\n5 6", "5\n5 5 4 5 5", "8\n1 2 0 0 0 0 3 3", "12\n-4 3 3 2 3 3 3 -4 2 -4 -4 -4", "10\n7 1 0 10 0 -5 -3 -2 0 0", "20\n6 0 0 -3 1 -3 0 -8 1 3 5 2 -1 -5 -1 9 0 6 -2 4", "100\n0 -18 -9 -15 3 16 -28 0 -28 0 28 -20 -9 9 -11 0 18 -15 -18 -26 0 -27 -25 -22 6 -5 8 14 -17 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 96 | codeforces | |
a850a1bcad64de860c139cea3c8ba010 | Zoo | The Zoo in the Grid Kingdom is represented by an infinite grid. The Zoo has *n* observation binoculars located at the *OX* axis. For each *i* between 1 and *n*, inclusive, there exists a single binocular located at the point with coordinates (*i*,<=0). There are *m* flamingos in the Zoo, located at points with positive... | {"inputs": ["5 5\n2 1\n4 1\n3 2\n4 3\n4 4", "3 3\n1 1\n2 10\n3 100", "1 2\n450000001 500000000\n900000001 1000000000", "3 6\n1 1\n1 2\n1 3\n2 1\n2 2\n3 1", "3 3\n227495634 254204506\n454991267 508409012\n715803819 799841973", "3 3\n96684705 23204141\n193369409 46408282\n217792636 52269809", "1000000 2\n136395332 110293... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
a855c7679049814a0a06cbf78812c973 | Greg and Caves | Greg has a pad. The pad's screen is an *n*<=×<=*m* rectangle, each cell can be either black or white. We'll consider the pad rows to be numbered with integers from 1 to *n* from top to bottom. Similarly, the pad's columns are numbered with integers from 1 to *m* from left to right.
Greg thinks that the pad's screen di... | {"inputs": ["1 1", "4 4", "3 5", "5 3", "5 5", "7 8", "9 8", "10 10", "100 100", "100 110", "100 200", "1 1000", "1000 1", "1000 3", "3 1000", "10 1000", "10 500", "250 250", "500 1000", "1000 500", "1000 1000", "1 2", "2000 2000", "1500 2000", "2000 1777", "1999 1994", "1994 1995", "1 2000", "2000 1", "2 2000", "2000 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
a8695a151c7d1fee85c1c1e62cc8f6c1 | Jeff and Furik | Jeff has become friends with Furik. Now these two are going to play one quite amusing game.
At the beginning of the game Jeff takes a piece of paper and writes down a permutation consisting of *n* numbers: *p*1, *p*2, ..., *p**n*. Then the guys take turns to make moves, Jeff moves first. During his move, Jeff chooses ... | {"inputs": ["2\n1 2", "5\n3 5 2 4 1", "16\n6 15 3 8 7 11 9 10 2 13 4 14 1 16 5 12", "9\n1 7 8 5 3 4 6 9 2", "5\n2 3 4 5 1", "9\n4 1 8 6 7 5 2 9 3", "10\n3 4 1 5 7 9 8 10 6 2", "13\n3 1 11 12 4 5 8 10 13 7 9 2 6", "10\n8 4 1 7 6 10 9 5 3 2", "2\n2 1", "95\n68 56 24 89 79 20 74 69 49 59 85 67 95 66 15 34 2 13 92 25 84 77... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 7 | codeforces | |
a875c5dded52170798e08effa7cb6695 | Vasya and Socks | Vasya has *n* pairs of socks. In the morning of each day Vasya has to put on a pair of socks before he goes to school. When he comes home in the evening, Vasya takes off the used socks and throws them away. Every *m*-th day (at days with numbers *m*,<=2*m*,<=3*m*,<=...) mom buys a pair of socks to Vasya. She does it la... | {"inputs": ["2 2", "9 3", "1 2", "2 3", "1 99", "4 4", "10 2", "10 9", "100 100", "2 27", "99 100", "99 2", "100 3", "98 3", "4 4", "100 2", "62 4", "99 10", "100 5", "80 80", "95 16", "75 16", "99 74", "20 21", "52 96", "24 5"], "outputs": ["3", "13", "1", "2", "1", "5", "19", "11", "101", "2", "99", "197", "149", "14... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 468 | codeforces | |
a8970e2b436e94ec4bcc241534b45bd6 | Tiling with Hexagons | Several ages ago Berland was a kingdom. The King of Berland adored math. That's why, when he first visited one of his many palaces, he first of all paid attention to the floor in one hall. The floor was tiled with hexagonal tiles.
The hall also turned out hexagonal in its shape. The King walked along the perimeter of ... | {"inputs": ["2 3 4", "2 2 2", "7 8 13", "14 7 75", "201 108 304", "999 998 996", "2 2 3", "2 3 2", "3 2 2", "2 3 3", "3 2 3", "3 3 2", "3 3 3", "4 5 3", "2 2 856", "2 986 2", "985 2 2", "2 958 983", "992 2 912", "789 894 2", "1000 1000 1000", "384 458 284", "709 14 290", "485 117 521", "849 333 102", "998 999 1000", "2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 64 | codeforces | |
a89c8820cafbc7a9c6e3baacc9ad9840 | Wilbur and Points | Wilbur is playing with a set of *n* points on the coordinate plane. All points have non-negative integer coordinates. Moreover, if some point (*x*, *y*) belongs to the set, then all points (*x*', *y*'), such that 0<=≤<=*x*'<=≤<=*x* and 0<=≤<=*y*'<=≤<=*y* also belong to this set.
Now Wilbur wants to number the points i... | {"inputs": ["5\n2 0\n0 0\n1 0\n1 1\n0 1\n0 -1 -2 1 0", "3\n1 0\n0 0\n2 0\n0 1 2", "9\n0 0\n1 0\n2 0\n0 1\n1 1\n2 1\n1 2\n2 2\n0 2\n0 0 0 -1 -1 -2 1 1 2", "18\n0 0\n0 1\n0 2\n0 3\n0 4\n0 5\n0 6\n0 7\n0 8\n0 9\n0 10\n0 11\n0 12\n0 13\n0 14\n0 15\n0 16\n1 0\n0 1 2 3 4 5 6 7 8 9 -1 10 11 12 13 14 15 16", "1\n0 0\n0", "37\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 12 | codeforces | |
a8b1aab3a22f8405c79e530a2a79375e | Christmas Spruce | Consider a rooted tree. A rooted tree has one special vertex called the root. All edges are directed from the root. Vertex *u* is called a child of vertex *v* and vertex *v* is called a parent of vertex *u* if there exists a directed edge from *v* to *u*. A vertex is called a leaf if it doesn't have children and has a ... | {"inputs": ["4\n1\n1\n1", "7\n1\n1\n1\n2\n2\n2", "8\n1\n1\n1\n1\n3\n3\n3", "3\n1\n1", "13\n1\n2\n2\n2\n1\n6\n6\n6\n1\n10\n10\n10", "7\n1\n2\n2\n1\n1\n1", "7\n1\n1\n1\n1\n2\n2", "8\n1\n1\n1\n1\n5\n5\n5", "9\n1\n1\n1\n1\n2\n6\n6\n6", "12\n1\n1\n1\n2\n5\n5\n5\n5\n1\n2\n2", "20\n1\n1\n1\n1\n2\n2\n2\n3\n3\n3\n4\n4\n4\n5\n5\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 122 | codeforces | |
a8b9f0bb25f28f00fcfd1efbbfb86d8e | Paper Work | Polycarpus has been working in the analytic department of the "F.R.A.U.D." company for as much as *n* days. Right now his task is to make a series of reports about the company's performance for the last *n* days. We know that the main information in a day report is value *a**i*, the company's profit on the *i*-th day. ... | {"inputs": ["11\n1 2 3 -4 -5 -6 5 -5 -6 -7 6", "5\n0 -1 100 -1 0", "1\n0", "1\n-1", "2\n0 0", "2\n-2 2", "2\n-2 -1", "12\n1 -12 -5 -8 0 -8 -1 -1 -6 12 -9 12", "4\n1 2 0 3", "4\n4 -3 3 3", "4\n0 -3 4 -3", "4\n-3 -2 4 -3", "4\n-3 -2 -1 -4", "5\n-2 -2 4 0 -1", "5\n-5 -3 -1 2 -1", "5\n-3 -2 -3 -2 -3", "10\n0 5 2 3 10 9 4 9... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 100 | codeforces | |
a8bdd009f7ce1f2f44c150ad8504bc9a | Lipshitz Sequence | A function is called Lipschitz continuous if there is a real constant *K* such that the inequality |*f*(*x*)<=-<=*f*(*y*)|<=≤<=*K*·|*x*<=-<=*y*| holds for all . We'll deal with a more... discrete version of this term.
For an array , we define it's Lipschitz constant as follows:
- if *n*<=<<=2, - if *n*<=≥<=2,... | {"inputs": ["10 4\n1 5 2 9 1 3 4 2 1 7\n2 4\n3 8\n7 10\n1 9", "7 6\n5 7 7 4 6 6 2\n1 2\n2 3\n2 6\n1 7\n4 7\n3 5", "2 2\n0 0\n1 2\n1 2", "2 2\n0 100000000\n1 2\n1 2", "4 6\n1 2 3 2\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4", "3 6\n10 20 30\n1 2\n1 3\n2 3\n1 2\n2 3\n1 3", "3 6\n48261735 26888803 75904937\n1 2\n1 3\n2 3\n1 2\n2 3\n1 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
a8d9c374dc35bbbb2575ed30d529d3b7 | Little Elephant and Sorting | The Little Elephant loves sortings.
He has an array *a* consisting of *n* integers. Let's number the array elements from 1 to *n*, then the *i*-th element will be denoted as *a**i*. The Little Elephant can make one move to choose an arbitrary pair of integers *l* and *r* (1<=≤<=*l*<=≤<=*r*<=≤<=*n*) and increase *a**i*... | {"inputs": ["3\n1 2 3", "3\n3 2 1", "4\n7 4 1 47", "10\n1 2 3 4 5 6 7 8 9 1000000000", "10\n1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1", "7\n47 47 47 47 47 47 48", "47\n479793446 951468508 89486286 338446715 32648506 624498057 608503040 669251062 922459299 753303599 15471514 633954104 726178809 25... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 54 | codeforces | |
a9142d7a0d07b86b7e2a3da2f1ed8549 | Rumor | Vova promised himself that he would never play computer games... But recently Firestorm — a well-known game developing company — published their newest game, World of Farcraft, and it became really popular. Of course, Vova started playing it.
Now he tries to solve a quest. The task is to come to a settlement named Ove... | {"inputs": ["5 2\n2 5 3 4 8\n1 4\n4 5", "10 0\n1 2 3 4 5 6 7 8 9 10", "10 5\n1 6 2 7 3 8 4 9 5 10\n1 2\n3 4\n5 6\n7 8\n9 10", "1 0\n0", "1 0\n1000000000", "2 0\n0 0", "2 0\n1000000000 0", "2 0\n0 1000000000", "2 0\n1000000000 1000000000", "2 1\n0 0\n1 2"], "outputs": ["10", "55", "15", "0", "1000000000", "0", "10000000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 104 | codeforces | |
a9334ecfe4eda493c86d67d26b117c09 | Random Query | You are given an array *a* consisting of *n* positive integers. You pick two integer numbers *l* and *r* from 1 to *n*, inclusive (numbers are picked randomly, equiprobably and independently). If *l*<=><=*r*, then you swap values of *l* and *r*. You have to calculate the expected value of the number of unique elemen... | {"inputs": ["2\n1 2", "2\n2 2", "10\n9 6 8 5 5 2 8 9 2 2", "20\n49 33 9 8 50 21 12 44 23 39 24 10 17 4 17 40 24 19 27 21", "1\n1000000"], "outputs": ["1.500000", "1.000000", "3.100000", "7.010000", "1.000000"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 8 | codeforces | |
a954c9b3c7a84fd96eda0a8f7520b89c | Painting Eggs | The Bitlandians are quite weird people. They have very peculiar customs.
As is customary, Uncle J. wants to have *n* eggs painted for Bitruz (an ancient Bitland festival). He has asked G. and A. to do the work.
The kids are excited because just as is customary, they're going to be paid for the job!
Overall uncle J.... | {"inputs": ["2\n1 999\n999 1", "3\n400 600\n400 600\n400 600", "2\n500 500\n500 500", "1\n1 999", "10\n1 999\n1 999\n1 999\n1 999\n1 999\n1 999\n1 999\n1 999\n1 999\n1 999", "2\n499 501\n501 499", "3\n500 500\n1 999\n400 600", "1\n0 1000", "1\n500 500", "1\n1000 0"], "outputs": ["AG", "AGA", "AG", "A", "AAAAAAAAAA", "A... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
a979154b5b2a8175788285841d9e28d3 | Game With Sticks | After winning gold and silver in IOI 2014, Akshat and Malvika want to have some fun. Now they are playing a game on a grid made of *n* horizontal and *m* vertical sticks.
An intersection point is any point on the grid which is formed by the intersection of one horizontal stick and one vertical stick.
In the grid show... | {"inputs": ["2 2", "2 3", "3 3", "20 68", "1 1", "1 2", "1 3", "2 1", "2 2", "3 1", "3 2", "68 42", "1 35", "25 70", "59 79", "65 63", "46 6", "28 82", "98 98", "98 99", "98 100", "99 98", "99 99", "99 100", "100 98", "100 99", "100 100", "3 4"], "outputs": ["Malvika", "Malvika", "Akshat", "Malvika", "Akshat", "Akshat"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 254 | codeforces | |
a9b139efa7de061f69403d9289843020 | Happy Farm 5 | The Happy Farm 5 creators decided to invent the mechanism of cow grazing. The cows in the game are very slow and they move very slowly, it can even be considered that they stand still. However, carnivores should always be chased off them.
For that a young player Vasya decided to make the shepherd run round the cows a... | {"inputs": ["4\n1 1\n5 1\n5 3\n1 3", "3\n0 0\n5 0\n0 5", "5\n0 0\n7 7\n7 5\n5 7\n1 1", "5\n1 0\n-1 0\n1 0\n-1 0\n0 0", "9\n1 0\n-1 0\n1 0\n-1 0\n0 0\n1 1\n-1 -1\n1 -1\n-1 1", "5\n-10 10\n-10 -10\n10 -10\n9 8\n1 2", "1\n7 -10", "3\n7 -10\n7 -10\n7 -10", "2\n-10 0\n-10 7", "5\n-10 0\n-10 7\n-10 0\n-10 7\n-10 0", "11\n0 0... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
a9e7f39b20cf005323eea47e365c2890 | Encrypting Messages | The Smart Beaver from ABBYY invented a new message encryption method and now wants to check its performance. Checking it manually is long and tiresome, so he decided to ask the ABBYY Cup contestants for help.
A message is a sequence of *n* integers *a*1,<=*a*2,<=...,<=*a**n*. Encryption uses a key which is a sequence ... | {"inputs": ["4 3 2\n1 1 1 1\n1 1 1", "3 1 5\n1 2 3\n4", "5 2 7\n0 0 1 2 4\n3 5", "20 15 17\n4 9 14 11 15 16 15 4 0 10 7 12 10 1 8 6 7 14 1 13\n6 3 14 8 8 11 16 4 5 9 2 13 6 14 15", "80 6 99\n48 97 9 77 73 21 86 78 48 5 71 16 42 67 90 27 30 52 41 86 53 4 60 17 66 38 94 46 51 51 70 11 1 16 74 53 17 12 82 95 51 33 83 70 4... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 32 | codeforces | |
a9edd7e23c7a56dec735305f3eb667a2 | Cyclic Cipher | You are given *n* sequences. Each sequence consists of positive integers, not exceeding *m*. All integers in one sequence are distinct, but the same integer may appear in multiple sequences. The length of the *i*-th sequence is *k**i*.
Each second integers in each of the sequences are shifted by one to the left, i.e. ... | {"inputs": ["3 4\n3 3 4 1\n4 1 3 4 2\n3 3 1 4", "5 5\n2 3 1\n4 5 1 3 2\n4 2 1 3 5\n1 3\n2 5 3", "4 6\n3 4 5 3\n2 6 3\n2 3 6\n3 3 6 5", "10 5\n2 2 4\n2 4 5\n2 1 2\n4 3 1 5 2\n4 1 3 2 5\n5 3 4 5 2 1\n3 3 5 4\n1 1\n2 4 1\n1 5", "10 10\n2 1 5\n2 3 4\n4 7 1 10 4\n4 6 3 9 7\n2 3 5\n3 4 9 7\n3 6 5 9\n5 8 5 4 10 6\n3 5 7 1\n1 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
a9f1db41bf78794ebd59fce0b08f9ad0 | Expression | Petya studies in a school and he adores Maths. His class has been studying arithmetic expressions. On the last class the teacher wrote three positive integers *a*, *b*, *c* on the blackboard. The task was to insert signs of operations '+' and '*', and probably brackets between the numbers so that the value of the resul... | {"inputs": ["1\n2\n3", "2\n10\n3", "1\n1\n1", "1\n2\n1", "10\n10\n10", "5\n1\n3", "3\n1\n5", "6\n7\n1", "1\n8\n3", "9\n7\n2", "1\n1\n10", "9\n1\n1", "10\n5\n6", "8\n9\n7", "4\n2\n10", "2\n8\n3", "3\n5\n7", "1\n10\n1", "2\n2\n2", "5\n6\n1", "10\n1\n1", "1\n6\n1", "1\n9\n1", "2\n1\n2", "2\n6\n1", "9\n2\n1", "1\n9\n2", "1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 341 | codeforces | |
aa0e79b94b0ba6e8643b2b44c935d9eb | Random Task | One day, after a difficult lecture a diligent student Sasha saw a graffitied desk in the classroom. She came closer and read: "Find such positive integer *n*, that among numbers *n*<=+<=1, *n*<=+<=2, ..., 2·*n* there are exactly *m* numbers which binary representation contains exactly *k* digits one".
The girl got int... | {"inputs": ["1 1", "3 2", "3 3", "1 11", "4 20", "45902564 24", "330 8", "10 10", "0 2", "1000000 55", "1 60", "1000000000 52", "101628400788615604 30", "101628400798615604 31", "55 55", "14240928 10", "1000000000 10", "1111111 11", "10000000000000000 35", "0 19", "768 10", "3691 6", "16 15", "427 4", "669 9", "0 16", ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
aa3049696d389bffae6f06d2bf84bfeb | Liebig's Barrels | You have *m*<==<=*n*·*k* wooden staves. The *i*-th stave has length *a**i*. You have to assemble *n* barrels consisting of *k* staves each, you can use any *k* staves to construct a barrel. Each stave must belong to exactly one barrel.
Let volume *v**j* of barrel *j* be equal to the length of the minimal stave in it.
... | {"inputs": ["4 2 1\n2 2 1 2 3 2 2 3", "2 1 0\n10 10", "1 2 1\n5 2", "3 2 1\n1 2 3 4 5 6", "10 3 189\n267 697 667 4 52 128 85 616 142 344 413 660 962 194 618 329 266 593 558 447 89 983 964 716 32 890 267 164 654 71", "10 3 453\n277 706 727 812 692 686 196 507 911 40 498 704 573 381 463 759 704 381 693 640 326 405 47 834... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 63 | codeforces | |
aa38306070eb8e4093e1bf4283d68da4 | Bubble Sort Graph | Iahub recently has learned Bubble Sort, an algorithm that is used to sort a permutation with *n* elements *a*1, *a*2, ..., *a**n* in ascending order. He is bored of this so simple algorithm, so he invents his own graph. The graph (let's call it *G*) initially has *n* vertices and 0 edges. During Bubble Sort execution, ... | {"inputs": ["3\n3 1 2", "5\n4 2 1 3 5", "10\n1 9 8 10 2 3 4 6 5 7", "50\n12 24 42 43 36 3 40 29 7 34 10 13 28 9 35 23 25 21 19 4 20 18 11 38 41 48 6 46 33 17 31 37 2 30 32 44 45 5 47 49 16 15 50 27 26 14 39 22 1 8", "100\n36 48 92 87 28 85 42 10 44 41 39 3 79 9 14 56 1 16 46 35 93 8 82 26 100 59 60 2 96 52 13 98 70 81 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 22 | codeforces | |
aa3c1b41277165391ffdeec88676f3de | Leaving Auction | There are *n* people taking part in auction today. The rules of auction are classical. There were *n* bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all.
Each bid is define by two integers (*a**i*,<=*b**i*), where *a**i* is the index of the perso... | {"inputs": ["6\n1 10\n2 100\n3 1000\n1 10000\n2 100000\n3 1000000\n3\n1 3\n2 2 3\n2 1 2", "3\n1 10\n2 100\n1 1000\n2\n2 1 2\n2 2 3", "1\n1 1\n1\n1 1", "2\n1 1\n2 2\n3\n1 1\n1 2\n2 1 2", "4\n1 3\n2 7\n1 8\n3 10\n15\n1 1\n1 2\n1 3\n1 4\n2 1 2\n2 1 3\n2 1 4\n2 2 3\n2 2 4\n2 3 4\n3 1 2 3\n3 1 2 4\n3 1 3 4\n3 2 3 4\n4 1 2 3... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
aa58cc23ec95ad4e4034fc6ce173c19c | Hamsters and Tigers | Today there is going to be an unusual performance at the circus — hamsters and tigers will perform together! All of them stand in circle along the arena edge and now the trainer faces a difficult task: he wants to swap the animals' positions so that all the hamsters stood together and all the tigers also stood together... | {"inputs": ["3\nHTH", "9\nHTHTHTHHT", "2\nTH", "4\nHTTH", "4\nHTHT", "7\nTTTHTTT", "8\nHHTHHTHH", "13\nHTTTHHHTTTTHH", "20\nTTHTHTHHTHTTHHTTTHHH", "35\nTTTTTTHTTHTTTTTHTTTTTTTTTTTHTHTTTTT", "120\nTTTTTTTHTHTHTTTTTHTHTTTTHTTTTTTTTTTTTTTTTTTTTHTTHTTTTHTTHTTTTTTTTTTTTTTTHTTTTTTHTHTTHTTTTTTHTTTTTTTTTHTTHTTTTHTTTHTTTTTH", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 72 | codeforces | |
aa6ceb741b91e022653c4ce5b955f3ff | Bus | There is a bus stop near the university. The lessons are over, and *n* students come to the stop. The *i*-th student will appear at the bus stop at time *t**i* (all *t**i*'s are distinct).
We shall assume that the stop is located on the coordinate axis *Ox*, at point *x*<==<=0, and the bus goes along the ray *Ox*, tha... | {"inputs": ["1 10\n3 5", "2 1\n3 5\n4 5", "5 4\n3 5\n4 5\n5 5\n6 5\n7 1", "20 4\n28 13\n31 13\n35 6\n36 4\n52 6\n53 4\n83 2\n84 4\n87 1\n93 6\n108 4\n113 6\n116 1\n125 2\n130 2\n136 13\n162 2\n166 4\n184 1\n192 2", "1 1\n109 15", "2 1\n43 5\n102 1", "4 2\n7 1\n12 14\n90 15\n176 1", "8 8\n48 14\n74 12\n94 4\n127 14\n151... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
aa87f34e616f70cb9788a76c5f75ea43 | HDD is Outdated Technology | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.
One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read s... | {"inputs": ["3\n3 1 2", "5\n1 3 5 4 2", "1\n1", "1\n1", "1\n1", "10\n8 2 10 3 4 6 1 7 9 5", "10\n1 2 3 4 5 6 7 8 9 10", "10\n1 3 5 7 9 10 8 6 4 2", "100\n11 9 35 34 51 74 16 67 26 21 14 80 84 79 7 61 28 3 53 43 42 5 56 36 69 30 22 88 1 27 65 91 46 31 59 50 17 96 25 18 64 55 78 2 63 24 95 48 93 13 38 76 89 94 15 90 45 8... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 136 | codeforces | |
aa909528de85efa4b55581fd8e03c2e2 | Kuro and Topological Parity | Kuro has recently won the "Most intelligent cat ever" contest. The three friends then decided to go to Katie's home to celebrate Kuro's winning. After a big meal, they took a small break then started playing games.
Kuro challenged Katie to create a game with only a white paper, a pencil, a pair of scissors and a lot o... | {"inputs": ["3 1\n-1 0 1", "2 1\n1 0", "1 1\n-1", "1 0\n-1", "1 1\n0", "5 1\n-1 -1 -1 -1 -1", "5 0\n-1 -1 -1 -1 -1", "10 1\n1 1 1 1 0 0 0 1 0 0", "50 1\n-1 -1 1 0 1 1 0 -1 1 0 -1 -1 0 0 -1 -1 0 1 1 -1 1 0 -1 1 1 -1 -1 -1 1 -1 -1 0 -1 0 -1 0 0 -1 -1 0 1 -1 0 1 -1 1 0 -1 -1 1", "20 1\n0 0 -1 0 1 1 1 1 -1 -1 1 1 1 -1 0 0 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
aa950f6569484d8c8e06d95a3f7aaf3a | Boxes Packing | Mishka has got *n* empty boxes. For every *i* (1<=≤<=*i*<=≤<=*n*), *i*-th box is a cube with side length *a**i*.
Mishka can put a box *i* into another box *j* if the following conditions are met:
- *i*-th box is not put into another box; - *j*-th box doesn't contain any other boxes; - box *i* is smaller than box *... | {"inputs": ["3\n1 2 3", "4\n4 2 4 3", "10\n58 58 58 58 58 58 58 58 58 58", "10\n86 89 89 86 86 89 86 86 89 89", "100\n981 288 186 186 292 876 341 288 981 360 783 907 292 186 341 292 360 876 360 360 981 398 783 288 292 398 876 981 398 907 783 360 288 981 907 186 360 288 186 981 186 288 907 876 288 907 876 360 341 292 90... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 197 | codeforces | |
aa95201684f692785e83233e7b14292e | Cycle | A tournament is a directed graph without self-loops in which every pair of vertexes is connected by exactly one directed edge. That is, for any two vertexes *u* and *v* (*u*<=≠<=*v*) exists either an edge going from *u* to *v*, or an edge from *v* to *u*.
You are given a tournament consisting of *n* vertexes. Your tas... | {"inputs": ["5\n00100\n10000\n01001\n11101\n11000", "5\n01111\n00000\n01000\n01100\n01110", "5\n01000\n00101\n10010\n11001\n10100", "5\n00110\n10110\n00011\n00000\n11010", "10\n0011000010\n1011001101\n0000101100\n0010101010\n1100000100\n1111101100\n1000100000\n1001001011\n0110111001\n1011111000", "10\n0111001000\n00111... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
aaa6c5a197701f18e7cecda2a36fc449 | Endless Roses Most Beautiful | Arkady decided to buy roses for his girlfriend.
A flower shop has white, orange and red roses, and the total amount of them is *n*. Arkady thinks that red roses are not good together with white roses, so he won't buy a bouquet containing both red and white roses. Also, Arkady won't buy a bouquet where all roses have t... | {"inputs": ["5 3\n4 3 4 1 6\nRROWW", "5 2\n10 20 14 20 11\nRRRRR", "11 5\n5 6 3 2 3 4 7 5 4 5 6\nRWOORWORROW", "15 10\n8560 6244 9607 5137 7187 3217 5527 9919 282 8748 3529 6110 5767 521 3393\nOWRWOORWRORWWRO", "10 4\n1208 5835 2637 5827 3722 6837 3499 6438 43 5333\nWRRWRWRWRW", "13 3\n9675 8988 5499 6356 5083 6067 558... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
aaab33deadf08632a19f4bb503f27565 | none | Alice and Bob decided to eat some fruit. In the kitchen they found a large bag of oranges and apples. Alice immediately took an orange for herself, Bob took an apple. To make the process of sharing the remaining fruit more fun, the friends decided to play a game. They put multiple cards and on each one they wrote a let... | {"inputs": ["1 4", "2 2", "3 2", "2 1", "5 3", "5 2", "8 5", "97 101", "1 3", "1000000000000000000 999999999999999999", "55 89", "610 987", "4181 6765", "46368 75025", "832040 514229", "5702887 9227465", "701408733 433494437", "956722026041 591286729879", "498454011879264 806515533049393", "420196140727489673 679891637... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 16 | codeforces | |
aaae939c861210fcad59ff469f432ee8 | Bakery | Masha wants to open her own bakery and bake muffins in one of the *n* cities numbered from 1 to *n*. There are *m* bidirectional roads, each of whose connects some pair of cities.
To bake muffins in her bakery, Masha needs to establish flour supply from some storage. There are only *k* storages, located in different c... | {"inputs": ["5 4 2\n1 2 5\n1 2 3\n2 3 4\n1 4 10\n1 5", "3 1 1\n1 2 3\n3", "2 3 1\n1 2 3\n1 2 18\n1 2 13\n2", "3 7 0\n1 3 9\n1 2 5\n1 2 21\n1 2 12\n1 2 13\n2 3 19\n2 3 8", "4 13 1\n1 4 10\n1 3 6\n1 4 3\n3 4 1\n1 3 2\n1 2 15\n1 4 21\n1 4 20\n2 4 13\n1 4 7\n2 4 2\n1 2 8\n1 3 17\n1", "5 7 3\n2 3 20\n1 2 10\n1 2 11\n4 5 15\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 23 | codeforces | |
aaaffe668fb66d099e8688f0232544af | Vessels | There is a system of *n* vessels arranged one above the other as shown in the figure below. Assume that the vessels are numbered from 1 to *n*, in the order from the highest to the lowest, the volume of the *i*-th vessel is *a**i* liters.
Initially, all the vessels are empty. In some vessels water is poured. All the w... | {"inputs": ["2\n5 10\n6\n1 1 4\n2 1\n1 2 5\n1 1 4\n2 1\n2 2", "3\n5 10 8\n6\n1 1 12\n2 2\n1 1 6\n1 3 2\n2 2\n2 3", "10\n71 59 88 55 18 98 38 73 53 58\n20\n1 5 93\n1 7 69\n2 3\n1 1 20\n2 10\n1 6 74\n1 7 100\n1 9 14\n2 3\n2 4\n2 7\n1 3 31\n2 4\n1 6 64\n2 2\n2 2\n1 3 54\n2 9\n2 1\n1 6 86", "10\n3 7 10 1 5 4 4 3 3 1\n20\n2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
aac6bac239d06f0aeceefefe8a47c5e9 | Let's Watch Football | Valeric and Valerko missed the last Euro football game, so they decided to watch the game's key moments on the Net. They want to start watching as soon as possible but the connection speed is too low. If they turn on the video right now, it will "hang up" as the size of data to watch per second will be more than the si... | {"inputs": ["4 1 1", "10 3 2", "13 12 1", "2 1 3", "6 2 4", "5 2 1", "2 1 1", "2 1 4", "5 1 5", "2 1 2", "60 16 1", "64 12 8", "66 38 4", "70 32 1", "24 12 12", "24 19 9", "244 87 4", "305 203 421", "888 777 1", "888 777 1000", "888 777 888", "5 4 10", "1000 1 1", "1000 1 1000", "1000 999 1", "1000 999 1000", "945 812 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 196 | codeforces | |
aaf53c3223958d02a7990a2f62318615 | Remove Extra One | You are given a permutation *p* of length *n*. Remove one element from permutation to make the number of records the maximum possible.
We remind that in a sequence of numbers *a*1,<=*a*2,<=...,<=*a**k* the element *a**i* is a record if for every integer *j* (1<=≤<=*j*<=<<=*i*) the following holds: *a**j*<=<<=*a*... | {"inputs": ["1\n1", "5\n5 1 2 3 4", "5\n4 3 5 1 2", "9\n9 5 8 6 3 2 4 1 7", "3\n3 2 1", "7\n1 6 7 4 2 5 3", "48\n38 6 31 19 45 28 27 43 11 35 36 20 9 16 42 48 14 22 39 18 12 10 34 25 13 26 40 29 17 8 33 46 24 30 37 44 1 15 2 21 3 5 4 47 32 23 41 7", "26\n23 14 15 19 9 22 20 12 5 4 21 1 16 8 6 11 3 17 2 10 24 26 13 18 2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 12 | codeforces | |
ab1ba7a3a8c64af0d4dacb38a45591ed | Sanatorium | Vasiliy spent his vacation in a sanatorium, came back and found that he completely forgot details of his vacation!
Every day there was a breakfast, a dinner and a supper in a dining room of the sanatorium (of course, in this order). The only thing that Vasiliy has now is a card from the dining room contaning notes ho... | {"inputs": ["3 2 1", "1 0 0", "1 1 1", "1000000000000000000 0 1000000000000000000", "1000 0 0", "0 1 0", "0 0 1", "1 1 0", "0 1 1", "1000000000000000000 999999999999999999 999999999999999999", "1000000000000000000 1000000000000000000 999999999999999999", "1000000000000000000 1000000000000000000 1000000000000000000", "9... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 16 | codeforces | |
ab243f42ee37afd8273312305780af22 | Electric Charges | Programmer Sasha is a student at MIPT (Moscow Institute of Physics and Technology) and he needs to make a laboratory work to pass his finals.
A laboratory unit is a plane with standard coordinate axes marked on it. Physicists from Moscow Institute of Physics and Technology charged the axes by large electric charges: a... | {"inputs": ["3\n1 10\n1 20\n1 30", "2\n1 10\n10 1", "10\n1 6\n2 2\n-1 9\n-8 8\n-4 10\n-10 -6\n5 -1\n-3 -7\n-4 3\n9 4", "18\n-14 -745\n87 -4611\n89 -3748\n-77 273\n-21 -4654\n-86 -5108\n-70 3232\n25 -6313\n-71 -4846\n88 -1894\n-65 9707\n-51 -3290\n-19 -580\n-62 -2408\n1 -6832\n52 -4279\n21 -7322\n55 9392", "12\n996 -72\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
ab514d2189903ec3467ac95baa7abde1 | Table Decorations | You have *r* red, *g* green and *b* blue balloons. To decorate a single table for the banquet you need exactly three balloons. Three balloons attached to some table shouldn't have the same color. What maximum number *t* of tables can be decorated if we know number of balloons of each color?
Your task is to write a pro... | {"inputs": ["5 4 3", "1 1 1", "2 3 3", "0 1 0", "0 3 3", "4 0 4", "1000000000 1000000000 1000000000", "100 99 56", "1000 1000 1002", "0 1 1000000000", "500000000 1000000000 500000000", "1000000000 2000000000 1000000000", "2000000000 2000000000 2000000000", "0 0 0", "1 2000000000 1000000000", "1585222789 1889821127 2000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 77 | codeforces | |
ab84e591c27936e4ef3d86b9651f6fd0 | Optimal Point on a Line | You are given *n* points on a line with their coordinates *x**i*. Find the point *x* so the sum of distances to the given points is minimal.
The first line contains integer *n* (1<=≤<=*n*<=≤<=3·105) — the number of points on the line.
The second line contains *n* integers *x**i* (<=-<=109<=≤<=*x**i*<=≤<=109) — the coo... | {"inputs": ["4\n1 2 3 4", "5\n-1 -10 2 6 7", "10\n-68 10 87 22 30 89 82 -97 -52 25", "100\n457 827 807 17 871 935 907 -415 536 170 551 -988 865 758 -457 -892 -875 -488 684 19 0 555 -807 -624 -239 826 318 811 20 -732 -91 460 551 -610 555 -493 -154 442 -141 946 -913 -104 704 -380 699 32 106 -455 -518 214 -464 -861 243 -7... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 107 | codeforces | |
ab9570f400b71baf4b0f8f8379616f4c | Not Afraid | Since the giant heads have appeared in the sky all humanity is in danger, so all Ricks and Mortys from all parallel universes are gathering in groups to find a solution to get rid of them.
There are *n* parallel universes participating in this event (*n* Ricks and *n* Mortys). I. e. each of *n* universes has one Rick... | {"inputs": ["4 2\n1 -3\n4 -2 3 2 -3", "5 2\n5 3 -2 1 -1 5\n3 -5 2 5", "7 2\n3 -1 6 7\n7 -5 4 2 4 7 -3 4", "2 1\n2 -2 2", "7 7\n1 -2\n1 6\n2 7 -6\n2 -6 4\n2 -4 -6\n3 -5 7 -5\n1 -6", "100 50\n2 62 -62\n2 19 -19\n2 38 -38\n2 -84 84\n2 -16 16\n2 67 -67\n2 41 -41\n2 -32 32\n2 32 -32\n2 -62 62\n2 89 -89\n2 -84 84\n2 96 -96\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 69 | codeforces | |
ab9bbca22e4ebbfac690204da5b4e636 | pSort | One day *n* cells of some array decided to play the following game. Initially each cell contains a number which is equal to it's ordinal number (starting from 1). Also each cell determined it's favourite number. On it's move *i*-th cell can exchange it's value with the value of some other *j*-th cell, if |*i*<=-<=*j*|<... | {"inputs": ["5\n5 4 3 2 1\n1 1 1 1 1", "7\n4 3 5 1 2 7 6\n4 6 6 1 6 6 1", "7\n4 2 5 1 3 7 6\n4 6 6 1 6 6 1", "6\n3 2 1 4 6 5\n3 6 1 6 6 1", "6\n3 5 1 4 6 2\n3 6 1 6 6 1", "4\n1 2 3 4\n1 1 1 1", "71\n1 63 3 4 5 6 7 8 9 44 29 12 13 14 55 34 42 18 52 20 21 33 23 24 25 26 27 28 19 30 47 32 15 71 37 36 69 38 39 40 41 17 43 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 27 | codeforces | |
abbad00030e70b95b58997b453592058 | Playing with Dice | Two players are playing a game. First each of them writes an integer from 1 to 6, and then a dice is thrown. The player whose written number got closer to the number on the dice wins. If both payers have the same difference, it's a draw.
The first player wrote number *a*, the second player wrote number *b*. How many w... | {"inputs": ["2 5", "2 4", "5 3", "1 6", "5 1", "6 3", "2 3", "5 6", "4 4", "1 1", "6 4", "1 4", "5 5", "4 5", "4 3", "1 5", "6 5", "2 2", "1 3", "3 6", "3 1", "3 2", "3 5", "3 3", "6 2", "4 1", "5 2", "4 2", "2 1", "6 1", "4 6", "2 6", "3 4", "1 2", "6 6", "5 4", "3 3", "1 1"], "outputs": ["3 0 3", "2 1 3", "2 1 3", "3... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 672 | codeforces | |
abc27619c76daf559804e27c90524aa3 | Black and White Tree | The board has got a painted tree graph, consisting of *n* nodes. Let us remind you that a non-directed graph is called a tree if it is connected and doesn't contain any cycles.
Each node of the graph is painted black or white in such a manner that there aren't two nodes of the same color, connected by an edge. Each ed... | {"inputs": ["3\n1 3\n1 2\n0 5", "6\n1 0\n0 3\n1 8\n0 2\n0 3\n0 0", "2\n0 0\n1 0", "5\n1 11\n0 9\n1 4\n0 4\n0 2", "10\n0 24\n1 164\n0 206\n0 45\n1 110\n0 66\n1 59\n1 92\n0 152\n1 68", "20\n0 569\n1 328\n1 74\n1 88\n1 90\n1 124\n0 78\n0 39\n1 9\n1 59\n1 41\n1 73\n1 45\n0 45\n0 13\n1 39\n0 24\n0 37\n0 95\n0 70", "30\n0 11... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
abf11aeddeb0af07ea9ac20715e7c810 | Solution for Cube | During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's possible to solve the cube in some state using 90-degrees rotation... | {"inputs": ["2 5 4 6 1 3 6 2 5 5 1 2 3 5 3 1 1 2 4 6 6 4 3 4", "5 3 5 3 2 5 2 5 6 2 6 2 4 4 4 4 1 1 1 1 6 3 6 3", "2 6 3 3 5 5 2 6 1 1 6 4 4 4 2 4 6 5 3 1 2 5 3 1", "3 4 2 3 5 5 6 6 4 5 4 6 5 1 1 1 6 2 1 3 3 2 4 2", "5 5 2 5 3 3 2 6 6 4 2 4 6 1 4 3 1 6 2 1 3 4 5 1", "6 6 1 2 6 1 1 3 5 4 3 4 3 5 5 2 4 4 6 2 1 5 3 2", "2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 29 | codeforces | |
ac0c2716962ff08b4b4c6c7396f716d9 | Tree Requests | Roman planted a tree consisting of *n* vertices. Each vertex contains a lowercase English letter. Vertex 1 is the root of the tree, each of the *n*<=-<=1 remaining vertices has a parent in the tree. Vertex is connected with its parent by an edge. The parent of vertex *i* is vertex *p**i*, the parent index is always les... | {"inputs": ["6 5\n1 1 1 3 3\nzacccd\n1 1\n3 3\n4 1\n6 1\n1 2", "5 6\n1 1 2 3\ncbcab\n3 1\n5 2\n1 3\n4 1\n4 2\n1 1", "5 6\n1 2 2 1\nbaabb\n1 1\n1 2\n5 1\n4 1\n4 2\n3 2", "5 9\n1 1 1 2\nedbcb\n1 3\n2 1\n1 3\n2 1\n2 2\n2 2\n1 1\n1 3\n2 1", "8 12\n1 1 1 2 1 1 4\ncbecdcce\n1 2\n1 2\n2 1\n1 1\n2 1\n1 3\n1 3\n1 3\n1 2\n2 3\n1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
ac413e3d23d2317e4f1b0c9a24087720 | Fix a Tree | A tree is an undirected connected graph without cycles.
Let's consider a rooted undirected tree with *n* vertices, numbered 1 through *n*. There are many ways to represent such a tree. One way is to create an array with *n* integers *p*1,<=*p*2,<=...,<=*p**n*, where *p**i* denotes a parent of vertex *i* (here, for con... | {"inputs": ["4\n2 3 3 4", "5\n3 2 2 5 3", "8\n2 3 5 4 1 6 6 7", "2\n1 2", "7\n4 3 2 6 3 5 2", "6\n6 2 6 2 4 2", "7\n1 6 4 4 5 6 7", "7\n7 5 3 1 2 1 5", "7\n1 2 3 4 5 6 7", "18\n2 3 4 5 2 7 8 9 10 7 11 12 14 15 13 17 18 18", "8\n2 1 2 2 6 5 6 6", "3\n2 1 1"], "outputs": ["1\n2 3 4 4 ", "0\n3 2 2 5 3 ", "2\n2 3 7 8 1 6 6... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 12 | codeforces | |
ac9108f0e82902b1ab432959abb62764 | Counterexample | Your friend has recently learned about coprime numbers. A pair of numbers {*a*,<=*b*} is called coprime if the maximum number that divides both *a* and *b* is equal to one.
Your friend often comes up with different statements. He has recently supposed that if the pair (*a*,<=*b*) is coprime and the pair (*b*,<=*c*) i... | {"inputs": ["2 4", "10 11", "900000000000000009 900000000000000029", "640097987171091791 640097987171091835", "19534350415104721 19534350415104725", "933700505788726243 933700505788726280", "1 3", "1 4", "1 1", "266540997167959130 266540997167959164", "267367244641009850 267367244641009899", "268193483524125978 2681934... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 367 | codeforces | |
ac9bff232861d45cba367272ddb2c80e | Eternal Victory | Valerian was captured by Shapur. The victory was such a great one that Shapur decided to carve a scene of Valerian's defeat on a mountain. So he had to find the best place to make his victory eternal!
He decided to visit all *n* cities of Persia to find the best available mountain, but after the recent war he was too ... | {"inputs": ["3\n1 2 3\n2 3 4", "3\n1 2 3\n1 3 3", "5\n5 3 60\n4 3 63\n2 1 97\n3 1 14", "3\n2 1 63\n3 1 78", "13\n8 2 58\n2 1 49\n13 10 41\n11 9 67\n6 4 18\n7 1 79\n3 2 58\n9 7 92\n10 6 62\n4 3 5\n12 4 87\n5 3 66", "2\n2 1 89", "12\n3 1 31\n5 2 94\n9 8 37\n10 9 45\n7 5 75\n4 2 77\n6 3 31\n11 6 14\n8 7 19\n2 1 68\n12 1 6... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 18 | codeforces | |
acd4c4fb1076614e330c5341053f7a0a | Rectangle and Square | Little Petya very much likes rectangles and especially squares. Recently he has received 8 points on the plane as a gift from his mother. The points are pairwise distinct. Petya decided to split them into two sets each containing 4 points so that the points from the first set lay at the vertexes of some square and the ... | {"inputs": ["0 0\n10 11\n10 0\n0 11\n1 1\n2 2\n2 1\n1 2", "0 0\n1 1\n2 2\n3 3\n4 4\n5 5\n6 6\n7 7", "0 0\n4 4\n4 0\n0 4\n1 2\n2 3\n3 2\n2 1", "-160 336\n-76 672\n8 168\n-580 588\n-1000 504\n-496 840\n-496 84\n-664 0", "8 -328\n-440 568\n-104 8\n-1000 -664\n8 456\n-328 8\n-552 120\n-664 -1000", "65 852\n-645 284\n-361 7... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 8 | codeforces | |
ad14725a5fe6b814b4b6bbb9fe4458f0 | Destroying Roads | In some country there are exactly *n* cities and *m* bidirectional roads connecting the cities. Cities are numbered with integers from 1 to *n*. If cities *a* and *b* are connected by a road, then in an hour you can go along this road either from city *a* to city *b*, or from city *b* to city *a*. The road network is s... | {"inputs": ["5 4\n1 2\n2 3\n3 4\n4 5\n1 3 2\n3 5 2", "5 4\n1 2\n2 3\n3 4\n4 5\n1 3 2\n2 4 2", "5 4\n1 2\n2 3\n3 4\n4 5\n1 3 2\n3 5 1", "9 9\n1 2\n2 3\n2 4\n4 5\n5 7\n5 6\n3 8\n8 9\n9 6\n1 7 4\n3 6 3", "9 9\n1 2\n2 3\n2 4\n4 5\n5 7\n5 6\n3 8\n8 9\n9 6\n1 7 4\n3 6 4", "10 11\n1 3\n2 3\n3 4\n4 5\n4 6\n3 7\n3 8\n4 9\n4 10\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
ad1f8a840e84be956b38eac4b391343f | Petr and Permutations | Petr likes to come up with problems about randomly generated data. This time problem is about random permutation. He decided to generate a random permutation this way: he takes identity permutation of numbers from $1$ to $n$ and then $3n$ times takes a random pair of different elements and swaps them. Alex envies Petr ... | {"inputs": ["5\n2 4 5 1 3"], "outputs": ["Petr"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 13 | codeforces | |
ad220da3e1b05b8f889f1484c2d540f7 | Drazil and Park | Drazil is a monkey. He lives in a circular park. There are *n* trees around the park. The distance between the *i*-th tree and (*i*<=+<=1)-st trees is *d**i*, the distance between the *n*-th tree and the first tree is *d**n*. The height of the *i*-th tree is *h**i*.
Drazil starts each day with the morning run. The mor... | {"inputs": ["5 3\n2 2 2 2 2\n3 5 2 1 4\n1 3\n2 2\n4 5", "3 3\n5 1 4\n5 1 4\n3 3\n2 2\n1 1", "10 10\n8477 33103 38654 6582 27496 1106 15985 3644 29818 8849\n88745 72099 87767 85285 73517 94562 87214 63194 83791 77619\n2 8\n1 5\n9 5\n7 8\n6 9\n8 1\n6 1\n4 9\n8 10\n5 10", "9 9\n1 1 1 1 1 1 1 1 1\n1 1 1 1 1000000000 1 1 1 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
ad656fd9fb168c5779c1eec25fd50ee2 | Sagheer and Crossroads | Sagheer is walking in the street when he comes to an intersection of two roads. Each road can be represented as two parts where each part has 3 lanes getting into the intersection (one for each direction) and 3 lanes getting out of the intersection, so we have 4 parts in total. Each part has 4 lights, one for each lane... | {"inputs": ["1 0 0 1\n0 1 0 0\n0 0 1 0\n0 0 0 1", "0 1 1 0\n1 0 1 0\n1 1 0 0\n0 0 0 1", "1 0 0 0\n0 0 0 1\n0 0 0 0\n1 0 1 0", "0 0 0 0\n0 0 0 1\n0 0 0 1\n0 0 0 1", "1 1 1 0\n0 1 0 1\n1 1 1 0\n1 1 1 1", "0 1 1 0\n0 1 0 0\n1 0 0 1\n1 0 0 0", "1 0 0 0\n0 1 0 0\n1 1 0 0\n0 1 1 0", "0 0 0 0\n0 1 0 1\n1 0 1 1\n1 1 1 0", "1 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 74 | codeforces | |
ad7defe219bd7fa8acbe1890ffa08b24 | none | You are given an array *a*1,<=*a*2,<=...,<=*a**n* consisting of *n* integers, and an integer *k*. You have to split the array into exactly *k* non-empty subsegments. You'll then compute the minimum integer on each subsegment, and take the maximum integer over the *k* obtained minimums. What is the maximum possible inte... | {"inputs": ["5 2\n1 2 3 4 5", "5 1\n-4 -5 -3 -2 -1", "10 2\n10 9 1 -9 -7 -9 3 8 -10 5", "10 4\n-8 -1 2 -3 9 -8 4 -3 5 9", "1 1\n504262064", "3 3\n-54481850 -878017339 -486296116", "2 2\n-333653905 224013643", "14 2\n-14 84 44 46 -75 -75 77 -49 44 -82 -74 -51 -9 -50", "88 71\n-497 -488 182 104 40 183 201 282 -384 44 -29... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 140 | codeforces | |
adb059482de1a081f75f56e8d0085745 | Position in Fraction | You have a fraction . You need to find the first occurrence of digit *c* into decimal notation of the fraction after decimal point.
The first contains three single positive integers *a*, *b*, *c* (1<=≤<=*a*<=<<=*b*<=≤<=105, 0<=≤<=*c*<=≤<=9).
Print position of the first occurrence of digit *c* into the fraction. Posi... | {"inputs": ["1 2 0", "2 3 7", "1 100000 1", "1 7 7", "99999 100000 8", "44102 73848 2", "7 31 3", "8880 81608 9", "4942 62768 5", "69168 84860 4", "971 1883 3", "1636 3269 6", "6873 7769 3", "13805 15538 3", "10958 21926 3", "8 51 0", "1 10 1", "1 9 0", "53 101 6", "1 10001 9", "25102 31579 2", "38790 39359 0", "47117 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 86 | codeforces | |
adbf79a9d4af5e615e98841bd63ff9b3 | Meeting of Old Friends | Today an outstanding event is going to happen in the forest — hedgehog Filya will come to his old fried Sonya!
Sonya is an owl and she sleeps during the day and stay awake from minute *l*1 to minute *r*1 inclusive. Also, during the minute *k* she prinks and is unavailable for Filya.
Filya works a lot and he plans to ... | {"inputs": ["1 10 9 20 1", "1 100 50 200 75", "6 6 5 8 9", "1 1000000000 1 1000000000 1", "5 100 8 8 8", "1 1000000000000000000 2 99999999999999999 1000000000", "1 1 1 1 1", "1 2 3 4 5", "1 1000000000 2 999999999 3141592", "24648817341102 41165114064236 88046848035 13602161452932 10000831349205", "1080184299348 3466682... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 142 | codeforces | |
adc74535feb0901a59a1c5135823da3b | Word Correction | Victor tries to write his own text editor, with word correction included. However, the rules of word correction are really strange.
Victor thinks that if a word contains two consecutive vowels, then it's kinda weird and it needs to be replaced. So the word corrector works in such a way: as long as there are two consec... | {"inputs": ["5\nweird", "4\nword", "5\naaeaa", "100\naaaaabbbbboyoyoyoyoyacadabbbbbiuiufgiuiuaahjabbbklboyoyoyoyoyaaaaabbbbbiuiuiuiuiuaaaaabbbbbeyiyuyzyw", "69\nbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", "12\nmmmmmmmmmmmm", "18\nyaywptqwuyiqypwoyw", "85\nbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 307 | codeforces | |
adcd6dbdc21f29d273d9dcf1d6cb45ab | Tavas and Karafs | Karafs is some kind of vegetable in shape of an 1<=×<=*h* rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs.
Each Karafs has a positive integer height. Tavas has an infinite 1-based sequence of Karafses. The height of the *i*-th Karafs is *s*... | {"inputs": ["2 1 4\n1 5 3\n3 3 10\n7 10 2\n6 4 8", "1 5 2\n1 5 10\n2 7 4", "1 1 4\n1 1000000 1000000\n1 1 1000000\n1 1000000 1\n1 1 1", "1000000 1000000 1\n1000000 1000000 1000000", "999999 1000000 1\n1 1000000 1000000", "1 1000000 1\n1 1000000 1000000", "1 5000 1\n1 1000000 1000000", "1 1 1\n1 1000000 1000000", "447 7... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 10 | codeforces | |
ade770083603ea41310a40d70e1f2c83 | Recover the String | For each string *s* consisting of characters '0' and '1' one can define four integers *a*00, *a*01, *a*10 and *a*11, where *a**xy* is the number of subsequences of length 2 of the string *s* equal to the sequence {*x*,<=*y*}.
In these problem you are given four integers *a*00, *a*01, *a*10, *a*11 and have to find any... | {"inputs": ["1 2 3 4", "1 2 2 1", "10 7 28 21", "0 0 0 0", "499928010 820999488 178951395 499991253", "49995000 11667 4308334 93096", "499928010 601314341 398636540 499991253", "0 2548 1752 650", "4950 53524 2876 158766", "20946628 20410736 263003096 958497436", "49995000 1061 8939 0", "0 0 0 45", "49995000 302076 4017... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.