messages
listlengths
1
1
ground_truth
stringlengths
156
726k
dataset
stringclasses
2 values
[ { "content": "Hint\n\n* One grid may be filled more than once\n* Even if it can be represented by one line segment such as '1', it may be represented by two or more line segments.\n\n\n\nSample Input 1\nFormula for Sample Input 1.\n\nSample Input 2\nSample Input 2 formula. Another character may get inside the s...
[{"input": "23\n1 1 3 1\n3 1 3 3\n3 3 1 3\n1 3 1 5\n1 5 3 5\n5 2 7 2\n7 2 7 4\n7 4 5 4\n5 4 5 6\n5 6 7 6\n11 4 13 4\n13 0 15 0\n15 0 15 4\n18 2 18 2\n21 5 23 5\n21 5 21 7\n21 7 23 7\n23 7 23 8\n23 9 21 9\n24 0 26 0\n24 0 24 4\n24 4 26 4\n26 0 26 4", "output": "-328\n"}, {"input": "23\n1 1 3 1\n3 1 3 3\n3 3 1 3\n1 3 1 5...
code_stdio
[ { "content": "There are N towers in the town where Ikta lives. Each tower is given a different number from 0 to N-1, and the tower with number i is called tower i. Curious Ikta was interested in the height of the N towers and decided to make a table T showing the magnitude relationship between them. T has N × N...
[{"input": "7\n0 1\n0 2\n2 3\n0 4\n0 5\n0 6", "output": "2071\n"}, {"input": "7\n0 1\n0 2\n1 3\n0 4\n1 5\n0 6", "output": "1303\n"}, {"input": "7\n0 1\n0 2\n0 3\n0 4\n0 5\n0 6", "output": "4683\n"}, {"input": "7\n0 1\n0 2\n0 3\n2 4\n0 5\n0 6", "output": "2071\n"}, {"input": "7\n0 1\n0 2\n0 3\n3 4\n0 5\n0 6", "output": ...
code_stdio
[ { "content": "$n$ students are taking an exam. The highest possible score at this exam is $m$. Let $a_{i}$ be the score of the $i$-th student. You have access to the school database which stores the results of all students.\n\nYou can change each student's score as long as the following conditions are satisfied...
[{"input": "27\n1 1\n0\n1 2\n0\n1 5\n0\n1 10\n0\n1 50\n0\n1 100\n0\n1 500\n0\n1 1000\n0\n1 5000\n0\n1 10000\n0\n1 50000\n0\n1 100000\n0\n1 5\n4\n1 5\n5\n1 10\n9\n1 10\n10\n1 100000\n9999\n1 100000\n100000\n1 4999\n386\n1 100000\n1\n4 5\n1 0 0 0\n4 5\n0 1 0 0\n4 5\n0 0 0 0\n4 5\n5 5 5 5\n4 5\n4 4 5 5\n4 5\n5 4 4 4\n4 5\...
code_stdio
[ { "content": "We have a string S of length N consisting of R, G, and B.\nFind the number of triples (i,~j,~k)~(1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n - S_i \\neq S_j, S_i \\neq S_k, and S_j \\neq S_k.\n - j - i \\neq k - j.\n\n-----Constraints-----\n - 1 \\leq N \\leq 4000\n...
[{"input": "4000\nGBRBRGGRRBRGBBGGRRGBRGGBRGGGBBGRGBRBRGGBGGGGRRGGBGGRGGGGRRGGRRGBBBGGRBGRRBBGGBRRBGGGGGBGGBGGRBBBGBGRGGRBGGRGRRRBRGBBBGGGRRBGRBBGGRGGRGRBGRRBGGRBRGGBBRGBRGRRGGRBGBRGBRGRRBGBRRBGRGBBGBRBGBBRBBGBBGBGGRBBRGRRGGRRBBBBRBBGBBGGRGRBBGGGBGGGGRRBBRGBBBBBRGGGBGGBBBRGRGRBGGGGBGBRGGBRGBRRRBGGBBRBBGGRRRBRRBRGGBGBBR...
code_stdio
[ { "content": "Igor K. always used to trust his favorite Kashpirovsky Antivirus. That is why he didn't hesitate to download the link one of his groupmates sent him via QIP Infinium. The link was said to contain \"some real funny stuff about swine influenza\". The antivirus had no objections and Igor K. run the f...
[{"input": "10110010010001110110110111100100011101101110010100100010110101011001011101111001\n1001000100\n1011001001\n0101100101\n0001110110\n1000101101\n0110110000\n0000010011\n1101111001\n1101010111\n1110010100\n", "output": "13739427\n"}, {"input": "0001010110111011010110011010110001010110001010111100010101101001101...
code_stdio
[ { "content": "There are N piles of stones. The i-th pile has A_i stones.\nAoki and Takahashi are about to use them to play the following game:\n - Starting with Aoki, the two players alternately do the following operation:\n - Operation: Choose one pile of stones, and remove one or more stones from it.\n - When...
[{"input": "300\n384661649102 749740371860 182994067519 635480054507 188947792922 485525176794 78108687147 989617350189 631154348796 697481765405 265428579953 267391231487 298335916571 638840284853 801747319246 75872927591 763161973616 67416808051 855953652500 952149595553 120076702790 865269978523 188163722408 6683657...
code_stdio
[ { "content": "You are given a sequence a consisting of n integers. You may partition this sequence into two sequences b and c in such a way that every element belongs exactly to one of these sequences. \n\nLet B be the sum of elements belonging to b, and C be the sum of elements belonging to c (if some of these...
[{"input": "100\n-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 -10...
code_stdio
[ { "content": "Do the following for a four-digit number N consisting of numbers 0-9.\n\n1. Let L be the number obtained as a result of arranging the numerical values ​​of each of the N digits in descending order.\n2. Let S be the number obtained as a result of arranging the numerical values ​​of each of the N di...
[{"input": "6174\n3985\n3333\n0000", "output": "0\n3\nNA\n"}, {"input": "6174\n1779\n3333\n0000", "output": "0\n6\nNA\n"}, {"input": "6174\n1794\n3333\n0000", "output": "0\n5\nNA\n"}, {"input": "6174\n1542\n3333\n0000", "output": "0\n2\nNA\n"}, {"input": "6174\n2326\n3333\n0000", "output": "0\n7\nNA\n"}, {"input": "617...
code_stdio
[ { "content": "Gena loves sequences of numbers. Recently, he has discovered a new type of sequences which he called an almost arithmetical progression. A sequence is an almost arithmetical progression, if its elements can be represented as:\n\n * a1 = p, where p is some integer; \n * ai = ai - 1 + ( - 1)i + 1·...
[{"input": "73\n531 626 701 57 708 511 54 441 297 697 411 253 397 652 21 59 851 561 539 461 629 894 275 417 127 960 433 243 963 247 5 368 969 541 408 485 319 117 441 131 265 357 1 659 267 983 643 285 913 782 813 569 99 781 297 636 645 341 6 17 601 129 509 197 226 105 241 737 86 128 762 647 849\n", "output": "4\n"}, {"i...
code_stdio
[ { "content": "The T9 typing predictor helps with suggestions for possible word combinations on an old-style numeric keypad phone. Each digit in the keypad (2-9) represents a group of 3-4 letters. To type a letter, press once the key which corresponds to the letter group that contains the required letter. Typing...
[{"input": "[\"gone\", \"hood\", \"good\", \"old\"]\n\"4663\"", "output": "[[\"gone\", \"hood\", \"good\"]]", "fn_name": "T9"}, {"input": "[\"goNe\", \"hood\", \"GOOD\", \"old\"]\n\"4663\"", "output": "[[\"goNe\", \"hood\", \"GOOD\"]]", "fn_name": "T9"}, {"input": "[\"good\", \"home\", \"new\"]\n\"4663\"", "output": "[...
code_functional
[ { "content": "Ilya is working for the company that constructs robots. Ilya writes programs for entertainment robots, and his current project is \"Bob\", a new-generation game robot. Ilya's boss wants to know his progress so far. Especially he is interested if Bob is better at playing different games than the pr...
[{"input": "129341234876124184 1 2\n1 3 3\n1 1 2\n1 2 3\n3 1 1\n3 1 3\n3 2 3\n", "output": "64670617438062091 64670617438062093\n"}, {"input": "129341234876124184 1 2\n1 3 3\n1 1 2\n1 2 3\n3 1 1\n3 1 3\n3 2 3\n", "output": "64670617438062091 64670617438062093\n"}, {"input": "1000000000000000000 2 1\n3 1 2\n2 3 3\n1 2 3...
code_stdio
[ { "content": "The map of Bertown can be represented as a set of n intersections, numbered from 1 to n and connected by m one-way roads. It is possible to move along the roads from any intersection to any other intersection. The length of some path from one intersection to another is the number of roads that one...
[{"input": "20 50\n20 3\n5 16\n1 3\n10 11\n10 15\n15 9\n20 9\n14 6\n16 5\n13 4\n11 5\n3 20\n13 17\n11 8\n11 6\n12 14\n16 18\n17 13\n18 7\n3 1\n8 10\n17 15\n7 2\n9 13\n5 11\n6 1\n2 16\n8 18\n10 8\n4 13\n9 15\n14 12\n1 6\n9 20\n7 18\n6 14\n7 6\n18 16\n2 7\n3 11\n15 17\n3 12\n14 10\n4 14\n19 4\n11 15\n4 19\n8 12\n17 8\n12...
code_stdio
[ { "content": "You are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits....
[{"input": "10000000000\n", "output": "6\n"}, {"input": "9999999967\n", "output": "10\n"}, {"input": "53937807463", "output": "10\n"}, {"input": "9876543210\n", "output": "6\n"}, {"input": "6983776800\n", "output": "5\n"}, {"input": "1881548213\n", "output": "6\n"}, {"input": "1483485061\n", "output": "7\n"}, {"input":...
code_stdio
[ { "content": "In the International System of Units (SI), various physical quantities are expressed in the form of \"numerical value + prefix + unit\" using prefixes such as kilo, mega, and giga. For example, \"3.5 kilometers\", \"5.1 milligrams\", and so on.\n\nOn the other hand, these physical quantities can b...
[{"input": "7\n12.729479136172973 kilo metfrt\n0.45 mega sttaw\n0.000000000000000000000001 yotta mrags\n1000000000000000000000000 yocto seconds\n42 amperes\n0.951642419825234 joulfs\n1234.56789012345678901234567890 hecto pascals", "output": "1.2729479136172973 * 10^4 metfrt\n4.5 * 10^5 sttaw\n1 * 10^0 mrags\n1.00000000...
code_stdio
[ { "content": "We call a positive integer number fair if it is divisible by each of its nonzero digits. For example, $102$ is fair (because it is divisible by $1$ and $2$), but $282$ is not, because it isn't divisible by $8$. Given a positive integer $n$. Find the minimum integer $x$, such that $n \\leq x$ and $...
[{"input": "100\n95\n94\n31\n65\n35\n95\n70\n78\n81\n36\n69\n97\n39\n28\n89\n62\n36\n23\n35\n21\n36\n11\n65\n39\n13\n34\n79\n87\n91\n70\n43\n82\n24\n97\n6\n87\n49\n81\n60\n92\n63\n9\n16\n6\n31\n90\n6\n5\n70\n48\n27\n86\n65\n66\n45\n8\n67\n17\n24\n44\n34\n93\n26\n32\n82\n54\n72\n83\n94\n81\n79\n79\n9\n9\n4\n59\n42\n83\n...
code_stdio
[ { "content": "Writing light novels is the most important thing in Linova's life. Last night, Linova dreamed about a fantastic kingdom. She began to write a light novel for the kingdom as soon as she woke up, and of course, she is the queen of it.\n\n<image>\n\nThere are n cities and n-1 two-way roads connecting...
[{"input": "20 2\n9 7\n3 7\n15 9\n1 3\n11 12\n18 7\n17 18\n20 1\n4 11\n2 11\n12 18\n8 18\n13 2\n19 2\n10 11\n6 13\n5 8\n14 1\n16 13\n", "output": "16\n"}, {"input": "20 7\n9 7\n3 13\n15 9\n1 3\n11 9\n18 7\n17 18\n20 1\n4 11\n2 11\n12 18\n8 18\n13 2\n19 1\n10 14\n6 13\n5 8\n14 1\n16 13\n", "output": "46\n"}, {"input": "...
code_stdio
[ { "content": "You have decided to write a book introducing good restaurants.\nThere are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i.\nNo two restaurants have the sam...
[{"input": "100\nsjcgcvldl 23\niyzgsoes 80\nu 82\nceooyrdyri 34\nhfzlpcs 100\nykfpusci 17\nvkke 94\nqnartzvpb 86\njqxf 35\nvsemwdhc 31\njuteior 78\nbvdq 3\nocnma 84\nkidwanqdvn 52\nmjopq 57\ntqfq 38\nikrqwzh 61\nxlcbfaszw 96\nceooyrdyri 10\nrdz 98\nxxywgn 64\nfbft 74\nebh 29\npio 95\nebh 88\nph 50\naqapninv 40\ncvvpogp...
code_stdio
[ { "content": "Vladik was bored on his way home and decided to play the following game. He took n cards and put them in a row in front of himself. Every card has a positive integer number not exceeding 8 written on it. He decided to find the longest subsequence of cards which satisfies the following conditions:\...
[{"input": "120\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5\n", "output": "120\n"}, {"input": "120\n8 8 8 8 8 8 8 8 8 8 8 8...
code_stdio
[ { "content": "Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.\n\nValera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m wrong solutions and for each wrong solution h...
[{"input": "68 85\n43 55 2 4 72 45 19 56 53 81 18 90 11 87 47 8 94 88 24 4 67 9 21 70 25 66 65 27 46 13 8 51 65 99 37 77 71 59 71 79 22 56 49 43 57 85 95 81 40 28 60 36 72 81 60 40 16 78 61 37 29 26 15 95 70 27 50 97\n6 6 48 72 54 31 1 50 29 64 93 9 29 93 66 63 25 90 52 1 66 13 70 44 24 87 32 90 84 72 44 13 25 45 31 16...
code_stdio
[ { "content": "Alexandra has a paper strip with n numbers on it. Let's call them a_{i} from left to right.\n\nNow Alexandra wants to split it into some pieces (possibly 1). For each piece of strip, it must satisfy:\n\n\n\n Each piece should contain at least l numbers.\n\n The difference between the maximal and t...
[{"input": "2 1000000000 2\n-1000000000 1000000000\n", "output": "-1\n"}, {"input": "2 0000000000 2\n-1000000000 1000000000\n", "output": "-1\n"}, {"input": "2 0000100000 2\n-1000000000 1000000000\n", "output": "-1\n"}, {"input": "2 0000000000 3\n-1000000000 1000000000\n", "output": "-1\n"}, {"input": "2 1000000000 1\n...
code_stdio
[ { "content": "**Story** \nOn some island lives a chameleon population. Chameleons here can be of only one of three colors - red, green and blue. Whenever two chameleons of different colors meet, they can change their colors to a third one (i.e. when red and blue chameleons meet, they can both become green). Th...
[{"input": "[673905669, 673905681, 174867657]\n2", "output": "[673905681]", "fn_name": "chameleon"}, {"input": "[1, 2147483646, 1]\n1", "output": "[1]", "fn_name": "chameleon"}, {"input": "[34, 32, 35]\n0", "output": "[35]", "fn_name": "chameleon"}, {"input": "[34, 32, 35]\n1", "output": "[-1]", "fn_name": "chameleon"}...
code_functional
[ { "content": "Imp is watching a documentary about cave painting. [Image] \n\nSome numbers, carved in chaotic order, immediately attracted his attention. Imp rapidly proposed a guess that they are the remainders of division of a number n by all integers i from 1 to k. Unfortunately, there are too many integers t...
[{"input": "1000000000000000000 1000000000000000000\n", "output": "No\n"}, {"input": "1000000000000000000 1000000000000000000\n", "output": "No\n"}, {"input": "1000000000000000000 1000000000000100000\n", "output": "No\n"}, {"input": "1174471498216289354 375019787446735639\n", "output": "No\n"}, {"input": "1218163628470...
code_stdio
[ { "content": "You are given a graph with $n$ nodes and $m$ directed edges. One lowercase letter is assigned to each node. We define a path's value as the number of the most frequently occurring letter. For example, if letters on a path are \"abaca\", then the value of that path is $3$. Your task is find a path ...
[{"input": "10 50\nebibwbjihv\n1 10\n1 2\n5 4\n1 8\n9 7\n5 6\n1 8\n8 7\n2 6\n5 4\n1 9\n3 2\n3 3\n5 6\n5 9\n2 4\n2 7\n3 9\n1 2\n1 7\n1 10\n3 7\n1 8\n3 10\n8 6\n1 7\n10 6\n1 6\n10 8\n1 5\n2 10\n3 9\n1 8\n8 3\n3 7\n5 2\n1 10\n1 4\n5 3\n3 2\n1 2\n5 8\n10 4\n2 10\n8 2\n1 9\n1 8\n1 2\n3 4\n1 8\n", "output": "-1\n"}, {"input"...
code_stdio
[ { "content": "William has two arrays $a$ and $b$, each consisting of $n$ items.\n\nFor some segments $l..r$ of these arrays William wants to know if it is possible to equalize the values of items in these segments using a balancing operation. Formally, the values are equalized if for each $i$ from $l$ to $r$ ho...
[{"input": "10 10\n894887111 146743785 109114345 815955099 968902979 475266442 919978438 174336213 986559256 952162378\n894887111 146743785 820647914 104421530 968902979 475266442 919978438 908881640 252013829 952162378\n7 10\n6 9\n5 9\n1 7\n2 9\n1 3\n3 10\n1 10\n3 7\n2 4\n", "output": "734545427\n734545427\n734545427\...
code_stdio
[ { "content": "Baby Ehab is known for his love for a certain operation. He has an array $a$ of length $n$, and he decided to keep doing the following operation on it:\n\nhe picks $2$ adjacent elements; he then removes them and places a single integer in their place: their bitwise XOR . Note that the length of th...
[{"input": "15\n2\n660632533 660632533\n2\n774306959 774306959\n2\n971739496 784083784\n2\n775353256 672614891\n2\n403290217 403290217\n2\n651261320 651261320\n2\n894672621 894672621\n2\n46281693 620415865\n2\n92929999 409128591\n2\n26890011 630323358\n2\n443724284 443724284\n2\n308822599 308822599\n2\n895967167 895967...
code_stdio
[ { "content": "problem\n\nDo you know Just Odd Inventions? The business of this company is to \"just odd inventions\". Here we call it JOI for short.\n\nJOI has two offices, each of which has square rooms of the same size arranged in a grid pattern. All the rooms that are in contact with each other have an ID ca...
[{"input": "5\n2 2 1 2\n6 5\n1 17\n3 2 2 1\n11 1 20\n10 18 3\n8\n5 4 1 3\n5 5 4 5 2\n8 2 1 9 7\n1 1 3 5 1\n7 2 7 1 3\n6 5 6 2\n2 3 5 8 2 7\n1 6 9 4 5 1\n2 5 1 4 2 2\n5 4 2 5 3 3\n12 1 5 1 5 6\n6\n3 3 2 2\n2 17 2\n9 1 9\n2 9 2\n2 2 1 1\n1 3\n5 7\n0", "output": "17\n4\n9\n"}, {"input": "5\n2 2 1 2\n6 5\n1 17\n3 2 2 1\n6 ...
code_stdio
[ { "content": "There is data of up to 100 characters per line, consisting of half-width alphabetic character strings. Some lines are symmetric (same whether read from the left edge or the right edge). Create a program that reads this data and outputs the number of symmetric strings in it. Note that lines consist...
[{"input": "abcba\nsx\nabcddcba\nrstrd", "output": "2\n"}, {"input": "abcca\nsw\nabcddcba\nrstrd", "output": "1\n"}, {"input": "abcca\nxt\nadcbdcba\nrdsrt", "output": "0\n"}, {"input": "abcba\nsw\nabcddcba\nrstrd", "output": "2\n"}, {"input": "accba\nsw\nabcddcba\nrstrd", "output": "1\n"}, {"input": "accba\nsx\nabcddcb...
code_stdio
[ { "content": "Little Vitaly loves different algorithms. Today he has invented a new algorithm just for you. Vitaly's algorithm works with string s, consisting of characters \"x\" and \"y\", and uses two following operations at runtime: Find two consecutive characters in the string, such that the first of them ...
[{"input": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n", "output": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"}, {"input": "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy\n", "output": "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy\n"}, {"input": "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy\n", "output": "yyyyyyyyyyyyyyyy...
code_stdio
[ { "content": "Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i. e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury mem...
[{"input": "20 20\n-1012 625 39 -1747 -1626 898 -1261 180 -876 -1417 -1853 -1510 -1499 -561 -1824 442 -895 13 1857 1860\n-1269013 -1270956 -1264151 -1266004 -1268121 -1258341 -1269574 -1271851 -1258302 -1271838 -1260049 -1258966 -1271398 -1267514 -1269981 -1262038 -1261675 -1262734 -1260777 -1261858\n", "output": "1\n"...
code_stdio
[ { "content": "Mountaineers Mr. Takahashi and Mr. Aoki recently trekked across a certain famous mountain range. The mountain range consists of N mountains, extending from west to east in a straight line as Mt. 1, Mt. 2, ..., Mt. N. Mr. Takahashi traversed the range from the west and Mr. Aoki from the east.\n\nTh...
[{"input": "10\n1 3776 3776 8848 8848 8848 8848 8848 8848 8848\n8848 8848 8848 8848 8848 8848 8848 8848 3776 5", "output": "884111967"}, {"input": "5\n16 0 4 -1 2\n19 24 -3 0 -11", "output": "0\n"}, {"input": "5\n16 0 1 -1 2\n19 24 -3 0 -11", "output": "0\n"}, {"input": "5\n16 0 2 -1 2\n19 24 -3 0 -11", "output": "0\n"...
code_stdio
[ { "content": "At a break Vanya came to the class and saw an array of $n$ $k$-bit integers $a_1, a_2, \\ldots, a_n$ on the board. An integer $x$ is called a $k$-bit integer if $0 \\leq x \\leq 2^k - 1$. \n\nOf course, Vanya was not able to resist and started changing the numbers written on the board. To ensure t...
[{"input": "20 30\n30095551 418501267 319405832 181290086 651729244 244371014 1160853882 491522284 582219539 1510068105 512276151 438340777 293617992 759003208 759003208 1 1043646272 1073741823 1431280338 1073741823\n", "output": "210\n"}, {"input": "20 30\n30095551 418501267 319405832 181290086 651729244 1073741823 12...
code_stdio
[ { "content": "You are going to be given a word. Your job will be to make sure that each character in that word has the exact same number of occurrences. You will return `true` if it is valid, or `false` if it is not.\n\nFor example:\n\n`\"abcabc\"` is a valid word because `'a'` appears twice, `'b'` appears twic...
[{"input": "\"AbcabcC\"", "output": "[false]", "fn_name": "validate_word"}, {"input": "\"abcabcd\"", "output": "[false]", "fn_name": "validate_word"}, {"input": "\"abc!abc!\"", "output": "[true]", "fn_name": "validate_word"}, {"input": "\"abc:abc\"", "output": "[false]", "fn_name": "validate_word"}, {"input": "\"abcabc...
code_functional
[ { "content": "You are given a set $T$, which is a subset of $U$. The set $U$ consists of $0, 1, ... n-1$. Print all sets, each of which is a subset of $U$ and includes $T$ as a subset. Note that we represent $0, 1, ... n-1$ as 00...0001, 00...0010, 00...0100, ..., 10...0000 in binary respectively and the intege...
[{"input": "4\n0 -1 -1", "output": "0:\n1: 0\n2: 1\n3: 0 1\n4: 2\n5: 0 2\n6: 1 2\n7: 0 1 2\n8: 3\n9: 0 3\n10: 1 3\n11: 0 1 3\n12: 2 3\n13: 0 2 3\n14: 1 2 3\n15: 0 1 2 3\n"}, {"input": "4\n0 -2 -1", "output": "0:\n1: 0\n2: 1\n3: 0 1\n4: 2\n5: 0 2\n6: 1 2\n7: 0 1 2\n8: 3\n9: 0 3\n10: 1 3\n11: 0 1 3\n12: 2 3\n13: 0 2 3\n1...
code_stdio
[ { "content": "You have a string $s$ — a sequence of commands for your toy robot. The robot is placed in some cell of a rectangular grid. He can perform four commands: 'W' — move one cell up; 'S' — move one cell down; 'A' — move one cell left; 'D' — move one cell right. \n\nLet $Grid(s)$ be the grid of minim...
[{"input": "3\nDSAWWAW\nD\nWA\n", "output": "8\n2\n4\n"}, {"input": "3\nDSAWWAW\nD\nAW\n", "output": "8\n2\n4\n"}, {"input": "3\nWSAWDAW\nD\nAW\n", "output": "4\n2\n4\n"}, {"input": "3\nDAAWWSW\nD\nAW\n", "output": "6\n2\n4\n"}, {"input": "3\nWAWWASD\nD\nWA\n", "output": "8\n2\n4\n"}, {"input": "3\nASAWWDW\nD\nWA\n", "...
code_stdio
[ { "content": "There are N blocks arranged in a row, numbered 1 to N from left to right. Each block has a weight, and the weight of Block i is A_i. Snuke will perform the following operation on these blocks N times:\n\n* Choose one block that is still not removed, and remove it. The cost of this operation is the...
[{"input": "10\n1 2 4 16 20 26 89 128 21 512", "output": "455264577\n"}, {"input": "10\n1 2 5 16 20 26 89 128 21 512", "output": "468151137\n"}, {"input": "10\n1 2 5 16 30 26 89 128 21 512", "output": "603626337\n"}, {"input": "10\n1 2 4 8 20 32 89 128 21 512", "output": "429828417\n"}, {"input": "10\n1 2 4 8 20 26 89 ...
code_stdio
[ { "content": "In this problem we assume the Earth to be a completely round ball and its surface a perfect sphere. The length of the equator and any meridian is considered to be exactly 40 000 kilometers. Thus, travelling from North Pole to South Pole or vice versa takes exactly 20 000 kilometers.\n\nLimak, a po...
[{"input": "10\n20000 South\n20000 North\n20000 South\n20000 North\n20000 South\n20000 North\n20000 South\n20000 North\n20000 South\n20000 North\n", "output": "YES\n"}, {"input": "10\n20000 South\n20000 North\n20000 South\n20000 North\n20000 South\n20000 North\n20000 South\n20000 North\n20000 South\n20000 North\n", "ou...
code_stdio
[ { "content": "Much cooler than your run-of-the-mill Fibonacci numbers, the Triple Shiftian are so defined: `T[n] = 4 * T[n-1] - 5 * T[n-2] + 3 * T[n-3]`.\n\nYou are asked to create a function which accept a base with the first 3 numbers and then returns the nth element.\n```python\ntriple_shiftian([1,1,1],25) =...
[{"input": "[6, 7, 2]\n35", "output": "[-21379280887590]", "fn_name": "triple_shiftian"}, {"input": "[1, 1, 1]\n35", "output": "[10127083068293]", "fn_name": "triple_shiftian"}, {"input": "[1, 2, 3]\n35", "output": "[17037073417493]", "fn_name": "triple_shiftian"}, {"input": "[3, 2, 1]\n35", "output": "[23471258855679]...
code_functional
[ { "content": "#### Task:\n\nYour job here is to implement a function `factors`, which takes a number `n`, and outputs an array of arrays comprised of two\nparts, `sq` and `cb`. The part `sq` will contain all the numbers that, when squared, yield a number which is a factor of `n`,\nwhile the `cb` part will conta...
[{"input": "100", "output": "[[[2, 5, 10], []]]", "fn_name": "factors"}, {"input": "16", "output": "[[[2, 4], [2]]]", "fn_name": "factors"}, {"input": "81", "output": "[[[3, 9], [3]]]", "fn_name": "factors"}, {"input": "80", "output": "[[[2, 4], [2]]]", "fn_name": "factors"}, {"input": "120", "output": "[[[2], [2]]]", ...
code_functional
[ { "content": "Does \\sqrt{a} + \\sqrt{b} < \\sqrt{c} hold?\n\nConstraints\n\n* 1 \\leq a, b, c \\leq 10^9\n* All values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\n\na \\ b \\ c\n\n\nOutput\n\nIf \\sqrt{a} + \\sqrt{b} < \\sqrt{c}, print `Yes`; otherwise, pri...
[{"input": "-10 -1 1", "output": "Yes\n"}, {"input": "-10 -1 0", "output": "Yes\n"}, {"input": "-16 -1 0", "output": "Yes\n"}, {"input": "110 -1 -3", "output": "No\n"}, {"input": "-1 -14 2", "output": "Yes\n"}, {"input": "111 -1 -3", "output": "No\n"}, {"input": "-1 -1 9", "output": "Yes\n"}, {"input": "-1 -2 9", "outp...
code_stdio
[ { "content": "You have a Petri dish with bacteria and you are preparing to dive into the harsh micro-world. But, unfortunately, you don't have any microscope nearby, so you can't watch them.\n\nYou know that you have $n$ bacteria in the Petri dish and size of the $i$-th bacteria is $a_i$. Also you know intergal...
[{"input": "8 1000000\n1 1 5 1000000 1000000 2 2 2\n", "output": "2\n"}, {"input": "8 1000000\n1 1 5 1000000 1000000 2 2 2\n", "output": "2\n"}, {"input": "8 1000000\n2 1 5 1000000 1000000 2 2 2\n", "output": "2\n"}, {"input": "15 1\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n", "output": "15\n"}, {"input": "15 1\n1 1 1 1 1 1 1 1 ...
code_stdio
[ { "content": "Your friend has been out shopping for puppies (what a time to be alive!)... He arrives back with multiple dogs, and you simply do not know how to respond!\n\nBy repairing the function provided, you will find out exactly how you should respond, depending on the number of dogs he has.\n\nThe number ...
[{"input": "100", "output": "[\"Woah that's a lot of dogs!\"]", "fn_name": "how_many_dalmatians"}, {"input": "80", "output": "[\"Woah that's a lot of dogs!\"]", "fn_name": "how_many_dalmatians"}, {"input": "26", "output": "[\"More than a handful!\"]", "fn_name": "how_many_dalmatians"}, {"input": "14", "output": "[\"Mor...
code_functional
[ { "content": "You are responsible for installing a gas pipeline along a road. Let's consider the road (for simplicity) as a segment $[0, n]$ on $OX$ axis. The road can have several crossroads, but for simplicity, we'll denote each crossroad as an interval $(x, x + 1)$ with integer $x$. So we can represent the r...
[{"input": "4\n8 2 5\n00110010\n8 1 1\n00110010\n9 100000000 100000000\n010101010\n2 5 1\n00\n", "output": "94\n25\n2900000000\n13\n"}, {"input": "4\n8 2 5\n00110010\n8 1 1\n01110010\n9 100000000 100000000\n010101010\n2 5 1\n00\n", "output": "94\n26\n2900000000\n13\n"}, {"input": "4\n8 2 5\n00110010\n8 1 1\n00111010\n9...
code_stdio
[ { "content": "Polycarp has recently created a new level in this cool new game Berlio Maker 85 and uploaded it online. Now players from all over the world can try his level.\n\nAll levels in this game have two stats to them: the number of plays and the number of clears. So when a player attempts the level, the n...
[{"input": "1\n99\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 1\n1 1\n1 1\n1 1\n1 1\n1...
code_stdio
[ { "content": "Doubly linked list is one of the fundamental data structures. A doubly linked list is a sequence of elements, each containing information about the previous and the next elements of the list. In this problem all lists have linear structure. I.e. each element except the first has exactly one previo...
[{"input": "100\n0 0\n0 0\n0 0\n97 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 29\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n12 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n...
code_stdio
[ { "content": "Let's call the following process a transformation of a sequence of length $n$.\n\nIf the sequence is empty, the process ends. Otherwise, append the greatest common divisor (GCD) of all the elements of the sequence to the result and remove one arbitrary element from the sequence. Thus, when the pro...
[{"input": "40471\n", "output": "1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
code_stdio
[ { "content": "We have a point $A$ with coordinate $x = n$ on $OX$-axis. We'd like to find an integer point $B$ (also on $OX$-axis), such that the absolute difference between the distance from $O$ to $B$ and the distance from $A$ to $B$ is equal to $k$. [Image] The description of the first test case. \n\nSince s...
[{"input": "6\n0 0\n5 8\n0 1000000\n1 0\n2 0\n0000000 1000000\n", "output": "0\n3\n1000000\n1\n0\n1000000\n"}, {"input": "6\n6 0\n0 8\n0 1000000\n0 0\n1 0\n0000000 1000000\n", "output": "0\n8\n1000000\n0\n1\n1000000\n"}, {"input": "6\n0 0\n5 8\n1 1000000\n1 0\n2 0\n0000000 1000000\n", "output": "0\n3\n999999\n1\n0\n100...
code_stdio
[ { "content": "G: Working\n\nKou decided to do the same number of jobs every day for the next $ N $.\n\n$ A_i $ jobs are added on the $ i $ day of the $ N $ day.\n\nMr. Kou has no work to do now, and he doesn't have to finish all the work by the $ N $ day.\n\nHow many jobs can you do in a day?\n\nHowever, Mr. Ko...
[{"input": "5\n6 -27 -3 -2 -29", "output": "-11\n"}, {"input": "5\n6 -27 -3 -1 -29", "output": "-10\n"}, {"input": "5\n4 -31 0 -1 -28", "output": "-13\n"}, {"input": "5\n-2 -12 7 -1 32", "output": "-7\n"}, {"input": "5\n3 -31 0 -1 -1", "output": "-14\n"}, {"input": "5\n3 -35 0 -1 -1", "output": "-16\n"}, {"input": "5\n...
code_stdio
[ { "content": "Everyone knows that 2010 FIFA World Cup is being held in South Africa now. By the decision of BFA (Berland's Football Association) next World Cup will be held in Berland. BFA took the decision to change some World Cup regulations:\n\n * the final tournament features n teams (n is always even) \n ...
[{"input": "4\nTeMnHVvWKpwlpubwyhzqvc\nAWJwc\nbhbxErlydiwtoxy\nEVASMeLpfqwjkke\nAWJwc-TeMnHVvWKpwlpubwyhzqvc 43:73\nbhbxErlydiwtoxy-TeMnHVvWKpwlpubwyhzqvc 38:99\nbhbxErlydiwtoxy-AWJwc 33:84\nEVASMeLpfqwjkke-TeMnHVvWKpwlpubwyhzqvc 79:34\nEVASMeLpfqwjkke-AWJwc 243:7\nEVASMeLpfqwjkke-bhbxErlydiwtoxy 3:6\n", "output": "EVA...
code_stdio
[ { "content": "In Group C of the 3rd year, we decided to use the \"class flag\" used at the sports festival on November 10, 2007 at future class reunions. So, in order to decide which students to keep the \"class flag\", I decided to play the following game using a large amount of candy that the teacher gave me ...
[{"input": "50\n5576\n6063\n5578", "output": "3C11\n3C38\n3C18\n3C01\n"}, {"input": "50\n5576\n6063\n515", "output": "3C11\n3C38\n3C18\n3C08\n"}, {"input": "50\n1864\n13193\n39", "output": "3C11\n3C31\n3C11\n3C39\n"}, {"input": "50\n5576\n5577\n5578", "output": "3C11\n3C38\n3C39\n3C01"}, {"input": "50\n5576\n6063\n39",...
code_stdio
[ { "content": "E869120's and square1001's 16-th birthday is coming soon.\n\nTakahashi from AtCoder Kingdom gave them a round cake cut into 16 equal fan-shaped pieces.\nE869120 and square1001 were just about to eat A and B of those pieces, respectively,\n\nwhen they found a note attached to the cake saying that \...
[{"input": "-2 -1", "output": "Yay!\n"}, {"input": "-3 -1", "output": "Yay!\n"}, {"input": "-6 -1", "output": "Yay!\n"}, {"input": "-4 -1", "output": "Yay!\n"}, {"input": "5 4\n", "output": "Yay!\n"}, {"input": "8 8\n", "output": "Yay!\n"}, {"input": "1 1\n", "output": "Yay!\n"}, {"input": "6 7\n", "output": "Yay!\n"},...
code_stdio
[ { "content": "Do you remember how Kai constructed the word \"eternity\" using pieces of ice as components?\n\nLittle Sheldon plays with pieces of ice, each piece has exactly one digit between 0 and 9. He wants to construct his favourite number t. He realized that digits 6 and 9 are very similar, so he can rotat...
[{"input": "2569\n09629965966225566262579565696595696954525955599926383255926955906666526913925296256629966292216925259225261263256229509529259756291959568892569599592218262625256926619266669279659295979299556965525222\n", "output": "44\n"}, {"input": "2559\n5255599526926555569592225552599525525955525925256265562252629...
code_stdio
[ { "content": "Alice and Bob have received three big piles of candies as a gift. Now they want to divide these candies as fair as possible. To do this, Alice takes one pile of candies, then Bob takes one of the other two piles. The last pile is split between Alice and Bob as they want: for example, it is possibl...
[{"input": "4\n1 3 4\n1 10 100\n10000000000000000 10000000000000000 10000000000000000\n23 34 45\n", "output": "4\n55\n15000000000000000\n51\n"}, {"input": "4\n1 3 4\n1 10 100\n10000000000000000 10000000000000000 10000000000000000\n23 34 22\n", "output": "4\n55\n15000000000000000\n39\n"}, {"input": "4\n1 1 4\n1 10 100\n...
code_stdio
[ { "content": "JavaScript provides a built-in parseInt method.\n\nIt can be used like this:\n\n- `parseInt(\"10\")` returns `10`\n- `parseInt(\"10 apples\")` also returns `10`\n\nWe would like it to return `\"NaN\"` (as a string) for the second case because the input string is not a valid number.\n\nYou are aske...
[{"input": "\"5 friends\"", "output": "[\"NaN\"]", "fn_name": "my_parse_int"}, {"input": "\"5friends\"", "output": "[\"NaN\"]", "fn_name": "my_parse_int"}, {"input": "\"I <3 u\"", "output": "[\"NaN\"]", "fn_name": "my_parse_int"}, {"input": "\"17.42\"", "output": "[\"NaN\"]", "fn_name": "my_parse_int"}, {"input": "\"12...
code_functional
[ { "content": "A little girl loves problems on bitwise operations very much. Here's one of them.\n\nYou are given two integers l and r. Let's consider the values of $a \\oplus b$ for all pairs of integers a and b (l ≤ a ≤ b ≤ r). Your task is to find the maximum value among all considered ones.\n\nExpression $x ...
[{"input": "259703440079833303 1004763675266938032\n", "output": "1152921504606846975\n"}, {"input": "190442232278841373 980738846929096255\n", "output": "1152921504606846975\n"}, {"input": "462451489958473150 957447393463701191\n", "output": "1152921504606846975\n"}, {"input": "491113582000560303 858928223424873439\n"...
code_stdio
[ { "content": "There are N people standing in a queue from west to east.\nGiven is a string S of length N representing the directions of the people.\nThe i-th person from the west is facing west if the i-th character of S is L, and east if that character of S is R.\nA person is happy if the person in front of hi...
[{"input": "95617 23923\nRRRLRRRLLRRLRRLRLRRLLLRLLLRRRRRRRLLRRRRLRRRLLRLLRLLLRLLRLRLRRRRRLRRLRRRLRRRLRRLLRLLRLLRLRLRRLRRRLRLRLRLRLLLLRRLRLRRRRLRLLLLLLRLRRRLRLRRLRLLRLLRRLRRRRRRLRRRLRLRLRRRLLLRLRLRLLLLLRRRLRLLLLRLLRRLLLLRRLRLRLRLLRLLLLLLRRLRRRRLLLRLLLRLRRRRLRRRRLLRLRRRRRLRLRRLLRLLLRLRLRRLLLRRRRRRLRRLLLLRRLRLLRLLLRLRRLRL...
code_stdio
[ { "content": "In this Kata, you will be given a string and your task will be to return the length of the longest prefix that is also a suffix. A prefix is the start of a string while the suffix is the end of a string. For instance, the prefixes of the string `\"abcd\"` are `[\"a\",\"ab\",\"abc\"]`. The suffixe...
[{"input": "\"abcdabcc\"", "output": "[0]", "fn_name": "solve"}, {"input": "\"abcdabc\"", "output": "[3]", "fn_name": "solve"}, {"input": "\"abcabca\"", "output": "[1]", "fn_name": "solve"}, {"input": "\"abcabc\"", "output": "[3]", "fn_name": "solve"}, {"input": "\"acbacc\"", "output": "[0]", "fn_name": "solve"}, {"inp...
code_functional
[ { "content": "Jeff's friends know full well that the boy likes to get sequences and arrays for his birthday. Thus, Jeff got sequence p_1, p_2, ..., p_{n} for his birthday.\n\nJeff hates inversions in sequences. An inversion in sequence a_1, a_2, ..., a_{n} is a pair of indexes i, j (1 ≤ i < j ≤ n), such that an...
[{"input": "53\n-3 2 -3 -5 -2 7 0 -2 1 6 -1 2 5 -3 3 -6 -2 -5 -3 -6 4 -4 -2 6 1 -7 -6 -4 0 2 -5 -1 -2 -6 2 2 7 -2 -3 1 0 -4 3 4 -2 7 -3 7 1 3 -10 -5 3\n", "output": "298\n"}, {"input": "53\n-3 2 -3 -5 -2 7 0 -2 1 6 -1 2 5 -3 3 -6 -2 -5 -3 -6 4 -4 -2 6 1 -3 -6 -4 0 2 -5 -1 -2 -6 2 2 7 -2 -3 1 0 -6 3 4 -2 7 -3 7 1 3 -10 ...
code_stdio
[ { "content": "Write a function `count_vowels` to count the number of vowels in a given string.\n\n### Notes:\n\n- Return `nil` or `None` for non-string inputs.\n- Return `0` if the parameter is omitted.\n\n### Examples:\n\n```python\ncount_vowels(\"abcdefg\") => 2\ncount_vowels(\"aAbcdeEfg\") => 4\n\ncount_vowe...
[{"input": "\"asdfdsaf asdfsasdfdsafgjlsdjf asdfdsf daf 13243242 dsafdsafds\"", "output": "[9]", "fn_name": "count_vowels"}, {"input": "\"asdfviosdfopsiewrwwer asdf asdfdsaf)(asdflkajdsf \"", "output": "[12]", "fn_name": "count_vowels"}, {"input": "\"asdfdsaf asdfsdaf 13243242 dsafdsafds\"", "output": "[6]",...
code_functional
[ { "content": "Give the summation of all even numbers in a Fibonacci sequence up to, but not including, the maximum value.\n\nThe Fibonacci sequence is a series of numbers where the next value is the addition of the previous two values. The series starts with 0 and 1:\n\n0 1 1 2 3 5 8 13 21...\n\nFor example:\n`...
[{"input": "2147483647", "output": "[1485607536]", "fn_name": "even_fib"}, {"input": "1000000000", "output": "[350704366]", "fn_name": "even_fib"}, {"input": "100000000", "output": "[82790070]", "fn_name": "even_fib"}, {"input": "1000000", "output": "[1089154]", "fn_name": "even_fib"}, {"input": "1000", "output": "[798...
code_functional
[ { "content": "From beginning till end, this message has been waiting to be conveyed.\n\nFor a given unordered multiset of n lowercase English letters (\"multi\" means that a letter may appear more than once), we treat all letters as strings of length 1, and repeat the following operation n - 1 times:\n\n * Rem...
[{"input": "100101\n", "output": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
code_stdio
[ { "content": "LiLand is a country, consisting of n cities. The cities are numbered from 1 to n. The country is well known because it has a very strange transportation system. There are many one-way flights that make it possible to travel between the cities, but the flights are arranged in a way that once you le...
[{"input": "5 6\n1 2\n2 3\n3 5\n1 4\n4 5\n1 3\n", "output": "Yes\n1\n1\n2\n2\n2\n2\n"}, {"input": "4 4\n1 2\n2 3\n3 4\n1 3\n", "output": "Yes\n1\n1\n2\n2\n"}, {"input": "4 3\n1 2\n2 3\n3 4\n-1 -2\n", "output": "Yes\n2\n2\n2\n"}, {"input": "4 3\n1 2\n2 3\n3 4\n-1 -4\n", "output": "Yes\n2\n2\n2\n"}, {"input": "4 3\n1 2\n...
code_stdio
[ { "content": "You get a new job working for Eggman Movers. Your first task is to write a method that will allow the admin staff to enter a person’s name and return what that person's role is in the company.\n\nYou will be given an array of object literals holding the current employees of the company. You code...
[{"input": "\"Dipper Pines\"", "output": "[\"Does not work here!\"]", "fn_name": "find_employees_role"}, {"input": "\"Bell Jewel\"", "output": "[\"Does not work here!\"]", "fn_name": "find_employees_role"}, {"input": "\"Bell Anna\"", "output": "[\"Does not work here!\"]", "fn_name": "find_employees_role"}, {"input": "\...
code_functional
[ { "content": "A boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet with n rows and m columns. Bob shaded some of the squares on the sheet. Having seen his masterpiece, he decided to share it with his elder brother, who lives in Flatland. Now Bob has to send his picture by post, bu...
[{"input": "50 1\n.\n*\n*\n*\n.\n.\n*\n.\n*\n*\n*\n*\n*\n*\n*\n.\n*\n*\n*\n*\n*\n*\n*\n*\n*\n*\n*\n*\n*\n.\n.\n.\n.\n*\n*\n.\n*\n*\n.\n.\n.\n.\n*\n*\n.\n.\n.\n.\n.\n.\n", "output": "*\n*\n*\n.\n.\n*\n.\n*\n*\n*\n*\n*\n*\n*\n.\n*\n*\n*\n*\n*\n*\n*\n*\n*\n*\n*\n*\n*\n.\n.\n.\n.\n*\n*\n.\n*\n*\n.\n.\n.\n.\n*\n*\n"}, {"inp...
code_stdio
[ { "content": "Qwerty the Ranger took up a government job and arrived on planet Mars. He should stay in the secret lab and conduct some experiments on bacteria that have funny and abnormal properties. The job isn't difficult, but the salary is high.\n\nAt the beginning of the first experiment there is a single b...
[{"input": "1000000 1000000 1000000 1000000\n", "output": "1000000\n"}, {"input": "1000000 1000000 1000000 1010000\n", "output": "1000000\n"}, {"input": "100000 100000 1000000 1000000\n", "output": "999999\n"}, {"input": "126480 295416 829274 421896\n", "output": "829273\n"}, {"input": "722229 410423 118215 838505\n", ...
code_stdio
[ { "content": "12:17 (UTC): The sample input 1 and 2 were swapped. The error is now fixed. We are very sorry for your inconvenience.\nThere are N children in AtCoder Kindergarten, conveniently numbered 1 through N. Mr. Evi will distribute C indistinguishable candies to the children.\nIf child i is given a candie...
[{"input": "4 13\n4 1 2 1\n4 1 10 1", "output": "714238057\n"}, {"input": "4 30\n3 1 1 1\n4 2 10 1", "output": "605469785\n"}, {"input": "4 12\n3 1 2 1\n11 1 5 2", "output": "809171659\n"}, {"input": "4 13\n4 1 2 1\n4 1 12 1", "output": "191070997\n"}, {"input": "4 21\n3 1 1 1\n4 2 10 1", "output": "278753645\n"}, {"in...
code_stdio
[ { "content": "After learning about polynomial hashing, Heidi decided to learn about shift-xor hashing. In particular, she came across this interesting problem.\n\nGiven a bitstring $y \\in \\{0,1\\}^n$ find out the number of different $k$ ($0 \\leq k < n$) such that there exists $x \\in \\{0,1\\}^n$ for which $...
[{"input": "111\n011101111010100111111000010101011110011000010101010001001011000111100101111000010110010011110100000111000100101\n", "output": "108\n"}, {"input": "111\n001101111000100111111000010101011110011000010101010001001011000111100101111101000110000011110110100111000100101\n", "output": "72\n"}, {"input": "111\n...
code_stdio
[ { "content": "In Chelyabinsk lives a much respected businessman Nikita with a strange nickname \"Boss\". Once Nikita decided to go with his friend Alex to the Summer Biathlon World Cup. Nikita, as a very important person, received a token which allows to place bets on each section no more than on one competitor...
[{"input": "20 30\n4 13 78 11\n13 19 56 41\n15 15 46 83\n4 9 74 72\n17 20 97 7\n15 20 29 64\n8 17 44 85\n4 18 26 46\n16 17 13 90\n16 16 39 89\n13 14 46 125\n14 18 67 18\n12 20 84 48\n10 20 49 32\n10 14 14 11\n6 18 80 84\n3 20 13 97\n12 20 62 42\n7 14 64 71\n5 19 38 17\n17 18 99 18\n11 15 83 22\n4 11 65 99\n8 16 89 45\n...
code_stdio
[ { "content": "Read problems statements in Mandarin Chinese and Russian. \n\nGrapes of Coderpur are very famous. Devu went to the market and saw that there were N people selling grapes. He didn’t like it because things were not very structured. So, he gave a task to Dhinwa to make things better. If Dhinwa succe...
[{"input": "2\n2 19\n5 10\n3 10\n10 3 17", "output": "23\n10\n"}, {"input": "2\n2 19\n5 10\n3 18\n10 3 17", "output": "23\n24\n"}, {"input": "2\n2 19\n5 10\n3 18\n10 3 11", "output": "23\n30\n"}, {"input": "2\n2 19\n8 10\n3 18\n10 3 11", "output": "20\n30\n"}, {"input": "2\n2 14\n5 10\n3 10\n10 3 17", "output": "13\n10...
code_stdio
[ { "content": "Sometimes one has to spell email addresses over the phone. Then one usually pronounces a dot as dot, an at sign as at. As a result, we get something like vasyaatgmaildotcom. Your task is to transform it into a proper email address (vasya@gmail.com). \n\nIt is known that a proper email address cont...
[{"input": "atatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatat\n", "output": "at@atatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatatat\n"}, {"input": "sdfuiopguoidfbhuihsregftuioheguodpsfhgvuherasuihfsduphguatwruheruopsghuiofhb...
code_stdio
[ { "content": "A strongness of an even number is the number of times we can successively divide by 2 until we reach an odd number starting with an even number n.\n\nFor example, if n = 12, then\n* 12 / 2 = 6\n* 6 / 2 = 3\n\nSo we divided successively 2 times and we reached 3, so the strongness of 12 is `2`.\n\nI...
[{"input": "1151592177\n2129680158", "output": "[1610612736]", "fn_name": "strongest_even"}, {"input": "2085422641\n2128923730", "output": "[2113929216]", "fn_name": "strongest_even"}, {"input": "1082012216\n1876572332", "output": "[1610612736]", "fn_name": "strongest_even"}, {"input": "1806570867\n2067832928", "output...
code_functional
[ { "content": "Problem statement\n\nAOR Ika-chan is in a bad mood lately. Apparently, I don't like the ratio of the number of followers to the number of followers of \"Ikatta\". Currently, AOR Ika-chan has $ A $ followers, $ B $ followers, and a ratio of $ A: B $.\n\nTherefore, AOR Ika decided to increase or dec...
[{"input": "19 139 3", "output": "120\n"}, {"input": "47 194 1", "output": "147\n"}, {"input": "32 118 1", "output": "86\n"}, {"input": "47 118 1", "output": "71\n"}, {"input": "116 2 2", "output": "112\n"}, {"input": "116 2 3", "output": "110\n"}, {"input": "19 128 3", "output": "45\n"}, {"input": "175 51 2", "output"...
code_stdio
[ { "content": "This is the hard version of the problem. The only difference between the two versions is the constraint on n. You can make hacks only if all versions of the problem are solved.\n\nA forest is an undirected graph without cycles (not necessarily connected).\n\nMocha and Diana are friends in Zhijiang...
[{"input": "10100 0 0\n", "output": "10099\n1 2\n1 3\n1 4\n1 5\n1 6\n1 7\n1 8\n1 9\n1 10\n1 11\n1 12\n1 13\n1 14\n1 15\n1 16\n1 17\n1 18\n1 19\n1 20\n1 21\n1 22\n1 23\n1 24\n1 25\n1 26\n1 27\n1 28\n1 29\n1 30\n1 31\n1 32\n1 33\n1 34\n1 35\n1 36\n1 37\n1 38\n1 39\n1 40\n1 41\n1 42\n1 43\n1 44\n1 45\n1 46\n1 47\n1 48\n1 ...
code_stdio
[ { "content": "Write a program which finds the greatest common divisor of two natural numbers a and b\n\nHint\n\nYou can use the following observation:\n\nFor integers x and y, if x ≥ y, then gcd(x, y) = gcd(y, x%y)\n\nConstrants\n\n1 ≤ a, b ≤ 109\n\nInput\n\na and b are given in a line sparated by a single spac...
[{"input": "124 31", "output": "31\n"}, {"input": "252 63", "output": "63\n"}, {"input": "32 192", "output": "32\n"}, {"input": "110 11", "output": "11\n"}, {"input": "110 90", "output": "10\n"}, {"input": "506 22", "output": "22\n"}, {"input": "13 130", "output": "13\n"}, {"input": "147 115", "output": "1\n"}, {"input...
code_stdio
[ { "content": "Fox Ciel is playing a mobile puzzle game called \"Two Dots\". The basic levels are played on a board of size n × m cells, like this:\n\n[Image]\n\nEach cell contains a dot that has some color. We will use different uppercase Latin characters to express different colors.\n\nThe key of this game is ...
[{"input": "50 2\nAA\nCD\nEE\nFC\nED\nAF\nFC\nAD\nBA\nAF\nBF\nDA\nAC\nFC\nFA\nBF\nAD\nBB\nDC\nAF\nAA\nAD\nEE\nED\nCD\nFC\nFB\nBB\nDD\nEB\nBE\nCF\nDE\nAE\nFD\nAB\nFB\nAE\nBE\nFA\nCF\nFB\nDE\nED\nAD\nFA\nBB\nBF\nDA\nEE\n", "output": "No\n"}, {"input": "50 2\nAA\nCD\nEE\nFC\nED\nAF\nFC\nAD\nBA\nAF\nBF\nDA\nAC\nFC\nFA\nBF\...
code_stdio
[ { "content": "You are given two integers $a$ and $b$. You can perform a sequence of operations: during the first operation you choose one of these numbers and increase it by $1$; during the second operation you choose one of these numbers and increase it by $2$, and so on. You choose the number of these operati...
[{"input": "3\n1 3\n11 11\n30 20\n", "output": "3\n0\n4\n"}, {"input": "3\n0 3\n11 11\n30 20\n", "output": "2\n0\n4\n"}, {"input": "3\n1 3\n11 11\n30 20\n", "output": "3\n0\n4\n"}, {"input": "3\n1 3\n11 1\n30 20\n", "output": "3\n4\n4\n"}, {"input": "3\n1 3\n11 0\n30 20\n", "output": "3\n5\n4\n"}, {"input": "3\n1 6\n11...
code_stdio
[ { "content": "One Sunday Petr went to a bookshop and bought a new book on sports programming. The book had exactly n pages.\n\nPetr decided to start reading it starting from the next day, that is, from Monday. Petr's got a very tight schedule and for each day of the week he knows how many pages he will be able ...
[{"input": "1000\n1000 1000 1000 1000 1000 1000 1000\n", "output": "1\n"}, {"input": "1000\n1000 1000 1000 1000 1000 1000 1100\n", "output": "1\n"}, {"input": "1000\n1000 1100 1000 1000 1000 1000 1000\n", "output": "1\n"}, {"input": "1\n1000 1000 1000 1000 1000 1000 1000\n", "output": "1\n"}, {"input": "1\n1001 1000 10...
code_stdio
[ { "content": "Crazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation aix + biy + ci = 0, where ai and bi are not both equal to the zero. The roads divide the plane into connected regions, possibly of infinite space. Let's call each such region a block. We define an ...
[{"input": "841746 527518\n595261 331297\n10\n-946901 129987 670374\n-140388 -684770 309555\n-302589 415564 -387435\n-777580 -72069 -395358\n-523453 -511446 854898\n-846967 -749453 -341866\n-1178673 434663 264157\n-638453 625357 344195\n-255265 -676356 -772398\n-824723 -319141 33585\n", "output": "0\n"}, {"input": "841...
code_stdio
[ { "content": "In a certain video game, the player controls a hero characterized by a single integer value: power. The hero will have to beat monsters that are also characterized by a single integer value: armor.\n\nOn the current level, the hero is facing $n$ caves. To pass the level, the hero must enter all th...
[{"input": "2\n1\n1 127\n2\n3 19 13 0\n2 12 11\n", "output": "128\n18\n"}, {"input": "2\n1\n1 146\n2\n3 19 16 0\n2 21 2\n", "output": "147\n20\n"}, {"input": "2\n1\n1 204\n2\n3 19 16 0\n2 21 2\n", "output": "205\n20\n"}, {"input": "2\n1\n1 204\n2\n3 19 16 1\n2 12 2\n", "output": "205\n18\n"}, {"input": "2\n1\n1 204\n2\...
code_stdio
[ { "content": "Mr. Chanek wants to knit a batik, a traditional cloth from Indonesia. The cloth forms a grid a with size n × m. There are k colors, and each cell in the grid can be one of the k colors.\n\nDefine a sub-rectangle as an ordered pair of two cells ((x_1, y_1), (x_2, y_2)), denoting the top-left cell a...
[{"input": "1110000000 1000100001 1000000001 170714 999995\n683808635 1423426790 555555553 555555554\n", "output": "220052742\n"}, {"input": "1110000000 1001100001 1000000001 170714 999995\n683808635 1423426790 555555553 555555554\n", "output": "972770006\n"}, {"input": "1000000000 1000000000 1000000000 999987 999995\n...
code_stdio
[ { "content": "Vasya has his favourite number $n$. He wants to split it to some non-zero digits. It means, that he wants to choose some digits $d_1, d_2, \\ldots, d_k$, such that $1 \\leq d_i \\leq 9$ for all $i$ and $d_1 + d_2 + \\ldots + d_k = n$.\n\nVasya likes beauty in everything, so he wants to find any so...
[{"input": "1000\n", "output": "1000\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
code_stdio
[ { "content": "Let's assume that we have a pair of numbers (a, b). We can get a new pair (a + b, b) or (a, a + b) from the given pair in a single step.\n\nLet the initial pair of numbers be (1,1). Your task is to find number k, that is, the least number of steps needed to transform (1,1) into the pair where at l...
[{"input": "1000000\n", "output": "30\n"}, {"input": "999998\n", "output": "30\n"}, {"input": "123455\n", "output": "26\n"}, {"input": "998756\n", "output": "30\n"}, {"input": "999879\n", "output": "30\n"}, {"input": "345612\n", "output": "28\n"}, {"input": "999997\n", "output": "30\n"}, {"input": "990001\n", "output":...
code_stdio
[ { "content": "Vasya has recently learned at school what a number's divisor is and decided to determine a string's divisor. Here is what he came up with.\n\nString a is the divisor of string b if and only if there exists a positive integer x such that if we write out string a consecutively x times, we get string...
[{"input": "asdkjjaskldjklasjdhasjdasdas\nasdjahsgdjslkdaygsudhasdkasnjdbayusvduasdklmadlsk\n", "output": "0\n"}, {"input": "asdkjjaskldjklasjdhasjdasdas\nasdjahsgdjslkdaygsudhasdkasnjdbayusvduasdklmaklsd\n", "output": "0"}, {"input": "aaaaaaaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaaaaaaa\n", "output": "3"}, {"input": "...
code_stdio
[ { "content": "There are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is...
[{"input": "25 100\n", "output": "Yes\n"}, {"input": "50 100\n", "output": "Yes\n"}, {"input": "25 98\n", "output": "Yes\n"}, {"input": "51 100\n", "output": "No\n"}, {"input": "32 96\n", "output": "Yes\n"}, {"input": "2 100\n", "output": "No\n"}, {"input": "24 98\n", "output": "No\n"}, {"input": "50 98\n", "output": "...
code_stdio
[ { "content": "Bike is interested in permutations. A permutation of length n is an integer sequence such that each integer from 0 to (n - 1) appears exactly once in it. For example, [0, 2, 1] is a permutation of length 3 while both [0, 2, 2] and [1, 2, 3] is not.\n\nA permutation triple of permutations of length...
[{"input": "5745\n", "output": "0 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 90 91 92 93 94 95 96 97 98 9...
code_stdio
[ { "content": "Little Petya often visits his grandmother in the countryside. The grandmother has a large vertical garden, which can be represented as a set of `n` rectangles of varying height. Due to the newest irrigation system we can create artificial rain above them.\n\nCreating artificial rain is an expensiv...
[{"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, 8, 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, 8...
code_functional
[ { "content": "A flea is sitting at one of the n hassocks, arranged in a circle, at the moment. After minute number k the flea jumps through k - 1 hassoсks (clockwise). For example, after the first minute the flea jumps to the neighboring hassock. You should answer: will the flea visit all the hassocks or not. W...
[{"input": "1000\n", "output": "NO\n"}, {"input": "512\n", "output": "YES\n"}, {"input": "256\n", "output": "YES\n"}, {"input": "512\n", "output": "YES\n"}, {"input": "1000\n", "output": "NO\n"}, {"input": "256\n", "output": "YES\n"}, {"input": "1001\n", "output": "NO\n"}, {"input": "688\n", "output": "NO\n"}, {"input"...
code_stdio
[ { "content": "D: Is greed the best?\n\nstory\n\nIn Japan, where there are 1, 5, 10, 50, 100, 500 yen coins, it is known that the number of coins can be minimized by using as many coins as possible when paying a certain amount. ..\n\nIf the amount of coins is different from that of Japan, it is not always possib...
[{"input": "42 1010", "output": "1050\n"}, {"input": "133 178", "output": "266\n"}, {"input": "16 102", "output": "112\n"}, {"input": "24 128", "output": "144\n"}, {"input": "18 102", "output": "108\n"}, {"input": "24 109", "output": "120\n"}, {"input": "35 128", "output": "140\n"}, {"input": "17 112", "output": "119\n...
code_stdio
[ { "content": "Vladimir wants to modernize partitions in his office. To make the office more comfortable he decided to remove a partition and plant several bamboos in a row. He thinks it would be nice if there are n bamboos in a row, and the i-th from the left is a_{i} meters high. \n\nVladimir has just planted ...
[{"input": "100 2619\n1207 5971 951 8250 6594 219 9403 9560 2368 289 3502 6626 1009 828 2378 615 3092 3751 841 7454 8001 1345 1644 1021 7088 7083 2805 1971 7456 6494 3805 9279 8737 8994 2975 2566 6490 1720 3595 8721 8500 4850 9716 2076 9532 1077 8370 2809 2885 1838 6081 667 900 9786 5600 3707 8818 7580 6067 2215 1726 2...
code_stdio
[ { "content": "Takahashi loves gold coins. He gains 1000 happiness points for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.)\nTakahashi has X yen. If he exchanges his money so that he will gain the most happiness points, how many happiness points...
[{"input": "1000000000\n", "output": "2000000000\n"}, {"input": "999999999\n", "output": "1999999495\n"}, {"input": "999999994\n", "output": "1999999490\n"}, {"input": "999999499\n", "output": "1999998495\n"}, {"input": "849598327\n", "output": "1699196325\n"}, {"input": "822889311\n", "output": "1645778310\n"}, {"inpu...
code_stdio
[ { "content": "Johnny has a younger sister Anne, who is very clever and smart. As she came home from the kindergarten, she told his brother about the task that her kindergartener asked her to solve. The task was just to construct a triangle out of four sticks of different colours. Naturally, one of the sticks is...
[{"input": "100 21 30 65\n", "output": "IMPOSSIBLE\n"}, {"input": "52 10 19 139\n", "output": "IMPOSSIBLE\n"}, {"input": "110 21 30 65\n", "output": "IMPOSSIBLE\n"}, {"input": "11 30 79 43\n", "output": "IMPOSSIBLE\n"}, {"input": "13 49 69 15\n", "output": "IMPOSSIBLE\n"}, {"input": "95 20 21 43\n", "output": "IMPOSSIB...
code_stdio
[ { "content": "Paul is at the orchestra. The string section is arranged in an r × c rectangular grid and is filled with violinists with the exception of n violists. Paul really likes violas, so he would like to take a picture including at least k of them. Paul can take a picture of any axis-parallel rectangle in...
[{"input": "10 10 10 1\n8 10\n2 9\n1 10\n3 1\n8 5\n10 1\n4 10\n10 2\n5 3\n9 3\n", "output": "1787\n"}, {"input": "14 10 10 1\n8 10\n2 9\n1 10\n3 1\n8 5\n10 1\n4 10\n10 2\n5 3\n9 3\n", "output": "3411\n"}, {"input": "10 10 10 1\n1 10\n10 8\n7 4\n7 2\n1 3\n6 6\n10 1\n2 7\n9 3\n3 10\n", "output": "1991\n"}, {"input": "10 ...
code_stdio
[ { "content": "You came to the exhibition and one exhibit has drawn your attention. It consists of $n$ stacks of blocks, where the $i$-th stack consists of $a_i$ blocks resting on the surface.\n\nThe height of the exhibit is equal to $m$. Consequently, the number of blocks in each stack is less than or equal to ...
[{"input": "50 1000000000\n824428839 821375880 831521735 868908015 86990853 248293447 886713846 425716910 443947914 504402098 40124673 774093026 271211165 873482658 592754073 490097471 947930201 69692739 145291746 418475785 80274059 696889747 854947829 231642778 141525047 57563878 92067934 387507168 522358804 37616740 ...
code_stdio
[ { "content": "You are given two positive integers N and K. How many multisets of rational numbers satisfy all of the following conditions?\n - The multiset has exactly N elements and the sum of them is equal to K.\n - Each element of the multiset is one of 1, \\frac{1}{2}, \\frac{1}{4}, \\frac{1}{8}, \\dots. In...
[{"input": "2969 2889\n", "output": "450491977\n"}, {"input": "2987 2897\n", "output": "524709859\n"}, {"input": "2919 2863\n", "output": "393849245\n"}, {"input": "2992 2938\n", "output": "678074080\n"}, {"input": "2963 2909\n", "output": "678074080\n"}, {"input": "2996 2919\n", "output": "500305582\n"}, {"input": "12...
code_stdio
[ { "content": "This is the easy version of the problem. The only difference between easy and hard versions is the constraint of $m$. You can make hacks only if both versions are solved.\n\nChiori loves dolls and now she is going to decorate her bedroom![Image] \n\nAs a doll collector, Chiori has got $n$ dolls. T...
[{"input": "54 53\n8192 2147483648 134217728 8589934592 64 131072 137438953472 67108864 16384 536870912 256 4096 1099511627776 549755813888 32768 2 1048576 8 4194304 4294967296 262144 268435456 8388608 140737488355328 1073741824 4398046511104 512 2199023255552 2048 281474976710656 16777216 70368744177664 1 112589990684...
code_stdio
[ { "content": "In an attempt to control the rise in population, Archer was asked to come up with a plan. This time he is targeting marriages. Archer, being as intelligent as he is, came up with the following plan:\n\nA man with name M is allowed to marry a woman with name W, only if M is a subsequence of W or W ...
[{"input": "3\njohn johanna\nria ria\nkayla jayla", "output": "YES\nYES\nNO\n"}, {"input": "3\njohn johanna\nria ria\nkayma jayla", "output": "YES\nYES\nNO\n"}, {"input": "3\njohn johanna\nria ria\nkaylb jayla", "output": "YES\nYES\nNO\n"}, {"input": "3\njohn johanna\nira ira\nkayla jayla", "output": "YES\nYES\nNO\n"},...
code_stdio
[ { "content": "As Will is stuck in the Upside Down, he can still communicate with his mom, Joyce, through the Christmas lights (he can turn them on and off with his mind). He can't directly tell his mom where he is, because the monster that took him to the Upside Down will know and relocate him. [Image] \n\nThu...
[{"input": ")?(??((???????()?(?????????)??(????????((?)?????)????)??????(?????)?)?????)??????(??()??????)????????)?)()??????????????())????????(???)??)????????????????????(?????)??)???)??(???????????????)???)??)?\n", "output": "8314\n"}, {"input": ")?(??((???????()?(?????????)??(????????((?)?????)????)??????(?????)?)??...
code_stdio
[ { "content": "The stardate is 1983, and Princess Heidi is getting better at detecting the Death Stars. This time, two Rebel spies have yet again given Heidi two maps with the possible locations of the Death Star. Since she got rid of all double agents last time, she knows that both maps are correct, and indeed ...
[{"input": "10 5\nsomer\nandom\nnoise\nmayth\neforc\nebewi\nthyou\nhctwo\nagain\nnoise\nsomermayth\nandomeforc\nnoiseebewi\nagainthyou\nnoisehctwo\n", "output": "4 6\n"}, {"input": "10 5\nsomer\nandom\nnoise\nmayth\neforc\nebewi\nthyou\nhctwo\nagain\nooise\nsomermayth\nandomeforc\nnoiseebewi\nagainthyou\nnoisehctwo\n",...
code_stdio
[ { "content": "Welcome to Rockport City!\n\nIt is time for your first ever race in the game against Ronnie. To make the race interesting, you have bet $a$ dollars and Ronnie has bet $b$ dollars. But the fans seem to be disappointed. The excitement of the fans is given by $gcd(a,b)$, where $gcd(x, y)$ denotes the...
[{"input": "4\n1 11\n1 2\n4 0\n20 10\n", "output": "10 1\n1 0\n4 0\n10 0\n"}, {"input": "4\n1 11\n1 2\n4 0\n22 10\n", "output": "10 1\n1 0\n4 0\n12 2\n"}, {"input": "4\n1 11\n1 2\n2 0\n22 10\n", "output": "10 1\n1 0\n2 0\n12 2\n"}, {"input": "4\n6 11\n1 2\n4 3\n20 10\n", "output": "5 1\n1 0\n1 0\n10 0\n"}, {"input": "4...
code_stdio
[ { "content": "Welcome to PC Koshien, players. This year marks the 10th anniversary of Computer Koshien, but the number of questions and the total score will vary from year to year. Scores are set for each question according to the difficulty level. When the number of questions is 10 and the score of each questi...
[{"input": "1\n2\n-1\n-9\n-1\n2\n-1\n-32\n-1\n1", "output": "-39\n"}, {"input": "1\n2\n0\n-38\n-1\n1\n-1\n-17\n0\n1", "output": "-52\n"}, {"input": "1\n2\n0\n-38\n-1\n1\n-1\n-32\n0\n1", "output": "-67\n"}, {"input": "1\n2\n-1\n-9\n-1\n2\n-1\n-32\n0\n1", "output": "-38\n"}, {"input": "1\n1\n-2\n-1\n-1\n3\n11\n-2\n6\n-2"...
code_stdio
[ { "content": "The Little Girl loves problems on games very much. Here's one of them.\n\nTwo players have got a string s, consisting of lowercase English letters. They play a game that is described by the following rules: The players move in turns; In one move the player can remove an arbitrary letter from stri...
[{"input": "opfokvwzpllctflkphutcrkferbjyyrasqqkrcvoymyrxwaudgsugcqveccymdplxmtlzfoptmrapfeizpnnhbzlkuyznwacnswibxhqunazbhdvrlidghisuqunstbuevjzimvlfvopgqxrvahhngnaumgywscfrfwfpnfxwhfrelbunmedvkssykwjyartxjiplerntzkpiiaalijiwhyuhxlvhxpkgfypvrpqqsacuwocdampnnhvibsbolyduvscsjfayxpldyvqzjbqojjxdvxtctwtifcdfcaoonzbgegyllng...
code_stdio