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\nAfter Vitaly was expelled from the university, he became interested in the graph theory.\n\nVitaly especially liked the cycles of an odd length in which each vertex occurs at most once.\n\nVitaly was wondering how to solv...
[{"type": "stdin_stdout", "input": "5 5\n1 2\n2 3\n3 4\n4 5\n5 1\n", "output": "0 1\n"}, {"type": "stdin_stdout", "input": "6 5\n1 2\n2 3\n3 4\n4 5\n5 1\n", "output": "0 1\n"}, {"type": "stdin_stdout", "input": "9 5\n1 2\n2 3\n3 4\n4 5\n5 1\n", "output": "0 1\n"}, {"type": "stdin_stdout", "input": "100000 0\n", "output...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a simple connected undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M.\n\nEdge i connects Vertex a_i and b_i bidirectionally.\n\nDeterm...
[{"type": "stdin_stdout", "input": "18 27\n17 9\n12 15\n18 17\n13 18\n13 1\n5 7\n12 1\n14 5\n15 11\n14 6\n1 9\n5 1\n18 16\n4 6\n7 2\n7 11\n6 3\n12 14\n5 3\n10 5\n5 8\n10 15\n3 15\n9 8\n7 15\n2 16\n18 15", "output": "No\n"}, {"type": "stdin_stdout", "input": "18 15\n17 9\n12 15\n18 17\n13 18\n13 1\n5 7\n12 1\n14 5\n15 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA long time ago in some far country lived king Copa. After the recent king's reform, he got so large powers that started to keep the books by himself.\n\nThe total income A of his kingdom during 0-th year is known, as wel...
[{"type": "stdin_stdout", "input": "-1 -512 10\n", "output": "No solution\n"}, {"type": "stdin_stdout", "input": "-3 -768 13\n", "output": "No solution\n"}, {"type": "stdin_stdout", "input": "-173 373 3\n", "output": "No solution\n"}, {"type": "stdin_stdout", "input": "-521 526 1\n", "output": "No solution\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven an array of integers your solution should find the smallest integer. \n\nFor example:\n\n- Given `[34, 15, 88, 2]` your solution will return `2`\n- Given `[34, -345, -1, 100]` your solution will return `-345`\n\nYou...
[{"input": "[0, 18446744073709551616, -18446744073709551617, 18446744073709551616, 18446744073709551616]", "output": "[-18446744073709551617]", "fn_name": "find_smallest_int"}, {"input": "[0, -18446744073709551615, 18446744073709551616]", "output": "[-18446744073709551615]", "fn_name": "find_smallest_int"}, {"input": "...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nXenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right. \n\nSpy s has an important note. He has to pass the note to spy f. Xenia inte...
[{"type": "stdin_stdout", "input": "100000 1 11500 86289\n1 86 75626\n", "output": "XRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn Aizu prefecture, we decided to create a new town to increase the population. To that end, we decided to cultivate a new rectangular land and divide this land into squares of the same size. The cost of developing this l...
[{"type": "stdin_stdout", "input": "10 29 10", "output": "2900\n"}, {"type": "stdin_stdout", "input": "10 29 13", "output": "3770\n"}, {"type": "stdin_stdout", "input": "4 -1 104", "output": "-416\n"}, {"type": "stdin_stdout", "input": "20 -1 18", "output": "-360\n"}, {"type": "stdin_stdout", "input": "12 -1 14", "outp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAnfisa the monkey learns to type. She is yet unfamiliar with the \"space\" key and can only type in lower-case Latin letters. Having typed for a fairly long line, Anfisa understood that it would be great to divide what sh...
[{"type": "stdin_stdout", "input": "200 1 200\nlycjpjrpkgxrkfvutlcwglghxadttpihmlpphwfttegfpimjxintjdxgqfhzrmxfcfojnxruhyfynlzgpxjeobjyxarsfxaqeogxfzvdlwsimupkwujudtfenryulzvsiazneyibqtweeuxpzrbumqqswjasliyjnnzfzuvthhzcsgfljikkajqkpjftztrzpjneaxqg\n", "output": "l\ny\nc\nj\np\nj\nr\np\nk\ng\nx\nr\nk\nf\nv\nu\nt\nl\nc\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe famous global economic crisis is approaching rapidly, so the states of Berman, Berance and Bertaly formed an alliance and allowed the residents of all member states to freely pass through the territory of any of them....
[{"type": "stdin_stdout", "input": "10 10\n##.#..#.#2\n...###....\n#..#....##\n.....#....\n.#........\n.....#####\n...#..#...\n....###...\n###.##...#\n.#...1#.3.\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "10 10\n#...33.#.#\n#.#.33.#1.\n2.....#.11\n222#.#.#..\n####...#.#\n#.........\n.#....#...\n..#..#.##...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs a New Year's gift, Dolphin received a string s of length 19.\n\nThe string s has the following format: [five lowercase English letters],[seven lowercase English letters],[five lowercase English letters].\n\nDolphin wan...
[{"type": "stdin_stdout", "input": "happy,newyear,enjoy\n", "output": "happy newyear enjoy\n"}, {"type": "stdin_stdout", "input": "haiku,atcoder,tasks\n", "output": "haiku atcoder tasks\n"}, {"type": "stdin_stdout", "input": "abcde,fghihgf,edcba\n", "output": "abcde fghihgf edcba\n"}, {"type": "stdin_stdout", "input": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the year of $30XX$ participants of some world programming championship live in a single large hotel. The hotel has $n$ floors. Each floor has $m$ sections with a single corridor connecting all of them. The sections are...
[{"type": "stdin_stdout", "input": "10 10 1 8 4\n10\n2 3 4 5 6 7 8 9\n10\n1 1 3 1\n2 1 7 1\n2 1 15 1\n7 1 4 1\n10 1 7 1\n2 1 7 1\n3 1 2 1\n5 1 2 1\n10 1 5 1\n6 1 9 1\n", "output": "3\n4\n6\n3\n3\n4\n3\n3\n4\n3\n"}, {"type": "stdin_stdout", "input": "10 10 1 8 4\n10\n2 3 4 5 6 7 8 9\n10\n1 1 3 1\n2 1 7 1\n2 1 15 1\n7 1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have N items that you want to put them into a knapsack. Item i has value vi and weight wi.\n\nYou want to find a subset of items to put such that:\n\n* The total value of the items is as large as possible.\n* The item...
[{"type": "stdin_stdout", "input": "1 10\n15 4\n0 3\n4 1\n13 3", "output": "15\n"}, {"type": "stdin_stdout", "input": "1 10\n27 4\n0 0\n6 1\n13 3", "output": "27\n"}, {"type": "stdin_stdout", "input": "1 10\n39 4\n1 0\n6 1\n13 3", "output": "39\n"}, {"type": "stdin_stdout", "input": "1 10\n24 4\n0 3\n5 1\n13 5", "outpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven a time in AM/PM format as a string, convert it to military (24-hour) time as a string.\n\nMidnight is 12:00:00AM on a 12-hour clock, and 00:00:00 on a 24-hour clock. Noon is 12:00:00PM on a 12-hour clock, and 12:00:...
[{"input": "\"12:00:01AM\"", "output": "[\"00:00:01\"]", "fn_name": "get_military_time"}, {"input": "\"01:02:03AM\"", "output": "[\"01:02:03\"]", "fn_name": "get_military_time"}, {"input": "\"02:04:05AM\"", "output": "[\"02:04:05\"]", "fn_name": "get_military_time"}, {"input": "\"03:06:07AM\"", "output": "[\"03:06:07\"...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Sentence Smash\n\nWrite a function that takes an array of words and smashes them together into a sentence and returns the sentence. You can ignore any need to sanitize words or add punctuation, but you should add spaces...
[{"input": "[\"this\", \"is\", \"a\", \"really\", \"long\", \"sentence\"]", "output": "[\"this is a really long sentence\"]", "fn_name": "smash"}, {"input": "[\"hello\", \"amazing\", \"world\"]", "output": "[\"hello amazing world\"]", "fn_name": "smash"}, {"input": "[\"hello\", \"world\"]", "output": "[\"hello world\"]...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a function that returns the index of the first occurence of the word \"Wally\". \"Wally\" must not be part of another word, but it can be directly followed by a punctuation mark. If no such \"Wally\" exists, retur...
[{"input": "\"Walley ,Wally -Wally ;Wally +Wally :Wally\"", "output": "[-1]", "fn_name": "wheres_wally"}, {"input": "\"Walley Wally, Wally- Wally: Wally+ Wally:\"", "output": "[7]", "fn_name": "wheres_wally"}, {"input": "\"wally mollyWally Wallybrolly 'Wally\"", "output": "[-1]", "fn_name": "wheres_wally"}, {"input": "...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nzscoder has a deck of $n+m$ custom-made cards, which consists of $n$ cards labelled from $1$ to $n$ and $m$ jokers. Since zscoder is lonely, he wants to play a game with himself using those cards. \n\nInitially, the deck ...
[{"type": "stdin_stdout", "input": "2000000 2000000\n", "output": "507914970\n"}, {"type": "stdin_stdout", "input": "1999922 1999943\n", "output": "255234262\n"}, {"type": "stdin_stdout", "input": "1999968 1999941\n", "output": "499830706\n"}, {"type": "stdin_stdout", "input": "1999913 1999918\n", "output": "667185390\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this Kata you are to implement a function that parses a string which is composed from tokens of the form 'n1-n2,n3,n4-n5:n6' where 'nX' is a positive integer. Each token represent a different range:\n\n'n1-n2' represen...
[{"input": "\"1-10,14, 20-25:2\"", "output": "[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 14, 20, 22, 24]]", "fn_name": "range_parser"}, {"input": "\"1-10,3\"", "output": "[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 3]]", "fn_name": "range_parser"}, {"input": "\"5-10\"", "output": "[[5, 6, 7, 8, 9, 10]]", "fn_name": "range_parser"}, {"input...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn McD's Burger, n hungry burger fans are ordering burgers. The ith order is placed by the ith fan at ti time and it takes di time to procees. What is the order in which the fans will get their burgers?\n\nInput Format\n\...
[{"type": "stdin_stdout", "input": "867\n490317 691111\n887872 411997\n656114 768604\n1027 17196\n982834 242480\n429255 61218\n513761 775074\n983667 410967\n412679 463744\n239690 278648\n559213 257757\n898250 192154\n795524 339490\n492066 774265\n713302 493367\n877920 234682\n500217 919598\n161118 441563\n816297 891191...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSagheer is working at a kindergarten. There are n children and m different toys. These children use well-defined protocols for playing with the toys:\n\n * Each child has a lovely set of toys that he loves to play with. ...
[{"type": "stdin_stdout", "input": "13 18 27 13\n1 1\n1 2\n1 3\n1 4\n1 17\n2 5\n2 1\n3 6\n3 2\n5 14\n5 3\n4 4\n6 9\n6 3\n7 8\n7 3\n8 7\n8 9\n10 11\n10 14\n11 10\n11 15\n11 11\n9 12\n9 11\n12 10\n13 15\n6 8\n6 14\n6 1\n6 17\n6 18\n11 12\n11 1\n11 1\n11 17\n1 18\n1 12\n1 7\n1 14\n", "output": "3\n0\n0\n0\n0\n4\n0\n0\n0\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a of n positive integers.\n\nYou can use the following operation as many times as you like: select any integer 1 ≤ k ≤ n and do one of two things: \n\n * decrement by one k of the first elements of...
[{"type": "stdin_stdout", "input": "4\n3\n1 2 1\n5\n11 14 9 10 8\n5\n0 3 1 4 1\n4\n5 2 1 10\n", "output": "YES\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "4\n3\n1 2 1\n5\n11 14 9 6 10\n5\n0 3 1 2 1\n4\n5 2 1 10\n", "output": "YES\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "4\n3\n0 2 1\n5\n11 14 9 10...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this Kata, we are going to see how a Hash (or Map or dict) can be used to keep track of characters in a string. \n\nConsider two strings `\"aabcdefg\"` and `\"fbd\"`. How many characters do we have to remove from the f...
[{"input": "\"abcdexyz\"\n\"yxz\"", "output": "[5]", "fn_name": "solve"}, {"input": "\"abdegfg\"\n\"ffdb\"", "output": "[0]", "fn_name": "solve"}, {"input": "\"aabcdefg\"\n\"fbd\"", "output": "[5]", "fn_name": "solve"}, {"input": "\"abcxyz\"\n\"ayxz\"", "output": "[2]", "fn_name": "solve"}, {"input": "\"xyz\"\n\"yxxz\"...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nA new airplane SuperPuperJet has an infinite number of rows, numbered with positive integers starting with 1 from cockpit to tail. There are six seats in each row, denoted with letters from 'a' to 'f'. Seats 'a', 'b' and ...
[{"type": "stdin_stdout", "input": "1000000000000000000d\n", "output": "3999999999999999994\n"}, {"type": "stdin_stdout", "input": "1000000000000000000a\n", "output": "3999999999999999995\n"}, {"type": "stdin_stdout", "input": "1000000000000000000e\n", "output": "3999999999999999993\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNikephoros and Polycarpus play rock-paper-scissors. The loser gets pinched (not too severely!).\n\nLet us remind you the rules of this game. Rock-paper-scissors is played by two players. In each round the players choose o...
[{"type": "stdin_stdout", "input": "1457057352\nR\nPSRSRSSRPSRRSSSRSRRPRSPPSPPRPSRRPPRSRRSPPSPPSPRPRPRPSSRPRPRRPSSSSSPSRRRPSRSPPSPSRRSPSSRSRPSPRRRSRRRPSPRPPRPPPPPRPPRRRRRRPPRRSPSPSSPSSPRPRSPPRRRPSPSRSRRRRRPPPSRPRSPPSSRRRRPRPPRSPSSPRRRPPPPPRRSRSPRPPSRPRSRSRRPRRRPRSRSPRRRSRSSRPPPRRSRRSSRRPSRPPRSPSPRPRSSSRSSRRPSRRRRPSRRPP...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Smart Beaver from ABBYY invented a new message encryption method and now wants to check its performance. Checking it manually is long and tiresome, so he decided to ask the ABBYY Cup contestants for help.\n\nA message...
[{"type": "stdin_stdout", "input": "80 6 99\n48 97 9 77 73 21 86 78 48 5 71 16 42 67 90 27 30 52 41 86 53 4 60 17 66 38 94 46 51 51 70 11 1 16 74 53 17 12 82 95 51 33 83 70 45 27 90 57 67 2 68 15 20 61 47 90 11 5 95 33 69 35 79 51 95 45 10 17 12 88 93 43 31 31 85 68 85 81 70 43\n47 92 59 85 73 38\n", "output": "95 38 9...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAn array is called `zero-balanced` if its elements sum to `0` and for each positive element `n`, there exists another element that is the negative of `n`. Write a function named `ìsZeroBalanced` that returns `true` if its...
[{"input": "[-1, 1, -2, 2, -2, -2, -4, 4]", "output": "[false]", "fn_name": "is_zero_balanced"}, {"input": "[0, 0, 0, 0, 0, 0]", "output": "[true]", "fn_name": "is_zero_balanced"}, {"input": "[0, 0, 0, 0, 0]", "output": "[true]", "fn_name": "is_zero_balanced"}, {"input": "[3, -2, -1]", "output": "[false]", "fn_name": "...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven a tree T with non-negative weight, find the height of each node of the tree. For each node, the height is the distance to the most distant leaf from the node.\n\nConstraints\n\n* 1 ≤ n ≤ 10,000\n* 0 ≤ wi ≤ 1,000\n\n...
[{"type": "stdin_stdout", "input": "4\n0 2 2\n1 2 2\n2 3 12", "output": "14\n14\n12\n14\n"}, {"type": "stdin_stdout", "input": "4\n0 2 2\n1 2 2\n2 3 21", "output": "23\n23\n21\n23\n"}, {"type": "stdin_stdout", "input": "4\n0 2 2\n1 2 2\n2 3 31", "output": "33\n33\n31\n33\n"}, {"type": "stdin_stdout", "input": "4\n0 2 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAndrewid the Android is a galaxy-famous detective. In his free time he likes to think about strings containing zeros and ones.\n\nOnce he thought about a string of length n consisting of zeroes and ones. Consider the foll...
[{"type": "stdin_stdout", "input": "9\n011111101\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "9\n011111111\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "9\n011101111\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "9\n011101101\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "9\n0...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# RegExp Fun #1 - When I miss few days of gym\n\n## Disclaimer\n\nThe background story of this Kata is 100% fiction. Any resemblance to real people or real events is **nothing more than a coincidence** and should be rega...
[{"input": "\"probably Probably probably Probably probably Probably probably Probably probably Probably\"", "output": "[\"prolly Prolly prolly Prolly prolly Prolly prolly Prolly prolly Prolly\"]", "fn_name": "gym_slang"}, {"input": "\"instagram Instagram instagram Instagram instagram Instagram instagram Instagram insta...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this problem, we use the 24-hour clock.\n\nTakahashi gets up exactly at the time H_1 : M_1 and goes to bed exactly at the time H_2 : M_2. (See Sample Inputs below for clarity.) He has decided to study for K consecutive...
[{"type": "stdin_stdout", "input": "17 -4 435 10 -1", "output": "25095\n"}, {"type": "stdin_stdout", "input": "17 -4 722 10 -1", "output": "42315\n"}, {"type": "stdin_stdout", "input": "-1 -3 436 11 -1", "output": "26235\n"}, {"type": "stdin_stdout", "input": "-1 -3 239 11 -1", "output": "14415\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAn elementary school student Takahashi has come to a variety store.\nHe has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it?\nNote that he lives in T...
[{"type": "stdin_stdout", "input": "1977 001 1111", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1977 011 1111", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1977 011 1110", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1977 011 0110", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a square grid with $n$ rows and $n$ columns, where each cell has a non-negative integer written in it. There is a chip initially placed at the top left cell (the cell with coordinates $(1, 1)$). You need to ...
[{"type": "stdin_stdout", "input": "7\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1\n1000000000 1000000000 1000000000 1000000000 1000000000 1 1000000000\n1000000000 1000000000 1000000000 1000000000 1 1000000000 1000000000\n1000000000 1000000000 1000000000 1 1000000000 1000000000 1000000000\n10000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.\n\nA...
[{"type": "stdin_stdout", "input": "30 10\nUTNTGOKZYJ\nQHOUHNYZVW\nLTVGHJRZVW\nMZHYHOLZYJ\nERYEUEPZYE\nUZDBFTURYJ\nRVSMQTIZGW\nWDJQHMIRYY\nKCORHQPZYE\nRRPLFOZZVY\nJTXMFNNNYJ\nMVTGGOZZVV\nEHAFFNUZVF\nLBRNWJZNYE\nJVMOHTPZYJ\nWTARFJLZVV\nLVJCWOURVW\nLCLQFJYRVV\nQVBVGNJRYF\nNTZGHOLRYE\nMGQKHOUPYJ\nRRSSBXPZYJ\nRYCRGTLZYJ\nJ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program that extracts n different numbers from the numbers 0 to 100 and outputs the number of combinations that add up to s. Each n number is from 0 to 100, and the same number cannot be used in one combination. F...
[{"type": "stdin_stdout", "input": "4 133\n-1 0\n0 0", "output": "15011\n0\n"}, {"type": "stdin_stdout", "input": "4 102\n-1 0\n0 0", "output": "7153\n0\n"}, {"type": "stdin_stdout", "input": "8 80\n2 -2\n0 0", "output": "37638\n0\n"}, {"type": "stdin_stdout", "input": "3 133\n-1 0\n0 0", "output": "1202\n0\n"}, {"type...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe capital of Berland looks like a rectangle of size n × m of the square blocks of same size.\n\nFire!\n\nIt is known that k + 1 blocks got caught on fire (k + 1 ≤ n·m). Those blocks are centers of ignition. Moreover pos...
[{"type": "stdin_stdout", "input": "1000000000 1010000000 10\n668983398 843926244\n730038846 389721428\n400508549 779159281\n683648123 559948749\n105869012 181419826\n391396726 503295408\n248489591 686114055\n102102370 108241714\n610800354 28286278\n587730768 379340837\n", "output": "331016602\n"}, {"type": "stdin_stdo...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA string is called bracket sequence if it does not contain any characters other than \"(\" and \")\". A bracket sequence is called regular (shortly, RBS) if it is possible to obtain correct arithmetic expression by insert...
[{"type": "stdin_stdout", "input": "20\n(())(()()())(())()()\n", "output": "01100111111001100000\n"}, {"type": "stdin_stdout", "input": "20\n(()()()())(()())()()\n", "output": "01111111100111100000\n"}, {"type": "stdin_stdout", "input": "20\n(())(())(())()(())()\n", "output": "01100110011000011000\n"}, {"type": "stdin_...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are many freight trains departing from Kirnes planet every day. One day on that planet consists of $h$ hours, and each hour consists of $m$ minutes, where $m$ is an even number. Currently, there are $n$ freight trai...
[{"type": "stdin_stdout", "input": "10 24 60 8\n10 59\n21 56\n0 42\n21 27\n5 24\n5 53\n16 5\n5 22\n10 11\n10 46\n", "output": "1 5\n1 \n"}, {"type": "stdin_stdout", "input": "10 24 60 8\n10 59\n21 56\n0 42\n21 27\n5 24\n5 53\n16 5\n5 22\n10 11\n10 46\n", "output": "1 5\n1 \n"}, {"type": "stdin_stdout", "input": "9 24 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# A History Lesson\n\nThe Pony Express was a mail service operating in the US in 1859-60.\n\n\n\n\nIt reduced the time for messages to travel between the Atlantic and Pacific coasts to about 10 days, before it was made ob...
[{"input": "[90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nIt's well known that the best way to distract from something is to do one's favourite thing. Job is such a thing for Leha.\n\nSo the hacker began to work hard in order to get rid of boredom. It means that Leha began to ha...
[{"type": "stdin_stdout", "input": "15 17\n1 10 8\n5 19 1\n12 14 6\n9 19 8\n6 7 3\n5 11 9\n7 12 5\n17 20 8\n6 12 6\n11 19 4\n3 14 1\n15 19 10\n3 20 5\n5 19 9\n10 18 10\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "15 17\n1 10 8\n5 19 1\n12 14 6\n9 19 8\n6 7 3\n5 11 9\n7 12 5\n17 20 8\n6 12 6\n11 19 4\n3 14 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nInternational Carpenters Professionals Company (ICPC) is a top construction company with a lot of expert carpenters. What makes ICPC a top company is their original language.\n\nThe syntax of the language is simply given ...
[{"type": "stdin_stdout", "input": "3\n-1 ( 10\n10 ) 5\n10 ) 5", "output": "No\nNo\nYes\n"}, {"type": "stdin_stdout", "input": "3\n-1 ( 0\n10 ) 4\n20 ( 4", "output": "Yes\nNo\nYes\n"}, {"type": "stdin_stdout", "input": "3\n-1 ) 10\n10 ( 12\n10 ( 7", "output": "No\nNo\nNo\n"}, {"type": "stdin_stdout", "input": "3\n-1 ( ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCreate a program that outputs the surface area S of a square cone with a height of h, with a square with one side x as the base. However, assume that the line segment connecting the apex and the center of the base is orth...
[{"type": "stdin_stdout", "input": "6\n5\n-1\n2\n0\n0", "output": "105.971422738\n-3.12310562562\n"}, {"type": "stdin_stdout", "input": "6\n5\n14\n4\n0\n0", "output": "105.971422738\n421.743216952\n"}, {"type": "stdin_stdout", "input": "6\n5\n14\n3\n0\n0", "output": "105.971422738\n409.241646964\n"}, {"type": "stdin_st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWhen provided with a number between 0-9, return it in words.\n\nInput :: 1\n\nOutput :: \"One\".\n\nIf your language supports it, try using a switch statement.\n\nWrite your solution by modifying this code:\n\n```python\n...
[{"input": "3", "output": "[\"Three\"]", "fn_name": "switch_it_up"}, {"input": "7", "output": "[\"Seven\"]", "fn_name": "switch_it_up"}, {"input": "8", "output": "[\"Eight\"]", "fn_name": "switch_it_up"}, {"input": "0", "output": "[\"Zero\"]", "fn_name": "switch_it_up"}, {"input": "4", "output": "[\"Four\"]", "fn_name"...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Task\n let F(N) be the sum square of digits of N. So:\n \n `F(1) = 1, F(3) = 9, F(123) = 14`\n\n Choose a number A, the sequence {A0, A1, ...} is defined as followed:\n ```\n A0 = A\n A1 = F(A0)\n A2 = F(A1) ...\n ...
[{"input": "810", "output": "[8]", "fn_name": "repeat_sequence_len"}, {"input": "812", "output": "[8]", "fn_name": "repeat_sequence_len"}, {"input": "818", "output": "[1]", "fn_name": "repeat_sequence_len"}, {"input": "833", "output": "[1]", "fn_name": "repeat_sequence_len"}, {"input": "85", "output": "[8]", "fn_name":...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a rectangle in the xy-plane, with its lower left corner at (0, 0) and its upper right corner at (W, H). Each of its sides is parallel to the x-axis or y-axis. Initially, the whole region within the rectangle is p...
[{"type": "stdin_stdout", "input": "18 1 -1\n2 -1 1\n5 2 1\n1 1 4\n5 2 0\n2 0 12", "output": "18\n"}, {"type": "stdin_stdout", "input": "10 10 5\n1 6 1\n4 1 3\n6 9 4\n9 4 2\n3 1 3\n", "output": "64\n"}, {"type": "stdin_stdout", "input": "10 10 5\n1 14 1\n4 1 1\n6 4 4\n9 0 2\n3 2 4", "output": "10\n"}, {"type": "stdin_s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ robots driving along an OX axis. There are also two walls: one is at coordinate $0$ and one is at coordinate $m$.\n\nThe $i$-th robot starts at an integer coordinate $x_i~(0 < x_i < m)$ and moves either left...
[{"type": "stdin_stdout", "input": "1\n20 170\n4 6 8 9 10 13 14 16 18 20 23 28 30 32 33 38 42 43 45 46\nL L L L L L L L L L R R R L L R R L R R\n", "output": "5 5 9 11 9 11 15 15 19 19 5 137 1 1 5 137 126 169 169 126\n"}, {"type": "stdin_stdout", "input": "1\n20 170\n4 1 8 9 10 13 14 16 18 20 23 28 30 32 33 38 42 43 45...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is v_{i}. Kuriyama Mirai wants to know something about these stones so she will ask yo...
[{"type": "stdin_stdout", "input": "56\n43 100 44 66 65 11 26 75 96 77 5 15 75 96 11 44 11 97 75 53 33 26 32 33 90 26 68 72 5 44 53 26 33 88 68 25 84 21 25 92 1 84 21 66 94 35 76 51 11 95 67 4 61 3 34 18\n27\n1 20 38\n1 11 46\n2 42 53\n1 8 11\n2 11 42\n2 35 39\n2 37 41\n1 48 51\n1 32 51\n1 36 40\n1 31 56\n1 18 38\n2 9 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn a public bath, there is a shower which emits water for T seconds when the switch is pushed.\n\nIf the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds...
[{"type": "stdin_stdout", "input": "4 1000000000\n0 1100 1000000 1000000000", "output": "2000000000\n"}, {"type": "stdin_stdout", "input": "4 1000000000\n0 1100 1000000 1010000000", "output": "2001000000\n"}, {"type": "stdin_stdout", "input": "4 1000010000\n0 1000 1000000 1000000000", "output": "2000010000\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis kata requires you to convert minutes (`int`) to hours and minutes in the format `hh:mm` (`string`).\n\nIf the input is `0` or negative value, then you should return `\"00:00\"`\n\n**Hint:** use the modulo operation t...
[{"input": "565757", "output": "[\"9429:17\"]", "fn_name": "time_convert"}, {"input": "134", "output": "[\"02:14\"]", "fn_name": "time_convert"}, {"input": "180", "output": "[\"03:00\"]", "fn_name": "time_convert"}, {"input": "970", "output": "[\"16:10\"]", "fn_name": "time_convert"}, {"input": "-6", "output": "[\"00:0...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is an undirected tree of $n$ vertices, connected by $n-1$ bidirectional edges. There is also a snake stuck inside of this tree. Its head is at vertex $a$ and its tail is at vertex $b$. The snake's body occupies all ...
[{"type": "stdin_stdout", "input": "4\n8 4 7\n1 2\n2 3\n1 4\n4 5\n4 6\n1 7\n7 8\n4 3 2\n4 3\n1 2\n2 3\n9 3 5\n1 2\n2 3\n3 4\n1 5\n5 6\n6 7\n1 8\n8 9\n16 15 12\n1 2\n2 3\n1 4\n4 5\n5 6\n6 7\n4 8\n10 9\n8 13\n10 11\n11 12\n11 13\n13 14\n10 15\n15 16\n", "output": "YES\nNO\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTo become the king of Codeforces, Kuroni has to solve the following problem.\n\nHe is given $n$ numbers $a_1, a_2, \\dots, a_n$. Help Kuroni to calculate $\\prod_{1\\le i<j\\le n} |a_i - a_j|$. As result can be very big, ...
[{"type": "stdin_stdout", "input": "140 149\n124 109 136 123 83 121 53 37 111 105 75 224 99 87 51 45 131 83 18 76 99 29 115 96 16 89 88 69 81 100 120 90 141 48 83 97 26 27 51 94 53 25 32 27 4 139 81 140 137 95 94 89 116 32 85 155 68 12 107 10 124 96 110 32 135 126 2 146 79 14 132 136 110 16 130 98 109 191 2 18 52 27 13...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Task\n You have some people who are betting money, and they all start with the same amount of money (this number>0). \n\n Find out if the given end-state of amounts is possible after the betting is over and money is red...
[{"input": "[100, 100, 100, 90, 1, 0, 0]", "output": "[false]", "fn_name": "learn_charitable_game"}, {"input": "[33, 19, 38, 87, 93, 4]", "output": "[false]", "fn_name": "learn_charitable_game"}, {"input": "[0, 0, 0, 0]", "output": "[false]", "fn_name": "learn_charitable_game"}, {"input": "[0, 56, 100]", "output": "[tr...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nYour friend Mishka and you attend a calculus lecture. Lecture lasts n minutes. Lecturer tells a_{i} theorems during the i-th minute.\n\nMishka is really interested in calculus, though it is so hard to stay awake for all t...
[{"type": "stdin_stdout", "input": "10 5\n1 1 1 1 1 1 1 1 10000 1\n1 1 1 1 1 1 1 1 0 1\n", "output": "10009\n"}, {"type": "stdin_stdout", "input": "10 5\n1 1 1 1 1 1 1 1 10000 1\n1 1 1 1 1 1 1 1 0 1\n", "output": "10009\n"}, {"type": "stdin_stdout", "input": "10 5\n1 1 1 1 1 1 1 1 10000 1\n1 1 1 0 1 1 1 1 0 1\n", "outp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nToad Zitz has an array of integers, each integer is between $0$ and $m-1$ inclusive. The integers are $a_1, a_2, \\ldots, a_n$.\n\nIn one operation Zitz can choose an integer $k$ and $k$ indices $i_1, i_2, \\ldots, i_k$ s...
[{"type": "stdin_stdout", "input": "100 1000\n980 755 745 448 424 691 210 545 942 979 555 783 425 942 495 741 487 514 752 434 187 874 372 617 414 505 659 445 81 397 243 986 441 587 31 350 831 801 194 103 723 166 108 182 252 846 328 905 639 690 738 638 986 340 559 626 572 808 442 410 179 549 880 153 449 99 434 945 163 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Cybernetics Failures (CF) organisation made a prototype of a bomb technician robot. To find the possible problems it was decided to carry out a series of tests. At the beginning of each test the robot prototype will b...
[{"type": "stdin_stdout", "input": "15 17 8 9\nURRDLUULLDDDRRURR\n", "output": "1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 0 241\n"}, {"type": "stdin_stdout", "input": "15 17 8 9\nURRDLUULLDDDRRURR\n", "output": "1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 0 241 "}, {"type": "stdin_stdout", "input": "15 17 7 9\nURRDLUULLDDDRRURR\n", "output"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYour favorite music streaming platform has formed a perfectly balanced playlist exclusively for you. The playlist consists of $n$ tracks numbered from $1$ to $n$. The playlist is automatic and cyclic: whenever track $i$ f...
[{"type": "stdin_stdout", "input": "100\n7585 5510 1017 4329 2840 8171 5089 1873 7308 9656 6833 7578 4914 6658 4408 7122 5265 1204 9800 3150 2151 6906 6041 3973 931 7239 4421 4211 156 8655 4266 3543 9752 3117 2731 6052 8950 9391 6367 996 9973 629 9489 4912 9226 9301 5166 4889 3710 6794 618 9155 2462 1120 5499 5861 3177...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have to rebuild a string from an enumerated list.\nFor this task, you have to check if input is correct beforehand.\n\n* Input must be a list of tuples\n* Each tuple has two elements.\n* Second element is an alphanume...
[{"input": "[[\"a\", 0]]", "output": "[false]", "fn_name": "denumerate"}, {"input": "[[1, \"a\"]]", "output": "[false]", "fn_name": "denumerate"}, {"input": "[[0, \"\"]]", "output": "[false]", "fn_name": "denumerate"}, {"input": "\"a\"", "output": "[false]", "fn_name": "denumerate"}, {"input": "[0]", "output": "[false]...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nAccording to an old legeng, a long time ago Ankh-Morpork residents did something wrong to miss Fortune, and she cursed them. She said that at some time n snacks of distinct sizes will fall on the city, and the residents s...
[{"type": "stdin_stdout", "input": "100\n98 52 63 2 18 96 31 58 84 40 41 45 66 100 46 71 26 48 81 20 73 91 68 76 13 93 17 29 64 95 79 21 55 75 19 85 54 51 89 78 15 87 43 59 36 1 90 35 65 56 62 28 86 5 82 49 3 99 33 9 92 32 74 69 27 22 77 16 44 94 34 6 57 70 23 12 61 25 8 11 67 47 83 88 10 14 30 7 97 60 42 37 24 38 53 5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe life goes up and down, just like nice sequences. Sequence t_1, t_2, ..., t_{n} is called nice if the following two conditions are satisfied: t_{i} < t_{i} + 1 for each odd i < n; t_{i} > t_{i} + 1 for each even i <...
[{"type": "stdin_stdout", "input": "50\n11836 28308 72527 92281 139289 93797 134555 148444 40866 111317 21564 87813 65466 20541 99238 2287 74647 128071 18163 61672 39766 55589 138385 147443 138100 142683 60703 15444 52566 72976 147412 116006 115986 110545 79993 100440 9876 71470 75209 62443 64906 88987 72232 2246 63160...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVanya walks late at night along a straight street of length l, lit by n lanterns. Consider the coordinate system with the beginning of the street corresponding to the point 0, and its end corresponding to the point l. The...
[{"type": "stdin_stdout", "input": "46 615683844\n431749087 271781274 274974690 324606253 480870261 401650581 13285442 478090364 266585394 425024433 588791449 492057200 391293435 563090494 317950 173675329 473068378 356306865 311731938 192959832 321180686 141984626 578985584 512026637 175885185 590844074 47103801 21221...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIahub likes trees very much. Recently he discovered an interesting tree named propagating tree. The tree consists of n nodes numbered from 1 to n, each node i having an initial value a_{i}. The root of the tree is node 1....
[{"type": "stdin_stdout", "input": "10 10\n418 45 865 869 745 901 177 773 854 462\n4 8\n1 4\n3 6\n1 5\n1 10\n5 9\n1 2\n4 7\n1 3\n2 2\n1 6 246\n1 4 296\n1 2 378\n1 8 648\n2 6\n1 5 288\n1 6 981\n1 2 868\n2 7\n", "output": "45\n1147\n-119\n"}, {"type": "stdin_stdout", "input": "10 10\n418 45 865 869 745 901 177 773 854 46...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the capital city of Berland, Bertown, demonstrations are against the recent election of the King of Berland. Berland opposition, led by Mr. Ovalny, believes that the elections were not fair enough and wants to organize...
[{"type": "stdin_stdout", "input": "100 10\n9199\n89 409 428 408 309 400 259 393 212 273 472 654 533 774 663 484 695 801 587 518 521 578 767 644 532 785 500 944 582 680 899 882 589 601 614 633 877 543 770 614 852 715 932 627 639 658 765 957 898 545 977 751 740 869 885 831 834 702 934 954 500 626 605 921 755 661 707 952...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHamming distance between strings a and b of equal length (denoted by h(a, b)) is equal to the number of distinct integers i (1 ≤ i ≤ |a|), such that ai ≠ bi, where ai is the i-th symbol of string a, bi is the i-th symbol ...
[{"type": "stdin_stdout", "input": "5728 5729 5750\n5631 5768\n9209\n", "output": "10344\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis contest is `CODE FESTIVAL`. However, Mr. Takahashi always writes it `CODEFESTIVAL`, omitting the single space between `CODE` and `FESTIVAL`.\n\nSo he has decided to make a program that puts the single space he omitte...
[{"type": "stdin_stdout", "input": "ETAUDARGTSOP", "output": "ETAU DARGTSOP\n"}, {"type": "stdin_stdout", "input": "AACDEFGHIJKL", "output": "AACD EFGHIJKL\n"}, {"type": "stdin_stdout", "input": "COCEFESTIVAL", "output": "COCE FESTIVAL\n"}, {"type": "stdin_stdout", "input": "POSTGRADUATF", "output": "POST GRADUATF\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have N coins each of which has a value ai. Find the number of combinations that result when you choose K different coins in such a way that the total value of the coins is greater than or equal to L and less than or e...
[{"type": "stdin_stdout", "input": "5 4 7 19\n1 10 2 2 -1", "output": "4\n"}, {"type": "stdin_stdout", "input": "5 6 7 19\n1 10 2 2 -1", "output": "0\n"}, {"type": "stdin_stdout", "input": "5 4 13 19\n1 5 1 2 -1", "output": "0\n"}, {"type": "stdin_stdout", "input": "5 6 10 7\n1 10 2 2 -1", "output": "0\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHave you ever tried to explain to the coordinator, why it is eight hours to the contest and not a single problem has been prepared yet? Misha had. And this time he has a really strong excuse: he faced a space-time paradox...
[{"type": "stdin_stdout", "input": "11 59 59 11 12\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "12 12 12 11 12\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "11 59 59 12 11\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "12 12 12 11 12\n", "output": "YES\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a convex polygon P with n distinct vertices p1, p2, ..., pn. Vertex pi has coordinates (xi, yi) in the 2D plane. These vertices are listed in clockwise order.\n\nYou can choose a real number D and move each ...
[{"type": "stdin_stdout", "input": "19\n449447997 711296339\n530233434 692216537\n535464528 613140435\n535533467 100893188\n530498867 -265063956\n519107979 -271820709\n482156929 -287792333\n-303730271 -287970295\n-416935204 -263348201\n-443613873 -249980523\n-453444829 -173903413\n-462102798 -80789280\n-462064673 -1322...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have caught N sardines. The deliciousness and fragrantness of the i-th sardine is A_i and B_i, respectively.\nWe will choose one or more of these sardines and put them into a cooler. However, two sardines on bad terms ...
[{"type": "stdin_stdout", "input": "10\n2 0\n2 -1\n-1 -1\n1 20\n0 -1\n-18 -1\n1 -1\n1 1\n-5 -1\n4 0", "output": "399\n"}, {"type": "stdin_stdout", "input": "10\n2 0\n0 0\n-1 2\n-1 13\n-2 -26\n-11 -1\n2 -1\n0 1\n0 0\n0 4", "output": "161\n"}, {"type": "stdin_stdout", "input": "10\n2 -1\n0 0\n-1 2\n-1 13\n0 -26\n-16 -1\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou will be given a string (x) featuring a cat 'C', a dog 'D' and a mouse 'm'. The rest of the string will be made up of '.'. \n\nYou need to find out if the cat can catch the mouse from it's current position. The cat can...
[{"input": "\"............C.............D..m...\"\n8", "output": "[\"Escaped!\"]", "fn_name": "cat_mouse"}, {"input": "\"m.C...\"\n5", "output": "[\"boring without all three\"]", "fn_name": "cat_mouse"}, {"input": "\".CD......m.\"\n10", "output": "[\"Protected!\"]", "fn_name": "cat_mouse"}, {"input": "\".CD......m.\"\n...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe protection of a popular program developed by one of IT City companies is organized the following way. After installation it outputs a random five digit number which should be sent in SMS to a particular phone number. ...
[{"type": "stdin_stdout", "input": "91537\n", "output": "27651\n"}, {"type": "stdin_stdout", "input": "13542\n", "output": "84443\n"}, {"type": "stdin_stdout", "input": "32036\n", "output": "82432\n"}, {"type": "stdin_stdout", "input": "71232\n", "output": "10151\n"}, {"type": "stdin_stdout", "input": "10000\n", "outpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis time the Berland Team Olympiad in Informatics is held in a remote city that can only be reached by one small bus. Bus has n passenger seats, seat i can be occupied only by a participant from the city ai.\n\nToday the...
[{"type": "stdin_stdout", "input": "10 5 1000000000\n1 1 1 2 2 1 2 2 2 2\n", "output": "10000000000\n"}, {"type": "stdin_stdout", "input": "10 5 1000000000\n1 1 1 2 2 1 2 2 3 2\n", "output": "10000000000\n"}, {"type": "stdin_stdout", "input": "10 5 1000000000\n1 1 1 2 0 1 2 2 3 2\n", "output": "10000000000\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the Kingdom of AtCoder, people use a language called Taknese, which uses lowercase English letters.\nIn Taknese, the plural form of a noun is spelled based on the following rules:\n - If a noun's singular form does not...
[{"type": "stdin_stdout", "input": "upruskhsmeicaqqesyyvopepmvdosibrvqoghdeikbpqbfgrufxdsqchjkuxpxngebxrmqdgqjsosencrbwknllvucvubyozfmttxtlsrrnrqavshaszrenhlbzpnpjgqftvwgukjwsekfcgllbzlnvmosmvqubtwsgltvmmzmslqdxqiifzkaqhsxzguseuexlycgubhdnwhrssyiybitcoowlhmmrdpgtrdwalvffknwibhwhacqfjcmwupoxonavvxwsvprpymskznabsquwssucx...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are cons...
[{"type": "stdin_stdout", "input": "50\nGRBGGRBRGRBGGBBBBBGGGBBBBRBRGBRRBRGBBBRBBRRGBGGGRB\n", "output": "18\n"}, {"type": "stdin_stdout", "input": "50\nRBGGBGGRBGRBBBGBBGRBBBGGGRBBBGBBBGRGGBGGBRBGBGRRGG\n", "output": "17\n"}, {"type": "stdin_stdout", "input": "50\nGGGBBRGGGGGRRGGRBGGRGBBRBRRBGRGBBBGBRBGRGBBGRGGBRB\n",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA boy Valera registered on site Codeforces as Valera, and wrote his first Codeforces Round #300. He boasted to a friend Arkady about winning as much as x points for his first contest. But Arkady did not believe his friend...
[{"type": "stdin_stdout", "input": "230 125 175 124 1 1\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "230 125 221 124 1 1\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "230 195 221 124 1 1\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "375 6 133 267 19 36\n", "output": "NO\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this task Anna and Maria play a game with a very unpleasant rival. Anna and Maria are in the opposite squares of a chessboard (8 × 8): Anna is in the upper right corner, and Maria is in the lower left one. Apart from t...
[{"type": "stdin_stdout", "input": "S......A\n.SS..S..\nS....S..\nSSS...S.\n.SS.STS.\n.S.SS...\n..S..S..\nM.SS....\n", "output": "LOSE\n"}, {"type": "stdin_stdout", "input": "SSSSSSSA\n......S.\n/.....S.\n.....SS.\n....SS..\n...SS...\n..SS....\nMSS.....\n", "output": "LOSE\n"}, {"type": "stdin_stdout", "input": "S..SSS...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven a sequence of items and a specific item in that sequence, return the item immediately following the item specified. If the item occurs more than once in a sequence, return the item after the first occurence. This sh...
[{"input": "[1, 2, 3, 4, 5, 6, 7, 8]\n3", "output": "[4]", "fn_name": "next_item"}, {"input": "[\"a\", \"b\", \"c\"]\n\"d\"", "output": "[null]", "fn_name": "next_item"}, {"input": "[\"a\", \"b\", \"c\"]\n\"c\"", "output": "[null]", "fn_name": "next_item"}, {"input": "\"testing\"\n\"t\"", "output": "[\"e\"]", "fn_name"...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N balls and N+1 holes in a line. Balls are numbered 1 through N from left to right. Holes are numbered 1 through N+1 from left to right. The i-th ball is located between the i-th hole and (i+1)-th hole. We denot...
[{"type": "stdin_stdout", "input": "1000 100 100", "output": "649620280.957660079002380"}, {"type": "stdin_stdout", "input": "1110 100 110", "output": "894375868.485796213150\n"}, {"type": "stdin_stdout", "input": "1110 101 110", "output": "894383190.732867240906\n"}, {"type": "stdin_stdout", "input": "1110 111 100", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.\n\nOne needs exactly di years to rise from rank i to rank i + ...
[{"type": "stdin_stdout", "input": "100\n63 65 21 41 95 23 3 4 12 23 95 50 75 63 58 34 71 27 75 31 23 94 96 74 69 34 43 25 25 55 44 19 43 86 68 17 52 65 36 29 72 96 84 25 84 23 71 54 6 7 71 7 21 100 99 58 93 35 62 47 36 70 68 9 75 13 35 70 76 36 62 22 52 51 2 87 66 41 54 35 78 62 30 35 65 44 74 93 78 37 96 70 26 32 71 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n## Task\n\nWrite a method `remainder` which takes two integer arguments, `dividend` and `divisor`, and returns the remainder when dividend is divided by divisor. Do NOT use the modulus operator (%) to calculate the remain...
[{"input": "19\n2", "output": "[1]", "fn_name": "remainder"}, {"input": "10\n2", "output": "[0]", "fn_name": "remainder"}, {"input": "34\n7", "output": "[6]", "fn_name": "remainder"}, {"input": "27\n5", "output": "[2]", "fn_name": "remainder"}, {"input": "3\n2", "output": "[1]", "fn_name": "remainder"}]
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a rectangular parallelepiped with sides of positive integer lengths $A$, $B$ and $C$. \n\nFind the number of different groups of three integers ($a$, $b$, $c$) such that $1\\leq a\\leq b\\leq c$ and parallel...
[{"type": "stdin_stdout", "input": "10\n9 6 8\n5 5 2\n8 9 2\n2 7 9\n6 4 10\n1 1 5\n2 15 1\n10 2 3\n12 5 4\n17 6 4\n", "output": "41\n6\n21\n12\n39\n2\n8\n14\n30\n22\n"}, {"type": "stdin_stdout", "input": "10\n9 6 8\n5 5 2\n8 9 2\n2 7 9\n6 4 10\n1 1 5\n2 8 1\n10 2 3\n12 5 4\n17 5 4\n", "output": "41\n6\n21\n12\n39\n2\n7...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe final match of the Berland Football Cup has been held recently. The referee has shown $n$ yellow cards throughout the match. At the beginning of the match there were $a_1$ players in the first team and $a_2$ players i...
[{"type": "stdin_stdout", "input": "1000\n1000\n1000\n1000\n1999999\n", "output": "1999 1999\n"}, {"type": "stdin_stdout", "input": "1000\n1000\n1000\n1000\n2000000\n", "output": "2000 2000\n"}, {"type": "stdin_stdout", "input": "1000\n1000\n1000\n1000\n2000000\n", "output": "2000 2000\n"}, {"type": "stdin_stdout", "in...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nN players will participate in a tennis tournament. We will call them Player 1, Player 2, \\ldots, Player N.\nThe tournament is round-robin format, and there will be N(N-1)/2 matches in total.\nIs it possible to schedule t...
[{"type": "stdin_stdout", "input": "171\n158 2 11 40 53 51 26 89 135 78 167 25 123 157 100 152 72 35 39 126 124 119 68 105 162 150 84 82 59 109 28 70 34 110 85 136 57 145 134 47 99 20 83 95 154 98 73 138 48 29 120 116 66 58 96 18 102 24 153 127 125 61 32 129 16 131 50 46 10 113 91 75 13 86 65 45 146 133 122 103 128 93 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis problem's actual name, \"Lexicographically Largest Palindromic Subsequence\" is too long to fit into the page headline.\n\nYou are given string s consisting of lowercase English letters only. Find its lexicographical...
[{"type": "stdin_stdout", "input": "zzzzzzzzzz\n", "output": "zzzzzzzzzz\n"}, {"type": "stdin_stdout", "input": "aaaaaaaaaa\n", "output": "aaaaaaaaaa\n"}, {"type": "stdin_stdout", "input": "zzzzzzzazz\n", "output": "zzzzzzzzz\n"}, {"type": "stdin_stdout", "input": "abbbbbbbbb\n", "output": "bbbbbbbbb\n"}, {"type": "std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTsumugi brought $n$ delicious sweets to the Light Music Club. They are numbered from $1$ to $n$, where the $i$-th sweet has a sugar concentration described by an integer $a_i$.\n\nYui loves sweets, but she can eat at most...
[{"type": "stdin_stdout", "input": "37 13\n164823 8992 21818 77521 130870 83201 174985 168799 9565 84443 105083 54131 130813 42829 98759 60103 198520 125068 59611 45609 124003 106143 54167 179002 103755 152802 146640 74767 91309 11941 131534 32533 67324 27272 49166 129157 41630\n", "output": "8992 18557 30498 52316 795...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHow can you tell an extrovert from an\nintrovert at NSA? Va gur ryringbef,\ngur rkgebireg ybbxf ng gur BGURE thl'f fubrf.\n\nI found this joke on USENET, but the punchline is scrambled. Maybe you can decipher it?\nAccordi...
[{"input": "\"How can you tell an extrovert from an\\nintrovert at NSA? Va gur ryringbef,\\ngur rkgebireg ybbxf ng gur BGURE thl'f fubrf.\"", "output": "[\"Ubj pna lbh gryy na rkgebireg sebz na\\nvagebireg ng AFN? In the elevators,\\nthe extrovert looks at the OTHER guy's shoes.\"]", "fn_name": "rot13"}, {"input": "\"G...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nLunar New Year is approaching, and Bob received a gift from his friend recently — a recursive sequence! He loves this sequence very much and wants to play with it.\n\nLet f_1, f_2, …, f_i, … be an infinite sequence of pos...
[{"type": "stdin_stdout", "input": "26\n150393140 360409816 380562806 954731482 34457876 66727907 376298532 679315200 260466665 597680044 95770656 948689469 209020313 926343072 66801160 426280560 927872284 389224547 492602065 324416078 776983298 191080523 167234113 791882865 365749226 28861923\n755656155 336170357\n", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBob is a lazy man. \n\nHe needs you to create a method that can determine how many ```letters``` and ```digits``` are in a given string.\n\n\n\nExample:\n\n\"hel2!lo\" --> 6\n\n\"wicked .. !\" --> 6\n\n\"!?..A\" --> 1\n\n...
[{"input": "\"u_n_d_e_r__S_C_O_R_E\"", "output": "[10]", "fn_name": "count_letters_and_digits"}, {"input": "\"de?=?=tttes!!t\"", "output": "[8]", "fn_name": "count_letters_and_digits"}, {"input": "\"n!!ice!!123\"", "output": "[7]", "fn_name": "count_letters_and_digits"}, {"input": "\"!@#$%^&`~.\"", "output": "[0]", "fn...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlex enjoys performing magic tricks. He has a trick that requires a deck of n cards. He has m identical decks of n different cards each, which have been mixed together. When Alex wishes to perform the trick, he grabs n ca...
[{"type": "stdin_stdout", "input": "999 504\n", "output": "0.0019990178729991604\n"}, {"type": "stdin_stdout", "input": "614 123\n", "output": "0.0032414781922363548\n"}, {"type": "stdin_stdout", "input": "723 1000\n", "output": "0.002762959403995896\n"}, {"type": "stdin_stdout", "input": "975 504\n", "output": "0.0020...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAtCoDeer the deer and his friend TopCoDeer is playing a game.\nThe game consists of N turns.\nIn each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-paper-scissors, under the following conditi...
[{"type": "stdin_stdout", "input": "ggppgggpgg\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "ggpgggppgg", "output": "2\n"}, {"type": "stdin_stdout", "input": "ggggggpppg", "output": "2\n"}, {"type": "stdin_stdout", "input": "ggppgpgggg", "output": "2\n"}, {"type": "stdin_stdout", "input": "ggppggpggg", "outp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n### Unfinished Loop - Bug Fixing #1\n\nOh no, Timmy's created an infinite loop! Help Timmy find and fix the bug in his unfinished for loop!\n\nWrite your solution by modifying this code:\n\n```python\ndef create_array(n):...
[{"input": "10", "output": "[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]]", "fn_name": "create_array"}, {"input": "9", "output": "[[1, 2, 3, 4, 5, 6, 7, 8, 9]]", "fn_name": "create_array"}, {"input": "8", "output": "[[1, 2, 3, 4, 5, 6, 7, 8]]", "fn_name": "create_array"}, {"input": "7", "output": "[[1, 2, 3, 4, 5, 6, 7]]", "fn_nam...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nHaiku is a genre of Japanese traditional poetry.\n\nA haiku poem consists of 17 syllables split into three phrases, containing 5, 7 and 5 syllables correspondingly (the first phrase should contain exactly 5 syllables, the...
[{"type": "stdin_stdout", "input": "aaaaaccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\naaaaaaaccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\naaaaaccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTwo bored soldiers are playing card war. Their card deck consists of exactly n cards, numbered from 1 to n, all values are different. They divide cards between them in some manner, it's possible that they have different n...
[{"type": "stdin_stdout", "input": "10\n9 8 7 6 2 3 5 4 10 1\n1 9\n", "output": "103 1\n"}, {"type": "stdin_stdout", "input": "10\n1 10\n9 5 7 6 1 2 3 9 8 4\n", "output": "105 1\n"}, {"type": "stdin_stdout", "input": "10\n9 8 7 6 2 3 5 4 9 1\n1 10\n", "output": "105 2\n"}, {"type": "stdin_stdout", "input": "10\n9 8 7 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nn soldiers stand in a circle. For each soldier his height ai is known. A reconnaissance unit can be made of such two neighbouring soldiers, whose heights difference is minimal, i.e. |ai - aj| is minimal. So each of them w...
[{"type": "stdin_stdout", "input": "88\n1000 1000 1000 1000 1000 998 998 1000 1000 1000 1000 999 999 1000 1000 1000 999 1000 997 999 997 1000 999 998 1000 999 1000 1000 1000 999 1000 999 999 1000 1000 999 1000 999 1000 1000 998 1000 1000 1000 998 998 1000 1000 999 1000 1000 1000 1000 1000 1000 1000 998 1000 1000 1000 9...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string S consisting of uppercase English letters. Find the length of the longest ACGT string that is a substring (see Notes) of S.\nHere, a ACGT string is a string that contains no characters other than A,...
[{"type": "stdin_stdout", "input": "TTTTTTTTTT\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "BBBBBBBBBB\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "GACGCTCCAV\n", "output": "9\n"}, {"type": "stdin_stdout", "input": "CTTAHTGACT\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "TGMJCTTDAA\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYaroslav has an array that consists of n integers. In one second Yaroslav can swap two neighboring array elements. Now Yaroslav is wondering if he can obtain an array where any two neighboring elements would be distinct i...
[{"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\nYou are given a three-digit positive integer N.\n\nDetermine whether N is a palindromic number.\n\nHere, a palindromic number is an integer that reads the same backward as forward in decimal notation.\n\n-----Constraints-...
[{"type": "stdin_stdout", "input": "575\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "999\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "171\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "123\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "812\n", "output": "No\n"}, {"type...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string $s$, consisting only of characters '0' or '1'. Let $|s|$ be the length of $s$.\n\nYou are asked to choose some integer $k$ ($k > 0$) and find a sequence $a$ of length $k$ such that:\n\n$1 \\le a_1 <...
[{"type": "stdin_stdout", "input": "1\n0000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1\n0000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100\n", "output": "NO\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMr. Simpson got up with a slight feeling of tiredness. It was the start of another day of hard work. A bunch of papers were waiting for his inspection on his desk in his office. The papers contained his students' answers ...
[{"type": "stdin_stdout", "input": "a+b+c\n(a+b)+c\na- (b-c)+2\n.\n4ab\n(a - b) (0-b+a) - 1a ^ 2 - b ^ 3\n2 b 2 a\n.\n108 a\n2 2 3 3 3 a\n4 a^1 27\n.\n.", "output": "yes\nno\n.\nno\nyes\n.\nyes\nyes\n.\n"}, {"type": "stdin_stdout", "input": "a+b+c\n(a+b)+c\na- (b-c)+2\n.\n4ab\n(a - b) (0-b+a) - 1a ^ 4 - b ^ 3\n2 b 2 a\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Berland road network consists of n cities and of m bidirectional roads. The cities are numbered from 1 to n, where the main capital city has number n, and the culture capital — number 1. The road network is set up so ...
[{"type": "stdin_stdout", "input": "34 53\n9 6\n25 28\n27 24\n15 18\n34 33\n27 30\n1 4\n4 7\n11 9\n11 8\n30 26\n15 12\n26 23\n17 15\n29 26\n11 15\n7 10\n14 12\n5 9\n8 5\n2 1\n24 21\n3 5\n14 17\n23 20\n25 22\n32 29\n8 6\n3 6\n33 31\n5 2\n21 18\n16 19\n19 22\n17 21\n14 11\n23 27\n3 1\n34 32\n32 30\n26 24\n17 20\n18 20\n2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian as well. \n\nThere are 100 houses located on a straight line. The first house is numbered 1 and the last one is numbered 100. Some M houses out of these 100 are occ...
[{"type": "stdin_stdout", "input": "3\n4 7 8\n12 52 56 8\n2 10 2\n21 75\n2 5 8\n10 49", "output": "0\n18\n11\n"}, {"type": "stdin_stdout", "input": "3\n4 7 3\n3 52 56 8\n2 10 2\n21 75\n2 5 8\n10 49", "output": "24\n18\n11\n"}, {"type": "stdin_stdout", "input": "3\n4 7 8\n19 52 56 8\n2 20 2\n21 34\n2 5 8\n10 29", "outpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nGiven the lengths of $ 2 $ sides that are not the hypotenuse of a right triangle, $ A $ and $ B $. The side of length $ A $ overlaps the $ x $ axis, and the side of length $ B $ overlaps the $ y $ axis.\n\nDo t...
[{"type": "stdin_stdout", "input": "-23 -12", "output": "-7238.229473871\n"}, {"type": "stdin_stdout", "input": "-26 -9", "output": "-3053.628059289\n"}, {"type": "stdin_stdout", "input": "-74 -8", "output": "-2144.660584851\n"}, {"type": "stdin_stdout", "input": "-11 -4", "output": "-268.082573106\n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe purpose of this problem is to verify whether the method you are using to read input data is sufficiently fast to handle problems branded with the enormous Input/Output warning. You are expected to be able to process a...
[{"type": "stdin_stdout", "input": "7 2\n1\n106\n966369\n10\n12\n40177\n11", "output": "3\n"}, {"type": "stdin_stdout", "input": "7 4\n1\n106\n966369\n10\n12\n40177\n11", "output": "1\n"}, {"type": "stdin_stdout", "input": "7 4\n1\n106\n966369\n10\n18\n40177\n11", "output": "0\n"}, {"type": "stdin_stdout", "input": "7 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N points in a D-dimensional space.\nThe coordinates of the i-th point are (X_{i1}, X_{i2}, ..., X_{iD}).\nThe distance between two points with coordinates (y_1, y_2, ..., y_D) and (z_1, z_2, ..., z_D) is \\sqrt{...
[{"type": "stdin_stdout", "input": "10 10\n8 -14 -14 -20 18 -1 -3 18 -1 10\n-9 2 4 -13 13 5 14 -9 20 -18\n-19 -19 -19 20 -3 20 -2 -18 -7 -11\n5 7 3 -11 12 -9 -10 10 20 -19\n-12 -8 -20 -13 12 13 17 17 -6 0\n-4 -14 -15 -15 18 19 -8 -1 -20 -2\n-7 11 -10 -16 3 -5 -12 15 6 -2\n12 18 -3 -15 -20 17 9 9 10 -10\n10 -2 9 -16 2 1...
code_stdio