messages
listlengths
1
1
ground_truth
stringlengths
88
726k
dataset
stringclasses
2 values
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe well-known Fibonacci sequence F_0, F_1, F_2,… is defined as follows: \n\n * F_0 = 0, F_1 = 1. \n * For each i β‰₯ 2: F_i = F_{i - 1} + F_{i - 2}. \n\n\n\nGiven an increasing arithmetic sequence of positive integers w...
[{"type": "stdin_stdout", "input": "1 123456 961946\n", "output": "11954016000000000001 3158031000000000000\n"}, {"type": "stdin_stdout", "input": "10000 154768 13\n", "output": "11015448000000000001 9428455500000000000\n"}, {"type": "stdin_stdout", "input": "0 123456 961946\n", "output": "11954016000000000001 31580310...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis problem is different with hard version only by constraints on total answers length\n\nIt is an interactive problem\n\nVenya joined a tour to the madhouse, in which orderlies play with patients the following game. Ord...
[{"type": "stdin_stdout", "input": "100\nssssssssssssssssssssssssssssssssssssssssssssssssssoooooooooooooooooooooooooooooooooooooooooooooooooo\n", "output": "? 1 50\n? 2 50\n? 1 100\n! \n"}, {"type": "stdin_stdout", "input": "100\nqvynouyqhasgfxwavprvmnfpqkzrqtyxpxqgzbfftxvzwsvbdlknukhgexhgbtnlhynwoivkyuvjtkfmlfidqtetef...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nINTERCAL is the oldest of esoteric programming languages. One of its many weird features is the method of character-based output, known as Turing Tape method. It converts an array of unsigned 8-bit integers into a sequenc...
[{"type": "stdin_stdout", "input": "aMCT]:0hDJ*Up5g_l:O&>>%gjQkZkb(mi&;\\7dL\"nWOGz/;,6h*@Q0R53MS2<}F~+Ms\\\"cF-lgF0>C&y7)72\\.T\"8*#VO=|^OtYs\n", "output": "122\n212\n240\n152\n112\n94\n80\n246\n244\n208\n254\n170\n156\n98\n198\n236\n196\n218\n106\n142\n232\n0\n216\n190\n144\n204\n180\n124\n132\n144\n50\n94\n32\n50\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Petya very much likes rectangles and especially squares. Recently he has received 8 points on the plane as a gift from his mother. The points are pairwise distinct. Petya decided to split them into two sets each co...
[{"type": "stdin_stdout", "input": "-841 -205\n590 -205\n-1000 -1000\n-364 1385\n-682 113\n-841 -1000\n-1000 -205\n908 1067\n", "output": "YES\n2 4 5 8\n1 3 6 7\n"}, {"type": "stdin_stdout", "input": "400 -580\n-580 -895\n-475 -720\n-580 -1000\n-405 -1000\n-20 400\n-300 -825\n-1000 -20\n", "output": "YES\n1 4 6 8 \n2 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOmkar is playing his favorite pixelated video game, Bed Wars! In Bed Wars, there are n players arranged in a circle, so that for all j such that 2 ≀ j ≀ n, player j - 1 is to the left of the player j, and player j is to t...
[{"type": "stdin_stdout", "input": "5\n4\nRLRL\n6\nLRRRRL\n8\nRLLRRRLL\n12\nLLLLRRLRRRLL\n5\nRRRRR\n", "output": "0\n1\n1\n3\n2\n"}, {"type": "stdin_stdout", "input": "5\n4\nRLRL\n6\nLRRRRL\n8\nRLLRRRLL\n12\nLLRRRLRRLLLL\n5\nRRRRR\n", "output": "0\n1\n1\n3\n2\n"}, {"type": "stdin_stdout", "input": "5\n4\nRLRL\n6\nRRRLR...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day, n people (n is an even number) met on a plaza and made two round dances, each round dance consists of exactly n/2 people. Your task is to find the number of ways n people can make two round dances if each round d...
[{"type": "stdin_stdout", "input": "20\n", "output": "12164510040883200\n"}, {"type": "stdin_stdout", "input": "18\n", "output": "39520825344000\n"}, {"type": "stdin_stdout", "input": "16\n", "output": "163459296000\n"}, {"type": "stdin_stdout", "input": "14\n", "output": "889574400\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis is the easy version of the problem. The difference between the versions is the constraints on a_i. You can make hacks only if all versions of the problem are solved.\n\nLittle Dormi has recently received a puzzle fro...
[{"type": "stdin_stdout", "input": "5 7\n#....#.\n.#.#...\n#....#.\n#....##\n#.#....\n4 1 1 1 0 3 1\n", "output": "\n3\n"}, {"type": "stdin_stdout", "input": "3 10\n#..###..##\n...#..###.\n.###..##..\n1 1 1 3 1 1 2 2 2 1\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "3 6\n..#..#\n......\n#####.\n1 1 2 1 1 1\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's consider one interesting word game. In this game you should transform one word into another through special operations. \n\nLet's say we have word w, let's split this word into two non-empty parts x and y so, that w...
[{"type": "stdin_stdout", "input": "dkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjij\ndddkikjjidkkidijjjjkkjjikjdikiidijjikikjijjiijdikkjjjiddjjijkkkjkiijijki...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Little Elephant loves Ukraine very much. Most of all he loves town Rozdol (ukr. \"Rozdil\").\n\nHowever, Rozdil is dangerous to settle, so the Little Elephant wants to go to some other town. The Little Elephant doesn'...
[{"type": "stdin_stdout", "input": "100\n922 938 103 689 526 118 314 496 373 47 224 544 495 656 804 754 269 356 354 536 817 597 787 178 516 659 790 993 786 169 866 779 997 350 674 310 219 546 564 893 402 449 751 628 329 686 392 951 716 439 332 563 215 146 746 311 866 773 548 1100 731 183 890 802 488 944 473 25 662 559 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVitaly is a very weird man. He's got two favorite digits a and b. Vitaly calls a positive integer good, if the decimal representation of this integer only contains digits a and b. Vitaly calls a good number excellent, if ...
[{"type": "stdin_stdout", "input": "1 2 1000000\n", "output": "786609214\n"}, {"type": "stdin_stdout", "input": "8 9 1000000\n", "output": "573697309\n"}, {"type": "stdin_stdout", "input": "3 6 1000000\n", "output": "786609214\n"}, {"type": "stdin_stdout", "input": "8 9 111111\n", "output": "900401372\n"}, {"type": "st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIgor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to Tanya's house. Igor thinks that the larger the number is, the more chance to win Tanya's heart he has. \n...
[{"type": "stdin_stdout", "input": "62800\n867 936 2 888 474 530 287 1101 220\n", "output": "33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA festival will be held in a town's main street. There are n sections in the main street. The sections are numbered 1 through n from left to right. The distance between each adjacent sections is 1.\n\nIn the festival m fi...
[{"type": "stdin_stdout", "input": "100 20 5\n47 93 3\n61 49 10\n14 69 10\n88 2 14\n35 86 18\n63 16 20\n39 49 22\n32 45 23\n66 54 25\n77 2 36\n96 85 38\n33 28 45\n29 78 53\n78 13 60\n58 96 64\n74 39 71\n18 80 80\n18 7 85\n97 82 96\n74 99 97\n", "output": " 877...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe finalists of the \"Russian Code Cup\" competition in 2214 will be the participants who win in one of the elimination rounds.\n\nThe elimination rounds are divided into main and additional. Each of the main elimination...
[{"type": "stdin_stdout", "input": "100 100\n100 100\n100\n", "output": "9900\n"}, {"type": "stdin_stdout", "input": "10 100\n100 100\n99\n", "output": "1000\n"}, {"type": "stdin_stdout", "input": "100 2\n50 100\n0\n", "output": "10000\n"}, {"type": "stdin_stdout", "input": "19 76\n91 91\n87\n", "output": "1729\n"}, {"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAndrey needs one more problem to conduct a programming contest. He has n friends who are always willing to help. He can ask some of them to come up with a contest problem. Andrey knows one value for each of his fiends β€” t...
[{"type": "stdin_stdout", "input": "100\n0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.2116826272545882 0.3214958859186292 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTomash keeps wandering off and getting lost while he is walking along the streets of Berland. It's no surprise! In his home town, for any pair of intersections there is exactly one way to walk from one intersection to the...
[{"type": "stdin_stdout", "input": "8 56\n1 2\n1 3\n1 4\n1 5\n1 6\n1 7\n1 8\n2 1\n2 3\n2 4\n2 5\n2 6\n2 7\n2 8\n3 1\n3 2\n3 4\n3 5\n3 6\n3 7\n3 8\n4 1\n4 2\n4 3\n4 5\n4 6\n4 7\n4 8\n5 1\n5 2\n5 3\n5 4\n5 6\n5 7\n5 8\n6 1\n6 2\n6 3\n6 4\n6 5\n6 7\n6 8\n7 1\n7 2\n7 3\n7 4\n7 5\n7 6\n7 8\n8 1\n8 2\n8 3\n8 4\n8 5\n8 6\n8 7...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIgor has been into chess for a long time and now he is sick of the game by the ordinary rules. He is going to think of new rules of the game and become world famous.\n\nIgor's chessboard is a square of size n Γ— n cells. I...
[{"type": "stdin_stdout", "input": "13\n.............\n.....o.......\n......o......\n.............\n...o........o\no............\n.............\n..o..........\n..........ooo\n.............\n..o...o.....o\n.............\n.o........o..\n", "output": "YES\nxx......................x\nxx.....x........x.......x\n...............
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Cereal Guy's friend Serial Guy likes to watch soap operas. An episode is about to start, and he hasn't washed his plate yet. But he decided to at least put in under the tap to be filled with water. The plate can be re...
[{"type": "stdin_stdout", "input": "4 10 10\n\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n\n..........\n..........\n........
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBecause of budget cuts one IT company established new non-financial reward system instead of bonuses.\n\nTwo kinds of actions are rewarded: fixing critical bugs and suggesting new interesting features. A man who fixed a c...
[{"type": "stdin_stdout", "input": "444\n", "output": "2159776046970635520\n"}, {"type": "stdin_stdout", "input": "500\n", "output": "5567867859752100000"}, {"type": "stdin_stdout", "input": "498\n", "output": "5392730685240975000"}, {"type": "stdin_stdout", "input": "308\n", "output": "117307091246785440\n"}, {"type":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLimak is a little polar bear. He doesn't have many toys and thus he often plays with polynomials.\n\nHe considers a polynomial valid if its degree is n and its coefficients are integers not exceeding k by the absolute val...
[{"type": "stdin_stdout", "input": "100 1000\n-62 57 -27 -67 49 -10 66 -64 -36 -78 62 -75 -39 75 -47 -36 41 -88 62 -43 22 29 -20 58 40 16 71 -2 -87 12 86 -90 -92 67 -12 -48 -10 -26 78 68 22 -3 66 -95 -81 34 14 -76 -27 76 -60 87 -84 3 35 -60 46 -65 29 -29 2 -44 -55 18 -75 91 36 34 -86 53 59 -54 -29 33 -95 66 9 72 67 -44...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCodeforces user' handle color depends on his rating β€” it is red if his rating is greater or equal to 2400; it is orange if his rating is less than 2400 but greater or equal to 2200, etc. Each time participant takes part i...
[{"type": "stdin_stdout", "input": "9\nmwAz9lQ 1786 -1631\nnYgYFXZQfY -1849 -1775\nKU4jF -1773 -3376\nopR 3752 2931\nGl -1481 -1002\nR -1111 3778\n0i9B21DC 3650 279\nQ8L2dS0 358 -3305\ng -2662 3968\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "9\nmwAz9lQ 1786 -1631\nnYgYFXZQfY -1849 -1775\nKU4jF -1773 -3376...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA rare article in the Internet is posted without a possibility to comment it. On a Polycarp's website each article has comments feed.\n\nEach comment on Polycarp's website is a non-empty string consisting of uppercase and...
[{"type": "stdin_stdout", "input": "A,3,B,2,C,0,D,1,E,0,F,1,G,0,H,1,I,1,J,0,K,1,L,0,M,2,N,0,O,1,P,0\n", "output": "4\nA K M \nB F H L N O \nC D G I P \nE J \n"}, {"type": "stdin_stdout", "input": "A,3,B,2,C,0,D,1,E,0,F,1,G,0,H,1,I,1,J,0,K,1,L,0,M,2,O,0,O,1,P,0\n", "output": "4\nA K M\nB F H L O O\nC D G I P\nE J\n"}, {...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAnton has the integer x. He is interested what positive integer, which doesn't exceed x, has the maximum sum of digits.\n\nYour task is to help Anton and to find the integer that interests him. If there are several such i...
[{"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "999999999999999999\n"}, {"type": "stdin_stdout", "input": "999000000001999999\n", "output": "998999999999999999\n"}, {"type": "stdin_stdout", "input": "199999999999999999\n", "output": "199999999999999999\n"}, {"type": "stdin_stdout", "input": "2999...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are two main kinds of events in the life of top-model: fashion shows and photo shoots. Participating in any of these events affects the rating of appropriate top-model. After each photo shoot model's rating increase...
[{"type": "stdin_stdout", "input": "10 1 1 1 2 0 10\n1 1\n2 1\n3 0\n4 0\n5 1\n6 1\n14 1\n8 1\n9 1\n10 1\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "10 1 1 1 2 0 10\n1 1\n2 1\n3 0\n4 0\n5 1\n6 1\n7 1\n8 1\n9 1\n10 1\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "10 1 1 1 2 0 10\n1 1\n2 1\n3 0\n4 0...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya writes his own library for building graphical user interface. Vasya called his creation VTK (VasyaToolKit). One of the interesting aspects of this library is that widgets are packed in each other. \n\nA widget is so...
[{"type": "stdin_stdout", "input": "20\nVBox hykl\nVBox enwv\nenwv.pack(hykl)\nVBox dlepf\ndlepf.pack(hykl)\nenwv.set_border(30)\nWidget mjrrik(54,21)\nhykl.set_border(2)\ndlepf.set_border(22)\nenwv.set_border(3)\nenwv.pack(dlepf)\ndlepf.pack(mjrrik)\nhykl.set_spacing(96)\nenwv.set_border(32)\ndlepf.set_border(72)\nWid...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string A. Find a string B, where B is a palindrome and A is a subsequence of B.\n\nA subsequence of a string is a string that can be derived from it by deleting some (not necessarily consecutive) character...
[{"type": "stdin_stdout", "input": "fggbyzobbmxtwdajawqdywnppflkkmtxzjvxopqvliwdwhzepcuiwelhbuotlkvesexnwkytonfrpqcxzzqzdvsmbsjcxxeugavekozfjlolrtqgwzqxsfgrnvrgfrqpixhsskbpzghndesvwptpvvkasfalzsetopervpwzmkgpcexqnvtnoulprwnowmsorscecvvvrjfwumcjqyrounqsgdruxttvtmrkivtxauhosokdiahsyrftzsgvgyveqwkzhqstbgywrvmsgfcfyuxpphvm...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMahmoud wants to send a message to his friend Ehab. Their language consists of n words numbered from 1 to n. Some words have the same meaning so there are k groups of words such that all the words in some group have the s...
[{"type": "stdin_stdout", "input": "5 4 4\ni loser am the second\n100 20 1 7 10\n1 1\n1 3\n2 2 5\n1 4\ni am the second\n", "output": "118\n"}, {"type": "stdin_stdout", "input": "5 4 4\ni loser am the second\n101 20 1 5 10\n1 1\n1 3\n2 2 5\n1 4\ni am the second\n", "output": "117\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOn the divine friendship day, \"A\" tied \"B\" a friendship band. But alas! Frequent quarrels started between them and \"B\" decided to remove and break off the band! The band isnt a huge one and consists of red, blue and...
[{"type": "stdin_stdout", "input": "350\nrrbbrbbbwbwwbwbbbbwwrrbbwbrwbrwbbbqbrwrwbrwwwrrbbrrwrbbrwbwrwwwrbrwwwwwrwbwwwrrbrrbbbrbrbbbrbbbrbbwbbbbbrbrrbrwwbrrrrwbwrwrbbwbwrbrbrwwbrrbwbrwwbwwwbrbwrwbwbrbbbwrbwwrrrbwbwbbbbbrrwwwrbrwwrbbwrbbrbbrbwrrwwbrrrbrwbrwwrbwbwrrrbwrwrrbrbbwrwrbrwwwrwbwrrwwwwrrrwrrwbbwrwwrwrbwwbwrrrrb...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Pandey is someone who is lazy, and when he's around his best friend GJ, he becomes super lazy. Pandey thinks that he is a Math-wizard, so he picks up a number S and asks GJ to throw him a challenge around that numb...
[{"type": "stdin_stdout", "input": "371 446\n1952\n9423\n8541\n57979\n535\n84946\n375\n8735\n8759\n7113\n11413\n65737\n500\n308\n194\n8785\n57265\n10381\n1130\n968\n5961\n76168\n81612\n66595\n66583\n1082\n373\n9386\n28833\n41145\n2566\n239\n722\n838\n5916\n28356\n2427\n602\n38509\n3629\n2636\n7551\n40\n21895\n795\n2518...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is a three-digit integer N. Does N contain the digit 7?\n\nIf so, print `Yes`; otherwise, print `No`.\n\nConstraints\n\n* 100 \\leq N \\leq 999\n\nInput\n\nInput is given from Standard Input in the following format:...
[{"type": "stdin_stdout", "input": "1760", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "2578", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "3557", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1413", "output": "No\n"}, {"type": "stdin_stdout", "input": "187", "output": "Yes\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given integers A and B, each between 1 and 3 (inclusive).\n\nDetermine if there is an integer C between 1 and 3 (inclusive) such that A \\times B \\times C is an odd number.\n\nConstraints\n\n* All values in input...
[{"type": "stdin_stdout", "input": "-1 -1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-3 -1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-1 -3", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-5 -1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-1 -5", "output": "Yes\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFind the number of palindromic numbers among the integers between A and B (inclusive). Here, a palindromic number is a positive integer whose string representation in base 10 (without leading zeros) reads the same forward...
[{"type": "stdin_stdout", "input": "31415 97709", "output": "662\n"}, {"type": "stdin_stdout", "input": "53417 77120", "output": "237\n"}, {"type": "stdin_stdout", "input": "44323 77120", "output": "328\n"}, {"type": "stdin_stdout", "input": "44323 83416", "output": "391\n"}, {"type": "stdin_stdout", "input": "15858 40...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have N points in a two-dimensional plane.\nThe coordinates of the i-th point (1 \\leq i \\leq N) are (x_i,y_i).\nLet us consider a rectangle whose sides are parallel to the coordinate axes that contains K or more of th...
[{"type": "stdin_stdout", "input": "4 3\n-1000000000 -1000000000\n1000000000 1000000000\n-999999999 999999999\n999999999 -1704052742", "output": "4000000000000000000\n"}, {"type": "stdin_stdout", "input": "4 3\n-1000000000 -1000000000\n1000000000 1011100000\n-1080623314 999999999\n176460011 -999999999", "output": "2514...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn a public bath, there is a shower which emits water for T seconds when the switch is pushed.\n\nIf the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds...
[{"type": "stdin_stdout", "input": "4 1000000000\n0 1100 1000000 1000000000", "output": "2000000000\n"}, {"type": "stdin_stdout", "input": "4 1000000000\n0 1100 1000000 1010000000", "output": "2001000000\n"}, {"type": "stdin_stdout", "input": "4 1000010000\n0 1000 1000000 1000000000", "output": "2000010000\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi recorded his daily life for the last few days as a integer sequence of length 2N, as follows:\n\n* a_1, b_1, a_2, b_2, ... , a_N, b_N\n\n\n\nThis means that, starting from a certain time T, he was:\n\n* sleeping...
[{"type": "stdin_stdout", "input": "10\n43196 57600\n4800 9600\n6000 1200\n600 600\n300 600\n5400 600\n6000 5760\n6760 2880\n6000 12000\n9000 600", "output": "5\n"}, {"type": "stdin_stdout", "input": "10\n43196 57600\n4800 9600\n6000 1200\n600 600\n300 600\n5400 600\n6000 5760\n6760 2880\n6000 12000\n9000 794", "output...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a data which provides heights (in meter) of mountains. The data is only for ten mountains.\n\nWrite a program which prints heights of the top three mountains in descending order.\n\nConstraints\n\n0 ≀ height of m...
[{"type": "stdin_stdout", "input": "1819\n2003\n1094\n2489\n1723\n492\n4419\n2848\n2834\n1724", "output": "4419\n2848\n2834\n"}, {"type": "stdin_stdout", "input": "1819\n2003\n1094\n2489\n1142\n492\n4419\n4289\n2834\n1724", "output": "4419\n4289\n2834\n"}, {"type": "stdin_stdout", "input": "1819\n2003\n876\n2840\n1723\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCreate a program that rotates the pattern of 8 characters x 8 lines clockwise by 90 degrees, 180 degrees, and 270 degrees and outputs it.\n\n\n\nInput\n\nA pattern consisting of 8 characters x 8 lines is given. Characters...
[{"type": "stdin_stdout", "input": "#*******\n#*******\n\"*******\n#*******\n#*******\n#*******\n#*******\n########", "output": "90\n#####\"##\n#*******\n#*******\n#*******\n#*******\n#*******\n#*******\n#*******\n180\n########\n*******#\n*******#\n*******#\n*******#\n*******\"\n*******#\n*******#\n270\n*******#\n*****...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have obtained the Izua Japanese dictionary, which is the official language of Izua, and the Izua alphabet (list of letters). There are N types of letters in the Izua alphabet. The order of the words that appear in the...
[{"type": "stdin_stdout", "input": "3\n2\n2 1\n3 1\n7\n2\n2 3\n1 1\n0", "output": "4\n120\n"}, {"type": "stdin_stdout", "input": "3\n2\n1 1\n3 1\n7\n2\n1 2\n1 1\n0", "output": "5\n720\n"}, {"type": "stdin_stdout", "input": "3\n2\n1 2\n3 1\n4\n2\n2 2\n1 4\n0", "output": "4\n21\n"}, {"type": "stdin_stdout", "input": "3\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nIn one river, there is a slightly dangerous game of jumping from one shore to the other on a stone.\n\n\n<image>\n\n\nNow, as shown in Figure 4-1 we consider the stone to be above the squares. The number of row...
[{"type": "stdin_stdout", "input": "5 1\n2 1 2 2 2\n1 3 3\n1 1 10\n1 1 1\n1 6 4\n5 0\n2 1 3 0 2\n1 3 2\n1 1 7\n1 2 1\n1 4 16\n0 0", "output": "25\n70\n"}, {"type": "stdin_stdout", "input": "5 1\n2 1 2 2 2\n1 3 3\n1 1 10\n1 1 1\n1 6 2\n5 0\n2 1 3 0 2\n1 3 2\n1 1 7\n1 2 1\n1 4 16\n0 0", "output": "15\n70\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe best night ever in the world has come! It's 8 p.m. of December 24th, yes, the night of Cristmas Eve. Santa Clause comes to a silent city with ringing bells. Overtaking north wind, from a sleigh a reindeer pulls she sh...
[{"type": "stdin_stdout", "input": "3 2 1\n0 1 1\n1 2 3\n1\n4 5 2\n0 1 1\n0 2 1\n1 2 1\n1 3 1\n2 3 2\n1\n2\n0 -1 0", "output": "1.000000000\n\n1.000000000\n0.000000000\n\n"}, {"type": "stdin_stdout", "input": "3 2 1\n0 1 2\n1 2 3\n1\n4 5 2\n0 1 1\n0 2 1\n1 2 1\n1 3 1\n2 3 1\n1\n2\n0 0 1", "output": "1.000000000\n\n0.50...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRational numbers are numbers represented by ratios of two integers. For a prime number p, one of the elementary theorems in the number theory is that there is no rational number equal to √p. Such numbers are called irrati...
[{"type": "stdin_stdout", "input": "2 10\n5 10\n19 111\n0 0", "output": "10/7 7/5\n9/4 2/1\n109/25 61/14\n"}, {"type": "stdin_stdout", "input": "11 5\n10 10\n5 100\n0 0", "output": "4/1 3/1\n10/3 3/1\n85/38 38/17\n"}, {"type": "stdin_stdout", "input": "2 5\n3 14\n26 111\n0 0", "output": "3/2 4/3\n7/4 12/7\n51/10 107/21...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have successfully completed your studies and are preparing to move from near Komaba to near Hongo. As I was organizing my house, I found a lot of lottery tickets I bought last year. After confirming the exchange deadl...
[{"type": "stdin_stdout", "input": "3 3\n*******1 100\n******22 1000\n11111112 1000000\n01203291\n02382022\n11111111\n10 10\n****3228 149416\n****3992 198635\n****4286 77783\n****4843 225244\n***49835 231046\n***59393 379996\n*5763748 437345\n*6726222 58054\n*8117882 16375\n*9244339 537727\n77885716\n96726222\n26971031...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n4\n5\n8\n58\n85\n\n\nOutput\n\n2970.000000000\n\nThe input will be given via stdin and the output should be printed to stdout by your code.\n\nNow solve the problem by providing the code.\n\nWrite Pyth...
[{"type": "stdin_stdout", "input": "4\n5\n10\n108\n152", "output": "9263.000000000000000\n"}, {"type": "stdin_stdout", "input": "4\n5\n20\n55\n152", "output": "5887.500000000000000\n"}, {"type": "stdin_stdout", "input": "4\n2\n11\n55\n152", "output": "5082.000000000000000\n"}, {"type": "stdin_stdout", "input": "4\n5\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAirport Codes\n\nAirport code\n\nIn the Kingdom of JAG, airport codes are assigned to each domestic airport for identification.\n\nAirport codes are assigned according to the following rules based on the name of the airpo...
[{"type": "stdin_stdout", "input": "3\nhaneda\noookayama\nssu\n2\nazusa\nazishirabe\n2\nsnuke\nsnake\n4\nhaneda\nhonda\nhanamaki\nhawaii\n0", "output": "1\n4\n-1\n3\n"}, {"type": "stdin_stdout", "input": "3\nhaneda\noookayama\nstu\n2\nazusa\nebarihsiza\n2\nsnuke\nsnake\n4\nhaneda\nhonda\nhanamaki\nhawaih\n0", "output":...
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\nDiameter of a Tree\n\n\n\n\nGiven a tree T with non-negative weight, find the diameter of the tree.\n\nThe diameter of a tree is the maximum distance between two nodes in a tree.\n\nConstraints\n\n* 1 ≀ n ≀ 100,000\n* 0 ≀...
[{"type": "stdin_stdout", "input": "4\n1 0 -2\n2 1 10\n1 3 4", "output": "14\n"}, {"type": "stdin_stdout", "input": "4\n1 0 1\n0 2 12\n2 3 -1", "output": "13\n"}, {"type": "stdin_stdout", "input": "4\n1 0 0\n2 1 11\n0 3 11", "output": "22\n"}, {"type": "stdin_stdout", "input": "4\n1 0 -1\n2 1 15\n1 3 4", "output": "19\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nChef, Artem and Eugene are the best of friends and teammates. Recently, they won a lot of money at the Are You Feeling Lucky Cup. Having put their fortune to test and emerging victorious, they are now busy enjoying their ...
[{"type": "stdin_stdout", "input": "2\n2 1 -1 11\n6 3 -1 0", "output": "0.666666666667\n0.666666666667\n"}, {"type": "stdin_stdout", "input": "2\n1 10 0 6\n1 2 2 -1", "output": "0.0909090909091\n0.333333333333\n"}, {"type": "stdin_stdout", "input": "2\n4 -1 -1 11\n2 4 0 0", "output": "1.33333333333\n0.333333333333\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAstronaut Natasha arrived on Mars. She knows that the Martians are very poor aliens. To ensure a better life for the Mars citizens, their emperor decided to take tax from every tourist who visited the planet. Natasha is t...
[{"type": "stdin_stdout", "input": "2 420\n412 363\n", "output": "420\n0 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 8...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConsider some positive integer x. Its prime factorization will be of form x = 2^{k_1} β‹… 3^{k_2} β‹… 5^{k_3} β‹… ...\n\nLet's call x elegant if the greatest common divisor of the sequence k_1, k_2, ... is equal to 1. For examp...
[{"type": "stdin_stdout", "input": "4\n4\n2\n72\n10\n", "output": " 2\n 1\n 61\n ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a rooted tree on n vertices, its root is the vertex number 1. The i-th vertex contains a number w_i. Split it into the minimum possible number of vertical paths in such a way that each path contains no more ...
[{"type": "stdin_stdout", "input": "2 100000 1000000000000000000\n1000000000 1000000000\n1\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "2 100000 1000000000100000000\n1000000000 1000000000\n1\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "2 101000 1000000000100000000\n1000000000 1000000000\n1\n", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nChouti was doing a competitive programming competition. However, after having all the problems accepted, he got bored and decided to invent some small games.\n\nHe came up with the following game. The player has a positiv...
[{"type": "stdin_stdout", "input": "1000000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1236540828\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1102703100\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1266106036\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1000000010\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 decided ...
[{"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\nYou have a garden consisting entirely of grass and weeds. Your garden is described by an n Γ— m grid, with rows numbered 1 to n from top to bottom, and columns 1 to m from left to right. Each cell is identified by a pair (...
[{"type": "stdin_stdout", "input": "3 150\nGGGWGGGGWWGGGGGGGGGGGGGWGGWGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGWGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGWGGGGGGGWGGGGGGGGGGGGGGGGGWGGGGGGGGGGGGGGGGGGW\nGGGGGGGGGGGGWGGGGGGGGGWGGGGGGGGGGGGWGGGGGWGGGGGGGWGGGGGGGWGGGGGWGGGGGGGGGGGGGGGGGGGGGGGGWGGGGWGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's call beauty of an array b_1, b_2, …, b_n (n > 1) β€” min_{1 ≀ i < j ≀ n} |b_i - b_j|.\n\nYou're given an array a_1, a_2, … a_n and a number k. Calculate the sum of beauty over all subsequences of the array of length e...
[{"type": "stdin_stdout", "input": "52 52\n19752 66708 73109 84463 95683 96876 98503 98812 99766 99778 99913 99975 99977 99997 99997 99997 99998 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence of n pairs of integers: (a_1, b_1), (a_2, b_2), ... , (a_n, b_n). This sequence is called bad if it is sorted in non-descending order by first elements or if it is sorted in non-descending order b...
[{"type": "stdin_stdout", "input": "4\n2 3\n1 2\n2 1\n2 4\n", "output": "17\n"}, {"type": "stdin_stdout", "input": "4\n2 3\n1 2\n2 1\n0 4\n", "output": "21\n"}, {"type": "stdin_stdout", "input": "4\n3 3\n2 3\n2 1\n2 4\n", "output": "16\n"}, {"type": "stdin_stdout", "input": "4\n2 3\n4 2\n2 1\n4 4\n", "output": "19\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetr stands in line of n people, but he doesn't know exactly which position he occupies. He can say that there are no less than a people standing in front of him and no more than b people standing behind him. Find the num...
[{"type": "stdin_stdout", "input": "100 81 58\n", "output": "19\n"}, {"type": "stdin_stdout", "input": "100 81 54\n", "output": "19\n"}, {"type": "stdin_stdout", "input": "100 81 91\n", "output": "19"}, {"type": "stdin_stdout", "input": "100 11 88\n", "output": "89"}, {"type": "stdin_stdout", "input": "59 12 33\n", "ou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp has spent the entire day preparing problems for you. Now he has to sleep for at least a minutes to feel refreshed.\n\nPolycarp can only wake up by hearing the sound of his alarm. So he has just fallen asleep and ...
[{"type": "stdin_stdout", "input": "7\n10 3 6 4\n11 3 6 4\n5 9 4 10\n6 5 2 3\n1 1 1 1\n3947465 47342 338129 123123\n234123843 13 361451236 361451000\n", "output": "27\n27\n9\n-1\n1\n6471793\n358578060125049\n"}, {"type": "stdin_stdout", "input": "7\n10 3 6 4\n11 3 6 0\n5 9 4 10\n6 5 2 3\n1 1 1 1\n3947465 47342 338129 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe government of Berland decided to improve network coverage in his country. Berland has a unique structure: the capital in the center and n cities in a circle around the capital. The capital already has a good network c...
[{"type": "stdin_stdout", "input": "3\n10\n3 3 2 3 2 5 1 2 11 3\n6 5 2 5 3 2 4 2 1 2\n20\n9 1 10 1 17 7 5 5 8 1 1 2 7 1 4 2 3 7 6 3\n2 6 3 2 37 1 5 5 4 5 1 3 21 15 1 7 7 5 0 1\n20\n9 1 9 1 5 1 3 2 0 3 6 1 2 8 11 7 3 5 14 2\n11 14 6 4 6 8 8 2 9 9 6 5 3 2 5 7 1 9 14 1\n", "output": "NO\nNO\nNO\n"}, {"type": "stdin_stdout...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n\"You must lift the dam. With a lever. I will give it to you.\n\nYou must block the canal. With a rock. I will not give the rock to you.\" \n\nDanik urgently needs rock and lever! Obviously, the easiest way to get these t...
[{"type": "stdin_stdout", "input": "5\n5\n1 5 3 12 10\n3\n1 1 2\n4\n6 2 5 3\n2\n2 4\n1\n1\n", "output": "1\n1\n2\n0\n0\n"}, {"type": "stdin_stdout", "input": "5\n5\n1 5 3 12 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1\n", "output": "1\n3\n2\n0\n0\n"}, {"type": "stdin_stdout", "input": "5\n5\n1 5 3 12 10\n3\n2 1 2\n4\n6 2 5 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis is the easy version of the problem. The difference between the versions is in the number of possible operations that can be made. You can make hacks if and only if you solved both versions of the problem.\n\nYou are ...
[{"type": "stdin_stdout", "input": "5\n2 2\n10\n11\n3 3\n011\n101\n110\n4 4\n1111\n0110\n0110\n1111\n5 5\n01011\n11001\n00010\n11011\n10000\n2 3\n011\n101\n", "output": "1\n1 1 2 1 2 2 \n6\n1 1 1 2 2 2 \n1 1 2 1 2 2 \n1 2 1 3 2 2 \n1 2 2 2 2 3 \n2 1 2 2 3 1 \n2 1 2 2 3 2 \n20\n1 1 1 2 2 2 \n1 2 1 3 2 2 \n1 2 2 2 2 3 \n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp calls an array dense if the greater of any two adjacent elements is not more than twice bigger than the smaller. More formally, for any i (1 ≀ i ≀ n-1), this condition must be satisfied: $$$(max(a[i], a[i+1]))/(m...
[{"type": "stdin_stdout", "input": "6\n4\n4 2 10 1\n2\n1 3\n2\n6 1\n3\n1 4 2\n5\n1 2 3 4 3\n12\n4 31 25 50 30 20 34 46 42 16 15 16\n", "output": "\n5\n1\n2\n1\n0\n3\n"}, {"type": "stdin_stdout", "input": "6\n4\n4 2 10 1\n2\n1 3\n2\n12 1\n3\n1 4 2\n5\n1 2 3 4 3\n12\n4 27 25 50 30 20 34 46 42 16 15 21\n", "output": "5\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a number n and an array b_1, b_2, …, b_{n+2}, obtained according to the following algorithm: \n\n * some array a_1, a_2, …, a_n was guessed; \n * array a was written to array b, i.e. b_i = a_i (1 ≀ i ≀ n);...
[{"type": "stdin_stdout", "input": "1\n12\n400000000 400000000 400000000 400000000 400000000 400000000 400000000 400000000 400000000 400000000 400000000 400000000 400000000 505032704\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "1\n12\n400000000 400000000 400000000 400000000 400000000 400000000 400000000 40...
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\nBob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given n numbers differs from the others. Bob observed that one number usually differs from the others in evenness. Help...
[{"type": "stdin_stdout", "input": "100\n44 40 6 40 56 90 98 8 36 64 76 86 98 76 36 92 6 30 98 70 24 98 96 60 24 82 88 68 86 96 34 42 58 10 40 26 56 10 88 58 70 32 24 28 14 82 52 12 62 36 70 60 52 34 74 30 78 76 10 16 42 94 66 90 70 38 52 12 58 22 98 96 14 68 24 70 4 30 84 98 8 50 14 52 66 34 100 10 28 100 56 48 38 12 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBessie and the cows are playing with sequences and need your help. They start with a sequence, initially containing just the number 0, and perform n operations. Each operation is one of the following:\n\n 1. Add the inte...
[{"type": "stdin_stdout", "input": "5\n2 -1569\n1 2 -156\n2 641\n2 -253\n2 -400\n", "output": "-784.500000\n-940.500000\n-413.333333\n-373.250000\n-378.600000\n"}, {"type": "stdin_stdout", "input": "5\n2 -1481\n1 2 -156\n2 194\n2 -253\n2 -400\n", "output": "-740.500000\n-896.500000\n-533.000000\n-463.000000\n-450.40000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYet another Armageddon is coming! This time the culprit is the Julya tribe calendar. \n\nThe beavers in this tribe knew math very well. Smart Beaver, an archaeologist, got a sacred plate with a magic integer on it. The tr...
[{"type": "stdin_stdout", "input": "4198516957\n", "output": " 503887718\n"}, {"type": "stdin_stdout", "input": "1278564645\n", "output": " 154026551\n"}, {"type": "stdin_stdout", "input": "292168270\n", "output"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n schoolchildren, boys and girls, lined up in the school canteen in front of the bun stall. The buns aren't ready yet and the line is undergoing some changes.\n\nEach second all boys that stand right in front of...
[{"type": "stdin_stdout", "input": "MFFFMMFMFMFMFFFMMMFFMMMMMMFMMFFMMMFMMFMFFFMMFMMMFFMMFFMFFMFMFFFMMMFFFMFMFMFMFFFMMMMFMMFMMFFMMMMMFFFM\n", "output": "55\n"}, {"type": "stdin_stdout", "input": "FFFFFMFMMFFFMFMFMFFMMFMFMFFMFMMMMFMFFFFFFMFFMMMFFMFFMFFFFFMFFFFMMFFFFFFFFFFFMFMFFMMFFMFMFMFMMFFFMMMM\n", "output": "58\n"}, {...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya works as a PR manager for a successful Berland company BerSoft. He needs to prepare a presentation on the company income growth since 2001 (the year of its founding) till now. Petya knows that in 2001 the company in...
[{"type": "stdin_stdout", "input": "100\n1 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 94 95 96 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPeople in the Tomskaya region like magic formulas very much. You can see some of them below.\n\nImagine you are given a sequence of positive integer numbers p1, p2, ..., pn. Lets write down some magic formulas:\n\n<image>...
[{"type": "stdin_stdout", "input": "25\n39226529 640445129 936289624 364461191 1096077769 573427707 1919403410 950067229 1217479531 455229458 1574949468 397268319 1267289585 995220637 1920919164 501015483 1815262670 1197059269 86947741 2000617780 667368575 733666398 1536581408 611239452 947487746\n", "output": "9991962...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya follows a basketball game and marks the distances from which each team makes a throw. He knows that each successful throw has value of either 2 or 3 points. A throw is worth 2 points if the distance it was made from...
[{"type": "stdin_stdout", "input": "18\n450 3726 12063 42865 29689 35320 33937 4067 45951 80313 53004 59541 75551 75836 151186 81297 93876 96211\n47\n3393 11375 6494 7645 9549 8499 11145 13121 14801 15578 24104 24125 25871 31280 35036 38969 29966 41342 42708 46033 47491 25404 49152 51905 55002 9827 56565 57901 104645 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Tanya decided to present her dad a postcard on his Birthday. She has already created a message β€” string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a ne...
[{"type": "stdin_stdout", "input": "DpiNBmCRFWxpdbfGOzvvOcemjructoAdEwegTvbVbfWWRPGyEAxGdDRWVlqNyGWMWHMrHAIZpyxvgaflrsVZhhZRouvpxrKXFZam\nwwPLFtNfPtJXvMLuHjKfYyaRhreNSWSzOvDpqHCGcqllACNPGHxReeFUCmAqIKXYytsSQwIxJzNiiUtgebVuwRmWpRALLyKAzyDPvgIGxALSaeeTIqm\n", "output": "66 12\n"}, {"type": "stdin_stdout", "input": "maZFX...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA map of some object is a rectangular field consisting of n rows and n columns. Each cell is initially occupied by the sea but you can cover some some cells of the map with sand so that exactly k islands appear on the map...
[{"type": "stdin_stdout", "input": "100 5000\n", "output": "YES\nLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLS\nSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSL\nLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSLSL...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nStepan had a favorite string s which consisted of the lowercase letters of the Latin alphabet. \n\nAfter graduation, he decided to remember it, but it was a long time ago, so he can't now remember it. But Stepan remembers...
[{"type": "stdin_stdout", "input": "200\n200 180 160 140 122 106 92 79 69 60 52 45 38 32 26 20 14 8 4 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter the educational reform Polycarp studies only two subjects at school, Safety Studies and PE (Physical Education). During the long months of the fourth term, he received n marks in them. When teachers wrote a mark in ...
[{"type": "stdin_stdout", "input": "100\n45 55\n3 5 3 4 1 1 1 1 5 2 1 3 1 5 3 5 1 1 3 1 1 3 5 5 1 1 1 5 5 1 3 1 1 1 3 3 1 1 1 4 3 1 5 1 3 1 4 5 4 3 3 1 1 5 5 1 3 5 1 1 5 1 1 3 5 5 1 1 3 3 4 1 1 4 5 3 1 3 1 5 1 5 4 5 1 1 1 1 4 5 4 5 3 1 1 5 1 5 1 4\n", "output": "1 1 1 1 2 2 2 2 1 2 2 1 2 1 1 1 2 2 1 2 2 1 1 1 2 2 2 1 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs you may know, MemSQL has American offices in both San Francisco and Seattle. Being a manager in the company, you travel a lot between the two cities, always by plane.\n\nYou prefer flying from Seattle to San Francisco ...
[{"type": "stdin_stdout", "input": "100\nSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSF\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100\nSFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\n", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Travelling Salesman spends a lot of time travelling so he tends to get bored. To pass time, he likes to perform operations on numbers. One such operation is to take a positive integer x and reduce it to the number of ...
[{"type": "stdin_stdout", "input": "10011010111010010111111110001010001010001010110010110010010111101111000101110101010111100101001100011001001001111011111100011110101011011001101101001111111101010010110011111101110010001000111111100011000000111111111100011000000000110101111000001011101000110000111110110000010000010011...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe recent All-Berland Olympiad in Informatics featured n participants with each scoring a certain amount of points.\n\nAs the head of the programming committee, you are to determine the set of participants to be awarded ...
[{"type": "stdin_stdout", "input": "100\n600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600 600...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a positive integer n, written without leading zeroes (for example, the number 04 is incorrect). \n\nIn one operation you can delete any digit of the given integer so that the result remains a positive intege...
[{"type": "stdin_stdout", "input": "2000000000\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "1234567891\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "1881388645\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "1538038021\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "1686264392\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAniruddha loves to code on HackerEarth. There are some type of problems which he likes the most.\nProblems are tagged with non empty strings containing only 'H' or 'E' or both. But he likes the problems tagged with string...
[{"type": "stdin_stdout", "input": "2\n9\n131\n\nARMOKE", "output": "230\n601742908\n"}, {"type": "stdin_stdout", "input": "2\n9\n159\n\nARMOKE", "output": "230\n118865459\n"}, {"type": "stdin_stdout", "input": "2\n6\n131\n\nARMOKE", "output": "52\n601742908\n"}, {"type": "stdin_stdout", "input": "2\n22\n21\n\nNSLALD",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMonk visits a magical place, Makizam. He is greeted by his old friend, Wiz. Wiz happy to see his old friend, gives him a puzzle.\nHe takes him to a room with N keys placed on the floor, the i'th key is of type Xi. The ke...
[{"type": "stdin_stdout", "input": "2\n2 4 1 \n2 3\n5 3 12 3\n1 2 10 7\n3 4 2\n2 3 5\n5 3 10 2\n1 2 5 7\n\nSAMPLE", "output": "19\n14\n"}, {"type": "stdin_stdout", "input": "2\n2 4 1 \n0 3\n5 3 12 3\n1 2 10 7\n3 4 2\n2 3 5\n5 3 10 2\n1 2 5 7\n\nSAMPLE", "output": "20\n14\n"}, {"type": "stdin_stdout", "input": "2\n2 4 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven a set S. Generate T, a set that contains all subsets of S minus the null set and calculate A, XOR sum of the set T. \nS={1,2,3}\nT={{1},{2},{3},{1,2},{1,3},{2,3} ,{1,2,3}}\nA=XORiana of T .\nXORiana of a set is de...
[{"type": "stdin_stdout", "input": "100\n100\n41 67 134 100 169 124 78 158 162 64 105 145 81 27 161 91 195 142 27 36 191 4 102 153 92 182 21 116 118 95 47 126 171 138 69 112 67 99 35 94 103 11 122 133 73 64 141 111 53 68 147 44 62 157 37 59 123 141 129 178 116 35 190 42 88 106 40 142 64 48 46 5 90 129 170 150 6 101 193...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nToday, Vasya has decided to study about Numbers and Number Theory. One of her good friends Kolya is very good at the subject. To help her, he kept the following task in front of Vasya: \n\nGiven an array A of size N, Vasy...
[{"type": "stdin_stdout", "input": "1000\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have N squares assigned the numbers 1,2,3,\\ldots,N. Each square has an integer written on it, and the integer written on Square i is a_i.\n\nHow many squares i satisfy both of the following conditions?\n\n* The assign...
[{"type": "stdin_stdout", "input": "15\n1 10 145 15 87 138 51 194 1 18 77 20 9 17 93", "output": "8\n"}, {"type": "stdin_stdout", "input": "15\n15 11 46 15 50 98 93 129 31 43 44 11 6 24 14", "output": "3\n"}, {"type": "stdin_stdout", "input": "15\n15 11 46 15 50 98 93 129 41 43 44 11 6 24 14", "output": "3\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is a positive integer N. Find the number of permutations (P_1,P_2,\\cdots,P_{3N}) of (1,2,\\cdots,3N) that can be generated through the procedure below. This number can be enormous, so print it modulo a prime number...
[{"type": "stdin_stdout", "input": "356 1000000007", "output": "614667827\n"}, {"type": "stdin_stdout", "input": "502 1000000007", "output": "749776015\n"}, {"type": "stdin_stdout", "input": "184 1000000007", "output": "550610517\n"}, {"type": "stdin_stdout", "input": "141 1000000007", "output": "536152791\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is a string S of length N-1. Each character in S is `<` or `>`.\n\nA sequence of N non-negative integers, a_1,a_2,\\cdots,a_N, is said to be good when the following condition is satisfied for all i (1 \\leq i \\leq ...
[{"type": "stdin_stdout", "input": "<>>><<<<<><<>>><", "output": "29\n"}, {"type": "stdin_stdout", "input": "<>>>><<<<><<<>><", "output": "28\n"}, {"type": "stdin_stdout", "input": "<>><<<><<<<>>>><", "output": "26\n"}, {"type": "stdin_stdout", "input": "<<>><<><<<<>>>><", "output": "24\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0. You are given a sequence h=\\\\{h_1,h_2,h_3,......\\\\} as input. You would like to change the height of Flower k t...
[{"type": "stdin_stdout", "input": "8\n4 39 136 0 23 108 50 101", "output": "295\n"}, {"type": "stdin_stdout", "input": "8\n4 65 136 0 23 108 20 101", "output": "325\n"}, {"type": "stdin_stdout", "input": "8\n4 65 136 0 23 108 20 001", "output": "244\n"}, {"type": "stdin_stdout", "input": "8\n4 65 136 0 23 108 21 101",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe ABC number of a string T is the number of triples of integers (i, j, k) that satisfy all of the following conditions:\n\n* 1 ≀ i < j < k ≀ |T| (|T| is the length of T.)\n* T_i = `A` (T_i is the i-th character of T fro...
[{"type": "stdin_stdout", "input": "??????????B??????AC??????", "output": "616193984\n"}, {"type": "stdin_stdout", "input": "B?????BA?????????????????", "output": "461993881\n"}, {"type": "stdin_stdout", "input": "?????????????????AB?????B", "output": "428928079\n"}, {"type": "stdin_stdout", "input": "????>????????????...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are playing the following game with Joisino.\n\n* Initially, you have a blank sheet of paper.\n* Joisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the n...
[{"type": "stdin_stdout", "input": "6\n12\n22\n18\n22\n18\n12", "output": "0\n"}, {"type": "stdin_stdout", "input": "6\n12\n22\n18\n35\n18\n12", "output": "2\n"}, {"type": "stdin_stdout", "input": "6\n12\n22\n28\n35\n18\n12", "output": "4\n"}, {"type": "stdin_stdout", "input": "6\n12\n35\n28\n35\n18\n12", "output": "2\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have a grid of H rows and W columns. Initially, there is a stone in the top left cell. Shik is trying to move the stone to the bottom right cell. In each step, he can move the stone one cell to its left, up, right, or ...
[{"type": "stdin_stdout", "input": "11 -1\n../##\n.##/.\n..#-#\n#\"./.", "output": "Impossible\n"}, {"type": "stdin_stdout", "input": "11 -1\n.#/.#\n.##/.\n..#-#\n#\"./.", "output": "Impossible\n"}, {"type": "stdin_stdout", "input": "11 -1\n.#/.#\n.##/.\n..#-#\n#!./.", "output": "Impossible\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYour task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.\n\nThe tex...
[{"type": "stdin_stdout", "input": "Thank you for your mail amd your lectures", "output": "your lectures\n"}, {"type": "stdin_stdout", "input": "ahTnk you for your mail and your serutcel", "output": "your serutcel\n"}, {"type": "stdin_stdout", "input": "Uhank you for your mail mad your lrctuees", "output": "your lrctue...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe courier charges for a courier company are set according to size and weight as shown in the table below.\n\nA size | B size | C size | D size | E size | F size\n--- | --- | --- | --- | --- | --- | ---\nSize | 60 cm or ...
[{"type": "stdin_stdout", "input": "2\n86 25 5 5\n135 60 10 30\n3\n10 8 25 24\n5 16 13 9\n30 30 30 14\n0", "output": "1200\n3800\n"}, {"type": "stdin_stdout", "input": "2\n51 0 5 15\n107 60 3 30\n3\n10 15 25 47\n2 12 12 3\n30 30 11 11\n0", "output": "1200\n2000\n"}, {"type": "stdin_stdout", "input": "2\n50 34 5 5\n80 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDo you know Just Odd Inventions? The business of this company is to \"just odd inventions\". Here, it is abbreviated as JOI.\n\nJOI is conducting research to confine many microorganisms in one petri dish alive. There are ...
[{"type": "stdin_stdout", "input": "6\n12 13\n5 9\n2 4\n10 12\n6 12\n6 11", "output": "5\n"}, {"type": "stdin_stdout", "input": "6\n12 38\n5 9\n2 4\n10 12\n6 12\n11 9", "output": "5\n"}, {"type": "stdin_stdout", "input": "6\n12 13\n5 9\n2 2\n10 12\n6 12\n6 11", "output": "5\n"}, {"type": "stdin_stdout", "input": "6\n12...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have just been put in charge of developing a new shredder for the Shredding Company. Although a ``normal'' shredder would just shred sheets of paper into little pieces so that the contents would become unreadable, thi...
[{"type": "stdin_stdout", "input": "50 12346\n712 144139\n927438 667387\n23 3312\n9 3142\n25 1299\n101 63556\n103 862150\n6 1104\n0 0", "output": "43 1 2 34 6\n481 1 441 39\n667387 667387\n18 3 3 12\nerror\n21 1 2 9 9\n97 6 35 56\n103 86 2 15 0\nrejected\n"}, {"type": "stdin_stdout", "input": "50 12346\n712 144139\n158...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nA graph is given in which N vertices, each numbered from 1 to N, are connected by N-1 undirected edges. For each vertex, output the shortest number of steps to start from that vertex and visit all vertices.\n\n...
[{"type": "stdin_stdout", "input": "6\n1 2\n2 3\n3 4\n3 5\n5 6", "output": "6\n7\n8\n7\n7\n6\n"}, {"type": "stdin_stdout", "input": "6\n1 2\n2 3\n6 4\n3 5\n5 6", "output": "5\n6\n7\n5\n7\n6\n"}, {"type": "stdin_stdout", "input": "6\n1 2\n2 3\n6 4\n3 4\n5 6", "output": "5\n6\n7\n7\n5\n6\n"}, {"type": "stdin_stdout", "in...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nI'm traveling to a country with a rabbit. There are n cities in this country numbered from 1 to n, and the rabbit is now in city 1. City i is a point on the coordinate plane (xi, yi) ).\n\nRabbits travel to meet the follo...
[{"type": "stdin_stdout", "input": "5\n101.13623414746552 91.04161232454778\n1 -1\n1 10\n0 3\n19 -1\n20 7", "output": "9\n"}, {"type": "stdin_stdout", "input": "5\n100.60853142327974 90.65666260699702\n1 0\n1 10\n8 3\n10 -1\n12 10", "output": "2\n"}, {"type": "stdin_stdout", "input": "5\n100.60853142327974 90.656662606...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n3 2\nR1\n\n\nOutput\n\n3 1 2\n4 5 6\n7 8 9\n\nThe input will be given via stdin and the output should be printed to stdout by your code.\n\nNow solve the problem by providing the code.\n\nWrite Python ...
[{"type": "stdin_stdout", "input": "73 2\nR2", "output": "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\n146 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nThere is a grid of $ N \\ times N $ cells. Initially all cells are white. Follow the steps below to increase the number of black squares.\n\nSelect one white cell from the cells that are even-numbered from the ...
[{"type": "stdin_stdout", "input": "9\noxoooooxo\noxxxxxxxx\noxoooooxo\nxxxxxxxxx\noxoxooooo\noxxxxxxxx\noxoxoxooo\nxxxxxxoxo\noxoxoxooo", "output": "4\n"}, {"type": "stdin_stdout", "input": "9\noxoooooxo\noxxxxxxxx\noxoooooxo\nxxxxxxxxx\noxoxooooo\noxxxxxxxx\noxoxoxooo\nxxxxxxoxo\noooxoxoxo", "output": "4\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe want to encode a given string $S$ to a binary string. Each alphabet character in $S$ should be mapped to a different variable-length code and the code must not be a prefix of others.\n\nHuffman coding is known as one o...
[{"type": "stdin_stdout", "input": "aaabbcccdeeegfg", "output": "41\n"}, {"type": "stdin_stdout", "input": "aaadbcccbeedgfg", "output": "42\n"}, {"type": "stdin_stdout", "input": "gegdeebcccbeaaa", "output": "38\n"}, {"type": "stdin_stdout", "input": "aeaaacccbeedgeg", "output": "36\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads a sequence of $n$ integers $a_i (i = 1, 2, ... n)$, and prints the minimum value, maximum value and sum of the sequence.\n\nConstraints\n\n* $0 < n \\leq 10000$\n* $-1000000 \\leq a_i \\leq 100...
[{"type": "stdin_stdout", "input": "5\n114 0 -15 -1 2", "output": "-15 114 100\n"}, {"type": "stdin_stdout", "input": "5\n114 -1 -15 -1 2", "output": "-15 114 99\n"}, {"type": "stdin_stdout", "input": "5\n112 -1 -15 -1 2", "output": "-15 112 97\n"}, {"type": "stdin_stdout", "input": "5\n112 1 -14 -1 2", "output": "-14 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYesterday Chef had a great party and doesn't remember the way he celebreated it. But he found a strange paper in his kitchen containing n digits (lets give them indices from 1 to n and name them a1, a2 ... aN). \n Chef re...
[{"type": "stdin_stdout", "input": "10 3\n0324152397\n2\n3\n10", "output": "3\n3\n38\n"}, {"type": "stdin_stdout", "input": "10 3\n0324152397\n4\n3\n10", "output": "7\n3\n38\n"}, {"type": "stdin_stdout", "input": "10 3\n0324152397\n1\n3\n10", "output": "0\n3\n38\n"}, {"type": "stdin_stdout", "input": "10 3\n0324152397\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSonya decided that having her own hotel business is the best way of earning money because she can profit and rest wherever she wants.\n\nThe country where Sonya lives is an endless line. There is a city in each integer co...
[{"type": "stdin_stdout", "input": "100 10\n-489 -476 -445 -432 -430 -421 -420 -418 -412 -411 -404 -383 -356 -300 -295 -293 -287 -276 -265 -263 -258 -251 -249 -246 -220 -219 -205 -186 -166 -157 -143 -137 -136 -130 -103 -86 -80 -69 -67 -55 -43 -41 -40 -26 -19 -9 16 29 41 42 54 76 84 97 98 99 101 115 134 151 157 167 169 ...
code_stdio