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\nThere is a frog living in a big pond. He loves jumping between lotus leaves floating on the pond. Interestingly, these leaves have strange habits. First, a leaf will sink into the water after the frog jumps from it. Secon...
[{"type": "stdin_stdout", "input": "10 10\n.o....o...\no.oo......\n..oo..oo..\n..o.......\n..oo..oo..\n.o.o...o..\no..U.o....\noo......oo\noo........\noo..oo....", "output": "RDLLLURUUURDDLLUURRDDLULLDDRR\n"}, {"type": "stdin_stdout", "input": "10 10\n.o....o...\no.oo......\n..oo..oo..\n..o.......\n..oo..oo..\n..o...o....
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven any integer x, Aoki can do the operation below.\nOperation: Replace x with the absolute difference of x and K.\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki ...
[{"type": "stdin_stdout", "input": "999999482938498888 1000000000000000000\n", "output": "517061501112\n"}, {"type": "stdin_stdout", "input": "34439284758432890 4389039281938432\n", "output": "673029497074566\n"}, {"type": "stdin_stdout", "input": "542309233112233445 542309233112233445\n", "output": "0\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSince you are the best Wraith King, Nizhniy Magazin «Mir» at the centre of Vinnytsia is offering you a discount.\n\nYou are given an array a of length n and an integer c. \n\nThe value of some array b of length k is the s...
[{"type": "stdin_stdout", "input": "100 20\n9149 9142 7686 5769 1871 4565 5670 8587 663 637 3421 4267 6884 8142 7634 5748 936 316 9300 771 6906 9230 8994 9690 7155 9393 6274 3183 932 7460 1611 6122 4031 6922 5466 1499 5290 4907 4673 5665 9744 1602 9891 8260 6351 4640 9930 9756 5242 3752 82 3287 824 6897 5579 9095 883 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConsider a sequence of digits of length $2^k$ $[a_1, a_2, \\ldots, a_{2^k}]$. We perform the following operation with it: replace pairs $(a_{2i+1}, a_{2i+2})$ with $(a_{2i+1} + a_{2i+2})\\bmod 10$ for $0\\le i<2^{k-1}$. F...
[{"type": "stdin_stdout", "input": "20\n4 8 6 6 3 0 1 8 3 6 1 4 3 2 1 3 6 4 5 4\n15\n16 19\n3 10\n9 9\n3 18\n6 7\n15 18\n12 19\n17 18\n12 12\n6 9\n3 10\n1 2\n2 3\n4 19\n16 16\n", "output": "1\n3\n0\n5\n0\n1\n2\n1\n0\n1\n3\n1\n1\n5\n0\n"}, {"type": "stdin_stdout", "input": "20\n4 8 6 6 3 0 1 8 3 6 1 4 3 2 1 3 6 4 5 4\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.\n\nSerge...
[{"type": "stdin_stdout", "input": "aaaaaaaadbaaabbbbbddaaabdadbbbbbdbbabbbabaabdbbdababbbddddbdaabbddbbbbabbbbbabadaadabaaaadbbabbbaddb\naaaaaaaaaaaaaa\n61 91 5 43 53 81 7 96 6 9 34 78 79 12 8 63 22 76 18 46 41 56 3 20 57 21 75 73 100 94 35 69 32 4 70 95 88 44 68 10 71 98 23 89 36 62 28 51 24 30 74 55 27 80 38 48 93 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA permutation of N numbers from 1 to N A1, A2, ……, AN is given. You can perform the operation reverse (i, j) to reverse the order of the numbers in the interval [i, j] (1 ≤ i ≤ j ≤ N) for this permutation. For example, if...
[{"type": "stdin_stdout", "input": "10\n3 -1 5 1 7 4 14 6 17 13", "output": "9\n"}, {"type": "stdin_stdout", "input": "10\n3 -1 5 1 7 4 14 6 17 8", "output": "9\n"}, {"type": "stdin_stdout", "input": "10\n2 -1 5 1 7 4 14 6 17 8", "output": "9\n"}, {"type": "stdin_stdout", "input": "10\n2 -1 5 1 7 4 12 6 17 8", "output"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are many blue cards and red cards on the table. For each card, an integer number greater than 1 is printed on its face. The same number may be printed on several cards.\n\nA blue card and a red card can be paired wh...
[{"type": "stdin_stdout", "input": "4 3\n2 6 6 15\n2 3 5\n2 3\n4 9\n8 16 32\n4 2\n4 9 11 13\n2 7\n5 5\n2 3 5 1001 1001\n7 11 13 17 34\n10 10\n2 3 5 7 12 11 13 15 17 29\n3 11 1 22 18 22 26 30 34 38\n20 20\n314 144 903 63 137 609 44 626 75 473\n876 421 909 519 755 840 374 368 570 872\n363 650 155 265 64 26 426 391 15 421...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDuring her tantrums the princess usually smashes some collectable porcelain. Every furious shriek is accompanied with one item smashed.\n\nThe collection of porcelain is arranged neatly on n shelves. Within each shelf the...
[{"type": "stdin_stdout", "input": "1 68\n100 26 58 15 8 69 66 49 97 18 74 27 39 19 76 37 25 4 88 75 17 79 41 21 44 39 7 42 63 82 92 87 41 85 25 30 43 80 165 106 98 88 16 15 97 74 81 76 33 19 64 3 14 72 17 36 33 21 34 59 38 75 48 1 57 20 81 56 74 67 14 89 51 30 1 66 20 58 64 58 16 99 33 97 31 5 54 87 6 64 70 40 93 25 5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a integer $n$ ($n > 0$). Find any integer $s$ which satisfies these conditions, or report that there are no such numbers:\n\nIn the decimal representation of $s$: $s > 0$, $s$ consists of $n$ digits, no ...
[{"type": "stdin_stdout", "input": "4\n7648\n1421\n37753\n53050\n", "output": "2333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forward and ...
[{"type": "stdin_stdout", "input": "6\nK.......\n........\n.##..##.\n#..##..#\n........\n...##...\n.#....#.\n..####.K\n\n.......K\n........\n.##..##.\n#..##..#\n........\n...##...\n.#....#.\nK.####..\n\nK.......\n........\n.##..##.\n#..##..#\n........\n...##...\n.#....#.\nK.####..\n\n.......K\n........\n.##..##.\n#..##...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day, Ikta, an elementary school student, received a piece of paper with mathematical formulas from his grandfather. Apparently, the grandfather will give you as much money as the answer to the formula. Ikta has only l...
[{"type": "stdin_stdout", "input": "(198876743*1-210*4-89)", "output": "3533045339395\n"}, {"type": "stdin_stdout", "input": "(198876744*1-210*4-89)", "output": "3533045357160\n"}, {"type": "stdin_stdout", "input": "(198776744*1-210*4-89)", "output": "3531268857160\n"}, {"type": "stdin_stdout", "input": "(198777744*1-2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\n$ M $ students will be tested in a classroom with $ N $ seats in a straight line. Seats are numbered $ 1 \\ dots N $ from the front, and $ 1 $ per seat can seat $ 1 $ students.\n\nNow each student is sitting in...
[{"type": "stdin_stdout", "input": "2 0\n-1 -1 0 3", "output": "0\n"}, {"type": "stdin_stdout", "input": "3 0\n-1 2 -1 3", "output": "0\n"}, {"type": "stdin_stdout", "input": "11 2\n1 4 10 6", "output": "1\n"}, {"type": "stdin_stdout", "input": "10 2\n0 2 4 10", "output": "0\n"}, {"type": "stdin_stdout", "input": "3 0\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nACM countries have rivers that flow from east to west in the center. This river flows from the neighboring country in the west through the neighboring country in ACM to the neighboring country in the east, and the total l...
[{"type": "stdin_stdout", "input": "1 1 100\n50 200 20 40 0\n1\n2 4 101\n7 4 2 4 1\n19 5 1 4 0\n5\n3\n10\n1\n1 2 3\n2 1 1 1 0\n1\n3\n1 2 6\n5 16 1 1 1\n2\n3\n0 0 0", "output": "110.0000000000\n111.1500000000\n5.3333333333\n64.3333333333\n"}, {"type": "stdin_stdout", "input": "1 1 110\n50 200 20 40 0\n1\n2 4 101\n7 4 1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n6\n2\n3\n1\n1\n4\n2\n\n\nOutput\n\nYes\nYes\nYes\nNo\nYes\nNo\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 cod...
[{"type": "stdin_stdout", "input": "6\n2\n3\n2\n1\n11\n2", "output": "Yes\nYes\nYes\nNo\nYes\nYes\n"}, {"type": "stdin_stdout", "input": "6\n2\n10\n0\n4\n4\n1", "output": "Yes\nYes\nNo\nYes\nYes\nYes\n"}, {"type": "stdin_stdout", "input": "6\n6\n8\n1\n2\n5\n3", "output": "Yes\nYes\nYes\nYes\nYes\nYes\n"}, {"type": "std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA famous Berland's painter Kalevitch likes to shock the public. One of his last obsessions is chess. For more than a thousand years people have been playing this old game on uninteresting, monotonous boards. Kalevitch dec...
[{"type": "stdin_stdout", "input": "BBBBBBBB\nBBBBBBBB\nBBBBBBBB\nBBBBBBBB\nBBBBBBBB\nBBBBBBBB\nBBBBBBBB\nBWBBWBWB\n", "output": "12\n"}, {"type": "stdin_stdout", "input": "BWBBBWWB\nBWBBBWWB\nBBBBBBBB\nBBBBBBBB\nBWBBBWWB\nBBBBBBBB\nBBBBBBBB\nBBBBBBBB\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "BBBBBBBB\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIt's now the season of TAKOYAKI FESTIVAL!\nThis year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The deliciousness of the i-th takoyaki is d_i.\nAs is commonly known, when you eat two t...
[{"type": "stdin_stdout", "input": "50\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\n", "output": "12250000\n"}, {"type": "stdin_stdout", "input": "41\n49 91 82 7 7...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program s...
[{"type": "stdin_stdout", "input": "2\n2.926287414400688 0.6174638399148507 2.2117258079089996 2.51039017960215 2.2432914589132955 0.3458310450303873 3.950438914943076 1.6292131026754104\n5.957858300757107 3.314602021400227 10.473008708157936 7.081122407685485 15.460510197185764 6.858362845609268 7.533578119892425 12.1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Task\n Suppose there are `n` people standing in a circle and they are numbered 1 through n in order. \n \n Person 1 starts off with a sword and kills person 2. He then passes the sword to the next person still standing,...
[{"input": "15", "output": "[15]", "fn_name": "circle_slash"}, {"input": "31", "output": "[31]", "fn_name": "circle_slash"}, {"input": "11", "output": "[7]", "fn_name": "circle_slash"}, {"input": "16", "output": "[1]", "fn_name": "circle_slash"}, {"input": "5", "output": "[3]", "fn_name": "circle_slash"}, {"input": "1"...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nTo introduce the problem think to my neighbor who drives a tanker truck. \nThe level indicator is down and he is worried\nbecause he does not know if he will be able to make deliveries. \nWe put the truck on a horizontal ...
[{"input": "3\n10\n7853", "output": "[1981]", "fn_name": "tankvol"}, {"input": "4\n10\n7853", "output": "[2933]", "fn_name": "tankvol"}, {"input": "2\n10\n7853", "output": "[1118]", "fn_name": "tankvol"}, {"input": "5\n7\n3848", "output": "[2940]", "fn_name": "tankvol"}, {"input": "4\n9\n6361", "output": "[2731]", "fn_...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou're given a string of dominos. For each slot, there are 3 options:\n\n * \"|\" represents a standing domino\n\n * \"/\" represents a knocked over domino\n\n * \" \" represents a space where there is no domino\n\nFor...
[{"input": "\"||| ||||//| |/\"", "output": "[\"/// ||||//| |/\"]", "fn_name": "domino_reaction"}, {"input": "\"||||| |||\"", "output": "[\"///// |||\"]", "fn_name": "domino_reaction"}, {"input": "\"|||||/|||\"", "output": "[\"//////|||\"]", "fn_name": "domino_reaction"}, {"input": "\"|||||\"", "output": "[\"/////\"]", ...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N people numbered 1 to N. Each of them is either an honest person whose testimonies are always correct or an unkind person whose testimonies may be correct or not.\nPerson i gives A_i testimonies. The j-th testi...
[{"type": "stdin_stdout", "input": "15\n14\n2 1\n3 1\n4 1\n5 1\n6 1\n7 1\n8 1\n9 1\n10 1\n11 1\n12 1\n13 1\n14 1\n15 1\n14\n1 1\n3 1\n4 1\n5 1\n6 1\n7 1\n8 1\n9 1\n10 1\n11 1\n12 1\n13 1\n14 1\n15 1\n14\n1 1\n2 1\n4 1\n5 1\n6 1\n7 1\n8 1\n9 1\n10 1\n11 1\n12 1\n13 1\n14 1\n15 1\n14\n1 1\n2 1\n3 1\n5 1\n6 1\n7 1\n8 1\n9...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nLet $ f (x) $ be the sum of each digit when the non-negative integer $ x $ is expressed in binary.\nGiven a positive integer $ N $, output the largest of $ f (0) $, $ f (1) $, ..., $ f (N) $.\n\n\nExample of ca...
[{"type": "stdin_stdout", "input": "10830", "output": "13\n"}, {"type": "stdin_stdout", "input": "1663", "output": "10\n"}, {"type": "stdin_stdout", "input": "2604", "output": "11\n"}, {"type": "stdin_stdout", "input": "5020", "output": "12\n"}, {"type": "stdin_stdout", "input": "170", "output": "7\n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAll cities of Lineland are located on the Ox coordinate axis. Thus, each city is associated with its position x_{i} — a coordinate on the Ox axis. No two cities are located at a single point.\n\nLineland residents love to...
[{"type": "stdin_stdout", "input": "50\n-50000 -49459 -48875 -48456 -48411 -48096 -47901 -47500 -47150 -46808 -46687 -46679 -46337 -45747 -45604 -45194 -44752 -44242 -44231 -44122 -43636 -43274 -42916 -42881 -42386 -42095 -41830 -41618 -41145 -40897 -40534 -40007 -39761 -39389 -39104 -38909 -38630 -38561 -38364 -38255 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array of positive integers $a = [a_0, a_1, \\dots, a_{n - 1}]$ ($n \\ge 2$).\n\nIn one step, the array $a$ is replaced with another array of length $n$, in which each element is the greatest common diviso...
[{"type": "stdin_stdout", "input": "1\n97\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 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\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1\n97\n1 1 1 1 1 1 1 1 1 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a grid with H rows and W columns.\n\nThe square at the i-th row and j-th column contains a string S_{i,j} of length 5.\n\nThe rows are labeled with the numbers from 1 through H, and the columns are labeled with t...
[{"type": "stdin_stdout", "input": "15 10\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake sna...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn some other world, today is December D-th.\nWrite a program that prints Christmas if D = 25, Christmas Eve if D = 24, Christmas Eve Eve if D = 23 and Christmas Eve Eve Eve if D = 22.\n\n-----Constraints-----\n - 22 \\le...
[{"type": "stdin_stdout", "input": "-1279", "output": "Christmas Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian. \n\nYou are given two positive integers – A and B. You have to check whether A is divisible by all the prime divisors of B.\n\n------ Input ------ \n\nThe first l...
[{"type": "stdin_stdout", "input": "3\n120 75\n184 16\n16 18", "output": "Yes\nYes\nNo\n"}, {"type": "stdin_stdout", "input": "3\n120 75\n184 16\n16 36", "output": "Yes\nYes\nNo\n"}, {"type": "stdin_stdout", "input": "3\n120 75\n184 16\n0 11", "output": "Yes\nYes\nYes\n"}, {"type": "stdin_stdout", "input": "3\n120 75\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe brave Knight came to the King and asked permission to marry the princess. The King knew that the Knight was brave, but he also wanted to know if he was smart enough. So he asked him to solve the following task.\n\nThe...
[{"type": "stdin_stdout", "input": "15\n11 22 13 24 15 26 17 28 19 30 21 2 23 4 25 6 27 8 29 10 1 12 3 14 5 16 7 18 9 20\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "15\n11 22 13 24 15 26 17 28 19 30 21 2 23 4 25 6 27 8 29 10 1 12 3 14 5 16 7 18 9 20\n", "output": "10\n"}, {"type": "stdin_stdout", "input":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe are still with squared integers.\n\nGiven 4 integers `a, b, c, d` we form the sum of the squares of `a` and `b`\nand then the sum of the squares of `c` and `d`. We multiply the two sums hence a number `n` and we try to...
[{"input": "7\n96\n-1\n81", "output": "[[[471, 7783], [663, 7769]]]", "fn_name": "prod2sum"}, {"input": "-14\n12\n-10\n8", "output": "[[[8, 236], [44, 232]]]", "fn_name": "prod2sum"}, {"input": "10\n11\n12\n13", "output": "[[[2, 263], [23, 262]]]", "fn_name": "prod2sum"}, {"input": "1\n20\n-4\n-5", "output": "[[[75, 10...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a new attraction in Singapore Zoo: The Infinite Zoo.\n\nThe Infinite Zoo can be represented by a graph with an infinite number of vertices labeled $1,2,3,\\ldots$. There is a directed edge from vertex $u$ to vert...
[{"type": "stdin_stdout", "input": "5\n1 4\n3 12\n2 15\n6 6\n10 5\n", "output": "YES\nYES\nNO\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "5\n1 4\n3 6\n1 8\n10 3\n5 5\n", "output": "YES\nYES\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "5\n1 2\n3 12\n2 6\n3 4\n3 5\n", "output": "YES\nYES\nNO\nYES\nYES\n"}, ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nComplete the solution so that it strips all text that follows any of a set of comment markers passed in. Any whitespace at the end of the line should also be stripped out. \n\n**Example:**\n\nGiven an input string of:\n``...
[{"input": "\"apples, pears # and bananas\\ngrapes\\navocado @apples\"\n[\"@\", \"!\"]", "output": "[\"apples, pears # and bananas\\ngrapes\\navocado\"]", "fn_name": "solution"}, {"input": "\"apples, pears # and bananas\\ngrapes\\nbananas !apples\"\n[]", "output": "[\"apples, pears # and bananas\\ngrapes\\nbananas !app...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis is an interactive problem.\n\nIn the Wonderful Metropolis of the Future, there is no need in subway train drivers. Due to the technological progress, they were replaced by the Artificial Intelligence (AI). Unfortunat...
[{"type": "stdin_stdout", "input": "1 2\n\nseY\n\nNo\n\nYes\n\nYds\n", "output": "1 1\n1 1\n1 1\n"}, {"type": "stdin_stdout", "input": "10 2\n\nYes\n\nNo\n\nYes\n\nYes\n", "output": "2 2\n"}, {"type": "stdin_stdout", "input": "1 2\n\nYes\n\nNo\n\nYer\n\nYes\n", "output": "1 1\n"}, {"type": "stdin_stdout", "input": "1 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMost C/C++ programmers know about excellent opportunities that preprocessor #define directives give; but many know as well about the problems that can arise because of their careless use.\n\nIn this problem we consider th...
[{"type": "stdin_stdout", "input": "5\n#define iiXEqDYeyVmIYsOaO fj/x-9-6/x*x+ 1/ 7*2-x -x+9+235*23*Ww+x-2*K+2-x/70\n#define XVgLzhoTUxoBr ( x+x/x/x*6-x)* x+K/24206-2 /5/8-x-7/Ww/K-x+6 \n#define QdfRBaJk 470551685-( 54-x)-30\n#define gEJcAGnF x+x-x+(x/x+9)/x-41-1/fj/1157561+x/x -x/26/x+K*x\n#define lO 7-1*(x*58 )-K*fj...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFind the length between 2 co-ordinates. The co-ordinates are made of integers between -20 and 20 and will be given in the form of a 2D array:\n\n(0,0) and (5,-7) would be [ [ 0 , 0 ] , [ 5, -7 ] ]\n\nThe function must re...
[{"input": "[[0, 0], [10, 15]]", "output": "[\"18.03\"]", "fn_name": "length_of_line"}, {"input": "[[-3, 4], [10, 5]]", "output": "[\"13.04\"]", "fn_name": "length_of_line"}, {"input": "[[0, 0], [-5, -6]]", "output": "[\"7.81\"]", "fn_name": "length_of_line"}, {"input": "[[0, 0], [-7, 4]]", "output": "[\"8.06\"]", "fn_...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nA connected undirected graph is called a vertex cactus, if each vertex of this graph belongs to at most one simple cycle.\n\nA simple cycle in a undirected graph is a sequence of distinct vertices v1, v2, ..., vt (t > 2),...
[{"type": "stdin_stdout", "input": "40 43\n1 2\n1 3\n1 4\n4 5\n5 6\n1 7\n5 8\n7 9\n2 10\n10 11\n11 12\n2 13\n13 14\n14 15\n15 16\n16 17\n17 18\n18 19\n19 20\n20 21\n21 22\n22 23\n23 24\n24 25\n25 2\n3 26\n26 27\n27 28\n28 29\n29 30\n30 31\n31 32\n32 3\n4 33\n33 34\n34 35\n35 36\n36 37\n37 4\n5 38\n38 39\n39 40\n40 5\n2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n points marked on the plane. The points are situated in such a way that they form a regular polygon (marked points are its vertices, and they are numbered in counter-clockwise order). You can draw n - 1 segment...
[{"type": "stdin_stdout", "input": "10\n0 1 1 0 -1 -2 1 0 0 0\n1 0 0 0 1 0 0 0 0 0\n0 0 1 2 1 0 1 1 0 0\n0 0 1 0 0 0 0 -1 0 0\n-1 0 -1 0 0 0 0 0 1 0\n0 0 -1 0 0 1 -1 0 0 1\n2 0 0 0 0 0 1 0 0 2\n0 -1 0 0 0 0 0 0 0 0\n0 0 0 0 0 -1 0 0 0 0\n0 1 0 -2 0 0 -1 -1 0 0\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's define the permutation of length n as an array p = [p1, p2, ..., pn] consisting of n distinct integers from range from 1 to n. We say that this permutation maps value 1 into the value p1, value 2 into the value p2 a...
[{"type": "stdin_stdout", "input": "50 20365011074\n", "output": "2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 50 49\n"}, {"type": "stdin_stdout", "input": "50 5608642004\n", "output": "1 2 4 3 5 6 8 7 9 10 11 13 12 15 14 17 16 18...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCreate a function named `divisors`/`Divisors` that takes an integer `n > 1` and returns an array with all of the integer's divisors(except for 1 and the number itself), from smallest to largest. If the number is prime ret...
[{"input": "24", "output": "[[2, 3, 4, 6, 8, 12]]", "fn_name": "divisors"}, {"input": "13", "output": "[\"13 is prime\"]", "fn_name": "divisors"}, {"input": "29", "output": "[\"29 is prime\"]", "fn_name": "divisors"}, {"input": "3", "output": "[\"3 is prime\"]", "fn_name": "divisors"}, {"input": "253", "output": "[[11,...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\n```if-not:sql\nImplement a function that receives two IPv4 addresses, and returns the number of addresses between them (including the first one, excluding the last one).\n```\n\n```if:sql\nGiven a database of first and la...
[{"input": "\"180.0.0.0\"\n\"181.0.0.0\"", "output": "[16777216]", "fn_name": "ips_between"}, {"input": "\"10.11.12.13\"\n\"10.11.13.0\"", "output": "[243]", "fn_name": "ips_between"}, {"input": "\"170.0.0.0\"\n\"170.1.0.0\"", "output": "[65536]", "fn_name": "ips_between"}, {"input": "\"1.2.3.4\"\n\"5.6.7.8\"", "output...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis problem is same as the previous one, but has larger constraints.\n\nIt was a Sunday morning when the three friends Selena, Shiro and Katie decided to have a trip to the nearby power station (do not try this at home)....
[{"type": "stdin_stdout", "input": "25\n-10000 -10000\n-10000 -5000\n-10000 0\n-10000 5000\n-10000 10000\n-7452 -10000\n-5000 -5000\n-5000 0\n-5000 5000\n-5000 10000\n-1 -10000\n0 -5000\n0 0\n0 5000\n0 10000\n5000 -13650\n5000 -5000\n5000 0\n5000 5000\n5000 10000\n10000 -10000\n10000 -5000\n10000 0\n10000 5000\n10000 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is the length of the string. You can hack this problem if you solve it. But you can hack the previous problem only if you solve both problems.\n\nKirk has a binary string...
[{"type": "stdin_stdout", "input": "0111001100111011101000\n", "output": "0011001100001011101000\n"}, {"type": "stdin_stdout", "input": "0111001100111111101000\n", "output": "0011001100000011101000\n"}, {"type": "stdin_stdout", "input": "0111011100111111101000\n", "output": "0001001100000011101000\n"}, {"type": "stdin_...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConsider some set of distinct characters $A$ and some string $S$, consisting of exactly $n$ characters, where each character is present in $A$.\n\nYou are given an array of $m$ integers $b$ ($b_1 < b_2 < \\dots < b_m$). \...
[{"type": "stdin_stdout", "input": "1000000000 2 2\n1 500000000\n", "output": "933660593\n"}, {"type": "stdin_stdout", "input": "1000000000 2 2\n1 500000000\n", "output": "933660593\n"}, {"type": "stdin_stdout", "input": "1000000000 2 2\n2 500000000\n", "output": "811805447\n"}, {"type": "stdin_stdout", "input": "10000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n employees in Alternative Cake Manufacturing (ACM). They are now voting on some very important question and the leading world media are trying to predict the outcome of the vote.\n\nEach of the employees belong...
[{"type": "stdin_stdout", "input": "100\nRDRRDRDDDDRDRRDDRDRRDDRRDDRRRDRRRDDDRDDRDDRRDRDRRRDRDRRRDRRDDDRDDRRRDRDRRRDDRDRDDDDDDDRDRRDDDDDDRRDD\n", "output": "D\n"}, {"type": "stdin_stdout", "input": "100\nRRDRRDDDDDDDRDRRRDRDRDDDRDDDRDDRDRRDRRRDRRDRRRRRRRDRRRRRRDDDRRDDRRRDRRRDDRRDRRDDDDDRRDRDDRDDRRRDRRDD\n", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIahub is so happy about inventing bubble sort graphs that he's staying all day long at the office and writing permutations. Iahubina is angry that she is no more important for Iahub. When Iahub goes away, Iahubina comes t...
[{"type": "stdin_stdout", "input": "20\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1\n", "output": "927799753\n"}, {"type": "stdin_stdout", "input": "20\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1\n", "output": "927799753\n"}, {"type": "stdin_stdout", "input": "10\n4 10 -1 1 6 8 9 2 -1 -...
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 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",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEve is a beginner stand-up comedian. Her first show gathered a grand total of two spectators: Alice and Bob.\n\nEve prepared $a_1 + a_2 + a_3 + a_4$ jokes to tell, grouped by their type:\n\ntype 1: both Alice and Bob like...
[{"type": "stdin_stdout", "input": "15\n1 100000000 100000000 100000000\n1 100000000 100000000 100000000\n1 100000000 100000000 100000000\n1 100000000 100000000 100000000\n1 100000000 100000000 100000000\n1 100000000 100000000 100000000\n1 100000000 100000000 100000000\n1 100000000 100000000 100000000\n1 100000000 1000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.\n\nAt the start of the day they have x ice cream packs. Since the ice cream is free, pe...
[{"type": "stdin_stdout", "input": "6 1000000000\n+ 1000000000\n+ 1000000000\n+ 1000000000\n+ 1000000000\n+ 1000000000\n+ 1000000000\n", "output": "7000000000 0\n"}, {"type": "stdin_stdout", "input": "6 1000000000\n+ 1000000000\n+ 1000000000\n+ 1000000000\n+ 1000000000\n+ 1000000000\n+ 1000000000\n", "output": "7000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a$ of length $n$ consisting of integers. You can apply the following operation, consisting of several steps, on the array $a$ zero or more times:\n\nyou select two different numbers in the array $a...
[{"type": "stdin_stdout", "input": "5\n6\n1 6 1 1 4 4\n2\n1 2\n2\n1 1\n5\n4 5 4 5 4\n6\n2 3 2 1 3 1\n", "output": "\n0\n0\n2\n1\n0\n"}, {"type": "stdin_stdout", "input": "5\n6\n1 6 1 1 4 4\n2\n1 2\n2\n1 1\n5\n4 5 4 5 4\n6\n2 3 2 1 3 1\n", "output": "0\n0\n2\n1\n0\n"}, {"type": "stdin_stdout", "input": "5\n6\n2 6 1 1 4 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a set of points on a straight line. Each point has a color assigned to it. For point a, its neighbors are the points which don't have any other points between them and a. Each point has at most two neighbors...
[{"type": "stdin_stdout", "input": "aaaaaaaaabbbbbaaaabaaaaaaaaaaaaaaaaabaaaaaabbbbbbbaaabbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaa\n", "output": "12\n"}, {"type": "stdin_stdout", "input": "bbbbbbbbbbbbbbbbbbbbbbddddddddddddddddaaaaaaaaaaaaaccccccccbbbbbbbaaaaaaaaaabbbbbbbbaaaaaaaaaacccccc\n", "output": "11\n"}, {...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is a positive integer N.\nWe will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.\n - Operation: if K divides N, replace N with N/K; otherwise, r...
[{"type": "stdin_stdout", "input": "1000000000000\n", "output": "266\n"}, {"type": "stdin_stdout", "input": "523968956449\n", "output": "385\n"}, {"type": "stdin_stdout", "input": "145329450841\n", "output": "289\n"}, {"type": "stdin_stdout", "input": "642507465600\n", "output": "12\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDuring a New Year special offer the \"Sudislavl Bars\" offered n promo codes. Each promo code consists of exactly six digits and gives right to one free cocktail at the bar \"Mosquito Shelter\". Of course, all the promoco...
[{"type": "stdin_stdout", "input": "58\n145410\n686144\n766870\n859775\n922809\n470967\n034349\n318920\n019664\n667953\n295078\n908733\n691385\n774622\n325695\n443254\n817406\n984471\n512092\n635832\n303546\n189826\n128551\n720334\n569318\n377719\n281502\n956352\n758447\n207280\n583935\n246631\n160045\n452683\n594100\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor a given sequence $A = \\\\{a_0, a_1, ..., a_{n-1}\\\\}$ which is sorted by ascending order, find a specific value $k$ given as a query.\n\nConstraints\n\n* $1 \\leq n \\leq 100,000$\n* $1 \\leq q \\leq 200,000$\n* $0 ...
[{"type": "stdin_stdout", "input": "4\n-1 0 1 4\n3\n-3\n4\n14", "output": "0\n1\n0\n"}, {"type": "stdin_stdout", "input": "4\n-1 0 1 4\n3\n-2\n4\n14", "output": "0\n1\n0\n"}, {"type": "stdin_stdout", "input": "4\n-1 0 1 4\n3\n-4\n4\n14", "output": "0\n1\n0\n"}, {"type": "stdin_stdout", "input": "4\n-1 0 1 4\n3\n-4\n0\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSquirrel Liss is interested in sequences. She also has preferences of integers. She thinks n integers a1, a2, ..., an are good.\n\nNow she is interested in good sequences. A sequence x1, x2, ..., xk is called good if it s...
[{"type": "stdin_stdout", "input": "49\n10 34 58 72 126 166 176 180 198 200 208 228 238 248 302 332 340 344 350 354 380 406 418 428 438 442 482 532 536 544 546 554 596 626 642 682 684 704 714 792 804 820 862 880 906 946 954 966 970\n", "output": "49\n"}, {"type": "stdin_stdout", "input": "44\n1 5 37 97 107 147 185 187 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp knows that if the sum of the digits of a number is divisible by $3$, then the number itself is divisible by $3$. He assumes that the numbers, the sum of the digits of which is divisible by $4$, are also somewhat ...
[{"type": "stdin_stdout", "input": "1000\n", "output": "1003\n"}, {"type": "stdin_stdout", "input": "1000\n", "output": "1003\n"}, {"type": "stdin_stdout", "input": "997\n", "output": "1003\n"}, {"type": "stdin_stdout", "input": "999\n", "output": "1003\n"}, {"type": "stdin_stdout", "input": "997\n", "output": "1003\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \\dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a...
[{"type": "stdin_stdout", "input": "314159265358979323846264338327950288419716939937551058209749445923078164062862089986280348253421170\n", "output": "243\n"}, {"type": "stdin_stdout", "input": "476640020082194381531155118436783393866726953614433851622190777875571135215042541028243752681838573", "output": "259\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's denote a function $f(x)$ in such a way: we add $1$ to $x$, then, while there is at least one trailing zero in the resulting number, we remove that zero. For example, $f(599) = 6$: $599 + 1 = 600 \\rightarrow 60 \\...
[{"type": "stdin_stdout", "input": "1000000000\n", "output": "91\n"}, {"type": "stdin_stdout", "input": "1000000000\n", "output": "91\n"}, {"type": "stdin_stdout", "input": "1472811722\n", "output": "57\n"}, {"type": "stdin_stdout", "input": "1660033091\n", "output": "63\n"}, {"type": "stdin_stdout", "input": "11000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nImplement the function which should return `true` if given object is a vowel (meaning `a, e, i, o, u`), and `false` otherwise.\n\nWrite your solution by modifying this code:\n\n```python\ndef is_vowel(s):\n\t\n```\n\nYour...
[{"input": "\"lol\"", "output": "[false]", "fn_name": "is_vowel"}, {"input": "\"ou\"", "output": "[false]", "fn_name": "is_vowel"}, {"input": "\"z\"", "output": "[false]", "fn_name": "is_vowel"}, {"input": "\"\"", "output": "[false]", "fn_name": "is_vowel"}, {"input": "\"a\"", "output": "[true]", "fn_name": "is_vowel"}...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya's bicycle chain drive consists of two parts: n stars are attached to the pedal axle, m stars are attached to the rear wheel axle. The chain helps to rotate the rear wheel by transmitting the pedal rotation.\n\nWe kn...
[{"type": "stdin_stdout", "input": "50\n159 880 1070 1139 1358 1608 1691 1841 2073 2171 2213 2597 2692 2759 2879 2931 3173 3217 3441 4201 4878 5106 5129 5253 5395 5647 5968 6019 6130 6276 6286 6330 6409 6728 7488 7713 7765 7828 7899 8064 8264 8457 8483 8685 8900 8946 8965 9133 9187 9638\n45\n57 159 1070 1139 1391 1608 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConsider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th ch...
[{"type": "stdin_stdout", "input": "3\n100110\n2\n01\n1\n111\n1\n", "output": "011001\n10\n111\n"}, {"type": "stdin_stdout", "input": "3\n100110\n2\n01\n1\n101\n1\n", "output": "011001\n10\n010\n"}, {"type": "stdin_stdout", "input": "3\n100110\n2\n01\n0\n101\n1\n", "output": "011001\n01\n010\n"}, {"type": "stdin_stdout...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA number is called powerful if it is a power of two or a factorial. In other words, the number $m$ is powerful if there exists a non-negative integer $d$ such that $m=2^d$ or $m=d!$, where $d!=1\\cdot 2\\cdot \\ldots \\cd...
[{"type": "stdin_stdout", "input": "100\n101\n102\n103\n104\n105\n106\n107\n108\n109\n110\n111\n112\n113\n114\n115\n116\n117\n118\n119\n120\n121\n122\n123\n124\n125\n126\n127\n128\n129\n130\n131\n132\n133\n134\n135\n136\n137\n138\n139\n140\n141\n142\n143\n144\n145\n146\n147\n148\n149\n150\n151\n152\n153\n154\n155\n156\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTheatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of the city's anniversary, a decision was taken to pave the Square with square granite flagstones. Each fla...
[{"type": "stdin_stdout", "input": "1000000000 1000000000 1\n", "output": "1000000000000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 987654321 1\n", "output": "987654321000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 989104164 1\n", "output": "989104164000000000\n"}, {"type": "stdin_stdout", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou're given an array $b$ of length $n$. Let's define another array $a$, also of length $n$, for which $a_i = 2^{b_i}$ ($1 \\leq i \\leq n$). \n\nValerii says that every two non-intersecting subarrays of $a$ have differen...
[{"type": "stdin_stdout", "input": "2\n6\n4 3 0 1 2 0\n2\n2 5\n", "output": "YES\nNO\n"}, {"type": "stdin_stdout", "input": "2\n6\n0 3 0 1 2 0\n2\n2 5\n", "output": "YES\nNO\n"}, {"type": "stdin_stdout", "input": "2\n6\n4 3 0 1 2 0\n2\n4 5\n", "output": "YES\nNO\n"}, {"type": "stdin_stdout", "input": "2\n6\n4 3 0 1 2 0...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOn the Planet AtCoder, there are four types of bases: A, C, G and T. A bonds with T, and C bonds with G.\nYou are given a letter b as input, which is A, C, G or T. Write a program that prints the letter representing the b...
[{"type": "stdin_stdout", "input": "A\n", "output": "T\n"}, {"type": "stdin_stdout", "input": "G\n", "output": "C\n"}, {"type": "stdin_stdout", "input": "C\n", "output": "G\n"}, {"type": "stdin_stdout", "input": "T\n", "output": "A\n"}, {"type": "stdin_stdout", "input": "C", "output": "G\n"}, {"type": "stdin_stdout", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWhen Mr. Kay was browsing a certain SNS as usual, the problem that \"there are people who can solve IQ150 or more\" came to the timeline. Mr. Kay has an IQ of over 150, so he solved the problem in an instant without even ...
[{"type": "stdin_stdout", "input": "2286", "output": "3\n"}, {"type": "stdin_stdout", "input": "1020", "output": "2\n"}, {"type": "stdin_stdout", "input": "1809", "output": "1\n"}, {"type": "stdin_stdout", "input": "2465", "output": "0\n"}, {"type": "stdin_stdout", "input": "4598", "output": "2\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which prints $n$-th fibonacci number for a given integer $n$. The $n$-th fibonacci number is defined by the following recursive formula:\n\n\\begin{equation*} fib(n)= \\left \\\\{ \\begin{array}{ll} 1 & (n...
[{"type": "stdin_stdout", "input": "44", "output": "1134903170\n"}, {"type": "stdin_stdout", "input": "44", "output": "1134903170\n"}, {"type": "stdin_stdout", "input": "41", "output": "267914296\n"}, {"type": "stdin_stdout", "input": "42", "output": "433494437\n"}, {"type": "stdin_stdout", "input": "43", "output": "70...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEverlasting Sa-Ga, a new, hot and very popular role-playing game, is out on October 19, 2008. Fans have been looking forward to a new title of Everlasting Sa-Ga.\n\nLittle Jimmy is in trouble. He is a seven-year-old boy, ...
[{"type": "stdin_stdout", "input": "10 24\n30 20\n0 0", "output": "a\nb\n"}, {"type": "stdin_stdout", "input": "19 24\n30 20\n0 0", "output": "a\nb\n"}, {"type": "stdin_stdout", "input": "10 3\n11 106\n0 0", "output": "b\nb\n"}, {"type": "stdin_stdout", "input": "10 3\n11 150\n0 0", "output": "b\na\n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTanechka is shopping in the toy shop. There are exactly $n$ toys in the shop for sale, the cost of the $i$-th toy is $i$ burles. She wants to choose two toys in such a way that their total cost is $k$ burles. How many way...
[{"type": "stdin_stdout", "input": "100000000000000 100000000000000\n", "output": "49999999999999\n"}, {"type": "stdin_stdout", "input": "100000000000000 100000000000000\n", "output": "49999999999999\n"}, {"type": "stdin_stdout", "input": "100000000010000 100000000000000\n", "output": "49999999999999\n"}, {"type": "std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCaptain Flint and his crew keep heading to a savage shore of Byteland for several months already, drinking rum and telling stories. In such moments uncle Bogdan often remembers his nephew Denis. Today, he has told a story...
[{"type": "stdin_stdout", "input": "2\n11405\n58469\n", "output": "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMonocarp has forgotten the password to his mobile phone. The password consists of $4$ digits from $0$ to $9$ (note that it can start with the digit $0$).\n\nMonocarp remembers that his password had exactly two different d...
[{"type": "stdin_stdout", "input": "12\n8\n1 2 3 5 6 7 8 9\n6\n4 5 6 7 8 9\n7\n0 4 5 6 7 8 9\n7\n1 4 5 6 7 8 9\n8\n0 1 4 5 6 7 8 9\n7\n2 4 5 6 7 8 9\n8\n0 2 4 5 6 7 8 9\n8\n1 2 4 5 6 7 8 9\n7\n3 4 5 6 7 8 9\n8\n0 3 4 5 6 7 8 9\n8\n1 3 4 5 6 7 8 9\n8\n2 3 4 5 6 7 8 9\n", "output": "6\n36\n18\n18\n6\n18\n6\n6\n18\n6\n6\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Hedgehog recently remembered one of his favorite childhood activities, — solving puzzles, and got into it with new vigor. He would sit day in, day out with his friend buried into thousands of tiny pieces of the pictur...
[{"type": "stdin_stdout", "input": "20 20\nABBBAAABABAAAAABBABB\nBABABBAABAABBAAABABB\nBABBBAABAABBABBBBABA\nBAAABBAAABABBABBAAAA\nABBAABAABBBBAAABBBAA\nBAAAAAAAABABBAAAAABB\nAAAAAAABABBBBBAABAAB\nABBBBABAABBAAAAABAAA\nBAAAAABBABAAAAABAAAB\nABABAABABBBABBAABBAA\nBAAABBBAAAABBBBBABAA\nAAABBABABAABBABAABAB\nABBABABABABAA...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nThere are $ N $ propositions, named $ 1, 2, \\ cdots, N $, respectively. Also, $ M $ information about the propositions is given. The $ i $ th information is \"$ a_i $$\". Given in the form \"b_i $\", which mea...
[{"type": "stdin_stdout", "input": "211 0\n4 2\n0 3", "output": "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n43\n44\n45\n46\n47\n48\n49\n50\n51\n52\n53\n54\n55\n56\n57\n58\n59\n60\n61\n62\n63\n64\n65\n66\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nInternational Center for Picassonian Cubism is a Spanish national museum of cubist artworks, dedicated to Pablo Picasso. The center held a competition for an artwork that will be displayed in front of the facade of the mu...
[{"type": "stdin_stdout", "input": "5 5\n1 2 3 2 5\n1 2 1 4 5\n5 5\n2 3 3 1 3\n4 1 5 3 2\n5 5\n1 2 3 4 5\n3 3 1 4 5\n3 3\n7 7 7\n7 14 7\n3 3\n2 4 4\n4 3 4\n4 3\n4 0 2 5\n0 2 1\n4 4\n2 8 8 8\n2 3 8 3\n10 10\n9 9 9 9 17 9 9 17 9 9\n9 16 9 9 9 9 9 9 9 3\n10 9\n20 1 20 20 20 20 20 18 20 20\n20 20 20 20 7 17 20 20 4\n0 0", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nYamano Mifune Gakuen's 1st grade G group is a class where female students carrying misfortune gather. They face various challenges every day with the goal of being happy.\n\nIn their class, they can take practi...
[{"type": "stdin_stdout", "input": "5 10 5\n0 1 1 2\n0 2 1 2\n0 1 2 3\n1 2 0 2\n1 4 2 3\n2 1 1 1\n2 1 1 2\n3 3 2 3\n4 1 1 2\n4 2 1 2", "output": "13\n"}, {"type": "stdin_stdout", "input": "5 10 5\n0 1 1 2\n0 2 1 2\n0 1 2 3\n1 2 0 2\n1 4 2 3\n2 1 1 1\n2 1 1 2\n3 3 2 4\n4 1 1 2\n4 2 0 2", "output": "14\n"}, {"type": "std...
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": "7 1000000000\n1 10001 10011 20011 20021 40021 4003...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBackgorund\n\nThe super popular game \"Puzzle & Hexagons\" has finally been released. This game is so funny that many people are addicted to it. There were a number of people who were certified as addicted by doctors beca...
[{"type": "stdin_stdout", "input": "4 5\nBYYGG\nRRRRR\nRRBRR\nYYGGB\n2\n4 1\n3 1", "output": ".....\nBYYBG\n..G..\nYYGBG\n"}, {"type": "stdin_stdout", "input": "4 5\nBYYGG\nRRRRR\nRBRRR\nYYGGB\n2\n3 1\n3 1", "output": ".....\nBYY..\n.B...\nYYB..\n"}, {"type": "stdin_stdout", "input": "4 5\nBYYGG\nRRRRR\nRBRRR\nYYGGB\n2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou went to the store, selling $n$ types of chocolates. There are $a_i$ chocolates of type $i$ in stock.\n\nYou have unlimited amount of cash (so you are not restricted by any prices) and want to buy as many chocolates as...
[{"type": "stdin_stdout", "input": "19\n11 10 2 12 1 1 9 13 8 40 16 27 18 22 33 1 14 32 12\n", "output": "34\n"}, {"type": "stdin_stdout", "input": "19\n11 10 2 12 1 1 9 13 8 40 8 27 18 22 33 1 14 32 12\n", "output": "34\n"}, {"type": "stdin_stdout", "input": "19\n11 10 6 11 2 1 6 13 8 38 8 27 9 22 18 7 14 20 12\n", "o...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis is the easier version of the problem. In this version $1 \\le n, m \\le 100$. You can hack this problem only if you solve and lock both problems.\n\nYou are given a sequence of integers $a=[a_1,a_2,\\dots,a_n]$ of le...
[{"type": "stdin_stdout", "input": "5\n3 1 4 1 2\n15\n5 5\n5 4\n5 3\n5 2\n5 1\n4 4\n4 3\n4 2\n4 1\n3 3\n3 2\n3 1\n2 2\n2 1\n1 1\n", "output": "2\n1\n4\n1\n3\n2\n4\n1\n3\n2\n4\n3\n4\n3\n4\n"}, {"type": "stdin_stdout", "input": "5\n3 1 4 1 2\n15\n5 5\n5 4\n5 3\n5 2\n5 1\n4 4\n4 3\n4 2\n4 1\n3 3\n3 2\n3 1\n2 2\n2 1\n1 1\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day you wanted to read something, so you went to your bookshelf to grab some book. But when you saw how messy the bookshelf was you decided to clean it up first.\n\nThere are $n$ books standing in a row on the shelf, ...
[{"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 13 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\nEfim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he de...
[{"type": "stdin_stdout", "input": "320 142\n2704701300865535.432223312233434114130011113220102420131323010344144201124303144444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444447444444444444444444444444444444615444444482101673308979557675074444444444444446...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKISS stands for Keep It Simple Stupid.\nIt is a design principle for keeping things simple rather than complex.\n\nYou are the boss of Joe.\n\nJoe is submitting words to you to publish to a blog. He likes to complicate th...
[{"input": "\"Joe listened to the noises and there were some onamonapias\"", "output": "[\"Keep It Simple Stupid\"]", "fn_name": "is_kiss"}, {"input": "\"Joe listened to the noise and it was an onamonapia\"", "output": "[\"Good work Joe!\"]", "fn_name": "is_kiss"}, {"input": "\"Sometimes joe cries for hours\"", "output...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is an array with some numbers. All numbers are equal except for one. Try to find it!\n\n```python\nfind_uniq([ 1, 1, 1, 2, 1, 1 ]) == 2\nfind_uniq([ 0, 0, 0.55, 0, 0 ]) == 0.55\n```\n\nIt’s guaranteed that array con...
[{"input": "[4, 4, 4, 3, 4, 4, 4, 4]", "output": "[3]", "fn_name": "find_uniq"}, {"input": "[5, 5, 5, 5, 4, 5, 5, 5]", "output": "[4]", "fn_name": "find_uniq"}, {"input": "[6, 6, 6, 6, 6, 5, 6, 6]", "output": "[5]", "fn_name": "find_uniq"}, {"input": "[7, 7, 7, 7, 7, 7, 6, 7]", "output": "[6]", "fn_name": "find_uniq"},...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given $a$ uppercase Latin letters 'A' and $b$ letters 'B'.\n\nThe period of the string is the smallest such positive integer $k$ that $s_i = s_{i~mod~k}$ ($0$-indexed) for each $i$. Note that this implies that $k$...
[{"type": "stdin_stdout", "input": "1000000000 1000000000\n", "output": "1999936805\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000\n", "output": "1999936805\n"}, {"type": "stdin_stdout", "input": "1000000000 956817411\n", "output": "1956733985\n"}, {"type": "stdin_stdout", "input": "1000000000 839933539\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nJohnny has recently found an ancient, broken computer. The machine has only one register, which allows one to put in there one variable. Then in one operation, you can shift its bits left or right by at most three positio...
[{"type": "stdin_stdout", "input": "10\n10 5\n11 73\n17 21\n1 1\n96 3\n2 128\n0001 1100611139403776\n1000000000000000000 1000000001000000000\n7 1\n10 8\n", "output": "1\n-1\n-1\n0\n2\n2\n-1\n-1\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "10\n10 5\n11 73\n17 18\n1 1\n96 3\n2 128\n0001 1100611139403776\n1000000000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKirito is stuck on a level of the MMORPG he is playing now. To move on in the game, he's got to defeat all n dragons that live on this level. Kirito and the dragons have strength, which is represented by an integer. In th...
[{"type": "stdin_stdout", "input": "9983 34\n6626 5976\n4448 3568\n2794 2309\n3741 8806\n4754 129\n2780 9275\n5785 9243\n3915 6159\n2609 4331\n238 6756\n6987 3887\n3384 5711\n4349 5563\n1135 4483\n9151 1584\n1500 766\n1608 4440\n7768 5005\n7205 2360\n9088 2933\n3923 7814\n7538 9372\n7504 165\n5277 1636\n2061 4384\n7668...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a_1, a_2, \\dots, a_n$ consisting of $n$ distinct integers. Count the number of pairs of indices $(i, j)$ such that $i < j$ and $a_i \\cdot a_j = i + j$.\n\n\n-----Input-----\n\nThe first line cont...
[{"type": "stdin_stdout", "input": "3\n2\n3 1\n3\n3 1 5\n5\n3 1 4 10 2\n", "output": "1\n2\n3\n"}, {"type": "stdin_stdout", "input": "3\n2\n2 1\n3\n4 2 5\n5\n3 1 4 10 2\n", "output": "0\n0\n3\n"}, {"type": "stdin_stdout", "input": "3\n2\n3 2\n3\n3 1 5\n5\n3 1 4 10 2\n", "output": "0\n2\n3\n"}, {"type": "stdin_stdout", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOur bear's forest has a checkered field. The checkered field is an n × n table, the rows are numbered from 1 to n from top to bottom, the columns are numbered from 1 to n from left to right. Let's denote a cell of the fie...
[{"type": "stdin_stdout", "input": "1000000000 1000000000 1000000000 100 -100 1000000000000000000\n", "output": "969796608 969796608\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000 1000000001 100 -100 1000000000000000000\n", "output": "599261184 599261185\n"}, {"type": "stdin_stdout", "input": "1000000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Dormi received a histogram with $n$ bars of height $a_1, a_2, \\ldots, a_n$ for Christmas. However, the more he played with his new histogram, the more he realized its imperfections, so today he wanted to modify it...
[{"type": "stdin_stdout", "input": "2\n4\n0 16 14 1\n6\n2 1 14 4 0 0\n", "output": "30\n19\n"}, {"type": "stdin_stdout", "input": "2\n4\n0 16 17 1\n6\n2 1 14 4 0 0\n", "output": "33\n19\n"}, {"type": "stdin_stdout", "input": "2\n4\n13 8 15 13\n6\n2 1 7 8 1 0\n", "output": "33\n16\n"}, {"type": "stdin_stdout", "input": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA way to make a new task is to make it nondeterministic or probabilistic. For example, the hard task of Topcoder SRM 595, Constellation, is the probabilistic version of a convex hull.\n\nLet's try to make a new task. Firs...
[{"type": "stdin_stdout", "input": "6\nzfnkpxaavrcvqhhkclcuiswawpghlqrlq wnvbzhvsjozlkwxowcvyclmehjkkvkxin\nzkxkvlnovnloxjdydujkjydaegzjypsgrzq dmiilhmkspokltabpvwalijhlitbfp\nldfbfggqsdqethdgkmbcwloluguxiluqjyr fewoondewvndcxticvpiqnvvdhsnzfd\nepokfmixjnawdfgkmqlcyirxuprrvudh xvijbdzqdyjwsyhjucytuxrxuiynxf\nxntrjusjwb...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nI chose creature observation as the theme of my free study during the summer vacation and purchased a creature observation kit.\n\nThis creature prefers to live in a three-dimensional grid-like space. Only one ...
[{"type": "stdin_stdout", "input": "5\n00000\n01010\n00000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01110\n00000\n00100\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nwHAT DO WE NEED cAPS LOCK FOR?\n\nCaps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had...
[{"type": "stdin_stdout", "input": "cTKDZNWVYRTFPQLDAUUNSPKTDJTUPPFPRXRSINTVFVNNQNKXWUZUDHZBUSOKTABUEDQKUIVRTTVUREEOBJTSDKJKVEGFXVHXEYPE\n", "output": "Ctkdznwvyrtfpqldauunspktdjtuppfprxrsintvfvnnqnkxwuzudhzbusoktabuedqkuivrttvureeobjtsdkjkvegfxvhxeype\n"}, {"type": "stdin_stdout", "input": "KETAXTSWAAOBKUOKUQREHIOMVMM...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a function getMean that takes as parameters an array (arr) and 2 integers (x and y). The function should return the mean between the mean of the the first x elements of the array and the mean of the last y elements ...
[{"input": "[1, 3, 2, 4]\n2\n3", "output": "[2.5]", "fn_name": "get_mean"}, {"input": "[1, -1, 2, -1]\n2\n3", "output": "[0]", "fn_name": "get_mean"}, {"input": "[1, 3, 2, 4]\n1\n2", "output": "[-1]", "fn_name": "get_mean"}, {"input": "[1, 3, 2, 4]\n2\n8", "output": "[-1]", "fn_name": "get_mean"}, {"input": "[1, 3, 2]\...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi and Aoki will have a battle using their monsters.\nThe health and strength of Takahashi's monster are A and B, respectively, and those of Aoki's monster are C and D, respectively.\nThe two monsters will take tur...
[{"type": "stdin_stdout", "input": "100 1 100 1\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "85 7 30 19\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "85 7 23 19\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "38 11 7 79\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "45 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA stowaway and a controller play the following game. \n\nThe train is represented by n wagons which are numbered with positive integers from 1 to n from the head to the tail. The stowaway and the controller are initially ...
[{"type": "stdin_stdout", "input": "50 42 13\nto head\n00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001\n", "output": "Controller 61\n"}, {"type": "stdin_stdout", "inpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOur fruit guy has a bag of fruit (represented as an array of strings) where some fruits are rotten. He wants to replace all the rotten pieces of fruit with fresh ones. For example, given `[\"apple\",\"rottenBanana\",\"app...
[{"input": "[\"rottenApple\", \"rottenBanana\", \"rottenApple\", \"rottenPineapple\", \"rottenKiwi\"]", "output": "[[\"apple\", \"banana\", \"apple\", \"pineapple\", \"kiwi\"]]", "fn_name": "remove_rotten"}, {"input": "[\"apple\", \"rottenBanana\", \"rottenApple\", \"pineapple\", \"kiwi\"]", "output": "[[\"apple\", \"b...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nReverse and invert all integer values in a given list. \n\nPython:\n\n reverse_invert([1,12,'a',3.4,87,99.9,-42,50,5.6]) = [-1,-21,-78,24,-5]\n \nIgnore all other types than integer.\n\nWrite your solution by modify...
[{"input": "[1, 12, \"a\", 3.4, 87, 99.9, -42, 50, 5.6]", "output": "[[-1, -21, -78, 24, -5]]", "fn_name": "reverse_invert"}, {"input": "[1, 2, 3, 4, 5]", "output": "[[-1, -2, -3, -4, -5]]", "fn_name": "reverse_invert"}, {"input": "[-9, -18, 99]", "output": "[[9, 81, -99]]", "fn_name": "reverse_invert"}, {"input": "[-1...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nVolodya likes listening to heavy metal and (occasionally) reading. No wonder Volodya is especially interested in texts concerning his favourite music style.\n\nVolodya calls a string powerful if it starts with \"heavy\" a...
[{"type": "stdin_stdout", "input": "trueheavymetalissotruewellitisalsosoheavythatyoucanalmosteeeltheweightofmetalonyou\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "trueheavymetalissotrufwellitisalsosoheavythatyoucanalmosteeeltheweightofmetalonyou\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "uoyn...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Write Number in Expanded Form\n\nYou will be given a number and you will need to return it as a string in [Expanded Form](https://www.mathplacementreview.com/arithmetic/whole-numbers.php#expanded-form). For example:\n\n...
[{"input": "4982342", "output": "[\"4000000 + 900000 + 80000 + 2000 + 300 + 40 + 2\"]", "fn_name": "expanded_form"}, {"input": "70304", "output": "[\"70000 + 300 + 4\"]", "fn_name": "expanded_form"}, {"input": "12", "output": "[\"10 + 2\"]", "fn_name": "expanded_form"}, {"input": "42", "output": "[\"40 + 2\"]", "fn_nam...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn recent years John has very successfully settled at his new job at the office. But John doesn't like to idly sit around while his code is compiling, so he immediately found himself an interesting distraction. The point ...
[{"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000 1000000 1000000000000000000\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000 1000000 1000000000000000000\n", "outpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNow Serval is a junior high school student in Japari Middle School, and he is still thrilled on math as before. \n\nAs a talented boy in mathematics, he likes to play with numbers. This time, he wants to play with numbers...
[{"type": "stdin_stdout", "input": "100\n0 1 0 0 1 0 1 0 0 0 0 0 1 0 0 1 1 1 1 0 0 1 0 1 1 0 1 0 0 0 0 1 0 1 1 1 1 0 0 1 0 1 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 1 1 1 1 0 0 0 0 1 1 1 0 1 0 0 1 1 0 0 1 0 0 1 1 0 0 0 1 1 1 0 0 0 1\n1 2 3 4 2 6 5 5 4 8 10 8 1 14 5 16 3 11 13 11 12 8 11 22 8 17 19 5 15 27 14 13...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi is about to assemble a character figure, consisting of N parts called Part 1, Part 2, ..., Part N and N-1 connecting components. Parts are distinguishable, but connecting components are not.\nPart i has d_i hole...
[{"type": "stdin_stdout", "input": "44242\n1 2 1 1 3 2 2 1 1 2 1 1 3 3 2 1 3 3 1 1 2 4 2 1 3 3 1 2 1 4 2 1 4 1 1 3 1 1 1 2 3 1 3 1 1 3 2 2 2 1 2 2 2 2 3 1 3 2 2 2 2 2 2 1 4 3 1 2 1 2 2 1 2 5 1 1 3 5 2 2 1 3 6 2 1 2 1 1 3 1 1 1 1 4 1 2 2 1 1 1 2 1 2 3 1 4 1 1 1 2 2 3 1 1 1 2 3 1 1 4 1 1 2 2 2 4 2 3 1 1 2 3 2 2 2 2 2 2 1...
code_stdio