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\nVampire\n\nMr. C is a vampire. If he is exposed to the sunlight directly, he turns into ash. Nevertheless, last night, he attended to the meeting of Immortal and Corpse Programmers Circle, and he has to go home in the nea...
[{"type": "stdin_stdout", "input": "4 3\n-2 -2 3\n1 0 3\n1 1 3\n2 2\n-2 0 8\n-2 2 3\n6 6\n-1 3 1\n-4 3 2\n-2 4 3\n0 -1 0\n1 8 3\n2 4 1\n2 6\n-11 6 1\n-3 1 2\n-6 1 2\n-2 0 4\n-3 -1 5\n-5 -2 6\n0 0", "output": "0.000000\n3.000000\n1.527864\n1.267949\n"}, {"type": "stdin_stdout", "input": "4 3\n-2 -2 3\n1 0 3\n1 1 3\n2 2\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a one-dimensional cellular automaton consisting of N cells. Cells are numbered from 0 to N − 1.\n\nEach cell has a state represented as a non-negative integer less than M. The states of cells evolve through discr...
[{"type": "stdin_stdout", "input": "5 4 1 3 3 0\n0 1 2 0 1\n5 7 1 3 2 0\n0 1 2 0 1\n5 13 1 3 2 11\n0 1 2 0 1\n5 5 2 0 1 100\n0 1 2 0 1\n6 6 0 2 3 1000\n0 1 2 0 1 4\n20 1000 0 2 3 1000000000\n0 1 2 0 1 0 1 2 0 1 0 1 2 0 1 0 1 2 0 1\n30 2 1 0 1 1000000000\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0\n30 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem\n\n\"Ritsumeikan University Competitive Programming Camp\" will be held this year as well. I am very much looking forward to this annual training camp. However, I couldn't stand my desires and splurged before the ...
[{"type": "stdin_stdout", "input": "1234 5 4 789012345678901234 5 6", "output": "1357101234567708000\n"}, {"type": "stdin_stdout", "input": "2017 4 2 789012345678901234 5 6", "output": "1357101234567706652\n"}, {"type": "stdin_stdout", "input": "2684 2 6 699116447311015755 5 1", "output": "1202480289374942482\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nquiz\n\nYou are the director of a quiz show. N people will appear in the quiz show as answerers, each numbered from 1 to N.\n\nQuestions will be M + 1 questions, and each question is numbered from 1 to M + 1. Questions ar...
[{"type": "stdin_stdout", "input": "3 2\n5 2 1 3\n8 2 2 3\n2 3\n13 2 1 2\n3 1 1\n5 1 1\n2 5\n100 1 1\n100 1 1\n100 1 1\n100 1 1\n100 1 1\n3 4\n5 1 1\n5 1 2\n100 2 1 3\n100 2 2 3\n0 0", "output": "14\n22\n501\n196\n"}, {"type": "stdin_stdout", "input": "3 2\n5 2 1 3\n8 2 2 3\n2 3\n13 2 1 2\n3 1 1\n5 1 1\n2 5\n100 1 1\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nD: Is greed the best?\n\nstory\n\nIn Japan, where there are 1, 5, 10, 50, 100, 500 yen coins, it is known that the number of coins can be minimized by using as many coins as possible when paying a certain amount. ..\n\nIf...
[{"type": "stdin_stdout", "input": "42 1010", "output": "1050\n"}, {"type": "stdin_stdout", "input": "133 178", "output": "266\n"}, {"type": "stdin_stdout", "input": "16 102", "output": "112\n"}, {"type": "stdin_stdout", "input": "24 128", "output": "144\n"}, {"type": "stdin_stdout", "input": "18 102", "output": "108\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n$N$ persons visited a restaurant. The restaurant is open from 0 to $T$. The $i$-th person entered the restaurant at $l_i$ and left at $r_i$. Find the maximum number of persons during the business hours.\n\nConstraints\n\n...
[{"type": "stdin_stdout", "input": "0 12\n1 -1\n1 4\n0 8\n0 11\n6 19\n7 21", "output": "0\n"}, {"type": "stdin_stdout", "input": "0 12\n0 -1\n1 4\n0 8\n0 11\n6 19\n7 21", "output": "0\n"}, {"type": "stdin_stdout", "input": "0 12\n1 0\n1 14\n0 0\n0 11\n6 19\n7 32", "output": "0\n"}, {"type": "stdin_stdout", "input": "0 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter learning a lot about space exploration, a little girl named Ana wants to change the subject.\n\nAna is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to che...
[{"type": "stdin_stdout", "input": "20\niw\nix\nudb\nbg\noi\nuo\njsm\num\ns\nquy\nqo\nbxct\nng\nrmr\nnu\nps\nio\nkh\nw\nk\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "20\niw\nix\nudb\nbg\noi\nuo\njsm\nmu\ns\nquy\nqo\nbxct\nng\nrmr\nnu\nps\nio\nkh\nw\nk\n", "output": "5\n"}, {"type": "stdin_stdout", "input":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIvan wants to play a game with you. He picked some string s of length n consisting only of lowercase Latin letters. \n\nYou don't know this string. Ivan has informed you about all its improper prefixes and suffixes (i.e. ...
[{"type": "stdin_stdout", "input": "18\nd\nh\ndj\nxh\ndjs\njxh\ndjsh\nzjxh\ndjshf\nkzjxh\ndjshfk\nhkzjxh\ndjshfkj\nkhkzjxh\ndjshfkje\nskhkzjxh\ndjshfkjeh\ndskhkzjxh\ndjshfkjehd\nhdskhkzjxh\ndjshfkjehds\nehdskhkzjxh\ndjshfkjehdsk\njehdskhkzjxh\ndjshfkjehdskh\nkjehdskhkzjxh\ndjshfkjehdskhk\nfkjehdskhkzjxh\ndjshfkjehdskhk...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe all know that a superhero can transform to certain other superheroes. But not all Superheroes can transform to any other superhero. A superhero with name s can transform to another superhero with name t if s can be mad...
[{"type": "stdin_stdout", "input": "eieoiiieaiuiiauieeuoueeoudljpjrpxdtqkrdfmhktpqrnkmyggywglpfpfmhrbaiioeuaieaouaoioaiuoiuueuaoouaeeoaaaueauueeiuaueuaeouiaaaieeaeiuouoiooauuoeauaiaoouuauuuuocqschpcxrxrgrcsjmwcbyfvtdxqtwha\naoeaoaoueieeioooiaooeoeoitvplxwkprykbhvxylcnxrhpgqclyjgfpzdpqwlcvouooeueoouieioeuouieoaaueuiiiae...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet s be some string consisting of symbols \"0\" or \"1\". Let's call a string t a substring of string s, if there exists such number 1 ≤ l ≤ |s| - |t| + 1 that t = s_l s_{l+1} … s_{l + |t| - 1}. Let's call a substring t ...
[{"type": "stdin_stdout", "input": "99985 45273\n", "output": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMisha was interested in water delivery from childhood. That's why his mother sent him to the annual Innovative Olympiad in Irrigation (IOI). Pupils from all Berland compete there demonstrating their skills in watering. It...
[{"type": "stdin_stdout", "input": "100 74 20\n9 15 16 18 55 41 64 44 5 1 27 31 36 25 71 28 71 35 47 40 21 53 31 11 24 1 69 67 58 16 19 52 33 17 63 1 49 28 17 52 46 60 53 21 21 60 19 63 11 61 10 27 3 22 38 31 45 69 61 18 58 22 8 71 17 1 64 70 56 10 66 47 70 1 45 8 66 8 66 25 39 45 47 7 41 24 41 72 16 42 28 7 15 10 38 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYet another education system reform has been carried out in Berland recently. The innovations are as follows:\n\nAn academic year now consists of n days. Each day pupils study exactly one of m subjects, besides, each subj...
[{"type": "stdin_stdout", "input": "50 50 1\n1 1 1\n1 1 2\n1 1 3\n1 1 4\n1 1 5\n1 1 6\n1 1 7\n1 1 8\n1 1 9\n1 1 10\n1 1 11\n1 1 12\n1 1 13\n1 1 14\n1 1 15\n1 1 16\n1 1 17\n1 1 18\n1 1 19\n1 1 20\n1 1 21\n1 1 22\n1 1 23\n1 1 24\n1 1 25\n1 1 26\n1 1 27\n1 1 28\n1 1 29\n1 1 30\n1 1 31\n1 1 32\n1 1 33\n1 1 34\n1 1 35\n1 1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou play your favourite game yet another time. You chose the character you didn't play before. It has str points of strength and int points of intelligence. Also, at start, the character has exp free experience points you...
[{"type": "stdin_stdout", "input": "5\n1 1 100000000\n100000000 100000000 100000000\n100000000 1 100000000\n1 100000000 100000000\n100000000 100000000 1\n", "output": "50000000\n50000000\n100000000\n1\n1\n"}, {"type": "stdin_stdout", "input": "5\n0 1 100000000\n100000000 100000000 100000000\n100000000 1 100000000\n1 10...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis problem is split into two tasks. In this task, you are required to find the minimum possible answer. In the task Village (Maximum) you are required to find the maximum possible answer. Each task is worth 50 points.\n...
[{"type": "stdin_stdout", "input": "10\n10 2\n4 10\n1 10\n5 10\n10 7\n9 10\n3 10\n1 6\n8 1\n", "output": "16\n8 10 9 2 4 1 5 6 7 3 \n"}, {"type": "stdin_stdout", "input": "10\n6 10\n2 7\n10 1\n10 8\n4 2\n1 5\n1 9\n2 3\n10 2\n", "output": "14\n9 3 4 7 1 10 2 6 5 8 \n"}, {"type": "stdin_stdout", "input": "10\n9 8\n1 3\n7...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given m sets of integers A_1, A_2, …, A_m; elements of these sets are integers between 1 and n, inclusive.\n\nThere are two arrays of positive integers a_1, a_2, …, a_m and b_1, b_2, …, b_n. \n\nIn one operation y...
[{"type": "stdin_stdout", "input": "7 8\n3 6 6 9 10 7 239\n8 1 16 7 19 2 3 239\n3 2 1 3\n2 4 1\n3 1 3 7\n2 4 3\n5 3 4 5 2 7\n2 5 7\n1 8\n", "output": "63\n"}, {"type": "stdin_stdout", "input": "7 8\n3 6 7 9 10 7 239\n8 1 16 7 19 2 3 239\n3 2 1 3\n2 4 1\n3 1 3 7\n2 4 3\n5 3 4 5 2 7\n2 5 7\n1 8\n", "output": "64\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string s, consisting of brackets of two types: '(', ')', '[' and ']'.\n\nA string is called a regular bracket sequence (RBS) if it's of one of the following types: \n\n * empty string; \n * '(' + RBS + '...
[{"type": "stdin_stdout", "input": "7\n()\n()\n()\n()\n()\n()\n()\n", "output": "1\n1\n1\n1\n1\n1\n1\n"}, {"type": "stdin_stdout", "input": "7\n((\n()\n()\n()\n()\n()\n()\n", "output": "0\n1\n1\n1\n1\n1\n1\n"}, {"type": "stdin_stdout", "input": "7\n((\n()\n()\n)(\n()\n()\n()\n", "output": "0\n1\n1\n0\n1\n1\n1\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers n and k.\n\nYou should create an array of n positive integers a_1, a_2, ..., a_n such that the sum (a_1 + a_2 + ... + a_n) is divisible by k and maximum element in a is minimum possible.\n\nWhat...
[{"type": "stdin_stdout", "input": "25\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer x. Can you make x by summing up some number of 11, 111, 1111, 11111, …? (You can use any number among them any number of times).\n\nFor instance, \n\n * 33=11+11+11 \n * 144=111+11+11+11 \n\nInp...
[{"type": "stdin_stdout", "input": "3\n33\n144\n143\n", "output": "YES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "3\n33\n144\n155\n", "output": "YES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "3\n33\n144\n69\n", "output": "\nYES\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "3\n33\n144\n103\n", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTheatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of the city's anniversary, a decision was taken to pave the Square with square granite flagstones. Each fla...
[{"type": "stdin_stdout", "input": "1000000000 1000000000 1\n", "output": "1000000000000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 987654321 1\n", "output": "987654321000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 989104164 1\n", "output": "989104164000000000\n"}, {"type": "stdin_stdout", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou've got an array a, consisting of n integers: a1, a2, ..., an. Your task is to find a minimal by inclusion segment [l, r] (1 ≤ l ≤ r ≤ n) such, that among numbers al, al + 1, ..., ar there are exactly k distinct number...
[{"type": "stdin_stdout", "input": "17 14\n271 158 573 88 792 767 392 646 392 392 271 549 402 767 573 925 796\n", "output": "-1 -1\n"}, {"type": "stdin_stdout", "input": "17 14\n271 158 1064 88 2 110 392 646 241 392 271 576 108 100 573 1344 796\n", "output": "2 16\n"}, {"type": "stdin_stdout", "input": "17 14\n271 158 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDima's got a staircase that consists of n stairs. The first stair is at height a1, the second one is at a2, the last one is at an (1 ≤ a1 ≤ a2 ≤ ... ≤ an). \n\nDima decided to play with the staircase, so he is throwing re...
[{"type": "stdin_stdout", "input": "5\n1 2 3 6 6\n25\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGreg has an array a = a1, a2, ..., an and m operations. Each operation looks as: li, ri, di, (1 ≤ li ≤ ri ≤ n). To apply operation i to the array means to increase all array elements with numbers li, li + 1, ..., ri by va...
[{"type": "stdin_stdout", "input": "4 3 6\n2 1 3 4\n1 2 2\n2 3 2\n3 4 4\n1 2\n1 3\n2 3\n1 2\n1 3\n2 3\n", "output": "10 21 31 20\n"}, {"type": "stdin_stdout", "input": "4 3 6\n2 1 3 4\n1 2 2\n2 4 2\n3 4 4\n1 2\n1 3\n2 3\n1 2\n1 3\n2 3\n", "output": "10 21 31 32\n"}, {"type": "stdin_stdout", "input": "4 3 6\n2 1 3 4\n1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a \"plus\") and negative (a \"minus\"). If t...
[{"type": "stdin_stdout", "input": "115\n10\n10\n10\n10\n01\n01\n10\n10\n10\n01\n01\n10\n01\n01\n10\n10\n10\n01\n10\n01\n10\n10\n01\n01\n10\n10\n10\n10\n01\n10\n01\n01\n10\n10\n10\n10\n01\n10\n10\n10\n01\n10\n01\n10\n10\n10\n10\n01\n01\n01\n10\n10\n01\n01\n01\n10\n10\n01\n10\n01\n01\n01\n01\n10\n10\n01\n10\n01\n01\n01\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's call an array consisting of n integer numbers a1, a2, ..., an, beautiful if it has the following property:\n\n * consider all pairs of numbers x, y (x ≠ y), such that number x occurs in the array a and number y occ...
[{"type": "stdin_stdout", "input": "58 38\n6384 48910\n97759 90589\n28947 5031\n45169 32592\n85656 26360\n88538 42484\n44042 88351\n42837 79021\n96022 59200\n485 96735\n98000 3939\n3789 64468\n10894 58484\n26422 26618\n25515 95617\n37452 5250\n39557 66304\n79009 40610\n80703 60486\n90344 37588\n57504 61201\n62619 79797...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have probably registered on Internet sites many times. And each time you should enter your invented password. Usually the registration form automatically checks the password's crypt resistance. If the user's password ...
[{"type": "stdin_stdout", "input": "c7jqaudcqmv8o7zvb5x_gp6zcgl6nwr7tz5or!28.tj8s1m2.wxz5a4id03!rq07?662vy.7.p5?vk2f2mc7ag8q3861rgd0rmbr\n", "output": "Too weak\n"}, {"type": "stdin_stdout", "input": "i6a.,8jb,n0kv4.1!7h?p.96pnhhgy6cl7dg7e4o6o384ys3z.t71kkq,,w,oqi4?u,,m5!rzu6wym_4hm,ohjy!.vvksl?pt,,1\n", "output": "Too...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Dima misbehaved during a math lesson a lot and the nasty teacher Mr. Pickles gave him the following problem as a punishment. \n\nFind all integer solutions x (0 < x < 109) of the equation:\n\nx = b·s(x)a + c, \n\nw...
[{"type": "stdin_stdout", "input": "1 3034 -9234\n", "output": "23\n12004 21106 24140 30208 33242 39310 42344 48412 51446 54480 57514 60548 63582 66616 69650 72684 75718 78752 81786 87854 90888 96956 99990\n"}, {"type": "stdin_stdout", "input": "5 1 4473\n", "output": "11\n1424330 14353380 17214841 52526348 60470649 69...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's denote as <image> the number of bits set ('1' bits) in the binary representation of the non-negative integer x.\n\nYou are given multiple queries consisting of pairs of integers l and r. For each query, find the x, ...
[{"type": "stdin_stdout", "input": "18\n1 10\n2 100\n1 1100\n1 10000\n1 100000\n1 1000000\n1 10000000\n1 100010010\n2 1000000000\n1 10001000000\n1 100000000000\n0 1000000100000\n1 10000000000000\n0 110000000000000\n0 1000000000000000\n1 10000000000000000\n2 100000000000000000\n1 1000000000000000000\n", "output": "7\n63...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPasha loves his phone and also putting his hair up... But the hair is now irrelevant.\n\nPasha has installed a new game to his phone. The goal of the game is following. There is a rectangular field consisting of n row wit...
[{"type": "stdin_stdout", "input": "928 467 10\n37 45\n47 278\n17 467\n158 66\n483 198\n83 123\n285 219\n513 187\n380 107\n304 352\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "518 518 10\n37 97\n38 278\n17 467\n158 66\n483 351\n83 123\n285 219\n513 187\n380 75\n304 352\n", "output": "0\n"}, {"type": "stdin_...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPasha decided to invite his friends to a tea party. For that occasion, he has a large teapot with the capacity of w milliliters and 2n tea cups, each cup is for one of Pasha's friends. The i-th cup can hold at most ai mil...
[{"type": "stdin_stdout", "input": "4 1000000000\n1 1 1 1 2 2 2 2\n", "output": "12.0\n"}, {"type": "stdin_stdout", "input": "4 1000000000\n1 1 1 1 1 1 1 1\n", "output": "6.0\n"}, {"type": "stdin_stdout", "input": "4 1000000000\n1 1 1 1 1 0 1 1\n", "output": "0.0\n"}, {"type": "stdin_stdout", "input": "5 16\n1 3 4 1 2 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTwo positive integers a and b have a sum of s and a bitwise XOR of x. How many possible values are there for the ordered pair (a, b)?\n\nInput\n\nThe first line of the input contains two integers s and x (2 ≤ s ≤ 1012, 0 ...
[{"type": "stdin_stdout", "input": "549755813888 549755813886\n", "output": "274877906944"}, {"type": "stdin_stdout", "input": "549755813887 549755813887\n", "output": "549755813886"}, {"type": "stdin_stdout", "input": "552972910589 546530328573\n", "output": "17179869184"}, {"type": "stdin_stdout", "input": "547616456...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFriends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at a1 percent and second one is charged at a2 percent. You can connect charger to a joystick on...
[{"type": "stdin_stdout", "input": "100 100\n", "output": "197\n"}, {"type": "stdin_stdout", "input": "100 25\n", "output": "122\n"}, {"type": "stdin_stdout", "input": "100 26\n", "output": "124\n"}, {"type": "stdin_stdout", "input": "155 25\n", "output": "178\n"}, {"type": "stdin_stdout", "input": "155 18\n", "output"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAnton and Dasha like to play different games during breaks on checkered paper. By the 11th grade they managed to play all the games of this type and asked Vova the programmer to come up with a new game. Vova suggested to ...
[{"type": "stdin_stdout", "input": "12 -11 20 200\n11 189\n12 108\n19 190\n21 27\n24 193\n26 86\n26 123\n31 180\n39 196\n107 193\n122 46\n129 103\n131 129\n132 135\n142 51\n157 22\n161 27\n195 163\n198 55\n199 64\n", "output": "Anton\n"}, {"type": "stdin_stdout", "input": "12 -11 20 200\n11 189\n12 108\n19 190\n42 27\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently Adaltik discovered japanese crosswords. Japanese crossword is a picture, represented as a table sized a × b squares, and each square is colored white or black. There are integers to the left of the rows and to th...
[{"type": "stdin_stdout", "input": "100\nWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWB\n", "output": "50\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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n"}, {"type": "stdin_stdout", "input": "100\nBWBWBWBWBWBWBW...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nJust to remind, girls in Arpa's land are really nice.\n\nMehrdad wants to invite some Hoses to the palace for a dancing party. Each Hos has some weight wi and some beauty bi. Also each Hos may have some friends. Hoses are...
[{"type": "stdin_stdout", "input": "10 5 100\n64 109 3 94 96 97 52 54 82 26\n796554 444893 214351 43810 684158 1060686 686198 339093 383018 699152\n6 8\n8 3\n3 9\n2 3\n10 3\n", "output": "1495706\n"}, {"type": "stdin_stdout", "input": "10 5 100\n48 73 57 46 95 19 171 73 94 24\n501216 675859 843572 565104 879875 828759 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWhile Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem.\n\nGiven two strings a and b, find the...
[{"type": "stdin_stdout", "input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\nbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSasha and Kolya decided to get drunk with Coke, again. This time they have k types of Coke. i-th type is characterised by its carbon dioxide concentration <image>. Today, on the party in honour of Sergiy of Vancouver they...
[{"type": "stdin_stdout", "input": "971 108\n706 706 991 706 988 997 996 997 991 996 706 706 996 706 996 984 1000 991 996 1000 724 724 997 991 997 984 997 1000 984 996 996 997 724 997 997 1000 997 724 984 997 996 988 997 706 706 997 1000 991 706 988 997 724 988 706 996 706 724 997 988 996 991 1000 1000 724 988 996 1000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSummer holidays! Someone is going on trips, someone is visiting grandparents, but someone is trying to get a part-time job. This summer Noora decided that she wants to earn some money, and took a job in a shop as an assis...
[{"type": "stdin_stdout", "input": "50 2\n74 90\n68 33\n49 88\n52 13\n73 21\n77 63\n27 62\n8 52\n60 57\n42 83\n98 15\n79 11\n77 46\n55 91\n72 100\n70 86\n50 51\n57 39\n20 54\n64 95\n66 22\n79 64\n31 28\n11 89\n1 36\n13 4\n75 62\n16 62\n100 35\n43 96\n97 54\n86 33\n62 63\n94 24\n19 6\n20 58\n38 38\n11 76\n70 40\n44 24\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nValentin participates in a show called \"Shockers\". The rules are quite easy: jury selects one letter which Valentin doesn't know. He should make a small speech, but every time he pronounces a word that contains the sele...
[{"type": "stdin_stdout", "input": "15\n. r\n? e\n. s\n. rw\n? y\n. fj\n. zftyd\n? r\n! wq\n? x\n? p\n. ours\n. dto\n. lbyfru\n? q\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "15\n. r\n? e\n. s\n. rw\n? y\n. jf\n. zftyd\n? r\n! wq\n? x\n? p\n. ours\n. dto\n. lbyfru\n? q\n", "output": "2\n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a ...
[{"type": "stdin_stdout", "input": "100\n1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "100\n1 1 1 1 0 0 0 0...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food inc...
[{"type": "stdin_stdout", "input": "20 58\n156216 11 152 99\n", "output": "191884.80000000002\n"}, {"type": "stdin_stdout", "input": "20 58\n93398 43 152 99\n", "output": "114790.40000000001\n"}, {"type": "stdin_stdout", "input": "18 46\n10753 23 46 140\n", "output": "3275.2000000000003\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRamesses knows a lot about problems involving trees (undirected connected graphs without cycles)!\n\nHe created a new useful tree decomposition, but he does not know how to construct it, so he asked you for help!\n\nThe d...
[{"type": "stdin_stdout", "input": "9\n1 2\n1 3\n1 4\n1 5\n1 6\n6 7\n7 8\n8 9\n", "output": "Yes\n5\n1 2\n1 3\n1 4\n1 5\n1 9\n"}, {"type": "stdin_stdout", "input": "9\n1 2\n2 3\n1 4\n1 5\n1 6\n6 7\n5 8\n7 9\n", "output": "Yes\n4\n1 3\n1 4\n1 8\n1 9\n"}, {"type": "stdin_stdout", "input": "9\n1 2\n2 3\n1 4\n1 8\n1 6\n6 7...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Arjit is the leader of a marvellous fighting army. His team is very good at fighting against all their enemies. But like Hound from Game of Thrones, Little Arjit and his entire team is scared of fire. When they see...
[{"type": "stdin_stdout", "input": "20\nOOXO*OOXXO*O*O*OXXOO**XX***OOO*XXX*XOOOOXXX**O***X*OO**X**OOXX*X**OXO*XXXX*X**X*OXX**XX**OXX*XOOOXX*XO*O*X**XXO*O**OX*O*OXXOX*X*XOXO*XX*O***OX**X*XXO*OXX**O*XO**O**O*OO*OXO**XX*OXOO**O**XO*O*OXO**XXXX*OOO***OOOXXXX*X*XX***O*OX***OX*X*OXXO***X*XO*OO*OXOOXO*X*OXX**OX**XX*XX**XO**X*...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given N sticks, the length of the i^th stick being ai . As your professor is very interested in triangles he gives you a problem:\nFrom the N given sticks, choose 3 sticks that form a triangle. If there are many s...
[{"type": "stdin_stdout", "input": "2\n5\n1 8 1 1 11\n3\n13 114 111\n\nSLMPAF", "output": "1 1 1\n13 111 114\n"}, {"type": "stdin_stdout", "input": "2\n5\n0 13 1 1 12\n3\n16 114 100\n\nMATPLF", "output": "-1\n16 100 114\n"}, {"type": "stdin_stdout", "input": "2\n5\n0 8 1 1 11\n3\n10 114 111\n\nSAMPLF", "output": "-1\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have a part to play in the Wars to Come.\n\nAs everyone knows, Lord Stannis Baratheon (First of His Name, King of the Andals and the First Men, Lord of the Seven Kingdoms and Protector of the Realm) is one true king. ...
[{"type": "stdin_stdout", "input": "4\n120 24 1 34 \n36", "output": "1\n"}, {"type": "stdin_stdout", "input": "4\n120 24 1 11 \n36", "output": "1\n"}, {"type": "stdin_stdout", "input": "4\n45 34 1 34 \n90", "output": "3\n"}, {"type": "stdin_stdout", "input": "4\n45 15 1 34 \n90", "output": "3\n"}, {"type": "stdin_stdou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConstraints\n\n* All values in input are integers.\n* 1\\leq N, M\\leq 12\n* 1\\leq X\\leq 10^5\n* 1\\leq C_i \\leq 10^5\n* 0\\leq A_{i, j} \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format...
[{"type": "stdin_stdout", "input": "8 5 22\n100 5 10 10 5 1\n56 5 9 1 12 8\n334 7 2 1 2 1\n433 4 5 2 8 2\n568 5 4 3 5 6\n235 3 5 6 10 7\n394 0 6 0 6 2\n1100 8 4 0 7 2", "output": "1392\n"}, {"type": "stdin_stdout", "input": "8 5 22\n100 5 10 10 5 1\n48 5 9 1 12 8\n334 7 2 1 2 1\n433 4 5 2 8 2\n568 5 4 3 5 6\n235 3 5 6 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi has K 500-yen coins. (Yen is the currency of Japan.) If these coins add up to X yen or more, print `Yes`; otherwise, print `No`.\n\nConstraints\n\n* 1 \\leq K \\leq 100\n* 1 \\leq X \\leq 10^5\n\nInput\n\nInput ...
[{"type": "stdin_stdout", "input": "13 1282", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "10 1282", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "4 1282", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "8 1282", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "10 333", "output": "Yes\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given N integers; the i-th of them is A_i. Find the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n*...
[{"type": "stdin_stdout", "input": "5\n52\n-1\n-2\n-2\n-1", "output": "110\n"}, {"type": "stdin_stdout", "input": "5\n89\n-1\n-2\n-2\n-1", "output": "184\n"}, {"type": "stdin_stdout", "input": "5\n46\n-1\n-4\n-2\n-1", "output": "102\n"}, {"type": "stdin_stdout", "input": "5\n115\n-1\n0\n-2\n-1", "output": "236\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs.\n\nDetermine if it is possible that there are exactly X cats among these A + B ani...
[{"type": "stdin_stdout", "input": "-1 -1 10", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-2 -1 10", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-3 -1 10", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-3 -1 17", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-5 -1 11", "output": "NO...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different.\n\nConstraints\n\n* 2 ≤ |S| ≤ 26, where |S| denotes the length of S.\n* S consists of lowercase En...
[{"type": "stdin_stdout", "input": "uncopyrightable", "output": "yes"}, {"type": "stdin_stdout", "input": "uncopyrightacle", "output": "no\n"}, {"type": "stdin_stdout", "input": "elcathgirypocnu", "output": "no\n"}, {"type": "stdin_stdout", "input": "elcathgirxpocnu", "output": "no\n"}, {"type": "stdin_stdout", "input"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either `.` or `*`. The character representing the pixel at the i-th row from the top and the j-th column from the l...
[{"type": "stdin_stdout", "input": "9 20\n.....***....***.....\n....*...*..*...*....\n...*.....**.....*...\n...*.....*......*...\n....*.....*....*....\n.....**..*...**.....\n.......*.*..*.......\n........**.*........\n.........**.........", "output": ".....***....***.....\n.....***....***.....\n....*...*..*...*....\n.....
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a magic room in a homestead. The room is paved with H × W tiles. There are five different tiles:\n\n* Tile with a east-pointing arrow\n* Tile with a west-pointing arrow\n* Tile with a south-pointing arrow\n* Tile...
[{"type": "stdin_stdout", "input": "10 10\n>>>v..>>>v\n...v..^..v\n>>>>>>^..v\n.........v\n.v<<<<...v\n.v.v.^...v\n.v.v.^<<<<\n.v.v.....v\n.v...^...v\n.?>>>^....\n6 10\n>>>>>>>>>v\n.........v\n.........v\n>>>>v....v\n^...v....v\n^<<<<<<<<<\n0 0", "output": "LOOP\nLOOP\n"}, {"type": "stdin_stdout", "input": "10 10\n>>>....
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBased on the information of the time when study started and the time when study ended, check whether the total time studied in one day is t or more, and if not, create a program to find the shortage time. Time is one unit...
[{"type": "stdin_stdout", "input": "10\n3\n6 11\n12 15\n18 22\n14\n2\n6 14\n13 20\n0", "output": "OK\nOK\n"}, {"type": "stdin_stdout", "input": "10\n3\n6 11\n12 15\n34 22\n14\n2\n6 14\n13 20\n0", "output": "14\nOK\n"}, {"type": "stdin_stdout", "input": "10\n3\n20 11\n2 15\n34 22\n13\n2\n4 14\n13 33\n0", "output": "18\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTaro, a boy who hates any inefficiencies, pays coins so that the number of coins to be returned as change is minimized in order to do smoothly when he buys something.\n\nOne day, however, he doubt if this way is really ef...
[{"type": "stdin_stdout", "input": "123 3 0 2 0 2 0\n1263 14 10 9 3 18 1\n0 0 0 0 0 0 0", "output": "6\n13\n"}, {"type": "stdin_stdout", "input": "167 3 1 2 1 2 1\n1826 9 9 9 1 15 10\n0 0 0 0 0 0 0", "output": "6\n10\n"}, {"type": "stdin_stdout", "input": "123 6 1 2 1 1 2\n999 17 15 9 2 16 10\n0 0 0 0 0 0 0", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWhist is a game played by four players with a standard deck of playing cards. The players seat around a table, namely, in north, east, south, and west. This game is played in a team-play basis: the players seating opposit...
[{"type": "stdin_stdout", "input": "H\n4C 8H QS 5D JD KS 8S AH 6H 7H 3S 7S 6D\nTC JC JS KD AC QC QD 2H QH 3H 3C 7C 4D\n6C 9C AS TD 5H 6S 5S KH TH AD 9S 8D 2D\n8C 5C 2S 7D KC 4S TS JH 4H 9H 2C 9D 3D\nD\n8D 9D 9S QS 4H 5H JD JS 9H 6S TH 6H QH\nQD 9C 5S 7S 7H AC 2D KD 6C 3D 8C TC 7C\n5D QC 3S 4S 3H 3D 6D KS JC AS 5C H8 TS...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAn undirected graph is given. Each edge of the graph disappears with a constant probability. Calculate the probability with which the remained graph is connected.\n\n\n\nInput\n\nThe first line contains three integers N (...
[{"type": "stdin_stdout", "input": "4 5 50\n1 2\n2 3\n3 4\n4 1\n1 3", "output": "0.437500000000"}, {"type": "stdin_stdout", "input": "4 5 50\n1 2\n2 3\n3 4\n4 2\n1 3", "output": "0.437500000\n"}, {"type": "stdin_stdout", "input": "4 5 50\n2 2\n2 3\n3 4\n4 1\n1 3", "output": "0.250000000\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMin Element\n\nGiven the sequence a_1, a_2, .., a_N.\n\nFind the minimum number in this sequence.\n\nIf the minimum value is in more than one place, answer the one with the lowest number.\n\ninput\n\n\nN\na_1 a_2 ... a_N\...
[{"type": "stdin_stdout", "input": "6\n10 17 3 2 6 -1", "output": "6\n"}, {"type": "stdin_stdout", "input": "6\n3 33 0 2 10 -1", "output": "6\n"}, {"type": "stdin_stdout", "input": "6\n3 55 0 2 10 -1", "output": "6\n"}, {"type": "stdin_stdout", "input": "6\n3 55 0 4 10 -1", "output": "6\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRemainder of Big Integers\n\nGiven two integers $A$ and $B$, compute the remainder of $\\frac{A}{B}$.\n\nInput\n\nTwo integers $A$ and $B$ separated by a space character are given in a line.\n\nOutput\n\nPrint the remaind...
[{"type": "stdin_stdout", "input": "10 16", "output": "10\n"}, {"type": "stdin_stdout", "input": "11 12", "output": "11\n"}, {"type": "stdin_stdout", "input": "12 47", "output": "12\n"}, {"type": "stdin_stdout", "input": "14 28", "output": "14\n"}, {"type": "stdin_stdout", "input": "18 11", "output": "7\n"}, {"type": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs you know, majority of students and teachers of Summer Informatics School live in Berland for the most part of the year. Since corruption there is quite widespread, the following story is not uncommon.\n\nElections are ...
[{"type": "stdin_stdout", "input": "10 10\n7 29\n10 31\n9 40\n5 17\n5 30\n6 85\n2 53\n7 23\n4 57\n10 9\n", "output": "49\n"}, {"type": "stdin_stdout", "input": "10 10\n5 81\n7 68\n7 48\n1 10\n5 37\n7 97\n8 54\n7 41\n7 56\n5 21\n", "output": "110\n"}, {"type": "stdin_stdout", "input": "10 10\n7 29\n10 54\n9 40\n5 17\n5 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBerland State University invites people from all over the world as guest students. You can come to the capital of Berland and study with the best teachers in the country.\n\nBerland State University works every day of the...
[{"type": "stdin_stdout", "input": "3\n4\n0 1 0 0 0 0 0\n100000000\n1 0 0 0 1 0 1\n1\n1 0 0 0 0 0 0\n", "output": "22\n233333332\n1\n"}, {"type": "stdin_stdout", "input": "3\n4\n0 1 0 0 0 0 0\n100000000\n1 1 0 0 1 0 1\n1\n1 0 0 0 0 0 0\n", "output": "22\n174999998\n1\n"}, {"type": "stdin_stdout", "input": "3\n4\n0 1 0 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently you have received two positive integer numbers x and y. You forgot them, but you remembered a shuffled list containing all divisors of x (including 1 and x) and all divisors of y (including 1 and y). If d is a di...
[{"type": "stdin_stdout", "input": "128\n540 90 378 3780 270 35 180 15 6 14 20 3780 2520 140 1080 54 540 120 1890 15 420 840 20 756 10 126 42 54 36 14 216 8 168 210 60 7 63 2 216 21 30 189 28 135 2 630 21 30 60 1512 7560 70 5 12 40 7560 252 378 3 108 5 72 10 3 28 24 1 27 9 45 180 56 1260 945 1080 420 168 2520 18 70 1 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBob is decorating his kitchen, more precisely, the floor. He has found a prime candidate for the tiles he will use. They come in a simple form factor — a square tile that is diagonally split into white and black part as d...
[{"type": "stdin_stdout", "input": "1000 1000\n", "output": "708964705\n"}, {"type": "stdin_stdout", "input": "1000 1001\n", "output": "419685057\n"}, {"type": "stdin_stdout", "input": "1000 122\n", "output": "712990290\n"}, {"type": "stdin_stdout", "input": "1000 0001\n", "output": "46452554\n"}, {"type": "stdin_stdou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nn robots have escaped from your laboratory! You have to find them as soon as possible, because these robots are experimental, and their behavior is not tested yet, so they may be really dangerous!\n\nFortunately, even tho...
[{"type": "stdin_stdout", "input": "4\n2\n-1 -2 0 0 0 0\n-1 -2 0 0 0 0\n3\n1 5 1 1 1 1\n2 5 0 0 0 1\n4 5 1 0 0 1\n2\n754 1337 0 1 1 1\n1336 1337 1 1 0 1\n1\n3 5 1 1 1 1\n", "output": "1 -1 -2\n1 2 -100000\n1 754 -100000\n1 -100000 -100000\n"}, {"type": "stdin_stdout", "input": "4\n2\n-1 -2 0 0 0 0\n-1 -2 0 0 0 0\n3\n1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is the number of elements in the array.\n\nYou are given an array a consisting of n integers. In one move you can choose any a_i and divide it by 2 rounding down (in othe...
[{"type": "stdin_stdout", "input": "50 25\n199970 199997 199998 199988 199999 199981 200000 199990 199974 199985 199932 200000 199966 199999 199999 199951 199983 199975 199974 199996 199974 199992 199979 199995 199955 199989 199960 199975 199983 199990 199950 199952 199999 199999 199962 199939 199979 199977 199962 1999...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs the name of the task implies, you are asked to do some work with segments and trees.\n\nRecall that a tree is a connected undirected graph such that there is exactly one simple path between every pair of its vertices.\...
[{"type": "stdin_stdout", "input": "20\n11 13\n21 38\n29 33\n10 18\n4 9\n2 6\n26 28\n15 39\n12 17\n8 19\n27 36\n20 22\n14 16\n3 5\n1 7\n24 37\n31 35\n30 32\n34 40\n23 25\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "20\n20 22\n9 11\n32 36\n8 12\n14 16\n4 6\n28 30\n29 37\n15 18\n33 35\n27 31\n21 25\n2 7\n19...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRoma is playing a new expansion for his favorite game World of Darkraft. He made a new character and is going for his first grind.\n\nRoma has a choice to buy exactly one of n different weapons and exactly one of m differ...
[{"type": "stdin_stdout", "input": "10 10 10\n51 87\n68 600\n82 1284\n33 936\n55 242\n89 1990\n58 357\n66 666\n62 512\n51 87\n92 1670\n56 280\n56 280\n91 1631\n77 1091\n89 1554\n61 473\n98 1901\n77 1091\n77 1091\n86 15 759\n43 58 386\n68 33 386\n39 62 386\n95 6 386\n74 27 386\n94 7 386\n17 36 386\n105 4 386\n45 56 386\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nToday Johnny wants to increase his contribution. His plan assumes writing n blogs. One blog covers one topic, but one topic can be covered by many blogs. Moreover, some blogs have references to each other. Each pair of bl...
[{"type": "stdin_stdout", "input": "25 50\n25 2\n6 17\n11 4\n3 18\n11 20\n6 7\n24 15\n1 8\n13 5\n12 25\n15 18\n14 21\n13 6\n5 10\n3 14\n1 2\n23 13\n12 20\n6 4\n8 9\n3 5\n10 7\n20 2\n20 16\n7 4\n8 25\n15 6\n24 14\n2 23\n2 13\n11 3\n16 21\n18 10\n22 1\n5 24\n6 18\n22 23\n4 13\n8 18\n5 20\n22 17\n20 7\n19 15\n10 12\n2 3\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the game of Mastermind, there are two players — Alice and Bob. Alice has a secret code, which Bob tries to guess. Here, a code is defined as a sequence of n colors. There are exactly n+1 colors in the entire universe, ...
[{"type": "stdin_stdout", "input": "7\n5 2 4\n3 1 1 2 5\n5 3 4\n1 1 2 1 2\n4 0 4\n5 5 3 3\n4 1 1\n2 3 2 3\n6 1 2\n3 2 1 1 1 1\n6 2 4\n3 3 2 1 1 1\n6 3 6\n1 1 3 2 1 1\n", "output": "YES\n5 1 1 4 2 \nYES\n3 1 1 1 2 \nYES\n3 3 5 5 \nYES\n1 1 1 3 \nYES\n4 4 4 4 3 1 \nYES\n2 1 4 4 1 1 \nYES\n2 1 1 3 1 1 \n"}, {"type": "stdi...
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 quirky....
[{"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 20 5 100\n1000000 1 6 100 10 1000000\n", "output": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have a knapsack with the capacity of W. There are also n items, the i-th one has weight w_i. \n\nYou want to put some of these items into the knapsack in such a way that their total weight C is at least half of its si...
[{"type": "stdin_stdout", "input": "3\n1 3\n3\n6 2\n19 8 19 69 9 4\n7 12\n1 1 1 17 1 1 1\n", "output": "1\n1 \n-1\n6\n1 2 3 5 6 7 \n"}, {"type": "stdin_stdout", "input": "3\n1 3\n3\n6 2\n19 8 19 69 9 4\n7 12\n1 1 1 17 1 1 1\n", "output": "1\n1\n-1\n6\n1 2 3 5 6 7 \n"}, {"type": "stdin_stdout", "input": "3\n1 3\n3\n6 2\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp found under the Christmas tree an array a of n elements and instructions for playing with it: \n\n * At first, choose index i (1 ≤ i ≤ n) — starting position in the array. Put the chip at the index i (on the val...
[{"type": "stdin_stdout", "input": "4\n5\n6 5 2 2 8\n3\n2 1 12\n6\n2 1111 2 3 995 1\n5\n1 1 1 1 4\n", "output": "10\n14\n1111\n8\n"}, {"type": "stdin_stdout", "input": "4\n5\n6 5 2 2 8\n3\n2 1 15\n6\n2 1111 2 3 995 1\n5\n1 1 1 1 4\n", "output": "10\n17\n1111\n8\n"}, {"type": "stdin_stdout", "input": "4\n5\n12 3 1 2 3\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have a malfunctioning microwave in which you want to put some bananas. You have n time-steps before the microwave stops working completely. At each time-step, it displays a new operation.\n\nLet k be the number of ban...
[{"type": "stdin_stdout", "input": "1 11111\n1 1110101 7\n", "output": "-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consi...
[{"type": "stdin_stdout", "input": "ttspivgoupgupvgpusvppogsseueusuglpiugssviuutlvgvugtpovuvspvpipggooplgvgugpogvesppulovugsvuougveiivgvslllviogpvtolepglguuellotpvgevspvoiiggiiplppgosuguvtstttpielteuglopgeoeeuivtptggltoltpgliviotsospvitupiopisoetupvvspooilsopslpoloptigstspoiuutiuvvuvlpplvioitsuvlpvtleveslslovolloogsgpv...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.\n\nWe'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence...
[{"type": "stdin_stdout", "input": "zyxzxzwyxywxxwabcdabdacdbcacdbcacabaaba\n", "output": "zzzyyxxwddddccbba\n"}, {"type": "stdin_stdout", "input": "zyxzxzwyxywxxwabcdabcacdbcacdbdacabaaba\n", "output": "zzzyyxxwddddcbba\n"}, {"type": "stdin_stdout", "input": "thankstosamarasauteddybearsforthiscontest\n", "output": "yt...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nJabber ID on the national Berland service «Babber» has a form <username>@<hostname>[/resource], where \n\n * <username> — is a sequence of Latin letters (lowercase or uppercase), digits or underscores characters «_», the...
[{"type": "stdin_stdout", "input": "IGsma3L6YTJRrXS@1g.yR3mC.c.xoCns7Wo1.9C.Oe.5ebkR/_97Ltj3\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "IGsma3K6YTJRrXS@1g.yR3mC.c.xoCns7Wo1.9C.Oe.5ebkR/_97Ltj3\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "POTjlYcxAZsbyZPDh@sPm.z6aVaO.H1wEUhD9YvROQFUk/M_jTHS...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEmuskald is a well-known illusionist. One of his trademark tricks involves a set of magical boxes. The essence of the trick is in packing the boxes inside other boxes.\n\nFrom the top view each magical box looks like a sq...
[{"type": "stdin_stdout", "input": "15\n999999986 268435456\n999999987 67108864\n999999988 16777216\n999999989 4194304\n999999990 1048576\n999999991 262144\n999999992 65536\n999999993 16384\n999999994 4096\n999999995 1024\n999999996 256\n999999997 64\n999999998 16\n999999999 4\n1000000000 1\n", "output": "1000000001"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe problem uses a simplified TCP/IP address model, please make sure you've read the statement attentively.\n\nPolycarpus has found a job, he is a system administrator. One day he came across n IP addresses. Each IP addre...
[{"type": "stdin_stdout", "input": "15 8\n244.1.125.160\n39.50.68.162\n142.253.101.137\n52.239.241.147\n194.4.189.143\n200.238.160.30\n245.78.177.243\n89.249.140.19\n169.51.142.22\n123.246.20.99\n133.44.192.119\n226.240.179.30\n76.209.211.184\n98.15.6.117\n227.219.117.153\n", "output": "-1\n"}, {"type": "stdin_stdout",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSmart Beaver decided to be not only smart, but also a healthy beaver! And so he began to attend physical education classes at school X. In this school, physical education has a very creative teacher. One of his favorite w...
[{"type": "stdin_stdout", "input": "200\n1 2 1 1 2 2 1 1 1 1 1 1 2 1 2 2 2 2 2 1 2 2 1 1 2 2 2 2 2 1 2 1 1 2 2 2 1 2 2 2 1 1 2 2 2 1 2 2 1 2 1 2 2 1 2 2 2 2 2 1 2 2 1 2 1 1 2 2 2 2 2 2 2 1 2 2 2 1 1 2 2 2 2 1 1 2 2 1 1 1 2 2 1 1 2 2 1 1 2 2 2 1 2 2 2 1 2 1 2 2 2 2 2 2 2 1 1 1 2 2 2 2 1 2 2 2 1 1 2 2 2 2 2 1 2 1 2 1 1 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn one little known, but very beautiful country called Waterland, lives a lovely shark Valerie. Like all the sharks, she has several rows of teeth, and feeds on crucians. One of Valerie's distinguishing features is that w...
[{"type": "stdin_stdout", "input": "54 22 1009\n15 7\n17 7\n11 9\n6 11\n12 9\n13 8\n13 12\n22 11\n20 9\n20 7\n16 11\n19 12\n3 12\n15 9\n1 12\n2 10\n16 10\n16 10\n14 10\n15 11\n11 9\n14 8\n10 10\n16 12\n1 8\n3 8\n21 11\n18 12\n2 6\n9 11\n11 7\n15 9\n20 11\n6 8\n8 8\n19 11\n15 7\n9 9\n22 3\n12 9\n17 9\n17 11\n12 7\n15 9\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya is a beginner programmer. He has already mastered the basics of the C++ language and moved on to learning algorithms. The first algorithm he encountered was insertion sort. Petya has already written the code that im...
[{"type": "stdin_stdout", "input": "150\n48 115 13 9 105 117 41 136 123 32 84 95 62 50 140 106 145 91 57 141 139 35 45 27 129 63 137 10 37 60 44 30 101 119 138 78 22 103 39 134 49 36 25 12 28 67 69 99 148 26 16 87 146 65 8 74 14 38 47 89 81 19 40 11 64 43 110 66 102 3 122 124 100 2 125 42 97 73 121 7 52 23 29 109 1 70 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this problem we consider a special type of an auction, which is called the second-price auction. As in regular auction n bidders place a bid which is price a bidder ready to pay. The auction is closed, that is, each bi...
[{"type": "stdin_stdout", "input": "100\n2515 3324 7975 6171 4240 1217 4829 5203 8603 6900 3031 4699 4732 6070 4221 3228 6497 7359 9130 4346 4619 1109 3945 5442 3271 16 9711 2045 6410 2301 3406 8125 6003 1892 1260 9661 3940 6692 4708 7027 4930 6925 1979 5361 4263 3144 867 8639 6230 5562 9714 3676 4231 3347 4733 4920 48...
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 34 28 28 28 40 28 28 28 28 28 28 28 28 28 28 28 28 28 28 47 28 28 28 28 28 28 28 28 28 28 28 28 28 19 28 28 28 28 28 28 28 28 28 28 28 28 28 46 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 49 28 28 28 28 28 28 28 31 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\nAlex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.\n\nGiven a sequence a consisting of n integers. The player can m...
[{"type": "stdin_stdout", "input": "100\n4 8 10 1 8 8 8 1 10 3 1 8 6 8 6 1 10 3 3 3 3 7 2 1 1 6 10 1 7 9 8 10 3 8 6 2 1 6 5 6 10 8 9 7 4 3 10 5 3 9 10 5 10 8 8 5 7 8 9 5 3 18 9 2 7 8 2 10 4 9 2 8 10 10 5 8 5 1 7 3 4 5 2 2 9 3 2 5 6 2 3 10 1 5 9 6 10 4 10 8\n", "output": "392\n"}, {"type": "stdin_stdout", "input": "100\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya studies in a school and he adores Maths. His class has been studying arithmetic expressions. On the last class the teacher wrote three positive integers a, b, c on the blackboard. The task was to insert signs of ope...
[{"type": "stdin_stdout", "input": "10\n10\n10\n", "output": "1000\n"}, {"type": "stdin_stdout", "input": "10\n5\n6\n", "output": "300\n"}, {"type": "stdin_stdout", "input": "9\n14\n2\n", "output": "252\n"}, {"type": "stdin_stdout", "input": "4\n3\n10\n", "output": "120\n"}, {"type": "stdin_stdout", "input": "10\n9\n6\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMisha and Vasya participated in a Codeforces contest. Unfortunately, each of them solved only one problem, though successfully submitted it at the first attempt. Misha solved the problem that costs a points and Vasya solv...
[{"type": "stdin_stdout", "input": "1297 2000 101 180\n", "output": "Misha\n"}, {"type": "stdin_stdout", "input": "1250 2500 000 176\n", "output": "Misha\n"}, {"type": "stdin_stdout", "input": "2851 1250 176 130\n", "output": "Misha\n"}, {"type": "stdin_stdout", "input": "1500 1250 180 264\n", "output": "Misha\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVanya got an important task — he should enumerate books in the library and label each book with its number. Each of the n books should be assigned with a number from 1 to n. Naturally, distinct books should be assigned di...
[{"type": "stdin_stdout", "input": "1000000000\n", "output": "8888888899\n"}, {"type": "stdin_stdout", "input": "999999998\n", "output": "8888888880\n"}, {"type": "stdin_stdout", "input": "999999999\n", "output": "8888888889\n"}, {"type": "stdin_stdout", "input": "222222222\n", "output": "1888888896\n"}, {"type": "stdi...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a programing contest named SnakeUp, 2n people want to compete for it. In order to attend this contest, people need to form teams of exactly two people. You are given the strength of each possible combination of t...
[{"type": "stdin_stdout", "input": "3\n1000000\n999999 999998\n999997 999996 999995\n999994 999993 999992 999991\n999990 999989 999988 999987 999986\n", "output": "2 1 4 3 6 5\n"}, {"type": "stdin_stdout", "input": "3\n487060\n3831 161856\n845957 794650 976977\n83847 50566 691206 498447\n698377 156232 59015 382455 6269...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have array a that contains all integers from 1 to n twice. You can arbitrary permute any numbers in a.\n\nLet number i be in positions xi, yi (xi < yi) in the permuted array a. Let's define the value di = yi - xi — th...
[{"type": "stdin_stdout", "input": "1376\n", "output": "1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137 139 141 143 145 147 149 151 153 155 157 159...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya decided to pass a very large integer n to Kate. First, he wrote that number as a string, then he appended to the right integer k — the number of digits in n. \n\nMagically, all the numbers were shuffled in arbitrary...
[{"type": "stdin_stdout", "input": "11111111111101101111110101011111010101001111001110010011810010110111101101112140110110\n110101100101111101011111111101111111111110111110011111011000111010100111011111000002\n", "output": "110101100101111101011111111101111111111110111110011111011000111010100111011111000002"}, {"type":...
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 632184275887310175 498293278222136720 551099726729989816 149940343283925029 989425634209891686\n", "output": "461895893/385687671\n"}, {"type": "std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDexterina and Womandark have been arch-rivals since they’ve known each other. Since both are super-intelligent teenage girls, they’ve always been trying to solve their disputes in a peaceful and nonviolent way. After god ...
[{"type": "stdin_stdout", "input": "1000000 50\n0.034403 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.033928 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.071853 0.000000 0.000000 0.016440 0.000000 0.000000 0.000000 0.000000 0.023167 0.067938 0.000000 0.000000 0.000000 0.000000 0....
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this problem you will write a simple generator of Brainfuck (<https://en.wikipedia.org/wiki/Brainfuck>) calculators.\n\nYou are given an arithmetic expression consisting of integers from 0 to 255 and addition/subtracti...
[{"type": "stdin_stdout", "input": "0-255-255-255-255+255+255+255+255+255\n", "output": "++++++++++++++++++++++++++++++++++++++++++++++++++.>\n+++++++++++++++++++++++++++++++++++++++++++++++++++++.>\n+++++++++++++++++++++++++++++++++++++++++++++++++++++.>\n"}, {"type": "stdin_stdout", "input": "293+235+47+150+222-3-90-...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDue to the recent popularity of the Deep learning new countries are starting to look like Neural Networks. That is, the countries are being built deep with many layers, each layer possibly having many cities. They also ha...
[{"type": "stdin_stdout", "input": "5 4 3\n2 1 0 1 2\n0 1 2 1 0\n1 2 1 0 2\n", "output": "209\n"}, {"type": "stdin_stdout", "input": "5 4 3\n2 1 0 1 2\n0 1 2 1 0\n1 2 1 0 1\n", "output": "210\n"}, {"type": "stdin_stdout", "input": "4 4 4\n0 1 3 2\n1 2 0 3\n2 3 1 0\n", "output": "64\n"}, {"type": "stdin_stdout", "input"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEighth-grader Vova is on duty today in the class. After classes, he went into the office to wash the board, and found on it the number n. He asked what is this number and the teacher of mathematics Inna Petrovna answered ...
[{"type": "stdin_stdout", "input": "1000010010\n", "output": "2\n1000009977 1000010004\n"}, {"type": "stdin_stdout", "input": "1010011010\n", "output": "2\n1010010985 1010011003\n"}, {"type": "stdin_stdout", "input": "1100011010\n", "output": "2\n1100010985 1100011003\n"}, {"type": "stdin_stdout", "input": "999999979\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGirl Lena likes it when everything is in order, and looks for order everywhere. Once she was getting ready for the University and noticed that the room was in a mess — all the objects from her handbag were thrown about th...
[{"type": "stdin_stdout", "input": "-44 47\n24\n96 -18\n-50 86\n84 68\n-25 80\n-11 -15\n-62 0\n-42 50\n-57 11\n-5 27\n-44 67\n-77 -3\n-27 -46\n32 63\n86 13\n-21 -51\n-25 -123\n-14 -2\n-21 86\n-92 -94\n-44 -34\n-74 55\n91 -35\n-10 55\n-34 16\n", "output": "208370\n0 1 22 0 2 10 0 3 14 0 4 18 0 5 20 0 6 11 0 7 0 8 24 0 9...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nImp is in a magic forest, where xorangles grow (wut?)\n\n<image>\n\nA xorangle of order n is such a non-degenerate triangle, that lengths of its sides are integers not exceeding n, and the xor-sum of the lengths is equal ...
[{"type": "stdin_stdout", "input": "1051\n", "output": "145985\n"}, {"type": "stdin_stdout", "input": "2498\n", "output": "699536\n"}, {"type": "stdin_stdout", "input": "1508\n", "output": "247634\n"}, {"type": "stdin_stdout", "input": "2451\n", "output": "681980\n"}, {"type": "stdin_stdout", "input": "1566\n", "output...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThroughout Igor K.'s life he has had many situations worthy of attention. We remember the story with the virus, the story of his mathematical career and of course, his famous programming achievements. However, one does no...
[{"type": "stdin_stdout", "input": "446237720 920085248 296916273 439113596\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "491259590 529594367 305425951 326414536\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "960442940 572344654 77422042 406189391\n", "output": "1\n"}, {"type": "stdin_stdout", "inp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya has an array a consisting of n integers. He wants to remove duplicate (equal) elements.\n\nPetya wants to leave only the rightmost entry (occurrence) for each element of the array. The relative order of the remainin...
[{"type": "stdin_stdout", "input": "48\n992 995 992 991 994 992 995 999 996 993 999 995 993 992 1000 992 568 996 991 993 992 998 998 998 999 995 992 992 993 992 992 995 996 995 997 991 997 991 999 994 994 997 1000 32 1000 992 1000 999\n", "output": "12\n568 998 993 996 995 991 994 997 32 992 1000 999\n"}, {"type": "std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nView Russian Translation\n\nLimak is a little polar bear.\nToday he found something delicious in the snow.\nIt's a square bar of chocolate with N x N pieces.\nSome pieces are special because there are cherries on them.\nY...
[{"type": "stdin_stdout", "input": "2\n3\n###\n#$.\n##$\n4\n####\n.##.\n.#..\n#...\n\nELPMAS", "output": "YES\nYES\n"}, {"type": "stdin_stdout", "input": "2\n3\n$##\n#\".\n###\n4\n####\n.##.\n.#..\n...#\n\nSAMFLP", "output": "YES\nYES\n"}, {"type": "stdin_stdout", "input": "2\n3\n$##\n#\".\n###\n4\n####\n.##.\n.#..\n./...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Pandey and GJ are coding buddies - since they are the part of ACM ICPC team together. But, GJ is fed up of Pandey's weird coding habits - like using editors which are slow, and irritating. Importantly, GJ believes ...
[{"type": "stdin_stdout", "input": "50\n86\n185 167 338 174 500 611 873 127 977 68 411 560 882 867 950 515 871 490 716 444 657 565 207 178 667 503 980 371 220 998 576 91 11 989 199 582 269 439 266 678 525 871 180 14 742 447 333 893 400 499 477 708 315 635 706 443 957 663 855 438 280 491 731 753 360 333 806 310 551 381 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou need to handle two extraordinarily large integers. The good news is that you don't need to perform any arithmetic operation on them. You just need to compare them and see whether they are equal or one is greater than ...
[{"type": "stdin_stdout", "input": "25\n0!\n1\n9!\n1828952637\n9!!\n999999999\n456!!!\n123!!!!!!\n5!\n120\n9!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n999999999!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n0!\n1\n2!\n1\n2!\n2\n6\n3!\n4!\n24\n5!\n120\n1077\n6!\n5040!\n7!!\n8!!!\n40320!!\n862380!!!\n9!!!!\n10!!!!!\n...
code_stdio