messages
listlengths
1
1
ground_truth
stringlengths
88
726k
dataset
stringclasses
2 values
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N points in a two-dimensional plane. The initial coordinates of the i-th point are (x_i, y_i). Now, each point starts moving at a speed of 1 per second, in a direction parallel to the x- or y- axis. You are give...
[{"type": "stdin_stdout", "input": "20\n8 -10 R\n-4 -9 U\n9 6 D\n-3 -2 R\n0 12 D\n4 5 D\n10 -10 U\n-1 -8 U\n10 -6 D\n8 -5 U\n6 4 D\n-1 3 D\n19 9 R\n9 -4 R\n3 10 D\n1 9 U\n1 -6 U\n9 -8 R\n9 6 D\n7 -3 D", "output": "502.250000000000\n"}, {"type": "stdin_stdout", "input": "20\n8 -10 R\n-4 -9 U\n9 5 D\n-3 -2 R\n0 7 D\n4 5 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N).\nYour objective is to remove some of the elements in a so that a will be a good sequence.\nHere, an sequence b is a good sequence when t...
[{"type": "stdin_stdout", "input": "8\n2 7 1 8 2 8 1 8\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "6\n1 2 2 3 3 3\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1\n1000000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "5\n2 4 1 4 2\n", "output": "2\n"}, {"type": "stdin_stdout", "inpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHey CodeWarrior,\n\nwe've got a lot to code today!\n\nI hope you know the basic string manipulation methods, because this kata will be all about them.\n\nHere we go...\n\n## Background\n\nWe've got a very long string, con...
[{"input": "\"uid12 ab, uid#, uidMiXeDcHaRs\"", "output": "[[\"12 ab\", \"\", \"mixedchars\"]]", "fn_name": "get_users_ids"}, {"input": "\" uidin name whitespace\"", "output": "[[\"in name whitespace\"]]", "fn_name": "get_users_ids"}, {"input": "\"uid##doublehashtag\"", "output": "[[\"doublehashtag\"]]", "fn_name": "g...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\n# One is the loneliest number\n\n## Task\n\nThe range of vision of a digit is its own value. `1` can see one digit to the left and one digit to the right,` 2` can see two digits, and so on.\n\nThus, the loneliness of a di...
[{"input": "65432165432", "output": "[false]", "fn_name": "loneliest"}, {"input": "8854778", "output": "[false]", "fn_name": "loneliest"}, {"input": "123456", "output": "[true]", "fn_name": "loneliest"}, {"input": "34315", "output": "[true]", "fn_name": "loneliest"}, {"input": "11111", "output": "[true]", "fn_name": "l...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nExtended Euclid Algorithm\n\n\n\n\nGiven positive integers a and b, find the integer solution (x, y) to ax + by = gcd(a, b), where gcd(a, b) is the greatest common divisor of a and b.\n\nConstraints\n\n* 1 ≤ a, b ≤ 109\n\...
[{"type": "stdin_stdout", "input": "810 11", "output": "-3 221\n"}, {"type": "stdin_stdout", "input": "277 5", "output": "-2 111\n"}, {"type": "stdin_stdout", "input": "195 10", "output": "1 -19\n"}, {"type": "stdin_stdout", "input": "174 10", "output": "-2 35\n"}, {"type": "stdin_stdout", "input": "41 52", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLucifer and Crowley being two most dangerous demons are fighting to become king of hell. A question is given to them. The one who solves it first becomes King. Given an array A of N elements and an integer M. Print YES if...
[{"type": "stdin_stdout", "input": "1000 300000003\n100000000 100000001 100000002 100000003 100000004 100000005 100000006 100000007 100000008 100000009 100000010 100000011 100000012 100000013 100000014 100000015 100000016 100000017 100000018 100000019 100000020 100000021 100000022 100000023 100000024 100000025 10000002...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nZiota found a video game called \"Monster Invaders\".\n\nSimilar to every other shooting RPG game, \"Monster Invaders\" involves killing monsters and bosses with guns.\n\nFor the sake of simplicity, we only consider two d...
[{"type": "stdin_stdout", "input": "100 4 8 9 2\n1 8 0 8 7 8 1 8 7 4 0 9 4 2 1 7 3 7 3 7 1 8 7 14 4 10 11 7 3 5 9 7 4 9 6 10 4 5 5 2 5 2 8 4 5 3 1 6 8 8 10 6 7 2 1 6 2 8 3 9 7 4 18 6 7 8 5 2 5 16 3 8 4 11 0 3 5 10 6 1 4 8 14 17 2 2 9 3 7 3 3 3 10 19 3 5 3 1 3 3\n", "output": "1584\n"}, {"type": "stdin_stdout", "input":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nComputer graphics uses polygon models as a way to represent three-dimensional shapes. A polygon model is a model that creates a surface by giving the coordinates of vertices and how to connect those vertices.\n\nA general...
[{"type": "stdin_stdout", "input": "6\n3 3 1\n1 2 4\n1 4 3\n-1 3 4\n5 -1 1\n2 3 1", "output": "0\n"}, {"type": "stdin_stdout", "input": "6\n3 3 1\n1 2 4\n1 4 3\n-1 4 4\n10 0 1\n2 3 1", "output": "0\n"}, {"type": "stdin_stdout", "input": "6\n3 1 1\n2 0 4\n0 4 1\n-1 4 4\n9 -1 2\n2 3 1", "output": "0\n"}, {"type": "stdin_...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nF: Miko Mi String-\n\nstory\n\nMikko Mikkomi ~! Everyone's idol, Miko Miko Tazawa! Today ~, with Mikoto ~, practice the string algorithm, let's do it ☆\n\nMiko's special ~~ character making ~~ The slogan \"MikoMikomi\" be...
[{"type": "stdin_stdout", "input": "iNobiNociN", "output": "mitomerarenaiWA\n"}, {"type": "stdin_stdout", "input": "iNoaiNociN", "output": "mitomerarenaiWA\n"}, {"type": "stdin_stdout", "input": "iNoaiNochN", "output": "mitomerarenaiWA\n"}, {"type": "stdin_stdout", "input": "NhcoNiaoNi", "output": "mitomerarenaiWA\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLimak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.\n\nThe distance between two letters is defined as the difference between their positions in the alph...
[{"type": "stdin_stdout", "input": "69 1701\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzy\n", "output": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaax\n"}, {"type": "stdin_stdout", "input": "69 1701\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzy\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n[Image] \n\n\n-----Input-----\n\nThe first line of the input is a string (between 1 and 50 characters long, inclusive). Each character will be a letter of English alphabet, lowercase or uppercase.\n\nThe second line of th...
[{"type": "stdin_stdout", "input": "MDJivQRiOIVRcCdkSuUlNbMEOkIVJRMTAnHbkVaOmOblLfignh\n25\n", "output": "MDJIVQRIOIVRCCDKSUULNBMEOKIVJRMTANHBKVAOMOBLLFIGNH\n"}, {"type": "stdin_stdout", "input": "aaaaaaAAAaaaaAaaAaaAaaaaAAaAAAaaAAaaaAAaaaaaAaaAAa\n2\n", "output": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"}...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n### Introduction and Warm-up (Highly recommended)\n\n### [Playing With Lists/Arrays Series](https://www.codewars.com/collections/playing-with-lists-slash-arrays)\n___\n\n## Task\n\n**_Given_** an *array/list [] of integer...
[{"input": "[13, 12, -27, -302, 25, 37, 133, 155, -1]\n5", "output": "[247895375]", "fn_name": "max_product"}, {"input": "[14, 29, -28, 39, -16, -48]\n4", "output": "[-253344]", "fn_name": "max_product"}, {"input": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n5", "output": "[0]", "fn_name": "max_product"}, {"input": "[10, 2, 3, 8,...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nOn his free time, Chouti likes doing some housework. He has got one new task, paint some bricks in the yard.\n\nThere are $n$ bricks lined in a row on the ground. Chouti has got $m$ paint buckets of different colors at ha...
[{"type": "stdin_stdout", "input": "1411 1081 1082\n", "output": "238077838\n"}, {"type": "stdin_stdout", "input": "1841 1185 1765\n", "output": "773828348\n"}, {"type": "stdin_stdout", "input": "2000 1234 1800\n", "output": "550745740\n"}, {"type": "stdin_stdout", "input": "2000 2000 1999\n", "output": "694730459\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ pillars aligned in a row and numbered from $1$ to $n$.\n\nInitially each pillar contains exactly one disk. The $i$-th pillar contains a disk having radius $a_i$.\n\nYou can move these disks from one pillar t...
[{"type": "stdin_stdout", "input": "100\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's call a set of positive integers a_1, a_2, ..., a_k quadratic if the product of the factorials of its elements is a square of an integer, i. e. ∏_{i=1}^{k} a_i! = m^2, for some integer m.\n\nYou are given a positive ...
[{"type": "stdin_stdout", "input": "17027\n", "output": "17024\n1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Task\n In ChessLand there is a small but proud chess bishop with a recurring dream. \n \n In the dream the bishop finds itself on an `n × m` chessboard with mirrors along each edge, and it is not a bishop but a ray of l...
[{"input": "[17, 19]\n[16, 18]\n[1, 1]\n239239239", "output": "[[10, 2]]", "fn_name": "chess_bishop_dream"}, {"input": "[1, 1]\n[0, 0]\n[1, -1]\n1000000000", "output": "[[0, 0]]", "fn_name": "chess_bishop_dream"}, {"input": "[17, 19]\n[14, 8]\n[1, -1]\n239239", "output": "[[4, 17]]", "fn_name": "chess_bishop_dream"}, {...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp was dismantling his attic and found an old floppy drive on it. A round disc was inserted into the drive with $n$ integers written on it.\n\nPolycarp wrote the numbers from the disk into the $a$ array. It turned o...
[{"type": "stdin_stdout", "input": "3\n3 3\n0 -5 4\n1 5 4\n2 2\n-4 0\n1 2\n2 2\n0 0\n1 2\n", "output": "-1 -1 -1\n-1 -1\n-1 -1\n"}, {"type": "stdin_stdout", "input": "3\n3 3\n0 -3 4\n1 5 2\n2 2\n-4 -1\n1 1\n2 2\n0 0\n1 2\n", "output": "2 14 5\n-1 -1\n-1 -1\n"}, {"type": "stdin_stdout", "input": "3\n3 3\n0 -3 4\n1 5 3\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDevu is a dumb guy, his learning curve is very slow. You are supposed to teach him n subjects, the i^{th} subject has c_{i} chapters. When you teach him, you are supposed to teach all the chapters of a subject continuousl...
[{"type": "stdin_stdout", "input": "20 8\n6 16 0 2 6 10 1 4 1 5 3 5 9 2 2 8 0 2 3 3\n", "output": "109\n"}, {"type": "stdin_stdout", "input": "20 8\n6 16 0 2 6 13 1 4 6 5 3 5 9 2 2 8 0 2 3 3\n", "output": "121\n"}, {"type": "stdin_stdout", "input": "20 8\n6 16 0 2 6 10 1 4 6 5 3 5 9 2 2 8 0 2 3 3\n", "output": "118\n"}...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian. \nSpring is interesting season of year. Chef is thinking about different things, but last time he thinks about interesting game - \"Strange Matrix\". \nChef has a...
[{"type": "stdin_stdout", "input": "18 6 1\n0 3\n-1 7 \n3 2 \n4 1\n6 3\n7 2", "output": "5\n5\n5\n5\n5\n5\n5\n5\n5\n5\n5\n5\n5\n5\n5\n5\n5\n5\n"}, {"type": "stdin_stdout", "input": "15 2 6\n3 0\n3 4 \n5 0 \n4 1\n4 0\n7 3", "output": "1\n1\n1\n0\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n"}, {"type": "stdin_stdout", "input": "13...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Dima has two sequences of points with integer coordinates: sequence (a_1, 1), (a_2, 2), ..., (a_{n}, n) and sequence (b_1, 1), (b_2, 2), ..., (b_{n}, n).\n\nNow Dima wants to count the number of distinct sequences ...
[{"type": "stdin_stdout", "input": "100\n2 2 10 3 5 6 4 7 9 8 2 7 5 5 1 7 5 9 2 2 10 3 6 10 9 9 10 7 3 9 7 8 8 3 9 3 9 3 3 6 3 7 9 9 7 10 9 1 1 3 6 2 9 5 9 9 6 2 6 5 6 8 2 10 1 1 6 8 8 4 5 2 6 8 8 5 9 2 3 3 7 7 10 5 4 2 10 6 7 6 5 4 10 6 10 3 9 9 1 5\n3 5 6 4 2 3 2 9 3 8 3 1 10 7 4 3 6 9 3 5 9 5 3 10 4 7 9 7 4 3 3 6 9 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the year 2168, AtCoder Inc., which is much larger than now, is starting a limited express train service called AtCoder Express.\nIn the plan developed by the president Takahashi, the trains will run as follows:\n - A t...
[{"type": "stdin_stdout", "input": "10\n64 55 27 35 76 119 7 18 49 100\n29 19 31 39 27 48 41 87 55 70\n", "output": "20291.000000000000\n"}, {"type": "stdin_stdout", "input": "10\n64 55 27 35 76 119 7 18 49 100\n29 19 31 39 27 48 41 87 55 70", "output": "20291.000000000000"}, {"type": "stdin_stdout", "input": "10\n64 5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTheofanis really likes sequences of positive integers, thus his teacher (Yeltsa Kcir) gave him a problem about a sequence that consists of only special numbers.\n\nLet's call a positive number special if it can be written...
[{"type": "stdin_stdout", "input": "3\n6 10\n4 20\n105 276\n", "output": "222\n272\n456030397\n"}, {"type": "stdin_stdout", "input": "3\n6 11\n2 17\n105 194\n", "output": "223\n17\n136912005\n"}, {"type": "stdin_stdout", "input": "3\n6 7\n4 20\n105 276\n", "output": "43\n272\n456030397\n"}, {"type": "stdin_stdout", "in...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEvery positive integer number, that is not prime, may be decomposed in prime factors. For example the prime factors of 20, are:\n```\n2, 2, and 5, because: 20 = 2 . 2 . 5\n```\nThe first prime factor (the smallest one) o...
[{"input": "10\n200", "output": "[[21, 25, 63, 105, 125, 147, 189]]", "fn_name": "sflpf_data"}, {"input": "501\n5000", "output": "[[998, 1996, 2994, 3992, 4990]]", "fn_name": "sflpf_data"}, {"input": "15\n150", "output": "[[26, 52, 78, 104, 130]]", "fn_name": "sflpf_data"}, {"input": "10\n100", "output": "[[21, 25, 63]...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nA breakthrough among computer games, \"Civilization XIII\", is striking in its scale and elaborate details. Let's take a closer look at one of them.\n\nThe playing area in the game is split into congruent cells that are r...
[{"type": "stdin_stdout", "input": "1000000\n", "output": "1209197264797\n"}, {"type": "stdin_stdout", "input": "1010000\n", "output": "1233502153639\n"}, {"type": "stdin_stdout", "input": "1010100\n", "output": "1233746427001\n"}, {"type": "stdin_stdout", "input": "999811\n", "output": "1208740231393\n"}, {"type": "st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTwilight Sparkle was playing Ludo with her friends Rainbow Dash, Apple Jack and Flutter Shy. But she kept losing. Having returned to the castle, Twilight Sparkle became interested in the dice that were used in the game.\n...
[{"type": "stdin_stdout", "input": "100000 100000\n", "output": "99999.418033254507\n"}, {"type": "stdin_stdout", "input": "100001 100000\n", "output": "100000.41802404786\n"}, {"type": "stdin_stdout", "input": "50000 100000\n", "output": "49999.843487110789\n"}, {"type": "stdin_stdout", "input": "99999 100000\n", "out...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIt's bonus time in the big city! The fatcats are rubbing their paws in anticipation... but who is going to make the most money? \n\nBuild a function that takes in two arguments (salary, bonus). Salary will be an integer, ...
[{"input": "10000\ntrue", "output": "[\"$100000\"]", "fn_name": "bonus_time"}, {"input": "25000\ntrue", "output": "[\"$250000\"]", "fn_name": "bonus_time"}, {"input": "10000\nfalse", "output": "[\"$10000\"]", "fn_name": "bonus_time"}, {"input": "60000\nfalse", "output": "[\"$60000\"]", "fn_name": "bonus_time"}, {"input...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp lives on the coordinate axis $Ox$ and travels from the point $x=a$ to $x=b$. It moves uniformly rectilinearly at a speed of one unit of distance per minute.\n\nOn the axis $Ox$ at the point $x=c$ the base station...
[{"type": "stdin_stdout", "input": "9\n4 17 0 0\n0 6 0 0\n5 0 7 3\n52 2 20 010\n-11 20 -40 0\n2 2 0 0\n-2 0 1 4\n-1 4 0 2\n0 4 -10 0\n", "output": "13\n6\n4\n30\n31\n0\n0\n2\n4\n"}, {"type": "stdin_stdout", "input": "9\n1 10 7 1\n3 3 1 0\n8 2 10 4\n10 2 10 100\n-10 20 -17 2\n-3 1 0 0\n-3 1 2 0\n2 3 0 3\n-1 1 -2 2\n", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string $s$ consisting of lowercase Latin letters and $q$ queries for this string.\n\nRecall that the substring $s[l; r]$ of the string $s$ is the string $s_l s_{l + 1} \\dots s_r$. For example, the substri...
[{"type": "stdin_stdout", "input": "dfcbbcfeeedbaea\n15\n1 1 e\n1 4 b\n2 10 15\n1 7 b\n1 12 c\n2 6 8\n2 1 6\n1 7 c\n1 2 f\n1 10 a\n2 7 11\n1 10 a\n1 14 b\n1 1 f\n2 1 11\n", "output": "4\n3\n4\n4\n6\n"}, {"type": "stdin_stdout", "input": "decbbcfeeedbafa\n15\n1 1 e\n1 4 b\n2 10 15\n1 7 b\n1 12 c\n2 6 8\n2 1 6\n1 7 c\n1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTaro Aizu's company has a boss who hates being indivisible. When Taro goes out to eat with his boss, he pays by splitting the bill, but when the payment amount is not divisible by the number of participants, his boss alwa...
[{"type": "stdin_stdout", "input": "4 15000\n520\n41\n129\n500\n3 1047\n6\n20\n25\n3 359208\n5\n14\n17\n0 0", "output": "14983\n1039\n359207\n"}, {"type": "stdin_stdout", "input": "4 15000\n305\n260\n136\n500\n3 400\n10\n23\n30\n3 599838\n5\n1\n12\n0 0", "output": "14983\n397\n599831\n"}, {"type": "stdin_stdout", "inpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA great king of a certain country suddenly decided to visit the land of a friendly country. The country is famous for trains, and the king visits various stations.\n\nThere are 52 train stations, each with a single upperc...
[{"type": "stdin_stdout", "input": "2\n1 2\nadd\n3\n12 4 0\nDDDA\n5\n3 1 3 5 2\ndcdkIlkP\n0", "output": "Zbc\nrzDo\nabafGijM\n"}, {"type": "stdin_stdout", "input": "2\n1 2\nadd\n3\n12 4 1\nDDDA\n5\n3 1 3 5 2\ndcdkIlkP\n0", "output": "Zbc\nrzCo\nabafGijM\n"}, {"type": "stdin_stdout", "input": "2\n1 0\nadd\n3\n12 4 1\nDD...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven an array of numbers, return a string made up of four parts:\n\na) a four character 'word', made up of the characters derived from the first two and last two numbers in the array. order should be as read left to righ...
[{"input": "[82, 98, 72, 71, 71, 72, 62, 67, 68, 115, 117, 112, 122, 121, 93]", "output": "[\"Rby]->Cyz-zyC>->Cyz\"]", "fn_name": "sort_transform"}, {"input": "[111, 121, 122, 124, 125, 126, 117, 118, 119, 121, 122, 73]", "output": "[\"oyzI-Io}~-~}oI-Io}~\"]", "fn_name": "sort_transform"}, {"input": "[78, 117, 110, 99,...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis is a follow up from my kata Insert Dashes. \nWrite a function ```insertDashII(num)``` that will insert dashes ('-') between each two odd numbers and asterisk ('\\*') between each even numbers in ```num``` \nFor examp...
[{"input": "1012356895", "output": "[\"10123-56*89-5\"]", "fn_name": "insert_dash2"}, {"input": "40546793", "output": "[\"4054*67-9-3\"]", "fn_name": "insert_dash2"}, {"input": "454793", "output": "[\"4547-9-3\"]", "fn_name": "insert_dash2"}, {"input": "123456", "output": "[\"123456\"]", "fn_name": "insert_dash2"}, {"i...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day Nikita found the string containing letters \"a\" and \"b\" only. \n\nNikita thinks that string is beautiful if it can be cut into 3 strings (possibly empty) without changing the order of the letters, where the 1-s...
[{"type": "stdin_stdout", "input": "bbabbbbbaaba\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "bbbbbbabaaaa\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "bbabbbbabbbb\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "baabbbbbaaba\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHacker Zhorik wants to decipher two secret messages he intercepted yesterday. Yeah message is a sequence of encrypted blocks, each of them consists of several bytes of information.\n\nZhorik knows that each of the message...
[{"type": "stdin_stdout", "input": "50 50\n5733 740 547 3647 5382 5109 6842 7102 5879 1502 3574 1628 7905 4357 8569 9564 8268 3542 2487 8532 425 7713 2585 925 6458 2697 2844 69 324 9030 495 4428 6724 3524 3304 4874 1303 2098 1136 1048 2464 7316 274 9586 534 2450 2368 8060 7795 70692\n1918 4122 6806 4914 6517 6278 9842 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFirst-rate specialists graduate from Berland State Institute of Peace and Friendship. You are one of the most talented students in this university. The education is not easy because you need to have fundamental knowledge ...
[{"type": "stdin_stdout", "input": "prntaxhysjfcfmrjngdsitlguahtpnwgbaxptubgpwcfxqehrulbxfcjssgocqncscduvyvarvwxzvmjoatnqfsvsilubexmwugedtzavyamqjqtkxzuslielibjnvkpvyrbndehsqcaqzcrmomqqwskwcypgqoawxdutnxmeivnfpzwvxiyscbfnloqjhjacsfnkfmbhgzpujrqdbaemjsqphokkiplblbflvadcyykcqrdohfasstobwrobslaofbasylwiizrpozvhtwyxtzl\n",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a of length n that consists of zeros and ones.\n\nYou can perform the following operation multiple times. The operation consists of two steps: \n\n 1. Choose three integers 1 ≤ x < y < z ≤ n, that ...
[{"type": "stdin_stdout", "input": "125\n1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0\n", "output": "YES\n23\n120 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAn ant moves on the real line with constant speed of $1$ unit per second. It starts at $0$ and always moves to the right (so its position increases by $1$ each second).\n\nThere are $n$ portals, the $i$-th of which is loc...
[{"type": "stdin_stdout", "input": "5\n370534603 100000000 1\n600000000 400000000 0\n800000000 300000000 0\n900000000 700000000 1\n1000000000 500000000 0\n", "output": "444580501\n"}, {"type": "stdin_stdout", "input": "5\n370534603 100000000 1\n600000000 400000000 0\n800000000 300000000 0\n900000000 700000000 1\n101000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe full exploration sister is a very talented woman. Your sister can easily count the number of routes in a grid pattern if it is in the thousands. You and your exploration sister are now in a room lined with hexagonal t...
[{"type": "stdin_stdout", "input": "-2 1 -1 2\n6\n-1 2\n2 0\n1 -2\n1 1\n-1 -1\n-1 -1\n2 5", "output": "-1\n"}, {"type": "stdin_stdout", "input": "-2 1 -1 2\n6\n-1 2\n2 0\n1 -2\n1 1\n-1 -1\n-1 -1\n3 5", "output": "-1\n"}, {"type": "stdin_stdout", "input": "-2 0 -1 2\n6\n-1 2\n2 0\n1 -2\n1 1\n-1 -1\n-1 -1\n3 5", "output"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKsusha is a beginner coder. Today she starts studying arrays. She has array a_1, a_2, ..., a_{n}, consisting of n positive integers.\n\nHer university teacher gave her a task. Find such number in the array, that all array...
[{"type": "stdin_stdout", "input": "5\n506904227 214303304 136194869 838256937 183952885\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "5\n506904227 214303304 136194869 838256937 183952885\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "5\n238711016 214303304 136194869 838256937 183952885\n", "outp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this Kata your task will be to return the count of pairs that have consecutive numbers as follows:\n```Haskell\npairs([1,2,5,8,-4,-3,7,6,5]) = 3\nThe pairs are selected as follows [(1,2),(5,8),(-4,-3),(7,6),5]\n--the f...
[{"input": "[21, 20, 22, 40, 39, -56, 30, -55, 95, 94]", "output": "[2]", "fn_name": "pairs"}, {"input": "[81, 44, 80, 26, 12, 27, -34, 37, -35]", "output": "[0]", "fn_name": "pairs"}, {"input": "[-55, -56, -7, -6, 56, 55, 63, 62]", "output": "[4]", "fn_name": "pairs"}, {"input": "[1, 2, 5, 8, -4, -3, 7, 6, 5]", "outpu...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nSomeone gave Alyona an array containing n positive integers a_1, a_2, ..., a_{n}. In one operation, Alyona can choose any element of the array and decrease it, i.e. replace with any positive integer that is smaller than t...
[{"type": "stdin_stdout", "input": "10\n1 1 1 10000000 10000000 10000000 10000000 10000000 10000000 10000000\n", "output": "9\n"}, {"type": "stdin_stdout", "input": "10\n1 1 1 10000000 10000000 10000000 10000000 10000000 10000000 10000000\n", "output": "9\n"}, {"type": "stdin_stdout", "input": "10\n1 1 1 10000000 10000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA positive integer number n is written on a blackboard. It consists of not more than 105 digits. You have to transform it into a beautiful number by erasing some of the digits, and you want to erase as few digits as possi...
[{"type": "stdin_stdout", "input": "53684795681792590016697187295561462737810600000146840941336328677293748561247888801665863139922929397968535048060292988802347668853531069156825523164438370977880256909710958836918627008217572514193873141535365258436916984535972865113877338591947508645026570682995314540038481160747606...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nChuck has lost count of how many asses he has kicked...\n\nChuck stopped counting at 100,000 because he prefers to kick things in the face instead of counting. That's just who he is.\n\nTo stop having to count like a mere...
[{"input": "\" 76 B2L4D0A8C6.-T%8.90. lkd\"", "output": "[true]", "fn_name": "body_count"}, {"input": "\"ffr65A C8K4D9U7V5.-Y%8.00.\"", "output": "[true]", "fn_name": "body_count"}, {"input": "\"PP P6A6T5F5S3.-Z%1.11.hgr\"", "output": "[true]", "fn_name": "body_count"}, {"input": "\"d G8H1E2O9N3.-W%8.56. f\""...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nWhile playing with geometric figures Alex has accidentally invented a concept of a $n$-th order rhombus in a cell grid.\n\nA $1$-st order rhombus is just a square $1 \\times 1$ (i.e just a cell).\n\nA $n$-th order rhombus...
[{"type": "stdin_stdout", "input": "100\n", "output": "19801\n"}, {"type": "stdin_stdout", "input": "100\n", "output": "19801"}, {"type": "stdin_stdout", "input": "72\n", "output": "10225\n"}, {"type": "stdin_stdout", "input": "94\n", "output": "17485\n"}, {"type": "stdin_stdout", "input": "77\n", "output": "11705\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTired of boring office work, Denis decided to open a fast food restaurant.\n\nOn the first day he made $a$ portions of dumplings, $b$ portions of cranberry juice and $c$ pancakes with condensed milk.\n\nThe peculiarity of...
[{"type": "stdin_stdout", "input": "7\n1 4 1\n0 0 0\n16 0 1\n2 2 2\n2 3 2\n3 2 2\n0 4 4\n", "output": "3\n0\n2\n4\n5\n5\n3\n"}, {"type": "stdin_stdout", "input": "7\n0 1 1\n0 0 0\n11 1 1\n2 2 4\n3 3 3\n4 2 3\n0 6 1\n", "output": "2\n0\n3\n5\n6\n5\n2\n"}, {"type": "stdin_stdout", "input": "7\n1 2 1\n0 0 0\n16 1 1\n2 2 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nM-kun is a brilliant air traffic controller.\n\nOn the display of his radar, there are N airplanes numbered 1, 2, ..., N, all flying at the same altitude.\nEach of the airplanes flies at a constant speed of 0.1 per second...
[{"type": "stdin_stdout", "input": "8\n285 224 U\n130 175 R\n111 322 D\n121 188 L\n201 116 U\n112 121 R\n145 239 D\n185 107 L", "output": "SAFE\n"}, {"type": "stdin_stdout", "input": "8\n285 224 U\n130 175 R\n101 322 D\n121 188 L\n201 116 U\n112 121 R\n145 239 D\n185 107 L", "output": "SAFE\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nShell Sort\n\nShell Sort is a generalization of Insertion Sort to arrange a list of $n$ elements $A$.\n\n\n1 insertionSort(A, n, g)\n2 for i = g to n-1\n3 v = A[i]\n4 j = i - g\n5 while j ...
[{"type": "stdin_stdout", "input": "5\n10\n1\n5\n9\n1", "output": "2\n4 1\n1\n1\n1\n5\n9\n10\n"}, {"type": "stdin_stdout", "input": "5\n10\n1\n5\n7\n1", "output": "2\n4 1\n1\n1\n1\n5\n7\n10\n"}, {"type": "stdin_stdout", "input": "5\n6\n1\n10\n7\n1", "output": "2\n4 1\n4\n1\n1\n6\n7\n10\n"}, {"type": "stdin_stdout", "in...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMonocarp is playing a computer game. In this game, his character fights different monsters.\n\nA fight between a character and a monster goes as follows. Suppose the character initially has health $h_C$ and attack $d_C$; ...
[{"type": "stdin_stdout", "input": "2\n1000000000000000 1\n1000000000000000 200000\n0 1 1\n1000000000000000 200000\n1000000000000000 1\n0 1 1\n", "output": "NO\nYES\n"}, {"type": "stdin_stdout", "input": "2\n1000000000000000 1\n1000000000000000 1000000000\n1000 10000 10000000000\n9 2\n16 4\n0 10 10\n", "output": "NO\nN...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Queen of England has n trees growing in a row in her garden. At that, the i-th (1 ≤ i ≤ n) tree from the left has height a_{i} meters. Today the Queen decided to update the scenery of her garden. She wants the trees' ...
[{"type": "stdin_stdout", "input": "50 5\n232 6 17 6 21 26 27 36 41 88 665 56 61 66 71 76 602 86 28 712 101 106 111 116 121 126 131 136 141 146 151 156 161 166 755 176 181 186 191 196 201 206 211 216 5 226 172 236 241 246\n", "output": "12\n- 1 231\n- 3 6\n+ 4 10\n+ 7 4\n- 10 42\n- 11 614\n- 17 521\n+ 19 63\n- 20 616\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVK news recommendation system daily selects interesting publications of one of n disjoint categories for each user. Each publication belongs to exactly one category. For each category i batch algorithm selects a_i publica...
[{"type": "stdin_stdout", "input": "40\n19 20 8 13 13 17 1 14 15 20 14 17 2 9 9 10 19 16 6 12 9 7 20 5 12 6 4 4 12 5 4 11 8 1 2 8 11 19 18 4\n52258 5648 46847 9200 101064 79328 64407 54479 1788 60107 8234 64215 15419 84411 50307 78075 92548 17867 43456 7970 1390 99373 97297 90662 82950 678 79356 51351 2794 82477 16508 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given three strings A, B and C. Check whether they form a word chain.\nMore formally, determine whether both of the following are true:\n - The last character in A and the initial character in B are the same.\n - ...
[{"type": "stdin_stdout", "input": "aaaaaaaaab aaaaaaaaaa aaaaaaaaab\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "baaaa`aaaa aabaaaaaaa aaaaa`aaab", "output": "YES\n"}, {"type": "stdin_stdout", "input": "baaaaaaa`` `aaaaaabaa aaaaa`aaab", "output": "YES\n"}, {"type": "stdin_stdout", "input": "baaabaaa`` `a...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHarry Potter and He-Who-Must-Not-Be-Named engaged in a fight to the death once again. This time they are located at opposite ends of the corridor of length l. Two opponents simultaneously charge a deadly spell in the enem...
[{"type": "stdin_stdout", "input": "1000\n148\n500\n", "output": "228.39506172839506\n"}, {"type": "stdin_stdout", "input": "425\n458\n118\n", "output": "337.93402777777777\n"}, {"type": "stdin_stdout", "input": "496\n326\n429\n", "output": "214.16688741721853\n"}, {"type": "stdin_stdout", "input": "745\n152\n417\n", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nI assume most of you are familiar with the ancient legend of the rice (but I see wikipedia suggests [wheat](https://en.wikipedia.org/wiki/Wheat_and_chessboard_problem), for some reason) problem, but a quick recap for you:...
[{"input": "0", "output": "[0]", "fn_name": "squares_needed"}, {"input": "1", "output": "[1]", "fn_name": "squares_needed"}, {"input": "2", "output": "[2]", "fn_name": "squares_needed"}, {"input": "3", "output": "[2]", "fn_name": "squares_needed"}, {"input": "4", "output": "[3]", "fn_name": "squares_needed"}]
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis problem consists of three subproblems: for solving subproblem C1 you will receive 4 points, for solving subproblem C2 you will receive 4 points, and for solving subproblem C3 you will receive 8 points.\n\nManao decid...
[{"type": "stdin_stdout", "input": "40 3\n1 62395\n5 40319\n4 165445\n10 137479\n10 47829\n8 9741\n5 148106\n10 25494\n18 162856\n2 106581\n0 194523\n9 148086\n1 100862\n6 147600\n6 107486\n6 166873\n7 16721\n4 22192\n0 8827\n1 197146\n10 8949\n0 150443\n9 148348\n3 143935\n1 139371\n7 128821\n10 107760\n4 141821\n1 35...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Task\n\nElections are in progress!\n\nGiven an array of numbers representing votes given to each of the candidates, and an integer which is equal to the number of voters who haven't cast their vote yet, find the number ...
[{"input": "[1, 3, 3, 1, 1]\n0", "output": "[0]", "fn_name": "elections_winners"}, {"input": "[5, 1, 3, 4, 1]\n0", "output": "[1]", "fn_name": "elections_winners"}, {"input": "[3, 1, 1, 3, 1]\n2", "output": "[2]", "fn_name": "elections_winners"}, {"input": "[2, 3, 5, 2]\n3", "output": "[2]", "fn_name": "elections_winne...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\n**Getting Familiar:**\nLEET: (sometimes written as \"1337\" or \"l33t\"), also known as eleet or leetspeak, is another alphabet for the English language that is used mostly on the internet. It uses various combinations of...
[{"input": "\"Do you also think these quotes are conflicting each other?\"", "output": "[\"\\u03b4\\u03b8 \\u03b3\\u03b8\\u03bc \\u03b1ls\\u03b8 \\u03c4h\\u03b9\\u03b7\\u03ba \\u03c4h\\u03b5s\\u03b5 q\\u03bc\\u03b8\\u03c4\\u03b5s \\u03b1\\u03c0\\u03b5 c\\u03b8\\u03b7fl\\u03b9c\\u03c4\\u03b9\\u03b7g \\u03b5\\u03b1ch \\u...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nOur Chef is catering for a big corporate office party and is busy preparing different mouth watering dishes. The host has insisted that he serves his delicious cupcakes for dessert. \n\nOn the day of the party, the Chef w...
[{"type": "stdin_stdout", "input": "4\n38\n13\n31\n2", "output": "17\n12\n30\n1\n"}, {"type": "stdin_stdout", "input": "4\n38\n13\n16\n2", "output": "17\n12\n0\n1\n"}, {"type": "stdin_stdout", "input": "4\n131\n14\n1\n4", "output": "130\n5\n0\n0\n"}, {"type": "stdin_stdout", "input": "4\n19\n13\n16\n2", "output": "18\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.\n\...
[{"type": "stdin_stdout", "input": "10\n4 7 480392999\n3 4 32525297\n9 7 417904789\n6 2 836294777\n5 3 616099185\n1 7 1310915575\n8 10 838073755\n5 10 547050646\n2 1 12607780\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10\n4 7 480392999\n3 4 32525297\n9 7 417904789\n6 2 836294777\n5 3 616099185\n1 7 131091...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nThe island where JOI lives has been invaded by zombies. JOI decided to escape to the shelter, which is set as the safest shelter on the island.\n\nThe island where JOI lives consists of N towns from town 1 to t...
[{"type": "stdin_stdout", "input": "13 21 1 1\n1001 6000\n11\n4 2\n3 7\n2 4\n8 8\n8 4\n2 10\n3 4\n6 7\n7 10\n10 11\n5 9\n11 10\n3 6\n4 5\n1 6\n13 12\n6 7\n8 11\n6 13\n7 8\n2 12", "output": "1001\n"}, {"type": "stdin_stdout", "input": "13 21 1 1\n1010 10247\n7\n1 2\n3 7\n2 4\n5 8\n8 9\n2 5\n3 4\n4 7\n9 10\n10 11\n9 9\n7...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya decided to go to the grocery store. He found in his wallet $a$ coins of $1$ burle and $b$ coins of $2$ burles. He does not yet know the total cost of all goods, so help him find out $s$ ($s > 0$): the minimum positi...
[{"type": "stdin_stdout", "input": "7\n1 1\n4 0\n0 2\n0 0\n2314 2374\n0 0\n1 1\n", "output": "4\n5\n1\n1\n7063\n1\n4\n"}, {"type": "stdin_stdout", "input": "5\n1 1\n4 0\n0 2\n0 0\n2314 2374\n", "output": "4\n5\n1\n1\n7063\n"}, {"type": "stdin_stdout", "input": "1\n1123112 1221133\n", "output": "3565379\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have a digit sequence S of length 4. You are wondering which of the following formats S is in:\n - YYMM format: the last two digits of the year and the two-digit representation of the month (example: 01 for January), ...
[{"type": "stdin_stdout", "input": "0112\n", "output": "AMBIGUOUS\n"}, {"type": "stdin_stdout", "input": "0101\n", "output": "AMBIGUOUS\n"}, {"type": "stdin_stdout", "input": "1211", "output": "AMBIGUOUS\n"}, {"type": "stdin_stdout", "input": "1204", "output": "AMBIGUOUS\n"}, {"type": "stdin_stdout", "input": "0112", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis program tests the life of an\nevaporator containing a gas. \n\nWe know the content of the evaporator (content in ml),\nthe percentage of foam or gas lost every day (evap_per_day)\nand the threshold (threshold) in per...
[{"input": "10\n10\n10", "output": "[22]", "fn_name": "evaporator"}, {"input": "47.5\n8\n8", "output": "[31]", "fn_name": "evaporator"}, {"input": "100\n1\n1", "output": "[459]", "fn_name": "evaporator"}, {"input": "100\n1\n5", "output": "[299]", "fn_name": "evaporator"}, {"input": "10\n10\n5", "output": "[29]", "fn_na...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian. \n\nRupsa recently started to intern under Chef. He gave her N type of ingredients of varying quantity A_{1}, A_{2}, ..., A_{N} respectively to store it. But as ...
[{"type": "stdin_stdout", "input": "2\n-1\n3 111\n-1\n9", "output": "113\n2\n"}, {"type": "stdin_stdout", "input": "2\n-1\n3 101\n-1\n9", "output": "103\n2\n"}, {"type": "stdin_stdout", "input": "2\n-2\n2 25\n-2\n16", "output": "27\n2\n"}, {"type": "stdin_stdout", "input": "2\n-1\n3 12\n-1\n9", "output": "14\n2\n"}, {"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAccording to a new ISO standard, a flag of every country should have a chequered field n × m, each square should be of one of 10 colours, and the flag should be «striped»: each horizontal row of the flag should contain sq...
[{"type": "stdin_stdout", "input": "20 19\n1111111111111111111\n8247715032316286876\n0000001000000000000\n4784876473600342372\n1111111111111111111\n2222222222222222222\n4444444444444444444\n5555555555555555555\n0000000000000000010\n4444444444444444444\n0000000000000000000\n5555555555555555555\n11500026576261848309\n999...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWhen you play the game of thrones, you win, or you die. There is no middle ground.\n\nCersei Lannister, A Game of Thrones by George R. R. Martin\n\nThere are n nobles, numbered from 1 to n. Noble i has a power of i. There...
[{"type": "stdin_stdout", "input": "20 53\n1 2\n1 4\n1 5\n1 6\n1 7\n1 8\n1 20\n2 3\n2 6\n2 16\n2 17\n3 6\n3 18\n3 20\n4 6\n4 7\n4 8\n4 18\n4 14\n4 18\n5 11\n5 16\n5 17\n2 18\n5 19\n6 8\n6 13\n7 8\n7 10\n7 15\n7 17\n14 18\n8 15\n8 16\n4 10\n17 15\n10 11\n10 17\n10 20\n11 15\n11 17\n12 14\n12 15\n12 16\n16 19\n14 16\n14 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given strings $S$ and $T$, consisting of lowercase English letters. It is guaranteed that $T$ is a permutation of the string abc.\n\nFind string $S'$, the lexicographically smallest permutation of $S$ such that $T...
[{"type": "stdin_stdout", "input": "7\nabacaba\nabc\ncccba\nacb\ndbsic\nbac\nabracadabra\nabc\ndddddddddddd\ncba\nbbc\nabc\nac\nabc\n", "output": "aaaacbb\nabccc\nbcdis\naaaaacbbdrr\ndddddddddddd\nbbc\nac\n"}, {"type": "stdin_stdout", "input": "7\nabacaba\nabc\ncccba\nacb\ndbsic\nbac\nabracadabra\nabc\ndddddddddddd\ncb...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCreate a program that calculates and outputs the surface distance by inputting the north latitude and east longitude of two cities on the earth. However, the earth is a sphere with a radius of 6,378.1 km, and the surface ...
[{"type": "stdin_stdout", "input": "35.997652258458864 139.77 51.15 361.449066466584\n1.6512558665331527 105.35573273382599 41.78 272.61282853754\n51.62303215206055 360.59086045680647 -34.03891385785915 302.61951676416413\n-1 -1 -1 -1", "output": "9516\n15035\n11082\n"}, {"type": "stdin_stdout", "input": "36.4199056430...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVova promised himself that he would never play computer games... But recently Firestorm — a well-known game developing company — published their newest game, World of Farcraft, and it became really popular. Of course, Vov...
[{"type": "stdin_stdout", "input": "10 5\n1 6 2 11 3 8 4 9 5 10\n1 2\n3 5\n5 6\n7 10\n9 10\n", "output": "27\n"}, {"type": "stdin_stdout", "input": "10 3\n1 6 2 27 1 8 1 9 5 1\n1 2\n3 1\n10 6\n7 8\n17 10\n", "output": "45\n"}, {"type": "stdin_stdout", "input": "10 3\n1 6 2 17 1 8 1 9 5 1\n1 2\n3 1\n10 6\n7 8\n17 10\n",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIvan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The $i$-th page contains some mystery that will be explained ...
[{"type": "stdin_stdout", "input": "17\n15 4 3 6 5 11 8 8 9 10 15 12 13 14 17 16 17\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "17\n16 4 3 6 7 6 10 8 9 10 11 12 13 14 15 16 17\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "17\n9 4 3 6 7 6 10 8 9 10 11 12 13 14 15 16 17\n", "output": "8\n"}, {"typ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this kata, the number 0 is infected. You are given a list. Every turn, any item in the list that is adjacent to a 0 becomes infected and transforms into a 0. How many turns will it take for the whole list to become inf...
[{"input": "[0, 1, 1, 1, 0]", "output": "[2]", "fn_name": "infected_zeroes"}, {"input": "[1, 1, 0, 1, 1]", "output": "[2]", "fn_name": "infected_zeroes"}, {"input": "[0, 1, 1, 0]", "output": "[1]", "fn_name": "infected_zeroes"}, {"input": "[0, 1, 1, 1]", "output": "[3]", "fn_name": "infected_zeroes"}, {"input": "[1, 1,...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet x be a string of length at least 1.\nWe will call x a good string, if for any string y and any integer k (k \\geq 2), the string obtained by concatenating k copies of y is different from x.\nFor example, a, bbc and cd...
[{"type": "stdin_stdout", "input": "bcbc\n", "output": "2\n3\n"}, {"type": "stdin_stdout", "input": "aab\n", "output": "1\n1\n"}, {"type": "stdin_stdout", "input": "ddd\n", "output": "3\n1\n"}, {"type": "stdin_stdout", "input": "adad", "output": "2\n3\n"}, {"type": "stdin_stdout", "input": "bbcc", "output": "1\n1\n"}, ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKolya got an integer array $a_1, a_2, \\dots, a_n$. The array can contain both positive and negative integers, but Kolya doesn't like $0$, so the array doesn't contain any zeros.\n\nKolya doesn't like that the sum of some...
[{"type": "stdin_stdout", "input": "100\n-6 2 8 -9 -9 3 -3 -2 7 3 2 -2 -9 -7 -10 -9 10 4 5 -9 8 -5 7 -2 6 -2 4 4 -2 -5 6 4 8 -8 9 7 -4 2 -3 7 4 -10 -7 -4 8 2 10 -8 -3 -8 -5 -5 -10 -6 -8 -5 7 -1 7 -5 9 10 3 5 10 -7 -3 -7 1 -5 -8 5 1 -1 4 10 2 6 -4 9 3 10 -5 -10 -10 -2 1 9 10 1 10 2 8 -3 -3 -1 7 -5 8 -4\n", "output": "11...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGargari got bored to play with the bishops and now, after solving the problem about them, he is trying to do math homework. In a math book he have found k permutations. Each of them consists of numbers 1, 2, ..., n in som...
[{"type": "stdin_stdout", "input": "41 4\n24 15 17 35 13 41 4 14 23 5 8 16 21 18 30 36 6 22 11 29 26 1 40 31 7 3 32 10 28 38 12 20 39 37 34 19 33 27 2 25 9\n22 13 25 24 38 35 29 12 15 8 11 37 3 19 4 23 18 32 30 40 36 21 16 34 27 9 5 41 39 2 14 17 31 33 26 7 1 10 20 6 28\n31 27 39 16 22 12 13 32 6 10 19 29 37 7 18 33 24...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAll cinema halls in Berland are rectangles with K rows of K seats each, and K is an odd number. Rows and seats are numbered from 1 to K. For safety reasons people, who come to the box office to buy tickets, are not allowe...
[{"type": "stdin_stdout", "input": "100 67\n66 12 2 49 62 63 59 14 13 26 15 25 22 16 33 17 15 14 13 33 9 10 53 28 17 27 18 39 35 64 1 59 33 24 66 64 4 2 4 5 22 9 52 36 44 57 62 3 52 21 62 55 25 2 65 18 20 40 8 30 27 28 47 19 67 67 42 6 53 17 36 38 57 37 45 13 58 12 31 24 15 67 9 18 56 20 34 8 20 31 13 19 42 12 16 15 54...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA palindrome is a string that reads the same backward as forward. For example, the strings \"z\", \"aaa\", \"aba\", and \"abccba\" are palindromes, but \"codeforces\" and \"ab\" are not. You hate palindromes because they ...
[{"type": "stdin_stdout", "input": "6\ncbabc\nab\nzza\nba\na\nnutforajaroftuna\n", "output": "\nYES\ncbabac\nYES\naab\nYES\nzaza\nYES\nbaa\nNO\nYES\nnutforajarofatuna\n"}, {"type": "stdin_stdout", "input": "6\ncbabc\nab\nzza\nba\na\nnutforajaroftuna\n", "output": "YES\ncbabca\nYES\naab\nYES\nzzaa\nYES\nbaa\nNO\nYES\nnu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIt's hard times now. Today Petya needs to score 100 points on Informatics exam. The tasks seem easy to Petya, but he thinks he lacks time to finish them all, so he asks you to help with one..\n\nThere is a glob pattern in...
[{"type": "stdin_stdout", "input": "k\n*\n89\nb\ncbbbc\ncabac\nbccbb\nccc\ncabaa\nabbaa\nccbaa\nccccb\ncabbb\nbbcbc\nbac\naaac\nabb\nbcbb\ncb\nbacc\nbbaba\nb\nacc\nbaac\naaba\nbcbba\nbaa\nbc\naaccb\nb\nab\nc\nbbbb\nabbcb\nacbb\ncba\nc\nbac\nc\nac\ncc\nb\nbbc\nbaab\nc\nbbc\nab\nb\nc\naa\naab\nab\naccbc\nacbaa\na\nccc\nc...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFailed Filter - Bug Fixing #3\nOh no, Timmy's filter doesn't seem to be working? Your task is to fix the FilterNumber function to remove all the numbers from the string.\n\nWrite your solution by modifying this code:\n\n`...
[{"input": "\"aa1bb2cc3dd\"", "output": "[\"aabbccdd\"]", "fn_name": "filter_numbers"}, {"input": "\"CodeWars\"", "output": "[\"CodeWars\"]", "fn_name": "filter_numbers"}, {"input": "\"test123\"", "output": "[\"test\"]", "fn_name": "filter_numbers"}, {"input": "\"a1b2c3\"", "output": "[\"abc\"]", "fn_name": "filter_num...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nFrom \"ftying rats\" to urban saniwation workers - can synthetic biology tronsform how we think of pigeons? \n\nThe upiquitous pigeon has long been viewed as vermin - spleading disease, scavenging through trush, and defec...
[{"type": "stdin_stdout", "input": "10\n9 16 19 23 7 14 21 15 14 6\n", "output": "23\n"}, {"type": "stdin_stdout", "input": "10\n5 20 18 1 12 17 22 20 26 4\n", "output": "21\n"}, {"type": "stdin_stdout", "input": "10\n9 16 19 23 7 14 21 15 14 6\n", "output": "23\n"}, {"type": "stdin_stdout", "input": "10\n5 20 18 1 12 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is an integer sequence of length N: A_1, A_2, \\cdots, A_N.\nAn integer sequence X, which is also of length N, will be chosen randomly by independently choosing X_i from a uniform distribution on the integers 1, 2, ...
[{"type": "stdin_stdout", "input": "6\n680824625 680824626 680824626 680824624 680824626 680824624\n", "output": "655804632\n"}, {"type": "stdin_stdout", "input": "6\n612348318 612348320 612348320 612348319 612348318 612348317\n", "output": "110656261\n"}, {"type": "stdin_stdout", "input": "6\n101617840 101617840 10161...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is the number of elements in the array.\n\nYou are given an array $a$ consisting of $n$ integers. In one move you can choose any $a_i$ and divide it by $2$ rounding down ...
[{"type": "stdin_stdout", "input": "50 25\n199970 199997 199998 199988 199999 199981 200000 199990 199974 199985 199932 200000 199966 199999 199999 199951 199983 199975 199974 199996 199974 199992 199979 199995 199955 199989 199960 199975 199983 199990 199950 199952 199999 199999 199962 199939 199979 199977 199962 1999...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe courier charges for a courier company are set according to size and weight as shown in the table below.\n\nA size | B size | C size | D size | E size | F size\n--- | --- | --- | --- | --- | --- | ---\nSize | 60 cm or ...
[{"type": "stdin_stdout", "input": "2\n86 25 5 5\n135 60 10 30\n3\n10 8 25 24\n5 16 13 9\n30 30 30 14\n0", "output": "1200\n3800\n"}, {"type": "stdin_stdout", "input": "2\n51 0 5 15\n107 60 3 30\n3\n10 15 25 47\n2 12 12 3\n30 30 11 11\n0", "output": "1200\n2000\n"}, {"type": "stdin_stdout", "input": "2\n50 34 5 5\n80 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this Kata, we are going to determine if the count of each of the characters in a string can be equal if we remove a single character from that string.\n\nFor example:\n```\nsolve('abba') = false -- if we remove any cha...
[{"input": "\"aabbccddd\"", "output": "[true]", "fn_name": "solve"}, {"input": "\"aaabcde\"", "output": "[false]", "fn_name": "solve"}, {"input": "\"aabbcc\"", "output": "[false]", "fn_name": "solve"}, {"input": "\"aaaabb\"", "output": "[false]", "fn_name": "solve"}, {"input": "\"abbccc\"", "output": "[false]", "fn_nam...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nVlad likes to eat in cafes very much. During his life, he has visited cafes n times. Unfortunately, Vlad started to feel that his last visits are not any different from each other. To fix that Vlad had a small research.\n...
[{"type": "stdin_stdout", "input": "8\n200000 1 200000 1 200000 1 200000 2\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "8\n200000 1 200000 1 200000 1 200000 2\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "5\n100 1000 1000 1000 1000\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "5\n100...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the d...
[{"type": "stdin_stdout", "input": "10\n10\n6 2 1 1 1 10 10 2 10 5\n8\n1 3 1 1 4 5 4 4\n9\n14 6 9 9 2 8 7 2 2\n10\n9 4 3 3 5 4 3 10 4 5\n9\n7 5 1 7 5 5 5 5 6\n8\n8 8 4 4 7 6 2 8\n10\n6 8 1 6 8 8 5 6 8 4\n10\n5 5 5 8 3 4 3 3 10 10\n8\n1 1 3 6 6 7 1 2\n8\n4 1 3 5 3 1 3 3\n", "output": "NO\nYES\nYES\nYES\nYES\nYES\nYES\nY...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Two-dimensional kingdom is going through hard times... This morning the Three-Dimensional kingdom declared war on the Two-dimensional one. This (possibly armed) conflict will determine the ultimate owner of the straig...
[{"type": "stdin_stdout", "input": "33 23 17 2\n1 1 2 2 2 3 3 3 3 3 3 4 4 4 4 4 5 5 5 6 6 7 7 7 8 8 8 8 8 9 9 10 10\n1 1 3 3 4 4 4 5 5 6 6 6 7 8 8 8 8 8 8 9 9 10 10\n", "output": "23\n1 1\n2 2\n3 3\n4 4\n5 5\n6 6\n7 7\n8 8\n9 9\n12 10\n13 11\n14 12\n17 13\n20 14\n21 15\n22 16\n23 17\n24 18\n25 19\n26 20\n27 21\n28 22\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn some other world, today is the day before Christmas Eve.\nMr. Takaha is buying N items at a department store. The regular price of the i-th item (1 \\leq i \\leq N) is p_i yen (the currency of Japan).\nHe has a discoun...
[{"type": "stdin_stdout", "input": "10\n10000\n10000\n10000\n10000\n10000\n10000\n10000\n10000\n10000\n10000\n", "output": "95000\n"}, {"type": "stdin_stdout", "input": "10\n8830\n106\n9248\n6388\n3562\n7160\n8452\n3486\n5802\n9228\n", "output": "57638\n"}, {"type": "stdin_stdout", "input": "9\n6126\n5482\n9198\n9274\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Scenario \n\nWith **_Cereal crops_** like wheat or rice, before we can eat the grain kernel, we need to remove that inedible hull, or *to separate the wheat from the chaff*.\n___\n\n# Task\n\n**_Given_** a *sequence of ...
[{"input": "[-16, 44, -7, -31, 9, -43, -44, -18, 50, 39, -46, -24, 3, -34, -27]", "output": "[[-16, -27, -7, -31, -34, -43, -44, -18, -24, -46, 39, 50, 3, 9, 44]]", "fn_name": "wheat_from_chaff"}, {"input": "[-17, 7, -12, 10, 4, -8, -19, -24, 40, 31, -29, 21, -45, 1]", "output": "[[-17, -45, -12, -29, -24, -8, -19, 4, ...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nWelcome young Jedi! In this Kata you must create a function that takes an amount of US currency in `cents`, and returns a dictionary/hash which shows the least amount of coins used to make up that amount. The only coin de...
[{"input": "100", "output": "[{\"Nickels\": 0, \"Pennies\": 0, \"Dimes\": 0, \"Quarters\": 4}]", "fn_name": "loose_change"}, {"input": "7.9", "output": "[{\"Nickels\": 1, \"Pennies\": 2, \"Dimes\": 0, \"Quarters\": 0}]", "fn_name": "loose_change"}, {"input": "56", "output": "[{\"Nickels\": 1, \"Pennies\": 1, \"Dimes\":...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nMahmoud has an array a consisting of n integers. He asked Ehab to find another array b of the same length such that:\n\n b is lexicographically greater than or equal to a. b_{i} ≥ 2. b is pairwise coprime: for every 1 ...
[{"type": "stdin_stdout", "input": "10\n5 3 2 2 3 3 3 4 2 5\n", "output": "5 3 2 7 11 13 17 19 23 29 "}, {"type": "stdin_stdout", "input": "10\n5 3 2 2 3 3 3 4 2 5\n", "output": "5 3 2 7 11 13 17 19 23 29 "}, {"type": "stdin_stdout", "input": "10\n5 3 4 2 3 3 3 4 2 5\n", "output": "5 3 4 7 11 13 17 19 23 29\n"}, {"type...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two positive integers ```a``` and ```b```.\n\nYou can perform the following operations on ```a``` so as to obtain ```b``` :\n```\n(a-1)/2 (if (a-1) is divisible by 2)\na/2 (if a is divisible by 2)\na...
[{"input": "4\n16", "output": "[2]", "fn_name": "operation"}, {"input": "1\n1", "output": "[0]", "fn_name": "operation"}, {"input": "2\n4", "output": "[1]", "fn_name": "operation"}, {"input": "3\n8", "output": "[4]", "fn_name": "operation"}, {"input": "4\n1", "output": "[2]", "fn_name": "operation"}, {"input": "1\n4", ...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nDreamoon likes sequences very much. So he created a problem about the sequence that you can't find in OEIS: \n\nYou are given two integers d, m, find the number of arrays a, satisfying the following constraints:\n\n * Th...
[{"type": "stdin_stdout", "input": "10\n1 1100000000\n2 1587398050\n4 99999998\n4 9999997\n5 999996\n10 99995\n9 9994\n8 1104\n12 92\n19 1\n", "output": "1\n3\n11\n11\n17\n119\n89\n59\n87\n0\n"}, {"type": "stdin_stdout", "input": "10\n1 1100000000\n2 1587398050\n3 99999998\n4 9999997\n5 999996\n18 99995\n9 9994\n8 1104...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWelcome to PC Koshien, players. Physical condition management is important to participate in the event. It is said that at the turn of the season when the temperature fluctuates greatly, it puts a strain on the body and i...
[{"type": "stdin_stdout", "input": "30 20\n55 0\n32 18\n2 23\n43 21\n34 10\n20 -13", "output": "10\n55\n14\n-21\n22\n24\n33\n"}, {"type": "stdin_stdout", "input": "30 19\n39 20\n19 18\n4 20\n22 21\n23 10\n10 -10", "output": "11\n19\n1\n-16\n1\n13\n20\n"}, {"type": "stdin_stdout", "input": "30 19\n39 20\n19 18\n4 20\n22...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.\n\nThe dot product of two integer number vectors x and y of size n is the sum of the produc...
[{"type": "stdin_stdout", "input": "5\n1 0 1 0 1\n0 1 0 1 0\n1 0 1 0 1\n0 1 0 1 0\n1 0 1 0 1\n7\n3\n2 4\n1 3\n3\n2 5\n1 2\n3\n", "output": "111\n"}, {"type": "stdin_stdout", "input": "5\n1 0 1 1 1\n0 1 0 1 0\n1 0 1 1 1\n0 1 0 1 0\n1 0 1 0 0\n7\n3\n2 4\n1 3\n3\n2 5\n1 1\n3\n", "output": "000\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two strings $s$ and $t$, both consisting of lowercase English letters. You are going to type the string $s$ character by character, from the first character to the last one.\n\nWhen typing a character, inste...
[{"type": "stdin_stdout", "input": "10\npaxghjnihn\nhn\nhdmevxvn\nn\nazdfhfxem\nxem\neowhldode\ndode\nwlclsnht\nct\nbpflheocamv\nv\nflejfh\nhixqqbnikthccagc\ndugt\neebmbpykcsmi\noivgrzwppny\nzhfyiuu\nebkqjcbcwviqkojnzyruwygtbvwws\nbofzr\n", "output": "YES\nYES\nYES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\n"}, {"type": "stdin_st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConsider a sequence generation that follows the following steps. We will store removed values in variable `res`. Assume `n = 25`:\n```Haskell\n-> [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25] Let's r...
[{"input": "10000", "output": "[4721110]", "fn_name": "solve"}, {"input": "1000", "output": "[63589]", "fn_name": "solve"}, {"input": "100", "output": "[993]", "fn_name": "solve"}, {"input": "25", "output": "[107]", "fn_name": "solve"}, {"input": "50", "output": "[304]", "fn_name": "solve"}, {"input": "7", "output": "[...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is the number of elements in the array.\n\nYou are given an array $a$ consisting of $n$ integers. In one move you can choose any $a_i$ and divide it by $2$ rounding down ...
[{"type": "stdin_stdout", "input": "50 25\n199970 199997 199998 199988 199999 199981 200000 199990 199974 199985 199932 200000 199966 199999 199999 199951 199983 199975 199974 199996 199974 199992 199979 199995 199955 199989 199960 199975 199983 199990 199950 199952 199999 199999 199962 199939 199979 199977 199962 1999...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMany people choose to obfuscate their email address when displaying it on the Web. One common way of doing this is by substituting the `@` and `.` characters for their literal equivalents in brackets.\n\nExample 1:\n```\n...
[{"input": "\"Hmm, this would be better with input validation...!\"", "output": "[\"Hmm, this would be better with input validation [dot] [dot] [dot] !\"]", "fn_name": "obfuscate"}, {"input": "\"jim.kuback@ennerman-hatano.com\"", "output": "[\"jim [dot] kuback [at] ennerman-hatano [dot] com\"]", "fn_name": "obfuscate...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nSquirrel Liss is interested in sequences. She also has preferences of integers. She thinks n integers a_1, a_2, ..., a_{n} are good.\n\nNow she is interested in good sequences. A sequence x_1, x_2, ..., x_{k} is called go...
[{"type": "stdin_stdout", "input": "49\n10 34 58 72 126 166 176 180 198 200 208 228 238 248 302 332 340 344 350 354 380 406 418 428 438 442 482 532 536 544 546 554 596 626 642 682 684 704 714 792 804 820 862 880 906 946 954 966 970\n", "output": "49\n"}, {"type": "stdin_stdout", "input": "49\n10 34 58 72 126 166 176 18...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCheck your arrows\nYou have a quiver of arrows, but some have been damaged. The quiver contains arrows with an optional range information (different types of targets are positioned at different ranges), so each item is an...
[{"input": "[{\"range\": 5}, {\"range\": 10, \"damaged\": true}, {\"damaged\": true}]", "output": "[true]", "fn_name": "any_arrows"}, {"input": "[{\"range\": 5, \"damaged\": false}, {\"range\": 15, \"damaged\": true}]", "output": "[true]", "fn_name": "any_arrows"}, {"input": "[{\"range\": 10, \"damaged\": true}, {\"dam...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a_1, a_2, \\dots , a_n$, which is sorted in non-decreasing order ($a_i \\le a_{i + 1})$. \n\nFind three indices $i$, $j$, $k$ such that $1 \\le i < j < k \\le n$ and it is impossible to construct a...
[{"type": "stdin_stdout", "input": "3\n7\n4 6 11 11 15 18 20\n4\n10 10 10 11\n3\n1 1 1000000000\n", "output": "1 2 7\n-1\n1 2 3\n"}, {"type": "stdin_stdout", "input": "3\n7\n4 6 11 11 15 18 20\n4\n10 10 10 11\n3\n1 1 1000000000\n", "output": "1 2 7\n-1\n1 2 3\n"}, {"type": "stdin_stdout", "input": "3\n7\n4 6 11 11 15 1...
code_stdio