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\nHeading ##There are two integers A and B. You are required to compute the bitwise AND amongst all natural numbers lying between A and B, both inclusive.\nInput Format\n\nFirst line of the input contains T, the number of t...
[{"type": "stdin_stdout", "input": "124\n1476395008 1493172223\n1275068416 1291845631\n4009754624 4026531839\n2516582400 2533359615\n50331648 67108863\n2566914048 2583691263\n2952790016 2969567231\n3892314112 3909091327\n3489660928 3506438143\n33554432 50331647\n1694498816 1711276031\n3623878656 3640655871\n1308622848 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nJ: City\n\nSanta decides to deliver a present to a city.\n\nThe city has a rectangular shape divided into north-south $ H $ parcels x east-west $ W $ parcels, with one house delivering gifts to each parcel.\n\nThe $ X $ t...
[{"type": "stdin_stdout", "input": "2 -2 11 0", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "0 -1 12 1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-1 2 0 14", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "0 -1 1 11", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1 -2 11 0", "out...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya plays the LionAge II. He was bored of playing with a stupid computer, so he installed this popular MMORPG, to fight with his friends. Vasya came up with the name of his character — non-empty string s, consisting of ...
[{"type": "stdin_stdout", "input": "emrvvhupytoxzhqxmuop 1\n49\ng g -558\nd g 845\nd k -745\nb g -773\nf f -733\nb s -491\na s -894\ng d -565\ns k -756\nb a 373\nb d 398\nk f 250\na b 531\nf g -27\nf b 125\na g -555\ns f 540\ng b 194\nk s -636\ns b -955\nd a -520\ng f -97\nf s -204\ns a 171\nb k -304\ns g -160\na a -56...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFind the smallest possible sum of the digits in the decimal notation of a positive multiple of K.\n\n-----Constraints-----\n - 2 \\leq K \\leq 10^5\n - K is an integer.\n\n-----Input-----\nInput is given from Standard Inp...
[{"type": "stdin_stdout", "input": "79992\n", "output": "36\n"}, {"type": "stdin_stdout", "input": "10989", "output": "27\n"}, {"type": "stdin_stdout", "input": "37450", "output": "3\n"}, {"type": "stdin_stdout", "input": "70620", "output": "6\n"}, {"type": "stdin_stdout", "input": "11849", "output": "5\n"}, {"type": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\nSnuke can perform the following operation when all integers on the blackboard are even:\n - Replace each integer X on the blackboard by X divided by 2...
[{"type": "stdin_stdout", "input": "6\n382253568 723152896 37802240 379425024 404894720 471526144\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "6\n348324507 1154626501 32183854 379425024 590201381 471526144", "output": "0\n"}, {"type": "stdin_stdout", "input": "6\n586050932 1154626501 32183854 379425024 5902...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n integers b_1, b_2, ..., b_{n} written in a row. For all i from 1 to n, values a_{i} are defined by the crows performing the following procedure:\n\n The crow sets a_{i} initially 0. The crow then adds b_{i} ...
[{"type": "stdin_stdout", "input": "10\n-38980 0001000000 -1000000000 1000000000 -1000000000 1000010010 -1000000000 1010000010 -1556535198 1000000000\n", "output": "961020 -999000000 0 0 10010 10010 10000010 -546535188 -556535198 1000000000\n"}, {"type": "stdin_stdout", "input": "10\n-38980 0001000000 -1000000000 10000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's call (yet again) a string good if its length is even, and every character in odd position of this string is different from the next character (the first character is different from the second, the third is different...
[{"type": "stdin_stdout", "input": "100\nababbaaabaaabaabbabbaaabbabaaabbbabbbbbbbbababbbbbabbaaaabbbabbaababaabaababbbabababbbababbbbaabbbba\n", "output": "34\nababbaabababbabaabbabaabbababababaabbabaabababababbabababababaabba\n"}, {"type": "stdin_stdout", "input": "100\nabbbbaabbbbababbbabababbbabaabaababaabbabbbaaaa...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a directed graph $G$ which can contain loops (edges from a vertex to itself). Multi-edges are absent in $G$ which means that for all ordered pairs $(u, v)$ exists at most one edge from $u$ to $v$. Vertices a...
[{"type": "stdin_stdout", "input": "1\n\n000110 0\n", "output": "1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"}, {"type": "stdin_stdout", "inpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Collatz Conjecture states that for any natural number n, if n is even, divide it by 2. If n is odd, multiply it by 3 and add 1. If you repeat the process continuously for n, n will eventually reach 1.\n\nFor example, ...
[{"input": "73567465519280238573", "output": "[362]", "fn_name": "collatz"}, {"input": "1000000000000000", "output": "[276]", "fn_name": "collatz"}, {"input": "1000000000", "output": "[101]", "fn_name": "collatz"}, {"input": "500", "output": "[111]", "fn_name": "collatz"}, {"input": "100", "output": "[26]", "fn_name": ...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nHow many ways are there to place a black and a white knight on an N * M chessboard such that they do not attack each other? The knights have to be placed on different squares. A knight can move two squares horizontally an...
[{"type": "stdin_stdout", "input": "3\n29 5\n2 2\n16 7", "output": "20112\n12\n11796\n"}, {"type": "stdin_stdout", "input": "3\n16 3\n4 3\n12 4", "output": "2084\n104\n2048\n"}, {"type": "stdin_stdout", "input": "3\n29 3\n2 2\n16 7", "output": "7154\n12\n11796\n"}, {"type": "stdin_stdout", "input": "3\n16 2\n4 3\n12 3"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter learning a lot about space exploration, a little girl named Ana wants to change the subject.\n\nAna is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to che...
[{"type": "stdin_stdout", "input": "20\niw\nix\nudb\nbg\noi\nuo\njsm\num\ns\nquy\nqo\nbxct\nng\nrmr\nnu\nps\nio\nkh\nw\nk\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "20\niw\nix\nudb\nbg\noi\nuo\njsm\nmu\ns\nquy\nqo\nbxct\nng\nrmr\nnu\nps\nio\nkh\nw\nk\n", "output": "5\n"}, {"type": "stdin_stdout", "input":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven a String(only lower case letters) , check if any substring has occured Twice :\n\n Example : iwsagoodboody\nHere, substring \"ood\" occurs twice.\n\nOutput \"YES\" if there is any such substring else output \"NO\"...
[{"type": "stdin_stdout", "input": "100\nhqghumeaylnlfdxfircvscxggbwkfnqduxwfnfozvs\ntkjprepggxrpnrvystmwcysyycqpevikeffmznimkkasvwsrenzkycxfxtlsgypsfadpooefxzbcoejuvpvaboygpoeylfpbnpljvrvipyamyehwqnqrqpmxujjloovaowuxwhmsncbxcoksfzkvatxdknlyjyhfixjswnkkufnuxxzrzbmnmgqooketlyhnkoaugzqrcddiuteiojwayyzpvscmpsajlfvgubfaaov...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nn fish, numbered from 1 to n, live in a lake. Every day right one pair of fish meet, and the probability of each other pair meeting is the same. If two fish with indexes i and j meet, the first will eat up the second with...
[{"type": "stdin_stdout", "input": "8\n0.000 0.147 0.783 0.224 0.220 0.651 0.453 0.209\n0.853 0.000 0.246 0.076 0.018 0.349 0.896 0.315\n0.217 0.754 0.000 0.307 0.968 0.400 0.531 0.086\n0.776 0.924 0.693 0.000 0.707 0.842 0.116 0.949\n0.780 0.982 0.032 0.293 0.000 0.908 0.307 0.266\n0.349 0.651 0.600 0.158 0.092 0.000 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a binary string $s$ consisting of $n$ zeros and ones.\n\nYour task is to divide the given string into the minimum number of subsequences in such a way that each character of the string belongs to exactly one...
[{"type": "stdin_stdout", "input": "4\n4\n0011\n6\n111111\n5\n10101\n8\n01010000\n", "output": "2\n1 2 2 1 \n6\n1 2 3 4 5 6 \n1\n1 1 1 1 1 \n4\n1 1 1 1 1 2 3 4 \n"}, {"type": "stdin_stdout", "input": "4\n4\n0011\n6\n111111\n5\n10101\n8\n01010000\n", "output": "2\n1 2 2 1 \n6\n1 2 3 4 5 6 \n1\n1 1 1 1 1 \n4\n1 1 1 1 1 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA Little Elephant from the Zoo of Lviv likes lucky strings, i.e., the strings that consist only of the lucky digits 4 and 7.\n\nThe Little Elephant has K favorite lucky strings A_{1}, A_{2}, ..., A_{K}. He thinks that the...
[{"type": "stdin_stdout", "input": "2 4\n2\n752\n25003\n1329\n10896\n39952297003683893618248919566249112695937429123", "output": "Good\nGood\nBad\nGood\n"}, {"type": "stdin_stdout", "input": "2 4\n1\n752\n28466\n1329\n10896\n95142413585696281004906476796906063037090967865", "output": "Bad\nGood\nGood\nGood\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n\"Search\" is an operation to obtain the desired information from a large amount of information. Familiar examples include \"finding your own exam number from a large number of exam numbers\" when announcing your success,...
[{"type": "stdin_stdout", "input": "7\n11\n15\n-2\n53\n51\n17\n109\n42\n4\n1\n2\n3\n10\n-1\n0", "output": "3\n2\n"}, {"type": "stdin_stdout", "input": "7\n11\n15\n-2\n53\n51\n17\n109\n42\n4\n1\n2\n3\n10\n-2\n0", "output": "3\n2\n"}, {"type": "stdin_stdout", "input": "7\n11\n15\n-2\n53\n51\n17\n109\n42\n4\n2\n2\n3\n10\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is a string S. Each character in S is either a digit (0, ..., 9) or ?.\nAmong the integers obtained by replacing each occurrence of ? with a digit, how many have a remainder of 5 when divided by 13? An integer may b...
[{"type": "stdin_stdout", "input": "???????????????2?????????????8???????????6????????5?6?5????1???8????1???????????????????????????????????3??????9????????????3??6???????????6???????????????????3???????????9???????3????6?5?????????????????2???????????5418??????????8????????9????????????0????????????????????????9??????...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVitya has just started learning Berlanese language. It is known that Berlanese uses the Latin alphabet. Vowel letters are \"a\", \"o\", \"u\", \"i\", and \"e\". Other letters are consonant.\n\nIn Berlanese, there has to b...
[{"type": "stdin_stdout", "input": "auuaoonntanonnuewannnnpuuinniwoonennyolonnnvienonpoujinndinunnenannmuveoiuuhikucuziuhunnnmunzancenen\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "auuaoonntanonnuewannnnpuuinniwoonennyolonnnvienonpoujinndinunnenannmuveoiuuhikucuziuhunnnmunzancenen\n", "output": "YES\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBob is about to take a hot bath. \n\nThere are two taps to fill the bath: a hot water tap and a cold water tap. The cold water's temperature is t1, and the hot water's temperature is t2. The cold water tap can transmit an...
[{"type": "stdin_stdout", "input": "1000000 1000000 1000000 1000000 1000000\n", "output": "1000000 1000000\n"}, {"type": "stdin_stdout", "input": "1000000 1000000 999999 999998 1000000\n", "output": "999999 999998\n"}, {"type": "stdin_stdout", "input": "129630 805489 631548 761110 577559\n", "output": "227930 447929\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given four integers $a$, $b$, $x$ and $y$. Initially, $a \\ge x$ and $b \\ge y$. You can do the following operation no more than $n$ times:\n\n Choose either $a$ or $b$ and decrease it by one. However, as a resul...
[{"type": "stdin_stdout", "input": "7\n10 10 8 5 3\n12 8 8 7 2\n12343 43 4543 39 123212\n1000000000 1000000000 1 1 1\n1000000000 1000000000 1 1 1000000000\n10 11 2 1 5\n10 11 9 1 10\n", "output": "70\n77\n177177\n999999999000000000\n999999999\n55\n10\n"}, {"type": "stdin_stdout", "input": "7\n10 10 8 5 3\n12 8 0 7 2\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe grasshopper is located on the numeric axis at the point with coordinate $x_0$.\n\nHaving nothing else to do he starts jumping between integer points on the axis. Making a jump from a point with coordinate $x$ with a d...
[{"type": "stdin_stdout", "input": "9\n0 1\n0 2\n10 10\n10 197\n177 25\n10000000000 1895528572\n-433494437 87178291199\n1 0\n-1 1\n", "output": "-1\n1\n11\n-187\n202\n10000000000\n-87611785637\n1\n0\n"}, {"type": "stdin_stdout", "input": "9\n0 1\n0 2\n10 11\n10 197\n177 25\n10000000000 1895528572\n-433494437 8717829119...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Artem likes electronics. He can spend lots of time making different schemas and looking for novelties in the nearest electronics store. The new control element was delivered to the store recently and Artem immediat...
[{"type": "stdin_stdout", "input": "13 21 1\n2 11\n", "output": "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is a string S of length N-1. Each character in S is `<` or `>`.\n\nA sequence of N non-negative integers, a_1,a_2,\\cdots,a_N, is said to be good when the following condition is satisfied for all i (1 \\leq i \\leq ...
[{"type": "stdin_stdout", "input": "<>>><<<<<><<>>><", "output": "29\n"}, {"type": "stdin_stdout", "input": "<>>>><<<<><<<>><", "output": "28\n"}, {"type": "stdin_stdout", "input": "<>><<<><<<<>>>><", "output": "26\n"}, {"type": "stdin_stdout", "input": "<<>><<><<<<>>>><", "output": "24\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA non-empty string is called palindrome, if it reads the same from the left to the right and from the right to the left. For example, \"abcba\", \"a\", and \"abba\" are palindromes, while \"abab\" and \"xy\" are not.\n\nA...
[{"type": "stdin_stdout", "input": "21\narozaupalanalapuazora\n", "output": "aaaaaaaallnoopprruuzz\n"}, {"type": "stdin_stdout", "input": "16\ngagadbcgghhchbdf\n", "output": "aabbccddfgggghhh\n"}, {"type": "stdin_stdout", "input": "15\nabacabadabacaba\n", "output": "aaaaaaaabbbbccd\n"}, {"type": "stdin_stdout", "input"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNezzar's favorite digit among $1,\\ldots,9$ is $d$. He calls a positive integer lucky if $d$ occurs at least once in its decimal representation.\n\nGiven $q$ integers $a_1,a_2,\\ldots,a_q$, for each $1 \\le i \\le q$ Nezz...
[{"type": "stdin_stdout", "input": "2\n3 3\n24 21 27\n10 4\n74 13 26 95 102 51 34 58 42 60\n", "output": "YES\nYES\nYES\nYES\nNO\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "2\n3 3\n27 21 27\n10 4\n74 13 26 95 102 51 34 58 42 60\n", "output": "YES\nYES\nYES\nYES\nNO\nYES\nYES\nYES\nYE...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThanos wants to destroy the avengers base, but he needs to destroy the avengers along with their base.\n\nLet we represent their base with an array, where each position can be occupied by many avengers, but one avenger ca...
[{"type": "stdin_stdout", "input": "5 3 10000 3241\n5 12 2\n", "output": "58892\n"}, {"type": "stdin_stdout", "input": "5 3 3521 10000\n5 12 2\n", "output": "58168\n"}, {"type": "stdin_stdout", "input": "5 3 10000 2737\n5 12 2\n", "output": "52844\n"}, {"type": "stdin_stdout", "input": "5 3 3521 10010\n5 12 2\n", "outp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlan decided to get in shape for the summer, so he created a precise workout plan to follow. His plan is to go to a different gym every day during the next N days and lift $X[i]$ grams on day $i$. In order to improve his ...
[{"type": "stdin_stdout", "input": "5 00000\n10000 30000 30000 40000 19505\n27261\n14 2 8 5 6\n", "output": "16\n"}, {"type": "stdin_stdout", "input": "5 00000\n10000 30000 30000 40000 19505\n27261\n14 0 8 5 6\n", "output": "14\n"}, {"type": "stdin_stdout", "input": "5 10000\n10000 40000 30000 30000 20000\n10000\n5 2 8...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe dragon and the princess are arguing about what to do on the New Year's Eve. The dragon suggests flying to the mountains to watch fairies dancing in the moonlight, while the princess thinks they should just go to bed e...
[{"type": "stdin_stdout", "input": "267 111\n", "output": "0.7727518243505415\n"}, {"type": "stdin_stdout", "input": "768 487\n", "output": "0.7203654732552364\n"}, {"type": "stdin_stdout", "input": "377 205\n", "output": "0.7393583121158366\n"}, {"type": "stdin_stdout", "input": "815 180\n", "output": "0.8467179193191...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDescription:\n\nThe mean (or average) is the most popular measure of central tendency; however it does not behave very well when the data is skewed (i.e. wages distribution). In such cases, it's better to use the median.\...
[{"input": "[10, 29, 23, 94, 76, 96, 5, 85, 4, 33, 47, 41, 87]", "output": "[41]", "fn_name": "median"}, {"input": "[3, 4, 1, 2, 5]", "output": "[3]", "fn_name": "median"}, {"input": "[1, 2, 3, 4]", "output": "[2.5]", "fn_name": "median"}, {"input": "[1, -1]", "output": "[0]", "fn_name": "median"}, {"input": "[1]", "ou...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nProfessor Dumbledore is helping Harry destroy the Horcruxes. He went to Gaunt Shack as he suspected a Horcrux to be present there. He saw Marvolo Gaunt's Ring and identified it as a Horcrux. Although he destroyed it, he i...
[{"type": "stdin_stdout", "input": "43 959134961 -868367850 142426380\n921743429 63959718 -797293233 122041422 -407576197 700139744 299598010 168207043 362252658 591926075 941946099 812263640 -76679927 -824267725 89529990 -73303355 83596189 -982699817 -235197848 654773327 125211479 -497091570 -2301804 203486596 -126652...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarpus has got n candies and m friends (n ≥ m). He wants to make a New Year present with candies to each friend. Polycarpus is planning to present all candies and he wants to do this in the fairest (that is, most equa...
[{"type": "stdin_stdout", "input": "100 100\n", "output": "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 1 1 1 1 "}, {"type": "stdin_stdout", "input": "100 100\n", "output": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Task\n Timed Reading is an educational tool used in many schools to improve and advance reading skills. A young elementary student has just finished his very first timed reading exercise. Unfortunately he's not a very g...
[{"input": "5\n\"Now and then, however, he is horribly thoughtless, and seems to take a real delight in giving me pain.\"", "output": "[14]", "fn_name": "timed_reading"}, {"input": "6\n\"Zebras evolved among the Old World horses within the last four million years.\"", "output": "[11]", "fn_name": "timed_reading"}, {"in...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn Byteland they have a very strange monetary system.\n\nEach Bytelandian gold coin has an integer number written on it. A coin n\ncan be exchanged in a bank into three coins: n/2, n/3 and n/4.\nBut these numbers are all ...
[{"type": "stdin_stdout", "input": "12\n10", "output": "13\n10\n"}, {"type": "stdin_stdout", "input": "12\n19", "output": "13\n19\n"}, {"type": "stdin_stdout", "input": "12\n11", "output": "13\n11\n"}, {"type": "stdin_stdout", "input": "12\n21", "output": "13\n22\n"}, {"type": "stdin_stdout", "input": "12\n27", "output...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSherlock Holmes and Dr. Watson played some game on a checkered board n × n in size. During the game they put numbers on the board's squares by some tricky rules we don't know. However, the game is now over and each square...
[{"type": "stdin_stdout", "input": "12\n8 42 23 20 39 5 23 86 26 65 93 82\n48 35 12 4 59 19 19 28 38 81 97 99\n93 24 31 44 97 50 44 99 50 7 10 64\n79 43 65 29 84 43 46 41 89 16 6 1\n34 90 33 1 7 12 46 84 67 30 1 58\n58 21 100 66 56 22 7 24 72 73 86 37\n2 17 85 6 2 73 85 44 43 79 34 65\n3 53 29 76 87 2 27 19 11 42 71 38...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTheory\n This section does not need to be read and can be skipped, but it does provide some clarity into the inspiration behind the problem.\nIn music theory, a major scale consists of seven notes, or scale degrees, in or...
[{"input": "[-11, -9, -7, -6, -4, -2, 0, 1, 3, 6, 8, 10, 12, 13, 15]", "output": "[true]", "fn_name": "is_tune"}, {"input": "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]", "output": "[false]", "fn_name": "is_tune"}, {"input": "[-4, -2, 0, 1, 3, 6, 8, 10, 12, 13, 15]", "output": "[true]", "fn_name": "is_tune"}, {"input": "[1...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nBackground\n\nThe kindergarten attached to the University of Aizu is a kindergarten where children who love programming gather. Yu, one of the kindergarten children, loves darts as much as programming. Yu-kun was addicted...
[{"type": "stdin_stdout", "input": "4 3 4 2\n3 1\n0 1\n3 3\n1 5\n4 2\n2 0\n5 0\n4 0\n3 2\n3 3\n4 3\n6 0\n6 10\n4 1\n3 4\n4 4\n5 10\n2 9", "output": "0.7490695671\n"}, {"type": "stdin_stdout", "input": "4 3 4 2\n3 1\n0 1\n3 3\n1 5\n4 2\n3 0\n5 0\n4 0\n3 2\n3 0\n4 3\n6 0\n6 10\n4 1\n3 4\n4 4\n5 10\n2 9", "output": "0.400...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have $2n$ integers $1, 2, \\dots, 2n$. You have to redistribute these $2n$ elements into $n$ pairs. After that, you choose $x$ pairs and take minimum elements from them, and from the other $n - x$ pairs, you take maxi...
[{"type": "stdin_stdout", "input": "3\n1\n1\n5\n1 4 5 9 10\n2\n3 4\n", "output": "\n1\n3\n1\n"}, {"type": "stdin_stdout", "input": "3\n1\n1\n5\n1 4 5 9 10\n2\n3 4\n", "output": "1\n3\n1\n"}, {"type": "stdin_stdout", "input": "3\n1\n1\n5\n1 4 5 9 10\n2\n1 4\n", "output": "1\n3\n1\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOn a two-dimensional plane, there are N red points and N blue points.\nThe coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i).\nA red point and a blue point can for...
[{"type": "stdin_stdout", "input": "5\n0 0\n4 1\n5 5\n6 6\n13 11\n2 2\n6 3\n-1 4\n8 4\n14 17", "output": "3\n"}, {"type": "stdin_stdout", "input": "5\n0 0\n4 1\n5 5\n6 6\n13 11\n2 2\n6 3\n-1 4\n8 4\n9 17", "output": "3\n"}, {"type": "stdin_stdout", "input": "5\n0 0\n4 1\n5 5\n6 6\n13 11\n2 2\n8 3\n-1 4\n14 4\n9 4", "ou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWhen the curtains are opened, a canvas unfolds outside. Kanno marvels at all the blonde colours along the riverside — not tangerines, but blossoms instead.\n\n\"What a pity it's already late spring,\" sighs Mino with regr...
[{"type": "stdin_stdout", "input": ".CAACCBBA.CBB.AC..BABCCBCCB..B.BC..CBC.CA.CC.C.CC.B.A.CC.BBCCBB..ACAACAC.CBCCB.AABAAC.CBCC.BA..CCBC.\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "CC.AAAC.BA.BBB.AABABBCCAA.A.CBCCB.B.BC.ABCBCBBAA.CACA.CCCA.CB.CCB.A.BCCCB...C.A.BCCBC..B.ABABB.C.BCB\n", "output": "Yes\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFind the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.\n\nConstraints\n\n* 1\\leq N \\leq 10^{16}\n* N is an integer.\n\nInput\n\nInput is given from Standard Input in the follo...
[{"type": "stdin_stdout", "input": "1265641936938969", "output": "135\n"}, {"type": "stdin_stdout", "input": "2005985506723837", "output": "136\n"}, {"type": "stdin_stdout", "input": "5193523582167964", "output": "139\n"}, {"type": "stdin_stdout", "input": "4944180382968715", "output": "138\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAttention: we lost all the test cases for this problem, so instead of solving the problem, we need you to generate test cases. We're going to give you the answer, and you need to print a test case that produces the given ...
[{"type": "stdin_stdout", "input": "100000\n", "output": "199998 2\n1 2\n"}, {"type": "stdin_stdout", "input": "99991\n", "output": "199980 2\n1 2\n"}, {"type": "stdin_stdout", "input": "99992\n", "output": "199982 2\n1 2\n"}, {"type": "stdin_stdout", "input": "99971\n", "output": "199940 2\n1 2\n"}, {"type": "stdin_st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBerland has n cities, the capital is located in city s, and the historic home town of the President is in city t (s ≠ t). The cities are connected by one-way roads, the travel time for each of the road is a positive integ...
[{"type": "stdin_stdout", "input": "2 9 1 2\n1 2 1000000\n1 2 1000000\n1 2 1100000\n1 2 1000000\n1 2 2\n1 2 1000000\n1 2 1000000\n1 2 1000000\n1 2 1000000\n", "output": "CAN 999999\nCAN 999999\nCAN 1099999\nCAN 999999\nYES\nCAN 999999\nCAN 999999\nCAN 999999\nCAN 999999\n"}, {"type": "stdin_stdout", "input": "2 9 1 2\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N rabbits, numbered 1, 2, \\ldots, N.\n\nFor each i, j (1 \\leq i, j \\leq N), the compatibility of Rabbit i and j is described by an integer a_{i, j}. Here, a_{i, i} = 0 for each i (1 \\leq i \\leq N), and a_{i...
[{"type": "stdin_stdout", "input": "16\n0 5 -4 -5 -8 -4 7 2 -4 0 7 0 2 -3 7 7\n5 0 8 -9 3 5 2 -7 2 -7 0 -1 -4 1 -1 9\n-4 8 0 -9 8 9 3 1 4 9 6 6 -6 1 8 9\n-5 -9 -9 0 -7 6 4 -1 9 -3 -5 0 1 2 -4 1\n-8 3 8 -7 0 -5 -9 9 1 -9 -6 -3 -8 3 4 3\n-4 5 9 6 -5 0 -6 1 -2 2 0 -5 -2 3 1 2\n7 2 3 4 -9 -6 0 -2 -2 -9 -3 9 -2 9 2 -5\n2 -7...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have managed to intercept an important message and you are trying to read it.\n\nYou realise that the message has been encoded and can be decoded by switching each letter with a corresponding letter.\n\nYou also notic...
[{"input": "\"qzezxirkg rh z srts ovevo wbmznrx fmgbkvw zmw rmgvikivgvw kiltiznnrmt ozmtfztv rg szh yvvm hgzmwziwravw rm gsv vxnzxirkg ozmtfztv hkvxrurxzgrlm zolmthrwv sgno zmw xhh rg rh lmv lu gsv gsivv vhhvmgrzo gvxsmloltrvh lu dliow drwv dvy xlmgvmg kilwfxgrlm gsv nzqlirgb lu dvyhrgvh vnkolb rg zmw rg rh hfkkligvw y...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program that will take a string of digits and give you all the possible consecutive slices of length `n` in that string.\n\nRaise an error if `n` is larger than the length of the string.\n\n\n## Examples\n\nFor ex...
[{"input": "\"01234\"\n3", "output": "[[[0, 1, 2], [1, 2, 3], [2, 3, 4]]]", "fn_name": "series_slices"}, {"input": "\"01234\"\n2", "output": "[[[0, 1], [1, 2], [2, 3], [3, 4]]]", "fn_name": "series_slices"}, {"input": "\"01234\"\n4", "output": "[[[0, 1, 2, 3], [1, 2, 3, 4]]]", "fn_name": "series_slices"}, {"input": "\"...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this Kata, you will be given a string of numbers in sequence and your task will be to return the missing number. If there is no number\nmissing or there is an error in the sequence, return `-1`.\n\nFor example:\n```Has...
[{"input": "\"900001900002900004900005900006\"", "output": "[900003]", "fn_name": "missing"}, {"input": "\"998999100010011003\"", "output": "[1002]", "fn_name": "missing"}, {"input": "\"99991000110002\"", "output": "[10000]", "fn_name": "missing"}, {"input": "\"979899100101102\"", "output": "[-1]", "fn_name": "missing"...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nWhen working with color values it can sometimes be useful to extract the individual red, green, and blue (RGB) component values for a color. Implement a function that meets these requirements:\n\n+ Accepts a case-insensit...
[{"input": "\"#beaded\"", "output": "[{\"r\": 190, \"g\": 173, \"b\": 237}]", "fn_name": "hex_string_to_RGB"}, {"input": "\"#FF9933\"", "output": "[{\"r\": 255, \"g\": 153, \"b\": 51}]", "fn_name": "hex_string_to_RGB"}, {"input": "\"#Fa3456\"", "output": "[{\"r\": 250, \"g\": 52, \"b\": 86}]", "fn_name": "hex_string_to...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nSasha and Kolya decided to get drunk with Coke, again. This time they have k types of Coke. i-th type is characterised by its carbon dioxide concentration $\\frac{a_{i}}{1000}$. Today, on the party in honour of Sergiy of ...
[{"type": "stdin_stdout", "input": "971 108\n706 706 991 706 988 997 996 997 991 996 706 706 996 706 996 984 1000 991 996 1000 724 724 997 991 997 984 997 1000 984 996 996 997 724 997 997 1000 997 724 984 997 996 988 997 706 706 997 1000 991 706 988 997 724 988 706 996 706 724 997 988 996 991 1000 1000 724 988 996 1000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGenos needs your help. He was asked to solve the following programming problem by Saitama:\n\nThe length of some string s is denoted |s|. The Hamming distance between two strings s and t of equal length is defined as $\\s...
[{"type": "stdin_stdout", "input": "1001101001101110101101000\n01111000010011111111110010001101000100011110101111\n", "output": "321\n"}, {"type": "stdin_stdout", "input": "1110010001000101001011111\n00011011000000100001010000010100110011010001111010\n", "output": "316\n"}, {"type": "stdin_stdout", "input": "1001101001...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter a probationary period in the game development company of IT City Petya was included in a group of the programmers that develops a new turn-based strategy game resembling the well known \"Heroes of Might & Magic\". A...
[{"type": "stdin_stdout", "input": "1000000000\n", "output": "3000000003000000001\n"}, {"type": "stdin_stdout", "input": "1147564610\n", "output": "3950713605816050131\n"}, {"type": "stdin_stdout", "input": "1000010000\n", "output": "3000060003300030001\n"}, {"type": "stdin_stdout", "input": "1065935402\n", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Chris is participating in a graph cutting contest. He's a pro. The time has come to test his skills to the fullest.\n\nChris is given a simple undirected connected graph with n vertices (numbered from 1 to n) and m...
[{"type": "stdin_stdout", "input": "8 30\n10 4\n3 8\n3 2\n10 1\n3 5\n3 4\n5 1\n8 2\n8 4\n3 10\n7 9\n3 6\n9 5\n5 10\n7 6\n7 5\n9 1\n2 7\n9 10\n1 4\n9 8\n6 2\n2 1\n7 1\n6 4\n4 5\n2 14\n10 8\n7 8\n5 2\n", "output": "3 5 1\n10 5 7\n4 5 2\n5 9 1\n10 9 8\n3 6 2\n4 6 7\n9 7 1\n8 7 2\n3 2 1\n14 2 8\n4 8 10\n8 3 10\n3 4 1\n4 10...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA bracket sequence is a string, containing only characters \"(\", \")\", \"[\" and \"]\".\n\nA correct bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting chara...
[{"type": "stdin_stdout", "input": "[()][([[]])][[[]()]][()[]]()()([[][]][[]][](()))[[[(())]]][]()(([([])(([[[]]()])(()))]((())))([()]([()[[[]([][[[[][(())([[]()])]]][[(())]([])]()][[](())]()[])]()[][]]([[]])[]])[(()[()((()[][()]))][])[]()()([]())](()[][][])()()[]()))[]()[]\n", "output": "61\n[()][([[]])][[[]()]][()[]]...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAllen and Bessie are playing a simple number game. They both know a function f: \\{0, 1\\}^n → R, i. e. the function takes n binary arguments and returns a real value. At the start of the game, the variables x_1, x_2, ......
[{"type": "stdin_stdout", "input": "2 2\n0 1 2 3\n2 5\n0 4\n", "output": "1.5000000000\n2.2500000000\n3.2500000000\n"}, {"type": "stdin_stdout", "input": "2 2\n0 2 0 3\n2 0\n0 13\n", "output": "1.25\n1.25\n4.5\n"}, {"type": "stdin_stdout", "input": "2 2\n0 1 2 2\n2 2\n0 2\n", "output": "1.25\n1.25\n1.75\n"}, {"type": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nThere are the following games.\n\nN characters are lined up in a vertical row. The color of these characters is red, blue, or yellow, and in the initial state, four or more characters of the same color are not ...
[{"type": "stdin_stdout", "input": "12\n3\n2\n1\n1\n1\n3\n2\n1\n2\n1\n1\n5\n2\n3\n2\n1\n2\n2\n5\n0\n0\n3\n2\n-1\n0\n0", "output": "8\n2\n1\n2\n"}, {"type": "stdin_stdout", "input": "12\n3\n2\n1\n1\n1\n3\n2\n2\n2\n2\n1\n5\n2\n3\n2\n1\n2\n2\n5\n1\n0\n3\n2\n-1\n0\n0", "output": "3\n2\n1\n2\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n sheets of square paper of the same size. Align the bottom of these papers horizontally and arrange them in several rows. However, adjacent rows must be arranged so that the left side is not lower than the righ...
[{"type": "stdin_stdout", "input": "5\n29\n0", "output": "5\n4 1\n3 2\n3 1 1\n2 2 1\n2 1 1 1\n1 1 1 1 1\n29\n28 1\n27 2\n27 1 1\n26 3\n26 2 1\n26 1 1 1\n25 4\n25 3 1\n25 2 2\n25 2 1 1\n25 1 1 1 1\n24 5\n24 4 1\n24 3 2\n24 3 1 1\n24 2 2 1\n24 2 1 1 1\n24 1 1 1 1 1\n23 6\n23 5 1\n23 4 2\n23 4 1 1\n23 3 3\n23 3 2 1\n23 3 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Definition\n\nAn **_element is leader_** *if it is greater than The Sum all the elements to its right side*.\n____\n\n# Task\n\n**_Given_** an *array/list [] of integers* , **_Find_** *all the **_LEADERS_** in the array...
[{"input": "[0, -1, -29, 3, 2]", "output": "[[0, -1, 3, 2]]", "fn_name": "array_leaders"}, {"input": "[16, 17, 4, 3, 5, 2]", "output": "[[17, 5, 2]]", "fn_name": "array_leaders"}, {"input": "[-36, -12, -27]", "output": "[[-36, -12]]", "fn_name": "array_leaders"}, {"input": "[-1, -29, -26, -2]", "output": "[[-1]]", "fn_...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor given two circles $c1$ and $c2$, print\n\n\n4\n\n\nif they do not cross (there are 4 common tangent lines),\n\n\n3\n\n\nif they are circumscribed (there are 3 common tangent lines),\n\n\n2\n\n\nif they intersect (ther...
[{"type": "stdin_stdout", "input": "-26 -2 -2\n15 2 -1", "output": "4\n"}, {"type": "stdin_stdout", "input": "-26 -2 -2\n15 2 -2", "output": "4\n"}, {"type": "stdin_stdout", "input": "-26 -2 -1\n15 2 -2", "output": "4\n"}, {"type": "stdin_stdout", "input": "-26 -2 -1\n21 2 -2", "output": "4\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIahub recently has learned Bubble Sort, an algorithm that is used to sort a permutation with n elements a_1, a_2, ..., a_{n} in ascending order. He is bored of this so simple algorithm, so he invents his own graph. The gr...
[{"type": "stdin_stdout", "input": "100\n36 48 92 87 28 85 42 10 44 41 39 3 79 9 14 56 1 16 46 35 93 8 82 26 100 59 60 2 96 52 13 98 70 81 71 94 54 91 17 88 33 30 19 50 18 73 65 29 78 21 61 7 99 97 45 89 57 27 76 11 49 72 84 69 43 62 4 22 75 6 66 83 38 34 86 15 40 51 37 74 67 31 20 63 77 80 12 53 5 25 58 90 68 24 64 23...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are an immigration officer in the Kingdom of AtCoder. The document carried by an immigrant has some number of integers written on it, and you need to check whether they meet certain criteria.\n\nAccording to the regul...
[{"type": "stdin_stdout", "input": "5\n-1 -1 1 1 321", "output": "APPROVED\n"}, {"type": "stdin_stdout", "input": "5\n-1 -1 1 1 337", "output": "APPROVED\n"}, {"type": "stdin_stdout", "input": "5\n-1 -1 1 1 200", "output": "APPROVED\n"}, {"type": "stdin_stdout", "input": "5\n-1 -1 1 1 385", "output": "APPROVED\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn mathematics, the Pythagorean theorem — is a relation in Euclidean geometry among the three sides of a right-angled triangle. In terms of areas, it states:\n\n In any right-angled triangle, the area of the square whose...
[{"type": "stdin_stdout", "input": "10000\n", "output": "12471\n"}, {"type": "stdin_stdout", "input": "9999\n", "output": "12467\n"}, {"type": "stdin_stdout", "input": "10000\n", "output": "12471"}, {"type": "stdin_stdout", "input": "9999\n", "output": "12467"}, {"type": "stdin_stdout", "input": "1000\n", "output": "88...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi the Jumbo will practice golf.\nHis objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).\nIf he can achieve the objective, print OK...
[{"type": "stdin_stdout", "input": "1000\n2 1000\n", "output": "OK\n"}, {"type": "stdin_stdout", "input": "279\n691 872\n", "output": "OK\n"}, {"type": "stdin_stdout", "input": "379\n400 757\n", "output": "NG\n"}, {"type": "stdin_stdout", "input": "1000\n1 999\n", "output": "NG\n"}, {"type": "stdin_stdout", "input": "1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs you probably know, Anton goes to school. One of the school subjects that Anton studies is Bracketology. On the Bracketology lessons students usually learn different sequences that consist of round brackets (characters ...
[{"type": "stdin_stdout", "input": "((((()())))())((((((()(()())(()())()((()()))(((())()()()(())))))()())())))(()()(()))))()(((()(((())()))())())))))(()()()((((((())(()())())()())(()))))()(()))(((()()()))())()(((()(()(((()))(()))()(()))((((((((())))))()))())(())))))()(()(()(((()((()()()())(((())())((()())(((((()()(())(...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given $n$ integers $a_1, a_2, \\ldots, a_n$. Find the maximum value of $max(a_l, a_{l + 1}, \\ldots, a_r) \\cdot min(a_l, a_{l + 1}, \\ldots, a_r)$ over all pairs $(l, r)$ of integers for which $1 \\le l < r \\le ...
[{"type": "stdin_stdout", "input": "4\n3\n2 3 3\n4\n3 0 10 1\n2\n359 139\n6\n229275 372495 402638 1125346 388084 422281\n", "output": "9\n10\n49901\n453107062748\n"}, {"type": "stdin_stdout", "input": "4\n3\n2 5 3\n4\n3 0 12 1\n2\n359 80\n6\n229275 718820 272407 1125346 388084 775159\n", "output": "15\n12\n28720\n43672...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConsider 2n rows of the seats in a bus. n rows of the seats on the left and n rows of the seats on the right. Each row can be filled by two people. So the total capacity of the bus is 4n.\n\nConsider that m (m ≤ 4n) peopl...
[{"type": "stdin_stdout", "input": "100 400\n", "output": "201 1 202 2 203 3 204 4 205 5 206 6 207 7 208 8 209 9 210 10 211 11 212 12 213 13 214 14 215 15 216 16 217 17 218 18 219 19 220 20 221 21 222 22 223 23 224 24 225 25 226 26 227 27 228 28 229 29 230 30 231 31 232 32 233 33 234 34 235 35 236 36 237 37 238 38 239 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nJulia is going to cook a chicken in the kitchen of her dormitory. To save energy, the stove in the kitchen automatically turns off after k minutes after turning on.\n\nDuring cooking, Julia goes to the kitchen every d min...
[{"type": "stdin_stdout", "input": "1000000000000000000 1001000000000000000 1000000000000000000\n", "output": "1000000000000000000.000000000000000\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000 1000000000000000000\n", "output": "1000000000000000000.000000000000000"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRegex Failure - Bug Fixing #2\nOh no, Timmy's received some hate mail recently but he knows better. Help Timmy fix his regex filter so he can be awesome again!\n\nWrite your solution by modifying this code:\n\n```python\n...
[{"input": "\"You're HiDeOuS!! timmy!\"", "output": "[\"You're awesome!! timmy!\"]", "fn_name": "filter_words"}, {"input": "\"You're horrible! timmy!\"", "output": "[\"You're awesome! timmy!\"]", "fn_name": "filter_words"}, {"input": "\"You're UGLY!! timmy!\"", "output": "[\"You're awesome!! timmy!\"]", "fn_name": "fil...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day Vasya was going home when he saw a box lying on the road. The box can be represented as a rectangular parallelepiped. Vasya needed no time to realize that the box is special, as all its edges are parallel to the c...
[{"type": "stdin_stdout", "input": "-827584 -680412 -103147\n897186 313672 388429\n892050 717946 505625 200144 311983 606037\n", "output": "1709658\n"}, {"type": "stdin_stdout", "input": "-827584 -680412 -103147\n897186 313672 388429\n892050 717946 505625 278931 311983 606037\n", "output": "1709658\n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarpus has n markers and m marker caps. Each marker is described by two numbers: xi is the color and yi is the diameter. Correspondingly, each cap is described by two numbers: aj is the color and bj is the diameter. C...
[{"type": "stdin_stdout", "input": "6 7\n2 1\n1 1\n2 2\n1 2\n1 1\n1 2\n2 1\n1 1\n1 1\n1 1\n1 2\n2 2\n1 1\n", "output": "5 5\n"}, {"type": "stdin_stdout", "input": "6 7\n1 1\n1 1\n1 2\n1 2\n2 2\n1 2\n2 1\n2 1\n2 1\n2 1\n1 1\n1 1\n1 2\n", "output": "3 3\n"}, {"type": "stdin_stdout", "input": "6 7\n2 1\n2 2\n2 1\n1 1\n2 1...
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 ≤ n, m ≤ 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,...,a_n] of length n. Its s...
[{"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 2 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\nRead problems statements in Mandarin Chinese and Russian as well. \nYour friend Сhef has prepared a rectangular cake for you. Both of you want to divide the cake among yourselves. Your friend is generous enough to let you...
[{"type": "stdin_stdout", "input": "2\n1 1 10 32\n11 11 20 20\n1 1 20 20\n11 11 30 76", "output": "360\n1515\n"}, {"type": "stdin_stdout", "input": "2\n1 1 10 10\n11 7 20 20\n1 1 20 20\n11 11 30 55", "output": "198\n1116\n"}, {"type": "stdin_stdout", "input": "2\n1 1 10 20\n11 7 20 20\n1 1 20 20\n11 11 30 55", "output"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this problem we consider a very simplified model of Barcelona city.\n\nBarcelona can be represented as a plane with streets of kind x = c and y = c for every integer c (that is, the rectangular grid). However, there is...
[{"type": "stdin_stdout", "input": "912738218 530309782 -939253776\n592805323 -930297022 -567581994 -829432319\n", "output": "1218437463.3854325\n"}, {"type": "stdin_stdout", "input": "137446306 341377513 -633738092\n244004352 -854692242 60795776 822516783\n", "output": "1800945736.2511592\n"}, {"type": "stdin_stdout",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA country called Berland consists of n cities, numbered with integer numbers from 1 to n. Some of them are connected by bidirectional roads. Each road has some length. There is a path from each city to any other one by th...
[{"type": "stdin_stdout", "input": "10 45 9\n2 1 428\n3 1 610\n3 2 357\n4 1 855\n4 2 528\n4 3 508\n5 1 425\n5 2 185\n5 3 349\n5 4 845\n6 1 206\n6 2 969\n6 3 153\n6 4 854\n6 5 640\n7 1 87\n7 2 250\n7 3 953\n7 4 456\n7 5 742\n7 6 588\n8 1 641\n8 2 898\n8 3 396\n8 4 960\n8 5 654\n8 6 410\n8 7 640\n9 1 707\n9 2 707\n9 3 70...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given $n$ elements numbered from $1$ to $n$, the element $i$ has value $a_i$ and color $c_i$, initially, $c_i = 0$ for all $i$.\n\nThe following operation can be applied:\n\nSelect three elements $i$, $j$ and $k$ ...
[{"type": "stdin_stdout", "input": "13\n1 2 3 2 1 3 3 4 5 5 5 4 7\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "7\n1 2 1 2 7 4 7\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "3\n1 1 2\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "3\n1 1 1\n", "output": "1\n"}, {"type": "stdin_stdout", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given n points on the plane. The polygon formed from all the n points is strictly convex, that is, the polygon is convex, and there are no three collinear points (i.e. lying in the same straight line). The points ...
[{"type": "stdin_stdout", "input": "20\n-2967010 48581504\n-2967318 48581765\n-2967443 48581988\n-2967541 48582265\n-2967443 48582542\n-2967318 48582765\n-2967010 48583026\n-2966691 48583154\n-2966252 48583234\n-2965813 48583154\n-2965494 48583026\n-2965186 48582765\n-2965061 48582542\n-2964963 48582265\n-2965061 48581...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIt is the hard version of the problem. The difference is that in this version, there are nodes with already chosen colors.\n\nTheofanis is starving, and he wants to eat his favorite food, sheftalia. However, he should fir...
[{"type": "stdin_stdout", "input": "5\n9\n31 yellow\n30 green\n26 yellow\n13 red\n2 red\n22 white\n12 red\n6 orange\n29 blue\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "5\n9\n31 yellow\n30 green\n26 yellow\n13 red\n2 red\n22 white\n12 red\n6 orange\n29 blue\n", "output": "0\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSnuke has N dogs and M monkeys. He wants them to line up in a row.\n\nAs a Japanese saying goes, these dogs and monkeys are on bad terms. (\"ken'en no naka\", literally \"the relationship of dogs and monkeys\", means a re...
[{"type": "stdin_stdout", "input": "001010 001011", "output": "931093537\n"}, {"type": "stdin_stdout", "input": "000101 000101", "output": "414723868\n"}, {"type": "stdin_stdout", "input": "000110 000111", "output": "399920258\n"}, {"type": "stdin_stdout", "input": "001111 001110", "output": "292820538\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Introduction\n\nThere is a war and nobody knows - the alphabet war! \nThere are two groups of hostile letters. The tension between left side letters and right side letters was too high and the war began. The letters ca...
[{"input": "\"z*dq*mw*pb*s\"", "output": "[\"Let's fight again!\"]", "fn_name": "alphabet_war"}, {"input": "\"zdqmwpbs\"", "output": "[\"Let's fight again!\"]", "fn_name": "alphabet_war"}, {"input": "\"*wwwwww*z*\"", "output": "[\"Left side wins!\"]", "fn_name": "alphabet_war"}, {"input": "\"sz**z**zs\"", "output": "[\...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nOn a chessboard with a width of 10^9 and a height of 10^9, the rows are numbered from bottom to top from 1 to 10^9, and the columns are numbered from left to right from 1 to 10^9. Therefore, for each cell of the chessboar...
[{"type": "stdin_stdout", "input": "0 5\n-1 96762320 34608098\n243235878 312125306 50510976\n326016273 498514053 50510976\n614560077 445224816 25950222\n1077021507 901150398 37242747\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "0 5\n-1 96762320 34608098\n243235878 312125306 50510976\n326016273 498514053 907...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis function should take two string parameters: a person's name (`name`) and a quote of theirs (`quote`), and return a string attributing the quote to the person in the following format:\n\n```python\n'[name] said: \"[qu...
[{"input": "\"Darrell\"\n\"What the heck is this thing?\"", "output": "[\"Darrell said: \\\"What the heck is this thing?\\\"\"]", "fn_name": "quotable"}, {"input": "\"Bethany\"\n\"Yes, way more fun than R\"", "output": "[\"Bethany said: \\\"Yes, way more fun than R\\\"\"]", "fn_name": "quotable"}, {"input": "\"Grae\"\n...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp, Arkady's friend, prepares to the programming competition and decides to write a contest. The contest consists of $n$ problems and lasts for $T$ minutes. Each of the problems is defined by two positive integers $...
[{"type": "stdin_stdout", "input": "2\n4\n1.9585346052548882 31.000\n12 0\n11 6\n30 1\n5 1\n3\n1.360280845492949 30.337801087585063\n0 10\n10 8\n20 8\n", "output": "7\n18\n"}, {"type": "stdin_stdout", "input": "2\n4\n1.557488533293537 31.000\n12 0\n11 6\n30 1\n5 1\n3\n1.360280845492949 30.337801087585063\n0 10\n10 8\n2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProfessor Ibrahim has prepared the final homework for his algorithm’s class. He asked his students to implement the Posterization Image Filter.\n\nTheir algorithm will be tested on an array of integers, where the $i$-th i...
[{"type": "stdin_stdout", "input": "100 10\n39 242 238 155 95 30 129 132 72 59 22 91 203 113 99 81 253 204 160 109 92 187 11 227 145 211 100 42 78 14 113 91 140 197 123 182 4 185 208 27 182 207 63 146 102 39 159 195 26 100 72 127 157 159 152 53 0 117 101 125 19 188 179 145 240 50 205 207 113 246 42 56 161 13 188 244 15...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the city of Ultima Thule job applicants are often offered an IQ test. \n\nThe test is as follows: the person gets a piece of squared paper with a 4 × 4 square painted on it. Some of the square's cells are painted black...
[{"type": "stdin_stdout", "input": "####\n.#..\n####\n....\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "....\n....\n....\n....\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "#..#\n.##.\n####\n####\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "#.#.\n.###\n#.#.\n.###\n", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe hobbits Frodo and Sam are carrying the One Ring to Mordor. In order not to be spotted by orcs, they decided to go through the mountains.\n\nThe mountain relief can be represented as a polyline with n points (x_i, y_i)...
[{"type": "stdin_stdout", "input": "5 9990\n300000 909\n366685 9999\n370849 9998\n379178 9996\n400000 1\n", "output": "25178.6601865589\n"}, {"type": "stdin_stdout", "input": "4 90\n362174 10000\n365957 13123\n373522 9997\n400000 3804\n", "output": "35378.024406478464\n"}, {"type": "stdin_stdout", "input": "4 90\n36217...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNobody knows, but $N$ frogs live in Chef's garden.\nNow they are siting on the X-axis and want to speak to each other. One frog can send a message to another one if the distance between them is less or equal to $K$.\nChef...
[{"type": "stdin_stdout", "input": "5 3 3\n0 3 8 5 12\n1 2\n1 3\n2 5\n", "output": "Yes\nYes\nNo\n"}, {"type": "stdin_stdout", "input": "5 6 3\n0 3 8 8 12\n1 2\n1 3\n2 5", "output": "Yes\nYes\nYes\n"}, {"type": "stdin_stdout", "input": "5 3 3\n0 3 15 8 12\n1 2\n1 3\n3 5", "output": "Yes\nNo\nYes\n"}, {"type": "stdin_st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n[0, 0]\n[0, 1] [1, 1]\n[0, 2] [1, 2] [2, 2]\n[0, 3] [1, 3] [2, 3] [3, 3]\n[0, 4] [1, 4] [2, 4] [3, 4] [4, 4]\n[0, 5] [1, 5] [2, 5] [3, 5] [4, 5] [5, 5]\n[0, 6] [1, 6] [2, 6] [3, 6] [4, 6] [5, 6] [6, 6...
[{"type": "stdin_stdout", "input": "6\n16 23 16 16 15 25\n10\n00 01 11 02 12 22 03 13 13 33", "output": "Yes\nYes\n"}, {"type": "stdin_stdout", "input": "6\n13 23 14 16 15 25\n10\n00 01 11 02 12 30 03 13 36 33", "output": "Yes\nYes\n"}, {"type": "stdin_stdout", "input": "6\n11 23 16 16 15 25\n10\n00 01 11 02 12 22 03 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe squirrel Chokudai has N acorns. One day, he decides to do some trades in multiple precious metal exchanges to make more acorns.\n\nHis plan is as follows:\n\n1. Get out of the nest with N acorns in his hands.\n2. Go t...
[{"type": "stdin_stdout", "input": "23\n1 2 1\n20 1 10", "output": "920\n"}, {"type": "stdin_stdout", "input": "23\n1 2 4\n10 1 4", "output": "460\n"}, {"type": "stdin_stdout", "input": "23\n1 12 1\n1 1 1", "output": "276\n"}, {"type": "stdin_stdout", "input": "23\n2 11 1\n2 1 2", "output": "506\n"}, {"type": "stdin_st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian. \n\nTuzik is a little dog. But despite the fact he is still a puppy he already knows about the pretty things that coins are. He knows that for every coin he can g...
[{"type": "stdin_stdout", "input": "2\n10 16\n14 18", "output": "10\n14\n"}, {"type": "stdin_stdout", "input": "2\n130 45\n4 17", "output": "42\n4\n"}, {"type": "stdin_stdout", "input": "2\n10 4\n21 19", "output": "2\n10\n"}, {"type": "stdin_stdout", "input": "2\n44 45\n2 17", "output": "44\n2\n"}, {"type": "stdin_stdo...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPaul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.\n\nP...
[{"type": "stdin_stdout", "input": "333 9\nedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedce...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn some other world, today is Christmas.\nMr. Takaha decides to make a multi-dimensional burger in his party. A level-L burger (L is an integer greater than or equal to 0) is the following thing:\n - A level-0 burger is a...
[{"type": "stdin_stdout", "input": "50 4321098765432109\n", "output": "2160549382716056\n"}, {"type": "stdin_stdout", "input": "50 2251799813685246\n", "output": "1125899906842623\n"}, {"type": "stdin_stdout", "input": "50 2251799813685247\n", "output": "1125899906842624\n"}, {"type": "stdin_stdout", "input": "50 22517...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a table consisting of n rows and m columns. Each cell of the table contains a number, 0 or 1. In one move we can choose some row of the table and cyclically shift its values either one cell to the left, or o...
[{"type": "stdin_stdout", "input": "10 10\n0000000000\n0000001000\n0000000100\n0101000100\n0000000000\n0000000000\n1000110000\n1011010010\n0000110000\n0000001001\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "10 10\n0000000000\n0000001000\n0000000100\n0101000100\n0000000000\n0000000000\n1000110000\n101101001...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLearn, learn and learn again — Valera has to do this every day. He is studying at mathematical school, where math is the main discipline. The mathematics teacher loves her discipline very much and tries to cultivate this ...
[{"type": "stdin_stdout", "input": "100\n-88 -5 -96 -45 -11 -81 -68 -58 -73 -91 -27 -23 -89 -34 -51 -46 -70 -95 -9 -77 -99 -61 -74 -98 -88 -44 -61 -88 -35 -71 -43 -23 -25 -98 -23 0 -1 -80 -52 -47 -26 -92 -82 -73 -45 -37 -15 -49 -9 -7 -47 0 -6 -76 -91 -20 -58 -46 -74 -57 -54 -39 -61 -18 -65 -61 -19 -64 -93 -29 -82 -25 -...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFormat any integer provided into a string with \",\" (commas) in the correct places.\n\n**Example:**\n``` csharp\nKata.NumberFormat(100000); // return \"100,000\"\nKata.NumberFormat(5678545); // return \"5,678,545\"\nKata...
[{"input": "5678545", "output": "[\"5,678,545\"]", "fn_name": "number_format"}, {"input": "-420902", "output": "[\"-420,902\"]", "fn_name": "number_format"}, {"input": "100000", "output": "[\"100,000\"]", "fn_name": "number_format"}, {"input": "-1003", "output": "[\"-1,003\"]", "fn_name": "number_format"}, {"input": "-...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. \n\nTotally in Berland there are n citizens, the ...
[{"type": "stdin_stdout", "input": "70\n644488 5444 150441 714420 602059 335330 510670 196555 546346 740011 509449 850947 692874 524857 750434 952985 223744 533151 896124 609694 367352 679050 560202 172728 569291 778616 332116 286927 843598 372698 244906 498046 900681 709791 420904 724593 864493 813094 791377 39998 296...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHongcow likes solving puzzles.\n\nOne day, Hongcow finds two identical puzzle pieces, with the instructions \"make a rectangle\" next to them. The pieces can be described by an n by m grid of characters, where the charact...
[{"type": "stdin_stdout", "input": "1 500\n.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMonocarp wants to watch $n$ videos. Each video is only one minute long, but its size may be arbitrary. The $i$-th video has the size $a_i$ megabytes. All videos are published on the Internet. A video should be downloaded ...
[{"type": "stdin_stdout", "input": "6 1000000000\n999999995 999999996 999999997 999999998 999999999 1000000000\n", "output": "5999999991\n"}, {"type": "stdin_stdout", "input": "5 1000000000\n500000000 500000000 500000000 500000000 500000000\n", "output": "2500000001\n"}, {"type": "stdin_stdout", "input": "5 999999999\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPablo Squarson is a well-known cubism artist. This year's theme for Pablo Squarson is \"Squares\". Today we are visiting his studio to see how his masterpieces are given birth.\n\nAt the center of his studio, there is a h...
[{"type": "stdin_stdout", "input": "1\n5\n0 0\n0 -1\n0 2\n0 3\n12\n0 0\n0 0\n2 0\n3 0\n4 1\n5 1\n6 2\n3 2\n8 2\n9 3\n10 3\n10\n0 2\n1 3\n2 2\n3 2\n2 1\n5 1\n6 1\n7 1\n3 0\n0", "output": "1 1\n3 2\n4 5\n4 5\n"}, {"type": "stdin_stdout", "input": "1\n5\n0 -1\n0 1\n0 2\n0 3\n12\n0 0\n1 0\n2 0\n3 1\n4 1\n5 1\n6 2\n7 1\n8 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are appointed director of a famous concert hall, to save it from bankruptcy. The hall is very popular, and receives many requests to use its two fine rooms, but unfortunately the previous director was not very efficie...
[{"type": "stdin_stdout", "input": "4\n1 2 10\n2 3 10\n3 3 10\n1 3 10\n6\n1 20 1000\n5 25 10000\n2 30 8781\n22 300 5500\n10 117 9000\n7 7 2175\n8\n32 251 2396\n132 281 1659\n222 235 5641\n162 217 1883\n22 158 7195\n194 198 9190\n119 274 1469\n122 334 13708\n0", "output": "30\n21175\n35734\n"}, {"type": "stdin_stdout", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a train going from Station A to Station B that costs X yen (the currency of Japan).\nAlso, there is a bus going from Station B to Station C that costs Y yen.\nJoisino got a special ticket. With this ticket, she c...
[{"type": "stdin_stdout", "input": "100 100\n", "output": "150\n"}, {"type": "stdin_stdout", "input": "81 58\n", "output": "110\n"}, {"type": "stdin_stdout", "input": "100 2\n", "output": "101\n"}, {"type": "stdin_stdout", "input": "76 48\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "-1 -17", "output": "-1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the 0 key, the 1 key and the backspace key.\nTo begin with, he is using a plain text editor with this keyboard. This e...
[{"type": "stdin_stdout", "input": "5000\n01000001011101000100001101101111011001000110010101110010000\n", "output": "500886057\n"}, {"type": "stdin_stdout", "input": "5000\n01000001011101010100001101101111011001000110010101110010000", "output": "500886057\n"}, {"type": "stdin_stdout", "input": "5000\n010000010110010101...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDrazil is playing a math game with Varda.\n\nLet's define <image> for positive integer x as a product of factorials of its digits. For example, <image>.\n\nFirst, they choose a decimal number a consisting of n digits that...
[{"type": "stdin_stdout", "input": "15\n989898989898989\n", "output": "777777777777777333333333333333322222222222222222222222222222\n"}, {"type": "stdin_stdout", "input": "15\n999999999999990\n", "output": "77777777777777333333333333333333333333333322222222222222\n"}, {"type": "stdin_stdout", "input": "15\n997953296764...
code_stdio