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\nAlice got an array of length $n$ as a birthday present once again! This is the third year in a row! \n\nAnd what is more disappointing, it is overwhelmengly boring, filled entirely with zeros. Bob decided to apply some ch... | [{"type": "stdin_stdout", "input": "5 12\n634 895\n143 730\n901 245\n386 486\n395 -111\n-469 -104\n-681 -623\n-900 843\n889 -883\n476 -304\n777 986\n206 -491\n", "output": "8107.800000000000182\n"}, {"type": "stdin_stdout", "input": "5 12\n634 895\n143 730\n901 245\n386 486\n395 -111\n-469 -104\n-681 -623\n-900 843\n88... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTonight, in your favourite cinema they are giving the movie Joker and all seats are occupied. In the cinema there are N rows with N seats each, forming an N\\times N square. We denote with 1, 2,\\dots, N the viewers in th... | [{"type": "stdin_stdout", "input": "6\n11 21 35 22 7 36 27 34 8 20 15 13 16 1 24 3 2 17 26 9 18 32 31 23 19 14 4 25 10 29 28 33 12 6 5 30", "output": "11"}, {"type": "stdin_stdout", "input": "4\n6 7 1 4 13 16 10 9 5 11 12 14 15 2 3 8", "output": "3"}, {"type": "stdin_stdout", "input": "3\n2 3 7 9 5 4 8 6 1", "output": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIvar the Boneless is a great leader. He is trying to capture Kattegat from Lagertha. The war has begun and wave after wave Ivar's warriors are falling in battle.\n\nIvar has $n$ warriors, he places them on a straight line... | [{"type": "stdin_stdout", "input": "100 55\n1 2 4 4 3 5 5 2 3 1 2 2 1 2 4 5 0 5 4 2 5 4 5 3 3 5 4 4 4 5 5 2 3 3 4 4 3 4 5 5 5 5 3 5 1 2 4 3 4 5 3 3 2 0 4 5 3 4 4 1 9 1 5 2 0 1 4 0 3 3 1 4 2 5 4 5 3 2 5 5 2 3 2 3 2 2 3 4 4 4 1 4 2 4 5 3 1 3 3 1\n5 2 1 4 3 4 3 1 4 4 1 2 0 2 1 5 5 4 5 4 2 5 2 1 5 1 4 0 1 5 4 5 1 4 4 2 5 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCheaterius is a famous in all the Berland astrologist, magician and wizard, and he also is a liar and a cheater. One of his latest inventions is Cheaterius' amulets! They bring luck and wealth, but are rather expensive. C... | [{"type": "stdin_stdout", "input": "7\n21\n33\n**\n33\n12\n**\n32\n31\n**\n21\n33\n**\n33\n12\n**\n32\n31\n**\n13\n23\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "7\n21\n33\n**\n33\n12\n**\n32\n31\n**\n21\n38\n**\n33\n12\n**\n32\n31\n**\n13\n23\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "7\n21\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt seems like the year of 2013 came only yesterday. Do you know a curious fact? The year of 2013 is the first year after the old 1987 with only distinct digits.\n\nNow you are suggested to solve the following problem: giv... | [{"type": "stdin_stdout", "input": "1987\n", "output": "2013\n"}, {"type": "stdin_stdout", "input": "2013\n", "output": "2014\n"}, {"type": "stdin_stdout", "input": "1000\n", "output": "1023\n"}, {"type": "stdin_stdout", "input": "1001\n", "output": "1023\n"}, {"type": "stdin_stdout", "input": "1234\n", "output": "1235... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDeadpool wants to decorate his girlfriend’s house with a series of bulbs. The number of bulbs is M. Initially, all the bulbs are switched off. Deadpool finds that there are K numbers of buttons, each of them is connected... | [{"type": "stdin_stdout", "input": "100 100\n100 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 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 93 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have an analog clock whose three hands (the second hand, the minute hand and the hour hand) rotate quite smoothly. You can measure two angles between the second hand and two other hands.\n\nWrite a program to find the ... | [{"type": "stdin_stdout", "input": "12 0 0 0\n12 11 59 59\n12 1 56 0\n12 1 56 3\n12 1 56 34\n12 3 9 43\n12 3 10 14\n12 2 17 58\n12 7 18 0\n10 7 23 0\n12 7 23 31\n2 0 38 19\n2 0 39 0\n2 0 39 30\n2 1 6 14\n2 1 20 1\n2 1 20 31\n3 2 19 0\n3 2 59 30\n4 0 28 48\n5 1 5 37\n5 1 10 10\n5 1 7 41\n11 0 36 0\n0 0 0 0", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently you've discovered a new shooter. They say it has realistic game mechanics.\n\nYour character has a gun with magazine size equal to $k$ and should exterminate $n$ waves of monsters. The $i$-th wave consists of $a_... | [{"type": "stdin_stdout", "input": "10 79\n2 2 70\n2 10 35\n10 10 76\n11 11 66\n12 12 75\n12 14 88\n15 16 76\n17 18 97\n19 20 105\n20 20 46\n", "output": "862\n"}, {"type": "stdin_stdout", "input": "10 79\n2 2 70\n2 10 35\n10 10 76\n11 11 66\n12 12 75\n12 14 88\n15 16 76\n17 18 97\n19 20 105\n20 20 46\n", "output": "86... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nB: 階層的計算機 (Hierarchical Calculator)\n\nProblem\n\nEbi-chan has N formulae: y = a_i x for i =1, ..., N (inclusive). Now she considers a subsequence of indices with length k: s_1, s_2, ..., s_k. At first, let x_0 be 1 and e... | [{"type": "stdin_stdout", "input": "4\n-1 2 -2 2", "output": "4\n1\n2\n3\n4\n"}, {"type": "stdin_stdout", "input": "4\n2 -1 -2 -1", "output": "3\n1\n2\n3\n"}, {"type": "stdin_stdout", "input": "4\n2 -1 -2 1", "output": "3\n1\n2\n3\n"}, {"type": "stdin_stdout", "input": "4\n-1 -2 0 2", "output": "3\n1\n2\n4\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIf there is an integer not less than 0 satisfying the following conditions, print the smallest such integer; otherwise, print -1.\n - The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For... | [{"type": "stdin_stdout", "input": "3 3\n1 7\n3 2\n1 7\n", "output": "702\n"}, {"type": "stdin_stdout", "input": "3 3\n3 1\n2 1\n1 4\n", "output": "411\n"}, {"type": "stdin_stdout", "input": "3 1\n1 7\n3 2\n0 28", "output": "700\n"}, {"type": "stdin_stdout", "input": "2 3\n2 0\n2 0\n2 0\n", "output": "10\n"}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nShaass has n books. He wants to make a bookshelf for all his books. He wants the bookshelf's dimensions to be as small as possible. The thickness of the i-th book is t_{i} and its pages' width is equal to w_{i}. The thick... | [{"type": "stdin_stdout", "input": "100\n2 2\n1 2\n1 1\n2 1\n1 2\n2 1\n2 2\n2 1\n2 1\n1 2\n1 2\n2 1\n1 2\n2 1\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 1\n2 2\n2 1\n1 1\n1 2\n2 2\n1 1\n2 2\n1 2\n2 1\n2 2\n1 2\n2 2\n1 2\n1 1\n2 2\n2 2\n1 1\n1 2\n2 2\n1 2\n1 1\n1 1\n1 1\n2 1\n2 1\n1 2\n1 2\n2 2\n1 2\n1 2\n1 1\n2 1\n2 1\n2 2\n1 2\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAnadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≤ a ≤ b ≤ 6, there is exactly one domino with a dots on one half and b dots on the other half. The s... | [{"type": "stdin_stdout", "input": "7 21\n3 5\n7 2\n2 3\n6 5\n5 2\n4 7\n2 6\n2 4\n6 7\n5 1\n1 4\n4 5\n5 7\n4 6\n3 1\n1 2\n3 4\n7 1\n3 7\n6 1\n3 6\n", "output": "16\n"}, {"type": "stdin_stdout", "input": "7 21\n1 2\n1 3\n1 4\n1 5\n1 6\n1 7\n2 3\n2 4\n2 5\n2 6\n2 7\n3 4\n3 5\n3 6\n3 7\n4 5\n4 6\n4 7\n5 6\n5 7\n6 7\n", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarpus loves lucky numbers. Everybody knows that lucky numbers are positive integers, whose decimal representation (without leading zeroes) contain only the lucky digits x and y. For example, if x = 4, and y = 7, then... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "40744\n"}, {"type": "stdin_stdout", "input": "1000000000\n", "output": "40744\n"}, {"type": "stdin_stdout", "input": "999999999\n", "output": "40743\n"}, {"type": "stdin_stdout", "input": "999999998\n", "output": "40742\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSuppose we have a sequence of non-negative integers, Namely a_1, a_2, ... ,a_n. At each time we can choose one term a_i with 0 < i < n and we subtract 1 from both a_i and a_i+1. We wonder whether we can get a sequence of ... | [{"type": "stdin_stdout", "input": "10000\n965025415 999971470 701127278 722558453 860773508 998208321 882682007 717808232 965289578 999849240 647655738 734796389 445919839 565884615 682769357 418326924 405511267 647687211 973600883 765117686 842450085 998782971 915038182 747264263 910653625 948741426 999497858 9896202... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter learning a lot about space exploration, a little girl named Ana wants to change the subject.\n\nAna is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to che... | [{"type": "stdin_stdout", "input": "20\niw\nix\nudb\nbg\noi\nuo\njsm\num\ns\nquy\nqo\nbxct\nng\nrmr\nnu\nps\nio\nkh\nw\nk\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "20\niw\nix\nudb\nbg\noi\nuo\njsm\num\ns\nquy\nqo\nbxct\nng\nrmr\nnu\nps\nio\nkh\nw\nk\n", "output": "5\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn this task Anna and Maria play a game with a very unpleasant rival. Anna and Maria are in the opposite squares of a chessboard (8 × 8): Anna is in the upper right corner, and Maria is in the lower left one. Apart from t... | [{"type": "stdin_stdout", "input": "S..SSS.A\nS.S.SSSS\nSSSSSSSS\n...SS...\nS.SSSSSS\nSS..SS.S\nSS..S.S.\nMSS..SSS\n", "output": "LOSE\n"}, {"type": "stdin_stdout", "input": ".SSSSSSA\n.SSSSSSS\n.SSSSSSS\n.SSSSSSS\n.SSSSSSS\n.SSSSSSS\nSSSSSSS.\nMSSSSSSS\n", "output": "LOSE\n"}, {"type": "stdin_stdout", "input": ".SSSS.... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n++++++++[>+>++>+++>++++>+++++>++++++>+++++++>++++++++>+++++++++>++++++++++>+\n++++++++++>++++++++++++>+++++++++++++>++++++++++++++>+++++++++++++++>+++++++\n+++++++++<<<<<<<<<<<<<<<<-]>>>>>>>>>>.<<<<<<<<<<>>>>>>>>>>>>>>++.... | [{"type": "stdin_stdout", "input": "1000000\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "1000000\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "1000010\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "1229030\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1000011\n", "output": "3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInna likes sweets and a game called the \"Candy Matrix\". Today, she came up with the new game \"Candy Matrix 2: Reload\".\n\nThe field for the new game is a rectangle table of size n × m. Each line of the table contains ... | [{"type": "stdin_stdout", "input": "10 10\nG********S\n*G*******S\n**G******S\n***G*****S\n****G****S\nS***G*****\n******G**S\n*******G*S\n********GS\nG********S\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "10 10\nG********S\n*G*******S\n**G******S\n***G*****S\n****S****G\nS***G*****\n******G**S\n*******G*... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers wri... | [{"type": "stdin_stdout", "input": "101 298\n", "output": "10000000000000000000000000000000000000000000000000000000000000000000999999999999999999999999999999999 99999999999999999999999999999999910000000000000000000000000000000000000000000000000000000000000000000\n"}, {"type": "stdin_stdout", "input": "101 299\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVanya loves playing. He even has a special set of cards to play with. Each card has a single integer. The number on the card can be positive, negative and can even be equal to zero. The only limit is, the number on each c... | [{"type": "stdin_stdout", "input": "123 222\n44 -190 -188 -185 -55 17 190 176 157 176 -24 -113 -54 -61 -53 53 -77 68 -12 -114 -217 163 -122 37 -37 20 -108 17 -140 -210 218 19 -89 54 18 197 111 -150 -36 -131 -172 36 67 16 -202 72 169 -137 -34 -122 137 -72 196 -17 -104 180 -102 96 -69 -184 21 -15 217 -61 175 -221 62 173 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider the infinite sequence $s$ of positive integers, created by repeating the following steps:\n\n Find the lexicographically smallest triple of positive integers $(a, b, c)$ such that $a \\oplus b \\oplus c = 0$, ... | [{"type": "stdin_stdout", "input": "9\n2\n3\n3\n12\n13\n6\n7\n11\n9\n", "output": "2\n3\n3\n13\n7\n12\n5\n11\n15\n"}, {"type": "stdin_stdout", "input": "9\n2\n3\n3\n12\n10\n6\n3\n22\n6\n", "output": "2\n3\n3\n13\n6\n12\n3\n18\n12\n"}, {"type": "stdin_stdout", "input": "9\n1\n5\n3\n4\n18\n6\n12\n8\n9\n", "output": "1\n8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven an array of N elements, check if it is possible to obtain a sum of S, by choosing some (or none) elements of the array and adding them.\n\nInput:\nFirst line of the input contains number of test cases T. Each test c... | [{"type": "stdin_stdout", "input": "50\n15\n-403058 315136 370586 156605 -458323 -377956 576329 623628 -772464 -967801 -1004 904618 -645084 -944193 -213379\n-433844\n14\n763376 324068 -260116 644761 -509791 -5611 -102387 131396 484627 750553 -323621 434549 -24093 465676\n2773387\n14\n948700 631252 -404264 73426 63860 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is a permutation P of \\{1, 2, \\ldots, N\\}.\nFor a pair (L, R) (1 \\le L \\lt R \\le N), let X_{L, R} be the second largest value among P_L, P_{L+1}, \\ldots, P_R.\nFind \\displaystyle \\sum_{L=1}^{N-1} \\sum_{R=L... | [{"type": "stdin_stdout", "input": "95\n41 7 46 26 89 2 78 92 8 16 45 57 17 6 35 62 91 95 63 48 19 79 74 52 1 77 28 93 56 31 25 54 40 64 9 34 53 11 10 55 94 24 67 58 27 60 90 87 18 73 50 80 20 21 61 42 88 14 44 76 39 70 51 66 83 32 30 81 23 82 72 65 15 68 75 71 69 13 4 3 85 84 49 59 22 33 5 47 12 37 29 36 38 86 43\n", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBob is decorating his kitchen, more precisely, the floor. He has found a prime candidate for the tiles he will use. They come in a simple form factor — a square tile that is diagonally split into white and black part as d... | [{"type": "stdin_stdout", "input": "1000 1000\n", "output": "708964705\n"}, {"type": "stdin_stdout", "input": "1000 1000\n", "output": "708964705\n"}, {"type": "stdin_stdout", "input": "1000 1001\n", "output": "419685057\n"}, {"type": "stdin_stdout", "input": "1000 122\n", "output": "712990290\n"}, {"type": "stdin_stdo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an angle $\\text{ang}$. \n\nThe Jury asks You to find such regular $n$-gon (regular polygon with $n$ vertices) that it has three vertices $a$, $b$ and $c$ (they can be non-consecutive) with $\\angle{abc} = \... | [{"type": "stdin_stdout", "input": "69\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n", "output": "180\n180\n180\n180\n180\n180\n180\n180\n180\n180\n180\n180\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string $s$ of even length $n$. String $s$ is binary, in other words, consists only of 0's and 1's.\n\nString $s$ has exactly $\\frac{n}{2}$ zeroes and $\\frac{n}{2}$ ones ($n$ is even).\n\nIn one operation... | [{"type": "stdin_stdout", "input": "3\n2\n10\n4\n0110\n8\n11101000\n", "output": "0\n1\n2\n"}, {"type": "stdin_stdout", "input": "3\n2\n10\n4\n0110\n8\n11100001\n", "output": "0\n1\n3\n"}, {"type": "stdin_stdout", "input": "3\n2\n10\n4\n1010\n8\n11101000\n", "output": "0\n0\n2\n"}, {"type": "stdin_stdout", "input": "3\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two positive integers A and B. Compare the magnitudes of these numbers.\n\n-----Constraints-----\n - 1 ≤ A, B ≤ 10^{100}\n - Neither A nor B begins with a 0.\n\n-----Input-----\nInput is given from Standard ... | [{"type": "stdin_stdout", "input": "123456789012345678901234567890\n54295952540662239241952312402", "output": "GREATER\n"}, {"type": "stdin_stdout", "input": "123456789012345678901234567890\n67478580391614097833417622355", "output": "GREATER\n"}, {"type": "stdin_stdout", "input": "123456789012345678901234567890\n127408... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt's a very unfortunate day for Volodya today. He got bad mark in algebra and was therefore forced to do some work in the kitchen, namely to cook borscht (traditional Russian soup). This should also improve his algebra sk... | [{"type": "stdin_stdout", "input": "20 3696\n87 22 21 83 95 31 28 96 71 25 56 40 70 79 46 87 19 19 34 25\n70 44 34 11 2 1 59 22 46 28 3 53 52 71 34 18 65 71 76 30\n", "output": "21.768421052631577\n"}, {"type": "stdin_stdout", "input": "20 1479\n69 30 15 62 81 24 5 16 25 65 47 23 62 51 87 50 6 44 88 61\n57 47 76 68 7 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJeff got 2n real numbers a_1, a_2, ..., a_2n as a birthday present. The boy hates non-integer numbers, so he decided to slightly \"adjust\" the numbers he's got. Namely, Jeff consecutively executes n operations, each of t... | [{"type": "stdin_stdout", "input": "10\n8003.867 4368.000 2243.000 3340.287 5384.000 1036.456 3506.000 4463.000 1477.000 2420.314 9391.000 1696.000 5857.833 244.000 8220.000 5879.000 5424.482 2631.197 7111.000 9157.536\n", "output": "0.028\n"}, {"type": "stdin_stdout", "input": "10\n8003.867 4368.000 2243.298 3340.000 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n\"The zombies are lurking outside. Waiting. Moaning. And when they come...\"\n\n\"When they come?\"\n\n\"I hope the Wall is high enough.\"\n\nZombie attacks have hit the Wall, our line of defense in the North. Its protect... | [{"type": "stdin_stdout", "input": "10 7\n.......\n.......\n.......\n.......\n.......\n.......\n.......\n.......\n...B...\nB.BB.B.\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "10 7\n.......\n.......\n.......\n.......\n.......\n.......\n.......\n...-...\n...B...\nB.BB.B.\n", "output": "3\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCarousel Boutique is busy again! Rarity has decided to visit the pony ball and she surely needs a new dress, because going out in the same dress several times is a sign of bad manners. First of all, she needs a dress patt... | [{"type": "stdin_stdout", "input": "5 5\nzbacg\nbaaac\naaaaa\neaaad\nweadd\n", "output": "31\n"}, {"type": "stdin_stdout", "input": "5 5\nzbacg\nbaaac\naaaaa\ndaaae\nweadd\n", "output": "31\n"}, {"type": "stdin_stdout", "input": "5 5\nzbacf\nbcaaa\naaaaa\neaaad\nveadd\n", "output": "28\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSuppose that you are in a campus and have to go for classes day by day. As you may see, when you hurry to a classroom, you surprisingly find that many seats there are already occupied. Today you and your friends went for ... | [{"type": "stdin_stdout", "input": "5 5 3\n.....\n.....\n*...*\n*....\n.*...\n", "output": "18\n"}, {"type": "stdin_stdout", "input": "5 5 3\n.....\n.....\n*...*\n*....\n.*...\n", "output": "18\n"}, {"type": "stdin_stdout", "input": "5 5 3\n.....\n.....\n*...*\n*....\n...*.\n", "output": "18\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.\n\nThe security system logs entrances and departures. The entrance of the $i$-th employee is... | [{"type": "stdin_stdout", "input": "20\n384933 946658 407136 242739 -242739 -407136 -946658 -384933 384933 -384933 319281 407136 804861 -407136 415987 946658 -946658 -415987 -804861 -319281\n", "output": "3\n8 2 10 \n"}, {"type": "stdin_stdout", "input": "20\n384933 946658 407136 242739 -242739 -407136 -946658 -384933 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBooks are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers.\n\nYou can assume that a word consists of at most 30 characters... | [{"type": "stdin_stdout", "input": "ntzsd 22\neevn 1\nnutrodnctioi -1\nse_z 1\nstyle 32\ntndmucod 2\nstyld 10\nmuee -2", "output": "eevn\n1\nmuee\n-2\nntzsd\n22\nnutrodnctioi\n-1\nse_z\n1\nstyld\n10\nstyle\n32\ntndmucod\n2\n"}, {"type": "stdin_stdout", "input": "ntzsd 10\neevn 1\nnutrodnctioi -1\nse_z 1\nstyle 32\ntndm... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBarney is standing in a bar and starring at a pretty girl. He wants to shoot her with his heart arrow but he needs to know the distance between him and the girl to make his shot accurate. [Image] \n\nBarney asked the bar ... | [{"type": "stdin_stdout", "input": "2.0629094807595491132306264747042243928486303384791951220362096240931158821630792563855724946791054152e85\n", "output": "20629094807595491132306264747042243928486303384791951220362096240931158821630792563855.724946791054152\n"}, {"type": "stdin_stdout", "input": "1.739019376653594888... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a square of size $10^6 \\times 10^6$ on the coordinate plane with four points $(0, 0)$, $(0, 10^6)$, $(10^6, 0)$, and $(10^6, 10^6)$ as its vertices.\n\nYou are going to draw segments on the plane. All segments a... | [{"type": "stdin_stdout", "input": "3 3\n2 3 1000000\n4 0 4\n3 0 1000000\n4 0 1\n2 0 5\n3 2 1000000\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "3 3\n2 3 1000000\n7 0 4\n3 0 1000000\n4 0 1\n2 0 5\n3 2 1000000\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "3 3\n2 3 1000000\n4 0 4\n3 0 1000000\n4 0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKurohashi has never participated in AtCoder Beginner Contest (ABC).\nThe next ABC to be held is ABC N (the N-th ABC ever held).\nKurohashi wants to make his debut in some ABC x such that all the digits of x in base ten ar... | [{"type": "stdin_stdout", "input": "111\n", "output": "111\n"}, {"type": "stdin_stdout", "input": "112\n", "output": "222\n"}, {"type": "stdin_stdout", "input": "750\n", "output": "777\n"}, {"type": "stdin_stdout", "input": "234\n", "output": "333\n"}, {"type": "stdin_stdout", "input": "999\n", "output": "999\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.\n\nA subarray is the sequence of consecutive elements of the array. Subarray is called in... | [{"type": "stdin_stdout", "input": "10\n32372808 517917901 640274071 1836610331 71867556 96204862 120140751 446173607 796619138 1156360703\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "10\n32372808 517917901 156515250 1836610331 71867556 96204862 120140751 446173607 796619138 1156360703\n", "output": "6\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nReforms continue entering Berland. For example, during yesterday sitting the Berland Parliament approved as much as n laws (each law has been assigned a unique number from 1 to n). Today all these laws were put on the tab... | [{"type": "stdin_stdout", "input": "98 24\n52 20 12 75 44 22 22 25 28 100 8 41 31 47 95 87 5 54 7 49 32 46 42 37 45 22 29 11 54 98 46 94 10 47 114 2 15 108 17 82 46 22 32 62 89 37 30 26 92 77 69 11 59 78 24 66 88 10 32 93 46 14 57 20 5 69 53 99 81 94 67 22 54 31 49 52 46 51 49 4 53 31 4 66 28 38 103 5 40 75 15 52 87 16... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne tradition of welcoming the New Year is launching fireworks into the sky. Usually a launched firework flies vertically upward for some period of time, then explodes, splitting into several parts flying in different dir... | [{"type": "stdin_stdout", "input": "30\n1 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5\n", "output": "43348\n"}, {"type": "stdin_stdout", "input": "30\n5 5 1 1 4 4 3 1 5 3 5 5 1 2 2 3 4 5 2 1 4 3 1 1 4 5 4 4 2 2\n", "output": "24339\n"}, {"type": "stdin_stdout", "input": "30\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n$n$ players are playing a game.\n\nThere are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always ... | [{"type": "stdin_stdout", "input": "1\n10\n1109412863 911871372 379798020 844017253 852316352 439889133 601615010 999121621 343144247 662484047\n148682006 868690703 149843110 1652026160 587798634 40092006 292693207 256527822 128794711 765771574\n", "output": "1111111111\n"}, {"type": "stdin_stdout", "input": "1\n10\n61... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke loves working out. He is now exercising N times.\nBefore he starts exercising, his power is 1. After he exercises for the i-th time, his power gets multiplied by i.\nFind Snuke's power after he exercises N times. Si... | [{"type": "stdin_stdout", "input": "100000\n", "output": "457992974\n"}, {"type": "stdin_stdout", "input": "100001", "output": "755072381\n"}, {"type": "stdin_stdout", "input": "110001", "output": "817497558\n"}, {"type": "stdin_stdout", "input": "110011", "output": "422312314\n"}, {"type": "stdin_stdout", "input": "10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMasha lives in a multi-storey building, where floors are numbered with positive integers. Two floors are called adjacent if their numbers differ by one. Masha decided to visit Egor. Masha lives on the floor $x$, Egor on t... | [{"type": "stdin_stdout", "input": "1000 999 1000 1000 1000 1000\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1000 999 1100 1000 1000 1000\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1000 999 1000 1000 1000 1000\n", "output": "NO"}, {"type": "stdin_stdout", "input": "188 288 112 595 331 414\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLunar New Year is approaching, and Bob is struggling with his homework – a number division problem.\n\nThere are $n$ positive integers $a_1, a_2, \\ldots, a_n$ on Bob's homework paper, where $n$ is always an even number. ... | [{"type": "stdin_stdout", "input": "100\n28 27 23 6 23 11 25 20 28 15 29 23 20 2 8 24 8 9 30 8 8 1 11 7 6 17 17 27 26 30 12 22 17 22 9 25 4 26 9 26 10 30 13 4 16 12 23 19 10 22 12 20 3 16 10 4 29 11 15 4 5 7 29 16 3 1 7 16 26 14 28 1 15 19 30 28 5 22 14 28 13 12 11 30 3 4 7 10 22 8 4 10 22 12 17 27 23 11 18 7\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMr. Scrooge, a very busy man, decided to count the time he wastes on all sorts of useless stuff to evaluate the lost profit. He has already counted the time he wastes sleeping and eating. And now Mr. Scrooge wants to coun... | [{"type": "stdin_stdout", "input": "61 764\n-9 15\n11 -8\n-6 -7\n-13 -19\n16 -16\n-5 -1\n20 -19\n-14 -1\n-11 4\n7 -2\n-3 2\n-14 -17\n15 18\n20 15\n-13 -2\n15 8\n3 13\n19 -10\n2 -6\n15 -3\n-12 11\n4 -16\n-14 20\n0 2\n11 -7\n-6 -11\n16 7\n8 -3\n16 -10\n-3 9\n9 5\n4 -1\n-17 9\n14 -4\n8 6\n-19 12\n10 -17\n-5 7\n7 -3\n5 3\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nImagine you have an infinite 2D plane with Cartesian coordinate system. Some of the integral points are blocked, and others are not. Two integral points A and B on the plane are 4-connected if and only if: the Euclidean ... | [{"type": "stdin_stdout", "input": "30426905\n", "output": "172120564\n"}, {"type": "stdin_stdout", "input": "38450759\n", "output": "217510336\n"}, {"type": "stdin_stdout", "input": "19863843\n", "output": "112366864\n"}, {"type": "stdin_stdout", "input": "24562258\n", "output": "138945112\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTwo bears are playing tic-tac-toe via mail. It's boring for them to play usual tic-tac-toe game, so they are a playing modified version of this game. Here are its rules.\n\nThe game is played on the following field. [Imag... | [{"type": "stdin_stdout", "input": "... ... ...\n... ... ...\n... ... ...\n\n... ... ...\n... ... ...\n... x.. ...\n\n... ... ...\n... ... ...\n... ... ...\n6 4\n", "output": "... ... ... \n... ... ... \n... ... ... \n\n... ... ... \n... ... ... \n... x.. ... \n\n!!! ... ... \n!!! ... ... \n!!! ... ... \n\n"}, {"type":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn mathematics, a subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements. For example, the sequence BDF is a subsequence of ABCDE... | [{"type": "stdin_stdout", "input": "KOROXDDWEUVYWJIXSFPEJFYZJDDUXISOFJTIFJSBTWIJQHMTQWLAGGMXTFALRXYCMGZNKYQRCDVTPRQDBAALTWAXTNLDPYWNSFKE\nNHZGRZFMFQGSAYOJTFKMMUPOOQXWCPPAIVRJHINJPHXTTBWRIYNOHMJKBBGXVXYZDBVBBTQRXTOFLBBCXGNICBKAAGOKAYCCJYCW\nXCXLBESCRBNKWYGFDZFKWYNLFAKEWWGRUIAQGNCFDQXCHDBEQDSWSNGVKUFOGGSPFFZWTXGZQMMFJXDW... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a bingo card with a 3\\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}.\nThe MC will choose N numbers, b_1, b_2, \\cdots, b_N. If our bingo sheet... | [{"type": "stdin_stdout", "input": "60 88 34\n92 41 43\n65 73 48\n10\n60\n43\n88\n11\n48\n73\n65\n41\n92\n34\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "60 106 34\n92 41 43\n39 73 48\n10\n60\n43\n88\n11\n48\n73\n65\n41\n92\n34", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "60 88 34\n92 41 43\n3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIroha is very particular about numbers. There are K digits that she dislikes: D_1, D_2, ..., D_K.\n\nShe is shopping, and now paying at the cashier. Her total is N yen (the currency of Japan), thus she has to hand at leas... | [{"type": "stdin_stdout", "input": "1001 8\n1 0 4 5 6 7 15 11", "output": "2222\n"}, {"type": "stdin_stdout", "input": "1001 8\n1 3 2 5 6 7 15 9", "output": "4000\n"}, {"type": "stdin_stdout", "input": "1001 8\n1 3 4 5 6 7 8 9", "output": "2000\n"}, {"type": "stdin_stdout", "input": "1000 8\n2 3 4 5 6 7 8 9", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEveryone knows that long ago on the territory of present-day Berland there lived Bindian tribes. Their capital was surrounded by n hills, forming a circle. On each hill there was a watchman, who watched the neighbourhood ... | [{"type": "stdin_stdout", "input": "10\n8097 8097 8097 14160 8097 8097 8097 8097 8097 8097\n", "output": "45\n"}, {"type": "stdin_stdout", "input": "10\n8097 8097 8097 14160 8097 8097 8097 8097 8097 4894\n", "output": "38\n"}, {"type": "stdin_stdout", "input": "10\n8097 8097 8097 14160 8097 8097 8097 8097 9062 4894\n",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTanya wants to go on a journey across the cities of Berland. There are n cities situated along the main railroad line of Berland, and these cities are numbered from 1 to n. \n\nTanya plans her journey as follows. First of... | [{"type": "stdin_stdout", "input": "10\n10 60 12 13 14 15 16 66 18 130\n", "output": "130\n"}, {"type": "stdin_stdout", "input": "10\n10 60 12 13 14 15 16 77 18 130\n", "output": "130\n"}, {"type": "stdin_stdout", "input": "9\n18 11 24 7 18 10 1 20 17\n", "output": "24\n"}, {"type": "stdin_stdout", "input": "9\n4 10 21... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nJOI Pizza sells pizza home delivery along the d-meter-long ring road that runs through the city center.\n\nJOI Pizza has n stores S1, ..., Sn on the loop line. The head office is S1. The distance from S1 to Si ... | [{"type": "stdin_stdout", "input": "8\n3\n2\n3\n2\n4\n6\n20\n4\n4\n33\n16\n15\n15\n12\n5\n8\n0", "output": "3\n15\n"}, {"type": "stdin_stdout", "input": "8\n3\n2\n3\n0\n4\n6\n20\n4\n4\n14\n14\n23\n7\n7\n11\n8\n0", "output": "3\n23\n"}, {"type": "stdin_stdout", "input": "8\n3\n2\n3\n0\n4\n6\n20\n4\n4\n17\n17\n23\n7\n7\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis task will exclusively concentrate only on the arrays where all elements equal 1 and/or 2.\n\nArray a is k-period if its length is divisible by k and there is such array b of length k, that a is represented by array b... | [{"type": "stdin_stdout", "input": "100 20\n2 2 2 1 1 2 1 2 1 2 1 1 2 2 2 2 2 1 2 1 2 2 2 2 1 2 1 2 1 1 1 1 2 2 2 2 1 2 1 1 2 2 2 2 1 2 1 2 1 2 1 1 2 1 2 2 2 1 2 2 2 2 2 2 2 2 1 2 1 1 1 1 2 2 2 2 2 1 1 2 2 1 2 2 1 2 1 2 1 2 1 1 2 2 1 2 2 1 1 1\n", "output": "13\n"}, {"type": "stdin_stdout", "input": "100 25\n2 2 1 2 2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nN hotels are located on a straight line. The coordinate of the i-th hotel (1 \\leq i \\leq N) is x_i.\nTak the traveler has the following two personal principles:\n - He never travels a distance of more than L in a single... | [{"type": "stdin_stdout", "input": "9\n1 3 6 13 15 18 19 29 31\n10\n4\n1 8\n7 3\n6 7\n8 5\n", "output": "4\n2\n1\n2\n"}, {"type": "stdin_stdout", "input": "9\n1 3 6 13 15 18 19 29 31\n10\n4\n1 8\n7 3\n6 7\n8 3", "output": "4\n2\n1\n3\n"}, {"type": "stdin_stdout", "input": "9\n1 3 6 13 23 18 19 29 31\n12\n4\n1 8\n1 5\n9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPizzaForces is Petya's favorite pizzeria. PizzaForces makes and sells pizzas of three sizes: small pizzas consist of $6$ slices, medium ones consist of $8$ slices, and large pizzas consist of $10$ slices each. Baking them... | [{"type": "stdin_stdout", "input": "6\n40\n15\n300\n1\n9999999999999999\n2\n", "output": "100\n40\n750\n15\n25000000000000000\n15\n"}, {"type": "stdin_stdout", "input": "6\n12\n15\n300\n1\n9999999999999999\n3\n", "output": "30\n40\n750\n15\n25000000000000000\n15\n"}, {"type": "stdin_stdout", "input": "6\n20\n15\n300\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nChef and his girlfriend are going to have a promenade. They are walking along the straight road which consists of segments placed one by one. Before walking Chef and his girlfriend stay at the beginning of the first segme... | [{"type": "stdin_stdout", "input": "2\n5\n11 11 1 4 -1\n5\n6 4 15 0 1", "output": "12\n17\n"}, {"type": "stdin_stdout", "input": "2\n5\n6 15 1 4 -3\n5\n12 4 15 0 1", "output": "16\n17\n"}, {"type": "stdin_stdout", "input": "2\n5\n6 15 1 4 -4\n5\n12 4 28 0 1", "output": "16\n30\n"}, {"type": "stdin_stdout", "input": "2\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHaving watched the last Harry Potter film, little Gerald also decided to practice magic. He found in his father's magical book a spell that turns any number in the sum of its digits. At the moment Gerald learned that, he ... | [{"type": "stdin_stdout", "input": "156161456146164104103460452045416165146141414651641564105461465156445621465146514562146145465165145145614561465145614561\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "1035582652791945409199994791047369985911446143541282263853565235001365759340472951643698773718261928078951... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n-----Input-----\n\nThe input contains a single integer a (10 ≤ a ≤ 999).\n\n\n-----Output-----\n\nOutput 0 or 1.\n\n\n-----Examples-----\nInput\n13\n\nOutput\n1\n\nInput\n927\n\nOutput\n1\n\nInput\n48\n\nOutput\n0\n\nThe ... | [{"type": "stdin_stdout", "input": "927\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "999\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "142\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "309\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "572\n", "output": "0\n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNatasha travels around Mars in the Mars rover. But suddenly it broke down, namely — the logical scheme inside it. The scheme is an undirected tree (connected acyclic graph) with a root in the vertex $1$, in which every le... | [{"type": "stdin_stdout", "input": "60\nAND 20 4\nNOT 42\nAND 48 59\nOR 17 7\nIN 0\nAND 36 37\nIN 1\nIN 0\nIN 1\nNOT 47\nAND 52 49\nOR 44 35\nIN 0\nIN 1\nAND 33 56\nIN 0\nIN 0\nIN 0\nAND 31 41\nOR 15 3\nOR 43 46\nIN 1\nXOR 22 28\nIN 1\nIN 1\nIN 1\nAND 34 21\nIN 0\nIN 1\nIN 0\nXOR 51 23\nXOR 10 54\nOR 57 40\nIN 0\nNOT 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt is known that passages in Singer house are complex and intertwined. Let's define a Singer k-house as a graph built by the following process: take complete binary tree of height k and add edges from each vertex to all i... | [{"type": "stdin_stdout", "input": "181\n", "output": "421742777\n"}, {"type": "stdin_stdout", "input": "261\n", "output": "952127278\n"}, {"type": "stdin_stdout", "input": "121\n", "output": "631667314\n"}, {"type": "stdin_stdout", "input": "351\n", "output": "625447969\n"}, {"type": "stdin_stdout", "input": "141\n", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis morning, Roman woke up and opened the browser with $n$ opened tabs numbered from $1$ to $n$. There are two kinds of tabs: those with the information required for the test and those with social network sites. Roman de... | [{"type": "stdin_stdout", "input": "100 47\n-1 1 -1 -1 -1 -1 -1 1 -1 -1 -1 1 -1 1 1 1 1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 1 -1 -1 1 1 -1 -1 -1 1 1 -1 1 -1 1 1 -1 -1 -1 -1 1 1 1 -1 -1 1 -1 -1 -1 1 1 -1 -1 1 1 -1 1 -1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 -1 1 -1 1 1 1 1 1 1 -1 1 1 -1 1 -1 -1 -1 1 -1 -1 1 1 -1 -1 1 -1\n", "output": "19\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne particularly well-known fact about zombies is that they move and think terribly slowly. While we still don't know why their movements are so sluggish, the problem of laggy thinking has been recently resolved. It turns... | [{"type": "stdin_stdout", "input": "10 9\n2 3\n6 8\n10 1\n1 8\n6 7\n8 7\n10 5\n7 10\n2 5\n", "output": "no\n"}, {"type": "stdin_stdout", "input": "10 9\n2 3\n6 8\n10 1\n1 8\n6 7\n8 7\n10 5\n7 10\n2 5\n", "output": "no\n"}, {"type": "stdin_stdout", "input": "10 9\n2 3\n6 8\n10 1\n1 8\n6 7\n8 7\n10 5\n7 10\n2 2\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHooray! Berl II, the king of Berland is making a knight tournament. The king has already sent the message to all knights in the kingdom and they in turn agreed to participate in this grand event.\n\nAs for you, you're jus... | [{"type": "stdin_stdout", "input": "11 8\n3 5 5\n8 9 9\n4 6 6\n8 10 10\n5 7 7\n2 7 2\n10 11 11\n1 11 1\n", "output": "0 1 5 5 6 7 2 9 10 11 1 \n"}, {"type": "stdin_stdout", "input": "11 7\n7 8 8\n5 6 5\n1 3 3\n7 9 9\n5 10 10\n10 11 11\n1 11 4\n", "output": "3 3 4 0 10 5 8 9 10 11 4 \n"}, {"type": "stdin_stdout", "input... | 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 use the Amidakuji to improve luck by gaining the ability to rea... | [{"type": "stdin_stdout", "input": "10 22 1 0 4\n1 -1\n59 3", "output": "0.834647\n"}, {"type": "stdin_stdout", "input": "15 17 5 0 1\n1 1\n-1 3", "output": "0.875000\n"}, {"type": "stdin_stdout", "input": "15 22 3 0 1\n0 0\n-1 1", "output": "0.904762\n"}, {"type": "stdin_stdout", "input": "14 22 1 0 1\n0 1\n41 3", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNew Year is coming in Line World! In this world, there are n cells numbered by integers from 1 to n, as a 1 × n board. People live in cells. However, it was hard to move between distinct cells, because of the difficulty o... | [{"type": "stdin_stdout", "input": "120 104\n41 15 95 85 34 11 25 42 65 39 77 80 74 17 66 73 21 14 36 63 63 79 45 24 65 7 63 80 51 21 2 19 78 28 71 2 15 23 17 68 62 18 54 39 43 70 3 46 34 23 41 65 32 10 13 18 10 3 16 48 54 18 57 28 3 24 44 50 15 2 20 22 45 44 3 29 2 27 11 2 12 25 25 31 1 2 32 4 11 30 13 16 26 21 1 13 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nStudents love to celebrate their holidays. Especially if the holiday is the day of the end of exams!\n\nDespite the fact that Igor K., unlike his groupmates, failed to pass a programming test, he decided to invite them to... | [{"type": "stdin_stdout", "input": "50 1000 49\n", "output": "YES\n1 1000.000000 2 20.408163 \n2 979.591837 3 40.816327 \n3 959.183673 4 61.224490 \n4 938.775510 5 81.632653 \n5 918.367347 6 102.040816 \n6 897.959184 7 122.448980 \n7 877.551020 8 142.857143 \n8 857.142857 9 163.265306 \n9 836.734694 10 183.673469 \n10 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n5\n\n\nOutput\n\n5\n\nThe input will be stdin and you should print your solution to stdout\n\n\nNow solve the problem and return the code.\n\nWrite Python code to solve this problem. Your program shoul... | [{"type": "stdin_stdout", "input": "304", "output": "10816520\n"}, {"type": "stdin_stdout", "input": "309", "output": "17426472\n"}, {"type": "stdin_stdout", "input": "352", "output": "45765225\n"}, {"type": "stdin_stdout", "input": "227", "output": "1542687\n"}, {"type": "stdin_stdout", "input": "280", "output": "6677... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTavas is a strange creature. Usually \"zzz\" comes out of people's mouth while sleeping, but string s of length n comes out from Tavas' mouth instead. [Image] \n\nToday Tavas fell asleep in Malekas' place. While he was sl... | [{"type": "stdin_stdout", "input": "173700 6\nbcabcbcbcbaaacaccaacaccaabacabaacbcacbbccaccbcacbabcaccccccaacacabbbbbacabbaaacbcbbaccaccabbbbaabbacacbabccaabcabbbcacaaccbabbcaaaaaabccbbcabcacbcbcabcbcbbaabacaaccccabacaaaccacaaabbacacabbcccacbaabcacacbbaaaccaccbaccccccbccaabcacaacabaccababacabcccbcbbacbabacbcbabacbbaccaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer sequence of length N, a = {a_1, a_2, …, a_N}, and an integer K.\n\na has N(N+1)/2 non-empty contiguous subsequences, {a_l, a_{l+1}, …, a_r} (1 ≤ l ≤ r ≤ N). Among them, how many have an arithmetic... | [{"type": "stdin_stdout", "input": "7 26\n10\n20\n30\n43\n30\n20\n10", "output": "13\n"}, {"type": "stdin_stdout", "input": "1 26\n10\n20\n30\n43\n30\n20\n10", "output": "0\n"}, {"type": "stdin_stdout", "input": "1 26\n10\n20\n30\n12\n30\n20\n12", "output": "0\n"}, {"type": "stdin_stdout", "input": "1 26\n10\n20\n27\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp loves ciphers. He has invented his own cipher called Right-Left.\n\nRight-Left cipher is used for strings. To encrypt the string $s=s_{1}s_{2} \\dots s_{n}$ Polycarp uses the following algorithm: he writes down ... | [{"type": "stdin_stdout", "input": "qwertyuioasdfghjklrtyuiodfghjklqwertyuioasdfssddxb\n", "output": "dfogihujyktlrqlwkejrhtgyfudisoaaosidufystsrdedwxqb\n"}, {"type": "stdin_stdout", "input": "qwertyuioasdfghjklrtyuiodfghjklqwertyuioasdfssddxb\n", "output": "dfogihujyktlrqlwkejrhtgyfudisoaaosidufystsrdedwxqb\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is an integer N. Snuke will choose integers s_1, s_2, n_1, n_2, u_1, u_2, k_1, k_2, e_1, and e_2 so that all of the following six conditions will be satisfied:\n\n* 0 \\leq s_1 < s_2\n* 0 \\leq n_1 < n_2\n* 0 \\leq ... | [{"type": "stdin_stdout", "input": "4\n33\n1\n28\n0111010001", "output": "996765147\n0\n399637805\n501963061\n"}, {"type": "stdin_stdout", "input": "4\n33\n1\n28\n0111110001", "output": "996765147\n0\n399637805\n744953502\n"}, {"type": "stdin_stdout", "input": "4\n24\n2\n30\n0110110001", "output": "192839398\n0\n434820... | 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 2314 1234 5000\n", "output": "546628648\n"}, {"type": "stdin_stdout", "input": "4988 3629 4106 4488\n", "output": "349016655\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\nPolycarp has built his own web service. Being a modern web service it includes login feature. And that always implies password security problems.\n\nPolycarp decided to store the hash of the password, generated by the fol... | [{"type": "stdin_stdout", "input": "5\nabacaba\nzyxaabcaabkjh\nonetwothree\nthreetwoone\none\nzzonneyy\none\nnone\ntwenty\nten\n", "output": "YES\nYES\nNO\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "5\nabacaba\nzyxaabcaabkjh\nonetwothree\nthreetwoone\none\nzzonneyy\neno\nnone\ntwenty\nten\n", "output": "YES\nYES\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRoma is playing a new expansion for his favorite game World of Darkraft. He made a new character and is going for his first grind.\n\nRoma has a choice to buy exactly one of n different weapons and exactly one of m differ... | [{"type": "stdin_stdout", "input": "10 10 10\n51 87\n68 600\n82 1284\n33 936\n55 242\n89 1990\n58 357\n66 666\n62 512\n51 87\n92 1670\n56 280\n56 280\n91 1631\n77 1091\n89 1554\n61 473\n98 1901\n77 1091\n77 1091\n86 15 759\n43 58 386\n68 33 386\n39 62 386\n95 6 386\n74 27 386\n94 7 386\n17 36 386\n105 4 386\n45 56 386\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTanya wants to go on a journey across the cities of Berland. There are $n$ cities situated along the main railroad line of Berland, and these cities are numbered from $1$ to $n$.\n\nTanya plans her journey as follows. Fir... | [{"type": "stdin_stdout", "input": "10\n10 60 12 13 14 15 16 66 18 130\n", "output": "130\n"}, {"type": "stdin_stdout", "input": "10\n10 60 12 13 14 15 16 66 18 130\n", "output": "130\n"}, {"type": "stdin_stdout", "input": "10\n8 60 12 13 14 15 16 66 18 130\n", "output": "130\n"}, {"type": "stdin_stdout", "input": "9\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer sequence A of length N.\nFind the maximum absolute difference of two elements (with different indices) in A.\n\n-----Constraints-----\n - 2 \\leq N \\leq 100\n - 1 \\leq A_i \\leq 10^9\n - All val... | [{"type": "stdin_stdout", "input": "100\n3142445 16266949 17493698 35569790 80507149 98771888 109205766 111818374 116565925 119183522 141425056 157086378 180302992 187469083 216070266 233105051 257048184 265553444 273526101 281450237 289171706 301768399 311455945 319497119 326729809 338683702 339701654 346802542 353453... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn the Internet, data is divided into packets, and each packet is transferred to a destination via a relay device called a router. Each router determines the next router to forward from the destination described in the pa... | [{"type": "stdin_stdout", "input": "7\n1 4 2 5 5 3\n2 1 5\n3 1 6\n4 1 7\n5 2 7 6\n6 1 2\n7 0\n6\n1 2 0\n1 5 0\n1 2 0\n5 1 3\n6 3 0\n1 7 4", "output": "NA\nNA\nNA\nNA\nNA\n3\n"}, {"type": "stdin_stdout", "input": "7\n1 4 2 5 4 3\n2 1 5\n3 1 6\n4 1 7\n5 2 7 6\n6 1 1\n7 0\n6\n1 2 1\n1 3 6\n1 2 0\n5 2 3\n6 3 0\n3 7 4", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhen registering in a social network, users are allowed to create their own convenient login to make it easier to share contacts, print it on business cards, etc.\n\nLogin is an arbitrary sequence of lower and uppercase l... | [{"type": "stdin_stdout", "input": "ELioO1lOoOIOiLoooi1iolul1O\n7\nOoEIuOIl1ui1010uiooOoi0Oio001L0EoEolO0\nOLIoOEuoE11u1u1iLOI0oO\nuEOuO0uIOOlO01OlEI0E1Oo0IO1LI0uE0LILO0\nEOo0Il11iIOOOIiuOiIiiLOLEOOII001EE\niOoO0LOulioE0OLIIIulli01OoiuOOOoOlEiI0EiiElIIu0\nlE1LOE1Oil\n1u0EOliIiIOl1u110il0l1O0u\n", "output": "Yes\n"}, {"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nI have n tickets for a train with a rabbit. Each ticket is numbered from 0 to n − 1, and you can use the k ticket to go to p⋅ak + q⋅bk station.\n\nRabbit wants to go to the all-you-can-eat carrot shop at the station m sta... | [{"type": "stdin_stdout", "input": "6 279 2 5 26 14", "output": "117\n"}, {"type": "stdin_stdout", "input": "17 256 2 3 10 9", "output": "67\n"}, {"type": "stdin_stdout", "input": "6 323 2 12 8 9", "output": "182\n"}, {"type": "stdin_stdout", "input": "6 279 2 5 46 14", "output": "57\n"}, {"type": "stdin_stdout", "inpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNoora is a student of one famous high school. It's her final year in school — she is going to study in university next year. However, she has to get an «A» graduation certificate in order to apply to a prestigious one.\n\... | [{"type": "stdin_stdout", "input": "100 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... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAssume there is an Ideal Random Number Generator which generates any real number between 0 and given integer. Two numbers are generated from the above generator using integer A and B, let's assume the numbers generated ar... | [{"type": "stdin_stdout", "input": "10 4 15", "output": "79/80"}, {"type": "stdin_stdout", "input": "12 2 6", "output": "1/12"}, {"type": "stdin_stdout", "input": "12 2 6", "output": "5/12"}, {"type": "stdin_stdout", "input": "10 4 13", "output": "1/2"}, {"type": "stdin_stdout", "input": "3 2 1", "output": "5/12"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob are playing a game on a matrix, consisting of $2$ rows and $m$ columns. The cell in the $i$-th row in the $j$-th column contains $a_{i, j}$ coins in it.\n\nInitially, both Alice and Bob are standing in a cel... | [{"type": "stdin_stdout", "input": "3\n3\n2 3 12\n2 10 0\n3\n-1 4 17\n3 9 0\n1\n4\n3\n", "output": "12\n12\n0\n"}, {"type": "stdin_stdout", "input": "3\n3\n2 3 12\n2 10 1\n3\n-1 4 17\n2 9 0\n1\n4\n3\n", "output": "12\n11\n0\n"}, {"type": "stdin_stdout", "input": "3\n3\n2 3 12\n2 10 2\n3\n-1 4 17\n3 5 0\n1\n4\n3\n", "ou... | 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. \nNim is a well-known combinatorial game, based on removing stones from piles. In this problem, we'll deal with a similar game, which we'll cal... | [{"type": "stdin_stdout", "input": "3\n4\n1 2 4 12\n3\n2 3 3\n5\n1 3 3 3 3", "output": "First\nSecond\nSecond\n"}, {"type": "stdin_stdout", "input": "3\n4\n1 2 4 12\n3\n1 3 3\n5\n1 3 3 3 3", "output": "First\nSecond\nSecond\n"}, {"type": "stdin_stdout", "input": "3\n4\n1 2 8 13\n3\n3 1 3\n5\n1 3 1 3 3", "output": "Firs... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCosmic market, commonly known as Kozumike, is the largest coterie spot sale in the universe. Doujin lovers of all genres gather at Kozumike. In recent years, the number of visitors to Kozumike has been increasing. If ever... | [{"type": "stdin_stdout", "input": "5 5 4\n0 0 1\n0 0 0\n0 2 0\n1 1 1\n1 0 0\n5 5 5\n1 4 0\n0 1 1\n0 4 1\n1 3 0\n0 3 1\n5 5 5\n1 0 0\n0 3 1\n1 2 1\n0 4 0\n1 1 1\n0 0 0", "output": "5\n0\n13\n12\n"}, {"type": "stdin_stdout", "input": "5 14 5\n2 0 2\n0 0 0\n0 0 1\n1 2 1\n1 0 0\n5 5 5\n1 4 1\n0 1 1\n1 1 1\n1 3 0\n1 3 0\n5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two arrays of integers $a_1, a_2, \\ldots, a_n$ and $b_1, b_2, \\ldots, b_n$.\n\nLet's define a transformation of the array $a$:\n\nChoose any non-negative integer $k$ such that $0 \\le k \\le n$.\n\nChoose ... | [{"type": "stdin_stdout", "input": "2\n10\n3 3 2 2 3 2 1 1 2 3\n3 3 2 1 2 3 2 3 1 1\n10\n1 1 3 1 2 2 1 3 3 3\n3 1 3 1 1 2 3 2 2 1\n", "output": "NO\nNO\n"}, {"type": "stdin_stdout", "input": "1\n10\n14 -91 -52 -82 -4 69 33 3 -46 81\n-45 15 -4 82 33 3 -90 -81 -51 69\n", "output": "YES\n"}, {"type": "stdin_stdout", "inpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor given three points p1, p2, p, find the reflection point x of p onto p1p2.\n\n<image>\n\nConstraints\n\n* 1 ≤ q ≤ 1000\n* -10000 ≤ xi, yi ≤ 10000\n* p1 and p2 are not identical.\n\nInput\n\n\nxp1 yp1 xp2 yp2\nq\nxp0 yp... | [{"type": "stdin_stdout", "input": "0 0 3 -1\n3\n0 1\n4 20\n-1 2", "output": "-0.600000000 -0.800000000\n-8.800000000 -18.400000000\n-2.000000000 -1.000000000\n"}, {"type": "stdin_stdout", "input": "0 0 2 0\n3\n-1 1\n0 1\n1 1", "output": "-1.0000000000 -1.0000000000\n0.0000000000 -1.0000000000\n1.0000000000 -1.00000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nUjan has a lot of useless stuff in his drawers, a considerable part of which are his math notebooks: it is time to sort them out. This time he found an old dusty graph theory notebook with a description of a graph.\n\nIt ... | [{"type": "stdin_stdout", "input": "15 10\n2 3\n5 4\n5 6\n5 7\n3 8\n3 10\n11 12\n12 13\n13 14\n14 15\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "15 10\n2 3\n5 4\n5 6\n5 7\n3 8\n3 10\n11 12\n12 13\n13 14\n14 15\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "15 10\n2 3\n5 4\n5 4\n5 7\n3 8\n3 10\n11... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle X used to play a card game called \"24 Game\", but recently he has found it too easy. So he invented a new game.\n\nInitially you have a sequence of n integers: 1, 2, ..., n. In a single step, you can pick two of t... | [{"type": "stdin_stdout", "input": "1000\n", "output": "YES\n1 * 2 = 2\n2 * 3 = 6\n6 * 4 = 24\n6 - 5 = 1\n24 * 1 = 24\n8 - 7 = 1\n24 * 1 = 24\n10 - 9 = 1\n24 * 1 = 24\n12 - 11 = 1\n24 * 1 = 24\n14 - 13 = 1\n24 * 1 = 24\n16 - 15 = 1\n24 * 1 = 24\n18 - 17 = 1\n24 * 1 = 24\n20 - 19 = 1\n24 * 1 = 24\n22 - 21 = 1\n24 * 1 = ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office.\n\nAll children love to cry loudly at the reception at the dentist. We enumerate th... | [{"type": "stdin_stdout", "input": "10\n9 8 8\n2 9 33\n10 7 42\n7 2 18\n3 5 82\n9 9 25\n3 2 86\n3 5 49\n5 3 72\n4 4 71\n", "output": "10\n1 2 3 4 5 6 7 8 9 10 "}, {"type": "stdin_stdout", "input": "10\n9 8 8\n2 9 33\n10 7 42\n7 2 18\n3 5 82\n9 9 25\n3 2 86\n3 5 49\n5 3 72\n4 4 71\n", "output": "10\n1 2 3 4 5 6 7 8 9 10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nImp likes his plush toy a lot.\n\n [Image] \n\nRecently, he found a machine that can clone plush toys. Imp knows that if he applies the machine to an original toy, he additionally gets one more original toy and one copy, ... | [{"type": "stdin_stdout", "input": "1000000000 999999999\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "1000000000 999999999\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000\n", "output": "No\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.\n\nThe pasture i... | [{"type": "stdin_stdout", "input": "10 10\n....W.W.W.\n.........S\n.S.S...S..\nW.......SS\n.W..W.....\n.W...W....\nS..S...S.S\n....W...S.\n..S..S.S.S\nSS.......S\n", "output": "Yes\nDDDDWDWDWD\nDDDDDDDDDS\nDSDSDDDSDD\nWDDDDDDDSS\nDWDDWDDDDD\nDWDDDWDDDD\nSDDSDDDSDS\nDDDDWDDDSD\nDDSDDSDSDS\nSSDDDDDDDS\n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nZS the Coder is coding on a crazy computer. If you don't type in a word for a c consecutive seconds, everything you typed disappear! \n\nMore formally, if you typed a word at second a and then the next word at second b, t... | [{"type": "stdin_stdout", "input": "2 1000000000\n1 1000000000\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "2 1000000000\n1 1000000000\n", "output": "2"}, {"type": "stdin_stdout", "input": "6 5\n1 5 8 14 19 20\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "5 10\n-1 1 22 32 34\n", "output": "3\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a long-established secondhand bookstore called JOI secondhand bookstore in your town, and you often use the JOI secondhand bookstore. Each book has a standard price, and you can buy it at that price if you go to ... | [{"type": "stdin_stdout", "input": "7 7\n4 1\n13 2\n18 3\n64 3\n13 2\n16 10\n11 2", "output": "147\n"}, {"type": "stdin_stdout", "input": "7 7\n4 1\n13 2\n12 3\n48 3\n8 2\n16 10\n11 2", "output": "120\n"}, {"type": "stdin_stdout", "input": "7 5\n4 1\n13 3\n12 3\n48 3\n8 3\n16 10\n11 2", "output": "109\n"}, {"type": "st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA monster is attacking the Cyberland!\n\nMaster Yang, a braver, is going to beat the monster. Yang and the monster each have 3 attributes: hitpoints (HP), offensive power (ATK) and defensive power (DEF).\n\nDuring the bat... | [{"type": "stdin_stdout", "input": "100 100 100\n100 100 100\n100 100 100\n", "output": "100"}, {"type": "stdin_stdout", "input": "50 100 51\n100 100 100\n1 100 100\n", "output": "1384"}, {"type": "stdin_stdout", "input": "100 100 1\n100 100 100\n1 100 100\n", "output": "1891"}, {"type": "stdin_stdout", "input": "1 1 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVladik is a competitive programmer. This year he is going to win the International Olympiad in Informatics. But it is not as easy as it sounds: the question Vladik face now is to find the cheapest way to get to the olympi... | [{"type": "stdin_stdout", "input": "16 4 12\n0000000011111111\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "16 1 12\n0000000011111111\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "16 1 12\n0100000011111111\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "16 2 12\n0100000011111111\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn old document says that a Ninja House in Kanazawa City was in fact a defensive fortress, which was designed like a maze. Its rooms were connected by hidden doors in a complicated manner, so that any invader would become... | [{"type": "stdin_stdout", "input": "2\n3 3 3 3 -3 3 2 -5 3 2 -5 -3 0\n3 5 3 -2 4 -3 -2 -2 -1 0", "output": "1 2 4 6\n2 1 3 8\n3 2 4 7\n4 1 3 5\n5 4 6 7\n6 1 5\n7 3 5 8\n8 2 7\n1 2 2 3 4\n2 1 1 3 4 4\n3 1 2 4\n4 1 2 2 3\n"}, {"type": "stdin_stdout", "input": "2\n3 3 3 3 -3 3 2 -5 3 2 -5 -3 0\n3 5 4 -2 4 -1 -2 -2 -1 0", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAnton and Dasha like to play different games during breaks on checkered paper. By the 11th grade they managed to play all the games of this type and asked Vova the programmer to come up with a new game. Vova suggested to ... | [{"type": "stdin_stdout", "input": "12 -11 20 200\n11 189\n12 108\n19 190\n21 27\n24 193\n26 86\n26 123\n31 180\n39 196\n107 193\n122 46\n129 103\n131 129\n132 135\n142 51\n157 22\n161 27\n195 163\n198 55\n199 64\n", "output": "Anton\n"}, {"type": "stdin_stdout", "input": "12 -11 20 200\n11 189\n12 108\n19 190\n42 27\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nЗавтра у хоккейной команды, которой руководит Евгений, важный матч. Евгению нужно выбрать шесть игроков, которые выйдут на лед в стартовом составе: один вратарь, два защитника и три нападающих.\n\nТак как это стартовый со... | [{"type": "stdin_stdout", "input": "29 42 50\n605 254 369 842 889 103 937 235 135 698 482 883 738 467 848 70 1000 129 970 58 94 873 140 363 133 913 834 727 185\n17 676 703 245 149 296 800 106 153 111 285 382 12 704 830 664 30 533 604 380 469 155 216 466 36 347 270 170 10 349 86 5 164 599 517 593 373 461 908 34 569 573\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn order to pass the entrance examination tomorrow, Taro has to study for T more hours.\nFortunately, he can leap to World B where time passes X times as fast as it does in our world (World A).\nWhile (X \\times t) hours ... | [{"type": "stdin_stdout", "input": "-1 011", "output": "-0.0909090909091\n"}, {"type": "stdin_stdout", "input": "1 106", "output": "0.00943396226415\n"}, {"type": "stdin_stdout", "input": "100 1\n", "output": "100.0000000000\n"}, {"type": "stdin_stdout", "input": "1 011", "output": "0.0909090909091\n"}, {"type": "stdin... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.