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\nBeroffice text editor has a wide range of features that help working with text. One of the features is an automatic search for typos and suggestions of how to fix them.\n\nBeroffice works only with small English letters (... | [{"type": "stdin_stdout", "input": "bddabcdfaccdabcdfadddabcdfabbdabcdfacddabcdfacdbabcdfacbbabcdfacbcabcdfacbdabcdfadbbabcdfabdbabcdfabdcabcdfabbcabcdfabccabcdfabbbabcdfaddcabcdfaccbabcdfadbdabcdfacccabcdfadcdabcdfadcbabcdfabcbabcdfadbcabcdfacdcabcdfabcdabcdfadccabcdfaddb\n", "output": "bd dabc dfacc dabc dfadddabc df... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEvlampiy has found one more cool application to process photos. However the application has certain limitations.\n\nEach photo i has a contrast vi. In order for the processing to be truly of high quality, the application ... | [{"type": "stdin_stdout", "input": "101 9\n3 2 2 1 4 1 3 2 3 4 3 2 3 1 4 4 1 1 4 1 3 3 4 1 2 1 1 3 1 2 2 4 3 1 4 3 1 1 4 4 1 2 1 1 4 2 3 4 1 2 1 4 4 1 4 3 1 4 2 1 2 1 4 3 4 3 4 2 2 4 3 2 1 1 4 3 2 2 4 3 3 2 4 1 3 2 2 4 1 3 4 2 1 3 3 2 2 1 1 3 1\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "101 9\n3 2 2 1 4 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nStudents went into a class to write a test and sat in some way. The teacher thought: \"Probably they sat in this order to copy works of each other. I need to rearrange them in such a way that students that were neighbors ... | [{"type": "stdin_stdout", "input": "101 4\n", "output": "YES\n2 4 1 3 \n7 5 8 6 \n10 12 9 11 \n15 13 16 14 \n18 20 17 19 \n23 21 24 22 \n26 28 25 27 \n31 29 32 30 \n34 36 33 35 \n39 37 40 38 \n42 44 41 43 \n47 45 48 46 \n50 52 49 51 \n55 53 56 54 \n58 60 57 59 \n63 61 64 62 \n66 68 65 67 \n71 69 72 70 \n74 76 73 75 \n7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhen registering in a social network, users are allowed to create their own convenient login to make it easier to share contacts, print it on business cards, etc.\n\nLogin is an arbitrary sequence of lower and uppercase l... | [{"type": "stdin_stdout", "input": "ELioO1lOoOIOiLoooi1iolul1O\n7\nOoEIuOIl1ui1010uiooOoi0Oio001L0EoEolO0\nOLIoOEuoE11u1u1iLOI0oO\nuEOuO0uIOOlO01OlEI0E1Oo0IO1LI0uE0LILO0\nEOo0Il11iIOOOIiuOiIiiLOLEOOII001EE\niOoO0LOulioE0OLIIIulli01OoiuOOOoOlEiI0EiiElIIu0\nlE1LOE1Oil\n1u0EOliIiIOl1u110il0l1O0u\n", "output": "Yes\n"}, {"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn atom of element X can exist in n distinct states with energies E1 < E2 < ... < En. Arkady wants to build a laser on this element, using a three-level scheme. Here is a simplified description of the scheme. \n\nThree di... | [{"type": "stdin_stdout", "input": "50 42\n257 258 350 375 1014 1017 1051 1097 1169 1177 1223 1836 1942 1983 2111 2131 2341 2418 2593 2902 2948 3157 3243 3523 3566 4079 4499 4754 5060 5624 6279 6976 7011 7071 7278 7366 7408 7466 7526 7837 7934 8532 8577 8680 9221 9271 9327 9411 9590 9794\n", "output": "0.918918918919\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou're given a tree with n vertices.\n\nYour task is to determine the maximum possible number of edges that can be removed in such a way that all the remaining connected components will have even size.\n\nInput\n\nThe fir... | [{"type": "stdin_stdout", "input": "10\n7 1\n8 4\n8 10\n4 7\n6 10\n9 3\n3 5\n2 10\n2 5\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "10\n8 1\n8 4\n8 10\n4 7\n6 10\n9 3\n3 5\n2 10\n2 5\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "10\n4 1\n10 4\n8 10\n4 7\n6 5\n9 2\n3 5\n2 10\n2 5\n", "output": "0\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAgain a simple task from Oz! He has given you two strings STR1 and STR2. Each character of both strings is from the set {A, B, C, D, E, F, G, H, I, J}. You can perform 3 types of conversions on string STR1 :\nReplace a ch... | [{"type": "stdin_stdout", "input": "10\nIAADIGED\nFGAAAJFH\nGAEDDHCD\nICICDCDH\nJAAHBJGH\nFBEIIJBE\nAEHAHAHD\nEIAHJCDJ\nGEGEEDGE\nHEJJIHFA\nAHJHHGEC\nGEDBGBAE\nGBIFIIIB\nCBHJDAGG\nCBJCCJBA\nFHEDFDBD\nEAAHFJEB\nBBEFGDBB\nJCGHCGHG\nAGCEDGGA", "output": "11\n11\n13\n16\n20\n20\n15\n19\n14\n20\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter a furious battle Pirate Jack won a battle against Captain Luthur. Pirate Jack found a golden chest from Luthur's treasures. But the problem is that Luthur's coders have locked this chest. You have found the function... | [{"type": "stdin_stdout", "input": "hack\n\nSAMPLE", "output": "-105 -98 -100 -108 \n"}, {"type": "stdin_stdout", "input": "hjca\n\nSAMPLE", "output": "-105 -107 -100 -98 \n"}, {"type": "stdin_stdout", "input": "ackh\n\nELNPAR", "output": "-98 -100 -108 -105 \n"}, {"type": "stdin_stdout", "input": "acki\n\nELNPAR", "ou... | 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.\n\nThere are N attendees in the party, and they a... | [{"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\nAt an arcade, Takahashi is playing a game called RPS Battle, which is played as follows:\n\n* The player plays N rounds of Rock Paper Scissors against the machine. (See Notes for the description of Rock Paper Scissors. A ... | [{"type": "stdin_stdout", "input": "30 6\n325 234 123\nrspsspspsrpspsppprpsprpssprpsr", "output": "6328\n"}, {"type": "stdin_stdout", "input": "30 6\n325 177 123\nrspsspspsrpspsppprpsprpssprpsr", "output": "5758\n"}, {"type": "stdin_stdout", "input": "30 13\n13 228 123\nssprpssprpsprpppspsprspspsspsr", "output": "2569\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn 2020, AtCoder Inc. with an annual sales of more than one billion yen (the currency of Japan) has started a business in programming education.\nOne day, there was an exam where a one-year-old child must write a program ... | [{"type": "stdin_stdout", "input": "1", "output": "Hello World"}, {"type": "stdin_stdout", "input": "2\n-2\n116", "output": "114\n"}, {"type": "stdin_stdout", "input": "2\n-2\n178", "output": "176\n"}, {"type": "stdin_stdout", "input": "2\n-2\n184", "output": "182\n"}, {"type": "stdin_stdout", "input": "2\n-2\n143", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given sequences A and B consisting of non-negative integers. The lengths of both A and B are N, and the sums of the elements in A and B are equal. The i-th element in A is A_i, and the i-th element in B is B_i.\n\... | [{"type": "stdin_stdout", "input": "3\n11 3\n-1 1\n2 8", "output": "9\n"}, {"type": "stdin_stdout", "input": "3\n8 3\n-1 1\n5 8", "output": "9\n"}, {"type": "stdin_stdout", "input": "3\n8 3\n-1 0\n4 8", "output": "8\n"}, {"type": "stdin_stdout", "input": "3\n8 3\n0 1\n4 8", "output": "9"}, {"type": "stdin_stdout", "inp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi is an expert of Clone Jutsu, a secret art that creates copies of his body.\n\nOn a number line, there are N copies of Takahashi, numbered 1 through N. The i-th copy is located at position X_i and starts walking ... | [{"type": "stdin_stdout", "input": "4\n2 1\n16 20\n6 56\n13 0", "output": "13\n"}, {"type": "stdin_stdout", "input": "4\n1 7\n5 10\n6 50\n10 1", "output": "12\n"}, {"type": "stdin_stdout", "input": "4\n1 7\n5 10\n6 50\n10 0", "output": "12\n"}, {"type": "stdin_stdout", "input": "4\n1 7\n5 16\n6 50\n10 0", "output": "12... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a string s of length 3 or greater. No two neighboring characters in s are equal.\n\nTakahashi and Aoki will play a game against each other. The two players alternately performs the following operation, Takahashi ... | [{"type": "stdin_stdout", "input": "bceab", "output": "Second\n"}, {"type": "stdin_stdout", "input": "bacba", "output": "First\n"}, {"type": "stdin_stdout", "input": "badba", "output": "First\n"}, {"type": "stdin_stdout", "input": "cadba", "output": "First\n"}, {"type": "stdin_stdout", "input": "dadba", "output": "Firs... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candie... | [{"type": "stdin_stdout", "input": "-465", "output": "107880\n"}, {"type": "stdin_stdout", "input": "-792", "output": "313236\n"}, {"type": "stdin_stdout", "input": "-937", "output": "438516\n"}, {"type": "stdin_stdout", "input": "-845", "output": "356590\n"}, {"type": "stdin_stdout", "input": "-647", "output": "208981... | 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\nConsider the following game. There are k pairs of n cards with numbers from 1 to n written one by one. Shuffle these kn cards well to make piles of k cards and arrange them in a horizontal row. The i-th (k-card) pile from... | [{"type": "stdin_stdout", "input": "2 1 0 5\n3 1 2 6\n2 2 1 3\n0 0 0 0", "output": "0.50000\n0.833333\n1.000\n"}, {"type": "stdin_stdout", "input": "2 1 1 5\n3 1 1 6\n2 2 1 3\n0 0 0 0", "output": "1.00000\n0.833333\n1.000\n"}, {"type": "stdin_stdout", "input": "2 1 1 5\n3 1 1 6\n2 2 0 3\n0 0 0 0", "output": "1.00000\n0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNantendo Co., Ltd. has released a game software called Packet Monster. This game was intended to catch, raise, and fight monsters, and was a very popular game all over the world.\n\nThis game had features not found in tra... | [{"type": "stdin_stdout", "input": "CBA\ncba\ncCa\nX\nYZ\nZ\n-", "output": "BbA\nYX\n"}, {"type": "stdin_stdout", "input": "CBA\ncba\ncCa\nY\nYZ\nZ\n-", "output": "BbA\nYY\n"}, {"type": "stdin_stdout", "input": "CBA\ncca\ncCa\nX\nZY\nZ\n-", "output": "BcA\nXY\n"}, {"type": "stdin_stdout", "input": "CAB\ncba\ncCa\nX\nYZ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAmber Claes Maes, a patissier, opened her own shop last month. She decided to submit her work to the International Chocolate Patissier Competition to promote her shop, and she was pursuing a recipe of sweet chocolate bars... | [{"type": "stdin_stdout", "input": "3 5\n###.#\n#####\n###..\n4 5\n.#.##\n####.\n####.\n##.#.\n8 8\n.#.#.#.#\n########\n.######.\n########\n.######.\n########\n.######.\n########\n8 8\n.#.#.#.#\n########\n.##.#.#.\n##....##\n.##.###.\n##...###\n.##.###.\n###.#.##\n4 4\n####\n####\n####\n####\n0 0", "output": "3\n5\n11\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem statement\n\nThere is a rational number sequence $ X_0, X_1, X_2, ..., X_N $. Each term is defined as follows.\n\n\n1. $ X_0 = 0 $\n2. $ X_i = X_ {i-1} $ $ op_i $ $ Y_i $ ($ 1 \\ leq i \\ leq N $). However, $ op_i... | [{"type": "stdin_stdout", "input": "4\n-1 2\n12 0\n1 -3\n3 13", "output": "-39\n"}, {"type": "stdin_stdout", "input": "4\n-2 4\n7 1\n-1 8\n2 25", "output": "-25\n"}, {"type": "stdin_stdout", "input": "4\n-1 -2\n2 3\n3 2\n2 22", "output": "-28\n"}, {"type": "stdin_stdout", "input": "4\n-1 -2\n2 5\n3 2\n2 22", "output": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem Statement\n\nDo you know the data structure called BDD (Binary Decision Diagram)? In recent years, ZDD, which has become a hot topic in the video related to Combinatorial Explosion Sister, is a data structure deri... | [{"type": "stdin_stdout", "input": "5\n11110101011100110010111100010011", "output": "13\n"}, {"type": "stdin_stdout", "input": "5\n11110101011100110010111100000010", "output": "12\n"}, {"type": "stdin_stdout", "input": "5\n10111101011100110010111100000010", "output": "14\n"}, {"type": "stdin_stdout", "input": "5\n10111... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n3\naab\nczc\nbaa\n\n\nOutput\n\naac\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... | [{"type": "stdin_stdout", "input": "3\naab\nccz\nbaa", "output": "aac\n"}, {"type": "stdin_stdout", "input": "3\nbba\nzcc\nbaa", "output": "aaz\n"}, {"type": "stdin_stdout", "input": "3\nabb\nzbc\nbaa", "output": "aab\n"}, {"type": "stdin_stdout", "input": "3\nbbb\nzcd\nbaa", "output": "abc\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nB: Dansunau www --Dance Now!-\n\nstory\n\nLast lab life! Daigakuin! !! Dosanko Snow has won 9th place in the event \"Master Idol World\", which can be said to be the outpost of the biggest competition \"Lab Life\" where m... | [{"type": "stdin_stdout", "input": "9\n9 8 7 6 9 5 3 2 1\n1 1 1\n3 4 2\n4 3 3\n4 0 4\n5 10 5\n12 9 7\n7 7 7\n8 11 8\n9 11 9", "output": "3\n"}, {"type": "stdin_stdout", "input": "9\n9 8 7 6 9 5 3 2 1\n1 1 1\n3 4 2\n4 3 3\n4 0 4\n5 10 5\n12 9 7\n7 7 7\n8 8 8\n9 11 9", "output": "3\n"}, {"type": "stdin_stdout", "input": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nD: Two Colors Sort\n\nproblem\n\nDuring the walk, umg found a sequence of length N, P_1, P_2, ..., P_N, which can be made by rearranging 1,2, ..., N.\n\numg can use mysterious powers to exchange places by choosing two dif... | [{"type": "stdin_stdout", "input": "1 0\n1 -1 18", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1 0\n2 -1 18", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "2 0\n1 2 11", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "2 0\n1 2 14", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "2 0\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which manipulates a sequence A = {a1, a2, . . . , an} with the following operations:\n\n* add(s, t, x): add x to as, as+1, ..., at.\n* getSum(s, t): report the sum of as, as+1, ..., at.\n\n\n\nNote that th... | [{"type": "stdin_stdout", "input": "3 5\n0 1 1 0\n0 2 3 2\n0 2 3 3\n1 2 3\n1 2 3", "output": "10\n10\n"}, {"type": "stdin_stdout", "input": "3 5\n0 1 2 1\n0 2 3 2\n0 2 3 3\n1 1 2\n1 2 3", "output": "7\n11\n"}, {"type": "stdin_stdout", "input": "3 5\n0 1 1 1\n0 2 3 2\n0 2 3 3\n1 1 2\n1 2 3", "output": "6\n10\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNatasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on n - 2 intermediate planets. Formally: we number all the planets from 1 to n. 1 is Earth, n is Mars. Natasha will ... | [{"type": "stdin_stdout", "input": "90\n35\n1 68 16 30 24 1 1 1 35 1 1 67 1 1 1 1 33 16 37 77 83 1 77 26 1 1 68 67 70 62 1 47 1 1 1 84 1 65 1 32 83 1 1 1 28 1 71 76 84 1 1 5 1 74 10 1 1 1 38 87 13 1 7 66 81 49 1 9 1 11 1 25 1 1 1 1 7 1 1 36 61 47 51 1 1 69 40 1 37 1\n40 1 21 1 19 51 37 52 64 1 86 1 5 24 1 1 1 19 36 1 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMr. F has n positive integers, a_1, a_2, …, a_n.\n\nHe thinks the greatest common divisor of these integers is too small. So he wants to enlarge it by removing some of the integers.\n\nBut this problem is too simple for h... | [{"type": "stdin_stdout", "input": "100\n95 94 31 65 35 95 70 78 81 36 69 97 39 28 89 62 36 23 35 21 36 11 65 39 13 34 79 87 91 70 43 82 24 97 6 87 49 81 60 92 63 9 16 6 31 90 6 5 70 48 27 86 65 66 45 8 67 17 24 44 34 93 26 32 82 54 72 83 94 81 79 79 9 9 4 59 42 83 80 67 28 62 56 58 87 67 34 3 61 14 62 19 94 31 74 97 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp, Arkady's friend, prepares to the programming competition and decides to write a contest. The contest consists of n problems and lasts for T minutes. Each of the problems is defined by two positive integers a_i a... | [{"type": "stdin_stdout", "input": "2\n4\n1.9585346052548882 31.000\n12 0\n11 6\n30 1\n5 1\n3\n1.360280845492949 30.337801087585063\n0 10\n10 8\n20 8\n", "output": "7\n18\n"}, {"type": "stdin_stdout", "input": "2\n4\n1.557488533293537 31.000\n12 0\n11 6\n30 1\n5 1\n3\n1.360280845492949 30.337801087585063\n0 10\n10 8\n2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs a German University in Cairo (GUC) student and a basketball player, Herr Wafa was delighted once he heard the news. GUC is finally participating in the Annual Basketball Competition (ABC). \n\nA team is to be formed of... | [{"type": "stdin_stdout", "input": "65 173 136\n26 18 8 11 1 22 44 6 15 22 13 49 30 36 37 41 25 27 9 36 36 1 45 20 7 47 28 30 30 21 33 32 9 11 16 5 19 12 44 40 25 40 32 36 15 34 4 43 28 19 29 33 7 11 18 13 40 18 10 26 1 48 20 38 1 20 34 8 46 8 32 35 16 49 26 36 11 16 4 29 35 44 14 21 22 42 10 1 3 12 35 30 14 45 2 24 32... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\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": "691900\n", "output": "4444477777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAt the first holiday in spring, the town Shortriver traditionally conducts a flower festival. Townsfolk wear traditional wreaths during these festivals. Each wreath contains exactly k flowers.\n\nThe work material for the... | [{"type": "stdin_stdout", "input": "100 15 6 10\n6 9 1 7 6 4 1 9 3 2 4 6 2 5 3 10 9 2 9 1 6 5 6 2 3 10 7 10 7 4 5 4 4 4 4 7 1 10 8 4 8 3 10 10 7 4 4 10 6 1 8 5 4 6 2 3 10 3 2 5 7 5 6 10 10 3 4 7 4 3 3 1 7 8 10 10 10 10 8 3 7 4 2 1 8 6 5 6 5 8 7 9 2 1 5 2 4 6 10 8\n6 9 7 8 7 1 4 3 5 8\n", "output": "2\n76 77 \n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour favorite shop sells n Kinder Surprise chocolate eggs. You know that exactly s stickers and exactly t toys are placed in n eggs in total.\n\nEach Kinder Surprise can be one of three types:\n\n * it can contain a sing... | [{"type": "stdin_stdout", "input": "4\n1 1 1\n1000000000 1000000000 1000000000\n1000000000 999999999 1\n1247516660 666666667 666666666\n", "output": "1\n1\n1000000000\n580849995\n"}, {"type": "stdin_stdout", "input": "4\n1 1 1\n1000000000 1000000000 1000000000\n1000000000 999999999 1\n999999999 666666667 666666666\n", ... | 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 teller, ... | [{"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\nByteburg Senate elections are coming. Usually \"United Byteland\", the ruling Byteland party, takes all the seats in the Senate to ensure stability and sustainable development. But this year there is one opposition candid... | [{"type": "stdin_stdout", "input": "11 14\n8 4 17 5 14 9 13 3 17 21 27\n5 16 1 4 24 14 8 32 29 19 17\n11 6 12 0 16 31 27 11 4 7 32\n2 9 2 31 30 12 21 11 29 29 26\n9 21 4 25 26 14 28 16 12 26 23\n31 22 30 5 6 29 31 11 20 18 29\n5 21 27 13 23 23 9 6 25 21 25\n8 16 29 5 26 14 2 15 3 15 22\n19 18 18 21 5 31 14 1 8 3 19\n16... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice has a cute cat. To keep her cat fit, Alice wants to design an exercising walk for her cat! \n\nInitially, Alice's cat is located in a cell (x,y) of an infinite grid. According to Alice's theory, cat needs to move: \... | [{"type": "stdin_stdout", "input": "6\n3 2 2 2\n0 0 -2 -2 2 2\n3 1 4 1\n0 0 -1 -1 1 1\n1 1 1 1\n1 1 1 1 1 1\n0 0 0 1\n0 0 0 0 0 1\n5 1 1 1\n0 0 -100 -100 0 100\n1 1 5 1\n0 0 -100 -100 100 0\n", "output": "Yes\nNo\nNo\nYes\nYes\nYes\n"}, {"type": "stdin_stdout", "input": "6\n3 2 2 2\n0 1 -2 -2 2 2\n3 1 4 1\n0 0 -1 -1 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n candies in a row, they are numbered from left to right from 1 to n. The size of the i-th candy is a_i.\n\nAlice and Bob play an interesting and tasty game: they eat candy. Alice will eat candy from left to rig... | [{"type": "stdin_stdout", "input": "7\n11\n3 1 4 1 5 9 1 4 10 3 5\n1\n1000\n3\n1 2 1\n13\n1 2 3 4 5 6 7 8 9 10 11 12 13\n2\n2 1\n6\n1 1 1 1 1 2\n7\n1 2 1 1 1 1 1\n", "output": "6 23 23\n1 1000 0\n2 1 3\n6 45 46\n2 2 1\n4 4 3\n4 4 4\n"}, {"type": "stdin_stdout", "input": "7\n11\n3 1 4 2 5 9 1 4 10 3 5\n1\n1000\n3\n1 2 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Omkar's last class of math, he learned about the least common multiple, or LCM. LCM(a, b) is the smallest positive integer x which is divisible by both a and b.\n\nOmkar, having a laudably curious mind, immediately tho... | [{"type": "stdin_stdout", "input": "10\n1000000000\n1000000000\n1000000000\n1000000000\n1000000000\n1000000000\n1000000000\n1000000000\n1000000000\n1000000000\n", "output": "500000000 500000000\n500000000 500000000\n500000000 500000000\n500000000 500000000\n500000000 500000000\n500000000 500000000\n500000000 500000000\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBoboniu gives you\n\n * r red balls, \n * g green balls, \n * b blue balls, \n * w white balls. \n\n\n\nHe allows you to do the following operation as many times as you want: \n\n * Pick a red ball, a green ball, and... | [{"type": "stdin_stdout", "input": "4\n0 1 1 1\n8 1 9 3\n0 0 0 0\n1000000000 1000000000 1000000000 1000000000\n", "output": "No\nYes\nYes\nYes\n"}, {"type": "stdin_stdout", "input": "4\n0 1 1 1\n8 1 9 5\n0 0 0 0\n1000000000 1000000000 1000000000 1000000000\n", "output": "NO\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp has a string s[1 ... n] of length n consisting of decimal digits. Polycarp performs the following operation with the string s no more than once (i.e. he can perform operation 0 or 1 time): \n\n * Polycarp select... | [{"type": "stdin_stdout", "input": "6\n8\n20192020\n8\n22019020\n4\n2020\n5\n20002\n6\n729040\n6\n200200\n", "output": "\nYES\nYES\nYES\nNO\nNO\nNO\n"}, {"type": "stdin_stdout", "input": "1\n8\n00202000\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1\n5\n20502\n", "output": "NO\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe brave Knight came to the King and asked permission to marry the princess. The King knew that the Knight was brave, but he also wanted to know if he was smart enough. So he asked him to solve the following task.\n\nThe... | [{"type": "stdin_stdout", "input": "15\n11 22 13 24 15 26 17 28 19 30 21 2 23 4 25 6 27 8 29 10 1 12 3 14 5 16 7 18 9 20\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "9\n16 5 18 7 2 9 4 11 6 13 8 15 10 17 12 1 14 3\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "4\n1 2 3 4 5 6 7 8\n", "output": "\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp came up with a new programming language. There are only two types of statements in it: \n\n * \"x := s\": assign the variable named x the value s (where s is a string). For example, the statement var := hello as... | [{"type": "stdin_stdout", "input": "4\n6\na := h\nb := aha\nc = a + b\nc = c + c\ne = c + c\nd = a + c\n15\nx := haha\nx = x + x\nx = x + x\nx = x + x\nx = x + x\nx = x + x\nx = x + x\nx = x + x\nx = x + x\nx = x + x\nx = x + x\nx = x + x\nx = x + x\nx = x + x\nx = x + x\n1\nhaha := hah\n5\nhaahh := aaaha\nahhhh = haah... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSome dwarves that are finishing the StUDY (State University for Dwarven Youngsters) Bachelor courses, have been told \"no genome, no degree\". That means that all dwarves should write a thesis on genome. Dwarven genome is... | [{"type": "stdin_stdout", "input": "aaaabcccca\naaaadccccb\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "aaaabcccca\naaaadccdcb\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "accccbaaaa\naaaadccdcb\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "rtfabanpc\natfabrnpc\n", "output": "YES\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJohn Doe has an n × m table. John Doe can paint points in some table cells, not more than one point in one table cell. John Doe wants to use such operations to make each square subtable of size n × n have exactly k points... | [{"type": "stdin_stdout", "input": "100 1000000000000000000 10000\n", "output": " 1\n"}, {"type": "stdin_stdout", "input": "1 1000000000000000000 0\n", "output": " 1\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Little Elephant has an integer a, written in the binary notation. He wants to write this number on a piece of paper.\n\nTo make sure that the number a fits on the piece of paper, the Little Elephant ought to delete ex... | [{"type": "stdin_stdout", "input": "11100010010010000110101101101100111111001010001101101001001111010110010111001011010000001100110101000101111000001111101111110010000010101110011110101101010110001100011101111011100010011101100111110010111111100110101000000111101000000000110100100101111101000110101010101101001110001110... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCapitalization is writing a word with its first letter as a capital letter. Your task is to capitalize the given word.\n\nNote, that during capitalization all the letters except the first one remains unchanged.\n\nInput\n... | [{"type": "stdin_stdout", "input": "lZqBqKeGvNdSeYuWxRiVnFtYbKuJwQtUcKnVtQhAlOeUzMaAuTaEnDdPfDcNyHgEoBmYjZyFePeJrRiKyAzFnBfAuGiUyLrIeLrNhBeBdVcEeKgCcBrQzDsPwGcNnZvTsEaYmFfMeOmMdNuZbUtDoQoNcGwDqEkEjIdQaPwAxJbXeNxOgKgXoEbZiIsVkRrNpNyAkLeHkNfEpLuQvEcMbIoGaDzXbEtNsLgGfOkZaFiUsOvEjVeCaMcZqMzKeAdXxJsVeCrZaFpJtZxInQxFaSmGgSsV... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently a serious bug has been found in the FOS code. The head of the F company wants to find the culprit and punish him. For that, he set up an organizational meeting, the issue is: who's bugged the code? Each of the n ... | [{"type": "stdin_stdout", "input": "10 2\n10 2\n9 3\n9 4\n7 2\n4 6\n10 1\n9 2\n3 10\n7 1\n5 1\n", "output": "43\n"}, {"type": "stdin_stdout", "input": "10 3\n6 3\n6 10\n2 5\n5 7\n6 2\n9 2\n8 1\n10 5\n5 10\n7 6\n", "output": "34\n"}, {"type": "stdin_stdout", "input": "10 4\n10 2\n9 3\n9 4\n7 2\n4 6\n10 1\n9 2\n3 10\n7 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDZY has a hash table with p buckets, numbered from 0 to p - 1. He wants to insert n numbers, in the order they are given, into the hash table. For the i-th number xi, DZY will put it into the bucket numbered h(xi), where ... | [{"type": "stdin_stdout", "input": "101 15\n139988797\n524419455\n1205904463\n153341038\n146759898\n171753194\n163710849\n42060733\n1382862835\n979451110\n1200809750\n37821717\n446728232\n850870259\n221398500\n", "output": "12\n"}, {"type": "stdin_stdout", "input": "101 15\n139988797\n524419455\n1205904463\n153341038\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle X and Little Z are good friends. They always chat online. But both of them have schedules.\n\nLittle Z has fixed schedule. He always online at any moment of time between a1 and b1, between a2 and b2, ..., between a... | [{"type": "stdin_stdout", "input": "13 42 292 733\n304 308\n362 365\n396 397\n686 688\n719 722\n815 816\n901 902\n904 905\n921 924\n929 933\n953 954\n977 980\n982 985\n28 30\n36 37\n108 112\n123 127\n134 135\n151 153\n160 162\n203 205\n208 212\n240 243\n261 264\n271 274\n294 297\n356 358\n383 385\n408 412\n415 418\n435... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHiking club \"Up the hill\" just returned from a walk. Now they are trying to remember which hills they've just walked through.\n\nIt is known that there were N stops, all on different integer heights between 1 and N kilo... | [{"type": "stdin_stdout", "input": "700\n399\n", "output": "400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Johnny has recently learned about set theory. Now he is studying binary relations. You've probably heard the term \"equivalence relation\". These relations are very important in many areas of mathematics. For examp... | [{"type": "stdin_stdout", "input": "4000\n", "output": "341934157\n"}, {"type": "stdin_stdout", "input": "3000\n", "output": "949793998\n"}, {"type": "stdin_stdout", "input": "3555\n", "output": "810675957\n"}, {"type": "stdin_stdout", "input": "2999\n", "output": "634360769\n"}, {"type": "stdin_stdout", "input": "3789... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA team of furry rescue rangers was sitting idle in their hollow tree when suddenly they received a signal of distress. In a few moments they were ready, and the dirigible of the rescue chipmunks hit the road.\n\nWe assume... | [{"type": "stdin_stdout", "input": "-10000 10000 10000 -10000\n1000 100\n-890 455\n-891 454\n", "output": "17904214.8944449873\n"}, {"type": "stdin_stdout", "input": "-10000 -10000 10000 10000\n1000 1000\n-454 -891\n-454 -891\n", "output": "17933348.203209"}, {"type": "stdin_stdout", "input": "-10000 -6484 10000 10000\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given the string s of length n and the numbers p, q. Split the string s to pieces of length p and q.\n\nFor example, the string \"Hello\" for p = 2, q = 3 can be split to the two strings \"Hel\" and \"lo\" or to t... | [{"type": "stdin_stdout", "input": "100 1 1\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\n", "output": "100\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\nb\nb... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGrandma Laura came to the market to sell some apples. During the day she sold all the apples she had. But grandma is old, so she forgot how many apples she had brought to the market.\n\nShe precisely remembers she had n b... | [{"type": "stdin_stdout", "input": "40 562\nhalfplus\nhalfplus\nhalfplus\nhalfplus\nhalfplus\nhalfplus\nhalfplus\nhalfplus\nhalf\nhalf\nhalf\nhalfplus\nhalf\nhalf\nhalfplus\nhalf\nhalfplus\nhalf\nhalfplus\nhalf\nhalfplus\nhalf\nhalfplus\nhalfplus\nhalfplus\nhalfplus\nhalfplus\nhalf\nhalf\nhalfplus\nhalf\nhalfplus\nhalf... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given n points on a plane. All the points are distinct and no three of them lie on the same line. Find the number of parallelograms with the vertices at the given points.\n\nInput\n\nThe first line of the input co... | [{"type": "stdin_stdout", "input": "20\n0 17\n1 8\n1 9\n2 5\n2 11\n3 0\n5 10\n5 13\n6 7\n7 3\n12 13\n13 7\n14 16\n15 10\n15 18\n17 2\n17 12\n18 14\n19 18\n20 17\n", "output": "18\n"}, {"type": "stdin_stdout", "input": "20\n0 17\n1 8\n1 9\n2 5\n2 20\n3 0\n5 10\n5 13\n6 7\n7 3\n12 13\n13 7\n14 16\n15 10\n15 18\n17 2\n17 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMasha wants to open her own bakery and bake muffins in one of the n cities numbered from 1 to n. There are m bidirectional roads, each of whose connects some pair of cities.\n\nTo bake muffins in her bakery, Masha needs t... | [{"type": "stdin_stdout", "input": "8 57 3\n1 3 15\n2 3 1\n1 7 21\n1 2 11\n2 1 16\n1 6 4\n1 3 2\n3 7 17\n5 8 3\n1 3 18\n1 4 3\n1 2 1\n2 8 14\n1 4 17\n4 5 21\n2 3 6\n3 5 11\n2 8 11\n3 4 1\n1 3 9\n1 4 3\n2 3 12\n1 5 9\n2 3 15\n1 2 14\n1 2 10\n1 4 19\n5 7 7\n5 8 20\n5 8 1\n1 4 3\n4 5 8\n5 7 1\n1 2 14\n4 5 9\n6 7 2\n2 6 9\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a square box 6 × 6 in size. It contains 36 chips 1 × 1 in size. Those chips contain 36 different characters — \"0\"-\"9\" and \"A\"-\"Z\". There is exactly one chip with each character.\n\nYou are allowed to make... | [{"type": "stdin_stdout", "input": "RSTYWU\nLMNXQO\nFGHVKI\nEABP9C\n345J86\nZD7210\n", "output": "2782\nR6\nU5\nR6\nD5\nR6\nU5\nR6\nD5\nR6\nU5\nR6\nR6\nD5\nR6\nU4\nR6\nD4\nR6\nU4\nR6\nD4\nR6\nU4\nR6\nR6\nD4\nR6\nU3\nR6\nD3\nR6\nU3\nR6\nD3\nR6\nU3\nR6\nR6\nD3\nR6\nU2\nR6\nD2\nR6\nU2\nR6\nD2\nR6\nU2\nR6\nR6\nD2\nR6\nU1\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVova again tries to play some computer card game.\n\nThe rules of deck creation in this game are simple. Vova is given an existing deck of n cards and a magic number k. The order of the cards in the deck is fixed. Each ca... | [{"type": "stdin_stdout", "input": "100 72\n8 8 7 9 6 1 4 5 3 7 5 10 5 4 1 3 4 1 3 1 6 6 4 5 4 5 6 1 10 7 9 1 6 10 6 6 9 3 3 4 5 9 4 9 8 1 5 9 3 7 1 8 5 2 1 1 7 7 7 6 6 4 2 9 10 2 8 3 1 1 4 8 5 9 7 10 9 4 2 3 7 7 6 7 8 5 1 3 8 5 1 8 9 10 3 7 1 8 10 5\n", "output": "4549\n"}, {"type": "stdin_stdout", "input": "100 72\n8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCalculate the minimum number of characters you need to change in the string s, so that it contains at least k different letters, or print that it is impossible.\n\nString s consists only of lowercase Latin letters, and it... | [{"type": "stdin_stdout", "input": "smaxpqplaqqbxuqxalqmbmmgubbpspxhawbxsuqhhegpmmpebqmqpbbeplwaepxmsahuepuhuhwxeqmmlgqubuaxehwuwasgxpqmugbmuawuhwqlswllssueglbxepbmwgs\n1\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "smaxpqplaqqbxuqxalqmbmmgubbpspxhawbxsuqhhegpmmpebqmqpbbeplwaepxmsahuepuhuhwxeqmmlgqubuaxehwu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIvan has an array consisting of n elements. Each of the elements is an integer from 1 to n.\n\nRecently Ivan learned about permutations and their lexicographical order. Now he wants to change (replace) minimum number of e... | [{"type": "stdin_stdout", "input": "50\n48 37 47 50 46 43 42 46 36 40 45 41 40 50 35 49 37 42 44 45 49 44 31 47 45 49 48 41 45 45 48 20 34 43 43 41 47 50 41 48 38 48 43 48 46 48 32 37 47 45\n", "output": "31\n1 2 3 4 5 6 7 8 36 9 10 11 40 12 35 13 14 42 15 16 17 44 31 18 19 49 21 22 23 24 25 20 34 26 27 28 29 50 41 30 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya the programmer lives in the middle of the Programming subway branch. He has two girlfriends: Dasha and Masha, who live at the different ends of the branch, each one is unaware of the other one's existence.\n\nWhen V... | [{"type": "stdin_stdout", "input": "999999 1000000\n", "output": "Equal\n"}, {"type": "stdin_stdout", "input": "1000000 999993\n", "output": "Masha\n"}, {"type": "stdin_stdout", "input": "999997 1000000\n", "output": "Dasha\n"}, {"type": "stdin_stdout", "input": "459973 1000000\n", "output": "Dasha\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe following problem is well-known: given integers n and m, calculate\n\n<image>, \n\nwhere 2n = 2·2·...·2 (n factors), and <image> denotes the remainder of division of x by y.\n\nYou are asked to solve the \"reverse\" p... | [{"type": "stdin_stdout", "input": "100000000\n100000000\n", "output": "100000000\n"}, {"type": "stdin_stdout", "input": "100000000\n100001000\n", "output": "100001000\n"}, {"type": "stdin_stdout", "input": "100000000\n110001000\n", "output": "110001000\n"}, {"type": "stdin_stdout", "input": "99999999\n100000000\n", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFafa owns a company that works on huge projects. There are n employees in Fafa's company. Whenever the company has a new project to start working on, Fafa has to divide the tasks of this project among all the employees.\n... | [{"type": "stdin_stdout", "input": "127925\n", "output": "23\n"}, {"type": "stdin_stdout", "input": "83160\n", "output": "127"}, {"type": "stdin_stdout", "input": "100000\n", "output": "35"}, {"type": "stdin_stdout", "input": "110309\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "19764\n", "output": "29\n"}, ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAkshara is a Maths teacher at Dynamic Public School.One day she decided to take an unusual test of all her students.She took all her students to a fair.There she took them to a candy room.The room had 2 doors and behind e... | [{"type": "stdin_stdout", "input": "20\n3 2\n2 4 2\n100 4653\n96 86 92 95 97 88 99 89 98 97 96 87 91 90 89 91 95 94 98 86 93 85 99 96 85 90 99 98 100 96 90 99 87 89 85 96 89 96 88 89 98 96 95 86 85 92 94 94 87 89 97 96 93 85 156 99 97 93 94 99 97 86 91 91 90 98 96 92 137 92 91 99 90 91 100 93 99 91 92 92 104 88 98 90 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \\leq i \\leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white.\n\nYou can d... | [{"type": "stdin_stdout", "input": "8\nRRWRWWRW", "output": "1\n"}, {"type": "stdin_stdout", "input": "8\nRRWWWRRW", "output": "2\n"}, {"type": "stdin_stdout", "input": "8\nWRWWWRRR", "output": "3\n"}, {"type": "stdin_stdout", "input": "8\nWWWWRRRR", "output": "4\n"}, {"type": "stdin_stdout", "input": "8\nRRWRVWRW", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and b_i. For each k=1, ..., N, solve the problem below:\n\n* Consider writing a number on each vertex in the tree in the follo... | [{"type": "stdin_stdout", "input": "8\n1 3\n2 3\n3 4\n3 5\n3 6\n6 7\n6 8", "output": "240\n240\n1680\n240\n240\n1008\n144\n144\n"}, {"type": "stdin_stdout", "input": "8\n1 3\n2 3\n5 4\n3 5\n3 6\n3 7\n3 8", "output": "360\n360\n2520\n120\n840\n360\n360\n360\n"}, {"type": "stdin_stdout", "input": "8\n1 2\n2 3\n2 4\n3 5\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven are a positive integer N and a string S of length N consisting of lowercase English letters.\n\nDetermine whether the string is a concatenation of two copies of some string. That is, determine whether there is a str... | [{"type": "stdin_stdout", "input": "6\ncbacba", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "6\nabcabc", "output": "Yes"}, {"type": "stdin_stdout", "input": "6\nacbadc", "output": "No\n"}, {"type": "stdin_stdout", "input": "6\nabcaac", "output": "No\n"}, {"type": "stdin_stdout", "input": "6\ncdabca", "output"... | 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.\n\nYou can use the following theorem:\n\nTheorem: an N-sided polygon satisfying the... | [{"type": "stdin_stdout", "input": "10\n1 0 10 10 16 12 34 110 11 3", "output": "No\n"}, {"type": "stdin_stdout", "input": "10\n1 0 10 10 16 22 34 110 11 3", "output": "No\n"}, {"type": "stdin_stdout", "input": "10\n1 0 10 10 16 17 34 110 11 3", "output": "No\n"}, {"type": "stdin_stdout", "input": "10\n1 0 10 10 8 12 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe number 105 is quite special - it is odd but still it has eight divisors. Now, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?\n\nConstraints\n\n* N i... | [{"type": "stdin_stdout", "input": "-108", "output": "0\n"}, {"type": "stdin_stdout", "input": "-153", "output": "0\n"}, {"type": "stdin_stdout", "input": "122", "output": "1\n"}, {"type": "stdin_stdout", "input": "138", "output": "2\n"}, {"type": "stdin_stdout", "input": "197", "output": "5\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInput Format\n\n\nN K\na_1 a_2 a_3 ... a_N\n\n\nOutput Format\n\nPrint the minimum cost in one line. In the end put a line break.\n\n\nConstraints\n\n* 1 ≤ K ≤ N ≤ 15\n* 1 ≤ a_i ≤ 10^9\n\n\n\nScoring\n\nSubtask 1 [120 poi... | [{"type": "stdin_stdout", "input": "5 5\n11683 3774 3598 4173 3424", "output": "31773\n"}, {"type": "stdin_stdout", "input": "5 4\n11683 3774 3598 4173 3424", "output": "23510\n"}, {"type": "stdin_stdout", "input": "5 5\n3949 3208 13644 3469 3424", "output": "21140\n"}, {"type": "stdin_stdout", "input": "5 5\n4931 3208... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPrime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs.\n\nIn thi... | [{"type": "stdin_stdout", "input": "12\n110\n200\n300\n0", "output": "5 7\n107 109\n197 199\n281 283\n"}, {"type": "stdin_stdout", "input": "12\n110\n200\n227\n0", "output": "5 7\n107 109\n197 199\n197 199\n"}, {"type": "stdin_stdout", "input": "12\n110\n200\n329\n0", "output": "5 7\n107 109\n197 199\n311 313\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nShe was worried. The grades are not good. Although she forced her parents to enroll in a dormitory school, her talent never blossomed. Or maybe he didn't have the talent in the first place, but it was possible that he did... | [{"type": "stdin_stdout", "input": "(B&B&f)|(~d&~i&i)|(~v&i&~V)|(&g&~e&o)|(~f&d&~v)|(d&~i&o)|(g&i&~B)|(~i&f&d)|(e&~i~~V)|(~v&f&~d)\n(S&X&~W)\n#", "output": "yes\nyes\n"}, {"type": "stdin_stdout", "input": "(B&B&f)|(~d&~i&i)|(~v&i&~V)|(&g&~e&o)|(~f&d&~v)|(d&~i&o)|(g&i&~B)|(~i&f&d)|(e&~i~~V)|(~v&f&~d)\n(T&X&~W)\n#", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n3 3 1 2 4\n1 2\n2 3\n3 1\n\n\nOutput\n\nIMPOSSIBLE\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... | [{"type": "stdin_stdout", "input": "4 1 2 1 2\n1 2\n2 3\n11 0", "output": "IMPOSSIBLE\n"}, {"type": "stdin_stdout", "input": "8 1 2 1 2\n1 2\n2 3\n11 0", "output": "IMPOSSIBLE\n"}, {"type": "stdin_stdout", "input": "3 3 2 2 4\n1 2\n2 3\n3 1", "output": "IMPOSSIBLE\n"}, {"type": "stdin_stdout", "input": "3 3 2 1 4\n1 2\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a frog living in a big pond. He loves jumping between lotus leaves floating on the pond. Interestingly, these leaves have strange habits. First, a leaf will sink into the water after the frog jumps from it. Secon... | [{"type": "stdin_stdout", "input": "10 10\n.o....o...\no.oo......\n..oo..oo..\n..o.......\n..oo..oo..\n.o.o...o..\no..U.o....\noo......oo\noo........\noo..oo....", "output": "RDLLLURUUURDDLLUURRDDLULLDDRR\n"}, {"type": "stdin_stdout", "input": "10 10\n.o....o...\no.oo......\n..oo..oo..\n..o.......\n..oo..oo..\n..o...o.... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn 21XX, an annual programming contest, Japan Algorithmist GrandPrix (JAG) has become one of the most popular mind sports events.\n\nJAG is conducted as a knockout tournament. This year, $N$ contestants will compete in JA... | [{"type": "stdin_stdout", "input": "[[r-i]-[m-e]]\nd -1\no 0\ng -1\nl 6", "output": "No\n"}, {"type": "stdin_stdout", "input": "[[m-y]-[a-o]]\nn 0\na 1\ny 2\nm 0", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "[[r-i]-[m-e]]\nd -1\nr 1\ng 1\nm 3", "output": "No\n"}, {"type": "stdin_stdout", "input": "[[r-i]-[m-... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads an integer $S$ [second] and converts it to $h:m:s$ where $h$, $m$, $s$ denote hours, minutes (less than 60) and seconds (less than 60) respectively.\n\nConstraints\n\n* $0 \\leq S \\leq 86400$\... | [{"type": "stdin_stdout", "input": "71983", "output": "19:59:43\n"}, {"type": "stdin_stdout", "input": "-1025", "output": "-1:42:55\n"}, {"type": "stdin_stdout", "input": "-144", "output": "-1:57:36\n"}, {"type": "stdin_stdout", "input": "-274", "output": "-1:55:26\n"}, {"type": "stdin_stdout", "input": "-399", "output... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDon't you tell me what you think that I can be\n\nIf you say that Arkady is a bit old-fashioned playing checkers, you won't be right. There is also a modern computer game Arkady and his friends are keen on. We won't discu... | [{"type": "stdin_stdout", "input": "20 10\n750 560 811 641 215 299 882 721 925 524 553 644 974 942 120 823 229 249 594 60 375 696 441 153 303 944 360 372 540 25 192 310 422 606 172 605 4 795 740 663\n39 30\n15 8\n6 38\n14 35\n27 7\n13 28\n21 12\n20 3\n23 22\n16 32\n1\n13 14 7 13 3 38 39 8 22 12 23 21 28 27 32 6 35 15 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is an interactive problem\n\nYou are given a grid n× n, where n is odd. Rows are enumerated from 1 to n from up to down, columns are enumerated from 1 to n from left to right. Cell, standing on the intersection of ro... | [{"type": "stdin_stdout", "input": "15\n111000110100010\n110101010100100\n001001011000100\n111011111001011\n011101111010100\n011011000011100\n010011100000010\n100101111100011\n001101111111100\n000101101101111\n100001101110000\n010101110110101\n110110011011011\n100010110110110\n111011101010000\n", "output": "? 1 1 1 3\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is an easier version of the problem. In this version, n ≤ 500.\n\nVasya is an experienced developer of programming competitions' problems. As all great minds at some time, Vasya faced a creative crisis. To improve th... | [{"type": "stdin_stdout", "input": "500\n)))(()(()())))))())()))(((()(()())(((()())(((()(((((())))))))))())())))()(((()))(((()())()()))))))()()()()()()()()()()()()()()()()()()()()()()()())(()()()()()()()()()()()()()()()()()(()(()(()))(((((()))(()())))((())((((((()(((((())))(()))())(())(()()(())())())(())()))(((()())(((... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers n and m. Calculate the number of pairs of arrays (a, b) such that:\n\n * the length of both arrays is equal to m; \n * each element of each array is an integer between 1 and n (inclusive); \n ... | [{"type": "stdin_stdout", "input": "1000 10\n", "output": "414070642\n"}, {"type": "stdin_stdout", "input": "1000 2\n", "output": "917124963\n"}, {"type": "stdin_stdout", "input": "379 10\n", "output": "181813681\n"}, {"type": "stdin_stdout", "input": "723 9\n", "output": "157557417\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n\n\nInput\n\nThe input consists of a single string of uppercase letters A-Z. The length of the string is between 1 and 10 characters, inclusive.\n\nOutput\n\nOutput \"YES\" or \"NO\".\n\nExamples\n\nInput\n\n\nGENIUS\n\n\... | [{"type": "stdin_stdout", "input": "UBSCRAMNLE\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "ALAKLINITY\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "SOLUSIONS\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "SM@RTPHONE\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "UBSCRBMN... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is the hard version of the problem. The difference between versions is the constraints on n and a_i. You can make hacks only if all versions of the problem are solved.\n\nFirst, Aoi came up with the following idea fo... | [{"type": "stdin_stdout", "input": "87 83\n40 6 7 50 16 65 47 90 94 65 79 29 41 76 80 13 87 37 92 71 54 53 93 79 14 53 71 78 50 50 74 40 30 92 66 86 94 60 37 65 82 14 61 48 68 71 91 99 74 88 89 34 57 74 25 2 79 72 92 37 61 16 32 85 29 74 6 69 50 74 76 48 31 42 40 95 29 27 28 31 38 60 52 45 14 78 59\n", "output": "75\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEveryone knows that agents in Valorant decide, who will play as attackers, and who will play as defenders. To do that Raze and Breach decided to play t matches of a digit game...\n\nIn each of t matches of the digit game,... | [{"type": "stdin_stdout", "input": "1\n33\n200000000000000000000000000000022\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "1\n33\n108463091323247016906011241806730\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1\n12\n200000000000000000000000000000022\n", "output": "2\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou got a job as a marketer in a pet shop, and your current task is to boost sales of cat food. One of the strategies is to sell cans of food in packs with discounts. \n\nSuppose you decided to sell packs with a cans in a... | [{"type": "stdin_stdout", "input": "10\n335544320 671088640\n335544322 671088639\n335544321 671088639\n335544325 671088637\n335544319 671088640\n335544319 671088641\n335544319 671088639\n335544318 671088639\n352759476 671088637\n335544319 671088643\n", "output": "NO\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nYES\nNO\n"}, {"type":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn recent years John has very successfully settled at his new job at the office. But John doesn't like to idly sit around while his code is compiling, so he immediately found himself an interesting distraction. The point ... | [{"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000 1000000 1000000000000000000\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000 1000010000000000000 1000000000000000000 1000000 1000000000000000000\n", "outpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp has n friends, the i-th of his friends has a_i candies. Polycarp's friends do not like when they have different numbers of candies. In other words they want all a_i to be the same. To solve this, Polycarp perform... | [{"type": "stdin_stdout", "input": "1\n52\n0 1 1 1 1 -1 0 1 2 1 2 1 1 1 1 1 1 1 0 1 3 0 2 0 1 0 1 4 -1 2 1 1 -1 3 2 1 1 2 0 -1 2 1 2 0 1 2 2 1 1 1 1 0\n", "output": "13\n"}, {"type": "stdin_stdout", "input": "1\n52\n0 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 1 0 1 2 -1 2 0 0 -1 3 2 1 1 1 0 1 2 1 2 0 1 2 2 1 1 1 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Smart Beaver from ABBYY came up with another splendid problem for the ABBYY Cup participants! This time the Beaver invites the contest participants to check out a problem on sorting documents by their subjects. Let's ... | [{"type": "stdin_stdout", "input": "2000\nJAPAN FEBRUARY MONEY SUPPLY RISES 8.8 PCT\nTOKYO, March 17 - Japan's broadly defined money supply\naverage of M-2 plus certificate of deposits (CDs) rose a\npreliminary 8.8 pct in February from a year earlier, compared\nwith an 8.6 pct rise ni January, the Bank of Japan said.\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day Vasya was going home when he saw a box lying on the road. The box can be represented as a rectangular parallelepiped. Vasya needed no time to realize that the box is special, as all its edges are parallel to the c... | [{"type": "stdin_stdout", "input": "-827584 -680412 -103147\n897186 313672 388429\n892050 717946 505625 200144 311983 606037\n", "output": "1709658\n"}, {"type": "stdin_stdout", "input": "-827584 -680412 -103147\n897186 313672 388429\n892050 717946 505625 278931 311983 606037\n", "output": "1709658\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMomiji has got a rooted tree, consisting of n nodes. The tree nodes are numbered by integers from 1 to n. The root has number 1. Momiji decided to play a game on this tree.\n\nThe game consists of several steps. On each s... | [{"type": "stdin_stdout", "input": "10\n1 2\n2 3\n3 4\n1 5\n2 6\n6 7\n7 8\n6 9\n9 10\n", "output": "3.8166666666666664\n"}, {"type": "stdin_stdout", "input": "10\n1 2\n2 3\n3 4\n1 5\n2 6\n8 7\n4 8\n6 9\n9 10\n", "output": "3.7333333333333334\n"}, {"type": "stdin_stdout", "input": "10\n1 2\n2 3\n3 4\n1 5\n3 6\n6 7\n7 8\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a rectangle grid. That grid's size is n × m. Let's denote the coordinate system on the grid. So, each point on the grid will have coordinates — a pair of integers (x, y) (0 ≤ x ≤ n, 0 ≤ y ≤ m).\n\nYour task ... | [{"type": "stdin_stdout", "input": "1000000000 1000000000 500000000 500000000 500000000 500000001\n", "output": "250000000 249999999 750000000 750000000\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000 286536427 579261823 230782719 575570138\n", "output": "171145067 291476754 401927786 867046892\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's assume that \n\n * v(n) is the largest prime number, that does not exceed n;\n * u(n) is the smallest prime number strictly greater than n. \n\n\n\nFind <image>.\n\nInput\n\nThe first line contains integer t (1 ≤ ... | [{"type": "stdin_stdout", "input": "6\n999\n1095\n821\n635\n63\n480\n", "output": "1003961/2011946\n1196833/2398042\n674039/1351366\n403199/808942\n3959/8174\n232303/466546\n"}, {"type": "stdin_stdout", "input": "6\n999\n588\n821\n635\n63\n480\n", "output": "1003961/2011946\n346909/696182\n674039/1351366\n403199/808942... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDuring a recent research Berland scientists found out that there were n cities in Ancient Berland, joined by two-way paths. Any two cities are joined by no more than one path. No path joins a city with itself. According t... | [{"type": "stdin_stdout", "input": "183\n", "output": "8372\n1 92\n1 93\n1 94\n1 95\n1 96\n1 97\n1 98\n1 99\n1 100\n1 101\n1 102\n1 103\n1 104\n1 105\n1 106\n1 107\n1 108\n1 109\n1 110\n1 111\n1 112\n1 113\n1 114\n1 115\n1 116\n1 117\n1 118\n1 119\n1 120\n1 121\n1 122\n1 123\n1 124\n1 125\n1 126\n1 127\n1 128\n1 129\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarpus likes giving presents to Paraskevi. He has bought two chocolate bars, each of them has the shape of a segmented rectangle. The first bar is a1 × b1 segments large and the second one is a2 × b2 segments large.\n... | [{"type": "stdin_stdout", "input": "7 1\n1 7\n", "output": " 0\n 7 1\n ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn army of n droids is lined up in one row. Each droid is described by m integers a1, a2, ..., am, where ai is the number of details of the i-th type in this droid's mechanism. R2-D2 wants to destroy the sequence of conse... | [{"type": "stdin_stdout", "input": "49 2 1971\n794 866\n401 575\n341 83\n103 208\n352 134\n260 878\n497 931\n630 570\n885 464\n23 663\n60 1461\n416 870\n955 405\n392 961\n530 258\n73 404\n736 923\n44 436\n594 314\n904 138\n980 163\n76 720\n879 809\n81 838\n263 599\n218 139\n659 493\n1044 754\n679 302\n490 7\n204 530\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is an infinite sequence consisting of all positive integers in the increasing order: p = {1, 2, 3, ...}. We performed n swap operations with this sequence. A swap(a, b) is an operation of swapping the elements of th... | [{"type": "stdin_stdout", "input": "30\n1 200000\n2 199999\n3 199998\n4 199997\n5 199996\n200001 399996\n200002 399997\n200003 399998\n200004 399999\n200005 400000\n400001 599998\n400002 599999\n400003 600000\n400004 599996\n400005 599995\n600001 800000\n600002 362647\n600003 799998\n600004 799997\n600005 799996\n60000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Lesha loves listening to music via his smartphone. But the smartphone doesn't have much memory, so Lesha listens to his favorite songs in a well-known social network InTalk.\n\nUnfortunately, internet is not that f... | [{"type": "stdin_stdout", "input": "100000 1 10000\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "100000 99999 3\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "100000 99999 2\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "100000 99999 4\n", "output": "1\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBerOilGasDiamondBank has branches in n cities, at that n is an even number. The bank management wants to publish a calendar with the names of all those cities written in two columns: the calendar should consist of exactly... | [{"type": "stdin_stdout", "input": "58\nesgdfmf\nxfkluadj\nqhvh\njwhuyhm\nmgi\nysgc\nvhhenku\npb\ntr\nu\njyrpjnpd\nkluadjo\nopb\ncopb\ngcyhceo\nr\ndjo\nxfklu\neo\nadjo\nfkluadjo\nybe\nwljwh\nqhvhh\nrhgotp\nyhceo\nuyhm\nvdd\nyhm\nysgcyhc\nvddrhg\nril\nwljwhu\nx\nqh\nhceo\ntfcopb\nmgitfc\nvddrh\nmgitfco\nxf\nmgitf\ncyoyb... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEach month Blake gets the report containing main economic indicators of the company \"Blake Technologies\". There are n commodities produced by the company. For each of them there is exactly one integer in the final repor... | [{"type": "stdin_stdout", "input": "100 30\n65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 74 57 115 16 55 102 79 97 21 80 41 56 49 103 61 66 1 36 44 43 82 37 38 106 27 114 51 112 55 87 41 69 31 86 58 27 46 99 18 105 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAuthor has gone out of the stories about Vasiliy, so here is just a formal task description.\n\nYou are given q queries and a multiset A, initially containing only integer 0. There are three types of queries:\n\n 1. \"+ ... | [{"type": "stdin_stdout", "input": "7\n? 1\n+ 941492387\n+ 72235422\n+ 449924898\n+ 783332532\n- 941492387\n- 72235422\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "14\n+ 4\n+ 4\n+ 4\n+ 4\n? 3\n- 4\n- 4\n- 4\n? 3\n+ 5\n? 3\n- 4\n+ 4\n? 3\n", "output": "7\n7\n7\n7\n"}, {"type": "stdin_stdout", "input": "14\n+... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA stowaway and a controller play the following game. \n\nThe train is represented by n wagons which are numbered with positive integers from 1 to n from the head to the tail. The stowaway and the controller are initially ... | [{"type": "stdin_stdout", "input": "50 42 13\nto head\n00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001\n", "output": "Controller 61\n"}, {"type": "stdin_stdout", "inpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are an experienced Codeforces user. Today you found out that during your activity on Codeforces you have made y submissions, out of which x have been successful. Thus, your current success rate on Codeforces is equal ... | [{"type": "stdin_stdout", "input": "5\n99999997 999999998 999999998 999999999\n99999996 999999997 999999997 999999999\n99999997 999999998 999999998 999999999\n99999996 999999997 999999997 999999999\n99999997 999999998 999999998 999999999\n", "output": "899999999100000001\n449999999550000002\n899999999100000001\n4499999... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.