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\nNavi is a counter strike pro. He always say how good he is at counter strike. After being tired of Navi, his friends decided to test his skills at shooting. They put M targets on a X-Y plane, each target is denoted by (X... | [{"type": "stdin_stdout", "input": "1\n3 3 5\n-1 1\n2 1\n3 0\n1 0\n-1 0\n4 0\n\nSAMPLF", "output": "YES\n"}, {"type": "stdin_stdout", "input": "1\n3 3 5\n1 1\n2 2\n3 0\n2 0\n-1 -1\n2 0\n\nSAMPLF", "output": "YES\n"}, {"type": "stdin_stdout", "input": "1\n3 3 5\n1 1\n2 2\n3 0\n4 0\n-1 -1\n2 0\n\nSAMPLF", "output": "YES\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRanjan came to know about competitive programming today and created an \naccount on Hackerearth.\n\nWith his full determination he started to solve his first problem.\nHe saw a question stated as.\n\nCalculate the sum of ... | [{"type": "stdin_stdout", "input": "3000\n8786 8705\n8419 7334\n8091 7406\n9692 8580\n2185 1951\n9195 8840\n1469 1159\n9424 2726\n9847 945\n8894 7210\n8680 6646\n9303 2351\n3298 1409\n6306 1275\n9130 8907\n8654 6048\n9652 9408\n9813 9686\n8678 742\n9955 1422\n8401 7395\n8562 4408\n7556 6839\n6595 5439\n6136 4626\n9629 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nN Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town.\n\nThere are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \\cd... | [{"type": "stdin_stdout", "input": "23 -3\n0\n1 0\n-1\n-1", "output": "23\n"}, {"type": "stdin_stdout", "input": "12 -2\n1\n-1 0\n0\n-1", "output": "12\n"}, {"type": "stdin_stdout", "input": "12 -2\n0\n-1 0\n0\n-1", "output": "12\n"}, {"type": "stdin_stdout", "input": "12 -2\n0\n-1 0\n0\n-2", "output": "12\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\n* S and T are strings consisting of low... | [{"type": "stdin_stdout", "input": "gumu humu", "output": "humugumu\n"}, {"type": "stdin_stdout", "input": "gumt humu", "output": "humugumt\n"}, {"type": "stdin_stdout", "input": "gums humu", "output": "humugums\n"}, {"type": "stdin_stdout", "input": "gums muhu", "output": "muhugums\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.\n\nFor each square, you will perform either of the following operations once:\n\n* Decrease the height of the s... | [{"type": "stdin_stdout", "input": "1\n1000010000", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1\n1000011000", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1\n1000011100", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1\n1000001100", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke has an empty sequence a.\n\nHe will perform N operations on this sequence.\n\nIn the i-th operation, he chooses an integer j satisfying 1 \\leq j \\leq i, and insert j at position j in a (the beginning is position 1... | [{"type": "stdin_stdout", "input": "9\n1 1 1 1 2 1 2 3 2", "output": "1\n2\n2\n3\n1\n2\n1\n1\n1\n"}, {"type": "stdin_stdout", "input": "9\n1 1 1 2 1 1 2 3 2", "output": "1\n2\n2\n3\n1\n1\n2\n1\n1\n"}, {"type": "stdin_stdout", "input": "9\n1 1 1 1 2 1 4 3 2", "output": "1\n2\n1\n3\n2\n4\n1\n1\n1\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are 2N points evenly spaced on the circumference of a circle. These points are numbered 1 to 2N in clockwise order, starting from some of them.\n\nSnuke will divide these points into N pairs, then for each pair, he ... | [{"type": "stdin_stdout", "input": "20 10\n10 18\n11 17\n14 7\n4 5\n30 28\n19 24\n29 22\n25 32\n38 34\n36 39", "output": "681816493\n"}, {"type": "stdin_stdout", "input": "20 10\n10 18\n21 17\n14 7\n4 5\n30 28\n19 24\n29 22\n25 32\n38 34\n36 39", "output": "676141768\n"}, {"type": "stdin_stdout", "input": "20 10\n10 18... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string S of length 3 consisting of `a`, `b` and `c`. Determine if S can be obtained by permuting `abc`.\n\nConstraints\n\n* |S|=3\n* S consists of `a`, `b` and `c`.\n\nInput\n\nInput is given from Standard... | [{"type": "stdin_stdout", "input": "cab", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "acb", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "cba", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "bca", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "abc", "output": "Yes"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi is now competing in a programming contest, but he received TLE in a problem where the answer is `YES` or `NO`.\n\nWhen he checked the detailed status of the submission, there were N test cases in the problem, an... | [{"type": "stdin_stdout", "input": "5 13", "output": "195788800\n"}, {"type": "stdin_stdout", "input": "3 10", "output": "18739200\n"}, {"type": "stdin_stdout", "input": "10 7", "output": "1740800\n"}, {"type": "stdin_stdout", "input": "110 5", "output": "640000\n"}, {"type": "stdin_stdout", "input": "15 7", "output": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are?\n\nConstraints\n\n* 1 ≤ N,A,B ≤ 10^9\n* A and B are ... | [{"type": "stdin_stdout", "input": "13 -10 2", "output": "133\n"}, {"type": "stdin_stdout", "input": "125 -2 0", "output": "247\n"}, {"type": "stdin_stdout", "input": "109 0 1", "output": "108\n"}, {"type": "stdin_stdout", "input": "109 0 2", "output": "215\n"}, {"type": "stdin_stdout", "input": "19 -7 -2", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke is going to open a contest named \"AtCoder s Contest\". Here, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase En... | [{"type": "stdin_stdout", "input": "AtCoder Befinner Contest", "output": "ABC\n"}, {"type": "stdin_stdout", "input": "AtCoder sennifeB Cpntest", "output": "AsC\n"}, {"type": "stdin_stdout", "input": "AtCoder rennigeB Contest", "output": "ArC\n"}, {"type": "stdin_stdout", "input": "AtCoder Aeifnnes Cpnsest", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven a string t, we will call it unbalanced if and only if the length of t is at least 2, and more than half of the letters in t are the same. For example, both `voodoo` and `melee` are unbalanced, while neither `noon` n... | [{"type": "stdin_stdout", "input": "aoctder", "output": "-1 -1\n"}, {"type": "stdin_stdout", "input": "aecteop", "output": "-1 -1\n"}, {"type": "stdin_stdout", "input": "actoder", "output": "-1 -1\n"}, {"type": "stdin_stdout", "input": "aocuder", "output": "-1 -1\n"}, {"type": "stdin_stdout", "input": "aecueor", "outpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game current... | [{"type": "stdin_stdout", "input": "3 3\nR G B\nG G G\nG B B\n2 4\nR G\nG G\nR B\nB R\n4 3\nF G B R\nG R R G\nB G G R\n0 0", "output": "2\n4\n5\n"}, {"type": "stdin_stdout", "input": "3 3\nR G B\nG G G\nG B B\n2 4\nS G\nG G\nR B\nB R\n4 3\nG G B R\nG R R G\nB G G R\n0 0", "output": "2\n4\n4\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCreate a program that converts data based on the given conversion table.\n\nThe characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters... | [{"type": "stdin_stdout", "input": "3\nA a\n0 5\n5 4\n10\nB\nB\nC\n0\n1\n4\n5\na\nb\nA\n3\nA a\n0 5\n5 4\n10\nA\nB\nC\n0\n1\n4\n5\na\nb\nA\n0", "output": "BBC5144aba\naBC5144aba\n"}, {"type": "stdin_stdout", "input": "3\nA a\n0 0\n5 4\n10\nB\nB\nC\n0\n1\n4\n5\na\nb\nA\n3\nA a\n0 5\n5 4\n10\nA\nB\nC\n0\n1\n4\n5\na\nb\nA... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTokyo has a very complex railway system. For example, there exists a partial map of lines and stations as shown in Figure D-1.\n\n<image>\n\nFigure D-1: A sample railway network\n\n\nSuppose you are going to station D fro... | [{"type": "stdin_stdout", "input": "4 4 2 1 4\n1 2 2 1\n3 3 2 1\n3 1 5 1\n2 4 4 2\n3 1\n3 11\n10 5 3\n\n10\n2 0 1 1 2\n1\n\n1\n4 5 2 4 1\n4 3 10 1\n3 2 2 1\n3 4 1 2\n3 2 5 2\n2 1 10 1\n3 3\n20 30\n3 2 1\n5 10\n4 2 1\n5 5 2 1 5\n2 2 10 2\n1 3 20 2\n1 4 32 1\n3 4 10 1\n4 5 20 1\n2 2\n20\n10 1\n20\n3 1\n0 0 0 0 0", "outpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts... | [{"type": "stdin_stdout", "input": "5 7\nRRCABXT\nAABMFAB\nRROMJAC\nAPTADAB\nYABADAO\n3 13\nABCDEFGHIJKLM\nYMADAMIMADAMY\nACEGIKMOQSUWY\n3 4\nDEFG\nACAB\nHIJK\n3 6\nFEDCB@\nHHIAKL\nMNOPQR\n10 19\nJFZODYDXMZZPEYTRNCW\nXVGHPOKEYNZTQFZJKOD\nEYEHHQKHFZOVNRGOOLP\nQFZOIHRQMGHPNISHXOC\nDRGILJHSQEHHQLYTILL\nNCSHQMKHTZZIHRPAUJA... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHint\n\nIn solving this problem, the following may be referred to. Shows how to convert an integer value to a string. Assign value as a string to str.\n\nFor C\n\n\ninclude <stdio.h>\n\nint main () {\nint value = 123; // ... | [{"type": "stdin_stdout", "input": "6 101\n111 101 101 101 001 101 101 001 101 101", "output": "444444\n"}, {"type": "stdin_stdout", "input": "5 100\n101 101 101 101 001 101 101 101 101 101", "output": "44444\n"}, {"type": "stdin_stdout", "input": "5 100\n101 101 101 101 101 101 001 101 101 101", "output": "66666\n"}, ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou built an apartment. The apartment has a water tank with a capacity of L in order to store water for the residents. The tank works as a buffer between the water company and the residents.\n\nIt is required to keep the ... | [{"type": "stdin_stdout", "input": "1 000\n0 86400 1\n1 110\n135105 86400 1\n0 0", "output": "1.0000000000\n0.0000000000\n"}, {"type": "stdin_stdout", "input": "1 101\n0 86400 2\n1 000\n68972 86400 -2\n0 0", "output": "2.0000000000\n0.0000000000\n"}, {"type": "stdin_stdout", "input": "1 100\n1 29656 1\n1 100\n111003 86... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem Statement\n\nMr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and does not have much money. Therefore, he is trying to save money by using the Seishun 18 Ticket. With only ... | [{"type": "stdin_stdout", "input": "8 24\n05:30 Kyoto 06:37 Maibara\n06:50 Maibara 07:36 Tsuruga\n07:42 Tsuruga 10:03 Kanazawa\n10:58 Kanazawa 12:07 Toyama\n12:15 Toyama 14:12 Naoetsu\n14:29 Noaetsu 15:57 Nagaoka\n16:11 Nagaoka 17:14 Niitsu\n17:38 Niitsu 20:06 AizuWakamatsu", "output": "2\nKanazawa 55\nNiitsu 24\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA: Hokkaido University Easy\n\nNote\n\nPlease note that the problem settings are the same as problem B, except for the constraints.\n\nstory\n\nHomura-chan, who passed Hokkaido University and is excited about the beginnin... | [{"type": "stdin_stdout", "input": "3 3\nA.B\n..B\n.BB", "output": "3\n"}, {"type": "stdin_stdout", "input": "3 3\nB.B\n..B\n-BB", "output": "4\n"}, {"type": "stdin_stdout", "input": "1 3\nAB.\n.B.\n.BB", "output": "0\n"}, {"type": "stdin_stdout", "input": "3 3\nA.B\nA..\n.CB", "output": "2\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which manipulates a sequence A = {a0, a1, . . . , an−1} with the following operations:\n\n* update(s, t, x): change as, as+1, ..., at to x.\n* find(i): output the value of ai.\n\n\n\nNote that the initial ... | [{"type": "stdin_stdout", "input": "9 5\n1 0 1 1\n1 1 4 3\n0 0 2 2\n0 1\n1 1", "output": "2147483647\n2147483647\n2147483647\n2147483647\n"}, {"type": "stdin_stdout", "input": "9 5\n1 0 1 1\n1 0 4 3\n0 0 2 2\n0 1\n1 1", "output": "2147483647\n2147483647\n2147483647\n2147483647\n"}, {"type": "stdin_stdout", "input": "9 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Head Chef is receiving a lot of orders for cooking the best of the problems lately. For this, he organized an hiring event to hire some talented Chefs. He gave the following problem to test the skills of the participa... | [{"type": "stdin_stdout", "input": "2\n1\n210", "output": "0\n2628\n"}, {"type": "stdin_stdout", "input": "2\n1\n198", "output": "0\n2484\n"}, {"type": "stdin_stdout", "input": "2\n1\n175", "output": "0\n2288\n"}, {"type": "stdin_stdout", "input": "2\n2\n175", "output": "2\n2288\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIvan is collecting coins. There are only N different collectible coins, Ivan has K of them. He will be celebrating his birthday soon, so all his M freinds decided to gift him coins. They all agreed to three terms: \n\n *... | [{"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000 1000010000000000000 1000000000000000000\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "10000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs a German University in Cairo (GUC) student and a basketball player, Herr Wafa was delighted once he heard the news. GUC is finally participating in the Annual Basketball Competition (ABC). \n\nA team is to be formed of... | [{"type": "stdin_stdout", "input": "65 173 136\n26 18 8 11 1 22 44 6 15 22 13 49 30 36 37 41 25 27 9 36 36 1 45 20 7 47 28 30 30 21 33 32 9 11 16 5 19 12 44 40 25 40 32 36 15 34 4 43 28 19 29 33 7 11 18 13 40 18 10 26 1 48 20 38 1 20 34 8 46 8 32 35 16 49 26 36 11 16 4 29 35 44 14 21 22 42 10 1 3 12 35 30 14 45 2 24 32... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's denote a function f(x) in such a way: we add 1 to x, then, while there is at least one trailing zero in the resulting number, we remove that zero. For example, \n\n * f(599) = 6: 599 + 1 = 600 → 60 → 6; \n * f(7) ... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "91\n"}, {"type": "stdin_stdout", "input": "1472811722\n", "output": "57\n"}, {"type": "stdin_stdout", "input": "1660033091\n", "output": "63\n"}, {"type": "stdin_stdout", "input": "1100000000\n", "output": "90\n"}, {"type": "stdin_stdout", "input": "15164332... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis morning Tolik has understood that while he was sleeping he had invented an incredible problem which will be a perfect fit for Codeforces! But, as a \"Discuss tasks\" project hasn't been born yet (in English, well), h... | [{"type": "stdin_stdout", "input": "812 19\n", "output": "1 1\n812 19\n1 2\n812 18\n1 3\n812 17\n1 4\n812 16\n1 5\n812 15\n1 6\n812 14\n1 7\n812 13\n1 8\n812 12\n1 9\n812 11\n1 10\n812 10\n1 11\n812 9\n1 12\n812 8\n1 13\n812 7\n1 14\n812 6\n1 15\n812 5\n1 16\n812 4\n1 17\n812 3\n1 18\n812 2\n1 19\n812 1\n2 1\n811 19\n2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a_1, a_2, ... , a_n and two integers m and k.\n\nYou can choose some subarray a_l, a_{l+1}, ..., a_{r-1}, a_r. \n\nThe cost of subarray a_l, a_{l+1}, ..., a_{r-1}, a_r is equal to ∑_{i=l}^{r} a_i - ... | [{"type": "stdin_stdout", "input": "44 2 531595322\n926215961 -385821837 -278841122 -422772006 -509196878 -81824369 -101501043 -33095577 -520514931 402836017 48602657 881104200 -110528684 52550046 -208588735 -814534121 -548420443 410430115 -636402169 -848516069 -70639158 775203498 -679440929 -427359667 33598904 6568726... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt's Petya's birthday party and his friends have presented him a brand new \"Electrician-n\" construction set, which they are sure he will enjoy as he always does with weird puzzles they give him.\n\nConstruction set \"El... | [{"type": "stdin_stdout", "input": "100\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n", "output": "65 199\n199 197\n197 195\n195 193\n193 191\n191 189\n189 187\n18... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day in the IT lesson Anna and Maria learned about the lexicographic order.\n\nString x is lexicographically less than string y, if either x is a prefix of y (and x ≠ y), or there exists such i (1 ≤ i ≤ min(|x|, |y|)),... | [{"type": "stdin_stdout", "input": "hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhihhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two strings s and t, each of length n and consisting of lowercase Latin alphabets. You want to make s equal to t. \n\nYou can perform the following operation on s any number of times to achieve it — \n\n * ... | [{"type": "stdin_stdout", "input": "16\n3\naaa\naaa\n3\nabb\naab\n3\naab\nbaa\n3\naab\naba\n3\naca\naba\n3\naba\nbaa\n3\naba\naab\n3\nabb\nabb\n3\nabb\nbab\n3\nabb\nbba\n3\nabc\nabc\n3\ncba\nbad\n3\nabc\ndab\n3\nabc\nacb\n3\ncba\ncba\n3\nabc\nbca\n", "output": "0\n-1\n1\n1\n-1\n1\n1\n0\n1\n2\n0\n-1\n-1\n1\n0\n2\n"}, {"... | 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 lower. You can make hacks only if all versions of the problem are solved.\n\nKoa the Koala is at the beach!\n\nThe beac... | [{"type": "stdin_stdout", "input": "32\n3 1 3\n2 2 1\n3 1 3\n2 2 2\n3 1 3\n2 2 3\n3 1 3\n2 3 1\n3 1 3\n2 3 2\n3 1 3\n2 3 3\n3 1 3\n3 1 1\n3 1 3\n3 1 2\n3 1 3\n3 1 3\n3 1 3\n3 2 1\n3 1 3\n3 2 2\n3 1 3\n3 2 3\n3 1 3\n3 3 1\n3 1 3\n3 3 2\n3 1 3\n3 3 3\n3 2 1\n1 1 1\n3 2 1\n1 1 2\n3 2 1\n1 1 3\n3 2 1\n1 2 1\n3 2 1\n1 2 2\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA bitstring is a string consisting only of the characters 0 and 1. A bitstring is called k-balanced if every substring of size k of this bitstring has an equal amount of 0 and 1 characters (k/2 of each).\n\nYou are given ... | [{"type": "stdin_stdout", "input": "9\n6 4\n100110\n3 2\n1?1\n3 2\n1?0\n4 4\n????\n7 4\n1?0??1?\n10 10\n11??11??11\n4 4\n1??1\n4 4\n?0?0\n6 2\n????00\n", "output": "YES\nYES\nNO\nYES\nYES\nNO\nYES\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "9\n6 4\n100110\n3 2\n1?1\n3 2\n0?1\n4 4\n????\n7 4\n1?0??1?\n10 10\n11???1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob have decided to play the game \"Rock, Paper, Scissors\". \n\nThe game consists of several rounds, each round is independent of each other. In each round, both players show one of the following things at the ... | [{"type": "stdin_stdout", "input": "1000000000\n156489182 145117627 698393191\n584283682 217785715 197930603\n", "output": "282676873 885890491\n"}, {"type": "stdin_stdout", "input": "931934723\n512340462 202375672 217218589\n24862054 655510760 251561909\n", "output": "235916499 739578188\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA country called Berland consists of n cities, numbered with integer numbers from 1 to n. Some of them are connected by bidirectional roads. Each road has some length. There is a path from each city to any other one by th... | [{"type": "stdin_stdout", "input": "10 45 9\n2 1 428\n3 1 610\n3 2 357\n4 1 855\n4 2 528\n4 3 508\n5 1 425\n5 2 185\n5 3 349\n5 4 845\n6 1 206\n6 2 969\n6 3 153\n6 4 854\n6 5 640\n7 1 87\n7 2 250\n7 3 953\n7 4 456\n7 5 742\n7 6 588\n8 1 641\n8 2 898\n8 3 396\n8 4 960\n8 5 654\n8 6 410\n8 7 640\n9 1 707\n9 2 707\n9 3 70... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a program that consists of n instructions. Initially a single variable x is assigned to 0. Afterwards, the instructions are of two types: \n\n * increase x by 1; \n * decrease x by 1. \n\n\n\nYou are given... | [{"type": "stdin_stdout", "input": "2\n8 4\n-+--+--+\n1 8\n2 8\n2 5\n1 1\n4 10\n+-++\n1 1\n1 2\n2 2\n1 3\n2 3\n3 3\n1 4\n2 4\n3 4\n4 4\n", "output": "\n1\n2\n4\n4\n3\n3\n4\n2\n3\n2\n1\n2\n2\n2\n"}, {"type": "stdin_stdout", "input": "2\n8 4\n-+--+--+\n2 8\n2 8\n2 5\n1 1\n4 10\n+-++\n1 1\n1 2\n2 2\n1 3\n2 3\n3 3\n1 4\n2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer k and an undirected tree, consisting of n vertices.\n\nThe length of a simple path (a path in which each vertex appears at most once) between some pair of vertices is the number of edges in this p... | [{"type": "stdin_stdout", "input": "20 2\n3 14\n13 1\n4 3\n13 5\n12 20\n19 12\n6 3\n12 15\n11 2\n11 17\n9 5\n19 7\n6 11\n17 5\n16 18\n16 7\n12 8\n19 11\n16 10\n", "output": "122844\n"}, {"type": "stdin_stdout", "input": "20 2\n6 14\n13 1\n4 3\n13 5\n12 20\n19 12\n6 3\n12 15\n11 2\n11 17\n9 5\n19 7\n6 11\n17 5\n16 18\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's call an integer array a_1, a_2, ..., a_n good if a_i ≠ i for each i.\n\nLet F(a) be the number of pairs (i, j) (1 ≤ i < j ≤ n) such that a_i + a_j = i + j.\n\nLet's say that an array a_1, a_2, ..., a_n is excellent ... | [{"type": "stdin_stdout", "input": "10\n20000 -431912570 597469643\n20000 -13928452 414987414\n20000 -472808872 367983694\n20000 -84913058 517394906\n20000 -514402152 597357115\n20000 -720971736 526102810\n20000 -416160739 748291750\n20000 -665939649 743938438\n20000 -80741314 634025883\n20000 -824743396 138091345\n", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Little Elephant has array a, consisting of n positive integers, indexed from 1 to n. Let's denote the number with index i as ai.\n\nThe Little Elephant wants to count, how many pairs of integers l and r are there, suc... | [{"type": "stdin_stdout", "input": "100 25\n457 226 629 226 147 284 72 23 247 76 972 829 173 591 581 373 533 474 521 219 181 278 890 27 345 478 595 678 971 157 776 156 970 955 584 786 692 774 228 459 118 419 671 24 128 76 677 66 923 800 870 124 420 528 609 131 88 118 19 807 288 973 896 305 268 486 830 149 529 399 894 7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarpus is a system administrator. There are two servers under his strict guidance — a and b. To stay informed about the servers' performance, Polycarpus executes commands \"ping a\" and \"ping b\". Each ping command s... | [{"type": "stdin_stdout", "input": "14\n1 7 3\n1 0 10\n1 7 3\n1 1 9\n2 2 8\n2 0 10\n1 1 9\n2 8 2\n2 6 4\n1 3 7\n1 3 7\n2 6 4\n2 1 9\n2 7 3\n", "output": "DEAD\nDEAD\n"}, {"type": "stdin_stdout", "input": "14\n1 5 3\n1 0 10\n1 7 3\n1 1 9\n2 2 8\n2 0 10\n1 1 9\n2 8 2\n2 6 4\n1 3 7\n1 3 7\n2 6 4\n2 1 9\n2 7 3\n", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs a big fan of Formula One, Charlie is really happy with the fact that he has to organize ticket sells for the next Grand Prix race in his own city. Unfortunately, the finacial crisis is striking everywhere and all the b... | [{"type": "stdin_stdout", "input": "100000 100000 1\n", "output": "3.999900002193968e-05\n"}, {"type": "stdin_stdout", "input": "15566 14608 0\n", "output": "0.061604676559388505\n"}, {"type": "stdin_stdout", "input": "100000 100000 10\n", "output": "0.00120926220494\n"}, {"type": "stdin_stdout", "input": "100000 10000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYaroslav, Andrey and Roman can play cubes for hours and hours. But the game is for three, so when Roman doesn't show up, Yaroslav and Andrey play another game. \n\nRoman leaves a word for each of them. Each word consists ... | [{"type": "stdin_stdout", "input": "10\n00000000000111111111\n00000000011111111111\n", "output": "Draw\n"}, {"type": "stdin_stdout", "input": "4\n01100000\n10010011\n", "output": "Second\n"}, {"type": "stdin_stdout", "input": "4\n01111000\n11111010\n", "output": "Second\n"}, {"type": "stdin_stdout", "input": "4\n010101... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIahub recently has learned Bubble Sort, an algorithm that is used to sort a permutation with n elements a1, a2, ..., an in ascending order. He is bored of this so simple algorithm, so he invents his own graph. The graph (... | [{"type": "stdin_stdout", "input": "100\n36 48 92 87 28 85 42 10 44 41 39 3 79 9 14 56 1 16 46 35 93 8 82 26 100 59 60 2 96 52 13 98 70 81 71 94 54 91 17 88 33 30 19 50 18 73 65 29 78 21 61 7 99 97 45 89 57 27 76 11 49 72 84 69 43 62 4 22 75 6 66 83 38 34 86 15 40 51 37 74 67 31 20 63 77 80 12 53 5 25 58 90 68 24 64 23... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe clique problem is one of the most well-known NP-complete problems. Under some simplification it can be formulated as follows. Consider an undirected graph G. It is required to find a subset of vertices C of the maximu... | [{"type": "stdin_stdout", "input": "12\n66 4\n12 7\n60 1\n24 4\n48 4\n-1 4\n36 4\n30 4\n6 4\n54 4\n42 2\n18 4\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "12\n67 4\n12 7\n60 1\n24 4\n48 4\n-1 4\n36 4\n30 4\n6 4\n54 4\n42 2\n18 4\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "12\n67 8\n12 7\n60 1\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLuke Skywalker got locked up in a rubbish shredder between two presses. R2D2 is already working on his rescue, but Luke needs to stay alive as long as possible. For simplicity we will assume that everything happens on a s... | [{"type": "stdin_stdout", "input": "9999 10000 10000 10010\n", "output": "4.9975012493753125e-05\n"}, {"type": "stdin_stdout", "input": "2173 2176 10001 9989\n", "output": "0.00015007503751875937\n"}, {"type": "stdin_stdout", "input": "9999 10000 10000 10000\n", "output": "0.000050000000000 \n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt was recycling day in Kekoland. To celebrate it Adil and Bera went to Central Perk where they can take bottles from the ground and put them into a recycling bin.\n\nWe can think Central Perk as coordinate plane. There a... | [{"type": "stdin_stdout", "input": "235810013 344493922 0 0 975204641 211157253\n18\n977686151 621301932\n408277582 166435161\n595105725 194278844\n967498841 705149530\n551735395 659209387\n492239556 317614998\n741520864 843275770\n585383143 903832112\n272581169 285871890\n339100580 134101148\n920610054 824829107\n6579... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs we all know Barney's job is \"PLEASE\" and he has not much to do at work. That's why he started playing \"cups and key\". In this game there are three identical cups arranged in a line from left to right. Initially key... | [{"type": "stdin_stdout", "input": "12\n254904759290707697 475737283258450340 533306428548398547 442127134828578937 779740159015946254 272877594683860919 93000149670491971 349640818793278778 498293278222136720 551099726729989816 149940343283925029 1677751211246811281\n", "output": "144527324/433581971\n"}, {"type": "st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya plays the LionAge II. He was bored of playing with a stupid computer, so he installed this popular MMORPG, to fight with his friends. Vasya came up with the name of his character — non-empty string s, consisting of ... | [{"type": "stdin_stdout", "input": "emrvvhupytoxzhqxmuop 1\n49\ng g -558\nd g 845\nd k -745\nb g -773\nf f -733\nb s -491\na s -894\ng d -565\ns k -756\nb a 373\nb d 398\nk f 250\na b 531\nf g -27\nf b 125\na g -555\ns f 540\ng b 194\nk s -636\ns b -955\nd a -520\ng f -97\nf s -204\ns a 171\nb k -304\ns g -160\na a -56... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEach New Year Timofey and his friends cut down a tree of n vertices and bring it home. After that they paint all the n its vertices, so that the i-th vertex gets color ci.\n\nNow it's time for Timofey birthday, and his mo... | [{"type": "stdin_stdout", "input": "10\n5 7\n4 5\n10 2\n3 6\n1 2\n3 4\n8 5\n4 9\n2 3\n15 15 15 15 5 15 26 18 15 15\n", "output": "YES\n5\n"}, {"type": "stdin_stdout", "input": "10\n5 7\n1 5\n10 2\n3 6\n1 2\n3 4\n8 5\n4 9\n2 3\n15 15 15 15 5 15 26 18 15 15\n", "output": "YES\n5\n"}, {"type": "stdin_stdout", "input": "10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt's been almost a week since Polycarp couldn't get rid of insomnia. And as you may already know, one week in Berland lasts k days!\n\nWhen Polycarp went to a doctor with his problem, the doctor asked him about his sleepi... | [{"type": "stdin_stdout", "input": "10 5\n1384 1129 1780 1960 1567 1928 12 1523 1165 344\n", "output": "6931.333333333333030"}, {"type": "stdin_stdout", "input": "10 4\n127 1459 718 1183 880 1044 1857 1340 725 1496\n", "output": "4574.428571428571558"}, {"type": "stdin_stdout", "input": "10 8\n127 1459 718 1183 880 104... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nn people are standing on a coordinate axis in points with positive integer coordinates strictly less than 106. For each person we know in which direction (left or right) he is facing, and his maximum speed.\n\nYou can put... | [{"type": "stdin_stdout", "input": "26 10\n495492 7 1\n256604 5 2\n511773 3 2\n590712 4 1\n206826 7 2\n817878 4 2\n843915 1 1\n349160 3 1\n351298 4 1\n782251 8 2\n910928 4 1\n662354 4 2\n468621 2 2\n466991 7 2\n787303 6 2\n221623 8 2\n343518 6 1\n141123 7 1\n24725 6 1\n896603 3 2\n918129 8 2\n706071 6 2\n512369 2 2\n60... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHelen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.\n\nMetropolis airpo... | [{"type": "stdin_stdout", "input": "10 6\n2226 89307 11261 28772 23196 30298 10832 43119 74662 24028\n", "output": "1246672\n16 7 14 11 13 10 15 8 9 12\n"}, {"type": "stdin_stdout", "input": "10 5\n66220 81797 38439 54881 86879 94346 8802 59094 57095 41949\n", "output": "2484818\n9 8 14 12 7 6 15 10 11 13\n"}, {"type":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDanil decided to earn some money, so he had found a part-time job. The interview have went well, so now he is a light switcher.\n\nDanil works in a rooted tree (undirected connected acyclic graph) with n vertices, vertex ... | [{"type": "stdin_stdout", "input": "10\n1 1 3 1 3 1 4 6 3\n0 1 1 1 1 1 1 1 0 0\n10\nget 9\nget 10\nget 4\nget 5\nget 5\nget 5\nget 10\nget 7\nget 5\nget 2\n", "output": "0\n0\n2\n1\n1\n1\n0\n1\n1\n1\n"}, {"type": "stdin_stdout", "input": "10\n1 1 3 1 3 1 4 6 3\n0 1 1 1 1 1 1 1 1 0\n10\nget 9\nget 10\nget 4\nget 5\nget ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice has a string consisting of characters 'A', 'B' and 'C'. Bob can use the following transitions on any substring of our string in any order any number of times: \n\n * A <image> BC\n * B <image> AC\n * C <image> AB... | [{"type": "stdin_stdout", "input": "AAAAAA\nAAAAAA\n30\n3 4 1 2\n3 3 4 4\n5 6 3 4\n3 3 2 3\n5 6 1 5\n2 4 4 6\n1 6 2 5\n6 6 3 4\n3 5 1 4\n4 5 3 6\n2 3 2 4\n3 4 4 4\n6 6 4 6\n3 3 2 5\n1 5 3 3\n4 6 1 2\n6 6 6 6\n3 3 3 4\n6 6 6 6\n5 6 4 4\n6 6 5 5\n2 3 1 4\n3 6 4 5\n3 5 6 6\n4 5 2 6\n5 6 6 6\n1 4 2 5\n4 5 2 5\n4 5 1 3\n2 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.\n\nThe three frie... | [{"type": "stdin_stdout", "input": "727\nbaabbabbbababbbbaaaabaabbaabababaaababaaababbbbababbbbbbbbbbaaabaabbbbbbbbaaaabaabbaaabaabbabaa\nddcdcccccccdccdcdccdddcddcddcddddcdddcdcdccddcdddddccddcccdcdddcdcccdccccccdcdcdccccccdccccccdc\nfffeefeffeefeeeeffefffeeefffeefffefeefefeeeffefefefefefefffffffeeeeeffffeefeeeeffffee... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string s consisting of n lowercase Latin letters. Polycarp wants to remove exactly k characters (k ≤ n) from the string s. Polycarp uses the following algorithm k times:\n\n * if there is at least one let... | [{"type": "stdin_stdout", "input": "26 1\nabcdefghijklmnopqrstuvwxyz\n", "output": "bcdefghijklmnopqrstuvwxyz\n"}, {"type": "stdin_stdout", "input": "26 1\nabcdefghijklmnopqrsuuvwxyz\n", "output": "bcdefghijklmnopqrsuuvwxyz\n"}, {"type": "stdin_stdout", "input": "26 2\nabcdefghijklmnopqrstuvwxyz\n", "output": "cdefghij... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBenny is a little pig. She usually goes to school, but the summer is coming which is also the time of getting the grade card report of all the N + 1 subjects.\n\nBenny has a M grade point system. Hence, all the scores for... | [{"type": "stdin_stdout", "input": "4\n1 1 2\n2\n6 19 7\n5 9 0 8 4 2 \n1 4 3\n0 \n1 1 2\n1 \n\nSAMPLE", "output": "Impossible\nImpossible\nImpossible\nImpossible\n"}, {"type": "stdin_stdout", "input": "4\n1 1 2\n2\n6 12 12\n7 0 0 8 4 0 \n1 4 1\n1 \n1 12 8\n1 \n\nSAMPLE", "output": "Impossible\nImpossible\n1\nImpossible... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNOTE: All quotes are for clarity\n\nYou are given one n x m grid and q queries. Each cell of grid will have a value assigned to it. Each query will be of type \"x y d\". Read below on how you have to process them.\n\nFor ... | [{"type": "stdin_stdout", "input": "29 99 64\n5248 63776 10752 92000 53632 12672 69184 -57824 51136 31392 30240 2560 79968 53856 75008 62848 83360 28576 17856 95808 46048 69312 99456 19584 -37376 84896 29888 95648 23904 46560 97216 80928 90688 76864 39232 48736 85376 66272 80480 66432 73984 -47808 9216 82624 62144 9699... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a magical shop owned by The Monk, which consists of magical potions. On the first day there are A number of potions. Let, potions[I] denote the number of potions present in the shop on the I^th day. \n\npotions... | [{"type": "stdin_stdout", "input": "122 110\n111\n\nSL@LVC", "output": "102\n"}, {"type": "stdin_stdout", "input": "105 111\n111\n\nSL@LVD", "output": "105\n"}, {"type": "stdin_stdout", "input": "11 111\n011\n\nDR@LLV", "output": "110\n"}, {"type": "stdin_stdout", "input": "11 111\n001\n\nDR@LLV", "output": "100\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is an integer sequence of length N+1: A_0, A_1, A_2, \\ldots, A_N. Is there a binary tree of depth N such that, for each d = 0, 1, \\ldots, N, there are exactly A_d leaves at depth d? If such a tree exists, print th... | [{"type": "stdin_stdout", "input": "10\n0 -1 1 1 3 3 4 8 13 23 34", "output": "360\n"}, {"type": "stdin_stdout", "input": "10\n-1 0 1 0 2 3 5 8 13 21 34", "output": "421\n"}, {"type": "stdin_stdout", "input": "10\n0 -1 1 1 3 4 4 8 13 23 34", "output": "358\n"}, {"type": "stdin_stdout", "input": "10\n-1 0 1 0 2 3 5 8 13... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAtCoder's head office consists of N rooms numbered 1 to N. For any two rooms, there is a direct passage connecting these rooms.\n\nFor security reasons, Takahashi the president asked you to set a level for every passage, ... | [{"type": "stdin_stdout", "input": "315", "output": "1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n5\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n6\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n5\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n7\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n5\n1\n2\n1\n3\n1\n2\n1\n4\n1\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFind the number, modulo 998244353, of sequences of length N consisting of 0, 1 and 2 such that none of their contiguous subsequences totals to X.\n\nConstraints\n\n* 1 \\leq N \\leq 3000\n* 1 \\leq X \\leq 2N\n* N and X a... | [{"type": "stdin_stdout", "input": "102 205", "output": "214138673\n"}, {"type": "stdin_stdout", "input": "169 205", "output": "909969555\n"}, {"type": "stdin_stdout", "input": "613 159", "output": "832714847\n"}, {"type": "stdin_stdout", "input": "325 205", "output": "688557253\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi has a strong stomach. He never gets a stomachache from eating something whose \"best-by\" date is at most X days earlier. He gets a stomachache if the \"best-by\" date of the food is X+1 or more days earlier, th... | [{"type": "stdin_stdout", "input": "-2 -1 10", "output": "dangerous\n"}, {"type": "stdin_stdout", "input": "-1 13 12", "output": "delicious\n"}, {"type": "stdin_stdout", "input": "-1 7 12", "output": "dangerous\n"}, {"type": "stdin_stdout", "input": "-1 7 14", "output": "dangerous\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs a New Year's gift, Dolphin received a string s of length 19.\nThe string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`.\nDolphin wants... | [{"type": "stdin_stdout", "input": "gaiku,atcoder,tasks", "output": "gaiku atcoder tasks\n"}, {"type": "stdin_stdout", "input": "abgde,fchihgf,edcba", "output": "abgde fchihgf edcba\n"}, {"type": "stdin_stdout", "input": "ha,pypnewyear,enjoy", "output": "ha pypnewyear enjoy\n"}, {"type": "stdin_stdout", "input": "gaiku... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecuti... | [{"type": "stdin_stdout", "input": "9999999999", "output": "12656242944"}, {"type": "stdin_stdout", "input": "1333", "output": "1952\n"}, {"type": "stdin_stdout", "input": "1455", "output": "2280\n"}, {"type": "stdin_stdout", "input": "1573", "output": "2576\n"}, {"type": "stdin_stdout", "input": "1479", "output": "240... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDr .: Peter, I've finally done it.\n\nPeter: See you again? What kind of silly invention is this time?\n\nDr .: I finally came up with a revolutionary way to process mathematical formulas on a computer. Look at this table... | [{"type": "stdin_stdout", "input": "10 0 82 - /\n4 5 - 31 1 5 * * *\n0 -2 1 + +", "output": "-0.121951\n-155.000000\n-1.000000\n"}, {"type": "stdin_stdout", "input": "10 0 82 - /\n4 5 - 60 1 5 * * *\n0 -2 1 + +", "output": "-0.121951\n-300.000000\n-1.000000\n"}, {"type": "stdin_stdout", "input": "10 0 82 - /\n4 0 - 60 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is an ice cream shop named Ten Ice Cream. At this store, we always have 10 types of ice cream on the shelves. The store manager creates a daily graph showing how well ice cream is selling for reference in product de... | [{"type": "stdin_stdout", "input": "15\n2\n6\n7\n0\n1\n9\n8\n7\n4\n8\n9\n1\n9\n4\n2\n1\n2\n1\n0\n0", "output": "*\n**\n**\n-\n**\n-\n*\n**\n**\n***\n-\n-\n*\n-\n-\n-\n-\n-\n-\n-\n*\n-\n-\n-\n-\n-\n-\n-\n-\n-\n"}, {"type": "stdin_stdout", "input": "15\n1\n6\n7\n0\n1\n9\n8\n7\n4\n8\n9\n1\n9\n4\n2\n1\n2\n1\n0\n0", "output... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the year 30XX, an expedition team reached a planet and found a warp machine suggesting the existence of a mysterious supercivilization. When you go through one of its entrance gates, you can instantaneously move to the... | [{"type": "stdin_stdout", "input": "25\nneihsokcpuziafoytisrevinu\nuniversityofaizupckoshhen", "output": "4\n"}, {"type": "stdin_stdout", "input": "25\nuniversityofaiztpckoshien\nuniversityofaizupbkoshhen", "output": "0\n"}, {"type": "stdin_stdout", "input": "25\nuniversityofaiztpckoshien\nnehhsokbpuziafoytisrevinu", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn bydrocarbon is an organic compound which contains only carbons and hydrogens. An isomer is a compound that has the same number of carbons but different structures. Heptane, for example, is a hydrocarbon with 7 carbons.... | [{"type": "stdin_stdout", "input": "1\n30", "output": "1\n14348906\n"}, {"type": "stdin_stdout", "input": "1\n30", "output": "1\n14348906\n"}, {"type": "stdin_stdout", "input": "1\n25", "output": "1\n1062881\n"}, {"type": "stdin_stdout", "input": "1\n29", "output": "1\n9565937\n"}, {"type": "stdin_stdout", "input": "1\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt is said that a legendary treasure left by Mr. Yao is sleeping somewhere in Hachioji long ago. The treasure map, which is said to show its whereabouts, has been handed down by Yao's n descendants, divided into several p... | [{"type": "stdin_stdout", "input": "4\n1 1\n2 0 -1\n2 4 2\n3 2 16 10\n0", "output": "-1\n"}, {"type": "stdin_stdout", "input": "4\n1 1\n2 0 0\n2 4 2\n3 2 16 10\n0", "output": "-1\n"}, {"type": "stdin_stdout", "input": "4\n1 1\n2 0 -1\n2 4 2\n3 2 16 2\n0", "output": "-1\n"}, {"type": "stdin_stdout", "input": "4\n1 1\n2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA dial lock is a kind of lock which has some dials with printed numbers. It has a special sequence of numbers, namely an unlocking sequence, to be opened.\n\nYou are working at a manufacturer of dial locks. Your job is to... | [{"type": "stdin_stdout", "input": "4\n1433 4680\n6\n777777 003330\n0", "output": "4\n2\n"}, {"type": "stdin_stdout", "input": "4\n1357 4680\n6\n509138 003330\n0", "output": "1\n4\n"}, {"type": "stdin_stdout", "input": "4\n1357 4680\n6\n297443 003330\n0", "output": "1\n5\n"}, {"type": "stdin_stdout", "input": "4\n1357 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMr. A wants to get to the destination on the Yamanote line.\n\nAfter getting on the train, Mr. A gets up for a minute and sleeps for b minutes repeatedly. It is c minutes after boarding to the destination, and you can get... | [{"type": "stdin_stdout", "input": "196 2 133", "output": "133\n"}, {"type": "stdin_stdout", "input": "128 12 16", "output": "16\n"}, {"type": "stdin_stdout", "input": "134 22 13", "output": "13\n"}, {"type": "stdin_stdout", "input": "134 22 21", "output": "21\n"}, {"type": "stdin_stdout", "input": "50 40 68", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem statement\n\nAOR Ika got a cabbage with $ N $ leaves. The leaves of this cabbage are numbered $ 1, \\ ldots, N $ in order from the outside, and the dirtiness of the $ i $ th leaf is $ D_i $. The larger this value ... | [{"type": "stdin_stdout", "input": "16 6 10 -1\n24 1 4 -1 0", "output": "1\n"}, {"type": "stdin_stdout", "input": "16 6 10 -1\n24 1 5 -1 0", "output": "1\n"}, {"type": "stdin_stdout", "input": "21 10 0 4\n5 2 13 -1 0", "output": "3\n"}, {"type": "stdin_stdout", "input": "16 6 10 -1\n24 1 4 0 1", "output": "1\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nN: Mail order\n\nMr. Komozawa bought building blocks toys from Makai mail order.\n\nThe building blocks are in the shape of a cube with a side length of 1, and are stacked on squares divided into $ H $ pieces vertically a... | [{"type": "stdin_stdout", "input": "2 2\n-1 11\n10 12", "output": "19\n"}, {"type": "stdin_stdout", "input": "2 2\n-4 0\n0 -2", "output": "-10\n"}, {"type": "stdin_stdout", "input": "2 2\n-1 2\n2 -1", "output": "-1\n"}, {"type": "stdin_stdout", "input": "2 2\n-1 2\n2 -2", "output": "-3\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nThere are coins with front and back sides and dice with rolls from $ 1 $ to $ N $. Gacho decided to play the following games using these.\n\nThe game starts with a score of $ 0 $ and proceeds as follows.\n\n\n1... | [{"type": "stdin_stdout", "input": "12 110 467", "output": "469611202\n"}, {"type": "stdin_stdout", "input": "12 100 467", "output": "732809678\n"}, {"type": "stdin_stdout", "input": "12 13 187", "output": "455459798\n"}, {"type": "stdin_stdout", "input": "12 60 467", "output": "654858060\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFind common tangent lines of two circles $c1$ and $c2$.\n\nConstraints\n\n* $-1,000 \\leq c1x, c1y, c2x, c2y \\leq 1,000$\n* $1 \\leq c1r, c2r \\leq 1,000$\n* $c1$ and $c2$ are different\n\nInput\n\nCenter coordinates ($c... | [{"type": "stdin_stdout", "input": "1 1 1\n6 2 2", "output": "0.6153846154 1.9230769231\n1.0000000000 0.0000000000\n1.4183420913 1.9082895434\n1.7355040625 0.3224796874"}, {"type": "stdin_stdout", "input": "-1 -6 2\n1 0 2", "output": "-2.89736660 -5.36754447\n-2.06969385 -4.31010205\n0.86969385 -5.28989795\n0.89736660 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor a dictionary $M$ that stores elements formed by a pair of a string key and an integer value, perform a sequence of the following operations. Note that each key in $M$ must be unique.\n\n* insert($key$, $x$): Insert an... | [{"type": "stdin_stdout", "input": "7\n0 blue 4\n0 red -1\n0 white 9\n1 red\n1 blue\n0 black 11\n1 black", "output": "-1\n4\n11\n"}, {"type": "stdin_stdout", "input": "7\n0 blue 15\n0 red 1\n0 whiue 5\n1 red\n1 blue\n0 black 11\n1 black", "output": "1\n15\n11\n"}, {"type": "stdin_stdout", "input": "7\n0 blue 4\n0 red -... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an undirected tree consisting of n vertices. An undirected tree is a connected undirected graph with n - 1 edges.\n\nYour task is to add the minimum number of edges in such a way that the length of the short... | [{"type": "stdin_stdout", "input": "7\n1 2\n2 3\n3 4\n3 5\n3 6\n3 7\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "7\n1 2\n2 3\n2 4\n4 5\n4 6\n5 7\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "7\n1 2\n1 3\n2 4\n2 5\n3 6\n1 7\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "7\n1 2\n2 3\n2 4\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter all the events in Orlando we all know, Sasha and Roma decided to find out who is still the team's biggest loser. Thankfully, Masha found somewhere a revolver with a rotating cylinder of n bullet slots able to contai... | [{"type": "stdin_stdout", "input": "15 10 15\n1\n2\n3\n4\n5\n6\n12\n8\n9\n10\n11\n12\n13\n14\n15\n", "output": ".X.X.XXX.XXXXXX"}, {"type": "stdin_stdout", "input": "15 10 15\n1\n2\n5\n6\n5\n6\n7\n12\n9\n10\n11\n12\n13\n14\n15\n", "output": ".X.X.X.X.XXXXXX"}, {"type": "stdin_stdout", "input": "17 10 15\n1\n2\n5\n6\n5\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n[The Duck song](https://www.youtube.com/watch?v=MtN1YnoL46Q)\n\nFor simplicity, we'll assume that there are only three types of grapes: green grapes, purple grapes and black grapes.\n\nAndrew, Dmitry and Michal are all gr... | [{"type": "stdin_stdout", "input": "100000 100000 100000\n100000 100000 100000\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100000 99999 100000\n100000 100000 100000\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100000 100000 99999\n100000 100000 100000\n", "output": "YES\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation p of length n, and Skynyrd bought an array a of length m, consisting of integers from 1 to n. \n\nLynyrd and Skynyrd became bored, so they asked... | [{"type": "stdin_stdout", "input": "3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5\n", "output": "110\n"}, {"type": "stdin_stdout", "input": "3 6 3\n2 1 3\n1 1 3 1 2 3\n1 5\n2 6\n3 5\n", "output": "110\n"}, {"type": "stdin_stdout", "input": "3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n3 6\n3 5\n", "output": "100\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInaka has a disc, the circumference of which is n units. The circumference is equally divided by n points numbered clockwise from 1 to n, such that points i and i + 1 (1 ≤ i < n) are adjacent, and so are points n and 1.\n... | [{"type": "stdin_stdout", "input": "30000 28\n10601 1119\n11119 20601\n9493 25771\n14351 4869\n13101 3619\n23101 13619\n29869 9351\n6119 15601\n3101 23619\n1851 22369\n11851 2369\n8619 18101\n19579 12933\n18619 28101\n16851 7369\n8101 28619\n24869 4351\n24351 14869\n2690 6851\n9869 19351\n5601 26119\n3976 21301\n21851 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVova is playing a computer game. There are in total n turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is k.\n\nDuring ea... | [{"type": "stdin_stdout", "input": "20\n1000000001 510000100 2 1\n1000000000 500000000 2 1\n1000000000 500000000 2 1\n1000000000 500000000 2 1\n1000000000 500000000 2 1\n1000000000 684100035 2 1\n1000000100 500000000 2 1\n1000000000 690764083 2 1\n1000000000 500000000 2 1\n1000000000 167868648 2 1\n1000000001 999999995... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGildong has bought a famous painting software cfpaint. The working screen of cfpaint is square-shaped consisting of n rows and n columns of square cells. The rows are numbered from 1 to n, from top to bottom, and the colu... | [{"type": "stdin_stdout", "input": "9 9\nBWBBWWWXW\nBWAWWWWWW\nWBWBBBBBB\nWWBBBWWWB\nWWBWBXBWW\nWBWWBBWWB\nWWWBWBWBW\nBBWBBBWWW\nWBWBBWWWW\n", "output": "18\n"}, {"type": "stdin_stdout", "input": "9 9\nBWBBWWWXW\nBWAWWWWWW\nWBWBBBBBB\nWWBBBWWWB\nWWBWBXBWW\nWBWWBBWWB\nWWWBWBWBW\nWWWBBBWBB\nWBWBBWWWW\n", "output": "18\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlan decided to get in shape for the summer, so he created a precise workout plan to follow. His plan is to go to a different gym every day during the next N days and lift X[i] grams on day i. In order to improve his work... | [{"type": "stdin_stdout", "input": "5 00000\n10000 30000 30000 40000 19505\n27261\n14 2 8 5 6\n", "output": "16\n"}, {"type": "stdin_stdout", "input": "5 00000\n10000 30000 30000 40000 19505\n27261\n14 0 8 5 6\n", "output": "14\n"}, {"type": "stdin_stdout", "input": "5 10000\n10000 37530 30000 30000 20000\n10000\n5 2 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nUjan has a lot of numbers in his boxes. He likes order and balance, so he decided to reorder the numbers.\n\nThere are k boxes numbered from 1 to k. The i-th box contains n_i integer numbers. The integers can be negative.... | [{"type": "stdin_stdout", "input": "5\n10 -251 650 475 -114 364 -75754 -982 -532 -151 -484\n10 -623 -132 -317561 -438 20 -275 -323 -530089 -311 -587\n10 450900 -519 903 -401 -789 -606529 277 -267 -682 -161\n10 -246 873 -641 838 719 234 789 -74 -287288 -772972\n10 186 741 -927 -866 -855 578 -1057019 202 162962 -458\n", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOh, New Year. The time to gather all your friends and reflect on the heartwarming events of the past year...\n\nn friends live in a city which can be represented as a number line. The i-th friend lives in a house with an ... | [{"type": "stdin_stdout", "input": "10\n10 7 10 10 7 10 7 7 10 10\n", "output": "2 6\n"}, {"type": "stdin_stdout", "input": "10\n10 7 10 10 7 10 7 5 10 10\n", "output": "2 7\n"}, {"type": "stdin_stdout", "input": "10\n1 2 3 4 5 6 7 8 9 10\n", "output": "4 10\n"}, {"type": "stdin_stdout", "input": "10\n1 2 3 4 5 6 9 8 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string s. Each character is either 0 or 1.\n\nYou want all 1's in the string to form a contiguous subsegment. For example, if the string is 0, 1, 00111 or 01111100, then all 1's form a contiguous subsegmen... | [{"type": "stdin_stdout", "input": "7\n0\n0\n0\n0\n0\n0\n0\n", "output": "0\n0\n0\n0\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "7\n0\n0\n0\n0\n1\n0\n0\n", "output": "0\n0\n0\n0\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "3\n010011\n0\n1111000\n", "output": "2\n0\n0\n"}, {"type": "stdin_stdout", "input": "3\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKarl likes Codeforces and subsequences. He wants to find a string of lowercase English letters that contains at least k subsequences codeforces. Out of all possible strings, Karl wants to find a shortest one.\n\nFormally,... | [{"type": "stdin_stdout", "input": "10000100000000000\n", "output": "ccccccccccccccccccccccccccccccccccccccccooooooooooooooooooooooooooooooooooooooooddddddddddddddddddddddddddddddddddddddddeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeffffffffffffffffffffffffffffffffffffffffoooooooooooooooooooooooooooooooooooooooorrrrrrrrrrr... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two lists of segments [al_1, ar_1], [al_2, ar_2], ..., [al_n, ar_n] and [bl_1, br_1], [bl_2, br_2], ..., [bl_n, br_n].\n\nInitially, all segments [al_i, ar_i] are equal to [l_1, r_1] and all segments [bl_i, ... | [{"type": "stdin_stdout", "input": "3\n3 5\n1 2\n3 4\n2 1000000000\n1 1\n999999999 999999999\n10 3\n5 10\n7 8\n", "output": "7\n2000000000\n0\n"}, {"type": "stdin_stdout", "input": "3\n3 5\n1 2\n3 4\n1 1000000000\n1 1\n999999999 999999999\n10 3\n5 10\n7 8\n", "output": "7\n2000000000\n0\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGerald is setting the New Year table. The table has the form of a circle; its radius equals R. Gerald invited many guests and is concerned whether the table has enough space for plates for all those guests. Consider all p... | [{"type": "stdin_stdout", "input": "10 1000 236\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "1 1484 1100\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "1 1484 0100\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100 821 25\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKavi has 2n points lying on the OX axis, i-th of which is located at x = i.\n\nKavi considers all ways to split these 2n points into n pairs. Among those, he is interested in good pairings, which are defined as follows:\n... | [{"type": "stdin_stdout", "input": "1000000\n", "output": "126330412"}, {"type": "stdin_stdout", "input": "372544\n", "output": "214345447\n"}, {"type": "stdin_stdout", "input": "315936\n", "output": "256195953\n"}, {"type": "stdin_stdout", "input": "446167\n", "output": "461428149\n"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA new cottage village called «Flatville» is being built in Flatland. By now they have already built in «Flatville» n square houses with the centres on the Оx-axis. The houses' sides are parallel to the coordinate axes. It... | [{"type": "stdin_stdout", "input": "50 1\n-967 7\n696 7\n-366 4\n557 1\n978 2\n800 4\n-161 2\n-773 2\n-248 2\n134 3\n869 6\n-932 2\n-262 14\n191 3\n669 2\n72 5\n0 1\n757 8\n859 2\n-131 8\n-169 3\n543 10\n-120 2\n-87 8\n-936 6\n-620 3\n-281 11\n684 3\n886 10\n497 4\n380 4\n833 1\n-727 6\n470 11\n584 9\n66 6\n-609 12\n-6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA widely known among some people Belarusian sport programmer Lesha decided to make some money to buy a one square meter larger flat. To do this, he wants to make and carry out a Super Rated Match (SRM) on the site Torcode... | [{"type": "stdin_stdout", "input": "15\na b c d e f g h i j k l m n o\n1\n221 n g m h n f d a b a m d o n e e c c i a f f f i h m b o l j b d f m f i j c g d k l i b d a h l j e n b d b j o c c b c e c o g n h a b l m m h n a a a n e k m m a e b l i k a g h k k f d j c n g c d k b f k k a k g m b a j b n m f c f f o a ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are less than 60 years left till the 900-th birthday anniversary of a famous Italian mathematician Leonardo Fibonacci. Of course, such important anniversary needs much preparations.\n\nDima is sure that it'll be gre... | [{"type": "stdin_stdout", "input": "1000000000 208196592308 1000000000000 1000000001\n", "output": "668826609\n"}, {"type": "stdin_stdout", "input": "7417434 671183669261 881538048766 3606057091\n", "output": "5978569\n"}, {"type": "stdin_stdout", "input": "220688329 777936720815 906371247466 123531039142\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarpus has been working in the analytic department of the \"F.R.A.U.D.\" company for as much as n days. Right now his task is to make a series of reports about the company's performance for the last n days. We know th... | [{"type": "stdin_stdout", "input": "100\n-76 -48 -63 -62 -94 -37 -54 -67 -9 -52 -83 -1 -87 -36 -94 -10 -19 -55 -93 -23 -2 -87 -15 -59 -60 -87 -63 -18 -62 -92 -10 -61 -12 -89 -85 -38 -37 -3 -71 -22 -94 -96 -100 -47 -20 -93 -28 77 -35 -74 -50 -72 -38 -29 -58 -80 -24 -9 -59 -4 -93 -65 -31 -47 -36 -13 -89 -96 -99 -83 -99 -... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt is known that there are k fish species in the polar ocean, numbered from 1 to k. They are sorted by non-decreasing order of their weight, which is a positive number. Let the weight of the i-th type of fish be wi, then ... | [{"type": "stdin_stdout", "input": "100 50 11\n7 15 0 1 6 7 9 2 4 6 7 7 3 9 4 5 0 7 8 19 4 1 3 6 8 10 4 6 6 1 6 6 7 4 10 3 10 1 3 1 10 6 9 9 5 2 9 2 9 8 10 2 10 3 3 2 3 8 6 2 7 10 7 2 7 2 8 9 6 2 5 4 4 5 3 3 9 10 9 4 9 3 9 5 3 11 6 2 3 6 10 3 10 2 6 13 10 10 4 8\n3 3 2 9 4 4 10 2 7 3 3 2 6 3 3 4 7 4 1 2 3 8 1 6 14 7 2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFox Ciel is playing a card game with her friend Jiro.\n\nJiro has n cards, each one has two attributes: position (Attack or Defense) and strength. Fox Ciel has m cards, each one has these two attributes too. It's known th... | [{"type": "stdin_stdout", "input": "36 30\nATK 116\nATK 120\nATK 122\nATK 120\nATK 116\nATK 118\nATK 123\nDEF 2564\nATK 123\nDEF 1810\nATK 124\nATK 120\nDEF 2598\nATK 119\nDEF 2103\nATK 123\nATK 118\nATK 118\nATK 123\nDEF 1988\nATK 122\nATK 120\nDEF 2494\nATK 122\nATK 124\nATK 117\nATK 121\nATK 118\nATK 117\nATK 122\nA... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarpus adores TV series. Right now he is ready to finish watching a season of a popular sitcom \"Graph Theory\". In total, the season has n episodes, numbered with integers from 1 to n.\n\nPolycarpus watches episodes ... | [{"type": "stdin_stdout", "input": "10\n3 8 10 1 7 9 6 5 2\n", "output": " 4"}, {"type": "stdin_stdout", "input": "5\n5 2 4 3\n", "output": " 1"}, {"type": "stdin_stdout", "input": "5\n5 4 3 2\n",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical O... | [{"type": "stdin_stdout", "input": "7 10\n1 0 1 0 0 0 1 0 1 0\n1 0 1 0 0 0 1 0 1 0\n1 1 1 1 1 1 1 1 1 1\n1 0 1 0 0 0 1 0 1 0\n1 1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1 1\n", "output": "YES\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n1 0 1 0 0 0 1 0 1 0\n0 0 0 0 0 0 0 0 0 0\n1 0 1 0 0 0 1 0 1 0\n1 0 1 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a rectangular board of M × N squares. Also you are given an unlimited number of standard domino pieces of 2 × 1 squares. You are allowed to rotate the pieces. You are asked to place as many dominoes as possi... | [{"type": "stdin_stdout", "input": "14 16\n", "output": "112\n"}, {"type": "stdin_stdout", "input": "15 16\n", "output": "120\n"}, {"type": "stdin_stdout", "input": "16 16\n", "output": "128\n"}, {"type": "stdin_stdout", "input": "14 15\n", "output": "105\n"}, {"type": "stdin_stdout", "input": "15 15\n", "output": "112... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.