messages listlengths 1 1 | ground_truth stringlengths 88 726k | dataset stringclasses 2
values |
|---|---|---|
[
{
"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\n## The story you are about to hear is true\nOur cat, Balor, sadly died of cancer in 2015.\n\nWhile he was alive, the three neighborhood cats Lou, Mustache Cat, and Raoul all recognized our house and yard as Balor's territ... | [{"input": "[\"------------\", \"------------\", \"-L----------\", \"------------\", \"------------\", \"------------\"]\n10", "output": "[true]", "fn_name": "peaceful_yard"}, {"input": "[\"------------\", \"---M--------\", \"------------\", \"------------\", \"-------R----\", \"------------\"]\n6", "output": "[false]"... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWord $s$ of length $n$ is called $k$-complete if $s$ is a palindrome, i.e. $s_i=s_{n+1-i}$ for all $1 \\le i \\le n$; $s$ has a period of $k$, i.e. $s_i=s_{k+i}$ for all $1 \\le i \\le n-k$. \n\nFor example, \"abaaba\"... | [{"type": "stdin_stdout", "input": "4\n6 2\nabaaba\n6 3\nabaaba\n36 9\nhippopotomonstrosesquippedaliophobia\n21 7\nwudixiaoxingxingheclp\n", "output": "2\n0\n23\n16\n"}, {"type": "stdin_stdout", "input": "4\n6 2\nabaaba\n6 3\nabaaba\n36 9\nhippopotononstrosesquippedaliophobia\n21 7\nwudixiaoxingxingheclp\n", "output": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese, Russian and Vietnamese as well. \n\nThere are N students living in the dormitory of Berland State University. Each of them sometimes wants to use the kitchen, so the head of t... | [{"type": "stdin_stdout", "input": "2\n3\n1 10 16\n1 27 3\n3\n19 20 30\n15 10 20", "output": "2\n1\n"}, {"type": "stdin_stdout", "input": "2\n3\n1 10 15\n1 10 3\n3\n19 20 30\n15 5 20", "output": "2\n1\n"}, {"type": "stdin_stdout", "input": "2\n3\n1 10 29\n1 10 3\n2\n17 39 30\n15 5 20", "output": "2\n2\n"}, {"type": "st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N children, numbered 1, 2, ..., N.\n\nSnuke has decided to distribute x sweets among them. He needs to give out all the x sweets, but some of the children may get zero sweets.\n\nFor each i (1 \\leq i \\leq N), ... | [{"type": "stdin_stdout", "input": "4 1111\n-1 2 110 1000", "output": "4\n"}, {"type": "stdin_stdout", "input": "4 1111\n1 5 100 1000", "output": "3\n"}, {"type": "stdin_stdout", "input": "4 1101\n1 5 100 1000", "output": "3\n"}, {"type": "stdin_stdout", "input": "4 1101\n0 5 100 1000", "output": "3\n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEach day in Berland consists of $n$ hours. Polycarp likes time management. That's why he has a fixed schedule for each day — it is a sequence $a_1, a_2, \\dots, a_n$ (each $a_i$ is either $0$ or $1$), where $a_i=0$ if Pol... | [{"type": "stdin_stdout", "input": "23\n1 1 1 1 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "23\n1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "23\n1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1\n", "output": "2\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA prime number is an integer that is greater than 1 and can only be divided by itself or 1. For example, 2 is a prime number because it is divisible only by 2 and 1, but 12 is not a prime number because it is divisible by... | [{"type": "stdin_stdout", "input": "19\n10887", "output": "17 23\n10883 10889\n"}, {"type": "stdin_stdout", "input": "19\n17073", "output": "17 23\n17053 17077\n"}, {"type": "stdin_stdout", "input": "19\n30085", "output": "17 23\n30071 30089\n"}, {"type": "stdin_stdout", "input": "19\n21592", "output": "17 23\n21589 21... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn this Kata you must convert integers numbers from and to a negative-base binary system.\n\nNegative-base systems can accommodate all the same numbers as standard place-value systems, but both positive and negative numbe... | [{"input": "2147483648", "output": "[\"110000000000000000000000000000000\"]", "fn_name": "int_to_negabinary"}, {"input": "-2147483648", "output": "[\"10000000000000000000000000000000\"]", "fn_name": "int_to_negabinary"}, {"input": "-65536", "output": "[\"110000000000000000\"]", "fn_name": "int_to_negabinary"}, {"input"... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nImplement a function that adds two numbers together and returns their sum in binary. The conversion can be done before, or after the addition.\n\nThe binary number returned should be a string.\n\nWrite your solution by mo... | [{"input": "0\n2174483647", "output": "[\"10000001100110111111110010111111\"]", "fn_name": "add_binary"}, {"input": "4096\n1", "output": "[\"1000000000001\"]", "fn_name": "add_binary"}, {"input": "100\n100", "output": "[\"11001000\"]", "fn_name": "add_binary"}, {"input": "51\n12", "output": "[\"111111\"]", "fn_name": "... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven a string `s` of uppercase letters, your task is to determine how many strings `t` (also uppercase) with length equal to that of `s` satisfy the followng conditions:\n\n* `t` is lexicographical larger than `s`, and\n... | [{"input": "\"ABCD\"", "output": "[402230]", "fn_name": "solve"}, {"input": "\"XYZA\"", "output": "[34480]", "fn_name": "solve"}, {"input": "\"ABC\"", "output": "[16174]", "fn_name": "solve"}, {"input": "\"ZAZ\"", "output": "[25]", "fn_name": "solve"}, {"input": "\"XYZ\"", "output": "[5]", "fn_name": "solve"}] | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day alice and bob were playing with their old toys , they had moved all the rakes and drawers to in the pursuit of their childhood toys.\nFinally they found bunch of cubes ,with letters and digits written on it ,whic... | [{"type": "stdin_stdout", "input": "cosmoscosmoscosmoscosmoscosmos 30\no 2 h a v e\ng 3 c o o k\ns 3 i e s 5\no 2 h a v e\ng 3 c s o k\ns 3 i e m 5\no 2 h a v e\ng 3 c o o k\ns 3 i e s 5\no 2 h a v e\ng 3 c s o k\ns 3 i e m 5\no 2 h a v e\ng 3 c o o k\ns 3 i e s 5\no 2 h a v e\ng 3 c s o k\ns 3 i e m 5\no 2 h a v e\ng ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSort array by last character\n\nComplete the function to sort a given array or list by last character of elements.\n\n```if-not:haskell\nElement can be an integer or a string.\n```\n\n### Example:\n\n```\n['acvd', 'bcc'] ... | [{"input": "[\"asdf\", \"asdf\", \"14\", \"13\"]", "output": "[[\"13\", \"14\", \"asdf\", \"asdf\"]]", "fn_name": "sort_me"}, {"input": "[\"bsde\", \"asdf\", 14, \"13\"]", "output": "[[\"13\", 14, \"bsde\", \"asdf\"]]", "fn_name": "sort_me"}, {"input": "[\"asdf\", 14, \"13\", \"asdf\"]", "output": "[[\"13\", 14, \"asdf... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJoisino wants to evaluate the formula \"A op B\".\nHere, A and B are integers, and the binary operator op is either + or -.\nYour task is to evaluate the formula instead of her.\n\n-----Constraints-----\n - 1≦A,B≦10^9\n -... | [{"type": "stdin_stdout", "input": "-1 - 182", "output": "-183\n"}, {"type": "stdin_stdout", "input": "6 - 131", "output": "-125\n"}, {"type": "stdin_stdout", "input": "5 - 118", "output": "-113\n"}, {"type": "stdin_stdout", "input": "-1 + 112", "output": "111\n"}, {"type": "stdin_stdout", "input": "-1 - 15", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array of `n+1` integers `1` through `n`. In addition there is a single duplicate integer.\n\nThe array is unsorted.\n\nAn example valid array would be `[3, 2, 5, 1, 3, 4]`. It has the integers `1` through... | [{"input": "[8, 2, 6, 3, 7, 2, 5, 1, 4]", "output": "[2]", "fn_name": "find_dup"}, {"input": "[1, 3, 2, 5, 4, 5, 7, 6]", "output": "[5]", "fn_name": "find_dup"}, {"input": "[5, 4, 3, 2, 1, 1]", "output": "[1]", "fn_name": "find_dup"}, {"input": "[1, 1, 2, 3]", "output": "[1]", "fn_name": "find_dup"}, {"input": "[1, 2, ... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N rabbits on a number line. The rabbits are conveniently numbered 1 through N. The coordinate of the initial position of rabbit i is x_i.\n\nThe rabbits will now take exercise on the number line, by performing s... | [{"type": "stdin_stdout", "input": "5\n0 1 3 6 10\n3 10\n2 3 4", "output": "0.0\n3.0\n7.0\n8.0\n10.0"}, {"type": "stdin_stdout", "input": "5\n-1 1 3 -1 17\n3 10\n4 4 3", "output": "-1\n1\n3\n-1\n17\n"}, {"type": "stdin_stdout", "input": "5\n-1 -1 2 1 10\n3 10\n2 3 4", "output": "-1\n-2\n7\n7\n10\n"}, {"type": "stdin_st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou receive some random elements as a space-delimited string. Check if the elements are part of an ascending sequence of integers starting with 1, with an increment of 1 (e.g. 1, 2, 3, 4).\n\nReturn:\n\n* `0` if the eleme... | [{"input": "\"1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 91 92 93 94 95 96 97 98 99 100 101 102\"", "outp... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFangy the little walrus, as all the modern walruses, loves to communicate via text messaging. One day he faced the following problem: When he sends large texts, they are split into parts each containing n characters (whic... | [{"type": "stdin_stdout", "input": "123\nOjg CVJm qfE RnHislFds nNKKt TCPLWukqNGAsVBplYbTfq? VeYKjfFGTzXWA ydpVZLIImNub yApKnAHv iXQmqv GjQvxrnAgtfTApiQyCKtg. GdmapGwvI udRqxTbnzgnOUNZx slAuEuLGCJycZJvtCczQ vommS xuuT eIK! DOJeFEaubbz HYLGlIIlNKfyaJQKVN eFNnUvKKCQLXvGhwX gjmRscMkedELUlHq? aTbyMGB EofzX wcAEjyRQpxghWvXh... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Petya likes permutations a lot. Recently his mom has presented him permutation q1, q2, ..., qn of length n.\n\nA permutation a of length n is a sequence of integers a1, a2, ..., an (1 ≤ ai ≤ n), all integers there ... | [{"type": "stdin_stdout", "input": "55 28\n35 33 46 8 11 13 14 26 42 38 1 7 34 5 2 21 17 45 54 43 4 18 27 50 25 10 29 48 6 16 22 28 55 53 49 41 39 23 40 47 51 37 36 19 9 32 52 12 24 3 20 15 30 44 31\n5 52 24 16 7 27 48 21 18 8 14 28 29 12 47 53 17 31 54 41 30 55 10 35 25 4 38 46 23 34 33 3 15 6 11 20 9 26 42 37 43 45 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's denote correct match equation (we will denote it as CME) an equation $a + b = c$ there all integers $a$, $b$ and $c$ are greater than zero.\n\nFor example, equations $2 + 2 = 4$ (||+||=||||) and $1 + 2 = 3$ (|+||=||... | [{"type": "stdin_stdout", "input": "100\n928\n970\n950\n921\n1007\n974\n353\n999\n964\n920\n926\n942\n934\n918\n930\n901\n977\n961\n978\n962\n951\n909\n994\n953\n946\n993\n982\n922\n1789\n932\n904\n910\n991\n937\n963\n988\n278\n903\n956\n976\n967\n958\n902\n986\n960\n965\n940\n914\n955\n987\n952\n971\n939\n966\n938\n91... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is the hard version of this problem. The only difference is the constraint on $k$ — the number of gifts in the offer. In this version: $2 \\le k \\le n$.\n\nVasya came to the store to buy goods for his friends for th... | [{"type": "stdin_stdout", "input": "8\n5 6 2\n2 4 3 5 12\n5 5 2\n2 4 3 5 10\n3 1 1\n4 2 6\n5 2 5\n10 1 3 9 2\n2 10000 2\n10000 10000\n2 9999 2\n10000 10000\n4 6 4\n3 2 2 2\n5 5 3\n1 2 2 1 2\n", "output": "3\n2\n0\n1\n2\n0\n4\n5\n"}, {"type": "stdin_stdout", "input": "8\n5 6 2\n2 4 3 5 12\n5 5 2\n2 4 1 5 10\n3 1 1\n4 2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDetermine whether a text T includes a pattern P. Your program should answer for given queries consisting of P_i.\n\nConstraints\n\n* 1 ≤ length of T ≤ 1000000\n* 1 ≤ length of P_i ≤ 1000\n* 1 ≤ Q ≤ 10000\n* The input cons... | [{"type": "stdin_stdout", "input": "aabaaa\n4\nab\nba\nbb\nxyz", "output": "1\n1\n0\n0\n"}, {"type": "stdin_stdout", "input": "aabaaa\n4\nab\nba\nba\nxyz", "output": "1\n1\n1\n0\n"}, {"type": "stdin_stdout", "input": "aabaaa\n4\nba\nbb\nac\nzyx", "output": "1\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "aabaaa\n4\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCreate a function that takes a string and returns that\nstring with the first half lowercased and the last half uppercased.\n\neg: foobar == fooBAR\n\nIf it is an odd number then 'round' it up to find which letters to upp... | [{"input": "\"jAvASCript\"", "output": "[\"javasCRIPT\"]", "fn_name": "sillycase"}, {"input": "\"jabberwock\"", "output": "[\"jabbeRWOCK\"]", "fn_name": "sillycase"}, {"input": "\"codewars\"", "output": "[\"codeWARS\"]", "fn_name": "sillycase"}, {"input": "\"SCOTland\"", "output": "[\"scotLAND\"]", "fn_name": "sillycas... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently, chef Ciel often hears about lucky numbers.\n\nEverybody knows that lucky numbers are positive integers\nwhose decimal representation contains only the lucky digits 4 and 7.\nFor example, numbers 47, 744, 4 are l... | [{"type": "stdin_stdout", "input": "6\nklin 18\nCiel's Drink 174\nThe curry 2nd edition 677505\necis omelet 85855\nunagi 1\n She firsu amd last letters can eb a space 253", "output": "0\n"}, {"type": "stdin_stdout", "input": "6\nklin 18\nCiel's Drink 133\nThe curry 2nd edition 888888\necir omelet 85855\nunagi 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Petya likes to play very much. And most of all he likes to play the following game:\n\nHe is given a sequence of N integer numbers. At each step it is allowed to increase the value of any number by 1 or to decrease... | [{"type": "stdin_stdout", "input": "7\n1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000\n", "output": "6000000000\n"}, {"type": "stdin_stdout", "input": "7\n1000000000 -447358682 1000000000 -1000000000 1000000000 -1000000000 1000000000\n", "output": "5447358682\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLast year Bob earned by selling memory sticks. During each of n days of his work one of the two following events took place: \n\n * A customer came to Bob and asked to sell him a 2x MB memory stick. If Bob had such a sti... | [{"type": "stdin_stdout", "input": "50\nwin 596\nwin 1799\nwin 1462\nsell 460\nwin 731\nwin 723\nwin 731\nwin 329\nwin 838\nsell 728\nwin 728\nwin 460\nwin 723\nwin 1462\nwin 1462\nwin 460\nwin 329\nwin 1462\nwin 460\nwin 460\nwin 723\nwin 731\nwin 723\nwin 596\nwin 731\nwin 596\nwin 329\nwin 728\nwin 715\nwin 329\nwin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTwilight Sparkle was playing Ludo with her friends Rainbow Dash, Apple Jack and Flutter Shy. But she kept losing. Having returned to the castle, Twilight Sparkle became interested in the dice that were used in the game.\n... | [{"type": "stdin_stdout", "input": "100001 100000\n", "output": "100000.41802404786\n"}, {"type": "stdin_stdout", "input": "50000 100000\n", "output": "49999.843487110797\n"}, {"type": "stdin_stdout", "input": "99999 100000\n", "output": "99998.418042461126\n"}, {"type": "stdin_stdout", "input": "100000 100000\n", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nComplete the function that determines the score of a hand in the card game [Blackjack](https://en.wikipedia.org/wiki/Blackjack) (aka 21).\n\nThe function receives an array of strings that represent each card in the hand (... | [{"input": "[\"A\", \"2\", \"A\", \"9\", \"9\"]", "output": "[22]", "fn_name": "score_hand"}, {"input": "[\"A\", \"2\", \"A\", \"3\", \"A\"]", "output": "[18]", "fn_name": "score_hand"}, {"input": "[\"A\", \"A\", \"A\", \"J\"]", "output": "[13]", "fn_name": "score_hand"}, {"input": "[\"5\", \"4\", \"A\", \"A\"]", "outp... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Little Elephant from the Zoo of Lviv likes listening to music.\nThere are N songs, numbered from 1 to N, in his MP3-player. The song i is described by a pair of integers B_{i} and L_{i} - the band (represented as inte... | [{"type": "stdin_stdout", "input": "2\n3\n1 1\n2 2\n-1 2\n3\n1 3\n1 3\n4 2", "output": "11\n14\n"}, {"type": "stdin_stdout", "input": "2\n3\n1 1\n2 3\n-1 2\n3\n0 3\n1 3\n4 2", "output": "14\n17\n"}, {"type": "stdin_stdout", "input": "2\n3\n1 3\n2 3\n4 2\n3\n2 1\n1 2\n2 11", "output": "17\n27\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarpus is an amateur programmer. Now he is analyzing a friend's program. He has already found there the function rangeIncrement(l, r), that adds 1 to each element of some array a for all indexes in the segment [l, r].... | [{"type": "stdin_stdout", "input": "20\n5 9 11 12 13 13 13 13 13 13 13 13 13 6 12 11 11 8 6 4\n", "output": "19\n5 13\n4 13\n3 13\n3 13\n2 13\n2 13\n2 13\n15 15\n15 17\n15 17\n15 17\n15 18\n15 18\n2 19\n1 19\n1 20\n1 20\n1 20\n1 20\n"}, {"type": "stdin_stdout", "input": "20\n5 9 11 12 13 13 13 13 13 13 13 13 13 6 12 11... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Task\nYour task is to find the sum for the range `0 ... m` for all powers from `0 ... n.\n\n# Example\n\n For `m = 2, n = 3`, the result should be `20`\n \n `0^0+1^0+2^0 + 0^1+1^1+2^1 + 0^2+1^2+2^2 + 0^3+1^3+2^3 = 20`\n... | [{"input": "10\n9", "output": "[1762344782]", "fn_name": "S2N"}, {"input": "567\n2", "output": "[61083856]", "fn_name": "S2N"}, {"input": "300\n2", "output": "[9090501]", "fn_name": "S2N"}, {"input": "37\n4", "output": "[15335280]", "fn_name": "S2N"}, {"input": "36\n4", "output": "[13409059]", "fn_name": "S2N"}, {"inpu... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer $n$. You have to calculate the number of binary (consisting of characters 0 and/or 1) strings $s$ meeting the following constraints.\n\nFor every pair of integers $(i, j)$ such that $1 \\le i \\le... | [{"type": "stdin_stdout", "input": "20\n1 1 2 0 0 2 0 2 2 2 0 0 2 2 2 0 2 0 0 0\n0 0 0 0 0 0 0 0 0 2 0 2 0 0 0 2 0 0 0\n0 1 2 0 2 2 2 2 0 0 2 0 2 2 0 2 2 2\n1 2 2 2 2 2 2 2 0 2 2 2 0 2 2 2 2\n0 2 0 0 2 2 2 0 2 2 0 0 2 0 0 0\n1 1 1 0 2 0 0 0 0 0 2 0 2 0 2\n1 0 1 2 2 2 0 0 2 0 0 0 2 0\n0 1 2 0 0 0 0 0 0 0 0 2 0\n0 0 0 0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has got a magic matrix a of size n × m. The rows of the matrix are numbered from 1 to n from top to bottom, the columns are numbered from 1 to m from left to right. Let a_{ij} be the element in the intersection of t... | [{"type": "stdin_stdout", "input": "13 8\n3 2 1 4 8 2 5 9\n8 2 10 8 9 3 2 8\n3 6 8 3 11 7 6 4\n4 2 10 5 7 5 1 3\n10 9 3 6 4 10 10 2\n10 3 7 1 4 5 7 10\n5 3 1 6 1 10 3 6\n10 7 6 8 1 8 4 1\n7 8 1 10 8 5 3 6\n3 8 10 6 7 6 5 5\n1 5 9 8 4 8 5 10\n6 9 10 7 5 10 5 4\n3 9 2 4 8 2 5 4\n8 1\n", "output": "140693813\n"}, {"type":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTo satisfy his love of matching socks, Phoenix has brought his $n$ socks ($n$ is even) to the sock store. Each of his socks has a color $c_i$ and is either a left sock or right sock.\n\nPhoenix can pay one dollar to the s... | [{"type": "stdin_stdout", "input": "4\n6 3 3\n1 2 3 2 2 2\n6 2 4\n1 1 2 2 2 2\n6 5 1\n6 5 4 3 2 1\n4 0 4\n4 4 4 3\n", "output": "\n2\n3\n5\n3\n"}, {"type": "stdin_stdout", "input": "4\n6 3 3\n1 2 3 2 2 2\n6 2 4\n1 1 2 2 2 2\n6 5 1\n6 5 4 3 2 1\n4 0 4\n4 4 4 3\n", "output": "2\n3\n5\n3\n"}, {"type": "stdin_stdout", "inp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCreate a function which answers the question \"Are you playing banjo?\". \nIf your name starts with the letter \"R\" or lower case \"r\", you are playing banjo!\n\nThe function takes a name as its only argument, and retu... | [{"input": "\"bravo\"", "output": "[\"bravo does not play banjo\"]", "fn_name": "areYouPlayingBanjo"}, {"input": "\"Adam\"", "output": "[\"Adam does not play banjo\"]", "fn_name": "areYouPlayingBanjo"}, {"input": "\"Paul\"", "output": "[\"Paul does not play banjo\"]", "fn_name": "areYouPlayingBanjo"}, {"input": "\"Ring... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the good old Hachioji railroad station located in the west of Tokyo, there are several parking lines, and lots of freight trains come and go every day.\n\nAll freight trains travel at night, so these trains containing ... | [{"type": "stdin_stdout", "input": "3 5\n0W 1W\n0W 2W\n0W 2E\n0E 1E\n1E 2E\naabbcdcee\n-\n-\n-\n-\nbbaadeecc\n3 3\n0E 1W\n1E 2W\n2E 0W\naabb\nbbcc\naa\nbbbb\ncc\naaaa\n3 4\n0E 1W\n0E 2E\n1E 2W\n2E 0W\nababab\n-\n-\naaabbb\n-\n-\n0 0", "output": "5\n2\n5\n"}, {"type": "stdin_stdout", "input": "3 5\n0W 1W\n0W 2W\n0W 2E\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarpus got an internship in one well-known social network. His test task is to count the number of unique users who have visited a social network during the day. Polycarpus was provided with information on all user re... | [{"type": "stdin_stdout", "input": "10 3 30000\n00:06:54\n00:42:06\n03:49:45\n04:38:35\n05:33:30\n05:51:46\n10:46:34\n14:34:59\n14:40:06\n14:53:13\n", "output": "6\n1\n2\n3\n3\n3\n3\n4\n5\n6\n6\n"}, {"type": "stdin_stdout", "input": "10 3 30000\n00:06:54\n00:42:06\n03:49:45\n04:38:35\n05:33:30\n05:51:56\n10:46:34\n14:3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi has decided to make a Christmas Tree for the Christmas party in AtCoder, Inc.\n\nA Christmas Tree is a tree with N vertices numbered 1 through N and N-1 edges, whose i-th edge (1\\leq i\\leq N-1) connects Vertex... | [{"type": "stdin_stdout", "input": "10\n1 2\n1 3\n1 4\n2 5\n6 10\n6 7\n7 8\n4 9\n10 5", "output": "2 6\n"}, {"type": "stdin_stdout", "input": "10\n1 2\n1 3\n3 4\n2 5\n6 5\n6 7\n7 8\n5 9\n10 5", "output": "2 5\n"}, {"type": "stdin_stdout", "input": "10\n1 2\n1 3\n3 4\n2 5\n7 5\n6 7\n7 8\n5 9\n10 5", "output": "3 5\n"}, ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSasha likes programming. Once, during a very long contest, Sasha decided that he was a bit tired and needed to relax. So he did. But since Sasha isn't an ordinary guy, he prefers to relax unusually. During leisure time Sa... | [{"type": "stdin_stdout", "input": "2\n114243 620721\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "2\n182166 620721\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "2\n182166 383547\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "2\n60202 951227\n", "output": "0\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLaura really hates people using acronyms in her office and wants to force her colleagues to remove all acronyms before emailing her. She wants you to build a system that will edit out all known acronyms or else will notif... | [{"input": "\"BRB I need to go into a KPI meeting before EOD\"", "output": "[\"BRB is an acronym. I do not like acronyms. Please remove them from your email.\"]", "fn_name": "acronym_buster"}, {"input": "\"The advert needs a CTA. NRN before EOD.\"", "output": "[\"The advert needs a call to action. No reply necessary be... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInnokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Inno... | [{"type": "stdin_stdout", "input": "10\nIJGDI KHB\nHBI CKKCG\nFHE GCAA\nEDCGH HHICE\nGFH AIHD\nHED KIK\nDCK BCFIJ\nFFIHE FDB\nJGB AKKI\nIJD CAG\n", "output": "YES\nIJG\nHBI\nFHE\nEDC\nGFH\nHED\nDCK\nFFI\nJGB\nIJD\n"}, {"type": "stdin_stdout", "input": "10\nIJGDI KHB\nHBI CKKCG\nFHE GCAA\nEDCGH HHICE\nGFH AIHD\nHED KIK\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a function that calculates the *least common multiple* of its arguments; each argument is assumed to be a non-negative integer. In the case that there are no arguments (or the provided array in compiled languages is... | [{"input": "17\n20\n4\n15\n4\n18\n12\n14\n20\n19\n2\n14\n13\n7", "output": "[5290740]", "fn_name": "lcm"}, {"input": "5\n6\n7\n9\n6\n9\n18\n4\n5\n15\n15\n10\n17\n7", "output": "[21420]", "fn_name": "lcm"}, {"input": "11\n13\n4\n5\n17\n4\n10\n13\n16\n13\n13", "output": "[194480]", "fn_name": "lcm"}, {"input": "3\n9\n9\n... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nShort Phrase\n\nA Short Phrase (aka. Tanku) is a fixed verse, inspired by Japanese poetry Tanka and Haiku. It is a sequence of words, each consisting of lowercase letters 'a' to 'z', and must satisfy the following conditi... | [{"type": "stdin_stdout", "input": "9\ndo\nhte\nbest\nand\nenjoy\ntoday\nat\nacm\nicpc\n14\noh\nyes\nby\nfar\nit\nis\nwow\nso\nbad\nto\nme\nyou\nknow\nhey\n15\nabcde\nfghijkl\nmnopq\nrstuvwx\nyzz\nabcde\nfghijkl\nmnopq\nrstuvwx\nyz\nabcde\nfghijkl\nmnopq\nrstuvwx\nyz\n0", "output": "1\n2\n6\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou will receive 5 points for solving this problem.\n\nManao has invented a new operation on strings that is called folding. Each fold happens between a pair of consecutive letters and places the second part of the string... | [{"type": "stdin_stdout", "input": "LEHLLLLLLHAFGEGLLHAFDLHHLLLLLDGGEHGGHLLLLLLLLDFLCBLLEFLLCBLLCGLEDLGGLECLDGLEHLLLGELLLEGLLLLGDLLLDALD\n", "output": "49\n"}, {"type": "stdin_stdout", "input": "LEHLLLLLLHAFGEGLLHAFDLHHMLLLLDGGEHGGHLLLLLLLLDFLCBLLEFLLCBLLCGLEDLGGLECLDGLEHLLLGELLLEGLLLLGDLLLDALD\n", "output": "47\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi has an N \\times M grid, with N horizontal rows and M vertical columns. Determine if we can place A 1 \\times 2 tiles (1 vertical, 2 horizontal) and B 2 \\times 1 tiles (2 vertical, 1 horizontal) satisfying the ... | [{"type": "stdin_stdout", "input": "44 6 13 3", "output": "YES\n^^^<>.\nvvv<>.\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\nYou are given a n × m field consisting only of periods ('.') and asterisks ('*'). Your task is to count all right triangles with two sides parallel to the square sides, whose vertices are in the centers of '*'-cells. A ri... | [{"type": "stdin_stdout", "input": "14 29\n**.*************..*.*********\n**..****.*********.**.*.****.\n********.**..*..*...*....**..\n****.**.***.*.***..*..***.*..\n***.****.***..*.***.*.****.*.\n*.*..***.***********.*.*.****\n****.*.***.*..****.**.**..***\n.*******..**...***.*.********\n*...**********...**...*.***.*... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers $a$ and $m$. Calculate the number of integers $x$ such that $0 \\le x < m$ and $\\gcd(a, m) = \\gcd(a + x, m)$.\n\nNote: $\\gcd(a, b)$ is the greatest common divisor of $a$ and $b$.\n\n\n-----In... | [{"type": "stdin_stdout", "input": "10\n164 252\n94 226\n38 254\n196 255\n35 256\n174 257\n251 495\n246 527\n9 260\n149 261\n", "output": "36\n112\n126\n128\n128\n256\n240\n480\n96\n168\n"}, {"type": "stdin_stdout", "input": "10\n164 252\n94 253\n171 254\n196 255\n35 256\n174 257\n251 258\n239 259\n9 260\n98 261\n", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMelody Pond was stolen from her parents as a newborn baby by Madame Kovarian, to become a weapon of the Silence in their crusade against the Doctor. Madame Kovarian changed Melody's name to River Song, giving her a new id... | [{"type": "stdin_stdout", "input": "1219679533107\n", "output": "1 609839766552\n"}, {"type": "stdin_stdout", "input": "1044191868535\n", "output": "1 522095934266\n"}, {"type": "stdin_stdout", "input": "1041721920937\n", "output": "1 520860960467\n"}, {"type": "stdin_stdout", "input": "1025662663437\n", "output": "1 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis problem is different with hard version only by constraints on total answers length\n\nIt is an interactive problem\n\nVenya joined a tour to the madhouse, in which orderlies play with patients the following game. Ord... | [{"type": "stdin_stdout", "input": "100\noooooooooooooooooooooooooooooooooooooooooooooooooovvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvwvvvvvvvvvvvvvvvv\n", "output": "? 1 100\n? 1 99\n! 8aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"}, {"type": "stdin_stdout", "input": "100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEveryone knows that computers become faster and faster. Recently Berland scientists have built a machine that can move itself back in time!\n\nMore specifically, it works as follows. It has an infinite grid and a robot wh... | [{"type": "stdin_stdout", "input": "2\n236675740 1140949963\n555555555 555555555\n", "output": "ds10utsusdtedslss10utsusdtedslss10utsusdtedslss10utsusdtedslss10utsusdtedslss10utsusdtedslss10utsusdtedslss10utsusdtedslss10utsusdtedslss10utsusdtedslss10utsusdtedslss10utsusdtedslss10utsusdtedslss10utsusdtedslss10utsusdteds... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA camera you have accidentally left in a desert has taken an interesting photo. The photo has a resolution of n pixels width, and each column of this photo is all white or all black. Thus, we can represent the photo as a ... | [{"type": "stdin_stdout", "input": "100\n1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100\n1 1 1 1 0 0 0 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ benches in the Berland Central park. It is known that $a_i$ people are currently sitting on the $i$-th bench. Another $m$ people are coming to the park and each of them is going to have a seat on some bench ... | [{"type": "stdin_stdout", "input": "100\n3241\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn his trip to Luxor and Aswan, Sagheer went to a Nubian market to buy some souvenirs for his friends and relatives. The market has some strange rules. It contains n different items numbered from 1 to n. The i-th item has... | [{"type": "stdin_stdout", "input": "90 61394040\n2480 6212 4506 829 8191 797 5336 6722 3178 1007 5849 3061 3588 6684 5983 5452 7654 5321 660 2569 2809 2179 679 4858 6887 2580 6880 6120 4159 5542 4999 8703 2386 8221 7046 1229 1662 4542 7089 3548 4298 1973 1854 2473 5507 241 359 5248 7907 5201 9624 4596 1723 2622 4800 47... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are many anime that are about \"love triangles\": Alice loves Bob, and Charlie loves Bob as well, but Alice hates Charlie. You are thinking about an anime which has n characters. The characters are labeled from 1 to... | [{"type": "stdin_stdout", "input": "28567 13\n28079 24675 1\n18409 26720 1\n980 10815 1\n20794 16571 1\n7376 19861 1\n10805 706 1\n4255 16391 1\n27376 18263 1\n10019 28444 1\n6574 28053 1\n5036 16610 1\n3543 7122 1\n512 9554 1\n", "output": "928433852\n"}, {"type": "stdin_stdout", "input": "28567 13\n28079 24675 1\n184... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Petya loves looking for numbers' divisors. One day Petya came across the following problem:\n\nYou are given n queries in the form \"xi yi\". For each query Petya should count how many divisors of number xi divide ... | [{"type": "stdin_stdout", "input": "20\n68260 0\n819 1\n54174 1\n20460 1\n25696 2\n81647 4\n17736 4\n91307 5\n5210 4\n87730 2\n4653 8\n11044 6\n15776 4\n17068 7\n73738 7\n36004 12\n83183 7\n75700 12\n84270 14\n16120 5\n", "output": "12\n11\n6\n44\n18\n1\n9\n7\n6\n12\n8\n8\n21\n3\n14\n3\n3\n13\n18\n26\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian. \n\nOnce Chef decided to divide the tangerine into several parts. At first, he numbered tangerine's segments from 1 to n in the clockwise order starting from some... | [{"type": "stdin_stdout", "input": "2\n10 3 2\n1 5\n5 5\n6 10\n1 5\n6 10\n10 3 0\n4 5\n10 1\n12 18\n1 10", "output": "Yes\nYes\n"}, {"type": "stdin_stdout", "input": "2\n10 3 2\n1 5\n5 5\n6 10\n1 5\n6 10\n10 3 0\n4 5\n10 1\n12 9\n1 10", "output": "Yes\nYes\n"}, {"type": "stdin_stdout", "input": "2\n10 3 2\n1 4\n10 5\n6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has a beautiful garden where wonderful fruit trees grow and yield fantastic harvest every year. But lately thieves started to sneak into the garden at nights and steal the fruit too often. Vasya can’t spend the nigh... | [{"type": "stdin_stdout", "input": "10 10\n1 0 1 1 1 1 1 1 1 1\n1 1 1 0 1 1 0 1 1 1\n1 0 1 0 1 1 1 1 0 1\n1 1 0 1 1 1 0 0 0 1\n0 1 0 1 1 1 0 1 1 1\n1 0 1 0 1 0 1 1 1 1\n1 1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 0 1 1\n1 1 1 1 0 1 1 1 1 1\n0 1 1 1 1 0 1 1 0 1\n10 10\n", "output": "79\n"}, {"type": "stdin_stdout", "input": "10 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn this Kata, you will be given two positive integers `a` and `b` and your task will be to apply the following operations:\n\n```\ni) If a = 0 or b = 0, return [a,b]. Otherwise, go to step (ii);\nii) If a ≥ 2*b, set a = a... | [{"input": "19394\n19394", "output": "[[19394, 19394]]", "fn_name": "solve"}, {"input": "8796203\n7556", "output": "[[1019, 1442]]", "fn_name": "solve"}, {"input": "7\n11", "output": "[[7, 11]]", "fn_name": "solve"}, {"input": "6\n19", "output": "[[6, 7]]", "fn_name": "solve"}, {"input": "22\n5", "output": "[[0, 1]]", ... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string $s$ of length $n$, which consists only of the first $k$ letters of the Latin alphabet. All letters in string $s$ are uppercase.\n\nA subsequence of string $s$ is a string that can be derived from $s... | [{"type": "stdin_stdout", "input": "76 26\nABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYABCDEFGHIJKLMNOPQRSTUVWXY\n", "output": "26\n"}, {"type": "stdin_stdout", "input": "76 26\nABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYABCDEFGHIJKLMNOPQRSTUVWXY\n", "output": "26"}, {"type": "stdin_stdout", "input": "22... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Morse code, an letter of English alphabet is represented as a string of some length from $1$ to $4$. Moreover, each Morse code representation of an English letter contains only dots and dashes. In this task, we will re... | [{"type": "stdin_stdout", "input": "100\n1\n0\n0\n1\n0\n0\n1\n1\n0\n0\n1\n0\n0\n0\n0\n0\n1\n1\n0\n0\n0\n1\n1\n1\n1\n0\n0\n1\n1\n0\n1\n1\n0\n1\n1\n1\n1\n0\n0\n0\n0\n0\n0\n1\n1\n0\n0\n1\n1\n1\n1\n0\n1\n0\n0\n0\n1\n0\n0\n1\n0\n1\n1\n1\n1\n1\n0\n1\n0\n0\n1\n1\n0\n0\n1\n0\n0\n1\n1\n0\n0\n0\n1\n0\n0\n0\n0\n0\n0\n1\n1\n0\n0\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCreate a program that reads the attendance numbers of students in a class and the data that stores the ABO blood group and outputs the number of people for each blood type. There are four types of ABO blood types: A, B, A... | [{"type": "stdin_stdout", "input": "1,B\n2,A\n3,B\n4,AB\n5,B\n5,O\n7,A\n8,O\n9,AB\n10,A\n11,A\n12,B\n13,AB\n14,A", "output": "5\n4\n3\n2\n"}, {"type": "stdin_stdout", "input": "1,B\n2,B\n3,B\n4,AB\n5,B\n6,O\n7,A\n8,O\n9,AB\n10,A\n11,A\n12,B\n13,AB\n14,A", "output": "4\n5\n3\n2\n"}, {"type": "stdin_stdout", "input": "1,... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nComplete the function to determine the number of bits required to convert integer `A` to integer `B` (where `A` and `B` >= 0)\n\nThe upper limit for `A` and `B` is 2^(16), `int.MaxValue` or similar.\n\nFor example, you ca... | [{"input": "312312312\n5645657", "output": "[13]", "fn_name": "convert_bits"}, {"input": "43\n2009989843", "output": "[17]", "fn_name": "convert_bits"}, {"input": "127681\n127681", "output": "[0]", "fn_name": "convert_bits"}, {"input": "31\n14", "output": "[2]", "fn_name": "convert_bits"}, {"input": "7\n17", "output": ... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n## Witamy!\n\nYou are in Poland and want to order a drink. You need to ask \"One beer please\": \"Jedno piwo poprosze\"\n\n``` java\nTranslator.orderingBeers(1) = \"Jedno piwo poprosze\"\n```\n\nBut let's say you are real... | [{"input": "99", "output": "[\"Dziewiecdziesiat dziewiec piw poprosze\"]", "fn_name": "ordering_beers"}, {"input": "98", "output": "[\"Dziewiecdziesiat osiem piw poprosze\"]", "fn_name": "ordering_beers"}, {"input": "44", "output": "[\"Czterdziesci cztery piwa poprosze\"]", "fn_name": "ordering_beers"}, {"input": "21",... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem statement\n\nMeatishi can increase or decrease the number of fingers.\nThere are n buns in front of Nikunishi-kun.\nMeatishi is trying to count the number of steamed buns by breaking his finger.\nThere are only tw... | [{"type": "stdin_stdout", "input": "1237235", "output": "21\n"}, {"type": "stdin_stdout", "input": "140502", "output": "18\n"}, {"type": "stdin_stdout", "input": "299812", "output": "19\n"}, {"type": "stdin_stdout", "input": "763679", "output": "20\n"}, {"type": "stdin_stdout", "input": "17679", "output": "15\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs we all know Barney's job is \"PLEASE\" and he has not much to do at work. That's why he started playing \"cups and key\". In this game there are three identical cups arranged in a line from left to right. Initially key... | [{"type": "stdin_stdout", "input": "12\n254904759290707697 475737283258450340 533306428548398547 442127134828578937 779740159015946254 272877594683860919 93000149670491971 349640818793278778 498293278222136720 551099726729989816 149940343283925029 1677751211246811281\n", "output": "144527324/433581971\n"}, {"type": "st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is an ice cream shop named Ten Ice Cream. At this store, we always have 10 types of ice cream on the shelves. The store manager creates a daily graph showing how well ice cream is selling for reference in product de... | [{"type": "stdin_stdout", "input": "15\n2\n6\n7\n0\n1\n9\n8\n7\n4\n8\n9\n1\n9\n4\n2\n1\n2\n1\n0\n0", "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"}, {"type": "stdin_stdout", "input": "15\n1\n6\n7\n0\n1\n9\n8\n7\n4\n8\n9\n1\n9\n4\n2\n1\n2\n1\n0\n0", "output... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA string is called square if it is some string written twice in a row. For example, the strings \"aa\", \"abcabc\", \"abab\" and \"baabaa\" are square. But the strings \"aaa\", \"abaaab\" and \"abcdabc\" are not square.\n... | [{"type": "stdin_stdout", "input": "10\na\naa\naaa\naaaa\nabab\nabcabc\nabacaba\nxxyy\nxyyx\nxyxy\n", "output": "NO\nYES\nNO\nYES\nYES\nYES\nNO\nNO\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "10\na\naa\naaa\naaaa\nabab\nabcabc\nabacaba\nyxxy\nxyyx\nxyxy\n", "output": "NO\nYES\nNO\nYES\nYES\nYES\nNO\nNO\nNO\nYES\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have to write two methods to *encrypt* and *decrypt* strings.\nBoth methods have two parameters:\n```\n1. The string to encrypt/decrypt\n2. The Qwerty-Encryption-Key (000-999) \n```\n\nThe rules are very easy:\n```\nT... | [{"input": "\"Do the kata Kobayashi Maru Test. Endless fun and excitement when finding a solution.\"\n583", "output": "[\"Sr pgi jlpl Jr,lqlage Zlow Piapc I.skiaa dw. l.s ibnepizi.p ugi. de.se.f l arkwper.c\"]", "fn_name": "encrypt"}, {"input": "\"This is a test.\"\n348", "output": "[\"Iaqh qh g iyhi,\"]", "fn_name": "... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants h... | [{"type": "stdin_stdout", "input": "100\n98 52 63 2 18 96 31 58 84 40 41 45 66 100 46 71 26 48 81 20 73 91 68 76 13 93 17 29 64 95 79 21 55 75 19 85 54 51 89 78 15 87 43 59 36 1 90 35 65 56 62 28 86 5 82 49 3 99 33 9 92 32 74 69 27 22 77 16 44 94 34 6 57 70 23 12 61 25 8 11 67 47 83 88 10 14 30 7 97 60 42 37 24 38 53 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA robber has attempted to rob a bank but failed to complete his task. However, he had managed to open all the safes.\n\nOleg the bank client loves money (who doesn't), and decides to take advantage of this failed robbery ... | [{"type": "stdin_stdout", "input": "8 3 13\n12\n3 3 3 12 7 6 10 1 8 8 7 12\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "8 3 13\n12\n3 3 3 8 7 6 10 1 8 8 7 12\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "8 5 13\n12\n3 3 3 8 7 6 10 1 7 8 7 11\n", "output": "8\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMonocarp is playing yet another computer game. In this game, his character has to kill a dragon. The battle with the dragon lasts $100^{500}$ seconds, during which Monocarp attacks the dragon with a poisoned dagger. The $... | [{"type": "stdin_stdout", "input": "4\n2 13\n1 5\n3 11\n1 4 20\n5 3\n1 2 4 8 7\n4 1000\n5 25 95 1337\n", "output": "9\n4\n1\n455\n"}, {"type": "stdin_stdout", "input": "4\n2 1\n1 5\n3 10\n2 4 10\n5 3\n1 2 4 5 7\n4 1000\n3 25 124 1337\n", "output": "1\n4\n1\n440\n"}, {"type": "stdin_stdout", "input": "4\n2 5\n1 5\n3 10\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nChampernown constant is an irrational number represented in decimal by \"0.\" followed by concatenation of all positive integers in the increasing order. The first few digits of this constant are: 0.123456789101112...\n\n... | [{"type": "stdin_stdout", "input": "11 17\n11 14\n0 0", "output": "01112131415161718\n01112131415161\n"}, {"type": "stdin_stdout", "input": "4 7\n2 26\n0 0", "output": "4567891\n23456789101112131415161718\n"}, {"type": "stdin_stdout", "input": "2 5\n1 26\n0 0", "output": "23456\n12345678910111213141516171\n"}, {"type":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob love playing one-dimensional battle ships. They play on the field in the form of a line consisting of n square cells (that is, on a 1 × n table).\n\nAt the beginning of the game Alice puts k ships on the fie... | [{"type": "stdin_stdout", "input": "50 7 3\n50\n17 47 1 12 21 25 6 5 49 27 34 8 16 38 11 44 48 9 2 20 3 22 33 23 36 41 15 35 31 30 50 7 45 42 37 29 14 26 24 46 19 4 10 28 18 43 32 39 40 13\n", "output": "19\n"}, {"type": "stdin_stdout", "input": "50 1 1\n50\n1 13 21 37 30 48 23 19 6 49 36 14 9 24 44 10 41 28 20 2 15 11... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe whole world got obsessed with robots,and to keep pace with the progress, great Berland's programmer Draude decided to build his own robot. He was working hard at the robot. He taught it to walk the shortest path from ... | [{"type": "stdin_stdout", "input": "RLRRRRRDRRDRRRRDLRRRRRRRDLRLDDLRRRRLDLDRDRRRRDRDRDRDLRRURRLRRRRDRRRRRRRRLDDRLRRDRRRRRRRDRDRLDRDDDRDR\n", "output": "BUG\n"}, {"type": "stdin_stdout", "input": "DDDDDDDDDDDDDDDDDDDDDDDDDLLLLLLLLLLLLLLLLLLLLLLLLRRRRRRRRRRRRRRRRRRRRRRRRRRRUUUUUUUUUUUUUUUUUUUUUUUU\n", "output": "BUG\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a bookshelf which can fit $n$ books. The $i$-th position of bookshelf is $a_i = 1$ if there is a book on this position and $a_i = 0$ otherwise. It is guaranteed that there is at least one book on the bookshelf.\n... | [{"type": "stdin_stdout", "input": "5\n7\n0 0 1 0 1 0 1\n3\n1 0 0\n5\n1 1 0 0 1\n6\n1 0 0 0 0 1\n5\n1 1 0 1 1\n", "output": "2\n0\n2\n4\n1\n"}, {"type": "stdin_stdout", "input": "5\n7\n0 0 1 0 1 0 1\n3\n1 0 0\n5\n1 1 0 1 1\n6\n1 0 0 0 0 1\n5\n1 1 0 1 1\n", "output": "2\n0\n1\n4\n1\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp took $n$ videos, the duration of the $i$-th video is $a_i$ seconds. The videos are listed in the chronological order, i.e. the $1$-st video is the earliest, the $2$-nd video is the next, ..., the $n$-th video is ... | [{"type": "stdin_stdout", "input": "6 3\n3 3 1 4 1 6\n", "output": "Yes\n2 3 1 \n"}, {"type": "stdin_stdout", "input": "6 3\n3 3 1 4 1 6\n", "output": "Yes\n2 3 1 "}, {"type": "stdin_stdout", "input": "3 3\n1 1 1\n", "output": "Yes\n1 1 1 \n"}, {"type": "stdin_stdout", "input": "3 3\n1 1 1\n", "output": "Yes\n1 1 1 "},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya writes his own library for building graphical user interface. Vasya called his creation VTK (VasyaToolKit). One of the interesting aspects of this library is that widgets are packed in each other. \n\nA widget is so... | [{"type": "stdin_stdout", "input": "20\nVBox hykl\nVBox enwv\nenwv.pack(hykl)\nVBox dlepf\ndlepf.pack(hykl)\nenwv.set_border(30)\nWidget mjrrik(54,21)\nhykl.set_border(2)\ndlepf.set_border(22)\nenwv.set_border(3)\nenwv.pack(dlepf)\ndlepf.pack(mjrrik)\nhykl.set_spacing(96)\nenwv.set_border(32)\ndlepf.set_border(72)\nWid... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMikhail the Freelancer dreams of two things: to become a cool programmer and to buy a flat in Moscow. To become a cool programmer, he needs at least p experience points, and a desired flat in Moscow costs q dollars. Mikha... | [{"type": "stdin_stdout", "input": "10 468662 93838\n589910 727627\n279516 867207\n470524 533177\n467834 784167\n295605 512137\n104422 629804\n925609 728473\n922365 964620\n998983 958315\n425628 935048\n", "output": "0.4691391144794256\n"}, {"type": "stdin_stdout", "input": "10 326330 93838\n589910 727627\n279516 86720... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWell, the series which Stepan watched for a very long time, ended. In total, the series had n episodes. For each of them, Stepan remembers either that he definitely has watched it, or that he definitely hasn't watched it,... | [{"type": "stdin_stdout", "input": "100 100\n????????????????????????????????????????????????????????????????????????????????????????????????????\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100 100\n????????????????????????????????????????????????????????????????????????????????????????????????????\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet $LCM(x, y)$ be the minimum positive integer that is divisible by both $x$ and $y$. For example, $LCM(13, 37) = 481$, $LCM(9, 6) = 18$.\n\nYou are given two integers $l$ and $r$. Find two integers $x$ and $y$ such that... | [{"type": "stdin_stdout", "input": "69\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\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... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian. \n\nYou are given an array A of N integers. You are to fulfill M queries. Each query has one of the following three types:\n\nC d : Rotate the array A clockwise b... | [{"type": "stdin_stdout", "input": "5 3\n0 13 10 -1 -2\nR -1\nC 1\nR 4\n@ 1\nS 2", "output": "-1\n-2\n"}, {"type": "stdin_stdout", "input": "5 3\n0 13 10 -1 -2\nR -2\nC 1\nR 4\n@ 1\nS 2", "output": "10\n-2\n"}, {"type": "stdin_stdout", "input": "5 3\n0 13 10 -1 -2\nR 0\nC 1\nR 4\n@ 1\nS 2", "output": "-2\n-2\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nValera's lifelong ambition was to be a photographer, so he bought a new camera. Every day he got more and more clients asking for photos, and one day Valera needed a program that would determine the maximum number of peop... | [{"type": "stdin_stdout", "input": "50 50\n6 10\n10 0\n1 9\n8 2\n4 9\n0 7\n2 0\n7 5\n4 8\n13 7\n2 4\n5 6\n6 8\n3 2\n4 6\n7 8\n6 9\n7 7\n7 3\n9 5\n3 10\n7 2\n4 3\n2 0\n6 5\n5 3\n1 7\n1 7\n9 1\n10 4\n10 5\n4 2\n10 10\n0 7\n1 2\n10 1\n1 7\n3 7\n8 7\n5 2\n6 1\n3 1\n4 7\n7 10\n1 5\n10 8\n5 5\n5 1\n3 3\n1 6\n2 1\n", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTake an integer `n (n >= 0)` and a digit `d (0 <= d <= 9)` as an integer. Square all numbers `k (0 <= k <= n)` between 0 and n. Count the numbers of \ndigits `d` used in the writing of all the `k**2`. Call `nb_dig` (or nb... | [{"input": "11549\n1", "output": "[11905]", "fn_name": "nb_dig"}, {"input": "12526\n1", "output": "[13558]", "fn_name": "nb_dig"}, {"input": "14956\n1", "output": "[17267]", "fn_name": "nb_dig"}, {"input": "11011\n2", "output": "[9481]", "fn_name": "nb_dig"}, {"input": "12224\n8", "output": "[7733]", "fn_name": "nb_dig... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAndrey thinks he is truly a successful developer, but in reality he didn't know about the binary search algorithm until recently. After reading some literature Andrey understood that this algorithm allows to quickly find ... | [{"type": "stdin_stdout", "input": "1000 1000 999\n", "output": "756641425\n"}, {"type": "stdin_stdout", "input": "1000 501 501\n", "output": "646597996\n"}, {"type": "stdin_stdout", "input": "1000 888 888\n", "output": "644649893\n"}, {"type": "stdin_stdout", "input": "1000 500 500\n", "output": "646597996\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGardener Alexey teaches competitive programming to high school students. To congratulate Alexey on the Teacher's Day, the students have gifted him a collection of wooden sticks, where every stick has an integer length. No... | [{"type": "stdin_stdout", "input": "11\n9969 9945 12703 11114 8159 10000 9928 9985 6747 9181 9933\n", "output": "5991155360\n"}, {"type": "stdin_stdout", "input": "11\n9969 9945 12703 9914 8159 10000 9928 9985 6747 9939 9933\n", "output": "5907768442\n"}, {"type": "stdin_stdout", "input": "11\n9969 9945 12703 9914 8159... | 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\n<image>\n\nThe International Clown and Pierrot Competition (ICPC), is one of the most distinguished and also the most popular events on earth in the show business.\n\nOne of the unique features of this contest is the grea... | [{"type": "stdin_stdout", "input": "3\n1000\n342\n-1\n5\n-1\n2\n18\n11\n932\n5\n420\n1100\n0\n200\n685\n8\n353\n143\n402\n274\n283\n31\n402\n523\n0", "output": "342\n10\n435\n309\n"}, {"type": "stdin_stdout", "input": "3\n1000\n342\n0\n5\n2\n2\n11\n11\n932\n5\n148\n1000\n0\n200\n400\n8\n353\n242\n1097\n274\n283\n107\n4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have integer $n$. Calculate how many ways are there to fully cover belt-like area of $4n-2$ triangles with diamond shapes. \n\nDiamond shape consists of two triangles. You can move, rotate or flip the shape, but you c... | [{"type": "stdin_stdout", "input": "1\n1000000000\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "1\n1000000000\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "1\n1111011001\n", "output": "1111011001\n"}, {"type": "stdin_stdout", "input": "1\n1011011001\n", "output": "1011011001\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt's that time of the year, Felicity is around the corner and you can see people celebrating all around the Himalayan region. The Himalayan region has n gyms. The i-th gym has g_{i} Pokemon in it. There are m distinct Pok... | [{"type": "stdin_stdout", "input": "100 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a function which reduces fractions to their simplest form! Fractions will be presented as an array/tuple (depending on the language), and the reduced fraction must be returned as an array/tuple:\n\n```\ninput: [nu... | [{"input": "[10956590, 13611876]", "output": "[[30605, 38022]]", "fn_name": "reduce_fraction"}, {"input": "[24622321, 24473455]", "output": "[[42673, 42415]]", "fn_name": "reduce_fraction"}, {"input": "[35884747, 5576447]", "output": "[[76841, 11941]]", "fn_name": "reduce_fraction"}, {"input": "[4255316, 11425973]", "o... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne way to create a task is to learn from life. You can choose some experience in real life, formalize it and then you will get a new task.\n\nLet's think about a scene in real life: there are lots of people waiting in fr... | [{"type": "stdin_stdout", "input": "100 1\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA girl named Sonya is studying in the scientific lyceum of the Kingdom of Kremland. The teacher of computer science (Sonya's favorite subject!) invented a task for her.\n\nGiven an array $a$ of length $n$, consisting only... | [{"type": "stdin_stdout", "input": "100 1000000000\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "216163471\n"}, {"type": "stdin_stdout", "input": "100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWinter is here at the North and the White Walkers are close. John Snow has an army consisting of n soldiers. While the rest of the world is fighting for the Iron Throne, he is going to get ready for the attack of the Whit... | [{"type": "stdin_stdout", "input": "4\n7 12 15 5\n", "output": "55\n"}, {"type": "stdin_stdout", "input": "4\n5 12 4 6\n", "output": "57\n"}, {"type": "stdin_stdout", "input": "4\n5 12 5 6\n", "output": "50\n"}, {"type": "stdin_stdout", "input": "4\n7 6 15 5\n", "output": "49\n"}, {"type": "stdin_stdout", "input": "4\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConstraints\n\n* 1 ≤ |V| ≤ 100\n* 0 ≤ |E| ≤ 9900\n* -2 × 107 ≤ di ≤ 2 × 107\n* There are no parallel edges\n* There are no self-loops\n\nInput\n\nAn edge-weighted graph G (V, E).\n\n\n|V| |E|\ns0 t0 d0\ns1 t1 d1\n:\ns|E|-... | [{"type": "stdin_stdout", "input": "15 6\n1 2 2\n1 3 -5\n1 2 3\n1 11 4\n2 0 1\n3 2 12", "output": "0 INF INF INF INF INF INF INF INF INF INF INF INF INF INF\n4 0 3 -5 INF INF INF INF INF INF INF 4 INF INF INF\n1 INF 0 INF INF INF INF INF INF INF INF INF INF INF INF\n13 INF 12 0 INF INF INF INF INF INF INF INF INF INF I... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is an infinite 2-dimensional grid. The robot stands in cell $(0, 0)$ and wants to reach cell $(x, y)$. Here is a list of possible commands the robot can execute:\n\nmove north from cell $(i, j)$ to $(i, j + 1)$;\n\n... | [{"type": "stdin_stdout", "input": "100\n0 0\n0 1\n1 0\n1 1\n0 2\n1 2\n2 0\n2 1\n2 2\n0 3\n1 3\n2 3\n3 0\n3 1\n3 2\n3 3\n0 4\n1 4\n2 4\n3 4\n4 0\n4 1\n4 2\n4 3\n4 4\n0 5\n1 5\n2 5\n3 5\n4 5\n5 0\n5 1\n5 2\n5 3\n5 4\n5 5\n0 6\n1 6\n2 6\n3 6\n4 6\n5 6\n6 0\n6 1\n6 2\n6 3\n6 4\n6 5\n6 6\n0 7\n1 7\n2 7\n3 7\n4 7\n5 7\n6 7\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical O... | [{"type": "stdin_stdout", "input": "7 10\n1 0 1 0 0 0 1 0 1 0\n1 0 1 0 0 0 1 0 1 0\n1 1 1 1 1 1 1 1 1 1\n1 0 1 0 0 0 1 0 1 0\n1 1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1 1\n", "output": "YES\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n1 0 1 0 0 0 1 0 1 0\n0 0 0 0 0 0 0 0 0 0\n1 0 1 0 0 0 1 0 1 0\n1 0 1 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n$n$ heroes fight against each other in the Arena. Initially, the $i$-th hero has level $a_i$.\n\nEach minute, a fight between two different heroes occurs. These heroes can be chosen arbitrarily (it's even possible that it... | [{"type": "stdin_stdout", "input": "2\n8\n1 9 1 9 8 10 10 10\n5\n10 10 10 10 10\n", "output": "6\n0\n"}, {"type": "stdin_stdout", "input": "2\n8\n1 9 1 9 8 10 10 10\n5\n10 10 10 10 10\n", "output": "6\n0\n"}, {"type": "stdin_stdout", "input": "2\n8\n1 9 1 9 8 10 16 10\n5\n10 10 10 10 10\n", "output": "6\n0\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLee was cleaning his house for the party when he found a messy string under the carpets. Now he'd like to make it clean accurately and in a stylish way...\n\nThe string $s$ he found is a binary string of length $n$ (i. e.... | [{"type": "stdin_stdout", "input": "5\n10\n0010111111\n4\n0000\n8\n01011111\n10\n1011010100\n1\n0\n", "output": "000111111\n0000\n0011111\n0\n0\n"}, {"type": "stdin_stdout", "input": "5\n10\n0010111111\n4\n1111\n8\n01011111\n10\n1011010100\n1\n0\n", "output": "000111111\n1111\n0011111\n0\n0\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's imagine we have a popular online RPG. A player begins with a score of 0 in class E5. A1 is the highest level a player can achieve.\n\nNow let's say the players wants to rank up to class E4. To do so the player needs... | [{"input": "332532105", "output": "[\"Well done! You have advanced to the qualifying stage. Win 2 out of your next 3 games to rank up.\"]", "fn_name": "playerRankUp"}, {"input": "100", "output": "[\"Well done! You have advanced to the qualifying stage. Win 2 out of your next 3 games to rank up.\"]", "fn_name": "playerR... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWith a friend we used to play the following game on a chessboard\n(8, rows, 8 columns).\nOn the first row at the *bottom* we put numbers:\n\n`1/2, 2/3, 3/4, 4/5, 5/6, 6/7, 7/8, 8/9`\n\nOn row 2 (2nd row from the bottom) w... | [{"input": "3000001", "output": "[[9000006000001, 2]]", "fn_name": "game"}, {"input": "750001", "output": "[[562501500001, 2]]", "fn_name": "game"}, {"input": "3000000", "output": "[[4500000000000]]", "fn_name": "game"}, {"input": "750000", "output": "[[281250000000]]", "fn_name": "game"}, {"input": "120000", "output":... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.\n\nThere are $n$ displays placed along a road,... | [{"type": "stdin_stdout", "input": "20\n804301132 586588704 822785255 552472140 16115810 148658854 66743034 628305150 677780684 931815125 208050516 401554301 954478790 571480982 387546138 832279893 641889899 80960260 717802881 172455365\n61699500 83254572 29028223 27833657 55743179 118122387 94729965 147554867 62937826... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.