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\nWet Shark once had 2 sequences: \n{a_n}= {a_1, a_2, a_3, ... , a_(109)} \n{b_n} = {b_1, b_2, b_3, ... , b_(109)} \nHowever, he only kept one element from each sequence. Luckily, both the elements that Wet Shark kept hav...
[{"type": "stdin_stdout", "input": "-15 -1 -2\n2 0", "output": "2147483648.00000000000\n"}, {"type": "stdin_stdout", "input": "-15 -1 -1\n2 0", "output": "1073741824.00000000000\n"}, {"type": "stdin_stdout", "input": "-6 4 -1\n8 -1", "output": "14680064.00000000000\n"}, {"type": "stdin_stdout", "input": "-8 0 -1\n2 -1"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWhen preparing a tournament, Codeforces coordinators try treir best to make the first problem as easy as possible. This time the coordinator had chosen some problem and asked $n$ people about their opinions. Each person a...
[{"type": "stdin_stdout", "input": "100\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "EASY\n"}, {"type": "stdin_stdout", "input": "100\n0 0 0 0 0 0 0 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCountry of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process.\n\nThere ar...
[{"type": "stdin_stdout", "input": "10 10 1\n351 0 3 7\n214 0 9 9\n606 0 7 8\n688 0 9 3\n188 3 0 9\n994 0 1 7\n372 5 0 14\n957 0 3 6\n458 8 0 7\n379 0 4 7\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "4 10 1\n988 0 1 1\n507 1 0 9\n798 1 0 9\n400 0 3 7\n242 2 0 8\n574 4 0 7\n458 0 4 9\n330 0 2 9\n303 2 0 8\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between the easy and hard versions is that tokens of type O do not appear in the input of the easy version.\n\nErrichto gave Monogon the following challenge in order to intimidate him from taking his t...
[{"type": "stdin_stdout", "input": "3\n3\n.X.\nXXX\n.X.\n6\nXX.XXX\nXXXXXX\nXXX.XX\nXXXXXX\nXX.X.X\nXXXXXX\n5\nXXX.X\n.X..X\nXXX.X\n..X..\n..X..\n", "output": "\n.X.\nXOX\n.X.\nXX.XXO\nXOXXOX\nOXX.XX\nXOOXXO\nXX.X.X\nOXXOXX\nXOX.X\n.X..X\nXXO.O\n..X..\n..X..\n"}, {"type": "stdin_stdout", "input": "3\n3\n.X.\nXXX\n.X.\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFloating-Point Numbers\n\nIn this problem, we consider floating-point number formats, data representation formats to approximate real numbers on computers.\n\nScientific notation is a method to express a number, frequentl...
[{"type": "stdin_stdout", "input": "1\n0000000000100000000000000000000000000000000000000000\n2\n0000000000000000000000000000000000000000000000000000\n2\n0000000000000000001000000000000000000000000000000000\n11\n0000000000000000000000000000000000000000000000000000\n7\n1101000000000000000000000000000000000000000000000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which manipulates a weighted rooted tree $T$ with the following operations:\n\n* $add(v,w)$: add $w$ to all edges from the root to node $u$\n\n* $getSum(u)$: report the sum of weights of all edges from the...
[{"type": "stdin_stdout", "input": "6\n2 1 2\n2 3 5\n0\n0\n0\n1 4\n7\n1 1\n0 3 12\n1 2\n0 4 20\n1 3\n0 3 40\n1 4", "output": "0\n0\n44\n112\n"}, {"type": "stdin_stdout", "input": "6\n2 1 2\n2 3 5\n0\n0\n0\n1 4\n7\n1 1\n0 3 6\n1 2\n0 4 20\n1 3\n0 5 40\n1 4", "output": "0\n0\n32\n146\n"}, {"type": "stdin_stdout", "input"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya adores sport programming. He can't write programs but he loves to watch the contests' progress. Vasya even has a favorite coder and Vasya pays special attention to him.\n\nOne day Vasya decided to collect the result...
[{"type": "stdin_stdout", "input": "100\n9999 9999 9999 9998 9998 9998 9997 9996 9996 9995 9993 9993 9991 9990 9989 9986 9984 9984 9983 9981 9981 10079 9980 9980 9979 9977 9977 9977 9977 9977 9976 9976 9975 9975 9973 9972 9972 9972 9972 9971 9969 9969 9969 9968 9967 9965 9962 9962 9962 9962 9960 9958 9958 9955 9954 995...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIt is known that the area of a regular dodecagon inscribed in a circle of radius a is 3a^2.\nGiven an integer r, find the area of a regular dodecagon inscribed in a circle of radius r.\n\n-----Constraints-----\n - 1 \\leq...
[{"type": "stdin_stdout", "input": "100\n", "output": "30000\n"}, {"type": "stdin_stdout", "input": "270", "output": "218700\n"}, {"type": "stdin_stdout", "input": "256", "output": "196608\n"}, {"type": "stdin_stdout", "input": "203", "output": "123627\n"}, {"type": "stdin_stdout", "input": "196", "output": "115248\n"}...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBerland has a long and glorious history. To increase awareness about it among younger citizens, King of Berland decided to compose an anthem.\n\nThough there are lots and lots of victories in history of Berland, there is ...
[{"type": "stdin_stdout", "input": "????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn olden days finding square roots seemed to be difficult but nowadays it can be easily done using in-built functions available across many languages \n.\n\nAssume that you happen to hear the above words and you want to g...
[{"type": "stdin_stdout", "input": "3\n18\n10\n10000", "output": "4\n3\n100\n"}, {"type": "stdin_stdout", "input": "3\n17\n16\n10010", "output": "4\n4\n100\n"}, {"type": "stdin_stdout", "input": "3\n10\n5\n10010", "output": "3\n2\n100\n"}, {"type": "stdin_stdout", "input": "3\n1\n11\n10000", "output": "1\n3\n100\n"}, {...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSome time ago Mister B detected a strange signal from the space, which he started to study.\n\nAfter some transformation the signal turned out to be a permutation p of length n or its cyclic shift. For the further investi...
[{"type": "stdin_stdout", "input": "108\n1 102 33 99 6 83 4 20 61 100 76 71 44 9 24 87 57 2 81 82 90 85 12 30 66 53 47 36 43 29 31 64 96 84 77 23 93 78 58 68 42 55 13 70 62 19 92 14 10 65 63 75 91 48 11 105 37 50 32 94 18 26 52 89 104 106 86 97 80 95 17 72 40 22 79 103 25 101 35 51 15 98 67 5 34 69 54 27 45 88 56 16 46...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have two distinct integers A and B.\nPrint the integer K such that |A - K| = |B - K|.\nIf such an integer does not exist, print IMPOSSIBLE instead.\n\n-----Constraints-----\n - All values in input are integers.\n - 0 \...
[{"type": "stdin_stdout", "input": "999999999 1000000000\n", "output": "IMPOSSIBLE\n"}, {"type": "stdin_stdout", "input": "369673908 845644227\n", "output": "IMPOSSIBLE\n"}, {"type": "stdin_stdout", "input": "232334010 962483782\n", "output": "597408896\n"}, {"type": "stdin_stdout", "input": "274100628 29096111\n", "ou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOf the real numbers, those with a circular decimal part and those with a finite number of digits can be expressed as fractions.\n\n\n\n\nGiven a real number that can be represented by a fraction, write a program that outp...
[{"type": "stdin_stdout", "input": "3.2(145)", "output": "32113/9990\n"}, {"type": "stdin_stdout", "input": "3.3(145)", "output": "16556/4995\n"}, {"type": "stdin_stdout", "input": "5.21(43)", "output": "25811/4950\n"}, {"type": "stdin_stdout", "input": "3.3(155)", "output": "16561/4995\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasiliy is fond of solving different tasks. Today he found one he wasn't able to solve himself, so he asks you to help.\n\nVasiliy is given n strings consisting of lowercase English letters. He wants them to be sorted in ...
[{"type": "stdin_stdout", "input": "10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\naaaaaaaaaaab\nab\naab\naaab\naaaab\naaaaab\naaaaaab\naaaaaaab\naaaaaaaab\naaaaaaaaab\n", "output": "8000000000\n"}, {"type": "stdin_stdout", "input": "10\n1000000000 100...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given $n$ one-dimensional segments (each segment is denoted by two integers β€” its endpoints).\n\nLet's define the function $f(x)$ as the number of segments covering point $x$ (a segment covers the point $x$ if $l ...
[{"type": "stdin_stdout", "input": "9\n4 3\n1 3\n7 9\n2 5\n3 6\n2 9\n1 4\n3 7\n1 3\n2 4\n3 5\n1 4\n6 7\n5 5\n4 3\n1 3\n7 9\n2 5\n3 6\n2 9\n1 4\n3 7\n1 3\n2 4\n3 5\n1 4\n6 7\n5 5\n1 4\n3 7\n", "output": "YES\nNO\nNO\nYES\nYES\nNO\nNO\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "4\n4 3\n1 3\n7 9\n2 5\n3 6\n2 9\n1 4\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe restaurant AtCoder serves the following five dishes:\n - ABC Don (rice bowl): takes A minutes to serve.\n - ARC Curry: takes B minutes to serve.\n - AGC Pasta: takes C minutes to serve.\n - APC Ramen: takes D minutes ...
[{"type": "stdin_stdout", "input": "123\n123\n123\n123\n123\n", "output": "643\n"}, {"type": "stdin_stdout", "input": "123\n123\n161\n123\n123", "output": "681\n"}, {"type": "stdin_stdout", "input": "123\n123\n161\n123\n163", "output": "721\n"}, {"type": "stdin_stdout", "input": "123\n123\n161\n123\n263", "output": "82...
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\nRecently Xenia has bought $n_r$ red gems, $n_g$ green gems and $n_b$ blue gems. Ea...
[{"type": "stdin_stdout", "input": "1\n10 10 10\n761 829 1037 1818 133 576 705 131 935 821\n896 163 569 957 169 475 342 1074 760 434\n131 383 243 247 908 799 56 1929 360 189\n", "output": "1928\n"}, {"type": "stdin_stdout", "input": "1\n10 10 10\n761 829 1037 1818 133 576 705 131 935 821\n896 163 569 656 169 475 342 10...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.\n\nDuring all his career Hideo has produced n game...
[{"type": "stdin_stdout", "input": "100\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "100\n1 1 1 1 1 1 1 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou want to make change for $ n $ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and / or 25 cents coins respectively, find the minimum number of coins you need.\n\nConstraints\n\n* $ 1 \\ le n \\ le 1...
[{"type": "stdin_stdout", "input": "251195", "output": "10049\n"}, {"type": "stdin_stdout", "input": "467454", "output": "18702\n"}, {"type": "stdin_stdout", "input": "698278", "output": "27934\n"}, {"type": "stdin_stdout", "input": "323456", "output": "12940\n"}, {"type": "stdin_stdout", "input": "164898", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis year in Equestria was a year of plenty, so Applejack has decided to build some new apple storages. According to the advice of the farm designers, she chose to build two storages with non-zero area: one in the shape o...
[{"type": "stdin_stdout", "input": "1\n1\n34\n- 1\n+ 1\n+ 1\n+ 1\n+ 1\n+ 1\n+ 1\n+ 1\n+ 1\n+ 1\n- 1\n- 1\n- 1\n- 1\n- 1\n+ 2\n+ 2\n+ 2\n+ 2\n- 1\n+ 2\n+ 2\n- 1\n+ 2\n- 1\n+ 3\n+ 3\n+ 1\n- 1\n- 2\n- 2\n- 2\n+ 1\n+ 3\n", "output": "NO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nYES\nNO\nNO\nYE...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA permutation of length $n$ is an array consisting of $n$ distinct integers from $1$ to $n$ in arbitrary order. For example, $[2,3,1,5,4]$ is a permutation, but $[1,2,2]$ is not a permutation ($2$ appears twice in the arr...
[{"type": "stdin_stdout", "input": "100\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n2\n13\n14\n23\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n90\n38\n39\n40\n41\n42\n43\n44\n45\n46\n47\n48\n69\n50\n51\n52\n53\n80\n55\n56\n57\n58\n59\n51\n61\n62\n103\n64\n65\n66\n67\n68\n69\n72\n71\n72\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese, Russian and Vietnamese as well. \n\nYou are given two integer arrays A and B each of size N. Let us define interaction of arrays A and B to be the sum of A[i] * B[i] for each ...
[{"type": "stdin_stdout", "input": "2\n2 2\n2 2\n-4 6\n3 9\n1 2 -3\n-2 -1 -4", "output": "16\n44\n"}, {"type": "stdin_stdout", "input": "2\n2 4\n0 2\n-1 10\n3 3\n1 2 -3\n-4 3 -5", "output": "60\n32\n"}, {"type": "stdin_stdout", "input": "2\n2 4\n0 2\n-1 10\n3 1\n1 2 -3\n-4 3 -5", "output": "60\n22\n"}, {"type": "stdin_...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYour friend is developing a computer game. He has already decided how the game world should look like β€” it should consist of n locations connected by m two-way passages. The passages are designed in such a way that it sho...
[{"type": "stdin_stdout", "input": "50 72\n35 38\n19 46\n35 12\n27 30\n23 41\n50 16\n31 6\n20 33\n38 1\n10 35\n13 43\n29 25\n25 4\n1 13\n4 20\n36 29\n13 47\n48 5\n30 21\n30 38\n28 50\n41 45\n25 43\n40 36\n19 47\n31 32\n26 28\n8 13\n43 24\n27 35\n14 29\n14 38\n50 9\n34 49\n12 34\n43 42\n41 15\n46 29\n48 11\n48 7\n40 29\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSometimes Mister B has free evenings when he doesn't know what to do. Fortunately, Mister B found a new game, where the player can play against aliens.\n\nAll characters in this game are lowercase English letters. There a...
[{"type": "stdin_stdout", "input": "12 12 876543210 1000000000\n", "output": "13\n"}, {"type": "stdin_stdout", "input": "12 12 876543210 1000000000\n", "output": "13"}, {"type": "stdin_stdout", "input": "10 12 220000011 220000032\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "5 10 1000000000 1000000000\n", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n<image>\n\n\nThere used to be a game called Joseph's potatoes. Let's say n people are participating. Participants form a circle facing the center and are numbered starting from 1. One hot potato is given to participant n ...
[{"type": "stdin_stdout", "input": "44 3\n45 10\n0 0", "output": "40\n33\n"}, {"type": "stdin_stdout", "input": "75 2\n16 14\n0 0", "output": "23\n10\n"}, {"type": "stdin_stdout", "input": "18 3\n45 10\n0 0", "output": "14\n33\n"}, {"type": "stdin_stdout", "input": "26 3\n45 10\n0 0", "output": "17\n33\n"}, {"type": "s...
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\nYou have a new professor of graph theory and he speaks very quickly. You come up with the following plan to keep up with his lecture and make notes.\n\nYou know two languages, and the professor is giving the lecture in th...
[{"type": "stdin_stdout", "input": "10 22\nazbrll oen\ngh vdyayei\njphveblohx vfglv\nmfyxib jepnvhcuwo\nrpikazqj uam\nl rx\nokjenof qpnyi\nj tixqrno\nod itozmfct\nikkdxmirx ev\nqexftojc p\nkdazb zjs\nmbk ykvqjrxaxu\nhbcwhouzq pwt\nmirpsz zfaegpl\nuhkkvcj rlvwj\nef iqnnwtolrc\npjzfcpmeag ecdayth\nsa qcthz\ncbfhfxi qrnbv...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMoamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.\n\nMoamen wins if $a_1 \\,\\&\\, a_2 \\,\\&\\, a_3 \\,\\&\\, \\ldots \\,\\&\\, a_n \\ge a_...
[{"type": "stdin_stdout", "input": "5\n200000 200000\n200000 200000\n200000 200000\n200000 200000\n200000 200000\n", "output": "226490044\n226490044\n226490044\n226490044\n226490044\n"}, {"type": "stdin_stdout", "input": "5\n200000 200000\n200000 200000\n200000 200000\n200000 200000\n200000 200000\n", "output": "226490...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is a positive integer N. Consider repeatedly applying the operation below on N:\n - First, choose a positive integer z satisfying all of the conditions below:\n - z can be represented as z=p^e, where p is a prime nu...
[{"type": "stdin_stdout", "input": "1000000000000\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "200560490130\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "755827200000\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "366735600000\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the evening Polycarp decided to analyze his today's travel expenses on public transport.\n\nThe bus system in the capital of Berland is arranged in such a way that each bus runs along the route between two stops. Each ...
[{"type": "stdin_stdout", "input": "27 8 1 0 1\nBcd A\nA b\nb BcDc\ndc dbaC\ndbaC dcCB\nB d\nd BbAc\nCBC b\nDBDca d\ncAbb AA\nAA Ba\ncAccb DBDca\ncb DdaB\nAAcBc Ba\nBa dc\ndc DDCd\nbcBDA da\nbDD ADD\nAA b\nb cb\ncb CCBbd\nCCBbd bcDdb\nbcDdb ddc\nddc C\nC Adc\nAdc BbAc\nBbAc DD\n", "output": "111\n"}, {"type": "stdin_st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEvlampiy has found one more cool application to process photos. However the application has certain limitations.\n\nEach photo i has a contrast v_{i}. In order for the processing to be truly of high quality, the applicati...
[{"type": "stdin_stdout", "input": "101 9\n3 2 2 1 4 1 3 2 3 4 3 2 3 1 4 4 1 1 4 1 3 3 4 1 2 1 1 3 1 2 2 4 3 1 4 3 1 1 4 4 1 2 1 1 4 2 3 4 1 2 1 4 4 1 4 3 1 4 2 1 2 1 4 3 4 3 4 2 2 4 3 2 1 3 4 3 2 2 4 3 3 2 4 1 3 2 2 4 1 3 4 2 1 3 3 2 2 1 1 3 1\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "101 9\n3 2 2 1 4 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVladimir would like to prepare a present for his wife: they have an anniversary! He decided to buy her exactly $n$ flowers.\n\nVladimir went to a flower shop, and he was amazed to see that there are $m$ types of flowers b...
[{"type": "stdin_stdout", "input": "1\n7 7\n873108721 195635452\n42649954 997221147\n873108721 1003477544\n1087176458 873108721\n1130734166 858693746\n1309378041 372607189\n1000000000 427003887\n", "output": "7410830018\n"}, {"type": "stdin_stdout", "input": "1\n7 7\n873108721 195635452\n66631086 997221147\n1700956320 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese, Russian and Vietnamese as well. \nZombies zombies everywhere!!Β \nIn a parallel world of zombies, there are N zombies. There are infinite number of unused cars, each of same mo...
[{"type": "stdin_stdout", "input": "2\n2 6\n16 17", "output": "30\n118740505\n"}, {"type": "stdin_stdout", "input": "2\n2 6\n19 17", "output": "30\n361105078\n"}, {"type": "stdin_stdout", "input": "2\n2 6\n29 17", "output": "30\n684841218\n"}, {"type": "stdin_stdout", "input": "2\n2 6\n19 34", "output": "30\n525446287\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads an integer $S$ [second] and converts it to $h:m:s$ where $h$, $m$, $s$ denote hours, minutes (less than 60) and seconds (less than 60) respectively.\n\nConstraints\n\n* $0 \\leq S \\leq 86400$\...
[{"type": "stdin_stdout", "input": "71983", "output": "19:59:43\n"}, {"type": "stdin_stdout", "input": "-1025", "output": "-1:42:55\n"}, {"type": "stdin_stdout", "input": "-144", "output": "-1:57:36\n"}, {"type": "stdin_stdout", "input": "-274", "output": "-1:55:26\n"}, {"type": "stdin_stdout", "input": "-399", "output...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given four integer values $a$, $b$, $c$ and $m$.\n\nCheck if there exists a string that contains:\n\n$a$ letters 'A';\n\n$b$ letters 'B';\n\n$c$ letters 'C';\n\nno other letters;\n\nexactly $m$ pairs of adjacent e...
[{"type": "stdin_stdout", "input": "3\n2 2 1 0\n2 1 1 1\n1 2 3 2\n", "output": "YES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "3\n2 2 1 0\n1 1 1 1\n1 2 3 2\n", "output": "YES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "3\n3 2 1 0\n1 1 1 1\n1 2 3 2\n", "output": "YES\nNO\nYES\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYour mission in this problem is to write a computer program that manipulates molecular for- mulae in virtual chemistry. As in real chemistry, each molecular formula represents a molecule consisting of one or more atoms. H...
[{"type": "stdin_stdout", "input": "H 1\neI 5\nC 12\nO 16\nF 22\nNe 24\nEu 64\nCc 241\nEND_OF_FIRST_PART\nG2C\n(MhF)2As\nCu(OH)2\nH((CO)2F)99\n0", "output": "UNKNOWN\nUNKNOWN\nUNKNOWN\n7723\n"}, {"type": "stdin_stdout", "input": "H 0\nHe 4\nC 12\nO 26\nF 2\nOe 36\nvC 64\nCc 603\nEND_OF_FIRST_PART\nH2B\n(MgF)2As\nBu(OH)...
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\nBurenka came to kindergarden. This kindergarten is quite strange, so each kid there receives two fractions ($\\frac{a}{b}$ and $\\frac{c}{d}$) with integer numerators and denominators. Then children are commanded to play ...
[{"type": "stdin_stdout", "input": "7\n1000000000 999999999 999999999 999999998\n999999997 999999996 999999996 999999995\n999999994 999999993 999999993 999999992\n999999991 999999990 999999990 999999989\n999999988 999999987 999999987 999999986\n999999985 999999984 999999984 999999983\n999999982 999999981 999999981 9999...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nShuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.\n\nThanks to Mr. Kitayuta's research, it has finally become possible to construct telep...
[{"type": "stdin_stdout", "input": "7 13\n6 1\n7 2\n3 7\n6 5\n3 6\n7 4\n3 5\n4 1\n3 1\n1 5\n1 6\n4 2\n2 4\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "7 13\n6 1\n7 2\n3 7\n6 5\n3 6\n7 4\n3 7\n4 1\n3 1\n1 5\n1 6\n4 2\n2 4\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "7 13\n6 1\n7 2\n3 7\n6 5\n3 6\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFind the price of a product before tax such that, when the consumption tax rate is 8 percent and 10 percent, the amount of consumption tax levied on it is A yen and B yen, respectively. (Yen is the currency of Japan.)\nHe...
[{"type": "stdin_stdout", "input": "80 100\n", "output": "1000\n"}, {"type": "stdin_stdout", "input": "68 85\n", "output": "850\n"}, {"type": "stdin_stdout", "input": "24 30\n", "output": "300\n"}, {"type": "stdin_stdout", "input": "25 32\n", "output": "320\n"}, {"type": "stdin_stdout", "input": "27 34\n", "output": "3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEvery year, hundreds of people come to summer camps, they learn new algorithms and solve hard problems.\n\nThis is your first year at summer camp, and you are asked to solve the following problem. All integers starting wi...
[{"type": "stdin_stdout", "input": "1000\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "1000\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "999\n", "output": "9\n"}, {"type": "stdin_stdout", "input": "100\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "123\n", "output": "6\n"}, {"type": "st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA sequence a0, a1, ..., at - 1 is called increasing if ai - 1 < ai for each i: 0 < i < t.\n\nYou are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequ...
[{"type": "stdin_stdout", "input": "100 3\n329 226 331 909 962 112 837 1005 194 818 506 416 125 648 367 459 400 582 989 547 329 438 234 121 272 226 821 376 834 427 718 164 834 113 654 177 737 212 169 696 744 180 89 944 233 147 667 990 809 1072 1085 1093 814 265 1067 312 833 572 303 901 1032 504 185 817 389 158 613 723 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAtCoDeer the deer recently bought three paint cans.\nThe color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c.\nHere, the color of each...
[{"type": "stdin_stdout", "input": "11 12 -1", "output": "3\n"}, {"type": "stdin_stdout", "input": "11 20 -1", "output": "3\n"}, {"type": "stdin_stdout", "input": "3 3 33\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "5 -1 33", "output": "3\n"}, {"type": "stdin_stdout", "input": "5 -2 33", "output": "3\n"}, {...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA bracket sequence is a string containing only characters \"(\" and \")\". A regular bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters \"1\" and \"...
[{"type": "stdin_stdout", "input": "40 36\n((((((((()()()))))))))((())((()())))(())\n", "output": "((((((((()()()))))))))((())((()())))\n"}, {"type": "stdin_stdout", "input": "40 34\n((((((((()()()))))))))((())((()())))(())\n", "output": "((((((((()()()))))))))((())((())))\n"}, {"type": "stdin_stdout", "input": "40 32\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou've decided to carry out a survey in the theory of prime numbers. Let us remind you that a prime number is a positive integer that has exactly two distinct positive integer divisors.\n\nConsider positive integers a, a ...
[{"type": "stdin_stdout", "input": "100000 1000000 7821\n", "output": "108426\n"}, {"type": "stdin_stdout", "input": "10000 1000000 60000\n", "output": "793662\n"}, {"type": "stdin_stdout", "input": "10000 1000000 60000\n", "output": "793662"}, {"type": "stdin_stdout", "input": "100000 1000000 7821\n", "output": "10842...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.\n\nTo settle this ...
[{"type": "stdin_stdout", "input": "tinkoff\nzscoder\n", "output": "fzfsirk\n"}, {"type": "stdin_stdout", "input": "tinkoff\nzscoder\n", "output": "fzfsirk\n"}, {"type": "stdin_stdout", "input": "tinkogf\nzscoder\n", "output": "fzgsirk"}, {"type": "stdin_stdout", "input": "thnkogf\nzscoder\n", "output": "fzgshrk"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya likes to solve equations. Today he wants to solve $(x~\\mathrm{div}~k) \\cdot (x \\bmod k) = n$, where $\\mathrm{div}$ and $\\mathrm{mod}$ stand for integer division and modulo operations (refer to the Notes below f...
[{"type": "stdin_stdout", "input": "999983 1000\n", "output": "999983001\n"}, {"type": "stdin_stdout", "input": "999995 1000\n", "output": "199999005\n"}, {"type": "stdin_stdout", "input": "1709131 435\n", "output": "743471986\n"}, {"type": "stdin_stdout", "input": "232207 1179\n", "output": "273772054\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe R1 company wants to hold a web search championship. There were n computers given for the competition, each of them is connected to the Internet. The organizers believe that the data transfer speed directly affects the...
[{"type": "stdin_stdout", "input": "80 50\n15160 6853 20254 11358 19535 27691 2983 31650 9219 11833 32053 31695 21511 4320 4384 24843 1454 31543 18796 13815 1546 27926 16276 14315 12542 25370 24890 29647 3584 17867 12446 15072 19852 30207 16361 7964 5343 398 10837 31114 9252 12767 15098 22562 32637 31823 8160 12658 642...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nMr. ukuku1333 is a little sloppy, so when I expanded the product of the linear expressions of x, I couldn't figure out the original linear expression.\nGiven the nth degree polynomial of x, factor it into the p...
[{"type": "stdin_stdout", "input": "x^5+15x^4+85x^3+225x^2+274x+120", "output": "(x+1)(x+2)(x+3)(x+4)(x+5)"}, {"type": "stdin_stdout", "input": "x^3-81x^2-1882x-1800", "output": "(x-100)(x+1)(x+18)"}, {"type": "stdin_stdout", "input": "x^2+4x+3", "output": "(x+1)(x+3)\n"}, {"type": "stdin_stdout", "input": "x^2+3x+2", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWhen a boy was cleaning up after his grand father passing, he found an old paper:\n\n<image>\n\n\n\nIn addition, other side of the paper says that \"go ahead a number of steps equivalent to the first integer, and turn clo...
[{"type": "stdin_stdout", "input": "56,65\n97,54\n64,-4\n55,76\n42,-27\n43,80\n87,-86\n55,-6\n89,34\n5,59\n0,0", "output": "181\n-212\n"}, {"type": "stdin_stdout", "input": "56,65\n97,54\n64,-4\n55,76\n42,-27\n43,80\n77,-86\n55,-6\n89,34\n95,5\n0,0", "output": "180\n-297\n"}, {"type": "stdin_stdout", "input": "56,65\n9...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem Statement\n\n\"Everlasting -One-\" is an award-winning online game launched this year. This game has rapidly become famous for its large number of characters you can play.\n\nIn this game, a character is character...
[{"type": "stdin_stdout", "input": "12 2\n2 2\n4 12\n6 0\n100000 0\n0 0", "output": "2049\n64\n607723520\n"}, {"type": "stdin_stdout", "input": "12 2\n1 2\n4 3\n6 0\n100000 0\n0 0", "output": "1025\n64\n607723520\n"}, {"type": "stdin_stdout", "input": "12 2\n2 2\n4 3\n6 0\n100000 0\n0 0", "output": "2049\n64\n607723520...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day Vasya got hold of information on the Martian dollar course in bourles for the next n days. The buying prices and the selling prices for one dollar on day i are the same and are equal to ai. Vasya has b bourles. He...
[{"type": "stdin_stdout", "input": "93 867\n131 1270 616 1027 1685 27 1662 947 1480 20 1394 1528 191 1348 37 1694 1772 1706 1394 49 1391 878 1474 307 101 1129 1064 116 143 1239 261 651 1534 1348 1604 636 793 1188 1293 36 1729 1204 1656 1579 1644 661 1470 341 1709 1860 1081 1539 5 1892 1732 1049 419 25 1086 1263 967 128...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTo get money for a new aeonic blaster, ranger Qwerty decided to engage in trade for a while. He wants to buy some number of items (or probably not to buy anything at all) on one of the planets, and then sell the bought it...
[{"type": "stdin_stdout", "input": "5 10 15\nDdunkjly\n13 12 4\n83 26 1\n63 42 3\n83 22 2\n57 33 0\n59 10 1\n89 31 1\n57 17 2\n98 79 5\n46 41 3\nFbpbc\n28 21 0\n93 66 5\n66 21 0\n68 58 0\n59 17 3\n57 23 1\n72 71 1\n55 51 2\n58 40 5\n70 67 2\nKeiotmh\n73 44 4\n98 14 0\n19 7 0\n55 10 5\n30 25 4\n66 48 2\n66 51 4\n82 79 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEmacs is a text editor which is widely used by many programmers.\n\nThe advantage of Emacs is that we can move a cursor without arrow keys and the mice. For example, the cursor can be moved right, left, down, and up by pu...
[{"type": "stdin_stdout", "input": "hyo\nnh\nEND_OF_TEXT\ne\nd\nf\nf\nk\np\np\ne\ny\na\nk\ny\ny\nn\ny\n-", "output": "hyonhhyonhhyonh\n"}, {"type": "stdin_stdout", "input": "hyn\nnh\nEND_OF_TEXT\ne\nd\nf\nf\nk\np\np\ne\nx\na\nk\ny\ny\nn\ny\n-", "output": "hynnhhynnhhynnh\n"}, {"type": "stdin_stdout", "input": "oyh\nni\...
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 s_{i} having the same length n. We denote the beauty o...
[{"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\nAnya loves to fold and stick. Today she decided to do just that.\n\nAnya has n cubes lying in a line and numbered from 1 to n from left to right, with natural numbers written on them. She also has k stickers with exclamat...
[{"type": "stdin_stdout", "input": "25 16 13326087796\n157576937 627434432 942652043 706432863 631136945 714549755 465703470 663358517 695561723 249240606 833566455 396564536 758483017 253748999 978210764 530023233 193812243 317718202 184788435 892848108 150420430 330992298 780787784 196460118 674015883\n", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n stone quarries in Petrograd.\n\nEach quarry owns mi dumpers (1 ≀ i ≀ n). It is known that the first dumper of the i-th quarry has xi stones in it, the second dumper has xi + 1 stones in it, the third has xi + ...
[{"type": "stdin_stdout", "input": "30\n53 12\n13 98\n21 60\n76 58\n39 5\n62 58\n73 80\n13 75\n37 45\n44 86\n1 85\n13 33\n17 50\n12 26\n97 48\n52 40\n2 71\n95 79\n38 76\n24 54\n91 39\n97 92\n94 80\n50 61\n33 56\n22 91\n39 94\n31 56\n28 16\n20 44\n", "output": "tolik\n"}, {"type": "stdin_stdout", "input": "30\n53 12\n13...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array of integers $a$ of length $n$. The elements of the array can be either different or the same.\n\nEach element of the array is colored either blue or red. There are no unpainted elements in the array...
[{"type": "stdin_stdout", "input": "8\n4\n1 2 5 2\nBRBR\n2\n1 2\nBB\n5\n3 1 4 2 5\nBRRBR\n5\n4 1 3 1 4\nRBRRB\n5\n5 1 5 1 10\nRBRRA\n4\n2 2 2 2\nBRBR\n2\n1 -3\nBR\n4\n-2 -1 4 0\nRRRR\n", "output": "YES\nYES\nYES\nYES\nNO\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "8\n4\n1 2 5 2\nBRBR\n2\n1 2\nBB\n5\n3 1 4 2 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nD: Arrow / Arrow\n\nproblem\n\nrodea is in a one-dimensional coordinate system and stands at x = 0. From this position, throw an arrow of positive integer length that always moves at speed 1 towards the target at x = N. H...
[{"type": "stdin_stdout", "input": "11 1\n11\n1\n16", "output": "1\n"}, {"type": "stdin_stdout", "input": "11 1\n11\n1\n6", "output": "-1\n"}, {"type": "stdin_stdout", "input": "15 1\n3\n1\n2", "output": "13\n"}, {"type": "stdin_stdout", "input": "15 1\n6\n1\n5", "output": "10\n"}, {"type": "stdin_stdout", "input": "15...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven a set of $N$ axis-aligned rectangles in the plane, find the area of regions which are covered by at least one rectangle.\n\nConstraints\n\n* $ 1 \\leq N \\leq 2000 $\n* $ βˆ’10^9 \\leq x1_i < x2_i\\leq 10^9 $\n* $ βˆ’10...
[{"type": "stdin_stdout", "input": "4\n0 0 3 1\n-1 0 1 3\n-1 2 4 3\n3 0 3 3", "output": "11\n"}, {"type": "stdin_stdout", "input": "4\n0 0 3 1\n-1 0 1 3\n-1 0 4 3\n2 0 3 2", "output": "15\n"}, {"type": "stdin_stdout", "input": "4\n0 0 3 2\n-1 0 1 3\n-1 0 8 3\n2 0 3 2", "output": "27\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are three cells on an infinite 2-dimensional grid, labeled $A$, $B$, and $F$. Find the length of the shortest path from $A$ to $B$ if:\n\nin one move you can go to any of the four adjacent cells sharing a side;\n\nv...
[{"type": "stdin_stdout", "input": "7\n\n2 2\n0 3\n-1 2\n\n2 5\n2 2\n0 3\n\n1000 144\n1000 2\n1000 0000\n\n0 2\n3 10\n2 10\n\n0 13\n12 8\n2 10\n\n0 1\n4 1\n1 2\n\n2 413\n0 10\n1 0\n", "output": "3\n3\n142\n11\n17\n4\n405\n"}, {"type": "stdin_stdout", "input": "7\n\n2 2\n1 3\n-1 2\n\n2 5\n2 1\n2 3\n\n1000 144\n1000 1\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positione...
[{"type": "stdin_stdout", "input": "10894 92356\n", "output": "46178\n46179\n46177\n46180\n46176\n46181\n46175\n46182\n46174\n46183\n46173\n46184\n46172\n46185\n46171\n46186\n46170\n46187\n46169\n46188\n46168\n46189\n46167\n46190\n46166\n46191\n46165\n46192\n46164\n46193\n46163\n46194\n46162\n46195\n46161\n46196\n46160...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a rooted tree with vertices numerated from $1$ to $n$. A tree is a connected graph without cycles. A rooted tree has a special vertex named root.\n\nAncestors of the vertex $i$ are all vertices on the path f...
[{"type": "stdin_stdout", "input": "8\n2 1\n-1 0\n1 1\n1 1\n1 1\n4 0\n5 1\n7 1\n", "output": "1 3 5 7 8\n"}, {"type": "stdin_stdout", "input": "8\n2 1\n-1 0\n1 1\n1 1\n1 1\n4 0\n5 1\n7 0\n", "output": "1 3 5\n"}, {"type": "stdin_stdout", "input": "8\n2 1\n-1 0\n1 0\n1 1\n2 1\n4 0\n5 1\n7 1\n", "output": "5 7 8\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures.\nCity i is established in year Y_i and belongs to Prefecture P_i.\nYou can assume that there are no multiple citie...
[{"type": "stdin_stdout", "input": "75634 912\n18125 601244640\n58230 951349939\n4017 753730550\n23636 124912128\n45120 23758881\n51811 316477853\n19326 139861106\n48018 406348942\n68864 391719264\n1850 712458521\n2796 385027567\n12731 564315721\n43367 828330253\n30104 102450015\n64351 340641907\n19781 414658282\n53502...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProf. Hachioji has devised a new numeral system of integral numbers with four lowercase letters \"m\", \"c\", \"x\", \"i\" and with eight digits \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\". He doesn't use digit...
[{"type": "stdin_stdout", "input": "10\nxi x8i\ni 9i\nc2x2i 5c9x8i\nm2ci 4m7c9x8i\n8c9x8i i\ni 9m9c9x8i\nm i\ni m\nm9i i\n8m9c7xi c1x8i", "output": "2x9i\nx\n7c2x\n5m9c9x9i\n8c9x9i\n9m9c9x9i\nmi\nmi\nmx\n9m8x9i\n"}, {"type": "stdin_stdout", "input": "10\nxi x8i\ni 9i\nc2x3i 5c8x8i\nm2ci 4m7c9x8i\n9c8x9i i\ni 9m9c9x8i\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's solve the geometric problem\n\nMr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.\n\nFloating-point error is the error caused by th...
[{"type": "stdin_stdout", "input": "128 205", "output": "205\n"}, {"type": "stdin_stdout", "input": "110 161", "output": "161\n"}, {"type": "stdin_stdout", "input": "13 204", "output": "102\n"}, {"type": "stdin_stdout", "input": "11 251", "output": "251\n"}, {"type": "stdin_stdout", "input": "10 103", "output": "103\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are league games and tournament games in sports competitions. In soccer league games, points are given to each of the wins, losses, and draws, and the rankings are competed based on the points. The points are win (3...
[{"type": "stdin_stdout", "input": "4\nJapan 1 0 2\nEgypt 1 3 -1\nCanada 0 2 1\nSpain 1 0 1\n3\nJndia -1 2 0\nPoland 1 1 1\nItalx 1 -1 1\n0", "output": "Japan,5\nSpain,4\nEgypt,2\nCanada,1\n\nPoland,4\nItalx,4\nJndia,-3\n"}, {"type": "stdin_stdout", "input": "4\nnapaJ 1 0 0\nEgzpt 0 2 -1\naDaadn 0 2 3\nnibpS 2 0 0\n3\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRyouko is an extremely forgetful girl, she could even forget something that has just happened. So in order to remember, she takes a notebook with her, called Ryouko's Memory Note. She writes what she sees and what she hea...
[{"type": "stdin_stdout", "input": "100 100\n28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Romans have attacked again. This time they are much more than the Persians but Shapur is ready to defeat them. He says: \"A lion is never afraid of a hundred sheep\". \n\nNevertheless Shapur has to find weaknesses in ...
[{"type": "stdin_stdout", "input": "97\n800 771 66 126 231 306 981 96 196 229 253 35 903 739 461 962 979 347 152 424 934 586 225 838 103 178 524 400 156 149 560 629 697 417 717 738 181 430 611 513 754 595 847 464 356 640 24 854 138 481 98 371 142 460 194 288 220 41 999 581 441 407 301 651 271 226 457 393 980 166 272 25...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads a list of student test scores and evaluates the performance for each student.\n\nThe test scores for a student include scores of the midterm examination m (out of 50), the final examination f (...
[{"type": "stdin_stdout", "input": "92 101 -1\n16 30 -1\n0 2 -1\n-1 -1 -1", "output": "A\nD\nF\n"}, {"type": "stdin_stdout", "input": "150 64 -2\n16 30 -1\n1 0 -1\n-1 -1 -1", "output": "A\nD\nF\n"}, {"type": "stdin_stdout", "input": "116 100 -1\n16 50 -1\n1 1 0\n-1 -1 -1", "output": "A\nB\nF\n"}, {"type": "stdin_stdout...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have N lamps numbered 1 to N, and N buttons numbered 1 to N. Initially, Lamp 1, 2, \\cdots, A are on, and the other lamps are off.\n\nSnuke and Ringo will play the following game.\n\n* First, Ringo generates a permutat...
[{"type": "stdin_stdout", "input": "9479599 4999", "output": "395563313\n"}, {"type": "stdin_stdout", "input": "4734557 4999", "output": "743624188\n"}, {"type": "stdin_stdout", "input": "7100253 4999", "output": "2548353\n"}, {"type": "stdin_stdout", "input": "9999999 4999", "output": "90395416"}, {"type": "stdin_stdo...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSuppose that there are some light sources and many spherical balloons. All light sources have sizes small enough to be modeled as point light sources, and they emit light in all directions. The surfaces of the balloons ab...
[{"type": "stdin_stdout", "input": "12 5 4\n0 10 0 1\n1 3 0 2\n1 4 0 2\n0 0 0 2\n10 0 0 1\n3 -1 0 2\n5 -1 0 2\n10 10 0 15\n-1 -10 0 1\n10 -10 0 1\n-10 -10 0 1\n10 10 0 1\n0 10 0 240\n10 0 0 200\n10 -2 0 52\n-10 0 0 100\n1 0 0 2\n-1 1 0\n12 5 4\n0 10 0 1\n1 5 0 2\n1 4 0 2\n0 0 0 2\n10 0 0 1\n3 -1 0 2\n5 -1 0 2\n10 10 0 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp has n different binary words. A word called binary if it contains only characters '0' and '1'. For example, these words are binary: \"0001\", \"11\", \"0\" and \"0011100\".\n\nPolycarp wants to offer his set of n...
[{"type": "stdin_stdout", "input": "4\n4\n0001\n1000\n0011\n0111\n3\n010\n111\n0\n2\n00000\n00001\n4\n01\n001\n0001\n00001\n", "output": "1\n3\n-1\n0\n\n2\n1 2\n"}, {"type": "stdin_stdout", "input": "4\n4\n0001\n0000\n0011\n0111\n3\n010\n111\n1\n2\n00000\n00001\n4\n01\n001\n0001\n00001\n", "output": "1\n1\n-1\n0\n\n2\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNam is playing with a string on his computer. The string consists of n lowercase English letters. It is meaningless, so Nam decided to make the string more beautiful, that is to make it be a palindrome by using 4 arrow ke...
[{"type": "stdin_stdout", "input": "198 10\ntuxqalctjyegbvouezfiqoeoazizhmjhpcmvyvjkyrgxkeupwcmvzcosdrrfgtdmxwfttxjxsbaspjwftgpnvsfyfqsrmyjmypdwonbzwsftepwtjlgbilhcsqyfzfzrfvrvfqiwoemthwvqpvqnflqqspvqrnmvucnspexpijnivqpavqxjyucufculletaedlvut\n", "output": "695\n"}, {"type": "stdin_stdout", "input": "198 14\ntuxqalctjy...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are both a shop keeper and a shop assistant at a small nearby shop. You have $n$ goods, the $i$-th good costs $a_i$ coins.\n\nYou got tired of remembering the price of each product when customers ask for it, thus you ...
[{"type": "stdin_stdout", "input": "3\n5\n1 2 6 4 5\n3\n1 2 3\n2\n777 2131\n", "output": "4\n2\n1454\n"}, {"type": "stdin_stdout", "input": "3\n5\n1 2 3 4 5\n3\n1 2 3\n2\n777 1089\n", "output": "3\n2\n933\n"}, {"type": "stdin_stdout", "input": "3\n5\n1 2 6 4 5\n3\n1 2 3\n2\n777 1089\n", "output": "4\n2\n933\n"}, {"type...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day, Snuke was given a permutation of length N, a_1, a_2, ..., a_N, from his friend.\n\nFind the following:\n\n<image>\n\nConstraints\n\n* 1 ≦ N ≦ 200,000\n* (a_1, a_2, ..., a_N) is a permutation of (1, 2, ..., N).\n\...
[{"type": "stdin_stdout", "input": "8\n5 3 8 1 2 6 7 4", "output": "84\n"}, {"type": "stdin_stdout", "input": "8\n4 5 8 1 2 6 7 3", "output": "86\n"}, {"type": "stdin_stdout", "input": "8\n5 4 8 1 2 6 7 3", "output": "85"}, {"type": "stdin_stdout", "input": "4\n2 3 1 4", "output": "17\n"}, {"type": "stdin_stdout", "inp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer N. Among the divisors of N! (= 1 \\times 2 \\times ... \\times N), how many Shichi-Go numbers (literally \"Seven-Five numbers\") are there?\nHere, a Shichi-Go number is a positive integer that has...
[{"type": "stdin_stdout", "input": "100\n", "output": "543\n"}, {"type": "stdin_stdout", "input": "52\n", "output": "123\n"}, {"type": "stdin_stdout", "input": "54\n", "output": "131\n"}, {"type": "stdin_stdout", "input": "77\n", "output": "323\n"}, {"type": "stdin_stdout", "input": "78\n", "output": "324\n"}, {"type":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA team of students from the city S is sent to the All-Berland Olympiad in Informatics. Traditionally, they go on the train. All students have bought tickets in one carriage, consisting of n compartments (each compartment ...
[{"type": "stdin_stdout", "input": "200\n2 1 1 2 2 2 2 1 1 2 2 2 1 1 2 2 2 2 1 1 1 2 2 2 2 2 2 1 2 2 1 1 1 1 2 1 2 2 1 2 2 2 2 1 2 2 1 1 1 1 2 2 1 1 1 1 1 2 2 2 2 1 2 1 2 2 2 2 1 1 1 2 1 2 2 2 2 1 1 1 1 1 1 2 2 2 1 2 2 2 1 2 2 2 1 1 1 2 2 1 1 1 1 2 2 1 2 1 1 1 2 2 1 1 2 2 2 1 2 2 0 1 2 1 1 2 2 2 1 2 2 1 1 1 2 2 2 1 2 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn a company an emplopyee is paid as under: \nIf his basic salary is less than Rs. 1500, then HRA = 10% of base salary and DA = 90% of basic salary. \nIf his salary is either equal to or above Rs. 1500, then HRA = Rs. 500...
[{"type": "stdin_stdout", "input": "3\n1203\n10042\n1312", "output": "2406.00\n20383.16\n2624\n"}, {"type": "stdin_stdout", "input": "3 \n530\n4670\n1914", "output": "1060\n9746.6\n4289.72\n"}, {"type": "stdin_stdout", "input": "3 \n1203\n10042\n1312", "output": "2406\n20383.2\n2624\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp is a frequent user of the very popular messenger. He's chatting with his friends all the time. He has $n$ friends, numbered from $1$ to $n$.\n\nRecall that a permutation of size $n$ is an array of size $n$ such t...
[{"type": "stdin_stdout", "input": "100 100\n82 51 81 14 37 17 78 92 64 15 8 86 89 8 87 77 66 10 15 12 100 25 92 47 21 78 20 63 13 49 41 36 41 79 16 87 87 69 1 76 80 60 100 49 70 59 72 8 38 71 15 97 71 14 76 90 81 4 59 46 39 28 92 3 28 22 53 99 59 52 74 43 92 43 42 23 44 9 82 47 7 48 12 12 3 55 37 71 46 22 84 52 98 41 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAndrey received a postcard from Irina. It contained only the words \"Hello, Andrey!\", and a strange string consisting of lowercase Latin letters, snowflakes and candy canes. Andrey thought that this string is an encrypte...
[{"type": "stdin_stdout", "input": "uduzhzchjkaddukfwqngffblohjmqbgyfrzomuznircygatbxoyfxflurhoewioptyqlpoozlksyxrntwsqozghcamszlgeawisninpntpwpuemybjwmhwmpqkurkrnjzfoppmoopwrmpylvhtntghxkavveeyfmdqsvuqiflyemklnshfrtskmyhkbzhwmlaqcasjbw\n200\n", "output": "uduzhzchjkaddukfwqngffblohjmqbgyfrzomuznircygatbxoyfxflurhoewio...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDark is going to attend Motarack's birthday. Dark decided that the gift he is going to give to Motarack is an array $a$ of $n$ non-negative integers.\n\nDark created that array $1000$ years ago, so some elements in that a...
[{"type": "stdin_stdout", "input": "7\n5\n-1 3 -1 24 -1\n5\n-1 40 14 -1 35\n6\n-1 -1 6 -1 0 -1\n2\n-1 -1\n2\n0 -1\n4\n1 -1 3 -1\n7\n1 -1 7 10 0 0 10\n", "output": "11 13\n26 27\n3 3\n0 0\n0 0\n1 2\n10 4\n"}, {"type": "stdin_stdout", "input": "7\n5\n-1 10 -1 20 -1\n5\n-1 22 35 -1 35\n6\n-1 -1 9 -1 3 -1\n2\n-1 -1\n2\n0 -...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\nIf AtCoDe...
[{"type": "stdin_stdout", "input": "2\n-3 4 1\n111 4 -1", "output": "No\n"}, {"type": "stdin_stdout", "input": "2\n5 1 1\n100 1 1\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "2\n5 2 3\n100 0 0", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "2\n5 2 2\n100 1 -1", "output": "No\n"}, {"type": "stdin_s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEach of you probably has your personal experience of riding public transportation and buying tickets. After a person buys a ticket (which traditionally has an even number of digits), he usually checks whether the ticket i...
[{"type": "stdin_stdout", "input": "100\n11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100\n77183123282838...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMr. Chanek is currently participating in a science fair that is popular in town. He finds an exciting puzzle in the fair and wants to solve it.\n\nThere are $N$ atoms numbered from $1$ to $N$. These atoms are especially q...
[{"type": "stdin_stdout", "input": "6 1\n1 10 10 5 20 100\n1000000 1 10 10 100 1000000\n", "output": "144\n"}, {"type": "stdin_stdout", "input": "6 1\n1 10 10 20 5 100\n1000000 1 10 100 10 1000000\n", "output": "144\n"}, {"type": "stdin_stdout", "input": "6 1\n1 10 10 5 20 100\n1000000 1 10 10 100 1000000\n", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGeorge is a cat, so he really likes to play. Most of all he likes to play with his array of positive integers b. During the game, George modifies the array by using special changes. Let's mark George's current array as b_...
[{"type": "stdin_stdout", "input": "69756649467079322827497669450385938193725265564551073376856848456377282337192553343102536673046067874193973249293390979688852602950724884726382282903675659200865787042684264196306648305545290076062924087939978017987667847105325657080274323400258982046115892228300171243907466293917094...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is \"7 rows\" in the game using playing cards. Here we consider a game that simplifies it. Arrange 7 using 13 cards with numbers 1 to 13 written on each. In the match, the game progresses as follows with only two pl...
[{"type": "stdin_stdout", "input": "5\n1 2 3 4 5 6\n1 3 5 6 8 4\n1 2 3 4 6 8\n1 2 3 5 10 11\n1 3 3 6 9 11", "output": "yes\nyes\nyes\nyes\nno\n"}, {"type": "stdin_stdout", "input": "5\n1 2 3 4 5 10\n1 3 5 6 12 3\n1 2 3 4 6 8\n1 2 4 5 10 11\n1 4 2 6 9 5", "output": "no\nno\nyes\nyes\nyes\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian as well. \n\nVadim and Roman like discussing challenging problems with each other. One day Vadim told his friend following problem:\nGiven N points on a plane. Each...
[{"type": "stdin_stdout", "input": "2\n2\n2 -1\n2 0\n3\n-1 1\n-1 0\n-2 1", "output": "3\n0\n"}, {"type": "stdin_stdout", "input": "2\n2\n2 -1\n0 0\n3\n-1 1\n-1 0\n-2 1", "output": "3\n0\n"}, {"type": "stdin_stdout", "input": "2\n2\n0 2\n-1 -1\n3\n3 3\n0 -1\n1 3", "output": "3\n0\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n2 2\n1 2 0\n3 4 1\n\n\nOutput\n\n2\n\nThe input will be stdin and you should print your solution to stdout\n\n\nNow solve the problem and return the code.\n\nWrite Python code to solve this problem. Yo...
[{"type": "stdin_stdout", "input": "8 0\n-2 0 1\n12 2 12", "output": "680445551\n"}, {"type": "stdin_stdout", "input": "4 0\n-2 0 -1\n12 2 5", "output": "15400\n"}, {"type": "stdin_stdout", "input": "4 0\n-2 0 1\n12 2 10", "output": "15400\n"}, {"type": "stdin_stdout", "input": "4 0\n1 0 1\n9 -1 -1", "output": "15400\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis problem differs from the previous one only in the absence of the constraint on the equal length of all numbers $a_1, a_2, \\dots, a_n$.\n\nA team of SIS students is going to make a trip on a submarine. Their target i...
[{"type": "stdin_stdout", "input": "100\n463 6421 2912 1546 3999 5175 4357 2259 7380 6081 1148 7857 3532 4168 5643 8819 2568 6681 975 9216 4590 5217 6215 7422 6631 1651 39 4268 8290 2022 3175 8281 1552 980 9314 234 934 5133 6712 1880 2766 5042 5004 5455 6038 6010 6022 1553 4015 4544 3985 4033 223 7682 6302 2121 4832 39...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nChanek Jones is back, helping his long-lost relative Indiana Jones, to find a secret treasure in a maze buried below a desert full of illusions.\n\nThe map of the labyrinth forms a tree with n rooms numbered from 1 to n a...
[{"type": "stdin_stdout", "input": "4 4\n2 -1000 100 3\n2 1\n3 2\n4 1\n2 1 3\n2 2 2\n1 1 -1000000000\n2 1 4\n", "output": "2102\n0\n1000000003\n"}, {"type": "stdin_stdout", "input": "4 4\n2 -1000 100 3\n2 1\n3 2\n4 2\n2 1 3\n2 2 2\n1 1 -1000000000\n2 1 4\n", "output": "2102\n0\n1000002003\n"}, {"type": "stdin_stdout", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDr. Evil kidnapped Mahmoud and Ehab in the evil land because of their performance in the Evil Olympiad in Informatics (EOI). He decided to give them some problems to let them go.\n\nDr. Evil is interested in sets, He has ...
[{"type": "stdin_stdout", "input": "100 100\n58 88 12 71 22 1 40 19 73 20 67 48 57 17 69 36 100 35 33 37 72 55 52 8 89 85 47 42 78 70 81 86 11 9 68 99 6 16 21 61 53 98 23 62 32 59 51 0 87 24 50 30 65 10 80 95 7 92 25 74 60 79 91 5 13 31 75 38 90 94 46 66 93 34 14 41 28 2 76 84 43 96 3 56 49 82 27 77 64 63 4 45 18 29 54...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's call an undirected graph of n vertices p-interesting, if the following conditions fulfill: the graph contains exactly 2n + p edges; the graph doesn't contain self-loops and multiple edges; for any integer k (1 ≀...
[{"type": "stdin_stdout", "input": "5\n24 228\n24 228\n24 228\n24 228\n24 228\n", "output": "1 2\n1 3\n1 4\n1 5\n1 6\n1 7\n1 8\n1 9\n1 10\n1 11\n1 12\n1 13\n1 14\n1 15\n1 16\n1 17\n1 18\n1 19\n1 20\n1 21\n1 22\n1 23\n1 24\n2 3\n2 4\n2 5\n2 6\n2 7\n2 8\n2 9\n2 10\n2 11\n2 12\n2 13\n2 14\n2 15\n2 16\n2 17\n2 18\n2 19\n2 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nE869120 defined a sequence $a$ like this:\n\n\n* $a_1=a_2=1$, $a_{k+2}=a_{k+1}+a_k \\ (k \\ge 1)$\n\n\nHe also defined sequences $d_1, d_2, d_3, \\dots , d_n$, as the following recurrence relation :\n\n\n* $d_{1, j} = a_j...
[{"type": "stdin_stdout", "input": "42 102", "output": "184174004\n"}, {"type": "stdin_stdout", "input": "42 123", "output": "268300608\n"}, {"type": "stdin_stdout", "input": "46 123", "output": "960087486\n"}, {"type": "stdin_stdout", "input": "70 123", "output": "396400358\n"}, {"type": "stdin_stdout", "input": "42 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCowboy Beblop is a funny little boy who likes sitting at his computer. He somehow obtained two elastic hoops in the shape of 2D polygons, which are not necessarily convex. Since there's no gravity on his spaceship, the ho...
[{"type": "stdin_stdout", "input": "16\n0 1000 0\n436 1013 0\n509 517 0\n1000 500 0\n1000 1000 0\n1401 1028 0\n1434 461 0\n2086 442 0\n2079 1044 0\n2506 1032 0\n2549 450 0\n3077 446 0\n3063 1067 0\n3715 1062 0\n3756 -125 0\n0 0 0\n16\n-243 700 394\n109 700 365\n129 700 -366\n763 700 -366\n725 700 397\n1131 700 409\n117...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is on constraints. In this version constraints are higher. You can make hacks only if all versions of the problem are solved.\n\nKoa the Koala is at the beach!\n\nThe bea...
[{"type": "stdin_stdout", "input": "1\n100 5 4\n1 -2 -1 0 0 4 3 3 1 3 1 5 3 3 0 3 3 6 3 5 6 0 3 3 4 0 2 2 2 0 2 2 4 2 2 4 3 2 3 6 0 0 3 2 1 0 0 2 1 1 3 4 6 9 5 8 12 2 2 0 6 2 4 2 3 1 3 4 2 3 3 2 2 3 2 1 0 2 1 1 0 5 3 3 3 1 8 4 4 11 6 3 1 2 4 4 2 -1 -1 1\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1\n100 5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe conducted a survey on newspaper subscriptions. More specifically, we asked each of the N respondents the following two questions:\n\n* Question 1: Are you subscribing to Newspaper X?\n* Question 2: Are you subscribing ...
[{"type": "stdin_stdout", "input": "101 110 100", "output": "100 109\n"}, {"type": "stdin_stdout", "input": "100 110 100", "output": "100 110\n"}, {"type": "stdin_stdout", "input": "000 110 100", "output": "100 210\n"}, {"type": "stdin_stdout", "input": "000 100 100", "output": "100 200\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTunnel formula\n\nOne day while exploring an abandoned mine, you found a long formula S written in the mine. If you like large numbers, you decide to take out the choke and add `(` or `)` so that the result of the formula...
[{"type": "stdin_stdout", "input": "2-(2-3+4+5)", "output": "12\n"}, {"type": "stdin_stdout", "input": "3+(2-4-4+5)", "output": "10\n"}, {"type": "stdin_stdout", "input": "2-(2-3+4+6)", "output": "13\n"}, {"type": "stdin_stdout", "input": "3+(2-4-4+6)", "output": "11\n"}, {"type": "stdin_stdout", "input": "4-(2+5-0+2)"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a rectangular grid with $n$ rows and $m$ columns. The cell located on the $i$-th row from the top and the $j$-th column from the left has a value $a_{ij}$ written in it.\n\nYou can perform the following oper...
[{"type": "stdin_stdout", "input": "2\n2 2\n-1 1\n1 1\n3 4\n-1 -1 -2 -10\n0 -2 -5 -6\n-1 -3 -4 -5\n", "output": "2\n40\n"}, {"type": "stdin_stdout", "input": "2\n2 2\n-1 1\n1 1\n3 4\n-1 -1 -2 -3\n-1 -2 -3 -4\n-2 -1 -8 -5\n", "output": "2\n33\n"}, {"type": "stdin_stdout", "input": "2\n2 2\n-1 1\n1 1\n3 4\n-1 -1 -2 -3\n-...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nDen, the phone number of Ukunikia Co., Ltd., enters a very long phone number into the phone every day.\nOne day, too tired, Den came up with a surprising idea.\n\"Isn't it even a little easier if you rearrange ...
[{"type": "stdin_stdout", "input": "11\n129483884450", "output": "125\n694\n738\n"}, {"type": "stdin_stdout", "input": "11\n128935478480", "output": "123\n689\n745\n"}, {"type": "stdin_stdout", "input": "11\n18396312558", "output": "124\n857\n369\n"}, {"type": "stdin_stdout", "input": "11\n24764186449", "output": "318\...
code_stdio