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\nUh oh! Applications to tech companies are due soon, and you've been procrastinating by doing contests instead! (Let's pretend for now that it is actually possible to get a job in these uncertain times.)\n\nYou have comple... | [{"type": "stdin_stdout", "input": "100 89826\n1076 402 6 202 1196 687 966 243 1715 847 608 1446 1901 106 1622 222 864 204 1700 1001 1834 726 1158 1497 1928 1787 254 275 1788 1972 687 611 1983 1085 1876 311 1979 1845 1706 1360 528 1842 1041 1636 1276 443 895 158 725 1884 13 1916 326 406 216 1040 677 366 785 1424 596 45... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe store sells n beads. The color of each bead is described by a lowercase letter of the English alphabet (\"a\"–\"z\"). You want to buy some beads to assemble a necklace from them.\n\nA necklace is a set of beads connec... | [{"type": "stdin_stdout", "input": "1\n364 1485\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccddddddddddddddddddddddddddeeeeeeeeeeeeeeeeeeeeeeefffffffffffffffffffffffffffgggggggggggggggggggggggggggggggggggggggghhhhhhh... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a secret array. You don't know this array and you have to restore it. However, you know some facts about this array:\n\n * The array consists of n distinct positive (greater than 0) integers. \n * The array cont... | [{"type": "stdin_stdout", "input": "5\n4 1 5\n6 27 50\n32 20 62\n8 2 11\n9 1 23\n", "output": "1 3 5 7 \n4 27 50 73 96 119 \n2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 \n2 5 8 11 14 17 20 23 \n1 12 23 34 45 56 67 78 89 \n"}, {"type": "stdin_stdout", "input": "5\n6 1 5\n6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGildong has a square board consisting of n rows and n columns of square cells, each consisting of a single digit (from 0 to 9). The cell at the j-th column of the i-th row can be represented as (i, j), and the length of t... | [{"type": "stdin_stdout", "input": "5\n3\n000\n122\n001\n2\n57\n75\n4\n0123\n4012\n3401\n2340\n1\n9\n8\n42987101\n98289412\n38949562\n87599023\n92834718\n83917348\n19823743\n38947912\n", "output": "\n4 4 1 0 0 0 0 0 0 0\n0 0 0 0 0 1 0 1 0 0\n9 6 9 9 6 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n18 49 49 49 49 15 0 30 42 42\n"}, {"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nn distinct integers x_1,x_2,…,x_n are written on the board. Nezzar can perform the following operation multiple times.\n\n * Select two integers x,y (not necessarily distinct) on the board, and write down 2x-y. Note that... | [{"type": "stdin_stdout", "input": "6\n2 1\n1 2\n3 0\n2 3 11\n2 -1\n40263371 27182818\n2 1000000000000000000\n1 1000000000000000000\n2 -1612195815535461144\n-1000000000000000000 123\n6 141\n-5 -20 15 -14 -2 -11\n", "output": "YES\nYES\nNO\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "6\n2 1\n1 2\n3 0\n2 3 11\n2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a grid with n rows and m columns. Every cell of the grid should be colored either blue or yellow.\n\nA coloring of the grid is called stupid if every row has exactly one segment of blue cells and every column has... | [{"type": "stdin_stdout", "input": "2020 2021\n", "output": "\n50657649\n"}, {"type": "stdin_stdout", "input": "1848 1937\n", "output": "337952422\n"}, {"type": "stdin_stdout", "input": "2000 2000\n", "output": "111024599\n"}, {"type": "stdin_stdout", "input": "2021 2021\n", "output": "138387540\n"}, {"type": "stdin_st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe weight of a sequence is defined as the number of unordered pairs of indexes (i,j) (here i < j) with same value (a_{i} = a_{j}). For example, the weight of sequence a = [1, 1, 2, 2, 1] is 4. The set of unordered pairs ... | [{"type": "stdin_stdout", "input": "2\n4\n1 2 1 1\n4\n1 2 3 4\n", "output": "\n6\n0\n"}, {"type": "stdin_stdout", "input": "2\n4\n2 2 2 2\n4\n1 3 3 4\n", "output": "15\n4\n"}, {"type": "stdin_stdout", "input": "2\n4\n2 2 2 2\n4\n1 4 3 4\n", "output": "15\n2\n"}, {"type": "stdin_stdout", "input": "2\n4\n2 2 2 2\n4\n1 2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarpus has n markers and m marker caps. Each marker is described by two numbers: xi is the color and yi is the diameter. Correspondingly, each cap is described by two numbers: aj is the color and bj is the diameter. C... | [{"type": "stdin_stdout", "input": "6 7\n2 1\n1 1\n2 2\n1 2\n1 1\n1 2\n2 1\n1 1\n1 1\n1 1\n1 2\n2 2\n1 1\n", "output": "5 5\n"}, {"type": "stdin_stdout", "input": "6 7\n1 1\n1 1\n1 2\n1 2\n2 2\n1 2\n2 1\n2 1\n2 1\n2 1\n1 1\n1 1\n1 2\n", "output": "3 3\n"}, {"type": "stdin_stdout", "input": "6 7\n2 1\n2 2\n2 1\n1 1\n2 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Smart Beaver from ABBYY loves puzzles. One of his favorite puzzles is the magic square. He has recently had an idea to automate the solution of this puzzle. The Beaver decided to offer this challenge to the ABBYY Cup ... | [{"type": "stdin_stdout", "input": "4\n-64322865 -60701256 -53458038 -42593211 -38971602 -31728384 -24485166 -17241948 -2755512 4487706 11730924 18974142 22595751 33460578 40703796 44325405\n", "output": "-39994920\n-60701256 -64322865 44325405 40703796\n-2755512 33460578 -53458038 -17241948\n18974142 -31728384 1173092... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFormula One championship consists of series of races called Grand Prix. After every race drivers receive points according to their final position. Only the top 10 drivers receive points in the following order 25, 18, 15, ... | [{"type": "stdin_stdout", "input": "1\n50\nJamesHunt\nNakajima\nHakkinen\nScheckter\nJones\nHill\nHawthorn\nVettel\nHulkenberg\nSutil\nGlock\nWebber\nAlbertoAscari\nMensel\nBuemi\nKubica\ndiGrassi\nJimClark\nKovalainen\nTrulli\nBarichelo\nSurtees\nJackieStewert\nLauda\nRaikkonen\nVilleneuve\nFangio\nButton\nDeLaRosa\nP... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs a tradition, every year before IOI all the members of Natalia Fan Club are invited to Malek Dance Club to have a fun night together. Malek Dance Club has 2n members and coincidentally Natalia Fan Club also has 2n membe... | [{"type": "stdin_stdout", "input": "1000000001101010101011111001001101011100011000010000100101001111001000110100100001110001100001000001\n", "output": "759144998\n"}, {"type": "stdin_stdout", "input": "1000001010111011110011111110011001011111011001110011100101111110100110111001100001110000011101011011\n", "output": "92... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou will receive 3 points for solving this problem.\n\nManao is designing the genetic code for a new type of algae to efficiently produce fuel. Specifically, Manao is focusing on a stretch of DNA that encodes one protein.... | [{"type": "stdin_stdout", "input": "CCCTTCACCCGGATCCAAATCCCTTAGAAATAATCCCCGACGGCGTTGTATCACCTCTGCACTTGTTAGTAAGGTCAGGCGTCCATTACGGAAGAACGTA\n", "output": "19\n"}, {"type": "stdin_stdout", "input": "GCATTACATGGGGGGGTCCTACGAGCCCGGCATCCCGGAAACTAGCCGGTTAATTTGGTTTAAACCCTCCCACCCCGGATTGTAACCCCCCTCATTGGTT\n", "output": "17\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne of the most important products of the R1 company is a popular @r1.com mail service. The R1 mailboxes receive and send millions of emails every day.\n\nToday, the online news thundered with terrible information. The R1... | [{"type": "stdin_stdout", "input": "gerald.agapov1991@gmail.com\n", "output": " 18"}, {"type": "stdin_stdout", "input": "x@x.x@x.x_e_@r1.com\n", "output": " 8"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading s1 and text s2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't ... | [{"type": "stdin_stdout", "input": "kKhuIwRPLCwPFfcnsyCfBdnsraGeOCcLTfXuGjqFSGPSAeDZJSS bXKFanNqWjpFnvRpWxHJspvisDlADJBioxXNbVoXeUedoPcNEpUyEeYxdJXhGzFAmpAiHotSVwbZQsuWjIVhVaEGgqbZHIoDpiEmjTtFylCwCkWWzUOoUfOHxEZvDwNpXhBWamHn\nK VpJjGhNbwCRhcfmNGVjewBFpEmPlIKeTuWiukDtEWpjgqciqglkyNfWrBLbGAKvlNWxaUelJmSlSoakSpRzePvJsshOs... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's denote as <image> the number of bits set ('1' bits) in the binary representation of the non-negative integer x.\n\nYou are given multiple queries consisting of pairs of integers l and r. For each query, find the x, ... | [{"type": "stdin_stdout", "input": "18\n0 18\n1 101\n1 1001\n0 10000\n2 100000\n1 1001010\n1 10000000\n1 100000001\n1 1000000000\n1 10000010000\n1 100000000000\n0 1100000000000\n2 10000100000000\n0 100000000000000\n1 1000100000000000\n1 10000000000000000\n1 100000000000000001\n2 1000000000000000100\n", "output": "15\n6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya had a strictly increasing sequence of positive integers a1, ..., an. Vasya used it to build a new sequence b1, ..., bn, where bi is the sum of digits of ai's decimal representation. Then sequence ai got lost and all... | [{"type": "stdin_stdout", "input": "100\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n6\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAmr bought a new video game \"Guess Your Way Out! II\". The goal of the game is to find an exit from the maze that looks like a perfect binary tree of height h. The player is initially standing at the root of the tree and... | [{"type": "stdin_stdout", "input": "4 3\n4 10 14 1\n3 7 6 0\n2 3 3 1\n", "output": "Data not sufficient!\n"}, {"type": "stdin_stdout", "input": "4 3\n4 10 26 1\n3 7 6 0\n2 3 3 1\n", "output": "Data not sufficient!\n"}, {"type": "stdin_stdout", "input": "4 3\n4 10 23 1\n3 7 6 0\n2 3 3 1\n", "output": "Data not sufficien... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKolya loves putting gnomes at the circle table and giving them coins, and Tanya loves studying triplets of gnomes, sitting in the vertexes of an equilateral triangle.\n\nMore formally, there are 3n gnomes sitting in a cir... | [{"type": "stdin_stdout", "input": "100000\n", "output": "192156836"}, {"type": "stdin_stdout", "input": "10701\n", "output": "198227529\n"}, {"type": "stdin_stdout", "input": "10010\n", "output": "495680028\n"}, {"type": "stdin_stdout", "input": "62113\n", "output": "786955632\n"}, {"type": "stdin_stdout", "input": "4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Cybernetics Failures (CF) organisation made a prototype of a bomb technician robot. To find the possible problems it was decided to carry out a series of tests. At the beginning of each test the robot prototype will b... | [{"type": "stdin_stdout", "input": "15 17 8 9\nURRDLUULLDDDRRURR\n", "output": "1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 0 241 "}, {"type": "stdin_stdout", "input": "15 17 7 9\nURRDLUULLDDDRRURR\n", "output": "1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 0 241\n"}, {"type": "stdin_stdout", "input": "15 17 1 9\nURRDLUULLDDDRRURR\n", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJohny likes numbers n and k very much. Now Johny wants to find the smallest integer x greater than n, so it is divisible by the number k.\n\nInput\n\nThe only line contains two integers n and k (1 ≤ n, k ≤ 109).\n\nOutput... | [{"type": "stdin_stdout", "input": "1000000010 1000000000\n", "output": "2000000000\n"}, {"type": "stdin_stdout", "input": "1398941105 1000000001\n", "output": "2000000002\n"}, {"type": "stdin_stdout", "input": "1000100010 1000010000\n", "output": "2000020000\n"}, {"type": "stdin_stdout", "input": "1000100010 110001000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn vacations n pupils decided to go on excursion and gather all together. They need to overcome the path with the length l meters. Each of the pupils will go with the speed equal to v1. To get to the excursion quickly, it... | [{"type": "stdin_stdout", "input": "10000 1000000000 999999999 1000000000 3\n", "output": "1.000000000999700060987552535\n"}, {"type": "stdin_stdout", "input": "10000 1000000000 999999999 1000000000 1\n", "output": "1.000000000999900000999850006\n"}, {"type": "stdin_stdout", "input": "10000 1 999999999 1000000000 1\n",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array consisting of n non-negative integers a1, a2, ..., an.\n\nYou are going to destroy integers in the array one by one. Thus, you are given the permutation of integers from 1 to n defining the order el... | [{"type": "stdin_stdout", "input": "7\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n1 2 3 4 5 6 7\n", "output": "6000000000\n5000000000\n4000000000\n3000000000\n2000000000\n1000000000\n0\n"}, {"type": "stdin_stdout", "input": "7\n1000000000 1000000000 1000000000 1000000100 1000000000 10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHongcow is ruler of the world. As ruler of the world, he wants to make it easier for people to travel by road within their own countries.\n\nThe world can be modeled as an undirected graph with n nodes and m edges. k of t... | [{"type": "stdin_stdout", "input": "24 38 2\n4 13\n7 1\n24 1\n2 8\n17 2\n2 18\n22 2\n23 3\n5 9\n21 5\n6 7\n6 19\n6 20\n11 7\n7 20\n13 8\n16 8\n9 10\n14 9\n21 9\n12 10\n10 22\n23 10\n17 11\n11 24\n20 12\n13 16\n13 23\n15 14\n17 14\n14 20\n19 16\n17 20\n17 23\n18 22\n18 23\n22 19\n21 20\n23 24\n", "output": "215\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBear Limak examines a social network. Its main functionality is that two members can become friends (then they can talk with each other and share funny pictures).\n\nThere are n members, numbered 1 through n. m pairs of m... | [{"type": "stdin_stdout", "input": "20 80\n17 4\n10 1\n11 10\n17 7\n15 10\n14 15\n13 1\n18 13\n3 13\n12 7\n9 13\n10 12\n14 12\n18 11\n4 7\n10 13\n11 3\n19 8\n14 7\n10 17\n14 3\n7 11\n11 14\n19 5\n10 14\n15 17\n3 1\n9 10\n11 2\n4 1\n11 4\n12 1\n12 3\n13 7\n1 14\n11 12\n7 1\n9 12\n18 15\n17 3\n7 15\n4 10\n7 18\n3 9\n12 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider the function p(x), where x is an array of m integers, which returns an array y consisting of m + 1 integers such that yi is equal to the sum of first i elements of array x (0 ≤ i ≤ m).\n\nYou have an infinite seq... | [{"type": "stdin_stdout", "input": "4 1000000000000000000\n612929642 983621174 279363954 332455288\n", "output": "2137\n"}, {"type": "stdin_stdout", "input": "4 1000000000000000000\n612929642 983621174 97116392 332455288\n", "output": "2137\n"}, {"type": "stdin_stdout", "input": "18 1000000000000000000\n1 0 0 0 0 0 0 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn a building where Polycarp lives there are equal number of flats on each floor. Unfortunately, Polycarp don't remember how many flats are on each floor, but he remembers that the flats are numbered from 1 from lower to ... | [{"type": "stdin_stdout", "input": "50 70\n3 3\n80 80\n23 23\n11 11\n87 87\n7 7\n63 63\n61 61\n67 67\n53 53\n9 9\n43 43\n55 55\n27 27\n5 5\n1 1\n99 99\n65 65\n37 37\n60 60\n32 32\n38 38\n81 81\n2 2\n34 34\n17 17\n82 82\n26 26\n71 71\n4 4\n16 16\n19 19\n39 39\n51 51\n6 6\n49 49\n64 64\n83 83\n10 10\n56 56\n30 30\n76 76\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nValentin participates in a show called \"Shockers\". The rules are quite easy: jury selects one letter which Valentin doesn't know. He should make a small speech, but every time he pronounces a word that contains the sele... | [{"type": "stdin_stdout", "input": "15\n. r\n? e\n. s\n. rw\n? y\n. fj\n. zftyd\n? r\n! wq\n? w\n? p\n. ours\n. dto\n. lbyfru\n? q\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "15\n. r\n? e\n. s\n. rw\n? y\n. fj\n. zftyd\n? r\n! qw\n? w\n? p\n. ours\n. dto\n. lbyfru\n? q\n", "output": "2\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a rectangular grid of n rows of m initially-white cells each.\n\nArkady performed a certain number (possibly zero) of operations on it. In the i-th operation, a non-empty subset of rows Ri and a non-empty subset ... | [{"type": "stdin_stdout", "input": "50 8\n.....#..\n........\n........\n.....#..\n.....#..\n........\n........\n........\n........\n...#....\n...#....\n........\n...#....\n#.#.#...\n...#....\n...#....\n........\n...#....\n...#....\n...#....\n........\n#.#.#...\n.....#..\n........\n#.#.#...\n#.#.#...\n#.#.#...\n...#....... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the Bus of Characters there are n rows of seat, each having 2 seats. The width of both seats in the i-th row is w_i centimeters. All integers w_i are distinct.\n\nInitially the bus is empty. On each of 2n stops one pas... | [{"type": "stdin_stdout", "input": "10\n24 53 10 128 141 9 15 62 32 47\n00100000000111111111\n", "output": "6 3 3 7 1 9 10 2 8 4 5 5 4 8 2 10 9 1 7 6\n"}, {"type": "stdin_stdout", "input": "10\n24 53 10 128 141 9 15 97 32 47\n00100000000111111111\n", "output": "6 3 3 7 1 9 10 2 8 4 5 5 4 8 2 10 9 1 7 6\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRahul and Rashi are bored with playing the game of Nim, particularly after Rahul gained a thorough understanding of game theory, and would always win.\n\nNow, they are going to play on a variation. \nThere are only 2 pile... | [{"type": "stdin_stdout", "input": "216\n88 0\n452 823\n549 562\n790 873\n114 186\n216 75\n620 414\n870 68\n657 802\n358 735\n757 593\n662 481\n700 339\n885 256\n1030 398\n370 939\n837 517\n519 150\n897 829\n822 76\n110 134\n241 367\n507 63\n241 807\n25 445\n440 802\n933 167\n588 798\n511 979\n256 565\n359 14\n805 1303... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet us define F(N,K) be number of subsets of K distinct elements of S where N is the size of S. Given a P( ≤ N), let Sum = F(N,0) + F(N,1) + ... + F(N,P). \nYou have to print Sum modulo 1000000007.\n\nInput: \nFirst line... | [{"type": "stdin_stdout", "input": "1000\n1000 0\n1000 1\n1000 2\n1000 3\n1000 4\n1000 5\n1000 6\n1000 7\n1000 8\n1000 9\n1000 10\n1000 11\n1000 12\n1000 13\n1000 14\n1000 15\n1000 16\n1000 17\n1000 18\n1000 19\n1000 20\n1000 21\n1000 22\n1000 23\n1000 24\n1000 25\n1000 26\n1000 27\n1000 28\n1000 29\n1000 30\n1000 31\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nN coders decided to go for a trip for the upcoming weekend. They chose Crater Lake National Park in Oregon, USA as their destination, because they all like to take a lot of photos and the beautiful nature gives them a cha... | [{"type": "stdin_stdout", "input": "1\n12 0\n-1 41\n\nENPTAO", "output": "4095\n"}, {"type": "stdin_stdout", "input": "1\n15 1\n1 14\n\nSAMPKE", "output": "24575\n"}, {"type": "stdin_stdout", "input": "1\n13 0\n-2 43\n\nEMPTBP", "output": "8191\n"}, {"type": "stdin_stdout", "input": "1\n15 0\n1 11\n\nSAMPKE", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nToday Oz is playing with his game-board. He has N coins of type-1 and M coins of type-2. Also the game-board has N squares of type-1 and M squares of type-2. In this game Oz must place one coin into each square. After pla... | [{"type": "stdin_stdout", "input": "2\n26 14 1911 581 510\n0 5 10 -20 -43\n\nSAMPKD", "output": "57820\n-100\n"}, {"type": "stdin_stdout", "input": "2\n26 15 1911 581 510\n0 5 10 -20 -43\n\nSAKPMD", "output": "58401\n-100\n"}, {"type": "stdin_stdout", "input": "2\n26 15 1911 581 510\n0 5 10 -25 -43\n\nSAKPMD", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt's the rainy season again, and the city experiences frequent showers throughout the day.\n\nThe weather report says that there is a P probability of rainfalls today. Raj has to step out for a meeting at the office, and ... | [{"type": "stdin_stdout", "input": "10\n0.18645496223766345 360\n0.17989902622977394 360\n0.45262248490623425 360\n0.04663296744034651 360\n0.12725823257381275 360\n0.2895663014860297 48\n0.05625277914818627 360\n0.11455689444280615 360\n0.46003084917418513 360\n0.17986394802612649 360", "output": "0.0503\n0.0484\n0.13... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFind the minimum prime number greater than or equal to X.\n\nConstraints\n\n* 2 \\le X \\le 10^5\n* All values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\n\nX\n\n\nOut... | [{"type": "stdin_stdout", "input": "99992", "output": "100003"}, {"type": "stdin_stdout", "input": "1171", "output": "1171\n"}, {"type": "stdin_stdout", "input": "1154", "output": "1163\n"}, {"type": "stdin_stdout", "input": "1955", "output": "1973\n"}, {"type": "stdin_stdout", "input": "1040", "output": "1049\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a sequence of N integers: A_1, A_2, \\cdots, A_N.\n\nYou can perform the following operation between 0 and K times (inclusive):\n\n* Choose two integers i and j such that i \\neq j, each between 1 and N (inclusive... | [{"type": "stdin_stdout", "input": "8 57\n-1 26 2 0 2 2 20 2", "output": "53\n"}, {"type": "stdin_stdout", "input": "8 26\n0 22 2 1 0 2 16 3", "output": "46\n"}, {"type": "stdin_stdout", "input": "8 26\n0 22 2 1 1 2 16 3", "output": "47\n"}, {"type": "stdin_stdout", "input": "8 26\n0 25 2 1 1 2 16 3", "output": "50\n"}... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a simple connected undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M.\n\nEdge i connects Vertex a_i and b_i bidirectionally.\n\nDeterm... | [{"type": "stdin_stdout", "input": "18 27\n17 9\n12 15\n18 17\n13 18\n13 1\n5 7\n12 1\n14 5\n15 11\n14 6\n1 9\n5 1\n18 16\n4 6\n7 2\n7 11\n6 3\n12 14\n5 3\n10 5\n5 8\n10 15\n3 15\n9 8\n7 15\n2 16\n18 15", "output": "No\n"}, {"type": "stdin_stdout", "input": "18 15\n17 9\n12 15\n18 17\n13 18\n13 1\n5 7\n12 1\n14 5\n15 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have N gemstones labeled 1 through N.\n\nYou can perform the following operation any number of times (possibly zero).\n\n* Select a positive integer x, and smash all the gems labeled with multiples of x.\n\n\n\nThen, f... | [{"type": "stdin_stdout", "input": "6\n100 -100 -100 -100 100 -100", "output": "200"}, {"type": "stdin_stdout", "input": "6\n000 -100 -100 -100 100 -100", "output": "100"}, {"type": "stdin_stdout", "input": "6\n111 4 -314 -1477 110 -128", "output": "225"}, {"type": "stdin_stdout", "input": "6\n111 4 -314 -3247 100 -161... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNukes has an integer that can be represented as the bitwise OR of one or more integers between A and B (inclusive). How many possible candidates of the value of Nukes's integer there are?\n\nConstraints\n\n* 1 ≤ A ≤ B < 2... | [{"type": "stdin_stdout", "input": "271828182845904523\n1128816364578546661", "output": "881093321760942453\n"}, {"type": "stdin_stdout", "input": "271828182845904523\n1080587834201094862", "output": "881093321760942453\n"}, {"type": "stdin_stdout", "input": "271828182845904523\n1104519973481288013", "output": "8810933... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N boxes arranged in a row. Initially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\n* Choose a box containing at least one candy, and eat o... | [{"type": "stdin_stdout", "input": "-2 124\n10 2 2 6 3", "output": "0\n"}, {"type": "stdin_stdout", "input": "-2 124\n10 1 2 6 3", "output": "0\n"}, {"type": "stdin_stdout", "input": "-2 189\n10 1 2 6 3", "output": "0\n"}, {"type": "stdin_stdout", "input": "-1 124\n10 2 2 6 3", "output": "0\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHiroshi:? D-C'KOPUA\n\nPeter: What's wrong, Dr. David? I'm used to shouting something I don't understand, but I'm not even writing it today.\n\nHiroshi: Here.\n\n<image>\n\n\nPeter: What? This table ... oh, there was some... | [{"type": "stdin_stdout", "input": "?DKC'-OPUB", "output": "PES WP E EIERD\n"}, {"type": "stdin_stdout", "input": "?DKC'-OPUA", "output": "PES WP E EIER\n"}, {"type": "stdin_stdout", "input": ".UPDL'BCN?", "output": "EP.PD IP?DSPP\n"}, {"type": "stdin_stdout", "input": ".UQDL'BCN?", "output": "EPF'K PEWLEPP\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBetter things, cheaper. There is a fierce battle at the time sale held in some supermarkets today. \"LL-do\" here in Aizu is one such supermarket, and we are holding a slightly unusual time sale to compete with other chai... | [{"type": "stdin_stdout", "input": "6 5\n1 1 . 0 0 4\n1 . . . . .\n. . 2 2 . .\n. . 2 2 3 3\nP . - . . .\n5\n0 50 5 10\n1 20 0 10\n2 10 5 15\n3 150 3 10\n4 100 8 9\n0 0", "output": "330\n"}, {"type": "stdin_stdout", "input": "6 5\n1 0 . 0 0 4\n1 . . . . .\n. . 2 2 . .\n. . 2 2 3 3\nP . . . . .\n5\n0 50 8 10\n1 20 0 10\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n cups of different sizes and three trays (bon festivals) A, B, and C, and these cups are placed on top of each of the three trays in a pile. However, in any tray, the smallest cup in the tray is on the bottom, ... | [{"type": "stdin_stdout", "input": "3 10\n0\n1 1\n2 2 3\n4 13\n1 1 2\n1 3\n1 4\n1 5\n2 1 2\n0\n0\n3 6\n0\n1 1\n2 2 3\n0 0", "output": "9\n-1\n0\n-1\n"}, {"type": "stdin_stdout", "input": "3 10\n0\n1 1\n2 2 3\n4 20\n2 1 2\n1 3\n1 4\n1 5\n2 1 2\n0\n0\n3 3\n0\n1 1\n2 2 3\n0 0", "output": "9\n3\n0\n-1\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBackground\n\nMr. A and Mr. B are enthusiastic about the game \"Changing Grids\". This game is for two players, with player 1 forming the stage and player 2 challenging the stage and aiming for the goal.\n\nNow, A and B h... | [{"type": "stdin_stdout", "input": "4 3\nS..\n/..\n..G\n../\n4\n2\n\n.#\n\n.#\n0\n\n..\n..\n\n8\n\n-#\n\n..\n10\n\n..\n..", "output": "4\n"}, {"type": "stdin_stdout", "input": "4 3\nS..\n/..\n.G.\n./.\n8\n0\n\n.\"\n\n.#\n2\n\n..\n..\n\n2\n\n#.\n\n..\n16\n\n..\n..", "output": "3\n"}, {"type": "stdin_stdout", "input": "4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEdward Leven loves multiples of eleven very much. When he sees a number, he always tries to find consecutive subsequences (or substrings) forming multiples of eleven. He calls such subsequences as 11-sequences. For exampl... | [{"type": "stdin_stdout", "input": "17819\n1011\n11011\n1234567891011121314151617181920\n0", "output": "1\n1\n4\n38\n"}, {"type": "stdin_stdout", "input": "17819\n1010\n11011\n1234567891011121314151617181920\n0", "output": "1\n0\n4\n38\n"}, {"type": "stdin_stdout", "input": "17819\n1011\n11011\n130083111483873165421240... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n2 2 2 0 0 0 5\n\n\nOutput\n\n1 3 3 1 0\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... | [{"type": "stdin_stdout", "input": "2 2 4 1 0 1 35", "output": "1 4 6 4 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\n"}, {"type": "stdin_stdout", "input": "1 1 4 0 0 0 24", "output": "1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"}, {"type": "stdin_stdout", "input": "1 1 4 0 0 1 24", "output": "1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA: Alphabet block\n\nWakana Nakawa loves palindromes. Because my name is also a palindrome.\n\nWakana got a set with some alphabet blocks. An alphabet block is a block in which one lowercase alphabet is written for each b... | [{"type": "stdin_stdout", "input": "gcpc", "output": "1\n"}, {"type": "stdin_stdout", "input": "bgnc", "output": "2\n"}, {"type": "stdin_stdout", "input": "gcoc", "output": "1\n"}, {"type": "stdin_stdout", "input": "gcnc", "output": "1\n"}, {"type": "stdin_stdout", "input": "cgnc", "output": "1\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nC: Skewering\n\nproblem\n\nOne day, when Homura was playing with blocks, Tempura came. Homura decided to play with blocks with Tempura.\n\nThere is a rectangular parallelepiped of A \\ times B \\ times C, which is made by... | [{"type": "stdin_stdout", "input": "28 11 20", "output": "Tem\n"}, {"type": "stdin_stdout", "input": "28 11 17", "output": "Hom\n"}, {"type": "stdin_stdout", "input": "54 11 17", "output": "Hom\n"}, {"type": "stdin_stdout", "input": "12 6 20", "output": "Tem\n"}, {"type": "stdin_stdout", "input": "24 6 20", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which manipulates a sequence A = {a0, a1, . . . , an−1} with the following operations:\n\n* update(s, t, x): change as, as+1, ..., at to x.\n* find(s, t): report the minimum element in as, as+1, ..., at.\n... | [{"type": "stdin_stdout", "input": "9 20\n0 0 0 0\n0 1 2 8\n0 0 2 2\n1 0 3\n1 1 2", "output": "2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n"}, {"type": "stdin_stdout", "input": "9 20\n0 0 0 0\n0 0 2 8\n0 0 0 2\n1 1 3\n1 1 2", "output": "8\n8\n8\n8\n8\n8\n8\n8\n8\n8\n8\n8\n8\n8\n8\n8\n8\n"}, {"type": "stdin_stdou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour friend is developing a computer game. He has already decided how the game world should look like — it should consist of n locations connected by m two-way passages. The passages are designed in such a way that it sho... | [{"type": "stdin_stdout", "input": "50 72\n35 38\n19 46\n35 12\n27 30\n23 41\n50 16\n31 6\n20 33\n38 1\n10 35\n13 43\n29 25\n25 4\n1 13\n4 20\n36 29\n13 47\n48 5\n30 21\n30 38\n28 50\n41 45\n25 43\n40 36\n19 47\n31 32\n26 28\n8 13\n43 24\n27 35\n14 29\n14 38\n50 9\n34 49\n12 34\n43 42\n41 15\n46 29\n48 11\n48 7\n40 29\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya is choosing a laptop. The shop has n laptops to all tastes.\n\nVasya is interested in the following properties: processor speed, ram and hdd. Vasya is a programmer and not a gamer which is why he is not interested i... | [{"type": "stdin_stdout", "input": "27\n1689 1927 40 270\n3833 2570 167 134\n2580 3589 390 300\n1898 2587 407 316\n1841 2772 411 187\n1296 288 407 506\n1215 263 236 307\n2737 1427 84 992\n1107 1879 284 866\n3311 2507 475 147\n2951 2214 209 375\n1352 2582 110 324\n2082 747 289 521\n2226 1617 209 108\n2253 1993 109 835\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob are decorating a Christmas Tree. \n\nAlice wants only 3 types of ornaments to be used on the Christmas Tree: yellow, blue and red. They have y yellow ornaments, b blue ornaments and r red ornaments.\n\nIn Bo... | [{"type": "stdin_stdout", "input": "100 100 100\n", "output": "297\n"}, {"type": "stdin_stdout", "input": "156 101 100\n", "output": "297\n"}, {"type": "stdin_stdout", "input": "156 111 100\n", "output": "297\n"}, {"type": "stdin_stdout", "input": "99 100 100\n", "output": "297\n"}, {"type": "stdin_stdout", "input": "9... | 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": "777777776 778777777 777777775 1000000000 1\n", "output": "0.00000201349596377857\n"}, {"type": "stdin_stdout", "input": "987654215 1000000000 9854874 854888120 270\n", "output": "0.00000003195140557588\n"}, {"type": "stdin_stdout", "input": "777777776 992178143 529475309 1000000000 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the la... | [{"type": "stdin_stdout", "input": "fbvzqonvdlqdanwliolaqfj sbauorbinites xkbfnfinitespjy phbexglblzpobtqpisyijycmtliola aosinites lbpjiwcjoqyuhglthloiniteswb mjtxhoofohzzgefvhsywojcuxtetxmojrlktodhbgyrkeejgjzxkzyvrxwmyaqkeoqnvusnlrsfffrzeoqjdfumolhksqkrtzwhnforgpenziokrxlnhcapbbupctlmuetrani pigxerwetupjbkvlmgnjhdfjli... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a square grid of size n × n. Some cells are colored in black, all others are colored in white. In one operation you can select some rectangle and color all its cells in white. It costs min(h, w) to color a rectan... | [{"type": "stdin_stdout", "input": "1000 24\n190 39 552 958\n539 146 763 587\n31 526 423 673\n208 432 953 442\n263 69 719 635\n162 428 623 797\n49 126 94 963\n749 623 979 919\n190 461 367 855\n211 240 939 914\n169 80 336 203\n684 546 829 582\n80 218 324 327\n560 452 656 637\n316 534 982 642\n521 634 758 686\n514 324 75... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMonocarp and Bicarp live in Berland, where every bus ticket consists of n digits (n is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have been erased. The number of d... | [{"type": "stdin_stdout", "input": "396\n???7?2675?2??52554870???512418???29?6270?638470?154?339014?59??5?3?51577??8?2???1441?86???90?7?6?472??3675?4??1920?9??6258??16362?979??707?0?05682730650?08???04005?54?355??4???530?5?1?9?84416??5???80??8102??2??8??3??868?18?304????68?91225?047175??4??8?14593???58?05661?9?0??4?8??... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAssume that you have k one-dimensional segments s_1, s_2, ... s_k (each segment is denoted by two integers — its endpoints). Then you can build the following graph on these segments. The graph consists of k vertexes, and ... | [{"type": "stdin_stdout", "input": "1\n10\n1 2\n1 3\n2 4\n2 5\n2 6\n3 7\n3 8\n4 9\n4 10\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "1\n10\n1 2\n2 3\n1 4\n2 5\n4 6\n6 7\n3 8\n4 9\n4 10\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "1\n10\n1 2\n1 3\n1 4\n2 5\n2 6\n6 7\n1 8\n4 9\n4 10\n", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are the gym teacher in the school.\n\nThere are n students in the row. And there are two rivalling students among them. The first one is in position a, the second in position b. Positions are numbered from 1 to n from... | [{"type": "stdin_stdout", "input": "22\n100 100 100 1\n100 100 1 100\n100 0 100 1\n100 0 1 100\n2 0 1 2\n2 100 1 2\n2 0 2 1\n2 100 2 1\n100 0 1 2\n100 98 1 2\n100 97 1 2\n100 0 2 1\n100 98 2 1\n100 97 2 1\n100 0 99 100\n100 98 99 100\n100 97 99 100\n100 0 100 99\n100 98 100 99\n100 97 100 99\n100 0 13 37\n100 0 66 11\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are an all-powerful being and you have created a rectangular world. In fact, your world is so bland that it could be represented by a r × c grid. Each cell on the grid represents a country. Each country has a dominant... | [{"type": "stdin_stdout", "input": "4\n7 8\nAAP@AABA\nPPPPAAAA\nPPPPAAAA\nAPAAPPPP\nAPAPPAPP\nAAAAPPAP\nAAAAPPAA\n6 5\nAAAAA\nAAAAA\nAAPAA\nAAPAP\nAAAPP\nAAAOP\n4 4\nPPPP\nPPPP\nPPPP\nPPPP\n1 4\nPPPP\nPA@P\nPPPP\n", "output": "2\n1\nMORTAL\nMORTAL\n"}, {"type": "stdin_stdout", "input": "4\n7 8\nAAPAAAAA\nPPPPAAAA\nPPPP... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGuy-Manuel and Thomas have an array a of n integers [a_1, a_2, ..., a_n]. In one step they can add 1 to any element of the array. Formally, in one step they can choose any integer index i (1 ≤ i ≤ n) and do a_i := a_i + 1... | [{"type": "stdin_stdout", "input": "1\n100\n64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 -64 64 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a consisting of n integers.\n\nYour task is to determine if a has some subsequence of length at least 3 that is a palindrome.\n\nRecall that an array b is called a subsequence of the array a if b ca... | [{"type": "stdin_stdout", "input": "15\n16\n1 1 1 1 1 1 1 1 1 1 1 1 5 12 12 14\n18\n12 14 12 15 17 16 11 5 15 15 7 15 15 14 16 16 11 11\n13\n4 9 11 7 13 9 10 1 3 7 12 5 9\n3\n3 2 2\n6\n6 3 2 2 3 1\n20\n2 2 4 4 5 5 5 5 5 5 5 5 5 5 6 8 10 12 12 17\n25\n1 1 6 10 8 8 9 10 14 16 16 16 16 16 16 16 16 16 16 16 16 18 21 21 23\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently Vova found n candy wrappers. He remembers that he bought x candies during the first day, 2x candies during the second day, 4x candies during the third day, ..., 2^{k-1} x candies during the k-th day. But there is... | [{"type": "stdin_stdout", "input": "53\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n", "output": "1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAshish has n elements arranged in a line. \n\nThese elements are represented by two integers a_i — the value of the element and b_i — the type of the element (there are only two possible types: 0 and 1). He wants to sort ... | [{"type": "stdin_stdout", "input": "10\n8\n94616 28275 43594 32192 68030 82703 84250 96281\n1 0 0 0 0 0 0 0\n5\n28821 83833 62399 69723 77684\n1 1 0 1 1\n8\n115822 94805 71389 67802 43519 34364 17842 98783\n0 1 0 1 0 1 0 0\n3\n63630 83145 89435\n1 1 1\n5\n66195 67879 10777 54269 80789\n1 1 1 1 0\n8\n42696 26113 2424 33... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTo help those contestants who struggle a lot in contests, the headquarters of Codeforces are planning to introduce Division 5. In this new division, the tags of all problems will be announced prior to the round to help th... | [{"type": "stdin_stdout", "input": "4\n6\n1 1 2 3 1 1\n5\n1 1 1 2 2\n8\n7 7 2 7 7 1 4 7\n10\n1 2 3 10 1 1 2 3 4 1\n", "output": "-1\n3\n-1\n2\n"}, {"type": "stdin_stdout", "input": "4\n6\n2 1 2 3 1 1\n5\n1 1 1 2 2\n8\n7 7 2 7 7 1 8 7\n10\n1 2 3 4 1 1 2 3 4 1\n", "output": "\n1\n3\n-1\n2\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDuring cleaning the coast, Alice found n piles of stones. The i-th pile has a_i stones.\n\nPiles i and i + 1 are neighbouring for all 1 ≤ i ≤ n - 1. If pile i becomes empty, piles i - 1 and i + 1 doesn't become neighbouri... | [{"type": "stdin_stdout", "input": "5\n3\n1 2 1\n3\n1 1 2\n5\n2 2 2 1 3\n5\n2100 1900 1600 3000 1600\n2\n2443 2445\n", "output": "\nYES\nYES\nYES\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "5\n3\n1 2 1\n3\n1 1 2\n5\n2 2 2 1 3\n5\n2100 1900 1600 3000 1600\n2\n2443 1129\n", "output": "YES\nYES\nYES\nYES\nNO\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet with n rows and m columns. Bob shaded some of the squares on the sheet. Having seen his masterpiece, he decided to share it with his elde... | [{"type": "stdin_stdout", "input": "50 1\n.\n*\n*\n*\n.\n.\n*\n.\n*\n*\n*\n*\n*\n*\n*\n.\n*\n*\n*\n*\n*\n*\n*\n*\n*\n*\n*\n*\n*\n.\n.\n.\n.\n*\n*\n.\n*\n*\n.\n.\n.\n.\n*\n*\n.\n.\n.\n.\n.\n.\n", "output": "*\n*\n*\n.\n.\n*\n.\n*\n*\n*\n*\n*\n*\n*\n.\n*\n*\n*\n*\n*\n*\n*\n*\n*\n*\n*\n*\n*\n.\n.\n.\n.\n*\n*\n.\n*\n*\n.\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Smart Beaver from ABBYY plans a space travel on an ultramodern spaceship. During the voyage he plans to visit n planets. For planet i ai is the maximum number of suitcases that an alien tourist is allowed to bring to ... | [{"type": "stdin_stdout", "input": "26 919241245\n302193 763904252\n302152 990010704\n453347 786598325\n302156 614790744\n151113 552970041\n151053 935503943\n453339 788648514\n453340 819457698\n604398 992471599\n453342 141598754\n302166 998869126\n151098 158907792\n453293 724150038\n604414 436248800\n604434 447578562\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Free Meteor Association (FMA) has got a problem: as meteors are moving, the Universal Cosmic Descriptive Humorous Program (UCDHP) needs to add a special module that would analyze this movement. \n\nUCDHP stores some s... | [{"type": "stdin_stdout", "input": "6 5 30\n536048 34640 572197 62457 304174\n194764 325606 270468 784237 551632\n10580 294606 63164 543647 531895\n430397 576813 678878 323394 603231\n534567 804015 403517 886087 981939\n518845 962097 609792 877955 88610\nc 1 5\nc 2 5\nc 2 5\nr 5 3\nc 5 2\nc 4 5\nr 6 5\nc 2 1\nr 3 4\nr ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt seems like the year of 2013 came only yesterday. Do you know a curious fact? The year of 2013 is the first year after the old 1987 with only distinct digits.\n\nNow you are suggested to solve the following problem: giv... | [{"type": "stdin_stdout", "input": "1987\n", "output": "2013\n"}, {"type": "stdin_stdout", "input": "2013\n", "output": "2014\n"}, {"type": "stdin_stdout", "input": "1594\n", "output": "1596\n"}, {"type": "stdin_stdout", "input": "5090\n", "output": "5091\n"}, {"type": "stdin_stdout", "input": "3000\n", "output": "3012... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBeing a nonconformist, Volodya is displeased with the current state of things, particularly with the order of natural numbers (natural number is positive integer number). He is determined to rearrange them. But there are ... | [{"type": "stdin_stdout", "input": "1000000000000 1000000000000\n", "output": "1000000000000\n"}, {"type": "stdin_stdout", "input": "1000000000000 1276759536556\n", "output": "1553519073112\n"}, {"type": "stdin_stdout", "input": "1000100000000 1000000000000\n", "output": "999900000000\n"}, {"type": "stdin_stdout", "inp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n<image>\n\nInput\n\nThe input contains a single floating-point number x with exactly 6 decimal places (0 < x < 5).\n\nOutput\n\nOutput two integers separated by a single space. Each integer should be between 1 and 10, inc... | [{"type": "stdin_stdout", "input": "4.472136\n", "output": "10 10\n"}, {"type": "stdin_stdout", "input": "4.239992\n", "output": "10 8\n"}, {"type": "stdin_stdout", "input": "0.499376\n", "output": "1 10\n"}, {"type": "stdin_stdout", "input": "1.483405\n", "output": "3 10\n"}, {"type": "stdin_stdout", "input": "4.06866... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nATMs of a well-known bank of a small country are arranged so that they can not give any amount of money requested by the user. Due to the limited size of the bill dispenser (the device that is directly giving money from a... | [{"type": "stdin_stdout", "input": "58 5\n1 6 9 18 34 41 82 99 164 179 183 204 240 396 636 1224 2023 2856 4488 4705 5712 9180 9266 18360 18850 20270 23086 60810 190701 197064 211140 214200 222970 243240 263510 314442 425670 486480 708288 789888 1009800 1025349 1054040 1094580 1325184 1579776 1748076 2050698 2635100 289... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day Vasya the Hipster decided to count how many socks he had. It turned out that he had a red socks and b blue socks.\n\nAccording to the latest fashion, hipsters should wear the socks of different colors: a red one o... | [{"type": "stdin_stdout", "input": "171 100\n", "output": "100 35\n"}, {"type": "stdin_stdout", "input": "171 110\n", "output": "110 30\n"}, {"type": "stdin_stdout", "input": "287 100\n", "output": "100 93\n"}, {"type": "stdin_stdout", "input": "287 101\n", "output": "101 93\n"}, {"type": "stdin_stdout", "input": "100 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPeople do many crazy things to stand out in a crowd. Some of them dance, some learn by heart rules of Russian language, some try to become an outstanding competitive programmers, while others collect funny math objects.\n... | [{"type": "stdin_stdout", "input": "133 51\n", "output": "1613157\n1 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 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 66... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA progress bar is an element of graphical interface that displays the progress of a process for this very moment before it is completed. Let's take a look at the following form of such a bar.\n\nA bar is represented as n ... | [{"type": "stdin_stdout", "input": "100 101 100\n", "output": "101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEach New Year Timofey and his friends cut down a tree of n vertices and bring it home. After that they paint all the n its vertices, so that the i-th vertex gets color ci.\n\nNow it's time for Timofey birthday, and his mo... | [{"type": "stdin_stdout", "input": "10\n5 7\n4 5\n10 2\n4 6\n1 2\n3 4\n8 5\n4 9\n2 3\n15 15 15 15 5 15 26 18 15 15\n", "output": "YES\n5\n"}, {"type": "stdin_stdout", "input": "10\n5 7\n4 5\n10 2\n4 6\n1 2\n3 4\n8 5\n4 9\n2 3\n15 15 15 15 5 15 42 18 15 15\n", "output": "YES\n5\n"}, {"type": "stdin_stdout", "input": "10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHelen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.\n\nMetropolis airpo... | [{"type": "stdin_stdout", "input": "10 6\n2226 89307 11261 28772 23196 30298 10832 43119 74662 24028\n", "output": "1246672\n16 7 14 11 13 10 15 8 9 12 \n"}, {"type": "stdin_stdout", "input": "10 5\n66220 81797 38439 54881 86879 94346 8802 59094 57095 41949\n", "output": "2484818\n9 8 14 12 7 6 15 10 11 13 \n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt seems that Borya is seriously sick. He is going visit n doctors to find out the exact diagnosis. Each of the doctors needs the information about all previous visits, so Borya has to visit them in the prescribed order (... | [{"type": "stdin_stdout", "input": "42\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n", "output": "83\n"}, {"type": "stdin_stdout", "input": "42\n1 2\n1 2\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSasha is taking part in a programming competition. In one of the problems she should check if some rooted trees are isomorphic or not. She has never seen this problem before, but, being an experienced participant, she gue... | [{"type": "stdin_stdout", "input": "10\n1 1 147 102 112 103 114 112 112 295 109\n", "output": "ambiguous\n0 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn this problem you will write a simple code generator for a 2D programming language derived from [Brainfuck](https://en.wikipedia.org/wiki/Brainfuck).\n\nThe code in this language is a rectangular grid of characters '.' ... | [{"type": "stdin_stdout", "input": "!\"#$%&'()*\n", "output": "..\nX.\n..\nX.\n..\nX.\n..\nX.\n..\nX.\n..\nX.\n..\nX.\n..\nX.\n..\nX.\n..\nX.\n..\nX.\n..\nX.\n..\nX.\n..\nX.\n..\nX.\n..\nX.\n..\nX.\n..\nX.\n..\nX.\n..\nX.\n..\nX.\n..\nX.\n..\nX.\n..\nX.\n..\nX.\n..\nX.\n..\nX.\n..\nX.\n..\nX.\n..\nX.\n..\nX.\n..\nX.\n.... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nView Russian Translation\n\nOne day Benny decides to miss lessons. But as she is a very good pig she will do her homework anyway. She doesn't know anything about the content of this lessons. Your task is to help her.\n\nT... | [{"type": "stdin_stdout", "input": "7 1 124\n\nDTPLAL", "output": "-0.11\n"}, {"type": "stdin_stdout", "input": "4 -1 0\n\nR@MQFL", "output": "-1.00\n"}, {"type": "stdin_stdout", "input": "11 3 77\n\nDSPL@M", "output": "0.37\n"}, {"type": "stdin_stdout", "input": "4 -2 0\n\nR@MQFL", "output": "-2.00\n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter solving Reese's first problem Harold thought he had proven himself. But Reese wasn't convinced so he gave Harold another query. He told Harold to find the nth term of the sequence given by the equation.\n\na[n]=( f[... | [{"type": "stdin_stdout", "input": "400\n44\n18470\n6337\n26503\n19172\n15727\n11481\n29361\n26965\n24467\n5708\n28148\n23284\n16830\n9964\n494\n2998\n11945\n4830\n5439\n32394\n14607\n3905\n156\n295\n12385\n17424\n18719\n19721\n19898\n5450\n21729\n14774\n11541\n1872\n19915\n25670\n26302\n17038\n9897\n28706\n23814\n3132... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is an integer N. Find the minimum possible positive integer k such that (1+2+\\cdots+k) is a multiple of N. It can be proved that such a positive integer k always exists.\n\nConstraints\n\n* 1 \\leq N \\leq 10^{15}\... | [{"type": "stdin_stdout", "input": "150916391", "output": "67547447\n"}, {"type": "stdin_stdout", "input": "116446379", "output": "20549361\n"}, {"type": "stdin_stdout", "input": "39730771", "output": "39730770\n"}, {"type": "stdin_stdout", "input": "71266519", "output": "17269679\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are playing a game and your goal is to maximize your expected gain. At the beginning of the game, a pawn is put, uniformly at random, at a position p\\in\\\\{1,2,\\dots, N\\\\}. The N positions are arranged on a circl... | [{"type": "stdin_stdout", "input": "10\n710714906537 801526060256 134858704333 970632701383 344124734627 780768757320 1205627779029 145838269002 9231169966 485814502387\n31 83 57 11 001 30 10 91 15 28", "output": "1205627778393.899999976158\n"}, {"type": "stdin_stdout", "input": "10\n710714906537 223115971783 134858704... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.\n\nConstraints\n\n* C is a lowercase English letter that is not `z`.\n\nInput\n\nInput is given from Standard I... | [{"type": "stdin_stdout", "input": "z", "output": "{\n"}, {"type": "stdin_stdout", "input": "b", "output": "c\n"}, {"type": "stdin_stdout", "input": "x", "output": "y\n"}, {"type": "stdin_stdout", "input": "`", "output": "a\n"}, {"type": "stdin_stdout", "input": "w", "output": "x\n"}, {"type": "stdin_stdout", "input": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists.\n\n* Let s' be the concatenation ... | [{"type": "stdin_stdout", "input": "contest\nprogrammhng", "output": "-1\n"}, {"type": "stdin_stdout", "input": "eontcst\nprogrammhng", "output": "-1\n"}, {"type": "stdin_stdout", "input": "eonscst\nprogrammhng", "output": "-1\n"}, {"type": "stdin_stdout", "input": "eonscst\nprogrammhog", "output": "-1\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Dwango Co., Ltd., there is a content distribution system named 'Dwango Media Cluster', and it is called 'DMC' for short.\nThe name 'DMC' sounds cool for Niwango-kun, so he starts to define DMC-ness of a string.\n\nGive... | [{"type": "stdin_stdout", "input": "54\nDIALUPWIDEAREADETWORKGAMINGOPERATIONCORPORATIONLIMITEN\n3\n20 30 40", "output": "0\n2\n3\n"}, {"type": "stdin_stdout", "input": "54\nDIALUPWIDEAREADETWORKGAMINGOPERATIONCORPORATIONLIMITEN\n3\n20 38 40", "output": "0\n3\n3\n"}, {"type": "stdin_stdout", "input": "54\nDIALUPWIDEAREA... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string S.\n\nTakahashi can insert the character `A` at any position in this string any number of times.\n\nCan he change S into `AKIHABARA`?\n\nConstraints\n\n* 1 \\leq |S| \\leq 50\n* S consists of upperc... | [{"type": "stdin_stdout", "input": "ARAABHAIKAA", "output": "NO\n"}, {"type": "stdin_stdout", "input": "AR@ABHAIKAA", "output": "NO\n"}, {"type": "stdin_stdout", "input": "AR@ABHAIJAA", "output": "NO\n"}, {"type": "stdin_stdout", "input": "AAJIAHBA@RA", "output": "NO\n"}, {"type": "stdin_stdout", "input": "AAIJAHBA@RA"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N cats. We number them from 1 through N.\n\nEach of the cats wears a hat. Cat i says: \"there are exactly a_i different colors among the N - 1 hats worn by the cats except me.\"\n\nDetermine whether there exists... | [{"type": "stdin_stdout", "input": "5\n3 4 3 4 3", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "5\n3 4 3 3 3", "output": "No\n"}, {"type": "stdin_stdout", "input": "5\n4 3 4 3 4", "output": "No"}, {"type": "stdin_stdout", "input": "5\n3 3 3 3 3", "output": "No"}, {"type": "stdin_stdout", "input": "4\n1 0 -1 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHave you ever heard of the unit \"○○ tsubo\" that expresses the area of land? Since ancient times, one samurai has said the area for making rice to eat in a day.\n\nThere is a land of a [m] x b [m]. Enter a and b and cr... | [{"type": "stdin_stdout", "input": "101 -1", "output": "-30.5525011457\n"}, {"type": "stdin_stdout", "input": "111 -1", "output": "-33.5775012592\n"}, {"type": "stdin_stdout", "input": "-1 106", "output": "-32.0650012024\n"}, {"type": "stdin_stdout", "input": "26 -1", "output": "-7.86500029494\n"}, {"type": "stdin_stdo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTaro and Hanako decided to play hit-and-blow. The hit-and-blow rules are as follows.\n\n* Separated into questioners and respondents.\n* The questioner decides a 4-digit number (correct answer) that does not include dupli... | [{"type": "stdin_stdout", "input": "1234 10660\n1234 1354\n1234 1234\n1230 1023\n0123 1234\n0 0", "output": "1 0\n2 1\n4 0\n1 3\n0 3\n"}, {"type": "stdin_stdout", "input": "1234 10660\n1964 1354\n1234 1234\n1230 1023\n0123 1234\n0 0", "output": "1 0\n2 0\n4 0\n1 3\n0 3\n"}, {"type": "stdin_stdout", "input": "1234 10660... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOur master carpenter is designing a condominium called Bange Hills Mansion. The condominium is constructed by stacking up floors of the same height. The height of each floor is designed so that the total height of the sta... | [{"type": "stdin_stdout", "input": "000 12 208", "output": "197\n"}, {"type": "stdin_stdout", "input": "000 9 208", "output": "200\n"}, {"type": "stdin_stdout", "input": "000 4 120", "output": "117\n"}, {"type": "stdin_stdout", "input": "000 16 106", "output": "91\n"}, {"type": "stdin_stdout", "input": "000 26 106", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPeter loves any kinds of cheating. A week before ICPC, he broke into Doctor's PC and sneaked a look at all the problems that would be given in ICPC. He solved the problems, printed programs out, and brought into ICPC. Sin... | [{"type": "stdin_stdout", "input": "3\n10 20 47\n7\n56 26 62 143 38 80 7", "output": "117\n1108\n"}, {"type": "stdin_stdout", "input": "3\n10 20 47\n7\n56 44 62 143 38 80 7", "output": "117\n1210\n"}, {"type": "stdin_stdout", "input": "3\n10 20 47\n7\n56 44 62 143 38 80 6", "output": "117\n1203\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe configuration of three circles packed inside a triangle such that each circle is tangent to the other two circles and to two of the edges of the triangle has been studied by many mathematicians for more than two centu... | [{"type": "stdin_stdout", "input": "20 80 -40 -27 106 -20\n20 -20 120 -20 -40 80\n0 0 1 0 0 1\n0 -2 999 1 -999 1\n897 -916 847 -972 973 -925\n1626 1224 -999 -998 -998 -1471\n-419 -1751 999 -999 0 731\n-734 -999 999 -464 -464 1496\n979 -436 -955 -337 157 -439\n0 0 0 0 0 0", "output": "22.344342834616615 24.4028528446503... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPrincess'Gamble\n\nPrincess gambling\n\nEnglish text is not available in this practice contest.\n\nOne day, a brave princess in a poor country's tomboy broke the walls of her room, escaped from the castle, and entered the... | [{"type": "stdin_stdout", "input": "3 2 50\n1\n4\n2\n4 4 65\n1\n0\n3\n-1\n3 1 10\n8\n2\n1\n0 0 0", "output": "87\n-105\n123\n"}, {"type": "stdin_stdout", "input": "3 2 50\n1\n2\n3\n4 4 65\n-1\n2\n5\n1\n3 1 10\n8\n0\n1\n0 0 0", "output": "150\n245\n101\n"}, {"type": "stdin_stdout", "input": "3 2 50\n1\n2\n3\n4 4 65\n-1\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n<image>\n\nOne evening. As usual, when you were watching TV in the living room, my sister in fifth grade offered me a consultation. When I listened to the story, I couldn't understand the math problem that was presented a... | [{"type": "stdin_stdout", "input": "111 218 367", "output": "353374389\n"}, {"type": "stdin_stdout", "input": "124 218 367", "output": "817857665"}, {"type": "stdin_stdout", "input": "29 218 367", "output": "816094540\n"}, {"type": "stdin_stdout", "input": "29 430 669", "output": "643250629\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA: Taking a Seat-Taking a Seat-\n\nstory\n\nMr. A entered the classroom at the examination site to take an examination. However, Mr. A is a very nervous type. Therefore, depending on the situation, there may be seats that... | [{"type": "stdin_stdout", "input": "10 0\n--o-,\n,ox--\n-.x--\n--o-x\n--xpo", "output": "0\n"}, {"type": "stdin_stdout", "input": "10 0\n--o-,\n,ox--\n-.x--\n--o-x\n-.xpo", "output": "0\n"}, {"type": "stdin_stdout", "input": "5 5\n--o,-\n--xo-\n--x--\no---x\n--xoo", "output": "3\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have N items that you want to put them into a knapsack. Item i has value vi and weight wi.\n\nYou want to find a subset of items to put such that:\n\n* The total value of the items is as large as possible.\n* The item... | [{"type": "stdin_stdout", "input": "1 10\n15 4\n0 3\n4 1\n13 3", "output": "15\n"}, {"type": "stdin_stdout", "input": "1 10\n27 4\n0 0\n6 1\n13 3", "output": "27\n"}, {"type": "stdin_stdout", "input": "1 10\n39 4\n1 0\n6 1\n13 3", "output": "39\n"}, {"type": "stdin_stdout", "input": "1 10\n24 4\n0 3\n5 1\n13 5", "outpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMike is given a matrix A, N and M are numbers of rows and columns respectively. A1, 1 is the number in the top left corner. All the numbers in A are non-negative integers. He also has L pairs of integers (ik, jk). His tas... | [{"type": "stdin_stdout", "input": "3 2\n2 2\n4 1\n7 -1\n2\n1 2\n2 2", "output": "5\n"}, {"type": "stdin_stdout", "input": "3 2\n2 2\n7 0\n7 -1\n2\n1 2\n2 2", "output": "7\n"}, {"type": "stdin_stdout", "input": "3 2\n1 2\n3 5\n7 0\n2\n2 2\n2 2", "output": "10\n"}, {"type": "stdin_stdout", "input": "3 2\n1 2\n3 6\n7 0\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently, the Fair Nut has written k strings of length n, consisting of letters \"a\" and \"b\". He calculated c — the number of strings that are prefixes of at least one of the written strings. Every string was counted o... | [{"type": "stdin_stdout", "input": "100 1000000000\nbbabbaabbbaaaaabbabbbaaabbbbabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbaabbbbabaabbbabbaaaaabbbbaab\nbbabbaabbbaaaaabbabbbaaabbbbabbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaababbbabbbbaaaaabbaaaaaaaab\n", "output": "41073741883\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.