messages
listlengths
1
1
ground_truth
stringlengths
88
726k
dataset
stringclasses
1 value
[ { "content": "Solve the following coding problem using the programming language python:\n\nBuses run between the cities A and B, the first one is at 05:00 AM and the last one departs not later than at 11:59 PM. A bus from the city A departs every a minutes and arrives to the city B in a t_{a} minutes, and a bus...
[{"type": "stdin_stdout", "input": "60 120\n17 120\n23:00\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "60 120\n17 120\n23:00\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "60 120\n17 175\n23:00\n", "output": "14\n"}, {"type": "stdin_stdout", "input": "111 120\n24 100\n13:00\n", "output": "9\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim ...
[{"type": "stdin_stdout", "input": "98\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n702\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n-----Input-----\n\nThe input contains a single integer a (1 ≀ a ≀ 30).\n\n\n-----Output-----\n\nOutput a single integer.\n\n\n-----Example-----\nInput\n3\n\nOutput\n27\n\nThe input will be stdin and you should print your ...
[{"type": "stdin_stdout", "input": "011\n", "output": "274\n"}, {"type": "stdin_stdout", "input": "010\n", "output": "265\n"}, {"type": "stdin_stdout", "input": "10\n", "output": "265\n"}, {"type": "stdin_stdout", "input": "11\n", "output": "274\n"}, {"type": "stdin_stdout", "input": "12\n", "output": "319\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Little Elephant loves sortings.\n\nHe 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 ai. The Little Elephant can make one move to choose ...
[{"type": "stdin_stdout", "input": "47\n703599938 780784195 912005704 957182560 961181825 964876912 996677776 997012583 999004240 999888999 999980718 999997556 999997940 999999989 999999991 999999991 999999999 999999999 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn one little known, but very beautiful country called Waterland, lives a lovely shark Valerie. Like all the sharks, she has several rows of teeth, and feeds on crucians. One of Valerie's distinguishing features is that w...
[{"type": "stdin_stdout", "input": "54 22 1009\n15 7\n17 7\n11 9\n6 11\n12 9\n13 8\n13 12\n22 11\n20 9\n20 7\n16 11\n19 12\n3 12\n15 9\n1 12\n2 10\n16 10\n16 10\n14 10\n15 11\n11 9\n14 8\n10 10\n16 12\n1 8\n3 8\n21 11\n18 12\n2 6\n9 11\n11 7\n15 9\n20 11\n6 8\n8 8\n19 11\n15 7\n9 9\n22 3\n12 9\n17 9\n17 11\n12 7\n15 9\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor a given polygon g, computes the area of the polygon.\n\ng is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≀ i ≀ n-1) are sides of g. The line segment connecting pn a...
[{"type": "stdin_stdout", "input": "4\n-1 -2\n-1 0\n-1 14\n-5 2", "output": "32.0\n"}, {"type": "stdin_stdout", "input": "4\n-1 -2\n-1 0\n-1 17\n-5 2", "output": "38.0\n"}, {"type": "stdin_stdout", "input": "4\n0 -1\n10 -3\n71 0\n0 11", "output": "502.0\n"}, {"type": "stdin_stdout", "input": "4\n0 -4\n-1 0\n-1 14\n-6 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA decimal representation of an integer can be transformed to another integer by rearranging the order of digits. Let us make a sequence using this fact.\n\nA non-negative integer a0 and the number of digits L are given fi...
[{"type": "stdin_stdout", "input": "2012 8\n83268 3\n1112 9\n0 1\n20 2\n0 0", "output": "13 86526432 3\n5 74943 4\n5 954197541 14\n0 0 1\n2 63 5\n"}, {"type": "stdin_stdout", "input": "245 9\n83268 23\n821 3\n0 0\n99 1\n0 -1", "output": "3 863098632 14\n12 98765433331976666543211 5\n3 495 1\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA matrix of size $n \\times m$ is called nice, if all rows and columns of the matrix are palindromes. A sequence of integers $(a_1, a_2, \\dots , a_k)$ is a palindrome, if for any integer $i$ ($1 \\le i \\le k$) the equal...
[{"type": "stdin_stdout", "input": "9\n1 1\n132703760\n1 1\n33227322\n1 1\n943066084\n1 1\n729139464\n1 1\n450488051\n1 1\n206794512\n1 1\n372520051\n1 1\n552003271\n1 1\n319080560\n", "output": "0\n0\n0\n0\n0\n0\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "9\n1 1\n132703760\n1 1\n33227322\n1 1\n943066084\n1 1\n729...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRevised\n\nThe current era, Heisei, will end on April 30, 2019, and a new era will begin the next day. The day after the last day of Heisei will be May 1, the first year of the new era.\n\nIn the system developed by the A...
[{"type": "stdin_stdout", "input": "HEISEI 1 0 0\nHEISEI 31 4 2\nIETEIH 31 5 3\nIFISEH 142 12 42\nHEISEI 15 8 30\nIEJSEH 103 2 42\nHEISEI 3 3 14\nHEISEI 28 2 23\n#", "output": "HEISEI 1 0 0\nHEISEI 31 4 2\n? 1 5 3\n? 112 12 42\nHEISEI 15 8 30\n? 73 2 42\nHEISEI 3 3 14\nHEISEI 28 2 23\n"}, {"type": "stdin_stdout", "inpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHDD 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.\n\nOne of the problems of...
[{"type": "stdin_stdout", "input": "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 81 52 87 83 73 44 49 23 82 85 75 86 33 47 19 58 97 37 20 40 10 92 4 6 68 77 54 71 12 62 60 100 39 41 99 72 29 57 8...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp wants to buy exactly $n$ shovels. The shop sells packages with shovels. The store has $k$ types of packages: the package of the $i$-th type consists of exactly $i$ shovels ($1 \\le i \\le k$). The store has an in...
[{"type": "stdin_stdout", "input": "10\n208790602 104395300\n208790602 104395300\n208790602 104395300\n208790602 104395300\n208790602 104395300\n208790602 104395300\n208790602 104395300\n208790602 104395300\n208790602 104395300\n208790602 104395300\n", "output": "104395301\n104395301\n104395301\n104395301\n104395301\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSereja has two sequences a and b and number p. Sequence a consists of n integers a_1, a_2, ..., a_{n}. Similarly, sequence b consists of m integers b_1, b_2, ..., b_{m}. As usual, Sereja studies the sequences he has. Toda...
[{"type": "stdin_stdout", "input": "82 50 1\n4 2 2 4 4 3 2 2 3 3 4 3 4 1 4 1 4 3 5 3 4 2 4 4 5 2 5 4 2 4 2 5 3 2 3 4 2 5 4 3 3 4 3 4 1 1 5 2 4 1 3 3 2 4 1 2 2 5 4 4 5 3 3 1 2 3 4 5 3 1 2 3 3 5 5 2 4 1 4 2 3 1\n4 3 3 3 4 1 4 4 5 5 5 2 5 4 1 2 2 1 3 3 3 3 2 5 3 2 4 3 2 2 4 4 4 3 4 2 1 2 3 2 1 1 5 2 3 5 4 5 3 4\n", "outpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis is an easier version of the problem. In this version $n \\le 1000$\n\nThe outskirts of the capital are being actively built up in Berland. The company \"Kernel Panic\" manages the construction of a residential comple...
[{"type": "stdin_stdout", "input": "100\n82 51 81 14 37 17 78 92 64 15 8 86 89 8 87 77 66 10 15 12 100 25 92 47 21 78 20 63 22 49 41 36 41 79 16 87 87 69 3 76 80 60 100 49 70 59 72 8 38 71 45 97 71 14 76 54 81 4 59 46 39 29 92 3 49 22 53 99 59 52 74 31 92 43 42 23 44 9 82 47 7 40 12 9 3 55 37 85 46 22 84 52 98 41 21 77...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRaccoon is fighting with a monster.\nThe health of the monster is H.\nRaccoon can use N kinds of special moves. Using the i-th move decreases the monster's health by A_i.\nThere is no other way to decrease the monster's h...
[{"type": "stdin_stdout", "input": "210 5\n31 41 59 26 53\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "211 5\n31 41 59 26 53\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "210 3\n31 41 59 26 53", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "210 3\n31 55 59 26 53", "output": "Yes\n"}, ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor some time the program of rounding numbers that had been developed by the Codeforces participants during one of the previous rounds, helped the citizens of Far Far Away to convert numbers into a more easily readable fo...
[{"type": "stdin_stdout", "input": "2567340036354357844391998756110821468858185018763415770617907336824217629234299240638243305079104961\n", "output": "$2,567,340,036,354,357,844,391,998,756,110,821,468,858,185,018,763,415,770,617,907,336,824,217,629,234,299,240,638,243,305,079,104,961.00\n"}, {"type": "stdin_stdout", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConsider some square matrix A with side n consisting of zeros and ones. There are n rows numbered from 1 to n from top to bottom and n columns numbered from 1 to n from left to right in this matrix. We'll denote the eleme...
[{"type": "stdin_stdout", "input": "100\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "89\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "91\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "76\n", "output": "13\n"}, {"type": "stdin_stdout", "input": "80\n", "output": "13\n"}, {"type": "std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an undirected connected weighted graph with N vertices and M edges that contains neither self-loops nor double edges.\nThe i-th (1≀i≀M) edge connects vertex a_i and vertex b_i with a distance of c_i.\nHere, ...
[{"type": "stdin_stdout", "input": "7 1\n1 -1 0\n-1 4 1\n-1 0 4", "output": "0\n"}, {"type": "stdin_stdout", "input": "7 1\n1 -1 0\n-1 4 2\n-1 0 4", "output": "0\n"}, {"type": "stdin_stdout", "input": "7 1\n1 -2 0\n-1 4 2\n-1 0 4", "output": "0\n"}, {"type": "stdin_stdout", "input": "14 -1\n2 0 1\n0 3 1\n0 0 4", "outpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA sequence of brackets is called balanced if one can turn it into a valid math expression by adding characters '+' and '1'. For example, sequences '(())()', '()', and '(()(()))' are balanced, while ')(', '(()', and '(()))...
[{"type": "stdin_stdout", "input": "3\n6\n101101\n10\n1001011101\n4\n1001\n", "output": "YES\n((()))\n()()()\nYES\n(()((())))\n()(()())()\nYES\n(())\n()()\n"}, {"type": "stdin_stdout", "input": "3\n6\n101101\n10\n1011001101\n4\n1001\n", "output": "YES\n((()))\n()()()\nYES\n(((()())))\n()((()))()\nYES\n(())\n()()\n"}, {...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a$ consisting of $n$ integers numbered from $1$ to $n$.\n\nLet's define the $k$-amazing number of the array as the minimum number that occurs in all of the subsegments of the array having length $k...
[{"type": "stdin_stdout", "input": "3\n5\n1 2 3 4 5\n5\n4 4 4 4 2\n6\n1 3 1 5 3 1\n", "output": "-1 -1 3 2 1 \n-1 4 4 4 2 \n-1 -1 1 1 1 1 \n"}, {"type": "stdin_stdout", "input": "3\n5\n4 4 4 4 2\n5\n1 2 3 4 5\n6\n1 3 1 5 3 1\n", "output": "-1 4 4 4 2 \n-1 -1 3 2 1 \n-1 -1 1 1 1 1 \n"}, {"type": "stdin_stdout", "input":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have final scores of an examination for n students. Calculate standard deviation of the scores s1, s2 ... sn.\n\nThe variance Ξ±2 is defined by\n\nΞ±2 = (βˆ‘ni=1(si - m)2)/n\n\nwhere m is an average of si. The standard de...
[{"type": "stdin_stdout", "input": "5\n70 115 100 90 20\n3\n74 80 117\n0", "output": "32.9241552663\n19.0146142626\n"}, {"type": "stdin_stdout", "input": "5\n70 115 100 90 20\n3\n74 82 117\n0", "output": "32.9241552663\n18.6726180989\n"}, {"type": "stdin_stdout", "input": "5\n70 115 100 90 20\n3\n74 80 80\n0", "output"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nInstructors of Some Informatics School make students go to bed.\n\nThe house contains n rooms, in each room exactly b students were supposed to sleep. However, at the time of curfew it happened that many students are not ...
[{"type": "stdin_stdout", "input": "100 3 30\n20 10 8 3 97 20 40 4 58 24 105 56 26 21 66 1 126 4 21 46 8 2 9 21 0 13 24 53 58 23 3 107 1 22 189 3 31 4 31 0 3 0 9 43 19 74 92 7 71 22 46 26 31 49 18 3 10 9 9 110 30 2 40 21 33 4 11 14 47 4 1 37 3 19 18 63 10 53 19 35 11 57 8 3 11 27 23 5 45 15 127 27 23 48 3 8 20 33 5 28\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDr .: Peter, do you know \"Yes, I have a number\"?\n\nPeter: I used to do it on TV the other day. You remember something by the number of characters in each word contained in a sentence. \"Yes, I have a number\", so it me...
[{"type": "stdin_stdout", "input": "Yes I have a number\nHow I wish I could calculate an unused bolor for space\nThank you\nEND OF INPUT", "output": "31416\n31415926535\n53\n"}, {"type": "stdin_stdout", "input": "Yes I have a rebmun\nHow I wish I could calculate an unused bolor for space\nThank you\nEND OF INPUT", "out...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n3D Printing\n\nWe are designing an installation art piece consisting of a number of cubes with 3D printing technology for submitting one to Installation art Contest with Printed Cubes (ICPC). At this time, we are trying t...
[{"type": "stdin_stdout", "input": "1 1 100\n100 100 100\n6 4 10\n100 100 100\n106 102 102\n112 110 104\n104 116 102\n100 114 104\n92 107 100\n10 1 10\n-100 101 100\n-108 102 120\n-116 103 100\n-124 100 100\n-132 99 100\n-92 98 100\n-84 100 140\n-76 103 100\n-68 146 100\n-60 101 100\n10 4 10\n100 100 100\n108 101 100\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which converts uppercase/lowercase letters to lowercase/uppercase for a given string.\n\nConstraints\n\n* The length of the input string < 1200\n\nInput\n\nA string is given in a line.\n\nOutput\n\nPrint t...
[{"type": "stdin_stdout", "input": "f@IR, LATER, OCCASIONALLY CLOUDY.", "output": "F@ir, later, occasionally cloudy.\n"}, {"type": "stdin_stdout", "input": "f@IR, LATER, YLLANOISACCO CLOUDY.", "output": "F@ir, later, yllanoisacco cloudy.\n"}, {"type": "stdin_stdout", "input": "f@IR, LATER, OLLANOISACCY CLOUDY.", "outpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n201\n\n\nOutput\n\n701\n\nThe input will be stdin and you should print your solution to stdout\n\n\nNow solve the problem and return the code.\n\nWrite Python code to solve this problem. Your program s...
[{"type": "stdin_stdout", "input": "148", "output": "648\n"}, {"type": "stdin_stdout", "input": "106", "output": "605\n"}, {"type": "stdin_stdout", "input": "145", "output": "645\n"}, {"type": "stdin_stdout", "input": "225", "output": "725\n"}, {"type": "stdin_stdout", "input": "171", "output": "671\n"}, {"type": "stdi...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe brothers Hiroshi and Kenjiro came to Lake Inawashiro for fishing. The two decided to score as follows and compete with the total score of the fish they caught.\n\n* One char is a point\n* One yamame trout b points\n* ...
[{"type": "stdin_stdout", "input": "0 11\n10 0\n-1 1 41 0", "output": "kenjiro\n"}, {"type": "stdin_stdout", "input": "0 11\n10 0\n-1 2 41 0", "output": "kenjiro\n"}, {"type": "stdin_stdout", "input": "0 10\n10 0\n-1 2 41 0", "output": "kenjiro\n"}, {"type": "stdin_stdout", "input": "0 10\n10 1\n-1 2 41 0", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian \n\nChef is sitting in a very boring lecture, waiting for it to end. He has recently asked his friend about the time, and instead of the straightforward answer, h...
[{"type": "stdin_stdout", "input": "2\n11\n26", "output": "00:02\n11:58\n05:32\n06:28\n"}, {"type": "stdin_stdout", "input": "2\n4\n104", "output": "05:28\n06:32\n01:52\n10:08\n"}, {"type": "stdin_stdout", "input": "2\n1\n104", "output": "04:22\n07:38\n01:52\n10:08\n"}, {"type": "stdin_stdout", "input": "2\n1\n116", "o...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTokyo has a very complex railway system. For example, there exists a partial map of lines and stations as shown in Figure D-1.\n\n<image>\n\nFigure D-1: A sample railway network\n\n\nSuppose you are going to station D fro...
[{"type": "stdin_stdout", "input": "4 4 2 1 4\n1 2 2 1\n3 3 2 1\n3 1 5 1\n2 4 4 2\n3 1\n3 11\n10 5 3\n\n10\n2 0 1 1 2\n1\n\n1\n4 5 2 4 1\n4 3 10 1\n3 2 2 1\n3 4 1 2\n3 2 5 2\n2 1 10 1\n3 3\n20 30\n3 2 1\n5 10\n4 2 1\n5 5 2 1 5\n2 2 10 2\n1 3 20 2\n1 4 32 1\n3 4 10 1\n4 5 20 1\n2 2\n20\n10 1\n20\n3 1\n0 0 0 0 0", "outpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer $n$. Check if $n$ has an odd divisor, greater than one (does there exist such a number $x$ ($x > 1$) that $n$ is divisible by $x$ and $x$ is odd).\n\nFor example, if $n=6$, then there is $x=3$. If...
[{"type": "stdin_stdout", "input": "6\n3\n3\n4\n5\n998244353\n1368804034442\n", "output": "YES\nYES\nNO\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "6\n3\n3\n4\n5\n998244353\n1099511627776\n", "output": "YES\nYES\nNO\nYES\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "6\n3\n3\n4\n5\n998244353\n852815039649\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIlya is a very good-natured lion. He likes maths. Of all mathematical objects, his favourite one is matrices. Now he's faced a complicated matrix problem he needs to solve.\n\nHe's got a square 2^{n} Γ— 2^{n}-sized matrix ...
[{"type": "stdin_stdout", "input": "16\n978618343 473608041 799158564 800910753 461479363 520477481 780529176 678879534 118274424 720632652 1126830014 582019792 225578081 537373229 944668919 758615621\n", "output": "15485512030\n"}, {"type": "stdin_stdout", "input": "16\n978618343 473608041 799158564 800910753 46147936...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSpongebob is already tired trying to reason his weird actions and calculations, so he simply asked you to find all pairs of n and m, such that there are exactly x distinct squares in the table consisting of n rows and m c...
[{"type": "stdin_stdout", "input": "983282300\n", "output": "48\n 1 983282300\n 2 3277...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMike wants to prepare for IMO but he doesn't know geometry, so his teacher gave him an interesting geometry problem. Let's define f([l, r]) = r - l + 1 to be the number of integer points in the segment [l, r] with l ≀ r (...
[{"type": "stdin_stdout", "input": "9 6\n-44 -29\n-11 85\n11 84\n-63 1\n75 89\n-37 61\n14 73\n78 88\n-22 -18\n", "output": " 0\n"}, {"type": "stdin_stdout", "input": "2 2\n-93 -22\n12 72\n", "output": " ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSnuke has N sticks.\nThe length of the i-th stick is l_i.\nSnuke is making a snake toy by joining K of the sticks together.\nThe length of the toy is represented by the sum of the individual sticks that compose it.\nFind ...
[{"type": "stdin_stdout", "input": "15 14\n50 26 27 21 41 7 42 35 7 5 5 36 39 1 45\n", "output": "386\n"}, {"type": "stdin_stdout", "input": "15 14\n49 26 27 21 41 12 42 35 7 5 5 36 39 1 45", "output": "390\n"}, {"type": "stdin_stdout", "input": "15 14\n49 26 27 21 33 14 42 35 7 5 5 31 39 1 45", "output": "379\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou work as a system administrator in a dormitory, which has $n$ rooms one after another along a straight hallway. Rooms are numbered from $1$ to $n$.\n\nYou have to connect all $n$ rooms to the Internet.\n\nYou can conne...
[{"type": "stdin_stdout", "input": "200 10\n10000010101010110011110010100010010000001100101111011001010010001101001011111110011010111101000101011110101001001101101011010011100000100101000010110111000110000010101110110000110000100000101110111100\n", "output": "989\n"}, {"type": "stdin_stdout", "input": "200 10\n10000010...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi is standing on a multiplication table with infinitely many rows and columns.\nThe square (i,j) contains the integer i \\times j. Initially, Takahashi is standing at (1,1).\nIn one move, he can move from (i,j) to...
[{"type": "stdin_stdout", "input": "613921846801\n", "output": "613921846800\n"}, {"type": "stdin_stdout", "input": "550310490859\n", "output": "550310490858\n"}, {"type": "stdin_stdout", "input": "571704556531\n", "output": "571704556530\n"}, {"type": "stdin_stdout", "input": "472249589291\n", "output": "472249589290\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi wants to be a member of some web service.\nHe tried to register himself with the ID S, which turned out to be already used by another user.\nThus, he decides to register using a string obtained by appending one ...
[{"type": "stdin_stdout", "input": "aaaaaaaaaa\naaaaaaaaaaa\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "vgxgpuamkx\nvgxgpuamkxk\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "chokudai\nchokudaiz\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "vfjaqmop\nodotkrjzr\n", "output": "No\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a multiset S consisting of positive integers (initially empty). There are two kind of queries: Add a positive integer to S, the newly added integer is not less than any number in it. Find a subset s of th...
[{"type": "stdin_stdout", "input": "88\n1 1411\n2\n1 1783\n1 2132\n2\n2\n1 2799\n2\n2\n1 7856\n1 10551\n2\n2\n1 10868\n1 15159\n1 16497\n2\n1 20266\n2\n2\n2\n1 21665\n2\n2\n2\n2\n1 25670\n2\n2\n2\n1 26767\n1 31392\n2\n2\n2\n1 35319\n1 38575\n1 40111\n2\n1 41305\n1 49444\n1 53013\n2\n2\n1 53117\n2\n2\n1 55113\n2\n2\n2\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Petya likes points a lot. Recently his mom has presented him n points lying on the line OX. Now Petya is wondering in how many ways he can choose three distinct points so that the distance between the two farthest ...
[{"type": "stdin_stdout", "input": "100 100\n-98 -97 -96 -93 -92 -91 -90 -87 -86 -84 -81 -80 -79 -78 -76 -75 -73 -71 -69 -67 -65 -64 -63 -62 -61 -54 -51 -50 -49 -48 -46 -45 -44 -37 -36 -33 -30 -28 -27 -16 -15 -13 -12 -10 -9 -7 -6 -5 -4 2 3 5 8 9 10 11 13 14 15 16 17 19 22 24 25 26 27 28 30 31 32 36 40 43 45 46 47 50 51...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBear Limak prepares problems for a programming competition. Of course, it would be unprofessional to mention the sponsor name in the statement. Limak takes it seriously and he is going to change some words. To make it sti...
[{"type": "stdin_stdout", "input": "75\nVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK\n", "output": "1406\n"}, {"type": "stdin_stdout", "input": "75\nVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK\n", "output": "1406\n"}, {"type": "stdin_stdout", "input": "75\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have just been put in charge of developing a new shredder for the Shredding Company. Although a ``normal'' shredder would just shred sheets of paper into little pieces so that the contents would become unreadable, thi...
[{"type": "stdin_stdout", "input": "50 12346\n712 144139\n927438 667387\n23 3312\n9 3142\n25 1299\n101 63556\n103 862150\n6 1104\n0 0", "output": "43 1 2 34 6\n481 1 441 39\n667387 667387\n18 3 3 12\nerror\n21 1 2 9 9\n97 6 35 56\n103 86 2 15 0\nrejected\n"}, {"type": "stdin_stdout", "input": "50 12346\n712 144139\n158...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nInnopolis University scientists continue to investigate the periodic table. There are nΒ·m known elements and they form a periodic table: a rectangle with n rows and m columns. Each element can be described by its coordina...
[{"type": "stdin_stdout", "input": "20 20 80\n5 3\n13 13\n8 5\n2 9\n12 16\n1 11\n15 11\n3 20\n10 7\n5 4\n11 2\n5 20\n14 8\n5 1\n8 13\n11 5\n19 2\n15 12\n12 7\n16 5\n17 3\n12 2\n17 16\n12 3\n12 6\n18 20\n2 20\n9 1\n5 10\n9 18\n17 1\n17 10\n20 1\n12 12\n19 14\n7 8\n2 19\n6 14\n5 6\n15 2\n18 14\n5 7\n14 14\n17 2\n20 20\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya owns a cornfield which can be defined with two integers $n$ and $d$. The cornfield can be represented as rectangle with vertices having Cartesian coordinates $(0, d), (d, 0), (n, n - d)$ and $(n - d, n)$.\n\n [Image...
[{"type": "stdin_stdout", "input": "9 3\n100\n0 0\n0 1\n0 2\n0 3\n0 4\n0 5\n0 6\n0 7\n0 8\n0 9\n1 0\n1 1\n1 2\n1 3\n1 4\n1 5\n1 6\n1 7\n1 8\n1 9\n2 0\n2 1\n2 2\n2 3\n2 4\n2 5\n2 6\n2 7\n2 8\n2 9\n3 0\n3 1\n3 2\n3 3\n3 4\n3 5\n3 6\n3 7\n3 8\n3 9\n4 0\n4 1\n4 2\n4 3\n4 4\n4 5\n4 6\n4 7\n4 8\n4 9\n5 0\n5 1\n5 2\n5 3\n5 4\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N towns in a coordinate plane. Town i is located at coordinates (x_i, y_i). The distance between Town i and Town j is \\sqrt{\\left(x_i-x_j\\right)^2+\\left(y_i-y_j\\right)^2}.\nThere are N! possible paths to vi...
[{"type": "stdin_stdout", "input": "8\n898 1000\n85 1000\n980 1000\n359 1000\n-560 1000\n-764 1000\n-103 1000\n-116 1000\n", "output": "5277.7500000000\n"}, {"type": "stdin_stdout", "input": "8\n-1000 1000\n-1000 0\n-1000 -1000\n0 1000\n0 -1000\n1000 1000\n1000 0\n1000 -1000\n", "output": "12300.5630797458\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Little Elephant loves permutations of integers from 1 to n very much. But most of all he loves sorting them. To sort a permutation, the Little Elephant repeatedly swaps some elements. As a result, he must receive a pe...
[{"type": "stdin_stdout", "input": "125 8\n111 69 3 82 24 38 4 39 42 22 92 6 16 10 8 45 17 91 84 53 5 46 124 47 18 57 43 73 114 102 121 105 118 95 104 98 72 20 56 60 123 80 103 70 65 107 67 112 101 108 99 49 12 94 2 68 119 109 59 40 86 116 88 63 110 14 13 120 41 64 89 71 15 35 81 51 113 90 55 122 1 75 54 33 28 7 125 9 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPooja would like to withdraw X US from an ATM. The cash machine will only accept the transaction if X is a multiple of 5, and Pooja's account balance has enough cash to perform the withdrawal transaction (including bank c...
[{"type": "stdin_stdout", "input": "1013 120.00", "output": "120.00\n"}, {"type": "stdin_stdout", "input": "1676 120.00", "output": "120.00\n"}, {"type": "stdin_stdout", "input": "1038 120.00", "output": "120.00\n"}, {"type": "stdin_stdout", "input": "1022 120.00", "output": "120.00\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSince Sonya has just learned the basics of matrices, she decided to play with them a little bit.\n\nSonya imagined a new type of matrices that she called rhombic matrices. These matrices have exactly one zero, while all o...
[{"type": "stdin_stdout", "input": "20\n1 0 2 3 5 3 2 1 3 2 3 1 4 2 1 4 2 3 2 4\n", "output": "4 5\n2 2\n"}, {"type": "stdin_stdout", "input": "20\n1 0 2 3 5 3 2 1 3 2 3 1 4 2 1 4 2 3 2 4\n", "output": "4 5\n2 2\n"}, {"type": "stdin_stdout", "input": "18\n2 2 3 2 4 3 3 3 0 2 4 2 1 3 2 1 1 1\n", "output": "3 6\n2 3\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya has n days of vacations! So he decided to improve his IT skills and do sport. Vasya knows the following information about each of this n days: whether that gym opened and whether a contest was carried out in the Int...
[{"type": "stdin_stdout", "input": "100\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "100\n3 0 3 0 3 0 3 0...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSnuke prepared 6 problems for a upcoming programming contest. For each of those problems, Rng judged whether it can be used in the contest or not.\n\nYou are given a string S of length 6. If the i-th character of s is `1`...
[{"type": "stdin_stdout", "input": "001011", "output": "3\n"}, {"type": "stdin_stdout", "input": "100000", "output": "1\n"}, {"type": "stdin_stdout", "input": "011011", "output": "4\n"}, {"type": "stdin_stdout", "input": "100100", "output": "2\n"}, {"type": "stdin_stdout", "input": "111011", "output": "5\n"}, {"type": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou 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 t...
[{"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\nAllen wants to enter a fan zone that occupies a round square and has $n$ entrances.\n\nThere already is a queue of $a_i$ people in front of the $i$-th entrance. Each entrance allows one person from its queue to enter the ...
[{"type": "stdin_stdout", "input": "30\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 10000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's define a multiplication operation between a string $a$ and a positive integer $x$: $a \\cdot x$ is the string that is a result of writing $x$ copies of $a$ one after another. For example, \"abc\" $\\cdot~2~=$ \"abca...
[{"type": "stdin_stdout", "input": "13\na\na\na\na\na\na\na\na\na\na\na\na\nb\na\na\na\na\na\na\na\na\na\na\na\nb\na\n", "output": "a\na\na\na\na\na\n-1\na\na\na\na\na\n-1\n"}, {"type": "stdin_stdout", "input": "13\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\nb\na\n", "output": "a\na\na\na\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence $s$ consisting of $n$ digits from $1$ to $9$.\n\nYou have to divide it into at least two segments (segment β€” is a consecutive sequence of elements) (in other words, you have to place separators be...
[{"type": "stdin_stdout", "input": "21\n3\n123\n3\n123\n3\n123\n3\n123\n3\n123\n3\n213\n3\n123\n3\n123\n3\n123\n3\n321\n3\n123\n3\n321\n3\n132\n3\n322\n3\n321\n3\n341\n3\n123\n3\n421\n3\n421\n3\n421\n3\n421\n", "output": "YES\n2\n1 23\nYES\n2\n1 23\nYES\n2\n1 23\nYES\n2\n1 23\nYES\n2\n1 23\nYES\n2\n2 13\nYES\n2\n1 23\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIvan has an array consisting of n different integers. He decided to reorder all elements in increasing order. Ivan loves merge sort so he decided to represent his array with one or several increasing sequences which he th...
[{"type": "stdin_stdout", "input": "10\n71550121 446173607 640274071 402690754 802030518 598196518 796619138 96204862 983359971 799843967\n", "output": "71550121 446173607 640274071 802030518 983359971 \n402690754 598196518 796619138 799843967 \n96204862 \n"}, {"type": "stdin_stdout", "input": "10\n71550121 446173607 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDuring the last Sereja's Codesecrof round the server crashed many times, so the round was decided to be made unrated for some participants. \n\nLet's assume that n people took part in the contest. Let's assume that the pa...
[{"type": "stdin_stdout", "input": "10 0\n5 9 1 12 4 2 2 4 12 1\n", "output": "2\n3\n4\n5\n6\n7\n8\n9\n"}, {"type": "stdin_stdout", "input": "10 0\n5 16 1 7 4 2 2 5 18 3\n", "output": "2\n3\n4\n5\n6\n7\n8\n9\n"}, {"type": "stdin_stdout", "input": "10 0\n5 16 1 7 4 2 2 4 18 3\n", "output": "2\n3\n4\n5\n6\n7\n8\n9\n"}, {...
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\nConsider a billiard table of rectangular size $n \\times m$ with four pockets. Let's introduce a coordinate system with the origin at the lower left corner (see the picture). [Image] \n\nThere is one ball at the point $(...
[{"type": "stdin_stdout", "input": "1000000000 999999999 999999998 999999999 -1 -1\n", "output": "1000000000 999999999\n"}, {"type": "stdin_stdout", "input": "1000000000 999999999 999999998 999999999 -1 -1\n", "output": "1000000000 999999999"}, {"type": "stdin_stdout", "input": "1000000000 999999999 999999998 999999999...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nValera is a collector. Once he wanted to expand his collection with exactly one antique item.\n\nValera knows n sellers of antiques, the i-th of them auctioned k_{i} items. Currently the auction price of the j-th object o...
[{"type": "stdin_stdout", "input": "3 999999\n22 1000000 1000000 1250369 623205 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000100 1506663 1001000 1010000 999999 1000000 1000000 1010000 352800 999999 1000000\n14 999999 999999 1521826 1368902 999999 1000000 999999 1556972 999999 999999 418013 999999 1000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's introduce a number system which is based on a roman digits. There are digits I, V, X, L which correspond to the numbers 1, 5, 10 and 50 respectively. The use of other roman digits is not allowed.\n\nNumbers in this ...
[{"type": "stdin_stdout", "input": "1000000000\n", "output": "48999999753\n"}, {"type": "stdin_stdout", "input": "1000000100\n", "output": "49000004653\n"}, {"type": "stdin_stdout", "input": "1517731607\n", "output": "74368848496\n"}, {"type": "stdin_stdout", "input": "1000001100\n", "output": "49000053653\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA and B are preparing themselves for programming contests.\n\nB loves to debug his code. But before he runs the solution and starts debugging, he has to first compile the code.\n\nInitially, the compiler displayed n compi...
[{"type": "stdin_stdout", "input": "10\n460626451 802090732 277246428 661369649 388684428 784303821 376287098 656422756 9301599 25720377\n277246428 388684428 661369649 460626451 656422756 802090732 9301599 784303821 376287098\n376287098 802090732 388684428 9301599 656422756 784303821 460626451 277246428\n", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAt the first holiday in spring, the town Shortriver traditionally conducts a flower festival. Townsfolk wear traditional wreaths during these festivals. Each wreath contains exactly k flowers.\n\nThe work material for the...
[{"type": "stdin_stdout", "input": "100 15 6 10\n6 9 1 7 6 4 1 9 3 2 4 6 2 5 3 10 9 2 9 1 6 5 6 2 3 10 7 10 7 4 5 4 4 4 4 7 1 10 8 4 8 3 10 10 7 4 4 10 6 1 8 5 4 6 2 3 10 3 2 5 7 5 6 10 10 3 4 7 4 3 3 1 7 8 10 10 10 10 8 3 7 4 2 1 8 6 5 6 5 8 7 9 2 1 5 2 4 6 10 8\n6 9 7 8 7 1 4 3 5 8\n", "output": "2\n76 77 \n"}, {"typ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a square matrix of size n. Every row and every column of this matrix is a permutation of 1, 2, …, n. Let a_{i, j} be the element at the intersection of i-th row and j-th column for every 1 ≀ i, j ≀ n. Rows a...
[{"type": "stdin_stdout", "input": "5\n3 2\n1 2 3\n2 3 1\n3 1 2\nDR\n3 2\n1 2 3\n2 3 1\n3 1 2\nLU\n3 1\n1 2 3\n2 3 1\n3 1 2\nI\n3 1\n1 2 3\n2 3 1\n3 1 2\nC\n3 16\n1 2 3\n2 3 1\n3 1 2\nLDICRUCILDICRUCI\n", "output": "\n2 3 1 \n3 1 2 \n1 2 3 \n\n3 1 2 \n1 2 3 \n2 3 1 \n\n1 2 3 \n3 1 2 \n2 3 1 \n\n1 3 2 \n2 1 3 \n3 2 1 \n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNatasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on n - 2 intermediate planets. Formally: we number all the planets from 1 to n. 1 is Earth, n is Mars. Natasha will ...
[{"type": "stdin_stdout", "input": "90\n35\n1 68 16 30 24 1 1 1 35 1 1 67 1 1 1 1 33 16 37 77 83 1 77 26 1 1 68 67 70 62 1 47 1 1 1 84 1 65 1 32 83 1 1 1 28 1 71 76 84 1 1 5 1 74 10 1 1 1 38 87 13 1 7 66 81 49 1 9 1 11 1 25 1 1 1 1 7 1 1 36 61 47 51 1 1 69 40 1 37 1\n40 1 21 1 19 51 37 52 64 1 86 1 5 24 1 1 1 19 36 1 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp found a rectangular table consisting of $n$ rows and $m$ columns. He noticed that each cell of the table has its number, obtained by the following algorithm \"by columns\":\n\ncells are numbered starting from one...
[{"type": "stdin_stdout", "input": "5\n1 1 1\n2 2 3\n3 10 11\n100 100 7312\n1001000 1000010 1000000000000\n", "output": "1\n2\n14\n1174\n1000009998991\n"}, {"type": "stdin_stdout", "input": "5\n1 1 1\n2 2 2\n3 10 11\n100 100 7312\n1001000 1000010 1000000000000\n", "output": "1\n3\n14\n1174\n1000009998991\n"}, {"type": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nZiota found a video game called \"Monster Invaders\".\n\nSimilar to every other shooting RPG game, \"Monster Invaders\" involves killing monsters and bosses with guns.\n\nFor the sake of simplicity, we only consider two d...
[{"type": "stdin_stdout", "input": "100 5 5 9 3\n3 4 2 3 4 3 8 5 2 1 1 4 1 1 10 10 7 5 2 9 4 2 10 10 8 2 4 9 6 2 6 7 7 5 7 7 1 8 10 9 9 3 10 3 10 1 1 8 3 6 4 5 5 4 9 5 9 4 8 2 10 8 9 1 5 9 7 2 1 7 9 3 2 9 1 5 4 2 3 10 6 7 8 2 10 1 6 2 1 6 10 9 1 2 2 7 2 8 4 4\n", "output": "1597\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a bracket sequence $s$ consisting of $n$ opening '(' and closing ')' brackets.\n\nA regular bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting ch...
[{"type": "stdin_stdout", "input": "20\n(())(()((((()())()((\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "20\n(())(((((((()())()()\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "20\n(()())()((((()(())((\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "20\n(())((((()(((())()()\n", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs you might remember from the previous round, Vova is currently playing a strategic game known as Rage of Empires.\n\nVova managed to build a large army, but forgot about the main person in the army - the commander. So h...
[{"type": "stdin_stdout", "input": "5\n1 1\n1 4\n3 6 3\n1 4\n3 10 3\n", "output": "1\n0\n"}, {"type": "stdin_stdout", "input": "5\n1 3\n1 4\n3 11 3\n2 4\n3 6 2\n", "output": "0\n0\n"}, {"type": "stdin_stdout", "input": "5\n1 3\n1 4\n3 12 3\n1 4\n3 4 3\n", "output": "0\n2\n"}, {"type": "stdin_stdout", "input": "5\n1 3\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlice has a birthday today, so she invited home her best friend Bob. Now Bob needs to find a way to commute to the Alice's home.\n\nIn the city in which Alice and Bob live, the first metro line is being built. This metro ...
[{"type": "stdin_stdout", "input": "10 3\n0 1 1 0 1 0 0 2 -1 0\n1 4 1 2 -1 0 1 1 -1 1\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "10 10\n1 0 0 0 0 0 0 0 0 1\n0 0 0 0 0 0 0 0 0 0\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "10 10\n1 0 0 0 0 0 0 0 0 1\n0 0 0 0 0 0 0 0 0 0\n", "output": "YES\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Elephant loves magic squares very much.\n\nA magic square is a 3 Γ— 3 table, each cell contains some positive integer. At that the sums of integers in all rows, columns and diagonals of the table are equal. The figu...
[{"type": "stdin_stdout", "input": "0 100000 100000\n100000 0 100000\n100000 100000 0\n", "output": "100000 100000 100000\n100000 100000 100000\n100000 100000 100000\n"}, {"type": "stdin_stdout", "input": "0 100000 100000\n100000 0 100000\n100000 100000 0\n", "output": "100000 100000 100000\n100000 100000 100000\n10000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nThere are fine icicles under the eaves of JOI's house in Canada. Because of this, JOI decided to investigate the icicles.\n\nThere are N (2 ≀ N ≀ 100000 = 105) icicles under the eaves of JOI's house. These icic...
[{"type": "stdin_stdout", "input": "1 56\n4\n-1\n-1\n-1", "output": "52\n"}, {"type": "stdin_stdout", "input": "2 71\n14\n6\n0\n0", "output": "122\n"}, {"type": "stdin_stdout", "input": "2 30\n14\n6\n3\n0", "output": "40\n"}, {"type": "stdin_stdout", "input": "2 17\n2\n3\n3\n-1", "output": "29\n"}, {"type": "stdin_stdo...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nValery 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 ...
[{"type": "stdin_stdout", "input": "150\n0 -2 1 -2 0 0 0 0 -2 0 -2 -1 0 0 2 0 1 -2 1 -1 0 0 0 2 -2 2 -1 0 0 -1 -2 0 2 0 1 0 -2 0 -2 -1 0 -2 -2 2 0 0 1 -2 -2 -1 -2 0 2 1 1 -1 1 0 -2 2 0 0 0 1 -1 0 -2 -1 0 -2 1 1 1 0 0 2 0 0 2 -1 0 0 2 0 2 0 -2 -1 1 -2 1 0 0 -2 -1 -1 0 0 2 -1 -1 -1 -1 -2 0 0 2 -1 -1 1 0 0 1 -1 0 0 -1 2 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nJabber ID on the national Berland service Β«BabberΒ» has a form <username>@<hostname>[/resource], where \n\n * <username> β€” is a sequence of Latin letters (lowercase or uppercase), digits or underscores characters Β«_Β», the...
[{"type": "stdin_stdout", "input": "IGsma3L6YTJRrXS@1g.yR3mC.c.xoCns7Wo1.9C.Oe.5ebkR/_97Ltj3\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "IGsma3K6YTJRrXS@1g.yR3mC.c.xoCns7Wo1.9C.Oe.5ebkR/_97Ltj3\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "POTjlYcxAZsbyZPDh@sPm.z6aVaO.H1wEUhD9YvROQFUk/M_jTHS...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSnuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them:\n - Throw the die. The current score is the result of the die.\n - As lon...
[{"type": "stdin_stdout", "input": "10000 100000\n", "output": "0.036463721466\n"}, {"type": "stdin_stdout", "input": "3904 16384\n", "output": "0.081316166237\n"}, {"type": "stdin_stdout", "input": "100000 5\n", "output": "0.999973749998\n"}, {"type": "stdin_stdout", "input": "97392 33\n", "output": "0.999781007423\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOh, New Year. The time to gather all your friends and reflect on the heartwarming events of the past year...\n\n$n$ friends live in a city which can be represented as a number line. The $i$-th friend lives in a house with...
[{"type": "stdin_stdout", "input": "10\n10 7 10 10 7 10 7 7 10 10\n", "output": "2 6\n"}, {"type": "stdin_stdout", "input": "10\n10 7 10 10 7 10 7 7 10 10\n", "output": "2 6\n"}, {"type": "stdin_stdout", "input": "10\n10 7 10 10 7 10 7 5 10 10\n", "output": "2 7\n"}, {"type": "stdin_stdout", "input": "10\n1 2 3 4 5 6 7...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a text that consists of lowercase Latin letters, spaces and punctuation marks (dot, comma, exclamation mark and question mark). A word is defined as a sequence of consecutive Latin letters.\n\nYour task is t...
[{"type": "stdin_stdout", "input": "ajdwlf ibvlfqadt sqdn aoj nsjtivfrsp !mquqfgzrbp w ow aydap ry s . jwlvg ? ocf segwvfauqt kicxdzjsxhi xorefcdtqc v zhvjjwhl bczcvve ayhkkl ujtdzbxg nggh fnuk xsspgvyz aze zjubgkwff?hgj spteldqbdo vkxtgnl uxckibqs vpzeaq roj ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTraining is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well.\n\nToday's training is to develop physical strength and judgment by running on a straight...
[{"type": "stdin_stdout", "input": "3 1 1 2 3 110\n49\n50\n51", "output": "53.6666666667\n"}, {"type": "stdin_stdout", "input": "3 0 1 2 3 100\n49\n50\n74", "output": "48.8333333333\n"}, {"type": "stdin_stdout", "input": "3 1 2 2 3 100\n49\n50\n51", "output": "47.6666666667\n"}, {"type": "stdin_stdout", "input": "3 1 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are planning to buy an apartment in a $n$-floor building. The floors are numbered from $1$ to $n$ from the bottom to the top. At first for each floor you want to know the minimum total time to reach it from the first ...
[{"type": "stdin_stdout", "input": "10 2\n7 6 15 6 16 18 2 17 17\n12 11 3 10 9 1 10 1 5\n", "output": "0 7 13 18 24 35 36 38 41 46\n"}, {"type": "stdin_stdout", "input": "10 2\n7 6 18 6 16 18 1 17 17\n6 9 3 10 9 1 10 1 5\n", "output": "0 7 13 18 24 35 36 37 40 45 \n"}, {"type": "stdin_stdout", "input": "10 2\n7 6 18 6 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHow many ways are there to choose two distinct positive integers totaling N, disregarding the order?\n\nConstraints\n\n* 1 \\leq N \\leq 10^6\n* N is an integer.\n\nInput\n\nInput is given from Standard Input in the follo...
[{"type": "stdin_stdout", "input": "3256265", "output": "1628132\n"}, {"type": "stdin_stdout", "input": "1527191", "output": "763595\n"}, {"type": "stdin_stdout", "input": "1743342", "output": "871670\n"}, {"type": "stdin_stdout", "input": "1412384", "output": "706191\n"}, {"type": "stdin_stdout", "input": "1339977", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBerland is going through tough times β€” the dirt price has dropped and that is a blow to the country's economy. Everybody knows that Berland is the top world dirt exporter!\n\nThe President of Berland was forced to leave o...
[{"type": "stdin_stdout", "input": "100\n-683 303 245 -975 345 -159 529 -752 -349 -318 -275 -62 -449 -601 -687 691 491 -261 -576 425 -468 -235 446 536 143 152 -402 -491 363 -842 676 360 -461 -170 727 53 10 823 665 716 110 450 -154 -265 -926 636 -577 99 -719 -786 373 -286 994 -756 644 -800 220 -771 860 610 -613 -51 -398...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTwo 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 differen...
[{"type": "stdin_stdout", "input": "2 5\n", "output": "3 0 3\n"}, {"type": "stdin_stdout", "input": "2 4\n", "output": "2 1 3\n"}, {"type": "stdin_stdout", "input": "5 3\n", "output": "2 1 3\n"}, {"type": "stdin_stdout", "input": "1 6\n", "output": "3 0 3\n"}, {"type": "stdin_stdout", "input": "5 1\n", "output": "3 1 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn number world, two different numbers are friends if they have a lot in common, but also each one has unique perks.\n\nMore precisely, two different numbers $a$ and $b$ are friends if $gcd(a,b)$, $\\frac{a}{gcd(a,b)}$, $...
[{"type": "stdin_stdout", "input": "100\n42 486 341 527 189 740 490 388 989 489 711 174 305 844 971 492 998 954 832 442 424 619 906 154 293 395 439 735 738 915 453 748 786 550 871 932 693 326 53 904 732 835 354 364 691 669 203 719 282 875 573 672 695 640 58 872 732 751 557 779 102 39 213 844 289 137 50 951 284 671 474 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe best night ever in the world has come! It's 8 p.m. of December 24th, yes, the night of Cristmas Eve. Santa Clause comes to a silent city with ringing bells. Overtaking north wind, from a sleigh a reindeer pulls she sh...
[{"type": "stdin_stdout", "input": "3 2 1\n0 1 1\n1 2 3\n1\n4 5 2\n0 1 1\n0 2 1\n1 2 1\n1 3 1\n2 3 2\n1\n2\n0 -1 0", "output": "1.000000000\n\n1.000000000\n0.000000000\n\n"}, {"type": "stdin_stdout", "input": "3 2 1\n0 1 2\n1 2 3\n1\n4 5 2\n0 1 1\n0 2 1\n1 2 1\n1 3 1\n2 3 1\n1\n2\n0 0 1", "output": "1.000000000\n\n0.50...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese, Russian and Vietnamese as well. \n\nPhantasialand boasts of its famous theme park. The park is frequently visited. It is quite large park that some tourists visit it more than...
[{"type": "stdin_stdout", "input": "4\n1 -1 12 11", "output": "12\n"}, {"type": "stdin_stdout", "input": "4\n1 -2 12 11", "output": "11\n"}, {"type": "stdin_stdout", "input": "4\n-1 -1 0 36", "output": "17\n"}, {"type": "stdin_stdout", "input": "4\n-2 -2 0 36", "output": "16\n"}, {"type": "stdin_stdout", "input": "4\n-...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a$ consisting of $n$ integers.\n\nYour task is to say the number of such positive integers $x$ such that $x$ divides each number from the array. In other words, you have to find the number of commo...
[{"type": "stdin_stdout", "input": "6\n10000100623 10000100623 10000100623 10000100623 10000100623 10000100623\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "6\n10000100623 10000100623 10000100623 10000100623 10000100623 10000100623\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "5\n153965681607 9999...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCount the number of distinct sequences a_1, a_2, ..., a_{n} (1 ≀ a_{i}) consisting of positive integers such that gcd(a_1, a_2, ..., a_{n}) = x and $\\sum_{i = 1}^{n} a_{i} = y$. As this number could be large, print the a...
[{"type": "stdin_stdout", "input": "495219 444706662\n", "output": "115165527\n"}, {"type": "stdin_stdout", "input": "495219 444706662\n", "output": "115165527\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "9357 18255507\n", "output": "745979764\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a grid with N rows and N columns of squares. Let (i, j) be the square at the i-th row from the top and the j-th column from the left.\nEach of the central (N-2) \\times (N-2) squares in the grid has a black stone...
[{"type": "stdin_stdout", "input": "176527 15\n1 81279\n2 22308\n2 133061\n1 80744\n2 44603\n1 170938\n2 139754\n2 15220\n1 172794\n1 159290\n2 156968\n1 56426\n2 77429\n1 97459\n2 71282\n", "output": "31159505795\n"}, {"type": "stdin_stdout", "input": "176527 15\n2 81279\n2 22308\n2 145342\n1 106634\n2 60988\n1 170938...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is an apple tree that bears apples of N colors. The N colors of these apples are numbered 1 to N, and there are a_i apples of Color i.\n\nYou and Lunlun the dachshund alternately perform the following operation (sta...
[{"type": "stdin_stdout", "input": "3\n000000\n24912\n20652", "output": "second\n"}, {"type": "stdin_stdout", "input": "3\n100000\n30000\n29639", "output": "first\n"}, {"type": "stdin_stdout", "input": "3\n000000\n30000\n29639", "output": "first\n"}, {"type": "stdin_stdout", "input": "3\n000001\n30000\n29639", "output"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou will be given a contest schedule for D days and M queries of schedule modification. In the i-th query, given integers d_i and q_i, change the type of contest to be held on day d_i to q_i, and then output the final sat...
[{"type": "stdin_stdout", "input": "5\n86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThese days Arkady works as an air traffic controller at a large airport. He controls a runway which is usually used for landings only. Thus, he has a schedule of planes that are landing in the nearest future, each landing...
[{"type": "stdin_stdout", "input": "66 20\n0 16\n0 45\n0 58\n1 6\n1 19\n2 7\n2 9\n3 9\n3 25\n3 57\n4 38\n4 58\n5 21\n5 40\n6 16\n6 19\n6 58\n7 6\n7 26\n7 51\n8 13\n8 36\n8 55\n9 1\n9 15\n9 33\n10 12\n10 37\n11 15\n11 34\n12 8\n12 37\n12 55\n13 26\n14 0\n14 34\n14 36\n14 48\n15 23\n15 29\n15 43\n16 8\n16 41\n16 45\n17 5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor long time scientists study the behavior of sharks. Sharks, as many other species, alternate short movements in a certain location and long movements between locations.\n\nMax is a young biologist. For $n$ days he watc...
[{"type": "stdin_stdout", "input": "127\n64 96 63 112 62 95 61 120 60 94 59 111 58 93 57 124 56 92 55 110 54 91 53 119 52 90 51 109 50 89 49 126 48 88 47 108 46 87 45 118 44 86 43 107 42 85 41 123 40 84 39 106 38 83 37 117 36 82 35 105 34 81 33 127 32 80 31 104 30 79 29 116 28 78 27 103 26 77 25 122 24 76 23 102 22 75 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA linear congruential generator produces a series R(β‹…) of pseudo-random numbers by the following for- mulas:\n\n<image>\n\nwhere S, A, C, and M are all parameters. In this problem, 0 ≀ S, A, C ≀ 15 and M = 256.\n\nNow sup...
[{"type": "stdin_stdout", "input": "5\n0 1 3 11 0\n5\n-1 12 2 0 7\n10\n46 2 28 27 203 31 14 81 122 141\n0", "output": "9 15 10\n6 11 13\n6 13 6\n"}, {"type": "stdin_stdout", "input": "5\n10 4 3 3 1\n5\n7 12 2 0 7\n10\n372 8 42 18 176 40 12 56 169 141\n0", "output": "0 1 1\n6 11 13\n0 15 15\n"}, {"type": "stdin_stdout",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMany internet protocols these days include the option of associating a\nmedia type with the content being sent.\nThe type is usually inferred from the file extension.\nYou are to write a program that facilitates the looku...
[{"type": "stdin_stdout", "input": "3 7\nhtml lmth/txft\nlht text/itml\ngnp image/png\nsug lmx+gvt/ehami\ntxt text/plajn\nindex.html\nthis.file.has.lots.of.dots.txt\nnoaotsdsall\nvires.uxe\ndont.let.the.png.fool.you\ncXT.trettam.esaT", "output": "unknown\nunknown\nlmth/txft\nunknown\nunknown\nunknown\nunknown\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOur brave travelers reached an island where pirates had buried treasure. However as the ship was about to moor, the captain found out that some rat ate a piece of the treasure map.\n\nThe treasure map can be represented a...
[{"type": "stdin_stdout", "input": "20 20\n####################\n############.####.##\n#######..####..#####\n######............##\n######.....#...###.#\n#####E..........##.#\n#.##.#.........#####\n##NR....KO.....#####\n##B........#...#####\n#Y.W...H.......#####\n#####Z.....#...#####\n######...#.#...#####\n#A.......#.#....
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSince 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. \n\nThere are n parallel univers...
[{"type": "stdin_stdout", "input": "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\n2 -11 11\n2 59 -59\n2 -13 13\n2 -70 70\n2 -3 3\n2 -41 41\n2 -74 74\n2 47 -47\n2 87 -87\n2 17 -17\n2 20 -20\n2 -14 14\n2 -67 67\n2 -95 95\n2 -15 15...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMakoto has a big blackboard with a positive integer $n$ written on it. He will perform the following action exactly $k$ times:\n\nSuppose the number currently written on the blackboard is $v$. He will randomly pick one of...
[{"type": "stdin_stdout", "input": "1000000000000000 10000\n", "output": "215514159\n"}, {"type": "stdin_stdout", "input": "1000000000000000 10000\n", "output": "215514159\n"}, {"type": "stdin_stdout", "input": "1000000000001000 10000\n", "output": "150774797\n"}, {"type": "stdin_stdout", "input": "1172768550854780 899...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLife is not easy. Sometimes it is beyond your control. Now, as contestants of ACM ICPC, you might be just tasting the bitter of life. But don't worry! Do not look only on the dark side of life, but look also on the bright...
[{"type": "stdin_stdout", "input": "1\nnorth\n3\nnorth\neasu\nsouth\n0", "output": "5\n1\n"}, {"type": "stdin_stdout", "input": "1\nnorth\n0\nnorth\ntsae\nosuth\n-1", "output": "5\n"}, {"type": "stdin_stdout", "input": "1\nnorth\n0\nmorth\ntsae\nosuth\n-1", "output": "5\n"}, {"type": "stdin_stdout", "input": "1\nnorth\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNikolay has only recently started in competitive programming, but already qualified to the finals of one prestigious olympiad. There going to be $n$ participants, one of whom is Nikolay. Like any good olympiad, it consist...
[{"type": "stdin_stdout", "input": "25\n5 1 1\n5 2 3\n5 5 5\n5 5 1\n5 4 4\n10 1 2\n10 3 7\n10 10 10\n10 3 1\n10 7 6\n1000000 21232 1234\n999999 999999 999999\n1000000 300001 966605\n1000000 290001 679121\n500000 111099 123456\n100 1 1\n1000000000 1 1000000000\n1000000000 1 500000000\n100000000 1 12345678\n1000000000 1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem C: Earn Big\n\nA group of N people is trying to challenge the following game to earn big money.\n\nFirst, N participants are isolated from each other. From this point, they are not allowed to contact each other, o...
[{"type": "stdin_stdout", "input": "110 50", "output": "0.224802593637\n"}, {"type": "stdin_stdout", "input": "010 50", "output": "1.000000000000\n"}, {"type": "stdin_stdout", "input": "110 89", "output": "0.789224893493\n"}, {"type": "stdin_stdout", "input": "110 12", "output": "0.000000001745\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSince Grisha behaved well last year, at New Year's Eve he was visited by Ded Moroz who brought an enormous bag of gifts with him! The bag contains n sweet candies from the good ol' bakery, each labeled from 1 to n corresp...
[{"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000\n", "output": "1152921504606846975\n"}, {"type": "stdin_stdout", "input": "1100000000000000000 1000000000000000000\n", "output": "1152921504606846975\n"}, {"type": "stdin_stdout", "input": "1100000000010000000 1000000000000000000\n", "output": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M. In addition, each vertex has a label, `A` or `B`. The label of Vertex i is s_i. ...
[{"type": "stdin_stdout", "input": "13 23\nABAAAABBBBAAB\n7 1\n10 6\n1 11\n2 10\n2 8\n2 11\n11 12\n8 3\n7 11\n11 2\n13 13\n11 9\n4 1\n9 7\n9 6\n8 13\n8 6\n4 10\n8 7\n4 3\n2 1\n8 12\n6 9", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "13 23\nABAAAABBBBAAB\n7 1\n10 6\n1 11\n2 10\n2 8\n2 11\n11 12\n8 3\n7 12\n11 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAtCoDeer has three cards, one red, one green and one blue.\n\nAn integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card.\n\nWe will arrange the cards in ...
[{"type": "stdin_stdout", "input": "4 3 2\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "2 3 4\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "7 3 2", "output": "YES\n"}, {"type": "stdin_stdout", "input": "7 6 0", "output": "YES\n"}, {"type": "stdin_stdout", "input": "2 6 0", "output": "YES\n"}, {...
code_stdio