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\nIn late autumn evening n robots gathered in the cheerful company of friends. Each robot has a unique identifier — an integer from 1 to 10^9.\n\nAt some moment, robots decided to play the game \"Snowball\". Below there are...
[{"type": "stdin_stdout", "input": "4 6\n5 1000000000 1790978867 12\n", "output": "1790978867\n"}, {"type": "stdin_stdout", "input": "4 9\n5 1000000000 1766326397 19\n", "output": "1766326397\n"}, {"type": "stdin_stdout", "input": "4 9\n5 1000000000 1204240164 12\n", "output": "1204240164\n"}, {"type": "stdin_stdout", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Task\n\nGiven the birthdates of two people, find the date when the younger one is exactly half the age of the other.\n\n# Notes\n\n* The dates are given in the format YYYY-MM-DD and are not sorted in any particular orde...
[{"input": "\"1990-12-06\"\n\"2000-02-29\"", "output": "[\"2009-05-24\"]", "fn_name": "half_life"}, {"input": "\"2012-03-31\"\n\"1990-06-09\"", "output": "[\"2034-01-21\"]", "fn_name": "half_life"}, {"input": "\"1984-08-14\"\n\"1990-04-17\"", "output": "[\"1995-12-19\"]", "fn_name": "half_life"}, {"input": "\"2000-06-3...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nCheck if given chord is minor or major.\n\n_____________________________________________________________\nRules:\n\n1. Basic minor/major chord have three elements.\n\n2. Chord is minor when interval between first and seco...
[{"input": "\"D F A C#\"", "output": "[\"Not a chord\"]", "fn_name": "minor_or_major"}, {"input": "\"Bb Gb Eb\"", "output": "[\"Not a chord\"]", "fn_name": "minor_or_major"}, {"input": "\"A C# D#\"", "output": "[\"Not a chord\"]", "fn_name": "minor_or_major"}, {"input": "\"D F A G\"", "output": "[\"Not a chord\"]", "fn...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp has n dice d_1, d_2, ..., d_{n}. The i-th dice shows numbers from 1 to d_{i}. Polycarp rolled all the dice and the sum of numbers they showed is A. Agrippina didn't see which dice showed what number, she knows on...
[{"type": "stdin_stdout", "input": "10 20\n1 1 1 1 5 100 1 1 1 1\n", "output": "0 0 0 0 0 95 0 0 0 0 "}, {"type": "stdin_stdout", "input": "10 20\n1 1 1 1 5 100 1 1 1 1\n", "output": "0 0 0 0 0 95 0 0 0 0\n"}, {"type": "stdin_stdout", "input": "10 20\n1 1 1 1 10 100 1 1 1 1\n", "output": "0 0 0 0 0 90 0 0 0 0"}, {"type...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAyrat has number n, represented as it's prime factorization p_{i} of size m, i.e. n = p_1·p_2·...·p_{m}. Ayrat got secret information that that the product of all divisors of n taken modulo 10^9 + 7 is the password to the...
[{"type": "stdin_stdout", "input": "67\n98929 19079 160079 181891 17599 91807 19079 98929 182233 92647 77477 98929 98639 182233 181891 182233 160079 98929 19079 98639 114941 98929 161341 91807 160079 22777 132361 92647 98929 77477 182233 103913 160079 77477 55711 77477 77477 182233 114941 91807 98929 19079 104393 18223...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day, liouzhou_101 got a chat record of Freda and Rainbow. Out of curiosity, he wanted to know which sentences were said by Freda, and which were said by Rainbow. According to his experience, he thought that Freda alwa...
[{"type": "stdin_stdout", "input": "10\nmiao.vyscfysAtWcPkpFHdwZqAQ,UPPcjhKQTlala.\nmiao.KESqus DybUuYFoWVpo..LWZh.UqEdUsTHFlKfzqkThAUPklala.\nUNoE vfZIAdxkiWKhsHPfsqRPTNQoHgAxooVLYxRzugHjo jaEHWQFF\nCCmdIwr.UkoiYWK.Z,,ZesMpISTXNgnpYnJaWquCyL,gO\n.JvOayhXK_bgoYbfAtnXg\nbvdSzRrXoGxVgWvdXnsjEnEfxDzIQo_aZVGDGrzwuAMtzVAHio...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers A and B.\nFind the largest value among A+B, A-B and A \\times B.\n\n-----Constraints-----\n - -1000 \\leq A,B \\leq 1000\n - All values in input are integers.\n\n-----Input-----\nInput is given ...
[{"type": "stdin_stdout", "input": "-17 -10", "output": "170\n"}, {"type": "stdin_stdout", "input": "-10 -10", "output": "100\n"}, {"type": "stdin_stdout", "input": "-156 -1", "output": "156\n"}, {"type": "stdin_stdout", "input": "-156 -2", "output": "312\n"}, {"type": "stdin_stdout", "input": "-156 -3", "output": "468...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOn a number line there are n balls. At time moment 0 for each ball the following data is known: its coordinate xi, speed vi (possibly, negative) and weight mi. The radius of the balls can be ignored.\n\nThe balls collide ...
[{"type": "stdin_stdout", "input": "10 88\n-100 -86 12\n-88 -62 9\n-96 -73 1\n-89 -100 34\n-80 -57 18\n-81 -91 2\n-84 -100 7\n-77 -84 3\n-97 -96 10\n-52 -60 3\n", "output": "-9488.033285728\n-7931.120096426\n-8406.936891019\n-8261.349896254\n-5320.095238095\n-5795.666666667\n-6961.166666667\n-5303.428571429\n-8788.1186...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nInnokentiy likes tea very much and today he wants to drink exactly n cups of tea. He would be happy to drink more but he had exactly n tea bags, a of them are green and b are black.\n\nInnokentiy doesn't like to drink the...
[{"type": "stdin_stdout", "input": "70000 2748 31589 38411\n", "output": "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array of integers. Vasya can permute (change order) its integers. He wants to do it so that as many as possible integers will become on a place where a smaller integer used to stand. Help Vasya find the m...
[{"type": "stdin_stdout", "input": "6\n300000000 200000000 300000000 200000000 1000000000 300000000\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "6\n300000000 200000000 173776099 200000000 1000000000 300000000\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "6\n300000000 200000000 173776099 200000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCreate a program that reads the sales unit price and sales quantity and outputs the total sales amount and the average sales quantity.\n\n\n\nInput\n\nThe input is given in the following format:\n\n\nSales unit price, sal...
[{"type": "stdin_stdout", "input": "02,001\n50,10\n8,531", "output": "4750\n181\n"}, {"type": "stdin_stdout", "input": "0,1000\n01,05\n134,8", "output": "1077\n338\n"}, {"type": "stdin_stdout", "input": "0,1000\n01,05\n134,9", "output": "1211\n338\n"}, {"type": "stdin_stdout", "input": "0,1000\n11,05\n134,9", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven a positive integer `n`, return first n dgits of Thue-Morse sequence, as a string (see examples).\n\nThue-Morse sequence is a binary sequence with 0 as the first element. The rest of the sequece is obtained by adding...
[{"input": "100", "output": "[\"0110100110010110100101100110100110010110011010010110100110010110100101100110100101101001100101100110\"]", "fn_name": "thue_morse"}, {"input": "10", "output": "[\"0110100110\"]", "fn_name": "thue_morse"}, {"input": "5", "output": "[\"01101\"]", "fn_name": "thue_morse"}, {"input": "2", "ou...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven an array A of N numbers, find the number of distinct pairs (i, j) such that j ≥i and A[i] = A[j].\n\nFirst line of the input contains number of test cases T. Each test case has two lines, first line is the number N,...
[{"type": "stdin_stdout", "input": "10\n807\n935399 145100 -386862 856283 628359 256963 -461034 935399 776945 -759500 -759500 935399 -967263 649644 -24686 -452785 -352467 688773 908612 -386862 -479957 -146506 439811 -506538 -146506 145100 -461034 935399 -352307 -181185 740341 740341 439811 742466 -854789 700140 -740255...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is a tree T with N vertices. The i-th edge connects Vertex A_i and B_i (1 \\leq A_i,B_i \\leq N).\nNow, each vertex is painted black with probability 1/2 and white with probability 1/2, which is chosen independently...
[{"type": "stdin_stdout", "input": "7\n4 7\n3 1\n2 6\n5 2\n7 1\n2 7\n", "output": "570312505\n"}, {"type": "stdin_stdout", "input": "7\n4 7\n3 1\n2 6\n5 4\n7 1\n2 7", "output": "835937507\n"}, {"type": "stdin_stdout", "input": "7\n4 7\n3 1\n3 6\n5 4\n7 1\n2 7", "output": "679687506\n"}, {"type": "stdin_stdout", "input"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLast summer Peter was at his granny's in the country, when a wolf attacked sheep in the nearby forest. Now he fears to walk through the forest, to walk round the forest, even to get out of the house. He explains this not ...
[{"type": "stdin_stdout", "input": "1000000\n", "output": "958220352\n"}, {"type": "stdin_stdout", "input": "972408\n", "output": "377259665\n"}, {"type": "stdin_stdout", "input": "956022\n", "output": "864671299\n"}, {"type": "stdin_stdout", "input": "941322\n", "output": "359985814\n"}, {"type": "stdin_stdout", "inpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlex is transitioning from website design to coding and wants to sharpen his skills with CodeWars. \nHe can do ten kata in an hour, but when he makes a mistake, he must do pushups. These pushups really tire poor Alex out...
[{"input": "10\n120", "output": "[3]", "fn_name": "alex_mistakes"}, {"input": "11\n120", "output": "[3]", "fn_name": "alex_mistakes"}, {"input": "20\n120", "output": "[0]", "fn_name": "alex_mistakes"}, {"input": "20\n125", "output": "[1]", "fn_name": "alex_mistakes"}, {"input": "20\n130", "output": "[1]", "fn_name": "a...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this problem you are to calculate the sum of all integers from 1 to n, but you should take all powers of two with minus in the sum.\n\nFor example, for n = 4 the sum is equal to - 1 - 2 + 3 - 4 = - 4, because 1, 2 an...
[{"type": "stdin_stdout", "input": "60\n536870912\n536870911\n536870913\n1000000000\n999999999\n1\n2\n3\n4\n268435456\n268435455\n268435457\n536870912\n536870911\n536870913\n1000000000\n999999999\n1\n2\n3\n4\n268435456\n268435455\n268435457\n536870912\n536870911\n536870913\n1000000000\n999999999\n1\n2\n3\n4\n268435456\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Introduction and Warm-up (Highly recommended)\n\n# [Playing With Lists/Arrays Series](https://www.codewars.com/collections/playing-with-lists-slash-arrays)\n___\n\n# Task\n\n**_Given_** an *array/list [] of integers* , ...
[{"input": "[-54, 37, 0, 64, -15, 640, 0]", "output": "[576]", "fn_name": "max_gap"}, {"input": "[24, 299, 131, 14, 26, 25]", "output": "[168]", "fn_name": "max_gap"}, {"input": "[-7, -42, -809, -14, -12]", "output": "[767]", "fn_name": "max_gap"}, {"input": "[12, -5, -7, 0, 290]", "output": "[278]", "fn_name": "max_ga...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nLeo has developed a new programming language C+=. In C+=, integer variables can only be changed with a \"+=\" operation that adds the right-hand side value to the left-hand side variable. For example, performing \"a += b\...
[{"type": "stdin_stdout", "input": "16\n1 1 1\n3 4 6\n4 5 16\n456 123 7890123\n1 1 1000000000\n45 12 782595420\n1 1000000000 1001000000\n1 999999999 1000000100\n1 99999 676497416\n5 6 1409378894\n8 9 1376775908\n500000000 500000000 1000000000\n1000000000 1000000000 1000000000\n999999999 1000000000 1000000000\n1066 1487...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is an infinite set generated as follows:\n\n$1$ is in this set.\n\nIf $x$ is in this set, $x \\cdot a$ and $x+b$ both are in this set.\n\nFor example, when $a=3$ and $b=6$, the five smallest elements of the set are:...
[{"type": "stdin_stdout", "input": "5\n24 3 5\n10 5 11\n2097 1 4\n19260817 394 623\n19260817 233 264\n", "output": "YES\nNO\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "5\n24 3 5\n10 5 11\n2097 1 4\n19260817 394 227\n19260817 233 264\n", "output": "YES\nNO\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a sorted array $a_1, a_2, \\dots, a_n$ (for each index $i > 1$ condition $a_i \\ge a_{i-1}$ holds) and an integer $k$.\n\nYou are asked to divide this array into $k$ non-empty consecutive subarrays. Every el...
[{"type": "stdin_stdout", "input": "7 6\n-3 0 -1 -2 -2 -4 -1\n", "output": "-2\n"}, {"type": "stdin_stdout", "input": "8 1\n1 1 2 3 5 8 13 21\n", "output": "20\n"}, {"type": "stdin_stdout", "input": "5 3\n99 101 103 105 107\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "5 3\n99 101 103 105 107\n", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlice is playing a game with her good friend, Marisa.\n\nThere are n boxes arranged in a line, numbered with integers from 1 to n from left to right. Marisa will hide a doll in one of the boxes. Then Alice will have m cha...
[{"type": "stdin_stdout", "input": "8000 100\n7990 4432 5901 5019 423 1200 7760 5752 7422 4337 4802 2570 7354 4912 2185 2344 6538 2783 1473 5311 3987 4739 7159 1677 3438 502 2800 1318 5223 4518 4448 6451 3455 5012 1588 814 4971 5847 3849 6248 6420 3607 2610 6852 1045 3730 757 6905 5248 3738 2382 7251 1305 7380 2476 734...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn Ancient Berland there were n cities and m two-way roads of equal length. The cities are numbered with integers from 1 to n inclusively. According to an ancient superstition, if a traveller visits three cities ai, bi, c...
[{"type": "stdin_stdout", "input": "4 4 4\n1 2\n2 3\n3 4\n1 3\n1 2 3\n1 3 4\n1 2 4\n1 3 2\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "4 4 2\n1 2\n2 3\n3 4\n1 3\n1 2 3\n1 3 4\n", "output": "4\n1 3 2 3 4\n"}, {"type": "stdin_stdout", "input": "4 4 1\n1 2\n2 3\n3 4\n1 3\n1 3 4\n", "output": "3\n1 2 3 4\n"}, ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have initially a string of N characters, denoted by A1,A2...AN. You have to print the size of the largest subsequence of string A such that all the characters in that subsequence are distinct ie. no two characters in ...
[{"type": "stdin_stdout", "input": "2\nabc\naba\n", "output": "3\n2\n"}, {"type": "stdin_stdout", "input": "2\nabd\naba", "output": "3\n2\n"}, {"type": "stdin_stdout", "input": "2\nabc\naaa", "output": "3\n1\n"}, {"type": "stdin_stdout", "input": "2\ncca\naaa", "output": "2\n1\n"}, {"type": "stdin_stdout", "input": "2\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this kata, you've to count lowercase letters in a given string and return the letter count in a hash with 'letter' as key and count as 'value'. The key must be 'symbol' instead of string in Ruby and 'char' instead of s...
[{"input": "\"arithmetics\"", "output": "[{\"a\": 1, \"c\": 1, \"e\": 1, \"h\": 1, \"i\": 2, \"m\": 1, \"r\": 1, \"s\": 1, \"t\": 2}]", "fn_name": "letter_count"}, {"input": "\"codewars\"", "output": "[{\"a\": 1, \"c\": 1, \"d\": 1, \"e\": 1, \"o\": 1, \"r\": 1, \"s\": 1, \"w\": 1}]", "fn_name": "letter_count"}, {"inpu...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou talked to Polycarp and asked him a question. You know that when he wants to answer \"yes\", he repeats Yes many times in a row.\n\nBecause of the noise, you only heard part of the answer — some substring of it. That i...
[{"type": "stdin_stdout", "input": "12\nYES\nesYes\ncodeforces\nes\nse\nYesY\nesYesYesYesYesYesYe\nseY\nYess\nsY\no\nYes\n", "output": "NO\nYES\nNO\nYES\nNO\nYES\nYES\nNO\nNO\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "1\nsYesYesYesYesYesYesYesYesYesYesYesYesYesYesYesYesY\n", "output": "YES\n"}, {"type": "std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Introduction\n\nThere is a war and nobody knows - the alphabet war! \nThere are two groups of hostile letters. The tension between left side letters and right side letters was too high and the war began.\n\n# Task\n\nW...
[{"input": "\"zdqmwpbs\"", "output": "[\"Let's fight again!\"]", "fn_name": "alphabet_war"}, {"input": "\"zzzzs\"", "output": "[\"Right side wins!\"]", "fn_name": "alphabet_war"}, {"input": "\"wwwwww\"", "output": "[\"Left side wins!\"]", "fn_name": "alphabet_war"}, {"input": "\"z\"", "output": "[\"Right side wins!\"]"...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nMr. Matsudaira is always careful about eco-friendliness in his life. Last month's water charge was 4280 yen, which exceeded the usual target of 4000 yen, so we have been trying to save water this month. How much have you ...
[{"type": "stdin_stdout", "input": "29\n104\n0\n-1", "output": "620\n-11360\n3130\n"}, {"type": "stdin_stdout", "input": "29\n112\n0\n-1", "output": "620\n-12640\n3130\n"}, {"type": "stdin_stdout", "input": "29\n130\n1\n-1", "output": "620\n-15520\n3130\n"}, {"type": "stdin_stdout", "input": "29\n97\n0\n-1", "output": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given n k-digit integers. You have to rearrange the digits in the integers so that the difference between the largest and the smallest number was minimum. Digits should be rearranged by the same rule in all intege...
[{"type": "stdin_stdout", "input": "8 8\n83239439\n62184887\n58968944\n39808261\n68740623\n38480328\n81965504\n52600488\n", "output": "44481119\n"}, {"type": "stdin_stdout", "input": "8 8\n96805230\n73119021\n06552907\n86283347\n88650846\n19155689\n37032451\n19310120\n", "output": "53604668\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's consider all integers in the range from $1$ to $n$ (inclusive).\n\nAmong all pairs of distinct integers in this range, find the maximum possible greatest common divisor of integers in pair. Formally, find the maximu...
[{"type": "stdin_stdout", "input": "100\n2\n3\n4\n6\n6\n9\n8\n9\n10\n11\n12\n23\n14\n15\n5\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n11\n20\n35\n36\n37\n38\n65\n40\n41\n42\n43\n44\n70\n46\n47\n48\n49\n50\n51\n52\n53\n54\n55\n56\n57\n58\n59\n60\n61\n62\n63\n64\n65\n66\n67\n68\n69\n70\n71\n72\n73\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAnshal and his friends love watching TV series together,but Anshal has a habit of giving spoilers.In order to tackle this his friends anagrammed the list of the shows they were planning to watch.Somehow Anshal got hold of...
[{"type": "stdin_stdout", "input": "MDSZWKDLGUIISYZKOGMGXOZKMTWHNCMZHGADQFOYZZITXHDNNRTNGSZULYBACPBJVBMNGDLICTBBDHQSAJFGDHCQFETHVUSRYEEGHSOLNSMQBCJBNQKSXMJCSCLOYDHWKNDTFTFTNTLQYUSLNCEKQPNJTAZREGOOTTJBOOUEKHUICMVPQBBJQQUJRTDXBTNWOWXCLTIXBDFFRAWKCZTUQNGHIJGLETHSPHWCCFZFIEMZHKJLKEFARNJBYPMCIWWZDTCHYDNIIBJRMVCWZJYTZHUXYJCG...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFinding your seat on a plane is never fun, particularly for a long haul flight... You arrive, realise again just how little leg room you get, and sort of climb into the seat covered in a pile of your own stuff.\n\nTo help...
[{"input": "\"60D\"", "output": "[\"Back-Middle\"]", "fn_name": "plane_seat"}, {"input": "\"17K\"", "output": "[\"Front-Right\"]", "fn_name": "plane_seat"}, {"input": "\"20B\"", "output": "[\"Front-Left\"]", "fn_name": "plane_seat"}, {"input": "\"2B\"", "output": "[\"Front-Left\"]", "fn_name": "plane_seat"}, {"input": ...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nBamboo Blossoms\n\nThe bamboos live for decades, and at the end of their lives, they flower to make their seeds. Dr. ACM, a biologist, was fascinated by the bamboos in blossom in his travel to Tsukuba. He liked the flower...
[{"type": "stdin_stdout", "input": "3 2\n2 6\n10 10\n110 181\n2 371896\n0 0", "output": "5\n17\n21\n379\n5361757\n"}, {"type": "stdin_stdout", "input": "12 1\n3 1\n10 20\n100 50\n3 202868\n0 0", "output": "13\n4\n47\n150\n2792771\n"}, {"type": "stdin_stdout", "input": "2 4\n3 1\n13 35\n100 47\n4 346519\n0 0", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlas, finding one's true love is not easy. Masha has been unsuccessful in that yet. Her friend Dasha told Masha about a way to determine the phone number of one's Prince Charming through arithmancy. \n\nThe phone number i...
[{"type": "stdin_stdout", "input": "17601120900014764776764048700928872725171605903217\n", "output": "10428170619\n"}, {"type": "stdin_stdout", "input": "78767765544454334445445555455676565433343455432332\n", "output": "11031574582\n"}, {"type": "stdin_stdout", "input": "676765666545656543321110112122111112234332221100...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nI am a craftsman specialized in interior works. A customer asked me to perform wiring work on a wall whose entire rectangular surface is tightly pasted with pieces of panels. The panels are all of the same size (2 m in wi...
[{"type": "stdin_stdout", "input": "1 -11", "output": "-10\n"}, {"type": "stdin_stdout", "input": "171 2", "output": "173\n"}, {"type": "stdin_stdout", "input": "120 3", "output": "121\n"}, {"type": "stdin_stdout", "input": "109 1", "output": "110\n"}, {"type": "stdin_stdout", "input": "119 1", "output": "120\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA rabbit who came to the fair found that the prize for a game at a store was a carrot cake. The rules for this game are as follows.\n\nThere is a grid-like field of vertical h squares x horizontal w squares, and each bloc...
[{"type": "stdin_stdout", "input": "4 6 1\n......\n...Y..\n/..Z..\nYRRRYY", "output": "YES\n"}, {"type": "stdin_stdout", "input": "4 6 1\n......\n...Y..\n..Z../\nYRRRYY", "output": "YES\n"}, {"type": "stdin_stdout", "input": "4 6 1\n......\n...Y./\n/..Z..\nYRRRYY", "output": "YES\n"}, {"type": "stdin_stdout", "input": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven an array, return the difference between the count of even numbers and the count of odd numbers. `0` will be considered an even number. \n\n```\nFor example:\nsolve([0,1,2,3]) = 0 because there are two even numbers a...
[{"input": "[5, 15, 16, 10, 6, 4, 16, \"t\", 13, \"n\", 14, \"k\", \"n\", 0, \"q\", \"d\", 7, 9]", "output": "[2]", "fn_name": "solve"}, {"input": "[0, 15, \"z\", 16, \"m\", 13, 14, \"c\", 9, 10, 13, \"u\", 4, 3]", "output": "[0]", "fn_name": "solve"}, {"input": "[1, \"a\", 17, 8, \"e\", 3, \"i\", 12, 1]", "output": "[...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\n_This kata is based on [Project Euler Problem 546](https://projecteuler.net/problem=546)_\n\n# Objective\n\nGiven the recursive sequence \n\nfk(n) =\n\n\n∑\n\ni\n=\n0\n\n\nn\n\n\n\nfk(floor(i / k)) where fk(0) = 1\n\nDefi...
[{"input": "3\n50000", "output": "[80887845303700596855]", "fn_name": "f"}, {"input": "100\n500000", "output": "[21469002551]", "fn_name": "f"}, {"input": "2\n1000", "output": "[264830889564]", "fn_name": "f"}, {"input": "97\n100000", "output": "[209497156]", "fn_name": "f"}, {"input": "2\n200", "output": "[7389572]", ...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor a string S consisting of the uppercase English letters `P` and `D`, let the doctoral and postdoctoral quotient of S be the total number of occurrences of `D` and `PD` in S as contiguous substrings. For example, if S =...
[{"type": "stdin_stdout", "input": "PDPD???", "output": "PDPDDDD\n"}, {"type": "stdin_stdout", "input": "DDPP???", "output": "DDPPDDD\n"}, {"type": "stdin_stdout", "input": "DDPO???", "output": "DDPODDD\n"}, {"type": "stdin_stdout", "input": "DDPO?>?", "output": "DDPOD>D\n"}, {"type": "stdin_stdout", "input": "?>?OPDD"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSummer is coming! It's time for Iahub and Iahubina to work out, as they both want to look hot at the beach. The gym where they go is a matrix a with n lines and m columns. Let number a[i][j] represents the calories burned...
[{"type": "stdin_stdout", "input": "4 5\n87882 40786 3691 85313 46694\n28884 16067 3242 97367 78518\n4250 35501 9780 14435 19004\n64673 65438 56977 64495 27280\n", "output": "747898\n"}, {"type": "stdin_stdout", "input": "4 5\n2274 40786 3691 98933 46694\n28884 16067 3242 97367 73338\n8377 57682 9780 14435 19004\n64673...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a simple regex to validate a username. Allowed characters are:\n\n- lowercase letters,\n- numbers,\n- underscore\n\nLength should be between 4 and 16 characters (both included).\n\nWrite your solution by modifying t...
[{"input": "\"Hasd_12assssssasasasasasaasasasasas\"", "output": "[false]", "fn_name": "validate_usr"}, {"input": "\"asd43 34\"", "output": "[false]", "fn_name": "validate_usr"}, {"input": "\"asd43_34\"", "output": "[true]", "fn_name": "validate_usr"}, {"input": "\"asddsa\"", "output": "[true]", "fn_name": "validate_usr...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nOranges on Cans\n\nsquare1001 You put a $ N $ can of aluminum on the table.\n\nE869120 You put $ M $ of oranges on each aluminum can on the table.\n\nHow many oranges are on the aluminum can?\n\ninput\n\nInput is given fr...
[{"type": "stdin_stdout", "input": "-17 16", "output": "-272\n"}, {"type": "stdin_stdout", "input": "-17 30", "output": "-510\n"}, {"type": "stdin_stdout", "input": "-17 44", "output": "-748\n"}, {"type": "stdin_stdout", "input": "-2 125", "output": "-250\n"}, {"type": "stdin_stdout", "input": "-1 111", "output": "-111...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGoal\nGiven a list of elements [a1, a2, ..., an], with each ai being a string, write a function **majority** that returns the value that appears the most in the list. \n\nIf there's no winner, the function should return N...
[{"input": "[\"A\", \"A\", \"A\", \"BBBBBBBB\"]", "output": "[\"A\"]", "fn_name": "majority"}, {"input": "[\"A\", \"B\", \"B\", \"A\"]", "output": "[null]", "fn_name": "majority"}, {"input": "[\"A\", \"A\", \"A\", \"A\"]", "output": "[\"A\"]", "fn_name": "majority"}, {"input": "[\"A\", \"B\", \"C\", \"C\"]", "output": ...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nHappy new year! The year 2020 is also known as Year Gyeongja (경자년, gyeongja-nyeon) in Korea. Where did the name come from? Let's briefly look at the Gapja system, which is traditionally used in Korea to name the years.\n\...
[{"type": "stdin_stdout", "input": "10 12\nsin im gye gap eul bynoeg jeong mu gj gyeong\nyu sul hae jb chuk in myo jin as o li sin\n14\n1\n1\n3\n4\n17\n17\n12\n13\n73\n2016\n32\n2018\n2019\n2020\n", "output": "sinyu\nsinyu\ngyehae\ngapjb\njeongchuk\njeongchuk\nimsin\ngyeyu\ngyeyu\nbynoegsin\nimjin\nmusul\ngjhae\ngyeong...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently personal training sessions have finished in the Berland State University Olympiad Programmer Training Centre. By the results of these training sessions teams are composed for the oncoming team contest season. Eac...
[{"type": "stdin_stdout", "input": "7\n4 19 14 8 21 16 2 18 1 15 3 17 13 5 6 10 9 7 12 11 20\n4 19 10\n14 8 3\n21 17 9\n16 6 12\n2 13 20\n18 1 7\n15 5 11\n21\n", "output": "3 4 8 9 10 14 17 1 2 5 6 7 11 12 13 15 16 18 19 20\n"}, {"type": "stdin_stdout", "input": "6\n6 4 10 16 14 11 13 1 7 17 18 15 5 3 9 12 2 8\n6 10 1\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAccording to ISO 8601, the first calendar week (1) starts with the week containing the first thursday in january.\nEvery year contains of 52 (53 for leap years) calendar weeks.\n\n**Your task is** to calculate the calenda...
[{"input": "\"2017-01-01\"", "output": "[52]", "fn_name": "get_calendar_week"}, {"input": "\"2018-12-24\"", "output": "[52]", "fn_name": "get_calendar_week"}, {"input": "\"2015-12-29\"", "output": "[53]", "fn_name": "get_calendar_week"}, {"input": "\"1995-12-31\"", "output": "[52]", "fn_name": "get_calendar_week"}, {"i...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a_1, a_2, \\dots, a_n$ where all $a_i$ are integers and greater than $0$.\n\n In one operation, you can choose two different indices $i$ and $j$ ($1 \\le i, j \\le n$). If $gcd(a_i, a_j)$ is equal ...
[{"type": "stdin_stdout", "input": "4\n1\n8\n6\n4 4 6 6 2 9\n4\n4 5 6 10\n5\n10 10 2 2 4\n", "output": "YES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "4\n1\n8\n6\n4 4 6 6 2 9\n4\n4 5 6 7\n5\n10 10 2 2 4\n", "output": "YES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "4\n1\n8\n6\n4 4 6 6 2 15\n4\n4 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe circle line of the Berland subway has n stations. We know the distances between all pairs of neighboring stations:\n\n\n\n d_1 is the distance between the 1-st and the 2-nd station;\n\n d_2 is the distance between the...
[{"type": "stdin_stdout", "input": "100\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 100 100...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are playing a popular video game which is famous for its depthful story and interesting puzzles. In the game you were locked in a mysterious house alone and there is no way to call for help, so you have to escape on y...
[{"type": "stdin_stdout", "input": "...\n...\n.*.\n...\n...\n.*.\n...\n...\n...\n...\n...\n.*.\n...\n...\n.*.\n...\n...\n...\n\n...\n.*.\n...\n*..\n...\n..*\n*.*\n*/*\n*.*\n*.*\n.*.\n*.*\n*..\n.*.\n..*\n*.*\n...\n*.*\n\n...\n.*.\n.*.\n...\n.**\n*..\n...\n...\n.*.\n.*.\n...\n*..\n..*\n...\n.**\n...\n*..\n...\n\n#", "out...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSo, the Berland is at war with its eternal enemy Flatland again, and Vasya, an accountant, was assigned to fulfil his duty to the nation. \n\nRight now the situation in Berland is dismal — their both cities are surrounded...
[{"type": "stdin_stdout", "input": "1003 -5005 3399\n-10705 -1729 4365\n", "output": "2196.845285084989\n"}, {"type": "stdin_stdout", "input": "-9577 9051 5276\n-4315 -1295 3517\n", "output": "1407.1273140166404\n"}, {"type": "stdin_stdout", "input": "-9445 -9860 5513\n6291 -855 9034\n", "output": "1791.7043689042112\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence of $n$ integers $a_1, \\, a_2, \\, \\dots, \\, a_n$.\n\nDoes there exist a sequence of $n$ integers $b_1, \\, b_2, \\, \\dots, \\, b_n$ such that the following property holds?\n\nFor each $1 \\le ...
[{"type": "stdin_stdout", "input": "20\n5\n6711 19885 -3098 -16272 -10076\n4\n86522 29647 -12464 -9627\n4\n-82555 -5215 -15221 -63129\n4\n-18147 4 5 -5\n5\n-17427 -19079 17427 15043 19079\n5\n15148 5942 361 9206 21087\n3\n-1 -55 1\n5\n47214 53109 39369 11561 -22908\n4\n-74790 54187 -2 30242\n2\n-68120 94070\n3\n-27228 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this problem you have to simulate the workflow of one-thread server. There are n queries to process, the i-th will be received at moment t_{i} and needs to be processed for d_{i} units of time. All t_{i} are guaranteed...
[{"type": "stdin_stdout", "input": "4 3\n999999996 1000000000\n999999997 1000000000\n999999998 1000000000\n999999999 1000000000\n", "output": "1999999996 2999999996 3999999996 4999999996 \n"}, {"type": "stdin_stdout", "input": "4 3\n999999996 1000000000\n999999997 1000000000\n999999998 1000000000\n999999999 1000000000\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou play a strategic video game (yeah, we ran out of good problem legends). In this game you control a large army, and your goal is to conquer $n$ castles of your opponent.\n\nLet's describe the game process in detail. In...
[{"type": "stdin_stdout", "input": "10 10 2\n2 1 1615\n2 1 1326\n0 0 3880\n2 0 1596\n1 2 4118\n0 0 4795\n0 1 814\n0 0 4555\n0 1 3284\n2 2 1910\n10 6\n2 1\n8 3\n8 7\n6 3\n4 1\n7 4\n6 4\n7 2\n10 9\n", "output": "27079\n"}, {"type": "stdin_stdout", "input": "10 10 0\n0 2 1413\n0 0 4466\n0 0 2681\n0 0 2959\n0 2 1182\n0 0 4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\nHow many kinds of items did you get?\n\n-----Constraints-----\n - 1 \\leq N \\leq 2\\times 10^5\n - S_i consists of low...
[{"type": "stdin_stdout", "input": "5\ngrape\ngrape\ngrape\ngrape\ngrape\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "5\ngrape\ngrape\ngraoe\ngrape\ngrape", "output": "2\n"}, {"type": "stdin_stdout", "input": "5\negapr\ngrape\ngraoe\ngr`pe\nepaqg", "output": "5\n"}, {"type": "stdin_stdout", "input": "5\ngra...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nToday, Wet Shark is given n integers. Using any of these integers no more than once, Wet Shark wants to get maximum possible even (divisible by 2) sum. Please, calculate this value for Wet Shark. \n\nNote, that if Wet Sha...
[{"type": "stdin_stdout", "input": "5\n999999999 503514429 850382710 999999999 1620498919\n", "output": "4974396056\n"}, {"type": "stdin_stdout", "input": "5\n999999999 503514429 850382710 999999999 1246839866\n", "output": "4097222574\n"}, {"type": "stdin_stdout", "input": "5\n999999999 999999999 850382710 999999999 9...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently, Petya learned about a new game \"Slay the Dragon\". As the name suggests, the player will have to fight with dragons. To defeat a dragon, you have to kill it and defend your castle. To do this, the player has a ...
[{"type": "stdin_stdout", "input": "4\n3 0 2 3\n5\n6 12\n2 22\n2 14\n1 7\n14 17\n", "output": "10\n16\n8\n1\n23\n"}, {"type": "stdin_stdout", "input": "4\n3 5 2 3\n5\n6 12\n2 22\n2 14\n1 7\n14 17\n", "output": "5\n11\n3\n0\n18\n"}, {"type": "stdin_stdout", "input": "4\n3 5 2 3\n5\n6 4\n2 22\n2 14\n2 14\n14 17\n", "outp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have a given picture with size $w \\times h$. Determine if the given picture has a single \"+\" shape or not. A \"+\" shape is described below:\n\n A \"+\" shape has one center nonempty cell. There should be some (a...
[{"type": "stdin_stdout", "input": "10 10\n..........\n..........\n....*.....\n....*.....\n.*******..\n....*.....\n....*.....\n..........\n....*.....\n..........\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "10 10\n..........\n..........\n....*.....\n....*.....\n.*******..\n....*.....\n....*.....\n............
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters.\n\nOur objective is to make all these three strings equal. For that, you can repeatedly perform the fo...
[{"type": "stdin_stdout", "input": "9\ncjfferent\ndifferent\ntnereffid", "output": "10\n"}, {"type": "stdin_stdout", "input": "9\ntneredfic\nciffeernt\ndifferent", "output": "11\n"}, {"type": "stdin_stdout", "input": "9\ntnedergia\ncifreefnt\ndifsnfeet", "output": "14\n"}, {"type": "stdin_stdout", "input": "9\ntnedergi...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven a string, determine if it's a valid identifier.\n\n## Here is the syntax for valid identifiers:\n* Each identifier must have at least one character.\n* The first character must be picked from: alpha, underscore, or ...
[{"input": "\"1ok0okay\"", "output": "[false]", "fn_name": "is_valid"}, {"input": "\"okay_ok1\"", "output": "[true]", "fn_name": "is_valid"}, {"input": "\"myIdentf\"", "output": "[true]", "fn_name": "is_valid"}, {"input": "\"str-str\"", "output": "[false]", "fn_name": "is_valid"}, {"input": "\"str_STR\"", "output": "[t...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite\n```python\nfunction repeating_fractions(numerator, denominator)\n```\nthat given two numbers representing the numerator and denominator of a fraction, return the fraction in string format. If the fractional part ha...
[{"input": "18018018\n80000000000", "output": "[\"0.(0)(2)5(2)5(2)5\"]", "fn_name": "repeating_fractions"}, {"input": "1554\n70", "output": "[\"22.2\"]", "fn_name": "repeating_fractions"}, {"input": "1\n3", "output": "[\"0.(3)\"]", "fn_name": "repeating_fractions"}, {"input": "0\n1", "output": "[\"0.0\"]", "fn_name": "...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nA traveler is planning a water hike along the river. He noted the suitable rest points for the night and wrote out their distances from the starting point. Each of these locations is further characterized by its picturesq...
[{"type": "stdin_stdout", "input": "19 2\n1 73\n2 96\n3 24\n5 96\n11 13\n14 96\n16 31\n17 60\n34 69\n39 41\n60 40\n61 96\n66 7\n67 56\n70 28\n73 12\n74 81\n78 77\n95 99\n", "output": "2 3 4 6 7 8 11 12 14 15 17 18 19\n"}, {"type": "stdin_stdout", "input": "20 8\n2 37\n9 28\n13 63\n14 85\n27 27\n29 90\n34 96\n36 60\n41 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIt is a simplified version of problem F2. 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 number...
[{"type": "stdin_stdout", "input": "4\n1 1\n221 2\n177890 2\n998244353 1\n", "output": "1\n221\n181111\n999999999\n"}, {"type": "stdin_stdout", "input": "4\n1 1\n221 2\n177890 1\n998244353 1\n", "output": "1\n221\n222222\n999999999\n"}, {"type": "stdin_stdout", "input": "4\n1 1\n221 2\n108810 1\n998244353 1\n", "output...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an undirected graph with N vertices and 0 edges. Process Q queries of the following types.\n\n* `0 u v`: Add an edge (u, v).\n* `1 u v`: Print 1 if u and v are in the same connected component, 0 otherwise.\n...
[{"type": "stdin_stdout", "input": "4 7\n0 0 1\n-1 1 1\n-1 2 3\n1 0 1\n1 2 2\n-1 0 3\n-1 1 1", "output": "1\n0\n1\n1\n0\n1\n"}, {"type": "stdin_stdout", "input": "4 7\n0 0 1\n-1 2 1\n-1 2 3\n1 0 1\n1 2 2\n-1 0 3\n-1 1 1", "output": "0\n0\n1\n1\n0\n1\n"}, {"type": "stdin_stdout", "input": "9 7\n1 1 1\n-1 0 1\n-1 2 3\n1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYour task is to write function which takes string and list of delimiters as an input and returns list of strings/characters after splitting given string.\n\nExample:\n```python\nmultiple_split('Hi, how are you?', [' ']) =...
[{"input": "\"Solve_this|kata-very\\\\quickly!\"\n[\"!\", \"|\", \"\\\\\", \"_\", \"-\"]", "output": "[[\"Solve\", \"this\", \"kata\", \"very\", \"quickly\"]]", "fn_name": "multiple_split"}, {"input": "\"((1+2))*(6-3)^9\"\n[\"+\", \"-\", \"(\", \")\", \"^\", \"*\"]", "output": "[[\"1\", \"2\", \"6\", \"3\", \"9\"]]", "...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n3 2\nR1\n\n\nOutput\n\n3 1 2\n4 5 6\n7 8 9\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 pro...
[{"type": "stdin_stdout", "input": "73 2\nR2", "output": "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73\n146 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N islands and M bridges.\nThe i-th bridge connects the A_i-th and B_i-th islands bidirectionally.\nInitially, we can travel between any two islands using some of these bridges.\nHowever, the results of a survey ...
[{"type": "stdin_stdout", "input": "29 45\n1 3\n2 3\n2 14\n2 19\n2 29\n3 26\n4 5\n4 6\n4 13\n4 17\n5 10\n5 19\n5 24\n6 18\n6 19\n6 24\n6 25\n6 28\n6 29\n8 9\n9 18\n9 25\n10 29\n11 16\n11 22\n12 14\n12 15\n12 26\n12 29\n13 14\n14 20\n14 27\n14 29\n15 16\n15 22\n15 25\n15 29\n16 29\n17 27\n19 26\n20 29\n24 26\n15 23\n1 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBarbara was late for her math class so as a punishment the teacher made her solve the task on a sheet of paper. Barbara looked at the sheet of paper and only saw n numbers a_1, a_2, …, a_n without any mathematical symbols...
[{"type": "stdin_stdout", "input": "100\n1 2 2 2 1 1 2 2 0 2 2 0 1 0 0 0 0 1 0 0 0 1 1 2 1 1 2 2 0 2 0 2 1 1 0 2 1 0 1 2 1 2 2 1 1 1 2 1 1 1 0 1 1 0 0 2 2 1 2 2 1 0 1 0 0 2 1 2 1 1 0 2 1 0 2 0 2 1 2 0 0 0 1 1 2 0 1 0 2 2 2 1 1 1 0 2 2 1 1 1\n*-+\n", "output": "1+2*2*2*1*1*2*2+0+2*2+0+1+0+0+0+0+1+0+0+0+1+1+2*1*1*2*2+0+2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya is a math teacher. n of his students has written a test consisting of m questions. For each student, it is known which questions he has answered correctly and which he has not.\n\nIf the student answers the j-th que...
[{"type": "stdin_stdout", "input": "3\n4 3\n5 1 2 2\n110\n100\n101\n100\n4 4\n6 2 0 10\n1001\n0010\n0110\n0101\n3 6\n20 3 15\n010110\n000101\n111111\n", "output": "3 1 2 \n2 3 4 1 \n3 1 4 5 2 6 \n"}, {"type": "stdin_stdout", "input": "3\n4 3\n10 1 2 2\n110\n100\n101\n100\n4 4\n6 2 0 10\n1001\n0010\n0110\n0101\n3 6\n20 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMike decided to teach programming to children in an elementary school. He knows that it is not an easy task to interest children in that age to code. That is why he decided to give each child two sweets.\n\nMike has $n$ s...
[{"type": "stdin_stdout", "input": "20\n43 48 38 34 23 18 8 22 12 7 47 1 13 20 3 15 49 6 10 26\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "20\n43 48 38 34 23 18 8 22 12 7 47 1 13 20 3 15 49 6 10 26\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "20\n43 48 38 34 41 18 8 22 12 7 47 1 13 20 3 15 49 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n2\n1 2\n\n\nOutput\n\n2\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 problem. Your program ...
[{"type": "stdin_stdout", "input": "2\n-1 -12", "output": "12\n"}, {"type": "stdin_stdout", "input": "2\n-1 12", "output": "-1\n"}, {"type": "stdin_stdout", "input": "2\n-1 24", "output": "-1\n"}, {"type": "stdin_stdout", "input": "2\n-2 24", "output": "-1\n"}, {"type": "stdin_stdout", "input": "2\n-2 22", "output": "-...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA chessboard n × m in size is given. During the zero minute we repaint all the black squares to the 0 color. During the i-th minute we repaint to the i color the initially black squares that have exactly four corner-adjac...
[{"type": "stdin_stdout", "input": "5000 5000\n1000000000\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "2085 5000\n1000000000\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "3762 3914\n1073\n", "output": "3386\n"}, {"type": "stdin_stdout", "input": "4583 2774\n1206\n", "output": "2535\n"}, {"type": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAndrey's favourite number is n. Andrey's friends gave him two identical numbers n as a New Year present. He hung them on a wall and watched them adoringly.\n\nThen Andrey got bored from looking at the same number and he s...
[{"type": "stdin_stdout", "input": "73552900025351606679224588872327647961330089042655630665222580520508672870102563487600132539752481214659858863022476410484266570139810532470714984092503934751571221521306943121997450187110428026190962582430971693370613087381790614697689671767000004095232276975952292053272119035138483...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi has a tower which is divided into N layers. Initially, all the layers are uncolored. Takahashi is going to paint some of the layers in red, green or blue to make a beautiful tower. He defines the beauty of the t...
[{"type": "stdin_stdout", "input": "121980 33447 90629 11295524182", "output": "643972230\n"}, {"type": "stdin_stdout", "input": "111605 33447 77758 2284871002", "output": "762328834\n"}, {"type": "stdin_stdout", "input": "111605 33447 14069 2284871002", "output": "815838636\n"}, {"type": "stdin_stdout", "input": "4247...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp likes numbers that are divisible by 3.\n\nHe has a huge number $s$. Polycarp wants to cut from it the maximum number of numbers that are divisible by $3$. To do this, he makes an arbitrary number of vertical cuts...
[{"type": "stdin_stdout", "input": "1000000000000000000000000000000000\n", "output": "33\n"}, {"type": "stdin_stdout", "input": "1000010000000000000000000000000000\n", "output": "32\n"}, {"type": "stdin_stdout", "input": "1000010000000001000000000000000000\n", "output": "31\n"}, {"type": "stdin_stdout", "input": "10000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.\n\nWrite a program which reads a list of N integers an...
[{"type": "stdin_stdout", "input": "11\n13\n20\n9\n10\n11\n13\n33\n14\n16\n12\n17", "output": "4\n"}, {"type": "stdin_stdout", "input": "11\n25\n20\n9\n10\n11\n13\n33\n14\n16\n12\n17", "output": "3\n"}, {"type": "stdin_stdout", "input": "11\n7\n10\n9\n10\n11\n13\n17\n14\n15\n16\n17", "output": "5\n"}, {"type": "stdin_s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp likes arithmetic progressions. A sequence $[a_1, a_2, \\dots, a_n]$ is called an arithmetic progression if for each $i$ ($1 \\le i < n$) the value $a_{i+1} - a_i$ is the same. For example, the sequences $[42]$, $...
[{"type": "stdin_stdout", "input": "4\n1 1000000000 1000000000 1000000000\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "4\n1 1000000000 1000000000 1000000000\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "4\n1 1000000000 1010000000 1000000000\n", "output": "-1\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGennady owns a small hotel in the countryside where he lives a peaceful life. He loves to take long walks, watch sunsets and play cards with tourists staying in his hotel. His favorite game is called \"Mau-Mau\".\n\nTo pl...
[{"type": "stdin_stdout", "input": "AS\n2H 4C TH JH AD\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "4D\nAS AC AD AH 5H\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "KH\n3C QD 9S KS 8D\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "4H\nJH QC 5H 9H KD\n", "output": "YES\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYour friend won't stop texting his girlfriend. It's all he does. All day. Seriously. The texts are so mushy too! The whole situation just makes you feel ill.\nBeing the wonderful friend that you are, you hatch an evil p...
[{"input": "\"You u youville utube you youyouyou uuu raiyou united youuuu u you\"", "output": "[\"your sister your sister youville utube your sister youyouyou uuu raiyou united your sister your sister your sister\"]", "fn_name": "autocorrect"}, {"input": "\"I want to film the bayou with you and put it on youtube\"", "o...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nA country has coins with denominations\n```python\ncoins_list = d1 < d2 < · · · < dn.\n```\nYou want to make change for n cents, using the smallest number of coins.\n\n```python\n# Example 1: U.S. coins\nd1 = 1 d2 = 5 d3 ...
[{"input": "[1, 2, 5, 10, 20, 50, 100, 200]\n93", "output": "[5]", "fn_name": "loose_change"}, {"input": "[25, 5, 10, 1, 21]\n63", "output": "[3]", "fn_name": "loose_change"}, {"input": "[1, 5, 10, 25]\n37", "output": "[4]", "fn_name": "loose_change"}, {"input": "[1, 4, 5, 10]\n8", "output": "[2]", "fn_name": "loose_ch...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are two buttons, one of size A and one of size B.\nWhen you press a button of size X, you get X coins and the size of that button decreases by 1.\nYou will press a button twice. Here, you can press the same button t...
[{"type": "stdin_stdout", "input": "-134 -12", "output": "-25\n"}, {"type": "stdin_stdout", "input": "-134 -8", "output": "-17\n"}, {"type": "stdin_stdout", "input": "-13 -10", "output": "-21\n"}, {"type": "stdin_stdout", "input": "100 100", "output": "200\n"}, {"type": "stdin_stdout", "input": "111 111", "output": "22...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBarney lives in country USC (United States of Charzeh). USC has n cities numbered from 1 through n and n - 1 roads between them. Cities and roads of USC form a rooted tree (Barney's not sure why it is rooted). Root of the...
[{"type": "stdin_stdout", "input": "85\n1 1 2 2 4 6 1 3 6 3 3 11 9 14 12 5 8 11 16 19 12 17 2 19 1 24 6 2 6 6 24 3 20 1 1 1 17 8 4 25 31 32 39 12 35 23 31 26 46 9 37 7 5 23 41 41 39 9 11 54 36 54 28 15 25 58 56 18 23 70 68 18 3 48 57 70 15 65 22 35 25 13 49 34\n", "output": "1.000000 28.500000 27.000000 38.000000 38.50...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCreate a function `isAlt()` that accepts a string as an argument and validates whether the vowels (a, e, i, o, u) and consonants are in alternate order.\n\n```python\nis_alt(\"amazon\")\n// true\nis_alt(\"apple\")\n// fal...
[{"input": "\"orange\"", "output": "[false]", "fn_name": "is_alt"}, {"input": "\"helipad\"", "output": "[true]", "fn_name": "is_alt"}, {"input": "\"amazon\"", "output": "[true]", "fn_name": "is_alt"}, {"input": "\"apple\"", "output": "[false]", "fn_name": "is_alt"}, {"input": "\"banana\"", "output": "[true]", "fn_name"...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a cube which consists of n × n × n small cubes. Small cubes have marks on their surfaces. An example where n = 4 is shown in the following figure.\n\n\n<image>\n\n\nThen, as shown in the figure above (right), mak...
[{"type": "stdin_stdout", "input": "12 3\nxy 4 3\nxz 1 2\nyz 2 3\n7 5\nxy 1 1\nxy 3 3\nxz 3 2\nyz 2 1\nyz 3 3\n0 0", "output": "1692\n310\n"}, {"type": "stdin_stdout", "input": "12 3\nxy 4 3\nxz 1 2\nyz 2 3\n7 5\nxy 1 1\nyx 3 3\nxz 3 2\nyz 2 1\nyz 3 3\n0 0", "output": "1692\n315\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConstraints\n\n* 1 ≤ |V| ≤ 1000\n* 0 ≤ |E| ≤ 2000\n* -10000 ≤ di ≤ 10000\n* There are no parallel edges\n* There are no self-loops\n\nInput\n\nAn edge-weighted graph G (V, E) and the source r.\n\n\n|V| |E| r\ns0 t0 d0\ns1...
[{"type": "stdin_stdout", "input": "42 0 1\n2 -1 3\n0 5 55\n1 0 -2\n-2 0 1\n2 4 -1", "output": "INF\n0\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\n"}, {"type": "st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nB: Hokkaido University Hard\n\nNote\n\nPlease note that the question settings are the same as question A, except for the constraints.\n\nstory\n\nHomura-chan, who passed Hokkaido University and is excited about the beginn...
[{"type": "stdin_stdout", "input": "3 3\nB.B\nB..\n.BB", "output": "4\n"}, {"type": "stdin_stdout", "input": "2 3\nB.B\nB..\n.BB", "output": "3\n"}, {"type": "stdin_stdout", "input": "1 3\nB-B\n..B\n.BA", "output": "2\n"}, {"type": "stdin_stdout", "input": "1 1\nB-B\n..B\n.BA", "output": "0\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nImplement `String#whitespace?(str)` (Ruby), `String.prototype.whitespace(str)` (JavaScript), `String::whitespace(str)` (CoffeeScript), or `whitespace(str)` (Python), which should return `true/True` if given object consist...
[{"input": "\"\\t \\n\\r\\n \"", "output": "[true]", "fn_name": "whitespace"}, {"input": "\"\\n\\r\\n\\r 3\"", "output": "[false]", "fn_name": "whitespace"}, {"input": "\"\\n\\r\\n\\r \"", "output": "[true]", "fn_name": "whitespace"}, {"input": "\"\\n\\r\\n\\r\"", "output": "[true]", "fn_name": "whitespace"}, {"input"...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nKND is a student programmer at the University of Aizu. His chest is known to be very sexy.\n\n<image>\n\n\nFor simplicity, the part of the skin that can be seen from the chest is represented by the isosceles tr...
[{"type": "stdin_stdout", "input": "3 2 3\n2 1 1\n2 1 1\n1 3 5", "output": "6.56688917825\n0.866025403784\n0.866025403784\n12.6033176764\n"}, {"type": "stdin_stdout", "input": "3 2 2\n2 1 1\n1 1 1\n1 3 16", "output": "5.44841509844\n0.866025403784\n1.29903810568\n29.6215145047\n"}, {"type": "stdin_stdout", "input": "4 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi is solving quizzes. He has easily solved all but the last one.\nThe last quiz has three choices: 1, 2, and 3.\nWith his supernatural power, Takahashi has found out that the choices A and B are both wrong.\nPrint...
[{"type": "stdin_stdout", "input": "3\n001", "output": "2\n"}, {"type": "stdin_stdout", "input": "3\n001", "output": "2\n"}, {"type": "stdin_stdout", "input": "3\n1\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "1\n2\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "1\n3\n", "output": "2\n"}, {"type": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a[0 \\ldots n-1]$ of length $n$ which consists of non-negative integers. Note that array indices start from zero.\n\nAn array is called good if the parity of each index matches the parity of the el...
[{"type": "stdin_stdout", "input": "4\n4\n6 4 7 6\n3\n3 2 6\n1\n7\n3\n4 14 2 1 18 3 0\n", "output": "-1\n1\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "4\n4\n3 2 0 6\n3\n6 4 4\n1\n7\n7\n7 7 2 1 18 1 2\n", "output": "-1\n-1\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "4\n4\n3 2 7 8\n3\n6 2 8\n1\n7\n7\n6 13 2 1 19 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen -, and the other characters are digits from 0 through 9.\nYou are given a string S. Determine whether it follows the postal c...
[{"type": "stdin_stdout", "input": "3 4\n269-6650\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "6 4\n269-6650", "output": "No\n"}, {"type": "stdin_stdout", "input": "6 8\n269-6650", "output": "No\n"}, {"type": "stdin_stdout", "input": "6 1\n269-6650", "output": "No\n"}, {"type": "stdin_stdout", "input": "6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCQXYM found a rectangle A of size n × m. There are n rows and m columns of blocks. Each block of the rectangle is an obsidian block or empty. CQXYM can change an obsidian block to an empty block or an empty block to an ob...
[{"type": "stdin_stdout", "input": "1\n9 9\n001010001\n101110100\n000010011\n100000001\n101010101\n110001111\n000001111\n110100000\n000110000\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "1\n8 9\n101110001\n101110100\n000010001\n001000001\n001011101\n110001111\n000001111\n110100010\n010110000\n", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNote that girls in Arpa’s land are really attractive.\n\nArpa loves overnight parties. In the middle of one of these parties Mehrdad suddenly appeared. He saw n pairs of friends sitting around a table. i-th pair consisted...
[{"type": "stdin_stdout", "input": "26\n8 10\n52 21\n2 33\n18 34\n30 51\n5 19\n22 32\n36 28\n42 16\n13 49\n11 17\n31 39\n43 37\n50 15\n29 20\n35 46\n47 23\n3 1\n44 7\n9 27\n6 48\n40 24\n26 14\n45 4\n12 25\n41 38\n", "output": "2 1\n1 2\n2 1\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n2 1\n1 2\n1 2\n1 2\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMash 2 arrays together so that the returning array has alternating elements of the 2 arrays . Both arrays will always be the same length.\n\neg. [1,2,3] + ['a','b','c'] = [1, 'a', 2, 'b', 3, 'c']\n\nWrite your solution b...
[{"input": "[\"h\", \"l\", \"o\", \"o\", \"l\"]\n[\"e\", \"l\", \"w\", \"r\", \"d\"]", "output": "[[\"h\", \"e\", \"l\", \"l\", \"o\", \"w\", \"o\", \"r\", \"l\", \"d\"]]", "fn_name": "array_mash"}, {"input": "[1, 8, \"hello\", \"dog\"]\n[\"fish\", \"2\", 9, 10]", "output": "[[1, \"fish\", 8, \"2\", \"hello\", 9, \"dog...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp wrote on the board a string $s$ containing only lowercase Latin letters ('a'-'z'). This string is known for you and given in the input.\n\nAfter that, he erased some letters from the string $s$, and he rewrote th...
[{"type": "stdin_stdout", "input": "10\nvzsxyuyy\n3\n1 0 3\nwwvutuxsuxywut\n2\n0 0\nsuzvsvutvvstuz\n3\n3 1 0\nstyuwsutv\n4\n6 3 0 1\nzsustytvzsyw\n6\n0 9 5 7 7 5\nsvwxwwwyxuvszx\n1\n0\nxuyyvuztxwuuvsxwz\n5\n5 7 0 0 7\nuxuztuwsxz\n5\n4 2 2 0 10\nxystzstwtzwsz\n2\n1 0\nuuzss\n1\n0\n", "output": "yzx\nxx\nuvz\nuvyw\nztwtv...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nJust to remind, girls in Arpa's land are really nice.\n\nMehrdad wants to invite some Hoses to the palace for a dancing party. Each Hos has some weight wi and some beauty bi. Also each Hos may have some friends. Hoses are...
[{"type": "stdin_stdout", "input": "10 5 100\n64 109 3 94 96 97 52 54 82 26\n796554 444893 214351 43810 684158 1060686 686198 339093 383018 699152\n6 8\n8 3\n3 9\n2 3\n10 3\n", "output": "1495706\n"}, {"type": "stdin_stdout", "input": "10 5 100\n48 73 57 46 95 19 171 73 94 24\n501216 675859 843572 565104 879875 828759 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads an directed graph $G = (V, E)$, and finds the shortest distance from vertex $1$ to each vertex (the number of edges in the shortest path). Vertices are identified by IDs $1, 2, ... n$.\n\nConst...
[{"type": "stdin_stdout", "input": "4\n1 2 1 4\n2 -1 4\n0 -1\n4 1 0", "output": "1 0\n2 -1\n3 -1\n4 1\n"}, {"type": "stdin_stdout", "input": "4\n1 2 1 4\n2 0 4\n0 -1\n4 -1 0", "output": "1 0\n2 -1\n3 -1\n4 1\n"}, {"type": "stdin_stdout", "input": "4\n1 2 1 4\n3 0 4\n0 -1\n4 -1 0", "output": "1 0\n2 -1\n3 -1\n4 1\n"}, {...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA university student, Takahashi, has to take N examinations and pass all of them. Currently, his readiness for the i-th examination is A_{i}, and according to his investigation, it is known that he needs readiness of at l...
[{"type": "stdin_stdout", "input": "12\n757232153 372327760 440075441 195848680 354974235 458054863 463477172 740174259 615762794 632963102 529866931 64991604\n102338863 98239366 465611891 362739947 147060907 118867039 63189252 78303147 501410831 110823640 122948912 572905212", "output": "5\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nStephen Queen wants to write a story. He is a very unusual writer, he uses only letters 'a', 'b', 'c', 'd' and 'e'!\n\nTo compose a story, Stephen wrote out $n$ words consisting of the first $5$ lowercase letters of the L...
[{"type": "stdin_stdout", "input": "6\n3\nbac\naaada\ne\n3\naba\nabcde\naba\n2\nbaba\nbaba\n4\nab\nab\nc\nbc\n5\ncbdca\nd\na\nd\ne\n3\nb\nc\nca\n", "output": "3\n2\n0\n2\n3\n2\n"}, {"type": "stdin_stdout", "input": "6\n3\nbac\naaada\ne\n3\naba\nabcde\naba\n2\nbaba\nbaba\n4\nba\nab\nc\nbc\n5\ncbdca\nd\na\nd\ne\n3\nb\nc\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKevin has just recevied his disappointing results on the USA Identification of Cows Olympiad (USAICO) in the form of a binary string of length n. Each character of Kevin's string represents Kevin's score on one of the n q...
[{"type": "stdin_stdout", "input": "93\n010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010\n", "output": "93\n"}, {"type": "stdin_stdout", "input": "93\n010101010101010101010101010101010101010101010101010101010101010101010101011101010101010101010\n", "output": "93\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKaren has just arrived at school, and she has a math test today!\n\n<image>\n\nThe test is about basic addition and subtraction. Unfortunately, the teachers were too busy writing tasks for Codeforces rounds, and had no ti...
[{"type": "stdin_stdout", "input": "19\n716981305 764655030 1148561420 914539062 853464027 317088317 653721289 239862203 605157354 943428394 261437390 821695238 312192823 432992892 547139308 121208111 1614663126 223751525 1084180198\n", "output": "399181927\n"}, {"type": "stdin_stdout", "input": "19\n469776209 76465503...
code_stdio