messages listlengths 1 1 | ground_truth stringlengths 156 726k | dataset stringclasses 2
values |
|---|---|---|
[
{
"content": "Barney lives in NYC. NYC has infinite number of intersections numbered with positive integers starting from 1. There exists a bidirectional road between intersections i and 2i and another road between i and 2i + 1 for every positive integer i. You can clearly see that there exists a unique shortes... | [{"input": "10\n2 37526406560905229 37526426361107171\n2 37526424114740747 18763396439955441\n2 300485276957081578 301492476099962199\n1 75035386466351570 441803674395985082 642312512\n2 300197522144700185 220954108245114486\n1 150105696341181576 559187296 100113944\n1 300197522135707767 150242638470761995 170574370\n2... | code_stdio |
[
{
"content": "There is a right triangle ABC with ∠ABC=90°.\nGiven the lengths of the three sides, |AB|,|BC| and |CA|, find the area of the right triangle ABC.\nIt is guaranteed that the area of the triangle ABC is an integer.\n\n-----Constraints-----\n - 1 \\leq |AB|,|BC|,|CA| \\leq 100\n - All values in input ... | [{"input": "28 96 100\n", "output": "1344\n"}, {"input": "35 84 91\n", "output": "1470\n"}, {"input": "77 36 85\n", "output": "1386\n"}, {"input": "32 69 101", "output": "1104\n"}, {"input": "45 28 53\n", "output": "630\n"}, {"input": "24 10 26\n", "output": "120\n"}, {"input": "13 84 85\n", "output": "546\n"}, {"input... | code_stdio |
[
{
"content": "Tenten runs a weapon shop for ninjas. Today she is willing to sell n shurikens which cost 1, 2, ..., n ryo (local currency). During a day, Tenten will place the shurikens onto the showcase, which is empty at the beginning of the day. Her job is fairly simple: sometimes Tenten places another shurik... | [{"input": "10\n+\n- 3\n+\n+\n+\n+\n- 1\n- 7\n- 9\n- 10\n+\n+\n+\n- 4\n- 5\n- 8\n+\n- 6\n+\n- 2\n", "output": "YES\n3 10 9 7 1 8 5 4 6 2 "}, {"input": "10\n+\n- 1\n+\n+\n+\n+\n- 1\n- 7\n- 9\n- 10\n+\n+\n+\n- 7\n- 10\n- 8\n+\n+\n- 6\n- 2\n", "output": "NO\n"}, {"input": "10\n+\n- 3\n+\n+\n+\n+\n- 1\n- 7\n- 9\n- 10\n+\n+... | code_stdio |
[
{
"content": "You are given an array of positive integers. While there are at least two equal elements, we will perform the following operation. We choose the smallest value $x$ that occurs in the array $2$ or more times. Take the first two occurrences of $x$ in this array (the two leftmost occurrences). Remove... | [{"input": "34\n967614464 967614464 1000000000 1000000000 1000000000 1000000000 1000000000 1010000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 100000000... | code_stdio |
[
{
"content": "You are playing euchre and you want to know the new score after finishing a hand. There are two teams and each hand consists of 5 tricks. The team who wins the majority of the tricks will win points but the number of points varies. To determine the number of points, you must know which team called... | [{"input": "[4, 0]\n1\nfalse\n[2, 2, 2, 2, 2]", "output": "[[4, 2]]", "fn_name": "update_score"}, {"input": "[4, 4]\n2\nfalse\n[2, 2, 2, 2, 2]", "output": "[[4, 6]]", "fn_name": "update_score"}, {"input": "[4, 6]\n2\ntrue\n[2, 2, 2, 2, 2]", "output": "[[4, 10]]", "fn_name": "update_score"}, {"input": "[7, 2]\n1\nfalse\... | code_functional |
[
{
"content": "There are N students and M checkpoints on the xy-plane.\n\nThe coordinates of the i-th student (1 \\leq i \\leq N) is (a_i,b_i), and the coordinates of the checkpoint numbered j (1 \\leq j \\leq M) is (c_j,d_j).\n\nWhen the teacher gives a signal, each student has to go to the nearest checkpoint m... | [{"input": "50 50\n-87868672 9773500\n38180447 36636308\n-93470873 38029088\n49678522 -87311634\n62792334 -82584220\n50941177 2445768\n-21746015 -16856077\n-69539173 -40150977\n-82915111 -60619217\n-42155179 93071641\n-3205477 16657057\n26789545 -1410866\n-32360553 -38239433\n-69707837 59109468\n-8767620 51549299\n-195... | code_stdio |
[
{
"content": "You are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N.\nYou can perform the following operation any number of times (possibly zero):\nOperation: Swap two adjacent elements in the permutation.\nYou want to have p_i ≠ i for all 1≤i≤N.\nFind the minimum required number of operations to a... | [{"input": "9\n1 4 1 2 3 10 2 12 14", "output": "1\n"}, {"input": "9\n1 4 0 2 3 10 2 12 14", "output": "1\n"}, {"input": "9\n1 1 0 2 3 10 2 12 14", "output": "1\n"}, {"input": "9\n1 1 1 2 3 10 2 12 14", "output": "1\n"}, {"input": "9\n1 4 1 2 3 10 2 6 10", "output": "1\n"}, {"input": "9\n1 4 1 2 3 10 2 6 14", "output":... | code_stdio |
[
{
"content": "AtCoDeer the deer has found two positive integers, a and b.\nDetermine whether the concatenation of a and b in this order is a square number.\n\n-----Constraints-----\n - 1 ≤ a,b ≤ 100\n - a and b are integers.\n\n-----Input-----\nInput is given from Standard Input in the following format:\na b\n\... | [{"input": "100 100\n", "output": "No\n"}, {"input": "000 001", "output": "Yes\n"}, {"input": "010 000", "output": "Yes\n"}, {"input": "000 000", "output": "Yes\n"}, {"input": "000 100", "output": "Yes\n"}, {"input": "110 100", "output": "No\n"}, {"input": "101 100", "output": "No\n"}, {"input": "101 101", "output": "N... | code_stdio |
[
{
"content": "In a strategic computer game \"Settlers II\" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense st... | [{"input": "100 100\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 100... | code_stdio |
[
{
"content": "We all know that GukiZ often plays with arrays. \n\nNow he is thinking about this problem: how many arrays a, of length n, with non-negative elements strictly less then 2l meet the following condition: <image>? Here operation <image> means bitwise AND (in Pascal it is equivalent to and, in C/C++/J... | [{"input": "1000000000000000000 1000000000000000000 64 1000000007\n", "output": "818137911\n"}, {"input": "1000000000000000000 1000000000000000100 64 1000000007\n", "output": "705677915\n"}, {"input": "85689952135646564 456465135103154 61 554556465\n", "output": "526174733\n"}, {"input": "94056881908542814 456465135103... | code_stdio |
[
{
"content": "Recently, Duff has been practicing weight lifting. As a hard practice, Malek gave her a task. He gave her a sequence of weights. Weight of i-th of them is 2wi pounds. In each step, Duff can lift some of the remaining weights and throw them away. She does this until there's no more weight left. Mal... | [{"input": "100\n196 1681 196 0 61 93 196 196 196 196 196 0 0 96 18 1576 0 93 666463 18 93 1 1278 8939 93 196 196 1278 3 0 67416 869956 10 56489 196 745 39 783 196 8939 196 81 69634 4552 39 3 14 20 25 8 10 4 7302 0 19579 20 1140 15990 7302 0 19579 4142 11 1354 75252 93 311 1278 0 79475 10 75252 93 7302 0 81 408441 1957... | code_stdio |
[
{
"content": "There was an electronic store heist last night.\n\nAll keyboards which were in the store yesterday were numbered in ascending order from some integer number $x$. For example, if $x = 4$ and there were $3$ keyboards in the store, then the devices had indices $4$, $5$ and $6$, and if $x = 10$ and th... | [{"input": "40\n194 121 110 134 172 142 195 135 186 187 128 161 185 132 117 175 178 131 143 151 170 181 188 140 133 145 119 129 179 149 109 123 124 106 100 199 197 155 141 183\n", "output": "60\n"}, {"input": "40\n194 121 110 134 172 142 195 135 186 187 128 161 185 132 117 175 178 131 143 151 170 181 188 140 133 145 11... | code_stdio |
[
{
"content": "Once Bob took a paper stripe of n squares (the height of the stripe is 1 square). In each square he wrote an integer number, possibly negative. He became interested in how many ways exist to cut this stripe into three pieces so that the sum of numbers from each piece is equal to the sum of numbers... | [{"input": "100\n3 0 -5 2 -3 -1 -1 0 -2 -5 -4 2 1 2 -2 -1 -1 -4 3 -1 -3 -1 5 0 -4 -4 -1 0 -2 -2 0 1 -1 -2 -1 -5 -4 -2 3 1 -3 0 -1 1 0 -1 2 0 -2 -1 -3 1 -2 2 3 2 -3 -5 2 2 -2 -2 1 2 -2 -1 3 0 -4 7 -2 2 1 4 -9 -1 -2 -1 0 -1 0 -2 -2 -1 1 1 -4 2 -3 -3 7 1 1 -3 -7 0 -2 0 5 -2\n", "output": "5\n"}, {"input": "100\n3 0 -5 2 -... | code_stdio |
[
{
"content": "For this problem you must create a program that says who ate the last cookie. If the input is a string then \"Zach\" ate the cookie. If the input is a float or an int then \"Monica\" ate the cookie. If the input is anything else \"the dog\" ate the cookie. The way to return the statement is:\n\"Wh... | [{"input": "1.98528462", "output": "[\"Who ate the last cookie? It was Monica!\"]", "fn_name": "cookie"}, {"input": "false", "output": "[\"Who ate the last cookie? It was the dog!\"]", "fn_name": "cookie"}, {"input": "true", "output": "[\"Who ate the last cookie? It was the dog!\"]", "fn_name": "cookie"}, {"input": "\"... | code_functional |
[
{
"content": "Let x be an array of integers x = [x_1, x_2, ..., x_n]. Let's define B(x) as a minimal size of a partition of x into subsegments such that all elements in each subsegment are equal. For example, B([3, 3, 6, 1, 6, 6, 6]) = 4 using next partition: [3, 3\\ |\\ 6\\ |\\ 1\\ |\\ 6, 6, 6].\n\nNow you don... | [{"input": "5\n1 1 1 1 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n", "output": "530612279\n"}, {"input": "10\n10 1 9 3 9 4 10 3 8 5\n10 1 10 14 12 4 10 4 10 7\n", "output": "875000103\n"}, {"input": "10\n10 1 9 3 9 4 10 3 8 5\n10 2 10 14 12 4 10 4 10 7\n", "output": "875000103\n"}, {"input": "10\n10 1 9... | code_stdio |
[
{
"content": "You are going out for a walk, when you suddenly encounter N monsters. Each monster has a parameter called health, and the health of the i-th monster is h_i at the moment of encounter. A monster will vanish immediately when its health drops to 0 or below.\nFortunately, you are a skilled magician, c... | [{"input": "5 2 1\n900000000\n900000000\n1000000000\n1000000000\n1000000000\n", "output": "800000000\n"}, {"input": "5 2 1\n105611412\n1737860309\n1010000000\n1000000101\n1100000000", "output": "969572082\n"}, {"input": "5 3 1\n105611412\n1151487296\n1010000000\n1000000101\n1100000000", "output": "710247900\n"}, {"inpu... | code_stdio |
[
{
"content": "Ilya is an experienced player in tic-tac-toe on the 4 × 4 field. He always starts and plays with Xs. He played a lot of games today with his friend Arseny. The friends became tired and didn't finish the last game. It was Ilya's turn in the game when they left it. Determine whether Ilya could have ... | [{"input": "xx..\n.oo.\nx...\noox.\n", "output": "YES\n"}, {"input": "x..x\n..oo\no...\nx.xo\n", "output": "YES\n"}, {"input": ".xox\no.x.\nx.o.\n..o.\n", "output": "YES\n"}, {"input": "o.oo\n.x.o\nx.x.\n.x..\n", "output": "YES\n"}, {"input": ".xx.\n.xoo\n.oox\n....\n", "output": "YES\n"}, {"input": "xxox\no.x.\nx.oo\n... | code_stdio |
[
{
"content": "Sehr Sus is an infinite hexagonal grid as pictured below, controlled by MennaFadali, ZerooCool and Hosssam.\n\nThey love equilateral triangles and want to create $n$ equilateral triangles on the grid by adding some straight lines. The triangles must all be empty from the inside (in other words, no... | [{"input": "10\n45996\n1494\n17871\n87082\n59317\n76537\n37514\n56796\n60195\n80410\n", "output": "263\n48\n164\n362\n299\n339\n238\n292\n301\n348\n"}, {"input": "5\n66\n6666\n666666\n66666666\n666666666\n", "output": "10\n100\n1000\n10000\n31623\n"}, {"input": "3\n390\n398\n285\n", "output": "25\n25\n21\n"}, {"input":... | code_stdio |
[
{
"content": "Problem\n\nKND is a student programmer at the University of Aizu. His neighbor is known to be very annoying. Neighbors find out that he is a sweet tooth and plan to add more sweetness than necessary to make him fat. To that end, your neighbor, you, was introduced to a sweets shop by a friend.\n\nH... | [{"input": "3 3 100\n2\n5 20 3 10\n2\n13 50 16 60\n2\n8 30 22 100\n0 1 2\n\n1 1 30\n1\n13 16\n0", "output": "27 100\n13 16\n"}, {"input": "3 3 100\n2\n5 20 3 10\n2\n13 60 16 60\n2\n8 30 22 100\n0 1 2\n\n1 1 30\n1\n13 17\n0", "output": "27 100\n13 17\n"}, {"input": "3 3 100\n2\n5 20 3 10\n2\n13 60 16 41\n2\n8 30 22 100\... | code_stdio |
[
{
"content": "Given N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\nHowever, if the result exceeds 10^{18}, print -1 instead.\n\n-----Constraints-----\n - 2 \\leq N \\leq 10^5\n - 0 \\leq A_i \\leq 10^{18}\n - All values in input are integers.\n\n-----Input-----\nInput is given from Standard Inp... | [{"input": "31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0\n", "output": "0\n"}, {"input": "31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 0 2 7 9 5 0", "output": "0\n"}, {"input": "31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0", "output": "0"}, {"input": "2\n1000000000 100... | code_stdio |
[
{
"content": "There are n workers in a company, each of them has a unique id from 1 to n. Exaclty one of them is a chief, his id is s. Each worker except the chief has exactly one immediate superior.\n\nThere was a request to each of the workers to tell how how many superiors (not only immediate). Worker's supe... | [{"input": "10 10\n3 0 0 0 0 0 1 1 1 0\n", "output": "5\n"}, {"input": "10 10\n3 0 0 0 0 0 1 0 1 0\n", "output": "6\n"}, {"input": "10 10\n3 0 0 0 0 1 1 0 1 0\n", "output": "5\n"}, {"input": "10 10\n3 0 0 0 1 1 1 0 1 0\n", "output": "4\n"}, {"input": "10 10\n3 0 0 0 0 2 1 0 1 0\n", "output": "5\n"}, {"input": "10 6\n3 ... | code_stdio |
[
{
"content": "Once upon a time, Oolimry saw a suffix array. He wondered how many strings can produce this suffix array.\n\nMore formally, given a suffix array of length $n$ and having an alphabet size $k$, count the number of strings that produce such a suffix array.\n\nLet $s$ be a string of length $n$. Then t... | [{"input": "73 95\n4 53 37 9 45 54 16 34 12 10 13 24 2 36 33 48 50 43 15 11 47 42 46 30 27 52 67 72 66 19 56 61 69 21 68 1 70 49 64 62 3 51 44 65 29 25 38 28 8 5 39 59 17 6 26 20 63 7 41 23 22 32 40 14 57 60 55 31 35 58 18 0 71\n", "output": "423380456"}, {"input": "73 95\n4 53 37 9 45 54 16 34 12 10 13 24 2 36 33 48 5... | code_stdio |
[
{
"content": "We have N squares assigned the numbers 1,2,3,\\ldots,N. Each square has an integer written on it, and the integer written on Square i is a_i.\n\nHow many squares i satisfy both of the following conditions?\n\n* The assigned number, i, is odd.\n* The written integer is odd.\n\nConstraints\n\n* All ... | [{"input": "15\n1 10 145 15 87 138 51 194 1 18 77 20 9 17 93", "output": "8\n"}, {"input": "15\n15 11 46 15 50 98 93 129 31 43 44 11 6 24 14", "output": "3\n"}, {"input": "15\n15 11 46 15 50 98 93 129 41 43 44 11 6 24 14", "output": "3\n"}, {"input": "15\n15 11 46 15 50 98 93 87 31 43 44 11 10 24 14", "output": "3\n"},... | code_stdio |
[
{
"content": "There are N integers, A_1, A_2, ..., A_N, written on the blackboard.\nYou will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally written.\nFind the maximum possible greatest common divisor of the N integers ... | [{"input": "3206\n2048 536870912 536870912 268435456 2097152 8192 128 16 16777216 4096 4096 16777216 32 131072 67108864 16777216 256 8388608 1048576 8 2048 8388608 4 16777216 33554432 8 512 16777216 8 33554432 65536 8192 64 64 4 16777216 524288 16 8192 16777216 67108864 536870912 268435456 536870912 4096 33554432 26214... | code_stdio |
[
{
"content": "Firecrackers scare Nian the monster, but they're wayyyyy too noisy! Maybe fireworks make a nice complement.\n\nLittle Tommy is watching a firework show. As circular shapes spread across the sky, a splendid view unfolds on the night of Lunar New Year's eve.\n\nA wonder strikes Tommy. How many regio... | [{"input": "3\n-10 4 10\n10 4 10\n0 -7 10\n", "output": "7\n"}, {"input": "3\n-10 4 10\n10 4 10\n0 -7 10\n", "output": "7\n"}, {"input": "3\n-3 -2 3\n-4 -12 3\n-6 -4 9\n", "output": "5\n"}, {"input": "3\n1 -7 10\n-7 9 10\n-2 -1 4\n", "output": "8\n"}, {"input": "3\n-3 -2 3\n-4 -6 3\n-6 -4 9\n", "output": "5\n"}, {"inpu... | code_stdio |
[
{
"content": "Dima the hamster enjoys nibbling different things: cages, sticks, bad problemsetters and even trees!\n\nRecently he found a binary search tree and instinctively nibbled all of its edges, hence messing up the vertices. Dima knows that if Andrew, who has been thoroughly assembling the tree for a lon... | [{"input": "36\n3 41 82 123 174 216 432 864 1080 1228 2149 4298 8596 11052 22104 33156 35919 71838 179595 359190 431028 862056 994680 1315440 1753920 3507840 7015680 10523520 21047040 26500200 53000400 106000800 132501000 176668000 353336000 530004000\n", "output": "Yes\n"}, {"input": "36\n3 41 82 123 174 216 432 864 1... | code_stdio |
[
{
"content": "-----Problem Statement-----\nWrite a program that accepts a number, n, and outputs the same.\n\n-----Input-----\nThe only line contains a single integer. \n\n-----Output-----\nOutput the answer in a single line.\n\n-----Constraints-----\n- 0 ≤ n ≤ 105\n\n-----Sample Input-----\n123\n\n-----Sample ... | [{"input": "1047", "output": "1047\n"}, {"input": "1652", "output": "1652\n"}, {"input": "3133", "output": "3133\n"}, {"input": "1313", "output": "1313\n"}, {"input": "1107", "output": "1107\n"}, {"input": "2085", "output": "2085\n"}, {"input": "2863", "output": "2863\n"}, {"input": "-160", "output": "-160\n"}, {"input... | code_stdio |
[
{
"content": "Vasya has n pairs of socks. In the morning of each day Vasya has to put on a pair of socks before he goes to school. When he comes home in the evening, Vasya takes off the used socks and throws them away. Every m-th day (at days with numbers m, 2m, 3m, ...) mom buys a pair of socks to Vasya. She d... | [{"input": "100 100\n", "output": "101\n"}, {"input": "100 100\n", "output": "101\n"}, {"input": "99 100\n", "output": "99\n"}, {"input": "100 3\n", "output": "149\n"}, {"input": "100 2\n", "output": "199\n"}, {"input": "99 10\n", "output": "109\n"}, {"input": "100 5\n", "output": "124\n"}, {"input": "95 16\n", "output... | code_stdio |
[
{
"content": "You are given two arrays $a$ and $b$, both of length $n$. All elements of both arrays are from $0$ to $n-1$.\n\nYou can reorder elements of the array $b$ (if you want, you may leave the order of elements as it is). After that, let array $c$ be the array of length $n$, the $i$-th element of this ar... | [{"input": "10\n6 3 0 5 4 5 5 5 8 5\n3 8 2 9 5 4 1 0 3 6\n", "output": "0 1 0 0 0 4 6 7 1 8 \n"}, {"input": "10\n6 3 0 5 4 5 5 5 8 5\n3 8 2 9 5 4 1 0 3 6\n", "output": "0 1 0 0 0 4 6 7 1 8 "}, {"input": "10\n6 3 0 5 4 5 5 4 8 5\n3 8 2 9 5 4 1 0 3 6\n", "output": "0 1 0 0 0 4 6 6 1 8\n"}, {"input": "10\n6 3 0 5 6 5 5 5 ... | code_stdio |
[
{
"content": "Initially Ildar has an empty array. He performs $n$ steps. On each step he takes a subset of integers already added to the array and appends the mex of this subset to the array. \n\nThe mex of an multiset of integers is the smallest non-negative integer not presented in the multiset. For example, ... | [{"input": "3\n0 1 1000000000\n", "output": "3\n"}, {"input": "3\n1 1 1000000000\n", "output": "1\n"}, {"input": "3\n1 0 1000000000\n", "output": "1\n"}, {"input": "3\n1 0 0000000000\n", "output": "1\n"}, {"input": "3\n1 0 0000001000\n", "output": "1\n"}, {"input": "3\n0 0 0000001000\n", "output": "3\n"}, {"input": "3\... | code_stdio |
[
{
"content": "Two countries, Country A and Country B, are at war. As a soldier in Country A, you will lead n soldiers to occupy the territory of Country B.\n\nThe territory of Country B is represented by a two-dimensional grid. The first place you occupy is a square on the 2D grid. Each of the soldiers you lead... | [{"input": "10\n10\n10\n14\n10\n10\n10\n10\n10\n10\n10", "output": "97\n"}, {"input": "10\n6\n10\n14\n10\n10\n10\n10\n10\n10\n20", "output": "103\n"}, {"input": "10\n6\n10\n14\n10\n10\n10\n10\n10\n18\n20", "output": "111\n"}, {"input": "10\n6\n10\n14\n10\n10\n10\n10\n10\n11\n20", "output": "104\n"}, {"input": "10\n6\n1... | code_stdio |
[
{
"content": "You are fed up with your messy room, so you decided to clean it up.\n\nYour room is a bracket sequence s=s_{1}s_{2}... s_{n} of length n. Each character of this string is either an opening bracket '(' or a closing bracket ')'.\n\nIn one operation you can choose any consecutive substring of s and r... | [{"input": "4\n8 2\n)())(()(\n10 4\n))()()()((\n2 1\n)(\n2 1\n)(\n", "output": "4\n1 2\n3 5\n4 6\n5 8\n5\n1 3\n3 5\n5 7\n7 9\n8 10\n1\n1 2\n1\n1 2\n"}, {"input": "4\n8 2\n)())(()(\n10 5\n)))(()()((\n2 1\n)(\n2 1\n)(\n", "output": "4\n1 2\n3 5\n4 6\n5 8\n5\n1 4\n3 5\n5 7\n7 9\n9 10\n1\n1 2\n1\n1 2\n"}, {"input": "4\n8 2... | code_stdio |
[
{
"content": "Given are a positive integer N and a string S of length N consisting of lowercase English letters.\nDetermine whether the string is a concatenation of two copies of some string.\nThat is, determine whether there is a string T such that S = T + T.\n\n-----Constraints-----\n - 1 \\leq N \\leq 100\n ... | [{"input": "100\ntttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt\n", "output": "Yes\n"}, {"input": "100\nyyxyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy\n", "output": "No\n"}, {"input": "99\nbbbbbbbbbbbbbbbbbbbbbbb... | code_stdio |
[
{
"content": "In this task you need to process a set of stock exchange orders and use them to create order book.\n\nAn order is an instruction of some participant to buy or sell stocks on stock exchange. The order number i has price p_{i}, direction d_{i} — buy or sell, and integer q_{i}. This means that the pa... | [{"input": "3 3\nB 16671 5044\nS 23924 4895\nS 76276 1905\n", "output": "S 76276 1905\nS 23924 4895\nB 16671 5044\n"}, {"input": "3 3\nB 16671 5006\nS 23924 4895\nS 76276 1905\n", "output": "S 76276 1905\nS 23924 4895\nB 16671 5006\n"}, {"input": "3 3\nB 16671 5006\nS 23924 4895\nS 76276 3800\n", "output": "S 76276 380... | code_stdio |
[
{
"content": "We have a grid with (2^N - 1) rows and (2^M-1) columns. You are asked to write 0 or 1 in each of these squares. Let a_{i,j} be the number written in the square at the i-th row from the top and the j-th column from the left.\n\nFor a quadruple of integers (i_1, i_2, j_1, j_2) such that 1\\leq i_1 \... | [{"input": "9 7", "output": "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\n1010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101\n111111111111111111111111111111111... | code_stdio |
[
{
"content": "Problem C Medical Checkup\n\nStudents of the university have to go for a medical checkup, consisting of lots of checkup items, numbered 1, 2, 3, and so on.\n\nStudents are now forming a long queue, waiting for the checkup to start. Students are also numbered 1, 2, 3, and so on, from the top of the... | [{"input": "3 102\n1\n3\n0", "output": "103\n34\n34\n"}, {"input": "3 35\n1\n3\n3", "output": "36\n12\n11\n"}, {"input": "3 55\n1\n3\n4", "output": "56\n19\n13\n"}, {"input": "3 55\n1\n3\n0", "output": "56\n19\n19\n"}, {"input": "3 55\n1\n4\n0", "output": "56\n14\n14\n"}, {"input": "3 55\n2\n4\n0", "output": "28\n14\n1... | code_stdio |
[
{
"content": "C: Divisor Game\n\nproblem\n\ntsutaj is trying to play about a few games.\n\nIn a divisor game, a natural number N of 2 or more is given first, and then the game progresses according to the following procedure.\n\n* Declare one integer from the divisors of N other than N. However, at this time, it... | [{"input": "1008", "output": "3 29\n"}, {"input": "3690", "output": "4 23\n"}, {"input": "5184", "output": "2 34\n"}, {"input": "120", "output": "3 15\n"}, {"input": "324", "output": "2 14\n"}, {"input": "330", "output": "4 15\n"}, {"input": "560", "output": "3 19\n"}, {"input": "180", "output": "3 17\n"}, {"input": "2... | code_stdio |
[
{
"content": "В самолёте есть n рядов мест. Если смотреть на ряды сверху, то в каждом ряду есть 3 места слева, затем проход между рядами, затем 4 центральных места, затем ещё один проход между рядами, а затем ещё 3 места справа.\n\nИзвестно, что некоторые места уже заняты пассажирами. Всего есть два вида пассаж... | [{"input": "30 1\nPPP-PPP.-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP-PPP\nPPP-PPPP... | code_stdio |
[
{
"content": "When Petya went to school, he got interested in large numbers and what they were called in ancient times. For instance, he learned that the Russian word \"tma\" (which now means \"too much to be counted\") used to stand for a thousand and \"tma tmyschaya\" (which literally means \"the tma of tmas\... | [{"input": "2147483647\n2147483647\n", "output": "YES\n0\n"}, {"input": "2147483646\n2147483647\n", "output": "NO\n"}, {"input": "1094841453\n1656354409\n", "output": "NO\n"}, {"input": "2147483647\n2147483646\n", "output": "NO\n"}, {"input": "1470193122\n1420950405\n", "output": "NO\n"}, {"input": "1470193122\n1180021... | code_stdio |
[
{
"content": "Andrewid the Android is a galaxy-famous detective. He is now chasing a criminal hiding on the planet Oxa-5, the planet almost fully covered with water.\n\nThe only dry land there is an archipelago of n narrow islands located in a row. For more comfort let's represent them as non-intersecting segme... | [{"input": "20 10\n4 9\n10 15\n17 18\n20 21\n11 27\n13 32\n35 40\n46 48\n49 51\n53 56\n59 60\n63 111\n130 68\n69 70\n74 50\n79 80\n89 82\n84 87\n88 91\n98 001\n4 7 6 1 5 4 3 1 8 2\n", "output": "No\n"}, {"input": "20 10\n4 9\n10 15\n17 18\n20 21\n25 27\n13 32\n35 40\n46 48\n49 51\n53 56\n59 60\n63 64\n130 68\n69 70\n74... | code_stdio |
[
{
"content": "Vasya is studying in the last class of school and soon he will take exams. He decided to study polynomials. Polynomial is a function P(x) = a_0 + a_1x^1 + ... + a_{n}x^{n}. Numbers a_{i} are called coefficients of a polynomial, non-negative integer n is called a degree of a polynomial.\n\nVasya ha... | [{"input": "1000000000000000000 1000000000000000000 1000000000000000000\n", "output": "2\n"}, {"input": "1000000000000000000 1000000000000000000 1000000000000000000\n", "output": "2\n"}, {"input": "1001000000000000000 1000000000000000000 1000000000000000000\n", "output": "1\n"}, {"input": "1001000000000000000 100000000... | code_stdio |
[
{
"content": "You are given an array $a_{1}, a_{2}, \\ldots, a_{n}$. You can remove at most one subsegment from it. The remaining elements should be pairwise distinct.\n\nIn other words, at most one time you can choose two integers $l$ and $r$ ($1 \\leq l \\leq r \\leq n$) and delete integers $a_l, a_{l+1}, \\l... | [{"input": "87\n65 97 97 99 57 78 92 55 68 89 63 94 71 54 74 63 94 60 97 75 96 82 87 90 62 72 83 100 76 67 95 69 61 53 55 79 73 99 77 85 79 84 51 58 66 96 97 89 69 84 87 72 53 67 90 63 92 65 73 57 82 69 96 77 73 53 85 96 84 86 61 54 84 52 52 68 100 94 80 60 61 83 89 91 74 92 55\n", "output": "72\n"}, {"input": "87\n65 ... | code_stdio |
[
{
"content": "# Introduction \n\nKa ka ka cypher is a cypher used by small children in some country. When a girl wants to pass something to the other girls and there are some boys nearby, she can use Ka cypher. So only the other girls are able to understand her. \nShe speaks using KA, ie.: \n`ka thi ka s ka bo ... | [{"input": "\"Incomprehensibilities\"", "output": "[\"kaIkancokamprekahekansikabikalikatiekas\"]", "fn_name": "ka_co_ka_de_ka_me"}, {"input": "\"maintenance\"", "output": "[\"kamaikantekanakance\"]", "fn_name": "ka_co_ka_de_ka_me"}, {"input": "\"Woodie\"", "output": "[\"kaWookadie\"]", "fn_name": "ka_co_ka_de_ka_me"}, ... | code_functional |
[
{
"content": "This function should test if the `factor` is a factor of `base`.\n\nReturn `true` if it is a factor or `false` if it is not.\n\n## About factors\nFactors are numbers you can multiply together to get another number.\n\n2 and 3 are factors of 6 because: `2 * 3 = 6`\n\n- You can find a factor by divi... | [{"input": "24617\n3", "output": "[false]", "fn_name": "check_for_factor"}, {"input": "24612\n3", "output": "[true]", "fn_name": "check_for_factor"}, {"input": "2453\n5", "output": "[false]", "fn_name": "check_for_factor"}, {"input": "2450\n5", "output": "[true]", "fn_name": "check_for_factor"}, {"input": "653\n7", "ou... | code_functional |
[
{
"content": "Shaass has decided to hunt some birds. There are n horizontal electricity wires aligned parallel to each other. Wires are numbered 1 to n from top to bottom. On each wire there are some oskols sitting next to each other. Oskol is the name of a delicious kind of birds in Shaass's territory. Suppose... | [{"input": "100\n54 15 25 18 64 62 23 59 70 137 50 26 87 35 75 86 0 22 6 60 70 41 21 9 75 50 25 3 69 14 39 68 64 46 59 99 2 0 21 76 90 12 61 42 12 91 36 39 47 41 93 81 66 57 70 36 68 89 52 1 19 93 67 22 76 20 8 81 123 18 100 73 61 93 75 80 53 72 40 20 2 86 33 70 27 16 11 26 55 44 47 55 94 58 2 55 82 22 9 95\n0\n", "out... | code_stdio |
[
{
"content": "Given are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.\nOperation: Choose one character of S and replace it with a different character.\n\n-----Constraints-----\n - S and T have lengths between 1 and 2\\times 1... | [{"input": "sjpvbzildfxlaukqtfznjjyryrdawsycubdpieejlzsexyhuajiqqigetwdyjeignkuuedzguvqhyrubpdfsenayqahbaqnyhavlaptlqtrotfzvbqbtpkuddnopjzoteuubxgkthzdyepesqgozkdvkcakraxeulhhqtnpolbtcsgxgskjjzdimcyhclnnwfbxwmznpvjaqjqqogwgwmzzpcvhywpcocmsxxmgsodckxvipzobspvwjezxugjlivdhefgdfkzzidktxjcnayjubmsqmpuaaidduwpmhkewaqtkvsudo... | code_stdio |
[
{
"content": "Given a side length `n`, traveling only right and down how many ways are there to get from the top left corner to the bottom right corner of an `n by n` grid?\n\nYour mission is to write a program to do just that!\n\nAdd code to `route(n)` that returns the number of routes for a grid `n by n` (if ... | [{"input": "165", "output": "[95995892383488599901870820732368671856306475542669347911637204757217297906428740013991568571288240]", "fn_name": "routes"}, {"input": "156", "output": "[376594020312425061595746241557406711201605603899894320577733841460621358204120168599683135056]", "fn_name": "routes"}, {"input": "126", "... | code_functional |
[
{
"content": "Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access to n computers throughout the town. Incidentally all the computers, which were hack... | [{"input": "10\n877105545 939360757 849826701 845946140 803128820 926787996 967305000 1743698496 717018470 971203310\n", "output": "181734622\n"}, {"input": "10\n877105545 939360757 849826701 845946140 803128820 926787996 967305000 904694971 921301848 971203310\n", "output": "861364152\n"}, {"input": "10\n877105545 939... | code_stdio |
[
{
"content": "Let's assume that \n\n * v(n) is the largest prime number, that does not exceed n;\n * u(n) is the smallest prime number strictly greater than n. \n\n\n\nFind <image>.\n\nInput\n\nThe first line contains integer t (1 ≤ t ≤ 500) — the number of testscases. \n\nEach of the following t lines of the... | [{"input": "6\n999\n1095\n821\n635\n63\n480\n", "output": "1003961/2011946\n1196833/2398042\n674039/1351366\n403199/808942\n3959/8174\n232303/466546\n"}, {"input": "6\n999\n588\n821\n635\n63\n480\n", "output": "1003961/2011946\n346909/696182\n674039/1351366\n403199/808942\n3959/8174\n232303/466546\n"}, {"input": "6\n88... | code_stdio |
[
{
"content": "There are N cities numbered 1 to N, connected by M railroads.\nYou are now at City 1, with 10^{100} gold coins and S silver coins in your pocket.\nThe i-th railroad connects City U_i and City V_i bidirectionally, and a one-way trip costs A_i silver coins and takes B_i minutes.\nYou cannot use gold... | [{"input": "50 98 49\n12 13 38 966876944\n35 47 5 419053521\n20 23 39 513566946\n43 45 31 973756616\n11 39 45 339701654\n8 12 34 119183522\n5 16 50 644322683\n37 44 42 476275226\n3 4 41 832102486\n29 45 1 974869661\n6 21 32 929876961\n23 33 18 660381903\n12 19 26 747314758\n9 45 22 109205766\n43 50 9 353453224\n18 23 3... | code_stdio |
[
{
"content": "Caracal is fighting with a monster.\nThe health of the monster is H.\nCaracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens:\n - If the monster's health is 1, it drops to 0.\n - If the monster's health, X, is greater than ... | [{"input": "1000000000000\n", "output": "1099511627775\n"}, {"input": "999999999999\n", "output": "1099511627775\n"}, {"input": "549755813888\n", "output": "1099511627775\n"}, {"input": "707813884927\n", "output": "1099511627775\n"}, {"input": "913056879650\n", "output": "1099511627775\n"}, {"input": "1010000000000", "... | code_stdio |
[
{
"content": "Read problems statements in Mandarin Chinese, Russian and Vietnamese as well. \n\nEugene loves sequences, especially arithmetic progressions. One day he was asked to solve a difficult problem.\n\nIf a sequence of numbers A_{1}, A_{2}, ... , A_{N} form an arithmetic progression A, he was asked to c... | [{"input": "2\n-3 3 -2 -2\n2 2 126 3", "output": "6\n-609\n"}, {"input": "2\n-3 3 -2 -2\n2 2 126 0", "output": "6\n-621\n"}, {"input": "2\n-1 6 -2 -2\n2 2 92 -1", "output": "8\n-461\n"}, {"input": "2\n-2 6 -2 -2\n2 2 92 -1", "output": "7\n-461\n"}, {"input": "2\n-2 6 0 -2\n2 2 92 -1", "output": "-4\n-461\n"}, {"input":... | code_stdio |
[
{
"content": "Polycarpus has a ribbon, its length is n. He wants to cut the ribbon in a way that fulfils the following two conditions: \n\n * After the cutting each ribbon piece should have length a, b or c. \n * After the cutting the number of ribbon pieces should be maximum. \n\n\n\nHelp Polycarpus and find... | [{"input": "3043 317 1141 2438\n", "output": "7\n"}, {"input": "3399 2035 2 3334\n", "output": "683\n"}, {"input": "4000 500 1000 2000\n", "output": "8\n"}, {"input": "4000 500 1000 1671\n", "output": "8\n"}, {"input": "918 102 1327 1733\n", "output": "9\n"}, {"input": "595 2263 3625 1\n", "output": "595\n"}, {"input":... | code_stdio |
[
{
"content": "You are given integers N,\\ A and B. Determine if there exists a permutation (P_0,\\ P_1,\\ ...\\ P_{2^N-1}) of (0,\\ 1,\\ ...\\ 2^N-1) that satisfies all of the following conditions, and create one such permutation if it exists.\n\n* P_0=A\n* P_{2^N-1}=B\n* For all 0 \\leq i < 2^N-1, the binary r... | [{"input": "2 1 0", "output": "YES\n1 3 2 0\n"}, {"input": "2 2 0", "output": "YES\n2 3 1 0\n"}, {"input": "2 3 2", "output": "YES\n3 1 0 2\n"}, {"input": "2 0 2", "output": "YES\n0 1 3 2\n"}, {"input": "2 2 3", "output": "YES\n2 0 1 3\n"}, {"input": "2 3 1", "output": "YES\n3 2 0 1\n"}, {"input": "2 0 1", "output": "Y... | code_stdio |
[
{
"content": "We have a board with a 2 \\times N grid.\nSnuke covered the board with N dominoes without overlaps.\nHere, a domino can cover a 1 \\times 2 or 2 \\times 1 square.\nThen, Snuke decided to paint these dominoes using three colors: red, cyan and green.\nTwo dominoes that are adjacent by side should be... | [{"input": "52\nRvvttdWIyyPPQFFZZssffEEkkaSSDKqcibbeYrhAljCCGGJppHHn\nRLLwwdWIxxNNQUUXXVVMMooBBaggDKqcimmeYrhAljOOTTJuuzzn\n", "output": "958681902\n"}, {"input": "52\nLLJngjjWwrKFFqcXNNYYaaGiimDtlsuuCTTyppVkkfobOOvxxAAU\nIIJnghhWwrKRRqcXZZQQddGMMmDtlsPPCeeyzzVSSfobHHvBBEEU\n", "output": "358954489\n"}, {"input": "52\n... | code_stdio |
[
{
"content": "In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m along the corridor, and all sections with equal numbers on ... | [{"input": "10 10 1 8 4\n10\n2 3 4 5 6 7 8 9\n10\n1 1 3 1\n2 1 7 1\n1 1 9 1\n7 1 4 1\n10 1 7 1\n2 1 7 1\n3 1 2 1\n5 1 2 1\n10 1 5 1\n6 1 9 1\n", "output": "3\n4\n4\n3\n3\n4\n3\n3\n4\n3\n"}, {"input": "10 18 1 8 4\n10\n2 3 4 5 6 7 8 9\n10\n1 1 3 1\n2 1 7 1\n1 1 9 1\n7 1 4 1\n10 1 7 1\n2 1 7 1\n3 1 2 1\n5 1 2 1\n10 1 5 1... | code_stdio |
[
{
"content": "problem\n\nChairman K is a regular customer of the JOI pizza shop in the center of JOI city. For some reason, he decided to start a life-saving life this month. So he wanted to order the pizza with the highest calories per dollar among the pizzas he could order at the JOI pizza store. Let's call s... | [{"input": "3\n16 2\n358\n87\n1601\n010", "output": "108\n"}, {"input": "3\n16 2\n696\n77\n1150\n010", "output": "102\n"}, {"input": "3\n12 2\n200\n87\n1514\n010", "output": "122\n"}, {"input": "3\n12 2\n491\n77\n1150\n010", "output": "117\n"}, {"input": "3\n12 2\n200\n87\n1149\n010", "output": "96\n"}, {"input": "3\n2... | code_stdio |
[
{
"content": "Polycarp had an array $a$ of $3$ positive integers. He wrote out the sums of all non-empty subsequences of this array, sorted them in non-decreasing order, and got an array $b$ of $7$ integers.\n\nFor example, if $a = \\{1, 4, 3\\}$, then Polycarp wrote out $1$, $4$, $3$, $1 + 4 = 5$, $1 + 3 = 4$,... | [{"input": "5\n1 3 4 4 5 7 8\n1 2 3 4 5 6 7\n300000000 300000000 300000000 600000000 600000000 600000000 900000000\n1 1 2 999999998 999999999 999999999 1000000000\n1 2 2 3 3 4 5\n", "output": "1 3 4\n1 2 4\n300000000 300000000 300000000\n1 1 999999998\n1 2 2\n"}, {"input": "5\n1 3 4 4 5 7 8\n1 2 3 4 5 6 7\n300000000 30... | code_stdio |
[
{
"content": "In this Kata, two players, Alice and Bob, are playing a palindrome game. Alice starts with `string1`, Bob starts with `string2`, and the board starts out as an empty string. Alice and Bob take turns; during a turn, a player selects a letter from his or her string, removes it from the string, and a... | [{"input": "\"qtkxttl\"\n\"utvohqk\"", "output": "[2]", "fn_name": "solve"}, {"input": "\"mctimp\"\n\"eyqbnh\"", "output": "[1]", "fn_name": "solve"}, {"input": "\"btzgd\"\n\"svjyb\"", "output": "[2]", "fn_name": "solve"}, {"input": "\"eyfjy\"\n\"ooigv\"", "output": "[1]", "fn_name": "solve"}, {"input": "\"abc\"\n\"xyz... | code_functional |
[
{
"content": "You have an array $a_1, a_2, \\dots, a_n$ consisting of $n$ distinct integers. You are allowed to perform the following operation on it:\n\nChoose two elements from the array $a_i$ and $a_j$ ($i \\ne j$) such that $\\gcd(a_i, a_j)$ is not present in the array, and add $\\gcd(a_i, a_j)$ to the end ... | [{"input": "57\n241 444 553 126 612 550 441 420 742 879 520 664 590 198 910 731 308 740 791 680 904 629 324 606 621 75 350 253 57 164 440 970 876 648 581 258 989 851 186 117 700 537 837 284 654 130 728 955 859 988 820 345 901 294 244 125 512\n", "output": "48"}, {"input": "10\n239529 302993 398153 204081 370085 184103 ... | code_stdio |
[
{
"content": "A: Isono, let's do that! --Sendame -\n\nstory\n\nNakajima \"Isono ~, let's do that!\"\n\nIsono \"What is that, Nakajima\"\n\nNakajima \"Look, that's that. It's hard to explain because I have to express it in letters for some reason.\"\n\nIsono \"No, it seems that you can put in figures and photos,... | [{"input": "3\ntameru\ntameru\nuremat\ntameru\nkougekida\ntameru", "output": "Nakajima-kun\n"}, {"input": "3\ntameru\ntameru\nuremat\ntameru\nadikeguok\ntameru", "output": "Hikiwake-kun\n"}, {"input": "3\ntameru\ntameru\nuremat\ntameru\nadikeguok\ntamdru", "output": "Hikiwake-kun\n"}, {"input": "3\ntameru\nuremat\nurem... | code_stdio |
[
{
"content": "Polycarp is going to participate in the contest. It starts at $h_1:m_1$ and ends at $h_2:m_2$. It is guaranteed that the contest lasts an even number of minutes (i.e. $m_1 \\% 2 = m_2 \\% 2$, where $x \\% y$ is $x$ modulo $y$). It is also guaranteed that the entire contest is held during a single ... | [{"input": "10:00\n11:00\n", "output": "10:30\n"}, {"input": "11:10\n11:12\n", "output": "11:11\n"}, {"input": "01:02\n03:02\n", "output": "02:02\n"}, {"input": "00:00\n23:58\n", "output": "11:59\n"}, {"input": "00:01\n23:59\n", "output": "12:00\n"}, {"input": "00:00\n00:02\n", "output": "00:01\n"}, {"input": "23:57\n2... | code_stdio |
[
{
"content": "There are three friend living on the straight line Ox in Lineland. The first friend lives at the point x_1, the second friend lives at the point x_2, and the third friend lives at the point x_3. They plan to celebrate the New Year together, so they need to meet at one point. What is the minimum to... | [{"input": "131 21 80\n", "output": "110\n"}, {"input": "138 23 56\n", "output": "115\n"}, {"input": "149 93 35\n", "output": "114\n"}, {"input": "29 97 147\n", "output": "118\n"}, {"input": "149 93 25\n", "output": "124\n"}, {"input": "235 31 80\n", "output": "204\n"}, {"input": "131 31 80\n", "output": "100\n"}, {"in... | code_stdio |
[
{
"content": "There is a right triangle with legs of length a and b. Your task is to determine whether it is possible to locate the triangle on the plane in such a way that none of its sides is parallel to the coordinate axes. All the vertices must have integer coordinates. If there exists such a location, you ... | [{"input": "1000 1000\n", "output": "YES\n0 0\n280 960\n-960 280"}, {"input": "545 175\n", "output": "YES\n0 0\n327 436\n-140 105\n"}, {"input": "385 850\n", "output": "YES\n0 0\n231 308\n-680 510\n"}, {"input": "280 210\n", "output": "YES\n0 0\n168 224\n-168 126"}, {"input": "408 765\n", "output": "YES\n0 0\n360 192\n... | code_stdio |
[
{
"content": "There are n problems prepared for the next Codeforces round. They are arranged in ascending order by their difficulty, and no two problems have the same difficulty. Moreover, there are m pairs of similar problems. Authors want to split problems between two division according to the following rules... | [{"input": "100000 10\n99562 484\n1099 99684\n593 99867\n99529 175\n99738 616\n99523 766\n99503 121\n99784 158\n199 99199\n15 99849\n", "output": "98100\n"}, {"input": "100000 10\n99562 484\n1099 99684\n593 99867\n99529 175\n99738 616\n99523 766\n42925 121\n99784 158\n199 99199\n15 99849\n", "output": "41826\n"}, {"inp... | code_stdio |
[
{
"content": "Recently a serious bug has been found in the FOS code. The head of the F company wants to find the culprit and punish him. For that, he set up an organizational meeting, the issue is: who's bugged the code? Each of the n coders on the meeting said: 'I know for sure that either x or y did it!'\n\nT... | [{"input": "10 3\n6 3\n6 10\n2 5\n5 7\n6 2\n9 2\n8 1\n10 5\n5 10\n7 6\n", "output": "34\n"}, {"input": "10 2\n10 2\n9 3\n9 4\n7 2\n4 6\n10 1\n9 2\n3 10\n7 1\n5 1\n", "output": "43\n"}, {"input": "10 3\n6 3\n6 10\n2 5\n5 7\n6 2\n9 2\n8 1\n10 5\n5 10\n7 3\n", "output": "37\n"}, {"input": "10 3\n6 3\n6 10\n2 5\n2 7\n6 2\n... | code_stdio |
[
{
"content": "Takahashi has N days of summer vacation.\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\nWhat is the maximum number of days Takahashi can hang out d... | [{"input": "1000000 10000\n10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000... | code_stdio |
[
{
"content": "There is 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.\n\nIn the grid, N Squares (r_1, c_1), (r_2, c_2), \\ldots, (r_N, c_N) are wall squares, and the others are all empty squares. It is guaranteed... | [{"input": "100000 100000 1\n50000 23836", "output": "920202332\n"}, {"input": "100000 100000 1\n50000 25003", "output": "717307015\n"}, {"input": "100000 100000 1\n50000 29731", "output": "587968146\n"}, {"input": "100000 100000 1\n84868 25003", "output": "677865158\n"}, {"input": "100000 100000 0\n50000 29731", "outp... | code_stdio |
[
{
"content": "— This is not playing but duty as allies of justice, Nii-chan!\n\n— Not allies but justice itself, Onii-chan!\n\nWith hands joined, go everywhere at a speed faster than our thoughts! This time, the Fire Sisters — Karen and Tsukihi — is heading for somewhere they've never reached — water-surrounded... | [{"input": "5000 5000 5000\n", "output": "986778560\n"}, {"input": "1171 2989 2853\n", "output": "234725427\n"}, {"input": "3238 2923 4661\n", "output": "636587126\n"}, {"input": "4539 2805 2702\n", "output": "356944655\n"}, {"input": "4998 4998 4998\n", "output": "259368717\n"}, {"input": "2048 4096 1024\n", "output":... | code_stdio |
[
{
"content": "Stepan likes to repeat vowel letters when he writes words. For example, instead of the word \"pobeda\" he can write \"pobeeeedaaaaa\".\n\nSergey does not like such behavior, so he wants to write a program to format the words written by Stepan. This program must combine all consecutive equal vowels... | [{"input": "200\nmmffggzvuuzzlkafduueqocuybiiaaeeoiioouaaurccuqoouuooooooyjjtyyxxiipnoeufyuuoyxxhhkaaeoooxapauuoppzabuuoiiuuggcciissuugejjiirruummsiifaauyypauwoofiemzaeeeeeeiioozzttyyidaaaiggizzerkooooeeepueeauupathhb\n", "output": "mmffggzvuzzlkafdueqocuybiaeeoioouaurccuqoouoyjjtyxxipnoeufyuoyxxhhkaeoxapauoppzabuoiugg... | code_stdio |
[
{
"content": "500-yen Saving\n\n\"500-yen Saving\" is one of Japanese famous methods to save money. The method is quite simple; whenever you receive a 500-yen coin in your change of shopping, put the coin to your 500-yen saving box. Typically, you will find more than one million yen in your saving box in ten ye... | [{"input": "4\n800\n700\n1600\n600\n4\n300\n1205\n1600\n30\n4\n300\n700\n1600\n650\n3\n1001\n2000\n638\n3\n250\n250\n1000\n4\n1251\n1466\n698\n299\n0", "output": "2 2900\n4 3135\n3 3250\n2 1639\n3 1500\n4 3714\n"}, {"input": "4\n800\n700\n1600\n600\n4\n300\n1205\n1600\n30\n4\n300\n700\n1600\n650\n3\n1001\n2000\n638\n3\... | code_stdio |
[
{
"content": "Holidays have finished. Thanks to the help of the hacker Leha, Noora managed to enter the university of her dreams which is located in a town Pavlopolis. It's well known that universities provide students with dormitory for the period of university studies. Consequently Noora had to leave Vičkopol... | [{"input": "12 1000000000\n", "output": "479001600\n"}, {"input": "1000000000 12\n", "output": "479001600\n"}, {"input": "1000000000 12\n", "output": "479001600\n"}, {"input": "12 1000000000\n", "output": "479001600\n"}, {"input": "1000000100 12\n", "output": "479001600\n"}, {"input": "12 1000100000\n", "output": "4790... | code_stdio |
[
{
"content": "There is an infinite board of square tiles. Initially all tiles are white.\n\nVova has a red marker and a blue marker. Red marker can color $a$ tiles. Blue marker can color $b$ tiles. If some tile isn't white then you can't use marker of any color on it. Each marker must be drained completely, so ... | [{"input": "99999999999973 99999999999971\n", "output": "199999999999948\n"}, {"input": "99999999999962 99999999999973\n", "output": "133333333333296\n"}, {"input": "99999999999973 99999999999930\n", "output": "399999999999808\n"}, {"input": "49999819999926 50000000000155\n", "output": "199999640000164\n"}, {"input": "... | code_stdio |
[
{
"content": "CQXYM is counting permutations length of $2n$.\n\nA permutation is an array consisting of $n$ distinct integers from $1$ to $n$ in arbitrary order. For example, $[2,3,1,5,4]$ is a permutation, but $[1,2,2]$ is not a permutation ($2$ appears twice in the array) and $[1,3,4]$ is also not a permutati... | [{"input": "20\n597\n2791\n71\n1\n6\n14\n196\n1\n4335\n14\n5133\n6\n17\n3620\n5111\n1\n119\n992\n76848\n127\n", "output": "924058387\n309126958\n25034588\n1\n239500800\n517878947\n323758520\n1\n41675960\n517878947\n479930293\n239500800\n971636156\n715097853\n974503605\n1\n796779807\n613317322\n14480144\n386977425\n"}, ... | code_stdio |
[
{
"content": "Write a function that takes a single array as an argument (containing multiple strings and/or positive numbers and/or arrays), and returns one of four possible string values, depending on the ordering of the lengths of the elements in the input array:\n\nYour function should return...\n\n- “Increa... | [{"input": "[[1, 23, 456, 78910], [\"abcdef\", \"ghijklmno\", \"pqrstuvwxy\"], [[1, 23, 456, 78910, [\"abcdef\", \"ghijklmno\", \"pqrstuvwxy\"]], 1234]]", "output": "[\"Decreasing\"]", "fn_name": "order_type"}, {"input": "[[\"ab\", \"cdef\", \"g\"], [\"hi\", \"jk\", \"lmnopq\"], [\"rst\", \"uv\", \"wx\"], [\"yz\"]]", "... | code_functional |
[
{
"content": "You are a mayor of Berlyatov. There are $n$ districts and $m$ two-way roads between them. The $i$-th road connects districts $x_i$ and $y_i$. The cost of travelling along this road is $w_i$. There is some path between each pair of districts, so the city is connected.\n\nThere are $k$ delivery rout... | [{"input": "5 5 4\n1 2 5\n4 3 4\n1 4 3\n4 3 10\n3 5 2\n1 5\n1 3\n3 3\n1 5\n", "output": "13\n"}, {"input": "5 5 4\n1 2 5\n4 3 4\n1 4 3\n4 3 10\n3 5 2\n1 2\n1 3\n3 3\n1 5\n", "output": "13\n"}, {"input": "5 5 4\n1 2 5\n2 3 4\n1 4 3\n4 3 7\n3 5 2\n1 5\n1 3\n3 3\n1 5\n", "output": "13\n"}, {"input": "5 5 4\n1 2 5\n2 3 4\n... | code_stdio |
[
{
"content": "Suppose $a_1, a_2, \\dots, a_n$ is a sorted integer sequence of length $n$ such that $a_1 \\leq a_2 \\leq \\dots \\leq a_n$.\n\nFor every $1 \\leq i \\leq n$, the prefix sum $s_i$ of the first $i$ terms $a_1, a_2, \\dots, a_i$ is defined by $$ s_i = \\sum_{k=1}^i a_k = a_1 + a_2 + \\dots + a_i. $$... | [{"input": "10\n2 1\n1000000000\n3 2\n-100000000 -150000003\n3 2\n-100000000 -150000004\n3 2\n-100000000 -150000001\n3 2\n-100000000 -150000002\n3 2\n-100000000 -150000000\n3 2\n-100000000 -149999999\n3 2\n-100000000 -149999999\n3 2\n-100000000 -149999998\n3 2\n-100000000 -149999997\n", "output": "Yes\nNo\nNo\nNo\nNo\n... | code_stdio |
[
{
"content": "A number is called almost prime if it has exactly two distinct prime divisors. For example, numbers 6, 18, 24 are almost prime, while 4, 8, 9, 42 are not. Find the amount of almost prime numbers which are between 1 and n, inclusive.\n\nInput\n\nInput contains one integer number n (1 ≤ n ≤ 3000).\n... | [{"input": "2998\n", "output": "1375\n"}, {"input": "2999\n", "output": "1375\n"}, {"input": "2997\n", "output": "1374\n"}, {"input": "3000\n", "output": "1375\n"}, {"input": "2990\n", "output": "1370\n"}, {"input": "2608\n", "output": "1216\n"}, {"input": "2103\n", "output": "1001\n"}, {"input": "1429\n", "output": "7... | code_stdio |
[
{
"content": "Takahashi made N problems for competitive programming.\nThe problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).\nHe is dividing the problems into two categories by choosing an integer K, as follows:\n - A problem with difficulty ... | [{"input": "29108\n82 21 41 24 13 39 53 14 10 42 19 46 48 18 81 69 6 62 80 32 58 97 9 7 19 16 84 91 25 47 83 25 75 19 16 16 70 10 29 45 89 89 68 59 75 30 51 78 86 4 63 73 31 64 24 82 44 16 40 11 15 75 95 27 41 33 2 2 37 57 83 2 33 2 24 93 29 78 49 3 51 76 54 73 48 28 50 67 26 4 78 32 19 4 83 29 36 92 93 71 5 22 72 66 1... | code_stdio |
[
{
"content": "Vasya had a strictly increasing sequence of positive integers a_1, ..., a_{n}. Vasya used it to build a new sequence b_1, ..., b_{n}, where b_{i} is the sum of digits of a_{i}'s decimal representation. Then sequence a_{i} got lost and all that remained is sequence b_{i}.\n\nVasya wonders what the ... | [{"input": "100\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n6\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n18\n... | code_stdio |
[
{
"content": "Takahashi and Aoki will play a game on a tree. The tree has N vertices numbered 1 to N, and the i-th of the N-1 edges connects Vertex a_i and Vertex b_i.\n\nAt the beginning of the game, each vertex contains a coin. Starting from Takahashi, he and Aoki will alternately perform the following operat... | [{"input": "7\n1 7\n3 1\n3 4\n2 5\n6 3\n2 1", "output": "Second\n"}, {"input": "7\n1 7\n7 1\n3 7\n2 5\n6 3\n4 1", "output": "Second\n"}, {"input": "7\n1 7\n4 1\n6 4\n7 5\n6 4\n2 1", "output": "Second\n"}, {"input": "7\n1 7\n5 1\n3 6\n3 5\n6 3\n2 1", "output": "Second\n"}, {"input": "7\n1 7\n3 1\n3 4\n4 5\n6 3\n2 1", "o... | code_stdio |
[
{
"content": "Read problems statements in Mandarin Chinese and Russian as well. \n\nJohn's barn has a fence consisting of N consecutive parts numbered from left to right starting from 1 to N. Each part is initially painted in one of two colors: red or green, whose information is provided you by a string C. The ... | [{"input": "1\n7 -1\nRGGRGRG", "output": "6\n"}, {"input": "1\n7 -1\nRGGSGRG", "output": "4\n"}, {"input": "1\n7 -1\nGGGRRRG", "output": "2\n"}, {"input": "1\n7 -2\nGGGRRRG", "output": "2\n"}, {"input": "1\n7 -1\nGRGRGGR", "output": "5\n"}, {"input": "1\n7 -1\nGRGQGGR", "output": "3\n"}, {"input": "1\n7 -1\nQGGRGRG", "... | code_stdio |
[
{
"content": "DNA is a biomolecule that carries genetic information. It is composed of four different building blocks, called nucleotides: adenine (A), thymine (T), cytosine (C) and guanine (G). Two DNA strands join to form a double helix, whereby the nucleotides of one strand bond to the nucleotides of the oth... | [{"input": "\"TGCTACGTACGATCGACGATCCACGAC\"\n\"GTCGTGGATCGTCGATCGTACGTAGCA\"", "output": "[true]", "fn_name": "check_DNA"}, {"input": "\"CGACATCGAGGGGGCTCAGAAGTACTGA\"\n\"CATGGCGTCAGTACTTCTGAGCC\"", "output": "[false]", "fn_name": "check_DNA"}, {"input": "\"ATGCCTACGGCCATATATATTTAG\"\n\"CTAAATATGTATGGCCGTAGGCAT\"", "ou... | code_functional |
[
{
"content": "My little sister came back home from school with the following task:\ngiven a squared sheet of paper she has to cut it in pieces\nwhich, when assembled, give squares the sides of which form\nan increasing sequence of numbers.\nAt the beginning it was lot of fun but little by little we were tired o... | [{"input": "7654322", "output": "[[1, 4, 11, 69, 3912, 7654321]]", "fn_name": "decompose"}, {"input": "7654321", "output": "[[6, 10, 69, 3912, 7654320]]", "fn_name": "decompose"}, {"input": "123456", "output": "[[1, 2, 7, 29, 496, 123455]]", "fn_name": "decompose"}, {"input": "1234567", "output": "[[2, 8, 32, 1571, 123... | code_functional |
[
{
"content": "The Smart Beaver from ABBYY decided to have a day off. But doing nothing the whole day turned out to be too boring, and he decided to play a game with pebbles. Initially, the Beaver has n pebbles. He arranges them in a equal rows, each row has b pebbles (a > 1). Note that the Beaver must use all t... | [{"input": "1000000000\n", "output": "1998535156\n"}, {"input": "1000001000\n", "output": "1906011808\n"}, {"input": "1549355491\n", "output": "1559780582\n"}, {"input": "1292236879\n", "output": "1292236880\n"}, {"input": "999996270\n", "output": "1705144136\n"}, {"input": "999999999\n", "output": "1494160827\n"}, {"i... | code_stdio |
[
{
"content": "Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties:\n\n the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of mat... | [{"input": "8 20\n0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1 0\n1 0 1 0 1 0 0 0 0 1 0 1 0 1 1 0 1 1 1 1\n1 0 1 0 1 0 0 0 0 1 0 1 0 1 1 0 1 1 1 1\n0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1 0\n0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1 0\n1 0 1 0 1 0 0 0 0 1 0 1 0 1 1 0 1 1 1 1\n1 0 1 0 1 0 0 0 0 1 0 1 0 1 1 0 1 1 1 1\n0 0 1 1 1 1 0 0... | code_stdio |
[
{
"content": "You are given undirected weighted graph. Find the length of the shortest cycle which starts from the vertex 1 and passes throught all the edges at least once. Graph may contain multiply edges between a pair of vertices and loops (edges from the vertex to itself).\n\nInput\n\nThe first line of the ... | [{"input": "15 32\n15 9 8860\n12 4 9045\n12 12 8221\n9 6 8306\n11 14 9052\n13 14 8176\n14 5 8857\n6 8 8835\n3 9 8382\n10 14 8212\n13 13 9061\n2 14 8765\n4 13 9143\n13 13 8276\n13 11 8723\n7 10 8775\n8 15 8965\n15 5 8800\n4 5 9317\n5 13 9178\n1 7 9031\n4 10 9114\n10 4 8628\n9 1 8584\n5 7 8701\n6 15 8177\n3 3 9325\n4 5 9... | code_stdio |
[
{
"content": "Write function describeList which returns \"empty\" if the list is empty or \"singleton\" if it contains only one element or \"longer\"\" if more.\n\nWrite Python code to solve this problem. Define a top-level function named `describeList` that takes the input arguments described above and returns... | [{"input": "[\"one\", \"two\"]", "output": "[\"longer\"]", "fn_name": "describeList"}, {"input": "[1, 2, 5, 4]", "output": "[\"longer\"]", "fn_name": "describeList"}, {"input": "[[1, 2]]", "output": "[\"singleton\"]", "fn_name": "describeList"}, {"input": "[\"one\"]", "output": "[\"singleton\"]", "fn_name": "describeLi... | code_functional |
[
{
"content": "In a small but very proud high school it was decided to win ACM ICPC. This goal requires to compose as many teams of three as possible, but since there were only 6 students who wished to participate, the decision was to build exactly two teams.\n\nAfter practice competition, participant number i g... | [{"input": "1000 1000 1000 1000 1000 1000\n", "output": "YES\n"}, {"input": "1000 1000 1000 1000 1000 1000\n", "output": "YES\n"}, {"input": "1000 1001 1000 1000 1000 1000\n", "output": "NO\n"}, {"input": "1000 1001 1000 0000 1000 1000\n", "output": "NO\n"}, {"input": "1000 1000 999 1000 1000 1000\n", "output": "NO\n"}... | code_stdio |
[
{
"content": "Ivan plays an old action game called Heretic. He's stuck on one of the final levels of this game, so he needs some help with killing the monsters.\n\nThe main part of the level is a large corridor (so large and narrow that it can be represented as an infinite coordinate line). The corridor is divi... | [{"input": "2\n3 2\n1 3 5\n4 1\n5 2 3 5\n", "output": "2\n2\n"}, {"input": "2\n3 2\n1 3 5\n4 1\n5 4 3 5\n", "output": "2\n3\n"}, {"input": "2\n3 2\n1 1 5\n4 1\n5 4 3 5\n", "output": "1\n3\n"}, {"input": "2\n3 2\n0 1 5\n4 1\n5 2 3 5\n", "output": "1\n2\n"}, {"input": "2\n3 2\n0 1 5\n4 1\n5 4 3 5\n", "output": "1\n3\n"},... | code_stdio |
[
{
"content": "# Task\n\nThe function `fold_cube(number_list)` should return a boolean based on a net (given as a number list), if the net can fold into a cube. \nYour code must be effecient and complete the tests within 500ms. \n\n## Input\n\nImagine a net such as the one below.\n\n```\n@\n@ @ @ @\n @\n```\n... | [{"input": "[18, 16, 17, 15, 13, 14]", "output": "[true]", "fn_name": "fold_cube"}, {"input": "[24, 20, 14, 19, 18, 9]", "output": "[true]", "fn_name": "fold_cube"}, {"input": "[12, 14, 13, 9, 10, 6]", "output": "[false]", "fn_name": "fold_cube"}, {"input": "[1, 7, 6, 17, 12, 16]", "output": "[false]", "fn_name": "fold... | code_functional |
[
{
"content": "There is an integer sequence A of length N whose values are unknown.\nGiven is an integer sequence B of length N-1 which is known to satisfy the following:\n B_i \\geq \\max(A_i, A_{i+1}) \nFind the maximum possible sum of the elements of A.\n\n-----Constraints-----\n - All values in input are int... | [{"input": "100\n100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 10... | code_stdio |
[
{
"content": "You are given an integer a that consists of n digits. You are also given a sequence of digits s of length m. The digit in position j (1 ≤ j ≤ m) of sequence s means that you can choose an arbitrary position i (1 ≤ i ≤ n) in a and replace the digit in the chosen position i with sj. Each element in ... | [{"input": "123456789012345678905764345\n00001\n", "output": "123456789112345678905764345\n"}, {"input": "123456789012345678905764345\n01001\n", "output": "123456789112345678915764345"}, {"input": "123456789012345678905764345\n11001\n", "output": "123456789112345678915764345"}, {"input": "123456789012345678905764345\n1... | code_stdio |
[
{
"content": "At the big break Nastya came to the school dining room. There are $n$ pupils in the school, numbered from $1$ to $n$. Unfortunately, Nastya came pretty late, so that all pupils had already stood in the queue, i.e. Nastya took the last place in the queue. Of course, it's a little bit sad for Nastya... | [{"input": "20 47\n4 6 11 15 9 17 3 1 19 14 12 8 2 5 7 20 16 18 13 10\n18 10\n6 3\n15 17\n18 7\n4 5\n19 10\n6 7\n11 3\n1 10\n17 3\n6 14\n7 10\n19 5\n12 10\n1 8\n6 11\n18 5\n6 8\n12 12\n1 5\n20 11\n16 8\n3 10\n20 19\n17 8\n19 10\n2 5\n19 8\n6 9\n16 3\n16 10\n19 7\n17 16\n10 13\n8 9\n12 5\n17 10\n2 15\n6 15\n4 9\n10 1\n1... | code_stdio |
[
{
"content": "Takahashi participated in a contest on AtCoder.\nThe contest had N problems.\nTakahashi made M submissions during the contest.\nThe i-th submission was made for the p_i-th problem and received the verdict S_i (AC or WA).\nThe number of Takahashi's correct answers is the number of problems on which... | [{"input": "100000 3\n7777 AC\n7777 AC\n7777 AC\n", "output": "1 0\n"}, {"input": "100000 3\n12676 AC\n7777 AC\n7777 CA", "output": "2 0\n"}, {"input": "100000 3\n7777 AC\n7777 AC\n7777 CA", "output": "1 0\n"}, {"input": "100000 3\n6234 AC\n7777 AC\n7777 AC", "output": "2 0\n"}, {"input": "100000 3\n7777 AC\n7777 AC\n7... | code_stdio |
[
{
"content": "Some integral numbers are odd. All are more odd, or less odd, than others.\n\nEven numbers satisfy `n = 2m` ( with `m` also integral ) and we will ( completely arbitrarily ) think of odd numbers as `n = 2m + 1`. \nNow, some odd numbers can be more odd than others: when for some `n`, `m` is more o... | [{"input": "[-42, -41, -40, -39, -38, -37, -36, -35, -34, -33, -32, -31, -30, -29, -28, -27, -26, -25, -24, -23, -22, -21, -20, -19, -18, -17, -16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 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, ... | code_functional |
[
{
"content": "A series or sequence of numbers is usually the product of a function and can either be infinite or finite.\n\nIn this kata we will only consider finite series and you are required to return a code according to the type of sequence:\n\n|Code|Type|Example|\n|-|-|-|\n|`0`|`unordered`|`[3,5,8,1,14,3]`... | [{"input": "[3, 5, 8, 9, 14, 23]", "output": "[1]", "fn_name": "sequence_classifier"}, {"input": "[3, 5, 8, 8, 14, 14]", "output": "[2]", "fn_name": "sequence_classifier"}, {"input": "[14, 14, 8, 8, 5, 3]", "output": "[4]", "fn_name": "sequence_classifier"}, {"input": "[3, 5, 8, 1, 14, 3]", "output": "[0]", "fn_name": ... | code_functional |
[
{
"content": "Let S(n) denote the sum of the digits in the decimal notation of n.\nFor example, S(101) = 1 + 0 + 1 = 2.\nGiven an integer N, determine if S(N) divides N.\n\n-----Constraints-----\n - 1 \\leq N \\leq 10^9\n\n-----Input-----\nInput is given from Standard Input in the following format:\nN\n\n-----O... | [{"input": "1000000000\n", "output": "Yes\n"}, {"input": "999999999\n", "output": "Yes\n"}, {"input": "873041724\n", "output": "Yes\n"}, {"input": "689670774\n", "output": "Yes\n"}, {"input": "506479109\n", "output": "Yes\n"}, {"input": "693828976\n", "output": "No\n"}, {"input": "972655544\n", "output": "No\n"}, {"inp... | code_stdio |
[
{
"content": "There are n kangaroos with pockets. Each kangaroo has a size (integer number). A kangaroo can go into another kangaroo's pocket if and only if the size of kangaroo who hold the kangaroo is at least twice as large as the size of kangaroo who is held.\n\nEach kangaroo can hold at most one kangaroo, ... | [{"input": "100\n154\n60\n97\n638\n139\n150\n570\n579\n601\n647\n804\n237\n245\n549\n288\n347\n778\n282\n916\n441\n974\n145\n957\n886\n655\n702\n930\n618\n132\n520\n972\n48\n94\n54\n682\n433\n896\n134\n845\n636\n242\n842\n125\n141\n240\n130\n409\n666\n948\n938\n604\n110\n474\n484\n364\n40\n807\n271\n438\n288\n201\n814\... | code_stdio |
[
{
"content": "Grandma Laura came to the market to sell some apples. During the day she sold all the apples she had. But grandma is old, so she forgot how many apples she had brought to the market.\n\nShe precisely remembers she had n buyers and each of them bought exactly half of the apples she had at the momen... | [{"input": "40 562\nhalfplus\nhalfplus\nhalfplus\nhalfplus\nhalfplus\nhalfplus\nhalfplus\nhalfplus\nhalf\nhalf\nhalf\nhalfplus\nhalf\nhalf\nhalfplus\nhalf\nhalfplus\nhalf\nhalfplus\nhalf\nhalfplus\nhalf\nhalfplus\nhalfplus\nhalfplus\nhalfplus\nhalfplus\nhalf\nhalf\nhalfplus\nhalf\nhalfplus\nhalfplus\nhalf\nhalf\nhalfpl... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.