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 Manhattan, roads run where the x or y coordinate is an integer. Both Sunuke-kun's house and Sumeke-kun's house are on the road, and the straight line distance (Euclidean distance) is just d. Find the maximum value that...
[{"type": "stdin_stdout", "input": "10.685123853325852", "output": "15.1110470690\n"}, {"type": "stdin_stdout", "input": "10.702511281748821", "output": "15.1356366061\n"}, {"type": "stdin_stdout", "input": "10.804121325601631", "output": "15.2793349082\n"}, {"type": "stdin_stdout", "input": "11.285119341606524", "outp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTwo semifinals have just been in the running tournament. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 ≤ 2k ≤ n...
[{"type": "stdin_stdout", "input": "8\n100 101\n200 201\n300 301\n310 400\n320 500\n330 600\n340 700\n350 800\n", "output": "11111000\n11110000\n"}, {"type": "stdin_stdout", "input": "8\n100 101\n200 201\n300 301\n310 400\n320 500\n330 600\n340 700\n350 800\n", "output": "11111000\n11110000\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIf the girl doesn't go to Denis, then Denis will go to the girl. Using this rule, the young man left home, bought flowers and went to Nastya. \n\nOn the way from Denis's house to the girl's house is a road of n lines. Thi...
[{"type": "stdin_stdout", "input": "30 8\n0 1 13 12 23 24 26 30\n40 7\n", "output": "30\n"}, {"type": "stdin_stdout", "input": "30 8\n0 1 9 12 23 24 26 30\n40 7\n", "output": "30\n"}, {"type": "stdin_stdout", "input": "30 8\n0 1 9 12 23 24 26 30\n27 7\n", "output": "41\n"}, {"type": "stdin_stdout", "input": "30 8\n0 1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBob is an active user of the social network Faithbug. On this network, people are able to engage in a mutual friendship. That is, if $a$ is a friend of $b$, then $b$ is also a friend of $a$. Each user thus has a non-negat...
[{"type": "stdin_stdout", "input": "35\n21 26 18 7 28 2 16 13 16 25 6 32 11 5 31 17 18 3 24 33 14 27 29 1 20 4 12 9 10 30 34 8 19 23 22\n", "output": "0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 \n"}, {"type": "stdin_stdout", "input": "35\n21 26 18 4 28 3 15 13 16 25 6 25 11 5 31 17 9 3 24 33 14 27 29 1 20 4 12 7 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe greatest common divisor is an indispensable element in mathematics handled on a computer. Using the greatest common divisor can make a big difference in the efficiency of the calculation. One of the algorithms to find...
[{"type": "stdin_stdout", "input": "1251 5715\n10 10\n0 0", "output": "9 6\n10 1\n"}, {"type": "stdin_stdout", "input": "1251 3144\n10 10\n0 0", "output": "3 6\n10 1\n"}, {"type": "stdin_stdout", "input": "1893 2905\n10 6\n0 0", "output": "1 11\n2 3\n"}, {"type": "stdin_stdout", "input": "1893 2905\n11 6\n0 0", "output...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian. \nVidhi went to a magic show last week where she was astounded by a magic trick performed by the great Mandwarf, the brown. His trick was as follows :\n\nAsk a vo...
[{"type": "stdin_stdout", "input": "2\n3\n1 1 1\n1 4 1000\nARM\n4\n0 2 3 11\n-1 1 1100\nAMAM", "output": "2 2 8\n1099 1 1 9\n"}, {"type": "stdin_stdout", "input": "2\n3\n1 1 1\n3 4 1100\nARM\n4\n0 2 3 8\n-1 1 1100\nAMAM", "output": "4 4 16\n1099 1 1 6\n"}, {"type": "stdin_stdout", "input": "2\n3\n2 1 1\n2 3 1000\nARM\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nInternational Abbreviation Olympiad takes place annually starting from 1989. Each year the competition receives an abbreviation of form IAO'y, where y stands for some number of consequent last digits of the current year. ...
[{"type": "stdin_stdout", "input": "9\nIAO'0\nIAO'00\nIAO'000\nIAO'0000\nIAO'00000\nIAO'000000\nIAO'0000000\nIAO'00000000\nIAO'000000000\n", "output": "1990\n2000\n3000\n10000\n100000\n1000000\n10000000\n100000000\n1000000000\n"}, {"type": "stdin_stdout", "input": "9\nIAO'0\nIAO'00\nIAO'000\nIAO'0000\nIAO'00000\nIAO'01...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the probability theory the following paradox called Benford's law is known: \"In many lists of random numbers taken from real sources, numbers starting with digit 1 occur much more often than numbers starting with any ...
[{"type": "stdin_stdout", "input": "20\n3 21\n15 28\n21 26\n4 6\n13 28\n20 23\n22 27\n4 13\n1 7\n5 35\n3 3\n16 30\n9 32\n9 16\n3 7\n21 22\n24 29\n6 25\n15 25\n28 33\n51\n", "output": "3.349496664437241e-05\n"}, {"type": "stdin_stdout", "input": "20\n10 21\n18 29\n4 8\n1 27\n24 29\n5 5\n22 22\n4 5\n1 4\n7 12\n11 23\n11 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou got a job as a marketer in a pet shop, and your current task is to boost sales of cat food. One of the strategies is to sell cans of food in packs with discounts. \n\nSuppose you decided to sell packs with $a$ cans in...
[{"type": "stdin_stdout", "input": "10\n335544320 671088640\n335544322 671088639\n335544321 671088639\n335544325 671088637\n335544319 671088640\n335544319 671088641\n335544319 671088639\n335544318 671088639\n352759476 671088637\n335544319 671088643\n", "output": "NO\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nYES\nNO\n"}, {"type":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a$ consisting of $n$ non-negative integers. It is guaranteed that $a$ is sorted from small to large.\n\nFor each operation, we generate a new array $b_i=a_{i+1}-a_{i}$ for $1 \\le i < n$. Then we s...
[{"type": "stdin_stdout", "input": "1\n147\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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTurtle Shi-ta and turtle Be-ko decided to divide a chocolate. The shape of the chocolate is rectangle. The corners of the chocolate are put on (0,0), (w,0), (w,h) and (0,h). The chocolate has lines for cutting. They cut t...
[{"type": "stdin_stdout", "input": "2 3 7 10 50\n3 3\n6 6\n10 10\n4.0000000000 4.380940502722975\n7.0000000000 7.0000000000\n2 3 10 10 48\n2 3\n7 6\n10 10\n4.1530399119933294 4.124627510166318\n7.679827074828504 8.063298606739774\n2 3 10 10 30\n3 3\n6 6\n10 10\n4.0000000000 4.920930737803775\n7.0000000000 7.0000000000\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOn the planet Mars a year lasts exactly n days (there are no leap years on Mars). But Martians have the same weeks as earthlings — 5 work days and then 2 days off. Your task is to determine the minimum possible and the ma...
[{"type": "stdin_stdout", "input": "1000000\n", "output": "285714 285715\n"}, {"type": "stdin_stdout", "input": "999999\n", "output": "285714 285714\n"}, {"type": "stdin_stdout", "input": "999998\n", "output": "285713 285714\n"}, {"type": "stdin_stdout", "input": "999997\n", "output": "285712 285714\n"}, {"type": "stdi...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEdogawa Conan got tired of solving cases, and invited his friend, Professor Agasa, over. They decided to play a game of cards. Conan has n cards, and the i-th card has a number a_{i} written on it.\n\nThey take turns play...
[{"type": "stdin_stdout", "input": "10\n38282 53699 38282 38282 38282 38282 38282 38282 38282 38282\n", "output": "Conan\n"}, {"type": "stdin_stdout", "input": "10\n50165 50165 50165 50165 50165 50165 50165 50165 50165 50165\n", "output": "Agasa\n"}, {"type": "stdin_stdout", "input": "10\n32093 36846 32093 32093 36846 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n$2^n$ teams participate in a playoff tournament. The tournament consists of $2^n - 1$ games. They are held as follows: in the first phase of the tournament, the teams are split into pairs: team $1$ plays against team $2$,...
[{"type": "stdin_stdout", "input": "7\n1011011\n", "output": "32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 11...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given integers A and B, each between 1 and 3 (inclusive).\nDetermine if there is an integer C between 1 and 3 (inclusive) such that A \\times B \\times C is an odd number.\n\n-----Constraints-----\n - All values i...
[{"type": "stdin_stdout", "input": "-1 -1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-3 -1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-1 -3", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-5 -1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-1 -5", "output": "Yes\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGreatest common divisor GCD(a, b) of two positive integers a and b is equal to the biggest integer d such that both integers a and b are divisible by d. There are many efficient algorithms to find greatest common divisor ...
[{"type": "stdin_stdout", "input": "10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "output": "10000000000000000000000000000000000000000000000000000000000000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAwruk is taking part in elections in his school. It is the final round. He has only one opponent — Elodreip. The are $n$ students in the school. Each student has exactly $k$ votes and is obligated to use all of them. So A...
[{"type": "stdin_stdout", "input": "100\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n-----Input-----\n\nThe input contains a single integer $a$ ($1 \\le a \\le 99$).\n\n\n-----Output-----\n\nOutput \"YES\" or \"NO\".\n\n\n-----Examples-----\nInput\n5\n\nOutput\nYES\n\nInput\n13\n\nOutput\nNO\n\nInput\n24\...
[{"type": "stdin_stdout", "input": "46\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "12\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "30\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "35\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "43\n", "output": "YES\n"}, {"type": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNantendo Co., Ltd. has released a game software called Packet Monster. This game was intended to catch, raise, and fight monsters, and was a very popular game all over the world.\n\nThis game had features not found in tra...
[{"type": "stdin_stdout", "input": "CBA\ncba\ncCa\nX\nYZ\nZ\n-", "output": "BbA\nYX\n"}, {"type": "stdin_stdout", "input": "CBA\ncba\ncCa\nY\nYZ\nZ\n-", "output": "BbA\nYY\n"}, {"type": "stdin_stdout", "input": "CBA\ncca\ncCa\nX\nZY\nZ\n-", "output": "BcA\nXY\n"}, {"type": "stdin_stdout", "input": "CAB\ncba\ncCa\nX\nYZ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are several days left before the fiftieth birthday of a famous Berland's writer Berlbury. In this connection the local library decided to make an exposition of the works of this famous science-fiction writer. It was...
[{"type": "stdin_stdout", "input": "55 1000\n2612 1306 4300 1790 3173 9493 7209 7763 8563 4534 7466 1281 4483 6863 3787 7292 3957 8775 7221 4016 5743 6556 2070 2119 4795 9094 1913 2077 8786 4520 1865 2357 7871 3288 8231 5808 9383 9820 9974 3056 5343 2169 5177 6299 5805 8132 9315 6747 5226 3531 1206 4073 8290 1423 6720\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDuring the winter holidays, the demand for Christmas balls is exceptionally high. Since it's already 2018, the advances in alchemy allow easy and efficient ball creation by utilizing magic crystals.\n\nGrisha needs to obt...
[{"type": "stdin_stdout", "input": "1000000000 1000000000\n1000000000 1000000000 1000000000\n", "output": "5000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000\n1000000000 1000000000 1000000000\n", "output": "5000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000\n1000100000 100000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEncryption System\n\nA programmer developed a new encryption system. However, his system has an issue that two or more distinct strings are `encrypted' to the same string.\n\nWe have a string encrypted by his system. To d...
[{"type": "stdin_stdout", "input": "enw\nabc\nabcdefghijklmnopqrst\ny\n#", "output": "1\nfox\n5\nacc\nacd\nbbd\nbcc\nbcd\n17711\nacceeggiikkmmooqqssu\nacceeggiikkmmooqqstt\nacceeggiikkmmooqqstu\nacceeggiikkmmooqrrtt\nacceeggiikkmmooqrrtu\nbcdefghijklmnopqrrtt\nbcdefghijklmnopqrrtu\nbcdefghijklmnopqrssu\nbcdefghijklmnop...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAstronaut Natasha arrived on Mars. She knows that the Martians are very poor aliens. To ensure a better life for the Mars citizens, their emperor decided to take tax from every tourist who visited the planet. Natasha is t...
[{"type": "stdin_stdout", "input": "2 420\n412 363\n", "output": "420\n0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 8...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers A and B as the input. Output the value of A + B.\nHowever, if A + B is 10 or greater, output error instead.\n\n-----Constraints-----\n - A and B are integers.\n - 1 ≤ A, B ≤ 9\n\n-----Input-----...
[{"type": "stdin_stdout", "input": "-169 -1", "output": "-170\n"}, {"type": "stdin_stdout", "input": "-169 -2", "output": "-171\n"}, {"type": "stdin_stdout", "input": "-279 -2", "output": "-281\n"}, {"type": "stdin_stdout", "input": "-279 -1", "output": "-280\n"}, {"type": "stdin_stdout", "input": "-433 -1", "output": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a chessboard of size 1 × n. It is guaranteed that n is even. The chessboard is painted like this: \"BWBW...BW\".\n\nSome cells of the board are occupied by the chess pieces. Each cell contains no more than o...
[{"type": "stdin_stdout", "input": "100\n93 54 57 61 68 66 70 96 64 82 80 75 69 77 76 94 67 86 90 73 74 58 100 83 92 89 56 99 88 59 95 72 81 51 85 71 97 60 91 63 65 98 79 84 53 62 87 55 52 78\n", "output": "1225\n"}, {"type": "stdin_stdout", "input": "100\n93 54 57 61 68 66 70 96 64 82 80 75 69 77 76 94 67 86 90 73 74 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTwo players are playing a game. The game is played on a sequence of positive integer pairs. The players make their moves alternatively. During his move the player chooses a pair and decreases the larger integer in the pai...
[{"type": "stdin_stdout", "input": "3\n1\n2 5\n2\n4 10\n5 10\n2\n2 3\n1 5", "output": "YES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "3\n1\n1 5\n2\n4 10\n5 10\n2\n2 3\n1 5", "output": "YES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "3\n1\n1 3\n2\n4 10\n5 10\n2\n4 3\n3 5", "output": "YES\nYES\nYES\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAssume that a, b, and n are all positive integers. Let f (i) be the i-th fraction of the fraction a / b (0 ≤ f (i) ≤ 9). At this time, let s be the sum of f (i) from i = 1 to n.\n\ns = f (1) + f (2) + ... + f (n)\n\n\nCre...
[{"type": "stdin_stdout", "input": "2 3 2\n2 7 3\n13 3 5\n4 6 2", "output": "12\n15\n15\n12\n"}, {"type": "stdin_stdout", "input": "1 3 2\n2 7 3\n13 3 5\n4 6 2", "output": "6\n15\n15\n12\n"}, {"type": "stdin_stdout", "input": "2 3 2\n2 7 3\n13 3 5\n4 4 2", "output": "12\n15\n15\n0\n"}, {"type": "stdin_stdout", "input":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAt regular competition Vladik and Valera won a and b candies respectively. Vladik offered 1 his candy to Valera. After that Valera gave Vladik 2 his candies, so that no one thought that he was less generous. Vladik for sa...
[{"type": "stdin_stdout", "input": "1000000000 1000000000\n", "output": "Vladik\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000\n", "output": "Vladik\n"}, {"type": "stdin_stdout", "input": "1000000000 1387445955\n", "output": "Vladik\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000001\n", "outpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a string s of length 3 or greater.\nNo two neighboring characters in s are equal.\nTakahashi and Aoki will play a game against each other.\nThe two players alternately performs the following operation, Takahashi ...
[{"type": "stdin_stdout", "input": "fzezbxdbwzbqzxdlkqpcheqlhlfkohdekflklzxpxodqexwewpfbobcdlxowlqzxkqdobwodoxdhcohfdzhlfzbzhcobhewxzodzqfxfbokxkqexwzdfxwhwfeocxobxkocphcofwlkzkcqpblclblbecbwozldhxfdekpwxocfhbzkxqwhkofcxzqlwhpdzkdcedxwkqpqpfchfeclcxeqxfcbzfkophefxkqclxwfoxdfpbeowxpxfdwpolkczlpcdhkhkhohplbfzkolqlzfbhfzl...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have N integers. The i-th integer is A_i.\nFind \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} (A_i \\mbox{ XOR } A_j), modulo (10^9+7).What is \\mbox{ XOR }?\n\nThe XOR of integers A and B, A \\mbox{ XOR } B, is defined as follow...
[{"type": "stdin_stdout", "input": "10\n3 14 159 2653 58979 323846 2643383 27950288 419716939 9375105820\n", "output": "103715602\n"}, {"type": "stdin_stdout", "input": "10\n1 14 159 2653 58979 323846 2643383 27950288 419716939 9375105820", "output": "103715608\n"}, {"type": "stdin_stdout", "input": "10\n1 14 159 2653 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Petya very much likes computers. Recently he has received a new \"Ternatron IV\" as a gift from his mother. Unlike other modern computers, \"Ternatron IV\" operates with ternary and not binary logic. Petya immediat...
[{"type": "stdin_stdout", "input": "274842194 1000000000\n", "output": "1162261466\n"}, {"type": "stdin_stdout", "input": "274842194 1000100000\n", "output": "1162105233\n"}, {"type": "stdin_stdout", "input": "922263603 387506683\n", "output": "1064907553\n"}, {"type": "stdin_stdout", "input": "1000000000 100000000\n",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are some ambiguities when one writes Berland names with the letters of the Latin alphabet.\n\nFor example, the Berland sound u can be written in the Latin alphabet as \"u\", and can be written as \"oo\". For this re...
[{"type": "stdin_stdout", "input": "101\nukuu\nh\nouuo\no\nkkuo\nko\nu\nh\nhku\nh\nh\nhuo\nuhoh\nkuu\nhu\nhkko\nuhuk\nkoho\nh\nhukk\noohu\nkk\nkko\nou\noou\nh\nuuu\nuh\nkhuk\nokoo\nouou\nuo\nkk\noo\nhuok\no\nu\nhok\nhu\nhhuu\nkuu\nooho\noku\nhuoh\nhhkh\nuuuh\nouo\nhou\nhhu\nh\no\nokou\nuo\nh\nukk\nu\nhook\nh\noouk\noku...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOnce Bob saw a string. It contained so many different letters, that the letters were marked by numbers, but at the same time each letter could be met in the string at most 10 times. Bob didn't like that string, because it...
[{"type": "stdin_stdout", "input": "100\n8 43 55 27 70 81 66 10 49 67 24 61 53 0 2 76 96 16 16 1 78 1 69 69 4 59 6 87 98 14 98 20 12 48 20 41 67 90 20 96 44 8 77 94 84 2 61 27 90 42 66 84 5 19 68 13 5 53 13 87 70 41 48 40 19 61 72 31 4 4 59 100 50 64 84 10 96 16 73 3 63 85 67 91 74 63 22 34 6 96 78 42 61 85 3 95 98 84 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads $n$ items and sorts them. Each item has attributes $\\\\{value, weight, type, date, name\\\\}$ and they are represented by $\\\\{$ integer, integer, upper-case letter, integer, string $\\\\}$ r...
[{"type": "stdin_stdout", "input": "5\n105 24 C 1500000000000 white\n100 23 C 1500000000000 blue\n105 23 A 1480000000000 pink\n110 25 B 1500000000000 black\n110 20 A 1484487224415 gree", "output": "100 23 C 1500000000000 blue\n105 23 A 1480000000000 pink\n105 24 C 1500000000000 white\n110 20 A 1484487224415 gree\n110 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two arrays $a_1, a_2, \\dots , a_n$ and $b_1, b_2, \\dots , b_m$. Array $b$ is sorted in ascending order ($b_i < b_{i + 1}$ for each $i$ from $1$ to $m - 1$).\n\nYou have to divide the array $a$ into $m$ con...
[{"type": "stdin_stdout", "input": "77 22\n3 2 4 8 10 7 5 7 9 7 5 6 2 9 10 1 5 4 5 8 6 9 3 1 8 1 10 9 6 7 7 1 5 3 6 4 9 10 7 8 2 3 10 10 9 9 2 9 1 9 7 3 2 4 7 7 1 1 10 4 2 2 8 3 2 9 11 10 5 6 7 1 10 8 3 9 1\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22\n", "output": "0\n"}, {"type": "stdin_stdout", "input":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter making bad dives into swimming pools, Wilbur wants to build a swimming pool in the shape of a rectangle in his backyard. He has set up coordinate axes, and he wants the sides of the rectangle to be parallel to them....
[{"type": "stdin_stdout", "input": "4\n-474 -894\n-474 -833\n-446 -894\n-446 -833\n", "output": "1708\n"}, {"type": "stdin_stdout", "input": "4\n-474 -894\n-474 -833\n-446 -894\n-446 -833\n", "output": "1708\n"}, {"type": "stdin_stdout", "input": "4\n-414 -891\n-414 896\n346 -891\n346 896\n", "output": "1358120\n"}, {"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor an integer n not less than 0, let us define f(n) as follows:\n - f(n) = 1 (if n < 2)\n - f(n) = n f(n-2) (if n \\geq 2)\nGiven is an integer N. Find the number of trailing zeros in the decimal notation of f(N).\n\n---...
[{"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "124999999999999995\n"}, {"type": "stdin_stdout", "input": "999003990299500294\n", "output": "124875498787437525\n"}, {"type": "stdin_stdout", "input": "1000000000010000000", "output": "125000000001249993\n"}, {"type": "stdin_stdout", "input": "10000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMatrix of given integers\n\n\na1,1 a1,2 ... a1, n\na2,1 a2,2 ... a2, n\n::\nan, 1 an, 2 ... an, n\n\n\nThen, create a program that outputs the maximum value of the sum of one or more consecutive terms (submatrix) in the v...
[{"type": "stdin_stdout", "input": "4\n1 3 -9 2\n2 7 -1 5\n-8 3 2 -1\n5 -1 -3 1", "output": "15\n"}, {"type": "stdin_stdout", "input": "4\n1 3 -9 0\n2 7 -1 5\n-8 3 2 -2\n3 -1 -3 1", "output": "14\n"}, {"type": "stdin_stdout", "input": "4\n1 3 -9 2\n2 4 -1 5\n-8 3 2 -1\n5 -1 -6 1", "output": "12\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day, Yuhao came across a problem about checking if some bracket sequences are correct bracket sequences.\n\nA bracket sequence is any non-empty sequence of opening and closing parentheses. A bracket sequence is called...
[{"type": "stdin_stdout", "input": "30\n)(((())()())()(\n))(()()()(\n))()((\n)())(()\n())())((\n((((())\n(((()))(\n(())\n)()(((()(()\n((())))(\n)()()())((\n))))(()\n()(((()\n)()()(\n(())())\n(()()(())(\n)()((\n)(()(())))\n))))(())((\n)()(()(((((\n(()))((\n()())\n((()()()))\n()((((((((()\n)(()(\n)(((())(()\n)((((()(\n((...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSmall, but very brave, mouse Brain was not accepted to summer school of young villains. He was upset and decided to postpone his plans of taking over the world, but to become a photographer instead.\n\nAs you may know, th...
[{"type": "stdin_stdout", "input": "5 5\nW G B W G\nG B W G B\nB W G B W\nW G B W G\nG B W G B\n", "output": "#Black&White\n"}, {"type": "stdin_stdout", "input": "5 5\nW G B W G\nG B W G B\nB W G B W\nW G B W G\nG B W G B\n", "output": "#Black&White"}, {"type": "stdin_stdout", "input": "5 5\nW G B Y M\nG B Y M C\nB Y M...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe busses in Berland are equipped with a video surveillance system. The system records information about changes in the number of passengers in a bus after stops.\n\nIf $x$ is the number of passengers in a bus just befor...
[{"type": "stdin_stdout", "input": "102 1\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "102 1\n1 1 1 1 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian. \n\nChef has a box full of infinite number of identical coins. One day while playing, he made N piles each containing equal number of coins. Chef suddenly remembe...
[{"type": "stdin_stdout", "input": "1\n4\n1 -1 2 2", "output": "2\n"}, {"type": "stdin_stdout", "input": "1\n4\n1 1 -1 4", "output": "2\n"}, {"type": "stdin_stdout", "input": "1\n4\n1 2 2 -1", "output": "2\n"}, {"type": "stdin_stdout", "input": "1\n4\n0 2 2 -1", "output": "2\n"}, {"type": "stdin_stdout", "input": "1\n4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N mountains ranging from east to west, and an ocean to the west.\nAt the top of each mountain, there is an inn. You have decided to choose where to stay from these inns.\nThe height of the i-th mountain from the...
[{"type": "stdin_stdout", "input": "20\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100\n", "output": "20\n"}, {"type": "stdin_stdout", "input": "20\n54 53 68 68 35 35 62 61 74 73 94 94 94 94 86 85 65 64 68 68\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "20\n8 12 14 17 23 26 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCODE FESTIVAL 2016 is going to be held. For the occasion, Mr. Takahashi decided to make a signboard.\n\nHe intended to write `CODEFESTIVAL2016` on it, but he mistakenly wrote a different string S. Fortunately, the string ...
[{"type": "stdin_stdout", "input": "EDOC6102LAVITSEF", "output": "16\n"}, {"type": "stdin_stdout", "input": "1DO2LAVI6REGE0TC", "output": "15\n"}, {"type": "stdin_stdout", "input": "VT0EGER6ICAL2OD0", "output": "10\n"}, {"type": "stdin_stdout", "input": "VV1EFFR7ICAK2OD0", "output": "11\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNow that Kuroni has reached 10 years old, he is a big boy and doesn't like arrays of integers as presents anymore. This year he wants a Bracket sequence as a Birthday present. More specifically, he wants a bracket sequenc...
[{"type": "stdin_stdout", "input": "((()((()()))))(\n", "output": "1\n12\n1 2 3 5 6 7 8 10 11 12 13 14\n"}, {"type": "stdin_stdout", "input": "(((((())()))()(\n", "output": "1\n12\n1 2 3 4 5 6 7 8 10 11 12 14\n"}, {"type": "stdin_stdout", "input": "((()(())()))()(\n", "output": "1\n10\n1 2 3 5 6 8 10 11 12 14\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConstruct a dice from a given sequence of integers in the same way as Dice I.\n\nYou are given integers on the top face and the front face after the dice was rolled in the same way as Dice I. Write a program to print an i...
[{"type": "stdin_stdout", "input": "1 2 3 4 14 -1\n3\n1 3\n1 4\n3 2", "output": "14\n2\n-1\n"}, {"type": "stdin_stdout", "input": "1 2 3 4 5 12\n3\n3 2\n1 3\n3 2", "output": "12\n5\n12\n"}, {"type": "stdin_stdout", "input": "1 2 3 4 5 16\n3\n3 2\n1 3\n3 2", "output": "16\n5\n16\n"}, {"type": "stdin_stdout", "input": "1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe on-board computer on Polycarp's car measured that the car speed at the beginning of some section of the path equals v_1 meters per second, and in the end it is v_2 meters per second. We know that this section of the r...
[{"type": "stdin_stdout", "input": "100 100\n100 10\n", "output": "34500\n"}, {"type": "stdin_stdout", "input": "100 100\n100 10\n", "output": "34500"}, {"type": "stdin_stdout", "input": "100 100\n100 0\n", "output": "10000\n"}, {"type": "stdin_stdout", "input": "100 100\n100 1\n", "output": "12450\n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe word internationalization is sometimes abbreviated to i18n.\nThis comes from the fact that there are 18 letters between the first i and the last n.\nYou are given a string s of length at least 3 consisting of lowercas...
[{"type": "stdin_stdout", "input": "internationalization\n", "output": "i18n\n"}, {"type": "stdin_stdout", "input": "intfrnationalization", "output": "i18n\n"}, {"type": "stdin_stdout", "input": "noitazilanoitanrftni", "output": "n18i\n"}, {"type": "stdin_stdout", "input": "ooitazilanoitanrftni", "output": "o18i\n"}, {...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Duck song\n\nFor simplicity, we'll assume that there are only three types of grapes: green grapes, purple grapes and black grapes.\n\nAndrew, Dmitry and Michal are all grapes' lovers, however their preferences of grap...
[{"type": "stdin_stdout", "input": "100000 100000 100000\n100000 100000 100000\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100000 100000 100000\n100000 100000 100000\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "99999 100000 100000\n100000 100000 100000\n", "output": "YES\n"}, {"type": "stdi...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGerald has been selling state secrets at leisure. All the secrets cost the same: n marks. The state which secrets Gerald is selling, has no paper money, only coins. But there are coins of all positive integer denomination...
[{"type": "stdin_stdout", "input": "108\n", "output": " 2"}, {"type": "stdin_stdout", "input": "243\n", "output": " 1"}, {"type": "stdin_stdout", "input": "81\n", "output": " ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently Johnny have learned bogosort sorting algorithm. He thought that it is too ineffective. So he decided to improve it. As you may know this algorithm shuffles the sequence randomly until it is sorted. Johnny decided...
[{"type": "stdin_stdout", "input": "3\n3\n6\n42", "output": "10/3\n1826/189\n3861289540035137932590423886961807813592751894315116939644306/8913121775113966157962800372668924735854723781840323828125\n"}, {"type": "stdin_stdout", "input": "3\n3\n5\n42", "output": "10/3\n149/21\n3861289540035137932590423886961807813592751...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nInnokenty works at a flea market and sells some random stuff rare items. Recently he found an old rectangular blanket. It turned out that the blanket is split in $n \\cdot m$ colored pieces that form a rectangle with $n$ ...
[{"type": "stdin_stdout", "input": "10 10\naaaaarpppp\nbbbbsssssu\ncciiiiiiqq\nddmmgggggg\neeebbbbbbb\nfffffqoooo\ngxxxxrrrrr\nhhfuuuuuuu\niiillqqqqq\njjjjjppwww\n", "output": "138\n"}, {"type": "stdin_stdout", "input": "10 10\naaaaaaaaaa\nbbbbbbbbbb\ncccccccccc\ndddddddddd\neeeeeeeeee\nffffffffff\ngggggggggg\nhhhhhhhh...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight lin...
[{"type": "stdin_stdout", "input": "1000000000 1000000000 117928222 908877261\n", "output": "500000000000000000.000000 0\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000 500000000 500000000\n", "output": "500000000000000000.000000 1\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000 500000000 49...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDZY loves chessboard, and he enjoys playing with it.\n\nHe has a chessboard of n rows and m columns. Some cells of the chessboard are bad, others are good. For every good cell, DZY wants to put a chessman on it. Each ches...
[{"type": "stdin_stdout", "input": "8 35\n......................-............\n...-..........-........-...........\n...........-.......................\n-..................................\n...................................\n...........-............-.........-\n.........-.........-.--............\n......................
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn poker, you have 5 cards. There are 10 kinds of poker hands (from highest to lowest):\n\n- royal flush - ace, king, queen, jack and ten, all in the same suit\n\n- straight flush - five cards of the same suit in sequen...
[{"type": "stdin_stdout", "input": "3\nAH KH QH TH JH\nJH 6S 3C 5C 7D\nQH QD 4S QC 2C", "output": "royal flush\nhigh card\nthree of a kind\n"}, {"type": "stdin_stdout", "input": "3\nAH KH QH TH JH\nKH 6S 2D 5C 7D\nQH QD 4S QC 2C", "output": "royal flush\nhigh card\nthree of a kind\n"}, {"type": "stdin_stdout", "input":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDescription\n\nKMC sells CDs every year at a coterie spot sale called Comic Market. F was supposed to sell CDs at the comic market, but due to the popularity of F, the KMC sales floor was flooded with people, and the calc...
[{"type": "stdin_stdout", "input": "500 1000\n100 10000\n400 1006\n1029 5000\n10000 10000\n0 0", "output": "0 1 0\n4 1 9\n1 1 0\n4 1 3\n0 0 0\n"}, {"type": "stdin_stdout", "input": "500 1001\n001 10100\n400 1047\n429 5000\n10000 10000\n0 0", "output": "0 1 0\n0 0 10\n1 1 0\n0 1 4\n0 0 0\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given three strings $a$, $b$ and $c$ of the same length $n$. The strings consist of lowercase English letters only. The $i$-th letter of $a$ is $a_i$, the $i$-th letter of $b$ is $b_i$, the $i$-th letter of $c$ is...
[{"type": "stdin_stdout", "input": "4\naaa\nbbb\nccc\nabc\nbca\nbca\naabb\nbbaa\nbaba\nimi\nmii\niim\n", "output": "NO\nYES\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "4\naaa\nbbb\nccc\nabc\nbca\ncca\naabb\nbbaa\nbaba\niim\nmii\niim\n", "output": "NO\nNO\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "4\naa`\ncb...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPalo Alto is an unusual city because it is an endless coordinate line. It is also known for the office of Lyft Level 5.\n\nLyft has become so popular so that it is now used by all $m$ taxi drivers in the city, who every d...
[{"type": "stdin_stdout", "input": "1 4\n2 4 6 10 15\n1 1 1 1 0\n", "output": "0 0 0 1 "}, {"type": "stdin_stdout", "input": "1 4\n2 4 6 10 14\n1 1 1 1 0\n", "output": "0 0 0 1\n"}, {"type": "stdin_stdout", "input": "1 4\n3 4 6 10 15\n1 1 1 1 0\n", "output": "0 0 0 1\n"}, {"type": "stdin_stdout", "input": "1 4\n2 4 6 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDo you know Just Odd Inventions? The business of this company is to \"just odd inventions\". Here, it is abbreviated as JOI.\n\nJOI is conducting research to confine many microorganisms in one petri dish alive. There are ...
[{"type": "stdin_stdout", "input": "6\n12 13\n5 9\n2 4\n10 12\n6 12\n6 11", "output": "5\n"}, {"type": "stdin_stdout", "input": "6\n12 38\n5 9\n2 4\n10 12\n6 12\n11 9", "output": "5\n"}, {"type": "stdin_stdout", "input": "6\n12 13\n5 9\n2 2\n10 12\n6 12\n6 11", "output": "5\n"}, {"type": "stdin_stdout", "input": "6\n12...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPeter wrote on the board a strictly increasing sequence of positive integers a_1, a_2, ..., a_{n}. Then Vasil replaced some digits in the numbers of this sequence by question marks. Thus, each question mark corresponds to...
[{"type": "stdin_stdout", "input": "98\n?\n?0\n2?\n6?\n6?\n69\n??\n??\n96\n1?2\n??3\n104\n??4\n1?9\n??2\n18?\n?01\n205\n?19\n244\n??8\n?5?\n?5?\n276\n??3\n???\n???\n?28\n?3?\n3??\n??8\n355\n4?0\n4??\n?10\n??1\n417\n4?9\n?3?\n4?4\n?61\n?8?\n???\n507\n?2?\n???\n??6\n5?7\n540\n5?9\n???\n?7?\n5??\n591\n?9?\n6?0\n620\n??4\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n3\n\n\nOutput\n\n1\n\nThe input will be stdin and you should print your solution to stdout\n\n\nNow solve the problem and return the code.\n\nWrite Python code to solve this problem. Your program shoul...
[{"type": "stdin_stdout", "input": "20093", "output": "276\n"}, {"type": "stdin_stdout", "input": "5663", "output": "100\n"}, {"type": "stdin_stdout", "input": "1761", "output": "292\n"}, {"type": "stdin_stdout", "input": "2283", "output": "36\n"}, {"type": "stdin_stdout", "input": "1253", "output": "88\n"}, {"type": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe understand that reading English is a great pain to many of you. So we’ll keep this problem statememt simple. Write a program that reports the point equally distant from a set of lines given as the input. In case of no ...
[{"type": "stdin_stdout", "input": "2\n-35 -35 100 100\n-49 49 1588 -2000\n4\n0 0 0 3\n0 0 3 0\n0 3 3 3\n3 0 3 3\n4\n0 3 -4 6\n3 0 6 -4\n2 3 6 6\n-1 2 -4 6\n0", "output": "Many\n1.500000 1.500000\n1.000000 1.000000\n"}, {"type": "stdin_stdout", "input": "2\n-35 -35 100 100\n-49 49 1588 -2000\n4\n0 0 0 4\n0 0 3 0\n0 3 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou're given an array $a$ of $n$ integers, such that $a_1 + a_2 + \\cdots + a_n = 0$.\n\nIn one operation, you can choose two different indices $i$ and $j$ ($1 \\le i, j \\le n$), decrement $a_i$ by one and increment $a_j...
[{"type": "stdin_stdout", "input": "7\n4\n-3 5 -3 1\n2\n1 -1\n4\n-3 2 -3 4\n4\n-1 1 1 -1\n7\n-5 7 -6 -4 17 -13 4\n6\n-1000000000 -1000000000 -1000000000 1000000000 1000000000 1000000000\n1\n0\n", "output": "3\n0\n4\n1\n8\n3000000000\n0\n"}, {"type": "stdin_stdout", "input": "7\n4\n-3 5 -3 1\n2\n1 -1\n4\n-3 2 -3 4\n4\n-...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nCryptography is all the rage at xryuseix's school. Xryuseix, who lives in a grid of cities, has come up with a new cryptography to decide where to meet.\n\nThe ciphertext consists of the $ N $ character string ...
[{"type": "stdin_stdout", "input": "5\nAMazA", "output": "3\nAAA\n"}, {"type": "stdin_stdout", "input": "5\nAMAza", "output": "3\nAAA\n"}, {"type": "stdin_stdout", "input": "5\nAMBza", "output": "3\nAAA\n"}, {"type": "stdin_stdout", "input": "5\nAaBzM", "output": "3\nAAA\n"}, {"type": "stdin_stdout", "input": "5\nAazBM...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.\n...
[{"type": "stdin_stdout", "input": "4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4\n", "output": "3\n2\n0\n4\n"}, {"type": "stdin_stdout", "input": "4\n7\n1 7 1 6 4 7 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4\n", "output": "3\n2\n0\n4\n"}, {"type": "stdin_stdout", "input": "4\n7\n1 7 1 6 4 7 6\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecall that a binary search tree is a rooted binary tree, whose nodes each store a key and each have at most two distinguished subtrees, left and right. The key in each node must be greater than any key stored in the left...
[{"type": "stdin_stdout", "input": "1000000\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "360561\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "699049\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "699047\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "699050\n", "output": "1\n"}...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nD: Sunburn-Suntan-\n\nstory\n\nAizunyan is a second-year student who belongs to the programming contest club of Wakagamatsu High School, commonly known as the Prokon club. Cute like an angel. Aizu Nyan is planning to part...
[{"type": "stdin_stdout", "input": "20\n1\n-1 12", "output": "13\n"}, {"type": "stdin_stdout", "input": "20\n1\n-1 19", "output": "20\n"}, {"type": "stdin_stdout", "input": "20\n1\n0 19", "output": "19\n"}, {"type": "stdin_stdout", "input": "20\n1\n0 12", "output": "12\n"}, {"type": "stdin_stdout", "input": "20\n1\n0 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp remembered the $2020$-th year, and he is happy with the arrival of the new $2021$-th year. To remember such a wonderful moment, Polycarp wants to represent the number $n$ as the sum of a certain number of $2020$ ...
[{"type": "stdin_stdout", "input": "5\n1\n4041\n4042\n8081\n8079\n", "output": "\nNO\nYES\nYES\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "5\n1\n4041\n4042\n8081\n8079\n", "output": "NO\nYES\nYES\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "5\n1\n4041\n4042\n12391\n8079\n", "output": "NO\nYES\nYES\nNO\nNO\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n1+2*3+4\n11\n\n\nOutput\n\nM\n\nThe input will be stdin and you should print your solution to stdout\n\n\nNow solve the problem and return the code.\n\nWrite Python code to solve this problem. Your pro...
[{"type": "stdin_stdout", "input": "4+1*3+0\n104", "output": "I\n"}, {"type": "stdin_stdout", "input": "4+1*3+0\n102", "output": "I\n"}, {"type": "stdin_stdout", "input": "0+3*1+4\n104", "output": "I\n"}, {"type": "stdin_stdout", "input": "0+3*1+4\n129", "output": "I\n"}, {"type": "stdin_stdout", "input": "3*1+0*4\n12"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a country with $n$ citizens. The $i$-th of them initially has $a_{i}$ money. The government strictly controls the wealth of its citizens. Whenever a citizen makes a purchase or earns some money, they must send a ...
[{"type": "stdin_stdout", "input": "10\n7 9 4 4 7 6 3 7 9 8\n10\n1 3 2\n1 10 5\n1 5 3\n1 5 2\n1 2 9\n1 2 9\n1 2 10\n1 5 7\n1 6 10\n1 10 9\n", "output": "7 10 2 4 7 10 3 7 9 9 \n"}, {"type": "stdin_stdout", "input": "10\n7 9 4 4 7 6 3 7 9 10\n10\n1 4 2\n1 10 5\n1 5 3\n1 5 2\n1 2 9\n1 2 9\n1 2 10\n1 5 7\n1 6 10\n1 10 9\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHeading ##There are two integers A and B. You are required to compute the bitwise AND amongst all natural numbers lying between A and B, both inclusive.\nInput Format\n\nFirst line of the input contains T, the number of t...
[{"type": "stdin_stdout", "input": "124\n1476395008 1493172223\n1275068416 1291845631\n4009754624 4026531839\n2516582400 2533359615\n50331648 67108863\n2566914048 2583691263\n2952790016 2969567231\n3892314112 3909091327\n3489660928 3506438143\n33554432 50331647\n1694498816 1711276031\n3623878656 3640655871\n1308622848 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.\n\nHongcow has decided to try to make new words fr...
[{"type": "stdin_stdout", "input": "abcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxy\n", "output": "25\n"}, {"type": "stdin_stdout", "input": "zyzzzyyzyyyzyyzyzyzyzyzzzyyyzzyzyyzzzzzyyyzzzzyzyy\n", "output": "50\n"}, {"type": "stdin_stdout", "input": "aaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaab\n", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya studies music. \n\nHe has learned lots of interesting stuff. For example, he knows that there are 12 notes: C, C#, D, D#, E, F, F#, G, G#, A, B, H. He also knows that the notes are repeated cyclically: after H goes ...
[{"type": "stdin_stdout", "input": "F# F# F#\n", "output": "strange\n"}, {"type": "stdin_stdout", "input": "D# D# F#\n", "output": "strange\n"}, {"type": "stdin_stdout", "input": "G# G# A\n", "output": "strange\n"}, {"type": "stdin_stdout", "input": "G# C# D\n", "output": "strange\n"}, {"type": "stdin_stdout", "input":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMeka-Naruto plays a computer game. His character has the following ability: given an enemy hero, deal $a$ instant damage to him, and then heal that enemy $b$ health points at the end of every second, for exactly $c$ secon...
[{"type": "stdin_stdout", "input": "6\n1411352 712902 579689 383030\n997653 839911 351405 69197\n31160 1580030 281506 245835\n234837 489356 452352 448472\n382561 916024 805514 657373\n287796 831046 710305 568719\n", "output": "1411352\n997653\n31160\n234837\n382561\n287796\n"}, {"type": "stdin_stdout", "input": "6\n141...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an undirected unweighted graph consisting of $n$ vertices and $m$ edges (which represents the map of Bertown) and the array of prices $p$ of length $m$. It is guaranteed that there is a path between each pai...
[{"type": "stdin_stdout", "input": "2\n4 3 2 3 4\n2 4 3\n1 2\n1 3\n1 4\n7 9 1 5 7\n2 10 4 8 5 6 7 3 3\n1 2\n1 3\n1 4\n3 2\n3 5\n4 2\n5 6\n1 4\n6 7\n", "output": "11\n12\n"}, {"type": "stdin_stdout", "input": "2\n4 3 2 3 4\n1 5 3\n1 2\n1 3\n1 4\n7 9 2 5 7\n3 10 4 8 5 8 7 3 3\n2 2\n2 3\n1 4\n3 2\n3 5\n4 3\n5 6\n1 4\n6 7\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are playing a game where your character should overcome different obstacles. The current problem is to come down from a cliff. The cliff has height $h$, and there is a moving platform on each height $x$ from $1$ to $h...
[{"type": "stdin_stdout", "input": "28\n8 4\n8 7 6 3\n8 5\n8 7 6 3 1\n8 5\n8 7 6 3 2\n8 6\n8 7 6 3 2 1\n8 4\n8 7 6 4\n8 5\n8 7 6 4 1\n8 5\n8 7 6 4 2\n8 6\n8 7 6 4 2 1\n8 5\n8 7 6 4 3\n8 6\n8 7 6 4 3 1\n8 6\n8 7 6 4 3 2\n8 7\n8 7 6 4 3 2 1\n8 4\n8 7 6 5\n8 5\n8 7 6 5 1\n8 5\n8 7 6 5 2\n8 6\n8 7 6 5 2 1\n8 5\n8 7 6 5 3\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTo become a millionaire, M-kun has decided to make money by trading in the next N days. Currently, he has 1000 yen and no stocks - only one kind of stock is issued in the country where he lives.\n\nHe is famous across the...
[{"type": "stdin_stdout", "input": "7\n100 130 243 130 115 115 150", "output": "3165\n"}, {"type": "stdin_stdout", "input": "7\n100 130 243 130 115 115 271", "output": "5706\n"}, {"type": "stdin_stdout", "input": "7\n110 130 243 130 115 115 271", "output": "5161\n"}, {"type": "stdin_stdout", "input": "7\n110 130 136 13...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi loves the number 7 and multiples of K.\nWhere is the first occurrence of a multiple of K in the sequence 7,77,777,\\ldots? (Also see Output and Sample Input/Output below.)\nIf the sequence contains no multiples ...
[{"type": "stdin_stdout", "input": "999983\n", "output": "999982\n"}, {"type": "stdin_stdout", "input": "999863\n", "output": "999862\n"}, {"type": "stdin_stdout", "input": "999953\n", "output": "999952\n"}, {"type": "stdin_stdout", "input": "531441\n", "output": "531441\n"}, {"type": "stdin_stdout", "input": "823543\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle penguin Polo adores strings. But most of all he adores strings of length n.\n\nOne day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, t...
[{"type": "stdin_stdout", "input": "93563 25\n", "output": "abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp wants to assemble his own keyboard. Layouts with multiple rows are too complicated for him — his keyboard will consist of only one row, where all $26$ lowercase Latin letters will be arranged in some order.\n\nPo...
[{"type": "stdin_stdout", "input": "5\nababa\ncodfdoca\ncbada\nzxzytyz\nabcdefghjjkllnopqrstuvwxyza\n", "output": "YES\nabcdefghijklmnopqrstuvwxyz\nYES\nacodfbeghijklmnpqrstuvwxyz\nYES\ncbadefghijklmnopqrstuvwxyz\nYES\ntyzxabcdefghijklmnopqrsuvw\nNO\n"}, {"type": "stdin_stdout", "input": "5\nababa\ncodedoca\nabcda\nzxz...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle girl Tanya climbs the stairs inside a multi-storey building. Every time Tanya climbs a stairway, she starts counting steps from $1$ to the number of steps in this stairway. She speaks every number aloud. For exampl...
[{"type": "stdin_stdout", "input": "48\n1 2 3 4 1 2 3 1 1 2 3 1 2 3 4 1 1 2 3 4 1 2 3 4 1 2 3 4 1 1 1 1 2 1 2 1 1 2 1 2 1 2 3 1 1 1 2 1\n", "output": "22\n4 3 1 3 4 1 4 4 4 1 1 1 2 2 1 2 2 3 1 1 2 1 "}, {"type": "stdin_stdout", "input": "48\n1 2 3 4 1 2 3 1 1 2 1 1 2 3 4 1 1 2 3 4 1 2 3 4 1 2 3 4 1 1 2 1 2 1 2 1 1 1 1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven are two strings s and t consisting of lowercase English letters. Determine if the number of non-negative integers i satisfying the following condition is finite, and find the maximum value of such i if the number is...
[{"type": "stdin_stdout", "input": "aa\naaaaaaa\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "abcabab\nab\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "aba\nbaaab\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "aa\naaaaaaa", "output": "-1"}, {"type": "stdin_stdout", "input": "aa\nabaaaaa...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Easter Rabbit laid n eggs in a circle and is about to paint them. \n\nEach egg should be painted one color out of 7: red, orange, yellow, green, blue, indigo or violet. Also, the following conditions should be satisfi...
[{"type": "stdin_stdout", "input": "100\n", "output": "ROYGBIVGBIVGBIVGBIVGBIVGBIVGBIVGBIVGBIVGBIVGBIVGBIVGBIVGBIVGBIVGBIVGBIVGBIVGBIVGBIVGBIVGBIVGBIVGBIVG"}, {"type": "stdin_stdout", "input": "99\n", "output": "ROYGBIVROYGBIVROYGBIVROYGBIVROYGBIVROYGBIVROYGBIVROYGBIVROYGBIVROYGBIVROYGBIVROYGBIVROYGBIVROYGBIVG\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian as well. \n\nChef wants to implement wildcard pattern matching supporting only the wildcard '?'. The wildcard character '?' can be substituted by any single lower c...
[{"type": "stdin_stdout", "input": "2\ns?o?r\nsco??\nstor?\nsco??", "output": "Yes\nNo\n"}, {"type": "stdin_stdout", "input": "2\ns?or?\nsco??\nstor?\nsco??", "output": "Yes\nNo\n"}, {"type": "stdin_stdout", "input": "2\ns?or?\nsco??\nstor?\nsco??", "output": "Yes\nNo"}, {"type": "stdin_stdout", "input": "2\nr?o?s\nsco...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYour friend recently came up with a card game called UT-Rummy.\n\nThe cards used in this game are numbered red, green, or blue and any number from 1 to 9. Each player in this game has 9 cards in his or her hand, chooses o...
[{"type": "stdin_stdout", "input": "5\n1 2 3 6 4 5 7 13 7\nR R R R R R G G G\n1 2 2 3 4 4 4 4 5\nR R R R R Q R R R\n1 3 3 4 4 4 5 5 5\nR R B R R R R R R\n1 1 1 3 4 5 6 6 10\nR R B G G G R R S\n2 2 2 3 3 3 1 1 2\nR G B R G B R G B", "output": "0\n0\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "5\n1 2 3 6 4 5 7 13 7\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs you know Appu created aversion to Maths after that maths problem given by his teacher.So he stopped studying and began to do farming. He has some land where he starts growing sugarcane. At the end of the season he grew...
[{"type": "stdin_stdout", "input": "50\n558017747 707412184 571476824 27885972 347137128 534455142 266330082 381698014 939365541 506551897 225052521 672800684 64370521 756181857 592652322 228887401 599530996 111233973 330484393 490574767 309080152 39589626 763859303 515779418 857884239 413041773 131315151 512215539 928...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a$ consisting of $n$ integers. Indices of the array start from zero (i. e. the first element is $a_0$, the second one is $a_1$, and so on).\n\nYou can reverse at most one subarray (continuous subse...
[{"type": "stdin_stdout", "input": "4\n8\n1 3 3 4 11 6 2 9\n5\n1 2 1 2 1\n10\n5 13 6 5 14 0 4 9 13 5\n4\n0 1 2 1\n", "output": "24\n5\n50\n3\n"}, {"type": "stdin_stdout", "input": "4\n8\n0 4 3 6 11 6 2 9\n5\n1 2 1 2 1\n10\n5 13 6 5 14 0 4 9 13 5\n4\n0 1 2 1\n", "output": "25\n5\n50\n3\n"}, {"type": "stdin_stdout", "inp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a directed acyclic graph, consisting of $n$ vertices and $m$ edges. The vertices are numbered from $1$ to $n$. There are no multiple edges and self-loops.\n\nLet $\\mathit{in}_v$ be the number of incoming ed...
[{"type": "stdin_stdout", "input": "10 45\n3 8\n3 7\n3 5\n3 2\n3 1\n3 4\n3 10\n3 6\n3 9\n8 7\n8 5\n8 2\n8 1\n8 4\n8 10\n8 6\n8 9\n7 5\n7 2\n7 1\n7 4\n7 10\n7 6\n7 9\n5 2\n5 1\n5 4\n5 10\n5 6\n5 9\n2 1\n2 4\n2 10\n2 6\n2 9\n1 4\n1 10\n1 6\n1 9\n4 10\n4 6\n4 9\n10 6\n10 9\n6 9\n", "output": "8\n"}, {"type": "stdin_stdout...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKuro and Shiro are playing with a board composed of n squares lining up in a row.\nThe squares are numbered 1 to n from left to right, and Square s has a mark on it.\nFirst, for each square, Kuro paints it black or white ...
[{"type": "stdin_stdout", "input": "7775\n", "output": "499126064\n499126064\n796234435\n114971967\n891826170\n38460928\n746758804\n102098624\n582205169\n762199467\n509915249\n602954502\n392594249\n215817236\n170876474\n643293880\n150463555\n628074695\n355316779\n513918741\n157394975\n757039573\n277888730\n825789360\n8...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n3\ny 7\ny 6\nn 5\n\n\nOutput\n\n1\n\nThe input will be stdin and you should print your solution to stdout\n\n\nNow solve the problem and return the code.\n\nWrite Python code to solve this problem. You...
[{"type": "stdin_stdout", "input": "3\ny 11\ny 3\nn 10", "output": "1\n"}, {"type": "stdin_stdout", "input": "3\ny 11\nx 3\nn 10", "output": "1\n"}, {"type": "stdin_stdout", "input": "3\nx 2\ny 10\nn 10", "output": "1\n"}, {"type": "stdin_stdout", "input": "3\ny 11\nw 3\nn 10", "output": "1\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFukushima Prefecture is also famous for producing fruits, and among them, peaches and apples boast one of the highest production volumes in Japan. By the way, when I made a print manuscript of an English pamphlet for sale...
[{"type": "stdin_stdout", "input": "the cost of one peach is higher than th`t of one apple.", "output": "the cost of one apple is higher than th`t of one peach.\n"}, {"type": "stdin_stdout", "input": "the cost of ooe peach is higher than th`t of one apple.", "output": "the cost of ooe apple is higher than th`t of one p...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAkaki, a patissier, can make N kinds of doughnut using only a certain powder called \"Okashi no Moto\" (literally \"material of pastry\", simply called Moto below) as ingredient. These doughnuts are called Doughnut 1, Dou...
[{"type": "stdin_stdout", "input": "5 3000\n150\n130\n150\n130\n110\n", "output": "26\n"}, {"type": "stdin_stdout", "input": "5 3000\n150\n130\n150\n130\n100", "output": "28\n"}, {"type": "stdin_stdout", "input": "5 3000\n236\n130\n150\n130\n100", "output": "27\n"}, {"type": "stdin_stdout", "input": "5 3000\n150\n173\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHideyuki is allowed by his father Ujisato some 1000 yen bills every month for his pocket money. In the first day of every month, the number of bills is decided as follows. Ujisato prepares n pieces of m-sided dice and dec...
[{"type": "stdin_stdout", "input": "2 6 -1\n2 12 0\n6 18 9\n13 2 52\n1 2008 3\n0 0 0", "output": "8.0000000000\n13.0000000000\n48.0000035281\n1.0000000000\n1001.5029880478\n"}, {"type": "stdin_stdout", "input": "2 6 -1\n2 12 0\n6 18 5\n13 2 52\n1 2008 3\n0 0 0", "output": "8.0000000000\n13.0000000000\n52.0000000000\n1....
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a$ consisting of $n$ positive integers.\n\nYou are allowed to perform this operation any number of times (possibly, zero):\n\nchoose an index $i$ ($2 \\le i \\le n$), and change $a_i$ to $a_i - a_{...
[{"type": "stdin_stdout", "input": "1\n100\n1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "10\n2\n1 1\n10\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of n bumpers. The bumpers are numbered with integers from 1 to n from left to right. There are two types of bump...
[{"type": "stdin_stdout", "input": "100\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "100\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKuro has recently won the \"Most intelligent cat ever\" contest. The three friends then decided to go to Katie's home to celebrate Kuro's winning. After a big meal, they took a small break then started playing games.\n\nK...
[{"type": "stdin_stdout", "input": "50 1\n-1 -1 -1 -1 -1 0 -1 -1 -1 0 1 0 -1 0 1 -1 -1 -1 1 0 1 -1 0 1 0 1 0 0 1 1 -1 1 -1 -1 1 1 -1 -1 0 -1 -1 1 -1 1 -1 1 1 0 0 -1\n", "output": "279519499\n"}, {"type": "stdin_stdout", "input": "50 1\n-1 -1 -1 -1 -1 0 -1 -1 -1 0 1 0 -1 0 1 -1 -1 -1 1 0 1 -1 0 1 0 1 0 0 0 1 -1 1 -1 -1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nToastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?\n\nGiven a n × n checkerboard. Each cell of the board has either character 'x', or character 'o...
[{"type": "stdin_stdout", "input": "19\noxoxoxoxooxoooxxoox\nxxxxxxxxoxxoxoooooo\noxoxoxooxxxooxxxooo\nxxoxxxooxooxxxoxxox\noxoxooxxxooooxxoxox\nxxxoooxoxxoxxoxxxoo\noxooxxxoooooxxoooxo\nxxooxooxoxxoxxoxxoo\noxxxxooooxxxooooxxx\nooxooxoxxoxxoxooxoo\nxxxooooxxxooooxoxox\noooxoxooxxoxooxooxx\nxxoooxxxooooxxoooxo\nooxxxoo...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nB-Mansion and courier\n\nProblem Statement\n\nTaro lives alone in a mansion. Taro, who loves studying, intends to study in his study in the house today. Taro can't concentrate outside the study, so he always studies in th...
[{"type": "stdin_stdout", "input": "1 1 110\n18", "output": "108\n"}, {"type": "stdin_stdout", "input": "1 0 110\n11", "output": "110\n"}, {"type": "stdin_stdout", "input": "1 3 110\n18", "output": "104\n"}, {"type": "stdin_stdout", "input": "1 0 192\n16", "output": "192\n"}, {"type": "stdin_stdout", "input": "1 1 192\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is an integer N. Find the number of digits that N has in base K.\n\n-----Notes-----\nFor information on base-K representation, see Positional notation - Wikipedia.\n\n-----Constraints-----\n - All values in input ar...
[{"type": "stdin_stdout", "input": "1000000000 2\n", "output": "30\n"}, {"type": "stdin_stdout", "input": "314159265 3\n", "output": "18\n"}, {"type": "stdin_stdout", "input": "282475249 7\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "282475248 7\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "282...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlice bought a Congo Prime Video subscription and was watching a documentary on the archaeological findings from Factor's Island on Loch Katrine in Scotland. The archaeologists found a book whose age and origin are unknow...
[{"type": "stdin_stdout", "input": "cbabacacacbabacababcabcbabacababcbcabacacacbababcbcacacbcbabcbcbabacacacabacbcbacacbcabacbcabcbabcbabababcaca\n", "output": "cabaaacbabcababcbcaacbabccaaaccbabbccaccbbabccaaaccbabcaacbcbabacbabcaaabac"}, {"type": "stdin_stdout", "input": "cbabacacacb`bacababcabcbabacababcbcabacacacba...
code_stdio