messages
listlengths
1
1
ground_truth
stringlengths
88
726k
dataset
stringclasses
1 value
[ { "content": "Solve the following coding problem using the programming language python:\n\nShapur was an extremely gifted student. He was great at everything including Combinatorics, Algebra, Number Theory, Geometry, Calculus, etc. He was not only smart but extraordinarily fast! He could manage to sum 1018 numb...
[{"type": "stdin_stdout", "input": "1010000011010110011101001101110001110010000111011101110010110110111111001001110100101100010101010001\n0111101000111100101100000101111010100100001000011101010100110011100011010011010101000100101011100011\n", "output": "110110101110101011000100100000101101011000111100000010011000010101...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nAt the JOI pasta shop, the recommended pasta for lunch and the set menu of freshly squeezed juice are popular. When ordering this set menu, choose one from each of the three pasta and two juices of the day. The...
[{"type": "stdin_stdout", "input": "800\n1126\n900\n198\n330", "output": "948\n"}, {"type": "stdin_stdout", "input": "800\n1126\n900\n132\n330", "output": "882\n"}, {"type": "stdin_stdout", "input": "800\n1126\n206\n132\n330", "output": "288\n"}, {"type": "stdin_stdout", "input": "800\n1126\n180\n132\n330", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Artem found a grasshopper. He brought it to his house and constructed a jumping area for him.\n\nThe area looks like a strip of cells 1 × n. Each cell contains the direction for the next jump and the length of that...
[{"type": "stdin_stdout", "input": "10\n>>>>>>>>><\n1 1 1 1 1 1 1 1 1 6\n", "output": "INFINITE\n"}, {"type": "stdin_stdout", "input": "10\n>>>>>>>>><\n2 1 1 1 1 1 1 1 1 5\n", "output": "INFINITE\n"}, {"type": "stdin_stdout", "input": "10\n>>>>>>>>>>\n1 1 1 1 1 1 2 1 1 100\n", "output": "FINITE\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDreamoon loves summing up something for no reason. One day he obtains two integers a and b occasionally. He wants to calculate the sum of all nice integers. Positive integer x is called nice if <image> and <image>, where ...
[{"type": "stdin_stdout", "input": "10000000 10000000\n", "output": "425362313\n"}, {"type": "stdin_stdout", "input": "10000000 9999999\n", "output": "930564389\n"}, {"type": "stdin_stdout", "input": "3865975 13943620\n", "output": "633381536\n"}, {"type": "stdin_stdout", "input": "6407688 3000816\n", "output": "895399...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCarol is currently curling.\n\nShe has n disks each with radius r on the 2D plane. \n\nInitially she has all these disks above the line y = 10^100.\n\nShe then will slide the disks towards the line y = 0 one by one in ord...
[{"type": "stdin_stdout", "input": "5 300\n939 465 129 611 532\n", "output": "300 667.8641053432639 1164.9596695962555 1522.2774553276686 2117.0538839123933\n"}, {"type": "stdin_stdout", "input": "5 300\n594 465 129 611 532\n", "output": "300 885.9684291836891 1383.0639934366804 1740.3817791680935 2335.1582077528183\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNinja Atsushi guards the town from the roof of the Ninja Building from early morning to late night every day. This Ninja Building is two adjacent buildings of the same floor, and Atsushi's daily routine is to jump between...
[{"type": "stdin_stdout", "input": "8\n0 0 0 2 3 1 0 -1\n1 2 -1 2 1 0 -1 0\n2\n1 1 2 2\n0 -1 2 2\n-1", "output": "4\n0\n"}, {"type": "stdin_stdout", "input": "8\n0 0 -1 2 2 2 0 -1\n1 1 1 1 1 1 -1 0\n2\n1 1 2 2\n0 -1 4 2\n0", "output": "1\n0\n"}, {"type": "stdin_stdout", "input": "8\n0 0 0 2 3 1 0 -1\n1 2 0 2 1 0 -1 0\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTwin adventurers Rin and Len are searching for treasure in the Mirror Cave. The cave has two pairs of rooms, the Hall of Mirrors, and an expensive treasure lies behind the door of the room.\n\nFor convenience, each of the...
[{"type": "stdin_stdout", "input": "5 5\n%#... ...#%\n.#.#. .#.#.\n.#.#. .#.#.\n.#.#. .#.#.\n...#L R#...\n3 2\n.L. .R#\n%.. .&.\n4 1\nL.%. %..R\n0 0", "output": "Yes\nNo\nNo\n"}, {"type": "stdin_stdout", "input": "5 5\n%#... ...#%\n.#.#. .#.#.\n.#.#. .#.#.\n.#.#. .#.#.\n...#L R#...\n3 2\n.L. .R#\n%.. .&.\n4 1\nL.$. %.....
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHomer has two friends Alice and Bob. Both of them are string fans.\n\nOne day, Alice and Bob decide to play a game on a string $s = s_1 s_2 \\dots s_n$ of length $n$ consisting of lowercase English letters. They move in t...
[{"type": "stdin_stdout", "input": "5\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\nazazazazazazazazazazazazazazazazazazazazazazazazaz\nzazazazazazazazazazazazazazazazazazazazazazazazaza\nzzazzazzazzazzazzazzazzazzazzazzazzazzazzazza\n", "output": "bzbzbzbzbzbz...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya has got $n$ books, numbered from $1$ to $n$, arranged in a stack. The topmost book has number $a_1$, the next one — $a_2$, and so on. The book at the bottom of the stack has number $a_n$. All numbers are distinct.\n...
[{"type": "stdin_stdout", "input": "10\n4 7 10 2 1 8 3 5 9 6\n4 2 7 1 8 10 5 3 9 6\n", "output": "1 3 0 1 1 0 2 0 1 1 \n"}, {"type": "stdin_stdout", "input": "10\n4 7 10 2 1 8 3 5 9 6\n4 2 7 1 8 10 5 3 9 6\n", "output": "1 3 0 1 1 0 2 0 1 1 "}, {"type": "stdin_stdout", "input": "10\n4 7 10 2 1 8 3 5 9 6\n4 2 7 1 8 10 5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nD: The Diversity of Prime Factorization\n\nProblem\n\nEbi-chan has the FACTORIZATION MACHINE, which can factorize natural numbers M (greater than 1) in O ($ \\ log $ M) time! But unfortunately, the machine could display o...
[{"type": "stdin_stdout", "input": "3\n2 3 11", "output": "3\n"}, {"type": "stdin_stdout", "input": "3\n2 2 11", "output": "1\n"}, {"type": "stdin_stdout", "input": "3\n2 2 13", "output": "1\n"}, {"type": "stdin_stdout", "input": "3\n2 3 17", "output": "3\n"}, {"type": "stdin_stdout", "input": "3\n2 2 15", "output": "0...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe start with a permutation $a_1, a_2, \\ldots, a_n$ and with an empty array $b$. We apply the following operation $k$ times.\n\nOn the $i$-th iteration, we select an index $t_i$ ($1 \\le t_i \\le n-i+1$), remove $a_{t_i}...
[{"type": "stdin_stdout", "input": "6\n2 1\n2 1\n1\n3 2\n1 3 2\n1 3\n4 2\n4 1 3 2\n1 2\n5 3\n4 3 2 5 1\n1 4 5\n6 3\n2 4 5 6 1 3\n2 4 5\n7 3\n7 6 4 3 2 1 5\n1 2 6\n", "output": "1\n0\n2\n0\n0\n4\n"}, {"type": "stdin_stdout", "input": "6\n2 1\n2 1\n1\n3 2\n1 3 2\n1 3\n4 2\n4 1 3 2\n1 2\n5 3\n4 3 2 5 1\n1 4 5\n6 3\n2 4 5 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA very brave explorer Petya once decided to explore Paris catacombs. Since Petya is not really experienced, his exploration is just walking through the catacombs.\n\nCatacombs consist of several rooms and bidirectional pa...
[{"type": "stdin_stdout", "input": "100\n0 0 0 0 0 0 1 4 4 0 2 2 4 1 7 1 11 0 8 4 12 12 3 0 3 2 2 4 3 9 1 5 4 6 9 14 6 2 4 18 7 7 19 11 20 13 17 16 0 34 2 6 12 27 9 4 29 22 4 20 20 17 17 20 37 53 17 3 3 15 1 46 11 24 31 6 12 6 11 18 13 1 5 0 19 10 24 41 16 41 18 52 46 39 16 30 18 23 53 13\n", "output": "66\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are various parking lots such as three-dimensional type and tower type in the city to improve the utilization efficiency of the parking lot. In some parking lots, a \"two-stage parking device\" as shown in the figur...
[{"type": "stdin_stdout", "input": "5 5\n136\n68\n82\n84\n114\n2 4\n14\n30\n118\n54\n0 0", "output": "2 3 4 1 5\n1 2 4 3\n"}, {"type": "stdin_stdout", "input": "2 5\n123\n52\n195\n87\n105\n2 4\n18\n30\n80\n24\n0 0", "output": "4 2 3 1 5\n1 2 4 3\n"}, {"type": "stdin_stdout", "input": "1 5\n123\n52\n105\n87\n105\n2 4\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlexey is travelling on a train. Unfortunately, due to the bad weather, the train moves slower that it should!\n\nAlexey took the train at the railroad terminal. Let's say that the train starts from the terminal at the mo...
[{"type": "stdin_stdout", "input": "2\n2\n2 4\n10 12\n0 2\n5\n1 4\n7 8\n9 10\n13 15\n19 20\n1 2 3 4 5\n", "output": "\n12\n32\n"}, {"type": "stdin_stdout", "input": "2\n2\n2 4\n10 12\n0 2\n5\n1 4\n7 8\n9 10\n13 15\n19 20\n1 2 3 4 5\n", "output": "12\n32\n"}, {"type": "stdin_stdout", "input": "2\n2\n2 3\n10 12\n0 2\n5\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a$ of $n$ ($n \\geq 2$) positive integers and an integer $p$. Consider an undirected weighted graph of $n$ vertices numbered from $1$ to $n$ for which the edges between the vertices $i$ and $j$ ($i...
[{"type": "stdin_stdout", "input": "1\n10 195593331\n886547706 549473499 719535263 337021357 357872635 1071822623 699988186 10455 29750933 887846992\n", "output": "1760339979\n"}, {"type": "stdin_stdout", "input": "1\n10 121406599\n432485522 549473499 522487623 1009120577 698965406 845977171 252631181 1770 81120106 717...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have to restore the wall. The wall consists of $N$ pillars of bricks, the height of the $i$-th pillar is initially equal to $h_{i}$, the height is measured in number of bricks. After the restoration all the $N$ pillar...
[{"type": "stdin_stdout", "input": "100 20 149 72\n67 101 52 15 0 92 26 74 44 61 6 44 45 19 22 8 10 85 67 78 24 61 81 99 62 84 9 71 11 65 5 97 3 72 5 81 81 104 65 85 52 21 20 53 66 91 4 75 84 139 72 27 50 26 9 65 14 6 54 68 6 2 89 78 40 45 98 45 27 51 94 72 67 81 20 19 38 64 14 40 57 21 82 99 37 113 21 22 30 14 73 93 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is a rooted tree with N vertices numbered 1 to N.\nThe root is Vertex 1, and the i-th edge (1 \\leq i \\leq N - 1) connects Vertex a_i and b_i.\nEach of the vertices has a counter installed. Initially, the counters ...
[{"type": "stdin_stdout", "input": "6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10\n", "output": "20 20 20 20 20 20\n"}, {"type": "stdin_stdout", "input": "6 2\n1 2\n1 3\n2 4\n3 6\n2 5\n2 10\n1 10", "output": "10 20 10 20 20 10\n"}, {"type": "stdin_stdout", "input": "6 1\n1 2\n1 3\n2 4\n3 6\n2 5\n1 10\n1 10", "output": "10 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWhen naming identifiers (variables and functions) in programming, compound words that concatenate words are used. However, if you concatenate them as they are, you will not be able to understand the word breaks, so in gen...
[{"type": "stdin_stdout", "input": "get^user_name L\ngetTserNbme U\nemaNresUteG D\nEndOfInput X", "output": "get^userName\nGetTserNbme\nema_nres_ute_g\n"}, {"type": "stdin_stdout", "input": "get^user_name L\nembNresTteg U\nemaNresUteG D\nEndOfInput X", "output": "get^userName\nEmbNresTteg\nema_nres_ute_g\n"}, {"type": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a$ of $n$ integers, where $n$ is odd. You can make the following operation with it: Choose one of the elements of the array (for example $a_i$) and increase it by $1$ (that is, replace it with $a_...
[{"type": "stdin_stdout", "input": "23 290352079\n162011045 845692742 774584765 103906675 222286673 251540072 1067675108 30856336 71306611 790640347 835976636 327687572 387722548 48938195 769656348 341889962 393959831 928029640 320443541 248114937 798473713 159552755 814528707\n", "output": "471308140\n"}, {"type": "st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou helped Dima to have a great weekend, but it's time to work. Naturally, Dima, as all other men who have girlfriends, does everything wrong.\n\nInna and Dima are now in one room. Inna tells Dima off for everything he do...
[{"type": "stdin_stdout", "input": "50 10\n1 2 3 4 5 6 7 8 9 10 10 1 1 1 1 1 1 1 1 1 10 1 1 1 1 1 1 1 1 1 10 1 1 1 1 1 1 1 1 1 10 1 1 1 1 1 1 1 1 1\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "50 10\n1 2 3 4 5 4 7 8 9 10 10 1 1 1 1 1 1 1 1 1 10 1 1 1 1 1 1 1 1 1 10 1 1 1 1 1 1 1 1 1 10 1 1 1 1 1 1 1 1 1\n",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Fair Nut lives in $n$ story house. $a_i$ people live on the $i$-th floor of the house. Every person uses elevator twice a day: to get from the floor where he/she lives to the ground (first) floor and to get from the f...
[{"type": "stdin_stdout", "input": "100\n95 81 40 82 80 78 4 86 37 94 1 46 85 6 41 87 100 69 100 87 12 61 55 81 81 32 40 54 22 32 24 73 61 68 76 16 83 76 73 77 41 37 88 46 72 63 2 37 14 49 45 81 75 56 10 101 73 85 41 17 5 2 16 75 28 53 35 77 66 53 69 82 50 95 2 12 35 62 84 46 29 95 91 49 78 14 88 75 58 52 49 31 56 43 5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together. He cannot do any other calculation.\nGiven are two integers A and B.\nIf Takahashi can calculate A \\times...
[{"type": "stdin_stdout", "input": "20 20\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "33 106", "output": "-1\n"}, {"type": "stdin_stdout", "input": "5 10\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "1 11\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "20 1\n", "output": "-1\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThree years have passes and nothing changed. It is still raining in London, and Mr. Black has to close all the doors in his home in order to not be flooded. Once, however, Mr. Black became so nervous that he opened one do...
[{"type": "stdin_stdout", "input": "250\n1 0 1 1 0 1 0 1 1 1 1 1 1 0 0 1 1 1 0 1 0 0 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 0 1 0 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 1 0 0 1 0 0 0 1 1 1 0 0 0 1 0 1 1 0 1 1 1 1 0 0 1 1 0 0 1 1 1 1 1 1 1 0 1 0 0 1 1 1 1 1 1 1 1 0 1 0 1 1 1 0 1 0 1 1 1 0 0 1 0 1 1 0 0 0 1 0 0 1 0 0 0 0 1 0...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nC: Prayer (Pray)\n\nSome twins are famous for praying before the contest.\n\nThere are four integers $ H, W, X, Y $, and it seems unlucky if $ H \\ times W $ and $ x + y $ are both odd numbers.\n\ninput\n\nFour integers $...
[{"type": "stdin_stdout", "input": "-1 -1 -3 -1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-2 -1 -3 -1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-2 -1 -4 -1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "0 -1 -4 -1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "0 -1 -3 -...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter seeing the \"ALL YOUR BASE ARE BELONG TO US\" meme for the first time, numbers X and Y realised that they have different bases, which complicated their relations.\n\nYou're given a number X represented in base b_{x}...
[{"type": "stdin_stdout", "input": "10 40\n39 39 39 39 39 39 39 39 39 39\n10 39\n38 38 38 38 38 38 38 38 38 38\n", "output": ">\n"}, {"type": "stdin_stdout", "input": "10 40\n39 39 39 14 39 39 39 39 39 39\n10 39\n38 38 38 38 38 38 38 38 38 38\n", "output": ">\n"}, {"type": "stdin_stdout", "input": "10 38\n16 19 37 32 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nX and A are integers between 0 and 9 (inclusive).\nIf X is less than A, print 0; if X is not less than A, print 10.\n\n-----Constraints-----\n - 0 \\leq X, A \\leq 9\n - All values in input are integers.\n\n-----Input----...
[{"type": "stdin_stdout", "input": "11 -1", "output": "10\n"}, {"type": "stdin_stdout", "input": "10 -1", "output": "10\n"}, {"type": "stdin_stdout", "input": "19 -1", "output": "10\n"}, {"type": "stdin_stdout", "input": "-1 -1", "output": "10\n"}, {"type": "stdin_stdout", "input": "10 -2", "output": "10\n"}, {"type": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPaul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.\n\nP...
[{"type": "stdin_stdout", "input": "302 4\nabdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdc...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEdo has got a collection of n refrigerator magnets!\n\nHe decided to buy a refrigerator and hang the magnets on the door. The shop can make the refrigerator with any size of the door that meets the following restrictions:...
[{"type": "stdin_stdout", "input": "20 5\n1 12 21 22\n9 10 15 20\n10 12 12 20\n1 1 25 29\n5 10 21 22\n4 9 20 25\n12 10 14 24\n3 3 19 27\n3 4 23 28\n9 1 11 31\n9 14 17 18\n8 12 14 20\n8 11 18 19\n12 3 14 29\n7 8 13 22\n6 4 16 30\n11 3 13 27\n9 16 15 18\n6 13 14 21\n9 12 15 22\n", "output": "4\n"}, {"type": "stdin_stdout...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have a sequence of N integers A~=~A_0,~A_1,~...,~A_{N - 1}.\n\nLet B be a sequence of K \\times N integers obtained by concatenating K copies of A. For example, if A~=~1,~3,~2 and K~=~2, B~=~1,~3,~2,~1,~3,~2.\n\nFind t...
[{"type": "stdin_stdout", "input": "10 998244353\n10 10 10 9 5 12 0 4 7 0", "output": "559205848\n"}, {"type": "stdin_stdout", "input": "10 1051516890\n10 15 10 1 5 4 0 8 4 0", "output": "142815647\n"}, {"type": "stdin_stdout", "input": "10 918571889\n10 9 10 7 7 3 0 11 4 0", "output": "551061978\n"}, {"type": "stdin_s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEla likes Chess a lot. During breaks, she usually challenges her co-worker in DTL to some chess games. She's not an expert at classic chess, but she's very interested in Chess variants, where she has to adapt to new rules...
[{"type": "stdin_stdout", "input": "10\n4\n2 2 3 3 2 3\n2 3\n7\n1 1 1 2 2 1\n6 7\n9\n9 1 8 1 9 2\n5 9\n6\n2 4 3 4 2 3\n6 5\n7\n2 2 2 1 3 1\n3 5\n7\n6 1 7 2 7 1\n2 2\n7\n2 1 2 2 1 2\n7 6\n7\n3 6 3 7 4 7\n3 7\n10\n2 1 1 2 1 1\n6 3\n4\n2 3 1 3 2 4\n3 4\n", "output": "YES\nNO\nNO\nYES\nYES\nNO\nYES\nYES\nNO\nNO\n"}, {"type...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.\n\...
[{"type": "stdin_stdout", "input": "691900\n", "output": "4444477777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ water tanks in a row, $i$-th of them contains $a_i$ liters of water. The tanks are numbered from $1$ to $n$ from left to right.\n\nYou can perform the following operation: choose some subsegment $[l, r]$ ($1...
[{"type": "stdin_stdout", "input": "65\n1000000 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 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\n", "output": "15416.615384615392\n15416.615384615392\n15416.615384615392\n15416.61538461...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya recieved a gift of a string s with length up to 10^5 characters for his birthday. He took two more empty strings t and u and decided to play a game. This game has two possible moves: Extract the first character of ...
[{"type": "stdin_stdout", "input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n", "output": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"}, {"type": "stdin_stdout", "input": "bababaaababaabbbbbabbbbbbaa...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nZane the wizard is going to perform a magic show shuffling the cups.\n\nThere are n cups, numbered from 1 to n, placed along the x-axis on a table that has m holes on it. More precisely, cup i is on the table at the posit...
[{"type": "stdin_stdout", "input": "203948 2 14\n203948 203947\n39 47\n4959 3030\n1 203947\n2929 12381\n203944 203948\n203947 203944\n203944 203922\n203922 203948\n2495 20495\n29419 5959\n12949 12\n49 29292\n1 94\n1 203\n", "output": "203947\n"}, {"type": "stdin_stdout", "input": "203948 2 14\n203948 203947\n39 38\n495...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAyoub had an array $a$ of integers of size $n$ and this array had two interesting properties: All the integers in the array were between $l$ and $r$ (inclusive). The sum of all the elements was divisible by $3$. \n\nUn...
[{"type": "stdin_stdout", "input": "101149 1300011130 1476544836\n", "output": "156648241\n"}, {"type": "stdin_stdout", "input": "101149 686320621 1476544836\n", "output": "113944181\n"}, {"type": "stdin_stdout", "input": "120881 536336525 585696606\n", "output": "915864703\n"}, {"type": "stdin_stdout", "input": "12138...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlice received a set of Toy Train™ from Bob. It consists of one train and a connected railway network of $n$ stations, enumerated from $1$ through $n$. The train occupies one station at a time and travels around the netwo...
[{"type": "stdin_stdout", "input": "5000 1\n4008 1126\n", "output": "6125 6124 6123 6122 6121 6120 6119 6118 6117 6116 6115 6114 6113 6112 6111 6110 6109 6108 6107 6106 6105 6104 6103 6102 6101 6100 6099 6098 6097 6096 6095 6094 6093 6092 6091 6090 6089 6088 6087 6086 6085 6084 6083 6082 6081 6080 6079 6078 6077 6076 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n\"Teishi-zushi\", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is C meters. Customers cannot go inside the counter.\n\nNakahashi entered Teishi-zushi, an...
[{"type": "stdin_stdout", "input": "15 10000000000\n400000000 1000000000\n800000000 1000000000\n1900000000 1000000000\n2400000000 1000000000\n2900000000 1000000000\n3300000000 1000000000\n3700000000 1000000000\n3800000000 1000000000\n4000000000 1000000000\n4100000000 1000000000\n5200000000 1000000000\n6600000000 100000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven an array $a_1, a_2, \\dots, a_n$, you need to handle a total of $q$ updates and queries of two types:\n\n$1$ $l$ $r$ — for each index $i$ with $l \\leq i \\leq r$, update the value of $a_i$ to the sum of the digits ...
[{"type": "stdin_stdout", "input": "1\n8 35\n14 14 14 14 14 14 14 14\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 2 3\n1 6 7\n1 6 7\n1 6 7\n1 6 7\n1 6 7\n1 6 7\n1 6 7\n1 6 7\n1 6 7\n1 6 7\n1 6 7\n1 6 7\n1 6 7\n1 1 8\n2 1\n2 2\n2 3\n2 4\n2 5\n2 6\n2 7\n2 8\n", "output": "5\n5\n5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter celebrating the midcourse the students of one of the faculties of the Berland State University decided to conduct a vote for the best photo. They published the photos in the social network and agreed on the rules to...
[{"type": "stdin_stdout", "input": "40\n119631 119631 772776 119631 658661 119631 108862 524470 125132 700668 69196 844949 154577 108862 108862 108862 597344 940938 989698 108862 154577 69196 125132 687080 940938 125132 69196 69196 125132 566152 953083 406319 380068 119631 154577 125132 413984 69196 154577 154577\n", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasiliy spent his vacation in a sanatorium, came back and found that he completely forgot details of his vacation! \n\nEvery day there was a breakfast, a dinner and a supper in a dining room of the sanatorium (of course, ...
[{"type": "stdin_stdout", "input": "718167999978848233 1000000000000000000 1000000000000000000\n", "output": "281832000021151766\n"}, {"type": "stdin_stdout", "input": "338654687020656675 999999999999999999 1000000000000000000\n", "output": "661345312979343324\n"}, {"type": "stdin_stdout", "input": "643704740517968615 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by rem...
[{"type": "stdin_stdout", "input": "mars\nsunvenusearthmarsjupitersaturnuranusneptune\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "mars\nsunvenusearthmarsjupitersatuqnuranusneptune\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "mars\nsunvenusearthmarsjupitersatuqnuranusnepttne\n", "output": "0\n"}...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVector Willman and Array Bolt are the two most famous athletes of Byteforces. They are going to compete in a race with a distance of L meters today.\n\n [Image] \n\nWillman and Bolt have exactly the same speed, so when th...
[{"type": "stdin_stdout", "input": "5000000000000000000 4999999999999999837 4999999999999999963\n", "output": "1249999999999999959/1250000000000000000\n"}, {"type": "stdin_stdout", "input": "5000000000000000000 4999999999999999837 4999999999999999963\n", "output": "1249999999999999959/1250000000000000000\n"}, {"type": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ piles of stones, where the $i$-th pile has $a_i$ stones. Two people play a game, where they take alternating turns removing stones.\n\nIn a move, a player may remove a positive number of stones from the firs...
[{"type": "stdin_stdout", "input": "7\n3\n2 5 10\n8\n1 2 1 1 1 1 1 1\n6\n2 2 5 4 5 6\n6\n1 1 2 1 2 1\n1\n1000000000\n5\n1 4 2 1 1\n3\n1 1 1\n", "output": "First \nSecond\nFirst \nFirst \nFirst \nSecond\nFirst \n"}, {"type": "stdin_stdout", "input": "7\n3\n2 5 10\n8\n1 2 1 1 1 1 1 1\n6\n2 2 5 4 5 6\n6\n1 1 2 1 2 1\n1\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA biscuit making machine produces B biscuits at the following moments: A seconds, 2A seconds, 3A seconds and each subsequent multiple of A seconds after activation.\nFind the total number of biscuits produced within T + 0...
[{"type": "stdin_stdout", "input": "1 20 20\n", "output": "400\n"}, {"type": "stdin_stdout", "input": "1 -7 15", "output": "-105\n"}, {"type": "stdin_stdout", "input": "1 -8 13", "output": "-104\n"}, {"type": "stdin_stdout", "input": "1 -7 21", "output": "-147\n"}, {"type": "stdin_stdout", "input": "1 -8 19", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array A of length N. Your task is to divide it into several contiguous subarrays. Here, all subarrays obtained must be sorted in either non-decreasing or non-increasing order. At least how many subarrays ...
[{"type": "stdin_stdout", "input": "7\n-1 -1 1 0 1 31150610 0000000101", "output": "3\n"}, {"type": "stdin_stdout", "input": "7\n1 2 3 2 1 999999999 1000000100", "output": "3\n"}, {"type": "stdin_stdout", "input": "7\n1 4 3 2 1 999999999 1000000100", "output": "3\n"}, {"type": "stdin_stdout", "input": "7\n1 4 3 4 1 999...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBy 2312 there were n Large Hadron Colliders in the inhabited part of the universe. Each of them corresponded to a single natural number from 1 to n. However, scientists did not know what activating several colliders simul...
[{"type": "stdin_stdout", "input": "1 100\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n«Polygon» is a system which allows to create programming tasks in a simple and professional way. When you add a test to the problem, the corresponding form asks you for the test index. As in most cases it is clear which i...
[{"type": "stdin_stdout", "input": "10\n1 7 13 6 10 10 3 8 2 4\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "10\n1 7 13 6 10 10 4 8 2 4\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "10\n1 7 13 6 10 10 4 8 2 8\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "10\n1 7 13 6 5 10 3 8 2 4\n", "o...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are fighting with Zmei Gorynich — a ferocious monster from Slavic myths, a huge dragon-like reptile with multiple heads! \n\n $m$ \n\nInitially Zmei Gorynich has $x$ heads. You can deal $n$ types of blows. If you deal...
[{"type": "stdin_stdout", "input": "5\n4 807989196\n770312657 78181451\n624192034 690910298\n754831733 354913874\n519577171 400120478\n4 491297333\n546432637 76258441\n312107971 75446008\n767483254 958677299\n84044330 577526244\n2 177840791\n197738084 143071228\n23274563 597315796\n7 610054060\n858529462 646280969\n644...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a board of size $n \\times n$, where $n$ is odd (not divisible by $2$). Initially, each cell of the board contains one figure.\n\nIn one move, you can select exactly one figure presented in some cell and mov...
[{"type": "stdin_stdout", "input": "3\n11\n11375\n5405\n", "output": "440\n490606116000\n52633933240\n"}, {"type": "stdin_stdout", "input": "3\n11\n22093\n2775\n", "output": "440\n3594535872088\n7123077200\n"}, {"type": "stdin_stdout", "input": "3\n21\n7511\n4623\n", "output": "3080\n141244655440\n32934449248\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a set of points $x_1$, $x_2$, ..., $x_n$ on the number line.\n\nTwo points $i$ and $j$ can be matched with each other if the following conditions hold: neither $i$ nor $j$ is matched with any other point; ...
[{"type": "stdin_stdout", "input": "100 13\n11 28 21 7 6 23 26 31 26 32 34 17 19 1 13 1 28 30 28 8 23 36 17 20 5 37 32 23 14 1 20 23 3 39 20 14 2 12 15 3 1 27 7 25 15 39 10 6 8 37 6 22 7 29 6 17 17 9 16 3 39 23 2 34 20 12 28 29 32 2 38 27 36 27 29 18 7 14 27 25 33 18 29 40 22 9 9 6 21 7 23 35 33 26 31 31 39 36 27 27\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven an array a_1, a_2, ..., a_{n} of n integers, find the largest number in the array that is not a perfect square.\n\nA number x is said to be a perfect square if there exists an integer y such that x = y^2.\n\n\n-----...
[{"type": "stdin_stdout", "input": "71\n908209 289 44521 240100 680625 274576 212521 91809 506944 499849 3844 15376 592900 58081 240100 984064 732736 257049 600625 180625 130321 580644 261121 75625 46225 853776 485809 700569 817216 268324 293764 528529 25921 399424 175561 99856 295936 20736 611524 13924 470596 574564 5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWinters are just damn freezing cold in Nvodsk! That's why a group of n friends prefers to take a taxi, order a pizza and call girls. The phone numbers in the city consist of three pairs of digits (for example, 12-34-56). ...
[{"type": "stdin_stdout", "input": "10\n5 eeleGlOFWbcnIPPtnll\n55-55-55\n00-00-00\n98-65-32\n76-43-10\n98-76-54\n2 DMBiqRyQJkFvHPJNJp\n28-97-50\n87-64-10\n4 bAfmtnKHohIX\n61-58-93\n77-77-77\n53-17-51\n96-43-10\n3 cDX\n22-22-22\n77-77-77\n63-30-64\n1 HCeHJ\n44-44-44\n6 HgSpfAolwoaBQ\n96-93-53\n98-53-10\n33-33-33\n66-66-...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers $A$ and $B$, calculate the number of pairs $(a, b)$ such that $1 \\le a \\le A$, $1 \\le b \\le B$, and the equation $a \\cdot b + a + b = conc(a, b)$ is true; $conc(a, b)$ is the concatenation ...
[{"type": "stdin_stdout", "input": "3\n1 14\n4 2\n191 102469002\n", "output": "1\n0\n1528\n"}, {"type": "stdin_stdout", "input": "3\n1 14\n4 2\n131 176163142\n", "output": "1\n0\n1048\n"}, {"type": "stdin_stdout", "input": "3\n1 14\n4 2\n142 128000654\n", "output": "1\n0\n1136\n"}, {"type": "stdin_stdout", "input": "3\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor given two sequences $X$ and $Y$, a sequence $Z$ is a common subsequence of $X$ and $Y$ if $Z$ is a subsequence of both $X$ and $Y$. For example, if $X = \\\\{a,b,c,b,d,a,b\\\\}$ and $Y = \\\\{b,d,c,a,b,a\\\\}$, the se...
[{"type": "stdin_stdout", "input": "3\nabcbdab\nbdcaba\nabc\nabc\nacb\nbc", "output": "4\n3\n1\n"}, {"type": "stdin_stdout", "input": "3\nabcbdab\nbdcaba\nabc\nabc\nbcb\nbc", "output": "4\n3\n2\n"}, {"type": "stdin_stdout", "input": "3\nabcbdab\nbdcaba\n`bc\nabc\nbcb\nbc", "output": "4\n2\n2\n"}, {"type": "stdin_stdout...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIvan has an array consisting of n elements. Each of the elements is an integer from 1 to n.\n\nRecently Ivan learned about permutations and their lexicographical order. Now he wants to change (replace) minimum number of e...
[{"type": "stdin_stdout", "input": "50\n48 37 47 50 46 43 42 46 36 40 45 41 40 50 35 49 37 42 44 45 49 44 31 47 45 49 48 41 45 45 48 20 34 43 43 41 47 50 41 48 38 48 43 48 46 48 32 37 47 45\n", "output": "31\n1 2 3 4 5 6 7 8 36 9 10 11 40 12 35 13 14 42 15 16 17 44 31 18 19 49 21 22 23 24 25 20 34 26 27 28 29 50 41 30 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor a given array $a$ consisting of $n$ integers and a given integer $m$ find if it is possible to reorder elements of the array $a$ in such a way that $\\sum_{i=1}^{n}{\\sum_{j=i}^{n}{\\frac{a_j}{j}}}$ equals $m$? It is ...
[{"type": "stdin_stdout", "input": "5\n4 10\n5 5 5 5\n3 5\n5 5 5\n3 4\n10 1 1\n4 5\n5 5 1 5\n5 5\n5 5 5 10 5\n", "output": "NO\nNO\nNO\nNO\nNO\n"}, {"type": "stdin_stdout", "input": "5\n4 10\n5 5 5 5\n3 5\n5 5 5\n3 4\n10 1 1\n4 5\n5 5 1 5\n5 5\n5 5 5 15 5\n", "output": "NO\nNO\nNO\nNO\nNO\n"}, {"type": "stdin_stdout", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVillages were scattered in the Wakamatsu Plain of Aizu. Several settlements are connected by straight roads that allow them to travel to and from each other, and any settlement in the plain can be traced back and forth. E...
[{"type": "stdin_stdout", "input": "7 6\n-1 2\n3 0\n2 2\n1 -1\n4 1\n2 3\n3 5\n1 3\n2 4\n2 3\n3 5\n3 7\n6 7", "output": "20.8510743960\n"}, {"type": "stdin_stdout", "input": "7 6\n-1 2\n3 0\n2 4\n1 -1\n4 1\n2 3\n3 5\n1 3\n2 4\n2 3\n3 5\n3 7\n6 7", "output": "20.0292199808\n"}, {"type": "stdin_stdout", "input": "7 6\n-1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nApart from having lots of holidays throughout the year, residents of Berland also have whole lucky years. Year is considered lucky if it has no more than 1 non-zero digit in its number. So years 100, 40000, 5 are lucky an...
[{"type": "stdin_stdout", "input": "1000000000\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "1000000000\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "100000000\n", "output": "100000000\n"}, {"type": "stdin_stdout", "input": "900000000\n", "output": "100000000\n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe king's birthday dinner was attended by $k$ guests. The dinner was quite a success: every person has eaten several dishes (though the number of dishes was the same for every person) and every dish was served alongside ...
[{"type": "stdin_stdout", "input": "100 100\n97 64 64 35 35 97 39 83 26 97 92 97 83 11 83 97 97 64 23 97 97 11 39 11 11 39 64 14 23 39 64 26 26 97 39 39 39 64 83 26 83 97 64 11 64 64 64 83 64 92 64 26 83 26 27 64 11 83 92 92 23 11 11 97 92 64 97 64 97 83 64 27 83 23 11 26 11 92 83 64 83 11 11 11 97 83 97 26 26 97 23 23...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTaro is a member of a programming contest circle. In this circle, the members manage their schedules in the system called Great Web Calender.\n\nTaro has just added some of his friends to his calendar so that he can brows...
[{"type": "stdin_stdout", "input": "5 2\n12.765198556451168 15.39026707382745 9.233322443088145\n10.815832893726053 -1.9252139692459584 2.3339220907347795\n4.371806005587981 8.307983558511573 9.03829736864434\n3.663558291396137 5.363391652445537 7.212792777097519\n3.0699790954158255 4.913753801376337 -4.249695725207287...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn 21XX, an annual programming contest, Japan Algorithmist GrandPrix (JAG) has become one of the most popular mind sports events.\n\nJAG is conducted as a knockout tournament. This year, $N$ contestants will compete in JA...
[{"type": "stdin_stdout", "input": "[[r-i]-[m-e]]\nd -1\no 0\ng -1\nl 6", "output": "No\n"}, {"type": "stdin_stdout", "input": "[[m-y]-[a-o]]\nn 0\na 1\ny 2\nm 0", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "[[r-i]-[m-e]]\nd -1\nr 1\ng 1\nm 3", "output": "No\n"}, {"type": "stdin_stdout", "input": "[[r-i]-[m-...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe new \"Die Hard\" movie has just been released! There are n people at the cinema box office standing in a huge line. Each of them has a single 100, 50 or 25 ruble bill. A \"Die Hard\" ticket costs 25 rubles. Can the bo...
[{"type": "stdin_stdout", "input": "14\n25 25 25 25 25 25 25 50 50 50 100 100 100 100\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "14\n25 25 25 25 25 25 25 50 50 50 100 100 100 100\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "10\n100 100 100 100 100 100 100 100 100 100\n", "output": "NO\n"}, {...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOnce upon a time Petya and Gena gathered after another programming competition and decided to play some game. As they consider most modern games to be boring, they always try to invent their own games. They have only stic...
[{"type": "stdin_stdout", "input": "110\n-256 -149 -136 -33 -253 -141 -170 -253 0 -107 -141 -236 -65 -158 -84 -180 -97 -97 -223 -44 -232 -255 -108 -25 -49 -48 -212 -3 -232 -172 -231 -158 -23 -206 -198 -55 -36 -11 -169 -94 -190 -115 -116 -231 -155 -201 -155 -103 -242 -119 -136 -8 -2 -11 -69 -250 -51 -129 -155 -216 -107 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHave you ever used the chat application QQ? Well, in a chat group of QQ, administrators can muzzle a user for days.\n\nIn Boboniu's chat group, there's a person called Du Yi who likes to make fun of Boboniu every day.\n\n...
[{"type": "stdin_stdout", "input": "100 61 71\n11 18 0 47 33 37 91 13 8 30 73 64 50 97 62 50 2 36 68 32 64 74 32 77 81 41 23 44 40 18 45 33 21 68 57 79 107 23 21 37 99 27 30 56 75 62 75 63 1 15 79 42 18 66 21 25 2 12 89 48 75 7 57 85 80 14 82 29 66 47 29 10 1 84 79 39 33 81 135 26 80 67 52 25 38 68 57 53 38 83 83 3 86 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya, like many others, likes to participate in a variety of sweepstakes and lotteries. Now he collects wrappings from a famous chocolate bar \"Jupiter\". According to the sweepstake rules, each wrapping has an integer w...
[{"type": "stdin_stdout", "input": "50\n667406402 354775600 95220950 604569294 945922983 82947113 120853697 25192357 911801905 8804755 572528228 1217518845 180664274 949243037 5283222 128577958 23627567 882714363 413386071 937062768 916521072 1051464852 328941225 17876118 770879655 928962609 331124489 236187404 8786298...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this problem you will meet the simplified model of game King of Thieves.\n\nIn a new ZeptoLab game called \"King of Thieves\" your aim is to reach a chest with gold by controlling your character, avoiding traps and obs...
[{"type": "stdin_stdout", "input": "100\n*****************************)**********************************************************************\n", "output": "yes\n"}, {"type": "stdin_stdout", "input": "100\n*.....................*.....................*.....................*......../............*...........\n", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe all know the problem about the number of ways one can tile a 2 × n field by 1 × 2 dominoes. You probably remember that it goes down to Fibonacci numbers. We will talk about some other problem below, there you also are ...
[{"type": "stdin_stdout", "input": "101\n", "output": "aaffjjnnrrvvzzddhhllppttxxbbffjjnnrrvvzzddhhllppttxxbbffjjnnrrvvzzddhhllppttxxbbffjjnnrrvvzzddhhllppt\nbbggkkoosswwaaeeiimmqquuyyccggkkoosswwaaeeiimmqquuyyccggkkoosswwaaeeiimmqquuyyccggkkoosswwaaeeiimmqqt\ncddhhllppttxxbbffjjnnrrvvzzddhhllppttxxbbffjjnnrrvvzzddhhll...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor god's sake, you're boxes with legs! It is literally your only purpose! Walking onto buttons! How can you not do the one thing you were designed for?\n\nOh, that's funny, is it? Oh it's funny? Because we've been at thi...
[{"type": "stdin_stdout", "input": "5\n2\n1 1\n2\n1 1000000000\n2\n1000000000 1\n2\n1000000000 1000000000\n2\n228 1337\n", "output": "YES\nYES\nNO\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "5\n2\n1 1\n2\n1 1000000000\n2\n1000000000 1\n2\n1000000000 1000000000\n2\n228 1337\n", "output": "YES\nYES\nNO\nYES\nYES\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA has a string consisting of some number of lowercase English letters 'a'. He gives it to his friend B who appends some number of letters 'b' to the end of this string. Since both A and B like the characters 'a' and 'b', ...
[{"type": "stdin_stdout", "input": "aaaaabbbbbb\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "aaaaabbbbbb\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "aaaaabbabbb\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "bbbabbaaaaa\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "aabb...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA: A-Z-\n\nproblem\n\nThere is a circular board of 26 squares, each square with one capital letter of the alphabet written clockwise in alphabetical order. That is, the clockwise side of the'A'square is the'B' square, the...
[{"type": "stdin_stdout", "input": "AIZV", "output": "2\n"}, {"type": "stdin_stdout", "input": "W\\AG", "output": "1\n"}, {"type": "stdin_stdout", "input": "[VIA", "output": "3\n"}, {"type": "stdin_stdout", "input": "BEW]", "output": "0\n"}, {"type": "stdin_stdout", "input": "VZIA", "output": "2\n"}, {"type": "stdin_st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nValera takes part in the Berland Marathon. The marathon race starts at the stadium that can be represented on the plane as a square whose lower left corner is located at point with coordinates (0, 0) and the length of the...
[{"type": "stdin_stdout", "input": "70092.4982 95833.7741\n1000\n", "output": "70092.4982000000 25741.2759000000\n18609.9464000000 70092.4982000000\n7131.3295000000 0.0000000000\n70092.4982000000 32872.6054000000\n11478.6169000001 70092.4982000000\n14262.6590000000 0.0000000000\n70092.4982000000 40003.9348999999\n4347....
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor an array a of integers let's denote its maximal element as max(a), and minimal as min(a). We will call an array a of k integers interesting if max(a) - min(a) ≥ k. For example, array [1, 3, 4, 3] isn't interesting as ...
[{"type": "stdin_stdout", "input": "1\n24\n1 1 1 1 1 1 2 2 2 2 2 2 4 4 4 4 4 4 5 5 5 5 5 5\n", "output": "YES\n12 13\n"}, {"type": "stdin_stdout", "input": "1\n24\n1 1 1 1 1 1 2 2 2 2 2 2 4 4 4 4 4 4 4 5 5 5 5 5\n", "output": "YES\n12 13\n"}, {"type": "stdin_stdout", "input": "1\n24\n1 1 2 1 1 1 2 2 2 2 2 2 4 4 4 4 4 4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only king stands on the standard chess board. You are given his position in format \"cd\", where c is the column from 'a' to 'h' and d is the row from '1' to '8'. Find the number of moves permitted for the king.\n\nCh...
[{"type": "stdin_stdout", "input": "e4\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "a1\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "h8\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "a4\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "g7\n", "output": "8\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKarlsson has recently discovered a huge stock of berry jam jars in the basement of the house. More specifically, there were $2n$ jars of strawberry and blueberry jam.\n\nAll the $2n$ jars are arranged in a row. The stairs...
[{"type": "stdin_stdout", "input": "4\n6\n1 1 1 1 2 1 2 1 2 1 1 1\n2\n2 2 1 2\n3\n1 1 1 1 1 1\n2\n2 1 2 1\n", "output": "12\n2\n6\n0\n"}, {"type": "stdin_stdout", "input": "4\n6\n2 2 2 1 2 2 2 1 2 2 1 2\n2\n2 2 1 2\n3\n1 1 1 1 2 1\n2\n2 1 1 1\n", "output": "10\n2\n4\n2\n"}, {"type": "stdin_stdout", "input": "4\n6\n1 1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string S consisting of lowercase English letters. We will write down this string, starting a new line after every w letters. Print the string obtained by concatenating the letters at the beginnings of thes...
[{"type": "stdin_stdout", "input": "dnuoodnuuuhs\n1", "output": "dnuoodnuuuhs\n"}, {"type": "stdin_stdout", "input": "shuuundoound\n1", "output": "shuuundoound\n"}, {"type": "stdin_stdout", "input": "dnuondouuuhs\n1", "output": "dnuondouuuhs\n"}, {"type": "stdin_stdout", "input": "siuuuodnound\n1", "output": "siuuuodno...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nM-kun has the following three cards:\n\n* A red card with the integer A.\n* A green card with the integer B.\n* A blue card with the integer C.\n\n\n\nHe is a genius magician who can do the following operation at most K t...
[{"type": "stdin_stdout", "input": "13 4 1\n10", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "13 5 1\n10", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "12 3 4\n9", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "12 4 4\n9", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "12 4 2\n9", "o...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Russian here \nThe Head Chef has been playing with Fibonacci numbers for long . He has learnt several tricks related to Fibonacci numbers . Now he wants to test his chefs in the skills . \n \nA...
[{"type": "stdin_stdout", "input": "3\n5\n13\n13", "output": "YES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "3\n13\n15\n13", "output": "YES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "3\n13\n18\n21", "output": "YES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "3\n5\n13\n11", "output": "YES\nYES\nNO\n"}, ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn 20XX AD, a school competition was held. The tournament has finally left only the final competition. You are one of the athletes in the competition.\n\nThe competition you participate in is to compete for the time it ta...
[{"type": "stdin_stdout", "input": "5 5\n-38 -71 -293 75 1\n-158 -38 -405 66 1\n-236 -303 157 266 1\n316 26 411 190 1\n207 -312 -27 196 1\n-50 292 -375 -401 389 -389\n460 278 409 -329 -303 411\n215 -220 -200 309 -474 300\n310 -494 -87 -300 123 -463\n386 378 486 -443 -64 299", "output": "0\n2\n1\n3\n0\n"}, {"type": "std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a deck of $n$ cards. The $i$-th card has a number $a_i$ on the front and a number $b_i$ on the back. Every integer between $1$ and $2n$ appears exactly once on the cards.\n\nA deck is called sorted if the front v...
[{"type": "stdin_stdout", "input": "20\n24 12\n37 1\n5 35\n36 19\n22 6\n25 4\n26 17\n15 31\n39 8\n28 16\n11 29\n21 18\n14 34\n30 10\n32 2\n20 27\n33 13\n23 9\n40 7\n3 38\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "20\n7 29\n4 34\n40 2\n39 10\n33 5\n1 37\n20 23\n14 21\n22 9\n8 28\n19 24\n26 13\n32 6\n30 16...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which calculates the distance between two points P1(x1, y1) and P2(x2, y2).\n\n\n\nInput\n\nFour real numbers x1, y1, x2 and y2 are given in a line.\n\nOutput\n\nPrint the distance in real number. The outp...
[{"type": "stdin_stdout", "input": "-1 -4 3 -115", "output": "111.072048689\n"}, {"type": "stdin_stdout", "input": "-1 -4 3 -190", "output": "186.043005781\n"}, {"type": "stdin_stdout", "input": "-1 -4 1 -190", "output": "186.010752377\n"}, {"type": "stdin_stdout", "input": "-1 -5 1 -190", "output": "185.010810495\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe progress is not standing still in Berland. Recently all garbage containers in Bertown, the capital of Berland, were replaced by differentiated recycling bins, each accepting some category of waste. While this will def...
[{"type": "stdin_stdout", "input": "7\n1 2 5\n1 1 3 0 0\n2 2 5\n0 0 0 1 0\n2 1 4\n1 1 2 0 0\n1 2 5\n1 2 3 0 1\n0 0 0\n0 0 0 0 0\n1 0 4\n1 0 0 0 0\n13 37 42\n1 0 0 40 47\n", "output": "YES\nYES\nYES\nYES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "7\n1 2 3\n1 1 3 0 0\n2 2 5\n0 0 3 1 0\n2 2 4\n1 2 2 0 1\n1 2 5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fak...
[{"type": "stdin_stdout", "input": "688094\n", "output": "abcdefghijklmnopqrssrqpomlkjihgfebbbccddeeffgghhiijjkkllmmnnooppqqrrss abcdefghijklmnopqrs\n"}, {"type": "stdin_stdout", "input": "912733\n", "output": "abcdefghijklmnopqrstsrqpnljigfedbccddeeffgghhiijjkkllmmnnooppqqrrsstt abcdefghijklmnopqrst\n"}, {"type": "std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA function $f : R \\rightarrow R$ is called Lipschitz continuous if there is a real constant K such that the inequality |f(x) - f(y)| ≤ K·|x - y| holds for all $x, y \\in R$. We'll deal with a more... discrete version of ...
[{"type": "stdin_stdout", "input": "3 6\n48261735 26888803 75904937\n1 2\n1 3\n2 3\n1 2\n2 3\n1 3\n", "output": "21372932\n119405200\n49016134\n21372932\n49016134\n119405200\n"}, {"type": "stdin_stdout", "input": "3 6\n48261735 26888803 75904937\n1 2\n1 3\n2 3\n1 2\n2 3\n1 3\n", "output": "21372932\n119405200\n49016134...
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\nYou had an array of integer numbers. You also had a beautiful operations called \"Copy-Paste\" which allowed you to copy any contiguous subsequence of ...
[{"type": "stdin_stdout", "input": "2\n5\n1 0 1 1 1\n5\n1 2 10 2 2", "output": "2\n3\n"}, {"type": "stdin_stdout", "input": "2\n5\n1 0 1 1 1\n5\n1 2 10 0 2", "output": "2\n4\n"}, {"type": "stdin_stdout", "input": "2\n5\n1 0 1 1 1\n5\n1 2 10 0 4", "output": "2\n5\n"}, {"type": "stdin_stdout", "input": "2\n5\n1 1 1 1 1\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA median of an array of integers of length $n$ is the number standing on the $\\lceil {\\frac{n}{2}} \\rceil$ (rounding up) position in the non-decreasing ordering of its elements. Positions are numbered starting with $1$...
[{"type": "stdin_stdout", "input": "6\n2 4\n0 24 37 58 62 64 69 78\n2 2\n27 61 81 91\n4 3\n0 4 16 18 21 27 36 53 82 91 92 95\n3 4\n1 11 12 22 33 35 38 67 69 71 94 99\n2 1\n11 41\n3 3\n1 2 1 1 1 1 1 1 -1\n", "output": "168\n108\n145\n234\n11\n3\n"}, {"type": "stdin_stdout", "input": "6\n2 4\n0 24 25 58 62 64 69 78\n2 2\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array of n integer numbers. Let sum(l, r) be the sum of all numbers on positions from l to r non-inclusive (l-th element is counted, r-th element is not counted). For indices l and r holds 0 ≤ l ≤ r ≤ n. ...
[{"type": "stdin_stdout", "input": "100\n2 1 -2 -1 -2 0 -1 -2 1 2 0 1 0 -2 -1 -2 0 2 0 1 -2 -2 2 0 -2 2 -2 0 2 -1 2 0 -1 0 -2 2 -1 -1 -2 -1 0 -2 2 0 -2 -2 -2 -1 1 0 -2 -1 2 -1 -4 0 -1 1 1 2 -2 1 -2 1 2 2 -2 1 -2 0 -1 -1 -2 -2 1 0 -1 -1 2 0 2 0 -1 2 1 -1 2 0 2 1 1 1 -1 -1 1 -2 0 0 -2 0\n", "output": "2 78 92\n"}, {"type...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given n rectangles. The corners of rectangles have integer coordinates and their edges are parallel to the Ox and Oy axes. The rectangles may touch each other, but they do not overlap (that is, there are no points...
[{"type": "stdin_stdout", "input": "5\n20421 5189 23141 12511\n16414 10436 17880 12511\n17880 10436 20421 12511\n15819 10436 16414 12511\n15819 5189 20421 10436\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "5\n20421 5189 23141 12511\n16414 10436 17880 12511\n17880 10436 20421 12511\n15819 10436 16414 12511...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have N logs of lengths A_1,A_2,\\cdots A_N.\nWe can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t...
[{"type": "stdin_stdout", "input": "10 10\n158260522 877914575 602436426 24979445 861648772 623690081 433933447 476190629 262703497 211047202\n", "output": "292638192\n"}, {"type": "stdin_stdout", "input": "10 10\n158260522 877914575 1013896555 24979445 861648772 623690081 433933447 476190629 262703497 374010847", "out...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven an array of $n$ positive integers $a_1, a_2, \\dots, a_n$ ($1 \\le a_i \\le 1000$). Find the maximum value of $i + j$ such that $a_i$ and $a_j$ are coprime,$^{\\dagger}$ or $-1$ if no such $i$, $j$ exist.\n\nFor exa...
[{"type": "stdin_stdout", "input": "9\n19\n146 637 288 867 647 705 297 414 541 951 238 806 73 916 781 371 937 343 985\n6\n289 797 286 446 650 296\n15\n670 558 11 473 388 270 231 981 580 180 834 882 212 233 547\n16\n461 336 815 510 720 169 999 580 367 47 992 786 671 522 25 24\n8\n732 710 651 518 287 789 347 14\n4\n697 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTwo experienced climbers are planning a first-ever attempt: they start at two points of the equal altitudes on a mountain range, move back and forth on a single route keeping their altitudes equal, and finally meet with e...
[{"type": "stdin_stdout", "input": "6\n0 -1\n3 4\n9 12\n17 10\n21 12\n33 -1\n5\n0 0\n12 0\n20 0\n30 0\n74 0\n10\n0 0\n1 2\n3 0\n6 3\n9 0\n11 2\n13 0\n15 2\n16 2\n35 0\n7\n0 0\n150 997\n300 1\n450 999\n600 2\n750 998\n900 0\n0", "output": "46.241105114034\n74.000000000000\n46.612166980266\n10078.072814085803\n"}, {"type...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have a grid with N rows and M columns of squares. Initially, all the squares are white.\n\nThere is a button attached to each row and each column. When a button attached to a row is pressed, the colors of all the squar...
[{"type": "stdin_stdout", "input": "1 13 1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1 13 0", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "7 17 0", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1 20 0", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1 21 3", "output": "Yes\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given n points on a plane. All points are different.\n\nFind the number of different groups of three points (A, B, C) such that point B is the middle of segment AC. \n\nThe groups of three points are considered un...
[{"type": "stdin_stdout", "input": "40\n-8 24\n2 -1\n1 -18\n72 -70\n5 -4\n-308 436\n-19 40\n36 -35\n-178 265\n-1 2\n-7 30\n-1 0\n3 -2\n200 -285\n17 -16\n-35 74\n0 -4\n-86 106\n-1 4\n-7 6\n0 1\n-5 4\n-2 3\n6 -5\n-4 5\n181 -262\n76 -118\n0 0\n-7 18\n-58 104\n-5 6\n-6 12\n-3 4\n1 0\n11 -10\n-86 130\n-3 6\n153 -236\n-183 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n<image>\n\n\nYou know the merry-go-round in the amusement park. Vehicles such as horses and carriages are fixed on a large disk, and it is a standard playset that the vehicle swings up and down at the same time as the dis...
[{"type": "stdin_stdout", "input": "0 3 1 1 0 -1 -1 2\n1 1 5 3 -1 3 0 -1", "output": "1 4 1 2 1 2 1 4\n1 2 1 4 1 4 1 2\n"}, {"type": "stdin_stdout", "input": "0 2 0 1 0 -1 -1 2\n1 1 5 3 -1 3 0 -1", "output": "1 2 1 2 1 4 1 4\n1 2 1 4 1 4 1 2\n"}, {"type": "stdin_stdout", "input": "0 2 1 1 0 -1 -1 2\n1 1 5 3 -1 0 0 -1",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given positive integer number n. You should create such strictly increasing sequence of k positive numbers a_1, a_2, ..., a_{k}, that their sum is equal to n and greatest common divisor is maximal.\n\nGreatest com...
[{"type": "stdin_stdout", "input": "10000000000 5000\n", "output": "640 1280 1920 2560 3200 3840 4480 5120 5760 6400 7040 7680 8320 8960 9600 10240 10880 11520 12160 12800 13440 14080 14720 15360 16000 16640 17280 17920 18560 19200 19840 20480 21120 21760 22400 23040 23680 24320 24960 25600 26240 26880 27520 28160 2880...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nThere are $ N $ streetlights on a two-dimensional square of $ W \\ times H $.\nGaccho wants to start with $ (1,1) $ and go to $ (W, H) $.\nGaccho is afraid of dark places, so he only wants to walk in the square...
[{"type": "stdin_stdout", "input": "43 16 2\n4 7\n-1 8\n10 0", "output": "48\n"}, {"type": "stdin_stdout", "input": "19 21 2\n0 3\n-1 11\n1 1", "output": "30\n"}, {"type": "stdin_stdout", "input": "12 31 1\n5 2\n-1 1\n14 0", "output": "36\n"}, {"type": "stdin_stdout", "input": "34 50 1\n9 1\n0 1\n-2 -1", "output": "74\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe sequence of integers $a_1, a_2, \\dots, a_k$ is called a good array if $a_1 = k - 1$ and $a_1 > 0$. For example, the sequences $[3, -1, 44, 0], [1, -99]$ are good arrays, and the sequences $[3, 7, 8], [2, 5, 4, 1], [0...
[{"type": "stdin_stdout", "input": "4\n-2 0 4 -1\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "4\n-2 0 1 -1\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "4\n-2 1 5 0\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "4\n-1 0 4 1\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "4\n-2 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMahmoud and Ehab continue their adventures! As everybody in the evil land knows, Dr. Evil likes bipartite graphs, especially trees.\n\nA tree is a connected acyclic graph. A bipartite graph is a graph, whose vertices can ...
[{"type": "stdin_stdout", "input": "10\n7 6\n2 10\n7 1\n8 5\n9 3\n2 3\n8 7\n10 8\n10 4\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "10\n7 6\n2 7\n4 1\n8 5\n9 4\n5 3\n8 7\n10 8\n10 4\n", "output": "16\n"}, {"type": "stdin_stdout", "input": "10\n2 6\n3 7\n8 4\n4 10\n6 9\n9 7\n3 10\n1 2\n5 8\n", "output": "16...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA: A-Z Cat / A-Z Cat\n\nstory\n\nAizunyan is a second-year student who belongs to the programming contest club of Wakagamatsu High School, commonly known as the Prokon club. It's so cute. Aizu Nyan was asked by her friend...
[{"type": "stdin_stdout", "input": "AOZUNYANPERIPERO", "output": "AZ\n"}, {"type": "stdin_stdout", "input": "OREQIRMQEAYNUYOA", "output": "-1\n"}, {"type": "stdin_stdout", "input": "OREPIREPNAYNUZOA", "output": "AZ\n"}, {"type": "stdin_stdout", "input": "OREPIRNPEAYNUZOA", "output": "AZ\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently a dog was bought for Polycarp. The dog's name is Cormen. Now Polycarp has a lot of troubles. For example, Cormen likes going for a walk. \n\nEmpirically Polycarp learned that the dog needs at least k walks for an...
[{"type": "stdin_stdout", "input": "100 500\n64 140 15 221 24 106 73 30 275 97 296 55 5 30 47 199 130 44 72 170 7 204 359 40 128 117 45 192 344 112 0 11 196 78 73 53 222 93 88 151 99 283 60 71 4 87 226 46 66 74 23 89 77 60 397 181 0 101 358 54 124 155 19 218 9 140 161 130 308 85 103 85 300 128 19 108 225 136 100 54 30 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these.\n\nOnly Japanese students or overseas students can pas...
[{"type": "stdin_stdout", "input": "12 14 3\ncaababaccaba", "output": "No\nYes\nYes\nYes\nYes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\n"}, {"type": "stdin_stdout", "input": "12 14 3\nabaccababaac", "output": "Yes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nYes\nYes\nYes\nNo\n"}, {"type": "stdin_stdout", "input": "12 16 2\ncabbabaacaaa"...
code_stdio