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\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\n22 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\nAs you must know, the maximum clique problem in an arbitrary graph is NP-hard. Nevertheless, for some graphs of specific kinds it can be solved effectively.\n\nJust in case, let us remind you that a clique in a non-direct...
[{"type": "stdin_stdout", "input": "50\n1 2 5 7 9 14 19 24 25 29 31 34 37 40 43 44 46 53 54 57 58 59 60 61 62 64 66 68 69 70 72 75 78 79 80 81 82 84 85 86 87 88 89 90 91 92 93 94 41 98\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "50\n1 2 5 7 9 14 19 24 25 29 31 34 37 40 43 44 46 53 54 57 58 59 60 61 62 64 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDuff is addicted to meat! Malek wants to keep her happy for n days. In order to be happy in i-th day, she needs to eat exactly ai kilograms of meat.\n\n<image>\n\nThere is a big shop uptown and Malek wants to buy meat for...
[{"type": "stdin_stdout", "input": "12\n70 11\n18 27\n32 11\n26 158\n91 18\n97 12\n75 43\n75 21\n84 29\n16 3\n133 124\n21 124\n", "output": "6758\n"}, {"type": "stdin_stdout", "input": "12\n70 11\n21 27\n32 11\n26 158\n91 18\n97 12\n75 43\n75 21\n84 29\n16 3\n133 124\n21 124\n", "output": "6791\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe city park of IT City contains n east to west paths and n north to south paths. Each east to west path crosses each north to south path, so there are n2 intersections.\n\nThe city funded purchase of five benches. To ma...
[{"type": "stdin_stdout", "input": "104\n", "output": "1014852610170048000\n"}, {"type": "stdin_stdout", "input": "105\n", "output": "1118875002712477920\n"}, {"type": "stdin_stdout", "input": "100\n", "output": "680185280130048000\n"}, {"type": "stdin_stdout", "input": "101\n", "output": "752883034137003000\n"}, {"typ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKolya is developing an economy simulator game. His most favourite part of the development process is in-game testing. Once he was entertained by the testing so much, that he found out his game-coin score become equal to 0...
[{"type": "stdin_stdout", "input": "1000000000\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "999129999\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "917261049\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "803219200\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "9080000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notificat...
[{"type": "stdin_stdout", "input": "10 85\n2 2\n1 10\n1 1\n2 6\n1 2\n1 4\n1 7\n2 1\n1 1\n3 3\n1 9\n1 6\n1 8\n1 10\n3 8\n2 8\n1 6\n1 3\n1 9\n1 6\n1 3\n1 8\n1 1\n1 6\n1 10\n2 1\n2 10\n1 10\n1 1\n1 10\n1 6\n2 2\n1 8\n1 3\n1 4\n1 9\n1 5\n1 5\n2 2\n2 4\n1 7\n1 1\n2 4\n2 9\n1 1\n1 7\n1 8\n3 14\n1 10\n2 2\n1 3\n1 10\n1 6\n3 3...
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\nDr. Evil kidnapped Mahmoud and Ehab in the evil land because of their performance in the Evil Olympiad in Informatics (EOI). He decided to give them some problems to let them go.\n\nDr. Evil is interested in sets, He has ...
[{"type": "stdin_stdout", "input": "100 100\n58 88 12 71 22 1 40 19 73 20 67 48 57 17 69 36 100 35 33 37 72 55 52 8 89 85 47 42 78 70 81 86 11 9 68 99 6 16 21 61 53 98 23 62 32 59 51 0 87 24 50 30 65 10 80 95 7 92 25 74 60 79 91 5 13 31 75 38 90 94 46 66 93 34 14 41 28 2 76 84 43 96 3 56 49 82 27 77 64 63 4 45 18 29 54...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nValentina is looking for a new game to play with her friends.\nShe asks her mom Marcia for an idea.\nAfter a moment Marcia described to girls the following simple game.\n\nGirls are divided into n teams, indexed 1 through...
[{"type": "stdin_stdout", "input": "3\n2 qwopwasp\nwdw\nabco\n5 eeeessaa\nvalentina\nesta\njugando\ncon\nmarcia\n5 ahi\nvalentina\nesta\njugando\ncon\nsusamigas\n\nSAMPLE", "output": "1\n2\n1\n"}, {"type": "stdin_stdout", "input": "3\n2 qwopwasp\nwdw\nabco\n5 eeeessaa\nvalentina\nesta\njugando\ncon\niarcma\n5 ahi\nvale...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nJulius Cipher is a type of cipher which relates all the lowercase alphabets to their numerical position in the alphabet, i.e., value of a is 1, value of b is 2, value of z is 26 and similarly for the rest of them. \n\nLit...
[{"type": "stdin_stdout", "input": "60\nvlmezxuyim\nusholhjomc\nfcrnbpodhf\ndltrthaaic\ncosnljmjtk\nzbowagxejo\nrjfguazsry\nbjzquzutvj\norhzmghfol\nbwvktwfepv\ncoamsgojyl\naqihirbyor\nxbetzvxvsr\nyffovdqcem\njuvvyioxzr\njchybdlgrw\nnxuspkypqf\nwovtphcriy\nogxpfdhykg\nsjdeufkvkq\ncmrtnhvzpm\nwnrqjfoojr\nznlihidhjz\nfzzp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\n* If both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n* If the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n* If none of the above holds but 5 divide...
[{"type": "stdin_stdout", "input": "1100000", "output": "322667033332\n"}, {"type": "stdin_stdout", "input": "1110000", "output": "328560000000\n"}, {"type": "stdin_stdout", "input": "1110010", "output": "328565550022\n"}, {"type": "stdin_stdout", "input": "1111010", "output": "329158562362\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this problem, a date is written as Y-M-D. For example, 2019-11-30 means November 30, 2019.\n\nIntegers M_1, D_1, M_2, and D_2 will be given as input.\nIt is known that the date 2019-M_2-D_2 follows 2019-M_1-D_1.\nDeter...
[{"type": "stdin_stdout", "input": "11 17\n11 122", "output": "0\n"}, {"type": "stdin_stdout", "input": "11 11\n11 101", "output": "0\n"}, {"type": "stdin_stdout", "input": "11 17\n11 17", "output": "0\n"}, {"type": "stdin_stdout", "input": "11 16\n11 28", "output": "0\n"}, {"type": "stdin_stdout", "input": "11 24\n11 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a very long bench. The bench is divided into M sections, where M is a very large integer.\n\nInitially, the bench is vacant. Then, M people come to the bench one by one, and perform the following action:\n\n* We ...
[{"type": "stdin_stdout", "input": "100\n-X-X-X--X-X--X--X-X--X-X-X--X-X-X--X--X-X-X-X--X--X-X-X-X-X-X-X-X-X-X-X-X-X-X-X--X-X-X-X-X-X-X-X-X-X", "output": "0 0 435664291\n"}, {"type": "stdin_stdout", "input": "100\nX-X-X-X-X-X-X-X-X-X--X-X-X-X-X-X-X-X-X-X-X-X-X-X-X--X--X-X-X-X--X--X-X-X--X-X-X--X-X--X--X-X--X-X-X-", "ou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi is practicing shiritori alone again today.\n\nShiritori is a game as follows:\n\n* In the first turn, a player announces any one word.\n* In the subsequent turns, a player announces a word that satisfies the fol...
[{"type": "stdin_stdout", "input": "9\nbasic\nc\ncpp\nphp\npython\nnadesico\nocaml\nlua\nassembly", "output": "Yes"}, {"type": "stdin_stdout", "input": "9\nbasic\nc\npcp\nphp\npython\nnadesico\nocaml\nlua\nassembly", "output": "No\n"}, {"type": "stdin_stdout", "input": "9\nb`sic\nc\npcp\nphp\npython\nnadesico\nocaml\nl...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a grid with infinitely many rows and columns. In this grid, there is a rectangular region with consecutive N rows and M columns, and a card is placed in each square in this region. The front and back sides of the...
[{"type": "stdin_stdout", "input": "1495 932", "output": "1388490\n"}, {"type": "stdin_stdout", "input": "582 1592", "output": "922200\n"}, {"type": "stdin_stdout", "input": "1018 932", "output": "944880\n"}, {"type": "stdin_stdout", "input": "1018 374", "output": "377952\n"}, {"type": "stdin_stdout", "input": "314 169...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRng is going to a festival.\n\nThe name of the festival is given to you as a string S, which ends with `FESTIVAL`, from input. Answer the question: \"Rng is going to a festival of what?\" Output the answer.\n\nHere, assum...
[{"type": "stdin_stdout", "input": "CODEFESTIVALFERTIVAL", "output": "CODEFESTIVAL\n"}, {"type": "stdin_stdout", "input": "CODEFESTIWALFESTIWAL", "output": "CODEFESTIWAL\n"}, {"type": "stdin_stdout", "input": "LAWITSEFLAWITSEFEDOC", "output": "LAWITSEFLAWI\n"}, {"type": "stdin_stdout", "input": "CODEFWSTIWALFESTIEAL", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N persons, conveniently numbered 1 through N. They will take 3y3s Challenge for N-1 seconds.\n\nDuring the challenge, each person must look at each of the N-1 other persons for 1 seconds, in some order.\n\nIf an...
[{"type": "stdin_stdout", "input": "163", "output": "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 86 87 88 89 90 91 92 93...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which computes the digit number of sum of two integers a and b.\n\nConstraints\n\n* 0 ≀ a, b ≀ 1,000,000\n* The number of datasets ≀ 200\n\nInput\n\nThere are several test cases. Each test case consists of...
[{"type": "stdin_stdout", "input": "-2 -1\n2 -15\n0110 -1", "output": "2\n3\n3\n"}, {"type": "stdin_stdout", "input": "10 10\n2 36\n1000 25", "output": "2\n2\n4\n"}, {"type": "stdin_stdout", "input": "-1 -1\n0 -1\n0111 14", "output": "2\n2\n3\n"}, {"type": "stdin_stdout", "input": "-2 -1\n0 -1\n0011 14", "output": "2\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nI conducted an exit poll of the shopping amount at a department store. Create a program that takes the shopping amount data as input, calculates the average shopping amount per person, and outputs it. The number of people...
[{"type": "stdin_stdout", "input": "6\n23426\n5600\n33800\n0\n26495\n52000", "output": "23553\n"}, {"type": "stdin_stdout", "input": "6\n23426\n5600\n33800\n0\n17519\n52000", "output": "22057\n"}, {"type": "stdin_stdout", "input": "6\n23426\n5600\n33800\n0\n14222\n52000", "output": "21508\n"}, {"type": "stdin_stdout", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a game called Packet Monster. A game that catches, raises, fights and exchanges monsters, and is very popular all over Japan. Of course, in my class. That's why I also raise monsters so that I can play with every...
[{"type": "stdin_stdout", "input": "10\n4 17 1 9 5 18 2 3 2 1\n8 12 6 5 10 5 4 4 7 6\n5\n4 3 2 1 1\n2 4 4 4 4\n4\n1 1 3 2\n5 3 2 1\n0", "output": "1\nNA\nNA\n"}, {"type": "stdin_stdout", "input": "10\n4 17 1 9 5 18 2 3 2 1\n8 12 6 5 10 5 4 4 7 6\n5\n4 3 2 1 1\n2 4 4 4 4\n4\n2 1 3 2\n5 3 2 1\n0", "output": "1\nNA\nNA\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nInformation I want to paint a rectangular veneer board to make a signboard for the promotion of the Olympic Games. Some rectangular masking tapes are pre-attached to the veneer board where I do not want to pain...
[{"type": "stdin_stdout", "input": "15 6\n10\n1 4 5 6\n2 1 0 5\n1 0 5 1\n6 1 7 6\n14 5 3 6\n11 0 9 2\n9 1 10 5\n11 0 14 1\n12 1 13 5\n11 5 14 6\n0 0", "output": "2\n"}, {"type": "stdin_stdout", "input": "15 6\n10\n0 4 5 6\n2 1 0 5\n1 0 5 1\n6 1 7 6\n14 5 3 6\n11 0 9 2\n9 1 10 5\n11 0 14 1\n12 1 13 5\n11 5 14 6\n0 0", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPeople in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (= 172), i.e., 1-credit coins, 4-credit coins, 9-credit c...
[{"type": "stdin_stdout", "input": "2\n19\n51\n0", "output": "1\n10\n107\n"}, {"type": "stdin_stdout", "input": "2\n19\n92\n0", "output": "1\n10\n804\n"}, {"type": "stdin_stdout", "input": "2\n173\n0\n-6", "output": "1\n13027\n"}, {"type": "stdin_stdout", "input": "2\n10\n51\n0", "output": "1\n4\n107\n"}, {"type": "std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAn open-top box having a square bottom is placed on the floor. You see a number of needles vertically planted on its bottom.\n\nYou want to place a largest possible spheric balloon touching the box bottom, interfering wit...
[{"type": "stdin_stdout", "input": "5 12\n70 66 70\n0 52 20\n15 27 10\n78 45 10\n20 60 13\n1 100\n54 75 200\n1 10\n90 14 1\n1 11\n54 149 200\n3 10\n53 60 0\n61 38 1\n45 44 1\n4 10\n20 21 10\n20 80 10\n80 20 10\n140 80 10\n0 0", "output": "44.661667\n39.000000\n130.000000\n102.978551\n107.095894\n99.314575\n"}, {"type":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMasa Kita, who entered the University of Tokyo, joined a circle called TSG (University of Tokyo Super Gamers).\n\nThis circle exhibits games at the Komaba Festival every year, and Masa Kita decided to create and display t...
[{"type": "stdin_stdout", "input": "3\n......\n......\n......\n......\n......\n......\n......\n......\n.RGB..\nRGOP..\nRGBPB.\nRGBPP.\nGBRGYP\nGBRRYP\nBGGRBB\nBPRGYY\nGGPRRY\nBYPPRB\nYGGGPB\nGYYYPR\nYRBRBR\nYBRBRB\nBRBRBR\nBRBRBR\n......\n......\n......\n......\n......\n......\n......\n......\n.....-\n......\n..OO..\n....
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n2 3 1 3 1 0\n\n\nOutput\n\n2\n\nThe input will be given via stdin and the output should be printed to stdout by your code.\n\nNow solve the problem by providing the code.\n\nWrite Python code to solve ...
[{"type": "stdin_stdout", "input": "15 18 0 12 0 4", "output": "138\n"}, {"type": "stdin_stdout", "input": "15 18 0 22 0 4", "output": "124\n"}, {"type": "stdin_stdout", "input": "15 18 1 22 0 4", "output": "120\n"}, {"type": "stdin_stdout", "input": "11 51 4 0 1 -1", "output": "255\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem Statement\n\nA magician lives in a country which consists of N islands and M bridges. Some of the bridges are magical bridges, which are created by the magician. Her magic can change all the lengths of the magical...
[{"type": "stdin_stdout", "input": "12 2 2 1 1\n1 2 7\n1 3 3\n4 3 1 2 2\n2 1 14\n2 3 x\n4 3 x\n0 0 0 0 0", "output": "7\n14\n"}, {"type": "stdin_stdout", "input": "3 2 2 3 1\n1 2 1\n1 3 2\n4 3 1 4 1\n2 1 10\n2 4 x\n4 3 x\n0 0 0 0 0", "output": "1\n10\n"}, {"type": "stdin_stdout", "input": "3 2 2 3 1\n1 2 1\n1 3 3\n4 3 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFalling Block Puzzle\n\nBlock drop\n\nYou are playing a falling block puzzle. As shown in the figure below, the field of this puzzle has a shape in which cubic cells are arranged in 2 squares x 2 squares in each row, and ...
[{"type": "stdin_stdout", "input": "1 1\n##\n#.\n..\n..\n#.\n..\n1 1\n.#\n#.\n#.\n..\n..\n.#\n2 2\n##\n#.\n##\n#.\n..\n.#\n##\n#.\n.#\n..\n#.\n..\n1 3\n#.\n..\n##\n##\n##\n##\n##\n##\n##\n##\n##\n##\n##\n##\n10 3\n##\n#.\n##\n#.\n##\n.#\n##\n.#\n#.\n##\n#.\n##\n.#\n##\n.#\n##\n.#\n#.\n.#\n#.\n#.\n.#\n#.\n.#\n#.\n..\n#....
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven a tree T with non-negative weight, find the height of each node of the tree. For each node, the height is the distance to the most distant leaf from the node.\n\nConstraints\n\n* 1 ≀ n ≀ 10,000\n* 0 ≀ wi ≀ 1,000\n\n...
[{"type": "stdin_stdout", "input": "4\n0 2 2\n1 2 2\n2 3 12", "output": "14\n14\n12\n14\n"}, {"type": "stdin_stdout", "input": "4\n0 2 2\n1 2 2\n2 3 21", "output": "23\n23\n21\n23\n"}, {"type": "stdin_stdout", "input": "4\n0 2 2\n1 2 2\n2 3 31", "output": "33\n33\n31\n33\n"}, {"type": "stdin_stdout", "input": "4\n0 2 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array of integers. Vasya can permute (change order) its integers. He wants to do it so that as many as possible integers will become on a place where a smaller integer used to stand. Help Vasya find the m...
[{"type": "stdin_stdout", "input": "6\n300000000 200000000 300000000 200000000 1000000000 300000000\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "6\n506233607 200000000 300000000 200000000 1000000000 300000000\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "6\n144373768 200000000 300000000 200000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWhen preparing a tournament, Codeforces coordinators try treir best to make the first problem as easy as possible. This time the coordinator had chosen some problem and asked n people about their opinions. Each person ans...
[{"type": "stdin_stdout", "input": "100\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "HARD\n"}, {"type": "stdin_stdout", "input": "100\n0 0 0 0 0 0 0 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a range of positive integers from l to r.\n\nFind such a pair of integers (x, y) that l ≀ x, y ≀ r, x β‰  y and x divides y.\n\nIf there are multiple answers, print any of them.\n\nYou are also asked to answer...
[{"type": "stdin_stdout", "input": "3\n6969 696969\n11103 49805\n6969 696969\n", "output": "6969 13938\n11103 22206\n6969 13938\n"}, {"type": "stdin_stdout", "input": "3\n9989 359575\n11103 49805\n6969 253442\n", "output": "9989 19978\n11103 22206\n6969 13938\n"}, {"type": "stdin_stdout", "input": "3\n6787 359575\n1110...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n emotes in very popular digital collectible card game (the game is pretty famous so we won't say its name). The i-th emote increases the opponent's happiness by a_i units (we all know that emotes in this game a...
[{"type": "stdin_stdout", "input": "69 10 2\n2 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 137 67 68 69 70\n", "output": "1169\n"}, {"type": "stdin_stdout", "input": "69 10 2\n2 3 4 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n β‹… k cities. The cities are numerated from 1 to n β‹… k, the distance between the neighboring cities is exactly 1 km.\n\nSerg...
[{"type": "stdin_stdout", "input": "98752 97209\n41218 39020\n", "output": "21427641 3199861056\n"}, {"type": "stdin_stdout", "input": "65536 32768\n6427 13573\n", "output": "67108864 1073741824\n"}, {"type": "stdin_stdout", "input": "100000 100000\n10 1\n", "output": "10000000000 10000000000\n"}, {"type": "stdin_stdou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis problem is same as the previous one, but has larger constraints.\n\nIt was a Sunday morning when the three friends Selena, Shiro and Katie decided to have a trip to the nearby power station (do not try this at home)....
[{"type": "stdin_stdout", "input": "25\n-10000 -10000\n-10000 -5000\n-10000 0\n-10000 5000\n-10000 10000\n-7452 -10000\n-5000 -5000\n-5000 0\n-5000 5000\n-5000 10000\n-1 -10000\n0 -5000\n0 0\n0 5000\n0 10000\n5000 -13650\n5000 -5000\n5000 0\n5000 5000\n5000 10000\n10000 -10000\n10000 -5000\n10000 0\n10000 5000\n10000 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter learning about polynomial hashing, Heidi decided to learn about shift-xor hashing. In particular, she came across this interesting problem.\n\nGiven a bitstring y ∈ \\{0,1\\}^n find out the number of different k (0 ...
[{"type": "stdin_stdout", "input": "111\n011101111010100111111000010101011110011000010101010001001011000111100101111000010110010011110100000111000100101\n", "output": "108\n"}, {"type": "stdin_stdout", "input": "111\n0011011110001001111110000101010111100110000101010100010010110001111001011111010001100000111101101001110...
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\nUjan has a lot of useless stuff in his drawers, a considerable part of which are his math notebooks: it is time to sort them out. This time he found an old dusty graph theory notebook with a description of a graph.\n\nIt ...
[{"type": "stdin_stdout", "input": "15 10\n2 3\n5 4\n5 12\n5 7\n3 8\n3 10\n11 12\n12 13\n13 14\n14 15\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "15 10\n2 3\n6 4\n5 12\n5 7\n3 8\n3 10\n11 12\n12 13\n13 14\n14 15\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "15 10\n2 3\n5 8\n5 6\n5 7\n3 8\n3 10\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOn the well-known testing system MathForces, a draw of n rating units is arranged. The rating will be distributed according to the following algorithm: if k participants take part in this event, then the n rating is evenl...
[{"type": "stdin_stdout", "input": "8\n2224571\n2410907\n1906778\n4433130\n429304\n748393\n1234320\n1234321\n", "output": "2982\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 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBeing tired of participating in too many Codeforces rounds, Gildong decided to take some rest in a park. He sat down on a bench, and soon he found two rabbits hopping around. One of the rabbits was taller than the other.\...
[{"type": "stdin_stdout", "input": "5\n-1 10 0 3\n1 10 2 0\n900000000 1000000000 1 9999999\n0 2 1 2\n1 3 1 2\n", "output": "-1\n-1\n10\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "5\n-1 1 0 3\n1 13 2 -1\n900000000 1000000000 1 2570333\n0 2 1 2\n1 3 1 2\n", "output": "-1\n12\n-1\n-1\n-1\n"}, {"type": "stdin_stdout", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor the given integer n (n > 2) let's write down all the strings of length n which contain n-2 letters 'a' and two letters 'b' in lexicographical (alphabetical) order.\n\nRecall that the string s of length n is lexicograp...
[{"type": "stdin_stdout", "input": "2\n39776 83767477\n50000 1249975000\n", "output": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are standing on the OX-axis at point 0 and you want to move to an integer point x > 0.\n\nYou can make several jumps. Suppose you're currently at point y (y may be negative) and jump for the k-th time. You can: \n\n ...
[{"type": "stdin_stdout", "input": "12\n1\n2\n3\n4\n5\n1\n2\n3\n4\n5\n1\n2\n", "output": "1\n3\n2\n3\n4\n1\n3\n2\n3\n4\n1\n3\n"}, {"type": "stdin_stdout", "input": "12\n1\n2\n3\n4\n5\n2\n2\n3\n4\n5\n1\n2\n", "output": "1\n3\n2\n3\n4\n3\n3\n2\n3\n4\n1\n3\n"}, {"type": "stdin_stdout", "input": "12\n1\n2\n3\n4\n5\n2\n2\n2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a number k and a string s of length n, consisting of the characters '.' and '*'. You want to replace some of the '*' characters with 'x' characters so that the following conditions are met: \n\n * The first...
[{"type": "stdin_stdout", "input": "5\n7 3\n.**.***\n5 1\n..*..\n5 2\n*.*.*\n3 2\n*.*\n1 1\n*\n", "output": "\n3\n1\n3\n2\n1\n"}, {"type": "stdin_stdout", "input": "5\n7 3\n***.**.\n5 12\n.*...\n5 2\n*.*.*\n3 2\n*.*\n1 1\n*\n", "output": "3\n1\n3\n2\n1\n"}, {"type": "stdin_stdout", "input": "5\n7 5\n***.**.\n5 12\n.*.....
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA boy Valera registered on site Codeforces as Valera, and wrote his first Codeforces Round #300. He boasted to a friend Arkady about winning as much as x points for his first contest. But Arkady did not believe his friend...
[{"type": "stdin_stdout", "input": "230 125 175 124 1 1\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "230 125 221 124 1 1\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "230 195 221 124 1 1\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "375 6 133 267 19 36\n", "output": "NO\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA little girl loves problems on bitwise operations very much. Here's one of them.\n\nYou are given two integers l and r. Let's consider the values of <image> for all pairs of integers a and b (l ≀ a ≀ b ≀ r). Your task is...
[{"type": "stdin_stdout", "input": "259703440079833303 1004763675266938032\n", "output": "1152921504606846975\n"}, {"type": "stdin_stdout", "input": "190620774979376809 899159649449168622\n", "output": "1152921504606846975\n"}, {"type": "stdin_stdout", "input": "462451489958473150 957447393463701191\n", "output": "1152...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFox Ciel is playing a card game with her friend Jiro.\n\nJiro has n cards, each one has two attributes: position (Attack or Defense) and strength. Fox Ciel has m cards, each one has these two attributes too. It's known th...
[{"type": "stdin_stdout", "input": "36 30\nATK 116\nATK 120\nATK 122\nATK 120\nATK 116\nATK 118\nATK 123\nDEF 2564\nATK 123\nDEF 1810\nATK 124\nATK 120\nDEF 2598\nATK 119\nDEF 2103\nATK 123\nATK 118\nATK 118\nATK 123\nDEF 1988\nATK 122\nATK 120\nDEF 2494\nATK 122\nATK 124\nATK 117\nATK 121\nATK 118\nATK 117\nATK 122\nA...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA permutation of length n is an integer sequence such that each integer from 0 to (n - 1) appears exactly once in it. For example, sequence [0, 2, 1] is a permutation of length 3 while both [0, 2, 2] and [1, 2, 3] are not...
[{"type": "stdin_stdout", "input": "100\n99 5 40 32 4 31 38 57 94 47 26 16 89 72 9 80 55 86 78 90 42 41 46 74 56 97 21 48 66 27 93 85 88 59 64 95 10 45 12 22 84 60 8 98 62 51 14 65 39 30 11 71 92 19 76 43 87 54 15 53 37 6 25 18 96 35 13 91 2 3 0 23 1 7 49 75 81 33 50 52 63 44 69 36 17 61 24 20 68 34 73 29 70 83 58 79 8...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMashmokh works in a factory. At the end of each day he must turn off all of the lights. \n\nThe lights on the factory are indexed from 1 to n. There are n buttons in Mashmokh's room indexed from 1 to n as well. If Mashmok...
[{"type": "stdin_stdout", "input": "100 100\n100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9...
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\nroge\nendagorion\nfeferivan\nilovetanyaromanova\nkostka\ndmitriyh\nmaratsnowbear\nbredorjaguarturnik\ncgyforever\n", "output": "zyxwvutsqpronljhgefikdmbca\n"}, {"type": "stdin_stdout", "input": "10\npetr\nroge\nendagorinn\nfeferivam\nilovetanyaromanova\naostjk\ndmitriyh\nma...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTavas is a strange creature. Usually \"zzz\" comes out of people's mouth while sleeping, but string s of length n comes out from Tavas' mouth instead.\n\n<image>\n\nToday Tavas fell asleep in Malekas' place. While he was ...
[{"type": "stdin_stdout", "input": "173700 6\nbcabcbcbcbaaacaccaacaccaabacabaacbcacbbccaccbcacbabcaccccccaacacabbbbbacabbaaacbcbbaccaccabbbbaabbacacbabccaabcabbbcacaaccbabbcaaaaaabccbbcabcacbcbcabcbcbbaabacaaccccabacaaaccacaaabbacacabbcccacbaabcacacbbaaaccaccbaccccccbccaabcacaacabaccababacabcccbcbbacbabacbcbabacbbaccaa...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA little boy Laurenty has been playing his favourite game Nota for quite a while and is now very hungry. The boy wants to make sausage and cheese sandwiches, but first, he needs to buy a sausage and some cheese.\n\nThe to...
[{"type": "stdin_stdout", "input": "50\n31 80 40 85 12 38 30 97 51 18 45 81 56 82 91 94 95 13 26 93 98 35 44 69 98 39 83 77 38 68 13 71 80 41 21 80 81 17 88 46 61 67 65 49 29 55 37 74 88\n71 8 42 74 14 70 100 96 25 56 95 38 41 88 45 43 46 16 55 77 100 68 51 30 73 51 25 88 64 26 22 50 4 57 88 85 45 32 11 96 94 19 9 12 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys all beacons to its left (direction of decreasing coord...
[{"type": "stdin_stdout", "input": "11\n110 90\n100 70\n90 10\n155 15\n130 1\n60 1\n71 10\n40 1\n30 1\n10 1\n20 1\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "11\n110 90\n100 70\n90 10\n155 15\n70 1\n60 1\n71 10\n40 1\n30 1\n10 1\n20 1\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "11\n110 90\n100...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTyndex is again well ahead of the rivals! The reaction to the release of Zoozle Chrome browser was the release of a new browser Tyndex.Brome!\n\nThe popularity of the new browser is growing daily. And the secret is not ev...
[{"type": "stdin_stdout", "input": "20 10\niwbiucrjoj\nqvjewvdrgwgc\newwqyhtdzakryafqaacimthycyasyb\ncuoscayekvbsqokyfdmjnojkjennf\nhkuv\njtdgbespjdtbc\ngeulitsrlqihoujvwuobnfospq\nzphnlqxacchxhyeehnpfwdjnwvj\nxicsaoyfgtdbwqfrdgaiyn\natgshewfkuxaipizcdev\nvp\nyblkfmqsj\nyevxolvycyrrooosberqzrabefdckg\nrytykrlgttc\nafph...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA teacher decides to give toffees to his students. He asks n students to stand in a queue. Since the teacher is very partial, he follows the following rule to distribute toffees.\n\nHe looks at the first two students and ...
[{"type": "stdin_stdout", "input": "484\nLLRRRL==RRLRRLR=LRR=RL=LLLRL===RLRRRLRR=RRRL=LLLLRL==RL==R==LLLRL=RLLRLRLLLLLLLRRLL=LLR=LLR==RLL==LLLR=RL==LL=LRRL=LLRRRLR====R=R=LRRRLLL==RLRRLR=LL==LLRLR===RR=LR==RL==L==R====LRL=LR=R=R=R=LL=L=RLR=RL==R==LRLRL==L==LL=LR=L=RRRR=R==RRLRRRLR==R=LL===R===RLRRR===LRRLLRRRRR=L==LLRR...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.\n\nA subarray is the sequence of consecutive elements of the array. Subarray is called in...
[{"type": "stdin_stdout", "input": "10\n32372808 517917901 640274071 1836610331 71867556 96204862 120140751 446173607 796619138 1156360703\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "10\n32372808 517917901 156515250 1836610331 71867556 96204862 120140751 446173607 796619138 1156360703\n", "output": "6\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a table consisting of n rows and m columns.\n\nNumbers in each row form a permutation of integers from 1 to m.\n\nYou are allowed to pick two elements in one row and swap them, but no more than once for each...
[{"type": "stdin_stdout", "input": "20 8\n4 3 2 1 5 6 7 8\n1 2 3 2 8 7 6 5\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp is mad about coding, that is why he writes Sveta encoded messages. He calls the median letter in a word the letter which is in the middle of the word. If the word's length is even, the median letter is the left o...
[{"type": "stdin_stdout", "input": "501\noilesjbgowlnayckhpoaitijewsyhgavnthycaecwnvzpxgjqfjyxnjcjknvvsmjbjwtcoyfbegmnnheeamvtfjkigqoanhvgdfrjchdqgowrstlmrjmcsuuwvvoeucfyhnxivosrxblfoqwikfxjnnyejdiihpenfcahtjwcnzwvxxseicvdfgqhtvefswznuyohmmljlnxubhevywpmnitnkhecsgccpstxkmdzabsnwxkokdfsogzbpnfvgudvqlstxojzfzugxbfrozveai...
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\nWinter is here at the North and the White Walkers are close. John Snow has an army consisting of n soldiers. While the rest of the world is fighting for the Iron Throne, he is going to get ready for the attack of the Whit...
[{"type": "stdin_stdout", "input": "4\n7 12 15 5\n", "output": "55\n"}, {"type": "stdin_stdout", "input": "4\n5 12 4 6\n", "output": "57\n"}, {"type": "stdin_stdout", "input": "4\n5 12 5 6\n", "output": "50\n"}, {"type": "stdin_stdout", "input": "4\n7 6 15 5\n", "output": "49\n"}, {"type": "stdin_stdout", "input": "4\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nn evenly spaced points have been marked around the edge of a circle. There is a number written at each point. You choose a positive real number k. Then you may repeatedly select a set of 2 or more points which are evenly ...
[{"type": "stdin_stdout", "input": "488\n453349582488862562152454328120974624021885842759505659322561694358728150516204337664755243733316681382547751353198982127441183878962690095592236469807087207161691714104527568781618875688104415243715506909284770554256616642020503116458540489226220383015748323400356936736149732496...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA string a of length m is called antipalindromic iff m is even, and for each i (1 ≀ i ≀ m) ai β‰  am - i + 1.\n\nIvan has a string s consisting of n lowercase Latin letters; n is even. He wants to form some string t that wi...
[{"type": "stdin_stdout", "input": "100\nadebebcdacabaadcbcdebcccdaadaeeedecdbcbdeddcbcaeedbecaeeabaabbdccaebdebabbabdcebbbdaabdbddcadaddadad\n52 62 28 18 100 84 16 53 43 52 49 92 10 64 50 95 90 52 21 14 60 3 94 63 31 70 74 62 93 75 100 96 58 36 76 40 62 74 91 77 92 78 65 11 50 18 79 29 10 25 4 24 44 39 4 91 81 63 97 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. ...
[{"type": "stdin_stdout", "input": "cicdcdikggfdibkibjdcfgafkdbkjeddbfeacceegecdjeeaedigcjehdjekibjhfdidebkhagibgfiafejfdckcadgcacgbgbcekbcebgeccekejkdkecabakffakjhkjigbaddkbeagfkcacbebfccdgcdihgigcjchgdkfikhceaefibkagaaekj\n", "output": "0.44385026737967914\n"}, {"type": "stdin_stdout", "input": "cicdcdikggfdibkibjdcf...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games. Alex enjoyed playing Minesweeper that time. He imagined that he saved world from bombs planted ...
[{"type": "stdin_stdout", "input": "21 10\n62637783*1\n23*51**531\n35*7*6.**.\n.*3***581*\n2.32*745**\n83*7*6*6*5\n*74.**6**3\n323*6**7*6\n3454*67.*1\n**63265*6*\n3725*4553*\n24****5**4\n23.34****4\n55257*1*4*\n4*3253*456\n**.3*45488\n*7318**4*5\n234.*4557*\n12..21*.*3\n286.235*4*\n834*11*.3*\n", "output": "NO\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Kraken lives!\n\nTragedy has struck the trade world since news has spread of the rise of the Kraken that terrorizes the Mediterranean Sea. Any ship that attempts to cross this strait is torn apart by the mighty tentac...
[{"type": "stdin_stdout", "input": "8\n21\nb 0\nc 1\nd 1\ne 1\nf 1\ng 0\nh 0\nj 1\nk 1\nl -1\nm 2\nn 1\no 0\nq 1\nr 0\nt 0\nu 0\nw 0\nx 1\ny 1\nz -2\n11111111111111111111111111111110111111111111110111111111111101111111111110111111111111111101111111111111111011111111111111101111111111111111111011111111111011111111111111...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nJoseph studies at SKIT.He is a fresher he has been given a task and he wants help from you for performing the task.The task is an interesting one.\n\nThe tasks is:-\n\nHe is provided with a value N, he has to make change ...
[{"type": "stdin_stdout", "input": "10\n4 30 12\n\nFLPMAS", "output": "0\n"}, {"type": "stdin_stdout", "input": "10\n4 20 12\n\nFLPMAS", "output": "0\n"}, {"type": "stdin_stdout", "input": "10\n4 20 12\n\nFLPSAM", "output": "0\n"}, {"type": "stdin_stdout", "input": "10\n4 20 19\n\nFLPSAM", "output": "0\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two numbers N and K and a set X.\n\nX = { x : x is a natural number ≀ N } \nYou have to find the total number of pairs of elements X[i] and X[j] belonging to the given set, such that, i < j and their sum is...
[{"type": "stdin_stdout", "input": "2\n12 3\n80 3\n\nRAMLPD", "output": "22\n1054\n"}, {"type": "stdin_stdout", "input": "2\n12 4\n80 3\n\nRAMPLD", "output": "15\n1054\n"}, {"type": "stdin_stdout", "input": "2\n12 1\n80 3\n\nRAMPLD", "output": "66\n1054\n"}, {"type": "stdin_stdout", "input": "2\n17 1\n28 3\n\nPALLRE", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe grandest stage of all, Wrestlemania XXX recently happened. And with it, happened one of the biggest heartbreaks for the WWE fans around the world. The Undertaker's undefeated streak was finally over. \n\nNow as an Un...
[{"type": "stdin_stdout", "input": "43\n23977\n51572\n123101\n15108\n362\n3100\n200978\n2022\n30701\n1938\n6120\n194869\n30338\n117918\n9978\n7235\n68390\n26667\n15024\n329\n24477\n56384\n11239\n51926\n42377\n19756\n241\n45575\n15310\n88487\n19469\n17155\n183422\n63425\n257917\n14454\n229306\n67918\n69127\n14024\n1431\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPandey needs your help. As you know, he is on the quest to save the princess. After traveling for a number of days, he has finally reached the palace, but one last battle remains to be fought. However he has only one unit...
[{"type": "stdin_stdout", "input": "10\n48\n+ 3\n+ 2\n+ 4\n- 3\n- 4\n- 2\n+ 3\n+ 2\n- 2\nN\nN\n+ 3\n+ 4\nN\n- 4\n+ 5\nN\n- 3\nN\n- 5\n+ 5\n- 3\nN\n- 1\n- 3\nN\n- 2\nN\n- 3\n- 2\n+ 1\n* 1\n+ 5\n- 4\n* 1\n* 4\n+ 4\nN\n+ 2\n- 3\n* 3\n+ 4\nN\n+ 5\n+ 2\nN\nN\nN\n41\n- 1\nN\n* 1\n- 4\nN\n+ 1\n- 5\nN\n* 4\n- 4\nN\n+ 3\n* 2\n-...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi is meeting up with Aoki.\n\nThey have planned to meet at a place that is D meters away from Takahashi's house in T minutes from now.\n\nTakahashi will leave his house now and go straight to the place at a speed ...
[{"type": "stdin_stdout", "input": "1000 21 183", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1001 21 183", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1001 14 183", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1001 14 176", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1001 20 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n* 1 \\leq N \\leq 2\\times 10^5\n* S_i consists of lowercase E...
[{"type": "stdin_stdout", "input": "5\ngrape\ngrape\ngraoe\ngrape\ngrape", "output": "2\n"}, {"type": "stdin_stdout", "input": "5\negapr\ngrape\ngraoe\ngr`pe\nepaqg", "output": "5\n"}, {"type": "stdin_stdout", "input": "5\ngrape\ngrape\ngraoe\ngrape\neparg", "output": "3\n"}, {"type": "stdin_stdout", "input": "5\ngrape...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven are strings s and t of length N each, both consisting of lowercase English letters.\n\nLet us form a new string by alternating the characters of S and the characters of T, as follows: the first character of S, the f...
[{"type": "stdin_stdout", "input": "8\nhmhmnknk uuuuuuut", "output": "humuhumunukunukt\n"}, {"type": "stdin_stdout", "input": "8\nhmhmnknk tuuuuuuu", "output": "htmuhumunukunuku\n"}, {"type": "stdin_stdout", "input": "8\nhmhmnknk tuuuuuvu", "output": "htmuhumunukunvku\n"}, {"type": "stdin_stdout", "input": "8\nhmhmnknk...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have decided to give an allowance to your child depending on the outcome of the game that he will play now.\n\nThe game is played as follows:\n\n* There are three \"integer panels\", each with a digit between 1 and 9 ...
[{"type": "stdin_stdout", "input": "-1 12 1", "output": "120\n"}, {"type": "stdin_stdout", "input": "1 11 1", "output": "112\n"}, {"type": "stdin_stdout", "input": "1 21 1", "output": "212\n"}, {"type": "stdin_stdout", "input": "2 21 1", "output": "213\n"}, {"type": "stdin_stdout", "input": "1 19 1", "output": "192\n"}...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N sightseeing spots on the x-axis, numbered 1, 2, ..., N. Spot i is at the point with coordinate A_i. It costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with c...
[{"type": "stdin_stdout", "input": "6\n-168 -101 -3258 1873 -20088 -2101", "output": "50438\n50438\n44258\n40310\n14598\n50572\n"}, {"type": "stdin_stdout", "input": "6\n-168 -101 -3258 1873 -20088 -1768", "output": "50438\n50438\n44258\n40310\n13932\n50572\n"}, {"type": "stdin_stdout", "input": "6\n-679 -3431 -3258 30...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the year 2168, AtCoder Inc., which is much larger than now, is starting a limited express train service called AtCoder Express.\n\nIn the plan developed by the president Takahashi, the trains will run as follows:\n\n* ...
[{"type": "stdin_stdout", "input": "10\n64 55 27 35 76 119 7 18 49 100\n29 19 31 39 27 48 41 87 55 70", "output": "20291.000000000000"}, {"type": "stdin_stdout", "input": "10\n64 55 27 35 76 119 7 18 49 100\n3 19 31 44 27 48 41 87 55 79", "output": "19071.25\n"}, {"type": "stdin_stdout", "input": "10\n64 55 27 35 76 11...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is an empty array. The following N operations will be performed to insert integers into the array. In the i-th operation (1≀i≀N), b_i copies of an integer a_i are inserted into the array. Find the K-th smallest inte...
[{"type": "stdin_stdout", "input": "10 878093\n1 100000\n1 110001\n1 100000\n1 100001\n1 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000", "output": "100000\n"}, {"type": "stdin_stdout", "input": "10 878093\n1 100000\n1 110001\n1 100000\n1 101001\n1 100000\n100000 100000\n100000 100000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the speed skating badge test, grades are awarded when the time specified for two distances is exceeded. For example, to reach Class A, 500 M requires less than 40.0 seconds and 1000 M requires less than 1 minute and 23...
[{"type": "stdin_stdout", "input": "70.02963720383003 94.72312922368101\n103.91489947609344 168.84078141503855", "output": "NA\nNA\n"}, {"type": "stdin_stdout", "input": "50.825010742906116 75.69989732783311\n82.26479437960049 146.33206365267094", "output": "D\nNA\n"}, {"type": "stdin_stdout", "input": "40.991466890252...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nShinya watched a program on TV called \"Maya's Great Prophecy! Will the World End in 2012?\" After all, I wasn't sure if the world would end, but I was interested in Maya's \"long-term calendar,\" which was introduced in ...
[{"type": "stdin_stdout", "input": "2012.12.31\n2.11.16.14.14\n7138.4.03\n10.5.5.1.2\n10000000.12.31\n#", "output": "0.0.0.0.10\n3034.11.28\n12.19.19.16.10\n6059.2.10\n8.19.3.13.2\n"}, {"type": "stdin_stdout", "input": "2312.02.12\n2.12.16.14.14\n7128.5.13\n5.1.5.2.01\n10020000.10.31\n#", "output": "0.15.3.8.19\n3054.8...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nMobiles are widely known as moving works of art. The IOI Japan Committee has decided to create mobiles to publicize JOI. JOI public relations mobiles are sticks, strings, and weights. It is constructed as follo...
[{"type": "stdin_stdout", "input": "1\n7 22 0 0\n4\n2 2 0 4\n1 3 0 0\n9 10 2 1\n3 2 0 0\n0", "output": "29\n190\n"}, {"type": "stdin_stdout", "input": "1\n7 11 0 0\n4\n2 2 0 4\n1 3 0 0\n3 8 2 1\n3 2 0 0\n0", "output": "18\n110\n"}, {"type": "stdin_stdout", "input": "1\n7 22 0 0\n4\n2 2 0 4\n1 3 0 0\n3 8 2 1\n3 2 0 0\n0...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA crop circle suddenly appeared on the vast agricultural land of Argentina. A total of n crop circles were confirmed, including overlapping, popping, large, and small ones.\n\nWhen a mystery hunter tried to capture the wh...
[{"type": "stdin_stdout", "input": "4\n6 4 2\n4 7 3\n7 10 3\n13 6 1\n4\n7 4 2\n4 7 3\n7 10 3\n11 6 3\n0", "output": "39.664699289572\n45.627024663706"}, {"type": "stdin_stdout", "input": "4\n3 4 1\n4 7 3\n12 14 3\n13 3 1\n4\n7 4 2\n4 7 3\n6 10 3\n11 6 3\n0", "output": "45.836887586\n48.016187138\n"}, {"type": "stdin_st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBridge Removal\n\nICPC islands once had been a popular tourist destination. For nature preservation, however, the government decided to prohibit entrance to the islands, and to remove all the man-made structures there. Th...
[{"type": "stdin_stdout", "input": "4\n1 2 3\n10 37 30\n10\n1 2 2 1 1 5 1 10 8\n10 2 1 20 2 1 30 1 1\n3\n1 1\n1 1\n0", "output": "114\n139\n2\n"}, {"type": "stdin_stdout", "input": "4\n1 2 3\n10 37 52\n10\n1 2 2 1 1 5 1 10 8\n10 2 1 20 2 1 30 1 1\n3\n1 1\n1 1\n0", "output": "136\n139\n2\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn sliding block puzzles, we repeatedly slide pieces (blocks) to open spaces within a frame to establish a goal placement of pieces.\n\nA puzzle creator has designed a new puzzle by combining the ideas of sliding block pu...
[{"type": "stdin_stdout", "input": "3 3\noo.\noXX\n.XX\n3 3\nXXp\nXX.\no.o\n3 5\n.o*XX\noooXX\noooo.\n7 12\noooooooooooo\nooooo*****oo\noooooo****oo\no**ooo***ooo\no***ooooo..o\no**ooooooXXo\nooooo****XXo\n5 30\noooooooooooooooooooooooooooooo\noooooooooooooooooooooooooooooo\no***************************oo\nXX.ooooooooo...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConvex polygon pillar industrial city\n\nThe Industrial Convex Pillar City (ICPC) is a city of buildings in the shape of several convex polygonal columns. You are about to walk through this city from your current location...
[{"type": "stdin_stdout", "input": "2\n4 1 0 0 1 0 1 1 0 1\n4 2 2 2 3 2 3 3 2 3\n60 45\n-1 -1 4 4\n4\n4 1 0 0 3 1 1 2 0 1\n3 2 10 7 8 2 12 4\n6 8 7 12 8 13 9 15 10 19 11 24 10 25\n5 4 16 2 16 4 12 8 14 2 15 0\n167 38\n3 3 15 21\n12\n4 3 -8 -3 -9 -3 -9 -5 -8 -6\n4 5 -4 -5 -7 -5 -7 -6 -9 -6\n4 2 -4 1 -5 1 -5 -4 -4 -4\n4 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nF: Grid number\n\nproblem\n\nEbi-chan is trying to write exactly one integer from 1 to 2 \\ times n in a grid with n columns horizontally and 2 rows vertically.\n\nOnly one integer can be written to each cell in the grid....
[{"type": "stdin_stdout", "input": "8 10 37", "output": "24\n"}, {"type": "stdin_stdout", "input": "5 4 11", "output": "10\n"}, {"type": "stdin_stdout", "input": "5 3 17", "output": "16\n"}, {"type": "stdin_stdout", "input": "5 4 18", "output": "14\n"}, {"type": "stdin_stdout", "input": "8 6 37", "output": "21\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEarthquakes\n\nE869120 You are not good at earthquakes.\n\nSpecifically, if an earthquake with a seismic intensity of $ p $ occurs while you are doing a task, the performance of that task will be reduced by $ 10 \\ times ...
[{"type": "stdin_stdout", "input": "3\n5 3\n-1 1\n22 2\n3\n1 4\n4 9", "output": "1000000000.0000000000000000\n1000000000.0000000000000000\n1000000000.0000000000000000\n"}, {"type": "stdin_stdout", "input": "3\n5 3\n-1 2\n22 2\n3\n1 4\n4 9", "output": "1000000000.0000001192092896\n1000000000.0000001192092896\n1000000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor a given weighted graph G(V, E) and a source r, find the source shortest path to each vertex from the source (SSSP: Single Source Shortest Path).\n\nConstraints\n\n* 1 ≀ |V| ≀ 100000\n* 0 ≀ di ≀ 10000\n* 0 ≀ |E| ≀ 5000...
[{"type": "stdin_stdout", "input": "8 6 1\n0 1 1\n0 2 4\n2 0 1\n0 2 2\n3 1 1\n3 2 5", "output": "INF\n0\nINF\nINF\nINF\nINF\nINF\nINF\n"}, {"type": "stdin_stdout", "input": "8 6 1\n0 1 1\n0 2 4\n0 0 1\n1 2 2\n3 0 2\n3 2 5", "output": "INF\n0\n2\nINF\nINF\nINF\nINF\nINF\n"}, {"type": "stdin_stdout", "input": "8 6 2\n0 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently, Chef got obsessed with piano. He is a just a rookie in this stuff and can not move his fingers from one key to other fast enough. He discovered that the best way to train finger speed is to play scales.\nThere a...
[{"type": "stdin_stdout", "input": "2 \nTSTT\n35\nRTTSSTT\n-4", "output": "12390\n0\n"}, {"type": "stdin_stdout", "input": "2 \nTSTT\n33\nRTTSSTT\n-6", "output": "11004\n0\n"}, {"type": "stdin_stdout", "input": "2 \nTSTT\n43\nSTSTTUR\n-1", "output": "18761\n0\n"}, {"type": "stdin_stdout", "input": "2 \nTSSS\n10\nSSTTRT...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlice got an array of length n as a birthday present once again! This is the third year in a row! \n\nAnd what is more disappointing, it is overwhelmengly boring, filled entirely with zeros. Bob decided to apply some chan...
[{"type": "stdin_stdout", "input": "5 12\n634 895\n143 730\n901 245\n386 486\n395 -111\n-469 -104\n-681 -623\n-900 843\n880 -883\n476 -304\n777 986\n206 -491\n", "output": "8098.800000000\n"}, {"type": "stdin_stdout", "input": "5 12\n634 895\n206 730\n901 245\n386 486\n395 -111\n-469 -104\n-681 -623\n-900 843\n880 -883...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVova has taken his summer practice this year and now he should write a report on how it went.\n\nVova has already drawn all the tables and wrote down all the formulas. Moreover, he has already decided that the report will...
[{"type": "stdin_stdout", "input": "94 3\n4 2 1 6 1 1 1 5 1 3 3 3 6 1 6 6 3 5 3 1 4 1 3 6 4 5 3 4 6 5 5 2 1 5 4 5 6 5 2 2 6 5 4 6 1 3 5 1 2 5 5 2 1 3 4 5 6 4 3 1 4 4 1 5 4 4 2 2 2 4 4 3 6 2 6 1 5 6 1 3 5 5 1 3 5 3 5 2 6 1 3 6 1 5\n5 6 3 5 4 1 4 6 3 1 4 4 3 3 6 2 1 1 4 6 4 2 4 1 3 1 5 3 6 2 5 6 1 6 6 2 2 2 2 5 2 6 1 4 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n<image>\n\nInput\n\nThe input contains a single integer a (0 ≀ a ≀ 15).\n\nOutput\n\nOutput a single integer.\n\nExample\n\nInput\n\n\n3\n\n\nOutput\n\n\n13\n\nThe input will be given via stdin and the output should be pr...
[{"type": "stdin_stdout", "input": "000\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "3\n", "output": "13\n"}, {"type": "stdin_stdout", "input": "11\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "10\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "12\n", "output": "4\n"}, {"type": "stdin_s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTom loves vowels, and he likes long words with many vowels. His favorite words are vowelly words. We say a word of length k is vowelly if there are positive integers n and m such that nβ‹… m = k and when the word is written...
[{"type": "stdin_stdout", "input": "34110\n", "output": "aeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaeiouaei...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is the length of the string.\n\nYou are given a string s and a string t, both consisting only of lowercase Latin letters. It is guaranteed that t can be obtained from s b...
[{"type": "stdin_stdout", "input": "ziurxtzxixmsmewfuffsqdkpphssdcgybwtmzavkosqtmcntspzvftqybaldjllvgttblectspqinfdhhnpvkcbwjlqlquajueqsgymyekuswjctumsbnvvaiinxjlzcnyixfaykolkeogufvzvhnatqtelgjkqfvexghiznwubwihjkznkhepjzrnyzftmimqtlihpn\nzurzximmewfuffskppsdcybwmzavkosqtmctspvftybaljlgtltsqinfdhhpvkcwjlqlqymykusctumsbn...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSasha grew up and went to first grade. To celebrate this event her mother bought her a multiplication table M with n rows and n columns such that M_{ij}=a_i β‹… a_j where a_1, ..., a_n is some sequence of positive integers....
[{"type": "stdin_stdout", "input": "10\n0 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 0 1 1 1 1 1 1 1 1\n1000000000 1 0 1 1 1 1 1 1 1\n1000000000 1 1 0 1 1 1 1 1 1\n1000000000 1 1 1 0 1 1 1 1 1\n1000000000 1 1 1 1 0 1 1 1 1\n1000000000 1 1 1 1 1 0 1 1 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKuroni is very angry at the other setters for using him as a theme! As a punishment, he forced them to solve the following problem:\n\nYou have an array a consisting of n positive integers. An operation consists of choosi...
[{"type": "stdin_stdout", "input": "10\n648137704891 648137704891 648137704891 648137704891 648137704891 648137704891 648137704891 648137704891 648137704891 724560300002\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "5\n169999847 169999847 169999847 300469729580 169999847\n", "output": "3\n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA lot of people associate Logo programming language with turtle graphics. In this case the turtle moves along the straight line and accepts commands \"T\" (\"turn around\") and \"F\" (\"move 1 unit forward\").\n\nYou are ...
[{"type": "stdin_stdout", "input": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\n50\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "TFFFTTTFFFFTFFTTFTTFTTFFTFFFTTTTTTFTTTTTTFFFFFFFTFFFFTTTFTFFTTTTTTFFFFFTTFTFTFFFTFTTFFTTFFFTTFFFTTTT\n1\n", "output": "1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence of positive integers a1, a2, ..., an. Find all such indices i, that the i-th element equals the arithmetic mean of all other elements (that is all elements except for this one).\n\nInput\n\nThe fi...
[{"type": "stdin_stdout", "input": "15\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n", "output": "15\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15\n"}, {"type": "stdin_stdout", "input": "10\n3 3 3 3 3 4 3 3 3 2\n", "output": "8\n1 2 3 4 5 7 8 9\n"}, {"type": "stdin_stdout", "input": "10\n15 7 10 7 7 7 4 4 7 2\n", "output": "5\n2 4 5 6 9\n"}...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's consider all integers in the range from 1 to n (inclusive).\n\nAmong all pairs of distinct integers in this range, find the maximum possible greatest common divisor of integers in pair. Formally, find the maximum va...
[{"type": "stdin_stdout", "input": "100\n2\n3\n4\n6\n6\n9\n8\n9\n10\n11\n12\n23\n14\n15\n5\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n11\n20\n35\n36\n37\n38\n65\n40\n41\n42\n43\n44\n70\n46\n47\n48\n49\n50\n51\n52\n53\n54\n55\n56\n57\n58\n59\n60\n61\n62\n63\n64\n65\n66\n67\n68\n69\n70\n71\n72\n73\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOmkar is standing at the foot of Celeste mountain. The summit is n meters away from him, and he can see all of the mountains up to the summit, so for all 1 ≀ j ≀ n he knows that the height of the mountain at the point j m...
[{"type": "stdin_stdout", "input": "100\n75 122 155 169 264 333 369 416 439 486 503 541 557 635 726 745 814 845 899 914 943 1016 1090 1132 1191 1199 1258 1323 1423 1491 1557 1562 1583 1663 1707 1711 1729 1095 1819 1894 1916 1926 1953 2022 2042 2055 2061 2125 2135 2170 2183 2215 2310 2338 2377 2420 2425 2473 2484 2537 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are a mayor of Berlyatov. There are n districts and m two-way roads between them. The i-th road connects districts x_i and y_i. The cost of travelling along this road is w_i. There is some path between each pair of di...
[{"type": "stdin_stdout", "input": "5 5 4\n1 2 5\n4 3 4\n1 4 3\n4 3 10\n3 5 2\n1 5\n1 3\n3 3\n1 5\n", "output": "13\n"}, {"type": "stdin_stdout", "input": "5 5 4\n1 2 5\n4 3 4\n1 4 3\n4 3 10\n3 5 2\n1 2\n1 3\n3 3\n1 5\n", "output": "13\n"}, {"type": "stdin_stdout", "input": "5 5 4\n1 2 5\n2 3 4\n1 4 3\n4 3 7\n3 5 2\n1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKilani and Abd are neighbors for 3000 years, but then the day came and Kilani decided to move to another house. As a farewell gift, Kilani is going to challenge Abd with a problem written by their other neighbor with the ...
[{"type": "stdin_stdout", "input": "100 60\n1 10 1 1 1 1 1 8 1 33 38 1 59 1 1 1 63 1 1 39 1 1 1 50 1 1 1 1 1 96 1 1 23 1 1 15 1 1 1 1 1 1 16 46 1 91 89 1 1 5 1 1 69 1 1 6 49 1 1 1 1 1 36 24 1 1 1 1 5 1 41 29 62 60 28 68 1 15 30 1 22 27 59 1 1 95 1 1 67 1 40 1 1 1 1 1 66 13 52\n", "output": "3\nbabaaaaababbabaaabaabaaab...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFour players participate in the playoff tournament. The tournament is held according to the following scheme: the first player will play with the second, and the third player with the fourth, then the winners of the pairs...
[{"type": "stdin_stdout", "input": "4\n3 7 9 5\n4 5 6 1\n5 3 8 1\n2 5 3 2\n", "output": "YES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "4\n3 7 2 5\n4 5 6 9\n5 3 15 1\n2 5 3 1\n", "output": "YES\nNO\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "4\n3 7 9 5\n4 5 6 9\n5 3 8 1\n6 5 3 2\n", "output": "\nYES\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Little Elephant very much loves sums on intervals.\n\nThis time he has a pair of integers l and r (l ≀ r). The Little Elephant has to find the number of such integers x (l ≀ x ≀ r), that the first digit of integer x e...
[{"type": "stdin_stdout", "input": "100000000000000000 1000000000000000000\n", "output": "90000000000000000\n"}, {"type": "stdin_stdout", "input": "779547115376367013 980561039207670775\n", "output": "20101392383130376\n"}, {"type": "stdin_stdout", "input": "458985985498001244 985458425544874008\n", "output": "52647244...
code_stdio