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\nYou are given n segments on the coordinate axis Ox and the number k. The point is satisfied if it belongs to at least k segments. Find the smallest (by the number of segments) set of segments on the coordinate axis Ox whi...
[{"type": "stdin_stdout", "input": "10 1\n-260424665 -168566709\n299109864 663179811\n769984405 942516913\n-998905510 -707148023\n-167958021 60599275\n658861231 718845364\n79407402 279078536\n13652788 79756488\n-676213666 -339118351\n-349156760 -258185154\n", "output": "5\n-998905510 -707148023\n-676213666 -168566709\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is enough money available on ATM in nominal value 10, 20, 50, 100, 200 and 500 dollars.\n\nYou are given money in nominal value of `n` with `1<=n<=1500`.\n\nTry to find minimal number of notes that must be used to r...
[{"input": "1250", "output": "[4]", "fn_name": "solve"}, {"input": "125", "output": "[-1]", "fn_name": "solve"}, {"input": "666", "output": "[-1]", "fn_name": "solve"}, {"input": "770", "output": "[4]", "fn_name": "solve"}, {"input": "550", "output": "[2]", "fn_name": "solve"}, {"input": "42", "output": "[-1]", "fn_nam...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a$ consisting of $n$ integers. Let's denote monotonic renumeration of array $a$ as an array $b$ consisting of $n$ integers such that all of the following conditions are met:\n\n $b_1 = 0$; for ev...
[{"type": "stdin_stdout", "input": "200\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLuba has to do n chores today. i-th chore takes a_{i} units of time to complete. It is guaranteed that for every $i \\in [ 2 . . n ]$ the condition a_{i} β‰₯ a_{i} - 1 is met, so the sequence is sorted.\n\nAlso Luba can wor...
[{"type": "stdin_stdout", "input": "100 1 99\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 10...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have a string s consisting of lowercase English letters. Snuke can perform the following operation repeatedly:\n\n* Insert a letter `x` to any position in s of his choice, including the beginning and end of s.\n\n\n\nS...
[{"type": "stdin_stdout", "input": "bxbax", "output": "-1\n"}, {"type": "stdin_stdout", "input": "xxabb", "output": "-1\n"}, {"type": "stdin_stdout", "input": "xyabb", "output": "-1\n"}, {"type": "stdin_stdout", "input": "bbayx", "output": "-1\n"}, {"type": "stdin_stdout", "input": "bb`yx", "output": "-1\n"}, {"type": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA schoolboy named Vasya loves reading books on programming and mathematics. He has recently read an encyclopedia article that described the method of median smoothing (or median filter) and its many applications in scienc...
[{"type": "stdin_stdout", "input": "168\n0 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 0 0 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 1 0 1 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 0 1 0 1 0 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a keyboard that consists of $26$ keys. The keys are arranged sequentially in one row in a certain order. Each key corresponds to a unique lowercase Latin letter.\n\nYou have to type the word $s$ on this keyb...
[{"type": "stdin_stdout", "input": "5\nabcdefghijklmnopqrstuvwxyz\nnlleh\nabcxefghijklmnopqrstuvwdyz\ni\nabcdefghhjllmnzpqrstuvwxyo\ncodeforecs\nmnbvcxzlkjhefdsapoiuytrgwq\nqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\nqwertyuiopasdfghjklzxcvbnm\nabacaba\n", "output": "12\n0\n106\n18\n74\n"}, {"type": "stdin_stdo...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFind the number with the most digits.\n\nIf two numbers in the argument array have the same number of digits, return the first one in the array.\n\nWrite your solution by modifying this code:\n\n```python\ndef find_longes...
[{"input": "[1, 200, 100000]", "output": "[100000]", "fn_name": "find_longest"}, {"input": "[3, 40000, 100]", "output": "[40000]", "fn_name": "find_longest"}, {"input": "[9000, 8, 800]", "output": "[9000]", "fn_name": "find_longest"}, {"input": "[8, 900, 500]", "output": "[900]", "fn_name": "find_longest"}, {"input": "...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis is the hard version of the problem. The difference between versions is the constraints on $n$ and $a_i$. You can make hacks only if all versions of the problem are solved.\n\nFirst, Aoi came up with the following ide...
[{"type": "stdin_stdout", "input": "87 83\n40 6 7 50 16 65 47 90 94 65 79 29 41 76 80 13 87 37 92 71 54 53 93 79 14 53 71 78 50 50 74 40 30 92 66 86 94 60 37 65 82 14 61 48 68 71 91 99 74 88 89 34 57 74 25 2 79 72 92 37 61 16 32 85 29 74 6 69 50 74 76 48 31 42 40 95 29 27 28 31 38 60 52 45 14 78 59\n", "output": "75\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition:\n\n* There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that...
[{"type": "stdin_stdout", "input": "aaaccacabaababb", "output": "11\n"}, {"type": "stdin_stdout", "input": "abbccacabaababa", "output": "13\n"}, {"type": "stdin_stdout", "input": "abbccaaabaababc", "output": "12\n"}, {"type": "stdin_stdout", "input": "`abab`cbbba`c`b", "output": "14\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nn hobbits are planning to spend the night at Frodo's house. Frodo has n beds standing in a row and m pillows (n ≀ m). Each hobbit needs a bed and at least one pillow to sleep, however, everyone wants as many pillows as po...
[{"type": "stdin_stdout", "input": "1000000000 1000000000 1000000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "100000000 999834114 93836827\n", "output": "29998\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000 1000000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "100000000 9998...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe most important part of a GSM network is so called Base Transceiver Station (BTS). These transceivers form the areas called cells (this term gave the name to the cellular phone) and every phone connects to the BTS with...
[{"type": "stdin_stdout", "input": "6\n3\n175\n101\n1057\n17888\n11057064", "output": "0\n43\n24\n262\n4469\n2764261\n"}, {"type": "stdin_stdout", "input": "6\n3\n175\n111\n1057\n17888\n11057064", "output": "0\n43\n26\n262\n4469\n2764261\n"}, {"type": "stdin_stdout", "input": "6\n1\n60\n100\n1526\n23456\n17396335", "ou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nКак извСстно, Π² Ρ‚Π΅ΠΏΠ»ΡƒΡŽ ΠΏΠΎΠ³ΠΎΠ΄Ρƒ ΠΌΠ½ΠΎΠ³ΠΈΠ΅ ΠΆΠΈΡ‚Π΅Π»ΠΈ ΠΊΡ€ΡƒΠΏΠ½Ρ‹Ρ… Π³ΠΎΡ€ΠΎΠ΄ΠΎΠ² ΠΏΠΎΠ»ΡŒΠ·ΡƒΡŽΡ‚ΡΡ сСрвисами городского Π²Π΅Π»ΠΎΠΏΡ€ΠΎΠΊΠ°Ρ‚Π°. Π’ΠΎΡ‚ ΠΈ Аркадий сСгодня Π±ΡƒΠ΄Π΅Ρ‚ Π΄ΠΎΠ±ΠΈΡ€Π°Ρ‚ΡŒΡΡ ΠΎΡ‚ ΡˆΠΊΠΎΠ»Ρ‹ Π΄ΠΎ Π΄ΠΎΠΌΠ°, ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΡ городскиС вСлосипСды.\n\nΠ¨ΠΊΠΎΠ»Π° ΠΈ Π΄ΠΎΠΌ находятся Π½Π°...
[{"type": "stdin_stdout", "input": "50 15001\n1269 1580 5431 5916 6642 14145 15760 19922 20589 22062 24138 33454 33505 35916 37012 42577 43140 49457 54720 55188 56205 56639 56870 57997 58379 59088 59297 61805 61861 63005 64013 68848 71182 71497 72715 73008 75616 76042 76614 80690 83089 85033 86408 92392 92763 93833 950...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven are strings s and t of length N each, both consisting of lowercase English letters.\nLet us form a new string by alternating the characters of S and the characters of T, as follows: the first character of S, the fir...
[{"type": "stdin_stdout", "input": "100\naernvaoeiuraxmueiwovioxmuaioervuaionuxiaomuahlhakaqduwbuvpgrrgreiufwuiaubewobsjdhfbajkslfhjcaklyuwee aibfaeqpwidbcuoifnydukfbavysknxyualdyksayfkjdafqiryekucyuwepaasfdasdfiocaudmiovuandksfucnaldsfumioxa\n", "output": "aaeirbnfvaaeoqepiwuirdabxcmuuoeiifwnoyvdiuokxfmbuaaviyosekrnvx...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian as well. \n\nGiven n words w[1..n], which originate from the same stem (e.g. grace, graceful, disgraceful, gracefully), we are interested in the original stem. To s...
[{"type": "stdin_stdout", "input": "1\n4\ngrace gracefuk disgraceful gracefully", "output": "grace\n"}, {"type": "stdin_stdout", "input": "1\n4\ngrace graceful disgraceful gracefully", "output": "grace\n"}, {"type": "stdin_stdout", "input": "1\n4\ngrace graceful disgraceful gracefully", "output": "grace"}, {"type": "st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis is the hard version of the problem. The difference is the constraint on the sum of lengths of strings and the number of test cases. You can make hacks only if you solve all versions of this task.\n\nYou are given a s...
[{"type": "stdin_stdout", "input": "10\nu\nxqpczgnzazxyrvx\ncfjgfhxmzqmjgzzjthziuomldylspyfuxvjlgdc\nooydbldio\nyvaamavy\nrzjjebcgotjffuzr\nhtfkwvihzuwxczopzqujdnaorgxibjfcmlzntskawxhyoymwynitukttewfpajuph\nfactnjajntcaf\nywowyovhrgradhtrqkgurkjpudnrrqhmmwiaqicfxnoyejdsmmurusdzqgjjntocryhqsgr\nqq\n", "output": "u\nxqx\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nImplement a function/class, which should return an integer if the input string is in one of the formats specified below, or `null/nil/None` otherwise.\n\nFormat:\n* Optional `-` or `+`\n* Base prefix `0b` (binary), `0x` (...
[{"input": "\"0xDEADbeef\"", "output": "[3735928559]", "fn_name": "to_integer"}, {"input": "\"0B1010\"", "output": "[null]", "fn_name": "to_integer"}, {"input": "\"-0x123\"", "output": "[-291]", "fn_name": "to_integer"}, {"input": "\"-0b1010\"", "output": "[-10]", "fn_name": "to_integer"}, {"input": "\"-0o123\"", "outp...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this kata, you'll be given an integer of range `0 <= x <= 99` and have to return that number spelt out in English. A few examples:\n\n```python\nname_that_number(4) # returns \"four\"\nname_that_number(19) # returns...
[{"input": "23", "output": "[\"twenty three\"]", "fn_name": "name_that_number"}, {"input": "99", "output": "[\"ninety nine\"]", "fn_name": "name_that_number"}, {"input": "53", "output": "[\"fifty three\"]", "fn_name": "name_that_number"}, {"input": "76", "output": "[\"seventy six\"]", "fn_name": "name_that_number"}, {"...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nIt's your Birthday. Your colleagues buy you a cake. The numbers of candles on the cake is provided (x). Please note this is not reality, and your age can be anywhere up to 1,000. Yes, you would look a mess.\n\nAs a surpri...
[{"input": "871\n\"gnlyvknjga\"", "output": "[\"That was close!\"]", "fn_name": "cake"}, {"input": "900\n\"abcdef\"", "output": "[\"That was close!\"]", "fn_name": "cake"}, {"input": "583\n\"slhacx\"", "output": "[\"That was close!\"]", "fn_name": "cake"}, {"input": "0\n\"jpipe\"", "output": "[\"That was close!\"]", "f...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nAn Ironman Triathlon is one of a series of long-distance triathlon races organized by the World Triathlon Corporaion (WTC).\nIt consists of a 2.4-mile swim, a 112-mile bicycle ride and a marathon (26.2-mile) (run, raced i...
[{"input": "151", "output": "[\"You're done! Stop running!\"]", "fn_name": "i_tri"}, {"input": "0", "output": "[\"Starting Line... Good Luck!\"]", "fn_name": "i_tri"}, {"input": "36", "output": "[{\"Bike\": \"104.60 to go!\"}]", "fn_name": "i_tri"}, {"input": "103", "output": "[{\"Bike\": \"37.60 to go!\"}]", "fn_name"...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given N real values A_1, A_2, \\ldots, A_N. Compute the number of pairs of indices (i, j) such that i < j and the product A_i \\cdot A_j is integer.\n\nConstraints\n\n* 2 \\leq N \\leq 200\\,000\n* 0 < A_i < 10^4\...
[{"type": "stdin_stdout", "input": "11\n0.9\n1\n1\n1.25\n2.7527267588296525\n5\n70\n0.000000001\n9999.999999999\n0.999999999\n1.7676771981771382", "output": "7\n"}, {"type": "stdin_stdout", "input": "11\n0.9\n1\n1\n1.25\n2.30000\n5\n70\n0.000000001\n9999.999999999\n0.999999999\n1.7676771981771382", "output": "8\n"}, {"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCounting sort can be used for sorting elements in an array which each of the n input elements is an integer in the range 0 to k. The idea of counting sort is to determine, for each input element x, the number of elements ...
[{"type": "stdin_stdout", "input": "7\n4 11 2 3 4 3 1", "output": "1 2 3 3 4 4 11\n"}, {"type": "stdin_stdout", "input": "7\n8 9 2 0 12 3 3", "output": "0 2 3 3 8 9 12\n"}, {"type": "stdin_stdout", "input": "7\n10 9 3 0 6 3 3", "output": "0 3 3 3 6 9 10\n"}, {"type": "stdin_stdout", "input": "7\n6 5 3 0 12 3 3", "outpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nInternational Women's Day is coming soon! Polycarp is preparing for the holiday.\n\nThere are $n$ candy boxes in the shop for sale. The $i$-th box contains $d_i$ candies.\n\nPolycarp wants to prepare the maximum number of...
[{"type": "stdin_stdout", "input": "8 2\n1 2 2 3 2 4 6 10\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "8 2\n2 2 2 2 2 4 6 10\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "8 2\n1 2 2 2 2 4 6 10\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "8 2\n2 2 2 2 2 4 7 10\n", "output": "6\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nGiven the strings $ s $, $ t $.\nFirst, let the string set $ A = $ {$ s $}, $ B = \\ phi $.\nAt this time, I want to perform the following operations as much as possible.\n\noperation\n\nstep1\n\nPerform the fo...
[{"type": "stdin_stdout", "input": "abaabbabaab`abbabbabaabbab\nab", "output": "2\n"}, {"type": "stdin_stdout", "input": "abaabbbbaab`abbabbabaabaab\nab", "output": "2\n"}, {"type": "stdin_stdout", "input": "abaabbbbaab`abbabbabaabaab\n`b", "output": "1\n"}, {"type": "stdin_stdout", "input": "abaabbbbaaa`abbabbabbabaab...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou've gotten an n Γ— m sheet of squared paper. Some of its squares are painted. Let's mark the set of all painted squares as A. Set A is connected. Your task is to find the minimum number of squares that we can delete fro...
[{"type": "stdin_stdout", "input": "20 20\n.....######.........\n.....#....#.........\n.....#....#.........\n.....#....#.........\n.....############...\n.........##.....#...\n..........#.....#...\n..........#.....#...\n..........###...#...\n............#...#...\n............#...#...\n............#...#...\n............#...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ persons who initially don't know each other. On each morning, two of them, who were not friends before, become friends.\n\nWe want to plan a trip for every evening of $m$ days. On each trip, you have to sele...
[{"type": "stdin_stdout", "input": "16 20 2\n10 4\n5 3\n10 5\n12 7\n7 6\n9 12\n9 6\n1 10\n11 16\n11 1\n16 3\n10 2\n14 4\n15 14\n4 13\n13 15\n1 8\n7 15\n1 7\n8 15\n", "output": "0\n0\n0\n0\n0\n0\n4\n4\n4\n4\n10\n10\n10\n10\n10\n14\n14\n14\n14\n15\n"}, {"type": "stdin_stdout", "input": "16 20 2\n10 4\n5 3\n10 5\n12 7\n7 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCorrect this code so that it takes one argument, `x`, and returns \"`x` is more than zero\" if `x` is positive (and nonzero), and otherwise, returns \"`x` is equal to or less than zero.\" In both cases, replace `x` with t...
[{"input": "-2", "output": "[\"-2 is equal to or less than zero.\"]", "fn_name": "corrections"}, {"input": "-1", "output": "[\"-1 is equal to or less than zero.\"]", "fn_name": "corrections"}, {"input": "0", "output": "[\"0 is equal to or less than zero.\"]", "fn_name": "corrections"}, {"input": "8", "output": "[\"8 is...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nWhen Valera has got some free time, he goes to the library to read some books. Today he's got t free minutes to read. That's why Valera took n books in the library and for each book he estimated the time he is going to ne...
[{"type": "stdin_stdout", "input": "100 100\n75 92 18 7 81 67 7 92 100 65 57 32 50 131 85 31 80 91 84 63 39 52 92 81 1 98 24 12 84 48 17 86 51 72 48 95 81 50 12 66 19 79 49 89 34 1 193 75 20 33 96 27 42 23 133 71 93 1 85 19 66 14 13 13 20 39 36 33 42 61 56 64 23 91 37 99 40 74 13 18 98 85 74 39 62 84 46 74 50 23 38 11 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOm Nom is the main character of a game \"Cut the Rope\". He is a bright little monster who likes visiting friends living at the other side of the park. However the dark old parks can scare even somebody as fearless as Om ...
[{"type": "stdin_stdout", "input": "6\n87 62 58 32 81 92 12 50 23 27 38 39 64 74 16 35 84 59 91 87 14 48 90 47 44 95 64 45 31 11 67 5 80 60 36 15 91 3 21 2 40 24 37 69 5 50 23 37 49 19 68 21 49 9 100 94 45 41 22 31 31 48 25 70 25 25 95 88 82 1 37 53 49 31 57 74 94 45 55 93 43 37 13 85 59 72 15 68 3 90 96 55 100 64 63 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVlad enjoys listening to music. He lives in Sam's Town. A few days ago he had a birthday, so his parents gave him a gift: MP3-player! Vlad was the happiest man in the world! Now he can listen his favorite songs whenever h...
[{"type": "stdin_stdout", "input": "3\n4\n-1 16 14 1\n2\n5\n1 4 0 17 8\n3\n5\n-1 1 -1 18 4 \n0", "output": "4\n1\n4\n"}, {"type": "stdin_stdout", "input": "3\n4\n0 4 5 2\n-1\n5\n1 1 5 11 4\n-1\n5\n1 2 3 9 -1 \n2", "output": "4\n5\n3\n"}, {"type": "stdin_stdout", "input": "3\n4\n1 3 4 2\n2\n5\n1 2 3 9 4\n5\n5\n1 2 3 9 4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis is a follow-up from my previous Kata which can be found here: http://www.codewars.com/kata/5476f4ca03810c0fc0000098\n\nThis time, for any given linear sequence, calculate the function [f(x)] and return it as a functi...
[{"input": "[0, 1, 2, 3, 100000]", "output": "[\"Non-linear sequence\"]", "fn_name": "get_function"}, {"input": "[0, 1, 2, 100000, 4]", "output": "[\"Non-linear sequence\"]", "fn_name": "get_function"}, {"input": "[0, 1, 100000, 3, 4]", "output": "[\"Non-linear sequence\"]", "fn_name": "get_function"}, {"input": "[0, 1...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given three words s_1, s_2 and s_3, each composed of lowercase English letters, with spaces in between.\nPrint the acronym formed from the uppercased initial letters of the words.\n\n-----Constraints-----\n - s_1,...
[{"type": "stdin_stdout", "input": "atcoder beginner contest\n", "output": "ABC\n"}, {"type": "stdin_stdout", "input": "resident register number\n", "output": "RRN\n"}, {"type": "stdin_stdout", "input": "resident retsiger number", "output": "RRN\n"}, {"type": "stdin_stdout", "input": "atcoder beginner contdst", "output...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Smart Beaver from ABBYY came up with another splendid problem for the ABBYY Cup participants! This time the Beaver invites the contest participants to check out a problem on sorting documents by their subjects. Let's ...
[{"type": "stdin_stdout", "input": "24000\nN.Y. BANK DISCOUNT BORROWINGS 169 MLN DLRS\nNEW YORK, April 9 - The eight major New York City banks had\ndaily average borrowings of 169 mln dlrs from the Federal\nReserve in the week ended April 8, a Fed spokesman said.\nA Fed spokesman said that all of the borrowings were ma...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHow to make a cake you'll never eat.\n\nIngredients. \n\n * 2 carrots\n * 0 calories\n * 100 g chocolate spread\n * 1 pack of flour\n * 1 egg\n\n\n\nMethod. \n\n 1. Put calories into the mixing bowl.\n 2. Take carr...
[{"type": "stdin_stdout", "input": "100 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1010 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n## Description\nYour job is to create a simple password validation function, as seen on many websites. \n\nThe rules for a valid password are as follows:\n- There needs to be at least 1 uppercase letter.\n- There needs to...
[{"input": "\"AbcdefGhijKlmnopQRsTuvwxyZ1234567890\"", "output": "[true]", "fn_name": "password"}, {"input": "\"Ab1!@#$%^&*()-_+={}[]|\\\\:;?/>.<,\"", "output": "[true]", "fn_name": "password"}, {"input": "\"!@#$%^&*()-_+={}[]|\\\\:;?/>.<,\"", "output": "[false]", "fn_name": "password"}, {"input": "\"abcd1234\"", "outp...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nSereja showed an interesting game to his friends. The game goes like that. Initially, there is a table with an empty cup and n water mugs on it. Then all players take turns to move. During a move, a player takes a non-emp...
[{"type": "stdin_stdout", "input": "100 1000\n10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBeing stuck at home, Ray became extremely bored. To pass time, he asks Lord Omkar to use his time bending power: Infinity Clock! However, Lord Omkar will only listen to mortals who can solve the following problem:\n\nYou ...
[{"type": "stdin_stdout", "input": "5\n20 809014\n289 -254 1 -109 -167 93 23 -37 -31 -109 204 59 296 49 132 0 -28 35 -197 -266\n20 458494\n113 218 -292 -298 179 258 -257 -20 296 76 -145 93 -282 -261 -159 -45 255 -107 171 63\n14 876161\n69 74 12 2 177 -113 103 93 38 -48 282 169 205 145\n26 731742\n76 190 -227 -81 -293 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a chessboard of size $n \\times n$. It is filled with numbers from $1$ to $n^2$ in the following way: the first $\\lceil \\frac{n^2}{2} \\rceil$ numbers from $1$ to $\\lceil \\frac{n^2}{2} \\rceil$ are writt...
[{"type": "stdin_stdout", "input": "4 5\n2 1\n1 4\n5 3\n3 2\n2 4\n", "output": "11\n10\n10\n13\n4\n"}, {"type": "stdin_stdout", "input": "4 5\n2 1\n1 4\n5 3\n6 2\n2 4\n", "output": "11\n10\n10\n11\n4\n"}, {"type": "stdin_stdout", "input": "8 5\n2 1\n4 4\n4 3\n3 2\n2 4\n", "output": "37\n14\n46\n41\n6\n"}, {"type": "std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is an integer sequence of length 2^N: A_0, A_1, ..., A_{2^N-1}. (Note that the sequence is 0-indexed.)\nFor every integer K satisfying 1 \\leq K \\leq 2^N-1, solve the following problem:\n - Let i and j be integers....
[{"type": "stdin_stdout", "input": "4\n75 26 45 72 81 47 97 97 2 2 25 82 84 17 56 32\n", "output": "101\n120\n147\n156\n156\n178\n194\n194\n194\n194\n194\n194\n194\n194\n194\n"}, {"type": "stdin_stdout", "input": "4\n75 26 45 112 81 47 97 97 2 2 25 95 84 17 56 32", "output": "101\n120\n187\n187\n187\n187\n209\n209\n209...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis is an interactive problem. In the output section below you will see the information about flushing the output.\n\nBear Limak thinks of some hidden number β€” an integer from interval [2, 100]. Your task is to say if th...
[{"type": "stdin_stdout", "input": "no\nyes\nno\nnn\nno\n", "output": "2\n3\n5\n7\n11\n13\n17\n19\n23\n29\n31\n37\n41\n43\n47\n4\n9\n25\n49\nprime\n"}, {"type": "stdin_stdout", "input": "no\nyes\nno\nno\nno\n", "output": "2\n3\n5\n7\n11\n13\n17\n19\n23\n29\n31\n37\n41\n43\n47\n4\n9\n25\n49\nprime\n"}, {"type": "stdin_s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given $n$ segments on a coordinate axis $OX$. The $i$-th segment has borders $[l_i; r_i]$. All points $x$, for which $l_i \\le x \\le r_i$ holds, belong to the $i$-th segment.\n\nYour task is to choose the maximum...
[{"type": "stdin_stdout", "input": "4\n4\n1 5\n2 4\n2 3\n3 4\n5\n1 5\n2 3\n2 5\n3 5\n2 2\n3\n1 3\n2 4\n2 3\n7\n1 10\n2 8\n2 5\n3 4\n4 4\n6 8\n7 7\n", "output": "3\n4\n2\n7\n"}, {"type": "stdin_stdout", "input": "4\n4\n1 5\n2 4\n2 3\n3 4\n5\n1 5\n2 3\n2 5\n3 5\n2 2\n3\n1 3\n2 4\n2 3\n7\n1 10\n2 8\n0 5\n3 4\n4 4\n6 8\n7 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a string $s$ of length $3$, consisting of uppercase and lowercase English letters. Check if it is equal to \"YES\" (without quotes), where each letter can be in any case. For example, \"yES\", \"Yes\", \"yes\" ar...
[{"type": "stdin_stdout", "input": "10\nYES\nyES\nyes\nYes\nYeS\nNoo\norZ\nyEz\nYas\nXES\n", "output": "YES\nYES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\n"}, {"type": "stdin_stdout", "input": "2\nyes\nlll\n", "output": "YES\nNO\n"}, {"type": "stdin_stdout", "input": "1\nvop\n", "output": "NO\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have $n$ chains, the $i$-th chain consists of $c_i$ vertices. Vertices in each chain are numbered independently from $1$ to $c_i$ along the chain. In other words, the $i$-th chain is the undirected graph with $c_i$ ve...
[{"type": "stdin_stdout", "input": "3\n4\n3 4 3 6\n-1 1 2 2\n-2 2 2 3\n2\n5 10\n-2 5\n-1 1\n3\n10 5 2\n-1 1 2\n-1 10 5\n", "output": "10\n15\n15\n"}, {"type": "stdin_stdout", "input": "3\n4\n3 4 3 6\n-1 1 2 2\n-1 2 2 3\n2\n5 10\n-1 5\n-1 1\n3\n6 5 2\n-1 1 2\n-1 5 5\n", "output": "10\n15\n10\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOnce upon a time in the Kingdom of Far Far Away lived Sir Lancelot, the chief Royal General. He was very proud of his men and he liked to invite the King to come and watch drill exercises which demonstrated the fighting t...
[{"type": "stdin_stdout", "input": "1000 1000\n", "output": "500000\n"}, {"type": "stdin_stdout", "input": "997 1000\n", "output": "498500\n"}, {"type": "stdin_stdout", "input": "999 1000\n", "output": "499500\n"}, {"type": "stdin_stdout", "input": "1000 999\n", "output": "499500\n"}, {"type": "stdin_stdout", "input": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPaw the Spider is making a web. Web-making is a real art, Paw has been learning to do it his whole life. Let's consider the structure of the web.\n\n<image>\n\nThere are n main threads going from the center of the web. Al...
[{"type": "stdin_stdout", "input": "20\n5 15 40 35 68 22\n6 70 19 28 69 63 1\n4 37 154 41 90\n7 11 148 35 94 55 59 64\n7 46 28 22 90 97 37 13\n5 62 45 34 50 94\n6 85 83 37 72 27 53\n6 46 56 116 71 49 33\n7 17 35 91 24 50 30 38\n2 75 12\n2 46 38\n1 61\n11 15 79 14 89 20 96 84 26 93 132 18\n1 75\n6 4 100 55 59 62 83\n5 4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe polar bears are going fishing. They plan to sail from (s_{x}, s_{y}) to (e_{x}, e_{y}). However, the boat can only sail by wind. At each second, the wind blows in one of these directions: east, south, west or north. A...
[{"type": "stdin_stdout", "input": "39 -1000000000 -1000000000 -999999997 -1000000000\nENEENWSWSSWESNSSEESNSESWSWNSWESNENWNWEE\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "39 -1000000000 -1000000000 -999999997 -1000000000\nENEENWSWSSWESNSSEESNSESWSWNSWESNENWNWEE\n", "output": "4\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe time is 2020. There is data that saves the qualifying results of PC Koshien 2020. This data stores the reference number and the number of correct answers assigned to each team. Here, the ranking is determined by the n...
[{"type": "stdin_stdout", "input": "1,20\n2,20\n3,30\n4,10\n5,10\n6,20\n0,0\n1\n2\n4\n1", "output": "2\n2\n3\n2\n"}, {"type": "stdin_stdout", "input": "1,20\n2,20\n3,30\n4,10\n5,10\n0,26\n0,0\n1\n2\n4\n1", "output": "3\n3\n4\n3\n"}, {"type": "stdin_stdout", "input": "1,20\n2,20\n3,30\n4,10\n5,10\n0,26\n0,0\n0\n2\n4\n1"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSonya decided that having her own hotel business is the best way of earning money because she can profit and rest wherever she wants.\n\nThe country where Sonya lives is an endless line. There is a city in each integer co...
[{"type": "stdin_stdout", "input": "100 10\n-489 -476 -445 -432 -430 -421 -420 -418 -412 -411 -404 -383 -356 -300 -295 -293 -287 -276 -265 -263 -258 -251 -249 -246 -220 -219 -205 -186 -166 -157 -143 -137 -136 -130 -103 -86 -80 -69 -67 -55 -43 -41 -40 -26 -19 -9 16 29 41 42 54 76 84 97 98 99 101 115 134 151 157 167 169 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet S be the concatenation of 10^{10} copies of the string 110. (For reference, the concatenation of 3 copies of 110 is 110110110.)\nWe have a string T of length N.\nFind the number of times T occurs in S as a contiguous ...
[{"type": "stdin_stdout", "input": "62089\n1101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101101...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n\"Fukusekiken\" is a popular ramen shop where you can line up. But recently, I've heard some customers say, \"I can't afford to have vacant seats when I enter the store, even though I have a long waiting time.\" I'd like ...
[{"type": "stdin_stdout", "input": "5\n41\n27\n26", "output": "0\n28\n18\n23\n"}, {"type": "stdin_stdout", "input": "5\n24\n18\n13", "output": "0\n11\n15\n2\n"}, {"type": "stdin_stdout", "input": "5\n24\n27\n13", "output": "0\n11\n18\n2\n"}, {"type": "stdin_stdout", "input": "5\n29\n27\n26", "output": "0\n8\n18\n23\n"}...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently, the Fair Nut has written $k$ strings of length $n$, consisting of letters \"a\" and \"b\". He calculated $c$Β β€” the number of strings that are prefixes of at least one of the written strings. Every string was cou...
[{"type": "stdin_stdout", "input": "100 1000000000\nbbabbaabbbaaaaabbabbbaaabbbbabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbaabbbbabaabbbabbaaaaabbbbaab\nbbabbaabbbaaaaabbabbbaaabbbbabbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaababbbabbbbaaaaabbaaaaaaaab\n", "output": "41073741883\n"}, {"type": "stdin_stdout", "input":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIt's a walking tour day in SIS.Winter, so $t$ groups of students are visiting Torzhok. Streets of Torzhok are so narrow that students have to go in a row one after another.\n\nInitially, some students are angry. Let's des...
[{"type": "stdin_stdout", "input": "16\n4\nPPPP\n4\nAPPP\n4\nPAPP\n4\nAAPP\n4\nPPAP\n4\nAPAP\n4\nPAAP\n4\nAAAP\n4\nPPPA\n4\nAPPA\n4\nPAPA\n4\nAAPA\n4\nPPAA\n4\nAPAA\n4\nPAAA\n4\nAAAA\n", "output": "0\n3\n2\n2\n1\n1\n1\n1\n0\n2\n1\n1\n0\n1\n0\n0\n"}, {"type": "stdin_stdout", "input": "16\n4\nPPPP\n4\nAPPP\n4\nPAPP\n4\nA...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSimple, remove the spaces from the string, then return the resultant string.\n\n~~~if:c\nFor C, you must return a new dynamically allocated string.\n~~~\n\nWrite your solution by modifying this code:\n\n```python\ndef no_...
[{"input": "\"8 8 Bi fk8h B 8 BB8B B B B888 c hl8 BhB fd\"", "output": "[\"88Bifk8hB8BB8BBBB888chl8BhBfd\"]", "fn_name": "no_space"}, {"input": "\"8 j 8 mBliB8g imjB8B8 jl B\"", "output": "[\"8j8mBliB8gimjB8B8jlB\"]", "fn_name": "no_space"}, {"input": "\"jfBm gk lf8hg 88lbe8 \"", "output": "[\"jfBmgklf8hg88lbe8...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nOn some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in yyyy/mm/dd format. For example, January 23, 2018 should be written as 2018/01/23.\nAfter finishing ...
[{"type": "stdin_stdout", "input": "2017/01/07\n", "output": "2018/01/07\n"}, {"type": "stdin_stdout", "input": "2017/01/31\n", "output": "2018/01/31\n"}, {"type": "stdin_stdout", "input": "2017/01/06", "output": "2018/01/06\n"}, {"type": "stdin_stdout", "input": "2017/01/32", "output": "2018/01/32\n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a function, `persistence`, that takes in a positive parameter `num` and returns its multiplicative persistence, which is the number of times you must multiply the digits in `num` until you reach a single digit.\n\nF...
[{"input": "999", "output": "[4]", "fn_name": "persistence"}, {"input": "444", "output": "[3]", "fn_name": "persistence"}, {"input": "39", "output": "[3]", "fn_name": "persistence"}, {"input": "25", "output": "[2]", "fn_name": "persistence"}, {"input": "4", "output": "[0]", "fn_name": "persistence"}]
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nElections in Berland are coming. There are only two candidates β€” Alice and Bob.\n\nThe main Berland TV channel plans to show political debates. There are $n$ people who want to take part in the debate as a spectator. Each...
[{"type": "stdin_stdout", "input": "54\n10 13\n10 45\n10 51\n01 44\n10 24\n10 26\n10 39\n10 38\n10 41\n10 33\n10 18\n10 12\n10 38\n10 30\n11 31\n10 46\n11 50\n00 26\n00 29\n00 50\n10 16\n10 40\n10 50\n00 43\n10 48\n10 32\n10 18\n10 8\n10 24\n10 32\n10 52\n00 41\n10 37\n10 38\n10 49\n00 35\n10 52\n00 44\n10 41\n10 36\n0...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n## The Riddle\n\nThe King of a small country invites 1000 senators to his annual party. As a tradition, each senator brings the King a bottle of wine. Soon after, the Queen discovers that one of the senators is trying to ...
[{"input": "[3, 5, 6, 7, 8, 9]", "output": "[1000]", "fn_name": "find"}, {"input": "[0, 3, 5, 4, 9, 8]", "output": "[825]", "fn_name": "find"}, {"input": "[0, 1, 2, 3, 4, 6]", "output": "[95]", "fn_name": "find"}, {"input": "[0, 1, 9, 3, 5]", "output": "[555]", "fn_name": "find"}, {"input": "[0, 1, 3, 4]", "output": "[...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nAssume that you have $k$ one-dimensional segments $s_1, s_2, \\dots s_k$ (each segment is denoted by two integers β€” its endpoints). Then you can build the following graph on these segments. The graph consists of $k$ verte...
[{"type": "stdin_stdout", "input": "1\n10\n1 2\n1 3\n2 4\n2 5\n2 6\n3 7\n3 8\n4 9\n4 10\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "1\n10\n1 2\n2 3\n1 4\n2 5\n4 6\n6 7\n3 8\n4 9\n4 10\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "1\n10\n1 2\n1 3\n1 4\n2 5\n2 6\n6 7\n1 8\n4 9\n4 10\n", "output"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is on constraints. In this version constraints are lower. You can make hacks only if all versions of the problem are solved.\n\nKoa the Koala is at the beach!\n\nThe beac...
[{"type": "stdin_stdout", "input": "32\n3 1 3\n2 2 1\n3 1 3\n2 2 2\n3 1 3\n2 2 3\n3 1 3\n2 3 1\n3 1 3\n2 3 2\n3 1 3\n2 3 3\n3 1 3\n3 1 1\n3 1 3\n3 1 2\n3 1 3\n3 1 3\n3 1 3\n3 2 1\n3 1 3\n3 2 2\n3 1 3\n3 2 3\n3 1 3\n3 3 1\n3 1 3\n3 3 2\n3 1 3\n3 3 3\n3 2 1\n1 1 1\n3 2 1\n1 1 2\n3 2 1\n1 1 3\n3 2 1\n1 2 1\n3 2 1\n1 2 2\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $n$. Let's cal...
[{"type": "stdin_stdout", "input": "20\n9 15 11 8 10 5 19 13 12 18 3 20 17 14 2 16 7 4 1 6\n12 6 7 5 4 20 15 14 1 18 10 17 9 19 16 3 13 11 2 8\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "20\n9 15 11 8 10 5 19 13 12 18 3 20 17 14 2 16 7 4 1 6\n12 6 7 5 4 20 15 14 1 18 10 17 9 19 16 3 13 11 2 8\n", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Little Elephant likes permutations. This time he has a permutation A[1], A[2], ..., A[N] of numbers 1, 2, ..., N.\n\nHe calls a permutation A good, if the number of its inversions is equal to the number of its local i...
[{"type": "stdin_stdout", "input": "4\n0\n1\n2\n0 1\n3\n0 1 2\n4\n1 3 2 4", "output": "YES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "4\n0\n1\n2\n0 1\n3\n11 1 1\n4\n1 3 2 -1", "output": "YES\nYES\nNO\nNO\n"}, {"type": "stdin_stdout", "input": "4\n-1\n1\n1\n0 1\n3\n3 0 1\n4\n1 3 2 4", "output": "YES\nYES\nNO...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nShinya watched a program on TV called \"Maya's Great Prophecy! Will the World End in 2012?\" After all, I wasn't sure if the world would end, but I was interested in Maya's \"long-term calendar,\" which was introduced in ...
[{"type": "stdin_stdout", "input": "2012.12.31\n2.11.16.14.14\n7138.4.03\n10.5.5.1.2\n10000000.12.31\n#", "output": "0.0.0.0.10\n3034.11.28\n12.19.19.16.10\n6059.2.10\n8.19.3.13.2\n"}, {"type": "stdin_stdout", "input": "2312.02.12\n2.12.16.14.14\n7128.5.13\n5.1.5.2.01\n10020000.10.31\n#", "output": "0.15.3.8.19\n3054.8...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIt is a complicated version of problem F1. The difference between them is the constraints (F1: $k \\le 2$, F2: $k \\le 10$).\n\nYou are given an integer $n$. Find the minimum integer $x$ such that $x \\ge n$ and the numbe...
[{"type": "stdin_stdout", "input": "6\n2021 3\n177890 2\n34512 3\n724533 4\n998244353 1\n12345678 10\n", "output": "2021\n181111\n34533\n724542\n999999999\n12345678\n"}, {"type": "stdin_stdout", "input": "6\n2021 3\n177890 2\n34512 3\n724533 4\n998244353 1\n12345678 10\n", "output": "2021\n181111\n34533\n724542\n999999...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a toy building consisting of $n$ towers. Each tower consists of several cubes standing on each other. The $i$-th tower consists of $h_i$ cubes, so it has height $h_i$.\n\nLet's define operation slice on some heig...
[{"type": "stdin_stdout", "input": "10 10\n1 1 1 1 1 1 1 1 1 1\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10 10\n3 3 3 3 3 3 3 3 3 3\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10 10\n1 1 1 1 1 1 1 1 1 1\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10 10\n3 3 3 3 3 3 3 3 3 3\n", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAnton's favourite geometric figures are regular polyhedrons. Note that there are five kinds of regular polyhedrons: \n\n Tetrahedron. Tetrahedron has 4 triangular faces. Cube. Cube has 6 square faces. Octahedron. Octah...
[{"type": "stdin_stdout", "input": "28\nOctahedron\nDodecahedron\nOctahedron\nOctahedron\nDodecahedron\nIcosahedron\nIcosahedron\nDodecahedron\nDodecahedron\nDodecahedron\nCube\nDodecahedron\nCube\nTetrahedron\nCube\nCube\nTetrahedron\nDodecahedron\nDodecahedron\nDodecahedron\nIcosahedron\nIcosahedron\nDodecahedron\nIc...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Task\n Given an array `arr` and a number `n`. Call a pair of numbers from the array a `Perfect Pair` if their sum is equal to `n`.\n\n Find all of the perfect pairs and return the sum of their **indices**. \n \n Note th...
[{"input": "[1, 4, 2, 3, 0, 5]\n7", "output": "[11]", "fn_name": "pairwise"}, {"input": "[0, 0, 0, 0, 1, 1]\n1", "output": "[10]", "fn_name": "pairwise"}, {"input": "[1, 3, 2, 4]\n4", "output": "[1]", "fn_name": "pairwise"}, {"input": "[15, 1, 1]\n5", "output": "[0]", "fn_name": "pairwise"}, {"input": "[1, 1, 1]\n2", "...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nEvil organizations that attempt to conquer the world are everywhere, regardless of age, east or west fiction, non-fiction, but what on earth did they try to conquer the world? I suddenly thought about that because I was a...
[{"type": "stdin_stdout", "input": "4\n0.200 3 1.3409251190635834\n0.38744720010760914 0 0.400\n0.900 1 1.000\n0.400 2 0.902270275623373\n2\n1.4849846876484776 1 1.1947768336367894\n0.500 0 1.000\n9\n0.200 7 0.600\n0.400 0 0.500\n1.540928395286643 8 1.727681009880635\n0.100 4 0.400\n0.200 2 0.600\n0.100 6 1.20624050513...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe problem was inspired by Pied Piper story. After a challenge from Hooli's compression competitor Nucleus, Richard pulled an all-nighter to invent a new approach to compression: middle-out.\n\nYou are given two strings ...
[{"type": "stdin_stdout", "input": "6\n7\ncontest\nntecost\n7\ncontest\nnsttdco\n7\ncontest\ntnsteco\n7\ncontess\ncotestn\n7\ncontest\ncontest\n7\nontestc\ncontest\n", "output": "3\n-1\n4\n-1\n0\n1\n"}, {"type": "stdin_stdout", "input": "6\n7\ncontest\nntecost\n7\ncontest\nnstteco\n7\ncontest\ntnsteco\n7\ncontess\ncote...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Beroil corporation structure is hierarchical, that is it can be represented as a tree. Let's examine the presentation of this structure as follows:\n\n * employee ::= name. | name:employee1,employee2, ... ,employeek....
[{"type": "stdin_stdout", "input": "ZLWSYH:WNMTNAI:FTCKPGZBJ.,UZSCFZVXXK.,LNGCU.,TCT.,LNGCU.,U.,NEHYSET..,FBLI:NEHYSET:IFY..,VN.,VN.,IFY.,FBLI.,YH.,FBLI.,DTXG.,NEHYSET.,WNMTNAI.,VN.,SVXN.,NEHYSET.,TCT.,DTXG..,UZSCFZVXXK:KZQRJFST.,FTCKPGZBJ.,WNMTNAI.,SVXN:DHONBXRZAL..,NEHYSET.,IFY..,MPOEEMVOP:DHONBXRZAL.,DTXG.,FTCKPGZBJ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou were lucky enough to get a map just before entering the legendary magical mystery world. The map shows the whole area of your planned exploration, including several countries with complicated borders. The map is clear...
[{"type": "stdin_stdout", "input": "6\nBlizid\n0 0\n60 -1\n60 60\n0 60\n0 50\n50 50\n50 10\n0 10\n-1\nBlizid\n0 10\n10 10\n10 50\n0 50\n-1\nWindom\n10 10\n50 10\n40 20\n20 20\n20 40\n10 50\n-1\nAccent\n50 10\n50 50\n35 50\n35 25\n-1\nPilot\n35 25\n35 50\n19 50\n-1\nBlizid\n20 20\n40 20\n20 40\n-1\n4\nA12345678901234567...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRunning with barriers on the circle track is very popular in the country where Dasha lives, so no wonder that on her way to classes she saw the following situation:\n\nThe track is the circle with length L, in distinct po...
[{"type": "stdin_stdout", "input": "50 100\n0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98\n1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\ncoastline\n\nWaves rush to the beach every second. There is data that observes and records how many meters the wave rushed beyond the reference point P every second for only T seconds. The data consists of T integers x1, ...
[{"type": "stdin_stdout", "input": "5 2 3\n3\n2\n1\n2\n6\n3 100 100\n5\n3\n4\n20 2 8\n3\n2\n10\n1\n14\n1\n1\n4\n2\n2\n16\n1\n8\n8\n2\n6\n3\n8\n3\n8\n7 2 2\n0\n2\n5\n2\n5\n2\n-1\n0 0 0", "output": "2\n0\n11\n5\n"}, {"type": "stdin_stdout", "input": "5 2 3\n3\n2\n1\n2\n6\n3 110 100\n5\n3\n4\n20 2 3\n3\n2\n10\n1\n14\n1\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had several concentric circles that divided the...
[{"type": "stdin_stdout", "input": "100\n901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIf we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.\n\nFinish the solution so that it returns the sum of all the multiples of 3 or 5 **below** ...
[{"input": "200", "output": "[9168]", "fn_name": "solution"}, {"input": "10", "output": "[23]", "fn_name": "solution"}, {"input": "20", "output": "[78]", "fn_name": "solution"}, {"input": "0", "output": "[0]", "fn_name": "solution"}, {"input": "1", "output": "[0]", "fn_name": "solution"}]
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nToday on a lecture about strings Gerald learned a new definition of string equivalency. Two strings a and b of equal length are called equivalent in one of the two cases: They are equal. If we split string a into two h...
[{"type": "stdin_stdout", "input": "yhwepqwyhwepqwyhwepqweahnqtueahnqtueahnqtuyhwepqwyhwepqwyhwepqwyhwepqweahnqtueahnqtuyhwepqweahnqtueahnqtueahnqtueahnqtueahnqtueahnqtu\neahnqtueahnqtueahnqtuyhwepqweahnqtuyhwepqwyhwepqweahnqtuyhwepqweahnqtuyhwepqweahnqtueahnqtuyhwepqweahnqtueahnqtuyhwepqwyhwepqwyhwepqw\n", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n[Image] \n\n\n-----Input-----\n\nThe input contains a single integer $a$ ($0 \\le a \\le 15$).\n\n\n-----Output-----\n\nOutput a single integer.\n\n\n-----Example-----\nInput\n3\n\nOutput\n13\n\nThe input will be stdin an...
[{"type": "stdin_stdout", "input": "000\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "3\n", "output": "13\n"}, {"type": "stdin_stdout", "input": "0\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "1\n", "output": "14\n"}, {"type": "stdin_stdout", "input": "2\n", "output": "12\n"}, {"type": "stdin_s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n###Lucky number\n\nWrite a function to find if a number is lucky or not. If the sum of all digits is 0 or multiple of 9 then the number is lucky.\n\n`1892376 => 1+8+9+2+3+7+6 = 36`. 36 is divisble by 9, hence number is lu...
[{"input": "1892231413243242344321432142343423437", "output": "[true]", "fn_name": "is_lucky"}, {"input": "18922314324324234423437", "output": "[false]", "fn_name": "is_lucky"}, {"input": "189223141324324234423437", "output": "[true]", "fn_name": "is_lucky"}, {"input": "1892376", "output": "[true]", "fn_name": "is_luck...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nCreate a function finalGrade, which calculates the final grade of a student depending on two parameters: a grade for the exam and a number of completed projects.\n\nThis function should take two arguments:\nexam - grade f...
[{"input": "100\n12", "output": "[100]", "fn_name": "final_grade"}, {"input": "10\n15", "output": "[100]", "fn_name": "final_grade"}, {"input": "99\n0", "output": "[100]", "fn_name": "final_grade"}, {"input": "85\n5", "output": "[90]", "fn_name": "final_grade"}, {"input": "55\n3", "output": "[75]", "fn_name": "final_gr...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nSmart Beaver recently got interested in a new word game. The point is as follows: count the number of distinct good substrings of some string s. To determine if a string is good or not the game uses rules. Overall there a...
[{"type": "stdin_stdout", "input": "hrsszhjvrbsszvqesessiqbzeqijjerqirhhjsehiehezvzihzssivhvihrivrhizeqvvhejvibhqrbbqjrjsessvrhijzsrqirvsqqbibzhrzseijesszsrzhjjbqsrjrsrizivvhsjvqz\n3\nrzzevhiibziqiirhsebebrvrvvjihsjhvjjrejvqezireqevqeszrrseriijijijveqzbsbrezqhrrhbshqrhzshjervqjjzveeqsisrbevvjvjhbzvbjrrvizh 0 122\niqqqj...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSkier rides on a snowy field. Its movements can be described by a string of characters 'S', 'N', 'W', 'E' (which correspond to $1$ meter movement in the south, north, west or east direction respectively).\n\nIt is known t...
[{"type": "stdin_stdout", "input": "1\nENNNNNNNNNNNSSSSSSSSSSSEEEEEEEEEEN\n", "output": "126\n"}, {"type": "stdin_stdout", "input": "1\nNEEEEEEEEEEEWWWWWWWWWWWNNNNNNNNNNE\n", "output": "126\n"}, {"type": "stdin_stdout", "input": "1\nENNNNNNNNNNNSSSSSSSNSSSEEEEEEEEEES\n", "output": "126\n"}, {"type": "stdin_stdout", "in...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBalph is learning to play a game called Buma. In this game, he is given a row of colored balls. He has to choose the color of one new ball and the place to insert it (between two balls, or to the left of all the balls, or...
[{"type": "stdin_stdout", "input": "WWWOONOOOWWW\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "WWWOONOOOVWW\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "WVWOONOOOVWW\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "WOWOONVOOVWW\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "WOWO...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEvery day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i.\n\nEvery passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Natural...
[{"type": "stdin_stdout", "input": "6 4 3\n11\n6\n2\n13\n17\n5", "output": "4\n"}, {"type": "stdin_stdout", "input": "6 4 3\n11\n9\n2\n13\n17\n5", "output": "4\n"}, {"type": "stdin_stdout", "input": "6 3 3\n7\n6\n2\n13\n17\n5", "output": "4\n"}, {"type": "stdin_stdout", "input": "6 3 3\n7\n6\n2\n13\n10\n6", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWilliam really likes the cellular automaton called \"Game of Life\" so he decided to make his own version. For simplicity, William decided to define his cellular automaton on an array containing $n$ cells, with each cell ...
[{"type": "stdin_stdout", "input": "4\n10 1\n1111111111\n9 4\n000000000\n9 4\n000000000\n9 4\n000000000\n", "output": "1111111111\n000000000\n000000000\n000000000\n"}, {"type": "stdin_stdout", "input": "4\n10 1\n1111111111\n9 4\n000000000\n9 4\n000000000\n9 4\n000000000\n", "output": "1111111111\n000000000\n000000000\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the Jambo Amusement Garden (JAG), you sell colorful drinks consisting of multiple color layers. This colorful drink can be made by pouring multiple colored liquids of different density from the bottom in order.\n\nYou ...
[{"type": "stdin_stdout", "input": "4\nred 3444\nred 3018\nred 3098\nred 3319\n4\nred\nred\nrec\nred", "output": "No\n"}, {"type": "stdin_stdout", "input": "4\nred 3444\nder 3018\nred 3098\nred 3319\n4\nred\nred\nrec\nred", "output": "No\n"}, {"type": "stdin_stdout", "input": "4\nred 2133\nder 3018\nred 3098\nred 3319\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nQuantum mechanics tells us that a molecule is only allowed to have specific, discrete amounts of internal energy. The 'rigid rotor model', a model for describing rotations, tells us that the amount of rotational energy a ...
[{"input": "423\n100\n150", "output": "[[4272300, 4357746, 4444038, 4531176, 4619160, 4707990, 4797666, 4888188, 4979556, 5071770, 5164830, 5258736, 5353488, 5449086, 5545530, 5642820, 5740956, 5839938, 5939766, 6040440, 6141960, 6244326, 6347538, 6451596, 6556500, 6662250, 6768846, 6876288, 6984576, 7093710, 7203690, ...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nKattapa, as you all know was one of the greatest warriors of his time. The kingdom of Maahishmati had never lost a battle under him (as army-chief), and the reason for that was their really powerful army, also called as M...
[{"type": "stdin_stdout", "input": "3\n2 3 4\n\n\n", "output": "READY FOR BATTLE\n"}, {"type": "stdin_stdout", "input": "4\n11 12 13 14\n\n\n", "output": "NOT READY\n"}, {"type": "stdin_stdout", "input": "5\n1 2 3 4 5\n\n\n", "output": "NOT READY\n"}, {"type": "stdin_stdout", "input": "1\n2\n\n\n", "output": "READY FOR...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nChef loves to play games. Now he plays very interesting game called \"Segment\". At the beginning Chef has segment [0, X] and no points on it. On each step Chef chooses the subsegment of maximal length possible such as it...
[{"type": "stdin_stdout", "input": "4\n-1 3\n16 2\n13 1\n1001000000 3092440", "output": "-0.7500000000000000\n4.0000000000000000\n6.5000000000000000\n475065130.4721832275390625\n"}, {"type": "stdin_stdout", "input": "4\n3 2\n23 1\n22 3\n1000000001 3153660", "output": "0.7500000000000000\n11.5000000000000000\n16.5000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs Sherlock Holmes was investigating another crime, he found a certain number of clues. Also, he has already found direct links between some of those clues. The direct links between the clues are mutual. That is, the dire...
[{"type": "stdin_stdout", "input": "30 70 288262020\n27 18\n5 19\n23 17\n16 17\n29 17\n1 22\n23 5\n10 13\n22 26\n14 3\n8 3\n29 9\n9 1\n3 9\n16 4\n9 22\n10 22\n20 1\n3 7\n23 19\n26 8\n24 1\n5 7\n28 29\n20 11\n16 12\n6 9\n24 29\n30 4\n5 26\n18 21\n5 21\n30 6\n12 13\n16 23\n28 14\n30 1\n7 27\n7 19\n27 17\n5 30\n30 27\n28 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given the current time in 24-hour format hh:mm. Find and print the time after a minutes.\n\nNote that you should find only the time after a minutes, see the examples to clarify the problem statement.\n\nYou can re...
[{"type": "stdin_stdout", "input": "12:34\n10000\n", "output": "11:14\n"}, {"type": "stdin_stdout", "input": "00:00\n10000\n", "output": "22:40\n"}, {"type": "stdin_stdout", "input": "00:00\n10000\n", "output": "22:40\n"}, {"type": "stdin_stdout", "input": "12:34\n10000\n", "output": "11:14\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNickname Generator\n\nWrite a function, `nicknameGenerator` that takes a string name as an argument and returns the first 3 or 4 letters as a nickname.\n\nIf the 3rd letter is a consonant, return the first 3 letters.\n\nI...
[{"input": "\"Sam\"", "output": "[\"Error: Name too short\"]", "fn_name": "nickname_generator"}, {"input": "\"Jam\"", "output": "[\"Error: Name too short\"]", "fn_name": "nickname_generator"}, {"input": "\"Suv\"", "output": "[\"Error: Name too short\"]", "fn_name": "nickname_generator"}, {"input": "\"Ni\"", "output": "...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem statement\n\nThere is a positive integer sequence $ a_1, a_2, \\ ldots, a_N $ of length $ N $.\n\nConsider the following game, which uses this sequence and is played by $ 2 $ players on the play and the play.\n\n*...
[{"type": "stdin_stdout", "input": "2\n10 -2", "output": "Second\n"}, {"type": "stdin_stdout", "input": "2\n-1 10", "output": "First\n"}, {"type": "stdin_stdout", "input": "2\n-2 2", "output": "Second\n"}, {"type": "stdin_stdout", "input": "2\n-2 4", "output": "Second\n"}, {"type": "stdin_stdout", "input": "2\n-2 8", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven a positive integer $k$, two arrays are called $k$-similar if:\n\nthey are strictly increasing;\n\nthey have the same length;\n\nall their elements are positive integers between $1$ and $k$ (inclusive);\n\nthey diffe...
[{"type": "stdin_stdout", "input": "6 5 15\n2 5 6 7 8 15\n1 2\n1 1\n5 5\n5 6\n4 5\n", "output": "15\n14\n14\n19\n13\n"}, {"type": "stdin_stdout", "input": "6 5 15\n2 5 6 4 8 15\n1 2\n1 1\n5 5\n5 6\n4 5\n", "output": "15\n14\n14\n19\n16\n"}, {"type": "stdin_stdout", "input": "6 5 13\n2 4 6 7 8 12\n1 4\n1 3\n3 5\n2 2\n5 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA convex polygon consisting of N vertices is given. The coordinates of each vertex are represented counterclockwise by (X1, Y1), (X2, Y2), ……, (XN, YN). No matter what straight line passes through the point P, find the co...
[{"type": "stdin_stdout", "input": "4\n100 100\n0 100\n0 0\n100 0", "output": "50.00000 50.00000"}, {"type": "stdin_stdout", "input": "4\n111 100\n-2 110\n0 -2\n110 -1", "output": "NA\n"}, {"type": "stdin_stdout", "input": "4\n111 110\n-2 110\n0 -2\n110 -1", "output": "NA\n"}, {"type": "stdin_stdout", "input": "4\n111 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n Γ— m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row num...
[{"type": "stdin_stdout", "input": "5 5 30\n0 1 1 1 0\n1 1 0 1 1\n0 1 1 1 1\n0 0 1 1 0\n0 0 0 0 0\n3 2\n2 2\n2 2\n4 3\n1 4\n3 2\n4 1\n2 4\n1 4\n2 1\n5 2\n4 1\n4 1\n5 1\n2 4\n2 4\n4 4\n1 2\n3 1\n4 5\n1 2\n2 3\n1 1\n5 1\n3 4\n1 1\n5 4\n1 5\n5 4\n2 2\n", "output": "3\n3\n3\n3\n3\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n5\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya is very upset that many people on the Net mix uppercase and lowercase letters in one word. That's why he decided to invent an extension for his favorite browser that would change the letters' register in every word ...
[{"type": "stdin_stdout", "input": "XHRPXZEGHSOCJPICUIXSKFrZUPYTSGJSDIYBCMNMNBPNDBXLXBzhbfnqvwcffvUdhtickyqhupmcehlsyvncqmfhautvxudqdhgg\n", "output": "xhrpxzeghsocjpicuixskfrzupytsgjsdiybcmnmnbpndbxlxbzhbfnqvwcffvudhtickyqhupmcehlsyvncqmfhautvxudqdhgg\n"}, {"type": "stdin_stdout", "input": "RJIQZMJzIMSNDBOHBRAWIENODSA...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi has K 500-yen coins. (Yen is the currency of Japan.)\nIf these coins add up to X yen or more, print Yes; otherwise, print No.\n\n-----Constraints-----\n - 1 \\leq K \\leq 100\n - 1 \\leq X \\leq 10^5\n\n-----Inp...
[{"type": "stdin_stdout", "input": "100 100000\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "84 42001\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "13 6498\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "4 2000\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "13 1282", "outp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPupils Alice and Ibragim are best friends. It's Ibragim's birthday soon, so Alice decided to gift him a new puzzle. The puzzle can be represented as a matrix with $2$ rows and $n$ columns, every element of which is either...
[{"type": "stdin_stdout", "input": "50\n0 1 1 1 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 0\n0 0 0 1 0 1 0 0 0 1 0 1 1 1 0 0 0 0 0 1 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 1\n0 0 0 0 1 1 0 0 1 0 0 0 1 0 0 0 1 1 0 0 0 0 1 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 0 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIvan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (...
[{"type": "stdin_stdout", "input": "1000000000000000000 100000000000000000\n", "output": "899999999999999991\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 200000000000000000\n", "output": "799999999999999991\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 100000000000000000\n", "output": "8999...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIntegral numbers can be even or odd.\n\nEven numbers satisfy `n = 2m` ( with `m` also integral ) and we will ( completely arbitrarily ) think of odd numbers as `n = 2m + 1`. \nNow, some odd numbers can be more odd than o...
[{"input": "[1, 3, 5, 7]", "output": "[7]", "fn_name": "oddest"}, {"input": "[-1, -1]", "output": "[null]", "fn_name": "oddest"}, {"input": "[-1, 0, 1]", "output": "[-1]", "fn_name": "oddest"}, {"input": "[-5, 3]", "output": "[null]", "fn_name": "oddest"}, {"input": "[1, 5]", "output": "[null]", "fn_name": "oddest"}, {...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nQuite recently, a very smart student named Jury decided that lectures are boring, so he downloaded a game called \"Black Square\" on his super cool touchscreen phone.\n\nIn this game, the phone's screen is divided into fo...
[{"type": "stdin_stdout", "input": "1809 1302 7164 6122\n3144121413113111223311232232114144321414421243443243422322144324121433444342231344234443332241322442\n", "output": "420780\n"}, {"type": "stdin_stdout", "input": "1809 1302 7164 6122\n3144121413113111223311232232114144321414421243443243422322144324121433444342231...
code_stdio