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\nIn some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter.\nIt had been snowing for a while before it finally stopped. For some two adjacent ...
[{"type": "stdin_stdout", "input": "290178 291177\n", "output": "208323\n"}, {"type": "stdin_stdout", "input": "336594 337545\n", "output": "115131\n"}, {"type": "stdin_stdout", "input": "124075 124692\n", "output": "65961\n"}, {"type": "stdin_stdout", "input": "82747 83560\n", "output": "247331\n"}, {"type": "stdin_st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second β€” number B, etc. till column 26 that is marked by Z. Then there are two-le...
[{"type": "stdin_stdout", "input": "10\nR50C12\nR23C47\nY96\nR44C13\nR19C21\nR95C73\nBK12\nR51C74\nAY34\nR63C25\n", "output": "L50\nAU23\nR96C25\nM44\nU19\nBU95\nR12C63\nBV51\nR34C51\nY63\n"}, {"type": "stdin_stdout", "input": "10\nR50C12\nR23C47\nY96\nR44C13\nR19C21\nR95C73\nBK12\nR51C74\nAY34\nR62C25\n", "output": "L...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou're given Q queries of the form (L, R). \n\nFor each query you have to find the number of such x that L ≀ x ≀ R and there exist integer numbers a > 0, p > 1 such that x = a^{p}.\n\n\n-----Input-----\n\nThe first line c...
[{"type": "stdin_stdout", "input": "20\n862 928\n758 964\n541 789\n622 943\n328 900\n14 764\n217 1554\n461 847\n442 468\n544 1157\n518 529\n938 993\n620 851\n690 944\n484 601\n320 910\n98 1355\n816 794\n765 880\n551 1280\n", "output": "1\n4\n5\n6\n14\n32\n30\n9\n0\n12\n1\n1\n5\n4\n4\n15\n35\n0\n2\n13\n"}, {"type": "std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nPlay by arranging white and black stones on the table. First, place the stones on the left edge of the table. Then place the stones in the second place from the left. Repeat this n times to arrange n stones in ...
[{"type": "stdin_stdout", "input": "8\n1\n0\n0\n0\n1\n0\n0\n0\n4\n1\n-1\n0\n1\n1\n1\n1\n1\n0", "output": "8\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "8\n1\n1\n0\n1\n0\n0\n0\n1\n4\n1\n0\n0\n1\n1\n0\n1\n1\n0", "output": "0\n0\n1\n0\n"}, {"type": "stdin_stdout", "input": "8\n1\n1\n1\n1\n0\n-1\n0\n1\n3\n1\n0\n1\n1\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter the contest in comparing numbers, Shapur's teacher found out that he is a real genius and that no one could possibly do the calculations faster than him even using a super computer!\n\nSome days before the contest, ...
[{"type": "stdin_stdout", "input": "Iran_\nPersian;\nW_o;n;d;e;r;f;u;l;\n7\nWonderfulPersianIran\nwonderful_PersIAN_IRAN;;_\nWONDERFUL___IRAN__PERSIAN__;;\nIra__Persiann__Wonderful\nWonder;;fulPersian___;I;r;a;n;\n__________IranPersianWonderful__________\nPersianIran_is_Wonderful\n", "output": "ACC\nACC\nACC\nWA\nACC\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBased on the information of the time when study started and the time when study ended, check whether the total time studied in one day is t or more, and if not, create a program to find the shortage time. Time is one unit...
[{"type": "stdin_stdout", "input": "10\n3\n6 11\n12 15\n18 22\n14\n2\n6 14\n13 20\n0", "output": "OK\nOK\n"}, {"type": "stdin_stdout", "input": "10\n3\n6 11\n12 15\n34 22\n14\n2\n6 14\n13 20\n0", "output": "14\nOK\n"}, {"type": "stdin_stdout", "input": "10\n3\n20 11\n2 15\n34 22\n13\n2\n4 14\n13 33\n0", "output": "18\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBerland has n cities connected by m bidirectional roads. No road connects a city to itself, and each pair of cities is connected by no more than one road. It is not guaranteed that you can get from any city to any other o...
[{"type": "stdin_stdout", "input": "10 45\n3 5\n2 3\n4 8\n2 5\n6 8\n10 7\n2 1\n3 7\n5 10\n6 1\n9 8\n3 1\n2 10\n6 7\n1 7\n7 9\n6 9\n9 3\n4 2\n2 6\n5 6\n5 8\n3 4\n10 8\n7 8\n4 6\n9 1\n5 5\n7 4\n1 10\n9 2\n2 8\n6 10\n9 8\n1 5\n7 2\n10 3\n3 8\n2 10\n1 1\n10 7\n1 3\n1 8\n10 2\n4 10\n", "output": "0\n"}, {"type": "stdin_stdo...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOpen Binary and Object Group organizes a programming contest every year. Mr. Hex belongs to this group and joins the judge team of the contest. This year, he created a geometric problem with its solution for the contest. ...
[{"type": "stdin_stdout", "input": "9\n-1 1\n0 1\n1 1\n-1 0\n0 0\n1 0\n-1 -1\n0 -2\n1 -1", "output": "No\n"}, {"type": "stdin_stdout", "input": "9\n-1 1\n0 1\n1 1\n-1 0\n0 0\n1 0\n-1 -1\n0 -1\n1 -1", "output": "No"}, {"type": "stdin_stdout", "input": "4\n0 1\n1 -1\n0 -1\n1 1", "output": "Yes\n"}, {"type": "stdin_stdout...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs you could know there are no male planes nor female planes. However, each plane on Earth likes some other plane. There are n planes on Earth, numbered from 1 to n, and the plane with number i likes the plane with number...
[{"type": "stdin_stdout", "input": "100\n25 6 46 37 87 99 70 31 46 12 94 40 87 56 28 14 94 39 13 12 67 13 71 39 83 48 40 14 62 41 16 71 20 41 83 41 68 98 23 82 62 83 62 35 49 22 31 21 66 98 54 39 34 52 11 28 47 89 25 44 68 36 91 46 82 86 88 48 27 93 7 9 53 36 16 100 84 84 44 25 58 66 16 46 72 21 91 78 4 17 44 17 47 67 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThree swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.\n\nIt takes the first swimmer exactly $a$ minutes to swim across the entire pool and come back...
[{"type": "stdin_stdout", "input": "10\n992222955174044630 49635415 8474 173727148\n618311281854681640 657834994 40173216 75996939\n710602478618400425 332897175 71490165 534449640\n768753872531302819 113476460 449 799174641\n633188994852953277 834175592 3132 788542124\n964246686346975322 539872840 295075 782348226\n683...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or...
[{"type": "stdin_stdout", "input": "30\nRLLRLRLLRRRLRRRLLLLLLRRRLRRLRL\n128 610 1680 2436 2896 2994 3008 3358 3392 4020 4298 4582 4712 4728 5136 5900 6088 6232 6282 6858 6934 7186 7224 7256 7614 8802 8872 9170 9384 9794\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "30\nRLLRLRLLRRRLRRRLLLLLLRRRLRRLRL\n128 610...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a$ of $n$ integers, and another integer $k$ such that $2k \\le n$.\n\nYou have to perform exactly $k$ operations with this array. In one operation, you have to choose two elements of the array (let...
[{"type": "stdin_stdout", "input": "1\n88 38\n9 143 135 72 74 12 120 27 108 183 18 24 163 122 140 155 166 188 197 14 134 66 188 161 79 100 40 55 161 118 121 18 72 141 136 31 39 187 2 98 16 118 120 196 127 66 135 186 49 16 17 50 107 192 50 23 62 110 83 124 197 127 185 129 131 182 45 147 174 115 89 109 177 7 70 43 75 5 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHeiankyo is known as a town with a grid of roads.\n\nHokusai, a cat who lives in Heiankyo, has to go from his home to a secret place on the outskirts of town every day for patrol. However, I get tired of following the sam...
[{"type": "stdin_stdout", "input": "4\n0 2\n0\n1 2\n2\n0 0 0 1\n0 0 1 0\n4 0\n4\n1 0 0 0\n3 5 2 3\n4 0 4 0\n0 2 0 4\n15 5\n0", "output": "1\nMiserable Hokusai!\nMiserable Hokusai!\n15504\n"}, {"type": "stdin_stdout", "input": "4\n2 2\n0\n1 2\n2\n0 0 0 1\n0 0 1 0\n4 0\n4\n1 0 0 0\n3 3 2 3\n4 0 4 0\n0 2 0 3\n15 3\n0", "o...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDo you know \"sed,\" a tool provided with Unix? Its most popular use is to substitute every occurrence of a string contained in the input string (actually each input line) with another string Ξ². More precisely, it procee...
[{"type": "stdin_stdout", "input": "2\na bb\nb aa\nb\nbbbbbbbb\n1\nb aa\nb\naaaaa\n3\nbb aab\nabc aadc\nad dee\nabc\ndeeeeeeeec\n10\na acb\nb bai\nc acf\nd bec\ne bbh\nf fag\ng abe\nh bag\ni aaj\nj bbb\na\nabaceaabe\n0", "output": "-1\n-1\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "2\na bb\nb aa\nb\nbbbbbbbb\n1\nb ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTop-model Izabella participates in the competition. She wants to impress judges and show her mathematical skills.\n\nHer problem is following: for given string, consisting of only 0 and 1, tell if it's possible to remove ...
[{"type": "stdin_stdout", "input": "1111111111101111111111111111111111111011111111111111111111111101111011111101111111111101111111111111\n", "output": "yes\n"}, {"type": "stdin_stdout", "input": "0110111111111111111111011111111110110111110111111111111111111111111111111111111110111111111111111111\n", "output": "yes\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSo the Beautiful Regional Contest (BeRC) has come to an end! $n$ students took part in the contest. The final standings are already known: the participant in the $i$-th place solved $p_i$ problems. Since the participants ...
[{"type": "stdin_stdout", "input": "5\n12\n5 4 4 3 2 2 1 1 1 1 1 1\n4\n4 3 2 2\n1\n1000100\n20\n20 19 18 17 16 15 14 13 15 11 10 9 8 7 6 5 4 3 2 1\n32\n125 64 63 58 58 58 58 58 37 37 37 37 34 34 28 28 28 28 28 28 24 24 19 17 17 17 17 16 16 16 16 11\n", "output": "1 2 3\n0 0 0\n0 0 0\n1 2 7\n1 2 11\n"}, {"type": "stdin_...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese . \n\nYou are given two strings A and B of the same length. Each string contains N Lower case Latin character (from 'a' to 'z'). A shift operation will remove the first charact...
[{"type": "stdin_stdout", "input": "5\nccade\nbddcc", "output": "3\n"}, {"type": "stdin_stdout", "input": "5\nccade\nccdcb", "output": "0\n"}, {"type": "stdin_stdout", "input": "5\nddacc\nbddcc", "output": "1\n"}, {"type": "stdin_stdout", "input": "5\nddacc\nccddb", "output": "2\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian. \n\nAlok-nath is man of equality. He needs your help to divide his β€œsanskars” evenly amongst all his followers. By doing this, Alok-nath can create equality among...
[{"type": "stdin_stdout", "input": "2\n6 3\n1 4 14 4 11\n5 2\n-1 2 0 14 4", "output": "no\nno\n"}, {"type": "stdin_stdout", "input": "2\n6 3\n1 4 14 4 11\n5 4\n-1 2 0 14 4", "output": "no\nno\n"}, {"type": "stdin_stdout", "input": "2\n5 3\n1 2 14 4 11\n5 2\n-1 2 0 8 7", "output": "no\nno\n"}, {"type": "stdin_stdout", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCodehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.\n\nThe valid sizes of T-shirts are either \"M\" or from $0$ to $3$ \"X\" follo...
[{"type": "stdin_stdout", "input": "43\nL\nXXXL\nM\nXS\nL\nXXL\nS\nL\nM\nXXXL\nXXS\nS\nXS\nS\nXS\nXL\nXXL\nXXL\nXS\nXXS\nXXL\nL\nXXXL\nL\nL\nXXL\nXXL\nM\nXXXS\nM\nXXL\nXXXS\nXXXL\nXXS\nL\nL\nXS\nL\nXS\nXS\nL\nXXL\nM\nXXXL\nXXL\nXXL\nXL\nL\nXS\nM\nXL\nXXXS\nXXXS\nS\nXXL\nXXXL\nXXL\nXS\nXXS\nL\nS\nXXXS\nXL\nL\nXL\nXXXS\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis time the Berland Team Olympiad in Informatics is held in a remote city that can only be reached by one small bus. Bus has n passenger seats, seat i can be occupied only by a participant from the city a_{i}.\n\nToday ...
[{"type": "stdin_stdout", "input": "1 1000000000 1000000000\n100000\n", "output": " 0"}, {"type": "stdin_stdout", "input": "5 3 2\n1 1 2 1 1\n", "output": " 7"}, {"type": "stdin_stdout", "input": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nE869120 has A 1-yen coins and infinitely many 500-yen coins.\n\nDetermine if he can pay exactly N yen using only these coins.\n\n-----Constraints-----\n - N is an integer between 1 and 10000 (inclusive).\n - A is an integ...
[{"type": "stdin_stdout", "input": "2018\n218\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "2018\n113", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "2018\n111", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "2018\n101", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "2018\n100", "o...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a square grid of size $n \\times n$. Some cells are colored in black, all others are colored in white. In one operation you can select some rectangle and color all its cells in white. It costs $\\min(h, w)$ to co...
[{"type": "stdin_stdout", "input": "1000 24\n190 39 552 958\n539 146 763 587\n31 526 423 673\n208 432 953 442\n263 69 719 635\n162 428 623 797\n49 126 94 963\n749 623 979 919\n190 461 367 855\n211 240 939 914\n169 80 336 203\n684 546 829 582\n80 218 324 327\n560 452 656 637\n316 534 982 642\n521 634 758 686\n514 324 75...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAuction\n\nsquare1001 You were watching a certain auction.\n\nAn auction is a transaction in which when there are a large number of buyers and the number of items is limited, the one with the highest price is given the ri...
[{"type": "stdin_stdout", "input": "5\n-1 -1 -2 -2 3", "output": "4\n5\n"}, {"type": "stdin_stdout", "input": "5\n-1 -1 -3 -2 3", "output": "3\n5\n"}, {"type": "stdin_stdout", "input": "5\n-1 -1 -3 -1 3", "output": "3\n5\n"}, {"type": "stdin_stdout", "input": "5\n-1 -1 -6 -1 3", "output": "3\n5\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDevu is a renowned classical singer. He is invited to many big functions/festivals. Recently he was invited to \"All World Classical Singing Festival\". Other than Devu, comedian Churu was also invited.\n\nDevu has provid...
[{"type": "stdin_stdout", "input": "100 6000\n41 31 23 17 24 78 26 96 93 48 46 2 49 33 35 9 73 100 34 48 83 36 33 69 43 24 3 74 8 81 27 33 94 38 77 9 76 90 62 90 21 67 22 22 12 2 17 27 102 18 72 85 59 65 71 38 90 75 74 66 60 47 58 50 90 95 75 10 5 100 97 29 83 88 65 26 93 90 22 98 36 55 70 38 50 92 88 72 99 96 25 14 74...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the $2022$ year, Mike found two binary integers $a$ and $b$ of length $n$ (both of them are written only by digits $0$ and $1$) that can have leading zeroes. In order not to forget them, he wanted to construct integer ...
[{"type": "stdin_stdout", "input": "5\n1\n0\n3\n011\n3\n110\n6\n111000\n6\n001011\n", "output": "\n1\n110\n100\n101101\n101110\n"}, {"type": "stdin_stdout", "input": "5\n1\n0\n3\n011\n3\n110\n6\n111000\n6\n001011\n", "output": "1\n110\n100\n101101\n101110\n"}, {"type": "stdin_stdout", "input": "5\n1\n0\n3\n011\n3\n110\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConsider a simplified penalty phase at the end of a football match.\n\nA penalty phase consists of at most $10$ kicks, the first team takes the first kick, the second team takes the second kick, then the first team takes ...
[{"type": "stdin_stdout", "input": "4\n1001???0?1\n1111111111\n??????????\n0100001000\n", "output": "8\n10\n6\n10\n"}, {"type": "stdin_stdout", "input": "4\n1?0???1001\n1111111111\n??????????\n0000000000\n", "output": "7\n10\n6\n10\n"}, {"type": "stdin_stdout", "input": "4\n1001?1?0??\n0111111011\n??????????\n110001100...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven an array $a$ of length $n$ and an integer $k$, find the number of indices $1 \\leq i \\leq n - k$ such that the subarray $[a_i, \\dots, a_{i+k}]$ with length $k+1$ (not with length $k$) has the following property:\n...
[{"type": "stdin_stdout", "input": "1\n40 39\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi has a string S consisting of lowercase English letters.\nStarting with this string, he will produce a new one in the procedure given as follows.\nThe procedure consists of Q operations. In Operation i (1 \\leq i...
[{"type": "stdin_stdout", "input": "a\n6\n2 2 a\n2 1 b\n1\n2 2 c\n1\n1\n", "output": "aabc\n"}, {"type": "stdin_stdout", "input": "a\n6\n2 2 a\n2 1 b\n1\n2 2 d\n1\n1", "output": "aabd\n"}, {"type": "stdin_stdout", "input": "a\n6\n2 2 b\n2 1 b\n1\n2 2 d\n1\n1", "output": "babd\n"}, {"type": "stdin_stdout", "input": "a\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are playing a game called Guru Guru Gururin. In this game, you can move with the vehicle called Gururin. There are two commands you can give to Gururin: 'R' and 'L'. When 'R' is sent, Gururin rotates clockwise by 90 d...
[{"type": "stdin_stdout", "input": "RRLRRLRRRRLRRLRRRRLRRLRRRRLRRLRR", "output": "4"}, {"type": "stdin_stdout", "input": "RLLRRLLLRRRLLLLRR", "output": "0\n"}, {"type": "stdin_stdout", "input": "RLLRRLLMRRRLLLLRR", "output": "0\n"}, {"type": "stdin_stdout", "input": "RLLRLLLLRRRLLLRRR", "output": "0"}, {"type": "stdin_...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given $q$ queries in the following form:\n\nGiven three integers $l_i$, $r_i$ and $d_i$, find minimum positive integer $x_i$ such that it is divisible by $d_i$ and it does not belong to the segment $[l_i, r_i]$.\n...
[{"type": "stdin_stdout", "input": "30\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 1000000000 1\n1 100000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFrom 1603 to 1867, people call that era the EDO era. EDO stands for Enhanced Driving Operation, the most advanced space navigation technology at the time, and was developed by Dr. Izy in 1603.\n\nYou are a space adventure...
[{"type": "stdin_stdout", "input": "2\n10 11\n11 12\n2\nN 2\nE 1\n2\n10 11\n11 12\n2\nN 2\nW 1\n3\n0 15\n5 10\n5 15\n5\nW 20\nS 10\nN 20\nE 10\nS 10\n0", "output": "Yes\nNo\nNo\n"}, {"type": "stdin_stdout", "input": "2\n10 11\n11 12\n2\nN 2\nE 1\n2\n10 11\n11 12\n2\nN 3\nW 1\n3\n0 15\n5 10\n5 15\n5\nW 20\nS 10\nN 20\nE...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCapitalization is writing a word with its first letter as a capital letter. Your task is to capitalize the given word.\n\nNote, that during capitalization all the letters except the first one remains unchanged.\n\n\n-----...
[{"type": "stdin_stdout", "input": "lZqBqKeGvNdSeYuWxRiVnFtYbKuJwQtUcKnVtQhAlOeUzMaAuTaEnDdPfDcNyHgEoBmYjZyFePeJrRiKyAzFnBfAuGiUyLrIeLrNhBeBdVcEeKgCcBrQzDsPwGcNnZvTsEaYmFfMeOmMdNuZbUtDoQoNcGwDqEkEjIdQaPwAxJbXeNxOgKgXoEbZiIsVkRrNpNyAkLeHkNfEpLuQvEcMbIoGaDzXbEtNsLgGfOkZaFiUsOvEjVeCaMcZqMzKeAdXxJsVeCrZaFpJtZxInQxFaSmGgSsV...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads an integer and prints sum of its digits.\n\n\n\nInput\n\nThe input consists of multiple datasets. For each dataset, an integer x is given in a line. The number of digits in x does not exceed 10...
[{"type": "stdin_stdout", "input": "123\n158\n1100\n0", "output": "6\n14\n2\n"}, {"type": "stdin_stdout", "input": "123\n181\n1111\n0", "output": "6\n10\n4\n"}, {"type": "stdin_stdout", "input": "123\n418\n1100\n0", "output": "6\n13\n2\n"}, {"type": "stdin_stdout", "input": "123\n418\n1110\n0", "output": "6\n13\n3\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi, who is A years old, is riding a Ferris wheel.\nIt costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for...
[{"type": "stdin_stdout", "input": "30 100\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "13 298\n", "output": "298\n"}, {"type": "stdin_stdout", "input": "60 654\n", "output": "654\n"}, {"type": "stdin_stdout", "input": "12 100\n", "output": "50\n"}, {"type": "stdin_stdout", "input": "6 482\n", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Smart Beaver from ABBYY loves puzzles. One of his favorite puzzles is the magic square. He has recently had an idea to automate the solution of this puzzle. The Beaver decided to offer this challenge to the ABBYY Cup ...
[{"type": "stdin_stdout", "input": "4\n-64322865 -60701256 -53458038 -42593211 -38971602 -31728384 -24485166 -17241948 -2755512 4487706 11730924 18974142 22595751 33460578 40703796 44325405\n", "output": "-39994920\n-60701256 -64322865 44325405 40703796\n-2755512 33460578 -53458038 -17241948\n18974142 -31728384 1173092...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nInternational Christmas Present Company (ICPC) is a company to employ Santa and deliver presents on Christmas. Many parents request ICPC to deliver presents to their children at specified time of December 24. Although sam...
[{"type": "stdin_stdout", "input": "3 2 3\n0 1 10\n1 2 15\n0 -1\n1 8\n2 -1\n3 2 4\n0 1 10\n1 2 10\n0 0\n1 19\n2 20\n0 25\n13 10 10\n0 1 39\n2 3 48\n3 5 20\n4 8 25\n3 9 10\n8 9 40\n3 4 5\n5 0 17\n0 7 93\n1 3 13\n0 0\n1 100000000\n2 100\n3 543\n4 500\n5 400\n6 300\n6 200\n8 100\n9 100\n0 0 0", "output": "3\n3\n4\n"}, {"t...
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\nEshag has an array $a$ consisting of $n$ integers.\n\nEshag can perform the following operation any number of times: choose some subsequence of $a$ and delete every element from it which is strictly larger than $AVG$, whe...
[{"type": "stdin_stdout", "input": "3\n6\n1 1 1 7 3 1\n6\n17 17 8 11 9 12\n6\n10 2 2 2 1 1\n", "output": "2\n5\n4\n"}, {"type": "stdin_stdout", "input": "3\n6\n1 1 1 7 3 1\n6\n17 17 8 11 9 12\n6\n10 2 2 2 0 1\n", "output": "2\n5\n5\n"}, {"type": "stdin_stdout", "input": "3\n6\n1 1 2 7 3 1\n6\n17 17 8 11 9 12\n6\n10 2 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRikhail Mubinchik believes that the current definition of prime numbers is obsolete as they are too complex and unpredictable. A palindromic number is another matter. It is aesthetically pleasing, and it has a number of r...
[{"type": "stdin_stdout", "input": "10000 239\n", "output": "1168638\n"}, {"type": "stdin_stdout", "input": "10001 239\n", "output": "1168798\n"}, {"type": "stdin_stdout", "input": "10000 239\n", "output": "1168638"}, {"type": "stdin_stdout", "input": "10278 674\n", "output": "204510\n"}, {"type": "stdin_stdout", "inpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHave you ever played Hanabi? If not, then you've got to try it out! This problem deals with a simplified version of the game.\n\nOverall, the game has 25 types of cards (5 distinct colors and 5 distinct values). Borya is ...
[{"type": "stdin_stdout", "input": "100\nY3 Y3 Y5 Y2 Y4 Y1 Y2 Y3 Y1 Y5 Y3 Y1 Y4 Y5 Y5 Y3 Y1 Y5 Y2 Y3 Y1 Y4 Y4 Y1 Y2 Y2 Y4 Y2 Y4 Y5 Y5 Y2 Y3 Y1 Y3 Y5 Y3 Y1 Y5 Y3 Y3 Y2 Y5 Y1 Y5 Y5 Y4 Y2 Y2 Y1 Y2 Y4 Y3 Y2 Y5 Y3 Y4 Y3 Y1 Y4 Y2 Y4 Y4 Y3 Y3 Y1 Y1 Y4 Y2 Y5 Y3 Y4 Y4 Y4 Y3 Y2 Y2 Y2 Y3 Y4 Y4 Y2 Y1 Y2 Y2 Y4 Y3 Y5 Y4 Y2 Y5 Y3 Y1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOnce again, Boris needs the help of Anton in creating a task. This time Anton needs to solve the following problem:\n\nThere are two arrays of integers $a$ and $b$ of length $n$. It turned out that array $a$ contains only...
[{"type": "stdin_stdout", "input": "5\n3\n1 -1 0\n1 1 -2\n3\n0 1 1\n0 2 2\n2\n1 -1\n1 44\n2\n-1 0\n-1 -38\n5\n1 1 -1 1 -1\n1 1 -1 1 -1\n", "output": "YES\nNO\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "5\n3\n0 -1 -1\n1 1 -2\n3\n0 1 1\n0 1 2\n2\n1 0\n1 41\n2\n-1 0\n-1 -41\n5\n0 1 -1 1 -1\n0 1 -1 1 -1\n", "out...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nInna and Dima bought a table of size n Γ— m in the shop. Each cell of the table contains a single letter: \"D\", \"I\", \"M\", \"A\".\n\nInna loves Dima, so she wants to go through his name as many times as possible as she...
[{"type": "stdin_stdout", "input": "14 34\nDDDDDDDDDDDDIMADDDDDDDDDDDDDDDIMAD\nDDDDDDIMADDDDDDDDDDDDDDDDDDDDDIMAD\nDDDDDDDDDDDDDIDDDDDDDDDDDIDIMIDIMA\nDDDDDDIMDDDDDDDDDDDDDIDDDDDDDDDDDD\nDDDDDDDDDDDDDDDDDMADDDDDDDDDDDDDMD\nDDDDDDIMIDDDDDDDDDDDDIMIDIMIDDDIDD\nDDDDDDDDDDDDDDDDDMIMDDDDIMDDIMADIM\nDDDDDDDDDDDADIMADIDDDDDDI...
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, \\ldots, b_n$ ($n > 1$) Β β€” $\\min\\limits_{1 \\leq i < j \\leq n} |b_i - b_j|$.\n\nYou're given an array $a_1, a_2, \\ldots a_n$ and a number $k$. Calculate the sum of beauty over ...
[{"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\nGerald plays the following game. He has a checkered field of size n Γ— n cells, where m various cells are banned. Before the game, he has to put a few chips on some border (but not corner) board cells. Then for n - 1 minut...
[{"type": "stdin_stdout", "input": "10 5\n2 1\n4 4\n2 2\n4 3\n1 1\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "5 5\n3 2\n5 4\n3 3\n2 3\n1 2\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "5 5\n3 2\n1 4\n5 1\n4 5\n3 1\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "5 5\n2 2\n5 3\n2 3\n5 1\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the world of DragonBool there are fierce warriors called Soints. Also there are even fiercer warriors called Sofloats – the mortal enemies of Soints.\n\nThe power of each warrior is determined by the amount of chakra h...
[{"type": "stdin_stdout", "input": "2\n2 3\n10 1\n20 2\n5 2\n4 2\n18 1\n5 5\n73 87\n100 13\n36 36\n77 46\n16 93\n49 46\n27 93\n118 87\n172 13\n63 36", "output": "8\n155\n"}, {"type": "stdin_stdout", "input": "2\n2 3\n7 1\n20 2\n5 2\n4 2\n18 1\n5 5\n73 87\n100 13\n36 36\n77 46\n16 93\n49 46\n27 93\n118 87\n172 13\n63 36...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA ski base is planned to be built in Walrusland. Recently, however, the project is still in the constructing phase. A large land lot was chosen for the construction. It contains n ski junctions, numbered from 1 to n. Init...
[{"type": "stdin_stdout", "input": "2 40\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n", "output": "0\n1\n3\n7\n15\n31\n63\n127\n255\n511\n1023\n2047\n4095\n8191\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is an integer x that is greater than or equal to 0, and less than or equal to 1.\nOutput 1 if x is equal to 0, or 0 if x is equal to 1.\n\n-----Constraints-----\n - 0 \\leq x \\leq 1\n - x is an integer\n\n-----Inpu...
[{"type": "stdin_stdout", "input": "000", "output": "1\n"}, {"type": "stdin_stdout", "input": "000", "output": "1\n"}, {"type": "stdin_stdout", "input": "1\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "0\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1", "output": "0"}, {"type": "stdin_stdout", "in...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPhoenix has $n$ coins with weights $2^1, 2^2, \\dots, 2^n$. He knows that $n$ is even.\n\nHe wants to split the coins into two piles such that each pile has exactly $\\frac{n}{2}$ coins and the difference of weights betwe...
[{"type": "stdin_stdout", "input": "100\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\n30\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is a string S. Replace every character in S with x and print the result.\n\n-----Constraints-----\n - S is a string consisting of lowercase English letters.\n - The length of S is between 1 and 100 (inclusive).\n\n-...
[{"type": "stdin_stdout", "input": "kvtvweokpottycaeeyfthzfvsgckwjmgqadfekjfitnsieylhumxjjezqvidkxjpywokrnzxxwraamuimhmrjwqeyvjvyjjzsxxf\n", "output": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"}, {"type": "stdin_stdout", "input": "qvssniprlkdntynymqcjoxpttvp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer N.\nFind the number of the positive divisors of N!, modulo 10^9+7.\n\n-----Constraints-----\n - 1≀N≀10^3\n\n-----Input-----\nThe input is given from Standard Input in the following format:\nN\n\n-...
[{"type": "stdin_stdout", "input": "1000\n", "output": "972926972\n"}, {"type": "stdin_stdout", "input": "1001", "output": "513172208\n"}, {"type": "stdin_stdout", "input": "108", "output": "875619122\n"}, {"type": "stdin_stdout", "input": "111", "output": "130571620\n"}, {"type": "stdin_stdout", "input": "101", "outpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two positive integers $x$ and $y$. You can perform the following operation with $x$: write it in its binary form without leading zeros, add $0$ or $1$ to the right of it, reverse the binary form and turn it ...
[{"type": "stdin_stdout", "input": "1740680371580423905 1636173592742219971\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "999999999999999999 1636173592742219971\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "616543106594181990 1600944574522397396\n", "output": "NO\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSnuke is buying a bicycle.\nThe bicycle of his choice does not come with a bell, so he has to buy one separately.\nHe has very high awareness of safety, and decides to buy two bells, one for each hand.\nThe store sells th...
[{"type": "stdin_stdout", "input": "10000 10000 10000\n", "output": "20000\n"}, {"type": "stdin_stdout", "input": "10000 10100 10000", "output": "20000\n"}, {"type": "stdin_stdout", "input": "10000 00100 10000", "output": "10100\n"}, {"type": "stdin_stdout", "input": "11000 10100 10000", "output": "20100\n"}, {"type": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSquare Route\n\nSquare root\n\nEnglish text is not available in this practice contest.\n\nMillionaire Shinada, who has decided to build a new mansion, is wondering in which city to build the new mansion. To tell the truth...
[{"type": "stdin_stdout", "input": "3 3\n2\n1\n2\n-1\n3\n1\n1 2\n22\n11\n10\n0 0", "output": "7\n0\n"}, {"type": "stdin_stdout", "input": "3 3\n1\n1\n2\n1\n1\n1\n1 2\n10\n10\n23\n0 0", "output": "11\n1\n"}, {"type": "stdin_stdout", "input": "3 3\n1\n1\n1\n2\n3\n1\n1 2\n10\n10\n10\n0 0", "output": "6\n2\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese . \n\nGiven an array of n non-negative integers: A_{1}, A_{2}, …, A_{N}. Your mission is finding a pair of integers A_{u}, A_{v} (1 ≀ u < v ≀ N) such that (A_{u} and A_{v}) is...
[{"type": "stdin_stdout", "input": "4\n1\n11\n23\n11", "output": "11\n"}, {"type": "stdin_stdout", "input": "4\n4\n11\n18\n16", "output": "16\n"}, {"type": "stdin_stdout", "input": "4\n1\n15\n17\n14", "output": "14\n"}, {"type": "stdin_stdout", "input": "4\n13\n10\n3\n13", "output": "13\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor a given sequence of distinct non-negative integers $(b_1, b_2, \\dots, b_k)$ we determine if it is good in the following way:\n\nConsider a graph on $k$ nodes, with numbers from $b_1$ to $b_k$ written on them.\n\nFor ...
[{"type": "stdin_stdout", "input": "109\n74 18 237 179 195 112 156 11 72 68 173 202 78 250 224 251 107 55 186 144 57 62 28 210 132 64 93 6 211 0 174 163 248 226 167 246 46 102 253 180 121 56 151 35 150 254 168 201 242 118 190 158 196 30 75 116 187 96 215 244 192 73 12 175 33 222 131 256 181 230 114 165 128 234 63 90 44...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBomboslav likes to look out of the window in his room and watch lads outside playing famous shell game. The game is played by two persons: operator and player. Operator takes three similar opaque shells and places a ball ...
[{"type": "stdin_stdout", "input": "2000000000\n0\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1999999995\n0\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "1999999995\n1\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1999999995\n2\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have an array of integers (initially empty).\n\nYou have to perform $q$ queries. Each query is of one of two types:\n\n\"$1$ $x$\" β€” add the element $x$ to the end of the array;\n\n\"$2$ $x$ $y$\" β€” replace all occurr...
[{"type": "stdin_stdout", "input": "8\n2 1 4\n1 1\n1 4\n1 2\n2 2 4\n2 4 3\n1 2\n2 2 7\n", "output": "1 3 3 7 \n"}, {"type": "stdin_stdout", "input": "8\n2 1 4\n1 1\n1 4\n1 2\n2 2 4\n2 4 3\n1 2\n2 2 7\n", "output": "1 3 3 7 "}, {"type": "stdin_stdout", "input": "8\n2 2 4\n1 1\n1 4\n1 2\n2 2 4\n2 4 3\n1 2\n2 2 7\n", "out...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n> I would, if I could,\n> If I couldn't how could I?\n> I couldn't, without I could, could I?\n> Could you, without you could, could ye?\n> Could ye? could ye?\n> Could you, without you could, could ye?\n\nIt is true...
[{"type": "stdin_stdout", "input": "15 2 3\n16 3 6\n110 9 112\n0 0 0", "output": "1\n11\n98\n"}, {"type": "stdin_stdout", "input": "15 2 4\n16 3 6\n110 9 112\n0 0 0", "output": "8\n11\n98\n"}, {"type": "stdin_stdout", "input": "15 2 4\n15 3 6\n110 9 112\n0 0 0", "output": "8\n10\n98\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn an attempt to escape the Mischievous Mess Makers' antics, Farmer John has abandoned his farm and is traveling to the other side of Bovinia. During the journey, he and his k cows have decided to stay at the luxurious Gr...
[{"type": "stdin_stdout", "input": "491 172\n01111101111111100000111010110001010001110111000010101111101000100010010111011101110110111101101010111000111000011100011010010010111111000011011010100110001000011100111000001011100010001111101111101000111001100110010100101000001110010100100100100101001100010101001000010000111...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nE869120 is initially standing at the origin (0, 0) in a two-dimensional plane.\nHe has N engines, which can be used as follows:\n - When E869120 uses the i-th engine, his X- and Y-coordinate change by x_i and y_i, respect...
[{"type": "stdin_stdout", "input": "100\n-62558 -455059\n-78926 -574123\n-122264 -889372\n-29760 -216480\n-91884 -668382\n-122636 -892078\n-134168 -975964\n-17670 -128535\n-127782 -929511\n-74524 -542102\n-104470 -759935\n-133362 -970101\n-93124 -677402\n-16368 -119064\n-19530 -142065\n-82336 -598928\n-87358 -635459\n-...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAt Aizu Riverside Hospital, inpatients walk twice a day for rehabilitation and health promotion. As the number of people trying to recover their physical strength by walking is increasing day by day in order to leave the ...
[{"type": "stdin_stdout", "input": "5\n263 1519 1817\n2 1240 1985\n11656 1896 4132\n10001 503 3107\n51 1421 2690\n3\n345 1628 2181\n7 3910 1590\n5982 2525 3616\n0", "output": "11656 6028\n5982 6141\n"}, {"type": "stdin_stdout", "input": "5\n263 1519 1817\n2 1240 1985\n11656 1896 4132\n10001 503 3107\n51 1421 2690\n3\n3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nExpression Mining\n\nConsider an arithmetic expression built by combining single-digit positive integers with addition symbols `+`, multiplication symbols `*`, and parentheses `(` `)`, defined by the following grammar rul...
[{"type": "stdin_stdout", "input": "3\n(3+2)*3+1\n1\n1*1*1+1+1*1\n1307\n1*(2*3*4)+5+((5+7*8))*(9)\n0", "output": "2\n10\n0\n"}, {"type": "stdin_stdout", "input": "3\n(1+2)*4+3\n1\n1*1*1+1*1*1\n1108\n1*(2*3*4)+5+((6+7*8))*(9)\n0", "output": "3\n12\n0\n"}, {"type": "stdin_stdout", "input": "3\n(1+2)*3+3\n1\n1*1*1+1+1*1\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n shovels in Polycarp's shop. The i-th shovel costs i burles, that is, the first shovel costs 1 burle, the second shovel costs 2 burles, the third shovel costs 3 burles, and so on. Polycarps wants to sell shovel...
[{"type": "stdin_stdout", "input": "499999999\n", "output": "1249999995\n"}, {"type": "stdin_stdout", "input": "1000000000\n", "output": "500000000\n"}, {"type": "stdin_stdout", "input": "499999998\n", "output": "1249999991\n"}, {"type": "stdin_stdout", "input": "458679894\n", "output": "1043399471\n"}, {"type": "stdin...
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\nSFFSSFFFFFFSSFFFSSFSFFFFFSSFFFSFFFFFFSFSSSFSFSFFFFSFSSFFFFFFFFSFFFFFSFFFFFSSFFFSFFSFSFFFFSFFSFFFFFFF\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\nN contestants participated in a competition. The total of N-1 matches were played in a knockout tournament. For some reasons, the tournament may not be \"fair\" for all the contestants. That is, the number of the matches ...
[{"type": "stdin_stdout", "input": "7\n1\n2\n2\n3\n1\n4", "output": "4\n"}, {"type": "stdin_stdout", "input": "7\n1\n4\n2\n3\n1\n3", "output": "5\n"}, {"type": "stdin_stdout", "input": "7\n1\n4\n2\n3\n1\n4", "output": "4\n"}, {"type": "stdin_stdout", "input": "7\n1\n4\n2\n3\n1\n7", "output": "4\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEugene likes working with arrays. And today he needs your help in solving one challenging task.\n\nAn array $c$ is a subarray of an array $b$ if $c$ can be obtained from $b$ by deletion of several (possibly, zero or all) ...
[{"type": "stdin_stdout", "input": "3\n41 -41 41\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "3\n41 -60 41\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "3\n57 -60 41\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "3\n57 -33 41\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "3\n5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have a rectangular parallelepiped of size AΓ—BΓ—C, built with blocks of size 1Γ—1Γ—1. Snuke will paint each of the AΓ—BΓ—C blocks either red or blue, so that:\n\n* There is at least one red block and at least one blue block....
[{"type": "stdin_stdout", "input": "19 9 5", "output": "45\n"}, {"type": "stdin_stdout", "input": "11 5 5", "output": "25\n"}, {"type": "stdin_stdout", "input": "-1 2 10", "output": "0\n"}, {"type": "stdin_stdout", "input": "19 5 5", "output": "25\n"}, {"type": "stdin_stdout", "input": "5 5 5", "output": "25\n"}, {"typ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGreg has an array a = a1, a2, ..., an and m operations. Each operation looks as: li, ri, di, (1 ≀ li ≀ ri ≀ n). To apply operation i to the array means to increase all array elements with numbers li, li + 1, ..., ri by va...
[{"type": "stdin_stdout", "input": "4 3 6\n2 1 3 4\n1 2 2\n2 3 2\n3 4 4\n1 2\n1 3\n2 3\n1 2\n1 3\n2 3\n", "output": "10 21 31 20\n"}, {"type": "stdin_stdout", "input": "4 3 6\n2 1 3 4\n1 2 2\n2 4 2\n3 4 4\n1 2\n1 3\n2 3\n1 2\n1 3\n2 3\n", "output": "10 21 31 32\n"}, {"type": "stdin_stdout", "input": "4 3 6\n2 1 3 4\n1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSimon has an array a_1, a_2, ..., a_{n}, consisting of n positive integers. Today Simon asked you to find a pair of integers l, r (1 ≀ l ≀ r ≀ n), such that the following conditions hold: there is integer j (l ≀ j ≀ r), ...
[{"type": "stdin_stdout", "input": "5\n2 3 5 7 11\n", "output": "5 0\n1 2 3 4 5 \n"}, {"type": "stdin_stdout", "input": "5\n2 3 5 9 17\n", "output": "5 0\n1 2 3 4 5\n"}, {"type": "stdin_stdout", "input": "5\n2 3 5 7 11\n", "output": "5 0\n1 2 3 4 5 "}, {"type": "stdin_stdout", "input": "2\n999999 1000000\n", "output": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem Statement\n\nLet's consider operations on monochrome images that consist of hexagonal pixels, each of which is colored in either black or white. Because of the shape of pixels, each of them has exactly six neighbo...
[{"type": "stdin_stdout", "input": "00000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000111111111\n10000000111111110000000011111111000000001111111100000000111111110000000011111111000000001111111100000000111111110000000011111111\n010101010101010101010101...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nF: Multiplication is fun --Multiplication Is Interesting -\n\nstory\n\nNamba, a high school boy, is thinking of giving her a few lines on her birthday. She is a girl who loves multiplication, so Namba wants to give her a ...
[{"type": "stdin_stdout", "input": "3 3.9884088227062082\n4.1091643442474926\n2.4255254960412556\n3.5822804934056625\n5.345178229082616\n3.4110023092801276\n4.814519106855367", "output": "1\n"}, {"type": "stdin_stdout", "input": "2 2.7392730443507527\n3.4955293017360702\n2.1596061630199546\n2.4656347357978543\n4.322234...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a$ consisting of $n$ integer numbers.\n\nLet instability of the array be the following value: $\\max\\limits_{i = 1}^{n} a_i - \\min\\limits_{i = 1}^{n} a_i$.\n\nYou have to remove exactly one elem...
[{"type": "stdin_stdout", "input": "82\n53931 67166 20637 68570 4855 63080 53128 28375 54407 70564 46622 46903 32659 68966 20614 11381 51217 94774 90448 13368 51098 46518 15907 1090 44331 39269 17316 22813 66082 78034 58245 36364 45200 78881 4933 66406 58312 74413 94780 12718 61328 57754 75973 93986 26719 12938 21718 9...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are a total of n x n squares, n rows vertically and n columns horizontally. Some squares are marked. Create a program that reads the marked state of each square and displays the length of the side of the largest squ...
[{"type": "stdin_stdout", "input": "10\n...*....**\n..........\n**....**..\n........*.\n..*.......\n..........\n.*........\n..........\n....*..***\n.*....*...\n10\n*****.****\n*..*.*....\n****.*....\n*....*....\n*....*****\n..........\n****.*****\n*..*...*..\n****...*..\n*..*...*..\n0", "output": "5\n3\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning ...
[{"type": "stdin_stdout", "input": "1000000 1000000 500000 10000\n", "output": "10000\n"}, {"type": "stdin_stdout", "input": "1000000 1000000000 999999 10000\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "1000000 1000000000 999999 10000\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "1000000 100000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDr. Evil is interested in math and functions, so he gave Mahmoud and Ehab array a of length n and array b of length m. He introduced a function f(j) which is defined for integers j, which satisfy 0 ≀ j ≀ m - n. Suppose, c...
[{"type": "stdin_stdout", "input": "1 1 1\n1107891008\n15017817\n1 1 821220804\n", "output": "1092873191\n1914093995\n"}, {"type": "stdin_stdout", "input": "1 1 1\n937982044\n179683049\n1 1 821220804\n", "output": "758298995\n1579519799\n"}, {"type": "stdin_stdout", "input": "1 1 1\n937982044\n179683049\n1 1 821220804\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPrint all combinations which can be made by $k$ different elements from $0, 1, ..., n-1$. Note that we represent $0, 1, ... n-1$ as 00...0001, 00...0010, 00...0100, ..., 10...0000 in binary respectively and the integer re...
[{"type": "stdin_stdout", "input": "10 5", "output": "31: 0 1 2 3 4\n47: 0 1 2 3 5\n55: 0 1 2 4 5\n59: 0 1 3 4 5\n61: 0 2 3 4 5\n62: 1 2 3 4 5\n79: 0 1 2 3 6\n87: 0 1 2 4 6\n91: 0 1 3 4 6\n93: 0 2 3 4 6\n94: 1 2 3 4 6\n103: 0 1 2 5 6\n107: 0 1 3 5 6\n109: 0 2 3 5 6\n110: 1 2 3 5 6\n115: 0 1 4 5 6\n117: 0 2 4 5 6\n118: ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a function f(x), which is initially a constant function f(x) = 0.\nWe will ask you to process Q queries in order. There are two kinds of queries, update queries and evaluation queries, as follows:\n - An update q...
[{"type": "stdin_stdout", "input": "4\n1 -1000000000 1000000000\n1 -1000000000 1000000000\n1 -1000000000 1000000000\n2\n", "output": "-1000000000 3000000000\n"}, {"type": "stdin_stdout", "input": "4\n1 -1000000000 1000000000\n1 -1000000000 0000000000\n1 -1000000000 1000000000\n2", "output": "-1000000000 2000000000\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOur old friend Alexey has finally entered the University of City N β€” the Berland capital. Alexey expected his father to get him a place to live in but his father said it was high time for Alexey to practice some financial...
[{"type": "stdin_stdout", "input": "71\n1 99\n11 69\n86 92\n7 49\n31 70\n42 53\n48 81\n86 96\n36 91\n19 38\n39 91\n41 64\n87 93\n83 97\n40 41\n3 32\n15 18\n58 65\n22 32\n1 71\n58 86\n64 77\n15 69\n4 34\n42 89\n9 66\n15 18\n58 65\n59 96\n39 89\n19 38\n6 63\n26 73\n29 47\n55 88\n5 78\n41 74\n48 81\n20 71\n59 96\n42 49\n4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven are a sequence of N positive integers A_1, A_2, \\ldots, A_N and another positive integer S.\n\nFor a non-empty subset T of the set \\{1, 2, \\ldots , N \\}, let us define f(T) as follows:\n\n - f(T) is the number o...
[{"type": "stdin_stdout", "input": "2896 1518\n498 2010 1723 2089 76 1224 1972 612 465 880 283 143 1538 372 841 1998 292 2096 423 728 2199 807 2325 1185 1664 2349 531 40 1039 2006 2179 1842 2954 2847 2540 1045 2697 2112 1625 2062 631 2136 544 2420 1199 2592 2820 802 1157 383 1164 617 1513 2876 2625 947 1720 1640 1772 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nN cells are arranged in a row. Some of them may contain tokens. You are given a string s that consists of `0`s and `1`s. If the i-th character of s is `1`, the i-th cell (from left) contains a token. Otherwise, it doesn't...
[{"type": "stdin_stdout", "input": "50\n10101000010011011110001001111110001101010111100110", "output": "11\n"}, {"type": "stdin_stdout", "input": "50\n10101000010011011010001001111110001101010111100100", "output": "10\n"}, {"type": "stdin_stdout", "input": "50\n10101110010101010110001001011111001001110111000000", "outp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ cities and $m$ bidirectional roads in Berland. The $i$-th road connects the cities $x_i$ and $y_i$, and has the speed limit $s_i$. The road network allows everyone to get from any city to any other city.\n\n...
[{"type": "stdin_stdout", "input": "4\n4 5 7\n4 1 3\n1 2 5\n2 1 6\n1 3 1\n3 4 4\n4 6 5\n1 2 1\n1 3 1\n1 4 2\n2 4 2\n4 3 1\n3 2 1\n3 2 10\n1 2 8\n1 3 10\n5 5 2\n1 2 17\n3 1 15\n2 3 18\n1 4 14\n2 5 12\n", "output": "1\n3\n0\n50\n"}, {"type": "stdin_stdout", "input": "4\n4 5 7\n4 1 3\n1 2 5\n2 1 6\n1 3 1\n3 4 4\n4 6 5\n1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOnce n people simultaneously signed in to the reception at the recently opened, but already thoroughly bureaucratic organization (abbreviated TBO). As the organization is thoroughly bureaucratic, it can accept and cater f...
[{"type": "stdin_stdout", "input": "12\n11 4\n9 2\n10000 100\n1000000000 2345\n123456 1234567\n123456 65536\n5 55\n5 3\n2323 10\n999111000 232323\n999888777 284079058\n999888777 777\n", "output": " 4\n ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian. \n\nChef likes trees a lot. Today he has an infinte full binary tree (each node has exactly two childs) with special properties.\nChef's tree has the following sp...
[{"type": "stdin_stdout", "input": "5\nQb 1 10\nQr 4 2\nQi\nQb 4 11\nQr 4 12", "output": "2\n1\n2\n3\n"}, {"type": "stdin_stdout", "input": "5\nQb 4 10\nQr 3 11\nQi\nQb 4 3\nQr 4 12", "output": "2\n3\n2\n3\n"}, {"type": "stdin_stdout", "input": "5\nQb 4 10\nQr 4 4\nQi\nQb 4 4\nQr 4 12", "output": "2\n0\n0\n3\n"}, {"typ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have two permutations P and Q of size N (that is, P and Q are both rearrangements of (1,~2,~...,~N)).\nThere are N! possible permutations of size N. Among them, let P and Q be the a-th and b-th lexicographically smalle...
[{"type": "stdin_stdout", "input": "8\n7 3 5 4 2 1 6 8\n3 8 2 5 4 6 7 1\n", "output": "17517\n"}, {"type": "stdin_stdout", "input": "8\n5 7 4 2 8 3 6 1\n1 7 8 4 6 2 5 3\n", "output": "19898\n"}, {"type": "stdin_stdout", "input": "8\n1 2 3 4 5 6 7 8\n8 7 6 5 4 3 2 1\n", "output": "40319\n"}, {"type": "stdin_stdout", "in...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nToday Tavas got his test result as an integer score and he wants to share it with his girlfriend, Nafas.\n\nHis phone operating system is Tavdroid, and its keyboard doesn't have any digits! He wants to share his score wit...
[{"type": "stdin_stdout", "input": "73\n", "output": "seventy-three\n"}, {"type": "stdin_stdout", "input": "77\n", "output": "seventy-seven\n"}, {"type": "stdin_stdout", "input": "78\n", "output": "seventy-eight\n"}, {"type": "stdin_stdout", "input": "77\n", "output": "seventy-seven\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAsterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.\n\nA little later they found a string s, ...
[{"type": "stdin_stdout", "input": "btbdpnzdenxueteteytvkwnegodyhmdwhmrmbftrifytzudumzlacwytsuzefqfpjesdblxhpcsidgksisjdmhyxmmugrjmtfcgxmcgpmvbxbyszdugvmoyjeeqsywcvuqskcjotyhvdijyslgfvyujxthngnonasgnbzzygyikhfelirdfsvuicbiazfdeqecbtbdpnzdenxueteteytvkwnegodyhmdwhmrmbftrifytzudumzlacwytsuzefqfpjesdblxhpcsidgksisjdmhyxmm...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAn English booklet has been created for publicizing Aizu to the world. When you read it carefully, you found a misnomer (an error in writing) on the last name of Masayuki Hoshina, the lord of the Aizu domain. The booklet ...
[{"type": "stdin_stdout", "input": "3\nHoshimo\nHashino\nMasayuki Hoshino was the grandson of Ieyasu Tokugawa.", "output": "Hoshimo\nHashino\nMasayuki Hoshina was the grandson of Ieyasu Tokugawa.\n"}, {"type": "stdin_stdout", "input": "3\nHoshimo\nHashino\nMasayuki Hoshino was the grandspn of Ieyasu Tokugawa.", "output...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWhen Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.\nYou, the smartwatch, has found N routes to his home.\nIf Mr. X uses the i-th of these ro...
[{"type": "stdin_stdout", "input": "100 79\n359 483\n836 935\n246 178\n901 621\n246 967\n428 447\n65 252\n294 631\n903 95\n965 92\n901 614\n528 580\n420 398\n727 132\n266 536\n991 973\n419 606\n710 676\n418 666\n268 141\n500 874\n685 455\n868 169\n222 348\n748 482\n535 214\n487 952\n52 336\n380 985\n581 209\n516 292\n2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA newspaper is published in Walrusland. Its heading is s1, it consists of lowercase Latin letters. Fangy the little walrus wants to buy several such newspapers, cut out their headings, glue them one to another in order to...
[{"type": "stdin_stdout", "input": "ehfjaabjfedhddejjfcfijagefhjeahjcddhchahjbagi\nfbfdjbjhibjgjgaaajgdbcfdbhjcajcbbieijhcjgajhgaa\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "ehfjaabjfedhddejjfcfihagefhjeahjcddjchahjbagi\nfbfdjbjhibjgjgaaajgdbcfdbhjcajcbbieijhcjgajhgaa\n", "output": "10\n"}, {"type": "std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently Bob invented a new game with a tree (we should remind you, that a tree is a connected graph without cycles): he deletes any (possibly, zero) amount of edges of the tree, and counts the product of sizes of the con...
[{"type": "stdin_stdout", "input": "50\n45 39\n18 12\n13 6\n48 45\n46 36\n46 8\n40 36\n29 28\n2 18\n43 26\n25 14\n43 31\n13 30\n12 35\n38 42\n20 5\n7 35\n10 50\n27 13\n1 41\n24 21\n25 5\n7 31\n15 45\n32 25\n43 23\n4 50\n46 11\n40 14\n37 21\n50 2\n41 42\n43 30\n14 22\n36 48\n8 24\n49 20\n19 26\n32 10\n35 29\n1 6\n34 33\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer sequence A of length N and an integer K.\nYou will perform the following operation on this sequence Q times:\n - Choose a contiguous subsequence of length K, then remove the smallest element among...
[{"type": "stdin_stdout", "input": "2000 1161 195\n120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687 120890687...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDima, Inna and Seryozha have gathered in a room. That's right, someone's got to go. To cheer Seryozha up and inspire him to have a walk, Inna decided to cook something. \n\nDima and Seryozha have n fruits in the fridge. E...
[{"type": "stdin_stdout", "input": "88 10\n6 64 43 1 1 1 8 15 39 1 95 2 1 80 36 40 25 2 52 24 29 26 16 45 96 99 1 91 16 97 67 1 39 91 1 41 72 67 93 84 1 12 67 53 26 1 14 39 94 92 28 75 10 16 81 97 77 22 1 1 41 90 51 49 90 74 5 61 1 45 88 1 40 7 4 59 16 33 6 4 92 1 38 20 4 53 10 80\n70 45 1 73 52 1 20 78 68 98 1 95 2 61...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBerland SU holds yet another training contest for its students today. n students came, each of them brought his laptop. However, it turned out that everyone has forgot their chargers!\n\nLet students be numbered from 1 to...
[{"type": "stdin_stdout", "input": "7 200000\n66 57 15 65 32 46 30\n66 31 64 9 63 57 65\n", "output": "-1"}, {"type": "stdin_stdout", "input": "7 200000\n66 57 15 65 32 46 30\n7 31 64 9 63 57 65\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "6 200000\n66 57 15 65 32 46 30\n7 31 64 9 63 57 65\n", "output": "-...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's call an array of non-negative integers $a_1, a_2, \\ldots, a_n$ a $k$-extension for some non-negative integer $k$ if for all possible pairs of indices $1 \\leq i, j \\leq n$ the inequality $k \\cdot |i - j| \\leq mi...
[{"type": "stdin_stdout", "input": "3\n1000000000 1000000000 1000000000\n", "output": "500000000\n"}, {"type": "stdin_stdout", "input": "3\n1000000000 1000000000 1000100000\n", "output": "500000000\n"}, {"type": "stdin_stdout", "input": "3\n1000000000 1000000000 1000100010\n", "output": "500000000\n"}, {"type": "stdin_...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have a board with a 2 \\times N grid. Snuke covered the board with N dominoes without overlaps. Here, a domino can cover a 1 \\times 2 or 2 \\times 1 square.\n\nThen, Snuke decided to paint these dominoes using three c...
[{"type": "stdin_stdout", "input": "52\nRvvttdWIyyPPQFFZZssffEEkkaSSDKqcibbeYrhAljCCGGJppHHn\nRLLwwdWIxxNNQUUXXVVMMooCBaggDKqcimmeYrhAljOOTTJuuzzn", "output": "958681902\n"}, {"type": "stdin_stdout", "input": "52\nnHHppJGGCCjlAhrYebbicqKDSSakkEEffssZZFFQPPyyIWdttvvR\nnzzuuJTTOOjlAhrYemmicqKDggaBBooMMVVXXUUQNNxxIWdwwLLR...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWilbur the pig is tinkering with arrays again. He has the array a_1, a_2, ..., a_{n} initially consisting of n zeros. At one step, he can choose any index i and either add 1 to all elements a_{i}, a_{i} + 1, ... , a_{n} o...
[{"type": "stdin_stdout", "input": "22\n1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000\n", "output": "43000000000\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a simple code of a function and you would like to know what it will return. \n\nF(N, K, Answer, Operator, A[N]) returns int;\nbegin\nfor i=1..K do\nfor j=1..N do\nAnswer=(Answer operator A_{j})\nreturn Answe...
[{"type": "stdin_stdout", "input": "3\n3 1 -1\n1 0 6\nXOR\n3 1 0\n1 2 3\nAND\n3 2 1\n-1 2 1\nOR", "output": "-8\n0\n-1\n"}, {"type": "stdin_stdout", "input": "3\n3 1 -1\n1 3 3\nXOR\n2 1 0\n1 1 3\nAND\n3 0 -2\n0 3 4\nOR", "output": "-2\n0\n-2\n"}, {"type": "stdin_stdout", "input": "3\n3 1 -1\n1 2 6\nXOR\n3 1 0\n1 2 3\nA...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDr. Bruce Banner hates his enemies (like others don't). As we all know, he can barely talk when he turns into the incredible Hulk. That's why he asked you to help him to express his feelings.\n\nHulk likes the Inception s...
[{"type": "stdin_stdout", "input": "100\n", "output": "I hate that I love that I hate that I love that I hate that I love that I hate that I love that I hate that I love that I hate that I love that I hate that I love that I hate that I love that I hate that I love that I hate that I love that I hate that I love that I...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Fire Lord attacked the Frost Kingdom. He has already got to the Ice Fortress, where the Snow Queen dwells. He arranged his army on a segment n in length not far from the city walls. And only the frost magician Solomon...
[{"type": "stdin_stdout", "input": "23\n99 110 99 100 100 100 100 99 100 99 99 100 000 100 99 111 100 100 100 99 99 99 99\n", "output": "ARARARARARARARARARARARARALLLLLLLLLLLLAARARARARARARARARARARARARALLLLLLLLLLLLAARARARARARARARARARARARARALLLLLLLLLLLLAARARARARARARARARARARARARALLLLLLLLLLLLAARARARARARARARARARARARARALLLLLL...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe World Programming Olympics Medal is a metal disk, consisting of two parts: the first part is a ring with outer radius of r1 cm, inner radius of r2 cm, (0 < r2 < r1) made of metal with density p1 g/cm3. The second part...
[{"type": "stdin_stdout", "input": "10 24 2621 2533 3148 3544 4273 4921 2950 3780 4483\n10 1687 4906 4246 2814 1874 3020 3039 3971 102 492\n10 3458 2699 2463 4395 3607 550 1608 958 3970 3077\n4 891\n", "output": "4919.7621246685\n"}, {"type": "stdin_stdout", "input": "10 24 2621 2533 3148 3544 4273 4921 2950 3780 4461\...
code_stdio