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\nWe need a function ```count_sel()``` that receives an array or list of integers (positive and negative) and may give us the following information in the order and structure presented bellow:\n\n```[(1), (2), (3), [[(4)],...
[{"input": "[4, 4, 2, -3, 1, 4, 3, 2, 0, -5, 2, -2, -2, -5]", "output": "[[14, 8, 4, [[2, 4], 3]]]", "fn_name": "count_sel"}, {"input": "[5, -1, 1, -1, -2, 5, 0, -2, -5, 3]", "output": "[[10, 7, 4, [[-2, -1, 5], 2]]]", "fn_name": "count_sel"}, {"input": "[-3, -2, -1, 3, 4, -5, -5, 5, -1, -5]", "output": "[[10, 7, 5, [[...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Little Elephant from the Zoo of Lviv has an array A that consists of N positive integers. Let A[i] be the i-th number in this array (i = 1, 2, ..., N).\n\nFind the minimal number x > 1 such that x is a divisor of all ...
[{"type": "stdin_stdout", "input": "2\n3\n2 4 8\n3\n4 7 5\n\n\n", "output": "2\n-1\n"}, {"type": "stdin_stdout", "input": "2\n3\n3 4 16\n3\n1 10 6", "output": "-1\n-1\n"}, {"type": "stdin_stdout", "input": "2\n1\n1 4 6\n1\n1 13 10", "output": "-1\n-1\n"}, {"type": "stdin_stdout", "input": "2\n2\n2 3 8\n3\n0 0 11", "out...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTry guessing the statement from this picture: $3$ \n\nYou are given a non-negative integer $d$. You have to find two non-negative real numbers $a$ and $b$ such that $a + b = d$ and $a \\cdot b = d$.\n\n\n-----Input-----\...
[{"type": "stdin_stdout", "input": "7\n69\n0\n1\n4\n5\n999\n1010\n", "output": "Y 67.98507130050643 1.014928699493561\nY 0.0 0.0\nN\nY 2.000000021073422 1.999999978926578\nY 3.6180339887498913 1.3819660112501058\nY 997.9989969899639 1.0010030100361376\nY 1008.9990079355314 1.0009920644684442\n"}, {"type": "stdin_stdout...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nUser ainta loves to play with cards. He has a cards containing letter \"o\" and b cards containing letter \"x\". He arranges the cards in a row, and calculates the score of the deck by the formula below. At first, the sc...
[{"type": "stdin_stdout", "input": "79123 17331\n", "output": "6246978154\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCompare given two sequence $A = \\\\{a_0, a_1, ..., a_{n-1}\\\\}$ and $B = \\\\{b_0, b_1, ..., b_{m-1}$ lexicographically.\n\nConstraints\n\n* $1 \\leq n, m \\leq 1,000$\n* $0 \\leq a_i, b_i \\leq 1,000$\n\nInput\n\nThe i...
[{"type": "stdin_stdout", "input": "4\n0 4 12 1\n5\n1 2 5 4 1", "output": "1\n"}, {"type": "stdin_stdout", "input": "4\n1 4 1 1\n2\n-1 4 5 4 2", "output": "0\n"}, {"type": "stdin_stdout", "input": "4\n1 4 1 1\n2\n-1 4 9 4 2", "output": "0\n"}, {"type": "stdin_stdout", "input": "4\n1 4 1 1\n2\n-2 4 9 4 2", "output": "0\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya is preparing a contest, and now he has written a statement for an easy problem. The statement is a string of length $n$ consisting of lowercase Latin latters. Vasya thinks that the statement can be considered hard i...
[{"type": "stdin_stdout", "input": "25\ndadddhrdhradrdzzzahazaddr\n582987584 321035417 414785252 587245865 701672370 65936511 563890835 134108386 387506178 22811155 989335244 1206131752 445085282 809768866 105799145 196558041 1131981383 134067229 875977231 488184174 41982468 225574390 702881847 937432062 185455403\n", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet N be a positive odd number.\n\nThere are N coins, numbered 1, 2, \\ldots, N. For each i (1 \\leq i \\leq N), when Coin i is tossed, it comes up heads with probability p_i and tails with probability 1 - p_i.\n\nTaro ha...
[{"type": "stdin_stdout", "input": "5\n1.1614561119919404 1.1884479131493024 2.346315137474776 3.457070091264252 0.7256297605857085", "output": "0.0803727774076\n"}, {"type": "stdin_stdout", "input": "5\n1.1614561119919404 1.1884479131493024 2.346315137474776 4.129281462465055 0.7256297605857085", "output": "-0.1355589...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEveryone knows passphrases. One can choose passphrases from poems, songs, movies names and so on but frequently\nthey can be guessed due to common cultural references.\nYou can get your passphrases stronger by different ...
[{"input": "\"FOR THIS REASON IT IS RECOMMENDED THAT PASSPHRASES NOT BE REUSED ACROSS DIFFERENT OR UNIQUE SITES AND SERVICES.\"\n15", "output": "[\".hTrXkGtH ScP HtIxH TjFxCj gD IcTgTuUxS HhDgRp sThJtG Tq iDc hThPgWeHhPe iPwI StScTbBdRtG Hx iX CdHpTg hXwI GdU\"]", "fn_name": "play_pass"}, {"input": "\"TO BE HONEST WITH...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nLesha plays the recently published new version of the legendary game hacknet. In this version character skill mechanism was introduced. Now, each player character has exactly n skills. Each skill is represented by a non-n...
[{"type": "stdin_stdout", "input": "1 1000000000 1000 1000 1000000000000000\n1000000000\n", "output": "1000000001000\n1000000000 \n"}, {"type": "stdin_stdout", "input": "1 1000001000 1000 1000 1000000000000000\n1000000000\n", "output": "1000001001000\n1000001000\n"}, {"type": "stdin_stdout", "input": "1 1000000000 1000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe \"Bulls and Cows\" game needs two people to play. The thinker thinks of a number and the guesser tries to guess it.\n\nThe thinker thinks of a four-digit number in the decimal system. All the digits in the number are ...
[{"type": "stdin_stdout", "input": "10\n0132 0 1\n6801 0 1\n8749 1 1\n8036 0 0\n7384 0 2\n8594 0 1\n9307 1 0\n7390 0 1\n6127 1 1\n0381 0 1\n", "output": "Incorrect data\n"}, {"type": "stdin_stdout", "input": "10\n8795 0 3\n4971 1 1\n5032 0 1\n5479 0 3\n2501 0 1\n9052 1 1\n3649 0 1\n1927 1 0\n9173 0 1\n8014 0 2\n", "out...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe say that a odd number N is similar to 2017 when both N and (N+1)/2 are prime.\nYou are given Q queries.\nIn the i-th query, given two odd numbers l_i and r_i, find the number of odd numbers x similar to 2017 such that ...
[{"type": "stdin_stdout", "input": "6\n1 53\n7 129\n37 55\n19 51\n103 169\n13 33", "output": "4\n4\n1\n1\n1\n1\n"}, {"type": "stdin_stdout", "input": "6\n1 53\n7 129\n65 55\n19 51\n17 169\n13 49", "output": "4\n4\n-1\n1\n4\n2\n"}, {"type": "stdin_stdout", "input": "6\n1 53\n13 91\n37 55\n19 51\n73 91\n13 49\n", "output...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi likes the sound when he buys a drink from a vending machine.\nThat sound can be heard by spending A yen (the currency of Japan) each time.\nTakahashi has B yen. He will hear the sound as many times as he can wit...
[{"type": "stdin_stdout", "input": "100 100 100\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1 100 100\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "011 -1 106", "output": "-1\n"}, {"type": "stdin_stdout", "input": "001 -1 106", "output": "-1\n"}, {"type": "stdin_stdout", "input": "101 -1 106",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nXenia the beginner mathematician is a third year student at elementary school. She is now learning the addition operation.\n\nThe teacher has written down the sum of multiple numbers. Pupils should calculate the sum. To m...
[{"type": "stdin_stdout", "input": "2+3+3+1+2+2+2+1+1+2+1+3+2+2+3+3+2+2+3+3+3+1+1+1+3+3+3+2+1+3+2+3+2+1+1+3+3+3+1+2+2+1+2+2+1+2+1+3+1+1\n", "output": "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\n"}, {"type": "stdin_stdout", "input": "2+1+2+2+1+3+2+3+1+1+2+1+2+2+3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe development of algae in a pond is as follows.\nLet the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:\n - x_{i+1} = rx_i - D\nYou are given r, D and x_{2...
[{"type": "stdin_stdout", "input": "28 -2 -1", "output": "-26\n-726\n-20326\n-569126\n-15935526\n-446194726\n-12493452326\n-349816665126\n-9794866623526\n-274256265458726\n"}, {"type": "stdin_stdout", "input": "17 -2 -1", "output": "-15\n-253\n-4299\n-73081\n-1242375\n-21120373\n-359046339\n-6103787761\n-103764391935\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSmeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise.\nYou are given Smeke's current rating, x. Print ABC i...
[{"type": "stdin_stdout", "input": "1000\n", "output": "ABC\n"}, {"type": "stdin_stdout", "input": "2000\n", "output": "ARC\n"}, {"type": "stdin_stdout", "input": "0000", "output": "ABC\n"}, {"type": "stdin_stdout", "input": "2936", "output": "ARC\n"}, {"type": "stdin_stdout", "input": "0100", "output": "ABC\n"}, {"typ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA checksum is an algorithm that scans a packet of data and returns a single number. The idea is that if the packet is changed, the checksum will also change, so checksums are often used for detecting\ntransmission errors,...
[{"input": "\"ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ\"", "output": "[848640]", "fn_name": "quicksum"}, ...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food inc...
[{"type": "stdin_stdout", "input": "20 58\n156216 11 152 99\n", "output": "191884.80000000002\n"}, {"type": "stdin_stdout", "input": "20 58\n93398 43 152 99\n", "output": "114790.40000000001\n"}, {"type": "stdin_stdout", "input": "18 46\n10753 23 46 140\n", "output": "3275.2000000000003\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLesha plays the recently published new version of the legendary game hacknet. In this version character skill mechanism was introduced. Now, each player character has exactly n skills. Each skill is represented by a non-n...
[{"type": "stdin_stdout", "input": "5 5 10 20 50\n0 0 0 0 0\n", "output": " 150\n 5 5 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe GCD table G of size n × n for an array of positive integers a of length n is defined by formula \n\n<image>\n\nLet us remind you that the greatest common divisor (GCD) of two positive integers x and y is the greatest ...
[{"type": "stdin_stdout", "input": "5\n537163 537163 537163 537163 537163 537163 1074326 537163 537163 537163 515139317 1074326 537163 537163 537163 539311652 321760637 170817834 537163 537163 537163 537163 537163 537163 392666153\n", "output": "539311652 515139317 392666153 321760637 170817834 "}, {"type": "stdin_stdo...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA new school year is approaching, which also means students will be taking tests. \n\nThe tests in this kata are to be graded in different ways. A certain number of points will be given for each correct answer and a certa...
[{"input": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 2, 0, 0, 0, 0, 1, 1, 2, 2, 2, 2, 0]\n6\n0\n1.5", "output": "[87]", "fn_name": "score_test"}, {"input": "[0, 1, 2, 0, 0, 2, 0, 1, 2, 1, 0, 0, 1, 0, 2, 1, 0, 2, 2, 0]\n9\n3\n2", "output": "[84]", "fn_name": "score_test"}, {"input": "[0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 0, 2, ...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a rectangular grid of size $n \\times m$. Each cell has a number written on it; the number on the cell ($i, j$) is $a_{i, j}$. Your task is to calculate the number of paths from the upper-left cell ($1, 1$) to th...
[{"type": "stdin_stdout", "input": "10 10 524287\n1 2 4 8 16 32 64 128 256 512\n2 4 8 16 32 64 128 256 512 1024\n4 8 16 32 64 128 256 512 1024 2048\n8 16 32 64 128 256 512 1024 2048 4096\n16 32 64 128 256 512 1024 2048 4096 8192\n32 64 128 256 512 1024 2048 4096 8192 16384\n64 128 256 512 1024 2048 4096 8192 16384 3276...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n«One dragon. Two dragon. Three dragon», — the princess was counting. She had trouble falling asleep, and she got bored of counting lambs when she was nine.\n\nHowever, just counting dragons was boring as well, so she ente...
[{"type": "stdin_stdout", "input": "10\n10\n10\n10\n100000\n", "output": "10000\n"}, {"type": "stdin_stdout", "input": "10\n10\n10\n4\n100000\n", "output": "30000\n"}, {"type": "stdin_stdout", "input": "10\n10\n16\n4\n100000\n", "output": "30000\n"}, {"type": "stdin_stdout", "input": "1\n1\n1\n1\n100000\n", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe `depth` of an integer `n` is defined to be how many multiples of `n` it is necessary to compute before all `10` digits have appeared at least once in some multiple. \n\nexample:\n```\nlet see n=42\n\nMultiple ...
[{"input": "25", "output": "[36]", "fn_name": "compute_depth"}, {"input": "8", "output": "[12]", "fn_name": "compute_depth"}, {"input": "13", "output": "[8]", "fn_name": "compute_depth"}, {"input": "7", "output": "[10]", "fn_name": "compute_depth"}, {"input": "42", "output": "[9]", "fn_name": "compute_depth"}, {"input"...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nMr Keks is a typical white-collar in Byteland.\n\nHe has a bookshelf in his office with some books on it, each book has an integer positive price.\n\nMr Keks defines the value of a shelf as the sum of books prices on it. ...
[{"type": "stdin_stdout", "input": "30 4\n893642632982367 772277951746295 510759449350295 826812150840579 1060893142351815 525992742241552 154832018679993 645715002371268 27232975419720 475004229372388 200177708355593 810661468479466 49618609534806 301608930846726 97042172725806 441637617418914 594900693592862 62651070...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn one school with Vasya there is a student Kostya. Kostya does not like physics, he likes different online games. Every day, having come home, Kostya throws his bag in the farthest corner and sits down at his beloved com...
[{"type": "stdin_stdout", "input": "3 3 2 5\ndesolator\nrefresher\nperseverance\nvanguard: desolator 1, refresher 1\nmaelstorm: perseverance 2\n1 desolator\n2 perseverance\n1 refresher\n2 desolator\n2 perseverance\n", "output": "1\nvanguard 1\n2\ndesolator 1\nmaelstorm 1\n0\n"}, {"type": "stdin_stdout", "input": "2 3 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPrime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs.\n\nIn thi...
[{"type": "stdin_stdout", "input": "12\n110\n200\n300\n0", "output": "5 7\n107 109\n197 199\n281 283\n"}, {"type": "stdin_stdout", "input": "12\n110\n200\n227\n0", "output": "5 7\n107 109\n197 199\n197 199\n"}, {"type": "stdin_stdout", "input": "12\n110\n200\n329\n0", "output": "5 7\n107 109\n197 199\n311 313\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDO YOU EXPECT ME TO FIND THIS OUT?\n\nWHAT BASE AND/XOR LANGUAGE INCLUDES string?\n\nDON'T BYTE OF MORE THAN YOU CAN CHEW\n\nYOU CAN ONLY DISTORT THE LARGEST OF MATHEMATICS SO FAR\n\nSAYING \"ABRACADABRA\" WITHOUT A MAGIC...
[{"type": "stdin_stdout", "input": "10\n5 5 10 10 10 2 4 3 4 10\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10\n5 5 10 10 10 2 4 3 4 10\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10\n5 5 10 10 10 1 4 3 4 10\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10\n3 5 10 10 10 1 4 3 4 10\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this Kata, you will implement the [Luhn Algorithm](http://en.wikipedia.org/wiki/Luhn_algorithm), which is used to help validate credit card numbers.\n\nGiven a positive integer of up to 16 digits, return ```true``` if ...
[{"input": "4111111111111111", "output": "[true]", "fn_name": "validate"}, {"input": "2626262626262626", "output": "[true]", "fn_name": "validate"}, {"input": "8675309", "output": "[false]", "fn_name": "validate"}, {"input": "922030", "output": "[false]", "fn_name": "validate"}, {"input": "912030", "output": "[true]", ...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nSmith wakes up at the side of a dirty, disused bathroom, his ankle chained to pipes. Next to him is tape-player with a hand-written message \"Play Me\". He finds a tape in his own back pocket. After putting the tape in th...
[{"type": "stdin_stdout", "input": "15 6\naaa\naaabbb\naaabb\naaaaa\naaaaaa\naaaa\naaabbbb\naaaaa\naaaaaa\naaaa\naaabbbb\naabbbb\naa\naa\naab\na\n?a?\n??\n?aa?bb?\n?aa?aa?\n??aaa?\n", "output": "0\n4\n2\n5\n6\n7\n"}, {"type": "stdin_stdout", "input": "15 6\naaa\naaabbb\naaabb\naaaaa\naaaaaa\naaaa\naaabbbb\naaaaa\naaaaa...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe define the \"unfairness\" of a list/array as the *minimal* difference between max(x1,x2,...xk) and min(x1,x2,...xk), for all possible combinations of k elements you can take from the list/array; both minimum and maximu...
[{"input": "[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n10", "output": "[0]", "fn_name": "min_unfairness"}, {"input": "[1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2]\n10", "output": "[1]", "fn_name": "min_unfairness"}, {"input": "[1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2]\n9", "output": "[0]", "fn_name...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\n## Find Mean\n\nFind the mean (average) of a list of numbers in an array.\n\n## Information\n\nTo find the mean (average) of a set of numbers add all of the numbers together and divide by the number of values in the list....
[{"input": "[-1, 3, 5, -7]", "output": "[0]", "fn_name": "find_average"}, {"input": "[5, 7, 3, 7]", "output": "[5.5]", "fn_name": "find_average"}, {"input": "[1, 3, 5, 7]", "output": "[4]", "fn_name": "find_average"}, {"input": "[1]", "output": "[1]", "fn_name": "find_average"}, {"input": "[]", "output": "[0]", "fn_nam...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nMake a program that filters a list of strings and returns a list with only your friends name in it.\n\nIf a name has exactly 4 letters in it, you can be sure that it has to be a friend of yours! Otherwise, you can be sure...
[{"input": "[\"Jimm\", \"Cari\", \"aret\", \"truehdnviegkwgvke\", \"sixtyiscooooool\"]", "output": "[[\"Jimm\", \"Cari\", \"aret\"]]", "fn_name": "friend"}, {"input": "[\"This\", \"IS\", \"enough\", \"TEst\", \"CaSe\"]", "output": "[[\"This\", \"TEst\", \"CaSe\"]]", "fn_name": "friend"}, {"input": "[\"Hell\", \"Is\", \...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nLeha like all kinds of strange things. Recently he liked the function F(n, k). Consider all possible k-element subsets of the set [1, 2, ..., n]. For subset find minimal element in it. F(n, k) — mathematical expectation o...
[{"type": "stdin_stdout", "input": "7\n4 12 5 15 8 2 5\n2 1 2 0 1 1 1\n", "output": "4 12 2 15 8 5 5\n"}, {"type": "stdin_stdout", "input": "7\n4 12 5 8 10 2 3\n2 1 2 1 1 1 2\n", "output": "4 12 3 10 8 5 2\n"}, {"type": "stdin_stdout", "input": "7\n4 12 5 8 10 2 3\n2 2 2 1 1 1 2\n", "output": "5 4 3 12 10 8 2\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMake a function **\"add\"** that will be able to sum elements of **list** continuously and return a new list of sums.\n\nFor example: \n\n```\nadd [1,2,3,4,5] == [1, 3, 6, 10, 15], because it's calculated like \nthis : [1...
[{"input": "[7, 14, 21, 28, 35, 42, 49, 56]", "output": "[[7, 21, 42, 70, 105, 147, 196, 252]]", "fn_name": "add"}, {"input": "[8, 16, 24, 32, 40, 48, 56, 64]", "output": "[[8, 24, 48, 80, 120, 168, 224, 288]]", "fn_name": "add"}, {"input": "[5, 10, 15, 20, 25, 30, 35, 40]", "output": "[[5, 15, 30, 50, 75, 105, 140, 18...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which computes the digit number of sum of two integers a and b.\n\nConstraints\n\n* 0 ≤ a, b ≤ 1,000,000\n* The number of datasets ≤ 200\n\nInput\n\nThere are several test cases. Each test case consists of...
[{"type": "stdin_stdout", "input": "-2 -1\n2 -15\n0110 -1", "output": "2\n3\n3\n"}, {"type": "stdin_stdout", "input": "10 10\n2 36\n1000 25", "output": "2\n2\n4\n"}, {"type": "stdin_stdout", "input": "-1 -1\n0 -1\n0111 14", "output": "2\n2\n3\n"}, {"type": "stdin_stdout", "input": "-2 -1\n0 -1\n0011 14", "output": "2\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDothraki are planning an attack to usurp King Robert's throne. King Robert learns of this conspiracy from Raven and plans to lock the single door through which the enemy can enter his kingdom.\n\nBut, to lock the door he ...
[{"type": "stdin_stdout", "input": "wmtdtgddcldazqohcrpyjjebruxjxlstxmzqucvypaarrqyvhpurbyuuvteseyobmnuirrigsixjyweilabmzvhwpnovlexartiikrpcbmnckukwunkvktrziixwmwwgpeobxfgzstbepncmanhmibmrjlnxhldwpuxpzfotbryqeacgpmsypgrargxyrdwixwxybnscesviszqknlicrbcjhajafgkcekafxukcmfmhedrsqbwhczslbcngkxkohmvfjfjvmxctcvnswjaaksllwyti...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi has decided to distribute N AtCoder Crackers to K users of as evenly as possible.\nWhen all the crackers are distributed, find the minimum possible (absolute) difference between the largest number of crackers re...
[{"type": "stdin_stdout", "input": "100 100\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "100 10\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "111 136", "output": "1\n"}, {"type": "stdin_stdout", "input": "110 112", "output": "1\n"}, {"type": "stdin_stdout", "input": "011 127", "output": "1\n"}, {...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them.\n\nFor example, if K = 3, print `ACLACLACL`.\n\nConstraints\n\n* 1 \\leq K \\leq 5\n* All values in input...
[{"type": "stdin_stdout", "input": "451", "output": "ACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACL...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHilbert's Hotel is a very unusual hotel since the number of rooms is infinite! In fact, there is exactly one room for every integer, including zero and negative integers. Even stranger, the hotel is currently at full capa...
[{"type": "stdin_stdout", "input": "10\n3\n-14 -33 142\n16\n45 -84 35 85 69 -64 93 -70 0 -102 2 -52 -55 38 33 -98\n2\n5 0\n4\n-65 -113 5 6\n5\n82 -66 113 -81 -35\n5\n-125 107 -1 2 -10\n1\n25\n1\n-19\n1\n-8\n12\n32 41 43 -157 57 8 -86 111 -25 96 28 -44\n", "output": "NO\nNO\nNO\nNO\nNO\nNO\nYES\nYES\nYES\nNO\n"}, {"type...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA tatami mat, a Japanese traditional floor cover, has a rectangular form with aspect ratio 1:2. When spreading tatami mats on a floor, it is prohibited to make a cross with the border of the tatami mats, because it is bel...
[{"type": "stdin_stdout", "input": "6 12\n2 18\n0 0", "output": "4\n872\n"}, {"type": "stdin_stdout", "input": "5 18\n18 4\n0 0", "output": "10\n25\n"}, {"type": "stdin_stdout", "input": "14 14\n8 3\n0 0", "output": "2\n10\n"}, {"type": "stdin_stdout", "input": "8 10\n18 4\n0 0", "output": "1\n25\n"}, {"type": "stdin_s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBrave Ponta and his best friend, Brave Gonta, have come to Luida's bar in search of friends to embark on an epic adventure. There are many warriors, monks and wizards in the tavern who are itching to go on an adventure.\n...
[{"type": "stdin_stdout", "input": "5\n1 4 3 2 20\n19\n1 3 4 10\n0", "output": "10\n2\n"}, {"type": "stdin_stdout", "input": "5\n1 4 3 2 20\n19\n2 3 4 10\n0", "output": "10\n1\n"}, {"type": "stdin_stdout", "input": "5\n2 0 3 4 20\n29\n1 3 4 10\n0", "output": "11\n2\n"}, {"type": "stdin_stdout", "input": "5\n2 0 3 4 20\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs meticulous Gerald sets the table, Alexander finished another post on Codeforces and begins to respond to New Year greetings from friends. Alexander has n friends, and each of them sends to Alexander exactly one e-card....
[{"type": "stdin_stdout", "input": "10\n5 1 6 2 8 3 4 10 9 7\n3 1 10 6 8 5 2 7 9 4\n2 9 1 4 10 6 8 7 3 5\n10 1 7 8 3 2 4 6 5 9\n3 2 10 4 7 8 5 6 1 9\n5 6 3 10 8 7 2 9 4 1\n6 5 1 3 2 7 9 10 8 4\n1 10 9 3 7 8 4 2 6 5\n6 8 4 5 9 1 2 10 7 3\n9 6 8 5 10 3 1 7 2 4\n5 7 4 8 9 6 1 10 3 2\n", "output": "5 1 1 1 4 5 5 1 4 5 \n"}...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have a string $s$ and a chip, which you can place onto any character of this string.\n\nAfter placing the chip, you move it to the right several (maybe zero) times, i. e. you perform the following operation several ti...
[{"type": "stdin_stdout", "input": "1\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Task\nGet the digits sum of `n`th number from the [Look-and-Say sequence](http://en.wikipedia.org/wiki/Look-and-say_sequence)(1-based).\n\n`1, 11, 21, 1211, 111221, 312211, 13112221, 1113213211, ...`\n\n# Input/Output\n...
[{"input": "1", "output": "[1]", "fn_name": "look_and_say_and_sum"}, {"input": "2", "output": "[2]", "fn_name": "look_and_say_and_sum"}, {"input": "3", "output": "[3]", "fn_name": "look_and_say_and_sum"}, {"input": "4", "output": "[5]", "fn_name": "look_and_say_and_sum"}, {"input": "5", "output": "[8]", "fn_name": "loo...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan).\nIn how many ways can we select some of these coins so that they are X yen in total?\nCoins of the same kind cannot be distingui...
[{"type": "stdin_stdout", "input": "30\n40\n50\n6000\n", "output": "213\n"}, {"type": "stdin_stdout", "input": "30\n40\n77\n6000", "output": "293\n"}, {"type": "stdin_stdout", "input": "30\n47\n77\n6000", "output": "319\n"}, {"type": "stdin_stdout", "input": "30\n112\n134\n6415", "output": "0\n"}, {"type": "stdin_stdou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ cities numbered from $1$ to $n$, and city $i$ has beauty $a_i$.\n\nA salesman wants to start at city $1$, visit every city exactly once, and return to city $1$.\n\nFor all $i\\ne j$, a flight from city $i$ t...
[{"type": "stdin_stdout", "input": "30\n13 1\n111 5\n50 5\n61 0\n76 98\n110 1\n17 1\n4 17\n72 28\n75 90\n16 0\n13 12\n57 0\n47 12\n34 13\n61 120\n3 1\n134 100\n89 94\n88 10\n42 3\n93 33\n6 5\n81 48\n31 17\n32 0\n11 5\n69 1\n58 1\n3 21\n", "output": "750\n"}, {"type": "stdin_stdout", "input": "30\n13 1\n59 5\n50 5\n61 0...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n5 3\n4\n2\n5\n\n\nOutput\n\n5\n2\n4\n1\n3\n\nThe input will be stdin and you should print your solution to stdout\n\n\nNow solve the problem and return the code.\n\nWrite Python code to solve this prob...
[{"type": "stdin_stdout", "input": "92 1\n1\n-2\n2", "output": "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n43\n44\n45\n46\n47\n48\n49\n50\n51\n52\n53\n54\n55\n56\n57\n58\n59\n60\n61\n62\n63\n64\n65\n66\n6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDima worked all day and wrote down on a long paper strip his favorite number $n$ consisting of $l$ digits. Unfortunately, the strip turned out to be so long that it didn't fit in the Dima's bookshelf.\n\nTo solve the issu...
[{"type": "stdin_stdout", "input": "100\n8820100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000026601\n", "output": "88201000000000000000000000000000000000000000000000000000000000000000000000000000000000000026601\n"}, {"type": "stdin_stdout", "input": "100\n8820100000000000000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have n distinct points on a plane, none of them lie on OY axis. Check that there is a point after removal of which the remaining points are located on one side of the OY axis.\n\n\n-----Input-----\n\nThe first line co...
[{"type": "stdin_stdout", "input": "23\n-1 1\n-1 2\n-2 4\n-7 -8\n-3 3\n-9 -14\n-5 3\n-6 2\n-7 11\n-4 4\n-8 5\n1 1\n-1 -1\n-1 -2\n-2 -4\n-7 8\n-3 -3\n-9 14\n-5 -3\n-6 -2\n-7 -11\n-4 -4\n-8 -5\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "23\n-1 1\n-1 2\n-2 4\n-7 -8\n-3 3\n-9 -14\n-5 3\n-6 2\n-7 11\n-4 4\n-8...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian. \nA new school in Byteland is now in the process of renewing some classrooms with new, stronger and better chairs, so that the students can stay still and pay a...
[{"type": "stdin_stdout", "input": "2\n8\n29", "output": "255\n536870911\n"}, {"type": "stdin_stdout", "input": "2\n8\n49", "output": "255\n949480668\n"}, {"type": "stdin_stdout", "input": "2\n21\n9", "output": "2097151\n511\n"}, {"type": "stdin_stdout", "input": "2\n4\n22", "output": "15\n4194303\n"}, {"type": "stdin_...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a function `getDrinkByProfession`/`get_drink_by_profession()` that receives as input parameter a string, and produces outputs according to the following table:\n\n\n\n\nInput\nOutput\n\n\n\"Jabroni\"\n\"Patron Tequi...
[{"input": "\"scHOOl counselor\"", "output": "[\"Anything with Alcohol\"]", "fn_name": "get_drink_by_profession"}, {"input": "\"scHOOl COUnselor\"", "output": "[\"Anything with Alcohol\"]", "fn_name": "get_drink_by_profession"}, {"input": "\"prOgramMer\"", "output": "[\"Hipster Craft Beer\"]", "fn_name": "get_drink_by_...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nA superhero fights with a monster. The battle consists of rounds, each of which lasts exactly $n$ minutes. After a round ends, the next round starts immediately. This is repeated over and over again.\n\nEach round has the...
[{"type": "stdin_stdout", "input": "1000000000000 10\n-10 5 -2 -2 -10 -7 -5 -9 -3 -4\n", "output": "212765957448\n"}, {"type": "stdin_stdout", "input": "1000000000000 10\n-10 9 -2 -2 -10 -7 -5 -9 -3 -4\n", "output": "232558139536\n"}, {"type": "stdin_stdout", "input": "1000000000000 10\n-14 9 -2 -2 -10 -7 -5 -9 -3 -4\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIkta, who hates to lose, has recently been enthusiastic about playing games using the Go board. However, neither Go nor Gomoku can beat my friends at all, so I decided to give a special training to the lesser-known game P...
[{"type": "stdin_stdout", "input": "...............\n...............\n...............\n...............\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\nWe have a string of letters 'a' and 'b'. We want to perform some operations on it. On each step we choose one of substrings \"ab\" in the string and replace it with the string \"bba\". If we have no \"ab\" as a substring,...
[{"type": "stdin_stdout", "input": "abaaaaaabaaaabbabbaaabbbbabababaaaaabbaabbaaaaabbbaababaaaaaaabbbbbaaaaabaababbabababbabbbbaabbaabbabbbabaabbaabbaaaaaab\n", "output": "235606597\n"}, {"type": "stdin_stdout", "input": "abaaaaaabaaaabbabbaaabbbbabababaaaaabbaabbaaaaabbbaababaaaaaaabbbbbaaaaabaababbabababbabbbbaabbaab...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a $n \\times m$ grid. You are standing at cell $(1, 1)$ and your goal is to finish at cell $(n, m)$.\n\nYou can move to the neighboring cells to the right or down. In other words, suppose you are standing at cell...
[{"type": "stdin_stdout", "input": "9\n1 1 0\n2 2 4\n2 2 3\n2 2 -2\n1 1 1\n100 100 11000\n2 3 7\n3 1 9\n2 6 11\n", "output": "YES\nNO\nYES\nNO\nNO\nNO\nNO\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "9\n1 1 0\n2 2 4\n2 2 3\n2 2 -1\n2 1 1\n100 100 10000\n2 4 7\n3 1 9\n2 6 8\n", "output": "YES\nNO\nYES\nNO\nYES\nNO\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSum all the numbers of the array (in F# and Haskell you get a list) except the highest and the lowest element (the value, not the index!).\n(The highest/lowest element is respectively only one element at each edge, even i...
[{"input": "[-6, -20, -1, -10, -12]", "output": "[-28]", "fn_name": "sum_array"}, {"input": "[-6, 20, -1, 10, -12]", "output": "[3]", "fn_name": "sum_array"}, {"input": "[6, 0, 1, 10, 10]", "output": "[17]", "fn_name": "sum_array"}, {"input": "[6, 2, 1, 8, 10]", "output": "[16]", "fn_name": "sum_array"}, {"input": "[-3...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nBees Alice and Alesya gave beekeeper Polina famous card game \"Set\" as a Christmas present. The deck consists of cards that vary in four features across three options for each kind of feature: number of shapes, shape, sh...
[{"type": "stdin_stdout", "input": "24 4\nSETS\nETES\nSSST\nESTE\nTSES\nSSES\nTESS\nSEEE\nETEE\nETSS\nSSEE\nESTT\nSTSS\nTTTT\nTEEE\nTSEE\nESET\nTTTE\nETTT\nSTEE\nSTTE\nESSS\nTEET\nTETE\n", "output": "31\n"}, {"type": "stdin_stdout", "input": "24 4\nSETS\nETES\nSSST\nESTE\nTSES\nSSES\nTESS\nEESE\nETEE\nETSS\nSSEE\nESTT\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n*** No Loops Allowed ***\n\nYou will be given an array (a) and a value (x). All you need to do is check whether the provided array contains the value, without using a loop.\n\nArray can contain numbers or strings. X can b...
[{"input": "[66, \"codewars\", 11, \"alex loves pushups\"]\n\"alex loves pushups\"", "output": "[true]", "fn_name": "check"}, {"input": "[\"when's\", \"the\", \"next\", \"Katathon?\", 9, 7]\n\"Katathon?\"", "output": "[true]", "fn_name": "check"}, {"input": "[8, 7, 5, \"bored\", \"of\", \"writing\", \"tests\", 115]\n45...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou've got a list of program warning logs. Each record of a log stream is a string in this format: \"2012-MM-DD HH:MM:SS:MESSAGE\" (without the quotes). \n\nString \"MESSAGE\" consists of spaces, uppercase and lowercase ...
[{"type": "stdin_stdout", "input": "60 3\n2012-03-16 16:15:25: Disk size is\n2012-03-16 16:15:25: Network failute\n2012-03-16 16:16:29: Cant write varlog\n2012-03-16 16:16:42: Unable to start process\n2012-03-16 16:16:43: Disk size is too small\n2012-03-16 16:16:53: Timeout detected\n", "output": "2012-03-16 16:16:43\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have N dice arranged in a line from left to right. The i-th die from the left shows p_i numbers from 1 to p_i with equal probability when thrown.\nWe will choose K adjacent dice, throw each of them independently, and c...
[{"type": "stdin_stdout", "input": "10 4\n17 13 13 12 15 20 10 13 17 11\n", "output": "32.000000000000\n"}, {"type": "stdin_stdout", "input": "10 4\n17 13 13 12 15 20 10 13 17 11", "output": "32.000000000000"}, {"type": "stdin_stdout", "input": "10 4\n17 21 13 12 15 20 10 13 17 11", "output": "33.5000000000\n"}, {"type...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N towns in JOI, which are connected by M bidirectional roads. There are shopping malls in K towns, and the people go to one of those towns through the road to shop.\n\nDepending on the location of your home, you...
[{"type": "stdin_stdout", "input": "10 3 1\n1 2 5\n3 3 2\n3 1 1\n2", "output": "7\n"}, {"type": "stdin_stdout", "input": "11 3 1\n1 1 1\n2 3 0\n3 1 1\n1", "output": "1\n"}, {"type": "stdin_stdout", "input": "10 3 1\n1 2 2\n2 3 2\n3 1 1\n1", "output": "3\n"}, {"type": "stdin_stdout", "input": "10 3 1\n1 2 2\n2 3 2\n2 1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIf the strings are consecutive, you can replace the characters with a rule to shorten the string. For example, for the string AAAA, the expression @ 4A will compress one character. Create a program that restores the chara...
[{"type": "stdin_stdout", "input": "ab@5C1@8050\n@99,1=1@90", "output": "abCCCCC10000000050\n999999999,1=1000000000"}, {"type": "stdin_stdout", "input": "ab@5C2@8050\n@99,1=1@90", "output": "abCCCCC20000000050\n999999999,1=1000000000"}, {"type": "stdin_stdout", "input": "ab@5C1@8050\n@99+1<1@90", "output": "abCCCCC1000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFacetook is a well known social network website, and it will launch a new feature called Facetook Priority Wall. This feature will sort all posts from your friends according to the priority factor (it will be described).\...
[{"type": "stdin_stdout", "input": "kmircqsffq\n14\nfrnf likes xgmmp's post\nfnfdpupayp commented on syz's post\nxefshpn commented on xgmmp's post\nm posted on gdwydzktok's wall\neskm likes pqmbnuc's post\npnqiapduhz likes zzqvjdz's post\nx likes nouuurc's post\nvnyxhoukuo posted on uhblapjab's wall\nblpjpxn likes zvwb...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\n-----Constraints-----\n - All...
[{"type": "stdin_stdout", "input": "1999999216 1999999234\n", "output": "650\n"}, {"type": "stdin_stdout", "input": "1999999264 1999999270\n", "output": "26\n"}, {"type": "stdin_stdout", "input": "1999999266 1999999276\n", "output": "18\n"}, {"type": "stdin_stdout", "input": "1999997173 1999999190\n", "output": "0\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAdvanced Creative Mobile (ACM) has decided to develop a GUI application to be installed in a new portable computer.\n\nAs shown in the figure below, the GUI has a nested structure in which it has one main panel, several p...
[{"type": "stdin_stdout", "input": "5\n<main>10,10,190,150<menu>20,20,70,140</menu><primary>80,20,180,140</primary></main>\n9 10\n0 17\n40 190\n2 3\n130 80\n0", "output": "OUT OF MAIN PANEL 1\nOUT OF MAIN PANEL 1\nOUT OF MAIN PANEL 1\nOUT OF MAIN PANEL 1\nprimary 0\n"}, {"type": "stdin_stdout", "input": "5\n<main>10,10...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWelcome! Everything is fine.\n\nYou have arrived in The Medium Place, the place between The Good Place and The Bad Place. You are assigned a task that will either make people happier or torture them for eternity.\n\nYou h...
[{"type": "stdin_stdout", "input": "2\n3\n1 2 3\n3 2 4\n2 4 3\n4 5 6\n5 6 5\n2\n1 2 1\n1 3 2\n1 4 3\n", "output": "15 33\n6 6\n"}, {"type": "stdin_stdout", "input": "2\n3\n1 2 0\n3 2 4\n2 4 3\n4 5 6\n5 6 5\n2\n1 2 1\n1 3 2\n1 4 3\n", "output": "12 30\n6 6\n"}, {"type": "stdin_stdout", "input": "2\n3\n1 2 0\n3 1 4\n2 4 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob are decorating a Christmas Tree. \n\nAlice wants only $3$ types of ornaments to be used on the Christmas Tree: yellow, blue and red. They have $y$ yellow ornaments, $b$ blue ornaments and $r$ red ornaments.\...
[{"type": "stdin_stdout", "input": "100 100 100\n", "output": "297\n"}, {"type": "stdin_stdout", "input": "156 101 100\n", "output": "297\n"}, {"type": "stdin_stdout", "input": "156 111 100\n", "output": "297\n"}, {"type": "stdin_stdout", "input": "100 100 100\n", "output": "297"}, {"type": "stdin_stdout", "input": "99...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Story&Task\n The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all houses in the city were built in one row.\n\n Let's enumerate all the houses from left to ...
[{"input": "[1, 2, 3, 1, 2]", "output": "[[3, 2, 0, 2, 0]]", "fn_name": "luxhouse"}, {"input": "[3, 2, 1, 4]", "output": "[[2, 3, 4, 0]]", "fn_name": "luxhouse"}, {"input": "[1, 2, 3]", "output": "[[3, 2, 0]]", "fn_name": "luxhouse"}, {"input": "[3, 2, 1]", "output": "[[0, 0, 0]]", "fn_name": "luxhouse"}, {"input": "[1...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nNew Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $h$ hours and $m$ minutes, where $0 \\le hh < 24$ and $0 \\le mm < 60$. We use 24-hour ti...
[{"type": "stdin_stdout", "input": "5\n3 55\n22 30\n21 10\n20 21\n19 59\n", "output": "1205\n90\n170\n219\n241\n"}, {"type": "stdin_stdout", "input": "5\n4 55\n22 30\n21 10\n20 21\n19 59\n", "output": "1145\n90\n170\n219\n241\n"}, {"type": "stdin_stdout", "input": "5\n15 14\n22 45\n21 2\n0 21\n19 59\n", "output": "526\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a rooted tree. Each vertex contains a_i tons of gold, which costs c_i per one ton. Initially, the tree consists only a root numbered 0 with a_0 tons of gold and price c_0 per ton.\n\nThere are q queries. Eac...
[{"type": "stdin_stdout", "input": "5 5 2\n2 0 2\n1 0 3 4\n2 2 4\n1 0 1 3\n2 4 2\n", "output": "\n2 4\n4 10\n1 3\n"}, {"type": "stdin_stdout", "input": "5 5 2\n2 0 2\n1 0 1 4\n2 2 4\n1 0 1 3\n2 4 2\n", "output": "2 4\n4 10\n1 3\n"}, {"type": "stdin_stdout", "input": "5 10 2\n2 0 2\n1 0 3 4\n2 2 4\n1 0 1 3\n2 4 2\n", "o...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBajtek, known for his unusual gifts, recently got an integer array $x_0, x_1, \\ldots, x_{k-1}$.\n\nUnfortunately, after a huge array-party with his extraordinary friends, he realized that he'd lost it. After hours spent ...
[{"type": "stdin_stdout", "input": "100\n57 81 176 211 251 311 346 404 469 506 563 587 682 717 757 817 852 910 975 1012 1069 1093 1188 1223 1263 1323 1358 1416 1481 1518 1575 1599 1694 1729 1769 1829 1864 1922 1987 2024 2081 2105 2200 2235 2275 2335 2370 2428 2493 2530 2587 2611 2706 2741 2781 2841 2876 2934 2999 3036 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer array $a$ of length $n$.\n\nDoes there exist an array $b$ consisting of $n+1$ positive integers such that $a_i=\\gcd (b_i,b_{i+1})$ for all $i$ ($1 \\leq i \\leq n$)?\n\nNote that $\\gcd(x, y)$ de...
[{"type": "stdin_stdout", "input": "3\n7\n48 27 99 27 93 72 2\n5\n86 73 29 1 37\n9\n45 59 22 6 75 4 14 57 23\n", "output": "NO\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "4\n1\n343\n2\n4 2\n3\n4 2 4\n4\n1 1 1 1\n", "output": "YES\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "1\n8\n157 5487 4421 1774 4662 5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEudokimus, a system administrator is in trouble again. As a result of an error in some script, a list of names of very important files has been damaged. Since they were files in the BerFS file system, it is known that eac...
[{"type": "stdin_stdout", "input": "b.baba.ebpbac.iabaeabac.abab.adabacaba.ahcggibij.adaacab.ebaba.aa.abacaba.dacabada.daqjcpc.jadab.dab\n", "output": "YES\nb.bab\na.ebp\nbac.iab\naeabac.aba\nb.ada\nbacaba.ahc\nggibij.ada\nacab.eba\nba.a\na.aba\ncaba.dac\nabada.daq\njcpc.jad\nab.dab\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConsider the sequence `a(1) = 7, a(n) = a(n-1) + gcd(n, a(n-1)) for n >= 2`: \n\n`7, 8, 9, 10, 15, 18, 19, 20, 21, 22, 33, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 69, 72, 73...`.\n\nLet us take the differences between...
[{"input": "100000", "output": "[99955]", "fn_name": "count_ones"}, {"input": "10000", "output": "[9968]", "fn_name": "count_ones"}, {"input": "1000", "output": "[975]", "fn_name": "count_ones"}, {"input": "200", "output": "[184]", "fn_name": "count_ones"}, {"input": "100", "output": "[90]", "fn_name": "count_ones"}, {...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis is a simplified version of the task Toy Train. These two versions differ only in the constraints. Hacks for this version are disabled.\n\nAlice received a set of Toy Train™ from Bob. It consists of one train and a co...
[{"type": "stdin_stdout", "input": "100 50\n29 35\n10 75\n29 34\n10 87\n29 13\n29 38\n41 21\n10 6\n29 94\n10 47\n31 27\n41 24\n41 8\n10 93\n41 52\n41 36\n31 32\n85 81\n31 32\n41 79\n41 99\n85 88\n41 25\n31 68\n41 93\n10 87\n85 97\n41 85\n10 64\n10 68\n85 22\n10 45\n85 15\n10 16\n10 21\n41 66\n29 68\n41 96\n29 34\n10 22...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLot of junior developer can be stuck when they need to change the access permission to a file or a directory in an Unix-like operating systems.\n\nTo do that they can use the `chmod` command and with some magic trick they...
[{"input": "{\"user\": \"rwx\", \"group\": \"r-x\", \"other\": \"r-x\"}", "output": "[\"755\"]", "fn_name": "chmod_calculator"}, {"input": "{\"user\": \"rwx\", \"group\": \"r--\", \"other\": \"r--\"}", "output": "[\"744\"]", "fn_name": "chmod_calculator"}, {"input": "{\"user\": \"r-x\", \"group\": \"r-x\", \"other\": \...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\n### Longest Palindrome\n\nFind the length of the longest substring in the given string `s` that is the same in reverse. \n\nAs an example, if the input was “I like racecars that go fast”, the substring (`racecar`) ...
[{"input": "\"FourscoreandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNowweareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometode...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet us denote by f(x, m) the remainder of the Euclidean division of x by m.\nLet A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M).\nFind \\displaystyle{\\sum_{...
[{"type": "stdin_stdout", "input": "10000000000 99201 99975\n", "output": "992010000000000\n"}, {"type": "stdin_stdout", "input": "9999999995 82382 99996\n", "output": "309280000028478\n"}, {"type": "stdin_stdout", "input": "9999999997 38566 99996\n", "output": "309280000067758\n"}, {"type": "stdin_stdout", "input": "9...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA string $s$ of length $n$ can be encrypted by the following algorithm: iterate over all divisors of $n$ in decreasing order (i.e. from $n$ to $1$), for each divisor $d$, reverse the substring $s[1 \\dots d]$ (i.e. the ...
[{"type": "stdin_stdout", "input": "100\nedykhvzcntljuuoqghptioetqnfllwekzohiuaxelgecabvsbibgqodqxvyfkbyjwtgbyhvssntinkwsinwsmalusiwnjmtcoovf\n", "output": "fvooctmjnwisulamswniswknitnssvhybgtwjybkfyvxqdoqgbqteoitnczvkyedhljuuoqghptnfllwekzohiuaxelgecabvsbi\n"}, {"type": "stdin_stdout", "input": "100\nooooooooooooooooo...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nJack really likes his number five: the trick here is that you have to multiply each number by 5 raised to the number of digits of each numbers, so, for example:\n```python\nmultiply(3)==15\nmultiply(10)==250\nmultiply(200...
[{"input": "200", "output": "[25000]", "fn_name": "multiply"}, {"input": "10", "output": "[250]", "fn_name": "multiply"}, {"input": "-2", "output": "[-10]", "fn_name": "multiply"}, {"input": "5", "output": "[25]", "fn_name": "multiply"}, {"input": "0", "output": "[0]", "fn_name": "multiply"}]
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nChef Palin, as his name suggests, is always very interested in palindromic strings. Recently, he made a pretty interesting discovery on palindromes and that made him feel really Lucky. He came across something known as Lu...
[{"type": "stdin_stdout", "input": "3\nlatbcdkfy\nfeicedocljbux\naaaaaaba", "output": "luckykcul 8\nfluckyoykculf 10\nunlucky\n"}, {"type": "stdin_stdout", "input": "3\nytkdadfbl\ntobjlcedechwf\naabaaaba", "output": "luckykcul 8\nfluckyeykculf 10\nunlucky\n"}, {"type": "stdin_stdout", "input": "3\nytkdadfbl\ntobjlcfdec...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCreate a function that takes a Roman numeral as its argument and returns its value as a numeric decimal integer. You don't need to validate the form of the Roman numeral.\n\nModern Roman numerals are written by expressing...
[{"input": "\"MDCLXVI\"", "output": "[1666]", "fn_name": "solution"}, {"input": "\"MMVIII\"", "output": "[2008]", "fn_name": "solution"}, {"input": "\"XXI\"", "output": "[21]", "fn_name": "solution"}, {"input": "\"IV\"", "output": "[4]", "fn_name": "solution"}, {"input": "\"I\"", "output": "[1]", "fn_name": "solution"}...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nWilliam has an array of $n$ integers $a_1, a_2, \\dots, a_n$. In one move he can swap two neighboring items. Two items $a_i$ and $a_j$ are considered neighboring if the condition $|i - j| = 1$ is satisfied.\n\nWilliam wan...
[{"type": "stdin_stdout", "input": "5\n3\n2 4 6\n5\n4 4 4 4 4\n5\n1 3 5 10 12\n5\n1 1 1 1 1\n5\n4 8 10 6 2\n", "output": "-1\n-1\n3\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "5\n3\n2 4 12\n5\n4 4 4 4 4\n5\n1 2 5 14 9\n5\n2 2 0 1 2\n5\n4 0 10 6 2\n", "output": "-1\n-1\n0\n-1\n-1\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFamous Brazil city Rio de Janeiro holds a tennis tournament and Ostap Bender doesn't want to miss this event. There will be n players participating, and the tournament will follow knockout rules from the very first game. ...
[{"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "85\n"}, {"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "85\n"}, {"type": "stdin_stdout", "input": "123456789123456789\n", "output": "81\n"}, {"type": "stdin_stdout", "input": "679891637638612257\n", "output": "84\n"}, {"type": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N students in a school.\nWe will divide these students into some groups, and in each group they will discuss some themes.\nYou think that groups consisting of two or less students cannot have an effective discus...
[{"type": "stdin_stdout", "input": "1000\n", "output": "333\n"}, {"type": "stdin_stdout", "input": "303\n", "output": "101\n"}, {"type": "stdin_stdout", "input": "807\n", "output": "269\n"}, {"type": "stdin_stdout", "input": "596\n", "output": "198\n"}, {"type": "stdin_stdout", "input": "604\n", "output": "201\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHave you ever used the chat application QQ? Well, in a chat group of QQ, administrators can muzzle a user for days.\n\nIn Boboniu's chat group, there's a person called Du Yi who likes to make fun of Boboniu every day.\n\n...
[{"type": "stdin_stdout", "input": "100 61 71\n11 18 0 47 33 75 91 13 8 21 73 64 50 97 62 50 2 36 68 32 64 74 32 77 81 41 23 44 40 36 45 33 21 68 57 79 75 23 67 37 99 27 30 56 75 62 75 63 46 19 79 42 11 66 21 25 2 12 89 48 75 7 57 85 80 14 82 29 66 47 29 10 1 84 79 39 33 81 73 51 80 67 52 25 38 68 57 53 38 83 83 3 86 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).\n\nYou are given a sequence $a$ consisting of $n$ integers.\n\nYou are ma...
[{"type": "stdin_stdout", "input": "93\n6 6 10 10 8 4 7 10 2 3 4 10 7 2 8 8 4 2 4 4 7 7 3 2 3 1 5 3 7 2 4 9 10 8 10 5 1 6 2 1 10 3 5 6 6 9 3 10 1 10 1 6 2 3 8 7 1 5 4 10 4 3 5 8 8 1 3 8 2 3 10 7 2 4 5 2 6 4 10 4 4 8 5 1 6 3 1 9 5 4 9 4 3\n", "output": "4\nRRLR\n"}, {"type": "stdin_stdout", "input": "93\n6 6 10 10 9 4 7...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Russian here \nPolo, the Penguin, has a lot of tests tomorrow at the university.\nHe knows that there are N different questions that will be on the tests. For each question i (i = 1..N), he kno...
[{"type": "stdin_stdout", "input": "1\n3 20\n1 -2 0\n6 4 8\n4 -1 3", "output": "24\n"}, {"type": "stdin_stdout", "input": "1\n3 12\n1 0 1\n1 3 14\n13 4 3", "output": "52\n"}, {"type": "stdin_stdout", "input": "1\n3 7\n0 -1 1\n4 0 5\n12 5 3", "output": "60\n"}, {"type": "stdin_stdout", "input": "1\n3 7\n1 1 0\n2 3 20\n3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N computers and N sockets in a one-dimensional world. The coordinate of the i-th computer is a_i, and the coordinate of the i-th socket is b_i. It is guaranteed that these 2N coordinates are pairwise distinct.\n...
[{"type": "stdin_stdout", "input": "3\n3\n4\n18\n11\n0\n10", "output": "1\n"}, {"type": "stdin_stdout", "input": "3\n3\n4\n18\n20\n0\n10", "output": "1\n"}, {"type": "stdin_stdout", "input": "3\n3\n10\n8\n7\n0\n10", "output": "1\n"}, {"type": "stdin_stdout", "input": "3\n3\n10\n9\n7\n0\n10", "output": "1\n"}, {"type": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou love coffee and want to know what beans you can afford to buy it.\n\nThe first argument to your search function will be a number which represents your budget.\n\nThe second argument will be an array of coffee bean pri...
[{"input": "14\n[13, 15, 14, 14, 15, 13]", "output": "[\"13,13,14,14\"]", "fn_name": "search"}, {"input": "14\n[7, 3, 23, 9, 14, 20, 7]", "output": "[\"3,7,7,9,14\"]", "fn_name": "search"}, {"input": "24\n[2.7, 0, 100.9, 1, 5.5]", "output": "[\"0,1,2.7,5.5\"]", "fn_name": "search"}, {"input": "14\n[17, 33, 23, 19, 19, ...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor a positive integer n\n\n* If n is even, divide by 2.\n* If n is odd, multiply by 3 and add 1.\n\n\n\nIf you repeat the above operation, the result will be 1. A problem called \"Colatz conjecture\" is that repeating th...
[{"type": "stdin_stdout", "input": "3\n1043\n0", "output": "7\n124\n"}, {"type": "stdin_stdout", "input": "3\n3340\n0", "output": "7\n136\n"}, {"type": "stdin_stdout", "input": "3\n109\n0", "output": "7\n113\n"}, {"type": "stdin_stdout", "input": "3\n440\n0", "output": "7\n115\n"}, {"type": "stdin_stdout", "input": "3\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYour task is to find the first element of an array that is not consecutive.\n\nBy not consecutive we mean not exactly 1 larger than the previous element of the array.\n\nE.g. If we have an array `[1,2,3,4,6,7,8]` then `1`...
[{"input": "[1, 2, 3, 4, 5, 6, 7, 8]", "output": "[null]", "fn_name": "first_non_consecutive"}, {"input": "[4, 5, 6, 7, 8, 9, 11]", "output": "[11]", "fn_name": "first_non_consecutive"}, {"input": "[1, 2, 3, 4, 6, 7, 8]", "output": "[6]", "fn_name": "first_non_consecutive"}, {"input": "[4, 6, 7, 8, 9, 11]", "output": "...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nBaby is getting his frst tooth. This means more sleepless nights, but with the fun of feeling round his gums and trying to guess which will be first out! \n\nProbably best have a sweepstake with your friends - because you...
[{"input": "[1, 2, 5, 7, 1, 0, 9]", "output": "[6]", "fn_name": "first_tooth"}, {"input": "[20, 9, 16, 19]", "output": "[0]", "fn_name": "first_tooth"}, {"input": "[1, 1, 1, 1]", "output": "[-1]", "fn_name": "first_tooth"}, {"input": "[1, 2, 3, 4]", "output": "[3]", "fn_name": "first_tooth"}, {"input": "[1, 2, 6, 4]", ...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nYour master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts...
[{"type": "stdin_stdout", "input": "5 7\nRRCABXT\nAABMFAB\nRROMJAC\nAPTADAB\nYABADAO\n3 13\nABCDEFGHIJKLM\nYMADAMIMADAMY\nACEGIKMOQSUWY\n3 4\nDEFG\nACAB\nHIJK\n3 6\nFEDCB@\nHHIAKL\nMNOPQR\n10 19\nJFZODYDXMZZPEYTRNCW\nXVGHPOKEYNZTQFZJKOD\nEYEHHQKHFZOVNRGOOLP\nQFZOIHRQMGHPNISHXOC\nDRGILJHSQEHHQLYTILL\nNCSHQMKHTZZIHRPAUJA...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's define $p_i(n)$ as the following permutation: $[i, 1, 2, \\dots, i - 1, i + 1, \\dots, n]$. This means that the $i$-th permutation is almost identity (i.e. which maps every element to itself) permutation but the ele...
[{"type": "stdin_stdout", "input": "30 5\n4 2 8 3 4\n", "output": "14 16 16 14 12 12 12 8 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14\n"}, {"type": "stdin_stdout", "input": "30 5\n4 4 8 3 4\n", "output": "10 10 14 14 8 8 8 8 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10\n"}, {"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAizuwakamatsu City is known as the \"City of History\". About 400 years ago, the skeleton of the castle town was created by Gamo Ujisato, but after that, it became the central city of the Aizu clan 230,000 stones, whose a...
[{"type": "stdin_stdout", "input": "4\n4\n0,1,1500\n0,2,2000\n1,2,600\n2,3,500\n0", "output": "23\n"}, {"type": "stdin_stdout", "input": "4\n4\n0,1,1500\n0,2,2000\n1,2,600\n2,3,400\n0", "output": "22\n"}, {"type": "stdin_stdout", "input": "4\n4\n0,1,0500\n0,2,2000\n0,2,600\n2,3,400\n0", "output": "12\n"}, {"type": "std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi is practicing shiritori alone again today.\nShiritori is a game as follows:\n - In the first turn, a player announces any one word.\n - In the subsequent turns, a player announces a word that satisfies the follo...
[{"type": "stdin_stdout", "input": "100\nlkykrymhey\nyujwmjhnzx\nxgmkqgsajk\nkkvqjyapln\nnkcubvbxdx\nxheccrzfne\neqeizvicxx\nxesnssfeuz\nzsjdhxndds\nsuvxanfkpe\neodirlsywl\nlmiwshvenl\nluomflsyiq\nqcjuajhxme\nelfadfvxvm\nmknedshbyv\nvnboqueaai\niwexnqgqvj\njzfofokvkg\nggzhwrtktd\nderapdnumy\nyfobbqcozo\noivhkngvyy\nytj...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Little Elephant very much loves sums on intervals.\n\nThis time he has a pair of integers l and r (l ≤ r). The Little Elephant has to find the number of such integers x (l ≤ x ≤ r), that the first digit of integer x e...
[{"type": "stdin_stdout", "input": "100000000000000000 1000000000000000000\n", "output": "90000000000000000\n"}, {"type": "stdin_stdout", "input": "645762257531682046 885295120956158518\n", "output": "23953286342447648\n"}, {"type": "stdin_stdout", "input": "819875140559301752 946247219812473271\n", "output": "12637207...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nComplete the function which takes two arguments and returns all numbers which are divisible by the given divisor. First argument is an array of `numbers` and the second is the `divisor`.\n\n## Example\n\n```python\ndivisi...
[{"input": "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n1", "output": "[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]]", "fn_name": "divisible_by"}, {"input": "[1, 2, 3, 4, 5, 6]\n2", "output": "[[2, 4, 6]]", "fn_name": "divisible_by"}, {"input": "[0, 1, 2, 3, 4, 5, 6]\n4", "output": "[[0, 4]]", "fn_name": "divisible_by"}, {"input": "[1,...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nGeorge woke up and saw the current time s on the digital clock. Besides, George knows that he has slept for time t. \n\nHelp George! Write a program that will, given time s and t, determine the time p when George went to ...
[{"type": "stdin_stdout", "input": "05:50\n05:44\n", "output": "00:06\n"}, {"type": "stdin_stdout", "input": "00:00\n01:00\n", "output": "23:00\n"}, {"type": "stdin_stdout", "input": "00:01\n00:00\n", "output": "00:01\n"}, {"type": "stdin_stdout", "input": "23:59\n23:59\n", "output": "00:00\n"}, {"type": "stdin_stdout"...
code_stdio