messages
listlengths
1
1
ground_truth
stringlengths
156
726k
dataset
stringclasses
2 values
[ { "content": "There are several colored cubes. All of them are of the same size but they may be colored differently. Each face of these cubes has a single color. Colors of distinct faces of a cube may or may not be the same.\n\nTwo cubes are said to be identically colored if some suitable rotations of one of th...
[{"input": "3\nscarlet green blue yellow magenta cyan\nblue pink green magenta cyan lemon\npurple red blue yellow cyan green\n2\nred green blue yellow magenta cyan\ncyan green blue yellow magenta red\n2\nred green gray gray magenta cyan\ncyan green gray fray magenta red\n2\nred green blue yellow magenta cyan\nmagenta r...
code_stdio
[ { "content": "John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.\n\nThere are $n$ students, each of them has a unique id (from $1$ to $n...
[{"input": "18\n68 32 84 6\n44 53 11 21\n61 34 77 82\n19 36 47 58\n47 73 31 96\n17 50 82 16\n57 90 64 8\n14 37 45 69\n48 1 18 58\n42 34 96 14\n56 82 33 77\n40 66 30 53\n33 31 44 95\n0 90 24 8\n7 85 39 1\n76 77 93 35\n98 9 62 13\n24 84 60 51\n", "output": "8\n"}, {"input": "18\n68 32 84 6\n44 53 11 21\n61 34 77 82\n19 3...
code_stdio
[ { "content": "There are $n$ shovels in the nearby shop. The $i$-th shovel costs $a_i$ bourles.\n\nMisha has to buy exactly $k$ shovels. Each shovel can be bought no more than once.\n\nMisha can buy shovels by several purchases. During one purchase he can choose any subset of remaining (non-bought) shovels and b...
[{"input": "9 4 8\n12 13 5 1 12 1 2 2 2\n9 4\n8 4\n5 3\n9 7\n", "output": "28\n"}, {"input": "9 4 8\n6 13 5 1 10 1 1 2 1\n9 4\n8 4\n5 3\n9 7\n", "output": "19\n"}, {"input": "9 4 8\n6 13 5 1 12 1 1 2 2\n9 4\n8 4\n5 3\n9 5\n", "output": "21\n"}, {"input": "9 4 8\n6 13 5 1 12 1 2 2 2\n9 4\n8 4\n5 3\n9 5\n", "output": "22...
code_stdio
[ { "content": "You are given a matrix with $n$ rows (numbered from $1$ to $n$) and $m$ columns (numbered from $1$ to $m$). A number $a_{i, j}$ is written in the cell belonging to the $i$-th row and the $j$-th column, each number is either $0$ or $1$.\n\nA chip is initially in the cell $(1, 1)$, and it will be mo...
[{"input": "4\n2 2\n1 1\n0 1\n2 3\n1 1 0\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 0 0 0 0 0\n1 0 1 1 1 0 1\n2 5\n1 0 1 0 0\n1 1 1 1 0\n-1 1 1 0 0\n", "output": "0\n3\n5\n4\n"}, {"input": "4\n2 2\n1 1\n0 1\n2 3\n1 1 1\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 1 0 0 1 0\n1 0 1 0 1 0 1\n2 5\n1 0 1 0 0\n1 1 1 1 0\n-1 1 2 0 0\n", "output": "0...
code_stdio
[ { "content": "Salem gave you $n$ sticks with integer positive lengths $a_1, a_2, \\ldots, a_n$.\n\nFor every stick, you can change its length to any other positive integer length (that is, either shrink or stretch it). The cost of changing the stick's length from $a$ to $b$ is $|a - b|$, where $|x|$ means the a...
[{"input": "113\n86 67 31 33 72 100 88 63 16 12 79 80 76 45 31 96 44 10 24 33 53 11 56 100 23 57 9 48 28 73 18 48 12 89 73 9 51 11 82 94 90 92 34 99 54 58 33 67 35 87 58 90 94 64 57 80 87 99 84 99 20 1 63 12 16 40 50 95 33 58 7 23 71 89 53 15 95 29 71 16 65 21 66 89 82 30 6 45 6 66 58 32 27 78 28 42 8 61 10 26 7 55 76 ...
code_stdio
[ { "content": "Emergency Evacuation\n\nThe Japanese government plans to increase the number of inbound tourists to forty million in the year 2020, and sixty million in 2030. Not only increasing touristic appeal but also developing tourism infrastructure further is indispensable to accomplish such numbers.\n\nOne...
[{"input": "0 1 3\n1 1\n-2 18\n0 4\n3 -1\n1 3\n0 1\n2 0", "output": "20\n"}, {"input": "0 1 3\n0 1\n-2 35\n0 3\n5 -1\n1 2\n0 1\n5 0", "output": "37\n"}, {"input": "0 3 3\n1 1\n-2 18\n0 3\n5 -1\n1 2\n0 1\n5 0", "output": "18\n"}, {"input": "0 3 3\n1 1\n-2 18\n0 3\n5 -1\n1 3\n0 1\n5 0", "output": "18\n"}, {"input": "0 3 ...
code_stdio
[ { "content": "Polycarpus likes studying at school a lot and he is always diligent about his homework. Polycarpus has never had any problems with natural sciences as his great-great-grandfather was the great physicist Seinstein. On the other hand though, Polycarpus has never had an easy time with history.\n\nEve...
[{"input": "10\n58 22116\n112840 772160\n127432 399484\n182031 255417\n459340 548097\n603984 739189\n606173 663033\n280170 366159\n779239 906234\n874623 155443\n", "output": "7\n"}, {"input": "10\n58 22116\n112840 772160\n122094 399484\n182031 255417\n459340 548097\n603984 739189\n606173 663033\n280170 366159\n779239 9...
code_stdio
[ { "content": "#### Task:\n\nYour job here is to write a function (`keepOrder` in JS/CoffeeScript, `keep_order` in Ruby/Crystal/Python, `keeporder` in Julia), which takes a sorted array `ary` and a value `val`, and returns the lowest index where you could insert `val` to maintain the sorted-ness of the array. Th...
[{"input": "[1, 2, 3, 4, 7]\n5", "output": "[4]", "fn_name": "keep_order"}, {"input": "[1, 2, 3, 4, 7]\n0", "output": "[0]", "fn_name": "keep_order"}, {"input": "[1, 1, 2, 2, 2]\n2", "output": "[2]", "fn_name": "keep_order"}, {"input": "[1, 2, 3, 4]\n-1", "output": "[0]", "fn_name": "keep_order"}, {"input": "[1, 2, 3, ...
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": "100110\n", "output": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
code_stdio
[ { "content": "You are given three bags. Each bag contains a non-empty multiset of numbers. You can perform a number of operations on these bags. In one operation, you can choose any two non-empty bags, and choose one number from each of the bags. Let's say that you choose number $a$ from the first bag and numbe...
[{"input": "3 3 3\n1000 1000 1000\n1000 1000 1000\n1 1 -1\n", "output": "5999\n"}, {"input": "3 3 3\n1010 1000 1000\n1000 1000 1000\n1 1 -1\n", "output": "6009\n"}, {"input": "3 3 3\n1010 1000 1000\n1000 1100 1000\n1 1 -1\n", "output": "6109\n"}, {"input": "3 3 3\n1010 1000 1010\n1000 1100 1000\n1 1 -1\n", "output": "6...
code_stdio
[ { "content": "You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.\n\nWe will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vectors <image> and <image> is acute (i.e. strictly less t...
[{"input": "11\n358 -724 -232 53 -520\n486 -554 -328 53 -220\n358 -554 -232 -372 -520\n358 -554 -232 308 -520\n868 -554 448 53 -520\n478 -554 -322 53 -600\n358 296 -232 53 -520\n256 -554 -368 53 -520\n230 -554 -136 53 -820\n-182 -554 173 53 -160\n358 -554 -232 53 -520\n", "output": "1\n11\n"}, {"input": "11\n358 -724 -...
code_stdio
[ { "content": "Your task is to make function, which returns the sum of a sequence of integers.\n\nThe sequence is defined by 3 non-negative values: **begin**, **end**, **step**.\n\nIf **begin** value is greater than the **end**, function should returns **0**\n\n*Examples*\n\n~~~if-not:nasm\n\n~~~\n\nThis is the ...
[{"input": "2\n24\n22", "output": "[26]", "fn_name": "sequence_sum"}, {"input": "0\n15\n3", "output": "[45]", "fn_name": "sequence_sum"}, {"input": "16\n15\n3", "output": "[0]", "fn_name": "sequence_sum"}, {"input": "1\n15\n3", "output": "[35]", "fn_name": "sequence_sum"}, {"input": "2\n6\n2", "output": "[12]", "fn_nam...
code_functional
[ { "content": "Innokentiy decides to change the password in the social net \"Contact!\", but he is too lazy to invent a new password by himself. That is why he needs your help. \n\nInnokentiy decides that new password should satisfy the following conditions: the length of the password must be equal to n, the p...
[{"input": "114 14\n", "output": "abcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmnab"}, {"input": "113 3\n", "output": "abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcab"}, {"input": "113 5\n"...
code_stdio
[ { "content": "A Pythagorean triple is a triple of integer numbers $(a, b, c)$ such that it is possible to form a right triangle with the lengths of the first cathetus, the second cathetus and the hypotenuse equal to $a$, $b$ and $c$, respectively. An example of the Pythagorean triple is $(3, 4, 5)$.\n\nVasya st...
[{"input": "3\n2131\n21165\n6666\n", "output": "32\n102\n57\n"}, {"input": "3\n2131\n21165\n6666\n", "output": "32\n102\n57\n"}, {"input": "3\n2131\n38301\n6666\n", "output": "32\n137\n57\n"}, {"input": "3\n1625\n38301\n6666\n", "output": "28\n137\n57\n"}, {"input": "3\n2570\n38301\n6666\n", "output": "35\n137\n57\n"},...
code_stdio
[ { "content": "A thief sneaked into a museum with a lot of treasures with only one large furoshiki. There are many things I want to steal, but the weight that the furoshiki can withstand is limited, and if it exceeds this, the furoshiki will tear. Therefore, the thief must consider a combination of treasures tha...
[{"input": "50\n5\n60,10\n100,10\n03,022\n210,45\n10,4\n162\n5\n60,10\n100,20\n120,30\n210,45\n10,4\n0", "output": "Case 1:\n220\n49\nCase 2:\n500\n109\n"}, {"input": "50\n5\n60,20\n100,20\n03,021\n210,45\n10,4\n143\n5\n60,10\n100,20\n120,30\n200,45\n10,4\n0", "output": "Case 1:\n220\n49\nCase 2:\n490\n109\n"}, {"input...
code_stdio
[ { "content": "## Emotional Sort ( ︶︿︶)\n\nYou'll have a function called \"**sortEmotions**\" that will return an array of **emotions** sorted. It has two parameters, the first parameter called \"**arr**\" will expect an array of **emotions** where an **emotion** will be one of the following:\n\n- **:D** -> Supe...
[{"input": "[\":)\", \"T_T\", \":)\", \":D\", \":D\"]\nfalse", "output": "[[\"T_T\", \":)\", \":)\", \":D\", \":D\"]]", "fn_name": "sort_emotions"}, {"input": "[\":)\", \"T_T\", \":)\", \":D\", \":D\"]\ntrue", "output": "[[\":D\", \":D\", \":)\", \":)\", \"T_T\"]]", "fn_name": "sort_emotions"}, {"input": "[\":D\", \"T_...
code_functional
[ { "content": "Kaavi, the mysterious fortune teller, deeply believes that one's fate is inevitable and unavoidable. Of course, she makes her living by predicting others' future. While doing divination, Kaavi believes that magic spells can provide great power for her to see the future. \n\n<image>\n\nKaavi has a ...
[{"input": "babbaaababbbbabbaaaababbbaabababbaabbaababbaaabaabbabaabbaababababbaabaaabaaaaababbaabaaaaabaabbabaaababbbb\nbbaabbbbabbbbaaaaaababbbabaaabbbbabababbbaabbbbbabaababbaabaaabaabbababababaaaaabaabbabaaabaaaaaaaaaaaaabbb\n", "output": "284471294"}, {"input": "bbbbabaaababbaabaaaaabaabbabaaaaabaaabaabbabababaabb...
code_stdio
[ { "content": "Kolya is going to make fresh orange juice. He has n oranges of sizes a_1, a_2, ..., a_{n}. Kolya will put them in the juicer in the fixed order, starting with orange of size a_1, then orange of size a_2 and so on. To be put in the juicer the orange must have size not exceeding b, so if Kolya sees ...
[{"input": "100 1000 1083\n992 616 818 359 609 783 263 989 501 929 362 394 919 1081 870 830 1097 975 62 346 531 367 323 457 707 360 949 334 867 116 478 417 961 963 1029 114 867 1008 988 916 983 1077 959 1322 572 961 579 318 721 337 488 717 111 70 416 685 987 130 353 107 61 191 827 849 106 815 211 953 111 398 889 860 80...
code_stdio
[ { "content": "Vasya studies divisibility rules at school. Here are some of them:\n\n * Divisibility by 2. A number is divisible by 2 if and only if its last digit is divisible by 2 or in other words, is even.\n * Divisibility by 3. A number is divisible by 3 if and only if the sum of its digits is divisible b...
[{"input": "30 100\n", "output": "2-type\n2\n"}, {"input": "10 100\n", "output": "2-type\n2\n"}, {"input": "10 25\n", "output": "2-type\n2\n"}, {"input": "70 14\n", "output": "2-type\n1\n"}, {"input": "10 16\n", "output": "2-type\n4\n"}, {"input": "91 49\n", "output": "2-type\n2\n"}, {"input": "10 40\n", "output": "2-t...
code_stdio
[ { "content": "You are standing on the $\\mathit{OX}$-axis at point $0$ and you want to move to an integer point $x > 0$.\n\nYou can make several jumps. Suppose you're currently at point $y$ ($y$ may be negative) and jump for the $k$-th time. You can:\n\neither jump to the point $y + k$\n\nor jump to the point $...
[{"input": "12\n1\n2\n3\n4\n5\n1\n2\n3\n4\n5\n1\n2\n", "output": "1\n3\n2\n3\n4\n1\n3\n2\n3\n4\n1\n3\n"}, {"input": "12\n1\n2\n3\n4\n5\n1\n2\n3\n4\n5\n1\n2\n", "output": "1\n3\n2\n3\n4\n1\n3\n2\n3\n4\n1\n3\n"}, {"input": "12\n1\n2\n3\n4\n5\n2\n2\n3\n4\n5\n1\n2\n", "output": "1\n3\n2\n3\n4\n3\n3\n2\n3\n4\n1\n3\n"}, {"in...
code_stdio
[ { "content": "Two famous competing companies ChemForces and TopChemist decided to show their sets of recently discovered chemical elements on an exhibition. However they know that no element should be present in the sets of both companies.\n\nIn order to avoid this representatives of both companies decided to m...
[{"input": "10\n598654597 975579682\n117777072 31932499\n223851456 1477480177\n988262691 654502493\n967529230 543358150\n835120075 101574205\n809901567 613170206\n152157661 479980560\n859252956 158469817\n614959273 735298093\n10\n1156316033 361325206\n341655282 740807372\n239996693 809030434\n813199219 765838311\n12755...
code_stdio
[ { "content": "Given is an undirected graph G consisting of N vertices numbered 1 through N and M edges numbered 1 through M.\nEdge i connects Vertex a_i and Vertex b_i bidirectionally.\nG is said to be a good graph when both of the conditions below are satisfied. It is guaranteed that G is initially a good grap...
[{"input": "3\n3 0\n6 2\n1 2\n2 3\n15 10\n12 14\n8 3\n10 1\n14 6\n12 6\n1 9\n13 1\n2 5\n3 9\n7 2\n", "output": "First\nSecond\nFirst\n"}, {"input": "1\n100000 0\n", "output": "First\n"}]
code_stdio
[ { "content": "Ivan has a robot which is situated on an infinite grid. Initially the robot is standing in the starting cell (0, 0). The robot can process commands. There are four types of commands it can perform: U — move from the cell (x, y) to (x, y + 1); D — move from (x, y) to (x, y - 1); L — move from (x...
[{"input": "100\nUDRLRRLLRRLRRRDDLLDDDLULLDDLURUURUULUDDDRDDLLRDLLUURLRDRLRRLRLLLULDUDDUURRLRDULDRDURRRRRRULDRRDLDRRL\n", "output": "88\n"}, {"input": "100\nUDRLRRLLRRLRRRDDLLDDDLULLDDLURUURUULUDDDRDDLLRDLLUURLRDRLRRLRLLLULDUDDUURRLRDULDRDURRRRRRULDRRDLDRRL\n", "output": "88\n"}, {"input": "100\nLRRDLDRRDLURRRRRRUDRDLU...
code_stdio
[ { "content": "In this problem, a $n \\times m$ rectangular matrix $a$ is called increasing if, for each row of $i$, when go from left to right, the values strictly increase (that is, $a_{i,1}<a_{i,2}<\\dots<a_{i,m}$) and for each column $j$, when go from top to bottom, the values strictly increase (that is, $a_...
[{"input": "10 4\n4 9 11 12\n8 11 13 18\n13 16 18 21\n15 21 0 24\n17 0 21 29\n21 26 0 33\n26 31 33 35\n30 32 35 37\n33 37 40 43\n34 41 46 51\n", "output": "-1\n"}, {"input": "10 4\n4 9 11 12\n8 11 13 18\n13 16 18 21\n15 21 0 24\n17 0 21 29\n21 26 0 33\n26 31 33 35\n30 32 35 37\n33 37 40 43\n34 41 46 51\n", "output": "-...
code_stdio
[ { "content": "Iahub is a big fan of tourists. He wants to become a tourist himself, so he planned a trip. There are n destinations on a straight road that Iahub wants to visit. Iahub starts the excursion from kilometer 0. The n destinations are described by a non-negative integers sequence a_1, a_2, ..., a_{n}....
[{"input": "50\n3987477 8934938 4067156 6712855 7269334 5039822 9533601 9335400 5992073 2619268 438734 8620973 4347619 4307947 2249161 815221 7615258 8244100 8341666 5908546 6646952 4812769 6215114 7479369 6290438 5623785 6466133 9953199 3525873 4326034 3510072 8117068 2342953 1717542 9766539 651627 9541804 4518782 704...
code_stdio
[ { "content": "Farmer Feb has three fields with potatoes planted in them. He harvested x potatoes from the first field, y potatoes from the second field and is yet to harvest potatoes from the third field. Feb is very superstitious and believes that if the sum of potatoes he harvests from the three fields is a p...
[{"input": "2\n3 20\n27 15", "output": "6\n1\n"}, {"input": "2\n3 20\n63 22", "output": "6\n4\n"}, {"input": "2\n3 20\n58 22", "output": "6\n3\n"}, {"input": "2\n5 19\n58 22", "output": "5\n3\n"}, {"input": "2\n2 1\n11 12", "output": "2\n6\n"}, {"input": "2\n2 6\n14 10", "output": "3\n5\n"}, {"input": "2\n24 7\n3 18", ...
code_stdio
[ { "content": "Pupils decided to go to amusement park. Some of them were with parents. In total, n people came to the park and they all want to get to the most extreme attraction and roll on it exactly once.\n\nTickets for group of x people are sold on the attraction, there should be at least one adult in each g...
[{"input": "100 1000 1000\n0000010100101100110100101111001111111111100101111100111011110001011110110111111010000000101000111000\n", "output": "100000\n"}, {"input": "100 1000 1000\n0000010100101100110100101111001111111111100101111100111011110001011110110111111010000000101000111000\n", "output": "100000\n"}, {"input": "...
code_stdio
[ { "content": "You have array a that contains all integers from 1 to n twice. You can arbitrary permute any numbers in a.\n\nLet number i be in positions x_{i}, y_{i} (x_{i} < y_{i}) in the permuted array a. Let's define the value d_{i} = y_{i} - x_{i} — the distance between the positions of the number i. Permut...
[{"input": "1376\n", "output": "1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 101 103 105 107 109 111 113 115 117 119 121 123 125 127 129 131 133 135 137 139 141 143 145 147 149 151 153 155 157 159 161 163 165 167 169 171...
code_stdio
[ { "content": "Create a function\n\n```python\nhas_two_cube_sums(n)\n```\n\nwhich checks if a given number `n` can be written as the sum of two cubes in two different ways: `n = a³+b³ = c³+d³`.\nAll the numbers `a`, `b`, `c` and `d` should be different and greater than `0`.\n\nE.g. 1729 = 9³+10³ = 1³+12³.\n\n```...
[{"input": "46163", "output": "[false]", "fn_name": "has_two_cube_sums"}, {"input": "4103", "output": "[false]", "fn_name": "has_two_cube_sums"}, {"input": "4102", "output": "[false]", "fn_name": "has_two_cube_sums"}, {"input": "4105", "output": "[false]", "fn_name": "has_two_cube_sums"}, {"input": "4106", "output": "[...
code_functional
[ { "content": "You have an array of numbers. \nYour task is to sort ascending odd numbers but even numbers must be on their places.\n\nZero isn't an odd number and you don't need to move it. If you have an empty array, you need to return it.\n\n*Example*\n```python\nsort_array([5, 3, 2, 8, 1, 4]) == [1, 3, 2, 8...
[{"input": "[1, 2, 3, 4, 5, 6, 7, 8, 9, 0]", "output": "[[1, 2, 3, 4, 5, 6, 7, 8, 9, 0]]", "fn_name": "sort_array"}, {"input": "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]", "output": "[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]", "fn_name": "sort_array"}, {"input": "[0, 1, 2, 3, 4, 9, 8, 7, 6, 5]", "output": "[[0, 1, 2, 3, 4, 5, 8, 7, 6, 9]]...
code_functional
[ { "content": "Chilly Willy loves playing with numbers. He only knows prime numbers that are digits yet. These numbers are 2, 3, 5 and 7. But Willy grew rather bored of such numbers, so he came up with a few games that were connected with them.\n\nChilly Willy wants to find the minimum number of length n, such t...
[{"input": "99993\n", "output": "10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
code_stdio
[ { "content": "Your task is simply to count the total number of lowercase letters in a string.\n\n## Examples\n\nWrite Python code to solve this problem. Define a top-level function named `lowercase_count` that takes the input arguments described above and returns the answer directly -- do not read from stdin or...
[{"input": "\"abcABC123!@#$%^&*()_-+=}{[]|':;?/>.<,~\"", "output": "[3]", "fn_name": "lowercase_count"}, {"input": "\"ABC123!@#$%^&*()_-+=}{[]|':;?/>.<,~\"", "output": "[0]", "fn_name": "lowercase_count"}, {"input": "\"abcdefghijklmnopqrstuvwxyz\"", "output": "[26]", "fn_name": "lowercase_count"}, {"input": "\"abcABC12...
code_functional
[ { "content": "You are given two integers a and b. Determine if a+b=15 or a\\times b=15 or neither holds.\n\nNote that a+b=15 and a\\times b=15 do not hold at the same time.\n\nConstraints\n\n* 1 \\leq a,b \\leq 15\n* All values in input are integers.\n\nInput\n\nInput is given from Standard Input in the followi...
[{"input": "-3 -5", "output": "*\n"}, {"input": "11 -1", "output": "x\n"}, {"input": "15 -1", "output": "x\n"}, {"input": "29 -1", "output": "x\n"}, {"input": "13 -1", "output": "x\n"}, {"input": "17 -1", "output": "x\n"}, {"input": "16 -1", "output": "+\n"}, {"input": "16 -2", "output": "x\n"}, {"input": "-1 -3", "out...
code_stdio
[ { "content": "Three people, A, B and C, are trying to communicate using transceivers.\nThey are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively.\nTwo people can directly communicate when the distance between them is at most d meters.\nDetermine if A and C...
[{"input": "-1 000 -1 15", "output": "Yes\n"}, {"input": "-1 100 -1 15", "output": "Yes\n"}, {"input": "-1 100 -1 12", "output": "Yes\n"}, {"input": "-1 100 -1 13", "output": "Yes\n"}, {"input": "-1 100 -1 24", "output": "Yes\n"}, {"input": "-1 100 -2 24", "output": "Yes\n"}, {"input": "-2 011 -1 24", "output": "Yes\n"...
code_stdio
[ { "content": "Petya is the most responsible worker in the Research Institute. So he was asked to make a very important experiment: to melt the chocolate bar with a new laser device. The device consists of a rectangular field of n × m cells and a robotic arm. Each cell of the field is a 1 × 1 square. The robotic...
[{"input": "20\n100 200 100 1 100 100\n100 200 1 100 100 100\n2 2 1 1 2 2\n100 100 50 50 1 1\n10 10 5 5 1 1\n100 100 99 1 1 99\n100 100 1 99 99 1\n100 100 1 10 10 1\n100 100 1 1 10 10\n9 6 1 3 3 1\n1000000000 1000000000 1 1 1000000000 1000000000\n9 4 1 4 4 1\n6 4 1 1 5 4\n6 2 1 1 5 2\n8 2 1 1 5 2\n10 2 1 1 5 2\n10 2 1 ...
code_stdio
[ { "content": "Valera the Horse is going to the party with friends. He has been following the fashion trends for a while, and he knows that it is very popular to wear all horseshoes of different color. Valera has got four horseshoes left from the last year, but maybe some of them have the same color. In this cas...
[{"input": "133315691 1002877005 1237779669 265159773\n", "output": "0\n"}, {"input": "133315691 1002877005 1237779669 207655879\n", "output": "0\n"}, {"input": "111229995 1002877005 1237779669 207655879\n", "output": "0\n"}, {"input": "133315691 265159773 1237779669 265159773\n", "output": "1\n"}, {"input": "391958720...
code_stdio
[ { "content": "Implement the function unique_in_order which takes as argument a sequence and returns a list of items without any elements with the same value next to each other and preserving the original order of elements.\n\nFor example:\n\n```python\nunique_in_order('AAAABBBCCDAABBB') == ['A', 'B', 'C', 'D', ...
[{"input": "\"AAAABBBCCDAABBB\"", "output": "[[\"A\", \"B\", \"C\", \"D\", \"A\", \"B\"]]", "fn_name": "unique_in_order"}, {"input": "\"ABBCcAD\"", "output": "[[\"A\", \"B\", \"C\", \"c\", \"A\", \"D\"]]", "fn_name": "unique_in_order"}, {"input": "[\"a\", \"b\", \"b\"]", "output": "[[\"a\", \"b\"]]", "fn_name": "unique...
code_functional
[ { "content": "Takahashi will do a tap dance. The dance is described by a string S where each character is L, R, U, or D. These characters indicate the positions on which Takahashi should step. He will follow these instructions one by one in order, starting with the first character.\nS is said to be easily playa...
[{"input": "UUULRUUDRURLDDRLRLRURLUDRLUURDDUULRUULRDRDULUUDLRLRUDLUDRLULULRUDURURDRLUURLULRUULDURDUUUDULRDRLRLDL\n", "output": "Yes\n"}, {"input": "UDUDRDDLRDDDRUDURUULULDUUURLDLDLRURLDDRDDDRUUDRUUDDDDUUURLDLULUDRUDDDUULDDLURDRDRUUURLUDUUDLRUUDULRD\n", "output": "No\n"}, {"input": "UUULRULUUDDLDDULRDRDDDRLDLULRDDLDLRUR...
code_stdio
[ { "content": "Example\n\nInput\n\n8\n-10 0\n-10 5\n-5 5\n-5 0\n10 0\n10 -5\n5 -5\n5 0\n\n\nOutput\n\n50\n\nWrite Python code to solve this problem. Your program should read the input from stdin and write the output to stdout. Enclose your complete solution in a single ```python code block.", "role": "user" ...
[{"input": "8\n-18 1\n-10 2\n-10 8\n-27 -1\n11 0\n22 -5\n4 -8\n5 0", "output": "137\n"}, {"input": "8\n-18 1\n-10 2\n-10 8\n-27 -1\n11 0\n22 -7\n4 -8\n5 0", "output": "144\n"}, {"input": "8\n-18 1\n-10 2\n-10 8\n-7 -1\n11 0\n22 -14\n4 -8\n5 0", "output": "155\n"}, {"input": "8\n-1 0\n-10 10\n-4 8\n-5 -1\n19 0\n10 -5\n7...
code_stdio
[ { "content": "problem\n\nThere are n cards with one integer from 1 to n and one blank card. Of these n + 1 cards, k cards are given, but 1 ≤ k ≤ n. You can write one integer from 1 to n on a blank card. I want to make a continuous sequence of integers as long as possible with just a given card.\n\nWrite a progr...
[{"input": "14 5\n6\n2\n4\n10\n1\n15 5\n5\n2\n0\n4\n7\n0 0", "output": "2\n4\n"}, {"input": "33 5\n5\n0\n4\n7\n0\n20 5\n10\n3\n2\n4\n7\n0 0", "output": "4\n3\n"}, {"input": "14 5\n6\n0\n4\n14\n1\n8 5\n5\n2\n0\n0\n7\n0 0", "output": "3\n3\n"}, {"input": "33 5\n5\n3\n4\n7\n0\n10 5\n5\n2\n1\n4\n7\n0 0", "output": "5\n2\n"...
code_stdio
[ { "content": "$N$ sages are sitting around a round table with $N$ seats. Each sage holds chopsticks with his dominant hand to eat his dinner. The following happens in this situation.\n\n* If sage $i$ is right-handed and a left-handed sage sits on his right, a level of frustration $w_i$ occurs to him. A right-ha...
[{"input": "5\n1 1 0 1 0\n1 3 1 -2 4", "output": "-1\n"}, {"input": "5\n1 1 0 1 0\n1 3 1 -1 4", "output": "0\n"}, {"input": "5\n1 1 0 0 2\n1 3 0 2 13", "output": "1\n"}, {"input": "5\n1 0 0 1 0\n2 3 6 1 2", "output": "3\n"}, {"input": "5\n1 1 0 1 0\n4 3 5 1 4", "output": "5\n"}, {"input": "5\n1 1 0 1 0\n4 3 0 1 4", "ou...
code_stdio
[ { "content": "It's New Year's Eve soon, so Ivan decided it's high time he started setting the table. Ivan has bought two cakes and cut them into pieces: the first cake has been cut into a pieces, and the second one — into b pieces.\n\nIvan knows that there will be n people at the celebration (including himself)...
[{"input": "100 100 100\n", "output": "2\n"}, {"input": "100 100 100\n", "output": "2\n"}, {"input": "100 100 10\n", "output": "1\n"}, {"input": "17 100 79\n", "output": "10\n"}, {"input": "17 100 79\n", "output": "10\n"}, {"input": "100 100 10\n", "output": "1\n"}, {"input": "5 122 100\n", "output": "40\n"}, {"input":...
code_stdio
[ { "content": "Sereja has got an array, consisting of n integers, a_1, a_2, ..., a_{n}. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: Make v_{i}-th array element equal to x_{i}. In other words, perform the assignment a_{v}_{i} = x_{i}. In...
[{"input": "6 6\n202714501 613423725 367325359 862808465 196327629 745008828\n2 492\n2 1943\n1 3 173984392\n1 5 17007494\n3 4\n1 5 472683539\n", "output": "862810900\n\n"}, {"input": "6 6\n202714501 613423725 367325359 862808465 196327629 745008828\n2 492\n2 1943\n1 3 173984392\n1 5 17007494\n3 4\n1 5 650027606\n", "ou...
code_stdio
[ { "content": "You are given a permutation of the numbers 1, 2, ..., n and m pairs of positions (a_{j}, b_{j}).\n\nAt each step you can choose a pair from the given positions and swap the numbers in that positions. What is the lexicographically maximal permutation one can get?\n\nLet p and q be two permutations ...
[{"input": "83 8\n54 3 52 12 61 36 65 62 69 49 47 77 31 15 21 14 73 29 6 26 37 17 81 75 43 30 58 76 16 8 11 5 27 35 7 66 50 67 2 39 45 28 60 71 38 82 53 1 42 13 44 72 22 4 9 25 19 57 10 70 18 68 32 34 20 80 23 79 24 63 64 51 59 41 74 48 40 33 46 83 55 56 78\n48 80\n1 8\n71 54\n15 59\n72 46\n36 9\n64 29\n55 58\n", "outp...
code_stdio
[ { "content": "Stepan is a very experienced olympiad participant. He has n cups for Physics olympiads and m cups for Informatics olympiads. Each cup is characterized by two parameters — its significance c_{i} and width w_{i}.\n\nStepan decided to expose some of his cups on a shelf with width d in such a way, tha...
[{"input": "20 10 761\n66 41\n47 7\n35 6\n22 40\n15 2\n47 28\n46 47\n3 45\n12 19\n44 41\n46 2\n49 23\n9 8\n7 41\n5 3\n16 42\n12 50\n17 22\n25 9\n45 12\n56 44\n34 47\n33 35\n32 47\n119 6\n27 18\n43 36\n23 6\n39 22\n38 45\n", "output": "1009\n"}, {"input": "20 10 761\n66 41\n47 7\n35 6\n22 40\n15 2\n47 28\n46 47\n3 45\n1...
code_stdio
[ { "content": "There are N strings arranged in a row. It is known that, for any two adjacent strings, the string to the left is lexicographically smaller than the string to the right. That is, S_1<S_2<...<S_N holds lexicographically, where S_i is the i-th string from the left.\n\nAt least how many different char...
[{"input": "5\n11 1 2 2 2", "output": "3"}, {"input": "5\n14 1 2 2 2", "output": "3"}, {"input": "5\n28 1 2 2 2", "output": "3"}, {"input": "5\n3 1 2 1 13", "output": "3"}, {"input": "5\n11 1 2 2 1", "output": "3"}, {"input": "5\n14 1 2 2 3", "output": "2"}, {"input": "5\n23 1 2 2 2", "output": "3"}, {"input": "5\n2 1 ...
code_stdio
[ { "content": "An accordion is a string (yes, in the real world accordions are musical instruments, but let's forget about it for a while) which can be represented as a concatenation of: an opening bracket (ASCII code $091$), a colon (ASCII code $058$), some (possibly zero) vertical line characters (ASCII code $...
[{"input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[\n", "output": "-1\n"}, {"input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
code_stdio
[ { "content": "Someone give a strange birthday present to Ivan. It is hedgehog — connected undirected graph in which one vertex has degree at least 3 (we will call it center) and all other vertices has degree 1. Ivan thought that hedgehog is too boring and decided to make himself k-multihedgehog.\n\nLet us defin...
[{"input": "33 2\n3 13\n17 3\n2 6\n5 33\n4 18\n1 2\n31 5\n4 19\n3 16\n1 3\n9 2\n10 3\n5 1\n5 28\n21 4\n7 2\n1 4\n5 24\n30 5\n14 3\n3 11\n27 5\n8 2\n22 4\n12 3\n20 4\n26 5\n4 23\n32 5\n25 5\n15 3\n29 5\n", "output": "Yes\n"}, {"input": "25 2\n1 2\n1 3\n1 4\n2 5\n2 6\n2 7\n3 8\n3 9\n3 10\n4 11\n4 12\n4 13\n4 14\n14 15\n1...
code_stdio
[ { "content": "Santa Claus has Robot which lives on the infinite grid and can move along its lines. He can also, having a sequence of m points p_1, p_2, ..., p_{m} with integer coordinates, do the following: denote its initial location by p_0. First, the robot will move from p_0 to p_1 along one of the shortest ...
[{"input": "26\nRURULRRURUDLULDLDLDURLRDDL\n", "output": "10\n"}, {"input": "26\nRURULRRLRUDUULLLDLDURDRDLD\n", "output": "11\n"}, {"input": "26\nLDDRLRUDLDLDLULDURURRLURUR\n", "output": "10\n"}, {"input": "26\nLDDRLRLDLDLDLUUDURURRLURUR\n", "output": "10\n"}, {"input": "26\nRURULRRURUDUULDLDLDLRLRDDL\n", "output": "10...
code_stdio
[ { "content": "The only difference between easy and hard versions is the maximum value of $n$.\n\nYou are given a positive integer number $n$. You really love good numbers so you want to find the smallest good number greater than or equal to $n$.\n\nThe positive integer is called good if it can be represented as...
[{"input": "100\n1\n2\n3\n4\n5\n6\n7\n8\n14\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n43\n44\n45\n46\n47\n48\n49\n50\n51\n52\n53\n54\n55\n56\n57\n58\n59\n60\n61\n62\n63\n64\n65\n66\n67\n68\n69\n70\n71\n72\n73\n74\n75\n76\n77\n78\...
code_stdio
[ { "content": "Given a matrix (H × W) which contains only 1 and 0, find the area of the largest rectangle which only contains 0s.\n\nConstraints\n\n* 1 ≤ H, W ≤ 1,400\n\nInput\n\n\nH W\nc1,1 c1,2 ... c1,W\nc2,1 c2,2 ... c2,W\n:\ncH,1 cH,2 ... cH,W\n\n\nIn the first line, two integers H and W separated by a space...
[{"input": "1 5\n1 0 1 0 0\n2 0 -1 -1 0\n0 -1 0 -1 0\n0 0 0 1 0", "output": "2\n"}, {"input": "1 3\n1 1 1 0 0\n2 0 -1 0 1\n1 -1 0 0 0\n-1 0 1 2 -1", "output": "0\n"}, {"input": "1 5\n0 0 0 0 0\n2 0 -1 -1 0\n0 0 0 0 0\n0 2 1 1 -1", "output": "5\n"}, {"input": "1 5\n1 0 1 0 0\n2 0 -1 -1 0\n0 -1 0 0 0\n0 0 0 1 0", "output...
code_stdio
[ { "content": "Little Elephant from the Zoo of Lviv likes cards. He has N cards, each of which has one of 1000 colors. The colors are numbered from 1 to 1000.\nLittle Elephant and Big Hippo are playing the following game. At first Little Elephant takes some subset of cards, and Big Hippo takes the rest of them. ...
[{"input": "2\n15\n-1 1 7\n35\n-1 -3 8 8", "output": "16384\n179869065\n"}, {"input": "2\n15\n-1 1 7\n38\n-1 -3 8 8", "output": "16384\n766320739\n"}, {"input": "2\n15\n-1 1 7\n47\n-1 -3 8 8", "output": "16384\n743685088\n"}, {"input": "2\n25\n0 -1 1\n15\n2 -1 -1 3", "output": "16777216\n16384\n"}, {"input": "2\n12\n-1...
code_stdio
[ { "content": "An expedition group flew from planet ACM-1 to Earth in order to study the bipedal species (its representatives don't even have antennas on their heads!).\n\nThe flying saucer, on which the brave pioneers set off, consists of three sections. These sections are connected by a chain: the 1-st section...
[{"input": "602799218 494169337\n", "output": "105935725\n"}, {"input": "523061914 144515354\n", "output": "127493116\n"}, {"input": "622152471 448257864\n", "output": "210299666\n"}, {"input": "549662082 945236243\n", "output": "239869294\n"}, {"input": "868095112 994962872\n", "output": "606909752\n"}, {"input": "296...
code_stdio
[ { "content": "A telephone number is a sequence of exactly 11 digits, where the first digit is 8. For example, the sequence 80011223388 is a telephone number, but the sequences 70011223388 and 80000011223388 are not.\n\nYou are given a string $s$ of length $n$, consisting of digits.\n\nIn one operation you can d...
[{"input": "2\n13\n7818005553535\n11\n31415926535\n", "output": "YES\nNO\n"}, {"input": "2\n13\n14222439333841\n11\n31415926535\n", "output": "NO\nNO\n"}, {"input": "2\n13\n3872943379171\n11\n45489461254\n", "output": "YES\nNO\n"}, {"input": "2\n13\n14222439333841\n11\n45489461254\n", "output": "NO\nNO\n"}, {"input": "...
code_stdio
[ { "content": "You are an upcoming movie director, and you have just released your first movie. You have also launched a simple review site with two buttons to press — upvote and downvote.\n\nHowever, the site is not so simple on the inside. There are two servers, each with its separate counts for the upvotes an...
[{"input": "9\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n", "output": "1\n1\n1\n1\n1\n1\n1\n1\n1\n"}, {"input": "9\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n", "output": "1\n1\n1\n1\n1\n1\n1\n1\n1\n"}, {"input": "9\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n2\n1\n1\n1\n1\n", "output": "1\n1\n1\n1\...
code_stdio
[ { "content": "Vasya plays the Need For Brake. He plays because he was presented with a new computer wheel for birthday! Now he is sure that he will win the first place in the championship in his favourite racing computer game! \n\nn racers take part in the championship, which consists of a number of races. Afte...
[{"input": "20\ng 1000000\nibb 1000000\nidj 1000000\nkccg 1000000\nbbe 1000000\nhjf 1000000\na 1000000\nf 1000000\niij 1000000\nakgf 1000000\nkdkhj 1000000\ne 1000000\nh 1000000\nhb 1000000\nfaie 1000000\nj 1000000\ni 1000000\nhgg 1000000\nfi 1000000\nicf 1000000\n12\n1000000 1000000 1000000 1000000 1000000 1000000 100...
code_stdio
[ { "content": "A positive integer is called a 2-3-integer, if it is equal to 2^{x}·3^{y} for some non-negative integers x and y. In other words, these integers are such integers that only have 2 and 3 among their prime divisors. For example, integers 1, 6, 9, 16 and 108 — are 2-3 integers, while 5, 10, 21 and 12...
[{"input": "1088391168 1934917632\n", "output": "17\n"}, {"input": "1088391167 1934917632\n", "output": "17\n"}, {"input": "1088391169 1934917632\n", "output": "16\n"}, {"input": "1088391168 1934917631\n", "output": "16\n"}, {"input": "1088391168 1934917633\n", "output": "17\n"}, {"input": "1088391167 1934917632\n", "o...
code_stdio
[ { "content": "You are given a permutation $p$ of $n$ integers $1$, $2$, ..., $n$ (a permutation is an array where each element from $1$ to $n$ occurs exactly once).\n\nLet's call some subsegment $p[l, r]$ of this permutation special if $p_l + p_r = \\max \\limits_{i = l}^{r} p_i$. Please calculate the number of...
[{"input": "5\n3 4 1 5 2\n", "output": "2\n"}, {"input": "5\n4 5 1 3 2\n", "output": "2\n"}, {"input": "5\n5 4 1 3 2\n", "output": "1\n"}, {"input": "5\n3 4 2 5 1\n", "output": "1\n"}, {"input": "5\n3 4 1 5 2\n", "output": "2"}, {"input": "3\n1 3 2\n", "output": "1\n"}, {"input": "3\n2 3 1\n", "output": "1\n"}, {"input...
code_stdio
[ { "content": "# Fourier transformations are hard. Fouriest transformations are harder.\n\nThis Kata is based on the SMBC Comic on fourier transformations.\n\nA fourier transformation on a number is one that converts the number to a base in which it has more `4`s ( `10` in base `6` is `14`, which has `1` four as...
[{"input": "2579111107964987025047536361483312385374008248282655401675211033926782006920415224913494809688581314878892733564", "output": "[\"2579111107964987025047536361483312385374008248282655401675211033926782006920415224913494809688581314878892733564 is the fouriest (4444444444444444444444444444444444444444444444) i...
code_functional
[ { "content": "There is a tree with N vertices, numbered 1, 2, \\ldots, N. For each i (1 \\leq i \\leq N - 1), the i-th edge connects Vertex x_i and y_i.\n\nTaro has decided to paint each vertex in white or black, so that any black vertex can be reached from any other black vertex by passing through only black v...
[{"input": "10 2\n8 5\n10 8\n6 5\n1 5\n4 8\n2 10\n3 6\n9 4\n1 7", "output": "0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n"}, {"input": "10 2\n8 5\n10 8\n6 5\n1 5\n4 8\n2 10\n3 6\n9 2\n1 7", "output": "0\n0\n1\n1\n1\n0\n1\n0\n1\n1"}, {"input": "4 101\n1 2\n1 3\n1 4", "output": "8\n5\n5\n5\n"}, {"input": "4 101\n1 2\n1 3\n2 4", "outpu...
code_stdio
[ { "content": "Taro came to a square to look for treasure. There are many treasures buried in this square, but Taro has the latest machines, so he knows everything about where the treasures are buried. Since the square is very wide Taro decided to look for the treasure to decide the area, but the treasure is wha...
[{"input": "5 5\n10 7\n-3 -8\n2 11\n6 0\n-1 3\n-3 1 3 13\n-1 -1 9 5\n-3 -16 10 11\n-1 0 5 4\n-1 -13 15 10", "output": "2\n2\n5\n1\n3\n"}, {"input": "5 5\n10 7\n-3 -8\n2 11\n10 0\n-1 3\n-3 1 3 13\n-1 -1 9 5\n-3 -16 12 11\n0 0 5 4\n-1 -13 15 10", "output": "2\n1\n5\n0\n3\n"}, {"input": "5 5\n10 7\n-3 -8\n2 11\n0 0\n-1 3\...
code_stdio
[ { "content": "Passer ratings are the generally accepted standard for evaluating NFL quarterbacks.\nI knew a rating of 100 is pretty good, but never knew what makes up the rating.\nSo out of curiosity I took a look at the wikipedia page and had an idea or my first kata: https://en.wikipedia.org/wiki/Passer_ratin...
[{"input": "432\n3554\n291\n28\n2", "output": "[112.2]", "fn_name": "passer_rating"}, {"input": "48\n192\n19\n2\n3", "output": "[39.6]", "fn_name": "passer_rating"}, {"input": "34\n172\n20\n1\n1", "output": "[69.7]", "fn_name": "passer_rating"}, {"input": "5\n76\n4\n1\n0", "output": "[158.3]", "fn_name": "passer_rating...
code_functional
[ { "content": "In Berland recently a new collection of toys went on sale. This collection consists of 10^9 types of toys, numbered with integers from 1 to 10^9. A toy from the new collection of the i-th type costs i bourles.\n\nTania has managed to collect n different types of toys a_1, a_2, ..., a_{n} from the ...
[{"input": "5 100000000\n100000000 999999999 1 2 3\n", "output": "14138\n4 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 8...
code_stdio
[ { "content": "Decimal numbers are a common notation system currently in use and use ten symbols 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 to represent all numbers.\n\nBinary numbers are a popular notation in the computer world and use two symbols, 0 and 1, to represent all numbers.\n\nOnly the four numbers 0, 1, 2, and ...
[{"input": "7\n4\n0\n24\n10\n10010\n-1", "output": "13\n10\n0\n120\n22\n2130122\n"}, {"input": "7\n4\n1\n24\n10\n10010\n-1", "output": "13\n10\n1\n120\n22\n2130122\n"}, {"input": "7\n4\n0\n12\n16\n10000\n-1", "output": "13\n10\n0\n30\n100\n2130100\n"}, {"input": "7\n4\n0\n24\n10\n11010\n-1", "output": "13\n10\n0\n120\n...
code_stdio
[ { "content": "There is an infinitely long street that runs west to east, which we consider as a number line.\nThere are N roadworks scheduled on this street.\nThe i-th roadwork blocks the point at coordinate X_i from time S_i - 0.5 to time T_i - 0.5.\nQ people are standing at coordinate 0. The i-th person will ...
[{"input": "4 6\n1 3 2\n2 13 10\n18 20 22\n4 4 2\n1\n1\n2\n3\n5\n8", "output": "10\n10\n10\n-1\n-1\n-1\n"}, {"input": "4 6\n2 1 0\n2 13 10\n18 20 22\n7 4 1\n1\n1\n4\n3\n5\n8", "output": "10\n10\n-1\n-1\n-1\n-1\n"}, {"input": "4 6\n1 3 2\n7 13 10\n18 20 13\n3 4 2\n0\n1\n2\n3\n5\n8\n", "output": "2\n2\n10\n-1\n13\n-1\n"}...
code_stdio
[ { "content": "Find places where a string P is found within a text T. Print all indices of T where P found. The indices of T start with 0.\n\nConstraints\n\n* 1 ≤ length of T ≤ 1000000\n* 1 ≤ length of P ≤ 10000\n* The input consists of alphabetical characters and digits\n\nInput\n\nIn the first line, a text T i...
[{"input": "aaaaab\naa", "output": "0\n1\n2\n3\n"}, {"input": "baaaaa\naa", "output": "1\n2\n3\n4\n"}, {"input": "aaabaa\naa", "output": "0\n1\n4\n"}, {"input": "baaaab\naa", "output": "1\n2\n3\n"}, {"input": "aaaabb\naa", "output": "0\n1\n2\n"}, {"input": "b`aaaa\naa", "output": "2\n3\n4\n"}, {"input": "``a```\n``", "...
code_stdio
[ { "content": "The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.\n\nThe playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game is to make numbers a1, a2, ..., ak (i.e. so...
[{"input": "120\n242 524 420 973 816 432 247 666 134 849 145 366 608 930 613 315 863 628 97 109 65 704 741 314 736 17 872 971 559 648 223 771 171 327 782 837 303 393 292 339 730 834 794 868 540 251 789 893 23 305 116 220 699 863 580 992 861 393 98 253 544 171 336 207 348 496 316 285 286 727 613 616 304 811 592 916 91 5...
code_stdio
[ { "content": "Sakuzyo - Imprinting\n\nA.R.C. Markland-N is a tall building with $n$ floors numbered from $1$ to $n$. Between each two adjacent floors in the building, there is a staircase connecting them.\n\nIt's lunchtime for our sensei Colin \"ConneR\" Neumann Jr, and he's planning for a location to enjoy his...
[{"input": "1\n100 52 99\n51 69 42 32 34 62 12 75 88 18 57 47 40 91 100 81 72 15 26 14 93 68 6 50 5 24 97 52 10 20 54 9 56 39 21 55 7 98 59 87 77 17 29 13 30 46 37 76 71 78 96 82 49 64 84 60 67 19 2 25 85 89 38 41 11 90 35 48 27 28 70 65 66 16 79 3 80 44 36 43 61 99 22 33 86 4 83 94 74 31 73 95 58 53 8 63 92 45 23\n", ...
code_stdio
[ { "content": "### Task\n\nYes, your eyes are no problem, this is toLoverCase (), not toLowerCase (), we want to make the world full of love.\n \n### What do we need to do?\n \nYou need to add a prototype function to the String, the name is toLoverCase. Function can convert the letters in the string, conve...
[{"input": "\"Hello World!\"", "output": "[\"ELEEV VVOEE!\"]", "fn_name": "to_lover_case"}, {"input": "\"jrvz,\"", "output": "[\"OOOO,\"]", "fn_name": "to_lover_case"}, {"input": "\"LOVE\"", "output": "[\"EVOL\"]", "fn_name": "to_lover_case"}, {"input": "\"love\"", "output": "[\"EVOL\"]", "fn_name": "to_lover_case"}, {...
code_functional
[ { "content": "We have a tree with N vertices. The i-th edge connects Vertex A_i and B_i bidirectionally.\nTakahashi is standing at Vertex u, and Aoki is standing at Vertex v.\nNow, they will play a game of tag as follows:\n - 1. If Takahashi and Aoki are standing at the same vertex, the game ends. Otherwise, Ta...
[{"input": "9626 1978 3170\n4041 8502\n9589 1770\n3880 9265\n3674 287\n5843 6458\n4211 4202\n1543 3712\n2171 8104\n6298 1286\n702 6013\n5943 5185\n570 8388\n328 3661\n4012 7110\n5999 5207\n4151 4634\n1287 1773\n8991 1892\n6828 7699\n6330 2869\n8268 6633\n3292 1018\n7016 6679\n8643 7852\n7834 6467\n4894 2098\n2936 460\n...
code_stdio
[ { "content": "Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall ...
[{"input": "8 10\n100\n200\n300\n400\n500\n600\n700\n800\n900\n1000\n", "output": "11\n13\n14\n15\n16\n16\n17\n18\n19\n20\n"}, {"input": "8 10\n100\n200\n300\n400\n500\n600\n700\n862\n900\n1000\n", "output": "11\n13\n14\n15\n16\n16\n17\n19\n19\n20\n"}, {"input": "7 10\n100\n200\n300\n400\n500\n600\n700\n800\n900\n1000\...
code_stdio
[ { "content": "You have to create a method \"compoundArray\" which should take as input two int arrays of different length and return one int array with numbers of both arrays shuffled one by one. \n```Example: \nInput - {1,2,3,4,5,6} and {9,8,7,6} \nOutput - {1,9,2,8,3,7,4,6,5,6}\n```\n\nWrite Python code to so...
[{"input": "[2147483647, 2147483646, 2147483645, 2147483644, 2147483643]\n[9]", "output": "[[2147483647, 9, 2147483646, 2147483645, 2147483644, 2147483643]]", "fn_name": "compound_array"}, {"input": "[0, 1, 2]\n[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]", "output": "[[0, 9, 1, 8, 2, 7, 6, 5, 4, 3, 2, 1, 0]]", "fn_name": "compound_...
code_functional
[ { "content": "Piegirl has found a monster and a book about monsters and pies. When she is reading the book, she found out that there are n types of monsters, each with an ID between 1 and n. If you feed a pie to a monster, the monster will split into some number of monsters (possibly zero), and at least one col...
[{"input": "11 10\n1 9 -1 -1 -1 -1 -1 -1 -1 -1 -1\n1 10 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1\n2 11 1 1 1 1 1 1 1 1 1 1 -1\n3 11 2 2 2 2 2 2 2 2 2 2 -1\n4 11 3 3 3 3 3 3 3 3 3 3 -1\n5 11 4 4 4 4 4 4 4 4 4 4 -1\n6 11 5 5 5 5 5 5 5 5 5 5 -1\n7 11 6 6 6 6 6 6 6 6 6 6 -1\n8 11 7 7 7 7 7 7 7 7 7 7 -1\n9 11 8 8 8 8 8 8 8 8 8 8 -1\n1...
code_stdio
[ { "content": "Takahashi has an empty string S and a variable x whose initial value is 0.\n\nAlso, we have a string T consisting of `0` and `1`.\n\nNow, Takahashi will do the operation with the following two steps |T| times.\n\n* Insert a `0` or a `1` at any position of S of his choice.\n* Then, increment x by t...
[{"input": "0111101111", "output": "28\n"}, {"input": "0111001111", "output": "27\n"}, {"input": "1010011111", "output": "29\n"}, {"input": "0010001111", "output": "23\n"}, {"input": "0010001011", "output": "21\n"}, {"input": "0010001001", "output": "18\n"}, {"input": "0110001001", "output": "19\n"}, {"input": "0010001...
code_stdio
[ { "content": "Given 2 elevators (named \"left\" and \"right\") in a building with 3 floors (numbered `0` to `2`), write a function `elevator` accepting 3 arguments (in order):\n\n- `left` - The current floor of the left elevator\n- `right` - The current floor of the right elevator\n- `call` - The floor that ca...
[{"input": "0\n1\n1", "output": "[\"right\"]", "fn_name": "elevator"}, {"input": "0\n1\n2", "output": "[\"right\"]", "fn_name": "elevator"}, {"input": "0\n0\n0", "output": "[\"right\"]", "fn_name": "elevator"}, {"input": "0\n2\n1", "output": "[\"right\"]", "fn_name": "elevator"}, {"input": "0\n0\n1", "output": "[\"righ...
code_functional
[ { "content": "Problem\n\nGiven the integer n, output the smallest m such that nCm (the number of combinations that choose m out of n different ones) is even.\n\nConstraints\n\nThe input satisfies the following conditions.\n\n* 1 ≤ n ≤ 1018\n\nInput\n\nThe input is given in the following format.\n\n\nn\n\n\nOutp...
[{"input": "127", "output": "128\n"}, {"input": "255", "output": "256\n"}, {"input": "175", "output": "16\n"}, {"input": "101", "output": "2\n"}, {"input": "15", "output": "16\n"}, {"input": "31", "output": "32\n"}, {"input": "63", "output": "64\n"}, {"input": "110", "output": "1\n"}, {"input": "010", "output": "1\n"},...
code_stdio
[ { "content": "Write a function that accepts two parameters (a and b) and says whether a is smaller than, bigger than, or equal to b.\n\nHere is an example code:\nvar noIfsNoButs = function (a,b) {\n if(a > b) return a + \" is greater than \" + b\n else if(a < b) return a + \" is smaller than \" + b\n else if...
[{"input": "100\n80", "output": "[\"100 is greater than 80\"]", "fn_name": "no_ifs_no_buts"}, {"input": "45\n51", "output": "[\"45 is smaller than 51\"]", "fn_name": "no_ifs_no_buts"}, {"input": "100\n100", "output": "[\"100 is equal to 100\"]", "fn_name": "no_ifs_no_buts"}, {"input": "20\n19", "output": "[\"20 is grea...
code_functional
[ { "content": "There are N balls in the xy-plane. The coordinates of the i-th of them is (x_i, i).\nThus, we have one ball on each of the N lines y = 1, y = 2, ..., y = N.\nIn order to collect these balls, Snuke prepared 2N robots, N of type A and N of type B.\nThen, he placed the i-th type-A robot at coordinate...
[{"input": "5\n20\n11 12 9 17 12\n", "output": "74\n"}, {"input": "5\n20\n14 12 16 17 15", "output": "52\n"}, {"input": "5\n20\n14 10 16 17 15", "output": "56\n"}, {"input": "5\n20\n14 10 20 17 15", "output": "48\n"}, {"input": "5\n20\n14 18 20 17 15", "output": "32\n"}, {"input": "5\n20\n14 18 20 17 19", "output": "24...
code_stdio
[ { "content": "There are n phone numbers in Polycarp's contacts on his phone. Each number is a 9-digit integer, starting with a digit different from 0. All the numbers are distinct.\n\nThere is the latest version of Berdroid OS installed on Polycarp's phone. If some number is entered, is shows up all the numbers...
[{"input": "9\n111111111\n111111110\n111111100\n111111000\n111110000\n111100000\n111000000\n110000000\n100000000\n", "output": "111111111\n111111110\n111111100\n111111000\n111110000\n111100000\n111000000\n110000000\n00000000\n"}, {"input": "10\n302417715\n621211824\n474451896\n961495400\n633841010\n839982537\n797812119...
code_stdio
[ { "content": "Read problems statements in Mandarin Chinese and Russian. \n\nYou are given an array A of integers of size N. You will be given Q queries where each query is represented by two integers L, R. You have to find the gcd(Greatest Common Divisor) of the array after excluding the part from range L to R...
[{"input": "1\n3 3\n3 5 17\n1 2\n0 1\n-1 0", "output": "17\n1\n1\n"}, {"input": "1\n3 3\n3 9 23\n3 0\n1 2\n-1 0", "output": "1\n23\n1\n"}, {"input": "1\n3 3\n5 10 10\n4 0\n0 0\n4 0", "output": "5\n5\n5\n"}, {"input": "1\n3 3\n3 6 19\n1 2\n0 0\n4 0", "output": "19\n1\n1\n"}, {"input": "1\n3 3\n2 2 16\n1 1\n1 2\n2 3", "o...
code_stdio
[ { "content": "As you must know, the maximum clique problem in an arbitrary graph is NP-hard. Nevertheless, for some graphs of specific kinds it can be solved effectively.\n\nJust in case, let us remind you that a clique in a non-directed graph is a subset of the vertices of a graph, such that any two vertices o...
[{"input": "50\n1 2 5 7 9 14 19 24 25 29 31 34 37 40 43 44 46 53 54 57 58 59 60 61 62 64 66 68 69 70 72 75 78 79 80 81 82 84 85 86 87 88 89 90 91 92 93 94 96 98\n", "output": "4\n"}, {"input": "50\n1 2 5 7 9 14 19 24 25 29 31 34 37 40 43 44 46 53 54 57 58 59 60 61 62 64 66 68 69 70 72 75 78 79 80 81 82 84 85 86 87 88 8...
code_stdio
[ { "content": "We're giving away nice huge bags containing number tiles! A bag we want to present to you contains n tiles. Each of them has a single number written on it — either 1 or 2.\n\nHowever, there is one condition you must fulfill in order to receive the prize. You will need to put all the tiles from the...
[{"input": "214\n1 2 2 1 1 1 2 2 2 2 1 1 1 2 2 2 2 2 2 1 2 1 1 2 2 1 1 2 2 2 2 1 2 2 2 1 1 2 2 2 1 1 2 2 1 2 2 2 1 1 2 1 1 2 1 1 1 2 2 2 2 1 2 2 2 1 2 1 2 1 1 2 2 1 1 2 1 2 2 2 2 2 2 2 1 2 1 2 2 1 2 2 2 1 2 2 1 2 2 1 2 2 2 2 1 2 2 2 1 1 2 2 2 2 2 2 1 2 2 2 2 1 1 1 2 2 2 1 2 1 2 1 1 2 1 1 1 2 2 2 1 2 2 2 2 2 2 2 1 2 2 1...
code_stdio
[ { "content": "Multiple polygonal lines are given on the xy-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template.\n\nA polygonal line consists of several line segments parallel to x-axis or y-axis. It is defined by a list of xy-coordin...
[{"input": "5\n5\n0 0\n2 0\n2 1\n4 1\n4 0\n5\n0 0\n0 2\n-1 2\n-1 4\n0 4\n5\n0 0\n0 1\n-2 1\n-2 2\n0 2\n5\n0 0\n0 -1\n2 -1\n2 0\n4 0\n5\n0 0\n2 0\n2 -1\n4 -1\n4 0\n5\n0 0\n2 0\n2 1\n4 1\n4 0\n4\n4\n-60 -75\n-60 -78\n-42 -78\n-42 -6\n4\n10 3\n10 7\n-4 7\n-4 40\n4\n-74 66\n-74 63\n-92 63\n-92 135\n4\n-12 22\n-12 25\n-30 2...
code_stdio
[ { "content": "You are given $n$ numbers $a_1, a_2, \\dots, a_n$. With a cost of one coin you can perform the following operation:\n\nChoose one of these numbers and add or subtract $1$ from it.\n\nIn particular, we can apply this operation to the same number several times.\n\nWe want to make the product of all ...
[{"input": "22\n99039804 -580368436 -694542422 231508622 -490965348 958087037 -570157955 560902976 -840005981 -1381720926 -708462966 639575552 119982241 -631099451 -154223559 102960509 -225552439 507250810 -712228569 989896753 1574991855 1\n", "output": "12773524192\n"}, {"input": "22\n99039804 -580368436 -694542422 23...
code_stdio
[ { "content": "There are times you recall a good old friend and everything you've come through together. Luckily there are social networks — they store all your message history making it easy to know what you argued over 10 years ago.\n\nMore formal, your message history is a sequence of messages ordered by time...
[{"input": "100 7\n0 1 1 1 0 5 6 6 8 8 9 11 12 11 8 0 0 14 6 16 7 21 15 23 15 24 0 0 0 28 0 29 26 27 19 1 0 21 37 32 40 30 37 34 39 38 34 38 0 0 41 24 45 47 0 33 46 26 31 0 21 57 57 18 63 63 20 59 65 56 68 0 30 55 55 0 70 43 59 49 59 79 66 74 0 11 65 0 80 63 0 84 73 49 73 81 0 86 76 20\n", "output": "8 9 10 11 12 13 14...
code_stdio
[ { "content": "Vanya has a table consisting of 100 rows, each row contains 100 cells. The rows are numbered by integers from 1 to 100 from bottom to top, the columns are numbered from 1 to 100 from left to right. \n\nIn this table, Vanya chose n rectangles with sides that go along borders of squares (some rectan...
[{"input": "5\n4 11 20 20\n6 11 20 16\n5 1 33 15\n11 3 18 21\n3 2 14 21\n", "output": "1087\n"}, {"input": "5\n4 11 20 22\n6 11 20 16\n5 1 34 15\n11 3 18 21\n3 1 14 11\n", "output": "1028\n"}, {"input": "5\n4 11 20 38\n6 11 20 16\n5 2 19 15\n11 3 18 15\n3 2 14 11\n", "output": "1000\n"}, {"input": "5\n4 11 20 20\n6 11 ...
code_stdio
[ { "content": "For a given polygon g, print \"1\" if g is a convex polygon, \"0\" otherwise. Here, in a convex polygon, all interior angles are less than or equal to 180 degrees.\n\ng is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≤ i ≤ n-1) are sides of the p...
[{"input": "4\n-1 1\n25 -3\n1 0\n-1 -1", "output": "0\n"}, {"input": "4\n-1 1\n25 -3\n1 -1\n-1 0", "output": "0\n"}, {"input": "4\n-1 1\n25 -3\n1 -1\n-1 1", "output": "0\n"}, {"input": "4\n-1 2\n25 -3\n1 -1\n-1 1", "output": "0\n"}, {"input": "4\n-1 2\n25 -3\n0 -1\n-1 1", "output": "0\n"}, {"input": "4\n-1 4\n25 -3\n0 ...
code_stdio
[ { "content": "Andryusha goes through a park each day. The squares and paths between them look boring to Andryusha, so he decided to decorate them.\n\nThe park consists of n squares connected with (n - 1) bidirectional paths in such a way that any square is reachable from any other using these paths. Andryusha d...
[{"input": "50\n8 37\n40 8\n38 40\n10 38\n29 10\n33 29\n17 33\n25 17\n19 25\n3 19\n13 3\n24 13\n12 24\n5 12\n41 5\n11 41\n27 11\n45 27\n6 45\n35 6\n9 35\n50 9\n32 50\n21 32\n22 21\n1 22\n31 1\n28 31\n4 28\n30 4\n7 30\n48 7\n46 48\n16 46\n49 16\n39 49\n18 39\n14 18\n34 14\n23 34\n20 23\n15 20\n44 15\n42 44\n2 42\n36 2\n...
code_stdio
[ { "content": "A string of length 6 consisting of lowercase English letters is said to be coffee-like if and only if its 3-rd and 4-th characters are equal and its 5-th and 6-th characters are also equal.\n\nGiven a string S, determine whether it is coffee-like.\n\n-----Constraints-----\n - S is a string of leng...
[{"input": "sippuu\n", "output": "Yes\n"}, {"input": "coffee\n", "output": "Yes\n"}, {"input": "dceett\n", "output": "Yes\n"}, {"input": "otjjmm\n", "output": "Yes\n"}, {"input": "zkrrcc\n", "output": "Yes\n"}, {"input": "abcccc\n", "output": "Yes\n"}, {"input": "iphone\n", "output": "No\n"}, {"input": "mdihxy\n", "out...
code_stdio
[ { "content": "Takahashi has decided to work on K days of his choice from the N days starting with tomorrow.\nYou are given an integer C and a string S. Takahashi will choose his workdays as follows:\n - After working for a day, he will refrain from working on the subsequent C days.\n - If the i-th character of ...
[{"input": "16 4 3\noxxoxoxxxxxooxoo", "output": "1\n6\n12\n16\n"}, {"input": "16 4 3\nooxxoxnyxxoxoxwo", "output": "1\n5\n11\n16\n"}, {"input": "16 4 3\npoxxoxoxxyoxoxxo", "output": "2\n7\n11\n16\n"}, {"input": "16 4 3\nooxxnxoxxyoxxxop", "output": "7\n11\n15\n"}, {"input": "16 4 3\nooxxoxoxxxoxoxxo\n", "output": "11\...
code_stdio
[ { "content": "The Floral Clock has been standing by the side of Mirror Lake for years. Though unable to keep time, it reminds people of the passage of time and the good old days.\n\nOn the rim of the Floral Clock are 2n flowers, numbered from 1 to 2n clockwise, each of which has a colour among all n possible on...
[{"input": "23333\n", "output": "259575428\n"}, {"input": "49997\n", "output": "645043850\n"}, {"input": "10492\n", "output": "914991759\n"}, {"input": "30000\n", "output": "583465411\n"}, {"input": "10001\n", "output": "552705744\n"}, {"input": "49999\n", "output": "791828238\n"}, {"input": "10000\n", "output": "93853...
code_stdio
[ { "content": "###Task:\n\nYou have to write a function **pattern** which returns the following Pattern(See Examples) upto n rows, where n is parameter.\n\n####Rules/Note:\n* If the Argument is 0 or a Negative Integer then it should return \"\" i.e. empty string.\n* The length of each line = (2n-1).\n* Range of ...
[{"input": "8", "output": "[\" 12345678\\n 12345678 \\n 12345678 \\n 12345678 \\n 12345678 \\n 12345678 \\n 12345678 \\n12345678 \"]", "fn_name": "pattern"}, {"input": "5", "output": "[\" 12345\\n 12345 \\n 12345 \\n 12345 \\n12345 \"]", "fn_name": "pattern"}, {"inp...
code_functional
[ { "content": "In telecomunications we use information coding to detect and prevent errors while sending data. \n\nA parity bit is a bit added to a string of binary code that indicates whether the number of 1-bits in the string is even or odd. Parity bits are used as the simplest form of error detecting code, an...
[{"input": "\"10100011 00111001 11001100 01010100 10110110 00111111\"", "output": "[\"1010001 0011100 1100110 error error 0011111\"]", "fn_name": "parity_bit"}, {"input": "\"01101110 01100000 01010110 10001111 01100011\"", "output": "[\"error 0110000 0101011 error 0110001\"]", "fn_name": "parity_bit"}, {"input": "\"111...
code_functional
[ { "content": "Little Artem found a grasshopper. He brought it to his house and constructed a jumping area for him.\n\nThe area looks like a strip of cells 1 × n. Each cell contains the direction for the next jump and the length of that jump. Grasshopper starts in the first cell and follows the instructions writ...
[{"input": "10\n>>>>>>>>><\n1 1 1 1 1 1 1 1 1 5\n", "output": "INFINITE\n"}, {"input": "10\n>>>>>>>>><\n1 1 1 1 1 1 1 1 1 1\n", "output": "INFINITE\n"}, {"input": "10\n>>>>>>>>>>\n1 1 1 1 1 1 1 1 1 100\n", "output": "FINITE\n"}, {"input": "10\n>>>>>>>>>>\n1 1 1 1 1 1 1 1 1 100\n", "output": "FINITE\n"}, {"input": "10\n...
code_stdio
[ { "content": "Given a positive number n > 1 find the prime factor decomposition of n.\nThe result will be a string with the following form :\n```\n \"(p1**n1)(p2**n2)...(pk**nk)\"\n```\nwhere ```a ** b``` means ```a``` to the power of ```b```\n\nwith the p(i) in increasing order and n(i) empty if\nn(i) is 1.\n`...
[{"input": "782611830", "output": "[\"(2)(3**2)(5)(7**2)(11)(13)(17)(73)\"]", "fn_name": "primeFactors"}, {"input": "7775460", "output": "[\"(2**2)(3**3)(5)(7)(11**2)(17)\"]", "fn_name": "primeFactors"}, {"input": "342217392", "output": "[\"(2**4)(3)(11)(43)(15073)\"]", "fn_name": "primeFactors"}, {"input": "775878912"...
code_functional
[ { "content": "problem\n\nAOR Ika made a set $ S = \\\\ {a_1, ..., a_N \\\\} $ and a map $ f: S → S $. $ f (a_i) = b_i $. For any element $ x $ in the set $ S $, all maps $ g, h: S → S $ satisfying $ g (f (x)) = h (f (x)) $ are $ g (x). ) = Determine if h (x) $ is satisfied, and if not, configure one counterexam...
[{"input": "5\n2 1 3 4 5\n3 4 2 5 1", "output": "Yes\n"}, {"input": "5\n1 2 3 4 5\n2 4 3 5 1", "output": "Yes\n"}, {"input": "5\n1 3 2 4 5\n3 4 2 5 1", "output": "Yes\n"}, {"input": "5\n2 1 3 4 5\n2 4 3 5 1", "output": "Yes\n"}, {"input": "5\n1 4 3 2 5\n3 4 2 5 1", "output": "Yes\n"}, {"input": "5\n2 1 3 4 5\n3 4 2 5 1...
code_stdio
[ { "content": "Given a string containing a list of integers separated by commas, write the function string_to_int_list(s) that takes said string and returns a new list containing all integers present in the string, preserving the order.\n\nFor example, give the string \"-1,2,3,4,5\", the function string_to_int_l...
[{"input": "\",,,,,1,2,3,,,4,,5,,,\"", "output": "[[1, 2, 3, 4, 5]]", "fn_name": "string_to_int_list"}, {"input": "\"21,12,23,34,45\"", "output": "[[21, 12, 23, 34, 45]]", "fn_name": "string_to_int_list"}, {"input": "\"-1,-2,3,-4,-5\"", "output": "[[-1, -2, 3, -4, -5]]", "fn_name": "string_to_int_list"}, {"input": "\"1...
code_functional
[ { "content": "You are given a sequence of $n$ integers $a_1$, $a_2$, ..., $a_n$. Let us call an index $j$ ($2 \\le j \\le {{n-1}}$) a hill if $a_j > a_{{j+1}}$ and $a_j > a_{{j-1}}$; and let us call it a valley if $a_j < a_{{j+1}}$ and $a_j < a_{{j-1}}$.\n\nLet us define the intimidation value of a sequence as ...
[{"input": "4\n3\n3 14 1\n5\n3 3 2 2 4\n6\n1 6 2 2 2 10\n5\n1 12 1 4 2\n", "output": "0\n0\n0\n0\n"}, {"input": "4\n3\n3 14 1\n5\n3 3 2 1 4\n6\n1 6 2 2 2 10\n5\n1 12 1 4 2\n", "output": "0\n0\n0\n0\n"}, {"input": "4\n3\n1 5 0\n5\n5 4 2 2 -1\n6\n0 8 2 5 4 10\n5\n2 6 1 4 -1\n", "output": "0\n0\n1\n0\n"}, {"input": "4\n3\...
code_stdio
[ { "content": "Bandits appeared in the city! One of them is trying to catch as many citizens as he can.\n\nThe city consists of $n$ squares connected by $n-1$ roads in such a way that it is possible to reach any square from any other square. The square number $1$ is the main square.\n\nAfter Sunday walk all the ...
[{"input": "100\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\n0 0 63 70 92 75 4 96 52 33 86 57 53 85 91 62 23 0 28 37 41 69 26 64 7 100 41 19 70 60 1 50 12 98 62 45 7...
code_stdio
[ { "content": "There are n student groups at the university. During the study day, each group can take no more than 7 classes. Seven time slots numbered from 1 to 7 are allocated for the classes.\n\nThe schedule on Monday is known for each group, i. e. time slots when group will have classes are known.\n\nYour t...
[{"input": "20\n1111111\n1101011\n1111011\n0111111\n1111111\n1110111\n1111111\n1111111\n1111111\n1111111\n1110111\n1111111\n0111111\n1011111\n1111111\n1111111\n1101110\n1111111\n1111111\n1111111\n", "output": "20\n"}, {"input": "20\n1111111\n1101011\n1111011\n0111111\n1111111\n1110111\n1111111\n1111111\n1111111\n111111...
code_stdio