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\nA fraction whose numerator is 1 and whose denominator is a positive integer is called a unit fraction. A representation of a positive rational number p/q as the sum of finitely many unit fractions is called a partition of... | [{"type": "stdin_stdout", "input": "2 3 120 3\n2 3 300 3\n2 3 299 3\n2 3 12 3\n2 3 12000 7\n54 1343 12000 7\n2 3 300 1\n2 1 200 5\n2 4 54 2\n0 0 0 0", "output": "4\n7\n6\n2\n42\n0\n0\n9\n3\n"}, {"type": "stdin_stdout", "input": "2 3 120 3\n2 3 300 3\n2 3 299 3\n2 3 12 3\n2 3 12000 7\n54 795 12000 7\n2 4 300 1\n2 1 200 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ candies in a row, they are numbered from left to right from $1$ to $n$. The size of the $i$-th candy is $a_i$.\n\nAlice and Bob play an interesting and tasty game: they eat candy. Alice will eat candy from l... | [{"type": "stdin_stdout", "input": "7\n11\n3 1 4 1 5 9 1 4 10 3 5\n1\n1000\n3\n1 2 1\n13\n1 2 3 4 5 6 7 8 9 10 11 12 13\n2\n2 1\n6\n1 1 1 1 1 2\n7\n1 2 1 1 1 1 1\n", "output": "6 23 23\n1 1000 0\n2 1 3\n6 45 46\n2 2 1\n4 4 3\n4 4 4\n"}, {"type": "stdin_stdout", "input": "7\n11\n3 1 4 2 5 9 1 4 10 3 5\n1\n1000\n3\n1 2 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day Alice visited Byteland to purchase jewels for her upcoming wedding anniversary.\nIn Byteland, every Jewelry shop has their own discount methods to attract the customers. One discount method called Buy1-Get1 caught... | [{"type": "stdin_stdout", "input": "4\nssss\nrsas\nsa\ns", "output": "2\n3\n2\n1\n"}, {"type": "stdin_stdout", "input": "4\ntsss\nsasr\nas\nt", "output": "3\n3\n2\n1\n"}, {"type": "stdin_stdout", "input": "4\nssss\natrs\nat\nt", "output": "2\n4\n2\n1\n"}, {"type": "stdin_stdout", "input": "4\nrsss\natsr\nbt\nt", "outpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIvan has got an array of n non-negative integers a_1, a_2, ..., a_{n}. Ivan knows that the array is sorted in the non-decreasing order. \n\nIvan wrote out integers 2^{a}_1, 2^{a}_2, ..., 2^{a}_{n} on a piece of paper. Now... | [{"type": "stdin_stdout", "input": "26\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "26\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "1\n2000000000\n", "output": "2000000000\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers K and S.\nThree variable X, Y and Z takes integer values satisfying 0β€X,Y,Zβ€K.\nHow many different assignments of values to X, Y and Z are there such that X + Y + Z = S?\n\nConstraints\n\n* 2β€Kβ€... | [{"type": "stdin_stdout", "input": "100 58", "output": "1770\n"}, {"type": "stdin_stdout", "input": "100 50", "output": "1326\n"}, {"type": "stdin_stdout", "input": "101 60", "output": "1891\n"}, {"type": "stdin_stdout", "input": "111 72", "output": "2701\n"}, {"type": "stdin_stdout", "input": "111 79", "output": "3240... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHierarchical Democracy\n\nThe presidential election in Republic of Democratia is carried out through multiple stages as follows.\n\n1. There are exactly two presidential candidates.\n2. At the first stage, eligible voters... | [{"type": "stdin_stdout", "input": "6\n[[123][4567][89]]\n[[5][3][6][3][9]]\n[[[99][59][63][85][51]][[1539][7995][466]][[51][57][79][99][3][91][59]]]\n[[[37][95][31][77][25]][[43][5][5][5][85]][[71][3][51][89][29]][[57][94][5][69][31]][[99][59][65][73][31]]]\n[[[[9][7][3]][[3][5][7]][[7][9][5]]][[[9][9][3]][[5][9][9]][... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne important contest will take place on the most famous programming platform (Topforces) very soon!\n\nThe authors have a pool of $n$ problems and should choose at most three of them into this contest. The prettiness of ... | [{"type": "stdin_stdout", "input": "1\n37\n166320 83160 41580 33264 27720 23760 20790 18480 16632 15120 13860 11880 11088 10395 9240 10676 7920 7560 6930 6160 5940 9910 5040 4752 4620 4158 3960 3780 3696 3465 3080 3024 2970 2772 2640 29 23\n", "output": "186906\n"}, {"type": "stdin_stdout", "input": "1\n37\n166320 8316... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to $120^{\\circ}$. Then he measured the length of its sides, and found that each of them is equal to an in... | [{"type": "stdin_stdout", "input": "1000 1000 1000 1000 1000 1000\n", "output": "6000000\n"}, {"type": "stdin_stdout", "input": "1000 1000 1000 1000 1000 1000\n", "output": "6000000\n"}, {"type": "stdin_stdout", "input": "718 466 729 470 714 481\n", "output": "2102808\n"}, {"type": "stdin_stdout", "input": "677 303 685... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nThere are n islands in JOI, and each island is numbered from 1 to n. Currently, the JOI country is developing a route network connecting each island.\n\nYou work at a ticket center that handles ship tickets. Th... | [{"type": "stdin_stdout", "input": "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 3 343750\n1 1 3 3343\n1 1 4 347392\n1 2 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 2780\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0", "output": "-1\n15\n12\n126... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N stones, numbered 1, 2, \\ldots, N. For each i (1 \\leq i \\leq N), the height of Stone i is h_i.\n\nThere is a frog who is initially on Stone 1. He will repeat the following action some number of times to reac... | [{"type": "stdin_stdout", "input": "6\n30 10 60 10 60 57", "output": "33\n"}, {"type": "stdin_stdout", "input": "6\n30 12 60 33 60 18", "output": "54\n"}, {"type": "stdin_stdout", "input": "6\n30 12 21 33 60 18", "output": "36\n"}, {"type": "stdin_stdout", "input": "6\n30 0 26 33 122 14", "output": "30\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLuckily, Serval got onto the right bus, and he came to the kindergarten on time. After coming to kindergarten, he found the toy bricks very funny.\n\nHe has a special interest to create difficult problems for others to so... | [{"type": "stdin_stdout", "input": "2 58 77\n0 0 0 0 6 0 0 0 40 0 0 0 0 22 0 0 41 74 0 0 0 0 0 0 0 15 0 0 60 5 69 0 0 30 0 0 23 60 0 35 0 0 0 0 0 0 69 0 0 0 0 0 0 0 0 0 0 0\n0 74\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 1 0 0 0 1 0 0 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n###Task:\n\nYou have to write a function `pattern` which creates the following pattern (see examples) up to the desired number of rows.\n\n* If the Argument is 0 or a Negative Integer then it should return \"\" i.e. empty... | [{"input": "5", "output": "[\"1\\n333\\n55555\"]", "fn_name": "pattern"}, {"input": "4", "output": "[\"1\\n333\"]", "fn_name": "pattern"}, {"input": "-25", "output": "[\"\"]", "fn_name": "pattern"}, {"input": "1", "output": "[\"1\"]", "fn_name": "pattern"}, {"input": "0", "output": "[\"\"]", "fn_name": "pattern"}] | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have stumbled across the divine pleasure that is owning a dog and a garden. Now time to pick up all the cr@p! :D\n\nGiven a 2D array to represent your garden, you must find and collect all of the dog cr@p - represente... | [{"input": "[[\"_\", \"_\", \"_\", \"_\"], [\"_\", \"_\", \"_\", \"@\"], [\"_\", \"_\", \"@\", \"_\"]]\n2\n2", "output": "[\"Clean\"]", "fn_name": "crap"}, {"input": "[[\"_\", \"_\", \"_\", \"_\"], [\"_\", \"_\", \"_\", \"_\"], [\"_\", \"_\", \"_\", \"_\"]]\n2\n2", "output": "[\"Clean\"]", "fn_name": "crap"}, {"input":... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Task\n\nFind the integer from `a` to `b` (included) with the greatest number of divisors. For example:\n\n```\ndivNum(15, 30) ==> 24\ndivNum(1, 2) ==> 2\ndivNum(0, 0) ==> 0\ndivNum(52, 156) ==> 120\n```\n\nIf... | [{"input": "159\n4", "output": "[\"Error\"]", "fn_name": "div_num"}, {"input": "52\n156", "output": "[120]", "fn_name": "div_num"}, {"input": "15\n30", "output": "[24]", "fn_name": "div_num"}, {"input": "15\n48", "output": "[48]", "fn_name": "div_num"}, {"input": "1\n2", "output": "[2]", "fn_name": "div_num"}] | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJohnny needs to make a rectangular box for his physics class project. He has bought P cm of wire and S cm^{2} of special paper. He would like to use all the wire (for the 12 edges) and paper (for the 6 sides) to make the ... | [{"type": "stdin_stdout", "input": "2\n40 46\n60 14", "output": "15.38\n0.83\n"}, {"type": "stdin_stdout", "input": "2\n20 16\n20 10", "output": "4.15\n1.42\n"}, {"type": "stdin_stdout", "input": "2\n32 20\n20 10", "output": "3.43\n1.42\n"}, {"type": "stdin_stdout", "input": "2\n32 42\n20 14", "output": "18.15\n3.0\n"}... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is an easier version of the problem with smaller constraints.\n\nKorney Korneevich dag up an array $a$ of length $n$. Korney Korneevich has recently read about the operation bitwise XOR , so he wished to experiment w... | [{"type": "stdin_stdout", "input": "100\n227 40 465 412 346 400 165 362 247 431 171 215 164 437 34 169 62 223 21 202 372 423 9 336 2 155 92 291 141 187 306 310 340 314 405 387 299 216 9 173 117 478 165 112 311 277 304 454 137 57 337 28 366 374 418 189 2 416 65 309 193 471 406 213 180 85 327 71 341 128 191 239 125 317 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice became interested in periods of integer numbers. We say positive $X$ integer number is periodic with length $L$ if there exists positive integer number $P$ with $L$ digits such that $X$ can be written as $PPPPβ¦P$. F... | [{"type": "stdin_stdout", "input": "98779\n163329605173223304180189399899081111990037\n", "output": "100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasily has a deck of cards consisting of n cards. There is an integer on each of the cards, this integer is between 1 and 100 000, inclusive. It is possible that some cards have the same integers on them.\n\nVasily decide... | [{"type": "stdin_stdout", "input": "100\n9 9 72 55 14 8 55 58 35 67 3 18 73 92 41 49 15 60 18 66 9 26 97 47 43 88 71 97 19 34 48 96 79 53 8 24 69 49 12 23 77 12 21 88 66 9 29 13 61 69 54 77 41 13 4 68 37 74 7 6 29 76 55 72 89 4 78 27 29 82 18 83 12 4 32 69 89 85 66 13 92 54 38 5 26 56 17 55 29 4 17 39 29 94 3 67 85 98 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Introduction\n\nThe first century spans from the **year 1** *up to* and **including the year 100**, **The second** - *from the year 101 up to and including the year 200*, etc.\n\n# Task : \nGiven a year, return the cent... | [{"input": "1705", "output": "[18]", "fn_name": "century"}, {"input": "1900", "output": "[19]", "fn_name": "century"}, {"input": "1601", "output": "[17]", "fn_name": "century"}, {"input": "2000", "output": "[20]", "fn_name": "century"}, {"input": "356", "output": "[4]", "fn_name": "century"}, {"input": "89", "output": ... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven some positive integers, I wish to print the integers such that all take up the same width by adding a minimum number of leading zeroes. No leading zeroes shall be added to the largest integer.\n\nFor example, given ... | [{"input": "1\n12\n34", "output": "[\"01\\n12\\n34\"]", "fn_name": "print_nums"}, {"input": "1009\n2", "output": "[\"1009\\n0002\"]", "fn_name": "print_nums"}, {"input": "1\n1\n13", "output": "[\"01\\n01\\n13\"]", "fn_name": "print_nums"}, {"input": "1\n8\n27", "output": "[\"01\\n08\\n27\"]", "fn_name": "print_nums"}, ... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n\"Contestant who earns a score equal to or greater than the k-th place finisher's score will advance to the next round, as long as the contestant earns a positive score...\" β an excerpt from contest rules.\n\nA total of ... | [{"type": "stdin_stdout", "input": "50 44\n100 100 99 97 95 91 91 84 83 83 79 71 70 69 69 62 61 60 59 59 58 102 58 55 55 54 52 48 47 45 44 44 38 36 38 31 28 28 25 25 24 24 24 22 17 15 14 13 12 4\n", "output": "44\n"}, {"type": "stdin_stdout", "input": "50 44\n100 100 99 97 95 91 91 84 83 83 79 71 70 69 69 62 61 60 59 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEverything got unclear to us in a far away constellation Tau Ceti. Specifically, the Taucetians choose names to their children in a very peculiar manner.\n\nTwo young parents abac and bbad think what name to give to their... | [{"type": "stdin_stdout", "input": "abbabaaabaaabbbbabbbbbababababaaaabbabbbbabbbbbabbbbababbaaaaabbbabbbbabbbbbbabaabababaabbbabababbaz\nabaaabaabbbbaabbbbaabababbaabaabababbbaabbbaaabbabbabbbbbbbbaabbbbbabababbbbaaabaaaabbbbbbbbabababba\n", "output": "abaaabaabbbbaabbbbaabababbaabaabababbbaabbbaaabbabbabbbbbbbbaabbbb... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIncreasing E869120 (Ninja E869120)\n\nE869120 You are good at alter ego.\n\nHere are $ N $ members of the PA Lab. But some of them may be E869120.\n\nSo you asked all the $ N $ members of the PA Lab for their names. As a ... | [{"type": "stdin_stdout", "input": "5\nE869120\nTMJN\nE869120\nASIAT\nYNYMXIAOLONGBAO", "output": "2\n"}, {"type": "stdin_stdout", "input": "5\nE869120\nTMJN\nE809126\nATIAT\nYNYMXIAOGONLBAO", "output": "1\n"}, {"type": "stdin_stdout", "input": "5\nE86912/\nTMJN\n621908E\nIATSA\nYNYMXIBOGONLBAO", "output": "0\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a tree (an undirected connected graph without cycles) and an integer s.\n\nVanya wants to put weights on all edges of the tree so that all weights are non-negative real numbers and their sum is s. At the sam... | [{"type": "stdin_stdout", "input": "3 1000000000\n3 2\n2 1\n", "output": "1000000000.0000000000\n"}, {"type": "stdin_stdout", "input": "2 1000000000\n2 1\n", "output": "1000000000.0000000000\n"}, {"type": "stdin_stdout", "input": "6 1\n2 1\n4 3\n2 5\n5 4\n5 6\n", "output": "0.6666666667\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIevan Ritola is a researcher of behavioral ecology. Her group visited a forest to analyze an ecological system of some kinds of foxes.\n\nThe forest can be expressed as a two-dimensional plane. With her previous research,... | [{"type": "stdin_stdout", "input": "2\n1 0 8\n1 -1 3", "output": "11 / 1\n"}, {"type": "stdin_stdout", "input": "2\n1 2 7\n2 3 12", "output": "19 / 1\n"}, {"type": "stdin_stdout", "input": "2\n1 0 7\n2 3 12", "output": "12 / 1\n"}, {"type": "stdin_stdout", "input": "2\n0 1 14\n0 0 0", "output": "14 / 1\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn mathematics, a [Diophantine equation](https://en.wikipedia.org/wiki/Diophantine_equation) is a polynomial equation, usually with two or more unknowns, such that only the integer solutions are sought or studied.\n\nIn t... | [{"input": "900000012", "output": "[[[225000004, 112500001], [75000004, 37499999], [3358276, 1679071], [1119604, 559601]]]", "fn_name": "sol_equa"}, {"input": "90000001", "output": "[[[45000001, 22500000], [6428575, 3214284], [3461545, 1730766], [494551, 247230]]]", "fn_name": "sol_equa"}, {"input": "90009", "output": ... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFind the largest square number not exceeding N. Here, a square number is an integer that can be represented as the square of an integer.\n\n-----Constraints-----\n - 1 \\leq N \\leq 10^9\n - N is an integer.\n\n-----Input... | [{"type": "stdin_stdout", "input": "1205711547", "output": "1205686729\n"}, {"type": "stdin_stdout", "input": "1258489257", "output": "1258475625\n"}, {"type": "stdin_stdout", "input": "1044195797", "output": "1044194596\n"}, {"type": "stdin_stdout", "input": "271828182\n", "output": "271821169\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven two integer arrays where the second array is a shuffled duplicate of the first array with one element missing, find the missing element.\n\nPlease note, there may be duplicates in the arrays, so checking if a numeri... | [{"input": "[4, 3, 3, 61, 8, 8]\n[8, 61, 8, 3, 4]", "output": "[3]", "fn_name": "find_missing"}, {"input": "[6, 1, 3, 6, 8, 2]\n[3, 6, 6, 1, 2]", "output": "[8]", "fn_name": "find_missing"}, {"input": "[0, 0, 0, 0, 0]\n[0, 0, 0, 0]", "output": "[0]", "fn_name": "find_missing"}, {"input": "[1, 2, 3]\n[1, 3]", "output": ... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string $s$ of length $n$ consisting of characters a and/or b.\n\nLet $\\operatorname{AB}(s)$ be the number of occurrences of string ab in $s$ as a substring. Analogically, $\\operatorname{BA}(s)$ is the nu... | [{"type": "stdin_stdout", "input": "1\naaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbab\n", "output": "baaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbab\n"}, {"type": "stdin_stdout", "input": "1\nabbabababbabababbababbbabbbbabbbabaabaabba\n", "output": "abbabababbabababbababbbabbbbabbbabaabaabba\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVery soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was a... | [{"type": "stdin_stdout", "input": "10 4\nigtVqPgoW 3 24\nuc 1 381\nOxmov[Av 4 727\nxyRAaAk 2 378\nvYCV 4 67\nuf 2 478\nDawOytiYiH 1 775\nRS 1 663\npLhTehhjA 2 38\nkYWfb 3 595\n", "output": "DawOytiYiH RS\nuf xyRAaAk\nkYWfb igtVqPgoW\nOxmov[Av vYCV\n"}, {"type": "stdin_stdout", "input": "10 4\nigtVqPgoW 3 24\nuc 1 381\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day Sasha visited the farmer 2D and his famous magnetic farm. On this farm, the crop grows due to the influence of a special magnetic field. Maintaining of the magnetic field is provided by $n$ machines, and the power... | [{"type": "stdin_stdout", "input": "166\n61 19 19 67 11 11 73 89 73 11 47 2 59 43 61 31 19 83 71 19 29 97 89 97 2 11 5 73 19 2 19 7 41 53 5 23 11 89 2 23 47 47 83 71 17 71 67 67 43 3 29 97 17 83 11 19 67 17 97 7 19 29 29 41 13 71 29 19 19 43 47 17 71 3 13 71 41 19 47 7 29 43 29 97 31 11 43 17 23 83 37 61 79 31 17 5 59 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNormally, we decompose a number into binary digits by assigning it with powers of 2, with a coefficient of `0` or `1` for each term:\n\n`25 = 1*16 + 1*8 + 0*4 + 0*2 + 1*1`\n\nThe choice of `0` and `1` is... not very binar... | [{"input": "1234567", "output": "[[1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, 1]]", "fn_name": "true_binary"}, {"input": "47", "output": "[[1, 1, -1, 1, 1, 1]]", "fn_name": "true_binary"}, {"input": "25", "output": "[[1, 1, 1, -1, -1]]", "fn_name": "true_binary"}, {"input": "3", "output": "[[... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHappy PMP is freshman and he is learning about algorithmic problems. He enjoys playing algorithmic games a lot.\n\nOne of the seniors gave Happy PMP a nice game. He is given two permutations of numbers 1 through n and is ... | [{"type": "stdin_stdout", "input": "20\n1 12 9 6 11 13 2 8 20 7 16 19 4 18 3 15 10 17 14 5\n5 14 17 10 15 3 18 4 19 16 7 20 8 2 13 11 6 9 12 1\n", "output": "19\n"}, {"type": "stdin_stdout", "input": "10\n8 2 10 3 4 6 1 7 9 5\n8 2 10 3 4 6 1 7 9 5\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10\n2 1 10 3 7 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches... | [{"type": "stdin_stdout", "input": "3\n-1000000000 1000000000\n1000000000 0\n1000 -1000000000\n3\n1000 -999999999\n1000 0\n1001 0\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "6\n2 4\n4 2\n3 -1\n-1 -3\n-3 0\n-2 3\n12\n0 3\n0 2\n1 2\n2 3\n3 2\n1 1\n2 0\n0 -2\n0 0\n-1 -1\n-2 0\n-1 1\n", "output": "YES\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nItβs still hot every day, but September has already come. Itβs autumn according to the calendar. Looking around, I see two red dragonflies at rest on the wall in front of me. Itβs autumn indeed.\n\nWhen two red dragonflie... | [{"type": "stdin_stdout", "input": "-7 1028", "output": "1035\n"}, {"type": "stdin_stdout", "input": "-2 1028", "output": "1030\n"}, {"type": "stdin_stdout", "input": "-2 1094", "output": "1096\n"}, {"type": "stdin_stdout", "input": "-2 1349", "output": "1351\n"}, {"type": "stdin_stdout", "input": "-3 1349", "output": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSummer holidays! Someone is going on trips, someone is visiting grandparents, but someone is trying to get a part-time job. This summer Noora decided that she wants to earn some money, and took a job in a shop as an assis... | [{"type": "stdin_stdout", "input": "50 2\n74 90\n68 33\n49 88\n52 13\n73 21\n77 63\n27 62\n8 52\n60 57\n42 83\n98 15\n79 11\n77 46\n55 91\n72 100\n70 86\n50 51\n57 39\n20 54\n64 95\n66 22\n79 64\n31 28\n11 89\n1 36\n13 4\n75 62\n16 62\n100 35\n43 96\n97 54\n86 33\n62 63\n94 24\n19 6\n20 58\n38 38\n11 76\n70 40\n44 24\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIahub helps his grandfather at the farm. Today he must milk the cows. There are n cows sitting in a row, numbered from 1 to n from left to right. Each cow is either facing to the left or facing to the right. When Iahub mi... | [{"type": "stdin_stdout", "input": "100\n1 1 0 0 1 1 1 1 0 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 0 1 0 0 0 0 1 1 1 1 0 0 1 0 0 1 1 0 1 1 1 1 1 1 0 0 0 0 1 1 0 0 0 0 0 1 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0 1 0 1 1 0 1 1 1 1 0 0 1 1 0 0 0 0 1 1 1 0 0 1 0 0\n", "output": "1446\n"}, {"type": "stdin_stdout", "input": "100\n1 1 0 0 1 1 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nShichi-Go-San (literally \"Seven-Five-Three\") is a traditional event in a certain country to celebrate the growth of seven-, five- and three-year-old children.\nTakahashi is now X years old. Will his growth be celebrated... | [{"type": "stdin_stdout", "input": "-132", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-154", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-133", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-108", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1271", "output": "NO\n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTwo students of AtCoder Kindergarten are fighting over candy packs.\nThere are three candy packs, each of which contains a, b, and c candies, respectively.\nTeacher Evi is trying to distribute the packs between the two st... | [{"type": "stdin_stdout", "input": "10 30 20\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "30 30 100\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "56 25 31\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "30 30 000", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "106 25 31", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nΠΠ°ΡΡΠ° Π·Π²ΡΠ·Π΄Π½ΠΎΠ³ΠΎ Π½Π΅Π±Π° ΠΏΡΠ΅Π΄ΡΡΠ°Π²Π»ΡΠ΅Ρ ΡΠΎΠ±ΠΎΠΉ ΠΏΡΡΠΌΠΎΡΠ³ΠΎΠ»ΡΠ½ΠΎΠ΅ ΠΏΠΎΠ»Π΅, ΡΠΎΡΡΠΎΡΡΠ΅Π΅ ΠΈΠ· n ΡΡΡΠΎΠΊ ΠΏΠΎ m ΡΠΈΠΌΠ²ΠΎΠ»ΠΎΠ² Π² ΠΊΠ°ΠΆΠ΄ΠΎΠΉ ΡΡΡΠΎΠΊΠ΅. ΠΠ°ΠΆΠ΄ΡΠΉ ΡΠΈΠΌΠ²ΠΎΠ»Β β ΡΡΠΎ Π»ΠΈΠ±ΠΎ Β«.Β» (ΠΎΠ·Π½Π°ΡΠ°Π΅Ρ ΠΏΡΡΡΠΎΠΉ ΡΡΠ°ΡΡΠΎΠΊ Π½Π΅Π±Π°), Π»ΠΈΠ±ΠΎ Β«*Β» (ΠΎΠ·Π½Π°ΡΠ°Π΅Ρ ΡΠΎ, ΡΡΠΎ Π² ΡΡΠΎΠΌ ΠΌΠ΅ΡΡΠ΅ Π½Π° Π½Π΅Π±Π΅ ... | [{"type": "stdin_stdout", "input": "7 10\n..........\n......*...\n....**..*.\n...**.....\n...*......\n..........\n..**.*....\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "3 9\n.........\n......*..\n.........\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "5 5\n....*\n....*\n....*\n..*..\n..*.*\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nComplete the function which returns the weekday according to the input number:\n\n* `1` returns `\"Sunday\"`\n* `2` returns `\"Monday\"`\n* `3` returns `\"Tuesday\"`\n* `4` returns `\"Wednesday\"`\n* `5` returns `\"Thursd... | [{"input": "20", "output": "[\"Wrong, please enter a number between 1 and 7\"]", "fn_name": "whatday"}, {"input": "0", "output": "[\"Wrong, please enter a number between 1 and 7\"]", "fn_name": "whatday"}, {"input": "8", "output": "[\"Wrong, please enter a number between 1 and 7\"]", "fn_name": "whatday"}, {"input": "4... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are a member of the space station engineering team, and are assigned a task in the construction process of the station. You are expected to write a computer program to complete the task.\n\nThe space station is made u... | [{"type": "stdin_stdout", "input": "3\n10.428063836405636 10.000 50.41258054211165 10.000\n40.000 10.67607738240928 53.01420883969367 10.791354692497457\n40.998260752412115 40.51646067399203 50.343828752057796 10.89540561727416\n2\n30.571866538226903 30.21421585553614 30.992025805702255 20.557461946050214\n40.000 40.89... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor a given two numbers your mission is to derive a function that evaluates whether two given numbers are **abundant**, **deficient** or **perfect** and whether together they are **amicable**.\n\n\n\n### Abundant Numbers\... | [{"input": "220221\n282224", "output": "[\"deficient abundant not amicable\"]", "fn_name": "deficiently_abundant_amicable_numbers"}, {"input": "299920\n9284", "output": "[\"abundant deficient not amicable\"]", "fn_name": "deficiently_abundant_amicable_numbers"}, {"input": "999220\n2849", "output": "[\"abundant deficien... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nObesity is cited as the cause of many adult diseases. In the past, with a few exceptions, it was unrelated to high school students. However, it is no longer unrealistic to suffer from lack of exercise due to excessive stu... | [{"type": "stdin_stdout", "input": "1011,50.0,1.60\n1002,60.1,0.70\n1003,60.0,0.80\n1004,80.0,1.71\n1005,90.0,1.60", "output": "1002\n1003\n1004\n1005\n"}, {"type": "stdin_stdout", "input": "1011,50.0,1.60\n1102,60.1,0.70\n1003,60.0,0.80\n1004,80.0,1.71\n1005,80.0,1.60", "output": "1102\n1003\n1004\n1005\n"}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn her way to programming school tiger Dasha faced her first test β a huge staircase! [Image] \n\nThe steps were numbered from one to infinity. As we know, tigers are very fond of all striped things, it is possible that i... | [{"type": "stdin_stdout", "input": "100 100\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100 100\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100 101\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "110 111\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "111 111\n", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven an integer `n`, find two integers `a` and `b` such that:\n```Pearl\nA) a >= 0 and b >= 0\nB) a + b = n\nC) DigitSum(a) + Digitsum(b) is maximum of all possibilities. \n```\nYou will return the digitSum(a) + digitsu... | [{"input": "15569047737", "output": "[144]", "fn_name": "solve"}, {"input": "2452148459", "output": "[116]", "fn_name": "solve"}, {"input": "50000000", "output": "[68]", "fn_name": "solve"}, {"input": "1140", "output": "[33]", "fn_name": "solve"}, {"input": "7019", "output": "[35]", "fn_name": "solve"}, {"input": "18",... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi is going to set a 3-character password.\nHow many possible passwords are there if each of its characters must be a digit between 1 and N (inclusive)?\n\n-----Constraints-----\n - 1 \\leq N \\leq 9\n - N is an in... | [{"type": "stdin_stdout", "input": "-109", "output": "-1295029\n"}, {"type": "stdin_stdout", "input": "-61", "output": "-226981\n"}, {"type": "stdin_stdout", "input": "-57", "output": "-185193\n"}, {"type": "stdin_stdout", "input": "-68", "output": "-314432\n"}, {"type": "stdin_stdout", "input": "-95", "output": "-8573... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven a sequence of numbers a1, a2, a3, ..., an, find the maximum sum of a contiguous subsequence of those numbers. Note that, a subsequence of one element is also a contiquous subsequence.\n\n\n\nInput\n\nThe input consi... | [{"type": "stdin_stdout", "input": "7\n-4\n-4\n6\n14\n15\n-8\n-14\n13\n1\n0\n3\n2\n-3\n-1\n1\n1\n5\n3\n0\n-6\n2\n3\n1100\n-200\n145\n0", "output": "35\n12\n1100\n"}, {"type": "stdin_stdout", "input": "7\n-5\n-4\n6\n8\n15\n-6\n-12\n13\n1\n2\n3\n2\n-2\n-1\n1\n1\n3\n2\n0\n-4\n2\n3\n1100\n-200\n145\n0", "output": "29\n12\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBankopolis is an incredible city in which all the n crossroads are located on a straight line and numbered from 1 to n along it. On each crossroad there is a bank office.\n\nThe crossroads are connected with m oriented bi... | [{"type": "stdin_stdout", "input": "10 7\n50\n4 7 655\n7 3 220\n3 5 15\n5 10 811\n10 1 490\n1 2 800\n7 10 200\n1 5 377\n1 4 656\n6 4 432\n3 7 563\n1 8 122\n2 9 777\n3 2 157\n5 8 912\n9 8 496\n9 2 740\n3 2 201\n6 7 653\n1 7 554\n6 9 660\n3 2 622\n6 10 227\n9 1 42\n2 6 346\n2 7 944\n3 10 654\n5 2 501\n1 6 786\n3 8 306\n6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the n... | [{"type": "stdin_stdout", "input": "abcdeabcde opqrsopqrs\n7 2\nabcdeabcde\n", "output": "6 2\n"}, {"type": "stdin_stdout", "input": "airport door\n5 5\nairport\n", "output": "4 5\n"}, {"type": "stdin_stdout", "input": "length depth\n3 1\nlength\n", "output": "2 1\n"}, {"type": "stdin_stdout", "input": "tea coffee\n4 4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCreate a function that takes a positive integer and returns the next bigger number that can be formed by rearranging its digits. For example:\n\n```\n12 ==> 21\n513 ==> 531\n2017 ==> 2071\n```\n\nIf the digits can't be re... | [{"input": "59884848459853", "output": "[59884848483559]", "fn_name": "next_bigger"}, {"input": "1234567890", "output": "[1234567908]", "fn_name": "next_bigger"}, {"input": "123456789", "output": "[123456798]", "fn_name": "next_bigger"}, {"input": "9876543210", "output": "[-1]", "fn_name": "next_bigger"}, {"input": "99... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob have participated to a Rock Off with their bands. A jury of true metalheads rates the two challenges, awarding points to the bands on a scale from 1 to 50 for three categories: Song Heaviness, Originality, a... | [{"input": "[47, 7, 2]\n[47, 7, 2]", "output": "[\"0, 0: that looks like a \\\"draw\\\"! Rock on!\"]", "fn_name": "solve"}, {"input": "[5, 6, 7]\n[3, 6, 10]", "output": "[\"1, 1: that looks like a \\\"draw\\\"! Rock on!\"]", "fn_name": "solve"}, {"input": "[47, 50, 22]\n[26, 47, 12]", "output": "[\"3, 0: Alice made \\\... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet \\mathrm{popcount}(n) be the number of `1`s in the binary representation of n. For example, \\mathrm{popcount}(3) = 2, \\mathrm{popcount}(7) = 3, and \\mathrm{popcount}(0) = 0.\n\nLet f(n) be the number of times the f... | [{"type": "stdin_stdout", "input": "23\n00110111001011011001111", "output": "3\n3\n2\n2\n3\n3\n2\n3\n3\n3\n2\n2\n3\n2\n2\n2\n2\n3\n2\n3\n3\n3\n2\n"}, {"type": "stdin_stdout", "input": "23\n00110111001011011101111", "output": "4\n4\n3\n3\n4\n3\n3\n3\n4\n4\n3\n4\n3\n3\n4\n3\n3\n3\n4\n3\n3\n3\n2\n"}, {"type": "stdin_stdou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Russian also. \nChef likes playing with strings. The most interesting game are named \"CHEF in string\". The move of the game consists of the following: Chef takes a subsequence of string's let... | [{"type": "stdin_stdout", "input": "CHEFCHEFFFF\n", "output": "2"}, {"type": "stdin_stdout", "input": "CIEFCHEFFFF", "output": "1\n"}, {"type": "stdin_stdout", "input": "BHHHEEFFFCC", "output": "0\n"}, {"type": "stdin_stdout", "input": "CHEFCHEFGFF", "output": "2\n"}, {"type": "stdin_stdout", "input": "CHHHEEFFFCC", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nF: Grid number\n\nproblem\n\nEbi-chan is trying to write exactly one integer from 1 to 2 \\ times n in a grid with n columns horizontally and 2 rows vertically.\n\nOnly one integer can be written to each cell in the grid.... | [{"type": "stdin_stdout", "input": "8 10 37", "output": "24\n"}, {"type": "stdin_stdout", "input": "5 4 11", "output": "10\n"}, {"type": "stdin_stdout", "input": "5 3 17", "output": "16\n"}, {"type": "stdin_stdout", "input": "5 4 18", "output": "14\n"}, {"type": "stdin_stdout", "input": "8 6 37", "output": "21\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are two main kinds of events in the life of top-model: fashion shows and photo shoots. Participating in any of these events affects the rating of appropriate top-model. After each photo shoot model's rating increase... | [{"type": "stdin_stdout", "input": "10 1 1 1 2 0 10\n1 1\n2 1\n3 0\n4 0\n5 1\n6 1\n14 1\n8 1\n9 1\n10 1\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "10 1 1 1 2 0 10\n1 1\n2 1\n3 0\n4 0\n5 1\n6 1\n7 1\n8 1\n9 1\n10 1\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "10 1 1 1 2 0 10\n1 1\n2 1\n3 0\n4 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe goddess of programming is reviewing a thick logbook, which is a yearly record of visitors to her holy altar of programming. The logbook also records her visits at the altar.\n\nThe altar attracts programmers from all ... | [{"type": "stdin_stdout", "input": "14\n04/21 09:00 I 000\n04/21 09:00 I 001\n04/21 09:15 I 002\n04/21 90:30 O 001\n04/21 09:45 O 000\n12/40 10:00 O 002\n04/28 09:00 I 003\n04/28 09:15 I 000\n04/28 09:30 I 004\n04/28 09:45 P 004\n04/28 10:00 O 000\n04/28 10:15 O 003\n04/29 20:00 I 002\n04/29 21:30 O 002\n20\n06/01 09:0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Vasya had n boxes with balls in the room. The boxes stood in a row and were numbered with numbers from 1 to n from left to right.\n\nOnce Vasya chose one of the boxes, let's assume that its number is i, took all ba... | [{"type": "stdin_stdout", "input": "48 19\n227460648 746912227 51958075 682685526 1080381698 666833118 492590399 167395932 678377837 125106811 638633256 713194370 386921921 34175133 704550052 220688092 499436761 495071386 57379330 137372655 0 720974146 209203457 946682102 237312198 943872065 957150897 357568282 3670067... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's introduce a number system which is based on a roman digits. There are digits I, V, X, L which correspond to the numbers $1$, $5$, $10$ and $50$ respectively. The use of other roman digits is not allowed.\n\nNumbers ... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "48999999753\n"}, {"type": "stdin_stdout", "input": "1000000001\n", "output": "48999999802\n"}, {"type": "stdin_stdout", "input": "1897400395\n", "output": "92972619108\n"}, {"type": "stdin_stdout", "input": "1100000001\n", "output": "53899999802\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a positive integer $m$ and two integer sequence: $a=[a_1, a_2, \\ldots, a_n]$ and $b=[b_1, b_2, \\ldots, b_n]$. Both of these sequence have a length $n$.\n\nPermutation is a sequence of $n$ different positiv... | [{"type": "stdin_stdout", "input": "20 1000000000\n667066860 170421783 139902912 635488786 31946329 289281524 541340760 264115900 680775010 102068388 128171043 636359373 477042326 879154458 716982402 654668379 256334407 874949294 737194458 663371809\n688973261 813186249 677241392 581016678 216137209 424019643 428224807... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nImagine you have an infinite 2D plane with Cartesian coordinate system. Some of the integral points are blocked, and others are not. Two integral points A and B on the plane are 4-connected if and only if:\n\n * the Eucl... | [{"type": "stdin_stdout", "input": "18855321\n", "output": "106661800\n"}, {"type": "stdin_stdout", "input": "34609610\n", "output": "195781516\n"}, {"type": "stdin_stdout", "input": "40000000\n", "output": "226274168\n"}, {"type": "stdin_stdout", "input": "38450759\n", "output": "217510336\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a function that takes a positive integer n, sums all the cubed values from 1 to n, and returns that sum.\n\nAssume that the input n will always be a positive integer.\n\nExamples:\n\n```python\nsum_cubes(2)\n> 9 \n#... | [{"input": "123", "output": "[58155876]", "fn_name": "sum_cubes"}, {"input": "10", "output": "[3025]", "fn_name": "sum_cubes"}, {"input": "4", "output": "[100]", "fn_name": "sum_cubes"}, {"input": "3", "output": "[36]", "fn_name": "sum_cubes"}, {"input": "1", "output": "[1]", "fn_name": "sum_cubes"}, {"input": "2", "ou... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarpus participates in a competition for hacking into a new secure messenger. He's almost won.\n\nHaving carefully studied the interaction protocol, Polycarpus came to the conclusion that the secret key can be obtaine... | [{"type": "stdin_stdout", "input": "284254589153928171911281811000\n1009 1000\n", "output": "YES\n2842545891539\n28171911281811000\n"}, {"type": "stdin_stdout", "input": "284254589153928171911281811000\n1009 1100\n", "output": "YES\n2842545891539\n28171911281811000\n"}, {"type": "stdin_stdout", "input": "28425458915392... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAtCoder Inc. has decided to lock the door of its office with a 3-digit PIN code.\n\nThe company has an N-digit lucky number, S. Takahashi, the president, will erase N-3 digits from S and concatenate the remaining 3 digits... | [{"type": "stdin_stdout", "input": "19\n5546189040285140044", "output": "273\n"}, {"type": "stdin_stdout", "input": "19\n4753841743850076999", "output": "311\n"}, {"type": "stdin_stdout", "input": "19\n9039528710159876563", "output": "412\n"}, {"type": "stdin_stdout", "input": "19\n3616863455241776042", "output": "322\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMiki is a high school student. She has a part time job, so she cannot take enough sleep on weekdays. She wants to take good sleep on holidays, but she doesn't know the best length of sleeping time for her. She is now tryi... | [{"type": "stdin_stdout", "input": "15 -1 0\n3.507493431634293\n1.3168078857315408\n0.8923013066938583", "output": "-5115018.0145617081\n"}, {"type": "stdin_stdout", "input": "15 -1 0\n2.5963136238190727\n1.3168078857315408\n0.4906502505511706", "output": "1186.1864007578\n"}, {"type": "stdin_stdout", "input": "15 -1 0... | 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": "176902 1481077 847541 412251 587604\n", "output": "616526 283398\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya plays a computer game with ninjas. At this stage Vasya's ninja should get out of a deep canyon.\n\nThe canyon consists of two vertical parallel walls, their height is n meters. Let's imagine that we split these wall... | [{"type": "stdin_stdout", "input": "001 1\n----------------------------------------------------------------------------------------------------X\n----------------------------------------------------------------------------------------------------X\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "011 1\n------... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGru has not been in the limelight for a long time and is, therefore, planning something particularly nefarious. Frustrated by his minions' incapability which has kept him away from the limelight, he has built a transmogri... | [{"type": "stdin_stdout", "input": "1\n5 10\n2 4 1 35 1\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1\n4 2\n-1 8 1 -1 -1", "output": "0\n"}, {"type": "stdin_stdout", "input": "1\n5 10\n2 4 1 62 1", "output": "1\n"}, {"type": "stdin_stdout", "input": "1\n5 20\n2 4 1 62 1", "output": "2\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven an array $a$ of length $n$, find another array, $b$, of length $n$ such that:\n\n for each $i$ $(1 \\le i \\le n)$ $MEX(\\{b_1$, $b_2$, $\\ldots$, $b_i\\})=a_i$. \n\nThe $MEX$ of a set of integers is the smallest n... | [{"type": "stdin_stdout", "input": "10\n1 2 3 4 4 4 7 7 7 10\n", "output": "0 1 2 3 5 6 4 8 9 7 "}, {"type": "stdin_stdout", "input": "10\n1 2 3 4 4 4 7 7 7 10\n", "output": "0 1 2 3 5 6 4 8 9 7\n"}, {"type": "stdin_stdout", "input": "7\n0 0 2 2 3 5 6\n", "output": "1 4 0 7 2 3 5 \n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn `non decreasing` number is one containing no two consecutive digits (left to right), whose the first is higer than the second. For example, 1235 is an non decreasing number, 1229 is too, but 123429 isn't.\n\nWrite a fu... | [{"input": "50", "output": "[12565671261]", "fn_name": "increasing_numbers"}, {"input": "20", "output": "[10015005]", "fn_name": "increasing_numbers"}, {"input": "10", "output": "[92378]", "fn_name": "increasing_numbers"}, {"input": "5", "output": "[2002]", "fn_name": "increasing_numbers"}, {"input": "6", "output": "[5... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is unrest in the Galactic Senate. Several thousand solar systems have declared their intentions to leave the Republic. Master Heidi needs to select the Jedi Knights who will go on peacekeeping missions throughout th... | [{"type": "stdin_stdout", "input": "6 6\n1 1 3 2 2 2\n1 0 0 1 0 0\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "6 6\n4 3 5 4 5 2\n0 1 0 1 2 0\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "6 6\n1 1 3 2 2 2\n1 0 0 0 0 0\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "6 6\n4 3 5 6 5 5\n0 0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe magic sum of 3s is calculated on an array by summing up odd numbers which include the digit `3`. Write a function `magic_sum` which accepts an array of integers and returns the sum.\n\n*Example:* `[3, 12, 5, 8, 30, 13... | [{"input": "[3, 12, 5, 8, 30, 13]", "output": "[16]", "fn_name": "magic_sum"}, {"input": "[30, 34, 330]", "output": "[0]", "fn_name": "magic_sum"}, {"input": "[3, 13]", "output": "[16]", "fn_name": "magic_sum"}, {"input": "null", "output": "[0]", "fn_name": "magic_sum"}, {"input": "[3]", "output": "[3]", "fn_name": "ma... | code_functional |
[
{
"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 h_{i} identical blocks. For clarification see picture for the first sample.\n... | [{"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\nYou are given an integer sequence $1, 2, \\dots, n$. You have to divide it into two sets $A$ and $B$ in such a way that each element belongs to exactly one set and $|sum(A) - sum(B)|$ is minimum possible.\n\nThe value $|x... | [{"type": "stdin_stdout", "input": "2000000000\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1999999999\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1999999997\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1999999998\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1000271094\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSaitama accidentally destroyed a hotel again. To repay the hotel company, Genos has volunteered to operate an elevator in one of its other hotels. The elevator is special β it starts on the top floor, can only move down, ... | [{"type": "stdin_stdout", "input": "100 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAndrew, Fedor and Alex are inventive guys. Now they invent the game with strings for two players.\n\nGiven a group of n non-empty strings. During the game two players build the word together, initially the word is empty. ... | [{"type": "stdin_stdout", "input": "5 12\nabas\ndsfdf\nabacaba\ndartsidius\nkolobok\n", "output": "Second\n"}, {"type": "stdin_stdout", "input": "5 6\nabas\ndsfdf\nabacaba\ndartsidius\nkolobok\n", "output": "Second\n"}, {"type": "stdin_stdout", "input": "3 3\nabasdfabab\nabaaasdfdsf\nasdfaba\n", "output": "Second\n"}, ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Task\n\nJohn has an important number, and he doesn't want others to see it.\n\nHe decided to encrypt the number, using the following steps:\n```\nHis number is always a non strict increasing sequence\nie. \"123\"\n\nHe ... | [{"input": "\"TTONWOHREEE\"", "output": "[\"123\"]", "fn_name": "original_number"}, {"input": "\"ONETWO\"", "output": "[\"12\"]", "fn_name": "original_number"}, {"input": "\"OONETW\"", "output": "[\"12\"]", "fn_name": "original_number"}, {"input": "\"ONE\"", "output": "[\"1\"]", "fn_name": "original_number"}, {"input":... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA long time ago (probably even in the first book), Nicholas Flamel, a great alchemist and the creator of the Philosopher's Stone, taught Harry Potter three useful spells. The first one allows you to convert a grams of san... | [{"type": "stdin_stdout", "input": "911 728 910 407 833 594\n", "output": "Hermione\n"}, {"type": "stdin_stdout", "input": "632 446 352 317 522 451\n", "output": "Hermione\n"}, {"type": "stdin_stdout", "input": "542 11 820 850 1201 738\n", "output": "Hermione\n"}, {"type": "stdin_stdout", "input": "911 728 910 180 833 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given sequences A and B consisting of non-negative integers.\nThe lengths of both A and B are N, and the sums of the elements in A and B are equal.\nThe i-th element in A is A_i, and the i-th element in B is B_i.\... | [{"type": "stdin_stdout", "input": "3\n11 3\n-1 1\n2 8", "output": "9\n"}, {"type": "stdin_stdout", "input": "3\n8 3\n0 1\n4 8\n", "output": "9\n"}, {"type": "stdin_stdout", "input": "3\n8 3\n-1 1\n5 8", "output": "9\n"}, {"type": "stdin_stdout", "input": "3\n8 3\n-1 0\n4 8", "output": "8\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n-----Input-----\n\nThe only line of the input contains a string of digits. The length of the string is between 1 and 10, inclusive.\n\n\n-----Output-----\n\nOutput \"Yes\" or \"No\".\n\n\n-----Examples-----\nInput\n373\n\... | [{"type": "stdin_stdout", "input": "4357087936\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "3333333333\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "806975480\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "4357087936\n", "output": "YES"}, {"type": "stdin_stdout", "input": "3333333... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n animals in the queue to Dr. Dolittle. When an animal comes into the office, the doctor examines him, gives prescriptions, appoints tests and may appoint extra examination. Doc knows all the forest animals perf... | [{"type": "stdin_stdout", "input": "150 2476\n70 21 114 127 22 11 29 59 51 59 35 3 53 88 5 8 44 4 8 100 1 27 1 25 27 56 48 22 23 103 85 66 14 58 20 7 176 11 19 26 105 97 83 3 29 30 52 92 59 11 135 37 59 8 66 20 47 19 143 16 93 18 57 71 1 13 141 1 119 6 2 87 40 68 28 22 20 53 31 19 15 33 32 9 70 63 16 26 77 7 45 52 73 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.\... | [{"type": "stdin_stdout", "input": "44447774444474477747774774477777474774744744477444447777477477744747477774744444744777777777747777477447744774744444747477744744\n77777474477477747774777777474474477444474777477747747777477747747744474474747774747747444777474444744744444477477777747744747477\n", "output": "37\n"}, {"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has a string $s$ of length $n$. He decides to make the following modification to the string: Pick an integer $k$, ($1 \\leq k \\leq n$). For $i$ from $1$ to $n-k+1$, reverse the substring $s[i:i+k-1]$ of $s$. For... | [{"type": "stdin_stdout", "input": "1\n440\ntcjbjlbtjfmvzdqutuwzvmgqrqtrvxwrdacxcowbmbwvwssihttgdsjntiawqavwspzmybakxmwpbcgaffpyhvjrulqsorkcuozvtdbkkmasxtemrrbhqnmkpgewwphdvcyhxmatrfjkesacujihmtyqtqcjfqhpsjhgzimegvkjylapylqprykvkjavlmipewlzqsfefjzecadsqmfutgnegngmwchqttcyklocfcyuhghvtygdbsxaoxkvtgdcnsqddzzakhgrribwxkua... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe concept of \"[smooth number](https://en.wikipedia.org/wiki/Smooth_number)\" is applied to all those numbers whose prime factors are lesser than or equal to `7`: `60` is a smooth number (`2 * 2 * 3 * 5`), `111` is not ... | [{"input": "3125", "output": "[\"Hamming number\"]", "fn_name": "is_smooth"}, {"input": "60", "output": "[\"Hamming number\"]", "fn_name": "is_smooth"}, {"input": "98", "output": "[\"humble number\"]", "fn_name": "is_smooth"}, {"input": "4096", "output": "[\"power of 2\"]", "fn_name": "is_smooth"}, {"input": "7", "outp... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe guessed a permutation $p$ consisting of $n$ integers. The permutation of length $n$ is the array of length $n$ where each element from $1$ to $n$ appears exactly once. This permutation is a secret for you.\n\nFor each ... | [{"type": "stdin_stdout", "input": "5\n6\n3 2 5 6\n2 4 6\n3 1 3 4\n2 1 3\n4 1 2 4 6\n5\n2 2 3\n2 1 2\n2 1 4\n2 4 5\n7\n3 1 2 6\n4 1 3 5 6\n2 1 2\n3 4 5 7\n6 1 2 3 4 5 6\n3 1 3 6\n2\n2 1 2\n5\n2 2 5\n3 2 3 5\n4 2 3 4 5\n5 1 2 3 4 5\n", "output": "3 1 4 6 2 5 \n3 2 1 4 5 \n2 1 6 3 5 4 7 \n1 2 \n2 5 3 4 1 \n"}, {"type": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have to create a function named reverseIt.\n\nWrite your function so that in the case a string or a number is passed in as the data , you will return the data in reverse order. If the data is any other type, return it... | [{"input": "[1, 2, 3]", "output": "[[1, 2, 3]]", "fn_name": "reverse_it"}, {"input": "\"314159\"", "output": "[\"951413\"]", "fn_name": "reverse_it"}, {"input": "\"Hello\"", "output": "[\"olleH\"]", "fn_name": "reverse_it"}, {"input": "314159", "output": "[951413]", "fn_name": "reverse_it"}, {"input": "true", "output":... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKristina has two arrays $a$ and $b$, each containing $n$ non-negative integers. She can perform the following operation on array $a$ any number of times:\n\napply a decrement to each non-zero element of the array, that is... | [{"type": "stdin_stdout", "input": "6\n4\n3 5 4 1\n1 3 2 0\n3\n1 2 1\n0 1 0\n4\n5 3 7 2\n1 1 1 1\n5\n1 2 3 4 5\n1 2 3 4 6\n1\n8\n0\n1\n4\n6\n", "output": "YES\nYES\nNO\nNO\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "1\n4\n8293 8293 1 8\n8293 8293 1 8\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "1\n4\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a multiset containing several integers. Initially, it contains $a_1$ elements equal to $1$, $a_2$ elements equal to $2$, ..., $a_n$ elements equal to $n$.\n\nYou may apply two types of operations: choose two int... | [{"type": "stdin_stdout", "input": "20\n1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "20\n1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "20\n1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 3\n", "output": "11\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a function that accepts two parameters, i) a string (containing a list of words) and ii) an integer (n). The function should alphabetize the list based on the nth letter of each word.\n\nThe letters should be compa... | [{"input": "\"hello, how, are, you, doing, today\"\n3", "output": "[\"today, are, doing, hello, you, how\"]", "fn_name": "sort_it"}, {"input": "\"zephyr, yellow, wax, a, ba, cat\"\n1", "output": "[\"a, ba, cat, wax, yellow, zephyr\"]", "fn_name": "sort_it"}, {"input": "\"words, wordz, wordy, wording\"\n5", "output": "[... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInna loves sweets very much. That's why she decided to play a game called \"Sweet Matrix\".\n\nInna sees an n Γ m matrix and k candies. We'll index the matrix rows from 1 to n and the matrix columns from 1 to m. We'll rep... | [{"type": "stdin_stdout", "input": "50 37 500\n", "output": "10544\n(1,1) (2,1) (3,1) (4,1) (4,2) (4,3) (4,4) (4,5) (4,6) (4,7) (4,8) (4,9) (4,10) (4,11) (4,12) (4,13) (4,14) (4,15) (4,16) (4,17) (4,18) (4,19) (4,20) (4,21) (4,22) (4,23) (4,24) (4,25) (4,26) (4,27) (4,28) (4,29) \n(1,1) (2,1) (3,1) (3,2) (3,3) (3,4) (3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLong ago, Vasily built a good fence at his country house. Vasily calls a fence good, if it is a series of n consecutively fastened vertical boards of centimeter width, the height of each in centimeters is a positive integ... | [{"type": "stdin_stdout", "input": "50\n1 3083990 976356336 922018335 1 170272482 1 547248035 1 1 1 1 1 928379588 1 1 1 270052499 315045369 1 1 556091215 1 655608230 424079072 1 1 185387009 77360256 1 1 942696777 228860271 1 487787709 1 437229749 167886535 1 1 904578415 319694007 1 313704390 1 1 957736320 771147030 458... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string $s$, consisting of $n$ lowercase Latin letters.\n\nA substring of string $s$ is a continuous segment of letters from $s$. For example, \"defor\" is a substring of \"codeforces\" and \"fors\" is not.... | [{"type": "stdin_stdout", "input": "25\nbbaaaaabaaaabbabaaaababaa\n", "output": "YES\nba\n"}, {"type": "stdin_stdout", "input": "25\nbbaaaaabaaaabbabaaaababaa\n", "output": "YES\nba\n"}, {"type": "stdin_stdout", "input": "25\nbbaaaaabaaaabbabaaaabab`a\n", "output": "YES\nba\n"}, {"type": "stdin_stdout", "input": "25\nb... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNot so long ago as a result of combat operations the main Berland place of interest β the magic clock β was damaged. The cannon's balls made several holes in the clock, that's why the residents are concerned about the rep... | [{"type": "stdin_stdout", "input": "1000 -1000\n", "output": "white\n"}, {"type": "stdin_stdout", "input": "0000 -1000\n", "output": "black\n"}, {"type": "stdin_stdout", "input": "-1059 -929\n", "output": "black\n"}, {"type": "stdin_stdout", "input": "-215 -996\n", "output": "black\n"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSeryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (her hame is Inna, by the way). However, the two lovebirds can always find a way to communicate. Today they are w... | [{"type": "stdin_stdout", "input": "7\ni\nam\nont\nmain\nin\nthe\nfamily\n<3i<>3am<3the<3<main<3in<3the<3><3family<3\n", "output": "no\n"}, {"type": "stdin_stdout", "input": "7\ni\nam\nont\nmbin\nin\nthe\nfamily\n<3i<>3am<3the<3<main<3in<3the<3><3fami... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEverybody knows that the Berland citizens are keen on health, especially students. Berland students are so tough that all they drink is orange juice!\n\nYesterday one student, Vasya and his mates made some barbecue and th... | [{"type": "stdin_stdout", "input": "2000\naabaaabaabababbbbbbabbbbb\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "2000\naabaaabaabababbbbbbabbbbb\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "2000\naaaaaabaabababbbbbbabbbbb\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "2000\naaaaaabaaba... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a simple function that takes polar coordinates (an angle in degrees and a radius) and returns the equivalent cartesian coordinates (rouded to 10 places).\n\n```\nFor example:\n\ncoordinates(90,1)\n=> (0.0, 1.0)\n\nc... | [{"input": "1090\n10000", "output": "[[9848.0775301221, 1736.4817766693]]", "fn_name": "coordinates"}, {"input": "45\n1", "output": "[[0.7071067812, 0.7071067812]]", "fn_name": "coordinates"}, {"input": "-270\n1", "output": "[[0.0, 1.0]]", "fn_name": "coordinates"}, {"input": "90\n1", "output": "[[0.0, 1.0]]", "fn_name... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA binary tree of n nodes is given. Nodes of the tree are numbered from 1 to n and the root is the node 1. Each node can have no child, only one left child, only one right child, or both children. For convenience, let's de... | [{"type": "stdin_stdout", "input": "50 50\navzqjbotzkdbrhpknuxxcndqnnkfpthvjriridgnocygczqeyy\n3 50\n0 0\n24 47\n0 0\n0 0\n0 36\n0 0\n42 0\n0 0\n0 0\n0 0\n2 9\n40 0\n0 0\n0 0\n0 0\n20 0\n5 0\n11 32\n0 0\n8 30\n0 34\n0 0\n17 21\n0 0\n0 0\n23 38\n15 39\n0 13\n19 0\n0 7\n10 14\n0 0\n4 41\n48 44\n33 27\n29 0\n0 0\n0 37\n0 ... | 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 a1, a2, ..., an in ascending order. He is bored of this so simple algorithm, so he invents his own graph. The graph (... | [{"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\nI decided to do bowling as a recreation of the class. Create a program that inputs the pitching information for each participant and outputs the grade information in descending order of score. If there is a tie, output in... | [{"type": "stdin_stdout", "input": "3\n1010 6 3 10 10 1 0 7 9 1 10 6 2 4 3 9 1 9 0\n1200 5 3 9 1 12 1 0 0 12 1 10 10 4 3 9 1 8 2 9\n1101 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3\n4\n3321 8 2 10 9 1 7 0 10 10 10 0 8 10 10 10 10\n3332 5 0 10 13 1 4 1 9 0 10 10 7 1 5 2 8 1\n3335 10 10 10 10 10 10 10 10 10 10 10 10\n3340 8 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a huge integer $a$ consisting of $n$ digits ($n$ is between $1$ and $3 \\cdot 10^5$, inclusive). It may contain leading zeros.\n\nYou can swap two digits on adjacent (neighboring) positions if the swapping d... | [{"type": "stdin_stdout", "input": "3\n0709\n1337\n246432\n", "output": "0079\n1337\n234642\n"}, {"type": "stdin_stdout", "input": "3\n0709\n1337\n246432\n", "output": "0079\n1337\n234642\n"}, {"type": "stdin_stdout", "input": "3\n477\n1337\n246432\n", "output": "477\n1337\n234642\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.