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\nI am a craftsman specialized in interior works. A customer asked me to perform wiring work on a wall whose entire rectangular surface is tightly pasted with pieces of panels. The panels are all of the same size (2 m in wi...
[{"type": "stdin_stdout", "input": "1 -11", "output": "-10\n"}, {"type": "stdin_stdout", "input": "171 2", "output": "173\n"}, {"type": "stdin_stdout", "input": "120 3", "output": "121\n"}, {"type": "stdin_stdout", "input": "109 1", "output": "110\n"}, {"type": "stdin_stdout", "input": "119 1", "output": "120\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA rabbit who came to the fair found that the prize for a game at a store was a carrot cake. The rules for this game are as follows.\n\nThere is a grid-like field of vertical h squares x horizontal w squares, and each bloc...
[{"type": "stdin_stdout", "input": "4 6 1\n......\n...Y..\n/..Z..\nYRRRYY", "output": "YES\n"}, {"type": "stdin_stdout", "input": "4 6 1\n......\n...Y..\n..Z../\nYRRRYY", "output": "YES\n"}, {"type": "stdin_stdout", "input": "4 6 1\n......\n...Y./\n/..Z..\nYRRRYY", "output": "YES\n"}, {"type": "stdin_stdout", "input": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor a string S consisting of the uppercase English letters `P` and `D`, let the doctoral and postdoctoral quotient of S be the total number of occurrences of `D` and `PD` in S as contiguous substrings. For example, if S =...
[{"type": "stdin_stdout", "input": "PDPD???", "output": "PDPDDDD\n"}, {"type": "stdin_stdout", "input": "DDPP???", "output": "DDPPDDD\n"}, {"type": "stdin_stdout", "input": "DDPO???", "output": "DDPODDD\n"}, {"type": "stdin_stdout", "input": "DDPO?>?", "output": "DDPOD>D\n"}, {"type": "stdin_stdout", "input": "?>?OPDD"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSummer is coming! It's time for Iahub and Iahubina to work out, as they both want to look hot at the beach. The gym where they go is a matrix a with n lines and m columns. Let number a[i][j] represents the calories burned...
[{"type": "stdin_stdout", "input": "4 5\n87882 40786 3691 85313 46694\n28884 16067 3242 97367 78518\n4250 35501 9780 14435 19004\n64673 65438 56977 64495 27280\n", "output": "747898\n"}, {"type": "stdin_stdout", "input": "4 5\n2274 40786 3691 98933 46694\n28884 16067 3242 97367 73338\n8377 57682 9780 14435 19004\n64673...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOranges on Cans\n\nsquare1001 You put a $ N $ can of aluminum on the table.\n\nE869120 You put $ M $ of oranges on each aluminum can on the table.\n\nHow many oranges are on the aluminum can?\n\ninput\n\nInput is given fr...
[{"type": "stdin_stdout", "input": "-17 16", "output": "-272\n"}, {"type": "stdin_stdout", "input": "-17 30", "output": "-510\n"}, {"type": "stdin_stdout", "input": "-17 44", "output": "-748\n"}, {"type": "stdin_stdout", "input": "-2 125", "output": "-250\n"}, {"type": "stdin_stdout", "input": "-1 111", "output": "-111...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHappy new year! The year 2020 is also known as Year Gyeongja (κ²½μžλ…„, gyeongja-nyeon) in Korea. Where did the name come from? Let's briefly look at the Gapja system, which is traditionally used in Korea to name the years.\n\...
[{"type": "stdin_stdout", "input": "10 12\nsin im gye gap eul bynoeg jeong mu gj gyeong\nyu sul hae jb chuk in myo jin as o li sin\n14\n1\n1\n3\n4\n17\n17\n12\n13\n73\n2016\n32\n2018\n2019\n2020\n", "output": "sinyu\nsinyu\ngyehae\ngapjb\njeongchuk\njeongchuk\nimsin\ngyeyu\ngyeyu\nbynoegsin\nimjin\nmusul\ngjhae\ngyeong...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently personal training sessions have finished in the Berland State University Olympiad Programmer Training Centre. By the results of these training sessions teams are composed for the oncoming team contest season. Eac...
[{"type": "stdin_stdout", "input": "7\n4 19 14 8 21 16 2 18 1 15 3 17 13 5 6 10 9 7 12 11 20\n4 19 10\n14 8 3\n21 17 9\n16 6 12\n2 13 20\n18 1 7\n15 5 11\n21\n", "output": "3 4 8 9 10 14 17 1 2 5 6 7 11 12 13 15 16 18 19 20\n"}, {"type": "stdin_stdout", "input": "6\n6 4 10 16 14 11 13 1 7 17 18 15 5 3 9 12 2 8\n6 10 1\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a_1, a_2, \\dots, a_n$ where all $a_i$ are integers and greater than $0$.\n\n In one operation, you can choose two different indices $i$ and $j$ ($1 \\le i, j \\le n$). If $gcd(a_i, a_j)$ is equal ...
[{"type": "stdin_stdout", "input": "4\n1\n8\n6\n4 4 6 6 2 9\n4\n4 5 6 10\n5\n10 10 2 2 4\n", "output": "YES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "4\n1\n8\n6\n4 4 6 6 2 9\n4\n4 5 6 7\n5\n10 10 2 2 4\n", "output": "YES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "4\n1\n8\n6\n4 4 6 6 2 15\n4\n4 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe circle line of the Berland subway has n stations. We know the distances between all pairs of neighboring stations:\n\n\n\n d_1 is the distance between the 1-st and the 2-nd station;\n\n d_2 is the distance between the...
[{"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\nYou are playing a popular video game which is famous for its depthful story and interesting puzzles. In the game you were locked in a mysterious house alone and there is no way to call for help, so you have to escape on y...
[{"type": "stdin_stdout", "input": "...\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*.*\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\n#", "out...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSo, the Berland is at war with its eternal enemy Flatland again, and Vasya, an accountant, was assigned to fulfil his duty to the nation. \n\nRight now the situation in Berland is dismal β€” their both cities are surrounded...
[{"type": "stdin_stdout", "input": "1003 -5005 3399\n-10705 -1729 4365\n", "output": "2196.845285084989\n"}, {"type": "stdin_stdout", "input": "-9577 9051 5276\n-4315 -1295 3517\n", "output": "1407.1273140166404\n"}, {"type": "stdin_stdout", "input": "-9445 -9860 5513\n6291 -855 9034\n", "output": "1791.7043689042112\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence of $n$ integers $a_1, \\, a_2, \\, \\dots, \\, a_n$.\n\nDoes there exist a sequence of $n$ integers $b_1, \\, b_2, \\, \\dots, \\, b_n$ such that the following property holds?\n\nFor each $1 \\le ...
[{"type": "stdin_stdout", "input": "20\n5\n6711 19885 -3098 -16272 -10076\n4\n86522 29647 -12464 -9627\n4\n-82555 -5215 -15221 -63129\n4\n-18147 4 5 -5\n5\n-17427 -19079 17427 15043 19079\n5\n15148 5942 361 9206 21087\n3\n-1 -55 1\n5\n47214 53109 39369 11561 -22908\n4\n-74790 54187 -2 30242\n2\n-68120 94070\n3\n-27228 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this problem you have to simulate the workflow of one-thread server. There are n queries to process, the i-th will be received at moment t_{i} and needs to be processed for d_{i} units of time. All t_{i} are guaranteed...
[{"type": "stdin_stdout", "input": "4 3\n999999996 1000000000\n999999997 1000000000\n999999998 1000000000\n999999999 1000000000\n", "output": "1999999996 2999999996 3999999996 4999999996 \n"}, {"type": "stdin_stdout", "input": "4 3\n999999996 1000000000\n999999997 1000000000\n999999998 1000000000\n999999999 1000000000\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou play a strategic video game (yeah, we ran out of good problem legends). In this game you control a large army, and your goal is to conquer $n$ castles of your opponent.\n\nLet's describe the game process in detail. In...
[{"type": "stdin_stdout", "input": "10 10 2\n2 1 1615\n2 1 1326\n0 0 3880\n2 0 1596\n1 2 4118\n0 0 4795\n0 1 814\n0 0 4555\n0 1 3284\n2 2 1910\n10 6\n2 1\n8 3\n8 7\n6 3\n4 1\n7 4\n6 4\n7 2\n10 9\n", "output": "27079\n"}, {"type": "stdin_stdout", "input": "10 10 0\n0 2 1413\n0 0 4466\n0 0 2681\n0 0 2959\n0 2 1182\n0 0 4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\nHow many kinds of items did you get?\n\n-----Constraints-----\n - 1 \\leq N \\leq 2\\times 10^5\n - S_i consists of low...
[{"type": "stdin_stdout", "input": "5\ngrape\ngrape\ngrape\ngrape\ngrape\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "5\ngrape\ngrape\ngraoe\ngrape\ngrape", "output": "2\n"}, {"type": "stdin_stdout", "input": "5\negapr\ngrape\ngraoe\ngr`pe\nepaqg", "output": "5\n"}, {"type": "stdin_stdout", "input": "5\ngra...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nToday, Wet Shark is given n integers. Using any of these integers no more than once, Wet Shark wants to get maximum possible even (divisible by 2) sum. Please, calculate this value for Wet Shark. \n\nNote, that if Wet Sha...
[{"type": "stdin_stdout", "input": "5\n999999999 503514429 850382710 999999999 1620498919\n", "output": "4974396056\n"}, {"type": "stdin_stdout", "input": "5\n999999999 503514429 850382710 999999999 1246839866\n", "output": "4097222574\n"}, {"type": "stdin_stdout", "input": "5\n999999999 999999999 850382710 999999999 9...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently, Petya learned about a new game \"Slay the Dragon\". As the name suggests, the player will have to fight with dragons. To defeat a dragon, you have to kill it and defend your castle. To do this, the player has a ...
[{"type": "stdin_stdout", "input": "4\n3 0 2 3\n5\n6 12\n2 22\n2 14\n1 7\n14 17\n", "output": "10\n16\n8\n1\n23\n"}, {"type": "stdin_stdout", "input": "4\n3 5 2 3\n5\n6 12\n2 22\n2 14\n1 7\n14 17\n", "output": "5\n11\n3\n0\n18\n"}, {"type": "stdin_stdout", "input": "4\n3 5 2 3\n5\n6 4\n2 22\n2 14\n2 14\n14 17\n", "outp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have a given picture with size $w \\times h$. Determine if the given picture has a single \"+\" shape or not. A \"+\" shape is described below:\n\n A \"+\" shape has one center nonempty cell. There should be some (a...
[{"type": "stdin_stdout", "input": "10 10\n..........\n..........\n....*.....\n....*.....\n.*******..\n....*.....\n....*.....\n..........\n....*.....\n..........\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "10 10\n..........\n..........\n....*.....\n....*.....\n.*******..\n....*.....\n....*.....\n............
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters.\n\nOur objective is to make all these three strings equal. For that, you can repeatedly perform the fo...
[{"type": "stdin_stdout", "input": "9\ncjfferent\ndifferent\ntnereffid", "output": "10\n"}, {"type": "stdin_stdout", "input": "9\ntneredfic\nciffeernt\ndifferent", "output": "11\n"}, {"type": "stdin_stdout", "input": "9\ntnedergia\ncifreefnt\ndifsnfeet", "output": "14\n"}, {"type": "stdin_stdout", "input": "9\ntnedergi...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA traveler is planning a water hike along the river. He noted the suitable rest points for the night and wrote out their distances from the starting point. Each of these locations is further characterized by its picturesq...
[{"type": "stdin_stdout", "input": "19 2\n1 73\n2 96\n3 24\n5 96\n11 13\n14 96\n16 31\n17 60\n34 69\n39 41\n60 40\n61 96\n66 7\n67 56\n70 28\n73 12\n74 81\n78 77\n95 99\n", "output": "2 3 4 6 7 8 11 12 14 15 17 18 19\n"}, {"type": "stdin_stdout", "input": "20 8\n2 37\n9 28\n13 63\n14 85\n27 27\n29 90\n34 96\n36 60\n41 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIt is a simplified version of problem F2. The difference between them is the constraints (F1: $k \\le 2$, F2: $k \\le 10$).\n\nYou are given an integer $n$. Find the minimum integer $x$ such that $x \\ge n$ and the number...
[{"type": "stdin_stdout", "input": "4\n1 1\n221 2\n177890 2\n998244353 1\n", "output": "1\n221\n181111\n999999999\n"}, {"type": "stdin_stdout", "input": "4\n1 1\n221 2\n177890 1\n998244353 1\n", "output": "1\n221\n222222\n999999999\n"}, {"type": "stdin_stdout", "input": "4\n1 1\n221 2\n108810 1\n998244353 1\n", "output...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an undirected graph with N vertices and 0 edges. Process Q queries of the following types.\n\n* `0 u v`: Add an edge (u, v).\n* `1 u v`: Print 1 if u and v are in the same connected component, 0 otherwise.\n...
[{"type": "stdin_stdout", "input": "4 7\n0 0 1\n-1 1 1\n-1 2 3\n1 0 1\n1 2 2\n-1 0 3\n-1 1 1", "output": "1\n0\n1\n1\n0\n1\n"}, {"type": "stdin_stdout", "input": "4 7\n0 0 1\n-1 2 1\n-1 2 3\n1 0 1\n1 2 2\n-1 0 3\n-1 1 1", "output": "0\n0\n1\n1\n0\n1\n"}, {"type": "stdin_stdout", "input": "9 7\n1 1 1\n-1 0 1\n-1 2 3\n1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n3 2\nR1\n\n\nOutput\n\n3 1 2\n4 5 6\n7 8 9\n\nThe input will be 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 pro...
[{"type": "stdin_stdout", "input": "73 2\nR2", "output": "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73\n146 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N islands and M bridges.\nThe i-th bridge connects the A_i-th and B_i-th islands bidirectionally.\nInitially, we can travel between any two islands using some of these bridges.\nHowever, the results of a survey ...
[{"type": "stdin_stdout", "input": "29 45\n1 3\n2 3\n2 14\n2 19\n2 29\n3 26\n4 5\n4 6\n4 13\n4 17\n5 10\n5 19\n5 24\n6 18\n6 19\n6 24\n6 25\n6 28\n6 29\n8 9\n9 18\n9 25\n10 29\n11 16\n11 22\n12 14\n12 15\n12 26\n12 29\n13 14\n14 20\n14 27\n14 29\n15 16\n15 22\n15 25\n15 29\n16 29\n17 27\n19 26\n20 29\n24 26\n15 23\n1 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBarbara was late for her math class so as a punishment the teacher made her solve the task on a sheet of paper. Barbara looked at the sheet of paper and only saw n numbers a_1, a_2, …, a_n without any mathematical symbols...
[{"type": "stdin_stdout", "input": "100\n1 2 2 2 1 1 2 2 0 2 2 0 1 0 0 0 0 1 0 0 0 1 1 2 1 1 2 2 0 2 0 2 1 1 0 2 1 0 1 2 1 2 2 1 1 1 2 1 1 1 0 1 1 0 0 2 2 1 2 2 1 0 1 0 0 2 1 2 1 1 0 2 1 0 2 0 2 1 2 0 0 0 1 1 2 0 1 0 2 2 2 1 1 1 0 2 2 1 1 1\n*-+\n", "output": "1+2*2*2*1*1*2*2+0+2*2+0+1+0+0+0+0+1+0+0+0+1+1+2*1*1*2*2+0+2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya is a math teacher. n of his students has written a test consisting of m questions. For each student, it is known which questions he has answered correctly and which he has not.\n\nIf the student answers the j-th que...
[{"type": "stdin_stdout", "input": "3\n4 3\n5 1 2 2\n110\n100\n101\n100\n4 4\n6 2 0 10\n1001\n0010\n0110\n0101\n3 6\n20 3 15\n010110\n000101\n111111\n", "output": "3 1 2 \n2 3 4 1 \n3 1 4 5 2 6 \n"}, {"type": "stdin_stdout", "input": "3\n4 3\n10 1 2 2\n110\n100\n101\n100\n4 4\n6 2 0 10\n1001\n0010\n0110\n0101\n3 6\n20 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMike decided to teach programming to children in an elementary school. He knows that it is not an easy task to interest children in that age to code. That is why he decided to give each child two sweets.\n\nMike has $n$ s...
[{"type": "stdin_stdout", "input": "20\n43 48 38 34 23 18 8 22 12 7 47 1 13 20 3 15 49 6 10 26\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "20\n43 48 38 34 23 18 8 22 12 7 47 1 13 20 3 15 49 6 10 26\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "20\n43 48 38 34 41 18 8 22 12 7 47 1 13 20 3 15 49 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n2\n1 2\n\n\nOutput\n\n2\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 ...
[{"type": "stdin_stdout", "input": "2\n-1 -12", "output": "12\n"}, {"type": "stdin_stdout", "input": "2\n-1 12", "output": "-1\n"}, {"type": "stdin_stdout", "input": "2\n-1 24", "output": "-1\n"}, {"type": "stdin_stdout", "input": "2\n-2 24", "output": "-1\n"}, {"type": "stdin_stdout", "input": "2\n-2 22", "output": "-...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA chessboard n Γ— m in size is given. During the zero minute we repaint all the black squares to the 0 color. During the i-th minute we repaint to the i color the initially black squares that have exactly four corner-adjac...
[{"type": "stdin_stdout", "input": "5000 5000\n1000000000\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "2085 5000\n1000000000\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "3762 3914\n1073\n", "output": "3386\n"}, {"type": "stdin_stdout", "input": "4583 2774\n1206\n", "output": "2535\n"}, {"type": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAndrey's favourite number is n. Andrey's friends gave him two identical numbers n as a New Year present. He hung them on a wall and watched them adoringly.\n\nThen Andrey got bored from looking at the same number and he s...
[{"type": "stdin_stdout", "input": "73552900025351606679224588872327647961330089042655630665222580520508672870102563487600132539752481214659858863022476410484266570139810532470714984092503934751571221521306943121997450187110428026190962582430971693370613087381790614697689671767000004095232276975952292053272119035138483...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi has a tower which is divided into N layers. Initially, all the layers are uncolored. Takahashi is going to paint some of the layers in red, green or blue to make a beautiful tower. He defines the beauty of the t...
[{"type": "stdin_stdout", "input": "121980 33447 90629 11295524182", "output": "643972230\n"}, {"type": "stdin_stdout", "input": "111605 33447 77758 2284871002", "output": "762328834\n"}, {"type": "stdin_stdout", "input": "111605 33447 14069 2284871002", "output": "815838636\n"}, {"type": "stdin_stdout", "input": "4247...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp likes numbers that are divisible by 3.\n\nHe has a huge number $s$. Polycarp wants to cut from it the maximum number of numbers that are divisible by $3$. To do this, he makes an arbitrary number of vertical cuts...
[{"type": "stdin_stdout", "input": "1000000000000000000000000000000000\n", "output": "33\n"}, {"type": "stdin_stdout", "input": "1000010000000000000000000000000000\n", "output": "32\n"}, {"type": "stdin_stdout", "input": "1000010000000001000000000000000000\n", "output": "31\n"}, {"type": "stdin_stdout", "input": "10000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.\n\nWrite a program which reads a list of N integers an...
[{"type": "stdin_stdout", "input": "11\n13\n20\n9\n10\n11\n13\n33\n14\n16\n12\n17", "output": "4\n"}, {"type": "stdin_stdout", "input": "11\n25\n20\n9\n10\n11\n13\n33\n14\n16\n12\n17", "output": "3\n"}, {"type": "stdin_stdout", "input": "11\n7\n10\n9\n10\n11\n13\n17\n14\n15\n16\n17", "output": "5\n"}, {"type": "stdin_s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp likes arithmetic progressions. A sequence $[a_1, a_2, \\dots, a_n]$ is called an arithmetic progression if for each $i$ ($1 \\le i < n$) the value $a_{i+1} - a_i$ is the same. For example, the sequences $[42]$, $...
[{"type": "stdin_stdout", "input": "4\n1 1000000000 1000000000 1000000000\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "4\n1 1000000000 1000000000 1000000000\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "4\n1 1000000000 1010000000 1000000000\n", "output": "-1\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGennady owns a small hotel in the countryside where he lives a peaceful life. He loves to take long walks, watch sunsets and play cards with tourists staying in his hotel. His favorite game is called \"Mau-Mau\".\n\nTo pl...
[{"type": "stdin_stdout", "input": "AS\n2H 4C TH JH AD\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "4D\nAS AC AD AH 5H\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "KH\n3C QD 9S KS 8D\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "4H\nJH QC 5H 9H KD\n", "output": "YES\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are two buttons, one of size A and one of size B.\nWhen you press a button of size X, you get X coins and the size of that button decreases by 1.\nYou will press a button twice. Here, you can press the same button t...
[{"type": "stdin_stdout", "input": "-134 -12", "output": "-25\n"}, {"type": "stdin_stdout", "input": "-134 -8", "output": "-17\n"}, {"type": "stdin_stdout", "input": "-13 -10", "output": "-21\n"}, {"type": "stdin_stdout", "input": "100 100", "output": "200\n"}, {"type": "stdin_stdout", "input": "111 111", "output": "22...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBarney lives in country USC (United States of Charzeh). USC has n cities numbered from 1 through n and n - 1 roads between them. Cities and roads of USC form a rooted tree (Barney's not sure why it is rooted). Root of the...
[{"type": "stdin_stdout", "input": "85\n1 1 2 2 4 6 1 3 6 3 3 11 9 14 12 5 8 11 16 19 12 17 2 19 1 24 6 2 6 6 24 3 20 1 1 1 17 8 4 25 31 32 39 12 35 23 31 26 46 9 37 7 5 23 41 41 39 9 11 54 36 54 28 15 25 58 56 18 23 70 68 18 3 48 57 70 15 65 22 35 25 13 49 34\n", "output": "1.000000 28.500000 27.000000 38.000000 38.50...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a cube which consists of n Γ— n Γ— n small cubes. Small cubes have marks on their surfaces. An example where n = 4 is shown in the following figure.\n\n\n<image>\n\n\nThen, as shown in the figure above (right), mak...
[{"type": "stdin_stdout", "input": "12 3\nxy 4 3\nxz 1 2\nyz 2 3\n7 5\nxy 1 1\nxy 3 3\nxz 3 2\nyz 2 1\nyz 3 3\n0 0", "output": "1692\n310\n"}, {"type": "stdin_stdout", "input": "12 3\nxy 4 3\nxz 1 2\nyz 2 3\n7 5\nxy 1 1\nyx 3 3\nxz 3 2\nyz 2 1\nyz 3 3\n0 0", "output": "1692\n315\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConstraints\n\n* 1 ≀ |V| ≀ 1000\n* 0 ≀ |E| ≀ 2000\n* -10000 ≀ di ≀ 10000\n* There are no parallel edges\n* There are no self-loops\n\nInput\n\nAn edge-weighted graph G (V, E) and the source r.\n\n\n|V| |E| r\ns0 t0 d0\ns1...
[{"type": "stdin_stdout", "input": "42 0 1\n2 -1 3\n0 5 55\n1 0 -2\n-2 0 1\n2 4 -1", "output": "INF\n0\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\nINF\n"}, {"type": "st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nB: Hokkaido University Hard\n\nNote\n\nPlease note that the question settings are the same as question A, except for the constraints.\n\nstory\n\nHomura-chan, who passed Hokkaido University and is excited about the beginn...
[{"type": "stdin_stdout", "input": "3 3\nB.B\nB..\n.BB", "output": "4\n"}, {"type": "stdin_stdout", "input": "2 3\nB.B\nB..\n.BB", "output": "3\n"}, {"type": "stdin_stdout", "input": "1 3\nB-B\n..B\n.BA", "output": "2\n"}, {"type": "stdin_stdout", "input": "1 1\nB-B\n..B\n.BA", "output": "0\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nKND is a student programmer at the University of Aizu. His chest is known to be very sexy.\n\n<image>\n\n\nFor simplicity, the part of the skin that can be seen from the chest is represented by the isosceles tr...
[{"type": "stdin_stdout", "input": "3 2 3\n2 1 1\n2 1 1\n1 3 5", "output": "6.56688917825\n0.866025403784\n0.866025403784\n12.6033176764\n"}, {"type": "stdin_stdout", "input": "3 2 2\n2 1 1\n1 1 1\n1 3 16", "output": "5.44841509844\n0.866025403784\n1.29903810568\n29.6215145047\n"}, {"type": "stdin_stdout", "input": "4 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi is solving quizzes. He has easily solved all but the last one.\nThe last quiz has three choices: 1, 2, and 3.\nWith his supernatural power, Takahashi has found out that the choices A and B are both wrong.\nPrint...
[{"type": "stdin_stdout", "input": "3\n001", "output": "2\n"}, {"type": "stdin_stdout", "input": "3\n001", "output": "2\n"}, {"type": "stdin_stdout", "input": "3\n1\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "1\n2\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "1\n3\n", "output": "2\n"}, {"type": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a[0 \\ldots n-1]$ of length $n$ which consists of non-negative integers. Note that array indices start from zero.\n\nAn array is called good if the parity of each index matches the parity of the el...
[{"type": "stdin_stdout", "input": "4\n4\n6 4 7 6\n3\n3 2 6\n1\n7\n3\n4 14 2 1 18 3 0\n", "output": "-1\n1\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "4\n4\n3 2 0 6\n3\n6 4 4\n1\n7\n7\n7 7 2 1 18 1 2\n", "output": "-1\n-1\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "4\n4\n3 2 7 8\n3\n6 2 8\n1\n7\n7\n6 13 2 1 19 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen -, and the other characters are digits from 0 through 9.\nYou are given a string S. Determine whether it follows the postal c...
[{"type": "stdin_stdout", "input": "3 4\n269-6650\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "6 4\n269-6650", "output": "No\n"}, {"type": "stdin_stdout", "input": "6 8\n269-6650", "output": "No\n"}, {"type": "stdin_stdout", "input": "6 1\n269-6650", "output": "No\n"}, {"type": "stdin_stdout", "input": "6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCQXYM found a rectangle A of size n Γ— m. There are n rows and m columns of blocks. Each block of the rectangle is an obsidian block or empty. CQXYM can change an obsidian block to an empty block or an empty block to an ob...
[{"type": "stdin_stdout", "input": "1\n9 9\n001010001\n101110100\n000010011\n100000001\n101010101\n110001111\n000001111\n110100000\n000110000\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "1\n8 9\n101110001\n101110100\n000010001\n001000001\n001011101\n110001111\n000001111\n110100010\n010110000\n", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNote that girls in Arpa’s land are really attractive.\n\nArpa loves overnight parties. In the middle of one of these parties Mehrdad suddenly appeared. He saw n pairs of friends sitting around a table. i-th pair consisted...
[{"type": "stdin_stdout", "input": "26\n8 10\n52 21\n2 33\n18 34\n30 51\n5 19\n22 32\n36 28\n42 16\n13 49\n11 17\n31 39\n43 37\n50 15\n29 20\n35 46\n47 23\n3 1\n44 7\n9 27\n6 48\n40 24\n26 14\n45 4\n12 25\n41 38\n", "output": "2 1\n1 2\n2 1\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n2 1\n1 2\n1 2\n1 2\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp wrote on the board a string $s$ containing only lowercase Latin letters ('a'-'z'). This string is known for you and given in the input.\n\nAfter that, he erased some letters from the string $s$, and he rewrote th...
[{"type": "stdin_stdout", "input": "10\nvzsxyuyy\n3\n1 0 3\nwwvutuxsuxywut\n2\n0 0\nsuzvsvutvvstuz\n3\n3 1 0\nstyuwsutv\n4\n6 3 0 1\nzsustytvzsyw\n6\n0 9 5 7 7 5\nsvwxwwwyxuvszx\n1\n0\nxuyyvuztxwuuvsxwz\n5\n5 7 0 0 7\nuxuztuwsxz\n5\n4 2 2 0 10\nxystzstwtzwsz\n2\n1 0\nuuzss\n1\n0\n", "output": "yzx\nxx\nuvz\nuvyw\nztwtv...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nJust to remind, girls in Arpa's land are really nice.\n\nMehrdad wants to invite some Hoses to the palace for a dancing party. Each Hos has some weight wi and some beauty bi. Also each Hos may have some friends. Hoses are...
[{"type": "stdin_stdout", "input": "10 5 100\n64 109 3 94 96 97 52 54 82 26\n796554 444893 214351 43810 684158 1060686 686198 339093 383018 699152\n6 8\n8 3\n3 9\n2 3\n10 3\n", "output": "1495706\n"}, {"type": "stdin_stdout", "input": "10 5 100\n48 73 57 46 95 19 171 73 94 24\n501216 675859 843572 565104 879875 828759 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads an directed graph $G = (V, E)$, and finds the shortest distance from vertex $1$ to each vertex (the number of edges in the shortest path). Vertices are identified by IDs $1, 2, ... n$.\n\nConst...
[{"type": "stdin_stdout", "input": "4\n1 2 1 4\n2 -1 4\n0 -1\n4 1 0", "output": "1 0\n2 -1\n3 -1\n4 1\n"}, {"type": "stdin_stdout", "input": "4\n1 2 1 4\n2 0 4\n0 -1\n4 -1 0", "output": "1 0\n2 -1\n3 -1\n4 1\n"}, {"type": "stdin_stdout", "input": "4\n1 2 1 4\n3 0 4\n0 -1\n4 -1 0", "output": "1 0\n2 -1\n3 -1\n4 1\n"}, {...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA university student, Takahashi, has to take N examinations and pass all of them. Currently, his readiness for the i-th examination is A_{i}, and according to his investigation, it is known that he needs readiness of at l...
[{"type": "stdin_stdout", "input": "12\n757232153 372327760 440075441 195848680 354974235 458054863 463477172 740174259 615762794 632963102 529866931 64991604\n102338863 98239366 465611891 362739947 147060907 118867039 63189252 78303147 501410831 110823640 122948912 572905212", "output": "5\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nStephen Queen wants to write a story. He is a very unusual writer, he uses only letters 'a', 'b', 'c', 'd' and 'e'!\n\nTo compose a story, Stephen wrote out $n$ words consisting of the first $5$ lowercase letters of the L...
[{"type": "stdin_stdout", "input": "6\n3\nbac\naaada\ne\n3\naba\nabcde\naba\n2\nbaba\nbaba\n4\nab\nab\nc\nbc\n5\ncbdca\nd\na\nd\ne\n3\nb\nc\nca\n", "output": "3\n2\n0\n2\n3\n2\n"}, {"type": "stdin_stdout", "input": "6\n3\nbac\naaada\ne\n3\naba\nabcde\naba\n2\nbaba\nbaba\n4\nba\nab\nc\nbc\n5\ncbdca\nd\na\nd\ne\n3\nb\nc\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKevin has just recevied his disappointing results on the USA Identification of Cows Olympiad (USAICO) in the form of a binary string of length n. Each character of Kevin's string represents Kevin's score on one of the n q...
[{"type": "stdin_stdout", "input": "93\n010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010\n", "output": "93\n"}, {"type": "stdin_stdout", "input": "93\n010101010101010101010101010101010101010101010101010101010101010101010101011101010101010101010\n", "output": "93\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKaren has just arrived at school, and she has a math test today!\n\n<image>\n\nThe test is about basic addition and subtraction. Unfortunately, the teachers were too busy writing tasks for Codeforces rounds, and had no ti...
[{"type": "stdin_stdout", "input": "19\n716981305 764655030 1148561420 914539062 853464027 317088317 653721289 239862203 605157354 943428394 261437390 821695238 312192823 432992892 547139308 121208111 1614663126 223751525 1084180198\n", "output": "399181927\n"}, {"type": "stdin_stdout", "input": "19\n469776209 76465503...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply this time machine to a well-known data structure: multiset.\n\nArtem want...
[{"type": "stdin_stdout", "input": "10\n1 1 1000000000\n1 4 1000000000\n2 2 1000000000\n1 5 1000000000\n1 8 1000000000\n2 15 1000000000\n3 3 1000000000\n3 10 1000000000\n3 6 1000000000\n3 7 1000000000\n", "output": "0\n3\n2\n2\n"}, {"type": "stdin_stdout", "input": "10\n1 1 1000000000\n1 4 1000000000\n2 2 1000000000\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N holes in a two-dimensional plane. The coordinates of the i-th hole are (x_i,y_i).\n\nLet R=10^{10^{10^{10}}}. Ringo performs the following operation:\n\n* Randomly choose a point from the interior of a circle ...
[{"type": "stdin_stdout", "input": "5\n0 0\n2 8\n4 5\n2 6\n3 10", "output": "0.43160120892732328768\n0.03480224363653196956\n0.13880483535586193855\n0.00000000000000000000\n0.39479171208028279727"}, {"type": "stdin_stdout", "input": "5\n1 0\n2 13\n-1 1\n4 10\n3 10", "output": "0.277405019286\n0.367426913906\n0.21519775...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi has two positive integers A and B.\n\nIt is known that A plus B equals N. Find the minimum possible value of \"the sum of the digits of A\" plus \"the sum of the digits of B\" (in base 10).\n\nConstraints\n\n* 2...
[{"type": "stdin_stdout", "input": "100000", "output": "10"}, {"type": "stdin_stdout", "input": "1697", "output": "23\n"}, {"type": "stdin_stdout", "input": "199", "output": "19\n"}, {"type": "stdin_stdout", "input": "178", "output": "16\n"}, {"type": "stdin_stdout", "input": "389", "output": "20\n"}, {"type": "stdin_s...
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\n\tA version control system(VCS) is a repository of files, often the files for the source code of computer programs, with monitored access. Every change...
[{"type": "stdin_stdout", "input": "2\n19 4 6\n1 4 6 7\n1 2 3 4 6 8\n12 2 2\n1 4\n1 4", "output": "3 12\n2 10\n"}, {"type": "stdin_stdout", "input": "2\n19 4 6\n1 4 6 7\n1 2 3 4 6 7\n12 2 2\n1 4\n1 4", "output": "4 13\n2 10\n"}, {"type": "stdin_stdout", "input": "2\n17 4 6\n1 3 6 11\n1 2 3 5 6 7\n5 2 2\n2 4\n3 4", "out...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a huge decimal number consisting of $n$ digits. It is guaranteed that this number has no leading zeros. Each digit of this number is either 0 or 1.\n\nYou may perform several (possibly zero) operations with ...
[{"type": "stdin_stdout", "input": "213 5 3\n111001111110111001101011111100010010011001000001111010110110011000100000101010111110010001111110001010011001101000000011111110101001101100100100110100000111111100010100011010010001011100111011000001110000111000101\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "213 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIf you draw a few infinitely long straight lines on an infinitely wide plane, this plane will be divided into several areas. For example, if you draw a straight line, the plane will be divided into two areas. Even if you ...
[{"type": "stdin_stdout", "input": "1\n705", "output": "2\n248866\n"}, {"type": "stdin_stdout", "input": "1\n506", "output": "2\n128272\n"}, {"type": "stdin_stdout", "input": "1\n154", "output": "2\n11936\n"}, {"type": "stdin_stdout", "input": "1\n238", "output": "2\n28442\n"}, {"type": "stdin_stdout", "input": "1\n373...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAt 17:00, special agent Jack starts to escape from the enemy camp. There is a cliff in between the camp and the nearest safety zone. Jack has to climb the almost vertical cliff by stepping his feet on the blocks that cove...
[{"type": "stdin_stdout", "input": "6 6\n4 4 X X T T\n4 7 8 2 X 7\n1 X X X 1 8\n1 2 X X X 6\n1 1 2 4 4 7\nS S 2 3 X X\n2 10\nT 1\n1 X\n1 X\n1 X\n1 1\n1 X\n1 X\n1 1\n1 X\nS S\n2 10\nT X\n1 X\n1 X\n1 X\n1 1\n1 X\n1 X\n1 1\n1 X\nS S\n10 10\nT T T T T T T T T T\nX 2 X X X X X 3 4 X\n9 8 9 X X X 2 9 X 9\n7 7 X 7 3 X X 8 9 X...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe official capital and the cultural capital of Berland are connected by a single road running through n regions. Each region has a unique climate, so the i-th (1 ≀ i ≀ n) region has a stable temperature of ti degrees in...
[{"type": "stdin_stdout", "input": "20 102\n73 79 75 27\n13 15 62 47\n74 75 85 86\n49 81 23 69\n43 17 45 27\n35 14 90 35\n51 74 35 33\n54 66 46 24\n33 76 49 3\n34 53 25 76\n69 72 76 31\n41 31 8 48\n49 48 85 24\n19 2 59 83\n19 31 51 86\n31 10 45 76\n56 47 79 86\n49 33 15 1\n77 89 26 64\n7 52 76 77\n", "output": "59201\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNezzar has $n$ balls, numbered with integers $1, 2, \\ldots, n$. Numbers $a_1, a_2, \\ldots, a_n$ are written on them, respectively. Numbers on those balls form a non-decreasing sequence, which means that $a_i \\leq a_{i+...
[{"type": "stdin_stdout", "input": "5\n6\n1 1 1 2 3 4\n5\n1 1 2 2 3\n4\n2 2 2 2\n3\n1 2 3\n1\n1\n", "output": "\n3\n2\n4\n1\n1\n"}, {"type": "stdin_stdout", "input": "5\n6\n1 1 1 2 3 4\n5\n1 1 2 2 3\n4\n2 2 2 2\n3\n1 2 3\n1\n1\n", "output": "3\n2\n4\n1\n1\n"}, {"type": "stdin_stdout", "input": "5\n6\n1 1 1 2 3 4\n5\n1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe, the researchers who discovered and investigated the ancient nation Iwashiro, finally discovered the temple in the center of Iwashiro. A lithograph dedicated to the god of Iwashiro was stored in the temple. On the lith...
[{"type": "stdin_stdout", "input": "aaaabaaaabaaaabaaaab\naabaa", "output": "1576\n"}, {"type": "stdin_stdout", "input": "aaaabaaaabaa`abaaaab\naabaa", "output": "1248\n"}, {"type": "stdin_stdout", "input": "aaaabaaaabaa`ababaaa\naabaa", "output": "1446\n"}, {"type": "stdin_stdout", "input": "aaaabaaaabaaaabaaaab\nbaaa...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string $s$ consisting of $n$ lowercase Latin letters.\n\nYou have to remove at most one (i.e. zero or one) character of this string in such a way that the string you obtain will be lexicographically smalle...
[{"type": "stdin_stdout", "input": "26\nlolthisiscoolfreehackforya\n", "output": "llthisiscoolfreehackforya\n"}, {"type": "stdin_stdout", "input": "26\nlolthisiscoolfreehackforya\n", "output": "llthisiscoolfreehackforya\n"}, {"type": "stdin_stdout", "input": "26\nlolthisiscoolfrfehackforya\n", "output": "llthisiscoolfr...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOmkar is playing his favorite pixelated video game, Bed Wars! In Bed Wars, there are $n$ players arranged in a circle, so that for all $j$ such that $2 \\leq j \\leq n$, player $j - 1$ is to the left of the player $j$, an...
[{"type": "stdin_stdout", "input": "5\n4\nRLRL\n6\nLRRRRL\n8\nRLLRRRLL\n12\nLLLLRRLRRRLL\n5\nRRRRR\n", "output": "0\n1\n1\n3\n2\n"}, {"type": "stdin_stdout", "input": "5\n4\nRLRL\n6\nLRRRRL\n8\nRLLRRRLL\n12\nLLRRRLRRLLLL\n5\nRRRRR\n", "output": "0\n1\n1\n3\n2\n"}, {"type": "stdin_stdout", "input": "5\n4\nRLRL\n6\nRRRLR...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNotice that the memory limit is non-standard.\n\nRecently Arthur and Sasha have studied correct bracket sequences. Arthur understood this topic perfectly and become so amazed about correct bracket sequences, so he even go...
[{"type": "stdin_stdout", "input": "50\n97 97\n61 61\n59 59\n29 29\n13 13\n7 7\n5 5\n3 3\n1 1\n3 3\n1 1\n13 13\n11 11\n9 9\n3 3\n1 1\n1 1\n1 1\n27 27\n25 25\n1 1\n21 21\n19 19\n17 17\n15 15\n5 5\n1 1\n1 1\n7 7\n1 1\n3 3\n1 1\n15 15\n13 13\n1 1\n9 9\n7 7\n5 5\n3 3\n1 1\n15 15\n5 5\n1 1\n1 1\n3 3\n1 1\n1 1\n1 1\n1 1\n1 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWherever the destination is, whoever we meet, let's render this song together.\n\nOn a Cartesian coordinate plane lies a rectangular stage of size w Γ— h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and ...
[{"type": "stdin_stdout", "input": "20 50000 50000\n2 45955 55488\n1 19804 29337\n2 3767 90811\n2 24025 33558\n1 46985 56518\n2 21094 30627\n2 5787 15320\n1 4262 91306\n2 37231 46764\n1 18125 27658\n1 36532 12317\n1 31330 40863\n1 18992 28525\n1 29387 38920\n1 44654 54187\n2 45485 55018\n2 36850 46383\n1 44649 54182\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe ask you to select some number of positive integers, and calculate the sum of them.\nIt is allowed to select as many integers as you like, and as large integers as you wish.\nYou have to follow these, however: each sele...
[{"type": "stdin_stdout", "input": "103 135 85", "output": "YES\n"}, {"type": "stdin_stdout", "input": "1 100 97\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "40 98 58\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "103 98 58", "output": "YES\n"}, {"type": "stdin_stdout", "input": "103 98 87", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it ...
[{"type": "stdin_stdout", "input": "100000000 100000000 100000000 100000000 1\n100000000 100000000 100001000 1\n", "output": "100000999\n"}, {"type": "stdin_stdout", "input": "100000000 100000000 100000000 100000000 1\n100000000 100000000 100000000 1\n", "output": "99999999\n"}, {"type": "stdin_stdout", "input": "10000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have a rectangular grid of squares with H horizontal rows and W vertical columns. Let (i,j) denote the square at the i-th row from the top and the j-th column from the left. On this grid, there is a piece, which is ini...
[{"type": "stdin_stdout", "input": "2 6 11\n2 1\nRLDRRUDDLRL\nURRDRLLDLRD", "output": "NO\n"}, {"type": "stdin_stdout", "input": "5 6 11\n2 0\nRLDRRUDDLRL\nURRDRLLDLRD", "output": "NO\n"}, {"type": "stdin_stdout", "input": "4 6 11\n2 1\nRLDRRUDDLRL\nURRDRLLDLRD", "output": "NO\n"}, {"type": "stdin_stdout", "input": "5 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor an array $b$ of length $m$ we define the function $f$ as $ f(b) = \\begin{cases} b[1] & \\quad \\text{if } m = 1 \\\\ f(b[1] \\oplus b[2],b[2] \\oplus b[3],\\dots,b[m-1] \\oplus b[m]) & \\quad \\text{otherwise,} \\en...
[{"type": "stdin_stdout", "input": "6\n0 1 6 12 51 68\n4\n1 6\n2 6\n3 3\n2 4\n", "output": "125\n125\n6\n13\n"}, {"type": "stdin_stdout", "input": "6\n1 2 4 12 16 32\n4\n1 6\n2 6\n3 4\n1 4\n", "output": "56\n56\n12\n14\n"}, {"type": "stdin_stdout", "input": "6\n1 2 4 12 32 32\n4\n1 6\n2 6\n3 4\n1 4\n", "output": "44\n4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAt Akabeko Elementary School, all the students participate in a slightly unusual jogging. Students run their own lap courses at their own pace. After going around each of your courses, you will be returned to elementary s...
[{"type": "stdin_stdout", "input": "2\n3 4\n13 4\n5\n789 289\n166 46\n9 4\n617 272\n972 303\n2\n11 5\n23 20\n0", "output": "13\n3\n1598397732\n1209243492\n1939462992\n1923746112\n1360317793\n23\n44\n"}, {"type": "stdin_stdout", "input": "2\n3 4\n13 4\n5\n789 289\n166 46\n9 4\n617 272\n972 303\n2\n11 5\n32 20\n0", "outp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNow I have a card with n numbers on it. Consider arranging some or all of these appropriately to make numbers. Find the number obtained by adding all the numbers created at this time.\n\nFor example, if you have 1 and 2, ...
[{"type": "stdin_stdout", "input": "4\n2\n8\n6\n10", "output": "1177916\n"}, {"type": "stdin_stdout", "input": "4\n4\n8\n6\n10", "output": "1315948\n"}, {"type": "stdin_stdout", "input": "4\n1\n5\n7\n17", "output": "1022430\n"}, {"type": "stdin_stdout", "input": "4\n4\n8\n3\n10", "output": "1108900\n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya has got a robot which is situated on an infinite Cartesian plane, initially in the cell $(0, 0)$. Robot can perform the following four kinds of operations: U β€” move from $(x, y)$ to $(x, y + 1)$; D β€” move from $(...
[{"type": "stdin_stdout", "input": "386\nRUDLURLUURDDLLLRLDURLRRDLDUUURLLRDLRRDLDRLDDURDURURDRLUULLDUULRULDLLLLDLUURRLRRRUDULRDDRDLDULRLDDRDDRLRLDLDULLULUDULLLDUUDURURDDLDRLUDDDDLDUDUURLUUDURRUDRLUDRLULLRLRRDLULDRRURUULLRDLDRLURDUDRLDLRLLUURLURDUUDRDURUDDLLDURURLLRRULURULRRLDLDRLLUUURURDRRRLRDRURULUDURRLRLDRUDLRRRRLLRU...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn some country live wizards. They love playing with numbers. \n\nThe blackboard has two numbers written on it β€” a and b. The order of the numbers is not important. Let's consider a ≀ b for the sake of definiteness. The p...
[{"type": "stdin_stdout", "input": "66\n7 0\n5 7\n1 3\n3 2\n3 5\n0 6\n1 2\n0 7\n4 5\n4 7\n5 1\n2 0\n4 0\n0 5\n3 6\n7 2\n6 0\n5 3\n6 6\n1 7\n5 6\n2 2\n3 4\n2 0\n5 3\n4 6\n6 1\n5 3\n100000000000 0000000000000000000\n0 1\n4 1\n2 6\n5 5\n4 5\n0 3\n3 7\n3 1\n1 0\n4 4\n1000000000000000000 100000000000\n12 6\n4 2\n7 5\n1 6\n6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}.\n\nSnuke, an employee, would like to play with this sequence.\nSpecific...
[{"type": "stdin_stdout", "input": "10000\n126382592 432418816 117063168 213396480 379143680 515038208 324231168 266539520 602792960 314653184 650153984 883734016 33309696 9005056 46451200 158759424 33279488 319342080 499438080 853167616 310094336 919876608 882363392 132034048 288561664 745817600 28561408 9703936 79297...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor a given positive integer n denote its k-rounding as the minimum positive integer x, such that x ends with k or more zeros in base 10 and is divisible by n.\n\nFor example, 4-rounding of 375 is 375Β·80 = 30000. 30000 is...
[{"type": "stdin_stdout", "input": "1005856822 8\n", "output": "50292841100000000\n"}, {"type": "stdin_stdout", "input": "1522186596 8\n", "output": "38054664900000000\n"}, {"type": "stdin_stdout", "input": "123456789 8\n", "output": "12345678900000000\n"}, {"type": "stdin_stdout", "input": "999999999 8\n", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given the string s of length n and the numbers p, q. Split the string s to pieces of length p and q.\n\nFor example, the string \"Hello\" for p = 2, q = 3 can be split to the two strings \"Hel\" and \"lo\" or to t...
[{"type": "stdin_stdout", "input": "100 1 1\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\n", "output": "100\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\nb\nb...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this problem you have to solve a simple classification task: given an image, determine whether it depicts a Fourier doodle. \n\nYou are given a set of 50 images with ids 1 through 50. You are also given a text file lab...
[{"type": "stdin_stdout", "input": "-116\n", "output": "0\n1\n1\n0\n1\n1\n0\n1\n1\n1\n1\n1\n0\n1\n0\n1\n1\n1\n0\n1\n1\n1\n1\n1\n0\n1\n0\n1\n1\n1\n"}, {"type": "stdin_stdout", "input": "-132\n", "output": "0\n1\n1\n0\n1\n1\n0\n1\n1\n1\n1\n1\n0\n1\n0\n1\n1\n1\n0\n1\n1\n1\n1\n1\n0\n1\n0\n1\n1\n1\n"}, {"type": "stdin_stdou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVus the Cossack holds a programming competition, in which $n$ people participate. He decided to award them all with pens and notebooks. It is known that Vus has exactly $m$ pens and $k$ notebooks.\n\nDetermine whether the...
[{"type": "stdin_stdout", "input": "100 100 100\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "100 100 100\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "000 100 000\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "000 100 100\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA substring of some string is called the most frequent, if the number of its occurrences is not less than number of occurrences of any other substring.\n\nYou are given a set of strings. A string (not necessarily from thi...
[{"type": "stdin_stdout", "input": "76\namnctposz\nmnctpos\nos\nu\ne\nam\namnc\neamnctpo\nl\nx\nq\nposzq\neamnc\nctposzq\nctpos\nmnc\ntpos\namnctposzql\ntposzq\nmnctposz\nnctpos\nctposzql\namnctpos\nmnct\np\nux\nposzql\ntpo\nmnctposzql\nmnctp\neamnctpos\namnct\ntposzql\nposz\nz\nct\namnctpo\noszq\neamnct\ntposz\ns\nmn\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAddition of Big Integers\n\nGiven two integers $A$ and $B$, compute the sum, $A + B$.\n\nInput\n\nTwo integers $A$ and $B$ separated by a space character are given in a line.\n\nOutput\n\nPrint the sum in a line.\n\nConst...
[{"type": "stdin_stdout", "input": "109 30", "output": "139\n"}, {"type": "stdin_stdout", "input": "195 30", "output": "225\n"}, {"type": "stdin_stdout", "input": "302 30", "output": "332\n"}, {"type": "stdin_stdout", "input": "552 30", "output": "582\n"}, {"type": "stdin_stdout", "input": "139 37", "output": "176\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDiamond Miner is a game that is similar to Gold Miner, but there are $n$ miners instead of $1$ in this game.\n\nThe mining area can be described as a plane. The $n$ miners can be regarded as $n$ points on the y-axis. Ther...
[{"type": "stdin_stdout", "input": "3\n2\n0 1\n1 0\n0 -1\n-2 0\n4\n1 0\n3 0\n-5 0\n6 0\n0 3\n0 1\n0 2\n0 4\n5\n3 0\n0 4\n0 -3\n4 0\n2 0\n2 0\n-3 0\n0 -10\n0 -1\n0 -10\n", "output": "3.6502815398728847\n18.061819283610365\n32.052255376143336\n"}, {"type": "stdin_stdout", "input": "3\n2\n0 1\n1 0\n0 -1\n-2 0\n4\n1 0\n3 0...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKate has a set $S$ of $n$ integers $\\{1, \\dots, n\\} $. \n\nShe thinks that imperfection of a subset $M \\subseteq S$ is equal to the maximum of $gcd(a, b)$ over all pairs $(a, b)$ such that both $a$ and $b$ are in $M$ ...
[{"type": "stdin_stdout", "input": "21031\n", "output": "1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA string is called palindrome if it reads the same from left to right and from right to left. For example \"kazak\", \"oo\", \"r\" and \"mikhailrubinchikkihcniburliahkim\" are palindroms, but strings \"abb\" and \"ij\" ar...
[{"type": "stdin_stdout", "input": "wrwrwfrrfrffrrwwwffffwrfrrwfrrfrwwfwfrwfwfwffwrrwfrrrwwwfrrrwfrrfwrwwrwrrrffffwrrrwrwfffwrffrwwwrwww\n", "output": "fffffffffffffffrrrrrrrrrrrrrrrrrrwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwrrrrrrrrrrrrrrrrrrfffffffffffffff\n"}, {"type": "stdin_stdout", "input": "wrwrwfrrfrffrrwwwffffwrfrrw...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou might have heard about our new goodie distribution program aka the \"Laddu Accrual System\". This problem is designed to give you a glimpse of its rules. You can read the page once before attempting the problem if you...
[{"type": "stdin_stdout", "input": "2\n4 INDIAN\nCONTEST_WON 1\nTOP_CONTRIBUTOR\nBUG_FOUND 100\nCONTEST_HOSTED\n4 NON_INDIAN\nCONTEST_WON 1\nTOP_CONTRIBUTOR\nBUG_FOUND 100\nCONTEST_HOSTED\n", "output": "3\n1\n"}, {"type": "stdin_stdout", "input": "2\n4 INDIAN\nCONTEST_WON 0\nTOP_CONTRIBUTOR\nBUG_FOUND 110\nCONTEST_HOST...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions are constraints on $n$ and $k$.\n\nYou are messaging in one of the popular social networks via your smartphone. Your smartphone can show at most $k$ most recent conversat...
[{"type": "stdin_stdout", "input": "10 4\n2 3 3 1 1 2 1 4 3 3\n", "output": "4\n4 1 3 2\n"}, {"type": "stdin_stdout", "input": "10 4\n2 3 5 1 1 2 1 4 3 3\n", "output": "4\n4 1 5 3\n"}, {"type": "stdin_stdout", "input": "10 4\n2 3 5 2 1 2 1 4 2 3\n", "output": "4\n3 2 4 1\n"}, {"type": "stdin_stdout", "input": "10 4\n2 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAccording to Berland laws it is only allowed to sell alcohol to people not younger than 18 years. Vasya's job is to monitor the law's enforcement. Tonight he entered a bar and saw n people sitting there. For every one of ...
[{"type": "stdin_stdout", "input": "4\n1475\nKXJURNYJHVLVKULJBPRBCZSOTKNTOGKGFKIQDQEMEAFTPNXQTIQWROI\nKTR\nRHVRWGODYWWTYZFLFYKCVUFFRTQDINKNWPKFHZBFWBHWINWJW\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "4\n1475\nKXJURNYJHVLVKULJBPRBCZSOTKNTOGKGFKIQDQEMEAFTPNXQTIQWROI\nRTK\nRHVRWGODYWWTYZFLFYKCVUFFRTQDINKNWPK...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence $a_1, a_2, \\dots, a_n$ consisting of $n$ integers.\n\nYou may perform the following operation on this sequence: choose any element and either increase or decrease it by one.\n\nCalculate the mini...
[{"type": "stdin_stdout", "input": "100 1186\n619 240 80 547 446 128 43 285 725 220 56 690 770 431 777 5 41 549 405 203 2 477 919 481 453 787 680 326 318 241 942 497 504 324 598 925 346 628 851 38 355 493 748 685 901 63 698 676 154 162 313 964 455 617 381 41 479 746 83 253 164 907 950 918 264 307 980 743 257 322 845 41...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this problem is used an extremely simplified version of HTML table markup. Please use the statement as a formal document and read it carefully.\n\nA string is a bHTML table, if it satisfies the grammar: \n \n \n ...
[{"type": "stdin_stdout", "input": "<table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td><table><tr><td></td></tr></table></td></tr></table></td></tr></table></td></tr></table></...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps:\n\n 1. Find the number that goes k-th in the current sequen...
[{"type": "stdin_stdout", "input": "20 20\n20 1 19 2 18 3 17 4 16 5 15 6 14 7 13 8 12 9 11 10\n", "output": "19\n"}, {"type": "stdin_stdout", "input": "20 10\n1 2 3 4 8 6 7 10 9 10 1 1 1 1 1 1 1 1 1 1\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "20 10\n1 2 3 4 8 6 7 10 9 10 1 1 1 1 0 1 1 1 1 1\n", "output"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMr. A, who will graduate next spring, decided to move when he got a job. The company that finds a job has offices in several towns, and the offices that go to work differ depending on the day. So Mr. A decided to live in ...
[{"type": "stdin_stdout", "input": "6\n0 1 80\n1 3 20\n0 2 60\n2 4 50\n3 2 66\n0 4 165\n2\n0 1 1\n1 2 1\n0", "output": "2 262\n1 2\n"}, {"type": "stdin_stdout", "input": "6\n0 1 80\n1 3 20\n0 2 60\n2 4 50\n3 2 66\n0 4 165\n2\n0 1 1\n0 2 1\n0", "output": "2 262\n0 2\n"}, {"type": "stdin_stdout", "input": "6\n0 1 113\n1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nB: Dansunau www --Dance Now!-\n\nstory\n\nLast lab life! Daigakuin! !! Dosanko Snow has won 9th place in the event \"Master Idol World\", which can be said to be the outpost of the biggest competition \"Lab Life\" where m...
[{"type": "stdin_stdout", "input": "9\n9 8 7 6 9 5 3 2 1\n1 1 1\n3 4 2\n4 3 3\n4 0 4\n5 10 5\n12 9 7\n7 7 7\n8 11 8\n9 11 9", "output": "3\n"}, {"type": "stdin_stdout", "input": "9\n9 8 7 6 9 5 3 2 1\n1 1 1\n3 4 2\n4 3 3\n4 0 4\n5 10 5\n12 9 7\n7 7 7\n8 8 8\n9 11 9", "output": "3\n"}, {"type": "stdin_stdout", "input": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nFive students, Taro, Jiro, Saburo, Shiro, and Hanako, participated in the JOI High School class.\n\nIn this class, a final exam was conducted. All five people took the final exam. For students with a final exam...
[{"type": "stdin_stdout", "input": "10\n130\n100\n37\n101", "output": "82\n"}, {"type": "stdin_stdout", "input": "10\n130\n100\n65\n101", "output": "87\n"}, {"type": "stdin_stdout", "input": "10\n130\n100\n98\n101", "output": "93\n"}, {"type": "stdin_stdout", "input": "10\n130\n110\n98\n100", "output": "95\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given a and b.\n\nConstraints\n\n* 0 < a, b ≀ 2,000,000,000\n* LCM(a, b) ≀ 2,000,000,000\n* The number of data sets ≀...
[{"type": "stdin_stdout", "input": "34 12\n234598000 42842091", "output": "2 204\n1 10050668864418000\n"}, {"type": "stdin_stdout", "input": "34 12\n234598000 60832539", "output": "2 204\n1 14271191984322000\n"}, {"type": "stdin_stdout", "input": "34 9\n234598000 42842091", "output": "1 306\n1 10050668864418000\n"}, {"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi has a lot of peculiar devices. These cylindrical devices receive balls from left and right. Each device is in one of the two states A and B, and for each state, the device operates as follows:\n\n* When a device...
[{"type": "stdin_stdout", "input": "4 123456789\nAABA", "output": "BABA\n"}, {"type": "stdin_stdout", "input": "4 110986646\nAABB", "output": "BABA\n"}, {"type": "stdin_stdout", "input": "4 123456789\nAAAA", "output": "BABA\n"}, {"type": "stdin_stdout", "input": "4 110986646\nBABA", "output": "BABA\n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a programming language in which every program is a non-empty sequence of \"<\" and \">\" signs and digits. Let's explain how the interpreter of this programming language works. A program is interpreted using move...
[{"type": "stdin_stdout", "input": "2 100\n44\n1 2\n2 2\n2 2\n1 2\n1 1\n2 2\n2 2\n1 2\n1 1\n1 1\n1 2\n1 1\n1 2\n1 1\n2 2\n1 1\n1 2\n2 2\n1 2\n1 2\n2 2\n2 2\n1 2\n1 1\n1 1\n1 2\n1 1\n2 2\n1 2\n1 2\n2 2\n1 2\n1 2\n2 2\n1 2\n2 2\n1 1\n1 1\n1 2\n1 2\n2 2\n1 2\n1 1\n1 2\n1 2\n2 2\n1 1\n2 2\n1 2\n1 1\n2 2\n1 1\n1 2\n2 2\n1 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n10^{10^{10}} participants, including Takahashi, competed in two programming contests.\nIn each contest, all participants had distinct ranks from first through 10^{10^{10}}-th.\nThe score of a participant is the product of...
[{"type": "stdin_stdout", "input": "99\n207579013 207579013\n376140463 376140463\n186969586 186969586\n326402540 326402540\n158176573 158176573\n127860890 127860890\n570870045 570870045\n178509023 178509023\n61263305 61263305\n558212775 558212775\n26389630 26389630\n496148000 496148000\n837151741 837151741\n656585276 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter you had helped Fedor to find friends in the Β«Call of Soldiers 3Β» game, he stopped studying completely. Today, the English teacher told him to prepare an essay. Fedor didn't want to prepare the essay, so he asked Ale...
[{"type": "stdin_stdout", "input": "2\nABBABAABBAABABBABAABABBAABBABAABBAABABBAABBABAABABBABAABBAABABBA ABBABAABBAABABBABAABABBAABBABAABBAABABBAABBABAABABBABAABBAABABA\n2\nABBABAABBAABABBABAABABBAABBABAAABAABABBAABBABAABABBABAABBAABABA neuzaiheshi\nABBABAABBAABABBABAABABBAABBABAABBAABABBAABBABAABABBABAABBAABABBA ABBABA...
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": "243\n", "output": " 1\n"}, {"type": "stdin_stdout", "input": "108\n", "output": " 2\n"}, {"type": "stdin_stdout", "input": "81\n", "output": " ...
code_stdio