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\nPrincess'Marriage\n\nMarriage of a princess\n\nEnglish text is not available in this practice contest.\n\nA brave princess in a poor country, knowing that gambling payouts are determined by the parimutuel method, felt mor...
[{"type": "stdin_stdout", "input": "2 8\n7 6\n4 10\n3 2\n5 10\n3 10\n5 10\n0 0", "output": "18\n110\n"}, {"type": "stdin_stdout", "input": "2 8\n7 6\n4 10\n3 3\n5 10\n3 10\n5 10\n0 0", "output": "18\n100\n"}, {"type": "stdin_stdout", "input": "2 8\n5 6\n5 5\n3 3\n4 10\n13 10\n5 10\n0 0", "output": "10\n190\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given strings s and t. Find one longest string that is a subsequence of both s and t.\n\nConstraints\n\n* s and t are strings consisting of lowercase English letters.\n* 1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInp...
[{"type": "stdin_stdout", "input": "abracadabra\navaeakedavra", "output": "aaadara\n"}, {"type": "stdin_stdout", "input": "abracbdaara\navadakedavra", "output": "aadaara\n"}, {"type": "stdin_stdout", "input": "abracbdaara\narvadekadava", "output": "aradaaa\n"}, {"type": "stdin_stdout", "input": "araadbcarba\narvadekada...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIT City company developing computer games invented a new way to reward its employees. After a new game release users start buying it actively, and the company tracks the number of sales with precision to each transaction....
[{"type": "stdin_stdout", "input": "2558402827158016680\n", "output": "1015239217126197\n"}, {"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "396825396825396\n"}, {"type": "stdin_stdout", "input": "1209365011581446835\n", "output": "479906750627558\n"}, {"type": "stdin_stdout", "input": "1155798879...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet {\\rm comb}(n,r) be the number of ways to choose r objects from among n objects, disregarding order.\nFrom n non-negative integers a_1, a_2, ..., a_n, select two numbers a_i > a_j so that {\\rm comb}(a_i,a_j) is maxim...
[{"type": "stdin_stdout", "input": "5\n20 13 1 4 20", "output": "20 13\n"}, {"type": "stdin_stdout", "input": "5\n36 13 1 8 10", "output": "36 13\n"}, {"type": "stdin_stdout", "input": "5\n36 13 1 8 17", "output": "36 17\n"}, {"type": "stdin_stdout", "input": "5\n1 10 -1 2 16", "output": "16 10\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMike has a string s consisting of only lowercase English letters. He wants to change exactly one character from the string so that the resulting one is a palindrome. \n\nA palindrome is a string that reads the same backwa...
[{"type": "stdin_stdout", "input": "scfwrjevejrwfcs\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "thdaonpepdoadht\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "scfwrievejrwfcs\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "thdaodpepnoadht\n", "output": "YES\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWhen you play the game of thrones, you win, or you die. There is no middle ground.\n\nCersei Lannister, A Game of Thrones by George R. R. Martin\n\nThere are $n$ nobles, numbered from $1$ to $n$. Noble $i$ has a power of ...
[{"type": "stdin_stdout", "input": "20 53\n1 2\n1 4\n1 5\n1 6\n1 7\n1 8\n1 20\n2 3\n2 6\n2 16\n2 17\n3 6\n3 18\n3 20\n4 6\n4 7\n4 8\n4 9\n4 14\n4 18\n5 11\n5 13\n5 17\n5 18\n5 19\n6 8\n6 13\n7 8\n7 10\n7 15\n7 17\n7 18\n8 15\n8 16\n9 10\n9 15\n10 11\n10 17\n10 20\n11 15\n11 16\n12 14\n12 15\n12 16\n12 19\n14 16\n14 19\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence $a_1, a_2, \\dots, a_n$ consisting of $n$ integers.\n\nYou can choose any non-negative integer $D$ (i.e. $D \\ge 0$), and for each $a_i$ you can:\n\n add $D$ (only once), i. e. perform $a_i := a_...
[{"type": "stdin_stdout", "input": "100\n49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese , Russian and Vietnamese as well. \n\nYou are given a uniformly randomly generated string S, consisting of letters from the set {\"A\", \"B\"}. Your task is to find a string T ...
[{"type": "stdin_stdout", "input": "2\nABAA\n@BC", "output": "ABA\n-1\n"}, {"type": "stdin_stdout", "input": "2\nBABB\n?BB", "output": "BAB\n-1\n"}, {"type": "stdin_stdout", "input": "2\nAA?A\nBBB", "output": "-1\n-1\n"}, {"type": "stdin_stdout", "input": "2\nABAA\nBAA", "output": "ABA\nA\n"}, {"type": "stdin_stdout", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp takes part in a quadcopter competition. According to the rules a flying robot should:\n\n start the race from some point of a field, go around the flag, close cycle returning back to the starting point. \n\nPo...
[{"type": "stdin_stdout", "input": "-100 -100\n-100 100\n", "output": "406\n"}, {"type": "stdin_stdout", "input": "-100 -100\n100 -100\n", "output": "406\n"}, {"type": "stdin_stdout", "input": "100 -100\n-100 -100\n", "output": "406\n"}, {"type": "stdin_stdout", "input": "-100 100\n-100 -100\n", "output": "406\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWoken up by the alarm clock Igor the financial analyst hurried up to the work. He ate his breakfast and sat in his car. Sadly, when he opened his GPS navigator, he found that some of the roads in Bankopolis, the city wher...
[{"type": "stdin_stdout", "input": "7 7\n.S.****\n...*.*.\n.****..\n.*.**.*\n..T*...\n***..*.\n**+****\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "7 7\n.S.****\n...*.*.\n.****..\n.*.**.*\n..T*...\n***..*.\n****+**\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "7 7\n.S.****\n...*.*.\n.****..\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTomash keeps wandering off and getting lost while he is walking along the streets of Berland. It's no surprise! In his home town, for any pair of intersections there is exactly one way to walk from one intersection to the...
[{"type": "stdin_stdout", "input": "8 56\n1 2\n1 3\n1 4\n1 5\n1 6\n1 7\n1 8\n2 1\n2 3\n2 4\n2 5\n2 6\n2 7\n2 8\n3 1\n3 2\n3 4\n3 5\n3 6\n3 7\n3 8\n4 1\n4 2\n4 3\n4 5\n4 6\n4 7\n4 8\n5 1\n5 2\n5 3\n5 4\n5 6\n5 7\n5 8\n6 1\n6 2\n6 3\n6 4\n6 5\n6 7\n6 8\n7 1\n7 2\n7 3\n7 4\n7 5\n7 6\n7 8\n8 1\n8 2\n8 3\n8 4\n8 5\n8 6\n8 7...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKatie, Kuro and Shiro are best friends. They have known each other since kindergarten. That's why they often share everything with each other and work together on some very hard problems.\n\nToday is Shiro's birthday. She...
[{"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "1000000000000000001\n"}, {"type": "stdin_stdout", "input": "1043714136496022950\n", "output": "1043714136496022951\n"}, {"type": "stdin_stdout", "input": "1837625121252532586\n", "output": "1837625121252532587\n"}, {"type": "stdin_stdout", "input": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs you might know, cooking is the process of taking a food item and subjecting it to various processes(like heating, roasting, baking etc).\nA food item gets prepared after it has been subjected to exactly N processes.\nT...
[{"type": "stdin_stdout", "input": "3\n-2 2\n5 10\n1 11", "output": "2\n555841676\n110\n"}, {"type": "stdin_stdout", "input": "3\n-2 2\n4 15\n1 12", "output": "2\n286982263\n132\n"}, {"type": "stdin_stdout", "input": "3\n-16 2\n10 13\n1 6", "output": "2\n131267026\n30\n"}, {"type": "stdin_stdout", "input": "3\n-8 2\n10...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDr. Moriarty is about to send a message to Sherlock Holmes. He has a string s. \n\nString p is called a substring of string s if you can read it starting from some position in the string s. For example, string \"aba\" has...
[{"type": "stdin_stdout", "input": "ksmbytfyhhnstlecripupiwdhbkhfpfmimrbqgszohcqnezcybvwasxmkxfupvuecsctcpadccnqexsglwaiyxcoyheefcjmdedesgjqdtqgrvfjonzesffousooutsjumrxl\nhgjqihcfbnmgufonaiudbjegexexthrzcdkuimwogpbyovemztzcmqnrbhabxyyxyfuzpyhjgnioexbezzupcxlyzuuncstiiqsjzdtqppqhxilvqimlpjejiqbwpeekzweeyvthvjffgfvqauqru...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn order to put away old things and welcome a fresh new year, a thorough cleaning of the house is a must.\n\nLittle Tommy finds an old polynomial and cleaned it up by taking it modulo another. But now he regrets doing thi...
[{"type": "stdin_stdout", "input": "1000000000000000000 2\n", "output": "61\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0 1 1 1 1 1 0 0 1 0 1 1 1 1 1 1 0 1 0 0 1 1 1 0 0 0 0 1 0 0 0 1 0 0 1 \n"}, {"type": "stdin_stdout", "input": "1000000000000000000 2\n", "output": "61\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nStick n circular stickers with a radius of 1 on a square origami paper with a side length of 10. The stickers can be stacked. Create a program that reads the coordinates of the position where the stickers are to be attach...
[{"type": "stdin_stdout", "input": "15\n3.13979,8.51743\n2.39506,3.84915\n2.68432,5.39095\n5.61904,9.16332\n7.85653,4.75593\n2.84021,5.41511\n1.79500,8.59211\n7.55389,8.17604\n4.70665,4.66125\n1.63470,4.42538\n7.34959,4.61981\n5.09003,8.11122\n5.24373,1.30066\n0.13517,1.83659\n7.57313,1.58150\n0", "output": "4\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently, Anton has found a set. The set consists of small English letters. Anton carefully wrote out all the letters from the set in one line, separated by a comma. He also added an opening curved bracket at the beginnin...
[{"type": "stdin_stdout", "input": "{a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N dishes, numbered 1, 2, \\ldots, N. Initially, for each i (1 \\leq i \\leq N), Dish i has a_i (1 \\leq a_i \\leq 3) pieces of sushi on it.\n\nTaro will perform the following operation repeatedly until all the p...
[{"type": "stdin_stdout", "input": "10\n1 3 2 3 3 2 3 2 1 3", "output": "54.48064457488221"}, {"type": "stdin_stdout", "input": "10\n1 3 2 2 3 2 3 2 1 3", "output": "52.8643923040\n"}, {"type": "stdin_stdout", "input": "10\n1 3 3 3 3 2 3 2 1 3", "output": "55.9466970748\n"}, {"type": "stdin_stdout", "input": "10\n1 3 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nValera the horse lives on a plane. The Cartesian coordinate system is defined on this plane. Also an infinite spiral is painted on the plane. The spiral consists of segments: [(0, 0), (1, 0)], [(1, 0), (1, 1)], [(1, 1), (...
[{"type": "stdin_stdout", "input": "37 -100\n", "output": "400\n"}, {"type": "stdin_stdout", "input": "100 100\n", "output": "397\n"}, {"type": "stdin_stdout", "input": "-96 -96\n", "output": "383\n"}, {"type": "stdin_stdout", "input": "100 100\n", "output": "397\n"}, {"type": "stdin_stdout", "input": "37 -100\n", "out...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCreate a program to determine the positional relationship between a triangle and a circle on a plane. All target figures shall include boundaries. The triangle is given the position of three vertices, and the circle is gi...
[{"type": "stdin_stdout", "input": "1 1\n6 0\n3 3\n3 0\n3\n3 11\n1 3\n11 16\n12 4\n5\n15 4\n17 12\n22 5\n7 22\n3\n5 13\n16 2\n16 9\n5 3\n1\n0 0", "output": "b\nd\nd\nd\n"}, {"type": "stdin_stdout", "input": "1 1\n6 0\n3 3\n3 2\n3\n3 11\n1 3\n11 16\n12 7\n5\n15 3\n17 7\n22 5\n7 12\n4\n5 13\n13 2\n16 9\n5 3\n2\n0 0", "ou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp is an organizer of a Berland ICPC regional event. There are $n$ universities in Berland numbered from $1$ to $n$. Polycarp knows all competitive programmers in the region. There are $n$ students: the $i$-th stude...
[{"type": "stdin_stdout", "input": "4\n7\n1 3 1 2 1 2 1\n12 8 3 2 5 1 5\n10\n2 2 2 4 2 2 2 6 3 3\n3435 3014 2197 4336 2893 1527 5359 2175 1961 2567\n6\n3 6 3 3 3 3\n0 11 6 5 9 7\n1\n1\n278\n", "output": "36 28 22 25 0 0 0\n29464 22953 18425 14701 16898 18425 0 0 0 0\n38 27 22 27 27 0\n278\n"}, {"type": "stdin_stdout", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBerland annual chess tournament is coming!\n\nOrganizers have gathered 2Β·n chess players who should be divided into two teams with n people each. The first team is sponsored by BerOil and the second team is sponsored by B...
[{"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 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 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\nThe mobile application store has a new game called \"Subway Roller\".\n\nThe protagonist of the game Philip is located in one end of the tunnel and wants to get out of the other one. The tunnel is a rectangular field cons...
[{"type": "stdin_stdout", "input": "1\n100 26\ns................PPPP.CCCCC..UUUUUU.........YYYQQQQQQQ...GGGGG............MMM.....JJJJ..............\n.OOOOOO....EEE....................................................SSSSSS........LLLLLL......NNNIIII.\n......FFFFFF...VVVV..ZZZBBB...KKKKK..WWWWWWWXXX..RRRRRRR......AAAAADD...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given names of two days of the week.\n\nPlease, determine whether it is possible that during some non-leap year the first day of some month was equal to the first day of the week you are given, while the first day...
[{"type": "stdin_stdout", "input": "wednesday\nwednesday\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "wednesday\nwednesday\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "wednesday\nsaturday\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "wednesday\nsaturday\n", "output": "YES\n"}, {...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMr. A came to Aizu for sightseeing. You can overlook the Aizu Basin from the window of the hotel where you stayed. As I was looking at the scenery, I noticed a piece of the photo on the floor. Apparently I took the outsid...
[{"type": "stdin_stdout", "input": "8 4\n2 1 3 1 1 5 1 3\n2 3 2 4 1 0 2 1\n0 3 -1 2 1 1 4 2\n1 2 3 2 1 1 5 4\n0 2 0 1 1 3 2 1\n1 3 1 2 2 4 3 2\n5 1 2 1 4 1 1 5\n4 1 1 -1 1 2 2 1\n2 -1 -1 -1\n0 3 -1 -1\n-1 2 2 4\n-1 1 -1 1\n5 3\n1 0 2 3 5\n2 3 7 2 1\n2 5 4 2 2\n8 9 0 3 3\n3 6 0 4 7\n-1 -1 2\n-1 3 5\n0 4 -1\n0 0", "outp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBrave Ponta has finally arrived at the final dungeon. This is a dark wilderness in front of the fort of the evil emperor Boromos, with fairly strong monsters guarding their territories.\n\n<image>\n\n\nFigure 1: Wildernes...
[{"type": "stdin_stdout", "input": "2\n1 1\n5 5\n4\n1.0 1.0317956219670807\n1.5068159031079704 3.2675997669892194\n4.150171138530334 2.1332708795299036\n3.0 3.589169796022375\n1\n2.6727744925703703 2.0\n0", "output": "impossible\n4.57812033\nimpossible\n"}, {"type": "stdin_stdout", "input": "2\n1 1\n5 5\n4\n1.0 1.03179...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nValera has array a, consisting of n integers a_0, a_1, ..., a_{n} - 1, and function f(x), taking an integer from 0 to 2^{n} - 1 as its single argument. Value f(x) is calculated by formula $f(x) = \\sum_{i = 0}^{n - 1} a_{...
[{"type": "stdin_stdout", "input": "43\n761 2165 6131 8874 8980 119 8300 9006 6278 7582 4740 6321 10042 6869 3788 17625 1707 5070 3809 335 2494 8255 1123 1430 190 5712 7313 3286 15423 133 1032 3067 8043 5297 5398 12168 13897 2141 1436 10227 362 8438 2300\n0111011100100011110010011110011011010001101\n", "output": "23536...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe arrange the numbers between 1 and N (1 <= N <= 10000) in increasing order and decreasing order like this:\n\n\n1 2 3 4 5 6 7 8 9 . . . N\nN . . . 9 8 7 6 5 4 3 2 1\n\n\nTwo numbers faced each other form a pair. Your ta...
[{"type": "stdin_stdout", "input": "1\n10\n13\n373", "output": "0\n0\n3\n20\n"}, {"type": "stdin_stdout", "input": "1\n175\n19\n12", "output": "0\n14\n4\n2\n"}, {"type": "stdin_stdout", "input": "1\n175\n19\n16", "output": "0\n14\n4\n0\n"}, {"type": "stdin_stdout", "input": "1\n12\n7\n115", "output": "0\n2\n2\n12\n"}, ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is a string S representing the day of the week today.\nS is SUN, MON, TUE, WED, THU, FRI, or SAT, for Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday, respectively.\nAfter how many days is the nex...
[{"type": "stdin_stdout", "input": "SAT\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "SUN\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "FRI\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "MON\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "THU\n", "output": "3\n"}, {"type": "stdi...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is a positive integer N.\nHow many tuples (A,B,C) of positive integers satisfy A \\times B + C = N?\n\n-----Constraints-----\n - 2 \\leq N \\leq 10^6\n - All values in input are integers.\n\n-----Input-----\nInput ...
[{"type": "stdin_stdout", "input": "1000000\n", "output": "13969985\n"}, {"type": "stdin_stdout", "input": "877046\n", "output": "12137262\n"}, {"type": "stdin_stdout", "input": "999931\n", "output": "13968881\n"}, {"type": "stdin_stdout", "input": "999901\n", "output": "13968459\n"}, {"type": "stdin_stdout", "input": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consisting only of lowercase and uppercase Latin letters.\n\nLet A be a set of positions in the string. Let's call it pretty if followin...
[{"type": "stdin_stdout", "input": "200\nrsgraosldglhdoorwhkrsehjpuxrjuwgeanjgezhekprzarelduuaxdnspzjuooguuwnzkowkuhzduakdrzpnslauejhrrkalwpurpuuswdgeadlhjwzjgegwpknepazwwleulppwrlgrgedlwdzuodzropsrrkxusjnuzshdkjrxxpgzanzdrpnggdwxarpwohxdepJ\n", "output": "17\n"}, {"type": "stdin_stdout", "input": "200\nMkuxcDWdcnqsrlT...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two arrays $a$ and $b$, each consisting of $n$ positive integers, and an integer $x$. Please determine if one can rearrange the elements of $b$ so that $a_i + b_i \\leq x$ holds for each $i$ ($1 \\le i \\le ...
[{"type": "stdin_stdout", "input": "4\n3 4\n0 2 -1\n1 2 2\n\n2 6\n1 4\n2 5\n\n4 4\n2 2 3 -1\n3 5 2 4\n\n1 0\n5\n5\n", "output": "Yes\nYes\nNo\nNo\n"}, {"type": "stdin_stdout", "input": "4\n3 4\n0 2 -1\n1 2 2\n\n2 6\n1 4\n2 5\n\n4 4\n2 2 3 -1\n1 5 2 4\n\n1 0\n5\n5\n", "output": "Yes\nYes\nNo\nNo\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVitaly is a very weird man. He's got two favorite digits a and b. Vitaly calls a positive integer good, if the decimal representation of this integer only contains digits a and b. Vitaly calls a good number excellent, if ...
[{"type": "stdin_stdout", "input": "3 6 1000000\n", "output": "786609214\n"}, {"type": "stdin_stdout", "input": "8 9 1000000\n", "output": "573697309\n"}, {"type": "stdin_stdout", "input": "1 2 1000000\n", "output": "786609214\n"}, {"type": "stdin_stdout", "input": "1 2 1000000\n", "output": "786609214\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven are positive integers A and B.\nLet us choose some number of positive common divisors of A and B.\nHere, any two of the chosen divisors must be coprime.\nAt most, how many divisors can we choose?Definition of common...
[{"type": "stdin_stdout", "input": "1000000000000 1000000000000\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "642507465600 642507465600\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "963761198400 963761198400\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "200560490130 200560490130\n", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nA mysterious $ X $ [cm] plant grows in one place. This plant has the following mysterious properties.\n\n* Say \"nobiro\" to this plant and it will grow $ A $ [cm].\n* Say \"tidime\" to this plant and it will g...
[{"type": "stdin_stdout", "input": "109 30 5\n0\norioan\nnobiro\nuifimd", "output": "109\n"}, {"type": "stdin_stdout", "input": "112 30 9\n0\norioan\nniboro\ntieimd", "output": "112\n"}, {"type": "stdin_stdout", "input": "84 122 10\n0\noobrjn\nonciro\nudfimi", "output": "84\n"}, {"type": "stdin_stdout", "input": "17 12...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nGiven a sequence $ a_i $ of length $ N $. Output all integers $ K (1 \\ le K \\ le N) $ that satisfy the following conditions.\n\nCondition: Well sorted $ a_1, \\ cdots, a_K $ matches $ a_ {N-K + 1}, \\ cdots, ...
[{"type": "stdin_stdout", "input": "8\n0 1 1 -24 -1 1 1 0", "output": "1 2 3 5 6 7 8\n"}, {"type": "stdin_stdout", "input": "8\n-1 0 12 16 3 1 0 -1", "output": "1 2 6 7 8\n"}, {"type": "stdin_stdout", "input": "8\n-1 0 12 8 3 1 0 -1", "output": "1 2 6 7 8\n"}, {"type": "stdin_stdout", "input": "8\n5 2 4 4 4 14 2 5", "o...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi is doing a research on sets of points in a plane. Takahashi thinks a set S of points in a coordinate plane is a good set when S satisfies both of the following conditions:\n\n* The distance between any two point...
[{"type": "stdin_stdout", "input": "33 4 2", "output": "0 0\n0 1\n0 4\n0 5\n0 8\n0 9\n0 12\n0 13\n0 16\n0 17\n0 20\n0 21\n0 24\n0 25\n0 28\n0 29\n0 32\n0 33\n0 36\n0 37\n0 40\n0 41\n0 44\n0 45\n0 48\n0 49\n0 52\n0 53\n0 56\n0 57\n0 60\n0 61\n0 64\n0 65\n2 2\n2 3\n2 6\n2 7\n2 10\n2 11\n2 14\n2 15\n2 18\n2 19\n2 22\n2 23...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is a sequence of N integers A_1, \\ldots, A_N.\nFind the (multiplicative) inverse of the sum of the inverses of these numbers, \\frac{1}{\\frac{1}{A_1} + \\ldots + \\frac{1}{A_N}}.\n\n-----Constraints-----\n - 1 \\l...
[{"type": "stdin_stdout", "input": "100\n1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's consider one interesting word game. In this game you should transform one word into another through special operations. \n\nLet's say we have word w, let's split this word into two non-empty parts x and y so, that w...
[{"type": "stdin_stdout", "input": "dkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjij\ndddkikjjidkkidijjjjkkjjikjdikiidijjikikjijjiijdikkjjjiddjjijkkkjkiijijki...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSometimes Mister B has free evenings when he doesn't know what to do. Fortunately, Mister B found a new game, where the player can play against aliens.\n\nAll characters in this game are lowercase English letters. There a...
[{"type": "stdin_stdout", "input": "12 12 876543210 1000000000\n", "output": "13"}, {"type": "stdin_stdout", "input": "10 12 220000011 220000032\n", "output": "11"}, {"type": "stdin_stdout", "input": "3 10 498103029 1063506054\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "13 8 654321109 654321126\n", "output...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are an environmental activist at heart but the reality is harsh and you are just a cashier in a cinema. But you can still do something!\n\nYou have $n$ tickets to sell. The price of the $i$-th ticket is $p_i$. As a te...
[{"type": "stdin_stdout", "input": "4\n1\n100\n50 1\n49 1\n100\n8\n100 200 100 200 100 200 100 100\n10 2\n15 3\n107\n3\n1000000000 1000000000 1000000000\n50 1\n50 1\n3000000000\n5\n200 100 100 100 100\n69 5\n31 2\n90\n", "output": "-1\n6\n3\n4\n"}, {"type": "stdin_stdout", "input": "4\n1\n100\n50 1\n49 1\n100\n8\n100 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMonocarp has got an array $a$ consisting of $n$ integers. Let's denote $k$ as the mathematic mean of these elements (note that it's possible that $k$ is not an integer).\n\nThe mathematic mean of an array of $n$ elements ...
[{"type": "stdin_stdout", "input": "4\n4\n8 8 12 14\n3\n50 25 10\n5\n1 4 7 3 5\n7\n-1 2 3 4 1 0 7\n", "output": "0\n0\n2\n0\n"}, {"type": "stdin_stdout", "input": "4\n4\n8 8 12 14\n3\n44 25 10\n5\n1 4 7 3 5\n7\n-1 2 3 4 1 0 7\n", "output": "0\n0\n2\n0\n"}, {"type": "stdin_stdout", "input": "4\n4\n8 8 18 14\n3\n44 25 10...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ candles on a Hanukkah menorah, and some of its candles are initially lit. We can describe which candles are lit with a binary string $s$, where the $i$-th candle is lit if and only if $s_i=1$.\n\nInitially, ...
[{"type": "stdin_stdout", "input": "5\n5\n10010\n11010\n2\n01\n11\n3\n110\n111\n9\n100010111\n111101100\n4\n001011011\n011010111\n", "output": "-1\n1\n-1\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "5\n5\n11000\n01000\n2\n01\n10\n3\n000\n101\n9\n100011111\n101101100\n9\n001001000\n011000101\n", "output": "-1\n2\n-1\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRelative B came to Mr. A's house. He is 3 years old and loves blocks. The block he has is shaped like Figure 1.\n\n<image>\n\nFigure 1\n\nMr. B is laying blocks on the board. When I asked him, \"What are you making?\", He...
[{"type": "stdin_stdout", "input": "20 21\n1 0\n14 8\n7\n4 0 1 1\n6 -1 1 3\n2 0 3 3\n1 0 5 0\n5 1 7 3\n2 -1 2 7\n2 -1 6 8\n20 20\n9 9\n1 1\n6\n2 0 1 1\n1 0 5 0\n2 1 1 4\n5 0 1 0\n4 1 6 10\n4 0 8 5\n0 0", "output": "NG\nNG\n"}, {"type": "stdin_stdout", "input": "20 21\n1 0\n14 8\n7\n4 0 1 1\n6 -1 1 3\n2 0 3 3\n1 0 5 0\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is BMI (Body Mass Index) as an index showing the degree of obesity. The BMI value is calculated using the following formula.\n\nBMI = weight (kg) / (height (m)) 2\n\nThe closer the BMI value is to the standard value...
[{"type": "stdin_stdout", "input": "6\n2 165 27\n-1 317 60\n2 68 72\n11 160 75\n7 185 001\n10 182 113\n3\n3 37 105\n0 229 6\n2 204 75\n0", "output": "11\n2\n"}, {"type": "stdin_stdout", "input": "6\n2 95 27\n-1 317 60\n2 68 72\n11 160 75\n7 185 101\n10 182 113\n3\n3 37 105\n0 229 6\n1 204 75\n0", "output": "11\n1\n"}, ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn Aramic language words can only represent objects.\n\nWords in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the sam...
[{"type": "stdin_stdout", "input": "10\nbda bbb cda dca dda dcb bcd dcb ada ddd\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "10\ncda bbb cda dca dda dcb bcd dcb ada ddd\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "10\nbda bbb cda dca dda dcb bcd dcb ada edd\n", "output": "6\n"}, {"type": "stdin_...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nInternational Coding Procedures Company (ICPC) writes all its code in Jedi Script (JS) programming language. JS does not get compiled, but is delivered for execution in its source form. Sources contain comments, extra whi...
[{"type": "stdin_stdout", "input": "8\n< > << >> in out fun in>>out\n6\n# let's rock\nin>>out in >> out inout>>outin bin>>out # yay!\nfun>>in>>out funin>>out out>>in <in> > <out>\nin> >> >>> >>>> >>>>>out\n# what's going on here?\n<> <> <> <> <fun> <funfun> <not so fun>\n", "output": "in>>outin>> out a>>b c>>out fun>>i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nn! = n Γ— (n βˆ’ 1) Γ— (n βˆ’ 2) Γ— ... Γ— 3 Γ— 2 Γ— 1\n\nIs called the factorial of n. For example, the factorial of 12\n\n12! = 12 x 11 x 10 x 9 x 8 x 7 x 6 x 5 x 4 x 3 x 2 x 1 = 479001600\n\nAnd there are two consecutive 0s at t...
[{"type": "stdin_stdout", "input": "2\n51\n11000\n0", "output": "0\n12\n2748\n"}, {"type": "stdin_stdout", "input": "2\n58\n10011\n0", "output": "0\n13\n2501\n"}, {"type": "stdin_stdout", "input": "2\n59\n10111\n0", "output": "0\n13\n2525\n"}, {"type": "stdin_stdout", "input": "2\n62\n10110\n0", "output": "0\n14\n2525\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Tower of Hanoi is a well-known mathematical puzzle. It consists of three rods, and a number of disks of different sizes which can slide onto any rod. The puzzle starts with the disks in a neat stack in ascending order...
[{"type": "stdin_stdout", "input": "0 10000 10000\n10000 0 10000\n10000 10000 0\n40\n", "output": "10995116277750000\n"}, {"type": "stdin_stdout", "input": "0 10000 10000\n10000 0 10000\n10000 10000 0\n40\n", "output": "10995116277750000\n"}, {"type": "stdin_stdout", "input": "0 00000 10000\n10000 0 10000\n10000 10000 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nN people run a marathon. There are M resting places on the way. For each resting place, the i-th runner takes a break with probability P_i percent. When the i-th runner takes a break, he gets rest for T_i time.\n\nThe i-t...
[{"type": "stdin_stdout", "input": "3 2 100\n-1 2 2\n50 -1 1\n83 2 2", "output": "0.9767033300\n0.0000000000\n-0.0005526700\n"}, {"type": "stdin_stdout", "input": "3 5 010\n-1 2 2\n55 0 1\n22 2 2", "output": "0.7318185458\n-0.0000007555\n-0.0143144522\n"}, {"type": "stdin_stdout", "input": "3 3 111\n-1 1 2\n1 0 2\n126 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nArpa is researching the Mexican wave.\n\nThere are n spectators in the stadium, labeled from 1 to n. They start the Mexican wave at time 0. \n\n At time 1, the first spectator stands. At time 2, the second spectator sta...
[{"type": "stdin_stdout", "input": "1000000000 1000000000 1000000000\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000 1000000000\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000 1400000000\n", "output": "600000000\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPak Chanek has $n$ blank heart-shaped cards. Card $1$ is attached directly to the wall while each of the other cards is hanging onto exactly one other card by a piece of string. Specifically, card $i$ ($i > 1$) is hanging...
[{"type": "stdin_stdout", "input": "15\n1 1 2 2 3 4 4 5 6 7 7 8 9 10\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "8\n1 1 3 3 5 5 7\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "7\n1 1 3 3 5 5\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "6\n1 2 1 4 2\n", "output": "4\n"}, {"type": "st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA robot is standing at the origin of the infinite two-dimensional plane. Each second the robot moves exactly $1$ meter in one of the four cardinal directions: north, south, west, and east. For the first step the robot can...
[{"type": "stdin_stdout", "input": "1000\n", "output": "251001\n"}, {"type": "stdin_stdout", "input": "1000\n", "output": "251001\n"}, {"type": "stdin_stdout", "input": "777\n", "output": "303420\n"}, {"type": "stdin_stdout", "input": "998\n", "output": "250000\n"}, {"type": "stdin_stdout", "input": "999\n", "output": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs a tradition, every year before IOI all the members of Natalia Fan Club are invited to Malek Dance Club to have a fun night together. Malek Dance Club has 2^{n} members and coincidentally Natalia Fan Club also has 2^{n}...
[{"type": "stdin_stdout", "input": "0110011110111000001101001010101000011011101001001101000000111101010101111101010011101001111010111001\n", "output": "416862683\n"}, {"type": "stdin_stdout", "input": "0111001111110010000001111100110100111110001100100001111111110000010010111010010010010111000110001111\n", "output": "77...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDemiurges Shambambukli and Mazukta love to watch the games of ordinary people. Today, they noticed two men who play the following game.\n\nThere is a rooted tree on n nodes, m of which are leaves (a leaf is a nodes that d...
[{"type": "stdin_stdout", "input": "50\n1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n7 8\n8 9\n9 10\n10 11\n11 12\n12 13\n13 14\n14 15\n15 16\n16 17\n17 18\n18 19\n19 20\n20 21\n21 22\n22 23\n23 24\n24 25\n25 26\n26 27\n27 28\n28 29\n29 30\n30 31\n31 32\n32 33\n33 34\n34 35\n35 36\n36 37\n37 38\n38 39\n39 40\n40 41\n41 42\n42 43\n43 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor a set $S$ of integers, perform a sequence of the following operations. Note that each value in $S$ must be unique.\n\n* insert($x$): Insert $x$ to $S$ and report the number of elements in $S$ after the operation.\n* f...
[{"type": "stdin_stdout", "input": "7\n0 -1\n0 2\n0 6\n1 2\n0 -1\n0 -1\n1 20", "output": "1\n2\n3\n1\n3\n3\n0\n"}, {"type": "stdin_stdout", "input": "7\n0 -1\n0 2\n0 5\n1 2\n0 -1\n1 0\n1 20", "output": "1\n2\n3\n1\n3\n0\n0\n"}, {"type": "stdin_stdout", "input": "7\n0 -1\n0 2\n0 6\n1 2\n0 -1\n0 0\n1 20", "output": "1\n2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMaria participates in a bicycle race.\n\nThe speedway takes place on the shores of Lake Lucerne, just repeating its contour. As you know, the lake shore consists only of straight sections, directed to the north, south, ea...
[{"type": "stdin_stdout", "input": "24\n-10000 -10000\n-10000 9998\n9998 9998\n9998 -10000\n-6364 -10000\n-6364 6362\n6362 6362\n6362 -6364\n-2728 -6364\n-2728 2726\n2726 2726\n2726 -910\n908 -910\n908 908\n-910 908\n-910 -4546\n4544 -4546\n4544 4544\n-4546 4544\n-4546 -8182\n8180 -8182\n8180 8180\n-8182 8180\n-8182 -1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou've got a robot, its task is destroying bombs on a square plane. Specifically, the square plane contains n bombs, the i-th bomb is at point with coordinates (x_{i}, y_{i}). We know that no two bombs are at the same poi...
[{"type": "stdin_stdout", "input": "24\n-2 -2\n-1 1\n0 1\n1 1\n0 2\n1 -1\n2 -2\n1 -4\n-1 1\n0 -2\n0 -2\n-2 0\n-2 -1\n2 -1\n2 2\n-1 -2\n-2 1\n2 0\n-1 2\n1 2\n-1 -1\n1 0\n2 1\n-2 2\n", "output": "130\n1 1 U\n2\n1 1 D\n3\n1 1 R\n2\n1 1 L\n3\n1 1 L\n1 1 U\n2\n1 1 R\n1 1 D\n3\n1 1 R\n1 1 U\n2\n1 1 L\n1 1 D\n3\n1 2 U\n2\n1 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet $f(x)$ be the sum of digits of a decimal number $x$.\n\nFind the smallest non-negative integer $x$ such that $f(x) + f(x + 1) + \\dots + f(x + k) = n$.\n\n\n-----Input-----\n\nThe first line contains one integer $t$ (...
[{"type": "stdin_stdout", "input": "7\n1 0\n2 1\n42 7\n1 9\n64 0\n99 0\n99 2\n", "output": "1\n-1\n4\n-1\n19999999\n99999999999\n7997\n"}, {"type": "stdin_stdout", "input": "7\n1 0\n1 1\n42 7\n1 9\n64 0\n99 0\n99 2\n", "output": "1\n0\n4\n-1\n19999999\n99999999999\n7997\n"}, {"type": "stdin_stdout", "input": "7\n1 0\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlmost every text editor has a built-in function of center text alignment. The developers of the popular in Berland text editor Β«TextpadΒ» decided to introduce this functionality into the fourth release of the product.\n\n...
[{"type": "stdin_stdout", "input": "8\n\n\n\ny\nW\n\n\n\n3B\n\nw\nV\n\n\n\nL\nSr\n\n\nV\n\n5\n\nAq\n\n\n\nJ\nR\n\n04\nJ\nv\nUh\n\n\n\nY\nG\n4\n\nG\nb\n\n\n9\n\n6\nd\n\n2\n\n\nE\n7\n\nr\n\n\n\n\nKC\ns\nE\n\nab\n4\nx\n\n\n\n\n\nEe\n4\n\nl\n\np\n\nG\nM\n\n\nn\n\n\nm0\n\nw\n\n\nP\n\n\n\n0\n\n\n", "output": "****\n*8 *\n* ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.\nThere are N attendees in the party, and they are...
[{"type": "stdin_stdout", "input": "32\n3 1 8 1 5 9 4 2 3 3 9 8 11 7 16 4 2 4 8 2 4 4 7 7 3 3 30 4 4 7 2 8", "output": "13\n"}, {"type": "stdin_stdout", "input": "32\n3 1 8 1 5 2 7 2 3 3 9 8 11 7 16 4 2 4 8 2 4 4 7 7 3 3 30 4 4 7 2 8", "output": "12\n"}, {"type": "stdin_stdout", "input": "32\n3 1 4 1 8 11 8 6 5 3 5 8 9...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nJafar has n cans of cola. Each can is described by two integers: remaining volume of cola a_{i} and can's capacity b_{i} (a_{i} ≀ b_{i}).\n\nJafar has decided to pour all remaining cola into just 2 cans, determine if he...
[{"type": "stdin_stdout", "input": "10\n15 26 15 14 14 39 40 4 25 39\n27 72 16 44 69 48 53 17 63 42\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "10\n15 26 15 14 14 39 40 4 25 39\n27 72 16 44 69 48 53 17 63 42\n", "output": "no\n"}, {"type": "stdin_stdout", "input": "10\n15 26 15 14 14 39 40 5 25 39\n27 72 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have a long seat of width X centimeters.\nThere are many people who wants to sit here. A person sitting on the seat will always occupy an interval of length Y centimeters.\nWe would like to seat as many people as possi...
[{"type": "stdin_stdout", "input": "100010 0 -1", "output": "-100011\n"}, {"type": "stdin_stdout", "input": "64146 123 456\n", "output": "110\n"}, {"type": "stdin_stdout", "input": "64145 123 456\n", "output": "109\n"}, {"type": "stdin_stdout", "input": "100000 1 1\n", "output": "49999\n"}, {"type": "stdin_stdout", "in...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have a simple undirected graph consisting of $n$ vertices and $m$ edges. The graph doesn't contain self-loops, there is at most one edge between a pair of vertices. The given graph can be disconnected.\n\nLet's make a...
[{"type": "stdin_stdout", "input": "21 35\n1 4\n2 4\n1 5\n2 5\n1 6\n2 6\n1 7\n2 7\n1 8\n2 8\n1 9\n2 9\n1 10\n2 10\n1 11\n2 11\n1 12\n2 12\n1 13\n2 13\n1 14\n2 14\n1 15\n2 15\n1 16\n2 16\n1 17\n2 17\n1 18\n2 18\n1 19\n2 19\n1 20\n2 20\n3 21\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "21 35\n1 4\n2 4\n1 5\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne foggy Stockholm morning, Karlsson decided to snack on some jam in his friend Lillebror Svantenson's house. Fortunately for Karlsson, there wasn't anybody in his friend's house. Karlsson was not going to be hungry any ...
[{"type": "stdin_stdout", "input": "15\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "15\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "8\n0 1\n1 0\n0...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe time on the planet Lapituletti goes the same way it goes on Earth but a day lasts $h$ hours and each hour lasts $m$ minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time...
[{"type": "stdin_stdout", "input": "15\n1 1\n00:00\n1 100\n00:01\n100 100\n02:82\n10 10\n04:04\n100 100\n99:00\n100 2\n30:00\n50 3\n30:00\n51 3\n30:01\n52 16\n21:12\n100 20\n20:07\n23 100\n21:45\n11 11\n02:02\n89 89\n88:86\n100 1\n01:00\n1 100\n00:01\n", "output": "00:00\n00:00\n02:82\n00:00\n00:00\n00:00\n00:00\n50:00...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.\n\...
[{"type": "stdin_stdout", "input": "99994\n", "output": "abcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabc...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a trampoline park with $n$ trampolines in a line. The $i$-th of which has strength $S_i$.\n\nPekora can jump on trampolines in multiple passes. She starts the pass by jumping on any trampoline of her choice.\n\nI...
[{"type": "stdin_stdout", "input": "3\n7\n1 2 10 2 2 2 2\n2\n2 1\n5\n1 1 1 2 1\n", "output": "10\n1\n1\n"}, {"type": "stdin_stdout", "input": "3\n7\n2 4 3 2 2 13 2\n2\n3 3\n5\n1 1 1 1 2\n", "output": "13\n4\n1\n"}, {"type": "stdin_stdout", "input": "3\n7\n3 4 3 2 2 24 2\n2\n3 3\n5\n1 1 1 1 2\n", "output": "24\n4\n1\n"}...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: \"Fox\"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order. \n\nAfter checking some e...
[{"type": "stdin_stdout", "input": "10\npetr\negor\nendagorion\nfeferivan\nilovetanyaromanova\nkostka\ndmitriyh\nmaratsnowbear\nbredorjaguarturnik\ncgyforever\n", "output": "aghjlnopefikdmbcqrstuvwxyz\n"}, {"type": "stdin_stdout", "input": "10\npetr\nroge\nendagorion\nfeferivan\nilovetanyaromanova\nkostka\ndmitriyh\nma...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMike is trying rock climbing but he is awful at it. \n\nThere are n holds on the wall, i-th hold is at height a_{i} off the ground. Besides, let the sequence a_{i} increase, that is, a_{i} < a_{i} + 1 for all i from 1 to ...
[{"type": "stdin_stdout", "input": "100\n2 43 47 49 50 57 59 67 74 98 901 903 904 906 907 908 909 910 911 912 913 914 915 916 917 1525 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 938 939 940 942 943 944 945 946 947 948 949 950 952 953 954 956 957 1027 959 960 961 962 963 965 966 967 968 969 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp is a great fan of television.\n\nHe wrote down all the TV programs he is interested in for today. His list contains n shows, i-th of them starts at moment l_{i} and ends at moment r_{i}.\n\nPolycarp owns two TVs....
[{"type": "stdin_stdout", "input": "5\n15 18\n23 24\n23 28\n26 24\n15 19\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "5\n15 18\n23 24\n23 11\n26 24\n15 19\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "5\n15 18\n23 24\n23 28\n22 24\n15 19\n", "output": "NO\n"}, {"type": "stdin_stdout", "input"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe amount of information on the World Wide Web is growing quite rapidly. In this information explosion age, we must survive by accessing only the Web pages containing information relevant to our own needs. One of the key...
[{"type": "stdin_stdout", "input": "3 1\naa\nb\nccc\naabccczbaacccbaazaabbcccaa\n3 1\na\nb\nc\ncbbcbcbabaacabccaccbaacbccbcaaaccccbcbcbbcacbaacccaccbbcaacbbabbabaccc\n3 4\naaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaaaa...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn an electric circuit, when two resistors R_1 and R_2 are connected in parallel, the equivalent resistance R_3 can be derived from the following formula:\n\n* \\frac{1}{R_1} + \\frac{1}{R_2} = \\frac{1}{R_3}\n\n\n\nGiven...
[{"type": "stdin_stdout", "input": "001 230", "output": "0.995670995671\n"}, {"type": "stdin_stdout", "input": "001 379", "output": "0.997368421053\n"}, {"type": "stdin_stdout", "input": "001 119", "output": "0.991666666667\n"}, {"type": "stdin_stdout", "input": "100 113", "output": "53.0516431925\n"}, {"type": "stdin_...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob are going to celebrate Christmas by playing a game with a tree of presents. The tree has n nodes (numbered 1 to n, with some node r as its root). There are a_i presents are hanging from the i-th node.\n\nBef...
[{"type": "stdin_stdout", "input": "4 3\n1 2\n1 3\n3 4\n1000000000 999999999 0 1\n", "output": "0 1 0 1 "}, {"type": "stdin_stdout", "input": "4 3\n1 2\n1 3\n3 4\n1000000000 999999999 0 2\n", "output": "0 1 0 1\n"}, {"type": "stdin_stdout", "input": "4 3\n1 2\n1 3\n1 4\n1000000000 999999999 0 2\n", "output": "0 0 0 0\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlice and Bonnie are sisters, but they don't like each other very much. So when some old family photos were found in the attic, they started to argue about who should receive which photos. In the end, they decided that th...
[{"type": "stdin_stdout", "input": "7\n479456257 682467462 202838061 802929167\n133179116 541657110 703996842 253385760\n829210948 865639323 321812660 580155067\n723036605 467995973 911771109 838534160\n732332969 59715289 216696388 60573917\n515702466 655741352 105418444 651954316\n884987644 907866122 399463262 9527779...
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": "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA conglomerate consists of $n$ companies. To make managing easier, their owners have decided to merge all companies into one. By law, it is only possible to merge two companies, so the owners plan to select two companies,...
[{"type": "stdin_stdout", "input": "20\n1 1228\n7 957 657 854 608 621 874 617\n6 159 43 19 122 116 194\n7 813 984 847 953 808 801 900\n2 693 844\n12 903 910 764 949 990 959 987 884 876 743 838 1017\n1 636\n8 107 201 935 203 159 67 550 948\n1 919\n14 934 742 1000 707 801 958 889 980 799 841 927 676 918 841\n7 590 569 48...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDetermine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane.\nYou can use the following theorem:\nTheorem: an N-sided polygon satisfying the con...
[{"type": "stdin_stdout", "input": "10\n100 100 100 100 100 100 100 100 100 100\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "10\n72 91 66 75 90 52 94 1 87 59\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "10\n11 11 11 11 99 11 11 11 11 11\n", "output": "No\n"}, {"type": "stdin_stdout", "input"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou need to find if a number can be expressed as sum of two perfect powers. That is, given x find if there exists non negative integers a, b, m, n such that am + bn = x.\n\nInput\n\nFirst line of the input contains number...
[{"type": "stdin_stdout", "input": "20\n27955\n637815\n90575\n561777\n622205\n466162\n379336\n195938\n91560\n894581\n799253\n948756\n448870\n26762\n507653\n176200\n175215\n499651\n82441\n354697", "output": "No\nNo\nNo\nNo\nNo\nYes\nYes\nYes\nYes\nYes\nNo\nNo\nNo\nYes\nYes\nYes\nNo\nNo\nNo\nYes"}, {"type": "stdin_stdout...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIroha loves Haiku. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order.\nTo create a Haiku, Iroha has come up with three different phrases. These phrases ha...
[{"type": "stdin_stdout", "input": "5 5 7\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "13 4 -2", "output": "NO\n"}, {"type": "stdin_stdout", "input": "13 4 -1", "output": "NO\n"}, {"type": "stdin_stdout", "input": "20 4 -1", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-1 -1 3", "output": "NO\n"}...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string S of length N consisting of A, C, G and T. Answer the following Q queries:\n - Query i (1 \\leq i \\leq Q): You will be given integers l_i and r_i (1 \\leq l_i < r_i \\leq N). Consider the substring...
[{"type": "stdin_stdout", "input": "8 3\nACACTABG\n6 3\n4 6\n2 1", "output": "-1\n0\n-1\n"}, {"type": "stdin_stdout", "input": "8 3\nACACTACG\n3 7\n2 3\n1 8\n", "output": "2\n0\n3\n"}, {"type": "stdin_stdout", "input": "8 3\nACACTACG\n3 7\n4 3\n1 2", "output": "2\n-1\n1\n"}, {"type": "stdin_stdout", "input": "8 3\nACAC...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet $n$ be an integer. Consider all permutations on integers $1$ to $n$ in lexicographic order, and concatenate them into one big sequence $p$. For example, if $n = 3$, then $p = [1, 2, 3, 1, 3, 2, 2, 1, 3, 2, 3, 1, 3, 1,...
[{"type": "stdin_stdout", "input": "1000000\n", "output": " 549766631"}, {"type": "stdin_stdout", "input": "771623\n", "output": " 501916356"}, {"type": "stdin_stdout", "input": "623847\n", "output": " ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAstronaut Natasha arrived on Mars. She knows that the Martians are very poor aliens. To ensure a better life for the Mars citizens, their emperor decided to take tax from every tourist who visited the planet. Natasha is t...
[{"type": "stdin_stdout", "input": "2 420\n412 363\n", "output": "420\n0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 8...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are wandering in the explorer space of the 2050 Conference.\n\nThe explorer space can be viewed as an undirected weighted grid graph with size nΓ— m. The set of vertices is \\{(i, j)|1≀ i≀ n, 1≀ j≀ m\\}. Two vertices (...
[{"type": "stdin_stdout", "input": "3 3 10\n1 1\n1 1\n1 1\n1 1 1\n1 1 1\n", "output": "\n10 10 10\n10 10 10\n10 10 10\n"}, {"type": "stdin_stdout", "input": "3 3 10\n1 1\n2 1\n1 1\n1 1 1\n1 1 1\n", "output": "10 10 10\n10 10 10\n10 10 10\n"}, {"type": "stdin_stdout", "input": "3 3 10\n1 1\n2 2\n1 1\n1 2 1\n2 2 1\n", "o...
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\nChouti was tired of the tedious homework, so he opened up an old programming problem he created years ago.\n\nYou are given a connected undirected graph with $n$ vertices and $m$ weighted edges. There are $k$ special vert...
[{"type": "stdin_stdout", "input": "4 4 2\n3 1\n1 2 1000000000\n2 3 1000000000\n3 1 1000000000\n3 4 1\n", "output": "1000000000 1000000000\n"}, {"type": "stdin_stdout", "input": "4 4 2\n3 1\n1 2 1000000000\n2 3 1000000001\n3 1 1000000000\n3 4 1\n", "output": "1000000000 1000000000\n"}, {"type": "stdin_stdout", "input":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA famous gang of pirates, Sea Dogs, has come back to their hideout from one of their extravagant plunders. They want to split their treasure fairly amongst themselves, that is why You, their trusted financial advisor, dev...
[{"type": "stdin_stdout", "input": "1000010000 3\n44431 10822\n45250 1096927361\n264372930 1\n", "output": "-1"}, {"type": "stdin_stdout", "input": "1000010001 3\n44431 10822\n45250 1096927361\n264372930 1\n", "output": "-1"}, {"type": "stdin_stdout", "input": "1000000000 3\n30490 19232\n45250 999980767\n264372930 1\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMr. Suzuki has opened a new mobile sales shop for freshly squeezed milk in the Aizu area. It is assumed that all the customers who come to buy that day are already in the store with bottles to take home and will not incre...
[{"type": "stdin_stdout", "input": "5\n-2\n45\n162\n2\n15\n0", "output": "73\n"}, {"type": "stdin_stdout", "input": "5\n-2\n32\n30\n2\n12\n0", "output": "52\n"}, {"type": "stdin_stdout", "input": "5\n-1\n-1\n4\n106\n0\n0", "output": "-3\n"}, {"type": "stdin_stdout", "input": "5\n4\n31\n14\n11\n14\n0", "output": "91\n"}...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven an array A of N numbers, find the number of distinct pairs (i, j) such that j β‰₯i and A[i] = A[j].\n\nFirst line of the input contains number of test cases T. Each test case has two lines, first line is the number N,...
[{"type": "stdin_stdout", "input": "10\n807\n935399 145100 -386862 856283 628359 256963 -461034 935399 776945 -759500 -759500 935399 -967263 649644 -24686 -452785 -352467 688773 908612 -386862 -479957 -146506 439811 -506538 -146506 145100 -461034 935399 -352307 -181185 740341 740341 439811 742466 -854789 700140 -740255...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nJoy is a short and lazy guy, he uses elevator to reach his flat. But unfortunately elevator is not working today and he became sad. Suddenly God came and made the stairs magical, such that he can jump on it in a magical w...
[{"type": "stdin_stdout", "input": "100\n41\n18467\n6334\n26500\n19169\n15724\n11478\n29358\n26962\n24464\n5705\n28145\n23281\n16827\n9961\n491\n2995\n11942\n4827\n5436\n32391\n14604\n3902\n153\n292\n12382\n17421\n18716\n19718\n19895\n5447\n21726\n14771\n11538\n1869\n19912\n25667\n26299\n17035\n9894\n28703\n23811\n3132...
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 10000\n10010 1629 30000 40724 20000\n20000\n12 1 5 3 10\n", "output": "13\n"}, {"type": "stdin_stdout", "input": "5 10000\n10010 1552 30000 40724 20000\n20000\n20 1 5 3 10\n", "output": "21\n"}, {"type": "stdin_stdout", "input": "5 10000\n10010 1552 30000 40724 20000\n20000\n20 0 5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWhen Masha came to math classes today, she saw two integer sequences of length $n - 1$ on the blackboard. Let's denote the elements of the first sequence as $a_i$ ($0 \\le a_i \\le 3$), and the elements of the second sequ...
[{"type": "stdin_stdout", "input": "100\n2 2 2 2 3 3 3 3 3 3 1 3 3 2 3 3 0 3 3 3 2 3 3 3 3 1 3 3 3 3 3 3 3 1 1 2 2 2 2 2 1 3 3 2 2 1 3 3 3 2 3 3 3 1 1 2 3 1 0 0 1 3 3 3 1 3 2 2 2 2 3 3 2 2 2 3 3 2 2 3 1 1 1 1 3 3 3 3 3 3 3 3 3 3 3 2 3 3 3\n0 0 0 2 2 1 0 0 0 0 0 0 2 2 2 0 0 0 3 2 2 2 2 2 1 1 1 3 3 1 0 2 1 1 0 0 2 2 2 0 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSnuke can change a string t of length N into a string t' of length N - 1 under the following rule:\n\n* For each i (1 ≀ i ≀ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t.\n\n\n\nThe...
[{"type": "stdin_stdout", "input": "whcrjpbyhtxywkrlxnbrbaojmr", "output": "10\n"}, {"type": "stdin_stdout", "input": "smjoabjdoxmrjwypugydyqrchv", "output": "11\n"}, {"type": "stdin_stdout", "input": "xwwwnajdrxmrqwzpugnhlojced", "output": "12\n"}, {"type": "stdin_stdout", "input": "xpwzglbjquntrci{axpdikofyw", "outpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOnce upon a time Mike and Mike decided to come up with an outstanding problem for some stage of ROI (rare olympiad in informatics). One of them came up with a problem prototype but another stole the idea and proposed that...
[{"type": "stdin_stdout", "input": "5 6\n1 2 3 4 5\n2 10\n1 1 5\n2 10\n1 1 6\n2 10\n1 1 7\n", "output": "50\n45\n50\n46\n50\n47\n"}, {"type": "stdin_stdout", "input": "5 5\n5 6 2 10 10\n1 2 7\n2 4\n1 1 10\n2 8\n1 3 4\n", "output": "34\n20\n26\n40\n36\n"}, {"type": "stdin_stdout", "input": "5 5\n1 2 3 4 5\n1 1 5\n2 10\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCounting was a difficult task in ancient Rome. The Arabic numerals 0,1,2,3,…, 9 have not yet been disseminated. Instead, the following symbols were used:\n\nArabic numerals | Roman numerals | Arabic numerals | Roman numer...
[{"type": "stdin_stdout", "input": "VI\nCXDCXXMCXVIIII\nDXDCIX", "output": "6\n1809\n1099\n"}, {"type": "stdin_stdout", "input": "IV\nCXDCXXMCXVIIII\nDXDCIX", "output": "4\n1809\n1099\n"}, {"type": "stdin_stdout", "input": "IV\nCCDIIXXXXVIDLI\nXIDXDC", "output": "4\n1095\n1099\n"}, {"type": "stdin_stdout", "input": "IV...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOh, no!\n\nThe coronavirus has caught you, and now you're sitting in a dark cellar, with tied legs (but not hands). You have a delicious cookie, a laptop in front of you, and your ideal development environment is open. Th...
[{"type": "stdin_stdout", "input": "3\n8707 7998 1614\n999941093851 131953876 8707\n", "output": "SMALL\n15155\nPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMr.X, who the handle name is T, looked at the list which written N handle names, S_1, S_2, ..., S_N.\nBut he couldn't see some parts of the list. Invisible part is denoted `?`.\n\nPlease calculate all possible index of th...
[{"type": "stdin_stdout", "input": "2\ntourist\neptr\ne", "output": "1\n"}, {"type": "stdin_stdout", "input": "2\nssvuhnr\nerrs\nf", "output": "2\n"}, {"type": "stdin_stdout", "input": "2\nhupouvt\netor\ni", "output": "3\n"}, {"type": "stdin_stdout", "input": "2\nsourist\neptr\ne", "output": "1\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMishka is decorating the Christmas tree. He has got three garlands, and all of them will be put on the tree. After that Mishka will switch these garlands on.\n\nWhen a garland is switched on, it periodically changes its s...
[{"type": "stdin_stdout", "input": "1499 1498 1500\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1500 1500 1500\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1493 1489 1487\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1500 1500 1500\n", "output": "NO"}, {"type": "stdin_stdout", "inp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNatasha travels around Mars in the Mars rover. But suddenly it broke down, namely β€” the logical scheme inside it. The scheme is an undirected tree (connected acyclic graph) with a root in the vertex 1, in which every leaf...
[{"type": "stdin_stdout", "input": "60\nAND 20 4\nNOT 42\nAND 48 59\nOR 17 7\nIN 0\nAND 36 37\nIN 1\nIN 0\nIN 1\nNOT 47\nAND 52 49\nOR 44 35\nIN 0\nIN 1\nAND 33 56\nIN 0\nIN 0\nIN 0\nAND 31 41\nOR 15 3\nOR 43 46\nIN 1\nXOR 22 28\nIN 1\nIN 1\nIN 1\nAND 34 21\nIN 1\nIN 1\nIN 0\nXOR 51 23\nXOR 10 54\nOR 57 40\nIN 0\nNOT 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBaby Badawy's first words were \"AND 0 SUM BIG\", so he decided to solve the following problem. Given two integers $n$ and $k$, count the number of arrays of length $n$ such that:\n\nall its elements are integers between ...
[{"type": "stdin_stdout", "input": "10\n99281 18\n100000 16\n100000 15\n100000 14\n100000 6\n8823 3\n283 17\n299 18\n182 19\n1928 20\n", "output": "207307884\n95964640\n764800965\n570057652\n999657007\n829332965\n995193330\n759808819\n657208696\n258367760\n"}, {"type": "stdin_stdout", "input": "10\n99281 18\n100000 16\...
code_stdio