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 renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled \"Special Olympics\". He justly thought that, if the regular Olympic games have five rings, then the Special ones wil... | [{"type": "stdin_stdout", "input": "-100 -97 20 40\n-151 -97 30 100\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "-123 -29 20 40\n-39 -19 99 100\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "-100 -97 20 40\n-90 -97 30 100\n", "output": "2"}, {"type": "stdin_stdout", "input": "-45 -93 20 40\n-36 -9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFennec and Snuke are playing a board game.\nOn the board, there are N cells numbered 1 through N, and N-1 roads, each connecting two cells. Cell a_i is adjacent to Cell b_i through the i-th road. Every cell can be reached... | [{"type": "stdin_stdout", "input": "7\n3 6\n1 2\n3 1\n7 4\n5 7\n1 4\n", "output": "Fennec\n"}, {"type": "stdin_stdout", "input": "7\n3 6\n2 2\n3 1\n7 4\n5 7\n1 4", "output": "Fennec\n"}, {"type": "stdin_stdout", "input": "7\n3 6\n2 2\n3 1\n7 4\n4 7\n1 4", "output": "Fennec\n"}, {"type": "stdin_stdout", "input": "7\n3 6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider the following equation: \n\n<image> where sign [a] represents the integer part of number a.\n\nLet's find all integer z (z > 0), for which this equation is unsolvable in positive integers. The phrase \"unsolvable... | [{"type": "stdin_stdout", "input": "14\n", "output": " 373391776\n"}, {"type": "stdin_stdout", "input": "38\n", "output": " 90046024\n"}, {"type": "stdin_stdout", "input": "25\n", "output": " ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem statement\n\nThere is a rational number sequence $ X_0, X_1, X_2, ..., X_N $. Each term is defined as follows.\n\n\n1. $ X_0 = 0 $\n2. $ X_i = X_ {i-1} $ $ op_i $ $ Y_i $ ($ 1 \\ leq i \\ leq N $). However, $ op_i... | [{"type": "stdin_stdout", "input": "4\n-1 2\n12 0\n1 -3\n3 13", "output": "-39\n"}, {"type": "stdin_stdout", "input": "4\n-2 4\n7 1\n-1 8\n2 25", "output": "-25\n"}, {"type": "stdin_stdout", "input": "4\n-1 -2\n2 3\n3 2\n2 22", "output": "-28\n"}, {"type": "stdin_stdout", "input": "4\n-1 -2\n2 5\n3 2\n2 22", "output": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMarcin is a coach in his university. There are $n$ students who want to attend a training camp. Marcin is a smart coach, so he wants to send only the students that can work calmly with each other.\n\nLet's focus on the st... | [{"type": "stdin_stdout", "input": "10\n206158430208 206162624513 68719476737 137506062337 206162624513 4194305 68719476737 206225539072 137443147777 109376694609\n202243898 470292528 170057449 290025540 127995253 514454151 607963029 768676450 611202521 68834463\n", "output": "2704208829\n"}, {"type": "stdin_stdout", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOnce upon a time in the Kingdom of Far Far Away lived Sam the Farmer. Sam had a cow named Dawn and he was deeply attached to her. Sam would spend the whole summer stocking hay to feed Dawn in winter. Sam scythed hay and p... | [{"type": "stdin_stdout", "input": "1256336691\n", "output": "2931452299 10050693537\n"}, {"type": "stdin_stdout", "input": "1359531323\n", "output": "6797656627 10876250593\n"}, {"type": "stdin_stdout", "input": "1544906479\n", "output": "1581910903 12359251841\n"}, {"type": "stdin_stdout", "input": "1278463385\n", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently, on the course of algorithms and data structures, Valeriy learned how to use a deque. He built a deque filled with $n$ elements. The $i$-th element is $a_i$ ($i$ = $1, 2, \\ldots, n$). He gradually takes the firs... | [{"type": "stdin_stdout", "input": "71 57\n9 26 80 2 65 60 63 1 15 109 114 1 58 27 41 97 42 9 42 56 87 22 10 28 34 90 13 70 71 56 65 21 0 78 47 96 56 77 32 83 28 16 10 41 0 18 118 12 27 112 4 67 21 41 111 20 21 52 74 10 83 74 43 123 2 15 0 63 68 7 72\n81\n47\n81\n81\n5\n9\n41\n76\n81\n92\n95\n94\n78\n93\n47\n30\n152\n3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a function which takes a number and returns the corresponding ASCII char for that value.\n\nExample: \n\n~~~if-not:java,racket\n```\nget_char(65) # => 'A'\n```\n~~~\n~~~if:java\n~~~\n~~~if:racket\n~~~\n\nFor ASCII t... | [{"input": "34", "output": "[\"\\\"\"]", "fn_name": "get_char"}, {"input": "65", "output": "[\"A\"]", "fn_name": "get_char"}, {"input": "33", "output": "[\"!\"]", "fn_name": "get_char"}, {"input": "35", "output": "[\"#\"]", "fn_name": "get_char"}, {"input": "36", "output": "[\"$\"]", "fn_name": "get_char"}, {"input": "... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are an environmental activist at heart but the reality is harsh and you are just a cashier in a cinema. But you can still do something!\n\nYou have n tickets to sell. The price of the i-th ticket is p_i. As a teller, ... | [{"type": "stdin_stdout", "input": "4\n1\n100\n50 2\n49 1\n100\n8\n100 200 100 200 100 200 100 100\n16 2\n15 3\n107\n3\n1000000000 1000000000 1000000000\n50 1\n50 1\n4850788900\n5\n200 100 100 100 100\n105 5\n31 1\n90\n", "output": "-1\n6\n-1\n2\n"}, {"type": "stdin_stdout", "input": "4\n1\n100\n50 2\n49 1\n100\n8\n100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. \n\nYou immediately decided to take a vac... | [{"type": "stdin_stdout", "input": "48 14\n1 1 1 1 1 6 1 1 1 1 1 1 3 3 1 1 1 1 1 2 2 2 1 1 1 1 1 1 2 1 4 1 1 1 1 1 1 1 1 1 1 7 1 1 1 1 1 5\n", "output": "42\n"}, {"type": "stdin_stdout", "input": "48 14\n1 1 1 1 1 6 1 1 1 1 1 1 3 3 1 1 2 1 1 2 2 2 1 1 1 1 1 1 2 1 4 1 1 1 1 1 1 1 1 1 1 7 1 1 1 1 1 5\n", "output": "42\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nImagine that there is a group of three friends: A, B and С. A owes B 20 rubles and B owes C 20 rubles. The total sum of the debts is 40 rubles. You can see that the debts are not organized in a very optimal manner. Let's ... | [{"type": "stdin_stdout", "input": "100 48\n1 56 6\n2 42 3\n3 52 1\n9 26 8\n10 96 8\n11 39 2\n12 51 6\n12 68 7\n13 40 5\n14 18 10\n14 70 6\n15 37 8\n15 38 8\n15 82 6\n15 85 5\n16 48 3\n16 50 9\n16 71 9\n17 18 3\n17 100 10\n20 73 3\n22 32 9\n22 89 9\n23 53 3\n24 53 1\n27 78 10\n30 50 5\n33 94 8\n34 87 9\n35 73 3\n36 51 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N Snuke Cats numbered 1, 2, \\ldots, N, where N is even.\nEach Snuke Cat wears a red scarf, on which his favorite non-negative integer is written.\nRecently, they learned the operation called xor (exclusive OR).... | [{"type": "stdin_stdout", "input": "4\n141 1 -1 2", "output": "-4 -144 142 -141\n"}, {"type": "stdin_stdout", "input": "4\n102 2 -1 2", "output": "-1 -101 102 -101\n"}, {"type": "stdin_stdout", "input": "4\n102 2 -1 1", "output": "-4 -104 101 -101\n"}, {"type": "stdin_stdout", "input": "4\n13 -17 0 0", "output": "-17 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSomething happened in Uzhlyandia again... There are riots on the streets... Famous Uzhlyandian superheroes Shean the Sheep and Stas the Giraffe were called in order to save the situation. Upon the arriving, they found tha... | [{"type": "stdin_stdout", "input": "100\n23 64 60 -45 -36 -64 -59 15 -75 69 -30 -7 -20 17 -77 58 93 -76 -98 -22 -31 16 -50 6 -20 -85 1 64 -88 -8 -15 -6 -57 25 91 10 2 -90 74 -66 -42 73 28 49 -85 59 96 79 -25 49 -59 -89 -75 12 -96 -33 -65 -8 -100 -81 17 99 -91 -5 7 -21 1 85 63 86 -26 85 -31 11 -75 35 -82 15 98 93 -55 66... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRamesses came to university to algorithms practice, and his professor, who is a fairly known programmer, gave him the following task.\n\nYou are given two matrices $A$ and $B$ of size $n \\times m$, each of which consists... | [{"type": "stdin_stdout", "input": "10 10\n1 1 1 0 1 1 0 0 0 1\n1 1 1 1 0 0 0 0 0 1\n0 1 0 0 0 0 0 0 1 0\n0 0 0 0 0 1 0 0 0 0\n0 1 1 1 0 1 1 1 0 0\n0 0 0 1 1 1 0 1 0 0\n0 0 0 0 1 1 0 0 1 1\n0 0 0 1 1 0 1 1 1 1\n1 1 0 1 1 0 1 1 0 0\n1 0 0 0 0 0 0 0 1 0\n0 1 0 1 0 1 1 1 0 0\n0 1 1 0 0 0 0 0 0 1\n0 1 0 0 0 1 0 0 0 0\n0 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNew Year is coming in Tree World! In this world, as the name implies, there are n cities connected by n - 1 roads, and for any two distinct cities there always exists a path between them. The cities are numbered by intege... | [{"type": "stdin_stdout", "input": "10\n1 2 938\n1 6 23\n1 10 727\n1 9 814\n9 5 644\n8 5 39\n2 7 999\n1 3 666\n5 4 577\n10\n9 1099\n5 64\n4 318\n3 373\n4 548\n7 219\n5 43\n5 27\n3 155\n8 359\n", "output": "5336.333333333333\n4524.333333333333\n3730.733333333333\n3518.3333333333335\n3886.3333333333335\n3418.333333333333... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn March 14, the day of the number $\\pi$ is celebrated all over the world. This is a very important mathematical constant equal to the ratio of the circumference of a circle to its diameter.\n\nPolycarp was told at schoo... | [{"type": "stdin_stdout", "input": "9\n000\n3\n4141592653\n141592653589793238462643383279\n31420\n31415\n314159265358\n27182\n314159265358979323846264338327\n", "output": "0\n1\n0\n0\n3\n5\n12\n0\n30\n"}, {"type": "stdin_stdout", "input": "3\n314\n315\n314\n", "output": "3\n2\n3\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nShubham has an array $a$ of size $n$, and wants to select exactly $x$ elements from it, such that their sum is odd. These elements do not have to be consecutive. The elements of the array are not guaranteed to be distinct... | [{"type": "stdin_stdout", "input": "4\n3 1\n16 11 12\n10 3\n13 12 9 1 9 8 4 19 16 19\n3 2\n3 2 6\n9 7\n11 14 1 6 3 12 3 20 16\n", "output": "Yes\nYes\nYes\nYes\n"}, {"type": "stdin_stdout", "input": "4\n3 1\n16 11 12\n10 3\n13 12 9 1 9 8 4 19 16 19\n3 2\n3 2 6\n9 7\n11 14 1 6 3 12 3 20 16\n", "output": "YES\nYES\nYES\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis problem consists of three subproblems: for solving subproblem C1 you will receive 4 points, for solving subproblem C2 you will receive 4 points, and for solving subproblem C3 you will receive 8 points.\n\nManao decid... | [{"type": "stdin_stdout", "input": "40 3\n1 62395\n5 40319\n4 165445\n10 137479\n10 47829\n8 9741\n5 148106\n10 25494\n10 162856\n2 106581\n0 194523\n9 148086\n1 100862\n6 147600\n6 107486\n6 166873\n7 16721\n4 22192\n0 8827\n1 197146\n10 8949\n0 150443\n9 148348\n3 143935\n1 139371\n7 128821\n10 107760\n4 141821\n1 35... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWith the motto \"Creating your own path,\" a shrine created a fortune-telling fortune with its own hands. Ask the person who draws the lottery to throw six stones first, then the line segment connecting the first and seco... | [{"type": "stdin_stdout", "input": "-1 -2 9 6\n3 -2 7 6\n-1 0 9 0\n2 2 0 -1\n1 2 2 0\n-3 -1 3 1\n0 0 0 0", "output": "syo-kichi\nsyo-kichi\n"}, {"type": "stdin_stdout", "input": "-1 -2 22 6\n3 -2 7 10\n-1 0 9 0\n3 2 0 -1\n1 1 2 1\n-3 -1 3 1\n0 0 0 0", "output": "syo-kichi\nkyo\n"}, {"type": "stdin_stdout", "input": "-1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a 4-character string S consisting of uppercase English letters.\nDetermine if S consists of exactly two kinds of characters which both appear twice in S.\n\n-----Constraints-----\n - The length of S is 4.\n ... | [{"type": "stdin_stdout", "input": "ASSA\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "FFEE\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "AVVA\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "HHTT\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "ILIL\n", "output": "Yes\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nUnlike Knights of a Round Table, Knights of a Polygonal Table deprived of nobility and happy to kill each other. But each knight has some power and a knight can kill another knight if and only if his power is greater than... | [{"type": "stdin_stdout", "input": "11 10\n1 2 3 4 5 6 7 8 9 10 11\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n", "output": "1000000000 2000000000 3000000000 4000000000 5000000000 6000000000 7000000000 8000000000 9000000000 10000000000 11000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a tree T with N vertices, numbered 1 through N. For each 1 ≤ i ≤ N - 1, the i-th edge connects vertices a_i and b_i.\n\nSnuke is constructing a directed graph T' by arbitrarily assigning direction to each edge in... | [{"type": "stdin_stdout", "input": "10\n2 4\n2 5\n8 3\n10 7\n1 7\n2 8\n9 10\n8 6\n10 8", "output": "220\n"}, {"type": "stdin_stdout", "input": "10\n1 4\n2 5\n1 3\n10 1\n1 6\n4 8\n9 8\n7 10\n10 2", "output": "122\n"}, {"type": "stdin_stdout", "input": "10\n2 4\n2 5\n2 3\n10 7\n1 6\n2 10\n9 5\n8 7\n10 6", "output": "194\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn this Kata, you will be given a string that has lowercase letters and numbers. Your task is to compare the number groupings and return the largest number. Numbers will not have leading zeros. \n\nFor example, `solve(\"g... | [{"input": "\"gh12cdy695m1\"", "output": "[695]", "fn_name": "solve"}, {"input": "\"vih61w8oohj5\"", "output": "[61]", "fn_name": "solve"}, {"input": "\"f7g42g16hcu5\"", "output": "[42]", "fn_name": "solve"}, {"input": "\"2ti9iei7qhr5\"", "output": "[9]", "fn_name": "solve"}, {"input": "\"lu1j8qbbb85\"", "output": "[85... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt's the most hotly anticipated game of the school year - Gryffindor vs Slytherin! Write a function which returns the winning team. \n\nYou will be given two arrays with two values. \n\nThe first given value is the number... | [{"input": "[100, \"yes\"]\n[100, \"no\"]", "output": "[\"Gryffindor wins!\"]", "fn_name": "game_winners"}, {"input": "[350, \"no\"]\n[250, \"yes\"]", "output": "[\"Slytherin wins!\"]", "fn_name": "game_winners"}, {"input": "[100, \"yes\"]\n[250, \"no\"]", "output": "[\"It's a draw!\"]", "fn_name": "game_winners"}, {"i... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs you very well know, the whole Universe traditionally uses three-dimensional Cartesian system of coordinates. In this system each point corresponds to three real coordinates (x, y, z). In this coordinate system, the dis... | [{"type": "stdin_stdout", "input": "1\n1000 1010 1000\n", "output": "0.33222591362126247 0.33554817275747506 0.33222591362126247\n"}, {"type": "stdin_stdout", "input": "1\n1000 1011 1000\n", "output": "0.33211557622052473 0.33576884755895053 0.33211557622052473\n"}, {"type": "stdin_stdout", "input": "1000\n1319 1000 99... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRational numbers are numbers represented by ratios of two integers. For a prime number p, one of the elementary theorems in the number theory is that there is no rational number equal to √p. Such numbers are called irrati... | [{"type": "stdin_stdout", "input": "2 10\n5 10\n19 111\n0 0", "output": "10/7 7/5\n9/4 2/1\n109/25 61/14\n"}, {"type": "stdin_stdout", "input": "11 5\n10 10\n5 100\n0 0", "output": "4/1 3/1\n10/3 3/1\n85/38 38/17\n"}, {"type": "stdin_stdout", "input": "2 5\n3 14\n26 111\n0 0", "output": "3/2 4/3\n7/4 12/7\n51/10 107/21... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA lighthouse keeper Peter commands an army of $n$ battle lemmings. He ordered his army to stand in a line and numbered the lemmings from $1$ to $n$ from left to right. Some of the lemmings hold shields. Each lemming canno... | [{"type": "stdin_stdout", "input": "80\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 1 0 0 0 0 0 0 0 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\n", "output": "1776 1805 1832 1857 1880 1901 1920 1937 1953 1967 1980 1991 2001 2009 2016 2021 2025 2027 2028 2028 2028 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nChef's new hobby is painting, but he learned the fact that it's not easy to paint 2D pictures in a hard way, after wasting a lot of canvas paper, paint and of course time. From now on, he decided to paint 1D pictures only... | [{"type": "stdin_stdout", "input": "3\n4\n1 5 5 5\n4\n1 1 1 5\n3\n5 5 2\n\n", "output": "Yes\nYes\nNo\n"}, {"type": "stdin_stdout", "input": "3\n4\n1 6 4 -2\n0\n0 9 -1 10\n0\n-1 3 6", "output": "No\nNo\nNo\n"}, {"type": "stdin_stdout", "input": "3\n4\n1 6 4 0\n0\n-1 9 -1 10\n0\n-1 3 6", "output": "No\nNo\nNo\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMr. Takahashi has a string s consisting of lowercase English letters. He repeats the following operation on s exactly K times.\n\n* Choose an arbitrary letter on s and change that letter to the next alphabet. Note that th... | [{"type": "stdin_stdout", "input": "codefestival\n101", "output": "aaaafeaaiaal\n"}, {"type": "stdin_stdout", "input": "cdoeffstival\n101", "output": "aaaaffaaiaal\n"}, {"type": "stdin_stdout", "input": "cdoeffstival\n111", "output": "aaaaafativam\n"}, {"type": "stdin_stdout", "input": "lavitsffeodc\n111", "output": "a... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt is only six months until Christmas, and AtCoDeer the reindeer is now planning his travel to deliver gifts.\n\nThere are N houses along TopCoDeer street. The i-th house is located at coordinate a_i. He has decided to de... | [{"type": "stdin_stdout", "input": "8\n121 1 -1 -1 -3 3 0 1", "output": "124\n"}, {"type": "stdin_stdout", "input": "8\n0 -4 -1 21 -2 -15 4 2", "output": "36\n"}, {"type": "stdin_stdout", "input": "8\n0 -3 -1 27 -6 -18 4 2", "output": "45\n"}, {"type": "stdin_stdout", "input": "8\n-2 -1 0 1 3 -143 0 1", "output": "146\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much. \n\nA song is a sequence of not... | [{"type": "stdin_stdout", "input": "10\n2 2 2 4 10 6 7 16 9 17\n1 2 3 5 5 6 7 8 18 10\n", "output": "157\n"}, {"type": "stdin_stdout", "input": "10\n1 2 0 4 10 4 7 16 9 17\n1 2 3 5 5 6 7 8 18 10\n", "output": "154\n"}, {"type": "stdin_stdout", "input": "10\n1 2 2 4 10 6 7 16 9 17\n1 2 3 5 5 6 7 8 18 10\n", "output": "1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Don't give me five!\n\nIn this kata you get the start number and the end number of a region and should return the count of all numbers except numbers with a 5 in it. The start and the end number are both inclusive!\n\nE... | [{"input": "-14\n-1", "output": "[13]", "fn_name": "dont_give_me_five"}, {"input": "-4\n17", "output": "[20]", "fn_name": "dont_give_me_five"}, {"input": "-4\n37", "output": "[38]", "fn_name": "dont_give_me_five"}, {"input": "-14\n-6", "output": "[9]", "fn_name": "dont_give_me_five"}, {"input": "4\n17", "output": "[12]... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIvan wants to make a necklace as a present to his beloved girl. A necklace is a cyclic sequence of beads of different colors. Ivan says that necklace is beautiful relative to the cut point between two adjacent beads, if t... | [{"type": "stdin_stdout", "input": "20\n19259 5236 2272 7238 560 938 6209 91 1540 2821 35 6097 12593 1092 6181 7553 4095 280 12810 2723\n", "output": "0\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMany years have passed, and n friends met at a party again. Technologies have leaped forward since the last meeting, cameras with timer appeared and now it is not obligatory for one of the friends to stand with a camera, ... | [{"type": "stdin_stdout", "input": "10\n489 685\n857 870\n736 221\n687 697\n166 360\n265 200\n738 519\n393 760\n66 176\n798 160\n", "output": "3231747\n"}, {"type": "stdin_stdout", "input": "10\n489 685\n857 870\n736 221\n687 697\n166 360\n265 200\n738 519\n393 760\n66 176\n798 160\n", "output": "3231747\n"}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInternational Car Production Company (ICPC), one of the largest automobile manufacturers in the world, is now developing a new vehicle called \"Two-Wheel Buggy\". As its name suggests, the vehicle has only two wheels. Qui... | [{"type": "stdin_stdout", "input": "1 1\n180 253 3\n1 1\n180 180 19\n2 10\n694 -351 7\n-24 360 8\n3 2\n100 60 2\n-72 -72 10\n-59 -413 5\n0 0", "output": "-7.91148452\n5.59128446\n0.00000000\n59.69026042\n-16.09771605\n5.86169674\n-6.89851214\n-10.76376689\n"}, {"type": "stdin_stdout", "input": "1 2\n180 253 2\n1 2\n180... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNadeko's birthday is approaching! As she decorated the room for the party, a long garland of Dianthus-shaped paper pieces was placed on a prominent part of the wall. Brother Koyomi will like it!\n\nStill unsatisfied with ... | [{"type": "stdin_stdout", "input": "100\ndddddccccdddddaaaaabbbbbbbbbbbbbaaacdcabbacccacccccbdbbadddbbddddbdaaccacdddbbbaddddbbbbdcbbbdddddda\n50\n54 b\n48 d\n45 b\n52 c\n52 a\n48 a\n54 b\n45 a\n47 d\n50 d\n53 a\n34 a\n51 b\n48 d\n47 d\n47 a\n48 d\n53 b\n52 d\n54 d\n46 a\n38 a\n52 b\n49 a\n49 b\n46 c\n99 a\n45 b\n35 c\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Dogeforces company has $k$ employees. Each employee, except for lower-level employees, has at least $2$ subordinates. Lower-level employees have no subordinates. Each employee, except for the head of the company, has ... | [{"type": "stdin_stdout", "input": "9\n98 100 100 100 100 100 100 99 100\n100 96 100 100 99 100 100 100 97\n100 100 98 99 100 100 100 100 100\n100 100 99 97 100 100 100 100 100\n100 99 100 100 98 100 100 100 99\n100 100 100 100 100 97 98 100 100\n100 100 100 100 100 98 97 100 100\n99 100 100 100 100 100 100 98 100\n100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs we all know, Max is the best video game player among her friends. Her friends were so jealous of hers, that they created an actual game just to prove that she's not the best at games. The game is played on a directed a... | [{"type": "stdin_stdout", "input": "100 1\n92 93 p\n", "output": "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAutumn came late to the kingdom of Far Far Away. The harvest was exuberant and it is now time to get ready for the winter. As most people celebrate the Harvest festival, Simon the Caretaker tries to solve a very non-trivi... | [{"type": "stdin_stdout", "input": "9 9\n", "output": "13\nAAA.BCCC.\n.ABBB.CD.\n.AE.BFCD.\nEEEFFFDDD\nG.E.HFIII\nGGGJHHHI.\nGK.JHL.IM\n.KJJJLMMM\nKKK.LLL.M\n"}, {"type": "stdin_stdout", "input": "9 8\n", "output": "12\nAAA.BCCC\n.ABBBDC.\nEA.FBDC.\nEEEFDDDG\nEHFFFGGG\n.HHHIIIG\nJHKKKIL.\nJJJK.IL.\nJ..K.LLL\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTake 2 strings `s1` and `s2` including only letters from `a`to `z`.\nReturn a new **sorted** string, the longest possible, containing distinct letters,\n- each taken only once - coming from s1 or s2.\n\n# Examples:\n```\n... | [{"input": "\"loopingisfunbutdangerous\"\n\"lessdangerousthancoding\"", "output": "[\"abcdefghilnoprstu\"]", "fn_name": "longest"}, {"input": "\"agenerationmustconfrontthelooming\"\n\"codewarrs\"", "output": "[\"acdefghilmnorstuw\"]", "fn_name": "longest"}, {"input": "\"inmanylanguages\"\n\"theresapairoffunctions\"", "... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEmuskald is a well-known illusionist. One of his trademark tricks involves a set of magical boxes. The essence of the trick is in packing the boxes inside other boxes.\n\nFrom the top view each magical box looks like a sq... | [{"type": "stdin_stdout", "input": "15\n999999986 268435456\n999999987 67108864\n999999988 16777216\n999999989 4194304\n999999990 1048576\n999999991 262144\n999999992 65536\n999999993 16384\n999999994 4096\n999999995 1024\n999999996 256\n999999997 64\n999999998 16\n999999999 4\n1000000000 1\n", "output": "1000000001\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMasha wants to open her own bakery and bake muffins in one of the n cities numbered from 1 to n. There are m bidirectional roads, each of whose connects some pair of cities.\n\nTo bake muffins in her bakery, Masha needs t... | [{"type": "stdin_stdout", "input": "8 57 3\n1 3 15\n2 3 1\n1 7 21\n1 2 11\n2 1 16\n1 6 4\n1 3 2\n3 7 17\n5 8 3\n1 3 18\n1 4 3\n1 2 1\n2 8 14\n1 4 17\n4 5 21\n2 3 6\n3 5 11\n2 8 11\n3 4 1\n1 3 9\n1 4 3\n2 3 12\n1 5 9\n2 3 15\n1 2 14\n1 2 10\n1 4 19\n5 7 7\n5 8 20\n5 8 1\n1 4 3\n4 5 8\n5 7 1\n1 2 14\n4 5 9\n6 7 2\n2 6 9\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Task\n\nYou are given a function that should insert an asterisk (`*`) between every pair of **even digits** in the given input, and return it as a string. If the input is a sequence, concat the elements first as a strin... | [{"input": "[1, 4, 64, 68, 67, 23, 1]", "output": "[\"14*6*4*6*8*67231\"]", "fn_name": "asterisc_it"}, {"input": "9682135", "output": "[\"96*8*2135\"]", "fn_name": "asterisc_it"}, {"input": "5312708", "output": "[\"531270*8\"]", "fn_name": "asterisc_it"}, {"input": "\"0000\"", "output": "[\"0*0*0*0\"]", "fn_name": "ast... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has the sequence consisting of n integers. Vasya consider the pair of integers x and y k-interesting, if their binary representation differs from each other exactly in k bits. For example, if k = 2, the pair of inte... | [{"type": "stdin_stdout", "input": "100 14\n8192 8192 8192 8192 8191 8192 8192 8192 8192 8192 8191 8191 8191 8192 8191 8191 8191 8192 8192 8192 8192 8192 8191 8191 8191 8192 8191 8192 8192 8192 8192 8192 8192 8191 8191 8192 8192 8191 8191 8192 8192 8192 8191 8191 8192 8191 8191 8191 8191 8191 8191 8192 8191 8191 8192 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMusicians of a popular band \"Flayer\" have announced that they are going to \"make their exit\" with a world tour. Of course, they will visit Berland as well.\n\nThere are n cities in Berland. People can travel between c... | [{"type": "stdin_stdout", "input": "7 7\n1 6 745325\n2 3 3581176\n2 4 19\n3 6 71263060078\n5 4 141198\n7 4 163953\n5 6 15994\n1 297404206755 82096176217 14663411 187389745 21385 704393\n", "output": "1 335807 7498159 335769 53373 21385 663675 \n"}, {"type": "stdin_stdout", "input": "7 7\n1 6 745325\n2 3 3581176\n2 4 19... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the fret number j on the i-th s... | [{"type": "stdin_stdout", "input": "58260522 77914575 2436426 24979445 61648772 23690081\n10\n582107247 906728404 411434947 673536177 411497300 488012525 561127307 800305059 992325267 112738006\n", "output": "804109112\n"}, {"type": "stdin_stdout", "input": "58260522 77914575 2436426 24979445 61648772 23690081\n10\n582... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n employees working in company \"X\" (let's number them from 1 to n for convenience). Initially the employees didn't have any relationships among each other. On each of m next days one of the following events to... | [{"type": "stdin_stdout", "input": "2 10\n2 2\n1 2 1\n3 1 1\n3 2 1\n3 1 1\n2 2\n3 1 2\n3 1 1\n3 2 1\n3 1 2\n", "output": "NO\nYES\nNO\nYES\nNO\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "2 10\n2 2\n1 2 1\n3 1 1\n3 1 1\n3 1 1\n2 2\n3 1 2\n3 1 1\n3 2 1\n3 1 2\n", "output": "NO\nNO\nNO\nYES\nNO\nYES\nYES\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given four integers $n$, $B$, $x$ and $y$. You should build a sequence $a_0, a_1, a_2, \\dots, a_n$ where $a_0 = 0$ and for each $i \\ge 1$ you can choose:\n\neither $a_i = a_{i - 1} + x$\n\nor $a_i = a_{i - 1} - ... | [{"type": "stdin_stdout", "input": "2\n100000 1000000000 1000000000 1\n100000 1 1000000000 10000\n", "output": "99995000050000\n-50000500000000\n"}, {"type": "stdin_stdout", "input": "7\n1 1 1 1\n2 2 2 2\n3 3 3 3\n4 4 4 4\n5 5 5 5\n6 6 6 6\n7 7 7 7\n", "output": "1\n2\n6\n8\n15\n18\n28\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nПамять компьютера состоит из n ячеек, которые выстроены в ряд. Пронумеруем ячейки от 1 до n слева направо. Про каждую ячейку известно, свободна она или принадлежит какому-либо процессу (в таком случае известен процесс, ко... | [{"type": "stdin_stdout", "input": "24\n0 0 6 6 6 0 22 22 0 23 23 0 19 19 19 19 0 0 17 0 0 3 3 3\n", "output": "14\n"}, {"type": "stdin_stdout", "input": "21\n0 11 11 11 11 0 7 0 12 12 12 12 12 0 19 19 19 0 1 1 1\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "24\n6 6 0 0 0 22 0 0 23 0 0 19 0 0 0 0 17 17 0 3 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCreate a function `close_compare` that accepts 3 parameters: `a`, `b`, and an optional `margin`. The function should return whether `a` is lower than, close to, or higher than `b`. `a` is \"close to\" `b` if `margin` is h... | [{"input": "1.99\n5\n3", "output": "[-1]", "fn_name": "close_compare"}, {"input": "8.1\n5\n3", "output": "[1]", "fn_name": "close_compare"}, {"input": "2\n5\n3", "output": "[0]", "fn_name": "close_compare"}, {"input": "5\n5\n3", "output": "[0]", "fn_name": "close_compare"}, {"input": "8\n5\n3", "output": "[0]", "fn_nam... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's imagine: there is a chess piece billiard ball. Its movements resemble the ones of a bishop chess piece. The only difference is that when a billiard ball hits the board's border, it can reflect from it and continue m... | [{"type": "stdin_stdout", "input": "1000000 1000000\n", "output": "1000000\n"}, {"type": "stdin_stdout", "input": "666667 1000000\n", "output": "333334\n"}, {"type": "stdin_stdout", "input": "871866 348747\n", "output": "174374\n"}, {"type": "stdin_stdout", "input": "863029 287677\n", "output": "287677\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPanic is rising in the committee for doggo standardization — the puppies of the new brood have been born multi-colored! In total there are 26 possible colors of puppies in the nature and they are denoted by letters from '... | [{"type": "stdin_stdout", "input": "27\nmnpsweykjdvaxyiqtgcuzhbfrlo\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "27\nabcdefghijklmnopqrstuvwxyza\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "27\nabcdefghijklmnopqrstuvwxyza\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "27\nmnpswey... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya loves hockey very much. One day, as he was watching a hockey match, he fell asleep. Petya dreamt of being appointed to change a hockey team's name. Thus, Petya was given the original team name w and the collection o... | [{"type": "stdin_stdout", "input": "100\nqn\nBE\nyN\nep\nPq\nXz\nLM\nEZ\ndb\nMn\nbn\nFe\nqA\nzc\nyq\npC\nyA\nWk\nYq\nrs\noD\nvD\nzW\nxZ\nbl\nur\nkf\ndf\nLS\nUW\nMy\nhR\nsh\nNh\nog\nCW\nor\nzo\nrO\nao\nXH\nDq\nKa\nlL\nYQ\nOh\nRZ\nAx\nta\nko\nDn\nNg\nNy\nDB\nYD\njO\nAp\nFT\noB\nNc\nwB\nHO\neW\nAc\nDr\nMt\nDf\nbF\nFP\nRa\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven: an array containing hashes of names\n\nReturn: a string formatted as a list of names separated by commas except for the last two names, which should be separated by an ampersand.\n\nExample:\n\n``` ruby\nlist([ {na... | [{"input": "[{\"name\": \"Bart\"}, {\"name\": \"Lisa\"}, {\"name\": \"Maggie\"}, {\"name\": \"Homer\"}, {\"name\": \"Marge\"}]", "output": "[\"Bart, Lisa, Maggie, Homer & Marge\"]", "fn_name": "namelist"}, {"input": "[{\"name\": \"Bart\"}, {\"name\": \"Lisa\"}, {\"name\": \"Maggie\"}]", "output": "[\"Bart, Lisa & Maggi... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a directed graph consisting of $n$ vertices. Each directed edge (or arc) labeled with a single character. Initially, the graph is empty.\n\nYou should process $m$ queries with it. Each query is one of three ... | [{"type": "stdin_stdout", "input": "3 11\n+ 1 2 a\n+ 1 3 c\n+ 3 2 a\n+ 2 1 a\n? 6\n? 5\n- 2 1\n- 3 2\n+ 2 1 c\n+ 3 2 d\n? 5\n", "output": "YES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "3 11\n+ 1 2 a\n+ 1 3 c\n+ 3 2 a\n+ 2 1 a\n? 6\n? 5\n- 2 1\n- 3 2\n+ 2 1 c\n+ 3 3 d\n? 5\n", "output": "YES\nYES\nYES\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes.\n\nLet's consider that all lines in the poems consist of lowercase Latin letter... | [{"type": "stdin_stdout", "input": "7 3\nferwljzwakxedlgwl\noerwljzwakxedlgwl\nhyqombizhuhxedprb\netptjrizhuhxedprb\nurtuckar\ndkartmwramklcmi\nrurtuckar\nnurartmwramklcmi\niraziomsv\nsaziomsv\nbprapiqpayzurgij\nusyemayzurgij\nztstmeecvmkvuu\nquexlecvmkvuu\nrlhwecvmkvuu\nzecvmkvuu\niikymgbncljtub\nqiikymgbncljtub\nbcav... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nStory\nJumbo Juice makes a fresh juice out of fruits of your choice.Jumbo Juice charges $5 for regular fruits and $7 for special ones. Regular fruits are Banana, Orange, Apple, Lemon and Grapes. Special ones are Avocado, ... | [{"input": "[\"blackBerry\", \"coconut\", \"avocado\"]", "output": "[8]", "fn_name": "mix_fruit"}, {"input": "[\"BlACKbeRrY\", \"cOcONuT\", \"avoCaDo\"]", "output": "[8]", "fn_name": "mix_fruit"}, {"input": "[\"watermelon\", \"cherry\", \"avocado\"]", "output": "[8]", "fn_name": "mix_fruit"}, {"input": "[\"watermelon\"... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMost of this problem is by the original author of [the harder kata](https://www.codewars.com/kata/556206664efbe6376700005c), I just made it simpler.\n\nI read a book recently, titled \"Things to Make and Do in the Fourth ... | [{"input": "1073741823", "output": "[false]", "fn_name": "polydivisible"}, {"input": "381654729", "output": "[true]", "fn_name": "polydivisible"}, {"input": "123220", "output": "[false]", "fn_name": "polydivisible"}, {"input": "1020005", "output": "[true]", "fn_name": "polydivisible"}, {"input": "9876545", "output": "[... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBerland Football Cup starts really soon! Commentators from all over the world come to the event.\n\nOrganizers have already built $n$ commentary boxes. $m$ regional delegations will come to the Cup. Every delegation shoul... | [{"type": "stdin_stdout", "input": "500000000001 1000000000000 100 100\n", "output": "49999999999900\n"}, {"type": "stdin_stdout", "input": "500000000001 1000000000000 100 100\n", "output": "49999999999900\n"}, {"type": "stdin_stdout", "input": "500000000001 1000000000000 110 100\n", "output": "50000000000100\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSpoonerize... with numbers... numberize?... numboonerize?... noonerize? ...anyway! If you don't yet know what a spoonerism is and haven't yet tried my spoonerism kata, please do [check it out](http://www.codewars.com/kat... | [{"input": "[1000000, \"hello\"]", "output": "[\"invalid array\"]", "fn_name": "noonerize"}, {"input": "[\"pippi\", 9999999]", "output": "[\"invalid array\"]", "fn_name": "noonerize"}, {"input": "[\"pippi\", \"hello\"]", "output": "[\"invalid array\"]", "fn_name": "noonerize"}, {"input": "[1000000, 9999999]", "output":... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFrom the FAQ:\n\nWhat am I allowed to post as a comment for a problem? \n\nDo NOT post code.\nDo NOT post a comment asking why your solution is wrong.\nDo NOT post a comment asking if you can be given the test case your p... | [{"type": "stdin_stdout", "input": "7\n1\n?\n2\n0?\n11\n69259?087\n4\n??\n2\n0?1\n4\n?????\n3\n22", "output": "0\n01\n692591087\n01\nNO\n01012\nNO\n"}, {"type": "stdin_stdout", "input": "7\n1\n?\n2\n0?\n11\n69259?087\n4\n??\n2\n0?1\n4\n?????\n3\n15", "output": "0\n01\n692591087\n01\nNO\n01012\n15\n"}, {"type": "stdin_s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDaniel is watching a football team playing a game during their training session. They want to improve their passing skills during that session.\n\nThe game involves $n$ players, making multiple passes towards each other. ... | [{"type": "stdin_stdout", "input": "1\n200\n5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHakone Ekiden is one of the Japanese New Year's traditions. In Hakone Ekiden, 10 runners from each team aim for the goal while connecting the sashes at each relay station. In the TV broadcast, the ranking change from the ... | [{"type": "stdin_stdout", "input": "10\nU\nD\nU\nD\nU\nD\nU\nD\nU\nD", "output": "608"}, {"type": "stdin_stdout", "input": "8\nT\nD\nD\nD\nD\nD\nD\nC", "output": "0\n"}, {"type": "stdin_stdout", "input": "8\nT\nD\nD\nD\nD\nD\nC\nC", "output": "0\n"}, {"type": "stdin_stdout", "input": "8\nT\nD\nD\nD\nD\nE\nC\nC", "outpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor an integer N, we will choose a permutation \\{P_1, P_2, ..., P_N\\} of \\{1, 2, ..., N\\}.\nThen, for each i=1,2,...,N, let M_i be the remainder when i is divided by P_i.\nFind the maximum possible value of M_1 + M_2 ... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "499999999500000000\n"}, {"type": "stdin_stdout", "input": "999999999\n", "output": "499999998500000001\n"}, {"type": "stdin_stdout", "input": "999999998\n", "output": "499999997500000003\n"}, {"type": "stdin_stdout", "input": "234679769\n", "output": "275372... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.\n\nL... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "4444477777\n"}, {"type": "stdin_stdout", "input": "1000100000\n", "output": "4444477777\n"}, {"type": "stdin_stdout", "input": "1211766791\n", "output": "4444477777\n"}, {"type": "stdin_stdout", "input": "1101704081\n", "output": "4444477777\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet S(n) denote the sum of the digits in the decimal notation of n.\nFor example, S(123) = 1 + 2 + 3 = 6.\nWe will call an integer n a Snuke number when, for all positive integers m such that m > n, \\frac{n}{S(n)} \\leq ... | [{"type": "stdin_stdout", "input": "792\n", "output": "1\n2\n3\n4\n5\n6\n7\n8\n9\n19\n29\n39\n49\n59\n69\n79\n89\n99\n199\n299\n399\n499\n599\n699\n799\n899\n999\n1099\n1199\n1299\n1399\n1499\n1599\n1699\n1799\n1899\n1999\n2999\n3999\n4999\n5999\n6999\n7999\n8999\n9999\n10999\n11999\n12999\n13999\n14999\n15999\n16999\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou've just recently been hired to calculate scores for a Dart Board game!\n\nScoring specifications:\n\n* 0 points - radius above 10\n* 5 points - radius between 5 and 10 inclusive\n* 10 points - radius less than 5\n\n*... | [{"input": "[15, 20, 30, 31, 32, 44, 100]", "output": "[0]", "fn_name": "score_throws"}, {"input": "[1, 2, 3, 4, 5, 6, 7, 8, 9]", "output": "[65]", "fn_name": "score_throws"}, {"input": "[0, 5, 10, 10.5, 4.5]", "output": "[30]", "fn_name": "score_throws"}, {"input": "[1, 2, 3, 4]", "output": "[140]", "fn_name": "score_... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDuring the lunch break all n Berland State University students lined up in the food court. However, it turned out that the food court, too, has a lunch break and it temporarily stopped working.\n\nStanding in a queue that... | [{"type": "stdin_stdout", "input": "10\n419946 201769\n245945 0\n842799 113073\n836998 245945\n0 794376\n692107 836998\n113073 904403\n904403 987165\n201769 692107\n794376 842799\n", "output": "419946 794376 201769 842799 692107 113073 836998 904403 245945 987165 \n"}, {"type": "stdin_stdout", "input": "10\n419946 2017... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a_1, a_2, \\dots , a_n$. Array is good if for each pair of indexes $i < j$ the condition $j - a_j \\ne i - a_i$ holds. Can you shuffle this array so that it becomes good? To shuffle an array means ... | [{"type": "stdin_stdout", "input": "3\n1\n7\n4\n1 1 3 5\n6\n3 2 1 5 6 4\n", "output": "7\n5 3 1 1\n6 5 4 3 2 1\n"}, {"type": "stdin_stdout", "input": "3\n1\n7\n4\n1 1 3 5\n6\n3 2 1 5 6 4\n", "output": "7\n5 3 1 1\n6 5 4 3 2 1\n"}, {"type": "stdin_stdout", "input": "3\n1\n7\n4\n0 1 3 5\n6\n3 2 1 5 6 4\n", "output": "7\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn a coordinate system,There are 3 chocolate which will be placed at three random position (x1,y1),(x2,y2) and (x3,y3).Ramesh loves Chocolates. Ramesh always moves along a straight line. your task is to find out whether h... | [{"type": "stdin_stdout", "input": "10\n44 89 20 54 87 61\n65 25 84 82 78 98\n62 115 111 81 47 101\n73 22 24 111 56 47\n115 38 36 41 102 112\n32 89 58 91 46 67\n31 23 114 55 119 87\n31 61 84 93 53 42\n77 82 64 67 88 73\n98 49 61 43 79 57", "output": "YES\nNO\nNO\nYES\nNO\nNO\nNO\nNO\nNO\nYES"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVanya and his friend Vova play a computer game where they need to destroy n monsters to pass a level. Vanya's character performs attack with frequency x hits per second and Vova's character performs attack with frequency ... | [{"type": "stdin_stdout", "input": "20 6 15\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n", "output": "Both\nBoth\nVova\nVova\nVanya\nVova\nVova\nBoth\nBoth\nVova\nVova\nVanya\nVova\nVova\nBoth\nBoth\nVova\nVova\nVanya\nVova\n"}, {"type": "stdin_stdout", "input": "20 5 15\n20\n21\n22... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn this problem, we will deal with binary strings. Each character of a binary string is either a 0 or a 1. We will also deal with substrings; recall that a substring is a contiguous subsequence of a string. We denote the ... | [{"type": "stdin_stdout", "input": "50\n01110100101100100100011001100001110010010000000101\n50\n27 18 7\n22 35 2\n50 35 1\n41 16 1\n27 5 5\n11 6 33\n7 19 2\n9 12 33\n14 37 4\n1 22 8\n22 3 5\n50 42 1\n50 38 1\n29 20 2\n20 34 17\n20 4 29\n16 21 3\n11 43 3\n15 45 1\n12 28 3\n31 34 13\n43 1 8\n3 41 1\n18 3 13\n29 44 6\n47 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA category page displays a set number of products per page, with pagination at the bottom allowing the user to move from page to page.\n\nGiven that you know the page you are on, how many products are in the category in t... | [{"input": "43\n15\n3456", "output": "[\"Showing 631 to 645 of 3456 Products.\"]", "fn_name": "pagination_text"}, {"input": "2\n30\n350", "output": "[\"Showing 31 to 60 of 350 Products.\"]", "fn_name": "pagination_text"}, {"input": "3\n10\n26", "output": "[\"Showing 21 to 26 of 26 Products.\"]", "fn_name": "pagination_... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Description:\n\n Find the longest successive exclamation marks and question marks combination in the string. A successive exclamation marks and question marks combination must contains two part: a substring of \"!\" and... | [{"input": "\"!!???!?????\"", "output": "[\"!?????\"]", "fn_name": "find"}, {"input": "\"!????!!!?\"", "output": "[\"????!!!\"]", "fn_name": "find"}, {"input": "\"!!???!????\"", "output": "[\"!!???\"]", "fn_name": "find"}, {"input": "\"!?!!??!!!?\"", "output": "[\"??!!!\"]", "fn_name": "find"}, {"input": "\"!?!!\"", "o... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA subsequence of length |x| of string s = s1s2... s|s| (where |s| is the length of string s) is a string x = sk1sk2... sk|x| (1 ≤ k1 < k2 < ... < k|x| ≤ |s|).\n\nYou've got two strings — s and t. Let's consider all subseq... | [{"type": "stdin_stdout", "input": "ctkhagrifaztmnxhmqztzibnmzzkojiztvrkfeoqegvwtbxlvvjhebshqaicsovtkcdovytimjggglyxlvglgunbohnkxargymbqvzgsnvjzgxivdgnaesgxqcruaopjuqsyyorrobnelehjnxcetveehlbmeskptivsuhuqupbieumycwczxyqjtwfofehfkpqmjngygwxkaviuyouiippgvlxjgtkxmhcwtzacbllsybgiujyryngapfwjkkyapfgxtcdpc\nctkhagrifaztmnxhm... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNukes has an integer that can be represented as the bitwise OR of one or more integers between A and B (inclusive). How many possible candidates of the value of Nukes's integer there are?\n\nConstraints\n\n* 1 ≤ A ≤ B < 2... | [{"type": "stdin_stdout", "input": "271828182845904523\n1128816364578546661", "output": "881093321760942453\n"}, {"type": "stdin_stdout", "input": "271828182845904523\n1080587834201094862", "output": "881093321760942453\n"}, {"type": "stdin_stdout", "input": "271828182845904523\n1104519973481288013", "output": "8810933... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe ancient Berlanders believed that the longer the name, the more important its bearer is. Thus, Berland kings were famous for their long names. But long names are somewhat inconvenient, so the Berlanders started to abbr... | [{"type": "stdin_stdout", "input": "50\nagecd\ncghafi\nfiide\niecc\njbdcfjhgd\ndiee\nhfeg\nehc\ngfijgjh\ngacaifebg\ndicbbddc\nhjgciaei\njjcdh\ng\ngc\ncf\nhfdjhd\nc\nicidbec\nji\neeh\ncgeejggc\nacfd\njjg\najefdj\neghhebiic\nbih\ngbb\njjaa\nidc\ngafi\necg\ndbigbjiehj\ncedif\nahidfaaajg\nhfhhiccbgb\ndgegjgieif\nhgjebhfdc\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou've got a positive integer sequence a_1, a_2, ..., a_{n}. All numbers in the sequence are distinct. Let's fix the set of variables b_1, b_2, ..., b_{m}. Initially each variable b_{i} (1 ≤ i ≤ m) contains the value of z... | [{"type": "stdin_stdout", "input": "23\n26988535 53977070 107954140 161931210 323862420 215908280 431816560 647724840 269885350 242896815 755678980 485793630 863633120 404828025 539770700 134942675 593747770 377839490 917610190 809656050 620736305 971587260 458805095\n", "output": "7\n"}, {"type": "stdin_stdout", "inpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe surveyor starship Hakodate-maru is famous for her two fuel containers with unbounded capacities. They hold the same type of atomic fuel balls.\n\nThere, however, is an inconvenience. The shapes of the fuel containers ... | [{"type": "stdin_stdout", "input": "100\n160\n50\n20\n150323\n0", "output": "99\n160\n47\n20\n150303\n"}, {"type": "stdin_stdout", "input": "100\n31\n37\n104\n151200\n0", "output": "99\n31\n37\n99\n151200\n"}, {"type": "stdin_stdout", "input": "100\n84\n50\n20\n151200\n0", "output": "99\n84\n47\n20\n151200\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs you might remember, the collector of Siruseri had ordered\na complete revision of the Voters List. He knew that constructing\nthe list of voters is a difficult task, prone to errors. Some\nvoters may have been away on ... | [{"type": "stdin_stdout", "input": "5 6 5\n23\n30\n42\n57\n90\n21 \n23 \n35 \n57 \n90 \n92 \n21 \n23 \n30 \n57 \n90 ", "output": "5\n21 \n23 \n30 \n57 \n90"}, {"type": "stdin_stdout", "input": "5 6 5\n23\n30\n37\n57\n90\n21 \n23 \n35 \n57 \n90 \n92 \n21 \n23 \n30 \n57 \n174", "output": "5\n21\n23\n30\n57\n90\n"}, {"typ... | 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\nThe ACM ICPC judges are very careful about not leaking their problems, and all communications are encrypted. However, one does sometimes make mistakes, like using too weak an encryption scheme. Here is an example of that.... | [{"type": "stdin_stdout", "input": "8\n1 1 1 1 1 1 2 1 8\n3 2 3 2 3 2 4 2 10\n6 4 7 13 7 b a 2 2e\ne1 13 ce 28 ca 6 ab 46 a5d\nb08 49e2 6128 f27 8cf2 bc50 7380 7fe1 722b\n4eba eb4 a352 fd14 6ac1 fed1 dd06 bb83 392bc\nef593c08 847e522f c9b20c47 26f3a4e1 e2720a01 6fe66007\n7a4e96ad 6ee5cef6 3853cd88\n8bf20206 757d6d66 9c... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Little Elephant has got a problem — somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.\n\nThe Little Elephant doesn't want to call the police u... | [{"type": "stdin_stdout", "input": "128\n1 2 4 6 8 17 20 20 23 33 43 49 49 49 52 73 74 75 82 84 85 87 90 91 102 103 104 105 111 111 401 142 142 152 155 160 175 176 178 181 183 184 187 188 191 193 326 202 202 214 224 225 236 239 240 243 246 247 249 249 257 257 261 264 265 271 277 281 284 284 286 289 290 296 297 303 305 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNote that the memory limit in this problem is lower than in others.\n\nYou have a vertical strip with n cells, numbered consecutively from 1 to n from top to bottom.\n\nYou also have a token that is initially placed in ce... | [{"type": "stdin_stdout", "input": "3912472 307193683\n", "output": "149191773\n"}, {"type": "stdin_stdout", "input": "2525447 612881327\n", "output": "368194805\n"}, {"type": "stdin_stdout", "input": "2924225 629135317\n", "output": "498731287\n"}, {"type": "stdin_stdout", "input": "3175292 612881327\n", "output": "60... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.\n\... | [{"type": "stdin_stdout", "input": "485 9554485\n7759121368632736852539182753173468028218114958118158732302477551670775608015153610483175626465946144780731573954182900412248382710280376491925985206156109890139333293746203940442347501294009600230166311978044218247083102712257326301109220002496805123344816427514286225153... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDraw a chessboard which has a height of H cm and a width of W cm. For example, the following figure shows a chessboard which has a height of 6 cm and a width of 10 cm.\n\n\n.#.#.#.#.\n.#.#.#.#.#\n.#.#.#.#.\n.#.#.#.#.#\n.#... | [{"type": "stdin_stdout", "input": "11 21\n10 0\n5 0\n2 4\n2 0\n0 0", "output": "#.#.#.#.#.#.#.#.#.#.#\n.#.#.#.#.#.#.#.#.#.#.\n#.#.#.#.#.#.#.#.#.#.#\n.#.#.#.#.#.#.#.#.#.#.\n#.#.#.#.#.#.#.#.#.#.#\n.#.#.#.#.#.#.#.#.#.#.\n#.#.#.#.#.#.#.#.#.#.#\n.#.#.#.#.#.#.#.#.#.#.\n#.#.#.#.#.#.#.#.#.#.#\n.#.#.#.#.#.#.#.#.#.#.\n#.#.#.#.#... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSo the Beautiful Regional Contest (BeRC) has come to an end! n students took part in the contest. The final standings are already known: the participant in the i-th place solved p_i problems. Since the participants are pr... | [{"type": "stdin_stdout", "input": "5\n12\n5 4 4 3 2 2 1 1 1 1 1 1\n4\n4 3 2 0\n1\n1000000\n20\n20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 10 3 2 1\n32\n64 64 63 58 58 58 58 58 37 37 37 37 34 34 28 28 28 28 28 28 24 24 19 17 17 17 17 16 17 16 16 11\n", "output": "1 2 3\n0 0 0\n0 0 0\n1 2 7\n2 6 6\n"}, {"type": "stdin_s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA widely known among some people Belarusian sport programmer Lesha decided to make some money to buy a one square meter larger flat. To do this, he wants to make and carry out a Super Rated Match (SRM) on the site Torcode... | [{"type": "stdin_stdout", "input": "15\na b c d e f g h i j k l m n o\n1\n221 n g m h n f d a b a m d o n e e c c i a f f f i h m b o l j b d f m f i j c g d k l i b d a h l j e n b d b j o c c b c e c o g n h a b l m m h n a a a n e k m m a e b l i k a g h k k f d j c n g c d k b f k k a k g m b a j b n m f c f f o a ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian. \n\nRecently Chef bought a bunch of robot-waiters. And now he needs to know how much to pay for the electricity that robots use for their work. All waiters serve ... | [{"type": "stdin_stdout", "input": "2\n-1 -1\n7 -1", "output": "2\n14\n"}, {"type": "stdin_stdout", "input": "2\n-1 -1\n2 11", "output": "2\n21\n"}, {"type": "stdin_stdout", "input": "2\n-1 -2\n4 14", "output": "3\n28\n"}, {"type": "stdin_stdout", "input": "2\n1 -1\n10 14", "output": "2\n28\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBob is travelling from one city to another. In his way, he sees many other cities pass by. What he does instead of learning the full names of the cities, he learns just the first character of the cities. For example, if h... | [{"type": "stdin_stdout", "input": "100\n84\nlrbbmqb\ncd\nr\nowkk\nhiddqsc\nxrjm\nwfr\nsjyb\ndbef\narcbynecd\nggx\npklore\nlnmpapqfwk\nopkm\noqhnwnkue\nhsqmgbbuq\nljjivswmd\nq\nbx\nxmvtr\nbljptnsn\nwzqf\nmafadrrwso\nsbcnuv\nhffbsaq\nwp\nc\ncehch\nvf\nkmlnozjkpq\nxrjxki\nzyxa\nbhhki\nq\noendtomfg\nwdwf\ngpxiq\nkuytdlcgd... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInna and Dima decided to surprise Sereja. They brought a really huge candy matrix, it's big even for Sereja! Let's number the rows of the giant matrix from 1 to n from top to bottom and the columns — from 1 to m, from lef... | [{"type": "stdin_stdout", "input": "63 67 18046757 61758841 85367218 68\n22 30\n25 40\n56 58\n29 11\n34 63\n28 66\n51 5\n39 64\n1 23\n24 61\n19 47\n10 31\n55 28\n52 26\n38 7\n28 31\n13 27\n37 42\n10 52\n19 33\n7 36\n13 1\n46 40\n21 41\n1 1\n6 35\n10 4\n46 9\n21 57\n1 49\n34 14\n14 35\n43 4\n1 41\n25 22\n18 25\n27 23\n4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nShohag has an integer sequence $a_1, a_2, \\ldots, a_n$. He can perform the following operation any number of times (possibly, zero):\n\nSelect any positive integer $k$ (it can be different in different operations).\n\nCh... | [{"type": "stdin_stdout", "input": "1\n39\n481199252 336470888 728039650 446497694 740396295 773386884 579721198 396628655 503722503 971207868 202647942 2087506 268792718 46761498 443917727 16843338 125908043 1772709198 717268783 787375312 150414369 693319712 519096230 29277141 856168102 762263554 674936674 407246545 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a rectangle grid. That grid's size is n × m. Let's denote the coordinate system on the grid. So, each point on the grid will have coordinates — a pair of integers (x, y) (0 ≤ x ≤ n, 0 ≤ y ≤ m).\n\nYour task ... | [{"type": "stdin_stdout", "input": "1000000000 1000001000 286536427 579261823 230782719 1150170645\n", "output": "209608854 195871608 363464000 962652038\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000 500000000 500000000 500000000 500000001\n", "output": "250000000 249999999 750000000 750000000\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn recreational mathematics, a [Keith number](https://en.wikipedia.org/wiki/Keith_number) or repfigit number (short for repetitive Fibonacci-like digit) is a number in the following integer sequence:\n\n`14, 19, 28, 47, 6... | [{"input": "41796205765147426974704791528", "output": "[89]", "fn_name": "is_keith_number"}, {"input": "18354972585225358067718266", "output": "[78]", "fn_name": "is_keith_number"}, {"input": "855191324330802397989", "output": "[64]", "fn_name": "is_keith_number"}, {"input": "11812665388886672", "output": "[48]", "fn_n... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya's telephone contains n photos. Photo number 1 is currently opened on the phone. It is allowed to move left and right to the adjacent photo by swiping finger over the screen. If you swipe left from the first photo, y... | [{"type": "stdin_stdout", "input": "100 20 100 15061\nwwwwhhwhhwhhwhhhhhwwwhhhwwwhwwhwhhwwhhwwwhwwhwwwhwhwhwwhhhwwwhhwhwwhhwhwhwwwhwwwwhwhwwwwhwhhhwhwhwwh\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "100 20 110 15061\nwwwwhhwhhwhhwhhhhhwwwhhhwwwhwwhwhhwwhhwwwhwwhwwwhwhwhwwhhhwwwhhwhwwhhwhwhwwwhwwwwhwhwwww... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFind the volume of a cone whose radius and height are provided as parameters to the function `volume`. Use the value of PI provided by your language (for example: `Math.PI` in JS, `math.pi` in Python or `Math::PI` in Ruby... | [{"input": "56\n30", "output": "[98520]", "fn_name": "volume"}, {"input": "7\n3", "output": "[153]", "fn_name": "volume"}, {"input": "0\n10", "output": "[0]", "fn_name": "volume"}, {"input": "10\n0", "output": "[0]", "fn_name": "volume"}, {"input": "0\n0", "output": "[0]", "fn_name": "volume"}] | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne rainy gloomy evening when all modules hid in the nearby cafes to drink hot energetic cocktails, the Hexadecimal virus decided to fly over the Mainframe to look for a Great Idea. And she has found one!\n\nWhy not make ... | [{"type": "stdin_stdout", "input": "010\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "011\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "001\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "20\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "15\n", "output": "4\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem Statement\n\nNathan O. Davis is a student at the department of integrated systems.\n\nToday's agenda in the class is audio signal processing. Nathan was given a lot of homework out. One of the homework was to writ... | [{"type": "stdin_stdout", "input": "5\n1 x 0 4 x\n2\nx x\n2\n1 2\n2\n3 0\n2\n1000000000 x\n4\nx 4 1 x\n0", "output": "ambiguous\nnone\nambiguous\nnone\nambiguous\nambiguous\n"}, {"type": "stdin_stdout", "input": "5\n1 x 0 4 x\n2\nx x\n2\n1 2\n2\n3 0\n2\n0000000000 x\n4\nx 4 1 x\n0", "output": "ambiguous\nnone\nambiguou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29.\n\n\n\nInput\n\nThe input is a... | [{"type": "stdin_stdout", "input": "6 2\n12 8\n0 0", "output": "Wednesday\nWednesday\n"}, {"type": "stdin_stdout", "input": "4 1\n2 18\n0 0", "output": "Thursday\nWednesday\n"}, {"type": "stdin_stdout", "input": "6 2\n7 17\n0 0", "output": "Wednesday\nSaturday\n"}, {"type": "stdin_stdout", "input": "1 1\n5 19\n0 0", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.\n\... | [{"type": "stdin_stdout", "input": "614586850 1000000000\n", "output": "1110059271353421796\n"}, {"type": "stdin_stdout", "input": "190535551 1000000000\n", "output": "1340487604111893304\n"}, {"type": "stdin_stdout", "input": "614586850 1000001000\n", "output": "1110063715797865796\n"}, {"type": "stdin_stdout", "input... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.