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\nA kindergarten teacher Natalia Pavlovna has invented a new ball game. This game not only develops the children's physique, but also teaches them how to count. \n\nThe game goes as follows. Kids stand in circle. Let's agre...
[{"type": "stdin_stdout", "input": "102\n", "output": "2 4 7 11 16 22 29 37 46 56 67 79 92 4 19 35 52 70 89 7 28 50 73 97 20 46 73 101 28 58 89 19 52 86 19 55 92 28 67 5 46 88 29 73 16 62 7 55 2 52 1 53 4 58 11 67 22 80 37 97 56 16 79 41 4 70 35 1 70 38 7 79 50 22 97 71 46 22 101 79 58 38 19 1 86 70 55 41 28 16 5 97 88...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day, after a difficult lecture a diligent student Sasha saw a graffitied desk in the classroom. She came closer and read: \"Find such positive integer n, that among numbers n + 1, n + 2, ..., 2·n there are exactly m n...
[{"type": "stdin_stdout", "input": "101628400788615604 30\n", "output": "999999999999995905\n"}, {"type": "stdin_stdout", "input": "101628400798615604 31\n", "output": "981546175132942729\n"}, {"type": "stdin_stdout", "input": "101628400798615604 31\n", "output": "981546175132942729\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have full control over a robot that walks around in a rectangular field paved with square tiles like a chessboard. There are m columns of tiles from west to east, and n rows of tiles from south to north (1 <= m, n <= ...
[{"type": "stdin_stdout", "input": "11 5\nFORWARD 3\nRIGHT\nFORWARD 10\nLEFT\nBACKWARD 3\nSTOP\n3 1\nFORWARD 2\nSTOP\n0 0", "output": "11 1\n1 1\n"}, {"type": "stdin_stdout", "input": "14 5\nFORWARD 3\nRIGHT\nFORWARD 8\nLEFT\nBACKWARD 2\nSTOP\n3 1\nFORVARD 5\nSTOP\n0 0", "output": "9 2\n1 1\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have a 3×3 square grid, where each square contains a lowercase English letters.\nThe letter in the square at the i-th row from the top and j-th column from the left is c_{ij}.\nPrint the string of length 3 that can be ...
[{"type": "stdin_stdout", "input": "ant\nobe\nrec\n", "output": "abc\n"}, {"type": "stdin_stdout", "input": "edu\ncat\nion\n", "output": "ean\n"}, {"type": "stdin_stdout", "input": "ant\nobe\nrfc", "output": "abc\n"}, {"type": "stdin_stdout", "input": "ddu\ncat\nion", "output": "dan\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOur beloved detective, Sherlock is currently trying to catch a serial killer who kills a person each day. Using his powers of deduction, he came to know that the killer has a strategy for selecting his next victim.\n\nThe...
[{"type": "stdin_stdout", "input": "bwyplnjn zkms\n26\nzkms nzmcsytxh\nnzmcsytxh yujsb\nbwyplnjn gtbzhudpb\ngtbzhudpb hpk\nyujsb xvy\nhpk wrwnfokml\nwrwnfokml ndouuikw\nndouuikw ucgrja\nucgrja tgfmpldz\nxvy nycrfphn\nnycrfphn quvs\nquvs htdy\nhtdy k\ntgfmpldz xtdpkxm\nxtdpkxm suwqxs\nk fv\nsuwqxs qckllwy\nqckllwy diun\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Resistance is trying to take control over as many planets of a particular solar system as possible. Princess Heidi is in charge of the fleet, and she must send ships to some planets in order to maximize the number of ...
[{"type": "stdin_stdout", "input": "24\n19 14\n8 15\n13 4\n18 16\n1 17\n10 3\n22 21\n10 14\n6 11\n9 12\n15 22\n11 3\n21 7\n2 12\n7 4\n4 19\n16 9\n24 17\n5 15\n8 2\n23 10\n20 12\n18 24\n", "output": "1 20 21 22 23 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24\n"}, {"type": "stdin_stdout", "input": "24\n19 14\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp is very careful. He even types numeric sequences carefully, unlike his classmates. If he sees a sequence without a space after the comma, with two spaces in a row, or when something else does not look neat, he ru...
[{"type": "stdin_stdout", "input": ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\n", "output": ", , , , , , ,...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou survived several months of exam wars and were able to enter ICPC University on a sunny day. On the day of admission, there was an enthusiastic recruitment of circles on the campus of the university, and you received a...
[{"type": "stdin_stdout", "input": "9\n315\n0", "output": "2\n11\n"}, {"type": "stdin_stdout", "input": "9\n256\n0", "output": "2\n0\n"}, {"type": "stdin_stdout", "input": "9\n160\n0", "output": "2\n1\n"}, {"type": "stdin_stdout", "input": "9\n213\n0", "output": "2\n3\n"}, {"type": "stdin_stdout", "input": "9\n200\n0",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer array $a_1, a_2, \\ldots, a_n$.\n\nThe array $b$ is called to be a subsequence of $a$ if it is possible to remove some elements from $a$ to get $b$.\n\nArray $b_1, b_2, \\ldots, b_k$ is called to ...
[{"type": "stdin_stdout", "input": "50\n170081 797965 40736 224325 102476 20832 954026 923972 391400 247099 95141 927386 79799 749285 104039 200818 623552 872203 355273 838168 352783 850365 389351 930945 847154 608047 727586 549184 520573 608953 338849 536466 345479 589848 882827 771475 874283 787115 992590 128903 9780...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA crop circle suddenly appeared on the vast agricultural land of Argentina. A total of n crop circles were confirmed, including overlapping, popping, large, and small ones.\n\nWhen a mystery hunter tried to capture the wh...
[{"type": "stdin_stdout", "input": "4\n6 4 2\n4 7 3\n7 10 3\n13 6 1\n4\n7 4 2\n4 7 3\n7 10 3\n11 6 3\n0", "output": "39.664699289572\n45.627024663706"}, {"type": "stdin_stdout", "input": "4\n3 4 1\n4 7 3\n12 14 3\n13 3 1\n4\n7 4 2\n4 7 3\n6 10 3\n11 6 3\n0", "output": "45.836887586\n48.016187138\n"}, {"type": "stdin_st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp is very fond of playing the game Minesweeper. Recently he found a similar game and there are such rules.\n\nThere are mines on the field, for each the coordinates of its location are known ($x_i, y_i$). Each mine...
[{"type": "stdin_stdout", "input": "3\n\n5 0\n0 0 1\n-1 1 4\n1 1 2\n1 0 3\n2 2 9\n\n5 2\n0 -1 1\n0 1 4\n2 0 2\n1 1 3\n2 2 9\n\n6 1\n1 -1 3\n0 -1 9\n0 1 7\n-1 0 1\n0 1 14\n-1 -1 11\n", "output": "2\n1\n1"}, {"type": "stdin_stdout", "input": "3\n\n5 0\n0 0 1\n-1 1 4\n1 0 2\n1 0 3\n2 2 11\n\n5 2\n0 0 0\n0 1 4\n3 0 2\n1 1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's call a list of positive integers $a_0, a_1, ..., a_{n-1}$ a power sequence if there is a positive integer $c$, so that for every $0 \\le i \\le n-1$ then $a_i = c^i$.\n\nGiven a list of $n$ positive integers $a_0, a...
[{"type": "stdin_stdout", "input": "100\n881 479 355 759 257 497 690 598 275 446 439 787 257 326 436 713 322 5 253 781 434 307 164 154 241 381 38 942 680 906 240 11 431 478 628 1203 346 74 493 964 455 746 950 41 585 549 892 687 264 41 487 676 63 453 861 980 477 901 80 907 285 506 619 748 773 743 56 925 651 685 845 313 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMemory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side lengt...
[{"type": "stdin_stdout", "input": "100000 25000\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "100000 25000\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "167552 16353\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "113151 20996\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "1413...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have an undirected graph G with N vertices numbered 1 to N and N edges as follows:\n - For each i=1,2,...,N-1, there is an edge between Vertex i and Vertex i+1.\n - There is an edge between Vertex X and Vertex Y.\nFor ...
[{"type": "stdin_stdout", "input": "2000 999 1001\n", "output": "2000\n1999\n1998\n1997\n1996\n1995\n1994\n1993\n1992\n1991\n1990\n1989\n1988\n1987\n1986\n1985\n1984\n1983\n1982\n1981\n1980\n1979\n1978\n1977\n1976\n1975\n1974\n1973\n1972\n1971\n1970\n1969\n1968\n1967\n1966\n1965\n1964\n1963\n1962\n1961\n1960\n1959\n195...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCreate a program that converts the date expressed in the Christian era to the Japanese calendar using the era name and outputs the date. The input is three integers, as shown in the example, in the order year, month, and ...
[{"type": "stdin_stdout", "input": "3559 9 5\n2425 12 2\n2980 9 14", "output": "heisei 1571 9 5\nheisei 437 12 2\nheisei 992 9 14\n"}, {"type": "stdin_stdout", "input": "3559 9 5\n2425 12 2\n2980 9 7", "output": "heisei 1571 9 5\nheisei 437 12 2\nheisei 992 9 7\n"}, {"type": "stdin_stdout", "input": "3080 6 3\n2027 12 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDwarfs have planted a very interesting plant, which is a triangle directed \"upwards\". This plant has an amusing feature. After one year a triangle plant directed \"upwards\" divides into four triangle plants: three of t...
[{"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "899770636\n"}, {"type": "stdin_stdout", "input": "148049062285906746\n", "output": "913927498\n"}, {"type": "stdin_stdout", "input": "615812227854199662\n", "output": "357939938\n"}, {"type": "stdin_stdout", "input": "585335721566249104\n", "output"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven are N points on the circumference of a circle centered at (0,0) in an xy-plane. The coordinates of the i-th point are (\\cos(\\frac{2\\pi T_i}{L}),\\sin(\\frac{2\\pi T_i}{L})).\n\nThree distinct points will be chose...
[{"type": "stdin_stdout", "input": "10 100\n2\n11\n35\n42\n54\n69\n89\n91\n93\n99", "output": "0.352886583546338 -0.109065017701873"}, {"type": "stdin_stdout", "input": "10 100\n2\n11\n40\n46\n54\n69\n89\n91\n93\n183", "output": "-0.215229840673 -0.027898226758\n"}, {"type": "stdin_stdout", "input": "10 100\n2\n10\n35\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFind the least common multiple (LCM) of given n integers.\n\nConstraints\n\n* 2 ≤ n ≤ 10\n* 1 ≤ ai ≤ 1000\n* Product of given integers ai(i = 1, 2, ... n) does not exceed 231-1\n\nInput\n\n\nn\na1 a2 ... an\n\n\nn is give...
[{"type": "stdin_stdout", "input": "3\n12 39 11", "output": "1716\n"}, {"type": "stdin_stdout", "input": "4\n1 2 5 24", "output": "120\n"}, {"type": "stdin_stdout", "input": "3\n3 37 10", "output": "1110\n"}, {"type": "stdin_stdout", "input": "4\n1 2 5 44", "output": "220\n"}, {"type": "stdin_stdout", "input": "3\n9 37...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible diverse words in lexicogra...
[{"type": "stdin_stdout", "input": "abcdefghijklmnopqrytuvwzsx", "output": "abcdefghijklmnopqrytuvwzx\n"}, {"type": "stdin_stdout", "input": "abcpefghijklmnodqrytuvwzsx", "output": "abcpefghijklmnodqrytuvwzx\n"}, {"type": "stdin_stdout", "input": "azcdefghijklmnopqrstuvwbyx", "output": "azcdefghijklmnopqrstuvwx\n"}, {"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this problem we consider a special type of an auction, which is called the second-price auction. As in regular auction n bidders place a bid which is price a bidder ready to pay. The auction is closed, that is, each bi...
[{"type": "stdin_stdout", "input": "100\n2515 3324 7975 6171 4240 1217 4829 5203 8603 6900 3031 4699 4732 6070 4221 3228 6497 7359 9130 4346 4619 1109 3945 5442 3271 16 9711 2045 6410 2301 3406 8125 6003 1892 1260 9661 3940 6692 4708 7027 4930 6925 1979 5361 4263 3144 867 8639 6230 5562 9714 3676 4231 3347 4733 4920 48...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCat Snuke is learning to write characters.\nToday, he practiced writing digits 1 and 9, but he did it the other way around.\nYou are given a three-digit integer n written by Snuke.\nPrint the integer obtained by replacing...
[{"type": "stdin_stdout", "input": "119\n", "output": "991\n"}, {"type": "stdin_stdout", "input": "999\n", "output": "111\n"}, {"type": "stdin_stdout", "input": "191\n", "output": "919\n"}, {"type": "stdin_stdout", "input": "111\n", "output": "999\n"}, {"type": "stdin_stdout", "input": "191\n", "output": "919\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLee tried so hard to make a good div.2 D problem to balance his recent contest, but it still doesn't feel good at all. Lee invented it so tediously slow that he managed to develop a phobia about div.2 D problem setting in...
[{"type": "stdin_stdout", "input": "7\n2\n2\n6\n8\n5\n110\n1478999\n", "output": "0\n0\n24\n96\n12\n782548134\n793574295\n"}, {"type": "stdin_stdout", "input": "7\n3\n2\n5\n8\n5\n101\n2000000\n", "output": "4\n0\n12\n96\n12\n981997171\n804665184\n"}, {"type": "stdin_stdout", "input": "3\n1234567\n1268501\n1268499\n", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA famous gang of pirates, Sea Dogs, has come back to their hideout from one of their extravagant plunders. They want to split their treasure fairly amongst themselves, that is why You, their trusted financial advisor, dev...
[{"type": "stdin_stdout", "input": "1000000000 3\n30490 19232\n45250 999980767\n264372930 1\n", "output": "-1"}, {"type": "stdin_stdout", "input": "1000000000 3\n30490 19232\n45250 999980767\n264372930 1\n", "output": "-1"}, {"type": "stdin_stdout", "input": "221407444 1\n999999999 999999999\n", "output": "-1\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the spirit of the holidays, Saitama has given Genos two grid paths of length n (a weird gift even by Saitama's standards). A grid path is an ordered sequence of neighbouring squares in an infinite grid. Two squares are...
[{"type": "stdin_stdout", "input": "200\nNESENEESEESWWWNWWSWSWNWNNWNNESWSWNNWNWNENESENNESSWSESWWSSSEEEESSENNNESSWWSSSSESWSWWNNEESSWWNNWSWSSWWNWNNEENNENWWNESSSENWNESWNESWNESEESSWNESSSSSESESSWNNENENESSWWNNWWSWWNESEENWWWWNWWNWWNENESESSWWSWWSES\nNWNESESSENNNESWNWWSWWWNWSESSSWWNWWNNWSENWSWNENNNWWSWWSWNNNESWWWSSESSWWWSSENWSE...
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\nProblem\n\nI started a part-time job at the rental DVD shop \"NEO\". First of all, I decided to study the fee system of this store.\n\nThere are three types of rental DVDs, old, semi-new, and new, and the rental fee for o...
[{"type": "stdin_stdout", "input": "135 100 340 4 200\n1 1 4\n70 100 351 5 200\n0 1 3\n70 100 340 6 343\n1 1 3\n0 0 0 0 0", "output": "1035\n1000\n1190\n"}, {"type": "stdin_stdout", "input": "135 100 340 5 200\n1 1 4\n70 100 351 5 200\n0 1 3\n70 100 340 6 343\n1 1 3\n0 0 0 0 0", "output": "1135\n1000\n1190\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a railroad in Takahashi Kingdom. The railroad consists of N sections, numbered 1, 2, ..., N, and N+1 stations, numbered 0, 1, ..., N. Section i directly connects the stations i-1 and i. A train takes exactly A_i ...
[{"type": "stdin_stdout", "input": "20 987654321\n129662684 2\n162021979 1\n458437539 1\n258406183 2\n202863355 1\n112218745 1\n348732033 1\n323036578 1\n382398703 1\n55854389 1\n283445191 1\n151300613 1\n693338042 2\n191178308 2\n386707193 1\n204580036 1\n335134457 1\n122253639 1\n824646518 2\n902554792 2", "output": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAnna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with each other. Specifically, each...
[{"type": "stdin_stdout", "input": "96 70\n30 37\n47 56\n19 79\n15 28\n2 43\n43 54\n59 75\n42 22\n38 18\n18 14\n47 41\n60 29\n35 11\n90 4\n14 41\n11 71\n41 24\n68 28\n45 92\n14 15\n34 63\n77 32\n67 38\n36 8\n37 4\n58 95\n68 84\n69 81\n35 23\n56 63\n78 91\n35 44\n66 63\n80 19\n87 88\n28 14\n62 35\n24 23\n83 37\n54 89\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarpus takes part in the \"Field of Wonders\" TV show. The participants of the show have to guess a hidden word as fast as possible. Initially all the letters of the word are hidden.\n\nThe game consists of several tu...
[{"type": "stdin_stdout", "input": "42\n*****o*******t********************oo******\n10\nvcrccobltkeidtxhsxhccaslkjhfyeqsetoowaemso\nuimjsoxifamvctkgqmrwhyjrgmlydczzqjoobnnwch\nuvmjsoqizfavctkxemrpaycngmlyemzzqjoobszwbh\nusmjsoviskzvctkljmrlmylugmlydfzzqvoobzawgh\nfeqweodinkhiatqmfokaxwcmlmbmvskssyookgcrax\ntackfosjhxeq...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMaga and Alex are good at string manipulation problems. Just now they have faced a problem related to string. But it is not a standard string problem. They have no idea to solve it. They need your help.\n\nA string is cal...
[{"type": "stdin_stdout", "input": "13405\nqlwkktpsmzutqfxhgzzwxmiknbrbvapvjakratudazxuyjnbpuwctnsfdmnskauhctkbccsshzwacneogswzefzvqcssdbywvjyptxneeeetdircmwfmpncbwiacyuvsdcbvfadpgsqvjvzhhhbxkdkwtxkapzhziruscydsimcwnugatftvdcmoyspvvjdecugelyuqeilbfidarbkuhesbzoodavpzobbcciogucwmrzcztdjisxsxsurysojdknbopkwxcporaiyohkcwr...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn Berland the opposition is going to arrange mass walking on the boulevard. The boulevard consists of n tiles that are lain in a row and are numbered from 1 to n from right to left. The opposition should start walking on...
[{"type": "stdin_stdout", "input": "250\n5 3 5 1 3 5 3 4 4 3 1 5 2 2 1 1 5 2 3 3 2 5 4 3 2 4 2 3 5 4 1 2 3 5 2 2 5 4 1 3 3 5 4 4 4 4 4 2 4 2 3 5 1 4 3 3 2 3 5 3 3 4 4 2 3 1 3 4 1 4 5 4 1 2 3 4 1 5 3 3 2 3 5 4 2 5 2 2 3 5 4 3 5 4 2 1 4 1 4 1 1 3 5 1 1 2 1 3 4 5 4 3 2 5 1 3 5 1 1 3 3 5 1 4 5 1 2 1 1 5 5 3 5 1 4 1 4 4 4 4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.\...
[{"type": "stdin_stdout", "input": "50\n44747747774474747747747447777447774747447477444474\n", "output": "YES"}, {"type": "stdin_stdout", "input": "50\n44444444444444444444444444444444444444444444444444\n", "output": "YES"}, {"type": "stdin_stdout", "input": "50\n77777777777777777777777777777777777777777777777777\n", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have a string S consisting of uppercase English letters. Additionally, an integer N will be given.\nShift each character of S by N in alphabetical order (see below), and print the resulting string.\nWe assume that A fo...
[{"type": "stdin_stdout", "input": "26\nYIHVXVZROUSFCUXIOGFIOUSIYDBTQLMECEEHARRBWUDXRITQZSTXNECYMODBOSODWDSWEFEXTVVPENGERSVLYSBDSJOKYSGTJQPEDQWMLFZANYYWWHRHPCOYXLEEBUPOBJMZVUTWCPXQEEHRPSUKCMIDRSBGHBRBAYXUGTZGFRSZTHEVFCFOOTPWYQMXJICOFMXDLCBINVZCPVWRKWDVGBDTDCWRNKPOXANOHOOCKXCSZBSHXXTGCKTSKBRZZTFAAQYFKZGNIZJJZSYTBOKKMTSH...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWhile purchasing certain items, a discount of 10% is offered if the quantity purchased is more than 1000. \nIf the quantity and price per item are input, write a program to calculate the total expenses.\n\n------ Input Fo...
[{"type": "stdin_stdout", "input": "3 \n100 120\n10 20\n1200 20\n", "output": "12000.000000\n200.000000\n21600.000000\n"}, {"type": "stdin_stdout", "input": "3 \n100 120\n10 20\n1200 40", "output": "12000.000000\n200.000000\n43200.000000\n"}, {"type": "stdin_stdout", "input": "3 \n100 215\n10 20\n1200 40", "output": "2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne beautiful July morning a terrible thing happened in Mainframe: a mean virus Megabyte somehow got access to the memory of his not less mean sister Hexadecimal. He loaded there a huge amount of n different natural numbe...
[{"type": "stdin_stdout", "input": "1000000000\n", "output": "512\n"}, {"type": "stdin_stdout", "input": "999999999\n", "output": "511\n"}, {"type": "stdin_stdout", "input": "121212121\n", "output": "511\n"}, {"type": "stdin_stdout", "input": "101010101\n", "output": "341\n"}, {"type": "stdin_stdout", "input": "9015561...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given $n$ lengths of segments that need to be placed on an infinite axis with coordinates.\n\nThe first segment is placed on the axis so that one of its endpoints lies at the point with coordinate $0$. Let's call ...
[{"type": "stdin_stdout", "input": "6\n2\n1 3\n3\n1 2 3\n4\n1 2 3 14\n4\n6 12 4 14\n7\n1 2 4 9 7 10 3\n8\n8 6 0 3 3 4 3 6\n", "output": "3\n3\n14\n16\n12\n8\n"}, {"type": "stdin_stdout", "input": "6\n2\n1 3\n3\n1 2 3\n4\n1 2 3 14\n4\n6 8 4 14\n7\n1 2 4 9 13 10 3\n8\n8 6 0 3 3 4 3 6\n", "output": "3\n3\n14\n14\n13\n8\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHere is a very simple variation of the game backgammon, named “Minimal Backgammon”. The game is played by only one player, using only one of the dice and only one checker (the token used by the player).\n\nThe game board ...
[{"type": "stdin_stdout", "input": "10 1 0 0\n7 1 0 0\n13 0 0 0\n6 11 1 1\n2\n5\n7 1 0 6\n1\n1\n3\n4\n5\n6\n0 0 0 0", "output": "0.000000\n0.000000\n0.000000\n0.829031\n0.000000\n"}, {"type": "stdin_stdout", "input": "6 1 0 0\n7 1 0 0\n7 2 0 0\n12 3 1 1\n2\n5\n8 10 0 6\n1\n3\n4\n4\n5\n6\n0 0 0 0", "output": "0.166667\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of len...
[{"type": "stdin_stdout", "input": "12814", "output": "160\n"}, {"type": "stdin_stdout", "input": "19710", "output": "199\n"}, {"type": "stdin_stdout", "input": "36877", "output": "272\n"}, {"type": "stdin_stdout", "input": "49568", "output": "315\n"}, {"type": "stdin_stdout", "input": "44971", "output": "300\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nInput\n\nThe input is given from standard input in the following format.\n\n\n> $H \\ W$ $a_{1, 1} \\ a_{1, 2} \\ \\cdots \\ a_{1, W}$ $a_{2, 1} \\ a_{2, 2} \\ \\cdots \\ a_{2, W}$ $\\vdots \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \...
[{"type": "stdin_stdout", "input": "4 6\n2 3 3 8 2 3\n11 8 9 0 2 0\n0 1 0 1 8 5\n3 10 3 5 9 27\n0 1 1 -1 2 4\n2 19 1 12 1 15", "output": "107\n"}, {"type": "stdin_stdout", "input": "4 6\n2 3 3 7 1 3\n11 8 9 0 2 0\n0 1 4 1 8 5\n3 10 3 5 9 14\n0 1 1 0 2 2\n2 19 1 12 1 10", "output": "96\n"}, {"type": "stdin_stdout", "inp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev got hold of lots of wooden cubes somewhere. They started making cube towers by placing the cubes one on top of the o...
[{"type": "stdin_stdout", "input": "53 3\n1 3 4 4 5 7 10 14 19 25 32 40 23 59 70 82 148 109 124 140 157 175 194 214 235 257 280 304 329 355 382 410 439 469 500 532 565 599 634 670 388 745 784 824 865 907 950 994 1039 1085 1132 1180 1229\n1 2 40\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "53 3\n1 3 4 4 5 7 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIt's a beautiful April day and Wallace is playing football with his friends. But his friends do not know that Wallace actually stayed home with Gromit and sent them his robotic self instead. Robo-Wallace has several advan...
[{"type": "stdin_stdout", "input": "111724 287004 1153685 512877 139642 23002\n", "output": "257072.950395018008"}, {"type": "stdin_stdout", "input": "435582 479389 540004 1229611 413521 1624\n", "output": "550382.746386589599"}, {"type": "stdin_stdout", "input": "246310 320553 585881 311740 443362 23788\n", "output": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\n-----Co...
[{"type": "stdin_stdout", "input": "30\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "40\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-40\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "-29\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "-30\n", "output": "No\n"}, {"type": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOn a chessboard with a width of $10^9$ and a height of $10^9$, the rows are numbered from bottom to top from $1$ to $10^9$, and the columns are numbered from left to right from $1$ to $10^9$. Therefore, for each cell of t...
[{"type": "stdin_stdout", "input": "0 5\n1 192023486 84774294\n243235878 312125306 50510976\n326016273 338641867 50510976\n570999440 445224816 125759940\n456157384 569789185 50510976\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "0 5\n1 192023486 50510976\n243235878 312125306 50510976\n326016273 338641867 505...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which counts and reports the number of each alphabetical letter. Ignore the case of characters.\n\nConstraints\n\n* The number of characters in the sentence < 1200\n\nInput\n\nA sentence in English is give...
[{"type": "stdin_stdout", "input": "This is ` pen.", "output": "a : 0\nb : 0\nc : 0\nd : 0\ne : 1\nf : 0\ng : 0\nh : 1\ni : 2\nj : 0\nk : 0\nl : 0\nm : 0\nn : 1\no : 0\np : 1\nq : 0\nr : 0\ns : 2\nt : 1\nu : 0\nv : 0\nw : 0\nx : 0\ny : 0\nz : 0\n"}, {"type": "stdin_stdout", "input": "This si a pen.", "output": "a : 1\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe string $s$ is given, the string length is odd number. The string consists of lowercase letters of the Latin alphabet.\n\nAs long as the string length is greater than $1$, the following operation can be performed on it...
[{"type": "stdin_stdout", "input": "5\nabcde\nc\nabcde\nb\nx\ny\naaaaaaaaaaaaaaa\na\ncontest\nt\n", "output": "YES\nNO\nNO\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "5\nabcde\nc\nabcde\nb\nx\ny\nabobobussss\ns\ncontest\nt\n", "output": "YES\nNO\nNO\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "1\nqwertyuiopp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAndi and Budi were given an assignment to tidy up their bookshelf of $n$ books. Each book is represented by the book title — a string $s_i$ numbered from $1$ to $n$, each with length $m$. Andi really wants to sort the boo...
[{"type": "stdin_stdout", "input": "5 2\nAA\nAB\nBB\nBA\nAZ\n", "output": "5 2 1 3 4 \n"}, {"type": "stdin_stdout", "input": "5 2\nAA\nAB\nBB\nBA\nAZ\n", "output": "5 2 1 3 4\n"}, {"type": "stdin_stdout", "input": "5 2\nAA\nAB\nBB\nBA\nZA\n", "output": "2 1 3 4 5\n"}, {"type": "stdin_stdout", "input": "5 2\nAA\nAB\nCB\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHr0d1y has $q$ queries on a binary string $s$ of length $n$. A binary string is a string containing only characters '0' and '1'.\n\nA query is described by a pair of integers $l_i$, $r_i$ $(1 \\leq l_i \\lt r_i \\leq n)$....
[{"type": "stdin_stdout", "input": "2\n6 3\n001000\n2 4\n1 3\n3 5\n4 2\n1111\n1 4\n2 3\n", "output": "\nYES\nNO\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "2\n6 3\n001000\n2 4\n1 3\n3 5\n4 2\n1111\n1 4\n2 3\n", "output": "YES\nNO\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "2\n6 3\n001000\n2 4\n1 3\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTo write a research paper, you should definitely follow the structured format. This format, in many cases, is strictly defined, and students who try to write their papers have a hard time with it.\n\nOne of such formats i...
[{"type": "stdin_stdout", "input": "5\n1 2 1 4 11\n3\n12 28 16\n0", "output": "1-2 1 4 11\n12 28 16\n"}, {"type": "stdin_stdout", "input": "5\n1 2 1 4 9\n3\n12 28 16\n0", "output": "1-2 1 4 9\n12 28 16\n"}, {"type": "stdin_stdout", "input": "5\n1 2 1 4 0\n3\n12 28 16\n0", "output": "1-2 1 4 0\n12 28 16\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor given an integer $n$, print all permutations of $\\\\{1, 2, ..., n\\\\}$ in lexicographic order.\n\nConstraints\n\n* $1 \\leq n \\leq 9$\n\nInput\n\nAn integer $n$ is given in a line.\n\nOutput\n\nPrint each permutati...
[{"type": "stdin_stdout", "input": "5", "output": "1 2 3 4 5\n1 2 3 5 4\n1 2 4 3 5\n1 2 4 5 3\n1 2 5 3 4\n1 2 5 4 3\n1 3 2 4 5\n1 3 2 5 4\n1 3 4 2 5\n1 3 4 5 2\n1 3 5 2 4\n1 3 5 4 2\n1 4 2 3 5\n1 4 2 5 3\n1 4 3 2 5\n1 4 3 5 2\n1 4 5 2 3\n1 4 5 3 2\n1 5 2 3 4\n1 5 2 4 3\n1 5 3 2 4\n1 5 3 4 2\n1 5 4 2 3\n1 5 4 3 2\n2 1 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nToday an outstanding event is going to happen in the forest — hedgehog Filya will come to his old fried Sonya!\n\nSonya is an owl and she sleeps during the day and stay awake from minute l_1 to minute r_1 inclusive. Also,...
[{"type": "stdin_stdout", "input": "519325240668210886 776112702001665034 360568516809443669 1272711703453279586 994594983925273138\n", "output": "256787461333454149\n"}, {"type": "stdin_stdout", "input": "519325240668210886 776112702001665034 360568516809443669 875594219634943179 994594983925273138\n", "output": "2567...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a positive integer $n$. Since $n$ may be very large, you are given its binary representation.\n\nYou should compute the number of triples $(a,b,c)$ with $0 \\leq a,b,c \\leq n$ such that $a \\oplus b$, $b \\...
[{"type": "stdin_stdout", "input": "1111111111111111111111111111111011111111111101101110111011111111010011111111111110111111111101011111\n", "output": "148758249\n"}, {"type": "stdin_stdout", "input": "11011111101010010\n", "output": "141427753\n"}, {"type": "stdin_stdout", "input": "1110\n", "output": "780\n"}, {"type...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven are two integer sequences of N elements each: A_1,...,A_N and B_1,...,B_N. Determine if it is possible to do the following operation at most N-2 times (possibly zero) so that, for every integer i from 1 to N, A_i \\...
[{"type": "stdin_stdout", "input": "6\n0 0 1 2 3 12\n0 2 14 6 2 3", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "6\n1 0 1 2 3 12\n0 2 14 6 2 3", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "6\n1 0 1 2 3 12\n0 4 14 6 2 3", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "6\n1 0 1 2 3 12\n1 4 14...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n\"This problem is rubbish! There is not statement, and there are only 5 test cases. The problemsetter took liberties with this problem!\" — people complained in the comments to one round on Codeforces. And even more... No...
[{"type": "stdin_stdout", "input": "5\n", "output": "1"}, {"type": "stdin_stdout", "input": "4\n", "output": "2"}, {"type": "stdin_stdout", "input": "2\n", "output": "3"}, {"type": "stdin_stdout", "input": "3\n", "output": "1"}, {"type": "stdin_stdout", "input": "1\n", "output": "2"}]
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Little Elephant has got a problem — somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.\n\nThe Little Elephant doesn't want to call the police u...
[{"type": "stdin_stdout", "input": "128\n1 2 4 6 8 17 20 20 23 33 43 49 49 49 52 73 74 75 82 84 85 87 90 91 102 103 104 105 111 111 401 142 142 152 155 160 175 176 178 181 183 184 101 188 191 193 326 202 202 214 224 225 236 239 240 243 246 247 249 249 257 257 261 264 265 271 277 281 284 284 286 289 290 296 297 303 305 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis is an interactive problem.\n\nNatasha is going to fly to Mars. Finally, Natasha sat in the rocket. She flies, flies... but gets bored. She wishes to arrive to Mars already! So she decides to find something to occupy ...
[{"type": "stdin_stdout", "input": "1000000000 30 1000000000\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\n", "output": "1\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\n500000000\n750000000\n875000000\n937500000\n968750000\n984375000\n992187500\n996093750\n99804...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMonocarp is the coach of the Berland State University programming teams. He decided to compose a problemset for a training session for his teams.\n\nMonocarp has $n$ problems that none of his students have seen yet. The $...
[{"type": "stdin_stdout", "input": "2\n4\n2 4\n3 4\n2 1\n1 3\n5\n1 5\n2 4\n3 3\n4 2\n5 1\n", "output": "3\n10\n"}, {"type": "stdin_stdout", "input": "2\n4\n2 4\n3 4\n2 1\n2 3\n5\n1 5\n2 4\n3 3\n4 2\n5 1\n", "output": "2\n10\n"}, {"type": "stdin_stdout", "input": "2\n4\n2 4\n3 3\n2 2\n1 3\n5\n1 5\n2 4\n3 3\n4 2\n5 1\n",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nShortest Common Non-Subsequence\n\nA subsequence of a sequence $P$ is a sequence that can be derived from the original sequence $P$ by picking up some or no elements of $P$ preserving the order. For example, \"ICPC\" is a...
[{"type": "stdin_stdout", "input": "0101\n1101001", "output": "0000\n"}, {"type": "stdin_stdout", "input": "0101\n1101000", "output": "0001\n"}, {"type": "stdin_stdout", "input": "0101\n0011001", "output": "1000\n"}, {"type": "stdin_stdout", "input": "0101\n0110001", "output": "0010\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFurik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik solved the task immediately....
[{"type": "stdin_stdout", "input": "1000 1010\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1000 1000\n", "output": "0"}, {"type": "stdin_stdout", "input": "1190 225\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1190 315\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1491 512\n", "output...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSeiji Hayashi had been a professor of the Nisshinkan Samurai School in the domain of Aizu for a long time in the 18th century. In order to reward him for his meritorious career in education, Katanobu Matsudaira, the lord ...
[{"type": "stdin_stdout", "input": "16\n10 8\n2 2\n2 6\n2 7\n6 6\n4 8\n4 2\n5 5\n4 8\n10 2\n6 7\n7 7\n7 8\n8 1\n5 4\n9 1\n10 3\n4 3\n8\n6 4\n2 2\n2 1\n2 4\n3 4\n4 2\n5 3\n1 1\n3 2\n3 3\n0", "output": "5\n5\n"}, {"type": "stdin_stdout", "input": "16\n10 9\n2 4\n2 6\n2 7\n6 6\n4 8\n4 2\n5 5\n4 8\n6 4\n6 7\n7 6\n7 8\n8 0\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nThere are many $ N $ colored balls of different weights in the queue. The queue is in ascending order from the beginning: $ 1,2,3, \\ dots, N-1, N, 1,2,3, \\ dots, N-1, N, 1,2,3, \\ dots $ The balls are lined u...
[{"type": "stdin_stdout", "input": "8 4\n46 70 57 10 174 41 130 43", "output": "193\n"}, {"type": "stdin_stdout", "input": "8 4\n46 70 57 10 174 33 130 43", "output": "201\n"}, {"type": "stdin_stdout", "input": "8 7\n46 70 57 3 174 25 130 43", "output": "1302\n"}, {"type": "stdin_stdout", "input": "8 4\n46 70 57 10 174...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne not particularly beautiful evening Valera got very bored. To amuse himself a little bit, he found the following game.\n\nHe took a checkered white square piece of paper, consisting of n × n cells. After that, he start...
[{"type": "stdin_stdout", "input": "10 60\n6 7\n2 4\n3 6\n1 4\n8 7\n2 8\n5 7\n6 4\n5 10\n1 7\n3 9\n3 4\n9 2\n7 1\n3 8\n10 7\n9 7\n9 1\n5 5\n4 7\n5 8\n4 2\n2 2\n9 4\n3 3\n7 5\n7 4\n7 7\n8 2\n8 1\n4 5\n1 10\n9 6\n3 1\n1 3\n3 2\n10 10\n4 6\n5 4\n7 3\n10 1\n3 7\n5 1\n10 9\n4 10\n6 10\n7 10\n5 9\n5 6\n1 2\n7 8\n3 5\n9 8\n9 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis is a simplified version of the task Toy Train. These two versions differ only in the constraints. Hacks for this version are disabled.\n\nAlice received a set of Toy Train™ from Bob. It consists of one train and a co...
[{"type": "stdin_stdout", "input": "5000 1\n4008 1126\n", "output": "6125 6124 6123 6122 6121 6120 6119 6118 6117 6116 6115 6114 6113 6112 6111 6110 6109 6108 6107 6106 6105 6104 6103 6102 6101 6100 6099 6098 6097 6096 6095 6094 6093 6092 6091 6090 6089 6088 6087 6086 6085 6084 6083 6082 6081 6080 6079 6078 6077 6076 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThose days, many boys use beautiful girls' photos as avatars in forums. So it is pretty hard to tell the gender of a user at the first glance. Last year, our hero went to a forum and had a nice chat with a beauty (he thou...
[{"type": "stdin_stdout", "input": "yufkkfwyhhvcjntsgsvpzbhqtmtgyxifqoewmuplphykmptfdebjxuaxigomjtwgtljwdjhjernkitifbomifbhysnmadtnyn\n", "output": "CHAT WITH HER!\n"}, {"type": "stdin_stdout", "input": "yufkkfwyhhvcjntsgsvpzbhqtmtgyxifqoewmuplphykmptfdebjxuaxigomjtwgtljwdjhjernkitifbomifbhysnmadtnyn\n", "output": "CHA...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn some country live wizards. They love to ride trolleybuses.\n\nA city in this country has a trolleybus depot with n trolleybuses. Every day the trolleybuses leave the depot, one by one and go to the final station. The f...
[{"type": "stdin_stdout", "input": "10 7 8\n2 4\n3 13\n4 7\n5 1\n9 16\n10 9\n12 18\n16 4\n17 16\n20 10\n", "output": "4.285714285714286\n4.511857892036909\n5.642857142857143\n13.071428571428573\n13.071428571428573\n13.071428571428573\n13.51185789203691\n18.28571428571429\n18.511857892036907\n21.514285714285712\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nChefs from all over the globe gather each year for an international convention. Each chef represents some country. Please, note that more than one chef can represent a country.\nEach of them presents their best dish to th...
[{"type": "stdin_stdout", "input": "4 5\nRamanujan India\nTorricelli Italy\nGauss Germany\nLagrange Italy\nRamanujan\nTorricelli\nTorricelli\nRamanujan\nLagrange\n", "output": "Italy\nRamanujan\n"}, {"type": "stdin_stdout", "input": "2 2\nNewton England\nEuclid Greece\nNewton\nEuclid\n", "output": "England\nEuclid\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMaksim walks on a Cartesian plane. Initially, he stands at the point $(0, 0)$ and in one move he can go to any of four adjacent points (left, right, up, down). For example, if Maksim is currently at the point $(0, 0)$, he...
[{"type": "stdin_stdout", "input": "39\n27 47\n30 9\n18 28\n49 16\n10 12\n25 13\n44 11\n13 9\n3 8\n30 2\n8 30\n38 32\n7 29\n38 43\n27 37\n6 13\n21 25\n31 18\n17 26\n51 52\n27 40\n10 43\n50 27\n41 41\n2 11\n38 45\n37 43\n20 52\n36 11\n43 46\n4 39\n22 32\n42 11\n8 37\n9 17\n38 8\n41 1\n24 50\n47 7\n", "output": "861\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAyush, Ashish and Vivek are busy preparing a new problem for the next Codeforces round and need help checking if their test cases are valid.\n\nEach test case consists of an integer $n$ and two arrays $a$ and $b$, of size...
[{"type": "stdin_stdout", "input": "24\n4\n1 2 3 4\n1 2 3 4\n4\n1 2 3 4\n1 2 4 3\n4\n1 2 3 4\n1 3 2 4\n4\n1 2 3 4\n1 3 4 2\n4\n1 2 3 4\n1 4 2 3\n4\n1 2 3 4\n1 4 3 2\n4\n1 2 3 4\n2 1 3 4\n4\n1 2 3 4\n2 1 4 3\n4\n1 2 3 4\n2 3 1 4\n4\n1 2 3 4\n2 3 4 1\n4\n1 2 3 4\n2 4 1 3\n4\n1 2 3 4\n2 4 3 1\n4\n1 2 3 4\n3 1 2 4\n4\n1 2 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFind the number of k-divisible numbers on the segment [a, b]. In other words you need to find the number of such integer values x that a ≤ x ≤ b and x is divisible by k.\n\n\n-----Input-----\n\nThe only line contains thre...
[{"type": "stdin_stdout", "input": "1 -1000000000000000000 1000000000000000000\n", "output": "2000000000000000001\n"}, {"type": "stdin_stdout", "input": "2 -1000000000000000000 1000000000000000000\n", "output": "1000000000000000001\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 -1000000000000000000 1000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Fair Nut likes kvass very much. On his birthday parents presented him $n$ kegs of kvass. There are $v_i$ liters of kvass in the $i$-th keg. Each keg has a lever. You can pour your glass by exactly $1$ liter pulling th...
[{"type": "stdin_stdout", "input": "4 4\n1000000000 1000000000 1000000000 1000000000\n", "output": "999999999\n"}, {"type": "stdin_stdout", "input": "4 4\n1000000000 1000000000 1000000000 1000000000\n", "output": "999999999\n"}, {"type": "stdin_stdout", "input": "4 4\n1000000000 1000000100 1000000000 1000000000\n", "ou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLinear Kingdom has exactly one tram line. It has n stops, numbered from 1 to n in the order of tram's movement. At the i-th stop ai passengers exit the tram, while bi passengers enter it. The tram is empty before it arriv...
[{"type": "stdin_stdout", "input": "100\n0 1\n0 0\n0 0\n1 0\n0 0\n0 1\n0 1\n1 1\n0 0\n0 0\n1 1\n0 0\n1 1\n0 1\n1 1\n0 1\n1 1\n1 0\n1 0\n0 0\n1 0\n0 0\n1 0\n0 0\n0 1\n1 1\n1 1\n0 1\n0 0\n1 0\n1 1\n0 1\n1 0\n1 1\n0 1\n1 1\n1 0\n0 0\n0 0\n0 1\n0 0\n-1 1\n1 1\n0 0\n1 1\n1 1\n0 0\n0 1\n1 0\n0 1\n0 0\n0 1\n0 1\n1 1\n1 1\n1 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Fair Nut is going to travel to the Tree Country, in which there are $n$ cities. Most of the land of this country is covered by forest. Furthermore, the local road system forms a tree (connected graph without cycles). ...
[{"type": "stdin_stdout", "input": "10\n81 34 31 38 69 62 54 18 72 29\n4 8 12\n2 9 25\n4 5 17\n5 7 35\n10 1 13\n9 3 53\n7 6 22\n1 6 82\n3 10 42\n", "output": " 187\n"}, {"type": "stdin_stdout", "input": "10\n11 43 11 96 18 53 25 89 31 41\n2 4 41\n7 1 88\n3 2 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor two sequences S and T of length N consisting of 0 and 1, let us define f(S, T) as follows:\n - Consider repeating the following operation on S so that S will be equal to T. f(S, T) is the minimum possible total cost o...
[{"type": "stdin_stdout", "input": "5\n52 67 72 25 79\n", "output": "269312\n"}, {"type": "stdin_stdout", "input": "5\n52 103 72 25 79", "output": "292096\n"}, {"type": "stdin_stdout", "input": "5\n63 103 72 25 79", "output": "306176\n"}, {"type": "stdin_stdout", "input": "1\n1000000000\n", "output": "999999993\n"}, {"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have $n \\times n$ square grid and an integer $k$. Put an integer in each cell while satisfying the conditions below. All numbers in the grid should be between $1$ and $k$ inclusive. Minimum number of the $i$-th row...
[{"type": "stdin_stdout", "input": "250 1000000000\n", "output": "770503193\n"}, {"type": "stdin_stdout", "input": "250 1000000000\n", "output": "770503193\n"}, {"type": "stdin_stdout", "input": "216 1142401243\n", "output": "820247611\n"}, {"type": "stdin_stdout", "input": "246 1140071398\n", "output": "783102336\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this p...
[{"type": "stdin_stdout", "input": "186\n2 1 2 1 1 1 1 1 2 1 1 2 2 2 1 1 2 2 1 1 1 2 1 1 2 2 1 1 1 2 2 1 1 1 1 1 2 1 1 1 2 1 2 1 1 2 1 1 1 2 2 2 2 2 2 2 1 2 1 2 1 1 2 1 2 2 1 1 1 1 1 2 2 1 2 2 1 2 2 1 1 1 2 2 1 1 2 2 1 2 2 1 2 2 2 2 2 1 1 1 1 2 1 1 2 2 2 2 2 2 1 1 1 1 1 2 1 1 2 2 1 2 2 1 1 1 1 1 2 2 1 1 2 2 1 2 2 2 1 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDue to the coronavirus pandemic, city authorities obligated citizens to keep a social distance. The mayor of the city Semyon wants to light up Gluharniki park so that people could see each other even at night to keep the ...
[{"type": "stdin_stdout", "input": "5\n2 1\n1 3\n2 2\n1 3\n5 4\n", "output": "1\n2\n2\n2\n10\n"}, {"type": "stdin_stdout", "input": "2\n461 5299\n118 177\n", "output": "1221420\n10443\n"}, {"type": "stdin_stdout", "input": "2\n461 5299\n176 177\n", "output": "1221420\n15576\n"}, {"type": "stdin_stdout", "input": "5\n5 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMike and !Mike are old childhood rivals, they are opposite in everything they do, except programming. Today they have a problem they cannot solve on their own, but together (with you) — who knows? \n\nEvery one of them ha...
[{"type": "stdin_stdout", "input": "17\n714413739 -959271262 714413739 -745891378 926207665 -404845105 -404845105 -959271262 -189641729 -670860364 714413739 -189641729 192457837 -745891378 -670860364 536388097 -959271262\n-417715348 -959271262 -959271262 714413739 -189641729 571055593 571055593 571055593 -417715348 -41...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle town Nsk consists of n junctions connected by m bidirectional roads. Each road connects two distinct junctions and no two roads connect the same pair of junctions. It is possible to get from any junction to any oth...
[{"type": "stdin_stdout", "input": "5 6 1 5\n1 2\n1 3\n1 4\n4 5\n3 5\n2 5\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "5 6 1 5\n1 2\n1 3\n1 4\n4 5\n3 5\n1 5\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "5 6 1 5\n1 2\n1 3\n2 4\n4 5\n3 5\n2 5\n", "output": "3\n"}, {"type": "stdin_stdout", "input": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSereja loves number sequences very much. That's why he decided to make himself a new one following a certain algorithm.\n\nSereja takes a blank piece of paper. Then he starts writing out the sequence in m stages. Each tim...
[{"type": "stdin_stdout", "input": "7\n1 53989\n1 47249\n1 71935\n2 1 3\n1 84520\n1 84185\n2 6 1\n14\n1 2 3 4 5 6 7 8 9 10 11 12 13 14\n", "output": "53989 47249 71935 53989 53989 53989 84520 84185 53989 47249 71935 53989 53989 53989\n"}, {"type": "stdin_stdout", "input": "7\n1 53989\n1 47249\n1 71935\n2 1 3\n1 84520\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAncient Egyptians are known to have used a large set of symbols $\\sum$ to write on the walls of the temples. Fafa and Fifa went to one of the temples and found two non-empty words S_1 and S_2 of equal lengths on the wall...
[{"type": "stdin_stdout", "input": "107 100000\n0 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\n0 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\nYou are given a tree (an undirected connected graph without cycles) and an integer $s$.\n\nVanya wants to put weights on all edges of the tree so that all weights are non-negative real numbers and their sum is $s$. At the...
[{"type": "stdin_stdout", "input": "3 1000000000\n3 2\n2 1\n", "output": "1000000000.000000000000000000"}, {"type": "stdin_stdout", "input": "2 1000000000\n2 1\n", "output": "1000000000.000000000000000000"}, {"type": "stdin_stdout", "input": "6 1\n2 1\n2 3\n2 5\n5 4\n5 6\n", "output": "0.500000000000000000"}, {"type": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlice is playing with some stones.\n\nNow there are three numbered heaps of stones. The first of them contains $a$ stones, the second of them contains $b$ stones and the third of them contains $c$ stones.\n\nEach time she...
[{"type": "stdin_stdout", "input": "64\n0 0 0\n0 0 1\n0 0 2\n0 0 3\n0 1 0\n0 1 1\n0 1 2\n0 1 3\n0 2 0\n0 2 1\n0 2 2\n0 2 3\n0 3 0\n0 3 1\n0 3 2\n0 3 3\n1 0 0\n1 0 1\n1 0 2\n1 0 3\n1 1 0\n1 1 1\n1 1 2\n1 1 3\n1 2 0\n1 2 1\n1 2 2\n1 2 3\n1 3 0\n1 3 1\n1 3 2\n1 3 3\n2 0 0\n2 0 1\n2 0 2\n2 0 3\n2 1 0\n2 1 1\n2 1 2\n2 1 3\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFrom the divine land of heaven came to earth a fruit known as Magic fruit.Unfortunately the fruit was found by two friends X and Y.\nAfter lot of fighting,they came to the conclusion that they will share the fruit if and ...
[{"type": "stdin_stdout", "input": "50", "output": "YES"}, {"type": "stdin_stdout", "input": "99", "output": "NO"}, {"type": "stdin_stdout", "input": "26", "output": "NO"}, {"type": "stdin_stdout", "input": "2", "output": "YES"}, {"type": "stdin_stdout", "input": "9", "output": "NO"}]
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently Luba learned about a special kind of numbers that she calls beautiful numbers. The number is called beautiful iff its binary representation consists of k + 1 consecutive ones, and then k consecutive zeroes.\n\nSo...
[{"type": "stdin_stdout", "input": "32640\n", "output": "32640\n"}, {"type": "stdin_stdout", "input": "97920\n", "output": "32640\n"}, {"type": "stdin_stdout", "input": "32640\n", "output": "32640\n"}, {"type": "stdin_stdout", "input": "97920\n", "output": "32640\n"}, {"type": "stdin_stdout", "input": "12096\n", "outpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRidbit starts with an integer $n$.\n\nIn one move, he can perform one of the following operations:\n\ndivide $n$ by one of its proper divisors, or\n\nsubtract $1$ from $n$ if $n$ is greater than $1$.\n\nA proper divisor i...
[{"type": "stdin_stdout", "input": "6\n1\n2\n3\n10\n10\n18\n", "output": "0\n1\n2\n2\n2\n2\n"}, {"type": "stdin_stdout", "input": "6\n1\n2\n3\n14\n6\n45\n", "output": "0\n1\n2\n2\n2\n3\n"}, {"type": "stdin_stdout", "input": "6\n2\n2\n3\n11\n4\n45\n", "output": "1\n1\n2\n3\n2\n3\n"}, {"type": "stdin_stdout", "input": "6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nYou brought a flat, holeless donut with a $ W $ horizontal $ H $ vertical $ H $ rectangle for ACPC.\nPlace this donut on the $ 2 $ dimension plane coordinate $ (0,0) $ with the center of the donut so that the s...
[{"type": "stdin_stdout", "input": "7828 5000 20 -1 1069 300", "output": "0.2806361085\n"}, {"type": "stdin_stdout", "input": "7828 10252 13 -1 292 464", "output": "1.5890410959\n"}, {"type": "stdin_stdout", "input": "7828 10252 13 -1 574 464", "output": "0.8083623693\n"}, {"type": "stdin_stdout", "input": "4997 2843 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nArkady coordinates rounds on some not really famous competitive programming platform. Each round features $n$ problems of distinct difficulty, the difficulties are numbered from $1$ to $n$.\n\nTo hold a round Arkady needs...
[{"type": "stdin_stdout", "input": "11000 10\n10000 9999 9998 1967 4502 9995 9994 10823 9992 9991\n", "output": "0000000000\n"}, {"type": "stdin_stdout", "input": "11000 10\n10000 9999 9998 1967 4502 9995 3707 10823 9992 9991\n", "output": "0000000000\n"}, {"type": "stdin_stdout", "input": "11010 10\n10000 9999 9998 19...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Smart Beaver from ABBYY invented a new message encryption method and now wants to check its performance. Checking it manually is long and tiresome, so he decided to ask the ABBYY Cup contestants for help.\n\nA message...
[{"type": "stdin_stdout", "input": "20 15 17\n4 9 14 11 15 16 15 4 0 10 7 12 10 1 8 6 7 14 1 13\n6 3 14 8 8 11 16 4 5 9 2 13 6 14 15\n", "output": "10 1 3 8 3 15 7 14 1 12 3 10 15 16 16 5 4 15 13 11 "}, {"type": "stdin_stdout", "input": "20 15 17\n4 9 14 11 15 16 15 4 0 10 7 12 10 1 8 6 7 14 1 13\n6 3 14 8 8 11 16 4 6 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA very brave explorer Petya once decided to explore Paris catacombs. Since Petya is not really experienced, his exploration is just walking through the catacombs.\n\nCatacombs consist of several rooms and bidirectional pa...
[{"type": "stdin_stdout", "input": "100\n0 0 0 0 0 0 1 4 4 0 2 2 4 1 7 1 11 0 8 4 12 12 3 0 3 2 2 4 3 9 1 5 4 6 9 14 6 2 4 18 7 7 19 11 20 13 17 16 0 34 2 6 12 27 9 4 29 22 4 20 20 17 17 20 37 53 17 3 3 15 1 46 11 24 31 6 12 6 11 18 13 1 5 0 19 10 24 41 16 41 18 52 46 39 16 30 18 23 53 13\n", "output": "66\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne of the oddest traditions of the town of Gameston may be that even the town mayor of the next term is chosen according to the result of a game. When the expiration of the term of the mayor approaches, at least three ca...
[{"type": "stdin_stdout", "input": "3 3\n1 2\n3 50\n10 29\n146 32\n39 2\n50 50\n0 0", "output": "0\n0\n1\n5\n31\n1\n13\n"}, {"type": "stdin_stdout", "input": "3 2\n1 2\n3 10\n10 29\n142 48\n39 2\n50 50\n0 0", "output": "1\n0\n2\n5\n63\n1\n13\n"}, {"type": "stdin_stdout", "input": "4 3\n3 3\n3 105\n10 29\n31 32\n27 5\n5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a functional graph. It is a directed graph, in which from each vertex goes exactly one arc. The vertices are numerated from 0 to n - 1.\n\nGraph is given as the array f_0, f_1, ..., f_{n} - 1, where f_{i} — ...
[{"type": "stdin_stdout", "input": "20 10\n13 10 5 6 18 5 12 13 15 1 10 3 9 16 7 9 7 11 9 13\n2634 7980 171 3503 6601 9378 4618 8243 9343 1979 4172 7441 9722 9863 6041 4790 1737 7586 6461 228\n", "output": " 62163 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a matrix, consisting of n rows and m columns. The rows are numbered top to bottom, the columns are numbered left to right.\n\nEach cell of the matrix can be either free or locked.\n\nLet's call a path in the...
[{"type": "stdin_stdout", "input": "9 10 30\n5 3\n5 5\n5 10\n1 3\n5 7\n1 8\n4 9\n2 10\n4 10\n3 1\n2 5\n3 8\n1 7\n2 2\n1 5\n2 3\n3 2\n3 10\n3 2\n2 7\n2 4\n1 4\n4 8\n2 8\n4 1\n5 3\n4 6\n5 8\n1 5\n1 1\n", "output": "1027\n857\n829\n783\n664\n648\n619\n611\n606\n595\n548\n527\n521\n486\n480\n469\n462\n458\n465\n458\n451\n4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\n-----Constraints-----\n - 0 \\leq A \\leq 10^{15}\n - 0 \\leq B < 10\n - A is an integer.\n - B is a number with two digits after t...
[{"type": "stdin_stdout", "input": "1000000000000000 9.99\n", "output": "9990000000000000\n"}, {"type": "stdin_stdout", "input": "1010000000000101 9.99", "output": "10089900000001008\n"}, {"type": "stdin_stdout", "input": "1010000000100101 9.99", "output": "10089900001000008\n"}, {"type": "stdin_stdout", "input": "1010...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIvan wants to have a good dinner. A good dinner should consist of a first course, a second course, a drink, and a dessert.\n\nThere are $n_1$ different types of first courses Ivan can buy (the $i$-th of them costs $a_i$ c...
[{"type": "stdin_stdout", "input": "5 5 5 5\n836 776 809 618 397\n121 629 373 169 333\n589 439 410 388 446\n936 472 433 647 791\n25\n1 2\n4 5\n5 4\n4 1\n3 5\n5 2\n2 4\n3 4\n3 3\n3 2\n4 4\n4 3\n1 1\n1 4\n5 1\n2 3\n1 5\n5 5\n2 5\n3 1\n2 1\n2 2\n1 3\n5 3\n4 2\n25\n1 1\n5 4\n4 1\n1 2\n1 4\n2 3\n3 3\n4 3\n2 2\n5 3\n2 1\n1 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA string $b$ is a subsequence of a string $a$ if $b$ can be obtained from $a$ by deletion of several (possibly, zero or all) characters. For example, \"xy\" is a subsequence of \"xzyw\" and \"xy\", but not \"yx\".\n\nYou ...
[{"type": "stdin_stdout", "input": "1\n200\nrgygrbbbrrbbuuggbburgybrtuybubtrbryrtutuuutrrgtbbgtggrggtttbgtbuubyuyyugtgygytbgrgttruturbyuytyyggruttrbbgggbrbryrtuggbuuburrttyubybbyygubrbguybgybubgbrruubbggugtbyurgrtruyrguruygyybygbyytygttbrryrubg\n", "output": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbgggggggggggggggggggg...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N cities numbered 1 through N, and M bidirectional roads numbered 1 through M. Road i connects City A_i and City B_i.\n\nSnuke can perform the following operation zero or more times:\n\n* Choose two distinct cit...
[{"type": "stdin_stdout", "input": "103 1\n6 8", "output": "101\n"}, {"type": "stdin_stdout", "input": "164 1\n6 8", "output": "162\n"}, {"type": "stdin_stdout", "input": "109 1\n5 9", "output": "107\n"}, {"type": "stdin_stdout", "input": "56 1\n12 11", "output": "54\n"}, {"type": "stdin_stdout", "input": "129 1\n4 6",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDima's got a staircase that consists of n stairs. The first stair is at height a_1, the second one is at a_2, the last one is at a_{n} (1 ≤ a_1 ≤ a_2 ≤ ... ≤ a_{n}). \n\nDima decided to play with the staircase, so he is t...
[{"type": "stdin_stdout", "input": "5\n1 2 3 6 6\n25\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer $x$ of $n$ digits $a_1, a_2, \\ldots, a_n$, which make up its decimal notation in order from left to right.\n\nAlso, you are given a positive integer $k < n$.\n\nLet's call integer $b_1, b_2, \\ld...
[{"type": "stdin_stdout", "input": "20 10\n21474836472147483648\n", "output": "20\n21474836482147483648\n"}, {"type": "stdin_stdout", "input": "20 19\n19999999999999999999\n", "output": "20\n20000000000000000002\n"}, {"type": "stdin_stdout", "input": "20 19\n19999999999999999999\n", "output": "20\n20000000000000000002\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which manipulates a sequence A = {a0, a1, . . . , an-1} with the following operations:\n\n* find(s, t): report the minimum element in as, as+1, . . . ,at.\n* update(i, x): change ai to x.\n\n\n\nNote that ...
[{"type": "stdin_stdout", "input": "5 5\n0 0 0\n1 2 4\n1 0 0\n1 1 9\n1 1 2", "output": "2147483647\n0\n2147483647\n2147483647\n"}, {"type": "stdin_stdout", "input": "6 5\n1 0 0\n0 1 2\n1 2 3\n1 0 2\n1 2 2", "output": "2147483647\n2147483647\n2\n2147483647\n"}, {"type": "stdin_stdout", "input": "3 5\n0 0 1\n1 1 2\n1 2 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe last stage of Football World Cup is played using the play-off system.\n\nThere are n teams left in this stage, they are enumerated from 1 to n. Several rounds are held, in each round the remaining teams are sorted in ...
[{"type": "stdin_stdout", "input": "256 128 256\n", "output": "Final!\n"}, {"type": "stdin_stdout", "input": "256 128 129\n", "output": "Final!\n"}, {"type": "stdin_stdout", "input": "256 255 128\n", "output": "Final!\n"}, {"type": "stdin_stdout", "input": "256 107 129\n", "output": "Final!\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDr .: Peter, I've finally done it.\n\nPeter: See you again? What kind of silly invention is this time?\n\nDr .: I finally came up with a revolutionary way to process mathematical formulas on a computer. Look at this table...
[{"type": "stdin_stdout", "input": "10 0 82 - /\n4 5 - 31 1 5 * * *\n0 -2 1 + +", "output": "-0.121951\n-155.000000\n-1.000000\n"}, {"type": "stdin_stdout", "input": "10 0 82 - /\n4 5 - 60 1 5 * * *\n0 -2 1 + +", "output": "-0.121951\n-300.000000\n-1.000000\n"}, {"type": "stdin_stdout", "input": "10 0 82 - /\n4 0 - 60 ...
code_stdio