messages listlengths 1 1 | ground_truth stringlengths 88 726k | dataset stringclasses 2
values |
|---|---|---|
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPandeyG, a brilliant tennis player, decided to start a tournament in his colony. Now, since PandeyG is overly optimistic and ambitious - he tries to lure in as many people as he can from his colony for them to participate... | [{"type": "stdin_stdout", "input": "2\n17\n11\n\nARMPLE", "output": "16\n10\n"}, {"type": "stdin_stdout", "input": "2\n16\n13\n\nTANPLF", "output": "15\n12\n"}, {"type": "stdin_stdout", "input": "2\n16\n12\n\nTANLPF", "output": "15\n11\n"}, {"type": "stdin_stdout", "input": "2\n146\n1\n\nSAMPLE", "output": "145\n0\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCompute A \\times B, truncate its fractional part, and print the result as an integer.\n\nConstraints\n\n* 0 \\leq A \\leq 10^{15}\n* 0 \\leq B < 10\n* A is an integer.\n* B is a number with two digits after the decimal p... | [{"type": "stdin_stdout", "input": "1010000000000101 9.99", "output": "10089900000001008\n"}, {"type": "stdin_stdout", "input": "1010000000100101 9.99", "output": "10089900001000008\n"}, {"type": "stdin_stdout", "input": "1010000100000101 9.99", "output": "10089900999001008\n"}, {"type": "stdin_stdout", "input": "10100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSilver Fox is fighting with N monsters.\n\nThe monsters are standing in a row, and we can assume them to be standing on a number line. The i-th monster, standing at the coordinate X_i, has the health of H_i.\n\nSilver Fox... | [{"type": "stdin_stdout", "input": "3 -1 2\n156828556 1001000000\n100000000 1000101000\n114627287 1001010011", "output": "1501055506\n"}, {"type": "stdin_stdout", "input": "3 -1 2\n156828556 1001000000\n100000000 1000101000\n114627287 0001010011", "output": "1001055506\n"}, {"type": "stdin_stdout", "input": "3 -1 1\n86... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor an integer N, we will choose a permutation \\\\{P_1, P_2, ..., P_N\\\\} of \\\\{1, 2, ..., N\\\\}.\n\nThen, for each i=1,2,...,N, let M_i be the remainder when i is divided by P_i.\n\nFind the maximum possible value o... | [{"type": "stdin_stdout", "input": "-202", "output": "20503\n"}, {"type": "stdin_stdout", "input": "-158", "output": "12561\n"}, {"type": "stdin_stdout", "input": "-173", "output": "15051\n"}, {"type": "stdin_stdout", "input": "-174", "output": "15225\n"}, {"type": "stdin_stdout", "input": "-140", "output": "9870\n"}, ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi and Aoki will play a game using a grid with H rows and W columns of square cells. There are N obstacles on this grid; the i-th obstacle is at (X_i,Y_i). Here, we represent the cell at the i-th row and j-th colum... | [{"type": "stdin_stdout", "input": "10 10 14\n4 3\n2 2\n9 4\n9 10\n7 7\n10 2\n10 10\n5 4\n3 4\n2 8\n6 4\n5 4\n5 8\n9 0", "output": "8\n"}, {"type": "stdin_stdout", "input": "10 10 14\n4 3\n2 1\n7 3\n9 10\n7 7\n8 1\n10 10\n5 4\n2 4\n2 8\n6 4\n4 4\n9 6\n9 -1", "output": "1\n"}, {"type": "stdin_stdout", "input": "10 10 14... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke is buying a bicycle. The bicycle of his choice does not come with a bell, so he has to buy one separately.\n\nHe has very high awareness of safety, and decides to buy two bells, one for each hand.\n\nThe store sells... | [{"type": "stdin_stdout", "input": "10000 10100 10000", "output": "20000\n"}, {"type": "stdin_stdout", "input": "10000 00100 10000", "output": "10100\n"}, {"type": "stdin_stdout", "input": "11000 10100 10000", "output": "20100\n"}, {"type": "stdin_stdout", "input": "11000 10110 10000", "output": "20110\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are two rectangles. The lengths of the vertical sides of the first rectangle are A, and the lengths of the horizontal sides of the first rectangle are B. The lengths of the vertical sides of the second rectangle are... | [{"type": "stdin_stdout", "input": "100 600 200 300", "output": "60000"}, {"type": "stdin_stdout", "input": "100 600 200 6", "output": "60000\n"}, {"type": "stdin_stdout", "input": "100 480 244 6", "output": "48000\n"}, {"type": "stdin_stdout", "input": "100 169 362 6", "output": "16900\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N rabbits, numbered 1 through N.\n\nThe i-th (1≤i≤N) rabbit likes rabbit a_i. Note that no rabbit can like itself, that is, a_i≠i.\n\nFor a pair of rabbits i and j (i<j), we call the pair (i,j) a friendly pair i... | [{"type": "stdin_stdout", "input": "5\n5 5 5 -1 2", "output": "1\n"}, {"type": "stdin_stdout", "input": "5\n5 5 5 -2 2", "output": "1\n"}, {"type": "stdin_stdout", "input": "5\n3 5 5 -1 1", "output": "0\n"}, {"type": "stdin_stdout", "input": "5\n5 5 5 -1 1", "output": "1\n"}, {"type": "stdin_stdout", "input": "5\n3 3 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRead a set of coordinates of three different points P1 (x1, y1), P2 (x2, y2), Q (xq, yq) on the plane, and line symmetry with point Q with the straight line passing through point P1 point P2 as the axis of symmetry. Creat... | [{"type": "stdin_stdout", "input": "1.0,0.0,-1.0,0.0,1.0,1.0\n1.0,0.0,0.0,-1.0,3.0,0.0\n0.0,1.0,0.0,-1.0,1.0,1.0", "output": "1.000000 -1.000000\n1.000000 2.000000\n-1.000000 1.000000"}, {"type": "stdin_stdout", "input": "1.0,0.0,-1.0,0.0,1.0,1.0\n1.0,0.0,0.0,-1.0,0.0,0.3\n0.0,1.0,0.0,-1.0,1.0,1.0", "output": "1.00000 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHousing maker Yamada House has launched a new featured product, a land for sale in a green home town with a rich environment such as schools and hospitals. This lot is divided into multiple lots and you can buy as many as... | [{"type": "stdin_stdout", "input": "5 4 6\n1 6\n2 4\n3 3\n4 4\n5 1\n6 2\n0 0 1 0 0\n0 0 0 2 0\n0 0 0 3 0\n0 4 5 0 6\n3 3 1\n1 9\n0 0 1\n0 0 0\n0 0 0\n4 4 4\n1 6\n2 2\n3 4\n4 4\n0 1 1 0\n0 0 0 2\n0 0 3 0\n0 4 0 0\n0 0 0", "output": "1 1 1 2 2\n1 1 1 2 2\n4 4 3 3 3\n4 4 5 6 6\n1 1 1\n1 1 1\n1 1 1\nNA\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe arrange the numbers between 1 and N (1 <= N <= 10000) in increasing order and decreasing order like this:\n\n\n1 2 3 4 5 6 7 8 9 . . . N\nN . . . 9 8 7 6 5 4 3 2 1\n\n\nTwo numbers faced each other form a pair. Your ta... | [{"type": "stdin_stdout", "input": "1\n10\n13\n373", "output": "0\n0\n3\n20\n"}, {"type": "stdin_stdout", "input": "1\n175\n19\n12", "output": "0\n14\n4\n2\n"}, {"type": "stdin_stdout", "input": "1\n175\n19\n16", "output": "0\n14\n4\n0\n"}, {"type": "stdin_stdout", "input": "1\n12\n7\n115", "output": "0\n2\n2\n12\n"}, ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTaro attempts to tell digits to Hanako by putting straight bars on the floor. Taro wants to express each digit by making one of the forms shown in Figure 1.\n\nSince Taro may not have bars of desired lengths, Taro cannot ... | [{"type": "stdin_stdout", "input": "9\n60 140 200 300\n300 105 330 135\n330 135 250 215\n240 205 250 215\n298 167 285 154\n30 40 30 90\n30 90 150 90\n150 90 150 20\n30 40 150 78\n8\n320 20 300 98\n320 20 380 50\n380 50 438 330\n10 50 40 20\n10 50 110 150\n110 150 180 80\n40 20 37 17\n37 17 27 27\n20\n72 222 132 182\n20... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven n numbers a0, a1, ..., an-1 and q.\nI want you to perform appropriate processing for q queries.\nThe query has the following three types of operations.\n\n\n* Shift the value\nGiven a pair of l and r. (l <r) Circula... | [{"type": "stdin_stdout", "input": "19 14\n289383\n930886\n692777\n636915\n747793\n238335\n885386\n435847\n516649\n641421\n2 7 368690\n1 3 6\n0 2 6\n1 1 8\n0 0 9\n2 2 665123\n1 5 9\n0 2 8\n2 7 961393\n1 1 2", "output": "238335\n238335\n289383\n289383\n289383\n289383\n289383\n289383\n289383\n289383\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn 21XX, humanity finally began a plan to relocate to Mars. Selected as the first group of immigrants to Mars, you are assigned to the Administrative Center of Mars to deal with various problems that occur on Mars. The bi... | [{"type": "stdin_stdout", "input": "7 5 1 3 4\n1 2 10\n3 6 0\n2 4 5\n1 3 2\n1 4 12\n0 0 0 0 0", "output": "14\n"}, {"type": "stdin_stdout", "input": "6 5 1 2 4\n1 2 5\n4 3 5\n2 3 -1\n1 3 8\n1 4 36\n0 0 0 0 0", "output": "41\n"}, {"type": "stdin_stdout", "input": "6 5 1 3 4\n1 2 5\n3 3 5\n2 3 5\n1 3 8\n1 4 11\n0 0 0 0 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA brave princess in a poor country's tomboy is married to another country for a political marriage. However, a villain who is trying to kill the princess is releasing a thug on the way to his wife.\n\nYou have already dec... | [{"type": "stdin_stdout", "input": "3 2 10\n1 2 13 6\n2 3 10 3\n3 2 10\n1 2 3 16\n2 3 9 7\n3 3 10\n1 3 17 6\n1 2 2 4\n2 3 9 19\n4 4 5\n1 3 13 5\n1 4 7 25\n2 3 8 2\n2 4 9 3\n0 0 0", "output": "6\n7\n4\n10\n"}, {"type": "stdin_stdout", "input": "3 2 10\n1 2 8 5\n2 3 10 0\n3 2 10\n1 2 3 8\n2 3 7 7\n3 3 10\n1 3 17 6\n1 2 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTaro, a junior high school student, is working on his homework. Today's homework is to read Chinese classic texts.\n\nAs you know, Japanese language shares the (mostly) same Chinese characters but the order of words is a ... | [{"type": "stdin_stdout", "input": "6\nonetwo2\n-\nonetwo1\nonetwo2\n-\nonetwo1\n7\nv\ntopbottom2\nonetwo2\n-\nonetwo1\ntopbottom1\n-\n6\nbaz2\nfoo2\nbaz1v\nbar1\nfoo1\nbar1\n0", "output": "2\n3\n1\n5\n6\n4\n4\n5\n3\n6\n2\n1\n7\n4\n3\n1\n5\n2\n6\n"}, {"type": "stdin_stdout", "input": "6\nonetwo2\n-\nonetwo1\nonetwo1\n-... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nH: Mercy\n\nSanta Claus found a group doing programming even though it was Christmas.\n\nSanta Claus felt sorry for them, so he decided to give them a cake.\n\nThere are $ N $ types of cream, and the taste is $ A_1, A_2, ... | [{"type": "stdin_stdout", "input": "2 1\n-14 0 2\n-3 -3", "output": "-28\n"}, {"type": "stdin_stdout", "input": "2 1\n-2 -1 2\n-3 -3", "output": "-6\n"}, {"type": "stdin_stdout", "input": "2 1\n-2 -2 2\n-3 -3", "output": "-8\n"}, {"type": "stdin_stdout", "input": "2 1\n-1 -8 2\n-1 3", "output": "-18\n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nSatake doesn't like being bent.\nFor example, I don't like pencils, chopsticks, and bent-shaped houses, and I don't like taking actions such as turning right or left.\n\nBy the way, Satake who lives on the XY p... | [{"type": "stdin_stdout", "input": "3\n2 -1\n1 3\n-2 -1", "output": "439.6951535312\n"}, {"type": "stdin_stdout", "input": "3\n1 0\n0 1\n-2 -2", "output": "405.0000000000\n"}, {"type": "stdin_stdout", "input": "3\n1 1\n0 1\n-2 -1", "output": "386.5650511771\n"}, {"type": "stdin_stdout", "input": "3\n1 0\n0 1\n-2 0", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor given two circles $c1$ and $c2$, print\n\n\n4\n\n\nif they do not cross (there are 4 common tangent lines),\n\n\n3\n\n\nif they are circumscribed (there are 3 common tangent lines),\n\n\n2\n\n\nif they intersect (ther... | [{"type": "stdin_stdout", "input": "-26 -2 -2\n15 2 -1", "output": "4\n"}, {"type": "stdin_stdout", "input": "-26 -2 -2\n15 2 -2", "output": "4\n"}, {"type": "stdin_stdout", "input": "-26 -2 -1\n15 2 -2", "output": "4\n"}, {"type": "stdin_stdout", "input": "-26 -2 -1\n21 2 -2", "output": "4\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor given two sequneces $A = \\\\{a_0, a_1, ..., a_{n-1}\\\\}$ and $B = \\\\{b_0, b_1, ..., b_{m-1}\\\\}$, determine whether all elements of $B$ are included in $A$. Note that, elements of $A$ and $B$ are sorted by ascend... | [{"type": "stdin_stdout", "input": "4\n2 0 3 10\n4\n-2 0 16", "output": "0\n"}, {"type": "stdin_stdout", "input": "4\n2 0 3 13\n6\n0 2 11", "output": "0\n"}, {"type": "stdin_stdout", "input": "4\n2 2 3 8\n4\n-1 -1 8", "output": "0\n"}, {"type": "stdin_stdout", "input": "4\n2 0 3 10\n4\n-2 0 8", "output": "0\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWho's interested in football?\nRayne Wooney has been one of the top players for his football club for the last few years. But unfortunately, he got injured during a game a few months back and has been out of play ever sin... | [{"type": "stdin_stdout", "input": "3\n4\n3 7 1 4 2 4\n5\n7 4 3 3 1\n5\n4 3 2 2 0", "output": "4\nUNFIT\nUNFIT\n"}, {"type": "stdin_stdout", "input": "3\n6\n1 1 -1 4 2 4\n5\n4 4 3 2 1\n5\n4 3 1 2 3", "output": "5\nUNFIT\n2\n"}, {"type": "stdin_stdout", "input": "3\n6\n1 1 -1 4 2 1\n5\n4 4 3 2 1\n5\n4 0 1 2 3", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Paul wants to learn how to play piano. He already has a melody he wants to start with. For simplicity he represented this melody as a sequence a_1, a_2, …, a_n of key numbers: the more a number is, the closer it is... | [{"type": "stdin_stdout", "input": "100\n5 5 2 4 5 4 4 4 4 2 5 3 4 2 4 4 1 1 5 3 2 2 1 3 3 2 5 3 4 5 1 3 5 4 4 4 3 1 4 4 3 4 5 2 5 4 2 1 2 2 3 5 5 5 1 4 5 3 1 4 2 2 5 1 5 3 4 1 5 1 2 2 3 5 1 3 2 4 2 4 2 2 4 1 3 5 2 2 2 3 3 4 3 2 2 5 5 4 2 5\n", "output": "1 2 1 2 3 1 2 1 2 1 2 1 2 1 2 3 2 1 3 2 1 2 1 3 2 1 2 1 2 3 1 2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice has a birthday today, so she invited home her best friend Bob. Now Bob needs to find a way to commute to the Alice's home.\n\nIn the city in which Alice and Bob live, the first metro line is being built. This metro ... | [{"type": "stdin_stdout", "input": "10 3\n0 1 1 0 1 0 0 2 -1 0\n1 4 1 2 -1 0 1 1 -1 1\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "10 10\n1 0 0 0 0 0 0 0 0 1\n0 0 0 0 0 0 0 0 0 0\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "10 3\n0 1 1 0 1 0 0 2 -1 0\n1 2 1 1 -1 0 1 1 0 1\n", "output": "NO\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a house with n flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of n integer numbers a_1, a_2, ..., a_n, where a_i = 1 if in the i-t... | [{"type": "stdin_stdout", "input": "100\n0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 -1 1 0\n", "output": "24\n"}, {"type": "stdin_stdout", "input": "100\n0 0 1 0 1 0 1 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlyona has recently bought a miniature fridge that can be represented as a matrix with h rows and 2 columns. Initially there is only one shelf at the bottom of the fridge, but Alyona can install arbitrary number of shelve... | [{"type": "stdin_stdout", "input": "100 1986\n29 77 55 79 29 99 68 31 78 53 80 91 181 52 131 95 58 84 23 65 86 89 84 98 83 40 50 88 53 74 35 53 52 61 69 90 81 53 98 100 12 79 38 93 80 84 46 47 40 56 65 72 95 67 95 80 45 89 58 96 99 96 78 16 43 96 50 68 62 37 59 65 77 64 94 92 69 97 48 76 53 92 100 94 94 70 23 000 93 78... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n\n\nInput\n\nThe input consists of a single string of uppercase letters A-Z. The length of the string is between 1 and 10 characters, inclusive.\n\nOutput\n\nOutput \"YES\" or \"NO\".\n\nExamples\n\nInput\n\n\nNEAT\n\n\nO... | [{"type": "stdin_stdout", "input": "ALLALINITY\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "YTINILALLA\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "ALKALINITY\n", "output": "YES"}, {"type": "stdin_stdout", "input": "TNSCRAMBLE\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "TNSARCM... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDora the explorer has decided to use her money after several years of juicy royalties to go shopping. What better place to shop than Nlogonia?\n\nThere are n stores numbered from 1 to n in Nlogonia. The i-th of these stor... | [{"type": "stdin_stdout", "input": "10 100\n4 51 22 73 78\n1 52\n5 49 74 100 14 80\n1 6\n2 98 128\n5 149 13 47 24 77\n6 47 57 11 24 117 94\n9 89 11 2 67 85 70 44 10 6\n7 12 9 92 30 10 39 70\n8 99 34 89 87 63 3 96 25\n", "output": "impossible\n"}, {"type": "stdin_stdout", "input": "10 100\n4 51 22 73 78\n1 52\n5 49 74 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is constraints.\n\nA session has begun at Beland State University. Many students are taking exams.\n\nPolygraph Poligrafovich is going to examine a group of n students. S... | [{"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\nThe only difference between easy and hard versions is that you should complete all the projects in easy version but this is not necessary in hard version.\n\nPolycarp is a very famous freelancer. His current rating is r u... | [{"type": "stdin_stdout", "input": "50 15000\n142 -300\n20 -298\n560 -300\n1815 -292\n282 -297\n92 -293\n34 -284\n555 -299\n408 -293\n504 -284\n278 -284\n139 -582\n64 -298\n311 -293\n130 -293\n89 -298\n129 -294\n385 -295\n136 -288\n41 -293\n112 -290\n416 -295\n178 -294\n154 -300\n110 -300\n346 -299\n209 -294\n1394 -295... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlex decided to go on a touristic trip over the country.\n\nFor simplicity let's assume that the country has n cities and m bidirectional roads connecting them. Alex lives in city s and initially located in it. To compare... | [{"type": "stdin_stdout", "input": "30 30\n81 86 81 91 90 100 98 89 96 97 88 99 68 23 82 107 94 80 99 67 70 90 81 74 91 100 92 89 74 98\n16 26\n20 3\n23 16\n17 27\n30 22\n18 23\n14 30\n25 4\n3 8\n18 9\n29 26\n27 21\n26 6\n10 7\n28 5\n1 30\n28 30\n12 15\n17 25\n26 15\n30 2\n5 15\n14 20\n10 4\n24 16\n8 7\n11 30\n19 8\n21... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya will fancy any number as long as it is an integer power of two. Petya, on the other hand, is very conservative and only likes a single integer p (which may be positive, negative, or zero). To combine their tastes, t... | [{"type": "stdin_stdout", "input": "1000000000 -1000\n", "output": "14\n"}, {"type": "stdin_stdout", "input": "1000100000 -1000\n", "output": "16\n"}, {"type": "stdin_stdout", "input": "1000000000 1000\n", "output": "16\n"}, {"type": "stdin_stdout", "input": "1001000001 1000\n", "output": "18\n"}, {"type": "stdin_stdou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCreatnx has n mirrors, numbered from 1 to n. Every day, Creatnx asks exactly one mirror \"Am I beautiful?\". The i-th mirror will tell Creatnx that he is beautiful with probability (p_i)/(100) for all 1 ≤ i ≤ n.\n\nCreatn... | [{"type": "stdin_stdout", "input": "100\n60 79 48 35 18 24 87 1 44 65 60 78 11 43 71 79 90 6 94 49 22 91 58 93 55 21 22 31 7 15 17 65 76 9 100 89 50 96 14 38 27 87 29 93 54 12 99 35 27 51 36 44 6 26 91 1 53 8 49 63 18 4 31 55 95 15 77 1 16 98 75 26 26 43 2 11 18 70 3 65 11 74 64 69 26 54 9 51 25 82 98 12 90 75 19 23 78... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt's a walking tour day in SIS.Winter, so t groups of students are visiting Torzhok. Streets of Torzhok are so narrow that students have to go in a row one after another.\n\nInitially, some students are angry. Let's descr... | [{"type": "stdin_stdout", "input": "16\n4\nPPPP\n4\nAPPP\n4\nPAPP\n4\nAAPP\n4\nPPAP\n4\nAPAP\n4\nPAAP\n4\nAAAP\n4\nPPPA\n4\nAPPA\n4\nPAPA\n4\nAAPA\n4\nPPAA\n4\nAPAA\n4\nPAAA\n4\nAAAA\n", "output": "0\n3\n2\n2\n1\n1\n1\n1\n0\n2\n1\n1\n0\n1\n0\n0\n"}, {"type": "stdin_stdout", "input": "1\n100\nPAPPPAPAAPAAPAAPPAAAPPAPPAP... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe USA Construction Operation (USACO) recently ordered Farmer John to arrange a row of n haybale piles on the farm. The i-th pile contains a_i haybales. \n\nHowever, Farmer John has just left for vacation, leaving Bessie... | [{"type": "stdin_stdout", "input": "3\n4 4\n0 0 2 2\n2 1\n100 2\n1 14\n0\n", "output": "2\n101\n0\n"}, {"type": "stdin_stdout", "input": "3\n4 5\n0 0 0 2\n2 2\n110 2\n1 14\n0\n", "output": "1\n112\n0\n"}, {"type": "stdin_stdout", "input": "3\n4 4\n0 0 2 2\n2 1\n100 4\n1 23\n1\n", "output": "2\n101\n1\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDreamoon is a big fan of the Codeforces contests.\n\nOne day, he claimed that he will collect all the places from 1 to 54 after two more rated contests. It's amazing!\n\nBased on this, you come up with the following probl... | [{"type": "stdin_stdout", "input": "5\n6 2\n3 1 1 5 7 10\n1 100\n100\n11 1\n1 1 1 1 1 1 1 1 1 1 1\n1 1\n1\n4 57\n80 60 40 20\n", "output": "5\n101\n2\n2\n60\n"}, {"type": "stdin_stdout", "input": "5\n6 2\n3 1 1 5 7 10\n1 100\n100\n11 1\n1 1 1 1 1 1 1 1 1 1 1\n1 1\n1\n4 57\n61 60 40 20\n", "output": "5\n101\n2\n2\n61\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOrac is studying number theory, and he is interested in the properties of divisors.\n\nFor two positive integers a and b, a is a divisor of b if and only if there exists an integer c, such that a⋅ c=b.\n\nFor n ≥ 2, we wi... | [{"type": "stdin_stdout", "input": "5\n497347 19283\n2568 1000000000\n499979 123987\n93 19\n13 5\n", "output": "536584\n2000002568\n1247930\n132\n34\n"}, {"type": "stdin_stdout", "input": "5\n497347 19283\n2568 1000000000\n499979 202537\n93 19\n13 5\n", "output": "536584\n2000002568\n1405030\n132\n34\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAshish has an array a of size n.\n\nA subsequence of a is defined as a sequence that can be obtained from a by deleting some elements (possibly none), without changing the order of the remaining elements.\n\nConsider a su... | [{"type": "stdin_stdout", "input": "10 4\n91239 51189 50977 96098 56330 55725 6448 7351 60071 93359\n", "output": "50977\n"}, {"type": "stdin_stdout", "input": "10 4\n91239 51189 50977 96098 56330 55725 6448 7351 82063 93359\n", "output": "50977\n"}, {"type": "stdin_stdout", "input": "10 4\n30551 51189 50977 96098 5633... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a consisting of n non-negative integers. You have to choose a non-negative integer x and form a new array b of size n according to the following rule: for all i from 1 to n, b_i = a_i ⊕ x (⊕ denotes... | [{"type": "stdin_stdout", "input": "100\n74 88 64 8 9 27 63 64 79 97 92 38 26 1 8 4 2 64 53 62 24 82 76 40 48 58 40 59 3 56 35 37 0 30 93 71 14 97 49 37 96 59 56 55 70 88 77 99 51 55 71 25 10 31 26 50 61 18 35 55 49 33 86 25 65 74 137 99 5 27 2 9 67 29 76 68 66 22 68 59 63 16 62 25 35 57 63 35 41 68 86 22 91 67 61 3 92... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMeka-Naruto plays a computer game. His character has the following ability: given an enemy hero, deal a instant damage to him, and then heal that enemy b health points at the end of every second, for exactly c seconds, st... | [{"type": "stdin_stdout", "input": "6\n879274 712902 672766 383030\n997653 839911 351405 69197\n31160 917403 281506 245835\n234837 489356 452352 448472\n382561 916024 805514 657373\n287796 831046 710305 568719\n", "output": "879274\n997653\n31160\n234837\n382561\n287796\n"}, {"type": "stdin_stdout", "input": "6\n879274... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.\... | [{"type": "stdin_stdout", "input": "44447774444474477747774774477777474774744744477444447777477477744747477774744444744777777777747777477447744774744444747477744744\n77777474477477747774777777474474477444474777477747747777477747747744474474747774747747444777474444744744444477477777747744747477\n", "output": "37\n"}, {"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA pair of positive integers (a,b) is called special if ⌊ a/b ⌋ = a mod b. Here, ⌊ a/b ⌋ is the result of the integer division between a and b, while a mod b is its remainder.\n\nYou are given two integers x and y. Find th... | [{"type": "stdin_stdout", "input": "9\n3 4\n2 100\n4 3\n50 3\n12 4\n69 420\n12345 6789\n123456 789\n12345678 9\n", "output": "\n1\n0\n2\n3\n5\n141\n53384\n160909\n36\n"}, {"type": "stdin_stdout", "input": "9\n3 6\n1 101\n11 6\n50 3\n12 4\n69 420\n12345 6789\n123456 789\n29238676 9\n", "output": "1\n0\n7\n3\n5\n141\n533... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a rooted tree. Each vertex contains a_i tons of gold, which costs c_i per one ton. Initially, the tree consists only a root numbered 0 with a_0 tons of gold and price c_0 per ton.\n\nThere are q queries. Eac... | [{"type": "stdin_stdout", "input": "5 5 2\n2 0 2\n1 0 3 4\n2 2 4\n1 0 1 3\n2 4 2\n", "output": "\n2 4\n4 10\n1 3\n"}, {"type": "stdin_stdout", "input": "5 5 2\n2 0 2\n1 0 1 4\n2 2 4\n1 0 1 3\n2 4 2\n", "output": "2 4\n4 10\n1 3\n"}, {"type": "stdin_stdout", "input": "5 10 2\n2 0 2\n1 0 3 4\n2 2 4\n1 0 1 3\n2 4 2\n", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTo learn as soon as possible the latest news about their favourite fundamentally new operating system, BolgenOS community from Nizhni Tagil decided to develop a scheme. According to this scheme a community member, who is ... | [{"type": "stdin_stdout", "input": "100\n13 71 16 92 25 53 97 63 70 83 51 16 51 84 5 10 54 89 18 95 48 29 82 27 84 68 7 4 65 99 95 37 26 24 24 39 3 44 74 7 75 32 27 24 73 48 72 15 46 75 91 94 19 44 77 23 94 88 51 84 72 95 75 55 80 47 58 13 87 88 25 2 89 81 72 36 7 42 16 59 32 75 58 61 44 96 36 48 88 49 53 91 13 1 37 87... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou've got a positive integer sequence a1, a2, ..., an. All numbers in the sequence are distinct. Let's fix the set of variables b1, b2, ..., bm. Initially each variable bi (1 ≤ i ≤ m) contains the value of zero. Consider... | [{"type": "stdin_stdout", "input": "23\n26988535 53977070 107954140 161931210 323862420 215908280 431816560 647724840 269885350 242896815 755678980 485793630 863633120 404828025 539770700 134942675 593747770 377839490 917610190 809656050 620736305 971587260 458805095\n", "output": "7"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYaroslav likes algorithms. We'll describe one of his favorite algorithms.\n\n 1. The algorithm receives a string as the input. We denote this input string as a. \n 2. The algorithm consists of some number of command. Сo... | [{"type": "stdin_stdout", "input": "10\n448\n727\n1418\n278\n870\n913\n2072\n300\n36\n1312\n", "output": "0??<>1\n1??<>2\n2??<>3\n3??<>4\n4??<>5\n5??<>6\n6??<>7\n7??<>8\n8??<>9\n9??>>??0\n??<>1\n?0>>0?\n?1>>1?\n?2>>2?\n?3>>3?\n?4>>4?\n?5>>5?\n?6>>6?\n?7>>7?\n?8>>8?\n?9>>9?\n?>>??\n>>?\n"}, {"type": "stdin_stdout", "inp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOnce Bob got to a sale of old TV sets. There were n TV sets at that sale. TV set with index i costs ai bellars. Some TV sets have a negative price — their owners are ready to pay Bob if he buys their useless apparatus. Bo... | [{"type": "stdin_stdout", "input": "99 17\n-993 -1745 -959 -989 -991 -995 -976 -997 -990 -1000 -996 -994 -999 -354 -1000 -983 -979 -1000 -989 -968 -994 -992 -962 -1593 -999 -983 -991 -979 -995 -993 -973 -999 -995 -995 -999 -993 -995 -992 -947 -1000 -999 -998 -982 -988 -757 -993 -426 -988 -980 -990 -979 -976 -995 -999 -... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n employees working in company \"X\" (let's number them from 1 to n for convenience). Initially the employees didn't have any relationships among each other. On each of m next days one of the following events to... | [{"type": "stdin_stdout", "input": "2 10\n2 2\n1 2 1\n3 1 1\n3 2 1\n3 1 1\n2 2\n3 1 2\n3 1 1\n3 2 1\n3 1 2\n", "output": "NO\nYES\nNO\nYES\nNO\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "2 10\n2 2\n1 2 1\n3 1 1\n3 1 1\n3 1 1\n2 2\n3 1 2\n3 1 1\n3 2 1\n3 1 2\n", "output": "NO\nNO\nNO\nYES\nNO\nYES\nYES\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEvery year a race takes place on the motorway between cities A and B. This year Vanya decided to take part in the race and drive his own car that has been around and bears its own noble name — The Huff-puffer.\n\nSo, Vasy... | [{"type": "stdin_stdout", "input": "76\n342 684 1027 1369 1711 2054 2396 2738 3081 3423 3765 4108 4450 4792 5135 5477 5819 6162 6504 6846 7189 7531 7873 8216 8558 8900 9243 9585 9927 10270 10612 10954 11297 11639 11981 12324 12666 13009 13351 13693 14036 14378 14720 15063 15405 15747 16090 16432 16774 17117 17459 17801... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp loves geometric progressions very much. Since he was only three years old, he loves only the progressions of length three. He also has a favorite integer k and a sequence a, consisting of n integers.\n\nHe wants ... | [{"type": "stdin_stdout", "input": "18 10\n10000000 100000000 1000000000 -10000000 -100000000 -1000000000 -10000000 -100000000 -1000000000 -10000000 -100000000 -1000000000 10000000 100000000 1000000000 10000000 100000000 1000000000\n", "output": "20\n"}, {"type": "stdin_stdout", "input": "18 10\n10000000 100000000 1000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe protection of a popular program developed by one of IT City companies is organized the following way. After installation it outputs a random five digit number which should be sent in SMS to a particular phone number. ... | [{"type": "stdin_stdout", "input": "12345\n", "output": "71232\n"}, {"type": "stdin_stdout", "input": "91537\n", "output": "27651\n"}, {"type": "stdin_stdout", "input": "13542\n", "output": "84443\n"}, {"type": "stdin_stdout", "input": "32036\n", "output": "82432\n"}, {"type": "stdin_stdout", "input": "71232\n", "outpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMaria participates in a bicycle race.\n\nThe speedway takes place on the shores of Lake Lucerne, just repeating its contour. As you know, the lake shore consists only of straight sections, directed to the north, south, ea... | [{"type": "stdin_stdout", "input": "24\n-10000 -10000\n-10000 9998\n9998 9998\n9998 -10000\n-6364 -10000\n-6364 6362\n6362 6362\n6362 -6364\n-2728 -6364\n-2728 2726\n2726 2726\n2726 -910\n908 -910\n908 908\n-910 908\n-910 -4546\n4544 -4546\n4544 4544\n-4546 4544\n-4546 -8182\n8180 -8182\n8180 8180\n-8182 8180\n-8182 -1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter finishing eating her bun, Alyona came up with two integers n and m. She decided to write down two columns of integers — the first column containing integers from 1 to n and the second containing integers from 1 to m... | [{"type": "stdin_stdout", "input": "1000000 1000000\n", "output": "200000000000\n"}, {"type": "stdin_stdout", "input": "1000010 1000000\n", "output": "200002000000\n"}, {"type": "stdin_stdout", "input": "1000000 1892547\n", "output": "378509400000\n"}, {"type": "stdin_stdout", "input": "1000000 999999\n", "output": "19... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSanta Claus likes palindromes very much. There was his birthday recently. k of his friends came to him to congratulate him, and each of them presented to him a string si having the same length n. We denote the beauty of t... | [{"type": "stdin_stdout", "input": "10 20\njvyxocgomfmrtllgmagp 13\ngvtjnyaofrswcnnifzfq 17\nqisxpseggpjfoijmqnel -5\nlenqmjiofjpggespxsiq 14\nqfzfinncwsrfoaynjtvg 14\ncaayidazlylxyisihdhx 14\npgamglltrmfmogcoxyvj 11\nxhdhisiyxlylzadiyaac 2\ntbirihfpjgbbtclpxwhv 19\nvhwxplctbbgjpfhiribt 10\n", "output": "109\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA tree is an undirected connected graph without cycles. The distance between two vertices is the number of edges in a simple path between them.\n\nLimak is a little polar bear. He lives in a tree that consists of n vertic... | [{"type": "stdin_stdout", "input": "15 1\n12 9\n13 7\n1 3\n10 4\n9 2\n2 15\n11 4\n2 14\n10 8\n6 7\n12 5\n8 7\n3 10\n10 2\n", "output": "346\n"}, {"type": "stdin_stdout", "input": "15 1\n12 9\n13 7\n1 3\n10 4\n9 2\n2 15\n11 4\n2 14\n10 8\n6 8\n12 5\n8 7\n3 10\n10 2\n", "output": "336\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlthough Inzane successfully found his beloved bone, Zane, his owner, has yet to return. To search for Zane, he would need a lot of money, of which he sadly has none. To deal with the problem, he has decided to hack the b... | [{"type": "stdin_stdout", "input": "10\n-1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000\n10 3\n7 4\n2 6\n9 2\n5 10\n1 8\n7 8\n7 2\n10 6\n", "output": "-999999998\n"}, {"type": "stdin_stdout", "input": "10\n-1000000000 -1000000000 -1000000000 -10000... | 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\nDr. Evil is interested in math and functions, so he gave Mahmoud and Ehab array a of length n and array b of length m. He introduced a function f(j) which is defined for integers j, which satisfy 0 ≤ j ≤ m - n. Suppose, c... | [{"type": "stdin_stdout", "input": "1 1 1\n1107891008\n15017817\n1 1 821220804\n", "output": "1092873191\n1914093995\n"}, {"type": "stdin_stdout", "input": "1 1 1\n937982044\n179683049\n1 1 821220804\n", "output": "758298995\n1579519799\n"}, {"type": "stdin_stdout", "input": "1 1 1\n937982044\n320909280\n1 1 821220804\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string s consisting of lowercase Latin letters. Character c is called k-dominant iff each substring of s with length at least k contains this character c.\n\nYou have to find minimum k such that there exis... | [{"type": "stdin_stdout", "input": "gfliflgfhhdkceacdljgkegmdlhcgkcmlelmbbbmdddgdeeljjhgbbffmemmmjhebgkhadkdajabcjkcgbkgbaeacdedlkklfech\n", "output": "17\n"}, {"type": "stdin_stdout", "input": "hceflkkldedcaeabgkbgckjcbajadkdahkgbehjmmmemffbbghjjleedgdddmbbbmlelmckgchldmgekgjldcaeckdhhfglfilfg\n", "output": "17\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array of n integer numbers a0, a1, ..., an - 1. Find the distance between two closest (nearest) minimums in it. It is guaranteed that in the array a minimum occurs at least two times.\n\nInput\n\nThe firs... | [{"type": "stdin_stdout", "input": "85\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 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 72 67 68 69 70 71 72 73 74 119 76 77 78 79 80 81 82 83 84 1\n", "output": "84\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya loves hockey very much. One day, as he was watching a hockey match, he fell asleep. Petya dreamt of being appointed to change a hockey team's name. Thus, Petya was given the original team name w and the collection o... | [{"type": "stdin_stdout", "input": "100\nqn\nBE\nyN\nep\nPq\nXz\nLM\nEZ\ndb\nMn\nbn\nFe\nqA\nzc\nyq\npC\nyA\nWk\nYq\nrs\noD\nvD\nzW\nxZ\nbl\nur\nkf\ndf\nLS\nUW\nMy\nhR\nsh\nNh\nog\nCW\nor\nzo\nrO\nao\nXH\nDq\nKa\nlL\nYQ\nOh\nRZ\nAx\nta\nko\nDn\nNg\nNy\nDB\nYD\njO\nAp\nFT\noB\nNc\nwB\nHO\neW\nAc\nDr\nMt\nDf\nbF\nFP\nRa\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAkash singh is a student of Mathematics at Geekland University. These days he is busy with his girlfriend Jassi. On the other hand, Jassi don't like mathematics that much. One day, Jassi decided to find all the strings of... | [{"type": "stdin_stdout", "input": "4000\n740948\n2\n551\n1152761423221685\n618927954312\n3411\n874277931986\n286024865090\n613893446066184\n6378\n291359840\n6361542097\n7260\n657541200146071777\n335998182660\n8012509478351201\n406\n8984143988\n8778383\n107349\n510\n968348499255\n3374380880681989\n22828907815861\n425\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt has been truly said that love is not meant for everyone.\n\nLet me introduce you to a very sad story of my friend Broken Amit. Yes several times he has been left heartbroken. Looking at his poor condition even God is p... | [{"type": "stdin_stdout", "input": "10\n538 44358 10096 27262 6813 27707 34468 11993 10965 14760 \n1338 2767 2817 2255 2014 1757 795 1296 592 1197", "output": "558433\n"}, {"type": "stdin_stdout", "input": "10\n538 44757 10096 27262 6813 27707 34468 11993 1889 14760 \n1338 2767 2817 2255 2014 1757 1101 1296 592 2199", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn infinite army of ants is marching on an infinite 2-D plane. Since ants are disciplined, here's how they march: each ant chooses exactly one x coordinate and moves along it in positive y direction, starting from (x, 0).... | [{"type": "stdin_stdout", "input": "2\n8 -1 26\n5 -1 0\n\nRLMOAE", "output": "28\n"}, {"type": "stdin_stdout", "input": "2\n1 1 14\n6 -1 1\n\nEAOMLS", "output": "15\n"}, {"type": "stdin_stdout", "input": "2\n1 1 15\n13 0 0\n\nEAOMMS", "output": "16\n"}, {"type": "stdin_stdout", "input": "2\n1 0 -1\n24 1 -1\n\nSQNALD", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOz and nakul have N robots, and they want to assign a distinct integer to each robot so that they can easily identify them. Also robots have already expressed their preferences to Oz and nakul. The k-th robot wants an int... | [{"type": "stdin_stdout", "input": "2\n1\n11\n2\n19 6\n\nSAMPLE", "output": "11\n108\n"}, {"type": "stdin_stdout", "input": "2\n1\n10\n2\n10 3\n\nELPMAS", "output": "10\n27\n"}, {"type": "stdin_stdout", "input": "2\n1\n1\n2\n10 14\n\nRAMPLE", "output": "1\n130\n"}, {"type": "stdin_stdout", "input": "2\n1\n6\n2\n15 13\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe ATM machine of State Bank of Patiala on Thapar Campus has a flaw in it and it takes a lot of time to complete a transaction.\nThis machine is quite different from other's as it needed no card. Only thing it required i... | [{"type": "stdin_stdout", "input": "2\n3\n102\n1024\n123477\n3\n102\n1323\n123477\n\nSAMPLE", "output": "NO\nYES\n"}, {"type": "stdin_stdout", "input": "2\n3\n102\n1024\n123477\n3\n102\n2323\n123477\n\nSAMPLE", "output": "NO\nYES\n"}, {"type": "stdin_stdout", "input": "2\n3\n102\n996\n123477\n3\n102\n1034\n123477\n\nSA... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is an integer sequence A_1, ..., A_N of length N.\n\nWe will choose exactly \\left\\lfloor \\frac{N}{2} \\right\\rfloor elements from this sequence so that no two adjacent elements are chosen.\n\nFind the maximum po... | [{"type": "stdin_stdout", "input": "10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 0000000000 1000000000 1000000000 1000000000", "output": "5000000000\n"}, {"type": "stdin_stdout", "input": "10\n1000000000 1000000000 1000000000 1000001000 1000000000 1000000000 0000000000 1000000000 1000000000 100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N points in a D-dimensional space.\n\nThe coordinates of the i-th point are (X_{i1}, X_{i2}, ..., X_{iD}).\n\nThe distance between two points with coordinates (y_1, y_2, ..., y_D) and (z_1, z_2, ..., z_D) is \\s... | [{"type": "stdin_stdout", "input": "-1 15\n-8 2 8 -1\n-18 2 1 2\n-2 10 22 -1", "output": "0\n"}, {"type": "stdin_stdout", "input": "-1 15\n-8 2 8 -1\n-18 2 2 2\n-2 10 22 -1", "output": "0\n"}, {"type": "stdin_stdout", "input": "-1 15\n-8 2 0 -1\n-18 2 2 2\n-2 10 22 -1", "output": "0\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order. (Assume that the positive x-axis points right, and the positive y-axis po... | [{"type": "stdin_stdout", "input": "1 -46 -103 12", "output": "-161 -92 -57 -150\n"}, {"type": "stdin_stdout", "input": "31 -41 -59 26", "output": "-126 -64 -36 -131"}, {"type": "stdin_stdout", "input": "1 -41 -59 26", "output": "-126 -34 -66 -101\n"}, {"type": "stdin_stdout", "input": "1 -46 -59 26", "output": "-131 -... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Japan, people make offerings called hina arare, colorful crackers, on March 3.\n\nWe have a bag that contains N hina arare. (From here, we call them arare.)\n\nIt is known that the bag either contains arare in three co... | [{"type": "stdin_stdout", "input": "9\nG W W G P W P G G", "output": "Three"}, {"type": "stdin_stdout", "input": "8\nO Y W G Y W Y Y", "output": "Four\n"}, {"type": "stdin_stdout", "input": "8\nO Y W F Y W Y Y", "output": "Four\n"}, {"type": "stdin_stdout", "input": "8\nQ Y W G Y W Y Y", "output": "Four\n"}, {"type": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two positive integers A and B. Compare the magnitudes of these numbers.\n\nConstraints\n\n* 1 ≤ A, B ≤ 10^{100}\n* Neither A nor B begins with a `0`.\n\nInput\n\nInput is given from Standard Input in the fol... | [{"type": "stdin_stdout", "input": "123456789012345678901234567890\n54295952540662239241952312402", "output": "GREATER\n"}, {"type": "stdin_stdout", "input": "123456789012345678901234567890\n67478580391614097833417622355", "output": "GREATER\n"}, {"type": "stdin_stdout", "input": "123456789012345678901234567890\n127408... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reverses a given string str.\n\n\n\nInput\n\nstr (the size of str ≤ 20) is given in a line.\n\nOutput\n\nPrint the reversed str in a line.\n\nExample\n\nInput\n\nw32nimda\n\n\nOutput\n\nadmin23w\n\nT... | [{"type": "stdin_stdout", "input": "w32njmda", "output": "admjn23w\n"}, {"type": "stdin_stdout", "input": "admjn23w", "output": "w32njmda\n"}, {"type": "stdin_stdout", "input": "acmjn23w", "output": "w32njmca\n"}, {"type": "stdin_stdout", "input": "3cmjn2aw", "output": "wa2njmc3\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n1+2*3+4\n11\n\n\nOutput\n\nM\n\nThe input will be given via stdin and the output should be printed to stdout by your code.\n\nNow solve the problem by providing the code.\n\nWrite Python code to solve ... | [{"type": "stdin_stdout", "input": "4+1*3+0\n104", "output": "I\n"}, {"type": "stdin_stdout", "input": "4+1*3+0\n102", "output": "I\n"}, {"type": "stdin_stdout", "input": "0+3*1+4\n104", "output": "I\n"}, {"type": "stdin_stdout", "input": "0+3*1+4\n129", "output": "I\n"}, {"type": "stdin_stdout", "input": "3*1+0*4\n12"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nF: Multiplication is fun --Multiplication Is Interesting -\n\nstory\n\nNamba, a high school boy, is thinking of giving her a few lines on her birthday. She is a girl who loves multiplication, so Namba wants to give her a ... | [{"type": "stdin_stdout", "input": "3 3.9884088227062082\n4.1091643442474926\n2.4255254960412556\n3.5822804934056625\n5.345178229082616\n3.4110023092801276\n4.814519106855367", "output": "1\n"}, {"type": "stdin_stdout", "input": "2 2.7392730443507527\n3.4955293017360702\n2.1596061630199546\n2.4656347357978543\n4.322234... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\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 bet... | [{"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\nYou are given a problemset consisting of n problems. The difficulty of the i-th problem is a_i. It is guaranteed that all difficulties are distinct and are given in the increasing order.\n\nYou have to assemble the contes... | [{"type": "stdin_stdout", "input": "9\n4 6 9 12 100 150 200 400 800\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "9\n4 6 9 12 100 150 200 400 612\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "9\n4 2 9 12 100 150 200 400 612\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "10\n1 2 5 11 12 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne rainy gloomy evening when all modules hid in the nearby cafes to drink hot energetic cocktails, the Hexadecimal virus decided to fly over the Mainframe to look for a Great Idea. And she has found one!\n\nWhy not make ... | [{"type": "stdin_stdout", "input": "20\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "010\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "011\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "001\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "12\n", "output": "4\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an undirected unweighted graph consisting of n vertices and m edges.\n\nYou have to write a number on each vertex of the graph. Each number should be 1, 2 or 3. The graph becomes beautiful if for each edge t... | [{"type": "stdin_stdout", "input": "12\n8 7\n2 3\n3 4\n4 5\n5 2\n6 7\n7 8\n8 6\n1 0\n2 1\n1 2\n3 3\n1 2\n2 3\n1 3\n3 2\n2 3\n3 1\n4 4\n1 2\n2 3\n3 4\n4 1\n4 4\n1 2\n2 3\n3 1\n4 1\n6 9\n1 4\n1 5\n1 6\n2 4\n2 5\n2 6\n3 4\n3 5\n3 6\n100000 0\n1000 5\n55 56\n56 57\n57 58\n58 59\n59 55\n11 11\n1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nReading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: \"Many are my names in many countries. Mithrandir a... | [{"type": "stdin_stdout", "input": "tttdddssstttssstttdddddddddttttttdddsssdddtttsssdddsssssstttddddddtttdddssstttsssttttttdddtttsssssstttssssssssstttsssssstttssstttdddddddddsssdddssssssdddssstttsssdddssstttdddttttttdddddddddsssssstttdddtttssssssdddddddddttttttdddtttsssdddssstttsssdddssssssdddsssdddddddddtttssstttsssss... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis problem is given in two editions, which differ exclusively in the constraints on the number n.\n\nYou are given an array of integers a[1], a[2], ..., a[n]. A block is a sequence of contiguous (consecutive) elements a... | [{"type": "stdin_stdout", "input": "100\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 10 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 21 125 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAmugae has a hotel consisting of 10 rooms. The rooms are numbered from 0 to 9 from left to right.\n\nThe hotel has two entrances — one from the left end, and another from the right end. When a customer arrives to the hote... | [{"type": "stdin_stdout", "input": "100\nLLLLLLLLLL0L2L48LL6L7L7L0L3L0L63LL3L4L9L2L7L6L3L8L2L5L9L0L3L3L9L3L3L3L5L2L2L2L1L8L5L7L9L2L05L0LL6L2L\n", "output": "1111111111\n"}, {"type": "stdin_stdout", "input": "100\nRRLLLLLLRR1R7R3L2R0L52RR2R4L1L7L6R4R0R4L5L4L5R2R8L7R0R6R4R8L6L8L4R5R7R3L9R7L64RR8L0R6R4R9L0R9R7R7R0L\n", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSanta has n candies and he wants to gift them to k kids. He wants to divide as many candies as possible between all k kids. Santa can't divide one candy into parts but he is allowed to not use some candies at all.\n\nSupp... | [{"type": "stdin_stdout", "input": "5\n5 3\n19 4\n12 7\n10 2\n100001 44619\n", "output": "4\n18\n10\n10\n100001\n"}, {"type": "stdin_stdout", "input": "5\n5 3\n12 4\n12 7\n10 2\n100001 44619\n", "output": "4\n12\n10\n10\n100001\n"}, {"type": "stdin_stdout", "input": "5\n10 2\n1 11\n5 11\n11 1\n110001 90586\n", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet LCM(x, y) be the minimum positive integer that is divisible by both x and y. For example, LCM(13, 37) = 481, LCM(9, 6) = 18.\n\nYou are given two integers l and r. Find two integers x and y such that l ≤ x < y ≤ r and... | [{"type": "stdin_stdout", "input": "69\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have n barrels lined up in a row, numbered from left to right from one. Initially, the i-th barrel contains a_i liters of water.\n\nYou can pour water from one barrel to another. In one act of pouring, you can choose ... | [{"type": "stdin_stdout", "input": "2\n4 1\n19 5 2 5\n3 2\n0 0 1\n", "output": "24\n1\n"}, {"type": "stdin_stdout", "input": "2\n4 1\n5 16 5 5\n3 2\n0 0 1\n", "output": "21\n1\n"}, {"type": "stdin_stdout", "input": "2\n4 3\n10 1 1 2\n3 2\n0 1 1\n", "output": "14\n2\n"}, {"type": "stdin_stdout", "input": "2\n4 1\n5 16 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNezzar has a binary string s of length n that he wants to share with his best friend, Nanako. Nanako will spend q days inspecting the binary string. At the same time, Nezzar wants to change the string s into string f duri... | [{"type": "stdin_stdout", "input": "4\n5 2\n00000\n00111\n1 5\n1 3\n2 1\n00\n01\n1 2\n10 6\n1111111111\n0110001110\n1 10\n5 9\n7 10\n1 7\n3 5\n6 10\n5 2\n10000\n11000\n2 5\n1 3\n", "output": "\nYES\nNO\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "4\n5 2\n00000\n00111\n1 5\n1 3\n2 1\n00\n01\n1 2\n10 6\n1111111111\n0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a tree with n nodes, numerated from 0 to n-1. For each k between 0 and n, inclusive, you have to count the number of unordered pairs (u,v), u ≠ v, such that the MEX of all the node labels in the shortest pat... | [{"type": "stdin_stdout", "input": "2\n4\n0 1\n0 2\n2 3\n2\n1 0\n", "output": "\n1 2 1 1 1 \n0 0 1 \n"}, {"type": "stdin_stdout", "input": "2\n4\n0 1\n1 2\n2 3\n2\n1 0\n", "output": "3 0 1 1 1\n0 0 1\n"}, {"type": "stdin_stdout", "input": "2\n4\n0 1\n1 2\n1 3\n2\n1 0\n", "output": "3 0 2 1 0\n0 0 1\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name s, a user can pick number p and character c and delete ... | [{"type": "stdin_stdout", "input": "10\nbcbccaacab\n40\n37 c\n21 a\n18 a\n5 b\n1 a\n8 c\n9 a\n38 c\n10 b\n12 c\n18 a\n23 a\n20 c\n7 b\n33 c\n4 c\n22 c\n28 c\n9 a\n12 a\n22 a\n1 b\n6 a\n31 c\n19 b\n19 a\n15 a\n6 c\n11 c\n18 b\n19 c\n24 c\n13 a\n16 c\n2 c\n12 b\n8 a\n14 c\n18 b\n19 c\n", "output": "cbcaabbccaaabbcccacabb... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider some square matrix A with side n consisting of zeros and ones. There are n rows numbered from 1 to n from top to bottom and n columns numbered from 1 to n from left to right in this matrix. We'll denote the eleme... | [{"type": "stdin_stdout", "input": "100\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "89\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "91\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "76\n", "output": "13\n"}, {"type": "stdin_stdout", "input": "80\n", "output": "13\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider the following equation: \n\n<image> where sign [a] represents the integer part of number a.\n\nLet's find all integer z (z > 0), for which this equation is unsolvable in positive integers. The phrase \"unsolvable... | [{"type": "stdin_stdout", "input": "14\n", "output": " 373391776\n"}, {"type": "stdin_stdout", "input": "38\n", "output": " 90046024\n"}, {"type": "stdin_stdout", "input": "25\n", "output": " ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a straight snowy road, divided into n blocks. The blocks are numbered from 1 to n from left to right. If one moves from the i-th block to the (i + 1)-th block, he will leave a right footprint on the i-th block. S... | [{"type": "stdin_stdout", "input": "17\n.......RRRRR.....\n", "output": "8 13\n"}, {"type": "stdin_stdout", "input": "17\n.....RRRRR.......\n", "output": "6 11\n"}, {"type": "stdin_stdout", "input": "17\n......RRRRR......\n", "output": "7 12\n"}, {"type": "stdin_stdout", "input": "13\n....LLLLLL...\n", "output": "10 4\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nValera is a lazy student. He has m clean bowls and k clean plates. \n\nValera has made an eating plan for the next n days. As Valera is lazy, he will eat exactly one dish per day. At that, in order to eat a dish, he needs... | [{"type": "stdin_stdout", "input": "233 100 1\n2 2 1 1 1 2 2 2 2 1 1 2 2 2 1 2 2 1 1 1 2 2 1 1 1 1 2 1 2 2 1 1 2 2 1 2 2 1 2 1 2 1 2 2 2 1 1 1 1 2 1 2 1 1 2 1 1 2 2 1 2 1 2 1 1 1 1 1 1 1 1 1 2 1 2 2 2 1 1 2 2 1 1 1 1 2 1 1 2 1 2 2 2 1 1 1 2 2 2 1 1 1 1 2 1 2 1 1 1 1 2 2 2 1 1 2 1 2 1 1 1 1 1 2 1 1 1 1 1 2 1 1 2 2 1 2 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou will receive 5 points for solving this problem.\n\nManao has invented a new operation on strings that is called folding. Each fold happens between a pair of consecutive letters and places the second part of the string... | [{"type": "stdin_stdout", "input": "LEHLLLLLLHAFGEGLLHAFDLHHMLLLLDGGEHGGHLLLLLLLLDFLCBLLEFLLCBLLCGLEDLGGLECLDGLEHLLLGELLLEGLLLLGDLLLDALD\n", "output": "47\n"}, {"type": "stdin_stdout", "input": "LEHLLLLLLHAFGEGLLHAFDLHHMLLKLDGGEHGGHLLLLLLLLDFLCBLLEFLLCBLLCGLEDLGGLECLDGLEHLLLGELLLEGLLLLGDLLLCALD\n", "output": "45\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNot so long ago company R2 bought company R1 and consequently, all its developments in the field of multicore processors. Now the R2 laboratory is testing one of the R1 processors.\n\nThe testing goes in n steps, at each ... | [{"type": "stdin_stdout", "input": "100 99 1 2\n2 1 1 1 2 2 1 1 1 2 2 2 1 2 1 1 2 1 1 2 1 2 2 1 2 1 2 1 2 1 2 2 2 2 1 1 1 1 1 2 1 2 2 1 2 2 2 1 1 1 1 1 2 2 2 2 1 2 2 1 1 1 2 1 1 2 1 1 2 1 2 1 2 1 1 1 1 2 1 1 0 1 1 2 2 2 1 1 1 1 2 2 2 2 1 1 2 2 2\n", "output": "Incorrect\n"}, {"type": "stdin_stdout", "input": "100 99 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya thinks that lucky tickets are the tickets whose numbers are divisible by 3. He gathered quite a large collection of such tickets but one day his younger brother Leonid was having a sulk and decided to destroy the co... | [{"type": "stdin_stdout", "input": "10\n146767769 71795210 50866429 35232438 22664883 56785812 91050433 75677099 84393937 43832346\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "10\n146767769 71795210 50866429 35232438 22664883 56785812 91050433 75677099 18053121 43832346\n", "output": "4\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya had two arrays consisting of non-negative integers: a of size n and b of size m. Vasya chose a positive integer k and created an n × m matrix v using the following formula:\n\n<image>\n\nVasya wrote down matrix v on... | [{"type": "stdin_stdout", "input": "5 5\n260683318 260683321 260683319 260683318 260683319\n207210837 207210840 207210838 207210837 207210838\n83257083 83257086 83257084 83257083 83257084\n142444898 142444901 142444899 142444898 142444899\n129630806 129630809 129630807 129630806 129630807\n", "output": "YES\n260683322\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMarina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly t characters. Help Vasya find at least one such string.\n\nMore formally, you are given two strings s1, ... | [{"type": "stdin_stdout", "input": "100 85\njknccpmanwhxqnxivdgguahjcuyhdrazmbfwoptatlgytakxsfvdzzcsglhmswfxafxyregdbeiwpawrjgwcqrkbhmrfcscgoszf\nhknccpmanwhxjnxivdggeahjcuyhdrazmbfwoqtatlgytdkxsfvdztcsglhmssfxsfxyrngdbeiwpawrjgwcqrkbhmrfcsckoskf\n", "output": "aaaaaaabaaaaaaaaaaaaabaaaaaaaabaaaaaaaabaaaaabaaaaaaaaaaaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLimak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.\n\nThe distance between two letters is defined as the difference between their positions in the alph... | [{"type": "stdin_stdout", "input": "69 1701\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzy\n", "output": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaax"}, {"type": "stdin_stdout", "input": "69 465\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzy\n", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe girl Taylor has a beautiful calendar for the year y. In the calendar all days are given with their days of week: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday.\n\nThe calendar is so beautiful that ... | [{"type": "stdin_stdout", "input": "105311\n", "output": "105322\n"}, {"type": "stdin_stdout", "input": "99988\n", "output": "100016"}, {"type": "stdin_stdout", "input": "99996\n", "output": "100024"}, {"type": "stdin_stdout", "input": "99999\n", "output": "100010"}, {"type": "stdin_stdout", "input": "19779\n", "output... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTreeland is a country in which there are n towns connected by n - 1 two-way road such that it's possible to get from any town to any other town. \n\nIn Treeland there are 2k universities which are located in different tow... | [{"type": "stdin_stdout", "input": "35 15\n6 12 32 18 11 10 29 9 30 27 31 14 8 24 28 25 19 15 21 3 4 1 33 22 23 17 16 13 7 2\n1 2\n20 3\n1 4\n20 5\n20 6\n1 7\n13 8\n4 9\n1 10\n1 11\n1 12\n1 13\n18 14\n10 15\n1 16\n16 17\n1 18\n1 19\n1 20\n20 21\n1 22\n27 23\n25 24\n1 25\n20 26\n20 27\n18 28\n4 29\n13 30\n4 31\n1 32\n20... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is an interactive problem. In the interaction section below you will see the information about flushing the output.\n\nIn this problem, you will be playing a game with Hongcow. How lucky of you!\n\nHongcow has a hidd... | [{"type": "stdin_stdout", "input": "3\n-1 0 1\n4 7 0\n-1 -1 4\n2 0 8\n0 5 2", "output": "2\n1 3\n1\n2\n2\n1 2\n1\n3\n3\n1 2 3\n3\n1 2 3\n3\n1 2 3\n3\n1 2 3\n3\n1 2 3\n3\n1 2 3\n3\n1 2 3\n3\n1 2 3\n-1\n2 0 0\n"}, {"type": "stdin_stdout", "input": "3\n-1 0 1\n4 7 0\n-1 -2 4\n2 0 8\n0 5 2", "output": "2\n1 3\n1\n2\n2\n1 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the army, it isn't easy to form a group of soldiers that will be effective on the battlefield. The communication is crucial and thus no two soldiers should share a name (what would happen if they got an order that Bob ... | [{"type": "stdin_stdout", "input": "50 2\nYES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES\n", "output": "Aa Ab Ac Ad Ae Af Ag Ah Ai Aj Ak Al Am An Ao Ap Aq Ar As At Au Av A... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.