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\nConsider a table of size n Γ— m, initially fully white. Rows are numbered 1 through n from top to bottom, columns 1 through m from left to right. Some square inside the table with odd side length was painted black. Find th...
[{"type": "stdin_stdout", "input": "96 1\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nB\nW\nW\nW\nW\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEverybody seems to think that the Martians are green, but it turns out they are metallic pink and fat. Ajs has two bags of distinct nonnegative integers. The bags are disjoint, and the union of the sets of numbers in the ...
[{"type": "stdin_stdout", "input": "36 81\n4 5 7 8 13 14 16 17 22 23 25 26 31 32 34 35 40 41 43 44 49 50 52 53 58 59 61 62 67 68 70 71 76 77 79 80\n", "output": "9\n3 12 21 30 39 48 57 66 75\n"}, {"type": "stdin_stdout", "input": "36 156\n8 1 8 9 26 14 13 33 22 32 24 70 31 32 34 35 40 41 52 44 49 50 36 53 46 56 61 62 9...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nElections in Berland are coming. There are only two candidates β€” Alice and Bob.\n\nThe main Berland TV channel plans to show political debates. There are n people who want to take part in the debate as a spectator. Each p...
[{"type": "stdin_stdout", "input": "54\n10 13\n10 45\n10 51\n01 44\n10 24\n10 26\n10 39\n10 38\n10 41\n10 33\n10 18\n10 12\n10 38\n10 30\n11 31\n10 46\n11 50\n00 26\n00 29\n00 50\n10 16\n10 40\n10 50\n00 43\n10 48\n10 32\n10 18\n10 8\n10 24\n10 32\n10 52\n00 41\n10 37\n10 38\n10 49\n00 35\n10 52\n00 44\n10 41\n10 36\n0...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n students in a university. The number of students is even. The i-th student has programming skill equal to a_i. \n\nThe coach wants to form n/2 teams. Each team should consist of exactly two students, and each ...
[{"type": "stdin_stdout", "input": "100\n1 1 100 100 1 100 1 1 1 1 1 1 100 1 100 100 100 1 1 100 100 100 100 100 1 100 1 100 1 1 1 100 1 1 100 1 100 1 1 1 100 100 1 1 1 100 100 100 100 100 1 100 100 1 1 1 1 100 1 1 100 1 1 1 1 100 100 100 1 100 1 100 100 100 1 1 100 100 100 100 1 100 1 100 100 1 100 1 100 100 100 100 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's denote that some array b is bad if it contains a subarray b_l, b_{l+1}, ..., b_{r} of odd length more than 1 (l < r and r - l + 1 is odd) such that βˆ€ i ∈ \\{0, 1, ..., r - l\\} b_{l + i} = b_{r - i}.\n\nIf an array ...
[{"type": "stdin_stdout", "input": "10 11\n-1 11 -1 -1 -1 -1 10 -1 -1 -1\n", "output": "100000000\n"}, {"type": "stdin_stdout", "input": "10 17\n-1 11 -1 -1 -1 -1 10 -1 -1 -1\n", "output": "301989884\n"}, {"type": "stdin_stdout", "input": "10 11\n-1 1 -1 -1 -1 -1 10 -1 -1 -1\n", "output": "100000000\n"}, {"type": "stdi...
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 β‹… m colored pieces that form a rectangle with n rows and ...
[{"type": "stdin_stdout", "input": "10 10\naaaaaaaaaa\nbbbbbbbbbb\ncccccccccc\ndddddddddd\neeeeeeeeee\nffffffffff\ngggggggggg\nhhhhhhhhhh\niiiiiiiiii\njjjjjjjjjj\n", "output": "440\n"}, {"type": "stdin_stdout", "input": "10 10\naaaaarpppp\nbbbbsssssu\ncciiiiiiqq\nddmmgggggg\neeebbbbbbb\nfffffqoooo\ngxxxxrrrrr\nhhfuuuuu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya is about to take his first university exam in about several minutes. And it's not just some ordinary exam, it's on mathematical analysis. Of course, right now Vasya can only think of one thing: what the result of hi...
[{"type": "stdin_stdout", "input": "100 1\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 99\n1\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou work as a system administrator in a dormitory, which has n rooms one after another along a straight hallway. Rooms are numbered from 1 to n.\n\nYou have to connect all n rooms to the Internet.\n\nYou can connect each ...
[{"type": "stdin_stdout", "input": "200 10\n10000010101010110011110010100010010000001100101111011001010010001101001011111110011010111101000101011110101001001101101011010011100000100101000010110111000110000010101110110000110000100000101110111100\n", "output": "989\n"}, {"type": "stdin_stdout", "input": "200 16\n10000010...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWelcome! Everything is fine.\n\nYou have arrived in The Medium Place, the place between The Good Place and The Bad Place. You are assigned a task that will either make people happier or torture them for eternity.\n\nYou h...
[{"type": "stdin_stdout", "input": "2\n3\n1 2 3\n3 2 4\n2 4 3\n4 5 6\n5 6 5\n2\n1 2 1\n1 3 2\n1 4 3\n", "output": "15 33\n6 6\n"}, {"type": "stdin_stdout", "input": "2\n3\n1 2 0\n3 2 4\n2 4 3\n4 5 6\n5 6 5\n2\n1 2 1\n1 3 2\n1 4 3\n", "output": "12 30\n6 6\n"}, {"type": "stdin_stdout", "input": "2\n3\n1 2 0\n3 1 4\n2 4 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWarawreh created a great company called Nanosoft. The only thing that Warawreh still has to do is to place a large picture containing its logo on top of the company's building.\n\nThe logo of Nanosoft can be described as ...
[{"type": "stdin_stdout", "input": "8 8 8\nRRRRGGGG\nRRRRGGGG\nRRRRGGGG\nRRRRGGGG\nYYYYBBBB\nYYYYBBBB\nYYYYBBBB\nYYYYBBBB\n1 1 8 8\n5 2 5 7\n3 1 8 6\n2 3 5 8\n1 2 6 8\n2 1 5 5\n2 1 7 7\n6 5 7 5\n", "output": "64\n0\n16\n4\n16\n4\n36\n0\n"}, {"type": "stdin_stdout", "input": "8 8 8\nRRRRGGGG\nRRRRGGGG\nRRRRGGGG\nRRRRGGG...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a of length n that has a special condition: every element in this array has at most 7 divisors. Find the length of the shortest non-empty subsequence of this array product of whose elements is a per...
[{"type": "stdin_stdout", "input": "8\n6 15 35 129 143 221 34 26\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "8\n6 15 35 129 143 221 3 26\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "8\n6 15 35 129 143 221 3 51\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "8\n6 11 35 129 143 221 3 5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given n integers a_1, a_2, ..., a_n.\n\nFor each a_i find its two divisors d_1 > 1 and d_2 > 1 such that \\gcd(d_1 + d_2, a_i) = 1 (where \\gcd(a, b) is the greatest common divisor of a and b) or say that there is...
[{"type": "stdin_stdout", "input": "10\n13 3 2 10 8 8 8 9 3 11\n", "output": "-1 -1 -1 2 -1 -1 -1 -1 -1 -1\n-1 -1 -1 5 -1 -1 -1 -1 -1 -1\n"}, {"type": "stdin_stdout", "input": "10\n2 3 3 5 5 8 8 9 2 19\n", "output": "-1 -1 -1 -1 -1 -1 -1 -1 -1 -1\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1\n"}, {"type": "stdin_stdout", "input": "10...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an undirected graph where each edge has one of two colors: black or red.\n\nYour task is to assign a real number to each node so that: \n\n * for each black edge the sum of values at its endpoints is 1; \n ...
[{"type": "stdin_stdout", "input": "50 49\n31 8 2\n31 7 2\n31 34 1\n7 49 1\n34 16 2\n8 24 1\n8 33 1\n8 21 1\n21 15 2\n34 4 2\n49 46 1\n34 18 2\n21 28 2\n33 23 1\n31 43 2\n4 17 2\n23 10 2\n16 30 2\n30 37 2\n34 25 2\n17 19 1\n34 40 1\n31 29 2\n46 32 2\n33 48 2\n31 14 1\n14 44 1\n14 9 2\n4 5 1\n43 2 2\n49 1 2\n17 26 2\n4 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n robbers at coordinates (a_1, b_1), (a_2, b_2), ..., (a_n, b_n) and m searchlight at coordinates (c_1, d_1), (c_2, d_2), ..., (c_m, d_m). \n\nIn one move you can move each robber to the right (increase a_i of e...
[{"type": "stdin_stdout", "input": "7 3\n0 8\n3 8\n2 7\n0 10\n5 5\n7 0\n3 5\n6 6\n3 11\n11 5\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "7 3\n0 8\n3 8\n2 7\n0 10\n5 5\n7 0\n3 5\n6 1\n3 11\n11 5\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "7 3\n0 8\n3 8\n2 7\n0 10\n5 5\n7 0\n3 5\n6 0\n3 11\n11 5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp found on the street an array a of n elements.\n\nPolycarp invented his criterion for the beauty of an array. He calls an array a beautiful if at least one of the following conditions must be met for each differen...
[{"type": "stdin_stdout", "input": "10\n5\n4 3 1 5 2\n5\n1 5 1 1 5\n5\n4 1 2 1 2\n5\n5 5 6 1 4\n5\n5 2 4 5 4\n5\n3 1 2 3 4\n5\n1 3 9 4 1\n5\n5 2 10 5 4\n5\n1 1 2 3 2\n4\n2 2 5 1\n", "output": "2\n0\n0\n2\n2\n2\n1\n2\n1\n1\n"}, {"type": "stdin_stdout", "input": "10\n5\n4 3 1 5 1\n5\n1 4 1 1 3\n5\n4 1 2 1 2\n5\n5 5 5 1 4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs Sherlock Holmes was investigating a crime, he identified n suspects. He knows for sure that exactly one of them committed the crime. To find out which one did it, the detective lines up the suspects and numbered them f...
[{"type": "stdin_stdout", "input": "64 28\n+54\n+44\n+55\n-3\n+33\n-54\n-54\n-7\n+33\n+54\n+54\n+26\n-54\n+14\n-54\n-47\n+25\n-54\n-54\n-54\n-52\n+54\n+54\n+54\n+54\n+20\n+7\n+54\n+4\n+32\n+46\n-54\n-47\n+15\n+32\n-54\n+7\n+62\n-16\n-54\n+3\n+54\n+54\n+54\n+54\n-54\n+54\n-54\n+54\n-52\n+27\n-7\n+54\n-5\n-54\n-18\n+1\n+...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou've got a rectangular parallelepiped with integer edge lengths. You know the areas of its three faces that have a common vertex. Your task is to find the sum of lengths of all 12 edges of this parallelepiped.\n\nInput\...
[{"type": "stdin_stdout", "input": "10000 10000 10000\n", "output": "1200"}, {"type": "stdin_stdout", "input": "10000 1 10000\n", "output": "40008"}, {"type": "stdin_stdout", "input": "9801 9801 9801\n", "output": "1188"}, {"type": "stdin_stdout", "input": "1 10000 10000\n", "output": "40008"}, {"type": "stdin_stdout",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor he knew every Who down in Whoville beneath, Was busy now, hanging a mistletoe wreath. \"And they're hanging their stockings!\" he snarled with a sneer, \"Tomorrow is Christmas! It's practically here!\"\n\nDr. Suess, H...
[{"type": "stdin_stdout", "input": "336 336\nHHHHHHHHHS..S..HH..H.S.H..HHH.H.H.H.S.H.S.S.H.S..SS..H.SS.H.HH.HH..HH.H...H.H.H.HSS..H...HH..HH.H..H.S.S....S.H.HH..HS..S.S.S.H.H.S..S.H.HH.HH..HH.HH.HS.HH.HSSHHHHHHHHH.H.HH..HHH.H.H.S..H.HH.S.H..HH.HS.HH.S.H.H.H..H.HH.HS.HHHHH.HH.S.SSS.S.S.HH.HS.H.S.HH.H.HH.H.S.HH.HS.HH..HH...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYaroslav thinks that two strings s and w, consisting of digits and having length n are non-comparable if there are two numbers, i and j (1 ≀ i, j ≀ n), such that si > wi and sj < wj. Here sign si represents the i-th digit...
[{"type": "stdin_stdout", "input": "10\n?8?528?91?\n1???60??54\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "10\n?8?258?91?\n1???60??54\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "10\n0????19?01\n????164759\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "10\n2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs it has been found out recently, all the Berland's current economical state can be described using a simple table n Γ— m in size. n β€” the number of days in each Berland month, m β€” the number of months. Thus, a table cell...
[{"type": "stdin_stdout", "input": "91 96\n49\n37 36 -1\n79 89 -1\n25 44 -1\n63 31 1\n60 29 -1\n31 36 1\n33 32 -1\n24 43 1\n19 51 -1\n60 19 1\n89 87 1\n8 81 -1\n36 55 1\n72 74 -1\n90 30 -1\n89 51 -1\n60 59 1\n15 27 -1\n10 20 -1\n21 55 -1\n48 89 -1\n49 19 -1\n59 37 1\n70 25 1\n10 73 1\n63 28 -1\n26 75 -1\n80 4 -1\n91 38...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya has n pairs of socks. In the morning of each day Vasya has to put on a pair of socks before he goes to school. When he comes home in the evening, Vasya takes off the used socks and throws them away. Every m-th day (...
[{"type": "stdin_stdout", "input": "100 100\n", "output": "101\n"}, {"type": "stdin_stdout", "input": "100 5\n", "output": "124\n"}, {"type": "stdin_stdout", "input": "99 100\n", "output": "99\n"}, {"type": "stdin_stdout", "input": "95 16\n", "output": "101\n"}, {"type": "stdin_stdout", "input": "99 74\n", "output": "1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBreaking Good is a new video game which a lot of gamers want to have. There is a certain level in the game that is really difficult even for experienced gamers.\n\nWalter William, the main character of the game, wants to ...
[{"type": "stdin_stdout", "input": "13 58\n9 12 0\n8 11 0\n4 8 1\n2 12 1\n9 1 1\n10 6 1\n5 2 1\n3 9 0\n8 3 0\n9 10 0\n8 5 1\n11 3 0\n11 1 0\n2 6 1\n12 3 1\n11 6 0\n1 12 0\n2 1 1\n11 13 0\n6 8 1\n11 5 1\n8 9 0\n1 4 0\n12 7 1\n5 12 0\n11 7 0\n11 2 0\n5 11 1\n9 4 1\n7 5 1\n2 11 0\n13 12 1\n10 3 1\n1 13 0\n7 1 0\n6 3 0\n7 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSoon a school Olympiad in Informatics will be held in Berland, n schoolchildren will participate there.\n\nAt a meeting of the jury of the Olympiad it was decided that each of the n participants, depending on the results,...
[{"type": "stdin_stdout", "input": "3000000\n1000000 1000000\n1000000 1000000\n1000000 1000000\n", "output": "1000000 1000000 1000000\n"}, {"type": "stdin_stdout", "input": "2174477\n352351 791072\n365110 969163\n887448 955610\n", "output": "791072 495957 887448\n"}, {"type": "stdin_stdout", "input": "1400000\n300000 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHigh school student Vasya got a string of length n as a birthday present. This string consists of letters 'a' and 'b' only. Vasya denotes beauty of the string as the maximum length of a substring (consecutive subsequence)...
[{"type": "stdin_stdout", "input": "100 12\naaaaaaaaaaaaaaaabaaabaaaaaaaaaabbaaaabbabaaaaaaaaaaaaaaaaaaaaabbaaabaaaaaaaaaaaabaaaaaaaabaaaaaaaaaa\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "100 65\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n", "ou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn one school with Vasya there is a student Kostya. Kostya does not like physics, he likes different online games. Every day, having come home, Kostya throws his bag in the farthest corner and sits down at his beloved com...
[{"type": "stdin_stdout", "input": "3 3 2 5\ndesolator\nrefresher\nperseverance\nvanguard: desolator 1, refresher 1\nmaelstorm: perseverance 2\n1 desolator\n2 perseverance\n1 refresher\n2 desolator\n2 perseverance\n", "output": "1\nvanguard 1\n2\ndesolator 1\nmaelstorm 1\n0\n"}, {"type": "stdin_stdout", "input": "2 3 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs you have noticed, there are lovely girls in Arpa’s land.\n\nPeople in Arpa's land are numbered from 1 to n. Everyone has exactly one crush, i-th person's crush is person with the number crushi.\n\n<image>\n\nSomeday Ar...
[{"type": "stdin_stdout", "input": "100\n84 94 72 32 61 90 61 2 76 42 35 82 90 29 51 27 65 99 38 41 44 73 100 58 56 64 54 31 14 58 57 64 90 49 73 80 74 19 31 86 73 44 39 43 28 95 23 5 85 5 74 81 34 44 86 30 50 57 94 56 53 42 53 87 92 78 53 49 78 60 37 63 41 19 15 68 25 77 87 48 23 100 54 27 68 84 43 92 76 55 2 94 100 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNoora is a student of one famous high school. It's her final year in school β€” she is going to study in university next year. However, she has to get an Β«AΒ» graduation certificate in order to apply to a prestigious one.\n\...
[{"type": "stdin_stdout", "input": "100 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...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPalindromic characteristics of string s with length |s| is a sequence of |s| integers, where k-th number is the total number of non-empty substrings of s which are k-palindromes.\n\nA string is 1-palindrome if and only if...
[{"type": "stdin_stdout", "input": "wyemcafatp\n", "output": "11 1 0 0 0 0 0 0 0 0 "}, {"type": "stdin_stdout", "input": "wyempafatc\n", "output": "11 1 0 0 0 0 0 0 0 0\n"}, {"type": "stdin_stdout", "input": "wyempaf`tc\n", "output": "10 0 0 0 0 0 0 0 0 0\n"}, {"type": "stdin_stdout", "input": "wyfmpae`tc\n", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n points on a straight line, and the i-th point among them is located at xi. All these coordinates are distinct.\n\nDetermine the number m β€” the smallest number of points you should add on the line to make the d...
[{"type": "stdin_stdout", "input": "10\n711183437 845779129 -106125616 -481773790 66231250 -183390793 -711197523 -196001897 -440633306 -873649505\n", "output": "156311685\n"}, {"type": "stdin_stdout", "input": "7\n996073710 -164874875 34663194 35526441 634003254 -704646201 -905166147\n", "output": "1901239851\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTwo famous competing companies ChemForces and TopChemist decided to show their sets of recently discovered chemical elements on an exhibition. However they know that no element should be present in the sets of both compan...
[{"type": "stdin_stdout", "input": "10\n598654597 975579682\n117777072 31932499\n223851456 1477480177\n988262691 654502493\n967529230 543358150\n835120075 101574205\n809901567 613170206\n152157661 479980560\n859252956 158469817\n614959273 735298093\n10\n1156316033 361325206\n341655282 740807372\n239996693 809030434\n81...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem Statement:\n\nDom and Brian were trying to evade the truck drivers of Verone's gang. They were too fast, too furious for them, and could get away from the truck drivers easily. They decided to race with each other...
[{"type": "stdin_stdout", "input": "3\n0 2 15\n1 4 10\n\nSKLPEA", "output": "Dom\n13\n"}, {"type": "stdin_stdout", "input": "3\n0 2 27\n2 4 10\n\nSKLPEA", "output": "Dom\n25\n"}, {"type": "stdin_stdout", "input": "3\n2 -1 35\n0 4 0\n\nDLPNAS", "output": "Dom\n36\n"}, {"type": "stdin_stdout", "input": "3\n1 2 3\n1 2 4\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSoumika has a string S and its starting index is 1. The string S consists of characters from 1-9. As she is very intelligent, she wants to test his brother Vinay Tendulkar. She asked her brother Vinay Tendulkar to count t...
[{"type": "stdin_stdout", "input": "574674546476\n\nSAMPLE", "output": "7 7 7 6 5 5 4 4 3 2 1 1\n"}, {"type": "stdin_stdout", "input": "574674546476\n\nELPMAS", "output": "7 7 7 6 5 5 4 4 3 2 1 1\n"}, {"type": "stdin_stdout", "input": "574674546476\n\nASMPLE", "output": "7 7 7 6 5 5 4 4 3 2 1 1\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a grid with N rows and N columns of squares. Let (i, j) be the square at the i-th row from the top and the j-th column from the left.\n\nEach of the central (N-2) \\times (N-2) squares in the grid has a black sto...
[{"type": "stdin_stdout", "input": "176527 15\n2 81279\n2 22308\n2 145342\n1 106634\n2 60988\n1 170938\n2 139754\n2 15220\n1 172794\n1 159290\n2 156968\n1 88080\n2 77429\n2 97459\n2 71282", "output": "31159275826"}, {"type": "stdin_stdout", "input": "176527 15\n2 81279\n2 22308\n2 145342\n1 106634\n2 60988\n1 170938\n2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.\n\nWe will pick up K among these cards. What is the maximum possible sum of the numbers written ...
[{"type": "stdin_stdout", "input": "2000000000 0 0 2000000000", "output": "2000000000"}, {"type": "stdin_stdout", "input": "3 0 17 18", "output": "-12\n"}, {"type": "stdin_stdout", "input": "0 3 10 12", "output": "-9\n"}, {"type": "stdin_stdout", "input": "-4 3 8 5", "output": "-10\n"}, {"type": "stdin_stdout", "input"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNiwango bought a piece of land that can be represented as a half-open interval [0, X).\n\nNiwango will lay out N vinyl sheets on this land. The sheets are numbered 1,2, \\ldots, N, and they are distinguishable. For Sheet ...
[{"type": "stdin_stdout", "input": "18 477\n324 31 27 227 9 21 41 55 50 34 2 362 92 11 13 17 183 119", "output": "128162603\n"}, {"type": "stdin_stdout", "input": "18 477\n324 31 27 227 9 21 41 29 16 34 2 362 92 11 13 17 183 119", "output": "752066823\n"}, {"type": "stdin_stdout", "input": "18 477\n324 31 27 227 9 21 4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe will call a string obtained by arranging the characters contained in a string a in some order, an anagram of a.\n\nFor example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multi...
[{"type": "stdin_stdout", "input": "5\nabaaaaaaaa\noweplustno\naaaaaaaaba\ntwoplusone\naaaabaaaaa", "output": "4\n"}, {"type": "stdin_stdout", "input": "5\nabaaaaaaaa\noweplustmo\naaaaaaaaba\nunoselpowt\naaaaaaaaba", "output": "3\n"}, {"type": "stdin_stdout", "input": "5\nabaaaaaaaa\noweplustno\naaaaaaaaba\ntwoplusone\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the beginning, Takahashi has A cookies, and Aoki has B cookies. They will perform the following operation alternately, starting from Takahashi:\n\n* If the number of cookies in his hand is odd, eat one of those cookies...
[{"type": "stdin_stdout", "input": "231274241 358979323 84", "output": "393502366 196751183\n"}, {"type": "stdin_stdout", "input": "377378637 358979323 84", "output": "490905292 245452646\n"}, {"type": "stdin_stdout", "input": "314159265 358979323 84", "output": "448759046 224379523"}, {"type": "stdin_stdout", "input":...
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 1000010000 1000000\n123\n159 1\n111 1\n135 3\n147 3", "output": "7496370\n"}, {"type": "stdin_stdout", "input": "5 1000000000 1000000\n123\n166 1\n111 1\n135 3\n147 3", "output": "7460410\n"}, {"type": "stdin_stdout", "input": "5 1000010000 1000000\n203\n159 1\n111 1\n135 3\n147 3"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe call a 4-digit integer with three or more consecutive same digits, such as 1118, good.\n\nYou are given a 4-digit integer N. Answer the question: Is N good?\n\nConstraints\n\n* 1000 ≀ N ≀ 9999\n* N is an integer.\n\nIn...
[{"type": "stdin_stdout", "input": "4000", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "15093", "output": "No\n"}, {"type": "stdin_stdout", "input": "12733", "output": "No\n"}, {"type": "stdin_stdout", "input": "24549", "output": "No\n"}, {"type": "stdin_stdout", "input": "16730", "output": "No\n"}, {"type": ...
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.\n\nHowever, if A + B is 10 or greater, output `error` instead.\n\nConstraints\n\n* A and B are integers.\n* 1 ≀ A, B ≀ 9\n\nInput\n\nInput is giv...
[{"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\nGiven a lowercase English letter c, determine whether it is a vowel. Here, there are five vowels in the English alphabet: `a`, `e`, `i`, `o` and `u`.\n\nConstraints\n\n* c is a lowercase English letter.\n\nInput\n\nThe in...
[{"type": "stdin_stdout", "input": "-12", "output": "consonant\n"}, {"type": "stdin_stdout", "input": "-10", "output": "consonant\n"}, {"type": "stdin_stdout", "input": "-14", "output": "consonant\n"}, {"type": "stdin_stdout", "input": "-17", "output": "consonant\n"}, {"type": "stdin_stdout", "input": "-11", "output": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the city, there are two pastry shops. One shop was very popular because its cakes are pretty tasty. However, there was a man who is displeased at the shop. He was an owner of another shop. Although cause of his shop's ...
[{"type": "stdin_stdout", "input": "2\n-1\n3\n26 4 2\n0", "output": "-1\n16\n"}, {"type": "stdin_stdout", "input": "2\n-1\n3\n26 4 1\n0", "output": "-1\n15\n"}, {"type": "stdin_stdout", "input": "2\n-1\n4\n1 -1 1\n0", "output": "-1\n0\n"}, {"type": "stdin_stdout", "input": "2\n1\n54\n13 9 10\n0", "output": "1\n0\n"}, {...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence a0a1...aN-1 digits and a prime number Q. For each i ≀ j with ai β‰  0, the subsequence aiai+1...aj can be read as a decimal representation of a positive integer. Subsequences with leading zeros are ...
[{"type": "stdin_stdout", "input": "6 32 64 13\n4 35 176 5\n5 555 442 1\n5 777 199 18\n100000 666 701622763 68962\n0 0 0 0", "output": "0\n1\n12\n1\n129752\n"}, {"type": "stdin_stdout", "input": "6 32 64 13\n4 35 176 5\n5 555 442 1\n5 777 465 18\n100000 666 701622763 65537\n0 0 0 0", "output": "0\n1\n12\n0\n68530\n"}, ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are a programmer who loves bishojo games (a sub-genre of dating simulation games). A game, which is titled \"I * C * P * C!\" and was released yesterday, has arrived to you just now. This game has multiple endings. Wh...
[{"type": "stdin_stdout", "input": "5\n3 3\n0 0\n5 4\n5 5", "output": "10\n"}, {"type": "stdin_stdout", "input": "5\n5 4\n1 1\n3 14\n5 5", "output": "4\n"}, {"type": "stdin_stdout", "input": "5\n5 4\n1 1\n3 18\n5 5", "output": "4\n"}, {"type": "stdin_stdout", "input": "5\n5 4\n1 0\n3 14\n5 5", "output": "4\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA great king of a certain country suddenly decided to visit the land of a friendly country. The country is famous for trains, and the king visits various stations.\n\nThere are 52 train stations, each with a single upperc...
[{"type": "stdin_stdout", "input": "2\n1 2\nadd\n3\n12 4 0\nDDDA\n5\n3 1 3 5 2\ndcdkIlkP\n0", "output": "Zbc\nrzDo\nabafGijM\n"}, {"type": "stdin_stdout", "input": "2\n1 2\nadd\n3\n12 4 1\nDDDA\n5\n3 1 3 5 2\ndcdkIlkP\n0", "output": "Zbc\nrzCo\nabafGijM\n"}, {"type": "stdin_stdout", "input": "2\n1 0\nadd\n3\n12 4 1\nDD...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nAOR Ika likes rooted trees with a fractal (self-similar) structure. Consider using the weighted rooted tree $ T $ consisting of $ N $ vertices to represent the rooted tree $ T'$ with the following fractal struc...
[{"type": "stdin_stdout", "input": "3.0106987506281717\n4\n4 1 1\n2 3 10\n2 4 0", "output": "11412.977062503\n"}, {"type": "stdin_stdout", "input": "3.0106987506281717\n4\n4 1 1\n2 3 11\n2 4 0", "output": "12541.821042461\n"}, {"type": "stdin_stdout", "input": "2.2392200720429236\n4\n2 3 1\n1 3 3\n3 4 20", "output": "1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have N coins each of which has a value ai. Find the number of combinations that result when you choose K different coins in such a way that the total value of the coins is greater than or equal to L and less than or e...
[{"type": "stdin_stdout", "input": "5 4 7 19\n1 10 2 2 -1", "output": "4\n"}, {"type": "stdin_stdout", "input": "5 6 7 19\n1 10 2 2 -1", "output": "0\n"}, {"type": "stdin_stdout", "input": "5 4 13 19\n1 5 1 2 -1", "output": "0\n"}, {"type": "stdin_stdout", "input": "5 6 10 7\n1 10 2 2 -1", "output": "0\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDivision of Big Integers\n\nGiven two integers $A$ and $B$, compute the quotient, $\\frac{A}{B}$. Round down to the nearest decimal.\n\nInput\n\nTwo integers $A$ and $B$ separated by a space character are given in a line....
[{"type": "stdin_stdout", "input": "12 -1", "output": "-12\n"}, {"type": "stdin_stdout", "input": "10 -1", "output": "-10\n"}, {"type": "stdin_stdout", "input": "20 -1", "output": "-20\n"}, {"type": "stdin_stdout", "input": "11 -1", "output": "-11\n"}, {"type": "stdin_stdout", "input": "15 -1", "output": "-15\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nChef talks a lot on his mobile phone. As a result he exhausts his talk-value (in Rokdas) very quickly. One day at a mobile recharge shop, he noticed that his service provider gives add-on plans which can lower his calling...
[{"type": "stdin_stdout", "input": "4\n1.00 90 1\n1 1.7525489781557062 28\n1.3670910027404404 200 2\n2 0.75 40\n5 1.2448234862135843 101\n1.690723151930112 50 2\n1 1.4388842285899601 65\n2 2.296376152318535 100\n1.00 000 2\n3 1.1116288236865874 10\n4 1.5704897737882006 36", "output": "0\n1\n0\n0\n"}, {"type": "stdin_st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp loves ciphers. He has invented his own cipher called Right-Left.\n\nRight-Left cipher is used for strings. To encrypt the string s=s_{1}s_{2} ... s_{n} Polycarp uses the following algorithm:\n\n * he writes down...
[{"type": "stdin_stdout", "input": "qwertyuioasdfghjklrtyuiodfghjklqwertyuioasdfssddxb\n", "output": "dfogihujyktlrqlwkejrhtgyfudisoaaosidufystsrdedwxqb\n"}, {"type": "stdin_stdout", "input": "qwertyuioasdfghjklrtyuipdfghjklqwertyuioasdfssddxb\n", "output": "dfpgihujyktlrqlwkejrhtgyfudisoaaosidufystsrdedwxqb\n"}, {"typ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis is an interactive problem.\n\nVasya and Petya are going to play the following game: Petya has some positive integer number a. After that Vasya should guess this number using the following questions. He can say a pair...
[{"type": "stdin_stdout", "input": "100\n103\n130\n138\n126\n157\n164\n185\n120\n109\n137\n123\n147\n124\n178\n183\n155\n146\n169\n156\n153\n196\n152\n145\n110\n184\n168\n170\n177\n190\n128\n108\n182\n102\n101\n159\n150\n117\n106\n187\n194\n167\n151\n171\n195\n127\n115\n192\n114\n125\n165\n118\n113\n189\n199\n180\n139\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou came to a local shop and want to buy some chocolate bars. There are n bars in the shop, i-th of them costs a_i coins (and you want to buy all of them).\n\nYou have m different coupons that allow you to buy chocolate b...
[{"type": "stdin_stdout", "input": "9\n7 2 3 3 2 5 6 3 3\n6\n7 5 4 8 9 2\n", "output": "31\n31\n31\n32\n32\n28\n"}, {"type": "stdin_stdout", "input": "9\n7 2 3 3 2 5 6 3 3\n6\n7 5 4 8 9 3\n", "output": "31\n31\n31\n32\n32\n29\n"}, {"type": "stdin_stdout", "input": "9\n7 2 3 3 2 5 5 3 3\n6\n7 5 4 8 9 3\n", "output": "30...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAnadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≀ a ≀ b ≀ 6, there is exactly one domino with a dots on one half and b dots on the other half. The s...
[{"type": "stdin_stdout", "input": "7 21\n1 2\n1 3\n1 4\n1 5\n1 6\n1 7\n2 3\n2 4\n2 5\n2 6\n2 7\n3 4\n3 5\n3 6\n3 7\n4 5\n4 6\n4 7\n5 6\n5 7\n6 7\n", "output": "16"}, {"type": "stdin_stdout", "input": "7 21\n3 5\n7 2\n2 3\n6 5\n5 2\n4 7\n2 6\n2 4\n6 7\n5 1\n1 4\n4 5\n5 7\n4 6\n3 1\n1 2\n3 4\n7 1\n3 7\n6 1\n3 6\n", "out...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKamil likes streaming the competitive programming videos. His MeTube channel has recently reached 100 million subscribers. In order to celebrate this, he posted a video with an interesting problem he couldn't solve yet. C...
[{"type": "stdin_stdout", "input": "32\n402528994560 0 0 0 0 0 0 932646223872 893192888700 0 813583026900 0 0 0 0 143521875000 0 177570054144 186624000000 0 517655600000 202145625000 341007975000 0 116252718750 0 148561875000 0 304819200000 248474688000 0 103125000000\n29 25\n20 24\n8 21\n23 3\n32 14\n29 30\n31 24\n28 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThree friends are going to meet each other. Initially, the first friend stays at the position x = a, the second friend stays at the position x = b and the third friend stays at the position x = c on the coordinate axis Ox...
[{"type": "stdin_stdout", "input": "8\n4 6 16\n7 6 35\n12 5 1\n2 15 3\n1 1000000000 0000000000\n1 1000000000 459694946\n2 0 9\n4 2 6\n", "output": "20\n54\n18\n22\n1999999996\n1999999994\n14\n4\n"}, {"type": "stdin_stdout", "input": "8\n4 6 16\n7 6 35\n12 5 1\n2 15 3\n1 1000000000 0000000000\n1 1000000000 459694946\n1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given string s of length n consisting of 0-s and 1-s. You build an infinite string t as a concatenation of an infinite number of strings s, or t = ssss ... For example, if s = 10010, then t = 100101001010010...\n\...
[{"type": "stdin_stdout", "input": "1\n439 -6100238\n100011110101001111000100101001001100010100010101001011100000110000000010011011111100010011100100000010011000110100111010100100100101101101100111100001010000010110000111011100000001110111100111110011110001001001100010110101100101011111010110010110101111001011000111010...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya has a string s of length n. He decides to make the following modification to the string: \n\n 1. Pick an integer k, (1 ≀ k ≀ n). \n 2. For i from 1 to n-k+1, reverse the substring s[i:i+k-1] of s. For example, if ...
[{"type": "stdin_stdout", "input": "1\n440\ntcjbjlbtjfmvzdqutuwzvmgqrqtrvxwrdacxcowbmbwvwssihttgdsjntiawqavwspzmybakxmwpbcgaffpyhvjrulqsorkcuozvtdbkkmasxtemrrbhqnmkpgewwphdvcyhxmatrfjkesacujihmtyqtqcjfqhpsjhgzimegvkjylapylqprykvkjavlmipewlzqsfefjzecadsqmfutgnegngmwchqttcyklocfcyuhghvtygdbsxaoxkvtgdcnsqddzzakhgrribwxkua...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nXenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself.\n\n<image>\n\nRecently Xenia has bought n_r red gems, n_g green gems and n_b blue gem...
[{"type": "stdin_stdout", "input": "5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n0 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n12\n", "output": "14\n1999999996000000002\n24\n24\n122\n"}, {"type": "stdin_stdout", "input": "5\n2 2 3\n7 8\n6 3\n3 0 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n0 2\n5 4\n6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Petya very much likes rectangles and especially squares. Recently he has received 8 points on the plane as a gift from his mother. The points are pairwise distinct. Petya decided to split them into two sets each co...
[{"type": "stdin_stdout", "input": "-841 -205\n590 -205\n-1000 -1000\n-364 1385\n-682 113\n-841 -1000\n-1000 -205\n908 1067\n", "output": "YES\n2 4 5 8 \n1 3 6 7 \n"}, {"type": "stdin_stdout", "input": "-850 -1000\n-475 -325\n1025 800\n-325 575\n-325 -850\n-1000 -475\n-100 -775\n1250 -550\n", "output": "YES\n1 2 5 6 \n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarpus likes studying at school a lot and he is always diligent about his homework. Polycarpus has never had any problems with natural sciences as his great-great-grandfather was the great physicist Seinstein. On the ...
[{"type": "stdin_stdout", "input": "10\n58 22116\n112840 772160\n127432 399484\n182031 255417\n459340 548097\n603984 739189\n606173 663033\n280170 366159\n779239 906234\n874623 155443\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "10\n58 22116\n112840 772160\n122094 399484\n182031 255417\n459340 548097\n60398...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Petya likes to play very much. And most of all he likes to play the following game:\n\nHe is given a sequence of N integer numbers. At each step it is allowed to increase the value of any number by 1 or to decrease...
[{"type": "stdin_stdout", "input": "7\n1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000\n", "output": "6000000000\n"}, {"type": "stdin_stdout", "input": "7\n1000000000 -447358682 1000000000 -1000000000 1000000000 -1000000000 1000000000\n", "output": "5447358682\n"}, {"type": "stdin_stdout...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA permutation is a sequence of integers from 1 to n of length n containing each number exactly once. For example, [1], [4, 3, 5, 1, 2], [3, 2, 1] β€” are permutations, and [1, 1], [4, 3, 1], [2, 3, 4] β€” no.\n\nPermutation a...
[{"type": "stdin_stdout", "input": "5 4\n1 2 5\n2 3\n1 1 3\n1 3 4\n", "output": "14\n7\n9\n"}, {"type": "stdin_stdout", "input": "4 4\n1 2 4\n2 3\n1 1 2\n1 1 4\n", "output": "9\n4\n10\n"}, {"type": "stdin_stdout", "input": "5 4\n1 1 4\n2 5\n1 1 2\n1 3 4\n", "output": "10\n3\n9\n"}, {"type": "stdin_stdout", "input": "5 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe progress is not standing still in Berland. Recently all garbage containers in Bertown, the capital of Berland, were replaced by differentiated recycling bins, each accepting some category of waste. While this will def...
[{"type": "stdin_stdout", "input": "7\n1 2 5\n1 1 3 0 0\n2 2 5\n0 0 0 1 0\n2 1 4\n1 1 2 0 0\n1 2 5\n1 2 3 0 1\n0 0 0\n0 0 0 0 0\n1 0 4\n1 0 0 0 0\n13 37 42\n1 0 0 40 47\n", "output": "YES\nYES\nYES\nYES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "7\n1 2 3\n1 2 3 0 0\n2 2 3\n1 2 3 1 0\n2 2 3\n1 2 3 0 1\n1 2 5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBerland crossword is a puzzle that is solved on a square grid with n rows and n columns. Initially all the cells are white.\n\nTo solve the puzzle one has to color some cells on the border of the grid black in such a way ...
[{"type": "stdin_stdout", "input": "17\n5 0 0 0 0\n2 1 0 1 1\n2 0 0 1 1\n3 1 0 1 0\n10 0 1 0 4\n9 0 4 1 1\n2 1 0 1 0\n5 4 1 1 1\n5 0 5 4 2\n8 2 3 4 5\n2 2 2 2 2\n5 0 4 2 2\n5 5 1 0 1\n8 0 5 2 5\n2 0 1 2 1\n2 1 0 1 2\n2 1 1 1 2\n", "output": "YES\nNO\nYES\nYES\nYES\nYES\nNO\nYES\nNO\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nN...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA number is called 2050-number if it is 2050, 20500, ..., (2050 β‹… 10^k for integer k β‰₯ 0).\n\nGiven a number n, you are asked to represent n as the sum of some (not necessarily distinct) 2050-numbers. Compute the minimum ...
[{"type": "stdin_stdout", "input": "9\n204926935685243951\n999999999999999000\n1000000000000000000\n204999999999997950\n983999999999997950\n205\n1266\n50\n20\n", "output": "-1\n81\n-1\n126\n128\n-1\n-1\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "9\n375241037050488412\n999999999999999000\n1000000000000000000\n204999...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFinally, you have defeated Razor and now, you are the Most Wanted street racer. Sergeant Cross has sent the full police force after you in a deadly pursuit. Fortunately, you have found a hiding spot but you fear that Cros...
[{"type": "stdin_stdout", "input": "3\n1\n0 1\n2\n0 1\n1 2\n2 3\n3 0\n3\n0 1\n0 5\n0 7\n1 2\n1 4\n2 5\n2 6\n3 5\n3 6\n3 7\n4 6\n4 7\n", "output": "0 1\n0 0\n0 1 3 2\n0 0 1 1\n0 1 5 2 7 4 3 6\n-1\n"}, {"type": "stdin_stdout", "input": "3\n1\n0 1\n2\n0 1\n1 2\n2 3\n3 0\n3\n0 1\n0 5\n0 7\n1 2\n1 4\n2 5\n2 6\n3 5\n3 6\n3 7...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n\n\nInput\n\nThe only line of input contains three integers a1, a2, a3 (1 ≀ a1, a2, a3 ≀ 20), separated by spaces.\n\nOutput\n\nOutput a single integer.\n\nExamples\n\nInput\n\n2 3 2\n\n\nOutput\n\n5\n\n\nInput\n\n13 14 1...
[{"type": "stdin_stdout", "input": "20 20 20\n", "output": "218920\n"}, {"type": "stdin_stdout", "input": "1 19 20\n", "output": "132716\n"}, {"type": "stdin_stdout", "input": "10 11 15\n", "output": "10480\n"}, {"type": "stdin_stdout", "input": "10 11 12\n", "output": "2474\n"}, {"type": "stdin_stdout", "input": "12 9...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA non-empty string s is called binary, if it consists only of characters \"0\" and \"1\". Let's number the characters of binary string s from 1 to the string's length and let's denote the i-th character in string s as si....
[{"type": "stdin_stdout", "input": "10339710010772692 73118299589861909\n", "output": "191515094\n"}, {"type": "stdin_stdout", "input": "10339710010772692 63292874515415410\n", "output": "158860080\n"}, {"type": "stdin_stdout", "input": "94889574706765 1001666051582721344\n", "output": "925366296\n"}, {"type": "stdin_s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIlya is a very good-natured lion. He likes maths. Of all mathematical objects, his favourite one is matrices. Now he's faced a complicated matrix problem he needs to solve.\n\nHe's got a square 2n Γ— 2n-sized matrix and 4n...
[{"type": "stdin_stdout", "input": "16\n978618343 473608041 799158564 800910753 461479363 520477481 780529176 678879534 118274424 720632652 1126830014 582019792 225578081 537373229 944668919 758615621\n", "output": "15485512030\n"}, {"type": "stdin_stdout", "input": "16\n978618343 473608041 799158564 800910753 46147936...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA nearby pie shop is having a special sale. For each pie you pay full price for, you may select one pie of a strictly lesser value to get for free. Given the prices of all the pies you wish to acquire, determine the minim...
[{"type": "stdin_stdout", "input": "50\n4 2 6 7 2 6 3 8 8 2 4 8 4 4 1 4 5 2 2 5 6 4 3 3 3 6 8 2 1 3 1 8 2 3 7 4 7 5 4 8 3 5 7 8 6 7 5 8 7 1\n", "output": "130\n"}, {"type": "stdin_stdout", "input": "50\n4 2 6 7 2 6 3 8 8 2 4 8 4 4 1 3 5 2 2 5 6 4 3 3 3 6 8 2 1 3 1 8 2 3 7 4 7 5 4 8 3 5 7 8 6 7 5 8 7 1\n", "output": "12...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSimon has a rectangular table consisting of n rows and m columns. Simon numbered the rows of the table from top to bottom starting from one and the columns β€” from left to right starting from one. We'll represent the cell ...
[{"type": "stdin_stdout", "input": "5 50\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\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\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 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have an array of positive integers a[1], a[2], ..., a[n] and a set of bad prime numbers b1, b2, ..., bm. The prime numbers that do not occur in the set b are considered good. The beauty of array a is the sum <image>, ...
[{"type": "stdin_stdout", "input": "35 1\n147456 288 165888 55296 442368 864 3456 576 41472 663552 13824 10368 71 6912 5184 1296 4608 73728 82944 1728 27648 110592 144 432 154456 41119 648 331776 2304 2592 9216 36864 216 18432 1152\n2\n", "output": "-126\n"}, {"type": "stdin_stdout", "input": "35 1\n147456 288 165888 5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlex enjoys performing magic tricks. He has a trick that requires a deck of n cards. He has m identical decks of n different cards each, which have been mixed together. When Alex wishes to perform the trick, he grabs n ca...
[{"type": "stdin_stdout", "input": "999 504\n", "output": "0.0019990178729991604\n"}, {"type": "stdin_stdout", "input": "614 123\n", "output": "0.0032414781922363548\n"}, {"type": "stdin_stdout", "input": "723 1000\n", "output": "0.002762959403995896\n"}, {"type": "stdin_stdout", "input": "975 504\n", "output": "0.0020...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have decided to watch the best moments of some movie. There are two buttons on your player: \n\n 1. Watch the current minute of the movie. By pressing this button, you watch the current minute of the movie and the pl...
[{"type": "stdin_stdout", "input": "18 111\n1449 2156\n3497 4784\n7775 14575\n23857 24593\n29211 30739\n31932 33447\n35902 36426\n36991 38506\n39679 47202\n48772 60016\n60522 61868\n63340 63982\n68417 78537\n79445 86568\n86918 87940\n90081 90310\n90629 94325\n95728 96263\n", "output": "58967\n"}, {"type": "stdin_stdout...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe first algorithm for detecting a face on the image working in realtime was developed by Paul Viola and Michael Jones in 2001. A part of the algorithm is a procedure that computes Haar features. As part of this task, we...
[{"type": "stdin_stdout", "input": "100 1\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this problem you are to calculate the sum of all integers from 1 to n, but you should take all powers of two with minus in the sum.\n\nFor example, for n = 4 the sum is equal to - 1 - 2 + 3 - 4 = - 4, because 1, 2 and...
[{"type": "stdin_stdout", "input": "60\n536870912\n536870911\n536870913\n1000000000\n999999999\n1\n2\n3\n4\n268435456\n268435455\n268435457\n536870912\n536870911\n536870913\n1000000000\n999999999\n1\n2\n3\n4\n268435456\n268435455\n268435457\n536870912\n536870911\n536870913\n1000000000\n999999999\n1\n2\n3\n4\n268435456\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition β€” when it rains, you go on the street and stay silent for a moment, con...
[{"type": "stdin_stdout", "input": "20 5750 12756 15\n", "output": "YES\n224.57771408997397\n"}, {"type": "stdin_stdout", "input": "20 2910 12756 15\n", "output": "YES\n113.65585182640422\n"}, {"type": "stdin_stdout", "input": "20 2726 12756 15\n", "output": "YES\n106.46936497552505\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSonya was unable to think of a story for this problem, so here comes the formal description.\n\nYou are given the array containing n positive integers. At one turn you can pick any element and increase or decrease it by 1...
[{"type": "stdin_stdout", "input": "75\n392 1038 98 533 515 448 220 310 386 28 539 294 208 828 75 534 875 493 94 205 656 105 546 493 60 188 222 108 788 504 809 621 934 455 307 178 630 298 938 62 850 421 839 134 950 256 934 817 209 559 866 67 990 835 534 672 468 768 757 516 959 893 275 136 692 927 321 554 801 805 885 12...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAnton likes to play chess, and so does his friend Danik.\n\nOnce they have played n games in a row. For each game it's known who was the winner β€” Anton or Danik. None of the games ended with a tie.\n\nNow Anton wonders, w...
[{"type": "stdin_stdout", "input": "379\nAADAAAAAADDAAAAAADAADADADDAAAAADADDAADAAAADDDADAAAAAAADAADAAAAAAADAAAAAAAAADAAAAAAADAAAAAAAAAAADDDADAAAAAAAADAADADAAAADAAAAAAAAAAAAAAAAADAAAADDDAADAAAAAAADAAADAAADAADDDADDAAADAAAAAADDDADDDAAADAAAADAAAAAAAAADAAADAAAAAAAAADAAAAAAAAAAAAAAAAAADADAAAAAAAAAAADAAAAADAAAADAAAAAAAAAAAAAD...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. \n\nTotally in Berland there are n citizens, the ...
[{"type": "stdin_stdout", "input": "70\n644488 5444 150441 714420 602059 335330 510670 196555 546346 740011 509449 850947 692874 524857 750434 952985 223744 533151 896124 609694 367352 679050 560202 172728 569291 778616 332116 286927 843598 372698 244906 498046 900681 709791 420904 724593 864493 813094 791377 39998 296...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBob recently read about bitwise operations used in computers: AND, OR and XOR. He have studied their properties and invented a new game.\n\nInitially, Bob chooses integer m, bit depth of the game, which means that all num...
[{"type": "stdin_stdout", "input": "17 15\na := 010000111111110\nb := 101100110000100\nc := 100101100100111\nd := 010110101110110\ne := 111111000010110\nf := 011001110111110\ng := 110011010100101\nh := 000001010010001\ni := 110000111001011\nj := 000010000010111\nk := 110110111110110\nl := 010000110000100\nm := 00011110...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe marmots have prepared a very easy problem for this year's HC2 – this one. It involves numbers n, k and a sequence of n positive integers a1, a2, ..., an. They also came up with a beautiful and riveting story for the p...
[{"type": "stdin_stdout", "input": "100 60\n1443 3849 6174 8249 696 8715 3461 9159 4468 2496 3044 2301 2437 7559 7235 7956 8959 2036 4399 9595 8664 9743 7688 3730 3705 1203 12615 7088 8563 3860 2794 8014 6951 1160 8616 970 9885 2421 17193 4885 5246 6146 8849 5141 8602 9486 7257 3300 8323 4797 4082 7135 80 9622 4543 656...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConnect the countless points with lines, till we reach the faraway yonder.\n\nThere are n points on a coordinate plane, the i-th of which being (i, yi).\n\nDetermine whether it's possible to draw two parallel and non-over...
[{"type": "stdin_stdout", "input": "20\n-975467170 758268840 -975467171 758268839 -975467172 758268838 -975467173 758268837 -975467174 1015089897 -975467175 758268835 -975467176 758268834 -975467177 967684266 -975467178 758268832 -975467179 1082851919\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "20\n-97546...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given n distinct points on a plane with integral coordinates. For each point you can either draw a vertical line through it, draw a horizontal line through it, or do nothing.\n\nYou consider several coinciding str...
[{"type": "stdin_stdout", "input": "10\n504155727 -77293021\n-155983273 -43296260\n-548837441 -43296260\n87058696 -80040028\n1006418476 -43296260\n-155983273 850521645\n-852404258 -125749655\n518823261 -77293021\n-89661323 -21885159\n-155983273 -406914114\n", "output": "11907\n"}, {"type": "stdin_stdout", "input": "10\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSince you are the best Wraith King, Nizhniy Magazin Β«MirΒ» at the centre of Vinnytsia is offering you a discount.\n\nYou are given an array a of length n and an integer c. \n\nThe value of some array b of length k is the s...
[{"type": "stdin_stdout", "input": "100 20\n9149 9142 7686 5769 1871 4565 5670 8587 663 637 3421 4267 6884 8142 7634 5748 936 316 9300 771 6906 9230 8994 9690 7155 9393 6274 3183 932 7460 1611 6122 4031 6922 5466 1499 5290 4907 4673 5665 9744 1602 9891 8260 6351 4640 9930 9756 5242 3752 82 3287 824 6897 5579 9095 883 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.\n\nL...
[{"type": "stdin_stdout", "input": "1000000000\n", "output": "4444477777\n"}, {"type": "stdin_stdout", "input": "1000100000\n", "output": "4444477777\n"}, {"type": "stdin_stdout", "input": "1211766791\n", "output": "4444477777\n"}, {"type": "stdin_stdout", "input": "1101704081\n", "output": "4444477777\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nUnlike Knights of a Round Table, Knights of a Polygonal Table deprived of nobility and happy to kill each other. But each knight has some power and a knight can kill another knight if and only if his power is greater than...
[{"type": "stdin_stdout", "input": "11 10\n1 2 3 4 5 6 7 8 9 10 11\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n", "output": "1000000000 2000000000 3000000000 4000000000 5000000000 6000000000 7000000000 8000000000 9000000000 10000000000 11000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHarry was contesting to be the most stylist person in his college. He had to collect maximum points from the judges to be able to win. However there was a problem. The judges were sitting in a line and each pair of adjace...
[{"type": "stdin_stdout", "input": "10\n42\n18467 6334 26500 19169 15724 11478 29358 26962 24464 5705 28145 23281 16827 9961 491 2995 11942 4827 5436 32391 14604 3902 153 292 12382 17421 18716 19718 19895 5447 21726 14771 11538 1869 19912 25667 26299 17035 9894 28703 23811 31322\n364\n17673 4664 15141 7711 28253 6868 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPRAVAH, an annual techfest is being organised at SKIT. Naina comes up with an idea for an event Guess The Number. In this event, the computer thinks up a random number and the player is asked to guess that number and ente...
[{"type": "stdin_stdout", "input": "385900\n123000", "output": "loses\n"}, {"type": "stdin_stdout", "input": "854000\n731377", "output": "loses\n"}, {"type": "stdin_stdout", "input": "854000\n186396", "output": "loses\n"}, {"type": "stdin_stdout", "input": "854000\n702572", "output": "loses\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet us see how search engines work. Consider the following simple auto complete feature. When you type some characters in the text bar, the engine automatically gives best matching options among it's database. Your job is...
[{"type": "stdin_stdout", "input": "0 3\nhackdrearth 14\nhackerranl 27\nqhkdae\n\nSAMPLE", "output": "-1\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "1 2\nhackdrearth 10\nhackerranl 27\neadkhr\n\nSAMPLE", "output": "-1\n-1\n"}, {"type": "stdin_stdout", "input": "1 2\nhtraerdkcah 10\nhackerranl 27\neadkhr\n\nSAMPLE",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi is a member of a programming competition site, ButCoder.\n\nEach member of ButCoder is assigned two values: Inner Rating and Displayed Rating.\n\nThe Displayed Rating of a member is equal to their Inner Rating i...
[{"type": "stdin_stdout", "input": "17 3051", "output": "3051\n"}, {"type": "stdin_stdout", "input": "17 3619", "output": "3619\n"}, {"type": "stdin_stdout", "input": "76 6963", "output": "6963\n"}, {"type": "stdin_stdout", "input": "76 3451", "output": "3451\n"}, {"type": "stdin_stdout", "input": "-1 2265", "output": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi, who is A years old, is riding a Ferris wheel.\n\nIt costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it f...
[{"type": "stdin_stdout", "input": "15 100", "output": "100\n"}, {"type": "stdin_stdout", "input": "16 110", "output": "110\n"}, {"type": "stdin_stdout", "input": "17 101", "output": "101\n"}, {"type": "stdin_stdout", "input": "25 111", "output": "111\n"}, {"type": "stdin_stdout", "input": "17 100", "output": "100\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFind the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).\n\nConstraints\n\n* 1 \\leq N \\leq 10^4\n* 1 \\leq A \\leq B \\leq 36\n* All input values a...
[{"type": "stdin_stdout", "input": "101 0 154", "output": "5151\n"}, {"type": "stdin_stdout", "input": "111 1 181", "output": "6216\n"}, {"type": "stdin_stdout", "input": "110 2 100", "output": "5994\n"}, {"type": "stdin_stdout", "input": "100 2 100", "output": "4939\n"}, {"type": "stdin_stdout", "input": "101 1 011", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis contest, AtCoder Beginner Contest, is abbreviated as ABC.\n\nWhen we refer to a specific round of ABC, a three-digit number is appended after ABC. For example, ABC680 is the 680th round of ABC.\n\nWhat is the abbrevi...
[{"type": "stdin_stdout", "input": "1530", "output": "ABC1530\n"}, {"type": "stdin_stdout", "input": "2825", "output": "ABC2825\n"}, {"type": "stdin_stdout", "input": "5621", "output": "ABC5621\n"}, {"type": "stdin_stdout", "input": "-105", "output": "ABC-105\n"}, {"type": "stdin_stdout", "input": "-136", "output": "AB...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSnuke loves constructing integer sequences.\n\nThere are N piles of stones, numbered 1 through N. The pile numbered i consists of a_i stones.\n\nSnuke will construct an integer sequence s of length Ξ£a_i, as follows:\n\n1....
[{"type": "stdin_stdout", "input": "10\n1 3 2 6 2 4 4 5 8 1", "output": "10\n14\n0\n10\n0\n0\n0\n0\n2\n0\n"}, {"type": "stdin_stdout", "input": "10\n1 3 1 6 3 4 6 6 4 1", "output": "10\n14\n0\n11\n0\n0\n0\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "10\n1 4 0 1 1 4 4 0 22 1", "output": "8\n12\n0\n0\n0\n0\n0\n0\n18\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead the coordinates of four different points on the plane, $ A (x_A, y_A) $, $ B (x_B, y_B) $, $ C (x_C, y_C) $, $ D (x_D, y_D) $, and straight line $ Create a program that outputs YES if AB $ and $ CD $ are orthogonal, ...
[{"type": "stdin_stdout", "input": "3.338679167476614 4.153021285774258 3.5962681645685493 3.0562783924178016 0.7824583380395241 0.6535611152381731 1.4307644766957708 0.2352661769827814\n2.6749426974072605 2.336361124342693 3.280415305064114 1.6735605571901062 -0.04476814775527138 2.2725919391555047 3.1294550602222495 ...
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\nYuki made a sugoroku so that everyone can play at the children's association event. In this sugoroku, squares are lined up in a ring, and each square has an integer of 1 or more written on it.\n\nThe player chooses a squa...
[{"type": "stdin_stdout", "input": "8\n2 -1 3 -1 1 4 -1 0", "output": "5\n"}, {"type": "stdin_stdout", "input": "8\n3 -1 3 -1 1 4 -1 0", "output": "6\n"}, {"type": "stdin_stdout", "input": "8\n3 -1 3 -1 2 4 -1 0", "output": "6\n"}, {"type": "stdin_stdout", "input": "8\n3 -1 3 -1 0 4 -1 0", "output": "7\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA Bingo game is played by one gamemaster and several players. At the beginning of a game, each player is given a card with M Γ— M numbers in a matrix (See Figure 10).\n\n<image>\n\nAs the game proceeds, the gamemaster anno...
[{"type": "stdin_stdout", "input": "4 3\n10 25 11 20 6 2 1 15 23\n5 21 1 12 23 17 7 26 2\n8 18 4 22 13 27 16 5 11\n19 9 24 2 11 5 14 28 16\n4 3\n12 13 20 24 28 32 15 16 17\n12 13 21 25 29 33 16 17 18\n12 13 22 26 30 34 17 18 15\n12 13 23 27 31 35 18 15 16\n4 3\n11 12 13 14 15 16 17 18 19\n21 22 23 24 25 26 27 28 29\n31...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven n integers a1, a2,…, an and n integers p1, p2,…, pn, integer m. The operation of selecting the kth integer ak with a probability of pk [%] is performed for each k (1 ≀ k ≀ n), and 0 or more and n or less integers ar...
[{"type": "stdin_stdout", "input": "4 100\n3 6 10 13\n160 28 40 19", "output": "53.147520000\n"}, {"type": "stdin_stdout", "input": "2 115\n2 2 -1 24\n91 60 40 23", "output": "13.246800000\n"}, {"type": "stdin_stdout", "input": "4 100\n2 5 10 13\n80 16 40 19", "output": "43.435600000\n"}, {"type": "stdin_stdout", "inpu...
code_stdio