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\nCasimir has a rectangular piece of paper with a checkered field of size $n \\times m$. Initially, all cells of the field are white.\n\nLet us denote the cell with coordinates $i$ vertically and $j$ horizontally by $(i, j)...
[{"type": "stdin_stdout", "input": "8\n2 3 1\n*.*\n...\n4 9 2\n*.*.*...*\n.*.*...*.\n..*.*.*..\n.....*...\n4 4 1\n*.*.\n****\n.**.\n....\n5 5 1\n.....\n*...*\n.*.*.\n..*.*\n...*.\n5 5 2\n.....\n*...*\n.*.*.\n..*.*\n...*.\n4 7 1\n*.....*\n.....*.\n..*.*..\n...*...\n3 3 1\n***\n***\n***\n3 5 1\n*...*\n.***.\n.**..\n", "o...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGildong is playing with his dog, Badugi. They're at a park that has $n$ intersections and $n-1$ bidirectional roads, each $1$ meter in length and connecting two intersections with each other. The intersections are numbere...
[{"type": "stdin_stdout", "input": "3\n3\n1 2\n2 3\n4\n1 2\n2 3\n3 4\n5\n1 2\n2 3\n3 4\n4 5\n3 6\n6 7\n5 13\n", "output": "2\n3\n4\n"}, {"type": "stdin_stdout", "input": "3\n3\n1 2\n2 3\n4\n1 2\n2 3\n3 4\n4\n1 2\n1 3\n3 4\n1 5\n3 8\n6 13\n5 8\n", "output": "2\n3\n2\n"}, {"type": "stdin_stdout", "input": "3\n3\n1 2\n2 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have a directed weighted graph with N vertices. Each vertex has two integers written on it, and the integers written on Vertex i are A_i and B_i.\n\nIn this graph, there is an edge from Vertex x to Vertex y for all pai...
[{"type": "stdin_stdout", "input": "6\n43 35\n97 26\n77 48\n133 16\n110 5\n154 15", "output": "140\n"}, {"type": "stdin_stdout", "input": "6\n43 35\n97 26\n77 48\n133 31\n110 5\n154 15", "output": "155\n"}, {"type": "stdin_stdout", "input": "6\n43 35\n97 26\n77 48\n133 36\n110 5\n154 15", "output": "160\n"}, {"type": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA bracket sequence is called regular if it is possible to obtain correct arithmetic expression by inserting characters + and 1 into this sequence. For example, sequences (())(), () and (()(())) are regular, while )(, (() ...
[{"type": "stdin_stdout", "input": "12\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n", "output": "YES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "12\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n", "output": "YES\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Task\n You are given a `moment` in time and space. What you must do is break it down into time and space, to determine if that moment is from the past, present or future.\n\n `Time` is the sum of characters that increas...
[{"input": "\"12:30 am\"", "output": "[[false, false, true]]", "fn_name": "moment_of_time_in_space"}, {"input": "\"12:02 pm\"", "output": "[[false, true, false]]", "fn_name": "moment_of_time_in_space"}, {"input": "\"01:00 pm\"", "output": "[[true, false, false]]", "fn_name": "moment_of_time_in_space"}, {"input": "\"11:...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nA witch named Marie lived deep in a remote forest. Since she is a witch, she magically covers everything she needs to live, such as food, water, and fuel.\n\nHer magic is activated by drawing a magic circle using some mag...
[{"type": "stdin_stdout", "input": "5 4\n1 2\n2 3\n3 4\n4 5\n4 6\n1 2\n1 3\n1 4\n2 4\n2 4\n3 4\n5 0\n0 0", "output": "yes\nno\nyes\n"}, {"type": "stdin_stdout", "input": "5 4\n1 2\n2 3\n3 4\n4 5\n7 6\n1 2\n1 3\n1 4\n2 4\n2 4\n3 4\n5 0\n0 0", "output": "yes\nno\nyes\n"}, {"type": "stdin_stdout", "input": "5 4\n1 2\n2 3\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSpin-off of this kata, here you will have to figure out an efficient strategy to solve the problem of finding the sole duplicate number among an unsorted array/list of numbers starting from 1 up to n.\n\nHints: a solution...
[{"input": "[8, 2, 6, 3, 7, 2, 5, 1, 4]", "output": "[2]", "fn_name": "find_dup"}, {"input": "[1, 3, 2, 5, 4, 5, 7, 6]", "output": "[5]", "fn_name": "find_dup"}, {"input": "[5, 4, 3, 2, 1, 1]", "output": "[1]", "fn_name": "find_dup"}, {"input": "[1, 1, 2, 3]", "output": "[1]", "fn_name": "find_dup"}, {"input": "[1, 2, ...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given the strings $a$ and $b$, consisting of lowercase Latin letters. You can do any number of the following operations in any order:\n\nif $|a| > 0$ (the length of the string $a$ is greater than zero), delete the...
[{"type": "stdin_stdout", "input": "5\na\na\nabcd\nbc\nhello\ncodeforces\nhello\nhelo\ndhjakjsnasjhfksafasd\nadjsnasjhfksvdafdser\n", "output": "\n0\n2\n13\n3\n20\n"}, {"type": "stdin_stdout", "input": "5\na\na\nabcd\nbc\nhello\ncodeforces\nhello\nhelo\ndhjakjsnasjhfksafasd\nadjsnasjhfksvdafdser\n", "output": "0\n2\n13...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA flower shop has got n bouquets, and the i-th bouquet consists of a_{i} flowers. Vasya, the manager of the shop, decided to make large bouquets from these bouquets. \n\nVasya thinks that a bouquet is large if it is made ...
[{"type": "stdin_stdout", "input": "25\n742168 377547 485672 437223 96307 902863 759104 747933 512899 410317 588598 666688 823202 257684 520631 910066 168864 71499 899972 565350 764848 754913 929040 864132 289976\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "25\n742168 377547 485672 437223 96307 902863 7591...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHeidi's friend Jenny is asking Heidi to deliver an important letter to one of their common friends. Since Jenny is Irish, Heidi thinks that this might be a prank. More precisely, she suspects that the message she is asked...
[{"type": "stdin_stdout", "input": "11\n1 0 6646\n2 0 8816\n3 2 9375\n4 2 5950\n5 1 8702\n6 2 2657\n7 2 885\n8 7 2660\n9 2 5369\n10 6 3798\n", "output": "18191\n"}, {"type": "stdin_stdout", "input": "11\n1 0 6646\n2 0 8816\n3 2 9375\n4 2 5950\n5 1 8702\n6 2 2657\n7 2 885\n8 7 2660\n9 2 5369\n10 6 3798\n", "output": "18...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlice likes snow a lot! Unfortunately, this year's winter is already over, and she can't expect to have any more of it. Bob has thus bought her a giftΒ β€” a large snow maker. He plans to make some amount of snow every day. ...
[{"type": "stdin_stdout", "input": "13\n1 1 1 1 1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1 1 1 1 1\n", "output": "1 1 1 1 1 1 1 1 1 1 1 1 1\n"}, {"type": "stdin_stdout", "input": "13\n1 1 1 1 1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1 1 1 1 1\n", "output": "1 1 1 1 1 1 1 1 1 1 1 1 1 "}, {"type": "stdin_stdout", "input": "13\n1 1 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n### Tongues\n\nGandalf's writings have long been available for study, but no one has yet figured out what language they are written in. Recently, due to programming work by a hacker known only by the code name ROT13, it h...
[{"input": "\"0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789\"", "output": "[\"0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789\"]", "fn_name": "tongues"}, {"input": "\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nSnuke has N strings. The i-th string is s_i.\n\nLet us concatenate these strings into one string after arranging them in some order. Find the maximum possible number of occurrences of `AB` in the resulting string.\n\nCons...
[{"type": "stdin_stdout", "input": "9\nBEWPVCRWH\nZQNZYIJX\nBAVREA\nPA\nHJMYITEOX\nBCJHMRMNK\nBP\nQVFABZ\nPRGKSPUNA", "output": "4\n"}, {"type": "stdin_stdout", "input": "9\nBEWPVCRWH\nZQNZYIJX\nAERVAB\nPA\nHJMYITEOX\nBCJHMRMNK\nBP\nQVFABZ\nPRGKSPUNA", "output": "4\n"}, {"type": "stdin_stdout", "input": "9\nBEWPVCRWH\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven an input string s, reverse the order of the words.\n\nA word is defined as a sequence of non-space characters. The words in s will be separated by at least one space.\n\nReturn a string of the words in reverse order...
[{"input": "\"Alice does not even like bob\"", "output": "\"bob like even not does Alice\"", "fn_name": "reverseWords"}, {"input": "\" Bob Loves Alice \"", "output": "\"Alice Loves Bob\"", "fn_name": "reverseWords"}, {"input": "\"the sky is blue\"", "output": "\"blue is sky the\"", "fn_name": "reverseWords"}, {"...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a function called calculate that takes 3 values. The first and third values are numbers. The second value is a character. If the character is \"+\" , \"-\", \"*\", or \"/\", the function will return the result of th...
[{"input": "3.2\n\"+\"\n8", "output": "[11.2]", "fn_name": "calculate"}, {"input": "3.2\n\"-\"\n8", "output": "[-4.8]", "fn_name": "calculate"}, {"input": "3.2\n\"*\"\n8", "output": "[25.6]", "fn_name": "calculate"}, {"input": "3.2\n\"/\"\n8", "output": "[0.4]", "fn_name": "calculate"}, {"input": "-3\n\"/\"\n0", "outpu...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nEvery evening Vitalya sets n alarm clocks to wake up tomorrow. Every alarm clock rings during exactly one minute and is characterized by one integer a_{i}Β β€” number of minute after midnight in which it rings. Every alarm c...
[{"type": "stdin_stdout", "input": "100 40 20\n148 120 37 65 188 182 199 131 97 174 157 113 62 63 193 8 72 152 138 5 90 48 133 83 197 118 123 2 181 151 53 115 78 177 144 33 196 19 85 104 77 34 173 198 136 44 3 22 86 200 23 129 68 176 29 58 121 56 79 15 159 183 171 60 141 54 158 106 30 17 116 105 190 59 36 46 169 142 16...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nUjan decided to make a new wooden roof for the house. He has $n$ rectangular planks numbered from $1$ to $n$. The $i$-th plank has size $a_i \\times 1$ (that is, the width is $1$ and the height is $a_i$).\n\nNow, Ujan wan...
[{"type": "stdin_stdout", "input": "10\n1\n1\n2\n2 1\n3\n3 1 2\n3\n2 2 2\n4\n4 1 4 2\n5\n5 4 3 4 1\n5\n1 2 3 4 5\n6\n3 2 1 6 2 2\n10\n4 5 2 9 6 10 3 7 1 8\n10\n1 3 2 2 2 9 10 10 9 10\n", "output": "1\n1\n2\n2\n2\n3\n3\n2\n5\n5\n"}, {"type": "stdin_stdout", "input": "10\n1\n1\n2\n2 1\n3\n3 1 2\n3\n2 2 2\n4\n4 1 4 1\n5\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n\"Duel!\"\n\nBetting on the lovely princess Claris, the duel between Tokitsukaze and Quailty has started.\n\nThere are $n$ cards in a row. Each card has two sides, one of which has color. At first, some of these cards are...
[{"type": "stdin_stdout", "input": "30 27\n000000000010110000101111111111\n", "output": "tokitsukaze\n"}, {"type": "stdin_stdout", "input": "30 27\n100000000010110000101111111111\n", "output": "tokitsukaze\n"}, {"type": "stdin_stdout", "input": "30 16\n100000000010110000101111111111\n", "output": "once again\n"}, {"typ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis time Baby Ehab will only cut and not stick. He starts with a piece of paper with an array a of length n written on it, and then he does the following:\n\n * he picks a range (l, r) and cuts the subsegment a_l, a_{l ...
[{"type": "stdin_stdout", "input": "6 3\n2 3 10 12 5 14\n1 6\n2 4\n3 5\n", "output": "4\n2\n2\n"}, {"type": "stdin_stdout", "input": "6 3\n1 3 10 6 10 14\n1 6\n2 4\n3 5\n", "output": "4\n2\n3\n"}, {"type": "stdin_stdout", "input": "6 3\n1 5 10 6 10 14\n1 6\n2 4\n3 5\n", "output": "5\n3\n3\n"}, {"type": "stdin_stdout", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYour friend has n cards.\n\nYou know that each card has a lowercase English letter on one side and a digit on the other.\n\nCurrently, your friend has laid out the cards on a table so only one side of each card is visible...
[{"type": "stdin_stdout", "input": "01234567890123456789012345678901234567890123456789\n", "output": "25\n"}, {"type": "stdin_stdout", "input": "qwertyuioplkjhgfdsazxcvbnmqwertyuioplkjhgfdsazxcvb\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "kaq7jyialrfp4ilkni90eq8v3amcbygon7py0hb8z26fbl8ss1\n", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou received a whatsup message from an unknown number. Could it be from that girl/boy with a foreign accent you met yesterday evening?\n\nWrite a simple regex to check if the string contains the word hallo in different la...
[{"input": "\"Hallo, wie geht's dir?\"", "output": "[true]", "fn_name": "validate_hello"}, {"input": "\"hombre! Hola!\"", "output": "[true]", "fn_name": "validate_hello"}, {"input": "\"hallo, salut\"", "output": "[true]", "fn_name": "validate_hello"}, {"input": "\"ciao bella!\"", "output": "[true]", "fn_name": "validat...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nA few years ago Sajjad left his school and register to another one due to security reasons. Now he wishes to find Amir, one of his schoolmates and good friends.\n\nThere are n schools numerated from 1 to n. One can travel...
[{"type": "stdin_stdout", "input": "120494\n", "output": "60246\n"}, {"type": "stdin_stdout", "input": "116591\n", "output": "58295\n"}, {"type": "stdin_stdout", "input": "110052\n", "output": "55025\n"}, {"type": "stdin_stdout", "input": "101000\n", "output": "50499\n"}, {"type": "stdin_stdout", "input": "150380\n", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis is a harder version of the problem. In this version $n \\le 500\\,000$\n\nThe outskirts of the capital are being actively built up in Berland. The company \"Kernel Panic\" manages the construction of a residential co...
[{"type": "stdin_stdout", "input": "100\n82 51 81 14 37 17 78 92 64 15 8 86 89 8 87 77 66 10 15 12 100 25 92 47 21 78 20 63 13 49 41 36 41 79 16 87 87 69 3 76 80 60 100 49 70 59 72 8 38 71 45 97 71 14 76 54 81 4 59 46 39 29 92 3 49 22 53 99 59 52 74 31 92 43 42 23 44 9 82 47 7 40 12 9 3 55 37 85 46 22 84 52 98 41 21 77...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Number encrypting: cypher\n## Part I of Number encrypting Katas\n***\n\n## Introduction\nBack then when the internet was coming up, most search functionalities simply looked for keywords in text to show relevant documen...
[{"input": "\"I do not know what else I can test. Be cool. Good luck\"", "output": "[\"1 d0 n07 kn0w wh47 3153 1 c4n 7357. 83 c001. 600d 1uck\"]", "fn_name": "cypher"}, {"input": "\"IlRzEeAaSsGbTtBgOo\"", "output": "[\"112233445566778900\"]", "fn_name": "cypher"}, {"input": "\"I am your father\"", "output": "[\"1 4m y0...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nSanta has $n$ candies and he wants to gift them to $k$ kids. He wants to divide as many candies as possible between all $k$ kids. Santa can't divide one candy into parts but he is allowed to not use some candies at all.\n...
[{"type": "stdin_stdout", "input": "5\n5 3\n19 4\n12 7\n10 2\n100001 44619\n", "output": "4\n18\n10\n10\n100001\n"}, {"type": "stdin_stdout", "input": "5\n5 3\n12 4\n12 7\n10 2\n100001 44619\n", "output": "4\n12\n10\n10\n100001\n"}, {"type": "stdin_stdout", "input": "5\n10 2\n1 11\n5 11\n11 1\n110001 90586\n", "output"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA Ministry for Defense sent a general to inspect the Super Secret Military Squad under the command of the Colonel SuperDuper. Having learned the news, the colonel ordered to all n squad soldiers to line up on the parade g...
[{"type": "stdin_stdout", "input": "100\n66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 55 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAt first, let's define function $f(x)$ as follows: $$ \\begin{matrix} f(x) & = & \\left\\{ \\begin{matrix} \\frac{x}{2} & \\mbox{if } x \\text{ is even} \\\\ x - 1 & \\mbox{otherwise } \\end{matrix} \\right. \\end{matrix}...
[{"type": "stdin_stdout", "input": "1000000000000000000 1\n", "output": "1000000000000000000\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 100\n", "output": "31249999999999998\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 10000\n", "output": "244140624999998\n"}, {"type": "stdin_stdout", "in...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n-----Input-----\n\nThe input consists of a single string of uppercase letters A-Z. The length of the string is between 1 and 10 characters, inclusive.\n\n\n-----Output-----\n\nOutput \"YES\" or \"NO\".\n\n\n-----Examples-...
[{"type": "stdin_stdout", "input": "ALKALINITY\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "ALLALINITY\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "YTINILALLA\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "UNSCRAMBLE\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "ALKAL...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is one apple tree in Arkady's garden. It can be represented as a set of junctions connected with branches so that there is only one way to reach any junctions from any other one using branches. The junctions are enu...
[{"type": "stdin_stdout", "input": "10\n1 1 2 4 2 4 1 8 8\n", "output": "1 1 1 1 1 1 2 2 3 6 \n"}, {"type": "stdin_stdout", "input": "10\n1 2 2 3 3 4 4 5 5\n", "output": "1 1 1 1 1 2 2 3 5 5 \n"}, {"type": "stdin_stdout", "input": "10\n1 1 1 1 1 1 1 1 1\n", "output": "1 1 1 1 1 1 1 1 1 9 \n"}, {"type": "stdin_stdout", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWhen provided with a String, capitalize all vowels\n\nFor example:\n\nInput : \"Hello World!\"\n\nOutput : \"HEllO WOrld!\"\n\nNote: Y is not a vowel in this kata.\n\nWrite your solution by modifying this code:\n\n```pyth...
[{"input": "\"HelloWorld!\"", "output": "[\"HEllOWOrld!\"]", "fn_name": "swap"}, {"input": "\"abracadabra\"", "output": "[\"AbrAcAdAbrA\"]", "fn_name": "swap"}, {"input": "\"Codewars\"", "output": "[\"COdEwArs\"]", "fn_name": "swap"}, {"input": "\"Sunday\"", "output": "[\"SUndAy\"]", "fn_name": "swap"}, {"input": "\"Mo...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nOnce Max found an electronic calculator from his grandfather Dovlet's chest. He noticed that the numbers were written with seven-segment indicators (https://en.wikipedia.org/wiki/Seven-segment_display). [Image] \n\nMax st...
[{"type": "stdin_stdout", "input": "222145 353252\n", "output": "3860750\n"}, {"type": "stdin_stdout", "input": "222145 353252\n", "output": "3860750\n"}, {"type": "stdin_stdout", "input": "188883 353252\n", "output": "4803878\n"}, {"type": "stdin_stdout", "input": "188883 240204\n", "output": "1479377\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGray code is a form of binary encoding where transitions between consecutive numbers differ by only one bit. This is a useful encoding for reducing hardware data hazards with values that change rapidly and/or connect to s...
[{"input": "[1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0]", "output": "[[1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nMutual Recursion allows us to take the fun of regular recursion (where a function calls itself until a terminating condition) and apply it to multiple functions calling each other! \n\nLet's use the Hofstadter Female and ...
[{"input": "25", "output": "[16]", "fn_name": "f"}, {"input": "10", "output": "[6]", "fn_name": "f"}, {"input": "15", "output": "[9]", "fn_name": "f"}, {"input": "0", "output": "[1]", "fn_name": "f"}, {"input": "5", "output": "[3]", "fn_name": "f"}]
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nCreate a method `sayHello`/`say_hello`/`SayHello` that takes as input a name, city, and state to welcome a person. Note that `name` will be an array consisting of one or more values that should be joined together with one...
[{"input": "[\"Franklin\", \"Delano\", \"Roosevelt\"]\n\"Chicago\"\n\"Illinois\"", "output": "[\"Hello, Franklin Delano Roosevelt! Welcome to Chicago, Illinois!\"]", "fn_name": "say_hello"}, {"input": "[\"Wallace\", \"Russel\", \"Osbourne\"]\n\"Albany\"\n\"New York\"", "output": "[\"Hello, Wallace Russel Osbourne! Welc...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nHamed has recently found a string t and suddenly became quite fond of it. He spent several days trying to find all occurrences of t in other strings he had. Finally he became tired and started thinking about the following...
[{"type": "stdin_stdout", "input": "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\nvvvvvvvv\n", "output": "2728075\n"}, {"type": "stdin_stdout", "input": "vnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssn\nnssnssns\n", "output": "943392\n"}, {"type": "stdin_stdout", "input": "kpjmawawawawawawawawawawawawawawawawa...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecall that the bracket sequence is considered regular if it is possible to insert symbols '+' and '1' into it so that the result is a correct arithmetic expression. For example, a sequence \"(()())\" is regular, because ...
[{"type": "stdin_stdout", "input": "9999 41526212\n", "output": "(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNuske has a grid with N rows and M columns of squares. The rows are numbered 1 through N from top to bottom, and the columns are numbered 1 through M from left to right. Each square in the grid is painted in either blue o...
[{"type": "stdin_stdout", "input": "5 5 6\n11010\n01110\n10111\n11111\n01010\n1 1 5 5\n1 2 4 5\n2 3 3 5\n3 3 3 2\n3 1 3 5\n1 1 3 4", "output": "-2\n-2\n0\n0\n2\n1\n"}, {"type": "stdin_stdout", "input": "5 5 6\n11010\n01110\n10111\n11111\n01010\n1 1 5 5\n1 2 4 5\n3 3 3 5\n3 3 3 2\n3 1 3 5\n1 1 3 4", "output": "-2\n-2\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Binomial Form of a polynomial has many uses, just as the standard form does. For comparison, if p(x) is in Binomial Form and q(x) is in standard form, we might write\n\np(x) := a0 \\* xC0 + a1 \\* xC1 + a2 \\* xC2 + ...
[{"input": "[1, 1, 1, 1, 7, 0, 5]\n2", "output": "[12]", "fn_name": "value_at"}, {"input": "[1, 2, 7, 0, 5]\n0.6", "output": "[4.24]", "fn_name": "value_at"}, {"input": "[1, 2, 7, 0, 5]\n0", "output": "[5.0]", "fn_name": "value_at"}, {"input": "[1, 2, 7, 0, 5]\n2", "output": "[12]", "fn_name": "value_at"}, {"input": "[...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor a positive integer X, let f(X) be the number of positive divisors of X.\nGiven a positive integer N, find \\sum_{K=1}^N K\\times f(K).\n\n-----Constraints-----\n - 1 \\leq N \\leq 10^7\n\n-----Input-----\nInput is giv...
[{"type": "stdin_stdout", "input": "10000000\n", "output": "838627288460105\n"}, {"type": "stdin_stdout", "input": "11001000", "output": "1020696029789074\n"}, {"type": "stdin_stdout", "input": "11000000", "output": "1020504841032058\n"}, {"type": "stdin_stdout", "input": "11001001", "output": "1020696117797082\n"}, {"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya wrote down two strings s of length n and t of length m consisting of small English letters 'a' and 'b'. What is more, he knows that string t has a form \"abab...\", namely there are letters 'a' on odd positions and ...
[{"type": "stdin_stdout", "input": "340\nbaa?b?abab??ab??aaabaa???bbbb??abaaaba?a?b?bb?ab?bbaa??aaaa???aaa?b???ba?a??b?bb?bbbabb?bb?a?a?bbbabbba?b?ababbb?b?a??bbb??bb?ababb?abbbbba??aabbaab?aaa??a???bbaa?bb?bb?babaa?bb?a???b?abbb???bb?a?a??b?b?abbba?b??a?bab??baa?aabaabb?abbbab?aa???bbaab?bbab?ba?aab?b?baabb???aaa??bb?...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThree numbers A, B and C are the inputs. Write a program to find second largest among them.\n\n-----Input-----\n\nThe first line contains an integer T, the total number of testcases. Then T lines follow, each line contain...
[{"type": "stdin_stdout", "input": "3\n120 11 400\n10213 312 10\n10 3 450\n", "output": "120\n312\n10\n"}, {"type": "stdin_stdout", "input": "3 \n120 14 400\n10213 312 10\n10 3 450", "output": "120\n312\n10\n"}, {"type": "stdin_stdout", "input": "3 \n117 14 384\n10213 312 10\n10 3 450", "output": "117\n312\n10\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bea...
[{"type": "stdin_stdout", "input": "100 99 98 97\n", "output": "196\n195\n98\n"}, {"type": "stdin_stdout", "input": "100 50 19 10\n", "output": "100\n50\n19\n"}, {"type": "stdin_stdout", "input": "100 50 19 25\n", "output": "100\n51\n25\n"}, {"type": "stdin_stdout", "input": "100 50 19 30\n", "output": "100\n61\n30\n"}...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe image shows how we can obtain the Harmonic Conjugated Point of three aligned points A, B, C.\n\n- We choose any point L, that is not in the line with A, B and C. We form the triangle ABL\n\n- Then we draw a line from ...
[{"input": "2\n10\n20", "output": "[7.1429]", "fn_name": "harmon_pointTrip"}, {"input": "6\n10\n11", "output": "[9.3333]", "fn_name": "harmon_pointTrip"}, {"input": "5\n17\n20", "output": "[15.0]", "fn_name": "harmon_pointTrip"}, {"input": "3\n9\n18", "output": "[6.75]", "fn_name": "harmon_pointTrip"}, {"input": "4\n12...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nEfim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he de...
[{"type": "stdin_stdout", "input": "320 142\n2704701300865535.432223312233434114130011113220102420131323010344144201124303144444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444447444444444444444444444444444444615444444482101673308979557675074444444444444446...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n###Task:\n\nYou have to write a function **pattern** which creates the following Pattern(See Examples) upto n(parameter) number of rows.\n\n####Rules/Note:\n* If the Argument is 0 or a Negative Integer then it should retu...
[{"input": "7", "output": "[\" 1 \\n 121 \\n 12321 \\n 1234321 \\n 123454321 \\n 12345654321 \\n1234567654321\"]", "fn_name": "pattern"}, {"input": "4", "output": "[\" 1 \\n 121 \\n 12321 \\n1234321\"]", "fn_name": "pattern"}, {"input": "-25", "output": "[\"\"]", "fn_name": "pattern"...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nPrincess'Marriage\n\nMarriage of a princess\n\nEnglish text is not available in this practice contest.\n\nA brave princess in a poor country, knowing that gambling payouts are determined by the parimutuel method, felt mor...
[{"type": "stdin_stdout", "input": "2 8\n7 6\n4 10\n3 2\n5 10\n3 10\n5 10\n0 0", "output": "18\n110\n"}, {"type": "stdin_stdout", "input": "2 8\n7 6\n4 10\n3 3\n5 10\n3 10\n5 10\n0 0", "output": "18\n100\n"}, {"type": "stdin_stdout", "input": "2 8\n5 6\n5 5\n3 3\n4 10\n13 10\n5 10\n0 0", "output": "10\n190\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given strings s and t. Find one longest string that is a subsequence of both s and t.\n\nConstraints\n\n* s and t are strings consisting of lowercase English letters.\n* 1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInp...
[{"type": "stdin_stdout", "input": "abracadabra\navaeakedavra", "output": "aaadara\n"}, {"type": "stdin_stdout", "input": "abracbdaara\navadakedavra", "output": "aadaara\n"}, {"type": "stdin_stdout", "input": "abracbdaara\narvadekadava", "output": "aradaaa\n"}, {"type": "stdin_stdout", "input": "araadbcarba\narvadekada...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are a *khm*mad*khm* scientist and you decided to play with electron distribution among atom's shells.\nYou know that basic idea of electron distribution is that electrons should fill a shell untill it's holding the ma...
[{"input": "61", "output": "[[2, 8, 18, 32, 1]]", "fn_name": "atomic_number"}, {"input": "47", "output": "[[2, 8, 18, 19]]", "fn_name": "atomic_number"}, {"input": "50", "output": "[[2, 8, 18, 22]]", "fn_name": "atomic_number"}, {"input": "52", "output": "[[2, 8, 18, 24]]", "fn_name": "atomic_number"}, {"input": "60", ...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nIT City company developing computer games invented a new way to reward its employees. After a new game release users start buying it actively, and the company tracks the number of sales with precision to each transaction....
[{"type": "stdin_stdout", "input": "2558402827158016680\n", "output": "1015239217126197\n"}, {"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "396825396825396\n"}, {"type": "stdin_stdout", "input": "1209365011581446835\n", "output": "479906750627558\n"}, {"type": "stdin_stdout", "input": "1155798879...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet {\\rm comb}(n,r) be the number of ways to choose r objects from among n objects, disregarding order.\nFrom n non-negative integers a_1, a_2, ..., a_n, select two numbers a_i > a_j so that {\\rm comb}(a_i,a_j) is maxim...
[{"type": "stdin_stdout", "input": "5\n20 13 1 4 20", "output": "20 13\n"}, {"type": "stdin_stdout", "input": "5\n36 13 1 8 10", "output": "36 13\n"}, {"type": "stdin_stdout", "input": "5\n36 13 1 8 17", "output": "36 17\n"}, {"type": "stdin_stdout", "input": "5\n1 10 -1 2 16", "output": "16 10\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMike has a string s consisting of only lowercase English letters. He wants to change exactly one character from the string so that the resulting one is a palindrome. \n\nA palindrome is a string that reads the same backwa...
[{"type": "stdin_stdout", "input": "scfwrjevejrwfcs\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "thdaonpepdoadht\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "scfwrievejrwfcs\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "thdaodpepnoadht\n", "output": "YES\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWhen you play the game of thrones, you win, or you die. There is no middle ground.\n\nCersei Lannister, A Game of Thrones by George R. R. Martin\n\nThere are $n$ nobles, numbered from $1$ to $n$. Noble $i$ has a power of ...
[{"type": "stdin_stdout", "input": "20 53\n1 2\n1 4\n1 5\n1 6\n1 7\n1 8\n1 20\n2 3\n2 6\n2 16\n2 17\n3 6\n3 18\n3 20\n4 6\n4 7\n4 8\n4 9\n4 14\n4 18\n5 11\n5 13\n5 17\n5 18\n5 19\n6 8\n6 13\n7 8\n7 10\n7 15\n7 17\n7 18\n8 15\n8 16\n9 10\n9 15\n10 11\n10 17\n10 20\n11 15\n11 16\n12 14\n12 15\n12 16\n12 19\n14 16\n14 19\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence $a_1, a_2, \\dots, a_n$ consisting of $n$ integers.\n\nYou can choose any non-negative integer $D$ (i.e. $D \\ge 0$), and for each $a_i$ you can:\n\n add $D$ (only once), i. e. perform $a_i := a_...
[{"type": "stdin_stdout", "input": "100\n49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese , Russian and Vietnamese as well. \n\nYou are given a uniformly randomly generated string S, consisting of letters from the set {\"A\", \"B\"}. Your task is to find a string T ...
[{"type": "stdin_stdout", "input": "2\nABAA\n@BC", "output": "ABA\n-1\n"}, {"type": "stdin_stdout", "input": "2\nBABB\n?BB", "output": "BAB\n-1\n"}, {"type": "stdin_stdout", "input": "2\nAA?A\nBBB", "output": "-1\n-1\n"}, {"type": "stdin_stdout", "input": "2\nABAA\nBAA", "output": "ABA\nA\n"}, {"type": "stdin_stdout", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp takes part in a quadcopter competition. According to the rules a flying robot should:\n\n start the race from some point of a field, go around the flag, close cycle returning back to the starting point. \n\nPo...
[{"type": "stdin_stdout", "input": "-100 -100\n-100 100\n", "output": "406\n"}, {"type": "stdin_stdout", "input": "-100 -100\n100 -100\n", "output": "406\n"}, {"type": "stdin_stdout", "input": "100 -100\n-100 -100\n", "output": "406\n"}, {"type": "stdin_stdout", "input": "-100 100\n-100 -100\n", "output": "406\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWoken up by the alarm clock Igor the financial analyst hurried up to the work. He ate his breakfast and sat in his car. Sadly, when he opened his GPS navigator, he found that some of the roads in Bankopolis, the city wher...
[{"type": "stdin_stdout", "input": "7 7\n.S.****\n...*.*.\n.****..\n.*.**.*\n..T*...\n***..*.\n**+****\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "7 7\n.S.****\n...*.*.\n.****..\n.*.**.*\n..T*...\n***..*.\n****+**\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "7 7\n.S.****\n...*.*.\n.****..\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTomash keeps wandering off and getting lost while he is walking along the streets of Berland. It's no surprise! In his home town, for any pair of intersections there is exactly one way to walk from one intersection to the...
[{"type": "stdin_stdout", "input": "8 56\n1 2\n1 3\n1 4\n1 5\n1 6\n1 7\n1 8\n2 1\n2 3\n2 4\n2 5\n2 6\n2 7\n2 8\n3 1\n3 2\n3 4\n3 5\n3 6\n3 7\n3 8\n4 1\n4 2\n4 3\n4 5\n4 6\n4 7\n4 8\n5 1\n5 2\n5 3\n5 4\n5 6\n5 7\n5 8\n6 1\n6 2\n6 3\n6 4\n6 5\n6 7\n6 8\n7 1\n7 2\n7 3\n7 4\n7 5\n7 6\n7 8\n8 1\n8 2\n8 3\n8 4\n8 5\n8 6\n8 7...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSimple, given a string of words, return the length of the shortest word(s).\n\nString will never be empty and you do not need to account for different data types.\n\nWrite your solution by modifying this code:\n\n```pytho...
[{"input": "\"turns out random test cases are easier than writing out basic ones\"", "output": "[3]", "fn_name": "find_short"}, {"input": "\"bitcoin take over the world maybe who knows perhaps\"", "output": "[3]", "fn_name": "find_short"}, {"input": "\"i want to travel the world writing code one day\"", "output": "[1]"...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nKatie, Kuro and Shiro are best friends. They have known each other since kindergarten. That's why they often share everything with each other and work together on some very hard problems.\n\nToday is Shiro's birthday. She...
[{"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "1000000000000000001\n"}, {"type": "stdin_stdout", "input": "1043714136496022950\n", "output": "1043714136496022951\n"}, {"type": "stdin_stdout", "input": "1837625121252532586\n", "output": "1837625121252532587\n"}, {"type": "stdin_stdout", "input": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs you might know, cooking is the process of taking a food item and subjecting it to various processes(like heating, roasting, baking etc).\nA food item gets prepared after it has been subjected to exactly N processes.\nT...
[{"type": "stdin_stdout", "input": "3\n-2 2\n5 10\n1 11", "output": "2\n555841676\n110\n"}, {"type": "stdin_stdout", "input": "3\n-2 2\n4 15\n1 12", "output": "2\n286982263\n132\n"}, {"type": "stdin_stdout", "input": "3\n-16 2\n10 13\n1 6", "output": "2\n131267026\n30\n"}, {"type": "stdin_stdout", "input": "3\n-8 2\n10...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDr. Moriarty is about to send a message to Sherlock Holmes. He has a string s. \n\nString p is called a substring of string s if you can read it starting from some position in the string s. For example, string \"aba\" has...
[{"type": "stdin_stdout", "input": "ksmbytfyhhnstlecripupiwdhbkhfpfmimrbqgszohcqnezcybvwasxmkxfupvuecsctcpadccnqexsglwaiyxcoyheefcjmdedesgjqdtqgrvfjonzesffousooutsjumrxl\nhgjqihcfbnmgufonaiudbjegexexthrzcdkuimwogpbyovemztzcmqnrbhabxyyxyfuzpyhjgnioexbezzupcxlyzuuncstiiqsjzdtqppqhxilvqimlpjejiqbwpeekzweeyvthvjffgfvqauqru...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCalculate the number of items in a vector that appear at the same index in each vector, with the same value. \n\n```python\n vector_affinity([1, 2, 3, 4, 5], [1, 2, 2, 4, 3]) # => 0.6\n vector_affinity([1, 2, 3], [1, ...
[{"input": "[6, 6, 6, 6, 6, 6]\n[6, null, null, 6, 6, null]", "output": "[0.5]", "fn_name": "vector_affinity"}, {"input": "[6]\n[6, 6, 6, 6, 6, 6]", "output": "[0.16666666666666666]", "fn_name": "vector_affinity"}, {"input": "[1, 2, 3, 4]\n[1, 2, 3, 5]", "output": "[0.75]", "fn_name": "vector_affinity"}, {"input": "[1,...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn order to put away old things and welcome a fresh new year, a thorough cleaning of the house is a must.\n\nLittle Tommy finds an old polynomial and cleaned it up by taking it modulo another. But now he regrets doing thi...
[{"type": "stdin_stdout", "input": "1000000000000000000 2\n", "output": "61\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0 1 1 1 1 1 0 0 1 0 1 1 1 1 1 1 0 1 0 0 1 1 1 0 0 0 0 1 0 0 0 1 0 0 1 \n"}, {"type": "stdin_stdout", "input": "1000000000000000000 2\n", "output": "61\n0 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\nStick n circular stickers with a radius of 1 on a square origami paper with a side length of 10. The stickers can be stacked. Create a program that reads the coordinates of the position where the stickers are to be attach...
[{"type": "stdin_stdout", "input": "15\n3.13979,8.51743\n2.39506,3.84915\n2.68432,5.39095\n5.61904,9.16332\n7.85653,4.75593\n2.84021,5.41511\n1.79500,8.59211\n7.55389,8.17604\n4.70665,4.66125\n1.63470,4.42538\n7.34959,4.61981\n5.09003,8.11122\n5.24373,1.30066\n0.13517,1.83659\n7.57313,1.58150\n0", "output": "4\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently, Anton has found a set. The set consists of small English letters. Anton carefully wrote out all the letters from the set in one line, separated by a comma. He also added an opening curved bracket at the beginnin...
[{"type": "stdin_stdout", "input": "{a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N dishes, numbered 1, 2, \\ldots, N. Initially, for each i (1 \\leq i \\leq N), Dish i has a_i (1 \\leq a_i \\leq 3) pieces of sushi on it.\n\nTaro will perform the following operation repeatedly until all the p...
[{"type": "stdin_stdout", "input": "10\n1 3 2 3 3 2 3 2 1 3", "output": "54.48064457488221"}, {"type": "stdin_stdout", "input": "10\n1 3 2 2 3 2 3 2 1 3", "output": "52.8643923040\n"}, {"type": "stdin_stdout", "input": "10\n1 3 3 3 3 2 3 2 1 3", "output": "55.9466970748\n"}, {"type": "stdin_stdout", "input": "10\n1 3 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nValera the horse lives on a plane. The Cartesian coordinate system is defined on this plane. Also an infinite spiral is painted on the plane. The spiral consists of segments: [(0, 0), (1, 0)], [(1, 0), (1, 1)], [(1, 1), (...
[{"type": "stdin_stdout", "input": "37 -100\n", "output": "400\n"}, {"type": "stdin_stdout", "input": "100 100\n", "output": "397\n"}, {"type": "stdin_stdout", "input": "-96 -96\n", "output": "383\n"}, {"type": "stdin_stdout", "input": "100 100\n", "output": "397\n"}, {"type": "stdin_stdout", "input": "37 -100\n", "out...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this Kata, you will implement a function `count` that takes an integer and returns the number of digits in `factorial(n)`. \n\nFor example, `count(5) = 3`, because `5! = 120`, and `120` has `3` digits. \n\nMore exampl...
[{"input": "50000000", "output": "[363233781]", "fn_name": "count"}, {"input": "5000000", "output": "[31323382]", "fn_name": "count"}, {"input": "500000", "output": "[2632342]", "fn_name": "count"}, {"input": "50000", "output": "[213237]", "fn_name": "count"}, {"input": "5000", "output": "[16326]", "fn_name": "count"},...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn computer science, cycle detection is the algorithmic problem of finding a cycle in a sequence of iterated function values.\n\nFor any function Ζ’, and any initial value x0 in S, the sequence of iterated function values\...
[{"input": "[1, 1, 1, 1, 1, 1, 1, 1]", "output": "[[0, 1]]", "fn_name": "cycle"}, {"input": "[1, 2, 3, 4, 2, 3, 4]", "output": "[[1, 3]]", "fn_name": "cycle"}, {"input": "[2, 3, 4, 2, 3, 4]", "output": "[[0, 3]]", "fn_name": "cycle"}, {"input": "[1, 2, 3, 4]", "output": "[[]]", "fn_name": "cycle"}, {"input": "[7]", "ou...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nCreate a program to determine the positional relationship between a triangle and a circle on a plane. All target figures shall include boundaries. The triangle is given the position of three vertices, and the circle is gi...
[{"type": "stdin_stdout", "input": "1 1\n6 0\n3 3\n3 0\n3\n3 11\n1 3\n11 16\n12 4\n5\n15 4\n17 12\n22 5\n7 22\n3\n5 13\n16 2\n16 9\n5 3\n1\n0 0", "output": "b\nd\nd\nd\n"}, {"type": "stdin_stdout", "input": "1 1\n6 0\n3 3\n3 2\n3\n3 11\n1 3\n11 16\n12 7\n5\n15 3\n17 7\n22 5\n7 12\n4\n5 13\n13 2\n16 9\n5 3\n2\n0 0", "ou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nI always thought that my old friend John was rather richer than he looked, but I never knew exactly how much money he actually had. One day (as I was plying him with questions) he said:\n\n* \"Imagine I have between `m` a...
[{"input": "0\n200", "output": "[[[\"M: 37\", \"B: 5\", \"C: 4\"], [\"M: 100\", \"B: 14\", \"C: 11\"], [\"M: 163\", \"B: 23\", \"C: 18\"]]]", "fn_name": "howmuch"}, {"input": "20000\n20100", "output": "[[[\"M: 20008\", \"B: 2858\", \"C: 2223\"], [\"M: 20071\", \"B: 2867\", \"C: 2230\"]]]", "fn_name": "howmuch"}, {"inpu...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp is an organizer of a Berland ICPC regional event. There are $n$ universities in Berland numbered from $1$ to $n$. Polycarp knows all competitive programmers in the region. There are $n$ students: the $i$-th stude...
[{"type": "stdin_stdout", "input": "4\n7\n1 3 1 2 1 2 1\n12 8 3 2 5 1 5\n10\n2 2 2 4 2 2 2 6 3 3\n3435 3014 2197 4336 2893 1527 5359 2175 1961 2567\n6\n3 6 3 3 3 3\n0 11 6 5 9 7\n1\n1\n278\n", "output": "36 28 22 25 0 0 0\n29464 22953 18425 14701 16898 18425 0 0 0 0\n38 27 22 27 27 0\n278\n"}, {"type": "stdin_stdout", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBerland annual chess tournament is coming!\n\nOrganizers have gathered 2Β·n chess players who should be divided into two teams with n people each. The first team is sponsored by BerOil and the second team is sponsored by B...
[{"type": "stdin_stdout", "input": "100\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe mobile application store has a new game called \"Subway Roller\".\n\nThe protagonist of the game Philip is located in one end of the tunnel and wants to get out of the other one. The tunnel is a rectangular field cons...
[{"type": "stdin_stdout", "input": "1\n100 26\ns................PPPP.CCCCC..UUUUUU.........YYYQQQQQQQ...GGGGG............MMM.....JJJJ..............\n.OOOOOO....EEE....................................................SSSSSS........LLLLLL......NNNIIII.\n......FFFFFF...VVVV..ZZZBBB...KKKKK..WWWWWWWXXX..RRRRRRR......AAAAADD...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given names of two days of the week.\n\nPlease, determine whether it is possible that during some non-leap year the first day of some month was equal to the first day of the week you are given, while the first day...
[{"type": "stdin_stdout", "input": "wednesday\nwednesday\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "wednesday\nwednesday\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "wednesday\nsaturday\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "wednesday\nsaturday\n", "output": "YES\n"}, {...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMr. A came to Aizu for sightseeing. You can overlook the Aizu Basin from the window of the hotel where you stayed. As I was looking at the scenery, I noticed a piece of the photo on the floor. Apparently I took the outsid...
[{"type": "stdin_stdout", "input": "8 4\n2 1 3 1 1 5 1 3\n2 3 2 4 1 0 2 1\n0 3 -1 2 1 1 4 2\n1 2 3 2 1 1 5 4\n0 2 0 1 1 3 2 1\n1 3 1 2 2 4 3 2\n5 1 2 1 4 1 1 5\n4 1 1 -1 1 2 2 1\n2 -1 -1 -1\n0 3 -1 -1\n-1 2 2 4\n-1 1 -1 1\n5 3\n1 0 2 3 5\n2 3 7 2 1\n2 5 4 2 2\n8 9 0 3 3\n3 6 0 4 7\n-1 -1 2\n-1 3 5\n0 4 -1\n0 0", "outp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBrave Ponta has finally arrived at the final dungeon. This is a dark wilderness in front of the fort of the evil emperor Boromos, with fairly strong monsters guarding their territories.\n\n<image>\n\n\nFigure 1: Wildernes...
[{"type": "stdin_stdout", "input": "2\n1 1\n5 5\n4\n1.0 1.0317956219670807\n1.5068159031079704 3.2675997669892194\n4.150171138530334 2.1332708795299036\n3.0 3.589169796022375\n1\n2.6727744925703703 2.0\n0", "output": "impossible\n4.57812033\nimpossible\n"}, {"type": "stdin_stdout", "input": "2\n1 1\n5 5\n4\n1.0 1.03179...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nValera has array a, consisting of n integers a_0, a_1, ..., a_{n} - 1, and function f(x), taking an integer from 0 to 2^{n} - 1 as its single argument. Value f(x) is calculated by formula $f(x) = \\sum_{i = 0}^{n - 1} a_{...
[{"type": "stdin_stdout", "input": "43\n761 2165 6131 8874 8980 119 8300 9006 6278 7582 4740 6321 10042 6869 3788 17625 1707 5070 3809 335 2494 8255 1123 1430 190 5712 7313 3286 15423 133 1032 3067 8043 5297 5398 12168 13897 2141 1436 10227 362 8438 2300\n0111011100100011110010011110011011010001101\n", "output": "23536...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nUh oh, Someone at the office has dropped all these sequences on the floor and forgotten to label them with their correct bases. \n\nWe have to fix this before the boss gets back or we're all going to be fired!\n\nThis is ...
[{"input": "[\"301\", \"302\", \"303\", \"304\", \"305\", \"310\", \"311\", \"312\", \"313\", \"314\"]", "output": "[6]", "fn_name": "base_finder"}, {"input": "[\"50\", \"51\", \"61\", \"53\", \"54\", \"60\", \"52\", \"62\", \"55\", \"56\"]", "output": "[7]", "fn_name": "base_finder"}, {"input": "[\"1\", \"2\", \"3\", ...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe arrange the numbers between 1 and N (1 <= N <= 10000) in increasing order and decreasing order like this:\n\n\n1 2 3 4 5 6 7 8 9 . . . N\nN . . . 9 8 7 6 5 4 3 2 1\n\n\nTwo numbers faced each other form a pair. Your ta...
[{"type": "stdin_stdout", "input": "1\n10\n13\n373", "output": "0\n0\n3\n20\n"}, {"type": "stdin_stdout", "input": "1\n175\n19\n12", "output": "0\n14\n4\n2\n"}, {"type": "stdin_stdout", "input": "1\n175\n19\n16", "output": "0\n14\n4\n0\n"}, {"type": "stdin_stdout", "input": "1\n12\n7\n115", "output": "0\n2\n2\n12\n"}, ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is a string S representing the day of the week today.\nS is SUN, MON, TUE, WED, THU, FRI, or SAT, for Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday, respectively.\nAfter how many days is the nex...
[{"type": "stdin_stdout", "input": "SAT\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "SUN\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "FRI\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "MON\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "THU\n", "output": "3\n"}, {"type": "stdi...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is a positive integer N.\nHow many tuples (A,B,C) of positive integers satisfy A \\times B + C = N?\n\n-----Constraints-----\n - 2 \\leq N \\leq 10^6\n - All values in input are integers.\n\n-----Input-----\nInput ...
[{"type": "stdin_stdout", "input": "1000000\n", "output": "13969985\n"}, {"type": "stdin_stdout", "input": "877046\n", "output": "12137262\n"}, {"type": "stdin_stdout", "input": "999931\n", "output": "13968881\n"}, {"type": "stdin_stdout", "input": "999901\n", "output": "13968459\n"}, {"type": "stdin_stdout", "input": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consisting only of lowercase and uppercase Latin letters.\n\nLet A be a set of positions in the string. Let's call it pretty if followin...
[{"type": "stdin_stdout", "input": "200\nrsgraosldglhdoorwhkrsehjpuxrjuwgeanjgezhekprzarelduuaxdnspzjuooguuwnzkowkuhzduakdrzpnslauejhrrkalwpurpuuswdgeadlhjwzjgegwpknepazwwleulppwrlgrgedlwdzuodzropsrrkxusjnuzshdkjrxxpgzanzdrpnggdwxarpwohxdepJ\n", "output": "17\n"}, {"type": "stdin_stdout", "input": "200\nMkuxcDWdcnqsrlT...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two arrays $a$ and $b$, each consisting of $n$ positive integers, and an integer $x$. Please determine if one can rearrange the elements of $b$ so that $a_i + b_i \\leq x$ holds for each $i$ ($1 \\le i \\le ...
[{"type": "stdin_stdout", "input": "4\n3 4\n0 2 -1\n1 2 2\n\n2 6\n1 4\n2 5\n\n4 4\n2 2 3 -1\n3 5 2 4\n\n1 0\n5\n5\n", "output": "Yes\nYes\nNo\nNo\n"}, {"type": "stdin_stdout", "input": "4\n3 4\n0 2 -1\n1 2 2\n\n2 6\n1 4\n2 5\n\n4 4\n2 2 3 -1\n1 5 2 4\n\n1 0\n5\n5\n", "output": "Yes\nYes\nNo\nNo\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVitaly is a very weird man. He's got two favorite digits a and b. Vitaly calls a positive integer good, if the decimal representation of this integer only contains digits a and b. Vitaly calls a good number excellent, if ...
[{"type": "stdin_stdout", "input": "3 6 1000000\n", "output": "786609214\n"}, {"type": "stdin_stdout", "input": "8 9 1000000\n", "output": "573697309\n"}, {"type": "stdin_stdout", "input": "1 2 1000000\n", "output": "786609214\n"}, {"type": "stdin_stdout", "input": "1 2 1000000\n", "output": "786609214\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n## Nova polynomial add\n\nThis kata is from a series on polynomial handling. ( [#1](http://www.codewars.com/kata/nova-polynomial-1-add-1) [#2](http://www.codewars.com/kata/570eb07e127ad107270005fe) [#3](http://www.codewar...
[{"input": "[1, 2, 3, 4, 5, 6]\n[]", "output": "[[1, 2, 3, 4, 5, 6]]", "fn_name": "poly_add"}, {"input": "[]\n[1, 2, 3, 4, 5, 6]", "output": "[[1, 2, 3, 4, 5, 6]]", "fn_name": "poly_add"}, {"input": "[1, 2, 3, 4]\n[4, 3, 2, 1]", "output": "[[5, 5, 5, 5]]", "fn_name": "poly_add"}, {"input": "[1, 2]\n[1]", "output": "[[2...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven are positive integers A and B.\nLet us choose some number of positive common divisors of A and B.\nHere, any two of the chosen divisors must be coprime.\nAt most, how many divisors can we choose?Definition of common...
[{"type": "stdin_stdout", "input": "1000000000000 1000000000000\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "642507465600 642507465600\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "963761198400 963761198400\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "200560490130 200560490130\n", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nA mysterious $ X $ [cm] plant grows in one place. This plant has the following mysterious properties.\n\n* Say \"nobiro\" to this plant and it will grow $ A $ [cm].\n* Say \"tidime\" to this plant and it will g...
[{"type": "stdin_stdout", "input": "109 30 5\n0\norioan\nnobiro\nuifimd", "output": "109\n"}, {"type": "stdin_stdout", "input": "112 30 9\n0\norioan\nniboro\ntieimd", "output": "112\n"}, {"type": "stdin_stdout", "input": "84 122 10\n0\noobrjn\nonciro\nudfimi", "output": "84\n"}, {"type": "stdin_stdout", "input": "17 12...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nGiven a sequence $ a_i $ of length $ N $. Output all integers $ K (1 \\ le K \\ le N) $ that satisfy the following conditions.\n\nCondition: Well sorted $ a_1, \\ cdots, a_K $ matches $ a_ {N-K + 1}, \\ cdots, ...
[{"type": "stdin_stdout", "input": "8\n0 1 1 -24 -1 1 1 0", "output": "1 2 3 5 6 7 8\n"}, {"type": "stdin_stdout", "input": "8\n-1 0 12 16 3 1 0 -1", "output": "1 2 6 7 8\n"}, {"type": "stdin_stdout", "input": "8\n-1 0 12 8 3 1 0 -1", "output": "1 2 6 7 8\n"}, {"type": "stdin_stdout", "input": "8\n5 2 4 4 4 14 2 5", "o...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi is doing a research on sets of points in a plane. Takahashi thinks a set S of points in a coordinate plane is a good set when S satisfies both of the following conditions:\n\n* The distance between any two point...
[{"type": "stdin_stdout", "input": "33 4 2", "output": "0 0\n0 1\n0 4\n0 5\n0 8\n0 9\n0 12\n0 13\n0 16\n0 17\n0 20\n0 21\n0 24\n0 25\n0 28\n0 29\n0 32\n0 33\n0 36\n0 37\n0 40\n0 41\n0 44\n0 45\n0 48\n0 49\n0 52\n0 53\n0 56\n0 57\n0 60\n0 61\n0 64\n0 65\n2 2\n2 3\n2 6\n2 7\n2 10\n2 11\n2 14\n2 15\n2 18\n2 19\n2 22\n2 23...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is a sequence of N integers A_1, \\ldots, A_N.\nFind the (multiplicative) inverse of the sum of the inverses of these numbers, \\frac{1}{\\frac{1}{A_1} + \\ldots + \\frac{1}{A_N}}.\n\n-----Constraints-----\n - 1 \\l...
[{"type": "stdin_stdout", "input": "100\n1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite\n```python\nword_pattern(pattern, string)\n```\nthat given a ```pattern``` and a string ```str```, find if ```str``` follows the same sequence as ```pattern```. \n\nFor example:\n```python\nword_pattern('abab', 'tru...
[{"input": "\"aafggiilp\"\n\"cow cow fly rooster pig sheep sheep chicken aardvark\"", "output": "[false]", "fn_name": "word_pattern"}, {"input": "\"aafggiilp\"\n\"cow cow fly pig pig sheep sheep chicken aardvark\"", "output": "[true]", "fn_name": "word_pattern"}, {"input": "\"abcdef\"\n\"apple banana cat donkey elephan...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's consider one interesting word game. In this game you should transform one word into another through special operations. \n\nLet's say we have word w, let's split this word into two non-empty parts x and y so, that w...
[{"type": "stdin_stdout", "input": "dkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjij\ndddkikjjidkkidijjjjkkjjikjdikiidijjikikjijjiijdikkjjjiddjjijkkkjkiijijki...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSometimes Mister B has free evenings when he doesn't know what to do. Fortunately, Mister B found a new game, where the player can play against aliens.\n\nAll characters in this game are lowercase English letters. There a...
[{"type": "stdin_stdout", "input": "12 12 876543210 1000000000\n", "output": "13"}, {"type": "stdin_stdout", "input": "10 12 220000011 220000032\n", "output": "11"}, {"type": "stdin_stdout", "input": "3 10 498103029 1063506054\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "13 8 654321109 654321126\n", "output...
code_stdio
[ { "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 te...
[{"type": "stdin_stdout", "input": "4\n1\n100\n50 1\n49 1\n100\n8\n100 200 100 200 100 200 100 100\n10 2\n15 3\n107\n3\n1000000000 1000000000 1000000000\n50 1\n50 1\n3000000000\n5\n200 100 100 100 100\n69 5\n31 2\n90\n", "output": "-1\n6\n3\n4\n"}, {"type": "stdin_stdout", "input": "4\n1\n100\n50 1\n49 1\n100\n8\n100 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMonocarp has got an array $a$ consisting of $n$ integers. Let's denote $k$ as the mathematic mean of these elements (note that it's possible that $k$ is not an integer).\n\nThe mathematic mean of an array of $n$ elements ...
[{"type": "stdin_stdout", "input": "4\n4\n8 8 12 14\n3\n50 25 10\n5\n1 4 7 3 5\n7\n-1 2 3 4 1 0 7\n", "output": "0\n0\n2\n0\n"}, {"type": "stdin_stdout", "input": "4\n4\n8 8 12 14\n3\n44 25 10\n5\n1 4 7 3 5\n7\n-1 2 3 4 1 0 7\n", "output": "0\n0\n2\n0\n"}, {"type": "stdin_stdout", "input": "4\n4\n8 8 18 14\n3\n44 25 10...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ candles on a Hanukkah menorah, and some of its candles are initially lit. We can describe which candles are lit with a binary string $s$, where the $i$-th candle is lit if and only if $s_i=1$.\n\nInitially, ...
[{"type": "stdin_stdout", "input": "5\n5\n10010\n11010\n2\n01\n11\n3\n110\n111\n9\n100010111\n111101100\n4\n001011011\n011010111\n", "output": "-1\n1\n-1\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "5\n5\n11000\n01000\n2\n01\n10\n3\n000\n101\n9\n100011111\n101101100\n9\n001001000\n011000101\n", "output": "-1\n2\n-1\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRelative B came to Mr. A's house. He is 3 years old and loves blocks. The block he has is shaped like Figure 1.\n\n<image>\n\nFigure 1\n\nMr. B is laying blocks on the board. When I asked him, \"What are you making?\", He...
[{"type": "stdin_stdout", "input": "20 21\n1 0\n14 8\n7\n4 0 1 1\n6 -1 1 3\n2 0 3 3\n1 0 5 0\n5 1 7 3\n2 -1 2 7\n2 -1 6 8\n20 20\n9 9\n1 1\n6\n2 0 1 1\n1 0 5 0\n2 1 1 4\n5 0 1 0\n4 1 6 10\n4 0 8 5\n0 0", "output": "NG\nNG\n"}, {"type": "stdin_stdout", "input": "20 21\n1 0\n14 8\n7\n4 0 1 1\n6 -1 1 3\n2 0 3 3\n1 0 5 0\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is BMI (Body Mass Index) as an index showing the degree of obesity. The BMI value is calculated using the following formula.\n\nBMI = weight (kg) / (height (m)) 2\n\nThe closer the BMI value is to the standard value...
[{"type": "stdin_stdout", "input": "6\n2 165 27\n-1 317 60\n2 68 72\n11 160 75\n7 185 001\n10 182 113\n3\n3 37 105\n0 229 6\n2 204 75\n0", "output": "11\n2\n"}, {"type": "stdin_stdout", "input": "6\n2 95 27\n-1 317 60\n2 68 72\n11 160 75\n7 185 101\n10 182 113\n3\n3 37 105\n0 229 6\n1 204 75\n0", "output": "11\n1\n"}, ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn Aramic language words can only represent objects.\n\nWords in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the sam...
[{"type": "stdin_stdout", "input": "10\nbda bbb cda dca dda dcb bcd dcb ada ddd\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "10\ncda bbb cda dca dda dcb bcd dcb ada ddd\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "10\nbda bbb cda dca dda dcb bcd dcb ada edd\n", "output": "6\n"}, {"type": "stdin_...
code_stdio