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\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 this kata, single digit numbers wi...
[{"input": "\"ACCDDCCA\"", "output": "[\"Not valid\"]", "fn_name": "palindrome"}, {"input": "\"1551\"", "output": "[\"Not valid\"]", "fn_name": "palindrome"}, {"input": "-4505", "output": "[\"Not valid\"]", "fn_name": "palindrome"}, {"input": "22.22", "output": "[\"Not valid\"]", "fn_name": "palindrome"}, {"input": "12...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nComprised of a team of five incredibly brilliant women, \"The ladies of ENIAC\" were the first “computors” working at the University of Pennsylvania’s Moore School of Engineering (1945). Through their contributions, we ga...
[{"input": "\"///$%&$553791r357%??@$%u?$%@7993111@$%t$h3% 3$l$311i3%@?&c3h%&t&&?%11e%$?@11957r79%&m$$a55n1!111%%\"", "output": "[\"RUTH LICHTERMAN!\"]", "fn_name": "rad_ladies"}, {"input": "\"%&$557f953//1/$@%r%935$$a@3111$@???%n???5 $%157b%///$i%55&31@l?%&$$a%@$s5757!$$%%%%53\"", "output": "[\"FRAN BILAS!\"]", "fn_nam...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nLuntik has decided to try singing. He has $a$ one-minute songs, $b$ two-minute songs and $c$ three-minute songs. He wants to distribute all songs into two concerts such that every song should be included to exactly one co...
[{"type": "stdin_stdout", "input": "4\n2 4 1\n4 2 0\n10 4 5\n1 1 2\n", "output": "1\n0\n1\n1\n"}, {"type": "stdin_stdout", "input": "4\n2 2 0\n4 2 0\n10 4 5\n1 1 2\n", "output": "0\n0\n1\n1\n"}, {"type": "stdin_stdout", "input": "4\n2 4 0\n4 2 0\n10 4 5\n1 1 2\n", "output": "0\n0\n1\n1\n"}, {"type": "stdin_stdout", "in...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n###Instructions\n\nA time period starting from ```'hh:mm'``` lasting until ```'hh:mm'``` is stored in an array:\n```\n['08:14', '11:34']\n```\nA set of different time periods is then stored in a 2D Array like so, each in ...
[{"input": "[[\"12:00\", \"10:01\"], [\"06:31\", \"14:23\"], [\"03:02\", \"07:58\"], [\"08:13\", \"10:05\"], [\"18:37\", \"04:22\"], [\"12:58\", \"14:28\"], [\"01:51\", \"14:40\"], [\"04:27\", \"01:00\"], [\"22:56\", \"23:33\"], [\"19:23\", \"07:00\"], [\"02:13\", \"16:14\"], [\"10:40\", \"02:36\"], [\"11:49\", \"00:10...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlicia has an array, $a_1, a_2, \\ldots, a_n$, of non-negative integers. For each $1 \\leq i \\leq n$, she has found a non-negative integer $x_i = max(0, a_1, \\ldots, a_{i-1})$. Note that for $i=1$, $x_i = 0$.\n\nFor exa...
[{"type": "stdin_stdout", "input": "35\n15 13 -25 -7 -18 -16 4 -15 2 -23 0 -3 -26 -27 -24 -27 -22 1 -52 -19 -16 -15 -29 -43 -18 -27 -11 -20 -2 -11 -20 -30 -1 -13 -46\n", "output": "15 28 3 21 10 12 32 17 34 11 34 31 8 7 10 7 12 35 -17 16 19 20 6 -8 17 8 24 15 33 24 15 5 34 22 -11 "}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet p (i) be the i-th prime number from the smallest. For example, 7 is the fourth prime number from the smallest, 2, 3, 5, 7, so p (4) = 7.\n\nGiven n, the sum of p (i) from i = 1 to n s\n\ns = p (1) + p (2) + .... + p (...
[{"type": "stdin_stdout", "input": "2\n219\n0", "output": "5\n136114\n"}, {"type": "stdin_stdout", "input": "2\n279\n0", "output": "5\n231208\n"}, {"type": "stdin_stdout", "input": "2\n195\n0", "output": "5\n105540\n"}, {"type": "stdin_stdout", "input": "2\n199\n0", "output": "5\n110364\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are 32 letters in the Polish alphabet: 9 vowels and 23 consonants. \n \nYour task is to change the letters with diacritics:\n\n```\ną -> a,\nć -> c,\nę -> e,\nł -> l,\nń -> n,\nó -> o,\nś -> s,\nź -> z,\nż -> z\n```...
[{"input": "\"W\\u00f3\\u0142 go pyta: 'Panie chrz\\u0105szczu,Po co pan tak brz\\u0119czy w g\\u0105szczu?'\"", "output": "[\"Wol go pyta: 'Panie chrzaszczu,Po co pan tak brzeczy w gaszczu?'\"]", "fn_name": "correct_polish_letters"}, {"input": "\"Za\\u017c\\u00f3\\u0142\\u0107 g\\u0119\\u015bl\\u0105 ja\\u017a\\u0144\...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nA bracketed sequence is called correct (regular) if by inserting \"+\" and \"1\" you can get a well-formed mathematical expression from it. For example, sequences \"(())()\", \"()\" and \"(()(()))\" are correct, while \")...
[{"type": "stdin_stdout", "input": "101\n(())))))()))()())(()))((())))((())(()()()(()()((()()((()((())))((()))()(())(()(())((()))(()))()(((()(\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "100\n)()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(\n", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDaniel has a string s, consisting of lowercase English letters and period signs (characters '.'). Let's define the operation of replacement as the following sequence of steps: find a substring \"..\" (two consecutive peri...
[{"type": "stdin_stdout", "input": "2 7\nab\n1 w\n2 w\n1 c\n2 .\n2 .\n1 .\n2 b\n", "output": "0\n0\n0\n0\n0\n1\n0\n"}, {"type": "stdin_stdout", "input": "2 7\nab\n1 w\n2 w\n1 c\n2 .\n2 .\n1 .\n2 b\n", "output": "0\n0\n0\n0\n0\n1\n0\n"}, {"type": "stdin_stdout", "input": "2 7\nab\n2 w\n2 w\n1 c\n2 .\n2 .\n1 .\n2 b\n", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYakko, Wakko and Dot, world-famous animaniacs, decided to rest from acting in cartoons, and take a leave to travel a bit. Yakko dreamt to go to Pennsylvania, his Motherland and the Motherland of his ancestors. Wakko thoug...
[{"type": "stdin_stdout", "input": "-16 2\n", "output": "5/6\n"}, {"type": "stdin_stdout", "input": "-16 3\n", "output": "2/3\n"}, {"type": "stdin_stdout", "input": "-12 2\n", "output": "5/6\n"}, {"type": "stdin_stdout", "input": "3 -12\n", "output": "2/3\n"}, {"type": "stdin_stdout", "input": "-12 3\n", "output": "2/3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe purpose of this kata is to work out just how many bottles of duty free whiskey you would have to buy such that the saving over the normal high street price would effectively cover the cost of your holiday. \n\nYou wil...
[{"input": "1400\n35\n10000", "output": "[20]", "fn_name": "duty_free"}, {"input": "12\n50\n1000", "output": "[166]", "fn_name": "duty_free"}, {"input": "24\n35\n3000", "output": "[357]", "fn_name": "duty_free"}, {"input": "700\n26\n7000", "output": "[38]", "fn_name": "duty_free"}, {"input": "17\n10\n500", "output": "[...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nGreg has an array a = a_1, a_2, ..., a_{n} and m operations. Each operation looks as: l_{i}, r_{i}, d_{i}, (1 ≤ l_{i} ≤ r_{i} ≤ n). To apply operation i to the array means to increase all array elements with numbers l_{i}...
[{"type": "stdin_stdout", "input": "4 3 6\n2 2 3 4\n1 2 2\n2 3 2\n3 4 4\n1 2\n1 3\n2 3\n1 2\n1 3\n2 3\n", "output": "10 22 31 20\n"}, {"type": "stdin_stdout", "input": "4 3 6\n2 2 3 4\n1 2 2\n3 3 2\n3 4 4\n1 2\n1 3\n2 3\n1 2\n1 3\n2 3\n", "output": "10 10 31 20\n"}, {"type": "stdin_stdout", "input": "4 3 6\n2 2 3 4\n1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string $s$ consisting of $n$ lowercase Latin letters. Polycarp wants to remove exactly $k$ characters ($k \\le n$) from the string $s$. Polycarp uses the following algorithm $k$ times:\n\n if there is at ...
[{"type": "stdin_stdout", "input": "26 1\nabcdefghijklmnopqrstuvwxyz\n", "output": "bcdefghijklmnopqrstuvwxyz\n"}, {"type": "stdin_stdout", "input": "26 1\nabcdefghijklmnopqrsuuvwxyz\n", "output": "bcdefghijklmnopqrsuuvwxyz\n"}, {"type": "stdin_stdout", "input": "26 2\nabcdefghijklmnopqrstuvwxyz\n", "output": "cdefghij...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array of positive integers a1, a2, ..., an × T of length n × T. We know that for any i > n it is true that ai = ai - n. Find the length of the longest non-decreasing sequence of the given array.\n\nInput\...
[{"type": "stdin_stdout", "input": "100 10000000\n300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 30...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter finding and moving to the new planet that supports human life, discussions started on which currency should be used. After long negotiations, Bitcoin was ultimately chosen as the universal currency.\n\nThese were th...
[{"type": "stdin_stdout", "input": "10\n1 10 100 1000 10000 100000 1000000 10000000 100000000 1000000001\n1000000000 999999999\n", "output": "999999999\n"}, {"type": "stdin_stdout", "input": "10\n1 10 100 1000 10000 100000 1000000 11000000 100000000 1000000001\n1000000000 999999999\n", "output": "999999999\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou and your n - 1 friends have found an array of integers a_1, a_2, ..., a_n. You have decided to share it in the following way: All n of you stand in a line in a particular order. Each minute, the person at the front of...
[{"type": "stdin_stdout", "input": "4\n6 4 2\n3 9 2 3 8 4\n4 3 1\n1 13 60 4\n4 1 3\n1 0 2 1\n2 2 2\n1 2\n", "output": "8\n60\n1\n2\n"}, {"type": "stdin_stdout", "input": "4\n6 4 2\n2 7 4 5 8 7\n4 4 1\n8 13 111 4\n4 1 2\n1 2 2 1\n2 2 1\n2 3\n", "output": "7\n8\n1\n3\n"}, {"type": "stdin_stdout", "input": "4\n6 4 2\n2 7 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between the easy and the hard version is the constraint on $n$.\n\nYou are given an undirected complete graph on $n$ vertices. A complete graph is a graph where each pair of vertices is connected by an...
[{"type": "stdin_stdout", "input": "1337\n", "output": "520628749\n"}, {"type": "stdin_stdout", "input": "1000\n", "output": "756980810\n"}, {"type": "stdin_stdout", "input": "3000\n", "output": "596853783\n"}, {"type": "stdin_stdout", "input": "4500\n", "output": "299551211\n"}, {"type": "stdin_stdout", "input": "100\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the world of Latin Alphabets, there seemed to be a catastrophe! All the vowels went missing. The other alphabets got disturbed and began the search operation.\nWhile searching they stumbled upon a garbage of letters. C...
[{"type": "stdin_stdout", "input": "10000\nmrbbmoswthlzegrlsoygzcjaenksbbdtecgljyvcbpjxizzsksmdhnrsnteptajetyewidaxiekcabocistqjkohfqypiydmgoqrqrdisjyrzykgvkggyqmqvyhhwzzxhyalielptfgqvgypjtsbaieljbanvksvnnjajcdinjtknhwfclefcvalsarpxcnfivyayqeslwpgxnevbksldcrfdddlxqirbdcatiiwxyssnmvwgtikarylhejqzrtbztzstpbdfefttscpeivrb...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe winter in Berland lasts n days. For each day we know the forecast for the average air temperature that day. \n\nVasya has a new set of winter tires which allows him to drive safely no more than k days at any average a...
[{"type": "stdin_stdout", "input": "100 50\n-7 -3 9 2 16 -19 0 -10 3 -11 17 7 -7 -10 -14 -14 -7 -15 -15 -8 8 -18 -17 -5 -19 -15 -14 0 8 -3 -19 -13 -3 11 -3 -16 16 -16 -12 -2 -17 7 -16 -14 -10 0 -10 -18 -16 -11 -2 -12 -15 -8 -1 -11 -3 -17 -14 -6 -9 -15 -14 -11 -20 -20 -4 -20 -14 -2 0 -2 -20 17 -17 2 0 1 2 6 -5 -13 -16 -...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe number `1035` is the smallest integer that exhibits a non frequent property: one its multiples, `3105 = 1035 * 3`, has its same digits but in different order, in other words, `3105`, is one of the permutations of `103...
[{"input": "10000\n7", "output": "[1]", "fn_name": "search_permMult"}, {"input": "10000\n4", "output": "[2]", "fn_name": "search_permMult"}, {"input": "10000\n3", "output": "[2]", "fn_name": "search_permMult"}, {"input": "5000\n7", "output": "[0]", "fn_name": "search_permMult"}, {"input": "8000\n4", "output": "[1]", "f...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Task\nA newspaper is published in Walrusland. Its heading is `s1` , it consists of lowercase Latin letters. \n\nFangy the little walrus wants to buy several such newspapers, cut out their headings, glue them one to anot...
[{"input": "\"abc\"\n\"abcabc\"", "output": "[2]", "fn_name": "buy_newspaper"}, {"input": "\"abc\"\n\"abccba\"", "output": "[4]", "fn_name": "buy_newspaper"}, {"input": "\"abc\"\n\"aaaaaa\"", "output": "[6]", "fn_name": "buy_newspaper"}, {"input": "\"abc\"\n\"bcac\"", "output": "[2]", "fn_name": "buy_newspaper"}, {"inp...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi went to an all-you-can-eat buffet with N kinds of dishes and ate all of them (Dish 1, Dish 2, \\ldots, Dish N) once.\nThe i-th dish (1 \\leq i \\leq N) he ate was Dish A_i.\nWhen he eats Dish i (1 \\leq i \\leq ...
[{"type": "stdin_stdout", "input": "20\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20\n50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50\n50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50\n", "output": "1950\n"}, {"type": "stdin_stdout", "input": "20\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEasy and hard versions are actually different problems, so we advise you to read both statements carefully.\n\nYou are given a weighted rooted tree, vertex 1 is the root of this tree. Also, each edge has its own cost.\n\n...
[{"type": "stdin_stdout", "input": "4\n4 18\n2 1 9 2\n3 2 4 1\n4 1 1 2\n3 20\n2 1 8 1\n3 1 7 2\n5 50\n1 3 100 1\n1 5 10 2\n2 3 123 2\n5 4 55 1\n2 000\n1 2 409 2\n", "output": "0\n0\n11\n18\n"}, {"type": "stdin_stdout", "input": "4\n4 18\n2 1 18 2\n3 2 4 1\n4 1 2 2\n3 20\n2 1 2 1\n3 1 8 2\n5 50\n1 3 100 1\n1 5 10 2\n2 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions:\n\n* 1 \\leq x,y,z\n* x^2 + y^2 + z^2 + xy + yz + zx = n\n\n\n\nGiven an integer N, find each of f(1),f(2),f(3),\\ldots,...
[{"type": "stdin_stdout", "input": "743", "output": "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou already know that Valery's favorite sport is biathlon. Due to your help, he learned to shoot without missing, and his skills are unmatched at the shooting range. But now a smaller task is to be performed, he should le...
[{"type": "stdin_stdout", "input": "20 20 2\nbaaaaaaaaaaaaaaaaaaa\nbfffffffacfffffffffa\nbgggggggaccgggggggga\nbhhhhhhhaccchhhhhhha\nbiiiiiiiacccciiiiiia\nbjjjjjjjacccccjjjjja\nbkkkkkkkacccccckkkka\nblllllllacccccccllla\nbbbbbbbbSccccccccmma\nbddddddddddcccccccna\nbodddddddcccccccccca\nbppddddddddTaaaaaaaa\nbqqqddddddd...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSanta Claus is the first who came to the Christmas Olympiad, and he is going to be the first to take his place at a desk! In the classroom there are n lanes of m desks each, and there are two working places at each of the...
[{"type": "stdin_stdout", "input": "10000 10000 199999999\n", "output": "10000 10000 L\n"}, {"type": "stdin_stdout", "input": "10000 10000 200000000\n", "output": "10000 10000 R\n"}, {"type": "stdin_stdout", "input": "10000 10000 199999999\n", "output": "10000 10000 L\n"}, {"type": "stdin_stdout", "input": "10000 10000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ points on a coordinate axis $OX$. The $i$-th point is located at the integer point $x_i$ and has a speed $v_i$. It is guaranteed that no two points occupy the same coordinate. All $n$ points move with the co...
[{"type": "stdin_stdout", "input": "5\n2 1 4 3 5\n2 2 2 3 4\n", "output": "19\n"}, {"type": "stdin_stdout", "input": "5\n2 1 4 3 5\n0 2 2 3 4\n", "output": "18\n"}, {"type": "stdin_stdout", "input": "5\n2 1 4 3 5\n2 2 2 3 4\n", "output": "19\n"}, {"type": "stdin_stdout", "input": "3\n1 3 2\n-100 2 10\n", "output": "3\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian. \n\nSometimes mysteries happen. Chef found a directed graph with N vertices and M edges in his kitchen! \nThe evening was boring and chef has nothing else to do, ...
[{"type": "stdin_stdout", "input": "12 7\n1 2 \n4 2\n3 4\n7 12\n2 2\n9 9\n10 1", "output": "-1\n"}, {"type": "stdin_stdout", "input": "12 7\n1 2 \n4 2\n3 4\n8 12\n2 2\n9 9\n10 1", "output": "-1\n"}, {"type": "stdin_stdout", "input": "12 7\n1 2 \n4 2\n3 4\n7 7\n2 1\n11 2\n11 1", "output": "-1\n"}, {"type": "stdin_stdout...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this kata, we want to discover a small property of numbers. \nWe say that a number is a **dd** number if it contains d occurences of a digit d, (d is in [1,9]).\n\n## Examples\n\n* 664444309 is a **dd** number, as it c...
[{"input": "664444309", "output": "[true]", "fn_name": "is_dd"}, {"input": "5023011", "output": "[false]", "fn_name": "is_dd"}, {"input": "9081231", "output": "[false]", "fn_name": "is_dd"}, {"input": "30313", "output": "[true]", "fn_name": "is_dd"}, {"input": "122", "output": "[true]", "fn_name": "is_dd"}]
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are walking through a parkway near your house. The parkway has $n+1$ benches in a row numbered from $1$ to $n+1$ from left to right. The distance between the bench $i$ and $i+1$ is $a_i$ meters.\n\nInitially, you have...
[{"type": "stdin_stdout", "input": "1\n100 7773\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...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nOne day, Taro, who lives in JOI town, decided to take a walk as a daily routine to improve his health. In JOI town, where Taro lives, he runs in the east-west direction as shown in the figure (H + 1). The road ...
[{"type": "stdin_stdout", "input": "3 4 2\n1 -1 1 1\n0 1 1 -2\n0 0 -1 1\n0 0 0", "output": "4 1\n"}, {"type": "stdin_stdout", "input": "3 4 3\n1 0 1 1\n0 1 -1 -1\n1 0 1 1\n0 0 0", "output": "1 5\n"}, {"type": "stdin_stdout", "input": "3 4 3\n1 0 1 1\n0 1 1 -2\n0 0 -1 1\n0 0 0", "output": "1 5\n"}, {"type": "stdin_stdou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSlime has a sequence of positive integers $a_1, a_2, \\ldots, a_n$.\n\nIn one operation Orac can choose an arbitrary subsegment $[l \\ldots r]$ of this sequence and replace all values $a_l, a_{l + 1}, \\ldots, a_r$ to the...
[{"type": "stdin_stdout", "input": "5\n5 3\n1 5 2 6 1\n1 6\n6\n3 2\n1 2 3\n4 3\n3 1 2 3\n10 3\n1 2 3 4 5 6 7 8 9 10\n", "output": "no\nyes\nyes\nno\nyes\n"}, {"type": "stdin_stdout", "input": "5\n5 3\n1 5 2 6 1\n1 6\n6\n3 2\n1 2 3\n4 3\n3 1 2 3\n10 3\n1 2 3 4 8 6 7 8 9 10\n", "output": "no\nyes\nyes\nno\nyes\n"}, {"typ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves.\n\nOne day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its un...
[{"type": "stdin_stdout", "input": "500\n1000\n0", "output": "850\n1520\n"}, {"type": "stdin_stdout", "input": "500\n1100\n0", "output": "850\n1950\n"}, {"type": "stdin_stdout", "input": "500\n2200\n0", "output": "850\n3390"}, {"type": "stdin_stdout", "input": "500\n0000\n-12", "output": "850\n"}, {"type": "stdin_stdou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe famous joke programming language HQ9+ has only 4 commands. In this problem we will explore its subset — a language called HQ...\n\n\n-----Input-----\n\nThe only line of the input is a string between 1 and 10^6 charact...
[{"type": "stdin_stdout", "input": "HQQQQQQQHQQQQHQHQQQHHQHHHQQHQQQQHHQHHQHHHHHHQQQQQQQQHHQQQQQHHQQQQHHHQQQQQQQQHQQQHQHQQQQQQHHHQHHQHQHHQQQQQHQQHQHQQQHQHQHHHHQQHQHQQQQQHQQQHQQQHQQHQHQQHQQQQQQ\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "HQQQQQQQHQQQQHQHQQQHHQHHHQQHQQQQHHQHHQHHHHHHQQQQQQQQHHQQQQQHHQQQQHHHQQ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nReturn the Nth Even Number\n\nThe input will not be 0.\n\nWrite your solution by modifying this code:\n\n```python\ndef nth_even(n):\n\t\n```\n\nYour solution should implemented in the function \"nth_even\". The inputs wi...
[{"input": "1298734", "output": "[2597466]", "fn_name": "nth_even"}, {"input": "100", "output": "[198]", "fn_name": "nth_even"}, {"input": "1", "output": "[0]", "fn_name": "nth_even"}, {"input": "2", "output": "[2]", "fn_name": "nth_even"}, {"input": "3", "output": "[4]", "fn_name": "nth_even"}]
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis problem is same as the next one, but has smaller constraints.\n\nShiro's just moved to the new house. She wants to invite all friends of her to the house so they can play monopoly. However, her house is too small, so...
[{"type": "stdin_stdout", "input": "10\n30518 30518 30518 30518 30518 30518 30518 30518 30518 30518\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "10\n30518 96518 74071 59971 50121 4862 43967 73607 19138 90754\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "10\n63649 14562 779 31060 84730 3390 1402...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are working as a night watchman in an office building. Your task is to check whether all the lights in the building are turned off after all the office workers in the building have left the office. If there are lights...
[{"type": "stdin_stdout", "input": "1 1 1\n0\n2 2 1\n1 1\n1 1\n3 2 1\n1 0 1\n0 1 -1\n3 3 1\n1 0 0\n0 1 0\n1 0 1\n4 4 2\n1 1 0 1\n0 0 0 1\n1 0 1 1\n1 0 0 0\n5 5 1\n1 1 1 0 1\n0 1 0 1 0\n1 0 1 0 1\n0 1 1 1 0\n1 0 1 0 0\n5 1 2\n0 0 0 0 0\n0 0 0 0 0\n0 0 1 0 0\n0 0 0 0 0\n0 0 0 0 1\n11 11 3\n0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem statement\n\nThere is an unsigned $ 2 $ decimal integer $ X $ with $ N $ in digits including Leading-zeros. Output the largest non-negative integer that can be expressed in $ 2 $ base in $ N $ digits where the Ham...
[{"type": "stdin_stdout", "input": "5\n00001\n4", "output": "11111\n"}, {"type": "stdin_stdout", "input": "5\n00000\n3", "output": "11100\n"}, {"type": "stdin_stdout", "input": "5\n00001\n1", "output": "10001\n"}, {"type": "stdin_stdout", "input": "5\n10001\n1", "output": "11001\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two strings $s$ and $t$. The string $s$ consists of lowercase Latin letters and at most one wildcard character '*', the string $t$ consists only of lowercase Latin letters. The length of the string $s$ equal...
[{"type": "stdin_stdout", "input": "5 102\neyw*y\neywsnxcwslfyiqbbeoaawtmioksfdndptxxcwzfmrpcixjbzvicijofjrbcvzaedglifuoczgjlqylddnsvsjfmfsccxbdveqguyfk\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "5 102\neyw*y\neywsnxcwslfyiqbbeoaawtmioksfdndptxxcwzfmrpcixjbzvicijofjrbcvzaedglifuoczgjlqylddnsvsjfmfsccxbdv...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\nACM\n\n\nOutput\n\n0\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 sho...
[{"type": "stdin_stdout", "input": "ABM", "output": "0\n"}, {"type": "stdin_stdout", "input": "BIB", "output": "2\n"}, {"type": "stdin_stdout", "input": "1MI", "output": "1\n"}, {"type": "stdin_stdout", "input": "MCA", "output": "0\n"}, {"type": "stdin_stdout", "input": "MAC", "output": "0\n"}, {"type": "stdin_stdout",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe programming competition season has already started and it's time to train for ICPC. Sereja coaches his teams for a number of year and he knows that to get ready for the training session it's not enough to prepare only...
[{"type": "stdin_stdout", "input": "100\n56 22 13 79 28 73 16 55 34 0 97 19 22 36 22 80 30 19 36 92 9 38 24 10 61 43 19 12 18 34 21 36 1 17 0 97 72 37 74 70 51 34 33 87 27 33 45 97 38 56 2 32 88 92 64 51 74 94 86 98 57 62 83 3 87 61 9 65 57 13 64 10 50 35 7 75 41 3 70 66 6 55 69 42 91 75 14 22 68 93 2 53 22 98 45 2 78 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle penguin Polo loves his home village. The village has n houses, indexed by integers from 1 to n. Each house has a plaque containing an integer, the i-th house has a plaque containing integer p_{i} (1 ≤ p_{i} ≤ n).\n...
[{"type": "stdin_stdout", "input": "1000 8\n", "output": "339760446\n"}, {"type": "stdin_stdout", "input": "1000 1\n", "output": "760074701\n"}, {"type": "stdin_stdout", "input": "1000 2\n", "output": "675678679\n"}, {"type": "stdin_stdout", "input": "1000 3\n", "output": "330155123\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter you had helped George and Alex to move in the dorm, they went to help their friend Fedor play a new computer game «Call of Soldiers 3».\n\nThe game has (m + 1) players and n types of soldiers in total. Players «Call...
[{"type": "stdin_stdout", "input": "13 27 7\n1893\n370\n7320\n5753\n4418\n2146\n2702\n5013\n5959\n1929\n7611\n7013\n540\n3454\n4271\n2887\n4724\n3520\n2111\n5845\n1868\n7659\n3040\n3775\n6507\n4917\n7506\n2515\n", "output": "20\n"}, {"type": "stdin_stdout", "input": "13 27 7\n1893\n370\n7320\n5753\n4418\n2146\n2702\n50...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNowadays the one-way traffic is introduced all over the world in order to improve driving safety and reduce traffic jams. The government of Berland decided to keep up with new trends. Formerly all n cities of Berland were...
[{"type": "stdin_stdout", "input": "50\n30 34 48\n11 30 15\n11 5 179\n4 5 57\n43 4 21\n14 43 74\n14 19 52\n45 19 60\n45 28 52\n24 28 94\n24 26 2\n48 26 34\n48 13 53\n13 42 7\n42 37 23\n37 17 70\n17 7 29\n20 7 93\n33 20 21\n33 2 53\n21 2 83\n49 21 33\n46 49 28\n18 46 1\n36 18 99\n47 36 52\n47 29 41\n41 29 40\n31 41 45\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCatherine received an array of integers as a gift for March 8. Eventually she grew bored with it, and she started calculated various useless characteristics for it. She succeeded to do it for each one she came up with. Bu...
[{"type": "stdin_stdout", "input": "100\n1 2 3 4 5 6 7 15 11 10 11 5 13 14 15 16 17 18 19 20 3 22 23 24 16 26 27 28 29 29 43 32 33 34 35 36 37 38 39 40 41 76 43 44 45 46 47 48 41 50 51 52 53 54 55 97 57 58 59 60 61 62 63 64 65 66 67 68 30 70 71 72 73 74 75 76 77 78 79 80 81 88 83 84 85 86 87 88 265 90 91 92 93 94 95 96...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Petya loves inequations. Help him find n positive integers a1, a2, ..., an, such that the following two conditions are satisfied:\n\n * a12 + a22 + ... + an2 ≥ x\n * a1 + a2 + ... + an ≤ y\n\nInput\n\nThe first l...
[{"type": "stdin_stdout", "input": "45678 783917268558 931068\n", "output": "1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have the `radius` of a circle with the center in point `(0,0)`.\n\nWrite a function that calculates the number of points in the circle where `(x,y)` - the cartesian coordinates of the points - are `integers`.\n\nExamp...
[{"input": "1000", "output": "[3141549]", "fn_name": "points"}, {"input": "99", "output": "[30757]", "fn_name": "points"}, {"input": "55", "output": "[9477]", "fn_name": "points"}, {"input": "33", "output": "[3409]", "fn_name": "points"}, {"input": "42", "output": "[5525]", "fn_name": "points"}, {"input": "15", "output...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two squares, one with sides parallel to the coordinate axes, and another one with sides at 45 degrees to the coordinate axes. Find whether the two squares intersect.\n\nThe interior of the square is consider...
[{"type": "stdin_stdout", "input": "-17 -91 -17 -27 -81 -27 -81 -91\n-48 -21 -12 -57 -48 -93 -84 -57\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "-17 -91 -17 -27 -81 -27 -81 -91\n-48 -21 -12 -57 -48 -93 -84 -57\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "-100 -100 -100 -99 -99 -99 -99 -100\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEvery great chef knows that lucky numbers are positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. \n\nOur chef has rec...
[{"type": "stdin_stdout", "input": "5\n6\n21\n18\n2\n10", "output": "-1\n21\n14\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "5\n9\n2\n14\n2\n25", "output": "-1\n-1\n14\n-1\n21\n"}, {"type": "stdin_stdout", "input": "5\n40\n5\n35\n1\n15", "output": "28\n-1\n35\n-1\n7\n"}, {"type": "stdin_stdout", "input": "5\n40\n5\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nThere is a mysterious device $ M $, and if you put Tanuki and Fox in this device, one animal will come out from the device (hereinafter, Tanuki will be $ T $ and Fox will be $ F $).\n\n$ M (x, y) $ represents a...
[{"type": "stdin_stdout", "input": "3\nF S T", "output": "T\n"}, {"type": "stdin_stdout", "input": "3\nF R T", "output": "T\n"}, {"type": "stdin_stdout", "input": "3\nG S T", "output": "T\n"}, {"type": "stdin_stdout", "input": "3\nG R T", "output": "T\n"}, {"type": "stdin_stdout", "input": "3\nH R T", "output": "T\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer $x$ and an array of integers $a_1, a_2, \\ldots, a_n$. You have to determine if the number $a_1! + a_2! + \\ldots + a_n!$ is divisible by $x!$.\n\nHere $k!$ is a factorial of $k$ — the product of ...
[{"type": "stdin_stdout", "input": "79 6\n2 2 4 3 5 1 2 2 1 5 5 3 2 1 3 4 2 1 2 1 2 2 3 1 6 6 6 3 1 3 6 3 4 5 1 2 2 3 1 5 3 4 1 3 1 3 1 1 5 2 3 3 2 2 3 1 3 5 5 1 1 3 3 4 3 1 5 4 1 4 4 1 3 1 2 1 1 1 1\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "10 5\n4 3 2 1 4 3 2 4 3 4\n", "output": "No\n"}, {"type": "st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGeorge decided to prepare a Codesecrof round, so he has prepared m problems for the round. Let's number the problems with integers 1 through m. George estimates the i-th problem's complexity by integer b_{i}.\n\nTo make t...
[{"type": "stdin_stdout", "input": "29 100\n20 32 41 67 72 155 331 382 399 412 465 644 484 511 515 529 690 637 679 715 733 763 826 843 862 903 276 979 989\n15 15 15 17 18 22 19 20 21 21 22 8 25 26 26 27 28 31 32 32 37 42 38 39 39 40 41 42 43 43 35 45 46 47 49 49 50 50 50 51 52 53 53 55 56 57 24 59 59 60 60 62 62 63 63 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOn vacations n pupils decided to go on excursion and gather all together. They need to overcome the path with the length l meters. Each of the pupils will go with the speed equal to v1. To get to the excursion quickly, it...
[{"type": "stdin_stdout", "input": "10010 1000000000 999999999 1000000000 1\n", "output": "1.0000000009999002\n"}, {"type": "stdin_stdout", "input": "10000 1000000000 999999999 1000000000 10000\n", "output": "1.000000000"}, {"type": "stdin_stdout", "input": "10010 1000000000 1 1000000000 10000\n", "output": "2.99999999...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string s, consisting of small Latin letters. Let's denote the length of the string as |s|. The characters in the string are numbered starting from 1. \n\nYour task is to find out if it is possible to rearr...
[{"type": "stdin_stdout", "input": "xxxxxxxxxxfxxxxxxxxxxxxxxxxxxxxxxxxxxxrxtxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxexxxxmxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxexxxxxxxxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxtxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxuxxxx...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nToday is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A...
[{"type": "stdin_stdout", "input": "2\n101\n010\n1111\n1010\n", "output": "Lucky Chef\n2\nUnlucky Chef\n"}, {"type": "stdin_stdout", "input": "2\n101\n011\n1111\n1010", "output": "Lucky Chef\n1\nUnlucky Chef\n"}, {"type": "stdin_stdout", "input": "2\n001\n111\n1111\n1010", "output": "Lucky Chef\n2\nUnlucky Chef\n"}, {"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSuppose you have two polynomials <image> and <image>. Then polynomial <image> can be uniquely represented in the following way:\n\n<image>\n\nThis can be done using [long division](https://en.wikipedia.org/wiki/Polynomial...
[{"type": "stdin_stdout", "input": "150\n", "output": "150\n1 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 1 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 1 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi has a string S of length N consisting of lowercase English letters. On this string, he will perform the following operation K times:\n\n* Let T be the string obtained by reversing S, and U be the string obtained...
[{"type": "stdin_stdout", "input": "10 2\nbbbabbbaaa", "output": "aaaaaaaaaa\n"}, {"type": "stdin_stdout", "input": "10 3\nbbaabbbaab", "output": "aaaaaaaabb\n"}, {"type": "stdin_stdout", "input": "10 2\nbaabbbaabb", "output": "aaaabbbaab\n"}, {"type": "stdin_stdout", "input": "10 2\nbaabbaaabb", "output": "aaaaaabbbb\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp plans to conduct a load testing of its new project Fakebook. He already agreed with his friends that at certain points in time they will send requests to Fakebook. The load testing will last n minutes and in the ...
[{"type": "stdin_stdout", "input": "100\n9997 9615 4045 2846 7656 2941 2233 9214 837 3312 5832 578 6146 8773 164 7303 3260 8684 1732 6608 9061 9224 7263 7279 1361 1823 8075 5946 2236 6529 6783 7494 510 1217 1135 8745 6517 141 8180 1948 6827 6091 2730 897 1254 705 1990 1806 1957 2571 8355 5542 5536 1527 886 2093 1532 48...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSuppose you are living with two cats: A and B. There are $n$ napping spots where both cats usually sleep.\n\nYour cats like to sleep and also like all these spots, so they change napping spot each hour cyclically:\n\nCat ...
[{"type": "stdin_stdout", "input": "7\n2 1\n2 2\n3 1\n3 2\n3 3\n5 5\n69 1337\n", "output": "\n1\n2\n1\n3\n2\n2\n65\n"}, {"type": "stdin_stdout", "input": "7\n2 1\n2 2\n3 1\n3 2\n3 3\n5 5\n69 1337\n", "output": "1\n2\n1\n3\n2\n2\n65\n"}, {"type": "stdin_stdout", "input": "7\n2 1\n2 2\n3 1\n3 2\n3 3\n5 5\n69 1154\n", "ou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N squares arranged in a row from left to right.\nThe height of the i-th square from the left is H_i.\nYou will land on a square of your choice, then repeat moving to the adjacent square on the right as long as t...
[{"type": "stdin_stdout", "input": "9449\n43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two sequences $a_1, a_2, \\dots, a_n$ and $b_1, b_2, \\dots, b_n$. Each element of both sequences is either $0$, $1$ or $2$. The number of elements $0$, $1$, $2$ in the sequence $a$ is $x_1$, $y_1$, $z_1$ re...
[{"type": "stdin_stdout", "input": "1\n45094381 58629867 47778466\n33028864 48902149 69571701\n", "output": "46602292\n"}, {"type": "stdin_stdout", "input": "1\n45094381 58629867 47778466\n33028864 48902149 69571701\n", "output": "46602292\n"}, {"type": "stdin_stdout", "input": "3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDraw a frame which has a height of H cm and a width of W cm. For example, the following figure shows a frame which has a height of 6 cm and a width of 10 cm.\n\n\n\n........#\n........#\n........#\n........#\n\n\n\nConstr...
[{"type": "stdin_stdout", "input": "5 7\n2 1\n17 12\n0 0", "output": "#######\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\nWrite a program to find the remainder when an integer A is divided by an integer B.\n\n-----Input-----\n\nThe first line contains an integer T, the total number of test cases. Then T lines follow, each line contains two I...
[{"type": "stdin_stdout", "input": "3 \n1 4\n111 1167\n12 36", "output": "1\n111\n12\n"}, {"type": "stdin_stdout", "input": "3 \n1 4\n111 1167\n20 36", "output": "1\n111\n20\n"}, {"type": "stdin_stdout", "input": "3 \n2 4\n111 1167\n20 65", "output": "2\n111\n20\n"}, {"type": "stdin_stdout", "input": "3\n1 2\n100 200\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet there be an array $b_1, b_2, \\ldots, b_k$. Let there be a partition of this array into segments $[l_1; r_1], [l_2; r_2], \\ldots, [l_c; r_c]$, where $l_1 = 1$, $r_c = k$, and for any $2 \\leq i \\leq c$ holds that $r...
[{"type": "stdin_stdout", "input": "30\n1\n0\n2\n0 0\n2\n0 1\n2\n1 0\n1\n1000000000\n2\n1000000000 1000000000\n2\n999999999 1000000000\n2\n1000000000 999999999\n5\n0 1 2 3 4\n5\n4 3 2 1 0\n5\n1 0 0 0 2\n1\n0\n5\n0 0 0 3 0\n1\n1\n1\n0\n1\n0\n1\n1\n2\n2 2\n5\n4 4 5 5 3\n4\n2 1 1 1\n5\n2 1 2 0 2\n1\n0\n1\n0\n4\n0 1 0 0\n2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLucy likes letters. She studied the definition of the lexicographical order at school and plays with it.\n\nAt first, she tried to construct the lexicographically smallest word out of given letters. It was so easy! Then s...
[{"type": "stdin_stdout", "input": "100 1 92\nxwcbimztwcyuckyappbkrddnxgnxqvmobveinzvvnseqxooecwrrdeuwzfzxvfkvguqrsofbbnhfcscxggpxzmruycgqfmnnoovd\n", "output": "a\nb\nb\nb\nb\nb\nc\nc\nc\nc\nc\nc\nc\nd\nd\nd\nd\ne\ne\ne\ne\nf\nf\nf\nf\nf\ng\ng\ng\ng\ng\nh\ni\ni\nk\nk\nk\nm\nm\nm\nm\nn\nn\nn\nn\nn\nn\nn\no\no\no\no\no\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAcacius is studying strings theory. Today he came with the following problem.\n\nYou are given a string $s$ of length $n$ consisting of lowercase English letters and question marks. It is possible to replace question mark...
[{"type": "stdin_stdout", "input": "6\n7\nabacaba\n7\n???????\n11\naba?abaaabc\n11\nabacaba?aba\n15\nrewq???f???fdsa\n11\ncbaaabacaba\n", "output": "yes\nabacaba\nyes\nabacaba\nyes\nabacabaaabc\nyes\nabacabazaba\nno\nyes\ncbaaabacaba\n"}, {"type": "stdin_stdout", "input": "6\n7\nabacaba\n7\n???????\n11\naba?abaaabc\n11...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDue to the increase in the number of students of Berland State University it was decided to equip a new computer room. You were given the task of buying mouses, and you have to spend as little as possible. After all, the ...
[{"type": "stdin_stdout", "input": "37 80 100\n31\n901706521 USB\n555265160 PS/2\n547038505 PS/2\n644436873 PS/2\n105558073 USB\n915082057 PS/2\n913113815 USB\n953413471 PS/2\n252912707 PS/2\n830344497 USB\n781593007 USB\n610659875 PS/2\n177755858 PS/2\n496444729 PS/2\n617569418 USB\n304908147 PS/2\n188649950 PS/2\n705...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Red Kingdom is attacked by the White King and the Black King!\n\nThe Kingdom is guarded by $n$ castles, the $i$-th castle is defended by $a_i$ soldiers. To conquer the Red Kingdom, the Kings have to eliminate all the ...
[{"type": "stdin_stdout", "input": "10\n6 3 4 5\n2 3 2 3 1 3\n1 5 4 3\n10\n4 4 2 3\n0 10 14 5\n2 2 1 4\n8 5\n3 5 3 5\n9 2 10\n4 5 5 5\n2 10 2 2\n2 3 1 4\n1 10\n3 1 5 3\n11 8 7\n2 5 4 5\n8 8\n3 5 1 4\n5 2 10\n", "output": "0\n2\n3\n2\n5\n12\n5\n0\n0\n2\n"}, {"type": "stdin_stdout", "input": "10\n6 3 4 5\n2 3 2 3 1 3\n1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nChef likes rectangles. Among all possible rectangles, he loves rectangles that can be drawn like a grid, such that they have N rows and M columns. Grids are common in Byteland. Hence, Chef has drawn such a rectangle and p...
[{"type": "stdin_stdout", "input": "3\n1 10 2\n4 2 2\n1 9 -2", "output": "2\n1\n-2\n"}, {"type": "stdin_stdout", "input": "3\n2 14 2\n4 2 2\n1 9 -2", "output": "1\n1\n-2\n"}, {"type": "stdin_stdout", "input": "3\n2 18 2\n4 2 3\n1 4 -1", "output": "1\n2\n-1\n"}, {"type": "stdin_stdout", "input": "3\n2 2 1\n3 1 2\n1 5 12...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are just some things you can't do on television. In this case, you've just come back from having a \"delicious\" Barth burger and you're set to give an interview. The Barth burger has made you queezy, and you've for...
[{"input": "\"I don't know if this will work without watering it first.\"", "output": "[\"sludge\"]", "fn_name": "bucket_of"}, {"input": "\"you know what, i don't know what was in that Barth burger\"", "output": "[\"slime\"]", "fn_name": "bucket_of"}, {"input": "\"i'm just going to wash my hands of this\"", "output": "...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is an infinite sequence consisting of all positive integers in the increasing order: p = {1, 2, 3, ...}. We performed n swap operations with this sequence. A swap(a, b) is an operation of swapping the elements of th...
[{"type": "stdin_stdout", "input": "30\n1 200000\n2 199999\n3 199998\n4 199997\n5 199996\n200001 399996\n200002 399997\n200003 399998\n200004 399999\n200005 400000\n400001 599998\n400002 599999\n400003 600000\n400004 599996\n400005 599995\n600001 800000\n600002 799999\n600003 799998\n600004 799997\n600005 799996\n60000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have a garden consisting entirely of grass and weeds. Your garden is described by an n × m grid, with rows numbered 1 to n from top to bottom, and columns 1 to m from left to right. Each cell is identified by a pair (...
[{"type": "stdin_stdout", "input": "3 150\nGGGWGGGGWWGGGGGGGGGGGGGWGGWGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGWGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGWGGGGGGGWGGGGGGGGGGGGGGGGGWGGGGGGGGGGGGGGGGGGW\nGGGGGGGGGGGGWGGGGGGGGGWGGGGGGGGGGGGWGGGGGWGGGGGGGWGGGGGGGWGGGGGWGGGGGGGGGGGGGGGGGGGGGGGGWGGGGWGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n<image>\n\nInput\n\nThe input contains two integers row, col (0 ≤ row, col ≤ 63), separated by a single space.\n\nOutput\n\nOutput \"IN\" or \"OUT\".\n\nExamples\n\nInput\n\n\n0 0\n\n\nOutput\n\n\nOUT\n\n\nInput\n\n\n27 0...
[{"type": "stdin_stdout", "input": "27 36\n", "output": "OUT\n"}, {"type": "stdin_stdout", "input": "0 45\n", "output": "OUT\n"}, {"type": "stdin_stdout", "input": "53 27\n", "output": "IN\n"}, {"type": "stdin_stdout", "input": "0 18\n", "output": "OUT\n"}, {"type": "stdin_stdout", "input": "51 1\n", "output": "OUT\n"}...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGildong has a square board consisting of n rows and n columns of square cells, each consisting of a single digit (from 0 to 9). The cell at the j-th column of the i-th row can be represented as (i, j), and the length of t...
[{"type": "stdin_stdout", "input": "5\n3\n000\n122\n101\n2\n57\n75\n4\n0123\n5469\n3401\n2340\n1\n9\n8\n42987101\n91120855\n77861569\n87599023\n92834718\n83917348\n19823743\n38947912\n", "output": "4 4 1 0 0 0 0 0 0 0\n0 0 0 0 0 1 0 1 0 0\n9 6 9 9 4 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n18 49 49 49 49 30 15 35 42 42\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads an integer n and identifies the number of combinations of a, b, c and d (0 ≤ a, b, c, d ≤ 9) which meet the following equality:\n\na + b + c + d = n\n\nFor example, for n = 35, we have 4 differ...
[{"type": "stdin_stdout", "input": "35\n011", "output": "4\n348\n"}, {"type": "stdin_stdout", "input": "35\n010", "output": "4\n282\n"}, {"type": "stdin_stdout", "input": "35\n15", "output": "4\n592\n"}, {"type": "stdin_stdout", "input": "35\n26", "output": "4\n282\n"}, {"type": "stdin_stdout", "input": "35\n13", "outp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nJamie is preparing a Codeforces round. He has got an idea for a problem, but does not know how to solve it. Help him write a solution to the following problem:\n\nFind k integers such that the sum of two to the power of e...
[{"type": "stdin_stdout", "input": "10 19228\n", "output": "Yes\n-10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe committee members of the Kitoshima programming contest had decided to use crypto-graphic software for their secret communication. They had asked a company, Kodai Software, to develop cryptographic software that employ...
[{"type": "stdin_stdout", "input": "4\nA\nAMD\nCAT\nDOG\nZ XUW ZVX Z YZT.\n2\nZA\nAY\nZA.\n2\n@A\nBB\nCC.\n16\nA\nB\nC\nD\nE\nF\nG\nH\nI\nJ\nK\nL\nM\nN\nO\nONMLKJIHGFEDCBA\nA B C D E F G H I J K L M N O ABCDEFGHIJKLMNO.\n0", "output": "A DOG AMD A CAT.\nZA.\nBB.\nO N M L K J I H G F E D C B A ONMLKJIHGFEDCBA.\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA penguin Rocher has $n$ sticks. He has exactly one stick with length $i$ for all $1 \\le i \\le n$.\n\nHe can connect some sticks. If he connects two sticks that have lengths $a$ and $b$, he gets one stick with length $a...
[{"type": "stdin_stdout", "input": "4\n1\n2\n3\n20\n", "output": "1\n1\n2\n10\n"}, {"type": "stdin_stdout", "input": "4\n1\n3\n3\n20\n", "output": "1\n2\n2\n10\n"}, {"type": "stdin_stdout", "input": "4\n3\n2\n12\n15\n", "output": "2\n1\n6\n8\n"}, {"type": "stdin_stdout", "input": "4\n1\n3\n1\n20\n", "output": "1\n2\n1\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFind the longest substring in alphabetical order.\n\nExample: the longest alphabetical substring in `\"asdfaaaabbbbcttavvfffffdf\"` is `\"aaaabbbbctt\"`.\n\nThere are tests with strings up to `10 000` characters long so y...
[{"input": "\"asdfaaaabbbbcttavvfffffdf\"", "output": "[\"aaaabbbbctt\"]", "fn_name": "longest"}, {"input": "\"asdfbyfgiklag\"", "output": "[\"fgikl\"]", "fn_name": "longest"}, {"input": "\"abcdeapbcdef\"", "output": "[\"abcde\"]", "fn_name": "longest"}, {"input": "\"asd\"", "output": "[\"as\"]", "fn_name": "longest"},...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nPak Chanek has a grid that has $N$ rows and $M$ columns. Each row is numbered from $1$ to $N$ from top to bottom. Each column is numbered from $1$ to $M$ from left to right.\n\nEach tile in the grid contains a number. The...
[{"type": "stdin_stdout", "input": "1000000000 1000000000\n", "output": "999999999000000000\n"}, {"type": "stdin_stdout", "input": "767928735 1000000000\n", "output": "767928734232071265\n"}, {"type": "stdin_stdout", "input": "1000000000 906523442\n", "output": "906523441000000000\n"}, {"type": "stdin_stdout", "input":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA brave princess in a poor country's tomboy is married to another country for a political marriage. However, a villain who is trying to kill the princess is releasing a thug on the way to his wife.\n\nYou have already dec...
[{"type": "stdin_stdout", "input": "3 2 10\n1 2 13 6\n2 3 10 3\n3 2 10\n1 2 3 16\n2 3 9 7\n3 3 10\n1 3 17 6\n1 2 2 4\n2 3 9 19\n4 4 5\n1 3 13 5\n1 4 7 25\n2 3 8 2\n2 4 9 3\n0 0 0", "output": "6\n7\n4\n10\n"}, {"type": "stdin_stdout", "input": "3 2 10\n1 2 8 5\n2 3 10 0\n3 2 10\n1 2 3 8\n2 3 7 7\n3 3 10\n1 3 17 6\n1 2 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIvan unexpectedly saw a present from one of his previous birthdays. It is array of n numbers from 1 to 200. Array is old and some numbers are hard to read. Ivan remembers that for all elements at least one of its neighbou...
[{"type": "stdin_stdout", "input": "37\n52 52 66 149 149 130 47 47 26 110 185 -1 73 73 65 -1 -1 130 -1 -1 -1 94 97 190 -1 -1 49 49 54 -1 92 92 5 25 48 79 79\n", "output": "903952722\n"}, {"type": "stdin_stdout", "input": "37\n52 52 66 149 149 130 47 47 17 110 185 -1 73 73 65 -1 -1 130 -1 -1 -1 94 97 190 -1 -1 49 49 54 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDreamoon likes sequences very much. So he created a problem about the sequence that you can't find in OEIS: \n\nYou are given two integers $d, m$, find the number of arrays $a$, satisfying the following constraints: The ...
[{"type": "stdin_stdout", "input": "10\n1 1000000000\n2 999999999\n3 39238314\n2 14233839\n3 1308869\n6 99995\n13 14099\n8 474\n9 146\n10 2\n", "output": "1\n3\n5\n3\n5\n23\n209\n59\n89\n1\n"}, {"type": "stdin_stdout", "input": "10\n1 1000000000\n2 999999999\n3 99999998\n4 9999997\n5 999996\n6 99995\n7 9994\n12 993\n15...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHamming distance between strings a and b of equal length (denoted by h(a, b)) is equal to the number of distinct integers i (1 ≤ i ≤ |a|), such that ai ≠ bi, where ai is the i-th symbol of string a, bi is the i-th symbol ...
[{"type": "stdin_stdout", "input": "5728 5729 5750\n5631 5768\n9163\n", "output": "10321\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle girl Margarita is a big fan of competitive programming. She especially loves problems about arrays and queries on them.\n\nRecently, she was presented with an array $a$ of the size of $10^9$ elements that is filled...
[{"type": "stdin_stdout", "input": "10\n449347852 741090797\n541919355 938202256\n442458747 465872502\n463474612 789217678\n146477812 390217056\n302933612 477640295\n48191125 1417399529\n173202385 374432789\n78807265 428215825\n194590462 1318087870\n", "output": "-145871473\n198141451\n11706878\n626346145\n268347434\n-...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have A apples and P pieces of apple.\nWe can cut an apple into three pieces of apple, and make one apple pie by simmering two pieces of apple in a pan.\nFind the maximum number of apple pies we can make with what we ha...
[{"type": "stdin_stdout", "input": "100 100\n", "output": "200\n"}, {"type": "stdin_stdout", "input": "1052 1", "output": "1578\n"}, {"type": "stdin_stdout", "input": "1829 1", "output": "2744\n"}, {"type": "stdin_stdout", "input": "3156 1", "output": "4734\n"}, {"type": "stdin_stdout", "input": "1450 1", "output": "21...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe want to encode a given string $S$ to a binary string. Each alphabet character in $S$ should be mapped to a different variable-length code and the code must not be a prefix of others.\n\nHuffman coding is known as one o...
[{"type": "stdin_stdout", "input": "aaabbcccdeeegfg", "output": "41\n"}, {"type": "stdin_stdout", "input": "aaadbcccbeedgfg", "output": "42\n"}, {"type": "stdin_stdout", "input": "gegdeebcccbeaaa", "output": "38\n"}, {"type": "stdin_stdout", "input": "aeaaacccbeedgeg", "output": "36\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMost football fans love it for the goals and excitement. Well, this Kata doesn't.\nYou are to handle the referee's little notebook and count the players who were sent off for fouls and misbehavior.\n\nThe rules:\nTwo team...
[{"input": "[\"A4R\", \"A2R\", \"A3R\", \"A6R\", \"A8R\", \"A10R\", \"A11R\"]", "output": "[[6, 11]]", "fn_name": "men_still_standing"}, {"input": "[\"A4Y\", \"A5R\", \"B5R\", \"A4Y\", \"B6Y\"]", "output": "[[9, 10]]", "fn_name": "men_still_standing"}, {"input": "[\"A4R\", \"A4R\", \"A4R\"]", "output": "[[10, 11]]", "f...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are three horses living in a horse land: one gray, one white and one gray-and-white. The horses are really amusing animals, which is why they adore special cards. Each of those cards must contain two integers, the f...
[{"type": "stdin_stdout", "input": "10 10\n4 8 4 10 2 10 8 10 4 6\n", "output": " 25\n"}, {"type": "stdin_stdout", "input": "10 10\n9 3 6 6 3 3 6 3 6 9\n", "output": " 25\n"}, {"type": "stdin_stdout...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya organized a strange birthday party. He invited $n$ friends and assigned an integer $k_i$ to the $i$-th of them. Now Petya would like to give a present to each of them. In the nearby shop there are $m$ unique present...
[{"type": "stdin_stdout", "input": "6\n6 6\n2 3 1 5 6 6\n629717071 992393438 995305242 999968259 999970082 999971487\n6 6\n2 5 2 2 4 3\n756869732 979591024 993778447 1268827656 999873038 999943064\n6 6\n5 1 4 5 6 4\n733550952 979779220 979918868 983712198 991976436 995169050\n6 6\n4 2 2 3 2 4\n257971677 920812339 98100...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis is an interactive problem.\n\nImur Ishakov decided to organize a club for people who love to play the famous game «The hat». The club was visited by n students, where n is even. Imur arranged them all in a circle and...
[{"type": "stdin_stdout", "input": "100\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis is a spin off of my first [kata](http://www.codewars.com/kata/56bc28ad5bdaeb48760009b0). You are given a list of character sequences as a comma separated string. Write a function which returns another string containi...
[{"input": "\"1,2,3,4\"", "output": "[\"2 3\"]", "fn_name": "array"}, {"input": "\"1, 3\"", "output": "[null]", "fn_name": "array"}, {"input": "\"1,2,3\"", "output": "[\"2\"]", "fn_name": "array"}, {"input": "\"1\"", "output": "[null]", "fn_name": "array"}, {"input": "\"\"", "output": "[null]", "fn_name": "array"}]
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nE: Jam\n\nproblem\n\nThere are N cities in a country, numbered 1, \\ 2, \\ ..., \\ N. These cities are connected in both directions by M roads, and the i-th road allows you to travel between the cities u_i and v_i in time...
[{"type": "stdin_stdout", "input": "4 4 3\n3 12 1 6\n1 1 2 3\n10 1 9 5\n1 2 1\n2 3 1\n1 3 1\n1 4 1", "output": "20\n18\n13\n"}, {"type": "stdin_stdout", "input": "4 4 3\n3 12 1 6\n1 1 2 3\n10 1 9 5\n1 2 0\n2 3 1\n1 3 1\n1 4 1", "output": "22\n19\n15\n"}, {"type": "stdin_stdout", "input": "4 4 3\n3 12 1 6\n1 1 2 3\n10 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRemainder of Big Integers\n\nGiven two integers $A$ and $B$, compute the remainder of $\\frac{A}{B}$.\n\nInput\n\nTwo integers $A$ and $B$ separated by a space character are given in a line.\n\nOutput\n\nPrint the remaind...
[{"type": "stdin_stdout", "input": "10 16", "output": "10\n"}, {"type": "stdin_stdout", "input": "11 12", "output": "11\n"}, {"type": "stdin_stdout", "input": "12 47", "output": "12\n"}, {"type": "stdin_stdout", "input": "14 28", "output": "14\n"}, {"type": "stdin_stdout", "input": "18 11", "output": "7\n"}, {"type": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA triangle is called an equable triangle if its area equals its perimeter. Return `true`, if it is an equable triangle, else return `false`. You will be provided with the length of sides of the triangle. Happy Coding!\n\n...
[{"input": "120\n109\n13", "output": "[false]", "fn_name": "equable_triangle"}, {"input": "17\n17\n30", "output": "[false]", "fn_name": "equable_triangle"}, {"input": "25\n25\n45", "output": "[false]", "fn_name": "equable_triangle"}, {"input": "13\n37\n30", "output": "[false]", "fn_name": "equable_triangle"}, {"input":...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp has an array $a$ consisting of $n$ integers.\n\nHe wants to play a game with this array. The game consists of several moves. On the first move he chooses any element and deletes it (after the first move the array...
[{"type": "stdin_stdout", "input": "2\n1000000 1000000\n", "output": "1000000\n"}, {"type": "stdin_stdout", "input": "2\n1000010 1001000\n", "output": "1000010\n"}, {"type": "stdin_stdout", "input": "2\n1000110 1001000\n", "output": "1000110\n"}, {"type": "stdin_stdout", "input": "2\n1000110 1000000\n", "output": "1000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nToday s kilometer long auto race takes place in Berland. The track is represented by a straight line as long as s kilometers. There are n cars taking part in the race, all of them start simultaneously at the very beginnin...
[{"type": "stdin_stdout", "input": "9 81812\n8 31 410 547 18 22 77 449 5 491 8 10 382 746 21 61 523\n1 452 181\n1 724 113\n1 113 724\n1 226 362\n46 5 257 2 126 373 6 6 491 9 7 137 23 93 73 163 13 17 106 3 100 5 415 270 2 7 723 597 4 176 3 274 18 1 852 334 14 7 25 163 1 3 199 29 140 32 32 191 2 583 3 23 11 22 23 250 1 7...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou all know the Dirichlet principle, the point of which is that if n boxes have no less than n + 1 items, that leads to the existence of a box in which there are at least two items.\n\nHaving heard of that principle, but...
[{"type": "stdin_stdout", "input": "10000 1 1000000000\n", "output": "Masha\n\n"}, {"type": "stdin_stdout", "input": "1010 1 1000000000\n", "output": "Masha\n\n"}, {"type": "stdin_stdout", "input": "2635 2 1000000000\n", "output": "Masha\n\n"}, {"type": "stdin_stdout", "input": "1 30 1000000000\n", "output": "Missing\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasily the bear has a favorite rectangle, it has one vertex at point (0, 0), and the opposite vertex at point (x, y). Of course, the sides of Vasya's favorite rectangle are parallel to the coordinate axes. \n\nVasya also ...
[{"type": "stdin_stdout", "input": "-1000000000 -1000000000\n", "output": "-2000000000 0 0 -2000000000\n"}, {"type": "stdin_stdout", "input": "-1000000000 -1000000000\n", "output": "-2000000000 0 0 -2000000000 "}, {"type": "stdin_stdout", "input": "-1000000000 -999999999\n", "output": "-1999999999 0 0 -1999999999\n"}, ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBerland, 2016. The exchange rate of currency you all know against the burle has increased so much that to simplify the calculations, its fractional part was neglected and the exchange rate is now assumed to be an integer....
[{"type": "stdin_stdout", "input": "4314752277691991627730686134692292422155753465948025897701703862445837045929984759093775762579123919\n", "output": "9314752277691991627730686134692292422155753465948025897701703862445837045929984759093775762579123914\n"}, {"type": "stdin_stdout", "input": "431475227769199162773068613...
code_stdio