messages listlengths 1 1 | ground_truth stringlengths 156 726k | dataset stringclasses 2
values |
|---|---|---|
[
{
"content": "Problem Statement\n\nNathan O. Davis is a student at the department of integrated systems.\n\nToday's agenda in the class is audio signal processing. Nathan was given a lot of homework out. One of the homework was to write a program to process an audio signal. He copied the given audio signal to h... | [{"input": "5\n1 x 0 4 x\n2\nx x\n2\n1 2\n2\n3 0\n2\n1000000000 x\n4\nx 4 1 x\n0", "output": "ambiguous\nnone\nambiguous\nnone\nambiguous\nambiguous\n"}, {"input": "5\n1 x 0 4 x\n2\nx x\n2\n1 2\n2\n3 0\n2\n0000000000 x\n4\nx 4 1 x\n0", "output": "ambiguous\nnone\nambiguous\nnone\nambiguous\nambiguous\n"}, {"input": "5\... | code_stdio |
[
{
"content": "Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M.\nLet a semi-common multiple of A be a positive integer X that satisfies the following condition for every k (1 \\leq k \\leq N):\n - There exists a non-negative integer p such that X= a_k \\times (p+0.5).\nFi... | [{"input": "5 1000000000\n6 6 2 6 2\n", "output": "166666667\n"}, {"input": "5 1000000000\n6 6 2 6 2", "output": "166666667"}, {"input": "3 100\n14 22 40\n", "output": "0\n"}, {"input": "3 000\n14 22 40", "output": "0\n"}, {"input": "3 000\n14 16 40", "output": "0\n"}, {"input": "3 010\n14 16 40", "output": "0\n"}, {"i... | code_stdio |
[
{
"content": "Iahub and Iahubina went to a picnic in a forest full of trees. Less than 5 minutes passed before Iahub remembered of trees from programming. Moreover, he invented a new problem and Iahubina has to solve it, otherwise Iahub won't give her the food. \n\nIahub asks Iahubina: can you build a rooted tr... | [{"input": "24\n3 3 3 4 5 6 7 14 9 10 11 12 13 14 15 16 17 18 19 20 21 18 23 24\n", "output": "NO\n"}, {"input": "24\n3 3 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 18 23 24\n", "output": "NO\n"}, {"input": "24\n1 2 3 4 5 6 7 8 9 10 11 12 23 14 15 16 17 18 19 20 21 22 23 24\n", "output": "NO\n"}, {"input": "24\n... | code_stdio |
[
{
"content": "Your task is to write a program which reads a date (from 2004/1/1 to 2004/12/31) and prints the day of the date. Jan. 1, 2004, is Thursday. Note that 2004 is a leap year and we have Feb. 29.\n\n\n\nInput\n\nThe input is a sequence of datasets. The end of the input is indicated by a line containing... | [{"input": "6 2\n12 8\n0 0", "output": "Wednesday\nWednesday\n"}, {"input": "4 1\n2 18\n0 0", "output": "Thursday\nWednesday\n"}, {"input": "6 2\n7 17\n0 0", "output": "Wednesday\nSaturday\n"}, {"input": "1 1\n5 19\n0 0", "output": "Thursday\nWednesday\n"}, {"input": "3 3\n2 14\n0 0", "output": "Wednesday\nSaturday\n"}... | code_stdio |
[
{
"content": "Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.\n\nLet next(x) be the minimum lucky number which is larger than or equals x. Pe... | [{"input": "614586850 1000000000\n", "output": "1110059271353421796\n"}, {"input": "190535551 1000000000\n", "output": "1340487604111893304\n"}, {"input": "614586850 1000001000\n", "output": "1110063715797865796\n"}, {"input": "190535551 1010000000\n", "output": "1384932048551893304\n"}, {"input": "402822109 1000001000... | code_stdio |
[
{
"content": "A: 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 block, and you can create your favorite character string by changing the order... | [{"input": "gcpc", "output": "1\n"}, {"input": "bgnc", "output": "2\n"}, {"input": "gcoc", "output": "1\n"}, {"input": "gcnc", "output": "1\n"}, {"input": "cgnc", "output": "1\n"}, {"input": "bcng", "output": "2\n"}, {"input": "bcnh", "output": "2\n"}, {"input": "hncb", "output": "2\n"}, {"input": "bnch", "output": "2\... | code_stdio |
[
{
"content": "## 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 territory, and would behave respectfully towards him and each other when they would... | [{"input": "[\"------------\", \"------------\", \"-L----------\", \"------------\", \"------------\", \"------------\"]\n10", "output": "[true]", "fn_name": "peaceful_yard"}, {"input": "[\"------------\", \"---M--------\", \"------------\", \"------------\", \"-------R----\", \"------------\"]\n6", "output": "[false]"... | code_functional |
[
{
"content": "Word $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\" is a $3$-complete word, while \"abccba\" is not.\n\nBob is given a word $s$ ... | [{"input": "4\n6 2\nabaaba\n6 3\nabaaba\n36 9\nhippopotomonstrosesquippedaliophobia\n21 7\nwudixiaoxingxingheclp\n", "output": "2\n0\n23\n16\n"}, {"input": "4\n6 2\nabaaba\n6 3\nabaaba\n36 9\nhippopotononstrosesquippedaliophobia\n21 7\nwudixiaoxingxingheclp\n", "output": "2\n0\n23\n16\n"}, {"input": "4\n6 2\nabaaba\n6 ... | code_stdio |
[
{
"content": "Read 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 the dormitory came up with a timetable for kitchen's usage in order to avoid t... | [{"input": "2\n3\n1 10 16\n1 27 3\n3\n19 20 30\n15 10 20", "output": "2\n1\n"}, {"input": "2\n3\n1 10 15\n1 10 3\n3\n19 20 30\n15 5 20", "output": "2\n1\n"}, {"input": "2\n3\n1 10 29\n1 10 3\n2\n17 39 30\n15 5 20", "output": "2\n2\n"}, {"input": "2\n3\n1 10 29\n2 10 3\n2\n25 39 30\n15 5 20", "output": "1\n2\n"}, {"inpu... | code_stdio |
[
{
"content": "There 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), Child i will be happy if he/she gets exactly a_i sweets. Snuke is trying to m... | [{"input": "4 1111\n-1 2 110 1000", "output": "4\n"}, {"input": "4 1111\n1 5 100 1000", "output": "3\n"}, {"input": "4 1101\n1 5 100 1000", "output": "3\n"}, {"input": "4 1101\n0 5 100 1000", "output": "3\n"}, {"input": "4 1101\n0 5 110 1000", "output": "3\n"}, {"input": "4 1101\n1 5 110 1000", "output": "3\n"}, {"inpu... | code_stdio |
[
{
"content": "Each 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 Polycarp works during the $i$-th hour of the day and $a_i=1$ if Polycarp rests d... | [{"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"}, {"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"}, {"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"}, {"input": "23\n1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1\n", "out... | code_stdio |
[
{
"content": "You are given a permutation $a$ of size $n$ and you should perform $n$ operations on it. In the $i$-th operation, you can choose a non-empty suffix of $a$ and increase all of its elements by $i$. How can we perform the operations to minimize the number of inversions in the final array?\n\nNote tha... | [{"input": "1\n20\n19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 20 1\n", "output": "19 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 20 \n"}, {"input": "1\n20\n20 1 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2\n", "output": "1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2 \n"}, {"input": "4\n4\n1 2 3 4\n5\n1 3 2 4 ... | code_stdio |
[
{
"content": "A 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 2, 3, 4, 6 in addition to 12 and 1.\n\nWhen you enter the integer n, write a... | [{"input": "19\n10887", "output": "17 23\n10883 10889\n"}, {"input": "19\n17073", "output": "17 23\n17053 17077\n"}, {"input": "19\n30085", "output": "17 23\n30071 30089\n"}, {"input": "19\n21592", "output": "17 23\n21589 21599\n"}, {"input": "19\n16181", "output": "17 23\n16141 16183\n"}, {"input": "19\n38456", "outpu... | code_stdio |
[
{
"content": "In 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 numbers are represented without the use of a minus sign (or, in computer represent... | [{"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": "Implement 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 Python code to solve this problem. Define a top-level function named `add_binary` that takes the... | [{"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": "A chess position can be expressed as a string using the Forsyth–Edwards Notation (FEN). Your task is to write a parser that reads in a FEN-encoded string and returns a depiction of the board using the Unicode chess symbols (♔,♕,♘,etc.). The board should be drawn from the perspective of the active... | [{"input": "\"2r2rk1/pp1qbppp/3p1n2/4p1B1/4P3/2NQ1P2/PPP3PP/2KR3R w - - 1 13\"", "output": "[\"\\u2587\\uff3f\\u2656\\uff3f\\u2587\\u2656\\u2654\\uff3f\\n\\u2659\\u2659\\uff3f\\u2655\\u2657\\u2659\\u2659\\u2659\\n\\u2587\\uff3f\\u2587\\u2659\\u2587\\u2658\\u2587\\uff3f\\n\\uff3f\\u2587\\uff3f\\u2587\\u2659\\u2587\\u265... | code_functional |
[
{
"content": "We have a 2 \\times N grid. We will denote the square at the i-th row and j-th column (1 \\leq i \\leq 2, 1 \\leq j \\leq N) as (i, j).\nYou are initially in the top-left square, (1, 1).\nYou will travel to the bottom-right square, (2, N), by repeatedly moving right or down.\nThe square (i, j) con... | [{"input": "7\n-2 -1 0 0 1 24 0\n166 0 -1 -2 -11 -1 2", "output": "151\n"}, {"input": "7\n-1 4 -1 4 2 16 0\n136 4 -4 6 -1 -1 -1", "output": "138\n"}, {"input": "7\n-1 4 -1 4 1 24 1\n136 2 -4 6 -1 -1 -1", "output": "136\n"}, {"input": "7\n-2 -1 0 -1 1 23 1\n73 -1 0 -1 -12 -2 2", "output": "57\n"}, {"input": "7\n-2 -1 1 ... | code_stdio |
[
{
"content": "Joisino 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 - op is either + or -.\n\n-----Input-----\nThe input is given from Standard In... | [{"input": "-1 - 182", "output": "-183\n"}, {"input": "6 - 131", "output": "-125\n"}, {"input": "5 - 118", "output": "-113\n"}, {"input": "-1 + 112", "output": "111\n"}, {"input": "-1 - 15", "output": "-16\n"}, {"input": "-2 - 12", "output": "-14\n"}, {"input": "-2 - 48", "output": "-50\n"}, {"input": "-2 - 74", "outpu... | code_stdio |
[
{
"content": "Little Dima misbehaved during a math lesson a lot and the nasty teacher Mr. Pickles gave him the following problem as a punishment. \n\nFind all integer solutions x (0 < x < 10^9) of the equation:x = b·s(x)^{a} + c, \n\nwhere a, b, c are some predetermined constant values and function s(x) determ... | [{"input": "1 3034 -9234\n", "output": "23\n12004 21106 24140 30208 33242 39310 42344 48412 51446 54480 57514 60548 63582 66616 69650 72684 75718 78752 81786 87854 90888 96956 99990 "}, {"input": "1 3034 -9234\n", "output": "23\n12004 21106 24140 30208 33242 39310 42344 48412 51446 54480 57514 60548 63582 66616 69650 7... | code_stdio |
[
{
"content": "In this problem, you should process T testcases.\n\nFor each testcase, you are given four integers N, M, A, B.\n\nCalculate \\sum_{i = 0}^{N - 1} floor((A \\times i + B) / M).\n\nConstraints\n\n* 1 \\leq T \\leq 100,000\n* 1 \\leq N, M \\leq 10^9\n* 0 \\leq A, B < M\n\nInput\n\nInput is given from... | [{"input": "5\n0 26 3 24\n6 5 4 1\n1 2 0 0\n31415 92653 41909 43244\n1000000000 1000000000 1831327114 999999999", "output": "0\n11\n0\n223190696\n915663556584336442\n"}, {"input": "5\n4 8 6 0\n11 5 7 3\n2 1 0 0\n31415 92653 111964 60313\n1000000000 1000000000 999999999 1505207673", "output": "3\n79\n0\n596283347\n50000... | code_stdio |
[
{
"content": "You 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 elements can form such a sequence, and no number is missing (\"not broken\", e.g. ... | [{"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": "Fangy 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 (which is the size of one text message). Thus, whole sentences and words get split... | [{"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 wcAEjyRQpxghWvXhdJb cwIz FEUsEFicYZ.\n",... | code_stdio |
[
{
"content": "Robot Doc is located in the hall, with n computers stand in a line, numbered from left to right from 1 to n. Each computer contains exactly one piece of information, each of which Doc wants to get eventually. The computers are equipped with a security system, so to crack the i-th of them, the robo... | [{"input": "100\n27 20 18 78 93 38 56 2 48 75 36 88 96 57 69 10 25 74 68 86 65 85 66 14 22 12 43 80 99 34 42 63 61 71 77 15 37 54 21 59 23 94 28 30 50 84 62 76 47 16 26 64 82 92 72 53 17 11 41 91 35 83 79 95 67 13 1 7 3 4 73 90 8 19 33 58 98 32 39 45 87 52 60 46 6 44 49 70 51 9 5 29 31 24 40 97 81 0 89 55\n", "output":... | code_stdio |
[
{
"content": "Little 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 are distinct. \n\nThere is only one thing Petya likes more than permutations:... | [{"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 51 19 22 50 39 32 1 49 36... | code_stdio |
[
{
"content": "You have a plate and you want to add some gilding to it. The plate is a rectangle that we split into $w\\times h$ cells. There should be $k$ gilded rings, the first one should go along the edge of the plate, the second one — $2$ cells away from the edge and so on. Each ring has a width of $1$ cell... | [{"input": "100 100 25\n", "output": "5100\n"}, {"input": "100 100 20\n", "output": "4880\n"}, {"input": "100 100 20\n", "output": "4880\n"}, {"input": "100 100 25\n", "output": "5100\n"}, {"input": "100 100 16\n", "output": "4416\n"}, {"input": "110 100 25\n", "output": "5600\n"}, {"input": "110 100 16\n", "output": "... | code_stdio |
[
{
"content": "# Task\n Pac-Man got lucky today! Due to minor performance issue all his enemies have frozen. Too bad Pac-Man is not brave enough to face them right now, so he doesn't want any enemy to see him. \n \n Given a gamefield of size `N` x `N`, Pac-Man's position(`PM`) and his enemies' positions(`enemies... | [{"input": "10\n[4, 6]\n[[0, 2], [5, 2], [5, 5]]", "output": "[15]", "fn_name": "pac_man"}, {"input": "8\n[1, 1]\n[[5, 4]]", "output": "[19]", "fn_name": "pac_man"}, {"input": "8\n[1, 5]\n[[5, 4]]", "output": "[14]", "fn_name": "pac_man"}, {"input": "2\n[0, 0]\n[[1, 1]]", "output": "[0]", "fn_name": "pac_man"}, {"input... | code_functional |
[
{
"content": "Let'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$ (|+||=|||) are CME but equations $1 + 2 = 4$ (|+||=||||), $2 + 2 = 3$ (||+||=|||), an... | [{"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\n911\n916\n954\n929\n935\n9... | code_stdio |
[
{
"content": "This 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 the New Year. It turned out that he was very lucky — today the offer \"$k$ of g... | [{"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"}, {"input": "8\n5 6 2\n2 4 3 5 12\n5 5 2\n2 4 1 5 10\n3 1 1\n4 2 6\n5 2 5\n10 1 3 9 2\n2 10000 2\n10000 10000\n2 ... | code_stdio |
[
{
"content": "Determine 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 consists of alphabetical characters and digits\n\nInput\n\nIn the first line, a t... | [{"input": "aabaaa\n4\nab\nba\nbb\nxyz", "output": "1\n1\n0\n0\n"}, {"input": "aabaaa\n4\nab\nba\nba\nxyz", "output": "1\n1\n1\n0\n"}, {"input": "aabaaa\n4\nba\nbb\nac\nzyx", "output": "1\n0\n0\n0\n"}, {"input": "aabaaa\n4\nca\nab\nba\nzyx", "output": "0\n1\n1\n0\n"}, {"input": "aacaaa\n4\nba\nb`\nac\nzyx", "output": "... | code_stdio |
[
{
"content": "Create 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 uppercase. See example below.\n\n sillycase(\"brian\") \n // --^-... | [{"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": "There are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times:\n - Choose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n.\nWhat is the largest possible sum of the integers written on... | [{"input": "-1 0 -1\n-1", "output": "-2.0\n"}, {"input": "-1 0 0\n-1", "output": "-1.0\n"}, {"input": "13 5 21\n2", "output": "102\n"}, {"input": "12 10 25\n0", "output": "47\n"}, {"input": "5 8 2\n10", "output": "8199\n"}, {"input": "42 4 21\n2", "output": "193\n"}, {"input": "3 8 2\n10", "output": "8197\n"}, {"input"... | code_stdio |
[
{
"content": "Recently, 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 lucky and 5, 17, 467 are not.\n\nCiel decides to make Ciel numbers.\nAs you kn... | [{"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"}, {"input": "6\nklin 18\nCiel's Drink 133\nThe curry 2nd edition 888888\necir omelet 85855\nunagi 1\n The firsu amd last letters can be a spac... | code_stdio |
[
{
"content": "Little 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 it by 1. The goal of the game is to make the sequence non-decreasing with th... | [{"input": "7\n1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000\n", "output": "6000000000\n"}, {"input": "7\n1000000000 -447358682 1000000000 -1000000000 1000000000 -1000000000 1000000000\n", "output": "5447358682\n"}, {"input": "7\n1000000000 -447358682 1000000000 -1000000000 1100000000 ... | code_stdio |
[
{
"content": "Last 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 stick, he sold it and got 2x berllars. \n * Bob won some programming competitio... | [{"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 1799\nwin 715\nwin 723\... | code_stdio |
[
{
"content": "You are taking a computer-based examination. The examination consists of N questions, and the score allocated to the i-th question is s_i. Your answer to each question will be judged as either \"correct\" or \"incorrect\", and your grade will be the sum of the points allocated to questions that ar... | [{"input": "3\n-101\n-1\n-1", "output": "-103\n"}, {"input": "3\n-109\n-1\n-1", "output": "-111\n"}, {"input": "3\n-156\n-1\n-1", "output": "-158\n"}, {"input": "3\n-166\n-1\n-1", "output": "-168\n"}, {"input": "3\n-166\n-2\n-1", "output": "-169\n"}, {"input": "3\n-166\n-4\n-1", "output": "-171\n"}, {"input": "3\n-390\... | code_stdio |
[
{
"content": "You are given a set of all integers from $l$ to $r$ inclusive, $l < r$, $(r - l + 1) \\le 3 \\cdot 10^5$ and $(r - l)$ is always odd.\n\nYou want to split these numbers into exactly $\\frac{r - l + 1}{2}$ pairs in such a way that for each pair $(i, j)$ the greatest common divisor of $i$ and $j$ is... | [{"input": "804212830686677670 804212830686679109\n", "output": "YES\n804212830686677670 804212830686677671\n804212830686677672 804212830686677673\n804212830686677674 804212830686677675\n804212830686677676 804212830686677677\n804212830686677678 804212830686677679\n804212830686677680 804212830686677681\n8042128306866776... | code_stdio |
[
{
"content": "Complete 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 (`\"2\"`, `\"3\",` ..., `\"10\"`, `\"J\"`, `\"Q\"`, `\"K\"` or `\"A\"`) and sh... | [{"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": "The 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 integer) that performed that song and the length of that song in seconds. The Lit... | [{"input": "2\n3\n1 1\n2 2\n-1 2\n3\n1 3\n1 3\n4 2", "output": "11\n14\n"}, {"input": "2\n3\n1 1\n2 3\n-1 2\n3\n0 3\n1 3\n4 2", "output": "14\n17\n"}, {"input": "2\n3\n1 3\n2 3\n4 2\n3\n2 1\n1 2\n2 11", "output": "17\n27\n"}, {"input": "2\n3\n1 1\n2 2\n-1 2\n3\n0 3\n1 3\n4 4", "output": "11\n21\n"}, {"input": "2\n3\n1 ... | code_stdio |
[
{
"content": "Polycarpus 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]. In other words, this function does the following: \n \n \n \n ... | [{"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"}, {"input": "20\n5 9 11 12 13 13 13 13 13 13 13 13 13 6 12 11 11 8 6 2\n", "output": "19\n5 13\n4 13\n3 13\n3... | code_stdio |
[
{
"content": "# 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 \n Note, that no output ever exceeds 2e9.\n\n# Input/Output\n\n\n - `[input]... | [{"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": "Polycarp invited all his friends to the tea party to celebrate the holiday. He has n cups, one for each of his n friends, with volumes a_1, a_2, ..., a_{n}. His teapot stores w milliliters of tea (w ≤ a_1 + a_2 + ... + a_{n}). Polycarp wants to pour tea in cups in such a way that: Every cup will ... | [{"input": "100 10000\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 100 100 100 100 100 1... | code_stdio |
[
{
"content": "Programmers working on a large project have just received a task to write exactly m lines of code. There are n programmers working on a project, the i-th of them makes exactly ai bugs in every line of code that he writes. \n\nLet's call a sequence of non-negative integers v1, v2, ..., vn a plan, i... | [{"input": "123 432 342 1000000007\n72 20 34 115 65 29 28 41 18 16 122 104 88 37 119 11 108 91 13 110 47 73 80 35 62 12 9 116 55 66 54 113 50 57 8 25 98 105 0 120 93 78 61 17 84 48 42 106 63 103 7 59 90 89 28 49 53 71 51 83 75 67 64 95 107 3 32 85 69 99 33 79 109 56 10 23 87 19 121 94 44 82 102 27 112 52 21 1 5 74 117 ... | code_stdio |
[
{
"content": "You 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 j \\le n$, an integer $a_{i,j}$ is given. It imposes the following constrain... | [{"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 0 0 0 0 0 0 2 2\n0 2 0 2... | code_stdio |
[
{
"content": "Some country is populated by wizards. They want to organize a demonstration.\n\nThere are n people living in the city, x of them are the wizards who will surely go to the demonstration. Other city people (n - x people) do not support the wizards and aren't going to go to the demonstration. We know... | [{"input": "10000 10000 10000\n", "output": "990000\n"}, {"input": "16485 10573 4769\n", "output": "775597\n"}, {"input": "1829 10325 17617\n", "output": "311890\n"}, {"input": "12248 10573 4769\n", "output": "573535\n"}, {"input": "13372 2590 2818\n", "output": "374233\n"}, {"input": "6571 10325 8965\n", "output": "57... | code_stdio |
[
{
"content": "Given 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 - Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\\ldots{... | [{"input": "contest\nprogramming\n", "output": "-1\n"}, {"input": "contest\nprogrammhng", "output": "-1\n"}, {"input": "eontcst\nprogrammhng", "output": "-1\n"}, {"input": "eonscst\nprogrammhng", "output": "-1\n"}, {"input": "eonscst\nprogrammhog", "output": "-1\n"}, {"input": "eonscst\nprogrammhpg", "output": "-1\n"},... | code_stdio |
[
{
"content": "Write a program that will calculate the number of trailing zeros in a factorial of a given number.\n\n`N! = 1 * 2 * 3 * ... * N`\n\nBe careful `1000!` has 2568 digits...\n\nFor more info, see: http://mathworld.wolfram.com/Factorial.html \n\n## Examples\n\n```python\nzeros(6) = 1\n# 6! = 1 * 2 * 3... | [{"input": "1000000000", "output": "[249999998]", "fn_name": "zeros"}, {"input": "100000", "output": "[24999]", "fn_name": "zeros"}, {"input": "1000", "output": "[249]", "fn_name": "zeros"}, {"input": "100", "output": "[24]", "fn_name": "zeros"}, {"input": "30", "output": "[7]", "fn_name": "zeros"}, {"input": "0", "out... | code_functional |
[
{
"content": "After the educational reform Polycarp studies only two subjects at school, Safety Studies and PE (Physical Education). During the long months of the fourth term, he received n marks in them. When teachers wrote a mark in the journal, they didn't write in what subject the mark was for, they just wr... | [{"input": "100\n45 55\n3 5 3 4 1 1 1 1 5 2 1 3 1 5 3 5 1 1 3 1 1 3 5 5 1 1 1 5 5 1 3 1 1 1 3 3 1 1 1 4 3 1 5 1 3 1 4 5 4 3 3 1 1 5 5 1 3 5 1 1 5 1 1 3 5 5 1 1 3 3 4 1 1 4 5 3 1 3 1 5 1 5 4 5 1 1 1 1 4 5 4 5 3 1 1 5 1 5 1 4\n", "output": "1 1 1 1 2 2 2 2 1 2 2 1 2 1 1 1 2 2 1 2 2 1 1 1 2 2 2 1 1 2 1 2 2 2 1 1 2 2 2 1 1... | code_stdio |
[
{
"content": "# Task\nGiven an array `arr`, find the maximal value of `k` such `a[i] mod k` = `a[j] mod k` for all valid values of i and j.\n\nIf it's impossible to find such number (there's an infinite number of `k`s), return `-1` instead.\n\n\n# Input/Output\n\n`[input]` integer array `arr`\n\nA non-empty arr... | [{"input": "[5, 6, 7, 8]", "output": "[1]", "fn_name": "finding_k"}, {"input": "[1, 1, 1]", "output": "[-1]", "fn_name": "finding_k"}, {"input": "[1, 7, 13]", "output": "[6]", "fn_name": "finding_k"}, {"input": "[10, 100]", "output": "[90]", "fn_name": "finding_k"}, {"input": "[64, 8, 1]", "output": "[7]", "fn_name": "... | code_functional |
[
{
"content": "Claire is a man-eater. She's a real man-eater. She's going around with dozens of guys. She's dating all the time. And one day she found some conflicts in her date schedule. D'oh!\n\nSo she needs to pick some dates and give the others up. The dates are set by hours like 13:00 to 15:00. She may have... | [{"input": "2\n2 100\n10 12\n14 16\n2 200\n12 13\n18 20\n4\n1 100\n6 22\n1 1000\n12 22\n1 10000\n6 22\n1 100000\n6 22\n16\n1 100000000\n6 7\n1 100000000\n7 8\n1 100000000\n8 15\n1 110000000\n9 10\n1 100000000\n10 11\n1 100000000\n11 12\n1 100000000\n12 13\n1 100000000\n13 17\n1 100000000\n14 15\n1 100000000\n15 16\n1 1... | code_stdio |
[
{
"content": "One day Misha and Andrew were playing a very simple game. First, each player chooses an integer in the range from 1 to n. Let's assume that Misha chose number m, and Andrew chose number a.\n\nThen, by using a random generator they choose a random integer c in the range between 1 and n (any integer... | [{"input": "1000000000 1000000000\n", "output": "999999999\n"}, {"input": "1000000000 1000000000\n", "output": "999999999"}, {"input": "1000000000 100000000\n", "output": "100000001\n"}, {"input": "1000000000 500000000\n", "output": "500000001\n"}, {"input": "1199670843 346250868\n", "output": "346250869\n"}, {"input":... | code_stdio |
[
{
"content": "Define a method that accepts 2 strings as parameters. The method returns the first string sorted by the second.\n\n```python\nsort_string(\"foos\", \"of\") == \"oofs\"\nsort_string(\"string\", \"gnirts\") == \"gnirts\"\nsort_string(\"banana\", \"abn\") == \"aaabnn\"\n```\n\nTo elaborate, ... | [{"input": "\"fumyarhncujlj\"\n\"nsejcwn\"", "output": "[\"njjcfumyarhul\"]", "fn_name": "sort_string"}, {"input": "\"bungholio\"\n\"aacbuoldiiaoh\"", "output": "[\"buoolihng\"]", "fn_name": "sort_string"}, {"input": "\"string\"\n\"gnirts\"", "output": "[\"gnirts\"]", "fn_name": "sort_string"}, {"input": "\"banana\"\n\... | code_functional |
[
{
"content": "Nathan O. Davis is trying to capture a game and struggling to get a very rare item. This rare item can be obtained by arranging special patterns in a row on a casino slot machine. The slot machine has N reels, and pressing the button once stops the currently rotating leftmost reel. Therefore, you ... | [{"input": "1 5 7 11 10\n11\n2 5 5 11 10\n2 4\n2 1 1 256 0\n128 255\n2 0 0 1 0\n1234 5678\n2 1 1 100 0\n99 98\n2 1 1 100 0\n99 99\n2 1 1 10000 0\n1 0\n3 1 2 10000 0\n2 1\n0 0 0 0 0", "output": "-1\n-1\n255\n-1\n198\n199\n10000\n-1\n"}, {"input": "1 5 7 11 10\n10\n2 5 7 11 10\n2 4\n2 1 1 256 0\n128 255\n2 0 0 1 0\n1234 ... | code_stdio |
[
{
"content": "Given the list of numbers, you are to sort them in non decreasing order.\n\n-----Input-----\nt – the number of numbers in list, then t lines follow [t <= 10^6]. \n\nEach line contains one integer: N [0 <= N <= 10^6]\n\n-----Output-----\nOutput given numbers in non decreasing order.\n\n-----Example... | [{"input": "5\n0\n0\n10\n11\n2", "output": "0\n0\n2\n10\n11\n"}, {"input": "5\n1\n1\n3\n11\n2", "output": "1\n1\n2\n3\n11\n"}, {"input": "5\n1\n1\n3\n11\n4", "output": "1\n1\n3\n4\n11\n"}, {"input": "5\n1\n0\n3\n11\n4", "output": "0\n1\n3\n4\n11\n"}, {"input": "5\n1\n0\n3\n17\n4", "output": "0\n1\n3\n4\n17\n"}, {"input... | code_stdio |
[
{
"content": "To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation:\n - 1 yen (the currency of Japan)\n - 6 yen, 6^2(=36) yen, 6^3(=216) yen, ...\n - 9 yen, 9^2(=81) yen, 9^3(=729) yen, ...\nAt least how many operations are re... | [{"input": "44852\n", "output": "16\n"}, {"input": "43637\n", "output": "16\n"}, {"input": "99788\n", "output": "15\n"}, {"input": "35861\n", "output": "15\n"}, {"input": "100000\n", "output": "7\n"}, {"input": "182896", "output": "14\n"}, {"input": "135433", "output": "10\n"}, {"input": "59049\n", "output": "1\n"}, {"... | code_stdio |
[
{
"content": "Diameter of a Tree\n\n\n\n\nGiven a tree T with non-negative weight, find the diameter of the tree.\n\nThe diameter of a tree is the maximum distance between two nodes in a tree.\n\nConstraints\n\n* 1 ≤ n ≤ 100,000\n* 0 ≤ wi ≤ 1,000\n\nInput\n\n\nn\ns1 t1 w1\ns2 t2 w2\n:\nsn-1 tn-1 wn-1\n\n\nThe f... | [{"input": "4\n1 0 -2\n2 1 10\n1 3 4", "output": "14\n"}, {"input": "4\n1 0 1\n0 2 12\n2 3 -1", "output": "13\n"}, {"input": "4\n1 0 0\n2 1 11\n0 3 11", "output": "22\n"}, {"input": "4\n1 0 -1\n2 1 15\n1 3 4", "output": "19\n"}, {"input": "4\n1 1 -1\n2 0 10\n0 3 6", "output": "16\n"}, {"input": "4\n0 1 2\n0 3 1\n2 3 12... | code_stdio |
[
{
"content": "Takahashi has a strong stomach. He never gets a stomachache from eating something whose \"best-by\" date is at most X days earlier.\nHe gets a stomachache if the \"best-by\" date of the food is X+1 or more days earlier, though.\nOther than that, he finds the food delicious if he eats it not later ... | [{"input": "-2 -1 10", "output": "dangerous\n"}, {"input": "-1 13 12", "output": "delicious\n"}, {"input": "3 7 12\n", "output": "dangerous\n"}, {"input": "-1 7 12", "output": "dangerous\n"}, {"input": "-1 7 14", "output": "dangerous\n"}, {"input": "13 2 -1", "output": "delicious\n"}, {"input": "13 4 -1", "output": "de... | code_stdio |
[
{
"content": "For a dynamic array $A = \\\\{a_0, a_1, ...\\\\}$ of integers, perform a sequence of the following operations:\n\n* pushBack($x$): add element $x$ at the end of $A$\n* randomAccess($p$):print element $a_p$\n* popBack(): delete the last element of $A$\n\n\n\n$A$ is a 0-origin array and it is empty ... | [{"input": "8\n0 -1\n0 14\n0 1\n2\n0 4\n1 0\n1 0\n1 1", "output": "-1\n-1\n14\n"}, {"input": "8\n0 -1\n0 9\n1 1\n2\n0 4\n1 0\n1 0\n1 1", "output": "9\n-1\n-1\n4\n"}, {"input": "8\n0 -1\n0 2\n0 3\n2\n0 4\n1 0\n1 0\n1 0", "output": "-1\n-1\n-1\n"}, {"input": "8\n0 -1\n0 9\n0 1\n2\n0 4\n1 0\n1 0\n1 1", "output": "-1\n-1\n... | code_stdio |
[
{
"content": "Read problems statements in Mandarin Chinese and Russian. \nRoman has no idea, why this problem is called Stone. He also has no idea on how to solve the followong problem: given array of N integers A and a number K. During a turn the maximal value over all A_{i} is chosen, let's call it MAX. Then... | [{"input": "4 0\n5 -1 14 -1", "output": "5 -1 14 -1\n"}, {"input": "4 0\n6 -1 14 -1", "output": "6 -1 14 -1\n"}, {"input": "4 1\n1 -1 19 4", "output": "18 20 0 15\n"}, {"input": "4 1\n5 -1 15 0", "output": "10 16 0 15\n"}, {"input": "4 1\n5 -1 23 0", "output": "18 24 0 23\n"}, {"input": "4 1\n3 0 14 -1", "output": "11 ... | code_stdio |
[
{
"content": "You are given three sticks with positive integer lengths of a, b, and c centimeters. You can increase length of some of them by some positive integer number of centimeters (different sticks can be increased by a different length), but in total by at most l centimeters. In particular, it is allowed... | [{"input": "300000 300000 300000 300000\n", "output": "4500090000549998\n"}, {"input": "300000 300000 313966 300000\n", "output": "4499976425036741\n"}, {"input": "300000 330804 313966 300000\n", "output": "4499890982537731\n"}, {"input": "53553 262850 271957 182759\n", "output": "834977070873802\n"}, {"input": "100000... | code_stdio |
[
{
"content": "Ekiden competitions are held every year in Aizukuni. The country of Aiz is dotted with N towns, each numbered from 1 to N. Several towns are connected by roads that allow them to come and go directly to each other. You can also follow several roads between any town. The course of the tournament is... | [{"input": "7 11\n2 4 2\n1 6 2\n2 4 2\n1 5 10\n2 6 2\n6 4 1\n6 5 1\n3 6 1\n4 7 0\n5 5 6\n6 7 1", "output": "4\n3\n4\n5\n7\n"}, {"input": "7 11\n2 1 2\n1 3 1\n2 3 2\n3 4 4\n2 6 1\n4 4 1\n3 5 2\n3 6 1\n4 7 3\n5 7 7\n6 7 1", "output": "4\n1\n2\n6\n7\n"}, {"input": "7 11\n2 2 2\n1 3 2\n3 3 2\n3 4 4\n2 6 1\n4 4 1\n3 5 1\n3 ... | code_stdio |
[
{
"content": "Write a program that prints a chessboard with N rows and M columns with the following rules:\nThe top left cell must be an asterisk (*)\nAny cell touching (left, right, up or down) a cell with an asterisk must be a dot (.)\nAny cell touching (left, right, up or down) a cell with a dot must be an a... | [{"input": "\"8 8\"", "output": "[\"*.*.*.*.\\n.*.*.*.*\\n*.*.*.*.\\n.*.*.*.*\\n*.*.*.*.\\n.*.*.*.*\\n*.*.*.*.\\n.*.*.*.*\"]", "fn_name": "chessboard"}, {"input": "\"5 2\"", "output": "[\"*.\\n.*\\n*.\\n.*\\n*.\"]", "fn_name": "chessboard"}, {"input": "\"3 3\"", "output": "[\"*.*\\n.*.\\n*.*\"]", "fn_name": "chessboard... | code_functional |
[
{
"content": "Vasya 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 the i-th row and the j-th column.\n\nVasya has also got a chip. Initially, the... | [{"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"}, {"input": "13 8\n3 2 1 4 8 2 5 9... | code_stdio |
[
{
"content": "There are K items placed on a grid of squares with R rows and C columns. Let (i, j) denote the square at the i-th row (1 \\leq i \\leq R) and the j-th column (1 \\leq j \\leq C). The i-th item is at (r_i, c_i) and has the value v_i.\nTakahashi will begin at (1, 1), the start, and get to (R, C), th... | [{"input": "4 5 10\n2 5 12\n1 5 12\n2 3 15\n1 2 20\n1 1 28\n2 4 26\n3 2 27\n4 5 21\n3 5 10\n1 3 10\n", "output": "142\n"}, {"input": "4 5 3\n1 5 11\n1 -1 12\n2 3 61\n2 3 20\n0 0 33\n3 3 10\n4 4 31\n14 6 21\n-1 2 17\n2 3 10", "output": "61\n"}, {"input": "4 5 10\n2 5 12\n1 5 7\n2 3 15\n1 2 20\n1 1 28\n2 4 26\n3 2 27\n4 ... | code_stdio |
[
{
"content": "You are given a grid with 2 rows and 3 columns of squares.\nThe color of the square at the i-th row and j-th column is represented by the character C_{ij}.\nWrite a program that prints YES if this grid remains the same when rotated 180 degrees, and prints NO otherwise.\n\n-----Constraints-----\n -... | [{"input": "pot\ntop\n", "output": "YES\n"}, {"input": "tab\nbet\n", "output": "NO\n"}, {"input": "eye\neel\n", "output": "NO\n"}, {"input": "spp\npps", "output": "YES\n"}, {"input": "tbb\nbet", "output": "NO\n"}, {"input": "eye\nele", "output": "NO\n"}, {"input": "pos\ntop", "output": "NO\n"}, {"input": "btb\nbet", "o... | code_stdio |
[
{
"content": "To 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 sock store to either:\n\nrecolor a sock to any color $c'$ $(1 \\le c' \\le n)$... | [{"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"}, {"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"}, {"input": "4\n6 3 3\n1 2 6 2 2 2\n6 2 4\n1 1 2 2 2 2\n6 5 1\n6 5 4 3 2 1\n4 0... | code_stdio |
[
{
"content": "In 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 various types of cars are settled in your parking lines early in the morning.... | [{"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"}, {"input": "3 5\n0W 1W\n0W 2W\n0W 2E\n0E 1E\n1E 2E\naabbccdee\n-\n-\n-\n-\nbbaadeecc\n... | code_stdio |
[
{
"content": "Polycarpus 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 requests for this time period. For each query, we know its time... and nothing ... | [{"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"}, {"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:34:59\n14:40:06\n14:53:13\n", "output": "6\n1\n2\... | code_stdio |
[
{
"content": "Takahashi 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 a_i and b_i.\n\nHe would like to make one as follows:\n\n* Specify two non-n... | [{"input": "10\n1 2\n1 3\n1 4\n2 5\n6 10\n6 7\n7 8\n4 9\n10 5", "output": "2 6\n"}, {"input": "10\n1 2\n1 3\n3 4\n2 5\n6 5\n6 7\n7 8\n5 9\n10 5", "output": "2 5\n"}, {"input": "10\n1 2\n1 3\n3 4\n2 5\n7 5\n6 7\n7 8\n5 9\n10 5", "output": "3 5\n"}, {"input": "10\n1 2\n1 3\n1 4\n2 5\n7 5\n6 7\n7 8\n5 9\n10 5", "output": ... | code_stdio |
[
{
"content": "Sasha 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 Sasha likes to upsolve unsolved problems because upsolving is very useful.\n\nT... | [{"input": "2\n114243 620721\n", "output": "0\n"}, {"input": "2\n182166 620721\n", "output": "0\n"}, {"input": "2\n182166 383547\n", "output": "0\n"}, {"input": "2\n60202 951227\n", "output": "0\n"}, {"input": "2\n60202 620721\n", "output": "0\n"}, {"input": "6\n5 2 2 3 10 6\n", "output": "1\n"}, {"input": "6\n5 2 2 4 ... | code_stdio |
[
{
"content": "Laura 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 notify the sender if unknown acronyms are present.\n\nAny combination of three or ... | [{"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": "You've got two rectangular tables with sizes na × ma and nb × mb cells. The tables consist of zeroes and ones. We will consider the rows and columns of both tables indexed starting from 1. Then we will define the element of the first table, located at the intersection of the i-th row and the j-th ... | [{"input": "14 28\n1000000010111011101010010101\n1110010011000011000110001001\n0001100110101000010110110011\n0101101011010101110100100101\n0100100101000011011111100010\n0001111000100000101000110101\n1011100111110101000110101010\n1111011011110100100000101000\n0011111101110001010010001110\n1011100011110000001011100100\n0... | code_stdio |
[
{
"content": "A little bear Limak plays a game. He has five cards. There is one number written on each card. Each number is a positive integer.\n\nLimak can discard (throw out) some cards. His goal is to minimize the sum of numbers written on remaining (not discarded) cards.\n\nHe is allowed to at most once dis... | [{"input": "100 100 100 100 100\n", "output": "200\n"}, {"input": "100 100 100 100 100\n", "output": "200\n"}, {"input": "100 100 100 100 000\n", "output": "100\n"}, {"input": "100 100 100 000 000\n", "output": "0\n"}, {"input": "100 100 99 99 98\n", "output": "296\n"}, {"input": "98 99 100 99 100\n", "output": "296\n"... | code_stdio |
[
{
"content": "Innokenty 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 Innokenty wants that all short names consist of three letters.\n\nEach club's ful... | [{"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"}, {"input": "10\nIJGDI KHB\nHBI CKKCG\nFHE GCAA\nEDCGH HHICE\nGFH AIHD\nHED KIK\nDCK BCFIJ\nFFIHE FDB\nJGB AKKI\nIJD CAG\n", "ou... | code_stdio |
[
{
"content": "Write 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 empty), return `1`.\n\n~~~if:objc\nNOTE: The first (and only named) argument... | [{"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": "Short 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 condition:\n\n> (The Condition for a Short Phrase)\n> The sequence of words can be ... | [{"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"}, {"input": "9\ndo\nhte\nbest\nand\nenjoy\ntoday\... | code_stdio |
[
{
"content": "You 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 above first part, running in the opposite direction and aligned to the posit... | [{"input": "LEHLLLLLLHAFGEGLLHAFDLHHLLLLLDGGEHGGHLLLLLLLLDFLCBLLEFLLCBLLCGLEDLGGLECLDGLEHLLLGELLLEGLLLLGDLLLDALD\n", "output": "49\n"}, {"input": "LEHLLLLLLHAFGEGLLHAFDLHHMLLLLDGGEHGGHLLLLLLLLDFLCBLLEFLLCBLLCGLEDLGGLECLDGLEHLLLGELLLEGLLLLGDLLLDALD\n", "output": "47\n"}, {"input": "LEHLLLLLLHAFGEGLLHAFDLHHMLLKLDGGEHGGHL... | code_stdio |
[
{
"content": "You 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 right triangle is a triangle in which one angle is a right angle (that is, a 90... | [{"input": "14 29\n**.*************..*.*********\n**..****.*********.**.*.****.\n********.**..*..*...*....**..\n****.**.***.*.***..*..***.*..\n***.****.***..*.***.*.****.*.\n*.*..***.***********.*.*.****\n****.*.***.*..****.**.**..***\n.*******..**...***.*.********\n*...**********...**...*.***.*\n*.******...*.***.**..*... | code_stdio |
[
{
"content": "Squirrel Liss lived in a forest peacefully, but unexpected trouble happens. Stones fall from a mountain. Initially Squirrel Liss occupies an interval [0, 1]. Next, n stones will fall and Liss will escape from the stones. The stones are numbered from 1 to n in order.\n\nThe stones always fall to th... | [{"input": "llrlrlllrrllrllllrlrrlrlrrllrlrlrrlrrrrrrlllrrlrrrrrlrrrlrlrlrrlllllrrrrllrrlrlrrrllllrlrrlrrlrlrrll\n", "output": "3\n5\n9\n10\n13\n18\n20\n21\n23\n25\n26\n29\n31\n33\n34\n36\n37\n38\n39\n40\n41\n45\n46\n48\n49\n50\n51\n52\n54\n55\n56\n58\n60\n62\n63\n69\n70\n71\n72\n75\n76\n78\n80\n81\n82\n87\n89\n90\n92\... | code_stdio |
[
{
"content": "There is an empty array.\nThe following N operations will be performed to insert integers into the array.\nIn the i-th operation (1≤i≤N), b_i copies of an integer a_i are inserted into the array.\nFind the K-th smallest integer in the array after the N operations.\nFor example, the 4-th smallest i... | [{"input": "10 878093\n1 100000\n1 110001\n1 100000\n1 100001\n1 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000", "output": "100000\n"}, {"input": "10 878093\n1 100000\n1 110001\n1 100000\n1 101001\n1 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000", ... | code_stdio |
[
{
"content": "You are given a string q. A sequence of k strings s_1, s_2, ..., s_{k} is called beautiful, if the concatenation of these strings is string q (formally, s_1 + s_2 + ... + s_{k} = q) and the first characters of these strings are distinct.\n\nFind any beautiful sequence of strings or determine that ... | [{"input": "26\nlllplzkkzflzflffzznnnnfgflqlttlmtnkzlztskngyymitqagattkdllyutzimsrskpapcmuupjdopxqlnhqcscwvdtxbflefy\n", "output": "YES\nlll\npl\nz\nkkz\nflzflffzz\nnnnnf\ngfl\nql\nttl\nmtnkzlzt\nskng\nyym\nitq\nagattk\ndlly\nutzims\nrskpap\ncmuup\njd\nop\nxqln\nhqcsc\nw\nvdtx\nbfl\nefy\n"}, {"input": "26\nlllplzkkzflz... | code_stdio |
[
{
"content": "You 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-----Input-----\n\nThe first line contains the single integer $T$ ($1 \\le T \\le 50... | [{"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"}, {"input": "10\n164 252\n94 253\n171 254\n196 255\n35 256\n174 257\n251 258\n239 259\n9 260\n98 261\n", "output": "36\n220\n126\n128\n128\n256\n84\n216\n9... | code_stdio |
[
{
"content": "Melody 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 identity that allowed her to kill the Eleventh Doctor.\n\nHeidi figured out tha... | [{"input": "1219679533107\n", "output": "1 609839766552\n"}, {"input": "1044191868535\n", "output": "1 522095934266\n"}, {"input": "1041721920937\n", "output": "1 520860960467\n"}, {"input": "1025662663437\n", "output": "1 512831331717\n"}, {"input": "1026828404677\n", "output": "1 513414202337\n"}, {"input": "14523797... | code_stdio |
[
{
"content": "There 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 out of $n$ available.\n\nLet $k$ be the maximum number of people sitting on o... | [{"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\n100\n100\n100\n100\n10... | code_stdio |
[
{
"content": "On 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 base cost a_{i} Egyptian pounds. If Sagheer buys k items with indices x_1, x... | [{"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 4716 693 961 7402 9004 799... | code_stdio |
[
{
"content": "There 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 n. Every pair of two characters can either mutually love each other or mutua... | [{"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"}, {"input": "28567 13\n28079 24675 1\n18409 26720 1\n980 12226 1\n20794 16571 1\n7376 198... | code_stdio |
[
{
"content": "Bob is playing a game named \"Walk on Matrix\".\n\nIn this game, player is given an n × m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located at position (1,1) with score a_{1,1}. \n\nTo reach the goal, position (n,m), player can move ri... | [{"input": "127382\n", "output": "2 3\n258454 131072 0\n127382 258454 127382\n"}, {"input": "117079\n", "output": "2 3\n248151 131072 0\n117079 248151 117079\n"}, {"input": "101472\n", "output": "2 3\n232544 131072 0\n101472 232544 101472\n"}, {"input": "100461\n", "output": "2 3\n231533 131072 0\n100461 231533 100461\... | code_stdio |
[
{
"content": "Little 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 none of the numbers xi - yi, xi - yi + 1, ..., xi - 1. Help him.\n\nInput\n\n... | [{"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"}, {"input": "20\n68260 0\n819 1\n54174 ... | code_stdio |
[
{
"content": "Read 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 segment. Then he intended to divide the fruit into several parts. In order t... | [{"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"}, {"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"}, {"input": "2\n10 3 2\n1 4\n10 5\n6 10\n1 5\n6 10\n10 3 0\n4 5\n10 1\n6 9\n1 10", "output": "Yes\nYes\n"}, ... | code_stdio |
[
{
"content": "Vasya 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 nights in the garden and guard the fruit because there’s no house in the garden! ... | [{"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"}, {"input": "10 10\n1 0 1 1 1 1 1 1 1 1\n1 1 1 0 1 1 0 1 1 1\n1 ... | code_stdio |
[
{
"content": "In 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 - 2*b, and repeat step (i). Otherwise, go to step (iii);\niii) If b ≥ 2*a, s... | [{"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": "You 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$ by deleting some of its symbols without changing the order of the remaining... | [{"input": "76 26\nABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYABCDEFGHIJKLMNOPQRSTUVWXY\n", "output": "26\n"}, {"input": "76 26\nABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYABCDEFGHIJKLMNOPQRSTUVWXY\n", "output": "26"}, {"input": "22 1\nAAAAAAAAAAAAAAAAAAAAAA\n", "output": "22\n"}, {"input": "22 1\nAAAAA... | code_stdio |
[
{
"content": "Chef talks a lot on his mobile phone. As a result he exhausts his talk-value (in Rokdas) very quickly. One day at a mobile recharge shop, he noticed that his service provider gives add-on plans which can lower his calling rates (Rokdas/minute). One of the plans said \"Recharge for 28 Rokdas and en... | [{"input": "4\n1.00 90 1\n1 1.7525489781557062 28\n1.3670910027404404 200 2\n2 0.75 40\n5 1.2448234862135843 101\n1.690723151930112 50 2\n1 1.4388842285899601 65\n2 2.296376152318535 100\n1.00 000 2\n3 1.1116288236865874 10\n4 1.5704897737882006 36", "output": "0\n1\n0\n0\n"}, {"input": "4\n1.00 200 1\n1 0.50 42\n1.00 ... | code_stdio |
[
{
"content": "We have a grid with H horizontal rows and W vertical columns. Let (i,j) denote the square at the i-th row from the top and the j-th column from the left.\nThe square (i, j) has two numbers A_{ij} and B_{ij} written on it.\nFirst, for each square, Takahashi paints one of the written numbers red and... | [{"input": "80 80\n80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80\n80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 ... | code_stdio |
[
{
"content": "In 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 represent a dot with a \"0\" and a dash with a \"1\".\n\nBecause there are $2^1... | [{"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\n0\n0\n1\n0\n0\n0\n1\n", ... | code_stdio |
[
{
"content": "Create 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, AB, and O.\n\n\n\nInput\n\nA comma-separated pair of attendance numbers and bl... | [{"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"}, {"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"}, {"input": "1,B\n2,A\n3,B\n4,AB\n5,A\n6,O\n7,A\n8,O\n9,AB\n11,A\n11,A\n12,B\n13,AB\n14... | code_stdio |
[
{
"content": "Complete 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 can change 31 to 14 by flipping the 4th and 0th bit:\n```\n 31 0 0 0 1 1 1 1 1... | [{"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": "## 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 really thirsty and want several beers. Then you need to count in Polish. And more... | [{"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": "Problem 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 two shapes that Nishikun's fingers can take, whether they are broken or not.\nN... | [{"input": "1237235", "output": "21\n"}, {"input": "140502", "output": "18\n"}, {"input": "299812", "output": "19\n"}, {"input": "763679", "output": "20\n"}, {"input": "17679", "output": "15\n"}, {"input": "33209", "output": "16\n"}, {"input": "96405", "output": "17\n"}, {"input": "1241", "output": "11\n"}, {"input": "... | code_stdio |
[
{
"content": "As 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 to Barney's heart is under the middle cup. $\\left. \\begin{array}{l}{\\text... | [{"input": "12\n254904759290707697 475737283258450340 533306428548398547 442127134828578937 779740159015946254 272877594683860919 93000149670491971 349640818793278778 498293278222136720 551099726729989816 149940343283925029 1677751211246811281\n", "output": "144527324/433581971\n"}, {"input": "12\n254904759290707697 50... | code_stdio |
[
{
"content": "There 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 development.\n\nFor such a store manager, you decided to create a program that ... | [{"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"}, {"input": "15\n1\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*... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.