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\nTraining is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well.\n\nToday's training is to increase creativity by drawing pictures. Let's draw a pattern w...
[{"type": "stdin_stdout", "input": "2\n1 3\n1 1\nRRRR\nRRGR\nRBRR\nRRRR", "output": "10\n"}, {"type": "stdin_stdout", "input": "2\n2 0\n1 1\nRRRR\nRRGR\nRBRR\nRRRR", "output": "16\n"}, {"type": "stdin_stdout", "input": "2\n2 0\n2 1\nRRRR\nRRGR\nRBRR\nRRRR", "output": "10\n"}, {"type": "stdin_stdout", "input": "2\n2 -1\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the official contest this problem has a different statement, for which jury's solution was working incorrectly, and for this reason it was excluded from the contest. This mistake have been fixed and the current given p...
[{"type": "stdin_stdout", "input": "20\n1306340891 192811911 592111899 609607891 585084800 601258511 223103775 164258550 858003275 230837577 971499807 312977833 344314550 397998873 558637732 216574673 913028292 1360238301 464376621 61315042\n", "output": "384683838\n"}, {"type": "stdin_stdout", "input": "20\n713900269 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere exists an island called Arpa’s land, some beautiful girls live there, as ugly ones do.\n\nMehrdad wants to become minister of Arpa’s land. Arpa has prepared an exam. Exam has only one question, given n, print the la...
[{"type": "stdin_stdout", "input": "1000000000\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "1902349577\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "0000000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1065810635\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "1760197508\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVladik and Chloe decided to determine who of them is better at math. Vladik claimed that for any positive integer n he can represent fraction <image> as a sum of three distinct positive fractions in form <image>.\n\nHelp ...
[{"type": "stdin_stdout", "input": "10000\n", "output": "10000 10001 100010000 "}, {"type": "stdin_stdout", "input": "17554\n", "output": "17554 17555 308160470\n"}, {"type": "stdin_stdout", "input": "10023\n", "output": "10023 10024 100470552\n"}, {"type": "stdin_stdout", "input": "19176\n", "output": "19176 19177 367...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently n students from city S moved to city P to attend a programming camp.\n\nThey moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can ...
[{"type": "stdin_stdout", "input": "19\n1\n1 1\n1\n1 2\n1\n1 1000\n1\n1 2000\n1\n2 2\n1\n2 3\n1\n2 1000\n1\n2 2000\n1\n1999 1999\n1\n1999 2000\n1\n2000 2000\n2\n1 1\n1 1\n2\n1 1\n1 2\n2\n1 2\n1 1\n2\n1 2000\n1 1\n2\n1 1\n1 2000\n2\n1 2000\n2 2\n2\n2 2000\n2 2\n2\n2 2\n2 2000\n", "output": "1 \n1 \n1 \n1 \n2 \n2 \n2 \n2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this Kata, you will be given a mathematical string and your task will be to remove all braces as follows:\n\n```Haskell\nsolve(\"x-(y+z)\") = \"x-y-z\"\nsolve(\"x-(y-z)\") = \"x-y+z\"\nsolve(\"u-(v-w-(x+y))-z\") = \"u-...
[{"input": "\"v-(l+s)-(t+y)-(c+f)+(b-(n-p))\"", "output": "[\"v-l-s-t-y-c-f+b-n+p\"]", "fn_name": "solve"}, {"input": "\"x-(-((-((((-((-(-(-y)))))))))))\"", "output": "[\"x-y\"]", "fn_name": "solve"}, {"input": "\"q+(s-(x-o))-(t-(w-a))\"", "output": "[\"q+s-x+o-t+w-a\"]", "fn_name": "solve"}, {"input": "\"(((((((m-(-((...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem statement\n\nWe played an AI soccer match between Country A and Country B. You have a table that records the player who had the ball at a certain time and its position. The table consists of N rows, and the i-th r...
[{"type": "stdin_stdout", "input": "5\n0 1 0 3 4\n30 1 0 3 4\n90 2 0 6 8\n120 1 1 1 1\n132 2 1 2 2", "output": "5.00000000 1.00000000\n1.41421356 0.20000000"}, {"type": "stdin_stdout", "input": "5\n0 2 0 3 4\n16 1 0 1 4\n155 2 0 6 13\n103 1 1 1 1\n132 -1 1 1 2", "output": "10.295630 2.316667\n1.000000 0.483333\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya loves hockey very much. One day, as he was watching a hockey match, he fell asleep. Petya dreamt of being appointed to change a hockey team's name. Thus, Petya was given the original team name w and the collection o...
[{"type": "stdin_stdout", "input": "100\nqn\nBE\nyN\nep\nPq\nXz\nLM\nEZ\ndb\nMn\nbn\nFe\nqA\nzc\nyq\npC\nyA\nWk\nYq\nrs\noD\nvD\nzW\nxZ\nbl\nur\nkf\ndf\nLS\nUW\nMy\nhR\nsh\nNh\nog\nCW\nor\nzo\nrO\nao\nXH\nDq\nKa\nlL\nYQ\nOh\nRZ\nAx\nta\nko\nDn\nNg\nNy\nDB\nYD\njO\nAp\nFT\noB\nNc\nwB\nHO\neW\nAc\nDr\nMt\nDf\nbF\nFP\nRa\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLeonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular w mm × h mm sheet of glass, a diamond glass cutter and lots of enthusiasm. What he lac...
[{"type": "stdin_stdout", "input": "10 19 10\nV 6\nH 8\nV 4\nV 8\nH 2\nH 5\nV 9\nH 7\nH 3\nV 7\n", "output": "114\n66\n44\n44\n44\n44\n44\n44\n44\n44\n"}, {"type": "stdin_stdout", "input": "15 5 10\nV 13\nV 6\nV 3\nH 4\nV 12\nV 7\nV 2\nH 1\nV 4\nH 3\n", "output": "65\n35\n35\n28\n24\n20\n20\n15\n15\n10\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiga Tower is the tallest and deepest building in Cyberland. There are 17 777 777 777 floors, numbered from - 8 888 888 888 to 8 888 888 888. In particular, there is floor 0 between floor - 1 and floor 1. Every day, tho...
[{"type": "stdin_stdout", "input": "-1000000000\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "-1000000000\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "-1325769607\n", "output": "9\n"}, {"type": "stdin_stdout", "input": "-1737641826\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "-4100583...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou received a notebook which is called Death Note. This notebook has infinite number of pages. A rule is written on the last page (huh) of this notebook. It says: \"You have to write names in this notebook during $n$ con...
[{"type": "stdin_stdout", "input": "16 2\n999999999 999999999 999999999 856501885 1080831631 999999999 768581442 1196229362 999999999 999999999 1341911334 1890212075 1581621479 999999999 999999999 999999999\n", "output": "499999999 500000000 499999999 428250943 540415815 500000000 384290721 598114681 499999999 50000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEdward Leven loves multiples of eleven very much. When he sees a number, he always tries to find consecutive subsequences (or substrings) forming multiples of eleven. He calls such subsequences as 11-sequences. For exampl...
[{"type": "stdin_stdout", "input": "17819\n1011\n11011\n1234567891011121314151617181920\n0", "output": "1\n1\n4\n38\n"}, {"type": "stdin_stdout", "input": "17819\n1010\n11011\n1234567891011121314151617181920\n0", "output": "1\n0\n4\n38\n"}, {"type": "stdin_stdout", "input": "17819\n1011\n11011\n130083111483873165421240...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Back-Story\n\nEvery day I travel on the freeway.\n\nWhen I am more bored than usual I sometimes like to play the following counting game I made up:\n\n* As I join the freeway my count is ```0```\n* Add ```1``` for every...
[{"input": "50.0\n120.0\n[[-1.0, 115.0], [-1.5, 110.0], [1.0, 130.0], [1.5, 130.0]]", "output": "[0]", "fn_name": "freeway_game"}, {"input": "50.0\n110.0\n[[-1.0, 110.0], [0.5, 110.0], [1.0, 110.0], [1.5, 110.0]]", "output": "[0]", "fn_name": "freeway_game"}, {"input": "30.0\n100.0\n[[-1.0, 110.0], [-0.7, 102.0], [-1.5...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn programming, hexadecimal notation is often used.\nIn hexadecimal notation, besides the ten digits 0, 1, ..., 9, the six letters A, B, C, D, E and F are used to represent the values 10, 11, 12, 13, 14 and 15, respective...
[{"type": "stdin_stdout", "input": "A B\n", "output": "<\n"}, {"type": "stdin_stdout", "input": "E C\n", "output": ">\n"}, {"type": "stdin_stdout", "input": "F F\n", "output": "=\n"}, {"type": "stdin_stdout", "input": "E F", "output": "<\n"}, {"type": "stdin_stdout", "input": "A A", "output": "=\n"}, {"type": "stdin_st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSaMer has written the greatest test case of all time for one of his problems. For a given array of integers, the problem asks to find the minimum number of groups the array can be divided into, such that the product of an...
[{"type": "stdin_stdout", "input": "80\n8861 -8846 -3257 8263 -8045 4549 9626 -6582 5755 -3559 5813 -7411 9151 -1847 2441 4201 2381 4651 -6571 199 -6737 -6333 -9433 -4967 9041 -9319 6801 5813 -2731 -8599 7681 -1303 -7333 6067 -1847 -6333 6047 -7907 -7333 8677 -937 829 2441 -5702 -8045 -3037 -4882 -7703 9001 -5702 -2039...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA new e-mail service \"Berlandesk\" is going to be opened in Berland in the near future. The site administration wants to launch their project as soon as possible, that's why they ask you to help. You're suggested to impl...
[{"type": "stdin_stdout", "input": "10\nzzzzzzzzzzzzzzzzzzzzzzzzzzz\nzzzzzzzzzzzzzzzzzzzzzzzzzzz\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\nzzzzzzzzzzzzzzzzzzzzzzzzzzz\nzzzzzzzzzzzzzzzzzzzzzzz...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nJamie loves sleeping. One day, he decides that he needs to wake up at exactly hh: mm. However, he hates waking up, so he wants to make waking up less painful by setting the alarm at a lucky time. He will then press the sn...
[{"type": "stdin_stdout", "input": "42\n15 44\n", "output": "12\n"}, {"type": "stdin_stdout", "input": "26\n04 58\n", "output": "26\n"}, {"type": "stdin_stdout", "input": "35\n15 25\n", "output": "13\n"}, {"type": "stdin_stdout", "input": "50\n01 59\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "46\n06 16\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a broken clock. You know, that it is supposed to show time in 12- or 24-hours HH:MM format. In 12-hours format hours change from 1 to 12, while in 24-hours it changes from 0 to 23. In both formats minutes ch...
[{"type": "stdin_stdout", "input": "24\n17:30\n", "output": "17:30\n"}, {"type": "stdin_stdout", "input": "12\n17:30\n", "output": "07:30\n"}, {"type": "stdin_stdout", "input": "24\n99:99\n", "output": "09:09\n"}, {"type": "stdin_stdout", "input": "12\n05:54\n", "output": "05:54\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou're given an undirected graph with $n$ nodes and $m$ edges. Nodes are numbered from $1$ to $n$.\n\nThe graph is considered harmonious if and only if the following property holds: For every triple of integers $(l, m, r...
[{"type": "stdin_stdout", "input": "1460 5\n100 300\n200 735\n420 117\n559 450\n435 900\n", "output": "795\n"}, {"type": "stdin_stdout", "input": "1460 5\n101 300\n200 735\n420 117\n559 450\n435 900\n", "output": "794\n"}, {"type": "stdin_stdout", "input": "1460 5\n100 300\n200 735\n420 117\n559 450\n435 460\n", "outpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a set of n points on the plane. A line containing the origin is called good, if projection of the given set to this line forms a symmetric multiset of points. Find the total number of good lines.\n\nMultiset...
[{"type": "stdin_stdout", "input": "50\n-38 -107\n-34 -75\n-200 -143\n-222 -139\n-34 55\n-102 -79\n48 -99\n2 -237\n-118 -167\n-56 -41\n10 17\n68 -89\n-32 41\n-100 -93\n84 -1\n86 -15\n46 -145\n-101 -117\n8 31\n-36 -61\n-12 21\n-116 79\n88 -205\n70 -103\n-78 -37\n106 -5\n-96 -201\n-60 -103\n-54 45\n-138 -177\n-178 -47\n-...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTak performed the following action N times: rolling two dice.\nThe result of the i-th roll is D_{i,1} and D_{i,2}.\nCheck if doublets occurred at least three times in a row.\nSpecifically, check if there exists at lease o...
[{"type": "stdin_stdout", "input": "100\n3 3\n1 1\n5 5\n4 4\n1 1\n3 3\n3 3\n5 5\n2 2\n3 3\n2 2\n2 2\n3 3\n3 3\n5 5\n3 3\n1 1\n3 3\n4 4\n1 1\n4 4\n3 3\n3 3\n4 4\n6 6\n5 5\n2 2\n6 6\n3 3\n1 1\n6 6\n4 4\n3 3\n3 3\n6 6\n2 2\n5 5\n5 5\n1 1\n1 1\n5 5\n6 6\n6 6\n4 4\n6 6\n6 6\n5 5\n3 3\n2 2\n1 1\n1 1\n4 4\n6 6\n5 5\n3 3\n2 2\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. ...
[{"type": "stdin_stdout", "input": "cicdcdikggfdibkibjdcfgafkdbkjeddbfeacceegecdjeeaedigcjehdjekibjhfdidebkhagibgfiafejfdckcadgcacgbgbcekbcebgeccekejkdkecabakffakjhkjigbaddkbeagfkcacbebfccdgcdihgigcjchgdkfikhceaefibkagaaekj\n", "output": "0.44385026737967914\n"}, {"type": "stdin_stdout", "input": "cicdcdikggfdibkibjdcf...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n$n$ towns are arranged in a circle sequentially. The towns are numbered from $1$ to $n$ in clockwise order. In the $i$-th town, there lives a singer with a repertoire of $a_i$ minutes for each $i \\in [1, n]$.\n\nEach sin...
[{"type": "stdin_stdout", "input": "4\n3\n12 16 14\n1\n1\n3\n1 2 3\n6\n81 75 75 93 93 87\n", "output": "YES\n3 1 3 \nYES\n1 \nNO\nYES\n5 5 4 1 4 5 \n"}, {"type": "stdin_stdout", "input": "4\n3\n12 16 14\n1\n1\n3\n1 2 3\n6\n81 75 75 93 93 87\n", "output": "YES\n3 1 3 \nYES\n1 \nNO\nYES\n5 5 4 1 4 5 \n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\n-----Constraints-----\n - \\alpha is an uppercase (A - Z) or lowercase (a - z) En...
[{"type": "stdin_stdout", "input": "B\n", "output": "A\n"}, {"type": "stdin_stdout", "input": "a\n", "output": "a\n"}, {"type": "stdin_stdout", "input": "A\n", "output": "A\n"}, {"type": "stdin_stdout", "input": "G\n", "output": "A\n"}, {"type": "stdin_stdout", "input": "Y\n", "output": "A\n"}, {"type": "stdin_stdout",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is the faculty of Computer Science in Berland. In the social net \"TheContact!\" for each course of this faculty there is the special group whose name equals the year of university entrance of corresponding course o...
[{"type": "stdin_stdout", "input": "5\n2043 2042 2041 2044 2040\n", "output": "2042\n"}, {"type": "stdin_stdout", "input": "5\n2012 2013 2014 2015 2016\n", "output": "2014\n"}, {"type": "stdin_stdout", "input": "5\n2011 2014 2012 2013 2010\n", "output": "2012\n"}, {"type": "stdin_stdout", "input": "5\n2014 2013 2011 20...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nC: Short-circuit evaluation\n\nproblem\n\nNaodai-kun and Hokkaido University-kun are playing games. Hokkaido University first generates the following logical formula represented by BNF.\n\n\n<formula> :: = <or-expr>\n<or-...
[{"type": "stdin_stdout", "input": "?&?&?|?|?&?", "output": "3 2\n"}, {"type": "stdin_stdout", "input": "?|?&?|?&?&?", "output": "3 1\n"}, {"type": "stdin_stdout", "input": "?&?&?|?&?|?", "output": "3 3\n"}, {"type": "stdin_stdout", "input": "?&?|?|?&?&?", "output": "3 2\n"}, {"type": "stdin_stdout", "input": "?|?|?&?&...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nJATC loves Banh-mi (a Vietnamese food). His affection for Banh-mi is so much that he always has it for breakfast. This morning, as usual, he buys a Banh-mi and decides to enjoy it in a special way.\n\nFirst, he splits the...
[{"type": "stdin_stdout", "input": "10 8\n0110000110\n3 3\n1 10\n4 4\n1 8\n1 2\n9 10\n2 10\n3 9\n", "output": "1\n960\n0\n224\n2\n2\n480\n112\n"}, {"type": "stdin_stdout", "input": "10 8\n0110000110\n3 3\n1 10\n4 4\n1 8\n1 2\n9 10\n2 10\n3 9\n", "output": "1\n960\n0\n224\n2\n2\n480\n112\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne of the simple ciphers is the affine cipher. First, replace the letters a to z with the numbers a = 0, b = 1, c = 2, ..., x = 23, y = 24, z = 25 and 0 to 25. Then replace the original alphabet with the following formul...
[{"type": "stdin_stdout", "input": "1\nx eazqyp pnop pngtg ye obmpngt xmybp mr lygw", "output": "p submit that there is another point of view\n"}, {"type": "stdin_stdout", "input": "1\nx pyqzae pnop pngtg ye obmpngt xmybp mr lygw", "output": "p timbus that there is another point of view\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given sequence a_1, a_2, ..., a_{n} and m queries l_{j}, r_{j} (1 ≤ l_{j} ≤ r_{j} ≤ n). For each query you need to print the minimum distance between such pair of elements a_{x} and a_{y} (x ≠ y), that: both inde...
[{"type": "stdin_stdout", "input": "10 6\n4 2 1 5 12 7 9 8 10 4\n1 3\n1 10\n2 10\n2 9\n5 5\n2 8\n", "output": "-1\n9\n-1\n-1\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "10 6\n4 2 1 5 6 7 9 8 10 4\n1 3\n1 10\n2 10\n2 9\n5 5\n2 8\n", "output": "-1\n9\n-1\n-1\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "10 6\n4 2 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis is a follow up from my kata The old switcheroo\n\nWrite\n```python\ndef encode(str)\n```\nthat takes in a string ```str``` and replaces all the letters with their respective positions in the English alphabet.\n\n```p...
[{"input": "\"this is a long string!! Please [encode] @C0RrEctly\"", "output": "[\"208919 919 1 1215147 1920189147!! 161251195 [51431545] @30181853201225\"]", "fn_name": "encode"}, {"input": "\"ZzzzZ\"", "output": "[\"2626262626\"]", "fn_name": "encode"}, {"input": "\"abc-#@5\"", "output": "[\"123-#@5\"]", "fn_name": "...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\n`Description:`\n\nGiven an input array (`arr`) of positive integers, the objective is to return an output array where each index represents the amount of times an element appeared (frequency) in the input array. \n\nMore ...
[{"input": "2\n2\n4\n4\n6\n6\n9\n9\n9\n9", "output": "[[null, null, [2, 4, 6], null, [9], null, null, null, null, null, null]]", "fn_name": "bucketize"}, {"input": "16\n7\n5\n3\n6\n23", "output": "[[null, [3, 5, 6, 7, 16, 23], null, null, null, null, null]]", "fn_name": "bucketize"}, {"input": "77\n3\n40\n40\n40", "out...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlperen is standing at the point $(0,0)$. He is given a string $s$ of length $n$ and performs $n$ moves. The $i$-th move is as follows:\n\nif $s_i = {L}$, then move one unit left;\n\nif $s_i = {R}$, then move one unit rig...
[{"type": "stdin_stdout", "input": "9\n7\nUUURDDL\n2\nUR\n8\nRRRUUDDD\n3\nLLL\n4\nDUUR\n5\nRUDLL\n11\nLLLLDDRUDRD\n10\nLLLLDDRUDR\n5\nRUDLL\n", "output": "YES\nYES\nNO\nNO\nYES\nYES\nNO\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "7\n7\nUUURDDL\n2\nUR\n8\nRRRUUDDD\n3\nLLL\n4\nDUUR\n5\nRUDLL\n11\nLLLLDDRUDRD\n", "ou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\nAssume we use the minimum number of bills required.\n\n-----Constraints...
[{"type": "stdin_stdout", "input": "1900\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "1001\n", "output": "999\n"}, {"type": "stdin_stdout", "input": "4575\n", "output": "425\n"}, {"type": "stdin_stdout", "input": "6426\n", "output": "574\n"}, {"type": "stdin_stdout", "input": "9445\n", "output": "555\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nI: Ravage\n\nSanta Claus was caught in the illuminations of the city and broke it.\n\nThere are N light bulbs in the illumination, and the $ i $ th light bulb only comes on when the voltage is above $ A_i $ and below $ B_...
[{"type": "stdin_stdout", "input": "4\n-1 2\n3 2\n-1 4\n-1 15", "output": "3\n"}, {"type": "stdin_stdout", "input": "4\n-4 2\n0 10\n3 7\n-2 2", "output": "3\n"}, {"type": "stdin_stdout", "input": "4\n-4 2\n0 10\n3 2\n-2 2", "output": "3\n"}, {"type": "stdin_stdout", "input": "4\n-4 2\n0 10\n3 2\n-4 2", "output": "3\n"}...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOn a number axis directed from the left rightwards, n marbles with coordinates x1, x2, ..., xn are situated. Let's assume that the sizes of the marbles are infinitely small, that is in this task each of them is assumed to...
[{"type": "stdin_stdout", "input": "15\n-241250505 -2\n-241250503 0\n-241250502 -5\n-241250501 -1\n-241250500 -3\n-241250499 2\n-241250498 -2\n-241250497 6\n-241250496 0\n-241250495 0\n-241250494 8\n-241250493 -5\n-241250492 7\n-241250491 -7\n-241250490 2\n", "output": "-20\n"}, {"type": "stdin_stdout", "input": "15\n-...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn order to put away old things and welcome a fresh new year, a thorough cleaning of the house is a must.\n\nLittle Tommy finds an old polynomial and cleaned it up by taking it modulo another. But now he regrets doing thi...
[{"type": "stdin_stdout", "input": "20180214 5\n", "output": "11\n 4 3 4 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads a word W and a text T, and prints the number of word W which appears in text T\n\nT consists of string Ti separated by space characters and newlines. Count the number of Ti which equals to W. T...
[{"type": "stdin_stdout", "input": "computer\nNurtures computer scientists and highly-skilled computer engineers\nwho will create and exploit \"knowledge\" for the enw era.\nProvides an outstanding computer environment.\nEND_OF_TEXT", "output": "3\n"}, {"type": "stdin_stdout", "input": "comquter\nNurtures computer scie...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKarlsson has visited Lillebror again. They found a box of chocolates and a big whipped cream cake at Lillebror's place. Karlsson immediately suggested to divide the sweets fairly between Lillebror and himself. Specificall...
[{"type": "stdin_stdout", "input": "O O .\n O O . .\n. . . . .\n . . . .\n . O .\n", "output": "Lillebror\n"}, {"type": "stdin_stdout", "input": ". . O\n . O O .\nO . O . O\n O O O O\n . . O\n", "output": "Lillebror\n"}, {"type": "stdin_stdout", "input": "O O O\n O . O .\nO . . O O\n O . O O\n O O O\n", "output": "L...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe solution of $ x ^ 3 = q $ is to calculate the recurrence formula $ x_ {n + 1} = x_n-\\ frac {x_ {n} ^ 3 --q} {3x_ {n} ^ 2} $ It can be calculated approximately with.\n\nPut a positive number $ \\ frac {q} {2} $ in $ x...
[{"type": "stdin_stdout", "input": "15\n153\n-1", "output": "2.466212\n5.348481\n"}, {"type": "stdin_stdout", "input": "15\n123\n-1", "output": "2.466212\n4.973190\n"}, {"type": "stdin_stdout", "input": "15\n194\n-1", "output": "2.466212\n5.788963\n"}, {"type": "stdin_stdout", "input": "15\n103\n-1", "output": "2.46621...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor the given sequence with n different elements find the number of increasing subsequences with k + 1 elements. It is guaranteed that the answer is not greater than 8·1018.\n\nInput\n\nFirst line contain two integer valu...
[{"type": "stdin_stdout", "input": "100 7\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n43\n44\n45\n46\n47\n48\n49\n50\n51\n52\n53\n54\n55\n56\n57\n58\n59\n60\n61\n62\n63\n64\n65\n66\n67\n68\n69\n70\n71\n72...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are literally dozens of snooker competitions held each year, and team Jinotega tries to attend them all (for some reason they prefer name \"snookah\")! When a competition takes place somewhere far from their hometow...
[{"type": "stdin_stdout", "input": "50\nPFH\nJFV->PFH\nBVP->PFH\nPFH->BVP\nPFH->JFV\nPFH->ETQ\nPFH->LQJ\nZTO->PFH\nPFH->BVP\nPFH->RXO\nPFH->ZTO\nHWL->PFH\nPFH->HIV\nPFH->AFP\nPFH->HWL\nOBB->PFH\nHIV->PFH\nPFH->LSR\nAFP->PFH\nLQJ->PFH\nHWL->PFH\nETQ->PFH\nPFH->HWL\nLSR->PFH\nWBR->PFH\nBNZ->PFH\nHQR->PFH\nZTO->PFH\nPFH->...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given array $a$ of length $n$. You can choose one segment $[l, r]$ ($1 \\le l \\le r \\le n$) and integer value $k$ (positive, negative or even zero) and change $a_l, a_{l + 1}, \\dots, a_r$ by $k$ each (i.e. $a_i...
[{"type": "stdin_stdout", "input": "39 1\n4 2 1 1 3 5 1 5 1 1 3 3 4 3 1 1 4 5 1 5 2 3 3 1 5 1 2 1 1 4 1 1 5 2 2 1 1 2 4\n", "output": "19\n"}, {"type": "stdin_stdout", "input": "39 1\n4 2 1 1 3 5 1 5 1 1 3 3 4 3 1 1 4 5 1 5 2 3 3 1 5 1 2 1 1 4 1 1 5 2 2 1 1 2 4\n", "output": "19\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N integers X_1, X_2, \\cdots, X_N, and we know that A_i \\leq X_i \\leq B_i.\nFind the number of different values that the median of X_1, X_2, \\cdots, X_N can take.\n\n-----Notes-----\nThe median of X_1, X_2, \...
[{"type": "stdin_stdout", "input": "3\n111 110\n111 11100\n-2 1111011010", "output": "10990\n"}, {"type": "stdin_stdout", "input": "3\n011 110\n111 11100\n-2 1111011010", "output": "11090\n"}, {"type": "stdin_stdout", "input": "3\n010 110\n111 11100\n-2 1111011010", "output": "11091\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConvert integers to binary as simple as that. You would be given an integer as a argument and you have to return its binary form.\nTo get an idea about how to convert a decimal number into a binary number, visit here.\n\n...
[{"input": "-999999", "output": "[\"11111111111100001011110111000001\"]", "fn_name": "to_binary"}, {"input": "-1000", "output": "[\"11111111111111111111110000011000\"]", "fn_name": "to_binary"}, {"input": "-15", "output": "[\"11111111111111111111111111110001\"]", "fn_name": "to_binary"}, {"input": "-3", "output": "[\"1...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\n# How many ways can you make the sum of a number?\n\nFrom wikipedia: https://en.wikipedia.org/wiki/Partition_(number_theory)#\n\n>In number theory and combinatorics, a partition of a positive integer *n*, also called an *...
[{"input": "275", "output": "[1520980492851175]", "fn_name": "exp_sum"}, {"input": "200", "output": "[3972999029388]", "fn_name": "exp_sum"}, {"input": "90", "output": "[56634173]", "fn_name": "exp_sum"}, {"input": "70", "output": "[4087968]", "fn_name": "exp_sum"}, {"input": "60", "output": "[966467]", "fn_name": "exp...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nIt's the year 4527 and the tanks game that we all know and love still exists. There also exists Great Gena's code, written in 2016. The problem this code solves is: given the number of tanks that go into the battle from e...
[{"type": "stdin_stdout", "input": "6\n1000000000000000000000000000000000000 11965651543 1000000000000000000000000000000000000 1000000000000000000000000000000000000 1000000000000000000000000000000000000 1000000000000000000000000000000000000\n", "output": "1196565154300000000000000000000000000000000000000000000000000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n piles of stones of sizes a1, a2, ..., an lying on the table in front of you.\n\nDuring one move you can take one pile and add it to the other. As you add pile i to pile j, the size of pile j increases by the c...
[{"type": "stdin_stdout", "input": "2\n2 9\n5\n4 10 7 3 4\n", "output": " 2 2 2 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is constraints.\n\nNow elections are held in Berland and you want to win them. More precisely, you want everyone to vote for you.\n\nThere are $n$ voters, and two ways to...
[{"type": "stdin_stdout", "input": "3\n3\n1 5\n2 10\n2 15\n7\n0 1\n3 1\n1 1\n6 1\n1 1\n4 1\n4 1\n6\n2 6\n2 3\n2 15\n2 7\n4 4\n5 5\n", "output": "10\n0\n7\n"}, {"type": "stdin_stdout", "input": "3\n3\n1 5\n2 10\n2 4\n7\n0 1\n3 1\n1 1\n6 1\n1 1\n4 1\n4 1\n6\n2 6\n2 3\n2 14\n2 1\n4 4\n5 5\n", "output": "4\n0\n4\n"}, {"typ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAtCoDeer the deer has N square tiles. The tiles are numbered 1 through N, and the number given to each tile is written on one side of the tile. Also, each corner of each tile is painted in one of the 1000 colors, which ar...
[{"type": "stdin_stdout", "input": "400\n196 345 527 695\n685 207 136 831\n303 497 409 762\n464 670 120 403\n867 799 702 490\n986 9 287 852\n519 89 617 973\n291 551 957 275\n329 210 75 744\n685 560 225 510\n568 429 313 112\n94 659 30 204\n51 891 791 326\n890 977 807 600\n203 468 753 791\n738 279 376 58\n377 694 954 955...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which prints the central coordinate ($cx$,$cy$) and the radius $r$ of a incircle of a triangle which is constructed by three points ($x_1$, $y_1$), ($x_2$, $y_2$) and ($x_3$, $y_3$) on the plane surface.\n...
[{"type": "stdin_stdout", "input": "1 -2\n3 2\n-2 0", "output": "0.53907943898209422325 -0.26437392711448356856 1.18845545916395465278"}, {"type": "stdin_stdout", "input": "0 3\n4 0\n0 0", "output": "1.00000000000000000000 1.00000000000000000000 1.00000000000000000000"}, {"type": "stdin_stdout", "input": "1 6\n-1 -3\n-...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe academic year has just begun, but lessons and olympiads have already occupied all the free time. It is not a surprise that today Olga fell asleep on the Literature. She had a dream in which she was on a stairs. \n\nTh...
[{"type": "stdin_stdout", "input": "50\nUUUUUUUUUUUUUUUUUUUUUUUUUDDDDDDDDDDDDDDDDDDDDDDDDD\n", "output": "51 102 153 204 255 306 357 408 459 510 561 612 663 714 765 816 867 918 969 1020 1071 1122 1173 1224 1275 1275 1224 1173 1122 1071 1020 969 918 867 816 765 714 663 612 561 510 459 408 357 306 255 204 153 102 51 "}, ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMr. Bender has a digital table of size n × n, each cell can be switched on or off. He wants the field to have at least c switched on squares. When this condition is fulfilled, Mr Bender will be happy.\n\nWe'll consider th...
[{"type": "stdin_stdout", "input": "1000000000 504951981 646612086 602763371\n", "output": "17360\n"}, {"type": "stdin_stdout", "input": "1000000000 999999946 999999941 715189365\n", "output": "37707\n"}, {"type": "stdin_stdout", "input": "1000000000 999999916 999999940 857945620\n", "output": "41279\n"}, {"type": "std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi is competing in a sumo tournament. The tournament lasts for 15 days, during which he performs in one match per day. If he wins 8 or more matches, he can also participate in the next tournament.\n\nThe matches fo...
[{"type": "stdin_stdout", "input": "xoxoxoxoxoxoxo", "output": "YES\n"}, {"type": "stdin_stdout", "input": "oxoxowoxoxoxox", "output": "YES\n"}, {"type": "stdin_stdout", "input": "oxoxowoooxoxxx", "output": "YES\n"}, {"type": "stdin_stdout", "input": "xxxoxooowoxoxo", "output": "YES\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nJohn has just bought a new car and is planning a journey around the country. Country has N cities, some of which are connected by bidirectional roads. There are N - 1 roads and every city is reachable from any other city....
[{"type": "stdin_stdout", "input": "4\n1 2\n2 3\n3 4\n", "output": "24\n"}, {"type": "stdin_stdout", "input": "4\n1 2\n2 3\n3 4\n", "output": "24\n"}, {"type": "stdin_stdout", "input": "4\n1 2\n1 3\n3 4\n", "output": "24\n"}, {"type": "stdin_stdout", "input": "4\n1 2\n2 3\n2 4\n", "output": "14\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nXenia lives in a city that has n houses built along the main ringroad. The ringroad houses are numbered 1 through n in the clockwise order. The ringroad traffic is one way and also is clockwise.\n\nXenia has recently move...
[{"type": "stdin_stdout", "input": "100 100\n48 73 63 16 49 88 36 17 66 6 87 13 94 52 58 70 71 52 7 70 25 42 24 36 57 9 79 26 75 39 13 14 38 26 33 66 88 28 75 98 53 48 67 54 63 25 69 87 88 32 72 17 36 35 29 67 74 89 70 47 20 90 78 13 94 57 32 73 29 74 45 78 85 64 81 56 12 65 19 67 34 86 55 71 41 33 76 13 100 47 44 76 8...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA string is called a KEYENCE string when it can be changed to `keyence` by removing its contiguous substring (possibly empty) only once.\n\nGiven a string S consisting of lowercase English letters, determine if S is a KEY...
[{"type": "stdin_stdout", "input": "eeyofscienck", "output": "NO\n"}, {"type": "stdin_stdout", "input": "eeyofsciencj", "output": "NO\n"}, {"type": "stdin_stdout", "input": "eeyofscienci", "output": "NO\n"}, {"type": "stdin_stdout", "input": "eeyofscjenci", "output": "NO\n"}, {"type": "stdin_stdout", "input": "icnejcsf...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn English and programming, groups can be made using symbols such as `()` and `{}` that change meaning. However, these groups must be closed in the correct order to maintain correct syntax.\n\nYour job in this kata will b...
[{"input": "\"{[{}[]()[]{}{}{}{}{}{}()()()()()()()()]{{{[[[((()))]]]}}}}(())[[]]{{}}[][][][][][][]({[]})\"", "output": "[true]", "fn_name": "group_check"}, {"input": "\"{{{{{{{{{{{((((((([])))))))}}}}}}}}}}\"", "output": "[false]", "fn_name": "group_check"}, {"input": "\"[{}{}())\"", "output": "[false]", "fn_name": "gr...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nOleg's favorite subjects are History and Math, and his favorite branch of mathematics is division.\n\nTo improve his division skills, Oleg came up with $t$ pairs of integers $p_i$ and $q_i$ and for each pair decided to fi...
[{"type": "stdin_stdout", "input": "10\n238517256500070918 988176216\n363959778883784349 933416507\n631238591652944446 530795521\n557307185726829409 1481431174\n86402035814143715 513728064\n101626841876448103 26556040\n598448092106640578 746411314\n733629261048200000 361714100\n624561301519202735 38\n106258810456388771...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEdo has got a collection of n refrigerator magnets!\n\nHe decided to buy a refrigerator and hang the magnets on the door. The shop can make the refrigerator with any size of the door that meets the following restrictions:...
[{"type": "stdin_stdout", "input": "20 5\n1 12 21 22\n9 10 15 20\n10 12 12 20\n1 1 25 29\n5 10 21 22\n4 9 16 25\n12 10 14 24\n3 3 19 27\n3 4 23 28\n12 1 11 31\n9 14 17 18\n8 12 14 20\n8 11 18 19\n12 3 14 29\n7 8 13 22\n6 4 16 30\n11 3 13 27\n9 16 15 18\n6 13 14 21\n9 12 15 22\n", "output": "4\n"}, {"type": "stdin_stdou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a permutation of numbers from 1 to n. Determine whether there's a pair of integers a, b (1 ≤ a, b ≤ n; a ≠ b) such that the element <image> (note, that it is usual division, not integer one) is between a and...
[{"type": "stdin_stdout", "input": "100\n1 65 33 97 17 81 49 11 73 41 25 89 57 5 69 39 21 85 53 13 77 45 29 93 61 3 67 60 99 19 83 51 11 75 43 27 91 59 7 71 39 23 87 55 15 79 47 31 2 95 63 66 34 98 18 82 50 10 74 42 26 90 58 6 70 38 22 86 54 14 78 46 30 94 62 4 68 36 100 20 84 52 12 76 44 28 92 60 8 72 40 24 88 56 16 8...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya has k matches, placed in n matchboxes lying in a line from left to right. We know that k is divisible by n. Petya wants all boxes to have the same number of matches inside. For that, he can move a match from its box...
[{"type": "stdin_stdout", "input": "100\n6 3 4 5 3 4 2 4 1 2 4 1 8 5 2 2 4 4 6 8 4 10 4 4 6 8 6 5 5 4 8 4 3 3 6 5 7 2 9 7 6 5 6 3 2 6 8 10 3 6 8 7 2 3 5 4 8 6 5 6 6 8 4 1 5 6 1 8 12 5 3 3 8 2 4 2 4 5 6 6 9 5 1 2 8 8 3 7 5 3 4 5 7 6 3 9 4 6 3 6\n", "output": "867\n"}, {"type": "stdin_stdout", "input": "100\n6 3 4 5 3 4 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nComplete the function/method so that it takes CamelCase string and returns the string in snake_case notation. Lowercase characters can be numbers. If method gets number, it should return string.\n\nExamples:\n\n``` javasc...
[{"input": "\"My3CodeIs4TimesBetter\"", "output": "[\"my3_code_is4_times_better\"]", "fn_name": "to_underscore"}, {"input": "\"ThisIsBeautifulDay\"", "output": "[\"this_is_beautiful_day\"]", "fn_name": "to_underscore"}, {"input": "\"TestController\"", "output": "[\"test_controller\"]", "fn_name": "to_underscore"}, {"in...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:...
[{"type": "stdin_stdout", "input": "dreamereraserdreamererasereraseeraserdreamererasereraserdreamdreamerdreamerdreamerdreamererasedreamereraseeraserdreamereraserdreamereraseeraserdreamdreamdreamerdreamerdreamerdreamdreamerdreameraseerasedreamererasererasererasedreamereraseerasererasedreamerasereraserdreamerdreamerasedr...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ houses along the road where Anya lives, each one is painted in one of $k$ possible colors.\n\nAnya likes walking along this road, but she doesn't like when two adjacent houses at the road have the same color...
[{"type": "stdin_stdout", "input": "100 100\n82 51 81 14 37 17 78 92 64 15 8 86 89 8 87 77 66 10 15 12 100 25 109 47 21 78 20 63 13 49 76 36 41 79 16 87 87 69 3 76 80 60 100 62 70 59 72 8 38 71 45 97 71 14 76 54 81 4 59 46 39 29 92 3 49 22 53 99 59 52 74 31 92 43 42 23 44 9 82 47 7 40 12 9 3 55 37 85 46 22 84 52 98 41 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle X has met the following problem recently. \n\nLet's define f(x) as the sum of digits in decimal representation of number x (for example, f(1234) = 1 + 2 + 3 + 4). You are to calculate <image>\n\nOf course Little X ...
[{"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "1000000000000000000 1999999999999999999"}, {"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "1000000000000000000 1999999999999999999"}, {"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "1000000000000000000 199...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWabbit is playing a game with $n$ bosses numbered from $1$ to $n$. The bosses can be fought in any order. Each boss needs to be defeated exactly once. There is a parameter called boss bonus which is initially $0$.\n\nWhen...
[{"type": "stdin_stdout", "input": "70 2\n1 1 1 1 1 -1 -1 -1 -1 -1 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3\n", "output": "-1685\n"}, {"type": "stdin_stdout", "input": "10 3\n950 88...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently, a start up by two students of a state university of city F gained incredible popularity. Now it's time to start a new company. But what do we call it?\n\nThe market analysts came up with a very smart plan: the n...
[{"type": "stdin_stdout", "input": "OVWIHIWVYXMVAAAATOXWOIUUHYXHIHHVUIOOXWHOXTUUMUUVHVWWYUTIAUAITAOMHXWMTTOIVMIVOTHOVOIOHYHAOXWAUVWAVIVM\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "QDPINBMCRFWXPDBFGOZVVOCEMJRUCTOADEWEGTVBVBFWWRPGYEEYGPRWWFBVBVTGEWEDAOTCURJMECOVVZOGFBDPXWFRCMBNIPDQ\n", "output": "NO\n"}, {...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string S of length 2 or 3 consisting of lowercase English letters. If the length of the string is 2, print it as is; if the length is 3, print the string after reversing it.\n\nConstraints\n\n* The length ...
[{"type": "stdin_stdout", "input": "acc", "output": "cca\n"}, {"type": "stdin_stdout", "input": "acb", "output": "bca\n"}, {"type": "stdin_stdout", "input": "adb", "output": "bda\n"}, {"type": "stdin_stdout", "input": "`cb", "output": "bc`\n"}, {"type": "stdin_stdout", "input": "bc`", "output": "`cb\n"}, {"type": "stdi...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string, consisting of lowercase Latin letters.\n\nA pair of neighbouring letters in a string is considered ugly if these letters are also neighbouring in a alphabet. For example, string \"abaca\" contains ...
[{"type": "stdin_stdout", "input": "100\nc\nda\na\nee\ned\ndb\nece\nab\nabe\nd\neeb\na\nbab\nbbd\nc\ncab\nc\nbda\ndb\ncca\nbcd\nbae\neb\nde\ndc\naee\nada\nba\nab\nde\ned\nae\nbc\nbec\ndae\nc\nb\ndab\nd\na\ndbd\nda\nb\ne\nde\nbe\nc\na\nb\nc\nbac\nee\nb\ncce\nc\nde\nc\ndee\ned\ncb\nb\ndc\ncc\na\neb\nec\nbcd\na\ndc\nf\nce...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two arrays: an array $a$ consisting of $n$ zeros and an array $b$ consisting of $n$ integers.\n\nYou can apply the following operation to the array $a$ an arbitrary number of times: choose some subsegment of...
[{"type": "stdin_stdout", "input": "17 10\n465 868 29 633 291 357 62 929 22 124 182 995 903 75 71 924 416\n", "output": "611\n"}, {"type": "stdin_stdout", "input": "1 1\n1000000000000\n", "output": "1000000000000\n"}, {"type": "stdin_stdout", "input": "7 4\n1 10000 1 1 1 1 10000\n", "output": "7500\n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this problem at each moment you have a set of intervals. You can move from interval (a, b) from our set to interval (c, d) from our set if and only if c < a < d or c < b < d. Also there is a path from interval I_1 from...
[{"type": "stdin_stdout", "input": "20\n1 1208 1583\n1 -258 729\n1 -409 1201\n1 194 1938\n1 -958 1575\n1 -1466 1752\n2 1 2\n2 1 2\n2 6 5\n1 -1870 1881\n1 -2002 2749\n1 -2002 2984\n1 -2002 3293\n2 2 4\n2 8 10\n2 9 6\n1 -2002 3572\n1 -2002 4175\n1 -2002 4452\n1 -2002 4605\n", "output": "YES\nYES\nYES\nYES\nYES\nNO\n"}, {...
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\n987654329876...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n## Overview\nResistors are electrical components marked with colorful stripes/bands to indicate both their resistance value in ohms and how tight a tolerance that value has. While you could always get a tattoo like Jimmie...
[{"input": "\"yellow violet brown silver\"", "output": "[\"470 ohms, 10%\"]", "fn_name": "decode_resistor_colors"}, {"input": "\"orange orange yellow gold\"", "output": "[\"330k ohms, 5%\"]", "fn_name": "decode_resistor_colors"}, {"input": "\"yellow violet orange gold\"", "output": "[\"47k ohms, 5%\"]", "fn_name": "dec...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nImpliment the reverse function, which takes in input n and reverses it. For instance, `reverse(123)` should return `321`. You should do this without converting the inputted number into a string.\n\nWrite your solution by ...
[{"input": "12005000", "output": "[50021]", "fn_name": "reverse"}, {"input": "1234", "output": "[4321]", "fn_name": "reverse"}, {"input": "4321", "output": "[1234]", "fn_name": "reverse"}, {"input": "1001", "output": "[1001]", "fn_name": "reverse"}, {"input": "1010", "output": "[101]", "fn_name": "reverse"}]
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nA new delivery of clothing has arrived today to the clothing store. This delivery consists of $a$ ties, $b$ scarves, $c$ vests and $d$ jackets.\n\nThe store does not sell single clothing items — instead, it sells suits of...
[{"type": "stdin_stdout", "input": "100000\n100000\n100000\n100000\n1000\n1000\n", "output": "100000000\n"}, {"type": "stdin_stdout", "input": "100000\n100000\n100000\n100000\n1000\n1000\n", "output": "100000000\n"}, {"type": "stdin_stdout", "input": "100000\n100000\n100100\n100000\n1000\n1000\n", "output": "100000000\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# The museum of incredible dull things\n\nThe museum of incredible dull things wants to get rid of some exhibitions. Miriam, the interior architect, comes up with a plan to remove the most boring exhibitions. She gives th...
[{"input": "[1, 2, 3, 4, 5]", "output": "[[2, 3, 4, 5]]", "fn_name": "remove_smallest"}, {"input": "[5, 3, 2, 1, 4]", "output": "[[5, 3, 2, 4]]", "fn_name": "remove_smallest"}, {"input": "[1, 2, 3, 1, 1]", "output": "[[2, 3, 1, 1]]", "fn_name": "remove_smallest"}, {"input": "[1, 2, 3, 4]", "output": "[[2, 3, 4]]", "fn_...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nAmong Johnny's numerous hobbies, there are two seemingly harmless ones: applying bitwise operations and sneaking into his dad's office. As it is usually the case with small children, Johnny is unaware that combining these...
[{"type": "stdin_stdout", "input": "6\n4\n1 0 2 5\n6\n10 7 14 16 0 12\n2\n0 1\n3\n1 2 6\n6\n1 4 6 10 11 20\n2\n0 1023\n", "output": "-1\n-1\n1\n-1\n-1\n1023\n"}, {"type": "stdin_stdout", "input": "6\n4\n1 0 2 6\n6\n10 7 27 16 1 12\n2\n0 1\n3\n1 2 6\n6\n0 8 6 10 11 33\n2\n0 1023\n", "output": "-1\n11\n1\n-1\n-1\n1023\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nComplete the function that takes an array of words.\n\nYou must concatenate the `n`th letter from each word to construct a new word which should be returned as a string, where `n` is the position of the word in the list.\...
[{"input": "[\"Chad\", \"Morocco\", \"India\", \"Algeria\", \"Botswana\", \"Bahamas\", \"Ecuador\", \"Micronesia\"]", "output": "[\"Codewars\"]", "fn_name": "nth_char"}, {"input": "[\"yoda\", \"best\", \"has\"]", "output": "[\"yes\"]", "fn_name": "nth_char"}, {"input": "[\"No\", \"No\"]", "output": "[\"No\"]", "fn_name...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are the Dungeon Master for a public DnD game at your local comic shop and recently you've had some trouble keeping your players' info neat and organized so you've decided to write a bit of code to help keep them sorte...
[{"input": "\"Amelia, 8165254325, Jessie, 9187162345, Marcus Kaine, 8018273245\"", "output": "[[{\"player\": \"Amelia\", \"contact\": 8165254325}, {\"player\": \"Jessie\", \"contact\": 9187162345}, {\"player\": \"Marcus Kaine\", \"contact\": 8018273245}]]", "fn_name": "player_manager"}, {"input": "\"jane, 801, dave, 12...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nA group of $n$ dancers rehearses a performance for the closing ceremony. The dancers are arranged in a row, they've studied their dancing moves and can't change positions. For some of them, a white dancing suit is already...
[{"type": "stdin_stdout", "input": "20 53 67\n1 2 1 2 0 0 0 2 2 2 1 0 0 2 0 0 0 1 1 2\n", "output": "413\n"}, {"type": "stdin_stdout", "input": "20 53 67\n1 2 1 2 0 0 0 2 2 2 1 0 0 2 0 0 0 1 1 2\n", "output": "413\n"}, {"type": "stdin_stdout", "input": "20 53 67\n1 2 1 2 0 0 0 2 2 2 1 0 0 2 0 0 1 1 1 2\n", "output": "4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n'Twas the night before Christmas, and Santa's frantically setting up his new Christmas tree! There are n nodes in the tree, connected by n-1 edges. On each edge of the tree, there's a set of Christmas lights, which can be...
[{"type": "stdin_stdout", "input": "4\n6 5\n1 2 -1\n1 3 1\n4 2 7\n6 3 0\n2 5 -1\n2 3 1\n2 5 0\n5 6 1\n6 1 1\n4 5 1\n5 3\n1 2 -1\n1 3 -1\n1 4 1\n4 5 -1\n2 4 0\n3 4 1\n2 3 1\n3 3\n1 2 -1\n1 3 -1\n2 2 0\n1 3 1\n2 3 0\n2 0\n1 2 1\n1 2 0\n", "output": "YES\n1 2 0\n1 3 1\n4 2 7\n6 3 0\n2 5 0\nYES\n1 2 1\n1 3 0\n1 4 1\n4 5 1\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCount the pairs of length-N sequences consisting of integers between 1 and M (inclusive), A_1, A_2, \\cdots, A_{N} and B_1, B_2, \\cdots, B_{N}, that satisfy all of the following conditions:\n - A_i \\neq B_i, for every i...
[{"type": "stdin_stdout", "input": "141421 356237\n", "output": "881613484\n"}, {"type": "stdin_stdout", "input": "500000 500000\n", "output": "869509376\n"}, {"type": "stdin_stdout", "input": "436426 479445\n", "output": "710501305\n"}, {"type": "stdin_stdout", "input": "148772 190081\n", "output": "685499830\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp is crazy about round numbers. He especially likes the numbers divisible by 10^{k}.\n\nIn the given number of n Polycarp wants to remove the least number of digits to get a number that is divisible by 10^{k}. For ...
[{"type": "stdin_stdout", "input": "1000000001 10\n", "output": "9\n"}, {"type": "stdin_stdout", "input": "1234567890 14\n", "output": "9\n"}, {"type": "stdin_stdout", "input": "1000999999 3\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "1090090090 5\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "12...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAt Aizu Shingakujuku, students are divided into classes by conducting a proficiency test when they enter the cram school. The test consists of three subjects: Mathematics, English, and Japanese, and students are divided i...
[{"type": "stdin_stdout", "input": "4\n100 217 28\n253 43 197\n18 34 24\n19 22 189\n2\n190 106 20\n66 72 171\n0", "output": "A\nA\nC\nB\nA\nA\n"}, {"type": "stdin_stdout", "input": "4\n100 137 28\n143 43 197\n18 34 24\n19 19 65\n2\n196 106 20\n66 72 171\n0", "output": "A\nA\nC\nC\nA\nA\n"}, {"type": "stdin_stdout", "in...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDoor's family is going celebrate Famil Doors's birthday party. They love Famil Door so they are planning to make his birthday cake weird!\n\nThe cake is a n × n square consisting of equal squares with side length 1. Each ...
[{"type": "stdin_stdout", "input": "21\n...CCC.....CC..C..C.C\n..CCC...CC...CC.CCC.C\n....C.C.C..CCC..C.C.C\n....CCC..C..C.CC.CCC.\n...CCC.C..C.C.....CCC\n.CCC.....CCC..C...C.C\nCCCC.C...CCC.C...C.CC\nC..C...C.CCC..CC..C..\nC...CC..C.C.CC..C.CC.\nCC..CCCCCCCCC..C....C\n.C..CCCC.CCCC.CCC...C\nCCC...CCC...CCC.C..C.\n.CCC...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 ar...
[{"type": "stdin_stdout", "input": "36\n6\n165310\n6\n177978\n6\n211759\n6\n212643\n6\n229540\n6\n250029\n6\n211519\n6\n256097\n6\n163478\n5\n91505\n5\n79280\n6\n260629\n6\n128051\n6\n121972\n6\n261633\n6\n172044\n6\n119055\n6\n208323\n6\n149942\n6\n161236\n6\n177150\n6\n233766\n5\n97949\n6\n230107\n6\n175822\n6\n21354...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAt an arcade, Takahashi is playing a game called RPS Battle, which is played as follows:\n - The player plays N rounds of Rock Paper Scissors against the machine. (See Notes for the description of Rock Paper Scissors. A d...
[{"type": "stdin_stdout", "input": "99901 2\n3193 1797 2772\nssrprrspsrprsrpsrprsssprrsrssrrprppprrrrrrrsprrrrsprsprsspsspprrrrpprsrprrrrpsspprrrspspsprprprprrpprppsrspprrsssssprsrrsrrsssppsprsrprpprpspppsprrspsspsppsrpspprpprsrsrssrrrrprspprpprrspssprsrrsppsrsrpssprsssprspppspspssrrpsrprpsrpprsrpppsprssssprsrrrrpsrprr...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe next \"Data Structures and Algorithms\" lesson will be about Longest Increasing Subsequence (LIS for short) of a sequence. For better understanding, Nam decided to learn it a few days before the lesson.\n\nNam created...
[{"type": "stdin_stdout", "input": "100\n102 157 177 149 138 193 19 74 127 156 128 122 6 101 154 92 24 188 51 89 18 77 112 100 65 11 113 173 79 124 102 81 11 171 114 43 60 168 44 86 87 82 177 8 12 181 139 121 140 28 108 17 173 63 18 4 148 125 117 153 193 180 188 142 46 75 163 126 128 22 32 163 164 1 161 19 162 59 190 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAhmed and Mostafa used to compete together in many programming contests for several years. Their coach Fegla asked them to solve one challenging problem, of course Ahmed was able to solve it but Mostafa couldn't.\n\nThis ...
[{"type": "stdin_stdout", "input": "14 14\n6 -1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 2 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 -1\n1 2 3 4 5 6 7 8 9 10 11 12 13 14\n", "output": "83\n"}, {"type": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n«Bersoft» company is working on a new version of its most popular text editor — Bord 2010. Bord, like many other text editors, should be able to print out multipage documents. A user keys a sequence of the document page n...
[{"type": "stdin_stdout", "input": "713,572,318,890,577,657,646,146,373,783,392,229,455,871,20,593,573,336,26,381,280,916,907,732,820,713,111,840,570,446,184,711,481,399,788,647,492,15,40,530,549,506,719,782,126,20,778,996,712,761,9,74,812,418,488,175,103,585,900,3,604,521,509,513,145,708,990,361,682,827,791,22,596,780...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given $n$ rectangles, each of height $1$. Each rectangle's width is a power of $2$ (i. e. it can be represented as $2^x$ for some non-negative integer $x$).\n\nYou are also given a two-dimensional box of width $W$...
[{"type": "stdin_stdout", "input": "2\n5 20\n1 2 16 2 8\n6 12\n4 8 8 4 2 8\n", "output": "2\n3\n"}, {"type": "stdin_stdout", "input": "2\n5 13\n2 2 8 2 8\n6 23\n1 16 8 2 2 1\n", "output": "2\n2\n"}, {"type": "stdin_stdout", "input": "2\n5 16\n1 2 8 4 8\n6 10\n2 8 8 2 2 8\n", "output": "\n2\n3\n"}, {"type": "stdin_stdou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA social network for dogs called DH (DogHouse) has k special servers to recompress uploaded videos of cute cats. After each video is uploaded, it should be recompressed on one (any) of the servers, and only after that it ...
[{"type": "stdin_stdout", "input": "10 10\n999999991 1000000000\n999999992 1000000000\n999999993 1000000000\n999999994 1000000000\n999999995 1000000000\n999999996 1000000000\n999999997 1000000000\n999999998 1000000000\n999999999 1000000000\n1000000000 1000000000\n", "output": "1999999991\n1999999992\n1999999993\n199999...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne very experienced problem writer decided to prepare a problem for April Fools Day contest. The task was very simple - given an arithmetic expression, return the result of evaluating this expression. However, looks like...
[{"type": "stdin_stdout", "input": "255+255+255+255+255+255+255+255+255+255\n", "output": "-42450\n"}, {"type": "stdin_stdout", "input": "101+200+195+231+107+222+146+254+160+209\n", "output": "-43175\n"}, {"type": "stdin_stdout", "input": "101+200+195+231+107+222+146+254+160+209\n", "output": "-43175\n"}, {"type": "std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation p of length n, and Skynyrd bought an array a of length m, consisting of integers from 1 to n. \n\nLynyrd and Skynyrd became bored, so they asked...
[{"type": "stdin_stdout", "input": "3 6 3\n2 1 3\n1 2 3 1 2 3\n1 6\n2 6\n3 5\n", "output": "110\n"}, {"type": "stdin_stdout", "input": "3 6 3\n2 1 3\n1 2 3 2 2 3\n1 5\n2 6\n3 5\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "3 6 3\n2 1 3\n2 2 3 1 2 3\n1 6\n2 6\n3 5\n", "output": "110\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya and Vasya are tossing a coin. Their friend Valera is appointed as a judge. The game is very simple. First Vasya tosses a coin x times, then Petya tosses a coin y times. If the tossing player gets head, he scores one...
[{"type": "stdin_stdout", "input": "100 100 1 1\n", "output": "4950\n2 1\n3 1\n3 2\n4 1\n4 2\n4 3\n5 1\n5 2\n5 3\n5 4\n6 1\n6 2\n6 3\n6 4\n6 5\n7 1\n7 2\n7 3\n7 4\n7 5\n7 6\n8 1\n8 2\n8 3\n8 4\n8 5\n8 6\n8 7\n9 1\n9 2\n9 3\n9 4\n9 5\n9 6\n9 7\n9 8\n10 1\n10 2\n10 3\n10 4\n10 5\n10 6\n10 7\n10 8\n10 9\n11 1\n11 2\n11 3\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWhen Sasha was studying in the seventh grade, he started listening to music a lot. In order to evaluate which songs he likes more, he introduced the notion of the song's prettiness. The title of the song is a word consist...
[{"type": "stdin_stdout", "input": "ZUBQNDCHHKWNWRVSDSRRRTGZDDPNTVJFKTCNGWND\n", "output": "7.53208608\n"}, {"type": "stdin_stdout", "input": "DNWGNBTKNJVTNPDDZGTRRRSDSVRDFWKHHBWNQBUY\n", "output": "11.8106291\n"}, {"type": "stdin_stdout", "input": "DNWGNBTKNJVTNQDDZGTRRRSDSVRDFWKHHBWNQBUY\n", "output": "11.8106291\n"}...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKsusha the Squirrel is standing at the beginning of a straight road, divided into n sectors. The sectors are numbered 1 to n, from left to right. Initially, Ksusha stands in sector 1. \n\nKsusha wants to walk to the end o...
[{"type": "stdin_stdout", "input": "10 3\n..........\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "10 3\n..........\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "10 1\n..........\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "10 4\n..........\n", "output": "YES\n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya has a sequence a consisting of n integers a_1, a_2, ..., a_n. Vasya may pefrom the following operation: choose some number from the sequence and swap any pair of bits in its binary representation. For example, Vasya...
[{"type": "stdin_stdout", "input": "5\n1000000000000000000 352839520853234088 165431853141398699 753467583475385837 895062156280564685\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "5\n1000000000000000000 352839520853234088 257894004782222768 753467583475385837 895062156280564685\n", "output": "4\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between the two versions is that this version asks the maximal possible answer.\n\nHomer likes arrays a lot. Today he is painting an array $a_1, a_2, \\dots, a_n$ with two kinds of colors, white and bl...
[{"type": "stdin_stdout", "input": "15\n3 5 2 5 3 2 2 5 5 4 5 5 1 3 1\n", "output": "14\n"}, {"type": "stdin_stdout", "input": "11\n2 3 10 3 3 8 9 2 11 10 3\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "11\n10 5 8 8 2 7 9 3 5 1 10\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "8\n1 2 4 1 4 5 4 4\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPalindrome\n\nProblem Statement\n\nFind the number of palindromes closest to the integer n.\n\nNote that the non-negative integer x is the number of palindromes, which means that the character string in which x is express...
[{"type": "stdin_stdout", "input": "4752", "output": "4774\n"}, {"type": "stdin_stdout", "input": "8517", "output": "8558\n"}, {"type": "stdin_stdout", "input": "3483", "output": "3443\n"}, {"type": "stdin_stdout", "input": "1868", "output": "1881\n"}, {"type": "stdin_stdout", "input": "2667", "output": "2662\n"}, {"ty...
code_stdio