messages
listlengths
1
1
ground_truth
stringlengths
88
726k
dataset
stringclasses
2 values
[ { "content": "Solve the following coding problem using the programming language python:\n\nSmall, but very brave, mouse Brain was not accepted to summer school of young villains. He was upset and decided to postpone his plans of taking over the world, but to become a photographer instead.\n\nAs you may know, th...
[{"type": "stdin_stdout", "input": "5 5\nW G B W G\nG B W G B\nB W G B W\nW G B W G\nG B W G B\n", "output": "#Black&White"}, {"type": "stdin_stdout", "input": "5 5\nW G B Y M\nG B Y M C\nB Y M C W\nY M C W G\nM C W G B\n", "output": "#Color"}, {"type": "stdin_stdout", "input": "3 2\nW W\nW W\nB B\n", "output": "#Black...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSonya decided that having her own hotel business is the best way of earning money because she can profit and rest wherever she wants.\n\nThe country where Sonya lives is an endless line. There is a city in each integer co...
[{"type": "stdin_stdout", "input": "100 10\n-489 -476 -445 -432 -430 -421 -420 -418 -412 -411 -404 -383 -356 -300 -295 -293 -287 -276 -265 -263 -258 -251 -249 -246 -220 -219 -205 -186 -166 -157 -143 -137 -136 -130 -103 -86 -80 -69 -67 -55 -43 -41 -40 -26 -19 -9 16 29 41 42 54 76 84 97 98 99 101 115 134 151 157 167 169 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya has an array of integers of length n.\n\nVasya performs the following operations on the array: on each step he finds the longest segment of consecutive equal integers (the leftmost, if there are several such segment...
[{"type": "stdin_stdout", "input": "100\n45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLimak is a grizzly bear who desires power and adoration. He wants to win in upcoming elections and rule over the Bearland.\n\nThere are n candidates, including Limak. We know how many citizens are going to vote for each c...
[{"type": "stdin_stdout", "input": "100\n1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string $s$, consisting of $n$ lowercase Latin letters.\n\nA substring of string $s$ is a continuous segment of letters from $s$. For example, \"defor\" is a substring of \"codeforces\" and \"fors\" is not....
[{"type": "stdin_stdout", "input": "25\nbbaaaaabaaaabbabaaaababaa\n", "output": "YES\nba\n"}, {"type": "stdin_stdout", "input": "10\ncodeforces\n", "output": "YES\nco\n"}, {"type": "stdin_stdout", "input": "9\naabbccaab\n", "output": "YES\nab\n"}, {"type": "stdin_stdout", "input": "9\naaaabbbbb\n", "output": "YES\nab\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarpus loves lucky numbers. Everybody knows that lucky numbers are positive integers, whose decimal representation (without leading zeroes) contain only the lucky digits x and y. For example, if x = 4, and y = 7, then...
[{"type": "stdin_stdout", "input": "1000000000\n", "output": "40744\n"}, {"type": "stdin_stdout", "input": "999999999\n", "output": "40743\n"}, {"type": "stdin_stdout", "input": "999999998\n", "output": "40742\n"}, {"type": "stdin_stdout", "input": "999999997\n", "output": "40741\n"}, {"type": "stdin_stdout", "input": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIahub and his friend Floyd have started painting a wall. Iahub is painting the wall red and Floyd is painting it pink. You can consider the wall being made of a very large number of bricks, numbered 1, 2, 3 and so on. \n\...
[{"type": "stdin_stdout", "input": "1 1 1000000000 2000000000\n", "output": "1000000001"}, {"type": "stdin_stdout", "input": "555 777 666013 1000000000\n", "output": "257229"}, {"type": "stdin_stdout", "input": "165 255 69696 1000000000\n", "output": "356482"}, {"type": "stdin_stdout", "input": "23 46 123321 900000000\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou came to the exhibition and one exhibit has drawn your attention. It consists of $n$ stacks of blocks, where the $i$-th stack consists of $a_i$ blocks resting on the surface.\n\nThe height of the exhibit is equal to $m...
[{"type": "stdin_stdout", "input": "50 1000000000\n824428839 821375880 831521735 868908015 86990853 248293447 886713846 425716910 443947914 504402098 40124673 774093026 271211165 873482658 592754073 490097471 947930201 69692739 145291746 418475785 80274059 696889747 854947829 231642778 141525047 57563878 92067934 38750...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYour security guard friend recently got a new job at a new security company. The company requires him to patrol an area of the city encompassing exactly N city blocks, but they let him choose which blocks. That is, your f...
[{"type": "stdin_stdout", "input": "1000000\n", "output": "4000\n"}, {"type": "stdin_stdout", "input": "999000\n", "output": "3998\n"}, {"type": "stdin_stdout", "input": "999001\n", "output": "4000\n"}, {"type": "stdin_stdout", "input": "999999\n", "output": "4000\n"}, {"type": "stdin_stdout", "input": "933206\n", "out...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLike any unknown mathematician, Yuri has favourite numbers: $A$, $B$, $C$, and $D$, where $A \\leq B \\leq C \\leq D$. Yuri also likes triangles and once he thought: how many non-degenerate triangles with integer sides $x...
[{"type": "stdin_stdout", "input": "86565 229134 356183 486713\n", "output": "1559833368660730\n"}, {"type": "stdin_stdout", "input": "90528 225462 336895 417903\n", "output": "1043176084391535\n"}, {"type": "stdin_stdout", "input": "178561 294901 405737 476436\n", "output": "911664147520700\n"}, {"type": "stdin_stdout...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n You are given <var>Q</var> tuples of integers <var>(L_i, A_i, B_i, M_i)</var>. For each tuple, answer the following question. \nThere is an arithmetic progression with L terms: s_0, s_1, s_2, ... , s_{L-1}.\nThe initial ...
[{"type": "stdin_stdout", "input": "31940 139378099479290043 26943708742238 1000000000\n", "output": "997629525\n"}, {"type": "stdin_stdout", "input": "1 999999999999999999 999999999999999999 998244353\n", "output": "716070897\n"}, {"type": "stdin_stdout", "input": "345 493299812499659259 1418510335032035 998244353\n",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently, you bought a brand new smart lamp with programming features. At first, you set up a schedule to the lamp. Every day it will turn power on at moment $0$ and turn power off at moment $M$. Moreover, the lamp allows...
[{"type": "stdin_stdout", "input": "7 1000000000\n1 10001 10011 20011 20021 40021 40031\n", "output": "999999969\n"}, {"type": "stdin_stdout", "input": "7 1000000000\n3 10001 10011 20011 20021 40021 40031\n", "output": "999999969\n"}, {"type": "stdin_stdout", "input": "6 981231233\n1 6 15 30 130 1875\n", "output": "981...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence $b_1, b_2, \\ldots, b_n$. Find the lexicographically minimal permutation $a_1, a_2, \\ldots, a_{2n}$ such that $b_i = \\min(a_{2i-1}, a_{2i})$, or determine that it is impossible.\n\n\n-----Input-...
[{"type": "stdin_stdout", "input": "50\n2\n2 1\n2\n1 2\n2\n1 2\n2\n2 1\n2\n1 3\n2\n2 1\n2\n1 2\n2\n2 1\n2\n3 1\n2\n1 2\n2\n1 2\n2\n2 1\n2\n1 3\n2\n1 2\n2\n3 1\n2\n1 2\n2\n1 3\n2\n1 3\n2\n2 1\n2\n1 3\n2\n1 2\n2\n1 3\n2\n1 3\n2\n3 1\n2\n2 1\n2\n1 2\n2\n1 2\n2\n1 3\n2\n2 1\n2\n2 1\n2\n3 1\n2\n1 2\n2\n3 1\n2\n3 1\n2\n1 3\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs you may know, MemSQL has American offices in both San Francisco and Seattle. Being a manager in the company, you travel a lot between the two cities, always by plane.\n\nYou prefer flying from Seattle to San Francisco ...
[{"type": "stdin_stdout", "input": "100\nSFFSSFFFFFFSSFFFSSFSFFFFFSSFFFSFFFFFFSFSSSFSFSFFFFSFSSFFFFFFFFSFFFFFSFFFFFSSFFFSFFSFSFFFFSFFSFFFFFFF\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100\nSFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\n", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCalculate the number of ways to place $n$ rooks on $n \\times n$ chessboard so that both following conditions are met:\n\n each empty cell is under attack; exactly $k$ pairs of rooks attack each other. \n\nAn empty cell...
[{"type": "stdin_stdout", "input": "200000 100000\n", "output": "668585001\n"}, {"type": "stdin_stdout", "input": "200000 199998\n", "output": "508670650\n"}, {"type": "stdin_stdout", "input": "200000 3393\n", "output": "259194802\n"}, {"type": "stdin_stdout", "input": "200000 100\n", "output": "431967939\n"}, {"type":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasiliy lives at point (a, b) of the coordinate plane. He is hurrying up to work so he wants to get out of his house as soon as possible. New app suggested n available Beru-taxi nearby. The i-th taxi is located at point (...
[{"type": "stdin_stdout", "input": "66 -82\n43\n27 -21 70\n-64 46 58\n-7 -20 41\n-42 60 57\n-93 -7 95\n26 -61 26\n-10 -72 25\n-78 -18 55\n-62 -64 69\n-33 95 50\n24 59 45\n4 72 37\n66 57 61\n16 -60 5\n17 -78 36\n-75 56 59\n-60 98 77\n-94 37 28\n76 6 63\n99 -35 75\n69 -40 1\n9 -48 56\n-94 -11 19\n69 1 63\n43 42 80\n-28 -...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nXenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a, b, c the f...
[{"type": "stdin_stdout", "input": "15\n2 1 2 1 3 6 1 2 1 6 1 3 4 6 4\n", "output": "1 2 4\n1 2 4\n1 3 6\n1 3 6\n1 2 6\n"}, {"type": "stdin_stdout", "input": "24\n1 1 1 1 1 1 1 1 1 2 2 2 3 3 3 3 3 3 4 4 4 6 6 6\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "12\n3 6 1 1 3 6 1 1 2 6 2 6\n", "output": "1 3 6\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string s consisting of lowercase Latin letters. Character c is called k-dominant iff each substring of s with length at least k contains this character c.\n\nYou have to find minimum k such that there exis...
[{"type": "stdin_stdout", "input": "gfliflgfhhdkceacdljgkegmdlhcgkcmlelmbbbmdddgdeeljjhgbbffmemmmkhebgkhadkdajabcjkcgbkgbaeacdedlkklfech\n", "output": "17\n"}, {"type": "stdin_stdout", "input": "bcaccacaaabaacaabaaabcbbcbcaacacbcbaaaacccacbbcbaabcbacaacbabacacacaccbbccbcbacbbbbccccabcabaaab\n", "output": "8\n"}, {"type...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCodehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.\n\nThe valid sizes of T-shirts are either \"M\" or from $0$ to $3$ \"X\" follo...
[{"type": "stdin_stdout", "input": "43\nL\nXXXL\nM\nXS\nL\nXXL\nS\nL\nM\nXXXL\nXXS\nS\nXS\nS\nXS\nXL\nXXL\nXXL\nXS\nXXS\nXXL\nL\nXXXL\nL\nL\nXXL\nXXL\nM\nXXXS\nM\nXXL\nXXXS\nXXXL\nXXS\nL\nL\nXS\nL\nXS\nXS\nL\nXXL\nM\nXXXL\nXXL\nXXL\nXL\nL\nXS\nM\nXL\nXXXS\nXXXS\nS\nXXL\nXXXL\nXXL\nXS\nXXS\nL\nS\nXXXS\nXL\nL\nXL\nXXXS\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are cons...
[{"type": "stdin_stdout", "input": "50\nGRBGGRBRGRBGGBBBBBGGGBBBBRBRGBRRBRGBBBRBBRRGBGGGRB\n", "output": "18\n"}, {"type": "stdin_stdout", "input": "50\nRBGGBGGRBGRBBBGBBGRBBBGGGRBBBGBBBGRGGBGGBRBGBGRRGG\n", "output": "17\n"}, {"type": "stdin_stdout", "input": "50\nGGGBBRGGGGGRRGGRBGGRGBBRBRRBGRGBBBGBRBGRGBBGRGGBRB\n",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBear Limak likes watching sports on TV. He is going to watch a game today. The game lasts 90 minutes and there are no breaks.\n\nEach minute can be either interesting or boring. If 15 consecutive minutes are boring then L...
[{"type": "stdin_stdout", "input": "90\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90\n", "output": "90\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya has got many devices that work on electricity. He's got n supply-line filters to plug the devices, the i-th supply-line filter has a_{i} sockets.\n\nOverall Vasya has got m devices and k electrical sockets in his fl...
[{"type": "stdin_stdout", "input": "50 50 2\n2 2 4 5 2 1 5 4 5 4 5 2 1 2 3 3 5 1 2 2 1 3 4 5 5 4 3 2 2 1 3 2 3 2 4 4 1 3 5 4 3 2 4 3 4 4 4 4 3 4\n", "output": "14\n"}, {"type": "stdin_stdout", "input": "50 30 1\n2 1 2 1 2 3 3 1 2 2 3 2 1 3 1 3 1 2 2 3 2 1 3 1 1 2 3 2 2 1 1 3 3 2 2 2 3 2 3 3 3 3 1 1 3 1 1 3 1 3\n", "out...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nUser ainta has a stack of n red and blue balls. He can apply a certain operation which changes the colors of the balls inside the stack.\n\n While the top ball inside the stack is red, pop the ball from the top of the st...
[{"type": "stdin_stdout", "input": "50\nBRRRBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\n", "output": "1125899906842609\n"}, {"type": "stdin_stdout", "input": "50\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\n", "output": "1125899906842623\n"}, {"type": "stdin_stdout", "input": "50\nRRBBBBBBBBBBBBBBBBRBRRBBBR...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food inc...
[{"type": "stdin_stdout", "input": "00 00\n100000 100 100 100\n", "output": "100000.0000\n"}, {"type": "stdin_stdout", "input": "20 55\n100000 100 100 100\n", "output": "80000.0000\n"}, {"type": "stdin_stdout", "input": "23 59\n100000 100 100 100\n", "output": "80000.0000\n"}, {"type": "stdin_stdout", "input": "14 33\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKolya got string s for his birthday, the string consists of small English letters. He immediately added k more characters to the right of the string.\n\nThen Borya came and said that the new string contained a tandem repe...
[{"type": "stdin_stdout", "input": "jhfwjyyzwrjiyrrgveiqkoltivghgkontrqragikttxxuwszjwqhwxindyrdqhucnbwgwrppgqmsasrzohezjlfmkzsqptwpratprcrxyxecnlsaiqrvimihmhjfgzwdtvmfhgbuonpsblphyoxzclkrwbwrkasahiirzqlfjdoomlosltldbpomyyhmdwfchzxnmwlh\n200\n", "output": "400\n"}, {"type": "stdin_stdout", "input": "nemtbujbscvkgxnbqbo...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ slimes in a row. Each slime has an integer value (possibly negative or zero) associated with it.\n\nAny slime can eat its adjacent slime (the closest slime to its left or to its right, assuming that this sli...
[{"type": "stdin_stdout", "input": "10\n-20 0 3 -5 -18 15 -3 -9 -7 9\n", "output": "89"}, {"type": "stdin_stdout", "input": "9\n2 4 -4 15 1 11 15 -7 -20\n", "output": "79"}, {"type": "stdin_stdout", "input": "8\n-1 5 -19 4 -12 20 1 -12\n", "output": "74"}, {"type": "stdin_stdout", "input": "1\n-1000000000\n", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Fair Nut lives in $n$ story house. $a_i$ people live on the $i$-th floor of the house. Every person uses elevator twice a day: to get from the floor where he/she lives to the ground (first) floor and to get from the f...
[{"type": "stdin_stdout", "input": "100\n47 79 39 24 51 37 29 54 96 100 48 80 32 98 27 88 73 36 79 11 33 78 87 94 27 55 21 1 24 6 83 27 7 66 27 91 12 35 43 17 57 46 78 19 20 61 29 89 6 73 51 82 48 14 33 81 37 51 34 64 57 19 1 96 49 81 34 27 84 49 72 56 47 37 50 23 58 53 78 82 25 66 13 10 61 3 73 96 64 59 38 48 12 61 96...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter learning about polynomial hashing, Heidi decided to learn about shift-xor hashing. In particular, she came across this interesting problem.\n\nGiven a bitstring $y \\in \\{0,1\\}^n$ find out the number of different ...
[{"type": "stdin_stdout", "input": "111\n001101111000100111111000010101011110011000010101010001001011000111100111111101000110000011110110100111000100101\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10\n1010100001\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "4\n1010\n", "output": "3\n"}, {"type":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Lesha loves listening to music via his smartphone. But the smartphone doesn't have much memory, so Lesha listens to his favorite songs in a well-known social network InTalk.\n\nUnfortunately, internet is not that f...
[{"type": "stdin_stdout", "input": "100000 99999 4\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "100000 1 10000\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "10028 13 10000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "100000 99999 2\n", "output": "1\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's call a string adorable if its letters can be realigned in such a way that they form two consequent groups of equal symbols (note that different groups must contain different symbols). For example, ababa is adorable ...
[{"type": "stdin_stdout", "input": "aaaaaaabbbbbbcder\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "aaaaaaaaaaaaaaa\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "bcbccccccca\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "abacabadde\n", "output": "No\n"}, {"type": "stdin_stdout", "inp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a set of points $x_1$, $x_2$, ..., $x_n$ on the number line.\n\nTwo points $i$ and $j$ can be matched with each other if the following conditions hold: neither $i$ nor $j$ is matched with any other point; ...
[{"type": "stdin_stdout", "input": "100 13\n11 28 21 7 6 23 26 31 26 32 34 17 19 1 13 1 28 30 28 8 23 36 17 20 5 37 32 23 14 1 20 23 3 39 20 14 2 12 15 3 1 27 7 25 15 39 10 6 8 37 6 22 7 29 6 17 17 9 16 3 39 23 2 34 20 12 28 29 32 2 38 27 36 27 29 18 7 14 27 25 33 18 29 40 22 9 9 6 21 7 23 35 33 26 31 31 39 36 27 27\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have a fraction $\\frac{a}{b}$. You need to find the first occurrence of digit c into decimal notation of the fraction after decimal point.\n\n\n-----Input-----\n\nThe first contains three single positive integers a, ...
[{"type": "stdin_stdout", "input": "99999 100000 8\n", "output": "-1"}, {"type": "stdin_stdout", "input": "44102 73848 2\n", "output": "132"}, {"type": "stdin_stdout", "input": "69168 84860 4\n", "output": "107"}, {"type": "stdin_stdout", "input": "13805 15538 3\n", "output": "164"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently Ivan noticed an array a while debugging his code. Now Ivan can't remember this array, but the bug he was trying to fix didn't go away, so Ivan thinks that the data from this array might help him to reproduce the ...
[{"type": "stdin_stdout", "input": "50 20\n1 44 48 43\n1 15 24 9\n2 39 44 25\n1 36 48 35\n1 4 30 27\n1 31 44 15\n2 19 38 22\n2 18 43 24\n1 25 35 10\n2 38 43 5\n2 10 22 21\n2 5 19 30\n1 17 35 26\n1 17 31 10\n2 9 21 1\n2 29 34 10\n2 25 44 21\n2 13 33 13\n2 34 38 9\n2 23 43 4\n", "output": "-1\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nZane the wizard is going to perform a magic show shuffling the cups.\n\nThere are n cups, numbered from 1 to n, placed along the x-axis on a table that has m holes on it. More precisely, cup i is on the table at the posit...
[{"type": "stdin_stdout", "input": "203948 2 14\n203948 203946\n39 38\n4959 3030\n1 203947\n2929 9292\n203944 203948\n203947 203944\n203944 203922\n203922 203948\n2495 20495\n29419 5959\n12949 12\n49 29292\n1 94\n1 203\n", "output": "203948"}, {"type": "stdin_stdout", "input": "203948 2 14\n203948 203947\n39 38\n4959 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDue to the increase in the number of students of Berland State University it was decided to equip a new computer room. You were given the task of buying mouses, and you have to spend as little as possible. After all, the ...
[{"type": "stdin_stdout", "input": "37 80 100\n31\n901706521 USB\n555265160 PS/2\n547038505 PS/2\n644436873 PS/2\n105558073 USB\n915082057 PS/2\n913113815 USB\n953413471 PS/2\n252912707 PS/2\n830344497 USB\n781593007 USB\n610659875 PS/2\n177755858 PS/2\n496444729 PS/2\n617569418 USB\n304908147 PS/2\n188649950 PS/2\n705...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKyoya Ootori is selling photobooks of the Ouran High School Host Club. He has 26 photos, labeled \"a\" to \"z\", and he has compiled them into a photo booklet with some photos in some order (possibly with some photos bein...
[{"type": "stdin_stdout", "input": "xulsyfkuizjauadjjopu\n", "output": "526\n"}, {"type": "stdin_stdout", "input": "cskgsxywlvfeicoueglr\n", "output": "526\n"}, {"type": "stdin_stdout", "input": "gggggggggggggggggggg\n", "output": "526\n"}, {"type": "stdin_stdout", "input": "qdqdddqddqqddqddqdqd\n", "output": "526\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKing of Berland Berl IV has recently died. Hail Berl V! As a sign of the highest achievements of the deceased king the new king decided to build a mausoleum with Berl IV's body on the main square of the capital.\n\nThe ma...
[{"type": "stdin_stdout", "input": "30 50\n56 <= 26\n47 >= 42\n18 > 7\n51 < 28\n36 >= 5\n58 = 58\n49 > 24\n2 <= 31\n24 < 37\n7 >= 2\n7 <= 33\n14 < 16\n11 <= 35\n33 > 7\n55 < 31\n46 >= 41\n55 > 5\n18 >= 60\n12 > 59\n10 <= 30\n25 >= 23\n40 > 3\n49 >= 45\n20 > 6\n60 < 53\n21 >= 5\n11 <= 50\n12 < 33\n1 <= 10\n44 > 29\n48 >...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFafa 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.\n...
[{"type": "stdin_stdout", "input": "100000\n", "output": "35\n"}, {"type": "stdin_stdout", "input": "83160\n", "output": "127\n"}, {"type": "stdin_stdout", "input": "99999\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "65536\n", "output": "16\n"}, {"type": "stdin_stdout", "input": "40320\n", "output": "95\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSuppose you have a special $x$-$y$-counter. This counter can store some value as a decimal number; at first, the counter has value $0$. \n\nThe counter performs the following algorithm: it prints its lowest digit and, aft...
[{"type": "stdin_stdout", "input": "01985222473\n", "output": "-1 35 -1 33 -1 -1 -1 31 -1 29 \n35 53 24 17 20 17 18 15 13 13 \n-1 24 -1 18 -1 18 -1 19 -1 14 \n33 17 18 51 14 19 23 13 21 15 \n-1 20 -1 14 -1 21 -1 22 -1 22 \n-1 17 18 19 21 -1 17 17 20 19 \n-1 18 -1 23 -1 17 -1 12 -1 17 \n31 15 19 13 22 17 12 49 16 15 \n-...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Little Elephant loves chess very much. \n\nOne day the Little Elephant and his friend decided to play chess. They've got the chess pieces but the board is a problem. They've got an 8 × 8 checkered board, each square i...
[{"type": "stdin_stdout", "input": "WBWBWBWB\nBWBWBWBW\nBWBWBWBW\nBWBWBWBW\nWBWBWBWB\nWBWBWBWB\nBWBWBWBW\nWBWBWBWB\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "BWBWBWBW\nWBWBWBWB\nBWBWBWBW\nBWBWBWBW\nWBWBWBWB\nWBWBWBWB\nWBWBWBWB\nWBWBWBWB\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "BWBWBWBW...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn 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.\n\nWhen he woke up, he only remembered that the key was a sequence of p...
[{"type": "stdin_stdout", "input": "36\n1007 27189 42294 81567 108756 133931 149036 161120 200393 231610 234631 270883 302100 307135 343387 344394 362520 383667 421933 463220 486381 526661 546801 571976 595137 615277 616284 629375 661599 674690 680732 714970 744173 785460 787474 823726\n", "output": "71\n1007 1007 2718...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.\n\nLet's enumerate all the houses from left to right, starting with one...
[{"type": "stdin_stdout", "input": "100\n9 9 72 55 14 8 55 58 35 67 3 18 73 92 41 49 15 60 18 66 9 26 97 47 43 88 71 97 19 34 48 96 79 53 8 24 69 49 12 23 77 12 21 88 66 9 29 13 61 69 54 77 41 13 4 68 37 74 7 6 29 76 55 72 89 4 78 27 29 82 18 83 12 4 32 69 89 85 66 13 92 54 38 5 26 56 17 55 29 4 17 39 29 94 3 67 85 98 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasily has a number a, which he wants to turn into a number b. For this purpose, he can do two types of operations: multiply the current number by 2 (that is, replace the number x by 2·x); append the digit 1 to the righ...
[{"type": "stdin_stdout", "input": "1 536870912\n", "output": "YES\n30\n1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 2097152 4194304 8388608 16777216 33554432 67108864 134217728 268435456 536870912 \n"}, {"type": "stdin_stdout", "input": "5440 27853056\n", "output": "Y...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe 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 ...
[{"type": "stdin_stdout", "input": "1000000000 1000000000 1000000000\n", "output": "1000000000000000000\n1000000000 1000000000\n"}, {"type": "stdin_stdout", "input": "1 1000000000 1000000000\n", "output": "1000000000000000000\n1000000000 1000000000\n"}, {"type": "stdin_stdout", "input": "1 1000000000 1000000000\n", "ou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEvery Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower be...
[{"type": "stdin_stdout", "input": "50\n67 1\n89 2\n83 1\n-26 1\n88 2\n-22 2\n-98 2\n-83 1\n58 2\n26 2\n-37 1\n-43 2\n29 1\n65 2\n-70 1\n81 2\n36 1\n52 2\n93 2\n-12 2\n-12 1\n5 2\n91 1\n3 1\n-27 1\n18 1\n-60 1\n-15 1\n17 1\n-33 1\n-74 2\n5 2\n-62 2\n72 1\n-22 1\n-58 1\n-9 1\n57 1\n-18 2\n-11 2\n-68 2\n74 2\n-20 2\n21 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n-----Input-----\n\nThe only line of the input is a string of 7 characters. The first character is letter A, followed by 6 digits. The input is guaranteed to be valid (for certain definition of \"valid\").\n\n\n-----Output...
[{"type": "stdin_stdout", "input": "A221033\n", "output": "21\n"}, {"type": "stdin_stdout", "input": "A223635\n", "output": "22\n"}, {"type": "stdin_stdout", "input": "A232726\n", "output": "23\n"}, {"type": "stdin_stdout", "input": "A102210\n", "output": "25\n"}, {"type": "stdin_stdout", "input": "A231010\n", "output"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOnce again Tavas started eating coffee mix without water! Keione told him that it smells awful, but he didn't stop doing that. That's why Keione told his smart friend, SaDDas to punish him! SaDDas took Tavas' headphones a...
[{"type": "stdin_stdout", "input": "777777777\n", "output": "1022\n"}, {"type": "stdin_stdout", "input": "444444444\n", "output": "511\n"}, {"type": "stdin_stdout", "input": "477477447\n", "output": "728\n"}, {"type": "stdin_stdout", "input": "777744747\n", "output": "996\n"}, {"type": "stdin_stdout", "input": "4447747...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMr. Chanek is currently participating in a science fair that is popular in town. He finds an exciting puzzle in the fair and wants to solve it.\n\nThere are $N$ atoms numbered from $1$ to $N$. These atoms are especially q...
[{"type": "stdin_stdout", "input": "6 1\n1 10 10 5 20 100\n1000000 1 10 10 100 1000000\n", "output": "144\n"}, {"type": "stdin_stdout", "input": "6 1\n1 10 10 20 5 100\n1000000 1 10 100 10 1000000\n", "output": "144\n"}, {"type": "stdin_stdout", "input": "5 1\n2 5 11 12 13\n1 2 100 100 100\n", "output": "40\n"}, {"type...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSergey is testing a next-generation processor. Instead of bytes the processor works with memory cells consisting of n bits. These bits are numbered from 1 to n. An integer is stored in the cell in the following way: the l...
[{"type": "stdin_stdout", "input": "100\n1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "100\n1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\n", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecenlty Luba got a credit card and started to use it. Let's consider n consecutive days Luba uses the card.\n\nShe starts with 0 money on her account.\n\nIn the evening of i-th day a transaction a_{i} occurs. If a_{i} > ...
[{"type": "stdin_stdout", "input": "20 23036\n-1 1 -1 -1 -1 -1 1 -1 -1 0 0 1 1 0 0 1 0 0 -1 -1\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "16 76798\n-1 11 -7 -4 0 -11 -12 3 0 -7 6 -4 8 6 5 -10\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "20 23079\n0 1 1 -1 1 0 -1 -1 0 0 1 -1 1 1 1 0 0 1 0 1\n",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two integer sequences S and T of length N and M, respectively, both consisting of integers between 1 and 10^5 (inclusive).\nIn how many pairs of a subsequence of S and a subsequence of T do the two subsequen...
[{"type": "stdin_stdout", "input": "1989 1986\n84234 80908 59749 63761 63761 49034 63761 64697 84234 84234 64697 64697 49034 80908 80908 63761 66200 59749 59749 80908 84234 63761 80908 80908 66200 92283 84234 63761 80908 63761 92283 59749 49034 78052 53613 49034 92283 80908 53613 59749 49034 49034 59749 80908 66200 809...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou're given an array $a$ of length $2n$. Is it possible to reorder it in such way so that the sum of the first $n$ elements isn't equal to the sum of the last $n$ elements?\n\n\n-----Input-----\n\nThe first line contains...
[{"type": "stdin_stdout", "input": "97\n7 8 5 4 7 4 10 3 8 10 2 10 9 9 8 1 9 1 8 8 5 6 4 8 7 1 9 10 6 3 9 5 8 3 3 8 9 8 4 2 10 8 5 4 1 10 8 4 2 3 2 10 6 1 4 5 1 2 9 5 4 9 1 5 5 8 10 1 10 6 5 8 8 8 5 4 5 7 8 8 6 2 7 10 4 2 1 6 5 9 1 8 6 7 5 2 3 4 1 10 4 5 4 3 10 8 9 9 9 8 6 5 8 7 8 10 4 4 7 5 8 8 1 10 6 9 5 9 8 4 9 1 10...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn mathematics, the Pythagorean theorem — is a relation in Euclidean geometry among the three sides of a right-angled triangle. In terms of areas, it states:\n\n In any right-angled triangle, the area of the square whose...
[{"type": "stdin_stdout", "input": "10000\n", "output": "12471\n"}, {"type": "stdin_stdout", "input": "9999\n", "output": "12467\n"}, {"type": "stdin_stdout", "input": "1000\n", "output": "881\n"}, {"type": "stdin_stdout", "input": "586\n", "output": "472\n"}, {"type": "stdin_stdout", "input": "362\n", "output": "258\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have $n \\times n$ square grid and an integer $k$. Put an integer in each cell while satisfying the conditions below. All numbers in the grid should be between $1$ and $k$ inclusive. Minimum number of the $i$-th row...
[{"type": "stdin_stdout", "input": "250 1000000000\n", "output": "770503193\n"}, {"type": "stdin_stdout", "input": "244 315404017\n", "output": "868949606\n"}, {"type": "stdin_stdout", "input": "218 325181815\n", "output": "230476135\n"}, {"type": "stdin_stdout", "input": "246 629926913\n", "output": "283598434\n"}, {"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSeryozha conducts a course dedicated to building a map of heights of Stepanovo recreation center. He laid a rectangle grid of size $n \\times m$ cells on a map (rows of grid are numbered from $1$ to $n$ from north to sout...
[{"type": "stdin_stdout", "input": "3000 3000 4 10\n623629309 917769297 890844966 987654319\n", "output": "215591588260257\n"}, {"type": "stdin_stdout", "input": "3000 3000 10 4\n122375063 551934841 132649021 999999937\n", "output": "218197599525055\n"}, {"type": "stdin_stdout", "input": "3000 3000 1000 1000\n794639486...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMad scientist Mike is busy carrying out experiments in chemistry. Today he will attempt to join three atoms into one molecule.\n\nA molecule consists of atoms, with some pairs of atoms connected by atomic bonds. Each atom...
[{"type": "stdin_stdout", "input": "1000000 1000000 1000000\n", "output": "500000 500000 500000\n"}, {"type": "stdin_stdout", "input": "688348 726472 442198\n", "output": "486311 240161 202037\n"}, {"type": "stdin_stdout", "input": "602752 645534 784262\n", "output": "232012 413522 370740\n"}, {"type": "stdin_stdout", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. \n\nTotally in Berland there are n citizens, the ...
[{"type": "stdin_stdout", "input": "70\n644488 5444 150441 714420 602059 335330 510670 196555 546346 740011 509449 850947 692874 524857 750434 952985 223744 374727 896124 753037 367352 679050 560202 172728 569291 778616 332116 286927 843598 372698 244906 498046 900681 709791 420904 724593 864493 813094 791377 39998 296...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFlatland has recently introduced a new type of an eye check for the driver's licence. The check goes like that: there is a plane with mannequins standing on it. You should tell the value of the minimum angle with the vert...
[{"type": "stdin_stdout", "input": "38\n96 416\n24 104\n6 26\n12 52\n210 910\n150 650\n54 234\n174 754\n114 494\n18 78\n90 390\n36 156\n222 962\n186 806\n126 546\n78 338\n108 468\n180 780\n120 520\n84 364\n66 286\n138 598\n30 130\n228 988\n72 312\n144 624\n198 858\n60 260\n48 208\n102 442\n42 182\n162 702\n132 572\n156...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this problem MEX of a certain array is the smallest positive integer not contained in this array.\n\nEveryone knows this definition, including Lesha. But Lesha loves MEX, so he comes up with a new problem involving MEX...
[{"type": "stdin_stdout", "input": "100\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSergei B., the young coach of Pokemons, has found the big house which consists of n flats ordered in a row from left to right. It is possible to enter each flat from the street. It is possible to go out from each flat. Al...
[{"type": "stdin_stdout", "input": "100\nfAfhfNNNhfffAfNffNANhffNffffffNfffffhNfffNfffNfffNfNNNffNfffNfhNNNffffNfNfffAffNffNffNNfhfffNhNffNNN\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "95\nEmuBuEBmmEBBElBlElmmBEmmmEmmEuBEEmummmEmBBBBEWBBBmEEBmmummBBmmlluBBmElmEBEmBmBBmBmuLmEBBmlEBmBu\n", "output": "39\n"}...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPasha has many hamsters and he makes them work out. Today, n hamsters (n is even) came to work out. The hamsters lined up and each hamster either sat down or stood up.\n\nFor another exercise, Pasha needs exactly $\\frac{...
[{"type": "stdin_stdout", "input": "200\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n", "output": "100\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCalculate the minimum number of characters you need to change in the string s, so that it contains at least k different letters, or print that it is impossible.\n\nString s consists only of lowercase Latin letters, and it...
[{"type": "stdin_stdout", "input": "smaxpqplaqqbxuqxalqmbmmgubbpspxhawbxsuqhhegpmmpebqmqpbbeplwaepxmsahuepuhuhwxeqmmlgqubuaxehwuwasgxpqmugbmuawuhwqlswllssueglbxepbmwgs\n1\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "fcfccfcfccfcfcffcffffffcfccfccfcffccccfcffffccfccfcffcfcccccffcfffcccffcfccfffffcccfccffffff...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOur old friend Alexey has finally entered the University of City N — the Berland capital. Alexey expected his father to get him a place to live in but his father said it was high time for Alexey to practice some financial...
[{"type": "stdin_stdout", "input": "71\n1 99\n11 69\n86 92\n7 49\n31 70\n42 53\n48 81\n86 96\n36 91\n19 38\n39 91\n41 64\n87 93\n83 97\n40 41\n3 32\n15 18\n58 65\n22 32\n1 71\n58 86\n64 77\n15 69\n4 34\n42 89\n9 66\n15 18\n58 65\n59 96\n39 89\n19 38\n6 63\n26 73\n29 47\n55 88\n5 78\n41 74\n48 81\n20 71\n59 96\n42 49\n4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAyoub had an array $a$ of integers of size $n$ and this array had two interesting properties: All the integers in the array were between $l$ and $r$ (inclusive). The sum of all the elements was divisible by $3$. \n\nUn...
[{"type": "stdin_stdout", "input": "120881 536336525 585696606\n", "output": "915864703\n"}, {"type": "stdin_stdout", "input": "121382 445163929 988375913\n", "output": "594431176\n"}, {"type": "stdin_stdout", "input": "126028 622192701 881885560\n", "output": "842053672\n"}, {"type": "stdin_stdout", "input": "142972 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe bear decided to store some raspberry for the winter. He cunningly found out the price for a barrel of honey in kilos of raspberry for each of the following n days. According to the bear's data, on the i-th (1 ≤ i ≤ n)...
[{"type": "stdin_stdout", "input": "100 9\n66 71 37 41 23 38 77 11 74 13 51 26 93 56 81 17 12 70 85 37 54 100 14 99 12 83 44 16 99 65 13 48 92 32 69 33 100 57 58 88 25 45 44 85 5 41 82 15 37 18 21 45 3 68 33 9 52 64 8 73 32 41 87 99 26 26 47 24 79 93 9 44 11 34 85 26 14 61 49 38 25 65 49 81 29 82 28 23 2 64 38 13 77 68...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nInnokentiy likes tea very much and today he wants to drink exactly n cups of tea. He would be happy to drink more but he had exactly n tea bags, a of them are green and b are black.\n\nInnokentiy doesn't like to drink the...
[{"type": "stdin_stdout", "input": "11 2 3 8\n", "output": "BBGBBGBBGBB\n"}, {"type": "stdin_stdout", "input": "11 2 4 7\n", "output": "BBGBBGBBGBG\n"}, {"type": "stdin_stdout", "input": "11 2 5 6\n", "output": "BBGBGBGBGBG\n"}, {"type": "stdin_stdout", "input": "11 2 6 5\n", "output": "GGBGBGBGBGB\n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVitaly is a very weird man. He's got two favorite digits a and b. Vitaly calls a positive integer good, if the decimal representation of this integer only contains digits a and b. Vitaly calls a good number excellent, if ...
[{"type": "stdin_stdout", "input": "3 6 1000000\n", "output": "786609214\n"}, {"type": "stdin_stdout", "input": "8 9 1000000\n", "output": "573697309\n"}, {"type": "stdin_stdout", "input": "1 2 1000000\n", "output": "786609214\n"}, {"type": "stdin_stdout", "input": "4 9 104671\n", "output": "329390901\n"}, {"type": "st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasily the Programmer loves romance, so this year he decided to illuminate his room with candles.\n\nVasily has a candles.When Vasily lights up a new candle, it first burns for an hour and then it goes out. Vasily is smar...
[{"type": "stdin_stdout", "input": "1000 1000\n", "output": "1001\n"}, {"type": "stdin_stdout", "input": "1000 2\n", "output": "1999\n"}, {"type": "stdin_stdout", "input": "1000 3\n", "output": "1499\n"}, {"type": "stdin_stdout", "input": "1000 4\n", "output": "1333\n"}, {"type": "stdin_stdout", "input": "999 2\n", "ou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA sequence $a_1, a_2, \\dots, a_k$ is called an arithmetic progression if for each $i$ from $1$ to $k$ elements satisfy the condition $a_i = a_1 + c \\cdot (i - 1)$ for some fixed $c$.\n\nFor example, these five sequences...
[{"type": "stdin_stdout", "input": "6\n-999999998 -999999999 -1000000000 -999999995 -999999997 -999999995\n", "output": "-1"}, {"type": "stdin_stdout", "input": "6\n-999999998 -999999999 -1000000000 -999999996 -999999997 -999999996\n", "output": "6"}, {"type": "stdin_stdout", "input": "6\n-1000000000 -500000000 -1 0 50...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Chris is bored during his physics lessons (too easy), so he has built a toy box to keep himself occupied. The box is special, since it has the ability to change gravity.\n\nThere are n columns of toy cubes in the b...
[{"type": "stdin_stdout", "input": "100\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bea...
[{"type": "stdin_stdout", "input": "100 99 98 97\n", "output": "196\n195\n98\n"}, {"type": "stdin_stdout", "input": "100 50 19 10\n", "output": "100\n50\n19\n"}, {"type": "stdin_stdout", "input": "100 50 19 25\n", "output": "100\n51\n25\n"}, {"type": "stdin_stdout", "input": "100 50 19 30\n", "output": "100\n61\n30\n"}...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are some beautiful girls in Arpa’s land as mentioned before.\n\nOnce Arpa came up with an obvious problem:\n\nGiven an array and a number x, count the number of pairs of indices i, j (1 ≤ i < j ≤ n) such that $a_{i}...
[{"type": "stdin_stdout", "input": "64 118\n361 547 410 294 448 377 482 490 13 116 346 50 251 330 443 128 543 580 370 489 337 509 414 291 228 71 245 308 319 314 154 39 317 288 145 248 547 152 262 278 89 108 522 238 128 575 112 469 86 230 310 492 127 270 475 25 179 72 345 444 17 332 544 338\n", "output": "3"}, {"type": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSome time ago Lesha found an entertaining string $s$ consisting of lowercase English letters. Lesha immediately developed an unique algorithm for this string and shared it with you. The algorithm is as follows.\n\nLesha c...
[{"type": "stdin_stdout", "input": "abbcdddeaaffdfouurtytwoo\n", "output": "18 abbcd...tw\n17 bbcdd...tw\n16 bcddd...tw\n15 cddde...tw\n14 dddea...tw\n13 ddeaa...tw\n12 deaad...tw\n11 eaadf...tw\n10 aadfortytw\n9 adfortytw\n8 dfortytw\n9 fdfortytw\n8 dfortytw\n7 fortytw\n6 ortytw\n5 rtytw\n6 urtytw\n5 rtytw\n4 tytw\n3 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nChilly Willy loves playing with numbers. He only knows prime numbers that are digits yet. These numbers are 2, 3, 5 and 7. But Willy grew rather bored of such numbers, so he came up with a few games that were connected wi...
[{"type": "stdin_stdout", "input": "123\n", "output": "100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110"}, {"type": "stdin_stdout", "input": "122\n", "output": "100000000000000000000000000000000000000000000000000000000000000000000000000000000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nComrade Dujikov is busy choosing artists for Timofey's birthday and is recieving calls from Taymyr from Ilia-alpinist.\n\nIlia-alpinist calls every n minutes, i.e. in minutes n, 2n, 3n and so on. Artists come to the comra...
[{"type": "stdin_stdout", "input": "10000 10000 10000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1 10000 10000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "10000 1 10000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1 1 10000\n", "output": "10000\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nValera the horse lives on a plane. The Cartesian coordinate system is defined on this plane. Also an infinite spiral is painted on the plane. The spiral consists of segments: [(0, 0), (1, 0)], [(1, 0), (1, 1)], [(1, 1), (...
[{"type": "stdin_stdout", "input": "37 -100\n", "output": "400\n"}, {"type": "stdin_stdout", "input": "100 100\n", "output": "397\n"}, {"type": "stdin_stdout", "input": "-96 -96\n", "output": "383\n"}, {"type": "stdin_stdout", "input": "99 100\n", "output": "398\n"}, {"type": "stdin_stdout", "input": "16 -32\n", "outpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs you probably know, Anton goes to school. One of the school subjects that Anton studies is Bracketology. On the Bracketology lessons students usually learn different sequences that consist of round brackets (characters ...
[{"type": "stdin_stdout", "input": "((((()())))())((((((()(()())(()())()((()()))(((())()()()(())))))()())())))(()()(()))))()(((()(((())()))())())))))(()()()((((((())(()())())()())(()))))()(()))(((()()()))())()(((()(()(((()))(()))()(()))((((((((())))))()))())(())))))()(()(()(((()((()()()())(((())())((()())(((((()()(())(...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is a positive integer N. Consider repeatedly applying the operation below on N:\n - First, choose a positive integer z satisfying all of the conditions below:\n - z can be represented as z=p^e, where p is a prime nu...
[{"type": "stdin_stdout", "input": "1000000000000\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "200560490130\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "755827200000\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "366735600000\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet S be the concatenation of 10^{10} copies of the string 110. (For reference, the concatenation of 3 copies of 110 is 110110110.)\nWe have a string T of length N.\nFind the number of times T occurs in S as a contiguous ...
[{"type": "stdin_stdout", "input": "62089\n1101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n workers in a company, each of them has a unique id from 1 to n. Exaclty one of them is a chief, his id is s. Each worker except the chief has exactly one immediate superior.\n\nThere was a request to each of t...
[{"type": "stdin_stdout", "input": "10 6\n3 0 0 0 0 0 0 1 0 0\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "9 1\n0 1 1 1 1 1 6 7 8\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "9 1\n0 1 1 1 1 5 6 7 8\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "9 1\n0 0 0 2 5 5 5 5 5\n", "output": "3\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter playing Neo in the legendary \"Matrix\" trilogy, Keanu Reeves started doubting himself: maybe we really live in virtual reality? To find if this is true, he needs to solve the following problem.\n\nLet's call a stri...
[{"type": "stdin_stdout", "input": "100\n0010110000001111110111101011100111101000110011011100100011110001101110000001000010100001011011110001\n", "output": "2\n001011000000111111011110101110011110100011001101110010001111000110111000000100001010000101101111000 1"}, {"type": "stdin_stdout", "input": "100\n011011001101111...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs you know, all the kids in Berland love playing with cubes. Little Petya has n towers consisting of cubes of the same size. Tower with number i consists of a_{i} cubes stacked one on top of the other. Petya defines the ...
[{"type": "stdin_stdout", "input": "76 41\n359 359 366 370 376 375 368 361 369 373 367 363 364 377 363 378 373 371 370 370 360 367 369 359 365 373 379 379 375 361 372 377 369 368 373 362 375 379 365 378 370 370 377 364 373 379 365 362 360 366 375 364 372 376 375 379 362 377 369 370 359 379 365 359 372 376 373 371 364 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou desperately need to build some string t. For that you've got n more strings s_1, s_2, ..., s_{n}. To build string t, you are allowed to perform exactly |t| (|t| is the length of string t) operations on these strings. ...
[{"type": "stdin_stdout", "input": "d\n100\nq 0\nj 0\nl 1\nn 1\nv 0\nx 1\nj 1\np 1\nb 1\nv 1\nu 1\ng 0\nk 1\nu 1\nc 1\nj 0\nd 1\nc 0\nv 1\nv 0\nu 1\nq 0\nf 0\ni 0\nn 1\nd 1\nh 1\ni 1\nj 1\ns 0\ni 0\nx 0\nb 0\nc 1\np 0\np 1\no 1\nc 1\nn 1\nf 0\no 0\nx 0\nu 0\ni 0\ng 0\ni 1\nl 0\np 0\nl 1\nl 1\nn 0\nq 1\nn 1\ng 1\nd 0\nb...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nManao works on a sports TV. He's spent much time watching the football games of some country. After a while he began to notice different patterns. For example, each team has two sets of uniforms: home uniform and guest un...
[{"type": "stdin_stdout", "input": "30\n44 17\n44 17\n44 17\n17 44\n44 17\n44 17\n17 44\n17 44\n17 44\n44 17\n44 17\n44 17\n44 17\n44 17\n17 44\n17 44\n17 44\n44 17\n44 17\n17 44\n44 17\n44 17\n44 17\n17 44\n17 44\n44 17\n17 44\n44 17\n44 17\n44 17\n", "output": "418\n"}, {"type": "stdin_stdout", "input": "30\n67 21\n8...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nValera loves his garden, where n fruit trees grow.\n\nThis year he will enjoy a great harvest! On the i-th tree b_{i} fruit grow, they will ripen on a day number a_{i}. Unfortunately, the fruit on the tree get withered, s...
[{"type": "stdin_stdout", "input": "24 1524\n16 934\n23 1940\n21 1447\n20 417\n24 1340\n22 1932\n13 775\n19 2918\n12 2355\n9 593\n11 2676\n3 1857\n16 868\n13 426\n18 1679\n22 991\n9 2728\n10 2497\n16 1221\n9 772\n23 2522\n24 982\n12 1431\n18 757\n", "output": "25893\n"}, {"type": "stdin_stdout", "input": "12 2856\n9 27...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSome time ago Leonid have known about idempotent functions. Idempotent function defined on a set {1, 2, ..., n} is such function $g : \\{1,2, \\ldots, n \\} \\rightarrow \\{1,2, \\ldots, n \\}$, that for any $x \\in \\{1,...
[{"type": "stdin_stdout", "input": "142\n34 88 88 88 88 88 131 53 88 130 131 88 88 130 88 131 53 130 130 34 88 88 131 130 53 88 88 34 131 130 88 131 130 34 130 53 53 34 53 34 130 34 88 88 130 88 131 130 34 53 88 34 53 88 130 53 34 53 88 131 130 34 88 88 130 88 130 130 131 131 130 53 131 130 131 130 53 34 131 34 88 53 8...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. ...
[{"type": "stdin_stdout", "input": "SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS\n100 100 100\n100 100 100\n1000000000000\n", "output": "100000001\n"}, {"type": "stdin_stdout", "input": "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor he knew every Who down in Whoville beneath, Was busy now, hanging a mistletoe wreath. \"And they're hanging their stockings!\" he snarled with a sneer, \"Tomorrow is Christmas! It's practically here!\"Dr. Suess, How T...
[{"type": "stdin_stdout", "input": "336 336\nHHHHHHHHHS..S..HH..H.S.H..HHH.H.H.H.S.H.S.S.H.S..SS..H.SS.H.HH.HH..HH.H...H.H.H.HSS..H...HH..HH.H..H.S.S....S.H.HH..HS..S.S.S.H.H.S..S.H.HH.HH..HH.HH.HS.HH.HSSHHHHHHHHH.H.HH..HHH.H.H.S..H.HH.S.H..HH.HS.HH.S.H.H.H..H.HH.HS.HHHHH.HH.S.SSS.S.S.HH.HS.H.S.HH.H.HH.H.S.HH.HS.HH..HH...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given n × m table. Each cell of the table is colored white or black. Find the number of non-empty sets of cells such that:\n\n All cells in a set have the same color. Every two cells in a set share row or column...
[{"type": "stdin_stdout", "input": "5 50\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 1 1 1 1 1 1 1 1\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 1 1 1 1 1 1 1 1\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 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMany students live in a dormitory. A dormitory is a whole new world of funny amusements and possibilities but it does have its drawbacks. \n\nThere is only one shower and there are multiple students who wish to have a sho...
[{"type": "stdin_stdout", "input": "0 89296 32018 98206 22395\n15733 0 69391 74253 50419\n80450 89589 0 20583 51716\n38629 93129 67730 0 69703\n44054 83018 21382 64478 0\n", "output": "874574\n"}, {"type": "stdin_stdout", "input": "0 14675 94714 27735 99544\n45584 0 43621 94734 66110\n72838 45781 0 47389 99394\n75870 9...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements.\n\nYou are given an integer $n$. \n\nYou have to find a sequence $s$ ...
[{"type": "stdin_stdout", "input": "10\n291\n292\n293\n294\n295\n296\n297\n298\n299\n300\n", "output": "13377777777777777733333333333333333333337\n133777777777777777733333333333333333333337\n1337777777777777777733333333333333333333337\n13377777777777777777733333333333333333333337\n13377777777777777777773333333333333333...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.\n\nPari is tryin...
[{"type": "stdin_stdout", "input": "4442231232741003009964183199713851566466079882929007253443848371978048610682180431295671905105980116\n", "output": "444223123274100300996418319971385156646607988292900725344384837197804861068218043129567190510598011661108950150917659213408128601684087917384834435270092928897066466515...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Artem found a grasshopper. He brought it to his house and constructed a jumping area for him.\n\nThe area looks like a strip of cells 1 × n. Each cell contains the direction for the next jump and the length of that...
[{"type": "stdin_stdout", "input": "10\n>>>>>>>>><\n1 1 1 1 1 1 1 1 1 5\n", "output": "INFINITE\n"}, {"type": "stdin_stdout", "input": "10\n>>>>>>>>><\n1 1 1 1 1 1 1 1 1 1\n", "output": "INFINITE\n"}, {"type": "stdin_stdout", "input": "10\n>>>>>>>>>>\n1 1 1 1 1 1 1 1 1 100\n", "output": "FINITE\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVanya loves playing. He even has a special set of cards to play with. Each card has a single integer. The number on the card can be positive, negative and can even be equal to zero. The only limit is, the number on each c...
[{"type": "stdin_stdout", "input": "123 222\n44 -190 -188 -185 -55 17 190 176 157 176 -24 -113 -54 -61 -53 53 -77 68 -12 -114 -217 163 -122 37 -37 20 -108 17 -140 -210 218 19 -89 54 18 197 111 -150 -36 -131 -172 36 67 16 -202 72 169 -137 -34 -122 137 -72 196 -17 -104 180 -102 96 -69 -184 21 -15 217 -61 175 -221 62 173 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day, at the \"Russian Code Cup\" event it was decided to play football as an out of competition event. All participants was divided into n teams and played several matches, two teams could not play against each other ...
[{"type": "stdin_stdout", "input": "11 5\n", "output": "55\n1 2\n1 3\n1 4\n1 5\n1 6\n2 3\n2 4\n2 5\n2 6\n2 7\n3 4\n3 5\n3 6\n3 7\n3 8\n4 5\n4 6\n4 7\n4 8\n4 9\n5 6\n5 7\n5 8\n5 9\n5 10\n6 7\n6 8\n6 9\n6 10\n6 11\n7 8\n7 9\n7 10\n7 11\n7 1\n8 9\n8 10\n8 11\n8 1\n8 2\n9 10\n9 11\n9 1\n9 2\n9 3\n10 11\n10 1\n10 2\n10 3\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is $\\frac{a}{b}$ for SmallR while $...
[{"type": "stdin_stdout", "input": "268 470 444 885\n", "output": "0.725614009325"}, {"type": "stdin_stdout", "input": "632 916 713 821\n", "output": "0.719292895126"}, {"type": "stdin_stdout", "input": "269 656 918 992\n", "output": "0.428937461623"}, {"type": "stdin_stdout", "input": "435 852 973 978\n", "output": "0...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nUnfortunately, Vasya can only sum pairs of integers (a, b), such that for any decimal place at least one number has digit 0 in this place. For example, Vasya can sum numbers 505 and 50, but he cannot sum 1 and 4.\n\nVasya...
[{"type": "stdin_stdout", "input": "81\n11 12 13 14 15 16 17 18 19 21 22 23 24 25 26 27 28 29 31 32 33 34 35 36 37 38 39 41 42 43 44 45 46 47 48 49 51 52 53 54 55 56 57 58 59 61 62 63 64 65 66 67 68 69 71 72 73 74 75 76 77 78 79 81 82 83 84 85 86 87 88 89 91 92 93 94 95 96 97 98 99\n", "output": "1\n11 "}, {"type": "st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is on constraints. In this version constraints are lower. You can make hacks only if all versions of the problem are solved.\n\nKoa the Koala is at the beach!\n\nThe beac...
[{"type": "stdin_stdout", "input": "32\n3 1 3\n2 2 1\n3 1 3\n2 2 2\n3 1 3\n2 2 3\n3 1 3\n2 3 1\n3 1 3\n2 3 2\n3 1 3\n2 3 3\n3 1 3\n3 1 1\n3 1 3\n3 1 2\n3 1 3\n3 1 3\n3 1 3\n3 2 1\n3 1 3\n3 2 2\n3 1 3\n3 2 3\n3 1 3\n3 3 1\n3 1 3\n3 3 2\n3 1 3\n3 3 3\n3 2 1\n1 1 1\n3 2 1\n1 1 2\n3 2 1\n1 1 3\n3 2 1\n1 2 1\n3 2 1\n1 2 2\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nXXI Berland Annual Fair is coming really soon! Traditionally fair consists of $n$ booths, arranged in a circle. The booths are numbered $1$ through $n$ clockwise with $n$ being adjacent to $1$. The $i$-th booths sells som...
[{"type": "stdin_stdout", "input": "78 74\n20194 1621 21498 13827 31277 19791 6583 13579 11160 20419 26490 160 3450 12925 9073 10381 27009 27968 10209 6478 18504 15371 32608 14197 12075 13723 12612 19020 28762 11057 12891 31164 16684 13717 19933 25453 2742 4955 6814 2863 10397 15461 20616 10905 2600 20137 4681 9199 270...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIlya is working for the company that constructs robots. Ilya writes programs for entertainment robots, and his current project is \"Bob\", a new-generation game robot. Ilya's boss wants to know his progress so far. Especi...
[{"type": "stdin_stdout", "input": "129341234876124184 1 2\n1 3 3\n1 1 2\n1 2 3\n3 1 1\n3 1 3\n3 2 3\n", "output": "64670617438062091 64670617438062093\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 2 1\n3 1 2\n2 3 3\n1 2 3\n2 2 3\n1 1 3\n2 3 2\n", "output": "1000000000000000000 0\n"}, {"type": "stdin_stdo...
code_stdio