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\nOnce upon a time in the Kingdom of Far Far Away lived Sir Lancelot, the chief Royal General. He was very proud of his men and he liked to invite the King to come and watch drill exercises which demonstrated the fighting t...
[{"type": "stdin_stdout", "input": "1000 1000\n", "output": "500000\n"}, {"type": "stdin_stdout", "input": "999 1000\n", "output": "499500\n"}, {"type": "stdin_stdout", "input": "1000 997\n", "output": "498500\n"}, {"type": "stdin_stdout", "input": "997 1000\n", "output": "498500\n"}, {"type": "stdin_stdout", "input": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nServal soon said goodbye to Japari kindergarten, and began his life in Japari Primary School.\n\nIn his favorite math class, the teacher taught him the following interesting definitions.\n\nA parenthesis sequence is a str...
[{"type": "stdin_stdout", "input": "300\n??????(??????(???)??(???????)??????)((??????(???(??)())?(???????)???????????((??(??(??(?)???)(????)??(??(?(??(????????()?????(????(?(??(?(?????)??(????(????(??(??(????((??)(??(??????????????????(????????(????(?(???????(??(????(???)?(???????)?)??(?????((??(??(??????????()?????(??...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMiyako came to the flea kingdom with a ukulele. She became good friends with local flea residents and played beautiful music for them every day.\n\nIn return, the fleas made a bigger ukulele for her: it has $n$ strings, a...
[{"type": "stdin_stdout", "input": "10\n13 18 10 3 9 19 20 4 10 5\n20\n0 9\n5 11\n1 5\n1 16\n3 3\n0 7\n10 19\n14 20\n6 15\n11 12\n13 16\n11 13\n3 9\n7 10\n2 2\n10 11\n17 20\n17 18\n0 15\n0 6\n", "output": "27 24 22 33 9 25 27 24 27 13 20 17 24 20 9 13 20 13 33 24\n"}, {"type": "stdin_stdout", "input": "10\n13 18 10 3 9...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe range search problem consists of a set of attributed records S to determine which records from S intersect with a given range.\n\nFor n points on a plane, report a set of points which are within in a given range. Note...
[{"type": "stdin_stdout", "input": "6\n0 1\n4 0\n5 0\n6 4\n3 2\n11 6\n2\n-1 4 -1 2\n0 8 0 5", "output": "0\n1\n4\n\n0\n1\n2\n3\n4\n\n"}, {"type": "stdin_stdout", "input": "6\n2 1\n2 2\n4 2\n4 2\n3 3\n5 4\n2\n2 4 0 4\n4 10 2 5", "output": "0\n1\n2\n3\n4\n\n2\n3\n5\n\n"}, {"type": "stdin_stdout", "input": "6\n0 1\n4 2\n5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCara is applying for several different jobs.\nThe online application forms ask her to respond within a specific character count.\nCara needs to check that her answers fit into the character limit.\n\nAnnoyingly, some appl...
[{"input": "\"As Deputy Base Manager on Phobos for five Martian years, I have significant relevant experience.\"\n90\nfalse", "output": "[[true, \"AsDeputyBaseManageronPhobosforfiveMartianyears,Ihavesignificantrelevantexperience.\"]]", "fn_name": "charCheck"}, {"input": "\"But, as I pointed out, anyone complaining abou...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no ...
[{"type": "stdin_stdout", "input": "100\n6072 8210 6405 1191 2533 8552 7594 8793 2207 8855 7415 6252 3433 2339 5532 3118 3054 5750 3690 9843 3881 1390 936 8611 7099 988 7730 3835 7065 5030 6932 6936 5531 5173 1331 8975 5454 1592 8516 328 1091 4368 8275 6462 8638 4002 5534 113 6295 5960 1688 3668 6604 9632 4214 8687 795...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOn a history lesson the teacher asked Vasya to name the dates when n famous events took place. He doesn't remembers the exact dates but he remembers a segment of days [li, ri] (inclusive) on which the event could have tak...
[{"type": "stdin_stdout", "input": "10\n10 10\n13 15\n6 14\n10 15\n4 15\n11 12\n11 15\n8 15\n1 11\n1 9\n", "output": "10 14 6 12 4 11 13 8 2 1\n"}, {"type": "stdin_stdout", "input": "10\n10 10\n13 15\n6 14\n10 15\n4 15\n11 12\n11 15\n5 15\n1 11\n1 9\n", "output": "10 14 6 12 4 11 13 5 2 1\n"}, {"type": "stdin_stdout", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMr. Bill is shopping at the store. There are some coins in his wallet (10-yen coins, 50-yen coins, 100-yen coins, 500-yen coins), but he is now trying to consume as much of this coin as possible. In other words, by paying...
[{"type": "stdin_stdout", "input": "160\n1 1 2 0\n160\n1 1 2 10\n0", "output": "10 1\n50 1\n100 1\n\n10 1\n50 1\n100 1\n"}, {"type": "stdin_stdout", "input": "160\n1 1 2 0\n160\n1 -1 1 10\n0", "output": "10 1\n50 1\n100 1\n\n10 1\n500 1\n"}, {"type": "stdin_stdout", "input": "160\n1 1 4 0\n125\n-1 1 2 10\n0", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTo get on the Shinkansen, you need two tickets, a \"ticket\" and a \"limited express ticket\". These are separate tickets because some of the routes may not use the Shinkansen, but for routes that use only the Shinkansen,...
[{"type": "stdin_stdout", "input": "0 0 0", "output": "Close\n"}, {"type": "stdin_stdout", "input": "1 0 0", "output": "Close\n"}, {"type": "stdin_stdout", "input": "0 1 0", "output": "Close\n"}, {"type": "stdin_stdout", "input": "0 0 0", "output": "Close\n"}, {"type": "stdin_stdout", "input": "0 1 0", "output": "Close...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nICPC Calculator\n\nIn mathematics, we usually specify the order of operations by using parentheses. For example, 7 × (3 + 2) always means multiplying 7 by the result of 3 + 2 and never means adding 2 to the result of 7 × ...
[{"type": "stdin_stdout", "input": "1\n4\n0\n+\n2.115262384218664\n1.6946524456220797\n1.2494077125386351\n0\n+\n2.4871472060127386\n+.\n.-*\n3...\n...)\n--.+1\n2....\n1.1146316365084887\n-1\n*\n0\n1.4326064398520582\n.3.\n)/\n0.6657411913142146\n*/.\n.7..\n...6\n1.7891160931823404\n-1", "output": "4\n"}, {"type": "std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys all beacons to its left (direction of decreasing coord...
[{"type": "stdin_stdout", "input": "11\n110 90\n100 70\n90 10\n155 15\n130 1\n60 1\n71 10\n40 1\n30 1\n10 1\n20 1\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "11\n110 90\n100 70\n90 10\n155 15\n70 1\n60 1\n71 10\n40 1\n30 1\n10 1\n20 1\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "11\n110 90\n100...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMary wrote a recipe book and is about to publish it, but because of a new European law, she needs to update and include all measures in grams.\n\nGiven all the measures in tablespoon (`tbsp`) and in teaspoon (`tsp`), cons...
[{"input": "\"In another bowl, add 2 tsp of vanilla extract, 3 tsp of baking soda and 1/2 tsp of salt\"", "output": "[\"In another bowl, add 2 tsp (10g) of vanilla extract, 3 tsp (15g) of baking soda and 1/2 tsp (3g) of salt\"]", "fn_name": "convert_recipe"}, {"input": "\"Add to the mixing bowl and coat well with 1 tbs...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nColossal! — exclaimed Hawk-nose. — A programmer! That's exactly what we are looking for.Arkadi and Boris Strugatsky. Monday starts on Saturday\n\nReading the book \"Equations of Mathematical Magic\" Roman Oira-Oira and Cr...
[{"type": "stdin_stdout", "input": "9\n3\n2\n2\n228\n1\n1\n0\n16\n1488\n", "output": "4\n2\n2\n16\n2\n2\n1\n2\n32\n"}, {"type": "stdin_stdout", "input": "9\n2\n1\n2\n228\n1\n6\n8\n16\n1488\n", "output": "2\n2\n2\n16\n2\n4\n2\n2\n32\n"}, {"type": "stdin_stdout", "input": "9\n3\n2\n2\n272\n1\n1\n15\n3\n1488\n", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite an algorithm that takes an array and moves all of the zeros to the end, preserving the order of the other elements.\n\n```python\nmove_zeros([False,1,0,1,2,0,1,3,\"a\"]) # returns[False,1,1,2,1,3,\"a\",0,0]\n```\n\n...
[{"input": "[\"a\", 0, 0, \"b\", null, \"c\", \"d\", 0, 1, false, 0, 1, 0, 3, [], 0, 1, 9, 0, 0, {}, 0, 0, 9]", "output": "[[\"a\", \"b\", null, \"c\", \"d\", 1, false, 1, 3, [], 1, 9, {}, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]", "fn_name": "move_zeros"}, {"input": "[\"a\", 0, 0, \"b\", \"c\", \"d\", 0, 1, 0, 1, 0, 3, 0, 1,...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nSnuke has a string S consisting of three kinds of letters: `a`, `b` and `c`.\n\nHe has a phobia for palindromes, and wants to permute the characters in S so that S will not contain a palindrome of length 2 or more as a su...
[{"type": "stdin_stdout", "input": "bacaccbabab", "output": "YES\n"}, {"type": "stdin_stdout", "input": "bacaacbcbab", "output": "YES\n"}, {"type": "stdin_stdout", "input": "babcbcaacab", "output": "YES\n"}, {"type": "stdin_stdout", "input": "bababccacab", "output": "YES\n"}, {"type": "stdin_stdout", "input": "bacaccba...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCodefortia is a small island country located somewhere in the West Pacific. It consists of $n$ settlements connected by $m$ bidirectional gravel roads. Curiously enough, the beliefs of the inhabitants require the time nee...
[{"type": "stdin_stdout", "input": "6 7 13 22\n1 2 13\n2 3 13\n1 4 22\n3 4 13\n4 5 13\n5 6 13\n6 1 13\n", "output": "0 13 26 39 26 13\n"}, {"type": "stdin_stdout", "input": "6 7 13 22\n1 2 13\n2 3 13\n1 4 22\n3 4 13\n4 1 13\n5 6 13\n6 1 13\n", "output": "0 13 26 13 26 13 "}, {"type": "stdin_stdout", "input": "6 7 13 22...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is a number sequence A of length N.\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n - For every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j doe...
[{"type": "stdin_stdout", "input": "10\n33 18 45 28 8 19 89 86 2 4\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "10\n33 4 45 28 15 19 123 86 2 4", "output": "5\n"}, {"type": "stdin_stdout", "input": "10\n33 18 45 28 8 19 89 86 2 7", "output": "6\n"}, {"type": "stdin_stdout", "input": "10\n33 4 45 28 15 19 89...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCreate a program that will take in a string as input and, if there are duplicates of more than two alphabetical characters in the string, returns the string with all the extra characters in a bracket.\n\nFor example, the ...
[{"input": "\"aaaabbcdefffffffg\"", "output": "[\"aa[aa]bbcdeff[fffff]g\"]", "fn_name": "string_parse"}, {"input": "\"aAAabbcdeFFFffffg\"", "output": "[\"aAAabbcdeFF[F]ff[ff]g\"]", "fn_name": "string_parse"}, {"input": "\"aAAabbcdeffFfFffg\"", "output": "[\"aAAabbcdeffFfFffg\"]", "fn_name": "string_parse"}, {"input": "...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j).\nThe integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,...
[{"type": "stdin_stdout", "input": "5 5 4\n13 25 7 15 17\n16 22 20 2 9\n14 11 12 1 19\n10 6 23 8 18\n3 21 5 24 4\n3\n13 13\n2 10\n13 13\n", "output": "0\n5\n0\n"}, {"type": "stdin_stdout", "input": "5 5 4\n13 25 7 15 17\n16 22 20 2 9\n14 11 12 1 19\n10 6 23 8 18\n3 21 5 24 4\n3\n13 13\n0 10\n13 13", "output": "0\n5\n0\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBerland shop sells $n$ kinds of juices. Each juice has its price $c_i$. Each juice includes some set of vitamins in it. There are three types of vitamins: vitamin \"A\", vitamin \"B\" and vitamin \"C\". Each juice can con...
[{"type": "stdin_stdout", "input": "25\n8 CA\n4 AB\n8 CA\n4 CA\n7 CB\n4 CB\n4 CB\n2 AC\n2 CA\n3 BC\n4 AC\n7 AB\n3 CA\n5 BC\n7 CB\n9 CA\n7 AB\n7 CA\n9 BA\n8 AC\n6 BA\n2 AC\n1 CB\n5 AB\n3 AB\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "25\n8 CA\n4 AB\n8 CA\n4 CA\n2 CB\n4 CB\n4 CB\n2 AC\n2 CA\n3 BC\n4 AC\n7 AB...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBran and his older sister Arya are from the same house. Bran like candies so much, so Arya is going to give him some Candies.\n\nAt first, Arya and Bran have 0 Candies. There are n days, at the i-th day, Arya finds a_{i} ...
[{"type": "stdin_stdout", "input": "100 456\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...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTwo T-shirt sizes are given: $a$ and $b$. The T-shirt size is either a string M or a string consisting of several (possibly zero) characters X and one of the characters S or L.\n\nFor example, strings M, XXL, S, XXXXXXXS ...
[{"type": "stdin_stdout", "input": "15\nM M\nM L\nL M\nS M\nM S\nL L\nXL L\nL XXXXXXL\nS S\nXXXXS XXXS\nXS XXXXXXS\nM XXXS\nM XXXL\nXXXXXS XL\nXL XXXXS\n", "output": "=\n<\n>\n<\n>\n=\n>\n<\n=\n<\n>\n>\n<\n<\n>\n"}, {"type": "stdin_stdout", "input": "1\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXS XXXXXXXXXXXXXXX...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEvery Friday and Saturday night, farmer counts amount of sheep returned back to his farm (sheep returned on Friday stay and don't leave for a weekend).\n\nSheep return in groups each of the days -> you will be given two a...
[{"input": "[2, 5, 8]\n[11, 23, 3, 4, 15, 112, 12, 4]\n355", "output": "[156]", "fn_name": "lostSheep"}, {"input": "[2, 7, 13, 17]\n[23, 56, 44, 12, 1, 2, 1]\n255", "output": "[77]", "fn_name": "lostSheep"}, {"input": "[11, 23, 3, 4, 15]\n[7, 14, 9, 21, 15]\n300", "output": "[178]", "fn_name": "lostSheep"}, {"input": "...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven positive integers N, K and M, solve the following problem for every integer x between 1 and N (inclusive):\n - Find the number, modulo M, of non-empty multisets containing between 0 and K (inclusive) instances of ea...
[{"type": "stdin_stdout", "input": "100 100 996766481\n", "output": "100\n479013218\n301906461\n76865454\n197164919\n185261994\n562146154\n218533225\n703919664\n761757943\n421733444\n150668448\n939625796\n441056419\n399708797\n265484256\n872130614\n530113978\n956321625\n942851863\n391142590\n196625433\n784864879\n81918...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe letters shop showcase is a string s, consisting of n lowercase Latin letters. As the name tells, letters are sold in the shop.\n\nLetters are sold one by one from the leftmost to the rightmost. Any customer can only b...
[{"type": "stdin_stdout", "input": "100\nwjtwxtttttxjjwxtjtttwxjwjjwjxtwwxxwwwtwttwxjxxjxwxwjtjjwxxxxwwtwtxjxwtwtjjjxwjxjtwwwwtjtttjjtxtwtxjw\n10\nxwjxjwxtwwj\nwxjxxjxjx\nwtjxxxjxjxtwt\njwwxj\njtwjtxjxttxwtw\nwtwxjjjttjx\nwwwjtxw\ntjxjwtjwtw\ntjwtjjxtxjwt\nwxwtxtjw\n", "output": "21\n29\n29\n12\n15\n17\n21\n14\n17\n14\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHeading ##There are two integers A and B. You are required to compute the bitwise AND amongst all natural numbers lying between A and B, both inclusive.\nInput Format\n\nFirst line of the input contains T, the number of t...
[{"type": "stdin_stdout", "input": "124\n1476395008 1493172223\n1275068416 1291845631\n4009754624 4026531839\n2516582400 2533359615\n50331648 67108863\n2566914048 2583691263\n2952790016 2969567231\n3892314112 3909091327\n3489660928 3506438143\n33554432 50331647\n1694498816 1711276031\n3623878656 3640655871\n1308622848 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n## Grade book\n\nComplete the function so that it finds the mean of the three scores passed to it and returns the letter value associated with that grade.\n\nNumerical Score | Letter Grade\n--- | ---\n90...
[{"input": "100\n100\n100", "output": "[\"A\"]", "fn_name": "get_grade"}, {"input": "100\n85\n96", "output": "[\"A\"]", "fn_name": "get_grade"}, {"input": "70\n70\n100", "output": "[\"B\"]", "fn_name": "get_grade"}, {"input": "95\n90\n93", "output": "[\"A\"]", "fn_name": "get_grade"}, {"input": "92\n93\n94", "output": ...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn Manhattan, roads run where the x or y coordinate is an integer. Both Sunuke-kun's house and Sumeke-kun's house are on the road, and the straight line distance (Euclidean distance) is just d. Find the maximum value that...
[{"type": "stdin_stdout", "input": "10.685123853325852", "output": "15.1110470690\n"}, {"type": "stdin_stdout", "input": "10.702511281748821", "output": "15.1356366061\n"}, {"type": "stdin_stdout", "input": "10.804121325601631", "output": "15.2793349082\n"}, {"type": "stdin_stdout", "input": "11.285119341606524", "outp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTwo semifinals have just been in the running tournament. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 ≤ 2k ≤ n...
[{"type": "stdin_stdout", "input": "8\n100 101\n200 201\n300 301\n310 400\n320 500\n330 600\n340 700\n350 800\n", "output": "11111000\n11110000\n"}, {"type": "stdin_stdout", "input": "8\n100 101\n200 201\n300 301\n310 400\n320 500\n330 600\n340 700\n350 800\n", "output": "11111000\n11110000\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIf the girl doesn't go to Denis, then Denis will go to the girl. Using this rule, the young man left home, bought flowers and went to Nastya. \n\nOn the way from Denis's house to the girl's house is a road of n lines. Thi...
[{"type": "stdin_stdout", "input": "30 8\n0 1 13 12 23 24 26 30\n40 7\n", "output": "30\n"}, {"type": "stdin_stdout", "input": "30 8\n0 1 9 12 23 24 26 30\n40 7\n", "output": "30\n"}, {"type": "stdin_stdout", "input": "30 8\n0 1 9 12 23 24 26 30\n27 7\n", "output": "41\n"}, {"type": "stdin_stdout", "input": "30 8\n0 1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBob is an active user of the social network Faithbug. On this network, people are able to engage in a mutual friendship. That is, if $a$ is a friend of $b$, then $b$ is also a friend of $a$. Each user thus has a non-negat...
[{"type": "stdin_stdout", "input": "35\n21 26 18 7 28 2 16 13 16 25 6 32 11 5 31 17 18 3 24 33 14 27 29 1 20 4 12 9 10 30 34 8 19 23 22\n", "output": "0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 \n"}, {"type": "stdin_stdout", "input": "35\n21 26 18 4 28 3 15 13 16 25 6 25 11 5 31 17 9 3 24 33 14 27 29 1 20 4 12 7 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe greatest common divisor is an indispensable element in mathematics handled on a computer. Using the greatest common divisor can make a big difference in the efficiency of the calculation. One of the algorithms to find...
[{"type": "stdin_stdout", "input": "1251 5715\n10 10\n0 0", "output": "9 6\n10 1\n"}, {"type": "stdin_stdout", "input": "1251 3144\n10 10\n0 0", "output": "3 6\n10 1\n"}, {"type": "stdin_stdout", "input": "1893 2905\n10 6\n0 0", "output": "1 11\n2 3\n"}, {"type": "stdin_stdout", "input": "1893 2905\n11 6\n0 0", "output...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian. \nVidhi went to a magic show last week where she was astounded by a magic trick performed by the great Mandwarf, the brown. His trick was as follows :\n\nAsk a vo...
[{"type": "stdin_stdout", "input": "2\n3\n1 1 1\n1 4 1000\nARM\n4\n0 2 3 11\n-1 1 1100\nAMAM", "output": "2 2 8\n1099 1 1 9\n"}, {"type": "stdin_stdout", "input": "2\n3\n1 1 1\n3 4 1100\nARM\n4\n0 2 3 8\n-1 1 1100\nAMAM", "output": "4 4 16\n1099 1 1 6\n"}, {"type": "stdin_stdout", "input": "2\n3\n2 1 1\n2 3 1000\nARM\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n## Task\n\nImplement a function which finds the numbers less than `2`, and the indices of numbers greater than `1` in the given sequence, and returns them as a pair of sequences. \n\nReturn a nested array or a tuple depen...
[{"input": "[0, 1, 2, 1, 0, 2, 1, 1, 1, 0, 4, 5, 6, 2, 1, 1, 0]", "output": "[[[0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0], [2, 5, 10, 11, 12, 13]]]", "fn_name": "binary_cleaner"}, {"input": "[0, 1, 2, 1, 0, 2, 1, 1]", "output": "[[[0, 1, 1, 0, 1, 1], [2, 5]]]", "fn_name": "binary_cleaner"}, {"input": "[3, 0, 7, 0, 2, 0]", "outp...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nA palindrome is a word, phrase, number, or other sequence of characters which reads the same backward as forward. Examples of numerical palindromes are:\n\n2332 \n110011 \n54322345 \n\nFor a given number `num`, write a...
[{"input": "\"ACCDDCCA\"", "output": "[\"Not valid\"]", "fn_name": "palindrome"}, {"input": "\"@14AbC\"", "output": "[\"Not valid\"]", "fn_name": "palindrome"}, {"input": "1456009006541", "output": "[true]", "fn_name": "palindrome"}, {"input": "\"1221\"", "output": "[\"Not valid\"]", "fn_name": "palindrome"}, {"input":...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nInternational Abbreviation Olympiad takes place annually starting from 1989. Each year the competition receives an abbreviation of form IAO'y, where y stands for some number of consequent last digits of the current year. ...
[{"type": "stdin_stdout", "input": "9\nIAO'0\nIAO'00\nIAO'000\nIAO'0000\nIAO'00000\nIAO'000000\nIAO'0000000\nIAO'00000000\nIAO'000000000\n", "output": "1990\n2000\n3000\n10000\n100000\n1000000\n10000000\n100000000\n1000000000\n"}, {"type": "stdin_stdout", "input": "9\nIAO'0\nIAO'00\nIAO'000\nIAO'0000\nIAO'00000\nIAO'01...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the probability theory the following paradox called Benford's law is known: \"In many lists of random numbers taken from real sources, numbers starting with digit 1 occur much more often than numbers starting with any ...
[{"type": "stdin_stdout", "input": "20\n3 21\n15 28\n21 26\n4 6\n13 28\n20 23\n22 27\n4 13\n1 7\n5 35\n3 3\n16 30\n9 32\n9 16\n3 7\n21 22\n24 29\n6 25\n15 25\n28 33\n51\n", "output": "3.349496664437241e-05\n"}, {"type": "stdin_stdout", "input": "20\n10 21\n18 29\n4 8\n1 27\n24 29\n5 5\n22 22\n4 5\n1 4\n7 12\n11 23\n11 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou got a job as a marketer in a pet shop, and your current task is to boost sales of cat food. One of the strategies is to sell cans of food in packs with discounts. \n\nSuppose you decided to sell packs with $a$ cans in...
[{"type": "stdin_stdout", "input": "10\n335544320 671088640\n335544322 671088639\n335544321 671088639\n335544325 671088637\n335544319 671088640\n335544319 671088641\n335544319 671088639\n335544318 671088639\n352759476 671088637\n335544319 671088643\n", "output": "NO\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nYES\nNO\n"}, {"type":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a$ consisting of $n$ non-negative integers. It is guaranteed that $a$ is sorted from small to large.\n\nFor each operation, we generate a new array $b_i=a_{i+1}-a_{i}$ for $1 \\le i < n$. Then we s...
[{"type": "stdin_stdout", "input": "1\n147\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTurtle Shi-ta and turtle Be-ko decided to divide a chocolate. The shape of the chocolate is rectangle. The corners of the chocolate are put on (0,0), (w,0), (w,h) and (0,h). The chocolate has lines for cutting. They cut t...
[{"type": "stdin_stdout", "input": "2 3 7 10 50\n3 3\n6 6\n10 10\n4.0000000000 4.380940502722975\n7.0000000000 7.0000000000\n2 3 10 10 48\n2 3\n7 6\n10 10\n4.1530399119933294 4.124627510166318\n7.679827074828504 8.063298606739774\n2 3 10 10 30\n3 3\n6 6\n10 10\n4.0000000000 4.920930737803775\n7.0000000000 7.0000000000\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOn the planet Mars a year lasts exactly n days (there are no leap years on Mars). But Martians have the same weeks as earthlings — 5 work days and then 2 days off. Your task is to determine the minimum possible and the ma...
[{"type": "stdin_stdout", "input": "1000000\n", "output": "285714 285715\n"}, {"type": "stdin_stdout", "input": "999999\n", "output": "285714 285714\n"}, {"type": "stdin_stdout", "input": "999998\n", "output": "285713 285714\n"}, {"type": "stdin_stdout", "input": "999997\n", "output": "285712 285714\n"}, {"type": "stdi...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEdogawa Conan got tired of solving cases, and invited his friend, Professor Agasa, over. They decided to play a game of cards. Conan has n cards, and the i-th card has a number a_{i} written on it.\n\nThey take turns play...
[{"type": "stdin_stdout", "input": "10\n38282 53699 38282 38282 38282 38282 38282 38282 38282 38282\n", "output": "Conan\n"}, {"type": "stdin_stdout", "input": "10\n50165 50165 50165 50165 50165 50165 50165 50165 50165 50165\n", "output": "Agasa\n"}, {"type": "stdin_stdout", "input": "10\n32093 36846 32093 32093 36846 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLearning to code around your full time job is taking over your life. You realise that in order to make significant steps quickly, it would help to go to a coding bootcamp in London.\n\nProblem is, many of them cost a fort...
[{"input": "\"What do you mean I cant learn to code??\"\n8\n9", "output": "[\"Sabbatical! Boom!\"]", "fn_name": "sabb"}, {"input": "\"I can?! Nice. FaC..Im coming :D\"\n9\n9", "output": "[\"Sabbatical! Boom!\"]", "fn_name": "sabb"}, {"input": "\"Why are you shouting?\"\n7\n2", "output": "[\"Back to your desk, boy.\"]",...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\n$2^n$ teams participate in a playoff tournament. The tournament consists of $2^n - 1$ games. They are held as follows: in the first phase of the tournament, the teams are split into pairs: team $1$ plays against team $2$,...
[{"type": "stdin_stdout", "input": "7\n1011011\n", "output": "32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 11...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given integers A and B, each between 1 and 3 (inclusive).\nDetermine if there is an integer C between 1 and 3 (inclusive) such that A \\times B \\times C is an odd number.\n\n-----Constraints-----\n - All values i...
[{"type": "stdin_stdout", "input": "-1 -1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-3 -1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-1 -3", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-5 -1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-1 -5", "output": "Yes\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array of integers. Your task is to sort odd numbers within the array in ascending order, and even numbers in descending order.\n\nNote that zero is an even number. If you have an empty array, you need to ...
[{"input": "[1, 2, 3, 4, 5, 6, 7, 8, 9, 0]", "output": "[[1, 8, 3, 6, 5, 4, 7, 2, 9, 0]]", "fn_name": "sort_array"}, {"input": "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]", "output": "[[8, 1, 6, 3, 4, 5, 2, 7, 0, 9]]", "fn_name": "sort_array"}, {"input": "[0, 1, 2, 3, 4, 9, 8, 7, 6, 5]", "output": "[[8, 1, 6, 3, 4, 5, 2, 7, 0, 9]]...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nBelow is a right-angled triangle:\n\n```\n |\\\n | \\\n | \\\n | \\ \no | \\ h \n | \\\n | θ \\\n |_______\\ \n a\n```\n\nYour challange is to write a function (```missingAngle``` in C/C#, ```missi...
[{"input": "16.7\n0\n12.3", "output": "[47]", "fn_name": "missing_angle"}, {"input": "0\n400\n300", "output": "[37]", "fn_name": "missing_angle"}, {"input": "5\n4\n0", "output": "[37]", "fn_name": "missing_angle"}, {"input": "8\n0\n5", "output": "[39]", "fn_name": "missing_angle"}, {"input": "7\n5\n0", "output": "[44]"...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nGreatest common divisor GCD(a, b) of two positive integers a and b is equal to the biggest integer d such that both integers a and b are divisible by d. There are many efficient algorithms to find greatest common divisor ...
[{"type": "stdin_stdout", "input": "10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "output": "10000000000000000000000000000000000000000000000000000000000000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAwruk is taking part in elections in his school. It is the final round. He has only one opponent — Elodreip. The are $n$ students in the school. Each student has exactly $k$ votes and is obligated to use all of them. So A...
[{"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\n-----Input-----\n\nThe input contains a single integer $a$ ($1 \\le a \\le 99$).\n\n\n-----Output-----\n\nOutput \"YES\" or \"NO\".\n\n\n-----Examples-----\nInput\n5\n\nOutput\nYES\n\nInput\n13\n\nOutput\nNO\n\nInput\n24\...
[{"type": "stdin_stdout", "input": "46\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "12\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "30\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "35\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "43\n", "output": "YES\n"}, {"type": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNantendo Co., Ltd. has released a game software called Packet Monster. This game was intended to catch, raise, and fight monsters, and was a very popular game all over the world.\n\nThis game had features not found in tra...
[{"type": "stdin_stdout", "input": "CBA\ncba\ncCa\nX\nYZ\nZ\n-", "output": "BbA\nYX\n"}, {"type": "stdin_stdout", "input": "CBA\ncba\ncCa\nY\nYZ\nZ\n-", "output": "BbA\nYY\n"}, {"type": "stdin_stdout", "input": "CBA\ncca\ncCa\nX\nZY\nZ\n-", "output": "BcA\nXY\n"}, {"type": "stdin_stdout", "input": "CAB\ncba\ncCa\nX\nYZ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDon't Drink the Water\n\nGiven a two-dimensional array representation of a glass of mixed liquids, sort the array such that the liquids appear in the glass based on their density. (Lower density floats to the top) The wid...
[{"input": "[[\"A\", \"A\", \"O\", \"H\"], [\"A\", \"H\", \"W\", \"O\"], [\"W\", \"W\", \"A\", \"W\"], [\"H\", \"H\", \"O\", \"O\"]]", "output": "[[[\"O\", \"O\", \"O\", \"O\"], [\"A\", \"A\", \"A\", \"A\"], [\"W\", \"W\", \"W\", \"W\"], [\"H\", \"H\", \"H\", \"H\"]]]", "fn_name": "separate_liquids"}, {"input": "[[\"H\...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are several days left before the fiftieth birthday of a famous Berland's writer Berlbury. In this connection the local library decided to make an exposition of the works of this famous science-fiction writer. It was...
[{"type": "stdin_stdout", "input": "55 1000\n2612 1306 4300 1790 3173 9493 7209 7763 8563 4534 7466 1281 4483 6863 3787 7292 3957 8775 7221 4016 5743 6556 2070 2119 4795 9094 1913 2077 8786 4520 1865 2357 7871 3288 8231 5808 9383 9820 9974 3056 5343 2169 5177 6299 5805 8132 9315 6747 5226 3531 1206 4073 8290 1423 6720\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDuring the winter holidays, the demand for Christmas balls is exceptionally high. Since it's already 2018, the advances in alchemy allow easy and efficient ball creation by utilizing magic crystals.\n\nGrisha needs to obt...
[{"type": "stdin_stdout", "input": "1000000000 1000000000\n1000000000 1000000000 1000000000\n", "output": "5000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000\n1000000000 1000000000 1000000000\n", "output": "5000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000\n1000100000 100000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# The Invitation\n\nMost of us played with toy blocks growing up. It was fun and you learned stuff. So what else can you do but rise to the challenge when a 3-year old exclaims, \"Look, I made a square!\", then pointing t...
[{"input": "[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]", "output": "[true]", "fn_name": "build_square"}, {"input": "[1, 3, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1]", "output": "[false]", "fn_name": "build_square"}, {"input": "[2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4]", "output": "[false]", "fn_name": "build_square"}, {"input": "[1,...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nEncryption System\n\nA programmer developed a new encryption system. However, his system has an issue that two or more distinct strings are `encrypted' to the same string.\n\nWe have a string encrypted by his system. To d...
[{"type": "stdin_stdout", "input": "enw\nabc\nabcdefghijklmnopqrst\ny\n#", "output": "1\nfox\n5\nacc\nacd\nbbd\nbcc\nbcd\n17711\nacceeggiikkmmooqqssu\nacceeggiikkmmooqqstt\nacceeggiikkmmooqqstu\nacceeggiikkmmooqrrtt\nacceeggiikkmmooqrrtu\nbcdefghijklmnopqrrtt\nbcdefghijklmnopqrrtu\nbcdefghijklmnopqrssu\nbcdefghijklmnop...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThanks to the effects of El Nino this year my holiday snorkelling trip was akin to being in a washing machine... Not fun at all.\n\nGiven a string made up of '~' and '\\_' representing waves and calm respectively, your jo...
[{"input": "\"_~~~~~~~_~__~______~~__~~_~~\"", "output": "[\"Throw Up\"]", "fn_name": "sea_sick"}, {"input": "\"_~~_~____~~~~~~~__~_~\"", "output": "[\"Throw Up\"]", "fn_name": "sea_sick"}, {"input": "\"______~___~_\"", "output": "[\"Throw Up\"]", "fn_name": "sea_sick"}, {"input": "\"____\"", "output": "[\"No Problem\"...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nAstronaut Natasha arrived on Mars. She knows that the Martians are very poor aliens. To ensure a better life for the Mars citizens, their emperor decided to take tax from every tourist who visited the planet. Natasha is t...
[{"type": "stdin_stdout", "input": "2 420\n412 363\n", "output": "420\n0 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 74 75 76 77 78 79 80 81 82 83 84 85 8...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers A and B as the input. Output the value of A + B.\nHowever, if A + B is 10 or greater, output error instead.\n\n-----Constraints-----\n - A and B are integers.\n - 1 ≤ A, B ≤ 9\n\n-----Input-----...
[{"type": "stdin_stdout", "input": "-169 -1", "output": "-170\n"}, {"type": "stdin_stdout", "input": "-169 -2", "output": "-171\n"}, {"type": "stdin_stdout", "input": "-279 -2", "output": "-281\n"}, {"type": "stdin_stdout", "input": "-279 -1", "output": "-280\n"}, {"type": "stdin_stdout", "input": "-433 -1", "output": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a chessboard of size 1 × n. It is guaranteed that n is even. The chessboard is painted like this: \"BWBW...BW\".\n\nSome cells of the board are occupied by the chess pieces. Each cell contains no more than o...
[{"type": "stdin_stdout", "input": "100\n93 54 57 61 68 66 70 96 64 82 80 75 69 77 76 94 67 86 90 73 74 58 100 83 92 89 56 99 88 59 95 72 81 51 85 71 97 60 91 63 65 98 79 84 53 62 87 55 52 78\n", "output": "1225\n"}, {"type": "stdin_stdout", "input": "100\n93 54 57 61 68 66 70 96 64 82 80 75 69 77 76 94 67 86 90 73 74 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTwo players are playing a game. The game is played on a sequence of positive integer pairs. The players make their moves alternatively. During his move the player chooses a pair and decreases the larger integer in the pai...
[{"type": "stdin_stdout", "input": "3\n1\n2 5\n2\n4 10\n5 10\n2\n2 3\n1 5", "output": "YES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "3\n1\n1 5\n2\n4 10\n5 10\n2\n2 3\n1 5", "output": "YES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "3\n1\n1 3\n2\n4 10\n5 10\n2\n4 3\n3 5", "output": "YES\nYES\nYES\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYour task is to find the number couple with the greatest difference from a given array of number-couples. \n\nAll number couples will be given as strings and all numbers in them will be positive integers. \n\nFor instanc...
[{"input": "[\"45896-2354\", \"4654-556767\", \"2455-423522\", \"3455-355\", \"34-34\", \"2524522-0\"]", "output": "[\"2524522-0\"]", "fn_name": "diff"}, {"input": "[\"43-45\", \"1021-55\", \"000-18888\", \"92-34\", \"76-32\", \"99-1\", \"1020-54\"]", "output": "[\"000-18888\"]", "fn_name": "diff"}, {"input": "[\"1-100...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nAssume that a, b, and n are all positive integers. Let f (i) be the i-th fraction of the fraction a / b (0 ≤ f (i) ≤ 9). At this time, let s be the sum of f (i) from i = 1 to n.\n\ns = f (1) + f (2) + ... + f (n)\n\n\nCre...
[{"type": "stdin_stdout", "input": "2 3 2\n2 7 3\n13 3 5\n4 6 2", "output": "12\n15\n15\n12\n"}, {"type": "stdin_stdout", "input": "1 3 2\n2 7 3\n13 3 5\n4 6 2", "output": "6\n15\n15\n12\n"}, {"type": "stdin_stdout", "input": "2 3 2\n2 7 3\n13 3 5\n4 4 2", "output": "12\n15\n15\n0\n"}, {"type": "stdin_stdout", "input":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAt regular competition Vladik and Valera won a and b candies respectively. Vladik offered 1 his candy to Valera. After that Valera gave Vladik 2 his candies, so that no one thought that he was less generous. Vladik for sa...
[{"type": "stdin_stdout", "input": "1000000000 1000000000\n", "output": "Vladik\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000\n", "output": "Vladik\n"}, {"type": "stdin_stdout", "input": "1000000000 1387445955\n", "output": "Vladik\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000001\n", "outpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe all know about Roman Numerals, and if not, here's a nice [introduction kata](http://www.codewars.com/kata/5580d8dc8e4ee9ffcb000050). And if you were anything like me, you 'knew' that the numerals were not used for zero...
[{"input": "1632\n2", "output": "[\"MDCXXXII:\"]", "fn_name": "roman_fractions"}, {"input": "5000", "output": "[\"MMMMM\"]", "fn_name": "roman_fractions"}, {"input": "0\n11", "output": "[\"S:.:\"]", "fn_name": "roman_fractions"}, {"input": "0\n-1", "output": "[\"NaR\"]", "fn_name": "roman_fractions"}, {"input": "0\n12"...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nWell met with Fibonacci bigger brother, AKA Tribonacci.\n\nAs the name may already reveal, it works basically like a Fibonacci, but summing the last 3 (instead of 2) numbers of the sequence to generate the next. And, wors...
[{"input": "[0.5, 0.5, 0.5]\n30", "output": "[[0.5, 0.5, 0.5, 1.5, 2.5, 4.5, 8.5, 15.5, 28.5, 52.5, 96.5, 177.5, 326.5, 600.5, 1104.5, 2031.5, 3736.5, 6872.5, 12640.5, 23249.5, 42762.5, 78652.5, 144664.5, 266079.5, 489396.5, 900140.5, 1655616.5, 3045153.5, 5600910.5, 10301680.5]]", "fn_name": "tribonacci"}, {"input": "...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a string s of length 3 or greater.\nNo two neighboring characters in s are equal.\nTakahashi and Aoki will play a game against each other.\nThe two players alternately performs the following operation, Takahashi ...
[{"type": "stdin_stdout", "input": "fzezbxdbwzbqzxdlkqpcheqlhlfkohdekflklzxpxodqexwewpfbobcdlxowlqzxkqdobwodoxdhcohfdzhlfzbzhcobhewxzodzqfxfbokxkqexwzdfxwhwfeocxobxkocphcofwlkzkcqpblclblbecbwozldhxfdekpwxocfhbzkxqwhkofcxzqlwhpdzkdcedxwkqpqpfchfeclcxeqxfcbzfkophefxkqclxwfoxdfpbeowxpxfdwpolkczlpcdhkhkhohplbfzkolqlzfbhfzl...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have N integers. The i-th integer is A_i.\nFind \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} (A_i \\mbox{ XOR } A_j), modulo (10^9+7).What is \\mbox{ XOR }?\n\nThe XOR of integers A and B, A \\mbox{ XOR } B, is defined as follow...
[{"type": "stdin_stdout", "input": "10\n3 14 159 2653 58979 323846 2643383 27950288 419716939 9375105820\n", "output": "103715602\n"}, {"type": "stdin_stdout", "input": "10\n1 14 159 2653 58979 323846 2643383 27950288 419716939 9375105820", "output": "103715608\n"}, {"type": "stdin_stdout", "input": "10\n1 14 159 2653 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Petya very much likes computers. Recently he has received a new \"Ternatron IV\" as a gift from his mother. Unlike other modern computers, \"Ternatron IV\" operates with ternary and not binary logic. Petya immediat...
[{"type": "stdin_stdout", "input": "274842194 1000000000\n", "output": "1162261466\n"}, {"type": "stdin_stdout", "input": "274842194 1000100000\n", "output": "1162105233\n"}, {"type": "stdin_stdout", "input": "922263603 387506683\n", "output": "1064907553\n"}, {"type": "stdin_stdout", "input": "1000000000 100000000\n",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are some ambiguities when one writes Berland names with the letters of the Latin alphabet.\n\nFor example, the Berland sound u can be written in the Latin alphabet as \"u\", and can be written as \"oo\". For this re...
[{"type": "stdin_stdout", "input": "101\nukuu\nh\nouuo\no\nkkuo\nko\nu\nh\nhku\nh\nh\nhuo\nuhoh\nkuu\nhu\nhkko\nuhuk\nkoho\nh\nhukk\noohu\nkk\nkko\nou\noou\nh\nuuu\nuh\nkhuk\nokoo\nouou\nuo\nkk\noo\nhuok\no\nu\nhok\nhu\nhhuu\nkuu\nooho\noku\nhuoh\nhhkh\nuuuh\nouo\nhou\nhhu\nh\no\nokou\nuo\nh\nukk\nu\nhook\nh\noouk\noku...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOnce Bob saw a string. It contained so many different letters, that the letters were marked by numbers, but at the same time each letter could be met in the string at most 10 times. Bob didn't like that string, because it...
[{"type": "stdin_stdout", "input": "100\n8 43 55 27 70 81 66 10 49 67 24 61 53 0 2 76 96 16 16 1 78 1 69 69 4 59 6 87 98 14 98 20 12 48 20 41 67 90 20 96 44 8 77 94 84 2 61 27 90 42 66 84 5 19 68 13 5 53 13 87 70 41 48 40 19 61 72 31 4 4 59 100 50 64 84 10 96 16 73 3 63 85 67 91 74 63 22 34 6 96 78 42 61 85 3 95 98 84 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads $n$ items and sorts them. Each item has attributes $\\\\{value, weight, type, date, name\\\\}$ and they are represented by $\\\\{$ integer, integer, upper-case letter, integer, string $\\\\}$ r...
[{"type": "stdin_stdout", "input": "5\n105 24 C 1500000000000 white\n100 23 C 1500000000000 blue\n105 23 A 1480000000000 pink\n110 25 B 1500000000000 black\n110 20 A 1484487224415 gree", "output": "100 23 C 1500000000000 blue\n105 23 A 1480000000000 pink\n105 24 C 1500000000000 white\n110 20 A 1484487224415 gree\n110 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two arrays $a_1, a_2, \\dots , a_n$ and $b_1, b_2, \\dots , b_m$. Array $b$ is sorted in ascending order ($b_i < b_{i + 1}$ for each $i$ from $1$ to $m - 1$).\n\nYou have to divide the array $a$ into $m$ con...
[{"type": "stdin_stdout", "input": "77 22\n3 2 4 8 10 7 5 7 9 7 5 6 2 9 10 1 5 4 5 8 6 9 3 1 8 1 10 9 6 7 7 1 5 3 6 4 9 10 7 8 2 3 10 10 9 9 2 9 1 9 7 3 2 4 7 7 1 1 10 4 2 2 8 3 2 9 11 10 5 6 7 1 10 8 3 9 1\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22\n", "output": "0\n"}, {"type": "stdin_stdout", "input":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter making bad dives into swimming pools, Wilbur wants to build a swimming pool in the shape of a rectangle in his backyard. He has set up coordinate axes, and he wants the sides of the rectangle to be parallel to them....
[{"type": "stdin_stdout", "input": "4\n-474 -894\n-474 -833\n-446 -894\n-446 -833\n", "output": "1708\n"}, {"type": "stdin_stdout", "input": "4\n-474 -894\n-474 -833\n-446 -894\n-446 -833\n", "output": "1708\n"}, {"type": "stdin_stdout", "input": "4\n-414 -891\n-414 896\n346 -891\n346 896\n", "output": "1358120\n"}, {"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor an integer n not less than 0, let us define f(n) as follows:\n - f(n) = 1 (if n < 2)\n - f(n) = n f(n-2) (if n \\geq 2)\nGiven is an integer N. Find the number of trailing zeros in the decimal notation of f(N).\n\n---...
[{"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "124999999999999995\n"}, {"type": "stdin_stdout", "input": "999003990299500294\n", "output": "124875498787437525\n"}, {"type": "stdin_stdout", "input": "1000000000010000000", "output": "125000000001249993\n"}, {"type": "stdin_stdout", "input": "10000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMatrix of given integers\n\n\na1,1 a1,2 ... a1, n\na2,1 a2,2 ... a2, n\n::\nan, 1 an, 2 ... an, n\n\n\nThen, create a program that outputs the maximum value of the sum of one or more consecutive terms (submatrix) in the v...
[{"type": "stdin_stdout", "input": "4\n1 3 -9 2\n2 7 -1 5\n-8 3 2 -1\n5 -1 -3 1", "output": "15\n"}, {"type": "stdin_stdout", "input": "4\n1 3 -9 0\n2 7 -1 5\n-8 3 2 -2\n3 -1 -3 1", "output": "14\n"}, {"type": "stdin_stdout", "input": "4\n1 3 -9 2\n2 4 -1 5\n-8 3 2 -1\n5 -1 -6 1", "output": "12\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day, Yuhao came across a problem about checking if some bracket sequences are correct bracket sequences.\n\nA bracket sequence is any non-empty sequence of opening and closing parentheses. A bracket sequence is called...
[{"type": "stdin_stdout", "input": "30\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((...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA family of kookaburras are in my backyard.\n\nI can't see them all, but I can hear them!\n\n# How many kookaburras are there?\n\n\n\n\n## Hint \n\nThe trick to counting kookaburras is to listen carefully\n\n* The males g...
[{"input": "\"hahahahahahahaHaHa\"", "output": "[2]", "fn_name": "kooka_counter"}, {"input": "\"hahahahahaHaHaHa\"", "output": "[2]", "fn_name": "kooka_counter"}, {"input": "\"HaHaHahahaHaHa\"", "output": "[3]", "fn_name": "kooka_counter"}, {"input": "\"hahahahaha\"", "output": "[1]", "fn_name": "kooka_counter"}, {"inp...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nSmall, but very brave, mouse Brain was not accepted to summer school of young villains. He was upset and decided to postpone his plans of taking over the world, but to become a photographer instead.\n\nAs you may know, th...
[{"type": "stdin_stdout", "input": "5 5\nW G B W G\nG B W G B\nB W G B W\nW G B W G\nG B W G B\n", "output": "#Black&White\n"}, {"type": "stdin_stdout", "input": "5 5\nW G B W G\nG B W G B\nB W G B W\nW G B W G\nG B W G B\n", "output": "#Black&White"}, {"type": "stdin_stdout", "input": "5 5\nW G B Y M\nG B Y M C\nB Y M...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe busses in Berland are equipped with a video surveillance system. The system records information about changes in the number of passengers in a bus after stops.\n\nIf $x$ is the number of passengers in a bus just befor...
[{"type": "stdin_stdout", "input": "102 1\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "102 1\n1 1 1 1 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian. \n\nChef has a box full of infinite number of identical coins. One day while playing, he made N piles each containing equal number of coins. Chef suddenly remembe...
[{"type": "stdin_stdout", "input": "1\n4\n1 -1 2 2", "output": "2\n"}, {"type": "stdin_stdout", "input": "1\n4\n1 1 -1 4", "output": "2\n"}, {"type": "stdin_stdout", "input": "1\n4\n1 2 2 -1", "output": "2\n"}, {"type": "stdin_stdout", "input": "1\n4\n0 2 2 -1", "output": "2\n"}, {"type": "stdin_stdout", "input": "1\n4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N mountains ranging from east to west, and an ocean to the west.\nAt the top of each mountain, there is an inn. You have decided to choose where to stay from these inns.\nThe height of the i-th mountain from the...
[{"type": "stdin_stdout", "input": "20\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100\n", "output": "20\n"}, {"type": "stdin_stdout", "input": "20\n54 53 68 68 35 35 62 61 74 73 94 94 94 94 86 85 65 64 68 68\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "20\n8 12 14 17 23 26 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCODE FESTIVAL 2016 is going to be held. For the occasion, Mr. Takahashi decided to make a signboard.\n\nHe intended to write `CODEFESTIVAL2016` on it, but he mistakenly wrote a different string S. Fortunately, the string ...
[{"type": "stdin_stdout", "input": "EDOC6102LAVITSEF", "output": "16\n"}, {"type": "stdin_stdout", "input": "1DO2LAVI6REGE0TC", "output": "15\n"}, {"type": "stdin_stdout", "input": "VT0EGER6ICAL2OD0", "output": "10\n"}, {"type": "stdin_stdout", "input": "VV1EFFR7ICAK2OD0", "output": "11\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNow that Kuroni has reached 10 years old, he is a big boy and doesn't like arrays of integers as presents anymore. This year he wants a Bracket sequence as a Birthday present. More specifically, he wants a bracket sequenc...
[{"type": "stdin_stdout", "input": "((()((()()))))(\n", "output": "1\n12\n1 2 3 5 6 7 8 10 11 12 13 14\n"}, {"type": "stdin_stdout", "input": "(((((())()))()(\n", "output": "1\n12\n1 2 3 4 5 6 7 8 10 11 12 14\n"}, {"type": "stdin_stdout", "input": "((()(())()))()(\n", "output": "1\n10\n1 2 3 5 6 8 10 11 12 14\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConstruct a dice from a given sequence of integers in the same way as Dice I.\n\nYou are given integers on the top face and the front face after the dice was rolled in the same way as Dice I. Write a program to print an i...
[{"type": "stdin_stdout", "input": "1 2 3 4 14 -1\n3\n1 3\n1 4\n3 2", "output": "14\n2\n-1\n"}, {"type": "stdin_stdout", "input": "1 2 3 4 5 12\n3\n3 2\n1 3\n3 2", "output": "12\n5\n12\n"}, {"type": "stdin_stdout", "input": "1 2 3 4 5 16\n3\n3 2\n1 3\n3 2", "output": "16\n5\n16\n"}, {"type": "stdin_stdout", "input": "1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe on-board computer on Polycarp's car measured that the car speed at the beginning of some section of the path equals v_1 meters per second, and in the end it is v_2 meters per second. We know that this section of the r...
[{"type": "stdin_stdout", "input": "100 100\n100 10\n", "output": "34500\n"}, {"type": "stdin_stdout", "input": "100 100\n100 10\n", "output": "34500"}, {"type": "stdin_stdout", "input": "100 100\n100 0\n", "output": "10000\n"}, {"type": "stdin_stdout", "input": "100 100\n100 1\n", "output": "12450\n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe word internationalization is sometimes abbreviated to i18n.\nThis comes from the fact that there are 18 letters between the first i and the last n.\nYou are given a string s of length at least 3 consisting of lowercas...
[{"type": "stdin_stdout", "input": "internationalization\n", "output": "i18n\n"}, {"type": "stdin_stdout", "input": "intfrnationalization", "output": "i18n\n"}, {"type": "stdin_stdout", "input": "noitazilanoitanrftni", "output": "n18i\n"}, {"type": "stdin_stdout", "input": "ooitazilanoitanrftni", "output": "o18i\n"}, {...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Duck song\n\nFor simplicity, we'll assume that there are only three types of grapes: green grapes, purple grapes and black grapes.\n\nAndrew, Dmitry and Michal are all grapes' lovers, however their preferences of grap...
[{"type": "stdin_stdout", "input": "100000 100000 100000\n100000 100000 100000\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100000 100000 100000\n100000 100000 100000\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "99999 100000 100000\n100000 100000 100000\n", "output": "YES\n"}, {"type": "stdi...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGerald has been selling state secrets at leisure. All the secrets cost the same: n marks. The state which secrets Gerald is selling, has no paper money, only coins. But there are coins of all positive integer denomination...
[{"type": "stdin_stdout", "input": "108\n", "output": " 2"}, {"type": "stdin_stdout", "input": "243\n", "output": " 1"}, {"type": "stdin_stdout", "input": "81\n", "output": " ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently Johnny have learned bogosort sorting algorithm. He thought that it is too ineffective. So he decided to improve it. As you may know this algorithm shuffles the sequence randomly until it is sorted. Johnny decided...
[{"type": "stdin_stdout", "input": "3\n3\n6\n42", "output": "10/3\n1826/189\n3861289540035137932590423886961807813592751894315116939644306/8913121775113966157962800372668924735854723781840323828125\n"}, {"type": "stdin_stdout", "input": "3\n3\n5\n42", "output": "10/3\n149/21\n3861289540035137932590423886961807813592751...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Task\n You are given three integers `l, d and x`. Your task is:\n```\n• determine the minimal integer n \n such that l ≤ n ≤ d, and the sum of its digits equals x.\n• determine the maximal integer m \n such that l...
[{"input": "2000\n7000\n3", "output": "[[2001, 3000]]", "fn_name": "min_and_max"}, {"input": "99\n5001\n28", "output": "[[1999, 4996]]", "fn_name": "min_and_max"}, {"input": "99\n5001\n27", "output": "[[999, 4995]]", "fn_name": "min_and_max"}, {"input": "100\n200\n10", "output": "[[109, 190]]", "fn_name": "min_and_max"...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nSwitch/Case - Bug Fixing #6\n\nOh no! Timmy's evalObject function doesn't work. He uses Switch/Cases to evaluate the given properties of an object, can you fix timmy's function?\n\nWrite your solution by modifying this co...
[{"input": "{\"a\": 1, \"b\": 1, \"operation\": \"**\"}", "output": "[1]", "fn_name": "eval_object"}, {"input": "{\"a\": 1, \"b\": 1, \"operation\": \"+\"}", "output": "[2]", "fn_name": "eval_object"}, {"input": "{\"a\": 1, \"b\": 1, \"operation\": \"-\"}", "output": "[0]", "fn_name": "eval_object"}, {"input": "{\"a\":...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nInnokenty works at a flea market and sells some random stuff rare items. Recently he found an old rectangular blanket. It turned out that the blanket is split in $n \\cdot m$ colored pieces that form a rectangle with $n$ ...
[{"type": "stdin_stdout", "input": "10 10\naaaaarpppp\nbbbbsssssu\ncciiiiiiqq\nddmmgggggg\neeebbbbbbb\nfffffqoooo\ngxxxxrrrrr\nhhfuuuuuuu\niiillqqqqq\njjjjjppwww\n", "output": "138\n"}, {"type": "stdin_stdout", "input": "10 10\naaaaaaaaaa\nbbbbbbbbbb\ncccccccccc\ndddddddddd\neeeeeeeeee\nffffffffff\ngggggggggg\nhhhhhhhh...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA carpet shop sells carpets in different varieties. Each carpet can come in a different roll width and can have a different price per square meter. \n\nWrite a function `cost_of_carpet` which calculates the cost (rounded ...
[{"input": "0\n0\n4\n10", "output": "[\"error\"]", "fn_name": "cost_of_carpet"}, {"input": "5\n6\n4\n10", "output": "[\"error\"]", "fn_name": "cost_of_carpet"}, {"input": "3.9\n2\n4\n10", "output": "[80]", "fn_name": "cost_of_carpet"}, {"input": "3\n5\n4\n10", "output": "[200]", "fn_name": "cost_of_carpet"}, {"input": ...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight lin...
[{"type": "stdin_stdout", "input": "1000000000 1000000000 117928222 908877261\n", "output": "500000000000000000.000000 0\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000 500000000 500000000\n", "output": "500000000000000000.000000 1\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000 500000000 49...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDZY loves chessboard, and he enjoys playing with it.\n\nHe has a chessboard of n rows and m columns. Some cells of the chessboard are bad, others are good. For every good cell, DZY wants to put a chessman on it. Each ches...
[{"type": "stdin_stdout", "input": "8 35\n......................-............\n...-..........-........-...........\n...........-.......................\n-..................................\n...................................\n...........-............-.........-\n.........-.........-.--............\n......................
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn poker, you have 5 cards. There are 10 kinds of poker hands (from highest to lowest):\n\n- royal flush - ace, king, queen, jack and ten, all in the same suit\n\n- straight flush - five cards of the same suit in sequen...
[{"type": "stdin_stdout", "input": "3\nAH KH QH TH JH\nJH 6S 3C 5C 7D\nQH QD 4S QC 2C", "output": "royal flush\nhigh card\nthree of a kind\n"}, {"type": "stdin_stdout", "input": "3\nAH KH QH TH JH\nKH 6S 2D 5C 7D\nQH QD 4S QC 2C", "output": "royal flush\nhigh card\nthree of a kind\n"}, {"type": "stdin_stdout", "input":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDescription\n\nKMC sells CDs every year at a coterie spot sale called Comic Market. F was supposed to sell CDs at the comic market, but due to the popularity of F, the KMC sales floor was flooded with people, and the calc...
[{"type": "stdin_stdout", "input": "500 1000\n100 10000\n400 1006\n1029 5000\n10000 10000\n0 0", "output": "0 1 0\n4 1 9\n1 1 0\n4 1 3\n0 0 0\n"}, {"type": "stdin_stdout", "input": "500 1001\n001 10100\n400 1047\n429 5000\n10000 10000\n0 0", "output": "0 1 0\n0 0 10\n1 1 0\n0 1 4\n0 0 0\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given three strings $a$, $b$ and $c$ of the same length $n$. The strings consist of lowercase English letters only. The $i$-th letter of $a$ is $a_i$, the $i$-th letter of $b$ is $b_i$, the $i$-th letter of $c$ is...
[{"type": "stdin_stdout", "input": "4\naaa\nbbb\nccc\nabc\nbca\nbca\naabb\nbbaa\nbaba\nimi\nmii\niim\n", "output": "NO\nYES\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "4\naaa\nbbb\nccc\nabc\nbca\ncca\naabb\nbbaa\nbaba\niim\nmii\niim\n", "output": "NO\nNO\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "4\naa`\ncb...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPalo Alto is an unusual city because it is an endless coordinate line. It is also known for the office of Lyft Level 5.\n\nLyft has become so popular so that it is now used by all $m$ taxi drivers in the city, who every d...
[{"type": "stdin_stdout", "input": "1 4\n2 4 6 10 15\n1 1 1 1 0\n", "output": "0 0 0 1 "}, {"type": "stdin_stdout", "input": "1 4\n2 4 6 10 14\n1 1 1 1 0\n", "output": "0 0 0 1\n"}, {"type": "stdin_stdout", "input": "1 4\n3 4 6 10 15\n1 1 1 1 0\n", "output": "0 0 0 1\n"}, {"type": "stdin_stdout", "input": "1 4\n2 4 6 1...
code_stdio