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\n# Right in the Center\n\n_This is inspired by one of Nick Parlante's exercises on the [CodingBat](https://codingbat.com/java) online code practice tool._\n\nGiven a sequence of characters, does `\"abc\"` appear in the CEN...
[{"input": "\"abcabcabcabc\"", "output": "[false]", "fn_name": "is_in_middle"}, {"input": "\"AAabcabcBB\"", "output": "[false]", "fn_name": "is_in_middle"}, {"input": "\"AAAAabcBB\"", "output": "[false]", "fn_name": "is_in_middle"}, {"input": "\"abcabcabc\"", "output": "[true]", "fn_name": "is_in_middle"}, {"input": "\...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nTwo chess pieces, a rook and a knight, stand on a standard chessboard 8 × 8 in size. The positions in which they are situated are known. It is guaranteed that none of them beats the other one.\n\nYour task is to find the ...
[{"type": "stdin_stdout", "input": "c1\nd2\n", "output": "42\n"}, {"type": "stdin_stdout", "input": "g1\ne6\n", "output": "39\n"}, {"type": "stdin_stdout", "input": "h8\ng2\n", "output": "43\n"}, {"type": "stdin_stdout", "input": "a8\nf1\n", "output": "42\n"}, {"type": "stdin_stdout", "input": "e4\nc1\n", "output": "37...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n1\n\n\nOutput\n\n)(\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 shou...
[{"type": "stdin_stdout", "input": "321", "output": ")))))))))))))))))))))())))((((((((((((((((((((((((\n"}, {"type": "stdin_stdout", "input": "222", "output": "))))))))))))()))))))))((((((((((((((((((((\n"}, {"type": "stdin_stdout", "input": "193", "output": ")))()))))))))))))))))(((((((((((((((((((\n"}, {"type": "std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAnd where the are the phone numbers?\n\nYou are given a string s consisting of lowercase English letters and an integer k. Find the lexicographically smallest string t of length k, such that its set of letters is a subset...
[{"type": "stdin_stdout", "input": "3 99948\nttt\n", "output": "tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have given an array $a$ of length $n$ and an integer $x$ to a brand new robot. What the robot does is the following: it iterates over the elements of the array, let the current element be $q$. If $q$ is divisible by $...
[{"type": "stdin_stdout", "input": "1\n20 9\n288 279 252 279 288 207 261 270 297 288 276 265 209 217 214 300 227 221 215 271\n", "output": "7833\n"}, {"type": "stdin_stdout", "input": "1\n20 9\n288 279 252 279 288 207 261 270 297 288 276 265 209 217 214 300 227 221 215 271\n", "output": "7833\n"}, {"type": "stdin_stdou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIkshu's love for binary numbers\n\nIkshu recently learnt to generate random numbers. He is generating stream binary numbers. Uptil now he has generated N bits of the binary number. Now, he wants to know if there is a stre...
[{"type": "stdin_stdout", "input": "32 7\n", "output": "288230376151711743/288230376151711744\n"}, {"type": "stdin_stdout", "input": "27 10\n", "output": "1541494189855/140737488355328\n"}, {"type": "stdin_stdout", "input": "54 11\n", "output": "37241906121/1099511627776\n"}, {"type": "stdin_stdout", "input": "5 3\n", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which performs the following operations to a binary search tree $T$ by adding delete operation to B: Binary Search Tree II.\n\n* insert $k$: Insert a node containing $k$ as key into $T$.\n* find $k$: Repo...
[{"type": "stdin_stdout", "input": "18\ninsert 13\ninsert 2\ninsert 3\ninsert 7\ninsert 22\ninsert 1\nfind 1\nfind 2\nfind 3\nfind 13\nfind 5\nfind 6\nfind 4\nfind 7\nprint\ndelete 3\ndelete 7\nprint", "output": "yes\nyes\nyes\nyes\nno\nno\nno\nyes\n 1 2 3 7 13 22\n 13 2 1 3 7 22\n 1 2 13 22\n 13 2 1 22\n"}, {"type": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAt the school where Vasya is studying, preparations are underway for the graduation ceremony. One of the planned performances is a ball, which will be attended by pairs of boys and girls.\n\nEach class must present two co...
[{"type": "stdin_stdout", "input": "3\n12 6 4\n2 1 2 4\n1 1 2 3\n2 1 1\n1\n1\n3 15 4\n1 1 2 2\n1 2 1 2\n", "output": "4\n0\n2\n"}, {"type": "stdin_stdout", "input": "3\n12 6 4\n2 1 2 4\n1 1 3 3\n2 1 1\n1\n1\n3 15 4\n1 1 2 2\n1 2 1 2\n", "output": "3\n0\n2\n"}, {"type": "stdin_stdout", "input": "3\n12 6 4\n2 1 2 7\n1 1 ...
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\nIn one move, you can choose two indices $1 \\le i, j \\le n$ such that $i \\ne j$ and set $a_i := a_j$. You can perform such moves any number of times (possibly, z...
[{"type": "stdin_stdout", "input": "5\n2\n0 3\n4\n2 0 13 1\n3\n3 3 3\n4\n5 10 5 4\n4\n2 1 1 2\n", "output": "YES\nYES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "5\n2\n0 3\n4\n2 0 25 1\n3\n3 3 3\n4\n5 10 5 4\n4\n2 1 1 2\n", "output": "YES\nYES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "5\n2\n0 3\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNiwango-kun, an employee of Dwango Co., Ltd., likes Niconico TV-chan, so he collected a lot of soft toys of her and spread them on the floor.\n\nNiwango-kun has N black rare soft toys of Niconico TV-chan and they are spre...
[{"type": "stdin_stdout", "input": "17 2\n0 5\n2 3\n1 0\n1 2\n3 1\n3 1\n3 5\n5 1\n5 4\n7 4\n8 4\n6 1\n1 2\n6 1\n8 1\n11 0\n11 0\n11 -1\n7 0", "output": "5\n"}, {"type": "stdin_stdout", "input": "17 3\n0 5\n2 3\n1 0\n1 2\n3 1\n3 1\n3 5\n5 1\n5 4\n7 4\n8 4\n6 1\n1 2\n6 1\n8 1\n11 1\n11 0\n11 -1\n7 1", "output": "6\n"}, {...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nComplete the function, which calculates how much you need to tip based on the total amount of the bill and the service. \n\nYou need to consider the following ratings:\n\n- Terrible: tip 0%\n- Poor: tip 5%\n- Good: tip 10...
[{"input": "20\n\"great!\"", "output": "[\"Rating not recognised\"]", "fn_name": "calculate_tip"}, {"input": "20\n\"hi\"", "output": "[\"Rating not recognised\"]", "fn_name": "calculate_tip"}, {"input": "107.65\n\"GReat\"", "output": "[17]", "fn_name": "calculate_tip"}, {"input": "20\n\"Excellent\"", "output": "[4]", "...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's introduce the designation <image>, where x is a string, n is a positive integer and operation \" + \" is the string concatenation operation. For example, [abc, 2] = abcabc.\n\nWe'll say that string s can be obtained...
[{"type": "stdin_stdout", "input": "10000000 1\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n", "output": "10000000\n"}, {"type": "stdin_stdout", "input": "10000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet a and b be some non-negative integers. Let's define strange addition of a and b as following:\n\n 1. write down the numbers one under another and align them by their least significant digit; \n 2. add them up digit ...
[{"type": "stdin_stdout", "input": "2 3\n14\n2 4\n2 1\n1 1\n", "output": "15\n12\n12\n"}, {"type": "stdin_stdout", "input": "2 3\n14\n2 4\n2 1\n2 0\n", "output": "15\n12\n11\n"}, {"type": "stdin_stdout", "input": "2 3\n11\n2 8\n2 2\n2 0\n", "output": "19\n13\n11\n"}, {"type": "stdin_stdout", "input": "2 3\n11\n2 8\n2 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven are three integers A_1, A_2, and A_3.\nIf A_1+A_2+A_3 is greater than or equal to 22, print bust; otherwise, print win.\n\n-----Constraints-----\n - 1 \\leq A_i \\leq 13 \\ \\ (i=1,2,3)\n - All values in input are i...
[{"type": "stdin_stdout", "input": "13 13 13\n", "output": "bust\n"}, {"type": "stdin_stdout", "input": "1 10 11\n", "output": "bust\n"}, {"type": "stdin_stdout", "input": "6 13 10\n", "output": "bust\n"}, {"type": "stdin_stdout", "input": "115 -5 1", "output": "bust\n"}, {"type": "stdin_stdout", "input": "-2 -10 -1", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given N points in the xy-plane. You have a circle of radius one and move it on the xy-plane, so as to enclose as many of the points as possible. Find how many points can be simultaneously enclosed at the maximum. ...
[{"type": "stdin_stdout", "input": "3\n6.834942604239939 7.69628\n6.04723928846506 4.859878448884584\n7.439438773048666 6.914350092484497\n6\n7.260024632937995 4.220572316804344\n7.2301779956102665 2.69466\n5.977411451010016 4.7893139817742\n5.771323891387089 5.033018424848772\n7.097650770216692 5.940611762552271\n8.51...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe process of mammoth's genome decoding in Berland comes to its end!\n\nOne of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English ...
[{"type": "stdin_stdout", "input": "252\n???????GCG??T??TT?????T?C???C?CCG???GA???????AC??A???AAC?C?CC??CCC??A??TA?CCC??T???C??CA???CA??G????C?C?C????C??C??A???C?T????C??ACGC??CC?A?????A??CC?C??C?CCG?C??C??A??CG?A?????A?CT???CC????CCC?CATC?G??????????A???????????????TCCCC?C?CA??AC??GC????????\n", "output": "AAAAAAAGCGA...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCompare two strings by comparing the sum of their values (ASCII character code).\n\n* For comparing treat all letters as UpperCase\n* `null/NULL/Nil/None` should be treated as empty strings\n* If the string contains other...
[{"input": "\"ZzZz\"\n\"ffPFF\"", "output": "[true]", "fn_name": "compare"}, {"input": "\"!!\"\n\"7476\"", "output": "[true]", "fn_name": "compare"}, {"input": "\"##\"\n\"1176\"", "output": "[true]", "fn_name": "compare"}, {"input": "\"AD\"\n\"DD\"", "output": "[false]", "fn_name": "compare"}, {"input": "\"Ad\"\n\"DD\"...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe consider a positive integer perfect, if and only if the sum of its digits is exactly $10$. Given a positive integer $k$, your task is to find the $k$-th smallest perfect positive integer.\n\n\n-----Input-----\n\nA sing...
[{"type": "stdin_stdout", "input": "10000\n", "output": "10800100\n"}, {"type": "stdin_stdout", "input": "9999\n", "output": "10800010\n"}, {"type": "stdin_stdout", "input": "9139\n", "output": "10134010\n"}, {"type": "stdin_stdout", "input": "9859\n", "output": "10422001\n"}, {"type": "stdin_stdout", "input": "8888\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPasha decided to invite his friends to a tea party. For that occasion, he has a large teapot with the capacity of w milliliters and 2n tea cups, each cup is for one of Pasha's friends. The i-th cup can hold at most a_{i} ...
[{"type": "stdin_stdout", "input": "4 1000000000\n1 1 1 1 2 2 2 2\n", "output": "12.0000000000\n"}, {"type": "stdin_stdout", "input": "4 1000000000\n1 1 1 1 1 1 1 1\n", "output": "6.0000000000\n"}, {"type": "stdin_stdout", "input": "5 15\n2 3 4 1 2 4 5 3 5 10\n", "output": "15.0000000000\n"}, {"type": "stdin_stdout", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConvenience store Deven Eleven is planning to open its first store in Aizuwakamatsu City to expand its business. There are already many other convenience stores in Aizuwakamatsu, so the place to open a new store is likely...
[{"type": "stdin_stdout", "input": "10 12\n6\n2 1\n6 1\n6 2\n1 5\n0 6\n5 6\n2\n1 3\n5 3\n11 6\n6\n3 3\n3 4\n6 1\n1 1\n1 6\n5 6\n2\n0 3\n6 4\n0 0", "output": "6\n18\n"}, {"type": "stdin_stdout", "input": "10 12\n6\n1 1\n6 1\n6 2\n1 5\n0 6\n5 6\n2\n1 3\n5 3\n11 6\n6\n3 3\n3 4\n6 2\n1 1\n1 5\n1 6\n2\n0 3\n6 4\n0 0", "outp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou play a computer game. In this game, you lead a party of $m$ heroes, and you have to clear a dungeon with $n$ monsters. Each monster is characterized by its power $a_i$. Each hero is characterized by his power $p_i$ an...
[{"type": "stdin_stdout", "input": "2\n6\n2 3 11 14 1 8\n2\n3 2\n000 1\n5\n3 5 100 2 3\n2\n30 5\n90 1\n", "output": "-1\n-1\n"}, {"type": "stdin_stdout", "input": "2\n6\n1 3 11 14 1 10\n2\n3 2\n100 1\n5\n3 5 100 2 3\n2\n30 5\n11 1\n", "output": "5\n-1\n"}, {"type": "stdin_stdout", "input": "2\n6\n1 3 11 16 1 10\n2\n3 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this problem MEX of a certain array is the smallest positive integer not contained in this array.\n\nEveryone knows this definition, including Lesha. But Lesha loves MEX, so he comes up with a new problem involving MEX...
[{"type": "stdin_stdout", "input": "100\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs a New Year's gift, Dolphin received a string s of length 19.\nThe string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`.\nDolphin wants...
[{"type": "stdin_stdout", "input": "gaiku,atcoder,tasks", "output": "gaiku atcoder tasks\n"}, {"type": "stdin_stdout", "input": "abgde,fchihgf,edcba", "output": "abgde fchihgf edcba\n"}, {"type": "stdin_stdout", "input": "ha,pypnewyear,enjoy", "output": "ha pypnewyear enjoy\n"}, {"type": "stdin_stdout", "input": "gaiku...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSeiji Maki doesn't only like to observe relationships being unfolded, he also likes to observe sequences of numbers, especially permutations. Today, he has his eyes on almost sorted permutations.\n\nA permutation $a_1, a_...
[{"type": "stdin_stdout", "input": "1\n264 695448956957126051\n", "output": "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVanya is managed to enter his favourite site Codehorses. Vanya uses n distinct passwords for sites at all, however he can't remember which one exactly he specified during Codehorses registration.\n\nVanya will enter passw...
[{"type": "stdin_stdout", "input": "20 5\nvSyC787KlIL8kZ2Uv5sw\nWKWOP\n7i8J3E8EByIq\nNW2VyGweL\nmyR2sRNu\nmXusPP0\nf4jgGxra\n4wHRzRhOCpEt\npPz9kybGb\nOtSpePCRoG5nkjZ2VxRy\nwHYsSttWbJkg\nKBOP9\nQfiOiFyHPPsw3GHo8J8\nxB8\nqCpehZEeEhdq\niOLjICK6\nQ91\nHmCsfMGTFKoFFnv238c\nJKjhg\ngkEUh\nKBOP9\n", "output": "3 11\n"}, {"type...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn Berland a bus travels along the main street of the capital. The street begins from the main square and looks like a very long segment. There are n bus stops located along the street, the i-th of them is located at the ...
[{"type": "stdin_stdout", "input": "6\n2 3 5 7 9 11\n11\n1 2 2 3 3 4 4 5 5 5 6\n", "output": " 18\n"}, {"type": "stdin_stdout", "input": "6\n2 3 5 7 11 13\n9\n1 2 2 3 3 4 5 5 6\n", "output": " 16\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis week Arkady wanted to cook some pancakes (to follow ancient traditions) and make a problem about that. But then he remembered that one can't make a problem about stacking pancakes without working at a specific IT com...
[{"type": "stdin_stdout", "input": "3\n6\n0 3 0 0 1 3\n10\n0 0 0 1 0 5 0 0 0 2\n3\n0 0 0\n", "output": "\n1 1 0 1 1 1 \n0 1 1 1 1 1 0 0 1 1 \n0 0 0 \n"}, {"type": "stdin_stdout", "input": "3\n6\n0 3 0 0 1 3\n10\n0 0 0 1 0 5 0 0 0 2\n3\n0 0 0\n", "output": "1 1 0 1 1 1 \n0 1 1 1 1 1 0 0 1 1 \n0 0 0 \n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMs. Iyo Kiffa-Australis has a balance and only two kinds of weights to measure a dose of medicine.\n\nFor example, to measure 200mg of aspirin using 300mg weights and 700mg weights, she can put one 700mg weight on the sid...
[{"type": "stdin_stdout", "input": "700 300 200\n993 200 300\n244 200 500\n275 111 330\n275 010 385\n694 375 1747\n3 1 10010\n0 0 0", "output": "1 3\n100 495\n25 28\n21 55\n1 11\n163 297\n3336 2\n"}, {"type": "stdin_stdout", "input": "700 300 200\n500 283 300\n349 200 500\n275 110 330\n275 010 385\n1067 344 4002\n3 1 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n TV shows you want to watch. Suppose the whole time is split into equal parts called \"minutes\". The i-th of the shows is going from l_i-th to r_i-th minute, both ends inclusive.\n\nYou need a TV to watch a TV...
[{"type": "stdin_stdout", "input": "10 798547896 459313948\n40312491 40315265\n40299842 40315264\n40296035 40315263\n40282844 40315262\n40304824 40315261\n40280414 40315260\n40299203 40315259\n40301967 40315258\n40276169 40315257\n40286575 40315256\n", "output": "236433977\n"}, {"type": "stdin_stdout", "input": "4 2882...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPrint the K-th element of the following sequence of length 32:\n\n\n1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51\n\nConstraints\n\n* 1 \\leq K \\leq 32\n* All values in...
[{"type": "stdin_stdout", "input": "16", "output": "14\n"}, {"type": "stdin_stdout", "input": "24", "output": "15\n"}, {"type": "stdin_stdout", "input": "32", "output": "51\n"}, {"type": "stdin_stdout", "input": "-22", "output": "2\n"}, {"type": "stdin_stdout", "input": "-27", "output": "1\n"}, {"type": "stdin_stdout",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the spring of 2014, a student successfully passed the university and started living alone. The problem here is what to do with the supper. He decided to plan a supper for the next N days.\n\nHe wants to maximize the to...
[{"type": "stdin_stdout", "input": "3 1 -10\n-19\n-10\n-10", "output": "-27\n"}, {"type": "stdin_stdout", "input": "2 1 -10\n-19\n-10\n-10", "output": "-19\n"}, {"type": "stdin_stdout", "input": "3 1 -19\n-19\n-10\n-10", "output": "-39\n"}, {"type": "stdin_stdout", "input": "3 1 -19\n-19\n-10\n-18", "output": "-47\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe name of one small but proud corporation consists of n lowercase English letters. The Corporation has decided to try rebranding — an active marketing strategy, that includes a set of measures to change either the brand...
[{"type": "stdin_stdout", "input": "10 10\nlellelleel\ne l\ne l\ne l\ne l\ne l\ne e\nl l\nl e\nl l\ne e\n", "output": "lellelleel\n"}, {"type": "stdin_stdout", "input": "10 10\nlellelleel\ne l\ne l\ne l\ne l\ne l\ne e\nl l\nl e\nl l\ne e\n", "output": "lellelleel\n"}, {"type": "stdin_stdout", "input": "10 10\nlellellee...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVictor and Peter are playing hide-and-seek. Peter has hidden, and Victor is to find him. In the room where they are playing, there is only one non-transparent wall and one double-sided mirror. Victor and Peter are points ...
[{"type": "stdin_stdout", "input": "-7366 1446\n-7727 -1428\n-2680 -3822 -5191 -5553\n-7304 -6313 -9229 1377\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "-4752 -3262\n-4582 6436\n-8997 -6490 -4630 1426\n-9865 -6697 -2371 -5622\n", "output": "YES"}, {"type": "stdin_stdout", "input": "-4752 -3262\n-4582 643...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLimak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.\n\nL...
[{"type": "stdin_stdout", "input": "170\n1 2 1 2 1 1 1 1 2 3 2 1 1 2 2 1 2 1 2 1 1 2 3 3 2 1 1 1 1 1 1 1 1 2 1 2 3 3 2 1 2 2 1 2 3 2 1 1 2 3 2 1 2 1 1 1 2 3 3 2 1 2 1 2 1 1 1 2 1 2 1 1 2 2 1 1 2 1 2 2 1 2 1 2 2 1 2 1 2 3 2 1 1 2 3 4 4 3 2 1 2 1 2 1 2 3 3 2 1 2 1 1 1 1 1 1 1 2 2 1 1 2 1 1 1 1 2 1 1 2 3 2 1 2 2 1 2 1 1 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOK, my warriors! Now that you beat the big BOSS, you can unlock three new skills. (Does it sound like we're playing an RPG? ;-)\n\n## The Arrow Function (JS only)\n\nThe first skill is the arrow function. Let's look at so...
[{"input": "[1, 2, 3, 4, 5]\n[1, 2]\n[3, 4]\n[2, 3]", "output": "[[1, 3, 5, 2, 4]]", "fn_name": "shuffle_it"}, {"input": "[1, 2, 3, 4, 5]\n[1, 2]\n[3, 4]", "output": "[[1, 3, 2, 5, 4]]", "fn_name": "shuffle_it"}, {"input": "[1, 2, 3, 4, 5]\n[1, 2]", "output": "[[1, 3, 2, 4, 5]]", "fn_name": "shuffle_it"}, {"input": "[1...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven a string $s$ of length $n$ and integer $k$ ($1 \\le k \\le n$). The string $s$ has a level $x$, if $x$ is largest non-negative integer, such that it's possible to find in $s$: $x$ non-intersecting (non-overlapping)...
[{"type": "stdin_stdout", "input": "92 5\nwwwwwwwwwwwwwwwwwgggggggggggggggbbbbyyyyyyyyyyyyyyjjjjjjjjjjjuuuuuuuuaaaaaaaaaaaafooooooooig\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "92 5\nwwwwwwwwwwwwwwwwwgggggggggggggggbbbbyyyyyyyyyyyyyyjjjjjjjjjjjuuuuuuuuaaaaaaaaaaaafooooooooig\n", "output": "3\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are the planning manager of an animation production company. What animation production companies produce these days is not limited to animation itself. Related products, such as figures of characters and character son...
[{"type": "stdin_stdout", "input": "4\nakzakr 2 1 8\nfnmyi 5 2 3 4 6 9\ntsnukk 5 2 3 4 7 9\nyskwcnt 6 3 4 7 8 9 10\n4\nakzakr 1 2\nfnmyi 3 10 11 12\ntsnukk 2 1 8\nyskwcnt 2 1 8\n5\nknmmdk 2 13 19\nakmhmr 4 13 15 19 22\nmksyk 6 3 7 12 13 15 19\nskrkyk 3 1 4 8\ntmemm 3 1 17 24\n5\nknmmdk 5 5 6 16 18 26\nakmhmr 9 3 4 7 11...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRyouko is an extremely forgetful girl, she could even forget something that has just happened. So in order to remember, she takes a notebook with her, called Ryouko's Memory Note. She writes what she sees and what she hea...
[{"type": "stdin_stdout", "input": "100 100\n28 28 28 34 28 28 28 40 28 28 28 28 28 28 28 28 28 28 28 28 28 28 47 28 28 28 28 28 28 28 28 28 28 28 28 28 19 28 28 28 28 28 28 28 28 28 28 28 28 28 46 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 49 28 28 28 28 28 28 28 31 28 28 28 28 28 28 28 28 28 28 28 28 28...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya the programmer lives in the middle of the Programming subway branch. He has two girlfriends: Dasha and Masha, who live at the different ends of the branch, each one is unaware of the other one's existence.\n\nWhen V...
[{"type": "stdin_stdout", "input": "999999 1000000\n", "output": "Equal\n"}, {"type": "stdin_stdout", "input": "1000000 999993\n", "output": "Masha\n"}, {"type": "stdin_stdout", "input": "999997 1000000\n", "output": "Dasha\n"}, {"type": "stdin_stdout", "input": "459973 1000000\n", "output": "Dasha\n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe flag of Berland is such rectangular field n × m that satisfies following conditions:\n\n Flag consists of three colors which correspond to letters 'R', 'G' and 'B'. Flag consists of three equal in width and height s...
[{"type": "stdin_stdout", "input": "15 28\nBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBB...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's consider equation:x^2 + s(x)·x - n = 0, \n\nwhere x, n are positive integers, s(x) is the function, equal to the sum of digits of number x in the decimal number system.\n\nYou are given an integer n, find the small...
[{"type": "stdin_stdout", "input": "160000001600000000\n", "output": "400000000\n"}, {"type": "stdin_stdout", "input": "250000002500000000\n", "output": "500000000\n"}, {"type": "stdin_stdout", "input": "360000003600000000\n", "output": "600000000\n"}, {"type": "stdin_stdout", "input": "490000004900000000\n", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N boxes arranged in a circle. The i-th box contains A_i stones.\n\nDetermine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation:\n\n* Select one box. ...
[{"type": "stdin_stdout", "input": "5\n12 26 12 10 8", "output": "NO\n"}, {"type": "stdin_stdout", "input": "5\n6 11 12 10 8", "output": "NO\n"}, {"type": "stdin_stdout", "input": "5\n6 16 12 10 8", "output": "NO\n"}, {"type": "stdin_stdout", "input": "5\n6 26 12 10 8", "output": "NO\n"}, {"type": "stdin_stdout", "inpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe $\\text{$gcdSum$}$ of a positive integer is the $gcd$ of that integer with its sum of digits. Formally, $\\text{$gcdSum$}(x) = gcd(x, \\text{ sum of digits of } x)$ for a positive integer $x$. $gcd(a, b)$ denotes the ...
[{"type": "stdin_stdout", "input": "3\n17\n110\n182\n", "output": "18\n110\n183\n"}, {"type": "stdin_stdout", "input": "3\n17\n110\n359\n", "output": "18\n110\n360\n"}, {"type": "stdin_stdout", "input": "3\n17\n100\n359\n", "output": "18\n102\n360\n"}, {"type": "stdin_stdout", "input": "3\n33\n100\n359\n", "output": "3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (x, y) coordinate system.\n\nWe are going to put drops of ink on the paper. A drop comes in three different...
[{"type": "stdin_stdout", "input": "2,5,3\n3,6,1\n3,4,2\n4,5,2\n3,6,3\n1,4,1", "output": "75\n5\n"}, {"type": "stdin_stdout", "input": "2,5,3\n1,6,3\n3,4,2\n4,5,2\n3,6,3\n2,4,1", "output": "73\n5\n"}, {"type": "stdin_stdout", "input": "2,5,3\n3,6,1\n2,4,2\n4,5,2\n3,6,3\n1,4,1", "output": "76\n5\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMr. A wants to get to the destination on the Yamanote line.\n\nAfter getting on the train, Mr. A gets up for a minute and sleeps for b minutes repeatedly. It is c minutes after boarding to the destination, and you can get...
[{"type": "stdin_stdout", "input": "196 2 133", "output": "133\n"}, {"type": "stdin_stdout", "input": "128 12 16", "output": "16\n"}, {"type": "stdin_stdout", "input": "134 22 13", "output": "13\n"}, {"type": "stdin_stdout", "input": "134 22 21", "output": "21\n"}, {"type": "stdin_stdout", "input": "50 40 68", "output"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDreamoon likes to play with sets, integers and <image>. <image> is defined as the largest positive integer that divides both a and b.\n\nLet S be a set of exactly four distinct integers greater than 0. Define S to be of r...
[{"type": "stdin_stdout", "input": "3081 11\n", "output": "203335\n11 22 33 55\n77 88 99 121\n143 154 165 187\n209 220 231 253\n275 286 297 319\n341 352 363 385\n407 418 429 451\n473 484 495 517\n539 550 561 583\n605 616 627 649\n671 682 693 715\n737 748 759 781\n803 814 825 847\n869 880 891 913\n935 946 957 979\n1001 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya's telephone contains n photos. Photo number 1 is currently opened on the phone. It is allowed to move left and right to the adjacent photo by swiping finger over the screen. If you swipe left from the first photo, y...
[{"type": "stdin_stdout", "input": "100 20 100 10202\nwwwwhhwhhwhhwhhhhhwwwhhhwwwhwwhwhhwwhhwwwhwwhwwwhwhwhwwhhhwhwhhwhwwhhwhwhwwwhwwwwhwhwwwwhwhhhwhwhwww\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "100 20 100 19121\nwwwwhhwhhwhhwhhhhhwwwhhhwwwhwwhwhhwwhhwwwhwwhwwwhwhwhwwhhhwhwhhwhwwhhwhwhwwwhwwwwhwhwwww...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a weighted undirected graph. The vertices are enumerated from 1 to n. Your task is to find the shortest path between the vertex 1 and the vertex n.\n\nInput\n\nThe first line contains two integers n and m (2...
[{"type": "stdin_stdout", "input": "10 10\n1 5 12\n2 4 140\n2 10 149\n3 6 154\n3 7 17\n3 8 226\n3 10 132\n4 10 55\n5 8 33\n7 8 173\n", "output": "1 5 8 7 3 10\n"}, {"type": "stdin_stdout", "input": "10 10\n1 5 12\n2 4 140\n2 10 149\n3 6 154\n2 7 17\n3 8 226\n3 10 136\n4 10 55\n5 8 33\n7 8 173\n", "output": "1 5 8 7 2 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA set of four prime numbers arranged like (a, a + 2, a + 6, a + 8) is called a quadruplet prime number. Of the four prime numbers that make up a quadruplet prime, the largest number is called the size of the quadruplet pr...
[{"type": "stdin_stdout", "input": "13\n14\n15\n16\n17\n18\n19\n20\n10010\n0", "output": "13\n13\n13\n13\n13\n13\n19\n19\n9439\n"}, {"type": "stdin_stdout", "input": "13\n14\n15\n16\n17\n36\n19\n20\n10000\n0", "output": "13\n13\n13\n13\n13\n19\n19\n19\n9439\n"}, {"type": "stdin_stdout", "input": "13\n14\n15\n16\n27\n36...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven a list of unique words. Find all pairs of distinct indices (i, j) in the given list so that the concatenation of the two words, i.e. words[i] + words[j] is a palindrome.\n\nExamples:\n\nNon-string inputs should be c...
[{"input": "[\"abcd\", \"dcba\", \"lls\", \"s\", \"sssll\"]", "output": "[[[0, 1], [1, 0], [2, 4], [3, 2]]]", "fn_name": "palindrome_pairs"}, {"input": "[\"dog\", \"cow\", \"tap\", \"god\", \"pat\"]", "output": "[[[0, 3], [2, 4], [3, 0], [4, 2]]]", "fn_name": "palindrome_pairs"}, {"input": "[5777, \"dog\", \"god\", tru...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet $n$ be a positive integer. Let $a, b, c$ be nonnegative integers such that $a + b + c = n$.\n\nAlice and Bob are gonna play rock-paper-scissors $n$ times. Alice knows the sequences of hands that Bob will play. However...
[{"type": "stdin_stdout", "input": "7\n2\n1 1 0\nRR\n2\n2 0 0\nSS\n2\n2 0 0\nRR\n3\n1 2 0\nRRR\n3\n2 1 0\nRRR\n1\n1 0 0\nP\n1\n1 0 0\nS\n", "output": "YES\nPR\nYES\nRR\nNO\nYES\nPPR\nNO\nNO\nYES\nR\n"}, {"type": "stdin_stdout", "input": "7\n2\n1 1 0\nRR\n2\n2 0 0\nSS\n2\n2 0 0\nRR\n3\n1 2 0\nRRR\n3\n2 1 0\nRRR\n1\n1 0 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIf I give you a date, can you tell me what day that date is? For example, december 8th, 2015 is a tuesday.\n\nYour job is to write the function ```day(d)```\nwhich takes a string representation of a date as input, in the ...
[{"input": "\"19000228\"", "output": "[\"Wednesday\"]", "fn_name": "day"}, {"input": "\"19000301\"", "output": "[\"Thursday\"]", "fn_name": "day"}, {"input": "\"20151208\"", "output": "[\"Tuesday\"]", "fn_name": "day"}, {"input": "\"20160301\"", "output": "[\"Tuesday\"]", "fn_name": "day"}, {"input": "\"20140728\"", "o...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nSnuke loves \"paper cutting\": he cuts out characters from a newspaper headline and rearranges them to form another string.\nHe will receive a headline which contains one of the strings S_1,...,S_n tomorrow.\nHe is excite...
[{"type": "stdin_stdout", "input": "3\ncbaa\ndaacc\nacacac\n", "output": "aac\n"}, {"type": "stdin_stdout", "input": "3\ncacb\nccabe\n`cacbc", "output": "abcc\n"}, {"type": "stdin_stdout", "input": "3\ncaaa\ndaacc\nacacac", "output": "aac\n"}, {"type": "stdin_stdout", "input": "3\ncaca\ncca`d\nacacac", "output": "acc\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are the gym teacher in the school.\n\nThere are $n$ students in the row. And there are two rivalling students among them. The first one is in position $a$, the second in position $b$. Positions are numbered from $1$ t...
[{"type": "stdin_stdout", "input": "22\n100 100 100 1\n100 100 1 100\n100 0 100 1\n100 0 1 100\n2 0 1 2\n2 100 1 2\n2 0 2 1\n2 100 2 1\n100 0 1 2\n100 98 1 2\n100 97 1 2\n100 0 2 1\n100 98 2 1\n100 97 2 1\n100 0 99 100\n100 98 99 100\n100 97 99 100\n100 0 100 99\n100 98 100 99\n100 97 100 99\n100 0 13 37\n100 0 66 11\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMake the 2D list by the sequential integers started by the ```head``` number.\n\nSee the example test cases for the expected output.\n\n``` \nNote:\n\n-10**20 < the head number <10**20\n1 <= the number of rows <= 1000\n0...
[{"input": "10000000000\n2\n2", "output": "[[[10000000000, 10000000001], [10000000002, 10000000003]]]", "fn_name": "make_2d_list"}, {"input": "2\n3\n4", "output": "[[[2, 3, 4, 5], [6, 7, 8, 9], [10, 11, 12, 13]]]", "fn_name": "make_2d_list"}, {"input": "5\n6\n1", "output": "[[[5], [6], [7], [8], [9], [10]]]", "fn_name"...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nProfessor Abacus has just built a new computing engine for making numerical tables. It was designed to calculate the values of a polynomial function in one variable at several points at a time. With the polynomial functio...
[{"type": "stdin_stdout", "input": "2\n1.0\n4.0\n14.21446074361601\n16.0\n25.0\n1\n-30.5893962764\n6.055835197262627\n39.3853798058\n74.3727663177\n0\n42.56611822314588\n79.5420238202\n28.0282396675\n-30.3627807522\n-49.34987576252381\n-25.34819013612247\n7.58575761381\n0\n-21.42163030108298\n-47.94509062430888\n-23.35...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWith your birthday coming up soon, your eccentric friend sent you a message to say \"happy birthday\":\n\n hhhappyyyy biirrrrrthddaaaayyyyyyy to youuuu\n hhapppyyyy biirtttthdaaay too youuu\n happy birrrthdayy to...
[{"input": "\"happy birthday\"\n\"hhhappyyyy biirrrrrthddaaaayyyyyyy to youuuu\"", "output": "[7680]", "fn_name": "count_subsequences"}, {"input": "\"happy birthday\"\n\"hhaappyy bbiirrtthhddaayy\"", "output": "[2048]", "fn_name": "count_subsequences"}, {"input": "\"happy birthday\"\n\"appyh appy birth day\"", "output"...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nXenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself.\n\n<image>\n\nRecently Xenia has bought n_r red gems, n_g green gems and n_b blue gem...
[{"type": "stdin_stdout", "input": "5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n0 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n12\n", "output": "14\n1999999996000000002\n24\n24\n122\n"}, {"type": "stdin_stdout", "input": "5\n2 2 3\n7 8\n6 3\n3 0 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n0 2\n5 4\n6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nN people are waiting in a single line in front of the Takahashi Store. The cash on hand of the i-th person from the front of the line is a positive integer A_i.\n\nMr. Takahashi, the shop owner, has decided on the followi...
[{"type": "stdin_stdout", "input": "15\n4\n1\n4\n1\n3\n18\n4\n12\n5\n3\n6\n8\n15\n12\n9", "output": "43\n"}, {"type": "stdin_stdout", "input": "15\n4\n1\n4\n1\n3\n18\n4\n12\n5\n3\n3\n8\n15\n12\n9", "output": "42\n"}, {"type": "stdin_stdout", "input": "15\n4\n1\n4\n1\n3\n31\n4\n8\n5\n3\n6\n8\n15\n7\n9", "output": "46\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYour program fails again. This time it gets \"Wrong answer on test 233\"\n\n.\n\nThis is the easier version of the problem. In this version 1 ≤ n ≤ 2000. You can hack this problem only if you solve and lock both problems....
[{"type": "stdin_stdout", "input": "100 100\n82 51 81 14 37 17 78 123 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 75 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 16 3 55 37 85 46 22 159 52 98 4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAmugae has a sentence consisting of $n$ words. He want to compress this sentence into one word. Amugae doesn't like repetitions, so when he merges two words into one word, he removes the longest prefix of the second word ...
[{"type": "stdin_stdout", "input": "9\nL M5 M5D M5DAYBl0r6gmttCTR M5DAYBl0r6gmttCTRoKdM9EFrX22qBZpAc M5DAYBl0r6gmttCTRoKdM9EFrX22qBZpAczv7fKrVgg0xe M5DAYBl0r6gmttCTRoKdM9EFrX22qBZpAczv7fKrVhg0xe09re M5DAYBl0r6gmttCTRoKdM9EFrX22qBZpAczv7fKrVhg0xe09re M5DAYBl0r6gmttCTRoKdM9EFrX22qBZpAczv7fKrVhg0xe09re\n", "output": "LM5D...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n incoming messages for Vasya. The i-th message is going to be received after t_{i} minutes. Each message has a cost, which equals to A initially. After being received, the cost of a message decreases by B each ...
[{"type": "stdin_stdout", "input": "108 576 610 844 573\n242 134 45 515 430 354 405 179 174 366 155 4 300 176 96 36 508 70 75 316 118 563 55 340 128 214 138 511 507 437 454 478 341 443 421 573 270 362 208 107 256 471 436 378 336 507 383 352 450 411 297 34 179 551 119 524 141 288 387 9 283 241 304 214 503 559 416 447 49...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a plan view consisting of 12 vertical and 12 horizontal squares showing the terrain. Each square is painted white or black. White represents the sea and black represents the land. When two black squares touch eac...
[{"type": "stdin_stdout", "input": "111100001111\n111000001111\n110000001110\n100000001111\n000100010000\n010000111010\n000001111100\n100011111110\n010101111100\n111000111000\n111100010000\n000000100000\n\n110001111100\n110010001010\n010010000001\n010000000001\n010000000110\n010000111000\n010000000000\n010000010010\n01...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFlatland is inhabited by pixels of three colors: red, green and blue. We know that if two pixels of different colors meet in a violent fight, only one of them survives the fight (that is, the total number of pixels decrea...
[{"type": "stdin_stdout", "input": "2147483630 2147483642 2147483610\n", "output": " 2147483630\n"}, {"type": "stdin_stdout", "input": "1944219055 454183506 1369298327\n", "output": " 1944219055\n"}, {"type": "stdi...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMasa Kita, who entered the University of Tokyo, joined a circle called TSG (University of Tokyo Super Gamers).\n\nThis circle exhibits games at the Komaba Festival every year, and Masa Kita decided to create and display t...
[{"type": "stdin_stdout", "input": "3\n......\n......\n......\n......\n......\n......\n......\n......\n.RGB..\nRGOP..\nRGBPB.\nRGBPP.\nGBRGYP\nGBRRYP\nBGGRBB\nBPRGYY\nGGPRRY\nBYPPRB\nYGGGPB\nGYYYPR\nYRBRBR\nYBRBRB\nBRBRBR\nBRBRBR\n......\n......\n......\n......\n......\n......\n......\n......\n.....-\n......\n..OO..\n....
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n> [Run-length encoding](https://en.wikipedia.org/w/index.php?title=Run-length_encoding) (RLE) is a very simple form of data compression in which runs of data (that is, sequences in which the same data value occurs in many...
[{"input": "\"hello world!\"", "output": "[[[1, \"h\"], [1, \"e\"], [2, \"l\"], [1, \"o\"], [1, \" \"], [1, \"w\"], [1, \"o\"], [1, \"r\"], [1, \"l\"], [1, \"d\"], [1, \"!\"]]]", "fn_name": "run_length_encoding"}, {"input": "\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbb\"", "output": "[[[34, \"a\"], [3, \"b\"]]]", "fn_name":...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nConsider the following game:\n\n* The game is played using a row of N squares and many stones.\n* First, a_i stones are put in Square i\\ (1 \\leq i \\leq N).\n* A player can perform the following operation as many time a...
[{"type": "stdin_stdout", "input": "36 17", "output": "644469316\n"}, {"type": "stdin_stdout", "input": "36 18", "output": "653755501\n"}, {"type": "stdin_stdout", "input": "36 22", "output": "667405665\n"}, {"type": "stdin_stdout", "input": "59 22", "output": "723249007\n"}, {"type": "stdin_stdout", "input": "49 17", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n**This Kata is intended as a small challenge for my students**\n\nAll Star Code Challenge #29\n\nYour friend Nhoj has dislexia, but can easily read messages if the words are written backwards. \nCreate a function called ...
[{"input": "\"Hello !Nhoj Want to have lunch?\"", "output": "[\"olleH johN! tnaW ot evah ?hcnul\"]", "fn_name": "reverse_sentence"}, {"input": "\"CodeWars rules!\"", "output": "[\"sraWedoC !selur\"]", "fn_name": "reverse_sentence"}, {"input": "\"1 2 3 4 5\"", "output": "[\"1 2 3 4 5\"]", "fn_name": "reverse_sentence"},...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nAsk a small girl - \"How old are you?\". She always says strange things... Lets help her!\n\n\nFor correct answer program should return int from 0 to 9.\n\nAssume test input string always valid and may look like \n\"1 yea...
[{"input": "\"2 years old\"", "output": "[2]", "fn_name": "get_age"}, {"input": "\"3 years old\"", "output": "[3]", "fn_name": "get_age"}, {"input": "\"4 years old\"", "output": "[4]", "fn_name": "get_age"}, {"input": "\"5 years old\"", "output": "[5]", "fn_name": "get_age"}, {"input": "\"6 years old\"", "output": "[6]...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nAmr loves Chemistry, and specially doing experiments. He is preparing for a new interesting experiment.\n\nAmr has n different types of chemicals. Each chemical i has an initial volume of a_{i} liters. For this experiment...
[{"type": "stdin_stdout", "input": "20\n1 2 3 4 6 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 100000\n", "output": "113\n"}, {"type": "stdin_stdout", "input": "20\n1 2 3 4 6 8 16 32 64 128 256 512 1024 2048 3647 8192 16384 32768 65536 100000\n", "output": "124\n"}, {"type": "stdin_stdout", "input": "20...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is an integer N.\nTakahashi chooses an integer a from the positive integers not greater than N with equal probability.\nFind the probability that a is odd.\n\n-----Constraints-----\n - 1 \\leq N \\leq 100\n\n-----In...
[{"type": "stdin_stdout", "input": "-1297", "output": "0.499614494988\n"}, {"type": "stdin_stdout", "input": "-1739", "output": "0.499712478436\n"}, {"type": "stdin_stdout", "input": "-2609", "output": "0.499808355692\n"}, {"type": "stdin_stdout", "input": "-4637", "output": "0.499892171663\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have N integers. The i-th number is A_i.\n\\{A_i\\} is said to be pairwise coprime when GCD(A_i,A_j)=1 holds for every pair (i, j) such that 1\\leq i < j \\leq N.\n\\{A_i\\} is said to be setwise coprime when \\{A_i\\}...
[{"type": "stdin_stdout", "input": "3\n6 10 15\n", "output": "setwise coprime\n"}, {"type": "stdin_stdout", "input": "3\n17 10 15", "output": "setwise coprime\n"}, {"type": "stdin_stdout", "input": "3\n26 10 15", "output": "setwise coprime\n"}, {"type": "stdin_stdout", "input": "3\n7 10 31", "output": "pairwise coprime...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's define the sum of two permutations p and q of numbers 0, 1, ..., (n - 1) as permutation [Image], where Perm(x) is the x-th lexicographically permutation of numbers 0, 1, ..., (n - 1) (counting from zero), and Ord(p)...
[{"type": "stdin_stdout", "input": "84\n83 4 68 34 24 2 48 38 22 51 5 62 31 67 66 53 49 70 9 71 46 41 30 8 50 17 28 79 15 80 32 43 14 74 29 42 81 60 56 65 23 0 77 76 58 78 1 11 37 27 75 35 18 73 54 20 57 33 36 6 61 69 64 55 39 10 3 45 13 26 59 82 21 25 63 52 16 44 47 72 19 12 7 40\n63 41 80 52 36 45 17 69 22 66 37 21 4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp loves geometric progressions very much. Since he was only three years old, he loves only the progressions of length three. He also has a favorite integer k and a sequence a, consisting of n integers.\n\nHe wants ...
[{"type": "stdin_stdout", "input": "18 10\n10000000 100000000 1000000000 -10000000 -100000000 -1000000000 -10000000 -100000000 -1000000000 -10000000 -100000000 -1000000000 10000000 100000000 1000000000 10000000 100000000 1000000000\n", "output": "20\n"}, {"type": "stdin_stdout", "input": "18 10\n10000000 100000000 1000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob are fighting over who is a superior debater. However they wish to decide this in a dignified manner. \nSo they decide to fight in the Battle of Words. \n\nIn each game both get to speak a sentence. Because t...
[{"type": "stdin_stdout", "input": "10\nkdeuqunsa vylhazxgf filexjohs dxretqfqh ohbcgirwp cwayrtksq wqnfyvohb ymnjjkowo aqhlwnahs vlyjekfjs bbrqrvfmc ymlsmjoyl vjwpaipqo uzohwcqqb bgjkfkbkj esqcfdgkr crweugucm tfncjlbpo rnoadvokf xpzksknrl hqmxnzuof hlggnuusu lzvdzzalu jjsnrslhf tkhfpahcl gmgshdaia eczdyngqz ftumhnais ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOn the great island of Baltia, there live N people, numbered from 1 to N. There are exactly M pairs of people that are friends with each other. The people of Baltia want to organize a successful party, but they have very ...
[{"type": "stdin_stdout", "input": "20 57\n13 14\n12 20\n18 3\n17 20\n15 9\n18 13\n12 19\n2 4\n9 2\n12 11\n14 1\n16 11\n11 14\n16 4\n16 15\n11 19\n15 4\n10 15\n12 5\n9 3\n10 2\n10 4\n20 19\n14 7\n19 2\n5 8\n6 14\n4 17\n2 17\n17 9\n13 9\n19 9\n18 8\n12 16\n18 5\n7 1\n8 3\n11 20\n6 13\n20 5\n13 8\n17 19\n7 6\n9 11\n18 9\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou might have heard about the next game in Lara Croft series coming out this year. You also might have watched its trailer. Though you definitely missed the main idea about its plot, so let me lift the veil of secrecy.\n...
[{"type": "stdin_stdout", "input": "636553724 546535019 115079316355948443\n", "output": "425992073 546535018\n"}, {"type": "stdin_stdout", "input": "548492800 434105920 179638683192075937\n", "output": "134679777 434105920\n"}, {"type": "stdin_stdout", "input": "595261150 794915864 332353903994901365\n", "output": "17...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTyndex is again well ahead of the rivals! The reaction to the release of Zoozle Chrome browser was the release of a new browser Tyndex.Brome!\n\nThe popularity of the new browser is growing daily. And the secret is not ev...
[{"type": "stdin_stdout", "input": "20 10\niwbiucrjoj\nqvjewvdrgwgc\newwqyhtdzakryafqaacimthycyasyb\ncuoscayekvbsqokyfdmjnojkjennf\nhkuv\njtdgbespjdtbc\ngeulitsrlqihoujvwuobnfospq\nzphnlqxacchxhyeehnpfwdjnwvj\nxicsaoyfgtdbwqfrdgaiyn\natgshewfkuxaipizcdev\nvp\nyblkfmqsj\nyevxolvycyrrooosberqzrabefdckg\nrytykrlgttc\nafph...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nReturn a new array consisting of elements which are multiple of their own index in input array (length > 1).\n\nSome cases: \n\n```\n[22, -6, 32, 82, 9, 25] => [-6, 32, 25]\n\n[68, -1, 1, -7, 10, 10] => [-1, 10]\n\n[-56,...
[{"input": "[-56, -85, 72, -26, -14, 76, -27, 72, 35, -21, -67, 87, 0, 21, 59, 27, -92, 68]", "output": "[[-85, 72, 0, 68]]", "fn_name": "multiple_of_index"}, {"input": "[28, 38, -44, -99, -13, -54, 77, -51]", "output": "[[38, -44, -99]]", "fn_name": "multiple_of_index"}, {"input": "[-1, -49, -1, 67, 8, -60, 39, 35]", ...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given three integers n, k, m and m conditions (l_1, r_1, x_1), (l_2, r_2, x_2), ..., (l_m, r_m, x_m).\n\nCalculate the number of distinct arrays a, consisting of n integers such that: \n\n * 0 ≤ a_i < 2^k for eac...
[{"type": "stdin_stdout", "input": "20 10 20\n6 8 384\n6 7 385\n6 10 128\n13 14 182\n15 19 0\n19 20 468\n20 20 477\n6 8 384\n17 20 16\n2 4 205\n6 6 899\n16 20 0\n20 20 477\n12 15 6\n9 11 513\n11 11 873\n16 19 0\n15 16 15\n7 9 180\n10 10 727\n", "output": "298754800\n"}, {"type": "stdin_stdout", "input": "20 10 20\n6 8 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya was late for the lesson too. The teacher gave him an additional task. For some array a Petya should find the number of different ways to select non-empty subset of elements from it in such a way that their product i...
[{"type": "stdin_stdout", "input": "20\n20 34 51 40 70 64 14 30 24 20 6 1 70 28 38 43 9 60 31 69\n", "output": "2047\n"}, {"type": "stdin_stdout", "input": "20\n20 34 51 40 70 64 14 30 24 20 6 1 70 28 38 43 9 60 31 69\n", "output": "2047\n"}, {"type": "stdin_stdout", "input": "18\n22 41 40 8 36 48 23 5 58 12 26 44 53 4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's call a number k-good if it contains all digits not exceeding k (0, ..., k). You've got a number k and an array a containing n numbers. Find out how many k-good numbers are in a (count each number every time it occur...
[{"type": "stdin_stdout", "input": "10 6\n1234560\n1234560\n1234560\n1234560\n1234560\n1234560\n1234560\n1234560\n1234560\n1234560\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "10 6\n1234560\n1234560\n1234560\n1234560\n1234560\n1234560\n1234560\n1234560\n1234560\n1234560\n", "output": "10\n"}, {"type": "std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn case you might be unlucky enough not to know the best dark fantasy franchise ever, Berserk tells the story of a man that, hating gratuitous violence, decided to become a mercenary (thus one who sells violence, no gratu...
[{"input": "[\"spirits of the dead attacking Gatsu and getting clanged for good\", \"but the wheel spirits where really made with bad CG\", \"Isidoro trying to steal the dragon Slayer and getting a sort of clang on his face\", \"Gatsu vs. the possessed horse: clang!\", \"Farnese whining again...\", \"a shame the episod...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nIt's tricky keeping track of who is owed what when spending money in a group. Write a function to balance the books.\n\n* The function should take one parameter: an object/dict with two or more name-value pairs which repr...
[{"input": "{\"A\": 20348, \"B\": 493045, \"C\": 2948, \"D\": 139847, \"E\": 48937534, \"F\": 1938724, \"G\": 4, \"H\": 2084}", "output": "[{\"A\": -6421468.75, \"B\": -5948771.75, \"C\": -6438868.75, \"D\": -6301969.75, \"E\": 42495717.25, \"F\": -4503092.75, \"G\": -6441812.75, \"H\": -6439732.75}]", "fn_name": "spli...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nZhinü was a child of the Emperor, but he was weaving the machine even if he opened it at the request of his father.\n\nIt was a pleasure of the Emperor to wear clothes made of a splendid cloth called Unnishiki woven by Zh...
[{"type": "stdin_stdout", "input": "5\n0 4 0 2 9 3 4 8 2 -1\n3 8 -1 0 0 3 1 2 17 54\n1 2 1 2 41 2 17 21 11 0\n-2 2 14 24 0 21 1 14 20 4\n7 6 30 0 10 1 22 -2 8 -1", "output": "NG\nNG\nNG\nOK\nNG\n"}, {"type": "stdin_stdout", "input": "5\n0 4 -1 2 7 3 4 8 2 -1\n3 5 -1 0 0 3 0 6 8 62\n1 4 1 0 76 4 17 2 11 0\n-2 2 14 24 -1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven an array of arguments, representing system call arguments keys and values, join it into a single, space-delimited string. You don't need to care about the application name -- your task is only about parameters.\n\nE...
[{"input": "[[\"foo\"], \"bar\", [\"baz\", \"qux\"], [\"xyzzy\", \"a\"], \"a\", [\"a\"], [\"a\", \"plugh\"]]", "output": "[\"foo bar --baz qux --xyzzy a a a -a plugh\"]", "fn_name": "args_to_string"}, {"input": "[[\"---\"], \"---\", [\"---\", \"---\"], [\"-----\", \"-\"], \"-\", [\"-\"], [\"-\", \"-----\"]]", "output":...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nAtaru Oafoot of Aizu Gakuen University High School decided to play with a slot machine.\n\nWhen you insert a medal on this machine, three reels will start spinning and each reel will stop automatically. In a normal game (...
[{"type": "stdin_stdout", "input": "3 2 30 3 41 226\n9 0 18 4 20 118\n5 5 12 0 15 203\n13 4 19 2 22 197\n7 4 24 4 17 209\n0 0 0 0 0 0", "output": "172\n795\n410\n1199\n617\n"}, {"type": "stdin_stdout", "input": "3 2 30 3 41 226\n9 0 36 4 20 118\n5 5 12 0 18 203\n13 4 19 2 22 197\n1 4 42 4 17 209\n0 0 0 0 0 0", "output"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCreate a function that takes a string as a parameter and does the following, in this order:\n\n1. replaces every letter with the letter following it in the alphabet (see note below)\n2. makes any vowels capital\n3. makes ...
[{"input": "\"Hello World\"", "output": "[\"Ifmmp xpsmE\"]", "fn_name": "changer"}, {"input": "\"sponge1\"", "output": "[\"tqpOhf1\"]", "fn_name": "changer"}, {"input": "\"Cat30\"", "output": "[\"dbU30\"]", "fn_name": "changer"}, {"input": "\"Alice\"", "output": "[\"bmjdf\"]", "fn_name": "changer"}, {"input": "\"dogs\"...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nSanta Claus has n candies, he dreams to give them as gifts to children.\n\nWhat is the maximal number of children for whose he can give candies if Santa Claus want each kid should get distinct positive integer number of c...
[{"type": "stdin_stdout", "input": "1000\n", "output": "44\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 54 \n"}, {"type": "stdin_stdout", "input": "990\n", "output": "44\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has $6$ strings and an infinite number of frets numbered from $1$. Fretting the fret number $j$ on the ...
[{"type": "stdin_stdout", "input": "58260522 32004256 2436426 24979445 61648772 23690081\n10\n582107247 906728404 411434947 673536177 411497300 488012525 1035611341 800305059 992325267 138720156\n", "output": "837678839\n"}, {"type": "stdin_stdout", "input": "58260522 32004256 2436426 24979445 12477970 11891566\n10\n58...
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$ and two integers $m$ and $k$.\n\nYou can choose some subarray $a_l, a_{l+1}, \\dots, a_{r-1}, a_r$. \n\nThe cost of subarray $a_l, a_{l+1}, \\dots, a_{r-1}, a_r$ is equal to...
[{"type": "stdin_stdout", "input": "44 2 531595322\n926215961 -385821837 -278841122 -422772006 -509196878 -81824369 -101501043 -33095577 -520514931 402836017 48602657 881104200 -110528684 52550046 -208588735 -814534121 -548420443 410430115 -636402169 -848516069 -70639158 775203498 -679440929 -427359667 33598904 6568726...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased ...
[{"type": "stdin_stdout", "input": "10 10\n20 53 6 97 74 12 92 48 13 97\n157 47 32 75 21 69 75 95 54 1\n97 36 1 41 87 1 23 39 44 27\n97 73 1 1 26 6 3 48 69 5\n70 93 42 35 5 12 22 33 29 13\n96 8 13 69 40 91 5 19 16 33\n61 92 54 82 60 24 63 64 59 65\n76 44 60 37 29 16 50 74 59 59\n77 58 95 30 52 25 34 2 49 92\n37 65 12 7...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya is developing his own programming language VPL (Vasya Programming Language). Right now he is busy making the system of exceptions. He thinks that the system of exceptions must function like that.\n\nThe exceptions a...
[{"type": "stdin_stdout", "input": "21\n try \n try \n try \n try \n try \n try \n try \n try \n try \n try \n throw( qtSMze) \ncatch(LY,\"x3 j\")\ncatch(hgSAFgbMGx,\"moByu\")\ncatch(LmydVQgv,\"hbZl\")\ncatch(oK,\"B6OZx qy\")\ncatch(rrtnRQB,\"7VFkQMv\")\ncatch(CASqQXaz,\"d9oci1Kx\")\ncatch(CTCzs...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nThere are $ M $ type characters. Use them to create a string of length $ N $. How many strings are used that have $ K $ or more? Find too much divided by $ 998244353 $.\n\nHere, the difference between two strin...
[{"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000 1001", "output": "824796085\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000 0001", "output": "276774580\n"}, {"type": "stdin_stdout", "input": "1000000000000000001 1000000000000000000 0001", "output": "314695265\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Task\n\nGiven an array of roots of a polynomial equation, you should reconstruct this equation.\n\n___\n\n## Output details:\n\n* If the power equals `1`, omit it: `x = 0` instead of `x^1 = 0`\n* If the power equals `0`...
[{"input": "[1, 2, 3, 4, 5]", "output": "[\"x^5 - 15x^4 + 85x^3 - 225x^2 + 274x - 120 = 0\"]", "fn_name": "polynomialize"}, {"input": "[0, -2, -3]", "output": "[\"x^3 + 5x^2 + 6x = 0\"]", "fn_name": "polynomialize"}, {"input": "[0, 2, 3]", "output": "[\"x^3 - 5x^2 + 6x = 0\"]", "fn_name": "polynomialize"}, {"input": "[...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Rebel fleet is on the run. It consists of m ships currently gathered around a single planet. Just a few seconds ago, the vastly more powerful Empire fleet has appeared in the same solar system, and the Rebels will nee...
[{"type": "stdin_stdout", "input": "30\n(89+76)/87\n(81+78)/18\n(60+97)/32\n(41+14)/48\n(55+65)/27\n(29+15)/95\n(64+13)/96\n(78+30)/75\n(43+6)/60\n(69+34)/48\n(62+2)/97\n(85+42)/3\n(4+97)/42\n(1+18)/39\n(46+55)/76\n(22+59)/24\n(62+81)/98\n(64+8)/51\n(9+59)/48\n(47+2)/80\n(33+74)/76\n(61+83)/44\n(86+4)/51\n(65+41)/49\n(...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTaro is an elementary school student who has just learned multiplication. Somehow, he likes multiplication, so when he sees numbers, he wants to multiply. He seems to like to do the following for integers greater than or ...
[{"type": "stdin_stdout", "input": "2\n999999\n1000100", "output": "12\n2\n"}, {"type": "stdin_stdout", "input": "2\n999999\n1010100", "output": "12\n3\n"}, {"type": "stdin_stdout", "input": "2\n999999\n1010110", "output": "12\n5\n"}, {"type": "stdin_stdout", "input": "2\n999999\n1101100", "output": "12\n4\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n...
[{"type": "stdin_stdout", "input": "resaremaerd", "output": "NO\n"}, {"type": "stdin_stdout", "input": "ersaremaerd", "output": "NO\n"}, {"type": "stdin_stdout", "input": "ersaremadrd", "output": "NO\n"}, {"type": "stdin_stdout", "input": "ersarfmadrd", "output": "NO\n"}, {"type": "stdin_stdout", "input": "errarfmadrd"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTenten runs a weapon shop for ninjas. Today she is willing to sell n shurikens which cost 1, 2, ..., n ryo (local currency). During a day, Tenten will place the shurikens onto the showcase, which is empty at the beginning...
[{"type": "stdin_stdout", "input": "10\n+\n- 3\n+\n+\n+\n+\n- 1\n- 7\n- 9\n- 10\n+\n+\n+\n- 4\n- 5\n- 8\n+\n- 6\n+\n- 2\n", "output": "YES\n3 10 9 7 1 8 5 4 6 2 "}, {"type": "stdin_stdout", "input": "10\n+\n- 1\n+\n+\n+\n+\n- 1\n- 7\n- 9\n- 10\n+\n+\n+\n- 7\n- 10\n- 8\n+\n+\n- 6\n- 2\n", "output": "NO\n"}, {"type": "st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array of positive integers. While there are at least two equal elements, we will perform the following operation. We choose the smallest value $x$ that occurs in the array $2$ or more times. Take the firs...
[{"type": "stdin_stdout", "input": "34\n967614464 967614464 1000000000 1000000000 1000000000 1000000000 1000000000 1010000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000...
code_stdio