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\nFind \\displaystyle{\\sum_{a=1}^{K}\\sum_{b=1}^{K}\\sum_{c=1}^{K} \\gcd(a,b,c)}.\nHere \\gcd(a,b,c) denotes the greatest common divisor of a, b, and c.\n\n-----Constraints-----\n - 1 \\leq K \\leq 200\n - K is an integer....
[{"type": "stdin_stdout", "input": "200\n", "output": "10813692\n"}, {"type": "stdin_stdout", "input": "199\n", "output": "10611772\n"}, {"type": "stdin_stdout", "input": "198\n", "output": "10493367\n"}, {"type": "stdin_stdout", "input": "197\n", "output": "10290813\n"}, {"type": "stdin_stdout", "input": "196\n", "out...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn a small restaurant there are a tables for one person and b tables for two persons. \n\nIt it known that n groups of people come today, each consisting of one or two people. \n\nIf a group consist of one person, it is s...
[{"type": "stdin_stdout", "input": "30 10 10\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2\n", "output": "20\n"}, {"type": "stdin_stdout", "input": "30 10 10\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2\n", "output": "20\n"}, {"type": "stdin_stdout", "input": "20 4 3\n2 2 2 2 2 2 2 2 1 2 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven an array (or list) of scores, return the array of _ranks_ for each value in the array. The largest value has rank 1, the second largest value has rank 2, and so on. Ties should be handled by assigning the same rank...
[{"input": "[5, 2, 3, 5, 5, 4, 9, 8, 0]", "output": "[[3, 8, 7, 3, 3, 6, 1, 2, 9]]", "fn_name": "ranks"}, {"input": "[-1, 3, 3, 3, 5, 5]", "output": "[[6, 3, 3, 3, 1, 1]]", "fn_name": "ranks"}, {"input": "[-5, -10, 3, 1]", "output": "[[3, 4, 1, 2]]", "fn_name": "ranks"}, {"input": "[1, 10, 4]", "output": "[[3, 1, 2]]",...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nSometimes it is hard to prepare tests for programming problems. Now Bob is preparing tests to new problem about strings β€” input data to his problem is one string. Bob has 3 wrong solutions to this problem. The first gives...
[{"type": "stdin_stdout", "input": "rdtevvmiqmfgvafkdypxjthzhfsbavmhgkavkfonscaokdxoscenpxrc\nijbvueenzsmgkmkrskjspvfchwkqdglkxnrdtevvmiqmfgvafkdypxjthz\nkqdglkxnrdtevvmiqmfgvafkdypxjthzhfsbavmhgkavkfonscaokdxoscenpxrcivydtkrxjy\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "iefouqzxoyuieqdzalfktehtvdbvjmeu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNauuo is a girl who loves playing cards.\n\nOne day she was playing cards but found that the cards were mixed with some empty ones.\n\nThere are $n$ cards numbered from $1$ to $n$, and they were mixed with another $n$ emp...
[{"type": "stdin_stdout", "input": "20\n0 0 0 0 5 6 7 8 0 0 11 12 13 14 15 16 17 18 0 0\n20 9 19 0 0 0 0 0 0 10 0 0 0 0 0 0 1 2 3 4\n", "output": "37\n"}, {"type": "stdin_stdout", "input": "20\n15 10 6 0 0 11 19 17 0 0 0 0 0 1 14 0 3 4 0 12\n20 7 0 0 0 0 0 0 5 8 2 16 18 0 0 13 9 0 0 0\n", "output": "30\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a function that accepts two arguments: an array/list of integers and another integer (`n`). \n\nDetermine the number of times where two integers in the array have a difference of `n`.\n\nFor example:\n```\n[1, 1, 5,...
[{"input": "[1, 1, 5, 6, 9, 16, 27]\n4", "output": "[3]", "fn_name": "int_diff"}, {"input": "[4, 8, 12, 12, 3, 6, 2]\n6", "output": "[3]", "fn_name": "int_diff"}, {"input": "[1, 2, 3, 4, 5, 6, 7]\n7", "output": "[0]", "fn_name": "int_diff"}, {"input": "[1, 6, 2, 3, 7, 8, 7]\n0", "output": "[1]", "fn_name": "int_diff"},...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nAt the start of each season, every player in a football team is assigned their own unique squad number. Due to superstition or their history certain numbers are more desirable than others.\n\nWrite a function generateNumb...
[{"input": "[1, 2, 3, 4, 6, 9, 10, 11, 15, 18, 27, 29, 34, 36, 38, 45, 47, 54, 56, 63, 65, 69, 72, 74, 81, 83, 90, 92]\n9", "output": "[null]", "fn_name": "generate_number"}, {"input": "[1, 2, 3, 4, 6, 9, 10, 11, 15, 18, 27, 29, 34, 36, 38, 45, 47, 54, 56, 63, 65, 69, 72, 74, 81, 83, 92]\n9", "output": "[null]", "fn_na...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nAncient Egyptians are known to have understood difficult concepts in mathematics. The ancient Egyptian mathematician Ahmes liked to write a kind of arithmetic expressions on papyrus paper which he called as Ahmes arithmet...
[{"type": "stdin_stdout", "input": "((((4?6)?9)?((5?(7?1))?(6?(4?(((((((7?3)?7)?(((((8?(6?7))?((1?2)?(5?8)))?8)?7)?4))?6)?7)?1)?((7?(2?((1?(((8?(((((2?7)?(((((3?6)?3)?(((((9?5)?7)?(1?(5?5)))?(8?((3?(1?2))?((8?5)?(7?((9?((9?8)?7))?1))))))?1))?1)?(9?2)))?((7?5)?((9?(4?(9?6)))?(8?(((5?7)?2)?(6?(3?8)))))))?(((4?(2?2))?(7?9...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIto joined the Kyudo club after entering high school. At first, I had a hard time because the arrow didn't reach the target, but in the fall of my first year of high school, I managed to improve to the point where the arr...
[{"type": "stdin_stdout", "input": "20\n1\n11\n1\n-1\n0\n8\n-2\n1\n0", "output": "12\n-1\n"}, {"type": "stdin_stdout", "input": "20\n1\n10\n1\n-1\n0\n8\n-2\n1\n0", "output": "11\n-1\n"}, {"type": "stdin_stdout", "input": "20\n3\n2\n0\n1\n12\n8\n-1\n-1\n0", "output": "18\n-2\n"}, {"type": "stdin_stdout", "input": "20\n5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given n Γ— m table. Each cell of the table is colored white or black. Find the number of non-empty sets of cells such that:\n\n All cells in a set have the same color. Every two cells in a set share row or column...
[{"type": "stdin_stdout", "input": "5 50\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\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\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 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day in the IT lesson Anna and Maria learned about the lexicographic order.\n\nString x is lexicographically less than string y, if either x is a prefix of y (and x β‰  y), or there exists such i (1 ≀ i ≀ min(|x|, |y|)),...
[{"type": "stdin_stdout", "input": "hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhihhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is the length of the string.\n\nYou are given a string $s$ and a string $t$, both consisting only of lowercase Latin letters. It is guaranteed that $t$ can be obtained fr...
[{"type": "stdin_stdout", "input": "izoiweukqszkkhwapzxyotbaarpqxbybsjxilhylbbjbvoedrezyluaabsfzvtxxvncdwxrlfdtfvbfoqwlzqwneimwzpoygfdcldmxdhoxzensxlspituzocvzzrfomhggrwurdccgfoorvhyzsdkpjhwakuoxwdjhzaalanyzwuuqwlrtmvmdraleyusjqdyxuztvc\nizoiweukqszkkhwapzxyotbaarpqxbybsjxilhylbbjbvoedrezyluaabsfzvtxxvncdwxrlfdtfvbfoqw...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNathan O. Davis is challenging a kind of shooter game. In this game, enemies emit laser beams from outside of the screen. A laser beam is a straight line with a certain thickness. Nathan moves a circular-shaped machine wi...
[{"type": "stdin_stdout", "input": "100 100 1 1\n78 1 50 100 21\n640 295 1 2\n1 -1 640 480 100\n0 0 0 0", "output": "Yes\nYes\n"}, {"type": "stdin_stdout", "input": "100 100 1 0\n78 1 50 100 21\n640 295 1 2\n1 -1 640 480 100\n0 0 0 0", "output": "Yes\nYes\n"}, {"type": "stdin_stdout", "input": "100 100 1 0\n78 1 50 100...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nPrepare the Othello board. The upper left is $ (1,1) $ and the lower right is $ (8,8) $. The board to be prepared here is $ (5,4) as follows. ) There is no $ black stone.\n\n\n........\n........\n........\n... ...
[{"type": "stdin_stdout", "input": "3\n1 1 10 1\n2 4 6 8\n6 3 8 8", "output": "10\n19\n15\n"}, {"type": "stdin_stdout", "input": "3\n1 1 10 1\n2 4 6 8\n8 3 8 8", "output": "10\n19\n6\n"}, {"type": "stdin_stdout", "input": "3\n1 1 10 1\n2 4 6 8\n8 3 8 4", "output": "10\n19\n2\n"}, {"type": "stdin_stdout", "input": "3\n2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp has just invented a new binary protocol for data transmission. He is encoding positive integer decimal number to binary string using following algorithm:\n\n Each digit is represented with number of '1' characte...
[{"type": "stdin_stdout", "input": "89\n11111111101111111110111111111011111111101111111110111111111011111111101111111110111111111\n", "output": "999999999\n"}, {"type": "stdin_stdout", "input": "89\n11111111101111111110111111111011111111101111111110111111111011111111101111111110111111111\n", "output": "999999999\n"}, {...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n stones arranged on an axis. Initially the i-th stone is located at the coordinate s_i. There may be more than one stone in a single place.\n\nYou can perform zero or more operations of the following type: \n\n...
[{"type": "stdin_stdout", "input": "20\n53 86 76 100 16 12 13 97 79 23 28 64 42 10 23 56 59 76 48 12\n48 49 49 49 48 49 48 49 49 49 48 48 48 49 49 49 49 49 49 48\n", "output": "YES\n19\n14 1 4\n14 16 7\n14 17 10\n14 12 15\n14 3 2\n6 3 25\n6 18 11\n20 18 16\n20 9 20\n7 9 10\n7 2 25\n5 2 12\n5 8 20\n10 8 25\n15 8 3\n15 4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou and your best friend Stripes have just landed your first high school jobs! You'll be delivering newspapers to your neighbourhood on weekends. For your services you'll be charging a set price depending on the quantity ...
[{"input": "499", "output": "[48.06]", "fn_name": "cheapest_quote"}, {"input": "10", "output": "[0.97]", "fn_name": "cheapest_quote"}, {"input": "20", "output": "[1.93]", "fn_name": "cheapest_quote"}, {"input": "40", "output": "[3.85]", "fn_name": "cheapest_quote"}, {"input": "41", "output": "[3.95]", "fn_name": "cheap...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's call the set of positive integers $S$ correct if the following two conditions are met:\n\n$S \\subseteq \\{1, 2, \\dots, n\\}$;\n\nif $a \\in S$ and $b \\in S$, then $|a-b| \\neq x$ and $|a-b| \\neq y$.\n\nFor the g...
[{"type": "stdin_stdout", "input": "1000000000 22 22\n", "output": "500000006\n"}, {"type": "stdin_stdout", "input": "1000000000 21 22\n", "output": "488372094\n"}, {"type": "stdin_stdout", "input": "1000000000 20 22\n", "output": "476190480\n"}, {"type": "stdin_stdout", "input": "455678451 22 17\n", "output": "2219971...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya trains to compose crossword puzzles. He can only compose crosswords of a very simplΠ΅ type so far. All of them consist of exactly six words; the words can be read only from top to bottom vertically and from the left ...
[{"type": "stdin_stdout", "input": "ABBAAAABBBB\nBBABAAAABAABAB\nBAABABBBABBBBBAAA\nBABABAAABBAAABBAAAAB\nABAAAABBBBBABAABABBAAAAABBBBBB\nBBBBAABBAABBBBABAAABAABBAABBAA\n", "output": "BAABABBBABBBBBAAA.............\nA...............B.............\nB...............A.............\nA...............A.............\nB..........
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is unrest in the Galactic Senate. Several thousand solar systems have declared their intentions to leave the Republic. Master Heidi needs to select the Jedi Knights who will go on peacekeeping missions throughout th...
[{"type": "stdin_stdout", "input": "100 100\n52 93 36 69 49 37 48 42 63 27 16 60 16 63 80 37 69 24 86 38 73 15 43 65 49 35 39 98 91 24 20 35 12 40 75 32 54 4 76 22 23 7 50 86 41 9 9 91 23 18 41 61 47 66 1 79 49 21 99 29 87 94 42 55 87 21 60 67 36 89 40 71 6 63 65 88 17 12 89 32 79 99 34 30 63 33 53 56 10 11 66 80 73 50...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of the queue. The i-th w...
[{"type": "stdin_stdout", "input": "15\n18 6 33 21 14 20 13 9 18 20 28 13 19 25 21\n", "output": "10 -1 11 8 6 6 0 -1 2 2 3 -1 -1 0 -1 "}, {"type": "stdin_stdout", "input": "15\n18 6 33 21 14 20 20 9 18 20 28 13 19 25 21\n", "output": "10 -1 11 8 6 6 5 -1 2 2 3 -1 -1 0 -1 "}, {"type": "stdin_stdout", "input": "15\n18 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTraining is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well.\n\nToday's training is to perform a very large number of calculations to improve the calc...
[{"type": "stdin_stdout", "input": "3\n0\n0\n1000000010", "output": "1000000010\n0\n0\n"}, {"type": "stdin_stdout", "input": "3\n0\n0\n1000000000", "output": "1000000000\n0\n0"}, {"type": "stdin_stdout", "input": "4\n11\n5\n10\n10", "output": "5\n10\n10\n11\n"}, {"type": "stdin_stdout", "input": "4\n11\n5\n19\n10", "ou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTwo tortoises named ***A*** and ***B*** must run a race. ***A*** starts with an average speed of ```720 feet per hour```.\nYoung ***B*** knows she runs faster than ***A***, and furthermore has not finished her cabbage.\n\...
[{"input": "720\n850\n370", "output": "[[2, 50, 46]]", "fn_name": "race"}, {"input": "820\n850\n550", "output": "[[18, 20, 0]]", "fn_name": "race"}, {"input": "720\n850\n70", "output": "[[0, 32, 18]]", "fn_name": "race"}, {"input": "720\n850\n37", "output": "[[0, 17, 4]]", "fn_name": "race"}, {"input": "80\n91\n37", "o...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor a non-negative integer N, define S(N) as the sum of the odd digits of N\nplus twice the sum of the even digits of N.\nFor example, S(5)=5, S(456)=2*4+5+2*6=25, and S(314159)=3+1+2*4+1+5+9=27.\nDefine D(N) as the last ...
[{"type": "stdin_stdout", "input": "3\n0 10\n34 453\n517800 1591348", "output": "46\n1890\n4830969\n"}, {"type": "stdin_stdout", "input": "3\n0 10\n16 252\n314159 1591348", "output": "46\n1065\n5747356\n"}, {"type": "stdin_stdout", "input": "3\n1 10\n28 297\n314159 559966", "output": "46\n1207\n1106130\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIt is a holiday season, and Koala is decorating his house with cool lights! He owns $n$ lights, all of which flash periodically.\n\nAfter taking a quick glance at them, Koala realizes that each of his lights can be descri...
[{"type": "stdin_stdout", "input": "70\n0010011111011101101111000111101011010101000011000000010100010101010001\n3 1\n1 5\n3 1\n4 1\n3 3\n2 4\n2 1\n5 1\n2 4\n5 2\n5 2\n4 1\n2 5\n2 2\n4 2\n5 1\n1 2\n2 4\n3 1\n1 1\n5 3\n5 2\n3 5\n4 4\n2 1\n3 2\n1 3\n5 1\n3 4\n2 3\n1 5\n4 1\n2 2\n5 1\n3 3\n4 2\n1 4\n5 2\n1 2\n4 1\n1 4\n5 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi has many red balls and blue balls. Now, he will place them in a row.\nInitially, there is no ball placed.\nTakahashi, who is very patient, will do the following operation 10^{100} times:\n - Place A blue balls a...
[{"type": "stdin_stdout", "input": "984159202374430527 552558592232591693 265756112319848958\n", "output": "718403090054581569\n"}, {"type": "stdin_stdout", "input": "994914121424164663 818665214162491101 129546857230076861\n", "output": "865367264194087802\n"}, {"type": "stdin_stdout", "input": "501719768609305159 370...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA ski base is planned to be built in Walrusland. Recently, however, the project is still in the constructing phase. A large land lot was chosen for the construction. It contains n ski junctions, numbered from 1 to n. Init...
[{"type": "stdin_stdout", "input": "2 40\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n", "output": "0\n1\n3\n7\n15\n31\n63\n127\n255\n511\n1023\n2047\n4095\n8191\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor a pole vaulter, it is very important to begin the approach run at the best possible starting mark. This is affected by numerous factors and requires fine-tuning in practice. But there is a guideline that will help a b...
[{"input": "1.83", "output": "[10.67]", "fn_name": "starting_mark"}, {"input": "2.13", "output": "[11.85]", "fn_name": "starting_mark"}, {"input": "1.75", "output": "[10.36]", "fn_name": "starting_mark"}, {"input": "1.52", "output": "[9.45]", "fn_name": "starting_mark"}, {"input": "1.22", "output": "[8.27]", "fn_name":...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reverses a given string str.\n\n\n\nInput\n\nstr (the size of str ≀ 20) is given in a line.\n\nOutput\n\nPrint the reversed str in a line.\n\nExample\n\nInput\n\nw32nimda\n\n\nOutput\n\nadmin23w\n\nT...
[{"type": "stdin_stdout", "input": "w32njmda", "output": "admjn23w\n"}, {"type": "stdin_stdout", "input": "admjn23w", "output": "w32njmda\n"}, {"type": "stdin_stdout", "input": "acmjn23w", "output": "w32njmca\n"}, {"type": "stdin_stdout", "input": "3cmjn2aw", "output": "wa2njmc3\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nJoe has been hurt on the Internet. Now he is storming around the house, destroying everything in his path.\n\nJoe's house has n floors, each floor is a segment of m cells. Each cell either contains nothing (it is an empty...
[{"type": "stdin_stdout", "input": "20 20\n..+#+.+++.+++#+..#++\n..####+++#..++#+.+.+\n+.+..+++..#.++++++++\n+##++..+.##..#+++.++\n++.+.+.+.++++.+++.++\n.+++++.+#+++++...+#+\n.++.#+++++++++.++.++\n...+.++++++.++#...++\n+++.+++.+....#....+.\n.++++++.+.+..++.++##\n.+..+..++#.+..++++++\n+..#+++++..+##+#++.+\n+.+#+#....+.#...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIntroduction\n\nIt's been more than 20 minutes since the negligent waiter has taken your order for the house special prime tofu steak with a side of chili fries.\n\nOut of boredom, you start fiddling around with the condi...
[{"input": "1735", "output": "[1398915]", "fn_name": "toothpick"}, {"input": "1757", "output": "[1443119]", "fn_name": "toothpick"}, {"input": "1974", "output": "[2038207]", "fn_name": "toothpick"}, {"input": "2048", "output": "[2796203]", "fn_name": "toothpick"}, {"input": "1038", "output": "[699451]", "fn_name": "too...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nAt the beginning of the new semester there is new schedule in the Berland State University. According to this schedule, n groups have lessons at the room 31. For each group the starting time of the lesson and the finishin...
[{"type": "stdin_stdout", "input": "16\n203671 381501\n58867 59732\n817520 962123\n125391 163027\n601766 617692\n381501 444610\n761937 817520\n16 10551\n21096 38291\n718073 761937\n583868 601766\n554859 731755\n678098 718073\n962123 992003\n163027 203671\n87917 96397\n", "output": "1\n12 "}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nImagine that you are in a building that has exactly n floors. You can move between the floors in a lift. Let's number the floors from bottom to top with integers from 1 to n. Now you're on the floor number a. You are very...
[{"type": "stdin_stdout", "input": "5000 2081 3619 5000\n", "output": "557114846\n"}, {"type": "stdin_stdout", "input": "5000 2314 1234 5000\n", "output": "546628648\n"}, {"type": "stdin_stdout", "input": "5000 1031 4782 5000\n", "output": "981271392\n"}, {"type": "stdin_stdout", "input": "5000 4998 5000 5000\n", "outp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two strings x and y, both consist only of lowercase Latin letters. Let |s| be the length of string s.\n\nLet's call a sequence a a merging sequence if it consists of exactly |x| zeros and exactly |y| ones in...
[{"type": "stdin_stdout", "input": "justamassivetesttocheck\nhowwellyouhandlemodulooperations\n", "output": "\n667387032\n"}, {"type": "stdin_stdout", "input": "justamassivetestsocheck\nhowwellyouhandlemodulooperations\n", "output": "732028571\n"}, {"type": "stdin_stdout", "input": "kcehcostsetevissamatsuj\nhowwellyouh...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe educational program (AHK Education) of the Aiz Broadcasting Association broadcasts a handicraft program for children, \"Play with Tsukuro\". This time I will make a box with sticks, but I would like to see if I can ma...
[{"type": "stdin_stdout", "input": "0 1 1 4 11 16 3 2 0 0 5 13", "output": "no\n"}, {"type": "stdin_stdout", "input": "0 1 1 4 11 16 6 2 0 0 5 13", "output": "no\n"}, {"type": "stdin_stdout", "input": "0 1 1 4 11 16 6 2 1 0 5 13", "output": "no\n"}, {"type": "stdin_stdout", "input": "0 1 1 4 2 20 6 2 2 0 13 13", "outpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Definition \n\nA number is a **_Special Number_** *if it’s digits only consist 0, 1, 2, 3, 4 or 5*\n\n**_Given_** a number *determine if it special number or not* . \n\n\n\n# Warm-up (Highly recommended)\n\n# [Playing ...
[{"input": "11350224", "output": "[\"Special!!\"]", "fn_name": "special_number"}, {"input": "23", "output": "[\"Special!!\"]", "fn_name": "special_number"}, {"input": "32", "output": "[\"Special!!\"]", "fn_name": "special_number"}, {"input": "55", "output": "[\"Special!!\"]", "fn_name": "special_number"}, {"input": "2"...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nA queen is the strongest chess piece. In modern chess the queen can move any number of squares in any horizontal, vertical or diagonal direction (considering that there're no other pieces on its way). The queen combines t...
[{"type": "stdin_stdout", "input": "10 20\n6 10\n3 10\n10 4\n5 3\n9 4\n10 1\n10 3\n10 7\n8 5\n7 2\n4 7\n5 1\n2 9\n5 5\n6 6\n9 8\n2 10\n9 10\n1 4\n7 4\n", "output": "0 0 4 9 4 1 2 0 0\n"}, {"type": "stdin_stdout", "input": "100 10\n97 5\n53 35\n92 86\n54 95\n98 13\n36 23\n55 56\n96 94\n25 96\n49 31\n", "output": "6 4 0 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWhen new students come to the Specialized Educational and Scientific Centre (SESC) they need to start many things from the beginning. Sometimes the teachers say (not always unfairly) that we cannot even count. So our teac...
[{"type": "stdin_stdout", "input": "|||||||||||||||||||||||||||||||||||||||||||||||||||+|||||||||||||||||||||||||||||||||||||||||||||||||||=||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||\n", "output": "||||||||||||||||||||||||||||||||||||||||||||||||||+|||||||||||||...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPrint all the integers that satisfies the following in ascending order:\n - Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers.\n\n-----Constraints...
[{"type": "stdin_stdout", "input": "0 32 110", "output": "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n"}, {"type": "stdin_stdout", "input": "8 35 011", "output": "8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n25\n26\n27\n28\n29\n30\n31\n32\n33\n3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn an embassy of a well-known kingdom an electronic queue is organised. Every person who comes to the embassy, needs to make the following three actions: show the ID, pay money to the cashier and be fingerprinted. Besides...
[{"type": "stdin_stdout", "input": "2 7 1\n10 3 10\n100\n3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $p$ of length $n$, and Skynyrd bought an array $a$ of length $m$, consisting of integers from $1$ to $n$. \n\nLynyrd and Skynyrd became bored, s...
[{"type": "stdin_stdout", "input": "3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5\n", "output": "110\n"}, {"type": "stdin_stdout", "input": "3 6 3\n2 1 3\n1 1 3 1 2 3\n1 5\n2 6\n3 5\n", "output": "110\n"}, {"type": "stdin_stdout", "input": "3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n3 6\n3 5\n", "output": "100\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFalling Block Puzzle\n\nBlock drop\n\nYou are playing a falling block puzzle. As shown in the figure below, the field of this puzzle has a shape in which cubic cells are arranged in 2 squares x 2 squares in each row, and ...
[{"type": "stdin_stdout", "input": "1 1\n##\n#.\n..\n..\n#.\n..\n1 1\n.#\n#.\n#.\n..\n..\n.#\n2 2\n##\n#.\n##\n#.\n..\n.#\n##\n#.\n.#\n..\n#.\n..\n1 3\n#.\n..\n##\n##\n##\n##\n##\n##\n##\n##\n##\n##\n##\n##\n10 3\n##\n#.\n##\n#.\n##\n.#\n##\n.#\n#.\n##\n#.\n##\n.#\n##\n.#\n##\n.#\n#.\n.#\n#.\n#.\n.#\n#.\n.#\n#.\n..\n#....
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis kata is part of the collection [Mary's Puzzle Books](https://www.codewars.com/collections/marys-puzzle-books).\n\nMary brought home a \"spot the differences\" book. The book is full of a bunch of problems, and each p...
[{"input": "\"abcdefghijklmnopqrstuvwxyz\"\n\"zyxwvutsrqponmlkjihgfedcba\"", "output": "[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]]", "fn_name": "spot_diff"}, {"input": "\"Congratulations! You did it!\"\n\"Conglaturations! U did this!\"", "output": "[[4, 8, 17, 18, 1...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nHeidi and Doctor Who hopped out of the TARDIS and found themselves at EPFL in 2018. They were surrounded by stormtroopers and Darth Vader was approaching. Miraculously, they managed to escape to a nearby rebel base but th...
[{"type": "stdin_stdout", "input": "1 2\n1156621358\n561572949 6885\n312543334 3629\n", "output": "10514\n"}, {"type": "stdin_stdout", "input": "1 2\n458828651\n209599643 7592\n208642144 8751\n", "output": "16343\n"}, {"type": "stdin_stdout", "input": "1 2\n754725914\n561572949 6885\n312543334 3629\n", "output": "10514...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Summation Of Primes\n\nThe sum of the primes below or equal to 10 is **2 + 3 + 5 + 7 = 17**. Find the sum of all the primes **_below or equal to the number passed in_**.\n\nFrom Project Euler's [Problem #10](https://pro...
[{"input": "25000", "output": "[32405717]", "fn_name": "summationOfPrimes"}, {"input": "4000", "output": "[1013507]", "fn_name": "summationOfPrimes"}, {"input": "5000", "output": "[1548136]", "fn_name": "summationOfPrimes"}, {"input": "2000", "output": "[277050]", "fn_name": "summationOfPrimes"}, {"input": "3000", "out...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which judges wheather given length of three side form a right triangle. Print \"YES\" if the given sides (integers) form a right triangle, \"NO\" if not so.\n\nConstraints\n\n* 1 ≀ length of the side ≀ 1,0...
[{"type": "stdin_stdout", "input": "3\n-1 -2 0\n0 1 -1\n-2 0 2", "output": "NO\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "3\n-1 -2 -1\n0 1 0\n-2 0 2", "output": "NO\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "3\n1 1 0\n29 1 -1\n0 1 -1", "output": "YES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "3\n2 2 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Task\n Mr.Nam has `n` candies, he wants to put one candy in each cell of a table-box. The table-box has `r` rows and `c` columns.\n\n Each candy was labeled by its cell number. The cell numbers are in range from 1 to N ...
[{"input": "15\n3\n3\n18", "output": "[[-1, -1, -1]]", "fn_name": "get_candy_position"}, {"input": "6\n2\n2\n7", "output": "[[-1, -1, -1]]", "fn_name": "get_candy_position"}, {"input": "15\n3\n3\n14", "output": "[[2, 1, 1]]", "fn_name": "get_candy_position"}, {"input": "15\n3\n3\n1", "output": "[[1, 2, 2]]", "fn_name":...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's call a positive integer extremely round if it has only one non-zero digit. For example, $5000$, $4$, $1$, $10$, $200$ are extremely round integers; $42$, $13$, $666$, $77$, $101$ are not.\n\nYou are given an integer...
[{"type": "stdin_stdout", "input": "5\n9\n42\n13\n100\n111\n", "output": "9\n13\n10\n19\n19\n"}, {"type": "stdin_stdout", "input": "1\n707951\n", "output": "52\n"}, {"type": "stdin_stdout", "input": "1\n99889\n", "output": "45\n"}, {"type": "stdin_stdout", "input": "1\n9123\n", "output": "36\n"}, {"type": "stdin_stdout...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSeen from above, there is a grid-like square shaped like Figure 1. The presence or absence of \"walls\" on each side of this grid is represented by a sequence of 0s and 1s. Create a program that stands at point A, puts yo...
[{"type": "stdin_stdout", "input": "1111\n00001\n0110\n11111\n1010\n00011\n1010\n01011\n1111", "output": "RRRRDDDDLLLLRULRDRRULRULULDLUDRURRDDDRUUUULLLL\n"}, {"type": "stdin_stdout", "input": "1111\n01001\n0010\n11101\n1110\n00111\n1110\n10001\n1110", "output": "RRRRDDDDUUUULLLDDRURLDRDLLLDRRRLLLURRULLUDRUUL\n"}, {"typ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter a long party Petya decided to return home, but he turned out to be at the opposite end of the town from his home. There are $n$ crossroads in the line in the town, and there is either the bus or the tram station at ...
[{"type": "stdin_stdout", "input": "5\n3 1 1\nBC\n1 0 0\nAB\n4 1 11\nAABBBBAABB\n1 3 1\nBBBBB\n6 1 1\nABABAB\n", "output": "1\n2\n1\n5\n6\n"}, {"type": "stdin_stdout", "input": "5\n2 1 1\nBB\n1 1 1\nAB\n3 2 0\nAABBBBAABB\n5 3 4\nBBBBB\n2 1 1\nABABAB\n", "output": "1\n1\n10\n1\n6\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHighway 201 is the most busy street in Rockport. Traffic cars cause a lot of hindrances to races, especially when there are a lot of them. The track which passes through this highway can be divided into $n$ sub-tracks. Yo...
[{"type": "stdin_stdout", "input": "3\n3\n1 2 3\n4\n0 1 1 0\n10\n10 3 1 11 5 2 1 7 19 4\n", "output": "0\n4\n21\n"}, {"type": "stdin_stdout", "input": "3\n3\n1 2 3\n4\n0 1 1 0\n10\n10 3 1 11 5 2 1 7 10 4\n", "output": "0\n4\n24\n"}, {"type": "stdin_stdout", "input": "3\n3\n1 1 3\n4\n1 1 1 0\n10\n16 3 6 11 0 2 1 3 10 4\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.\...
[{"type": "stdin_stdout", "input": "44447774444474477747774774477777474774744744477444447777477477744747477774744444744777777777747777477447744774744444747477744744\n77777474477477747774777777474474477444474777477747747777477747747744474474747774747747444777474444744744444477477777747744747477\n", "output": "37\n"}, {"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Little Elephant loves numbers. \n\nHe has a positive integer x. The Little Elephant wants to find the number of positive integers d, such that d is the divisor of x, and x and d have at least one common (the same) dig...
[{"type": "stdin_stdout", "input": "1010000000\n", "output": "117\n"}, {"type": "stdin_stdout", "input": "1011000000\n", "output": "171\n"}, {"type": "stdin_stdout", "input": "654885000\n", "output": "698\n"}, {"type": "stdin_stdout", "input": "1000000000\n", "output": "91\n"}, {"type": "stdin_stdout", "input": "101871...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently, you found a bot to play \"Rock paper scissors\" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \\dots s_{n}$ of length $n$ where each letter is either R, S or P....
[{"type": "stdin_stdout", "input": "3\nRRRR\nRSP\nS\n", "output": "PPPP\nPPP\nR\n"}, {"type": "stdin_stdout", "input": "3\nRRRR\nRSP\nS\n", "output": "PPPP\nPPP\nR\n"}, {"type": "stdin_stdout", "input": "3\nRRRR\nSSP\nS\n", "output": "PPPP\nRRR\nR\n"}, {"type": "stdin_stdout", "input": "3\nQRRR\nRSP\nS\n", "output": "P...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently in Divanovo, a huge river locks system was built. There are now $n$ locks, the $i$-th of them has the volume of $v_i$ liters, so that it can contain any amount of water between $0$ and $v_i$ liters. Each lock has...
[{"type": "stdin_stdout", "input": "50\n3 60 52 60 60 84 63 40 50 21 39 59 40 15 59 54 5 84 63 23 11 69 27 65 64 8 39 4 89 19 10 45 51 66 69 60 82 25 82 66 86 35 24 64 43 67 35 25 39 82\n50\n57\n46\n44\n70\n74\n98\n36\n48\n76\n52\n86\n40\n28\n56\n73\n64\n78\n21\n37\n54\n33\n93\n16\n18\n66\n75\n62\n77\n81\n96\n31\n41\n6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given N items.\n\nThe value of the i-th item (1 \\leq i \\leq N) is v_i.\n\nYour have to select at least A and at most B of these items.\n\nUnder this condition, find the maximum possible arithmetic mean of the va...
[{"type": "stdin_stdout", "input": "50 15 47\n795366679311762 795366679311762 795366679311762 795366679311762 795366679311762 795366679311762 795366679311762 795366679311762 795366679311762 795366679311762 795366679311762 473967724102502 795366679311762 766773867637913 795366679311762 795366679311762 795366679311762 79...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPak Chanek plans to build a garage. He wants the garage to consist of a square and a right triangle that are arranged like the following illustration.\n\nDefine $a$ and $b$ as the lengths of two of the sides in the right ...
[{"type": "stdin_stdout", "input": "1000000000\n", "output": "1333333336\n"}, {"type": "stdin_stdout", "input": "999999999\n", "output": "1333333335\n"}, {"type": "stdin_stdout", "input": "999999998\n", "output": "1333333333\n"}, {"type": "stdin_stdout", "input": "999999997\n", "output": "1333333332\n"}, {"type": "stdi...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Super Duper Secret Meeting of the Super Duper Secret Military Squad takes place in a Super Duper Secret Place. The place is an infinite plane with introduced Cartesian coordinate system. The meeting table is represent...
[{"type": "stdin_stdout", "input": "-565 -444 -419 -421\n30\n363 -249 790\n704 57 999\n-316 -305 119\n-778 -543 373\n-589 466 190\n516 -174 893\n-742 -662 390\n-382 825 1000\n520 -732 909\n-220 -985 555\n-49 -697 396\n-701 -882 520\n-105 227 691\n-113 -470 231\n-503 98 1088\n236 69 759\n150 393 951\n414 381 1000\n1096 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPeople in the Tomskaya region like magic formulas very much. You can see some of them below.\n\nImagine you are given a sequence of positive integer numbers p_1, p_2, ..., p_{n}. Lets write down some magic formulas:$q_{i}...
[{"type": "stdin_stdout", "input": "25\n39226529 640445129 936289624 364461191 1096077769 573427707 1919403410 950067229 1217479531 455229458 1574949468 397268319 1267289585 995220637 1920919164 501015483 1815262670 1197059269 86947741 1137410885 667368575 733666398 1536581408 611239452 947487746\n", "output": "2596546...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nToday, Wet Shark is given n bishops on a 1000 by 1000 grid. Both rows and columns of the grid are numbered from 1 to 1000. Rows are numbered from top to bottom, while columns are numbered from left to right.\n\nWet Shark ...
[{"type": "stdin_stdout", "input": "10\n646 171\n816 449\n375 934\n950 299\n702 232\n657 81\n885 306\n660 304\n369 371\n798 657\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10\n646 171\n816 449\n375 934\n950 299\n702 232\n657 81\n885 306\n660 304\n369 371\n798 657\n", "output": "0\n"}, {"type": "stdin_stdou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya has recently found out what a digital root of a number is and he decided to share his knowledge with you.\n\nLet's assume that S(n) is the sum of digits of number n, for example, S(4098) = 4 + 0 + 9 + 8 = 21. Then t...
[{"type": "stdin_stdout", "input": "4898 3\n", "output": "3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a$ of $n$ integers. You are asked to find out if the inequality $$\\max(a_i, a_{i + 1}, \\ldots, a_{j - 1}, a_{j}) \\geq a_i + a_{i + 1} + \\dots + a_{j - 1} + a_{j}$$ holds for all pairs of indice...
[{"type": "stdin_stdout", "input": "5\n19\n1 1 -1 -1 -1 0 -1 -1 1 -1 -1 1 0 1 0 -1 0 -1 -1\n11\n1 0 1 0 -1 1 -1 -1 -1 1 0\n58\n1 0 0 -1 -1 0 1 0 1 0 1 -1 1 1 0 0 1 -1 -1 1 -1 1 -1 -1 1 -1 0 1 0 0 0 0 -1 -1 0 0 0 1 0 0 1 -1 0 0 0 -1 0 0 1 -1 0 -1 1 1 -1 0 0 1\n2\n0 0\n10\n0 -1 1 -1 1 -1 0 0 1 0\n", "output": "NO\nNO\nNO...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDeveloping tools for creation of locations maps for turn-based fights in a new game, Petya faced the following problem.\n\nA field map consists of hexagonal cells. Since locations sizes are going to be big, a game designe...
[{"type": "stdin_stdout", "input": "-1000000000 -1000000000 1000000000 1000000000\n", "output": "2000000002000000001"}, {"type": "stdin_stdout", "input": "-1000000000 -1000000000 1000000000 1000000000\n", "output": "2000000002000000001"}, {"type": "stdin_stdout", "input": "-1000000000 -999999999 1000000000 999999999\n"...
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\nThe Head Chef is receiving a lot of orders for cooking the best of the problems lately. For this, he organized an hiring event to hire some...
[{"type": "stdin_stdout", "input": "2\n1\n210", "output": "0\n2628\n"}, {"type": "stdin_stdout", "input": "2\n1\n198", "output": "0\n2484\n"}, {"type": "stdin_stdout", "input": "2\n1\n175", "output": "0\n2288\n"}, {"type": "stdin_stdout", "input": "2\n2\n175", "output": "2\n2288\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nComplete the code which should return `true` if the given object is a single ASCII letter (lower or upper case), `false` otherwise.\n\nWrite your solution by modifying this code:\n\n```python\ndef is_letter(s):\n\t\n```\n...
[{"input": "\"a\\n\"", "output": "[false]", "fn_name": "is_letter"}, {"input": "\"ab\"", "output": "[false]", "fn_name": "is_letter"}, {"input": "\"7\"", "output": "[false]", "fn_name": "is_letter"}, {"input": "\"_\"", "output": "[false]", "fn_name": "is_letter"}, {"input": "\"\"", "output": "[false]", "fn_name": "is_l...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nIt's pretty straightforward. Your goal is to create a function that removes the first and last characters of a string. You're given one parameter, the original string. You don't have to worry with strings with less than ...
[{"input": "\"eloquent\"", "output": "[\"loquen\"]", "fn_name": "remove_char"}, {"input": "\"country\"", "output": "[\"ountr\"]", "fn_name": "remove_char"}, {"input": "\"ooopsss\"", "output": "[\"oopss\"]", "fn_name": "remove_char"}, {"input": "\"person\"", "output": "[\"erso\"]", "fn_name": "remove_char"}, {"input": "...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nIT City company developing computer games decided to upgrade its way to reward its employees. Now it looks the following way. After a new game release users start buying it actively, and the company tracks the number of s...
[{"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "228571428571428571\n"}, {"type": "stdin_stdout", "input": "1000000010000000000\n", "output": "228571430857142858\n"}, {"type": "stdin_stdout", "input": "1334196189585702396\n", "output": "304959129048160547\n"}, {"type": "stdin_stdout", "input": "13...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe ancient Berlanders believed that the longer the name, the more important its bearer is. Thus, Berland kings were famous for their long names. But long names are somewhat inconvenient, so the Berlanders started to abbr...
[{"type": "stdin_stdout", "input": "50\nagecd\ncghafi\nfiide\niecc\njbdcfjhgd\ndiee\nhfeg\nehc\ngfijgjh\ngacaifebg\ndicbbddc\nhjgciaei\njjcdh\ng\ngc\ncf\nhfdjhd\nc\nicidbec\nji\neeh\ncgeejggc\nacfd\njjg\najefdj\neghhebiic\nbih\ngbb\njjaa\nidc\ngafi\necg\ndbigbjiehj\ncedif\nahidfaaajg\nhfhhiccbgb\ndgegjgieif\nhgjebhfdc\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasiliy has an exam period which will continue for n days. He has to pass exams on m subjects. Subjects are numbered from 1 to m.\n\nAbout every day we know exam for which one of m subjects can be passed on that day. Perh...
[{"type": "stdin_stdout", "input": "100 10\n1 1 6 6 6 2 5 7 6 5 3 7 10 10 8 9 7 6 9 2 6 7 8 6 7 5 2 5 10 1 10 1 8 10 2 9 7 1 6 8 3 10 9 4 4 8 8 6 6 1 5 5 6 5 6 6 6 9 4 7 5 4 6 6 1 1 2 1 8 10 6 2 1 7 2 1 8 10 9 2 7 3 1 5 10 2 8 10 10 10 8 9 5 4 6 10 8 9 6 6\n2 4 10 11 5 2 6 7 2 15\n", "output": "74\n"}, {"type": "stdin_...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOld timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?\n\nThere are $n$ stu...
[{"type": "stdin_stdout", "input": "20 4\n1\n1\n1\n1\n1\n2\n2\n2\n2\n2\n3\n3\n3\n3\n3\n4\n4\n4\n4\n4\n", "output": "18\n"}, {"type": "stdin_stdout", "input": "20 4\n1\n1\n1\n1\n1\n2\n2\n2\n2\n2\n3\n3\n3\n3\n3\n4\n4\n4\n4\n4\n", "output": "18\n"}, {"type": "stdin_stdout", "input": "16 12\n1\n1\n1\n2\n2\n4\n3\n3\n3\n4\n4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTaro, a junior high school student, is working on his homework. Today's homework is to read Chinese classic texts.\n\nAs you know, Japanese language shares the (mostly) same Chinese characters but the order of words is a ...
[{"type": "stdin_stdout", "input": "6\nonetwo2\n-\nonetwo1\nonetwo2\n-\nonetwo1\n7\nv\ntopbottom2\nonetwo2\n-\nonetwo1\ntopbottom1\n-\n6\nbaz2\nfoo2\nbaz1v\nbar1\nfoo1\nbar1\n0", "output": "2\n3\n1\n5\n6\n4\n4\n5\n3\n6\n2\n1\n7\n4\n3\n1\n5\n2\n6\n"}, {"type": "stdin_stdout", "input": "6\nonetwo2\n-\nonetwo1\nonetwo1\n-...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a staircase with N steps. Takahashi is now standing at the foot of the stairs, that is, on the 0-th step.\nHe can climb up one or two steps at a time.\nHowever, the treads of the a_1-th, a_2-th, a_3-th, \\ldots, ...
[{"type": "stdin_stdout", "input": "16090 15931\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n43\n44\n45\n46\n47\n48\n49\n50\n51\n52\n53\n54\n55\n56\n57\n58\n59\n60\n61\n62\n63\n64\n65\n66\n67\n68\n69\n70\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 50\\,000$.\n\nThere are $n$ distinct points in three-dimensional space numbered from $1$ to $n$. The $i$-th point has coordinates $(x_i, y_i, z_i)$. The nu...
[{"type": "stdin_stdout", "input": "8\n-100000000 -100000000 -100000000\n100000000 100000000 100000000\n-100000000 100000000 100000000\n-100000000 -100000000 100000000\n100000000 100000000 -100000000\n100000000 -100000000 -100000000\n-100000000 100000000 -100000000\n100000000 -100000000 100000000\n", "output": "1 4\n7 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nReading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: \"Many are my names in many countries. Mithrandir a...
[{"type": "stdin_stdout", "input": "tttdddssstttssstttdddddddddttttttdddsssdddtttsssdddsssssstttddddddtttdddssstttsssttttttdddtttsssssstttssssssssstttsssssstttssstttdddddddddsssdddssssssdddssstttsssdddssstttdddttttttdddddddddsssssstttdddtttssssssdddddddddttttttdddtttsssdddssstttsssdddssssssdddsssdddddddddtttssstttsssss...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTaro is not good at hide-and-seek. As soon as you hide, you will find it, and it will be difficult to find the hidden child. My father, who couldn't see it, made an ultra-high performance location search system. You can u...
[{"type": "stdin_stdout", "input": "3\n6 6 3\n19 19 6\n42 10 1\n6\n5 2 2 11\n12 7 2 11\n11 9 1 11\n14 2 22 5\n17 9 20 5\n20 10 20 5\n0", "output": "Safe\nDanger\nDanger\nDanger\nDanger\nDanger\n"}, {"type": "stdin_stdout", "input": "3\n6 2 16\n40 7 8\n42 8 1\n6\n5 3 4 11\n12 4 2 15\n16 2 0 11\n28 2 31 5\n17 9 41 5\n24 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAnton has the integer x. He is interested what positive integer, which doesn't exceed x, has the maximum sum of digits.\n\nYour task is to help Anton and to find the integer that interests him. If there are several such i...
[{"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "999999999999999999\n"}, {"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "999999999999999999\n"}, {"type": "stdin_stdout", "input": "978916546899999999\n", "output": "899999999999999999\n"}, {"type": "stdin_stdout", "input": "999...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n schoolchildren, boys and girls, lined up in the school canteen in front of the bun stall. The buns aren't ready yet and the line is undergoing some changes.\n\nEach second all boys that stand right in front of...
[{"type": "stdin_stdout", "input": "MFFFMMFMFMFMFFFMMMFFMMMMMMFMMFFMMMFMMFMFFFMMFMMMFFMMFFFFFMFMFFFMMMFFFMFMFMFMFFFMMMMFMMFMMFFMMMMMMFFM\n", "output": "54\n"}, {"type": "stdin_stdout", "input": "MMMMMFFMFMFMFMMFMMFFMMFMFFFFFFFMFFFMMMMMMFFMMMFMFMMFMFFMMFMMMFFFFFMMMMMFMMMMFMMMFFMFFMFFFMFFMFFMMFFM\n", "output": "58\n"}, {...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA sequence $(b_1, b_2, \\ldots, b_k)$ is called strange, if the absolute difference between any pair of its elements is greater than or equal to the maximum element in the sequence. Formally speaking, it's strange if for ...
[{"type": "stdin_stdout", "input": "6\n4\n-1 -2 -1 1\n7\n-3 2 -2 0 -4 7 1\n5\n0 5 -3 2 -5\n3\n2 0 1\n4\n-3 -1 2 0\n6\n-3 -2 -1 1 1 1\n", "output": "3\n5\n4\n2\n3\n4\n"}, {"type": "stdin_stdout", "input": "6\n4\n-1 -2 -1 1\n7\n-3 2 -2 0 -4 7 1\n5\n0 5 -3 1 -5\n3\n2 0 1\n4\n-3 -1 2 0\n6\n-3 -2 -2 1 1 1\n", "output": "3\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given three integers A, B and C.\n\nDetermine if there exists an equilateral triangle whose sides have lengths A, B and C.\n\nConstraints\n\n* All values in input are integers.\n* 1 \\leq A,B,C \\leq 100\n\nInput\...
[{"type": "stdin_stdout", "input": "-1 -1 -1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-2 -1 -1", "output": "No\n"}, {"type": "stdin_stdout", "input": "-2 -1 -2", "output": "No\n"}, {"type": "stdin_stdout", "input": "-3 10 -1", "output": "No\n"}, {"type": "stdin_stdout", "input": "-3 1 -11", "output": "N...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nInna loves digit 9 very much. That's why she asked Dima to write a small number consisting of nines. But Dima must have misunderstood her and he wrote a very large number a, consisting of digits from 1 to 9.\n\nInna wants...
[{"type": "stdin_stdout", "input": "44444444444444544444444445444444444444444444444444554444444444444444444444444444444444444444455444444444444444444444444444444444444444545444444444444444444444444444444444444445444444444444444444444444444444444444544444444444444444444444444444444444444444444544444444444444444444444444...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nI bought food at the store to make a lunch box to eat at lunch. At the store, I only got an elongated bag to put food in, so I had to stack all the food vertically and put it in the bag. I want to pack the bag with the he...
[{"type": "stdin_stdout", "input": "4\nsandwich 30 120\nelppa 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 101 500\nchocolate 50 350\niookce 30 132\npurin 40 400\ncracker 40 154\n0", "output": "cake\nelppa\nsandwich\ncheese\nkanzume\npurin\nchocolate\nonigiri...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nFor the integer n (1 ≀ n), let Pn be a string of n + 1 I's and n O's starting with I and alternating, where I and O are the uppercase Ai and O, respectively. is there.\n\n\nP1 | IOI\n--- | ---\nP2 | IOIOI\nP3 |...
[{"type": "stdin_stdout", "input": "1\n119\nOOJOIOIOIIOII\n1\n14\nKIOIIOIOIOJOO\n0", "output": "3\n3\n"}, {"type": "stdin_stdout", "input": "1\n13\nOIIOIOIOIIOIO\n2\n13\nOOIOIOIOIIOII\n0", "output": "4\n2\n"}, {"type": "stdin_stdout", "input": "1\n13\nOOIOIOIOIIOII\n3\n13\nOOIOIOIOIIOII\n0", "output": "4\n1\n"}, {"type...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGottfried learned about binary number representation. He then came up with this task and presented it to you.\n\nYou are given a collection of $n$ non-negative integers $a_1, \\ldots, a_n$. You are allowed to perform the ...
[{"type": "stdin_stdout", "input": "37\n1048575 327657 1046479 686078 513773 589787 387035 736754 1038077 1048056 59263 753353 784318 647131 519679 294910 185560 604141 456668 849789 521404 782287 6137 1047551 849874 523933 521721 278491 1042415 581468 1013705 439526 1011709 917469 655311 327646 917499\n", "output": "2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe goal of the matrix-chain multiplication problem is to find the most efficient way to multiply given $n$ matrices $M_1, M_2, M_3,...,M_n$.\n\nWrite a program which reads dimensions of $M_i$, and finds the minimum numbe...
[{"type": "stdin_stdout", "input": "6\n30 35\n35 15\n15 5\n5 10\n10 20\n20 29", "output": "16125\n"}, {"type": "stdin_stdout", "input": "6\n30 35\n35 15\n15 5\n5 10\n10 20\n20 27", "output": "15625\n"}, {"type": "stdin_stdout", "input": "6\n30 35\n35 15\n15 5\n5 10\n10 20\n20 47", "output": "20625\n"}, {"type": "stdin_...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPrint all subsets of a set $S$, which contains $0, 1, ... n-1$ as elements. Note that we represent $0, 1, ... n-1$ as 00...0001, 00...0010, 00...0100, ..., 10...0000 in binary respectively and the integer representation o...
[{"type": "stdin_stdout", "input": "8", "output": "0:\n1: 0\n2: 1\n3: 0 1\n4: 2\n5: 0 2\n6: 1 2\n7: 0 1 2\n8: 3\n9: 0 3\n10: 1 3\n11: 0 1 3\n12: 2 3\n13: 0 2 3\n14: 1 2 3\n15: 0 1 2 3\n16: 4\n17: 0 4\n18: 1 4\n19: 0 1 4\n20: 2 4\n21: 0 2 4\n22: 1 2 4\n23: 0 1 2 4\n24: 3 4\n25: 0 3 4\n26: 1 3 4\n27: 0 1 3 4\n28: 2 3 4\n...
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\n\nIt reduced the time for messages to travel between the Atlantic and Pacific coasts to about 10 days, before it was made ...
[{"input": "[6, 24, 6, 8, 28, 8, 23, 47, 17, 29, 37, 18, 40, 49]\n2", "output": "[5]", "fn_name": "riders"}, {"input": "[33, 8, 16, 47, 30, 30, 46]\n5", "output": "[5]", "fn_name": "riders"}, {"input": "[50, 100, 25, 50, 26]\n3", "output": "[6]", "fn_name": "riders"}, {"input": "[50, 50, 25, 50, 24]\n3", "output": "[3]...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nYour security guard friend recently got a new job at a new security company. The company requires him to patrol an area of the city encompassing exactly N city blocks, but they let him choose which blocks. That is, your f...
[{"type": "stdin_stdout", "input": "1000000\n", "output": "4000\n"}, {"type": "stdin_stdout", "input": "1000000\n", "output": "4000\n"}, {"type": "stdin_stdout", "input": "999000\n", "output": "3998\n"}, {"type": "stdin_stdout", "input": "999001\n", "output": "4000\n"}, {"type": "stdin_stdout", "input": "999999\n", "ou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMany countries have such a New Year or Christmas tradition as writing a letter to Santa including a wish list for presents. Vasya is an ordinary programmer boy. Like all ordinary boys, he is going to write the letter to S...
[{"type": "stdin_stdout", "input": "8 704 99 110\n", "output": "ACACACACACACACACACACBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBA\nACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACBBBBBBBBBBBBBA\n"}, {"type": "stdin_stdout", "input": "8 66...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLogical quantifiers are very useful tools for expressing claims about a set. For this problem, let's focus on the set of real numbers specifically. The set of real numbers includes zero and negatives. There are two kinds ...
[{"type": "stdin_stdout", "input": "100 50\n55 13\n84 2\n22 63\n100 91\n2 18\n98 64\n1 86\n93 11\n17 6\n24 97\n14 35\n24 74\n22 3\n42 5\n63 79\n31 89\n81 22\n86 88\n77 51\n81 34\n19 55\n41 54\n34 57\n45 9\n55 72\n67 61\n41 84\n39 32\n51 89\n58 74\n32 79\n65 6\n86 64\n63 42\n100 57\n46 39\n100 9\n23 58\n26 81\n61 49\n71...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKawashiro Nitori is a girl who loves competitive programming.\n\nOne day she found a string and an integer. As an advanced problem setter, she quickly thought of a problem.\n\nGiven a string $s$ and a parameter $k$, you n...
[{"type": "stdin_stdout", "input": "7\n5 2\nrwrwq\n2 0\nac\n3 1\nioi\n4 0\nibdp\n22 0\ndokidoktliteraiureclub\n19 0\necilbiahgaahsmnetmi\n6 2\naaaaaa\n", "output": "NO\nYES\nYES\nYES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "7\n5 1\nqwqwq\n2 0\nab\n3 1\nioi\n4 2\nipcc\n22 0\ncokidokiliteratureclub\n19 11\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nStudents in a class are making towers of blocks. Each student makes a (non-zero) tower by stacking pieces lengthwise on top of each other. n of the students use pieces made of two blocks and m of the students use pieces m...
[{"type": "stdin_stdout", "input": "1000000 1000000\n", "output": "3000000\n"}, {"type": "stdin_stdout", "input": "1000000 1000000\n", "output": "3000000\n"}, {"type": "stdin_stdout", "input": "1000000 999999\n", "output": "2999998\n"}, {"type": "stdin_stdout", "input": "999999 1000000\n", "output": "3000000\n"}, {"typ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis contest, AtCoder Beginner Contest, is abbreviated as ABC.\nWhen we refer to a specific round of ABC, a three-digit number is appended after ABC. For example, ABC680 is the 680th round of ABC.\nWhat is the abbreviatio...
[{"type": "stdin_stdout", "input": "1530", "output": "ABC1530\n"}, {"type": "stdin_stdout", "input": "2825", "output": "ABC2825\n"}, {"type": "stdin_stdout", "input": "5621", "output": "ABC5621\n"}, {"type": "stdin_stdout", "input": "-105", "output": "ABC-105\n"}, {"type": "stdin_stdout", "input": "-136", "output": "AB...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nComplete the solution so that it returns true if it contains any duplicate argument values. Any number of arguments may be passed into the function.\n\nThe array values passed in will only be strings or numbers. The only ...
[{"input": "\"a\"\n\"b\"\n\"c\"\n\"d\"\n\"e\"\n\"f\"\n\"f\"\n\"b\"", "output": "[true]", "fn_name": "solution"}, {"input": "\"a\"\n\"b\"\n\"c\"\n\"d\"", "output": "[false]", "fn_name": "solution"}, {"input": "1\n2\n42\n3\n4\n5\n42", "output": "[true]", "fn_name": "solution"}, {"input": "\"a\"\n\"b\"\n\"c\"\n\"c\"", "ou...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\n## Description\n\nGiven an array X of positive integers, its elements are to be transformed by running the following operation on them as many times as required:\n\n```if X[i] > X[j] then X[i] = X[i] - X[j]```\n\nWhen no ...
[{"input": "[71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71]", "output": "[923]", "fn_name": "solution"}, {"input": "[60, 12, 96, 48, 60, 24, 72, 36, 72, 72, 48]", "output": "[132]", "fn_name": "solution"}, {"input": "[3, 13, 23, 7, 83]", "output": "[5]", "fn_name": "solution"}, {"input": "[4, 16, 24]", "output": "...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nGenos recently installed the game Zuma on his phone. In Zuma there exists a line of n gemstones, the i-th of which has color ci. The goal of the game is to destroy all the gemstones in the line as quickly as possible.\n\n...
[{"type": "stdin_stdout", "input": "50\n22 19 14 22 20 11 16 28 23 15 3 23 6 16 30 15 15 10 43 28 19 19 22 30 28 1 27 12 12 14 17 30 17 26 21 26 27 1 11 23 9 30 18 19 17 29 11 20 29 24\n", "output": "25\n"}, {"type": "stdin_stdout", "input": "50\n22 19 14 22 20 11 16 28 38 15 3 23 6 16 30 15 15 10 43 28 19 19 22 30 28 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Chris is bored during his physics lessons (too easy), so he has built a toy box to keep himself occupied. The box is special, since it has the ability to change gravity.\n\nThere are n columns of toy cubes in the b...
[{"type": "stdin_stdout", "input": "100\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe want to know the index of the vowels in a given word, for example, there are two vowels in the word super (the second and fourth letters). \n\nSo given a string \"super\", we should return a list of [2, 4].\n\n ...
[{"input": "\"supercalifragilisticexpialidocious\"", "output": "[[2, 4, 7, 9, 12, 14, 16, 19, 21, 24, 25, 27, 29, 31, 32, 33]]", "fn_name": "vowel_indices"}, {"input": "\"narboonnee\"", "output": "[[2, 5, 6, 9, 10]]", "fn_name": "vowel_indices"}, {"input": "\"UNDISARMED\"", "output": "[[1, 4, 6, 9]]", "fn_name": "vowel...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nKoa the Koala and her best friend want to play a game.\n\nThe game starts with an array a of length n consisting of non-negative integers. Koa and her best friend move in turns and each have initially a score equal to 0. ...
[{"type": "stdin_stdout", "input": "4\n5\n4 1 5 1 4\n4\n1 0 0 12\n1\n0\n2\n5 4\n", "output": "LOSE\nWIN\nDRAW\nWIN\n"}, {"type": "stdin_stdout", "input": "4\n5\n2 1 3 1 0\n4\n1 0 1 6\n1\n0\n2\n5 4\n", "output": "LOSE\nWIN\nDRAW\nWIN\n"}, {"type": "stdin_stdout", "input": "4\n5\n4 1 5 1 4\n4\n1 0 1 12\n1\n1\n2\n5 4\n", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe King of a little Kingdom on a little island in the Pacific Ocean frequently has childish ideas. One day he said, β€œYou shall make use of a message relaying game when you inform me of something.” In response to the King...
[{"type": "stdin_stdout", "input": "5\nAJMP\naB33d\nE\n86AE\nAM\n-1\nMPJE\nWaEaETC302Q\nCP\nrTurnAGumdam1isdefferentf", "output": "33Bad\nAE86\n2-\nEC302QTWaEa\nTurnAGumdam0isdefferentfr\n"}, {"type": "stdin_stdout", "input": "5\nAJMP\naB33d\nE\n86AE\nMA\n-1\nMPJE\nWaEaETC302Q\nCP\nftnereffedsi1madmuGAnruTr", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day, little Vasya found himself in a maze consisting of (n + 1) rooms, numbered from 1 to (n + 1). Initially, Vasya is at the first room and to get out of the maze, he needs to get to the (n + 1)-th one.\n\nThe maze i...
[{"type": "stdin_stdout", "input": "129\n1 1 3 3 1 4 7 4 3 5 8 11 3 9 15 4 11 17 1 6 18 9 11 13 17 22 8 18 26 13 16 20 3 16 35 26 23 28 27 30 39 29 43 8 14 6 17 32 26 31 2 18 3 47 52 21 57 1 35 35 53 47 16 26 30 65 48 2 32 11 10 5 4 1 4 53 71 21 53 8 58 49 17 6 19 80 1 49 43 60 12 60 35 25 86 45 47 97 52 74 10 91 93 31...
code_stdio