messages listlengths 1 1 | ground_truth stringlengths 156 726k | dataset stringclasses 2
values |
|---|---|---|
[
{
"content": "The only difference between the easy and the hard versions is the maximum value of $k$.\n\nYou are given an infinite sequence of form \"112123123412345$\\dots$\" which consist of blocks of all consecutive positive integers written one after another. The first block consists of all numbers from $1$... | [{"input": "19\n1\n10\n100\n1000\n10000\n100000\n1000000\n10000000\n100000000\n1000000000\n10000000000\n100000000000\n1000000000000\n10000000000000\n100000000000000\n1000000000000000\n10000000000000000\n100000000000000000\n1000000000000000000\n", "output": "1\n4\n1\n4\n9\n2\n6\n2\n6\n8\n1\n1\n9\n8\n3\n7\n6\n1\n1\n"}, {... | code_stdio |
[
{
"content": "Polycarp and Vasiliy love simple logical games. Today they play a game with infinite chessboard and one pawn for each player. Polycarp and Vasiliy move in turns, Polycarp starts. In each turn Polycarp can move his pawn from cell (x, y) to (x - 1, y) or (x, y - 1). Vasiliy can move his pawn from (x... | [{"input": "100000 99999 100000 100000\n", "output": "Polycarp\n"}, {"input": "100000 100000 100000 99999\n", "output": "Vasiliy\n"}, {"input": "55000 60000 55003 60100\n", "output": "Polycarp\n"}, {"input": "23039 21508 54113 76824\n", "output": "Polycarp\n"}, {"input": "32959 49970 75441 55257\n", "output": "Polycarp... | code_stdio |
[
{
"content": "Two people play the following string game. Initially the players have got some string s. The players move in turns, the player who cannot make a move loses. \n\nBefore the game began, the string is written on a piece of paper, one letter per cell.\n\n<image> An example of the initial situation at ... | [{"input": "tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiogogogogogogogogo... | code_stdio |
[
{
"content": "Takahashi is distributing N balls to K persons.\n\nIf each person has to receive at least one ball, what is the maximum possible difference in the number of balls received between the person with the most balls and the person with the fewest balls?\n\nConstraints\n\n* 1 \\leq K \\leq N \\leq 100\n... | [{"input": "-2 135", "output": "-137\n"}, {"input": "-2 240", "output": "-242\n"}, {"input": "-4 240", "output": "-244\n"}, {"input": "3 130", "output": "-127\n"}, {"input": "2 130", "output": "-128\n"}, {"input": "2 218", "output": "-216\n"}, {"input": "2 323", "output": "-321\n"}, {"input": "3 323", "output": "-320\n... | code_stdio |
[
{
"content": "There is a bus route as shown in Figure 1. There are 10 stops, each numbered 0-9. The bus turns back at stop 0, but the other side is a circulation route, which circulates in the order of 5 β 6 β 7 β 8 β 9 β 5 as shown in the figure.\n\n<image>\n\n\nFor this bus route, create a program that inputs... | [{"input": "2\n1 8\n8 0", "output": "1 2 3 4 5 6 7 8\n8 9 5 4 3 2 1 0\n"}, {"input": "2\n1 9\n8 1", "output": "1 2 3 4 5 6 7 8 9\n8 9 5 4 3 2 1\n"}, {"input": "2\n2 8\n6 2", "output": "2 3 4 5 6 7 8\n6 7 8 9 5 4 3 2\n"}, {"input": "2\n1 8\n5 0", "output": "1 2 3 4 5 6 7 8\n5 4 3 2 1 0\n"}, {"input": "2\n0 7\n8 2", "out... | code_stdio |
[
{
"content": "A number m of the form 10x + y is divisible by 7 if and only if x β 2y is divisible by 7. In other words, subtract twice the last digit \nfrom the number formed by the remaining digits. Continue to do this until a number known to be divisible or not by 7 is obtained; \nyou can stop when this numbe... | [{"input": "2340029794923400297949", "output": "[[14, 20]]", "fn_name": "seven"}, {"input": "170232833617690725", "output": "[[0, 16]]", "fn_name": "seven"}, {"input": "477557101", "output": "[[28, 7]]", "fn_name": "seven"}, {"input": "477557102", "output": "[[47, 7]]", "fn_name": "seven"}, {"input": "1369851", "output... | code_functional |
[
{
"content": "There are n cities in Berland and some pairs of them are connected by two-way roads. It is guaranteed that you can pass from any city to any other, moving along the roads. Cities are numerated from 1 to n.\n\nTwo fairs are currently taking place in Berland β they are held in two different cities a... | [{"input": "3\n7 7 3 5\n1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n7 5\n4 5 2 4\n1 2\n2 3\n3 4\n4 1\n4 2\n4 3 2 1\n1 2\n2 3\n4 1\n", "output": "4\n0\n1\n"}, {"input": "3\n7 7 3 5\n1 2\n2 3\n3 4\n2 5\n5 6\n6 7\n7 5\n4 5 2 4\n1 2\n2 3\n3 4\n4 1\n4 2\n4 3 2 1\n1 2\n2 3\n4 1\n", "output": "2\n0\n1\n"}, {"input": "3\n7 7 3 5\n1 2\n2 3\n... | code_stdio |
[
{
"content": "Limak is a grizzly bear who desires power and adoration. He wants to win in upcoming elections and rule over the Bearland.\n\nThere are n candidates, including Limak. We know how many citizens are going to vote for each candidate. Now i-th candidate would get a_{i} votes. Limak is candidate number... | [{"input": "100\n1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 100... | code_stdio |
[
{
"content": "problem\n\nJOI took six subjects: physics, chemistry, biology, earth science, history, and geography. Each test was scored on a 100-point scale.\n\nJOI chooses 3 subjects from 4 subjects of physics, chemistry, biology, and earth science, and 1 subject from 2 subjects of history and geography.\n\nW... | [{"input": "100\n-3\n8\n108\n-12\n-4", "output": "212\n"}, {"input": "100\n-7\n8\n108\n-12\n-1", "output": "215\n"}, {"input": "100\n66\n-13\n-1\n-2\n2", "output": "167\n"}, {"input": "100\n106\n-5\n-1\n-2\n3", "output": "208\n"}, {"input": "100\n106\n-2\n-2\n-2\n3", "output": "207\n"}, {"input": "100\n34\n76\n67\n10\n... | code_stdio |
[
{
"content": "Last year the world's largest square was built in Berland. It is known that the square can be represented as an infinite plane with an introduced Cartesian system of coordinates. On that square two sets of concentric circles were painted. Let's call the set of concentric circles with radii 1, 2, .... | [{"input": "100000 -100000 100000 100000\n", "output": " 200001\n"}, {"input": "100000 100000 100000 -100000\n", "output": " 200001\n"}, {"input": "99999 100000 100000 -100000\n", "output": " ... | code_stdio |
[
{
"content": "Alice has got addicted to a game called Sirtet recently.\n\nIn Sirtet, player is given an $n \\times m$ grid. Initially $a_{i,j}$ cubes are stacked up in the cell $(i,j)$. Two cells are called adjacent if they share a side. Player can perform the following operations: stack up one cube in two ad... | [{"input": "1555494676 853938121 172337487 490664825\n", "output": "866256663\n"}, {"input": "885636311 1133047284 232531966 493119835\n", "output": "572179871\n"}, {"input": "1076117758 300009121 565317265 947272048\n", "output": "963831390\n"}, {"input": "795069900 869551950 803936044 1279842333\n", "output": "815573... | code_stdio |
[
{
"content": "Dima and Inna are doing so great! At the moment, Inna is sitting on the magic lawn playing with a pink pony. Dima wanted to play too. He brought an n Γ m chessboard, a very tasty candy and two numbers a and b.\n\nDima put the chessboard in front of Inna and placed the candy in position (i, j) on t... | [{"input": "1000000 1000000 1000000 0000000 1000000 1000000\n", "output": "Poor Inna and pony!"}, {"input": "1000100 1000000 1000000 0000000 1000000 1000000\n", "output": "Poor Inna and pony!"}, {"input": "1000100 1000010 1000000 0000000 1000000 1000000\n", "output": "Poor Inna and pony!"}, {"input": "1000000 99999 123... | code_stdio |
[
{
"content": "Under the command \"Save Sergeant Ryan,\" Aiz's rescue team fought fierce battles with enemy forces in the floating city of Lee, Germany. They successfully joined the sergeant, but there were many enemy tanks and they could not call a rescue herio. So, in order to confuse the enemy tanks, they dec... | [{"input": "7\n1 2 5\n2 3 2\n3 4 3\n1 5 13\n5 6 3\n5 7 11\n0", "output": "27\n"}, {"input": "7\n1 2 4\n2 4 2\n3 4 3\n1 5 13\n5 6 3\n5 7 11\n0", "output": "25\n"}, {"input": "7\n1 3 2\n2 3 1\n7 4 3\n1 5 10\n5 6 4\n5 7 15\n0", "output": "29\n"}, {"input": "7\n1 2 5\n2 3 2\n3 4 3\n2 5 3\n5 6 10\n5 7 12\n0", "output": "12\... | code_stdio |
[
{
"content": "You are given an array a with n distinct integers. Construct an array b by permuting a such that for every non-empty subset of indices S = {x1, x2, ..., xk} (1 β€ xi β€ n, 0 < k < n) the sums of elements on that positions in a and b are different, i. e. \n\n<image>\n\nInput\n\nThe first line contain... | [{"input": "22\n133295371 188010892 71730560 209842234 193069109 184556873 87395258 234247052 230809052 211444018 148989732 17810977 158722706 11753932 100093528 1000000000 43672080 61357581 171830832 13873487 34865589 114340079\n", "output": "148989732 193069109 87395258 211444018 209842234 188010892 100093528 1000000... | code_stdio |
[
{
"content": "Example\n\nInput\n\nacmicpc\ntsukuba\n\n\nOutput\n\nNo\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": "acmicpc\nttukuba", "output": "No\n"}, {"input": "acmpcic\nttukuba", "output": "No\n"}, {"input": "acmpcid\nttukuba", "output": "No\n"}, {"input": "acmpcid\nttakubu", "output": "No\n"}, {"input": "acmqcid\nttakubu", "output": "No\n"}, {"input": "aciqcmd\nttakubu", "output": "No\n"}, {"input": "aciqcmd\ntt`ku... | code_stdio |
[
{
"content": "Given a non-negative number, return the next bigger polydivisible number, or an empty value like `null` or `Nothing`.\n\nA number is polydivisible if its first digit is cleanly divisible by `1`, its first two digits by `2`, its first three by `3`, and so on. There are finitely many polydivisible n... | [{"input": "3608528850368400786036724", "output": "[3608528850368400786036725]", "fn_name": "next_num"}, {"input": "3608528850368400786036725", "output": "[null]", "fn_name": "next_num"}, {"input": "1234567890", "output": "[1236004020]", "fn_name": "next_num"}, {"input": "123220", "output": "[123252]", "fn_name": "next... | code_functional |
[
{
"content": "Vasya decided to pass a very large integer n to Kate. First, he wrote that number as a string, then he appended to the right integer kΒ β the number of digits in n. \n\nMagically, all the numbers were shuffled in arbitrary order while this note was passed to Kate. The only thing that Vasya remember... | [{"input": "11111111111101101111110101011111010101001111001110010011810010110111101101112140110110\n110101100101111101011111111101111111111110111110011111011000111010100111011111000002\n", "output": "110101100101111101011111111101111111111110111110011111011000111010100111011111000002\n"}, {"input": "1111111111110110111... | code_stdio |
[
{
"content": "You are given a non-empty string s consisting of lowercase English letters. You have to pick exactly one non-empty substring of s and shift all its letters 'z' <image> 'y' <image> 'x' <image> 'b' <image> 'a' <image> 'z'. In other words, each character is replaced with the previous character of Eng... | [{"input": "abbbbbbbabbbbbbbbbbbbbbbbbbbbbbbabbabbbbbabbbbbbbbbbbabbbbbbbbabbabbbbbbbbbbbbbbabbabbbaababbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbabbbbbbbbbbbbbbbbabbbbabbbbbbbbbbbbbbbabbbbbbbbbaababbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbabbabbbbbbbbbbbbbbbbabbbabbbbbaabbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbb... | code_stdio |
[
{
"content": "Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).\n\n-----Constraints-----\n - 1 \\leq N \\leq 10^4\n - 1 \\leq A \\leq B \\leq 36\n - All input values are integers.\n\n-----Input-----\nInput is given from Standard Inpu... | [{"input": "100 4 16\n", "output": "4554\n"}, {"input": "101 0 154", "output": "5151\n"}, {"input": "111 1 181", "output": "6216\n"}, {"input": "110 2 100", "output": "5994\n"}, {"input": "100 2 100", "output": "4939\n"}, {"input": "101 1 011", "output": "2995\n"}, {"input": "101 1 010", "output": "2511\n"}, {"input": ... | code_stdio |
[
{
"content": "Slava plays his favorite game \"Peace Lightning\". Now he is flying a bomber on a very specific map.\n\nFormally, map is a checkered field of size 1 Γ n, the cells of which are numbered from 1 to n, in each cell there can be one or several tanks. Slava doesn't know the number of tanks and their po... | [{"input": "11124\n", "output": "16686\n2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100 102 104 106 108 110 112 114 116 118 120 122 124 126 128 130 132 134 136 138 140 142 144 146 148 150 152 154 156 158 160 162 164 166 1... | code_stdio |
[
{
"content": "What is an anagram? Well, two words are anagrams of each other if they both contain the same letters. For example:\n\n```\n'abba' & 'baab' == true\n\n'abba' & 'bbaa' == true\n\n'abba' & 'abbba' == false\n\n'abba' & 'abca' == false\n```\n\nWrite a function that will find all the anagrams of a word ... | [{"input": "\"abba\"\n[\"a\", \"b\", \"c\", \"d\", \"aabb\", \"bbaa\", \"abab\", \"baba\", \"baab\", \"abcd\", \"abbba\", \"baaab\", \"abbab\", \"abbaa\", \"babaa\"]", "output": "[[\"aabb\", \"bbaa\", \"abab\", \"baba\", \"baab\"]]", "fn_name": "anagrams"}, {"input": "\"ab\"\n[\"cc\", \"ac\", \"bc\", \"cd\", \"ab\", \"... | code_functional |
[
{
"content": "We have a graph with N vertices, numbered 0 through N-1. Edges are yet to be added.\n\nWe will process Q queries to add edges. In the i-th (1β¦iβ¦Q) query, three integers A_i, B_i and C_i will be given, and we will add infinitely many edges to the graph as follows:\n\n* The two vertices numbered A_i... | [{"input": "2 1\n0 0 1000000010", "output": "1000000011\n"}, {"input": "2 1\n1 0 1000000010", "output": "1000000010\n"}, {"input": "2 1\n0 0 1000000100", "output": "1000000101\n"}, {"input": "2 1\n0 0 1000001010", "output": "1000001011\n"}, {"input": "2 1\n0 0 1000010100", "output": "1000010101\n"}, {"input": "3 1\n0 0... | code_stdio |
[
{
"content": "One tradition of ACM-ICPC contests is that a team gets a balloon for every solved problem. We assume that the submission time doesn't matter and teams are sorted only by the number of balloons they have. It means that one's place is equal to the number of teams with more balloons, increased by 1. ... | [{"input": "7\n14000000003 1000000000000000000\n81000000000 88000000000\n5000000000 10778591928\n15000000000 39000000000\n46000000000 51000000000\n0 0000000000\n0 0\n", "output": "3\n"}, {"input": "7\n14000000003 1000000000000000000\n81000000000 88000000000\n5000000000 10778591928\n15000000000 41827794041\n46000000000 ... | code_stdio |
[
{
"content": "Peter loves any kinds of cheating. A week before ICPC, he broke into Doctor's PC and sneaked a look at all the problems that would be given in ICPC. He solved the problems, printed programs out, and brought into ICPC. Since electronic preparation is strictly prohibited, he had to type these progra... | [{"input": "3\n10 20 47\n7\n56 26 62 143 38 80 7", "output": "117\n1108\n"}, {"input": "3\n10 20 47\n7\n56 44 62 143 38 80 7", "output": "117\n1210\n"}, {"input": "3\n10 20 47\n7\n56 44 62 143 38 80 6", "output": "117\n1203\n"}, {"input": "3\n17 20 47\n7\n56 44 62 143 38 80 6", "output": "138\n1203\n"}, {"input": "3\n1... | code_stdio |
[
{
"content": "Palindromic characteristics of string s with length |s| is a sequence of |s| integers, where k-th number is the total number of non-empty substrings of s which are k-palindromes.\n\nA string is 1-palindrome if and only if it reads the same backward as forward.\n\nA string is k-palindrome (k > 1) i... | [{"input": "wyemcafatp\n", "output": "11 1 0 0 0 0 0 0 0 0 \n"}, {"input": "wyemcafatp\n", "output": "11 1 0 0 0 0 0 0 0 0 "}, {"input": "wyempafatc\n", "output": "11 1 0 0 0 0 0 0 0 0\n"}, {"input": "wyempaf`tc\n", "output": "10 0 0 0 0 0 0 0 0 0\n"}, {"input": "wyfmpae`tc\n", "output": "10 0 0 0 0 0 0 0 0 0\n"}, {"in... | code_stdio |
[
{
"content": "Monocarp plays a computer game. There are $n$ different sets of armor and $m$ different weapons in this game. If a character equips the $i$-th set of armor and wields the $j$-th weapon, their power is usually equal to $i + j$; but some combinations of armor and weapons synergize well. Formally, th... | [{"input": "2 10\n20\n2 2\n2 3\n2 4\n1 5\n1 2\n1 6\n1 1\n1 10\n2 10\n1 4\n2 8\n2 1\n1 9\n1 8\n2 5\n1 7\n2 7\n1 3\n2 9\n2 6\n", "output": "4\n"}, {"input": "2 10\n20\n2 6\n2 3\n1 1\n2 1\n2 9\n1 6\n1 2\n1 9\n1 10\n2 7\n2 4\n2 5\n1 5\n2 2\n2 8\n1 3\n1 8\n1 4\n1 7\n2 10\n", "output": "4\n"}, {"input": "2 10\n20\n1 9\n2 3\n... | code_stdio |
[
{
"content": "Create a function `longer` that accepts a string and sorts the words in it based on their respective lengths in an ascending order. If there are two words of the same lengths, sort them alphabetically. Look at the examples below for more details.\n\n```python\nlonger(\"Another Green World\") => Gr... | [{"input": "\"Darkness on the edge of Town\"", "output": "[\"of on the Town edge Darkness\"]", "fn_name": "longer"}, {"input": "\"Have you ever Seen the Rain\"", "output": "[\"the you Have Rain Seen ever\"]", "fn_name": "longer"}, {"input": "\"This will be our Year\"", "output": "[\"be our This Year will\"]", "fn_name"... | code_functional |
[
{
"content": "We have an integer array with unique elements and we want to do the permutations that have an element fixed, in other words, these permutations should have a certain element at the same position than the original.\n\nThese permutations will be called: **permutations with one fixed point**.\n\nLet'... | [{"input": "20\n2", "output": "[447507315596451070]", "fn_name": "fixed_points_perms"}, {"input": "10\n3", "output": "[222480]", "fn_name": "fixed_points_perms"}, {"input": "10\n4", "output": "[55650]", "fn_name": "fixed_points_perms"}, {"input": "4\n1", "output": "[8]", "fn_name": "fixed_points_perms"}, {"input": "4\n... | code_functional |
[
{
"content": "There is a grid of size W Γ H surrounded by walls. Some cells in the grid are occupied by slimes. The slimes want to unite with each other and become a \"King Slime\".\n\nIn each move, a slime can move to east, west, south and north direction until it enters a cell occupied by another slime or hit... | [{"input": "4 3 3\n1 1\n0 3\n3 1\n3 3", "output": "3\n"}, {"input": "4 3 3\n1 1\n1 3\n6 1\n3 2", "output": "4\n"}, {"input": "4 3 3\n1 1\n1 3\n3 1\n3 6", "output": "3\n"}, {"input": "4 6 3\n1 1\n0 3\n3 1\n3 3", "output": "3\n"}, {"input": "4 3 3\n1 1\n1 3\n3 1\n3 2", "output": "3\n"}, {"input": "4 3 3\n1 2\n1 3\n3 1\n3... | code_stdio |
[
{
"content": "You are given a rectangular table 3 Γ n. Each cell contains an integer. You can move from one cell to another if they share a side.\n\nFind such path from the upper left cell to the bottom right cell of the table that doesn't visit any of the cells twice, and the sum of numbers written in the cell... | [{"input": "10\n1086100980 -928074266 -409520915 770775361 240764400 108297300 -280070452 588179696 -920283246 736937716\n422602209 -940948979 -483879926 -525886137 -79749893 -958247281 844561102 553768085 269384580 -975129348\n-485518332 -130037110 493465239 494308146 958976404 706037260 154106757 -250914836 -91581406... | code_stdio |
[
{
"content": "Joisino the magical girl has decided to turn every single digit that exists on this world into 1.\nRewriting a digit i with j (0β€i,jβ€9) costs c_{i,j} MP (Magic Points).\nShe is now standing before a wall. The wall is divided into HW squares in H rows and W columns, and at least one square contains... | [{"input": "5 5\n0 999 1966 999 999 999 999 1629 999 790\n999 0 1675 999 1588 1296 1765 999 1373 999\n1262 999 0 999 999 999 999 999 999 999\n999 999 999 0 999 1663 729 999 999 1405\n999 999 999 999 1 999 999 999 1316 999\n999 999 999 999 182 1 251 926 1967 999\n1453 999 974 1903 117 999 0 999 1479 999\n416 999 999 999... | code_stdio |
[
{
"content": "You are given a tree with n vertices. Each vertex i has a value a_i associated with it.\n\nLet us root the tree at some vertex v. The vertex v is called a distinctive root if the following holds: in all paths that start at v and end at some other node, all the values encountered are distinct. Two ... | [{"input": "12\n7 1 6 1 4 1 0 3 2 5 3 1\n1 2\n2 10\n1 3\n6 4\n7 9\n3 5\n5 7\n11 8\n1 11\n11 12\n3 6\n", "output": "0\n"}, {"input": "12\n4 1 6 1 7 1 1 3 2 5 3 2\n1 2\n1 10\n1 3\n3 4\n7 9\n3 5\n5 7\n7 8\n1 11\n11 12\n3 6\n", "output": "4\n"}, {"input": "12\n4 1 6 1 4 1 1 3 2 5 3 2\n1 2\n2 10\n1 3\n3 4\n7 9\n3 5\n5 7\n7 ... | code_stdio |
[
{
"content": "In the snake exhibition, there are $n$ rooms (numbered $0$ to $n - 1$) arranged in a circle, with a snake in each room. The rooms are connected by $n$ conveyor belts, and the $i$-th conveyor belt connects the rooms $i$ and $(i+1) \\bmod n$. In the other words, rooms $0$ and $1$, $1$ and $2$, $\\ld... | [{"input": "36\n2\n--\n2\n>-\n2\n<-\n2\n->\n2\n>>\n2\n<>\n2\n-<\n2\n><\n2\n<<\n3\n---\n3\n>--\n3\n<--\n3\n->-\n3\n>>-\n3\n<>-\n3\n-<-\n3\n><-\n3\n<<-\n3\n-->\n3\n>->\n3\n<->\n3\n->>\n3\n>>>\n3\n<>>\n3\n-<>\n3\n><>\n3\n<<>\n3\n--<\n3\n>-<\n3\n<-<\n3\n-><\n3\n>><\n3\n<><\n3\n-<<\n3\n><<\n3\n<<<\n", "output": "2\n2\n2\n2\... | code_stdio |
[
{
"content": "Write a function that reverses the bits in an integer.\n\nFor example, the number `417` is `110100001` in binary. Reversing the binary is `100001011` which is `267`.\n\nYou can assume that the number is not negative.\n\nWrite Python code to solve this problem. Define a top-level function named `re... | [{"input": "2017", "output": "[1087]", "fn_name": "reverse_bits"}, {"input": "1023", "output": "[1023]", "fn_name": "reverse_bits"}, {"input": "417", "output": "[267]", "fn_name": "reverse_bits"}, {"input": "267", "output": "[417]", "fn_name": "reverse_bits"}, {"input": "1024", "output": "[1]", "fn_name": "reverse_bits... | code_functional |
[
{
"content": "Recently Polycarp noticed that some of the buttons of his keyboard are malfunctioning. For simplicity, we assume that Polycarp's keyboard contains $26$ buttons (one for each letter of the Latin alphabet). Each button is either working fine or malfunctioning. \n\nTo check which buttons need replace... | [{"input": "1\nammsdsdadasdsadssadassadsadasdsadsadr\n", "output": "adrs\n"}, {"input": "1\nammsdsdadasdsadssadassadsadasdsadsadr\n", "output": "adrs\n"}, {"input": "1\nammsdsdaeasdsadssadassadsadasdsadsads\n", "output": "ades\n"}, {"input": "1\nmlsjmksjfksjfkrjjksfnfksjfsksjdf\n", "output": "dfjklmnrs\n"}, {"input": "... | code_stdio |
[
{
"content": "Arkady is playing Battleship. The rules of this game aren't really important.\n\nThere is a field of $n \\times n$ cells. There should be exactly one $k$-decker on the field, i.Β e. a ship that is $k$ cells long oriented either horizontally or vertically. However, Arkady doesn't know where it is lo... | [{"input": "19 6\n##..............###\n#......#####.....##\n.....#########.....\n....###########....\n...#############...\n..###############..\n.#################.\n.#################.\n.#################.\n.#################.\n#####....##....####\n####............###\n###............####\n#####...####...####\n.#####..... | code_stdio |
[
{
"content": "Little Chris knows there's no fun in playing dominoes, he thinks it's too random and doesn't require skill. Instead, he decided to play with the dominoes and make a \"domino show\".\n\nChris arranges n dominoes in a line, placing each piece vertically upright. In the beginning, he simultaneously p... | [{"input": "400\n.L.R.LR.LRL.R.LR.LR..L....RLR.L..R..LRLRLR.LRL..RLR.LRLRLRLR.LR..LRL.RLR...LRLR.LRL.R.LR..LR.LRLR...LRLRL.R.L.....RL..RL.RLRL.RL.RL...RL..R.LRLRL..R.LRL...R..LRL.RLRL...RL..RLRLRLRL.R..LRL.R..LRLRL.R.L.R.L.RL.RLRLRL....R.LR..L..RL.RL.RLRLR.L..RLRL.RLR..LRLR.L.R..L.R.LR.LRL.....RLRL..RL..RLR.......LRLRL... | code_stdio |
[
{
"content": "There is always an integer in Takahashi's mind.\nInitially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is + or -. When he eats +, the integer in his mind increases by 1; when he eats -, the integer in his mind decreases by 1.\nThe symbols Takaha... | [{"input": "-+--\n", "output": "-2\n"}, {"input": "----\n", "output": "-4\n"}, {"input": "--+-\n", "output": "-2\n"}, {"input": "+---\n", "output": "-2\n"}, {"input": "+-++\n", "output": "2\n"}, {"input": "++++\n", "output": "4\n"}, {"input": "++-+\n", "output": "2\n"}, {"input": "-++-\n", "output": "0\n"}, {"input": "... | code_stdio |
[
{
"content": "# Description\n\nGiven a number `n`, you should find a set of numbers for which the sum equals `n`. This set must consist exclusively of values that are a power of `2` (eg: `2^0 => 1, 2^1 => 2, 2^2 => 4, ...`).\n\nThe function `powers` takes a single parameter, the number `n`, and should return an... | [{"input": "9007199254740991", "output": "[[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824, 2147483648, 4294967296, 8589934592, 17179869184, 34359738... | code_functional |
[
{
"content": "As the title suggests, this is the hard-core version of another neat kata.\n\nThe task is simple to explain: simply sum all the numbers from the first parameter being the beginning to the second parameter being the upper limit (possibly included), going in steps expressed by the third parameter:\... | [{"input": "20\n673388797\n5", "output": "[45345247259849570]", "fn_name": "sequence_sum"}, {"input": "780\n6851543\n5", "output": "[4694363402480]", "fn_name": "sequence_sum"}, {"input": "9383\n71418\n2", "output": "[1253127200]", "fn_name": "sequence_sum"}, {"input": "-24\n-2\n22", "output": "[-26]", "fn_name": "sequ... | code_functional |
[
{
"content": "Seisu-ya, a store specializing in non-negative integers, sells N non-negative integers. The i-th integer is A_i and has a utility of B_i. There may be multiple equal integers with different utilities.\n\nTakahashi will buy some integers in this store. He can buy a combination of integers whose bit... | [{"input": "7 17\n0 13\n13 1\n11 3\n4 5\n11 6\n-1 1\n2 -1", "output": "27\n"}, {"input": "7 20\n-1 0\n11 3\n35 2\n1 10\n4 6\n-1 0\n3 -1", "output": "18\n"}, {"input": "7 20\n-1 0\n11 5\n35 2\n1 10\n4 6\n-1 0\n3 -1", "output": "20\n"}, {"input": "7 20\n-1 -1\n3 0\n35 4\n1 10\n4 6\n-1 0\n3 -1", "output": "15\n"}, {"input... | code_stdio |
[
{
"content": "This is the easier version of the problem. In this version, $1 \\le n \\le 10^5$ and $0 \\le a_i \\le 1$. You can hack this problem only if you solve and lock both problems.\n\nChristmas is coming, and our protagonist, Bob, is preparing a spectacular present for his long-time best friend Alice. Th... | [{"input": "100\n1 1 0 1 1 1 1 0 1 0 0 1 1 1 1 1 0 1 0 1 0 1 1 1 1 1 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 0 0 1 0 1 0 1 1 0 0 1 0 0 1 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 0 1 0 1 1 1 1\n", "output": "1908\n"}, {"input": "100\n1 1 0 1 1 1 1 0 1 0 0 1 1 1 1 1 0 1 0 1 0 1 1 1 1 1 0 1 1 1 1 ... | code_stdio |
[
{
"content": "Given is a simple undirected graph with N vertices and M edges.\nIts vertices are numbered 1, 2, \\ldots, N and its edges are numbered 1, 2, \\ldots, M.\nOn Vertex i (1 \\leq i \\leq N) two integers A_i and B_i are written.\nEdge i (1 \\leq i \\leq M) connects Vertices U_i and V_i.\nSnuke picks ze... | [{"input": "300 300\n599720 331719 986622 302202 64836 630708 260908 557550 679660 315022 939160 133005 77222 687214 693973 196526 652034 173431 482644 484812 94312 433438 906407 324065 596747 112756 754441 540417 983349 160127 708834 39489 589887 615607 667029 767736 450291 829668 192526 414428 183234 555305 240890 48... | code_stdio |
[
{
"content": "Read problems statements in Mandarin Chinese, Russian and Vietnamese as well. \n\nChef's team is going to participate at the legendary math battles. One of the main task in the competition is to calculate the number of ways to create a number by adding some Chefonacci numbers. A number is called a... | [{"input": "5\n-2 -8\n11 0\n109 35\n0 -2\n-4 0", "output": "0\n0\n4375\n0\n0\n"}, {"input": "5\n-3 0\n11 1\n148 35\n0 -2\n-4 0", "output": "0\n0\n18334\n0\n0\n"}, {"input": "5\n-3 0\n5 1\n148 35\n0 -2\n-4 0", "output": "0\n1\n18334\n0\n0\n"}, {"input": "5\n-2 -8\n5 0\n70 12\n0 -2\n-4 0", "output": "0\n0\n279\n0\n0\n"},... | code_stdio |
[
{
"content": "Take debugging to a whole new level:\n\nGiven a string, remove every *single* bug.\n\nThis means you must remove all instances of the word 'bug' from within a given string, *unless* the word is plural ('bugs').\n\nFor example, given 'obugobugobuoobugsoo', you should return 'ooobuoobugsoo'.\n\nAnot... | [{"input": "\"oaisjdfowjefpoibugsjsofijeo oi bugs o bug f bug poaj sfd s\"", "output": "[\"oaisjdfowjefpoibugsjsofijeo oi bugs o f poaj sfd s\"]", "fn_name": "debug"}, {"input": "\"oaiwjefbugoijoijapsbugsdoibugbugjfoijasdfbugsbug\"", "output": "[\"oaiwjefoijoijapsbugsdoijfoijasdfbugs\"]", "fn_name": "debug"}, {"input... | code_functional |
[
{
"content": "Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes.\n\nStrictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 β€ x β€ x_2 and y_1 β€ y β€ y_2,... | [{"input": "2\n240945287 28477772 1496174734 106174079\n", "output": "97526692469552229\n"}, {"input": "2\n240945287 28477772 1496174734 174902664\n", "output": "96930557139611326\n"}, {"input": "2\n240945287 45763153 1496174734 174902664\n", "output": "95788985238816963\n"}, {"input": "2\n186213023 151398020 526707498... | code_stdio |
[
{
"content": "Johnny drives a truck and must deliver a package from his hometown to the district center. His hometown is located at point 0 on a number line, and the district center is located at the point d.\n\nJohnny's truck has a gas tank that holds exactly n liters, and his tank is initially full. As he dri... | [{"input": "281 12 23\n178 650197\n129 288456\n34 924882\n43 472160\n207 957083\n103 724815\n167 308008\n135 906958\n74 242828\n229 146026\n85 241042\n22 39127\n62 47524\n113 760274\n156 562141\n10 209057\n50 714473\n201 164128\n97 624021\n120 102709\n147 388268\n219 933977\n190 950684\n", "output": "-1\n"}, {"input": ... | code_stdio |
[
{
"content": "Kevin Sun has just finished competing in Codeforces Round #334! The round was 120 minutes long and featured five problems with maximum point values of 500, 1000, 1500, 2000, and 2500, respectively. Despite the challenging tasks, Kevin was uncowed and bulldozed through all of them, distinguishing h... | [{"input": "119 119 119 119 119\n10 10 10 10 10\n0 20\n", "output": "1310\n"}, {"input": "119 119 119 119 119\n10 10 10 10 10\n0 20\n", "output": "1310\n"}, {"input": "78 119 119 119 119\n10 10 10 10 10\n0 20\n", "output": "1310\n"}, {"input": "78 119 176 119 119\n10 10 10 10 10\n0 20\n", "output": "1310\n"}, {"input":... | code_stdio |
[
{
"content": "For given integer n, count the totatives of n, that is, the positive integers less than or equal to n that are relatively prime to n.\n\n\n\nInput\n\n\nn\n\n\nAn integer n (1 β€ n β€ 1000000000).\n\nOutput\n\nThe number of totatives in a line.\n\nExamples\n\nInput\n\n6\n\n\nOutput\n\n2\n\n\nInput\n\... | [{"input": "1101011", "output": "1084512\n"}, {"input": "1100111", "output": "1097712\n"}, {"input": "1010111", "output": "1003752\n"}, {"input": "1111111", "output": "1106224\n"}, {"input": "1011001", "output": "1011000\n"}, {"input": "1100101", "output": "1100100\n"}, {"input": "1101101", "output": "1037232\n"}, {"in... | code_stdio |
[
{
"content": "Allen is hosting a formal dinner party. $2n$ people come to the event in $n$ pairs (couples). After a night of fun, Allen wants to line everyone up for a final picture. The $2n$ people line up, but Allen doesn't like the ordering. Allen prefers if each pair occupies adjacent positions in the line,... | [{"input": "86\n33 6 22 8 54 43 57 85 70 41 20 17 35 12 66 25 45 78 67 55 50 19 31 75 77 29 58 78 34 15 40 48 14 82 6 37 44 53 62 23 56 22 34 18 71 83 21 80 47 38 3 42 60 9 73 49 84 7 76 30 5 4 11 28 69 16 26 10 59 48 64 46 32 68 24 63 79 36 13 1 27 61 39 74 2 51 51 2 74 39 61 27 1 13 36 79 86 24 68 32 46 64 63 59 10 2... | code_stdio |
[
{
"content": "Consider the following array:\n\n```\n[1, 12, 123, 1234, 12345, 123456, 1234567, 12345678, 123456789, 12345678910, 1234567891011...]\n```\n\nIf we join these blocks of numbers, we come up with an infinite sequence which starts with `112123123412345123456...`. The list is infinite.\n\nYou will be g... | [{"input": "1000000000000000000", "output": "[1]", "fn_name": "solve"}, {"input": "999999999999999999", "output": "[4]", "fn_name": "solve"}, {"input": "999999999999999993", "output": "[7]", "fn_name": "solve"}, {"input": "123456789", "output": "[3]", "fn_name": "solve"}, {"input": "123456", "output": "[6]", "fn_name":... | code_functional |
[
{
"content": "Your wizard cousin works at a Quidditch stadium and wants you to write a function that calculates the points for the Quidditch scoreboard! \n\n# Story\n\nQuidditch is a sport with two teams. The teams score goals by throwing the Quaffle through a hoop, each goal is worth **10 points**.\n\nThe refe... | [{"input": "\"Caerphilly Catapults vs Wigtown Wanderers\"\n\"Caerphilly Catapults: Quaffle goal, Caerphilly Catapults: Quaffle goal, Caerphilly Catapults: Quaffle goal, Caerphilly Catapults: Quaffle goal, Caerphilly Catapults: Quaffle goal, Caerphilly Catapults: Quaffle goal, Wigtown Wanderers: Quaffle goal, Caerphilly... | code_functional |
[
{
"content": "You are given several queries. In the i-th query you are given a single positive integer ni. You are to represent ni as a sum of maximum possible number of composite summands and print this maximum number, or print -1, if there are no such splittings.\n\nAn integer greater than 1 is composite, if ... | [{"input": "100\n611\n513\n544\n463\n38\n778\n116\n317\n848\n664\n440\n108\n718\n54\n334\n876\n234\n22\n944\n305\n159\n245\n513\n691\n639\n65\n308\n324\n813\n459\n164\n116\n331\n993\n184\n224\n853\n769\n121\n687\n93\n930\n751\n308\n485\n1386\n400\n695\n95\n751\n175\n972\n121\n654\n242\n610\n1074\n999\n237\n548\n742\n76... | code_stdio |
[
{
"content": "This is the easy version of the problem. The difference between the versions is in the constraints on the array elements. You can make hacks only if all versions of the problem are solved.\n\nYou are given an array [a_1, a_2, ..., a_n]. \n\nYour goal is to find the length of the longest subarray o... | [{"input": "100\n21 40 61 74 3 78 72 22 10 5 6 6 7 18 30 52 5 2 74 9 51 20 1 38 2 32 27 9 75 58 53 64 9 4 61 18 4 1 6 40 17 2 2 5 8 1 5 74 6 6 3 75 1 4 25 36 56 68 31 9 1 2 52 2 3 4 46 62 26 11 79 2 11 6 1 64 72 10 8 7 5 4 66 9 5 61 47 53 2 5 15 12 72 77 10 3 4 47 8 1\n", "output": "82\n"}, {"input": "100\n21 40 61 74 ... | code_stdio |
[
{
"content": "3R2 as DJ Mashiro - Happiness Breeze Ice - DJ Mashiro is dead or alive\n\nNEKO#Ξ¦ΟΞ¦ has just got a new maze game on her PC!\n\nThe game's main puzzle is a maze, in the forms of a $2 \\times n$ rectangle grid. NEKO's task is to lead a Nekomimi girl from cell $(1, 1)$ to the gate at $(2, n)$ and esca... | [{"input": "10 83\n1 3\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n1 4\n2 2\n2 3\n2 3\n2 3\n2 3\n2 3\n2 3\n1 4\n1 5\n1 7\n2 2\n2 2\n1 5\n2 2\n1 3\n2 1\n2 6\n1 5\n2 6\n2 9\n1 2\n2 5\n1 2\n2 5\n2 4\n2 4\n1 2\n1 2\n1 4\n2 6\n2 6\n2 4\n2 4\n1 2\n1 2\n2 4\n2 4\n2 3\n2 3\n1 2\n2 9\n1 2\n1 2\n1 2\n2 6\n2 6\n2 4\n2 4\n2 3\n2 5\n2 5\n2... | code_stdio |
[
{
"content": "There is a legend in the IT City college. A student that failed to answer all questions on the game theory exam is given one more chance by his professor. The student has to play a game with the professor.\n\nThe game is played on a square field consisting of n Γ n cells. Initially all cells are e... | [{"input": "1250846005844530517\n", "output": "1\n"}, {"input": "1000001000000000000\n", "output": "2\n"}, {"input": "2039244416399039339\n", "output": "1\n"}, {"input": "1000001000000001000\n", "output": "2\n"}, {"input": "1172500685464575937\n", "output": "1\n"}, {"input": "1639416648470331605\n", "output": "1\n"}, {... | code_stdio |
[
{
"content": "Implement a function which behaves like the uniq command in UNIX.\n\nIt takes as input a sequence and returns a sequence in which all duplicate elements following each other have been reduced to one instance.\n\nExample:\n\n```\n[\"a\", \"a\", \"b\", \"b\", \"c\", \"a\", \"b\", \"c\"] => [\"a\",... | [{"input": "[\"a\", \"a\", \"b\", \"b\", \"c\", \"a\", \"b\", \"c\", \"c\"]", "output": "[[\"a\", \"b\", \"c\", \"a\", \"b\", \"c\"]]", "fn_name": "uniq"}, {"input": "[\"a\", \"a\", \"a\", \"b\", \"b\", \"b\", \"c\", \"c\", \"c\"]", "output": "[[\"a\", \"b\", \"c\"]]", "fn_name": "uniq"}, {"input": "[null, \"a\", \"a\"... | code_functional |
[
{
"content": "## Fixed xor\n\nWrite a function that takes two hex strings as input and XORs them against each other. If the strings are different lengths the output should be the length of the shortest string.\n\nHint: The strings would first need to be converted to binary to be XOR'd. \n\n## Note:\nIf the two ... | [{"input": "\"1c0111001f010100061a024b53535009181c\"\n\"686974207468652062756c6c277320657965\"", "output": "[\"746865206b696420646f6e277420706c6179\"]", "fn_name": "fixed_xor"}, {"input": "\"7d1e875da9d5e89b54c7eaf\"\n\"3541599be591709795cebd5\"", "output": "[\"485fdec64c44980cc10957a\"]", "fn_name": "fixed_xor"}, {"in... | code_functional |
[
{
"content": "When preparing a tournament, Codeforces coordinators try treir best to make the first problem as easy as possible. This time the coordinator had chosen some problem and asked $n$ people about their opinions. Each person answered whether this problem is easy or hard.\n\nIf at least one of these $n$... | [{"input": "100\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "EASY\n"}, {"input": "100\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... | code_stdio |
[
{
"content": "## Task:\n\nYour task is to write a function which returns the sum of following series upto nth term(parameter).\n\n Series: 1 + 1/4 + 1/7 + 1/10 + 1/13 + 1/16 +...\n \n## Rules:\n \n* You need to round the answer to 2 decimal places and return it as String.\n\n* If the given value is 0 then it... | [{"input": "15", "output": "[\"1.94\"]", "fn_name": "series_sum"}, {"input": "39", "output": "[\"2.26\"]", "fn_name": "series_sum"}, {"input": "58", "output": "[\"2.40\"]", "fn_name": "series_sum"}, {"input": "1", "output": "[\"1.00\"]", "fn_name": "series_sum"}, {"input": "2", "output": "[\"1.25\"]", "fn_name": "serie... | code_functional |
[
{
"content": "Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process.\n\nThere are n + 1 cities consecutively numbered from 0 to n. City 0 is Metropolis that ... | [{"input": "10 10 1\n351 0 3 7\n214 0 9 9\n606 0 7 8\n688 0 9 3\n188 3 0 9\n994 0 1 7\n372 5 0 14\n957 0 3 6\n458 8 0 7\n379 0 4 7\n", "output": "-1\n"}, {"input": "4 10 1\n988 0 1 1\n507 1 0 9\n798 1 0 9\n400 0 3 7\n242 2 0 8\n574 4 0 7\n458 0 4 9\n330 0 2 9\n303 2 0 8\n293 0 3 13\n", "output": "-1\n"}, {"input": "10 ... | code_stdio |
[
{
"content": "Pay attention to the non-standard memory limit in this problem.\n\nIn order to cut off efficient solutions from inefficient ones in this problem, the time limit is rather strict. Prefer to use compiled statically typed languages (e.g. C++). If you use Python, then submit solutions on PyPy. Try to ... | [{"input": "7\n2\n1 1\n2\n1 2\n2\n2 1\n2\n2 2\n12\n5 8 10 1 1 10 7 3 12 3 3 7\n5\n2 1 3 1 3\n4\n4 3 4 3\n", "output": "0\n0\n0\n0\n3\n2\n0\n"}, {"input": "7\n2\n1 1\n2\n1 2\n2\n2 1\n2\n2 2\n12\n5 8 10 1 1 10 7 3 12 3 3 7\n5\n2 1 3 1 3\n4\n4 3 4 3\n", "output": "0\n0\n0\n0\n3\n2\n0\n"}, {"input": "7\n2\n1 1\n2\n1 2\n2\n... | code_stdio |
[
{
"content": "Katsusando loves omelette rice.\nBesides, he loves crème brûlée, tenderloin steak and so on, and believes that these foods are all loved by everyone.\nTo prove that hypothesis, he conducted a survey on M kinds of foods and asked N people whether they like these foods or not.\nThe i-th person answe... | [{"input": "30 30\n30 18 27 26 17 24 6 29 5 10 4 16 2 30 14 12 3 11 19 1 21 28 20 23 15 25 9 8 7 22 13\n30 2 18 10 9 23 8 13 12 6 3 4 19 15 16 29 22 21 7 25 5 20 17 14 28 24 11 27 30 26 1\n30 18 23 13 19 10 2 12 21 11 28 1 17 26 27 22 29 14 3 15 9 8 5 6 25 30 16 20 7 24 4\n30 16 12 23 7 20 17 25 8 2 10 28 5 6 21 13 19 ... | code_stdio |
[
{
"content": "Gildong is experimenting with an interesting machine Graph Traveler. In Graph Traveler, there is a directed graph consisting of n vertices numbered from 1 to n. The i-th vertex has m_i outgoing edges that are labeled as e_i[0], e_i[1], β¦, e_i[m_i-1], each representing the destination vertex of the... | [{"input": "4\n4 -9 -1 -1\n2\n2 3\n1\n2\n3\n2 4 1\n4\n3 1 2 1\n6\n1 -1\n3 -1\n3 -1\n4 -4\n2 1\n1 5\n", "output": "1\n1\n1\n1\n1\n1\n"}, {"input": "4\n4 -9 -1 -1\n2\n2 3\n1\n2\n3\n2 4 1\n4\n3 1 2 1\n6\n1 -1\n3 0\n3 -1\n4 -4\n2 1\n1 5\n", "output": "1\n1\n1\n1\n1\n1\n"}, {"input": "4\n4 -5 -3 -1\n2\n2 3\n1\n2\n3\n2 4 1\n... | code_stdio |
[
{
"content": "Imagine there's a big cube consisting of n^3 small cubes. Calculate, how many small cubes are not visible from outside.\n\nFor example, if we have a cube which has 4 cubes in a row, then the function should return 8, because there are 8 cubes inside our cube (2 cubes in each dimension)\n\nWrite Py... | [{"input": "10002", "output": "[1000000000000]", "fn_name": "not_visible_cubes"}, {"input": "12", "output": "[1000]", "fn_name": "not_visible_cubes"}, {"input": "18", "output": "[4096]", "fn_name": "not_visible_cubes"}, {"input": "7", "output": "[125]", "fn_name": "not_visible_cubes"}, {"input": "5", "output": "[27]", ... | code_functional |
[
{
"content": "After all the events in Orlando we all know, Sasha and Roma decided to find out who is still the team's biggest loser. Thankfully, Masha found somewhere a revolver with a rotating cylinder of n bullet slots able to contain exactly k bullets, now the boys have a chance to resolve the problem once a... | [{"input": "15 10 15\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n", "output": ".X.X.X.X.XXXXXX\n"}, {"input": "15 10 15\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n1\n14\n15\n", "output": ".X.X.X.X.XXX.XX"}, {"input": "15 10 15\n1\n2\n3\n3\n5\n6\n7\n8\n9\n10\n11\n12\n1\n14\n15\n", "output": ".X...X.X.XXX.XX"}, {"in... | code_stdio |
[
{
"content": "Folding a Ribbon\n\nThink of repetitively folding a very long and thin ribbon. First, the ribbon is spread out from left to right, then it is creased at its center, and one half of the ribbon is laid over the other. You can either fold it from the left to the right, picking up the left end of the ... | [{"input": "4 3 2\n30 578 1954\n59 471605241352156968 431565444592236940\n0 0 0", "output": "LRRR\nLLLLLRLLRLLLLLLLLLLRRRRLRLLLLL\nLRRRLRRLLRRRRLLLLRLLRRRLRRLLRLLLLLLRLRLLRLRLLLRLRLLRLLRRRLL\n"}, {"input": "4 3 2\n20 578 1954\n59 471605241352156968 431565444592236940\n0 0 0", "output": "LRRR\nLLLLLRLLRRRRRLRLLLLL\nLRRR... | code_stdio |
[
{
"content": "Ehab has an array $a$ of length $n$. He has just enough free time to make a new array consisting of $n$ copies of the old array, written back-to-back. What will be the length of the new array's longest increasing subsequence?\n\nA sequence $a$ is a subsequence of an array $b$ if $a$ can be obtaine... | [{"input": "4\n7\n6 6 12 8 6 6 6\n1\n2\n5\n4 5 9 2 7\n7\n1 2 7 1 6 20 2\n", "output": "3\n1\n5\n5\n"}, {"input": "4\n7\n6 6 12 8 6 5 6\n1\n2\n5\n4 5 9 2 7\n7\n1 2 7 1 6 20 2\n", "output": "4\n1\n5\n5\n"}, {"input": "4\n7\n6 6 8 8 6 6 6\n1\n2\n5\n4 5 9 8 7\n7\n1 2 7 1 6 10 2\n", "output": "2\n1\n5\n5\n"}, {"input": "4\n... | code_stdio |
[
{
"content": "Not so long ago company R2 bought company R1 and consequently, all its developments in the field of multicore processors. Now the R2 laboratory is testing one of the R1 processors.\n\nThe testing goes in n steps, at each step the processor gets some instructions, and then its temperature is measur... | [{"input": "100 99 1 2\n2 1 1 1 2 2 1 1 1 2 2 2 1 2 1 1 2 1 1 2 1 2 2 1 2 1 2 1 2 1 2 2 2 2 1 1 1 1 1 2 1 2 2 1 2 2 2 1 1 1 1 1 2 2 2 2 1 2 2 1 1 1 2 1 1 2 1 1 2 1 2 1 2 1 1 1 1 2 1 1 0 1 1 2 2 2 1 1 1 1 2 2 2 2 1 1 2 2 2\n", "output": "Incorrect\n"}, {"input": "100 99 1 2\n2 1 1 1 2 2 1 1 1 2 2 2 1 2 1 1 2 1 1 2 1 2 2... | code_stdio |
[
{
"content": "Zane the wizard had never loved anyone before, until he fell in love with a girl, whose name remains unknown to us.\n\n [Image] \n\nThe girl lives in house m of a village. There are n houses in that village, lining in a straight line from left to right: house 1, house 2, ..., house n. The village ... | [{"input": "100 1 100\n0 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 110 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": "In BerSoft $n$ programmers work, the programmer $i$ is characterized by a skill $r_i$.\n\nA programmer $a$ can be a mentor of a programmer $b$ if and only if the skill of the programmer $a$ is strictly greater than the skill of the programmer $b$ $(r_a > r_b)$ and programmers $a$ and $b$ are not i... | [{"input": "10 35\n322022227 751269818 629795150 369443545 344607287 250044294 476897672 184054549 986884572 917181121\n6 3\n7 3\n1 9\n7 9\n10 7\n3 4\n8 6\n7 4\n6 10\n7 2\n3 5\n6 9\n3 10\n8 7\n6 5\n8 1\n8 5\n1 7\n8 10\n8 2\n1 5\n10 4\n6 7\n4 6\n2 6\n5 4\n9 10\n9 2\n4 8\n5 9\n4 1\n3 2\n2 1\n4 2\n9 8\n", "output": "1 1 2... | code_stdio |
[
{
"content": "There are n cities in Bearland, numbered 1 through n. Cities are arranged in one long row. The distance between cities i and j is equal to |i - j|.\n\nLimak is a police officer. He lives in a city a. His job is to catch criminals. It's hard because he doesn't know in which cities criminals are. Th... | [{"input": "100 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 1\n", "output": "100\n"}, {"input": "100 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... | code_stdio |
[
{
"content": "Yurii is sure he can do everything. Can he solve this task, though?\n\nHe has an array $a$ consisting of $n$ positive integers. Let's call a subarray $a[l...r]$ good if the following conditions are simultaneously satisfied: $l+1 \\leq r-1$, i.Β e. the subarray has length at least $3$; $(a_l \\op... | [{"input": "10\n997230370 58052053 240970544 715275815 250707702 156801523 44100666 64791577 43523002 480196854\n", "output": "2\n"}, {"input": "10\n997230370 58052053 240970544 715275815 250707702 156801523 44100666 64791577 43523002 480196854\n", "output": "2"}, {"input": "10\n997230370 58052053 240970544 715275815 2... | code_stdio |
[
{
"content": "The tram in Berland goes along a straight line from the point 0 to the point s and back, passing 1 meter per t_1 seconds in both directions. It means that the tram is always in the state of uniform rectilinear motion, instantly turning around at points x = 0 and x = s.\n\nIgor is at the point x_1.... | [{"input": "1000 812 976\n230 1000\n1006 -1\n", "output": "164000\n"}, {"input": "1000 394 798\n155 1242\n954 -1\n", "output": "271560\n"}, {"input": "1000 812 976\n230 1000\n696 -1\n", "output": "164000\n"}, {"input": "1000 394 798\n155 1242\n934 -1\n", "output": "268460\n"}, {"input": "1000 812 976\n230 1000\n453 -1\... | code_stdio |
[
{
"content": "N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.\nThe i-th tile from the left is painted black if the i-th character of S is 0, and painted white if that character is 1.\nYou want to repaint some of the tiles black or white,... | [{"input": "01010000100110111100010011111100001010101111001100001010101000100101100011110011111110100011000001111011010011100010010111011001011000010110011100111010111111010100010111100100110000100010010011101001001110000100110101011001100000010111101101100100010011110010110010101100100011001010110010000101010101011000... | code_stdio |
[
{
"content": "Given are a sequence of N positive integers A_1, A_2, \\ldots, A_N, and a positive integer K.\nFind the number of non-empty contiguous subsequences in A such that the remainder when dividing the sum of its elements by K is equal to the number of its elements. We consider two subsequences different... | [{"input": "10 3\n14 26 111 65 35 89 184 32 38 46", "output": "4\n"}, {"input": "10 11\n14 26 111 0 35 27 95 13 38 63", "output": "12\n"}, {"input": "10 13\n14 15 101 65 35 89 95 32 38 46", "output": "6\n"}, {"input": "10 7\n14 15 92 65 35 89 79 32 38 46\n", "output": "8\n"}, {"input": "10 7\n14 15 101 65 35 89 79 32 3... | code_stdio |
[
{
"content": "There are $n$ slimes in a row. Each slime has an integer value (possibly negative or zero) associated with it.\n\nAny slime can eat its adjacent slime (the closest slime to its left or to its right, assuming that this slime exists). \n\nWhen a slime with a value $x$ eats a slime with a value $y$, ... | [{"input": "10\n-20 1 3 -5 -27 18 -3 -9 -7 9\n", "output": "102\n"}, {"input": "10\n-20 0 3 -5 -18 15 -3 -9 -7 9\n", "output": "89\n"}, {"input": "10\n-20 0 3 -5 -27 15 -3 -9 -7 9\n", "output": "98\n"}, {"input": "10\n-20 1 3 -5 -27 15 -3 -9 -7 9\n", "output": "99\n"}, {"input": "10\n-20 0 3 -5 -18 15 -3 -9 -7 9\n", "o... | code_stdio |
[
{
"content": "The sequence of $m$ integers is called the permutation if it contains all integers from $1$ to $m$ exactly once. The number $m$ is called the length of the permutation.\n\nDreamoon has two permutations $p_1$ and $p_2$ of non-zero lengths $l_1$ and $l_2$.\n\nNow Dreamoon concatenates these two perm... | [{"input": "6\n5\n1 4 3 2 1\n6\n2 4 1 3 3 1\n4\n2 1 1 2\n4\n1 3 3 1\n12\n2 1 3 5 5 6 7 8 9 1 10 2\n3\n1 2 1\n", "output": "2\n1 4\n4 1\n0\n1\n2 2\n0\n0\n2\n1 2\n2 1\n"}, {"input": "6\n5\n1 4 3 2 1\n6\n2 4 1 3 2 1\n4\n2 1 1 3\n4\n1 3 3 1\n12\n2 1 3 4 5 6 7 8 9 1 10 2\n3\n1 1 1\n", "output": "2\n1 4\n4 1\n1\n4 2\n0\n0\n1... | code_stdio |
[
{
"content": "There are N pieces of sushi. Each piece has two parameters: \"kind of topping\" t_i and \"deliciousness\" d_i.\nYou are choosing K among these N pieces to eat.\nYour \"satisfaction\" here will be calculated as follows:\n - The satisfaction is the sum of the \"base total deliciousness\" and the \"v... | [{"input": "1916 1626\n876 259545863\n275 561842149\n426 683968511\n234 568067978\n1649 76930683\n904 347657912\n1805 554767907\n151 166599168\n1652 995819129\n66 696036303\n1623 580173203\n739 759362608\n1877 78935906\n279 464616918\n217 367427797\n815 68145141\n1050 546297174\n1817 150025584\n508 799430434\n1766 6014... | code_stdio |
[
{
"content": "Appleman has a tree with n vertices. Some of the vertices (at least one) are colored black and other vertices are colored white.\n\nConsider a set consisting of k (0 β€ k < n) edges of Appleman's tree. If Appleman deletes these edges from the tree, then it will split into (k + 1) parts. Note, that ... | [{"input": "100\n0 0 2 2 0 3 5 0 6 2 0 4 0 2 3 7 8 3 15 19 13 8 18 19 3 14 23 9 6 3 6 17 26 24 20 6 4 27 8 5 14 5 35 31 27 3 41 25 20 14 25 31 49 40 0 1 10 5 50 13 29 58 1 6 8 1 40 52 30 15 50 8 66 52 29 71 25 68 36 7 80 60 6 2 11 43 62 27 84 86 71 38 14 50 88 4 8 95 53\n1 0 0 1 0 0 1 0 1 0 0 0 1 0 1 1 0 1 1 1 1 0 0 0 ... | code_stdio |
[
{
"content": "Write a program which reads a sequence of $n$ integers $a_i (i = 1, 2, ... n)$, and prints the minimum value, maximum value and sum of the sequence.\n\nConstraints\n\n* $0 < n \\leq 10000$\n* $-1000000 \\leq a_i \\leq 1000000$\n\nInput\n\nIn the first line, an integer $n$ is given. In the next lin... | [{"input": "5\n114 0 -15 -1 2", "output": "-15 114 100\n"}, {"input": "5\n114 -1 -15 -1 2", "output": "-15 114 99\n"}, {"input": "5\n112 -1 -15 -1 2", "output": "-15 112 97\n"}, {"input": "5\n112 1 -14 -1 2", "output": "-14 112 100\n"}, {"input": "5\n112 0 -15 -1 2", "output": "-15 112 98\n"}, {"input": "5\n112 1 -15 -... | code_stdio |
[
{
"content": "Madoka wants to enter to \"Novosibirsk State University\", but in the entrance exam she came across a very difficult task:\n\nGiven an integer $n$, it is required to calculate $\\sum{\\operatorname{lcm}(c, \\gcd(a, b))}$, for all triples of positive integers $(a, b, c)$, where $a + b + c = n$.\n\n... | [{"input": "100000\n", "output": "454535891\n"}, {"input": "69228\n", "output": "778304278\n"}, {"input": "94874\n", "output": "584783437\n"}, {"input": "99413\n", "output": "461761995\n"}, {"input": "99913\n", "output": "550761256\n"}, {"input": "1337\n", "output": "425608851\n"}, {"input": "228\n", "output": "3369368... | code_stdio |
[
{
"content": "The server in company A has a structure where N devices numbered 1, 2, ..., N are connected with N - 1 cables. The i-th cable connects Device U_i and Device V_i. Any two different devices are connected through some number of cables.\n\nEach device v (1 \\leq v \\leq N) has a non-zero integer A_v, ... | [{"input": "10\n5 4 15 5 1 5 -1 10 -10 -20\n10 4\n5 6\n8 1\n9 5\n7 1\n10 3\n2 8\n2 10\n9 1", "output": "1\n"}, {"input": "10\n3 4 9 6 1 10 -1 10 -10 -10\n7 4\n5 6\n8 1\n9 5\n7 1\n10 3\n2 8\n4 10\n9 2", "output": "4\n"}, {"input": "10\n3 4 9 6 0 10 -1 10 -10 -10\n7 4\n5 6\n8 1\n9 5\n7 1\n10 3\n2 8\n4 10\n9 2", "output":... | code_stdio |
[
{
"content": "Floating-Point Numbers\n\nIn this problem, we consider floating-point number formats, data representation formats to approximate real numbers on computers.\n\nScientific notation is a method to express a number, frequently used for numbers too large or too small to be written tersely in usual deci... | [{"input": "1\n0000000000100000000000000000000000000000000000000000\n2\n0000000000000000000000000000000000000000000000000000\n2\n0000000000000000001000000000000000000000000000000000\n11\n0000000000000000000000000000000000000000000000000000\n7\n1101000000000000000000000000000000000000000000000000\n100\n11000110101000011... | code_stdio |
[
{
"content": "You are given n integer numbers a_1, a_2, ..., a_n. Consider graph on n nodes, in which nodes i, j (iβ j) are connected if and only if, a_i AND a_jβ 0, where AND denotes the [bitwise AND operation](https://en.wikipedia.org/wiki/Bitwise_operation#AND).\n\nFind the length of the shortest cycle in th... | [{"input": "150\n0 0 0 0 0 0 0 2537672836907008 0 0 0 0 0 0 16384 0 0 0 0 34360787232 0 0 70871155232 0 0 0 0 0 0 0 0 0 0 0 2256197860262016 0 0 0 0 0 0 0 0 0 0 536872961 0 0 0 0 0 0 0 0 0 0 33619968 0 0 0 0 0 0 0 0 0 0 0 0 37189881297899520 0 18031990695526400 0 0 1099511627776 0 0 0 0 0 0 0 0 2097152 0 0 0 134217984 ... | code_stdio |
[
{
"content": "Chain Disappearance Puzzle\n\nWe are playing a puzzle. An upright board with H rows by 5 columns of cells, as shown in the figure below, is used in this puzzle. A stone engraved with a digit, one of 1 through 9, is placed in each of the cells. When three or more stones in horizontally adjacent cel... | [{"input": "1\n6 9 9 9 9\n5\n3 9 6 0 12\n5 6 6 9 9\n4 6 3 10 15\n3 2 2 14 9\n2 2 1 1 1\n10\n3 10 6 5 6\n2 4 1 8 3\n6 2 7 9 2\n8 7 7 6 1\n7 9 6 4 9\n8 9 1 1 10\n5 6 1 8 0\n6 8 2 1 2\n9 6 3 3 5\n5 3 8 8 8\n5\n1 2 3 4 5\n6 7 8 9 1\n2 3 4 5 6\n7 8 9 1 2\n4 4 1 6 12\n3\n2 2 4 7 4\n6 5 7 7 7\n8 8 2 9 9\n0", "output": "36\n9\... | code_stdio |
[
{
"content": "Vasya adores sport programming. He can't write programs but he loves to watch the contests' progress. Vasya even has a favorite coder and Vasya pays special attention to him.\n\nOne day Vasya decided to collect the results of all contests where his favorite coder participated and track the progres... | [{"input": "100\n9999 9999 9999 9998 9998 9998 9997 9996 9996 9995 9993 9993 9991 9990 9989 9986 9984 9984 9983 9981 9981 10079 9980 9980 9979 9977 9977 9977 9977 9977 9976 9976 9975 9975 9973 9972 9972 9972 9972 9971 9969 9969 9969 9968 9967 9965 9962 9962 9962 9962 9960 9958 9958 9955 9954 9954 9954 9954 9950 9949 99... | code_stdio |
[
{
"content": "It is known that the area of a regular dodecagon inscribed in a circle of radius a is 3a^2.\nGiven an integer r, find the area of a regular dodecagon inscribed in a circle of radius r.\n\n-----Constraints-----\n - 1 \\leq r \\leq 100\n - r is an integer.\n\n-----Input-----\nInput is given from Sta... | [{"input": "100\n", "output": "30000\n"}, {"input": "270", "output": "218700\n"}, {"input": "256", "output": "196608\n"}, {"input": "203", "output": "123627\n"}, {"input": "196", "output": "115248\n"}, {"input": "251", "output": "189003\n"}, {"input": "397", "output": "472827\n"}, {"input": "239", "output": "171363\n"}... | code_stdio |
[
{
"content": "Berland has a long and glorious history. To increase awareness about it among younger citizens, King of Berland decided to compose an anthem.\n\nThough there are lots and lots of victories in history of Berland, there is the one that stand out the most. King wants to mention it in the anthem as ma... | [{"input": "????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????\nrcmcsc... | code_stdio |
[
{
"content": "## The galactic games have begun!\n\nIt's the galactic games! Beings of all worlds come together to compete in several interesting sports, like nroogring, fredling and buzzing (the beefolks love the last one). However, there's also the traditional marathon run.\n\nUnfortunately, there have been ch... | [{"input": "50000000000000000000000000000000000000000", "output": "[583333333333333333333333333333333333333291666666666666666666666666666666666666668]", "fn_name": "solution"}, {"input": "50000000", "output": "[583333291666668]", "fn_name": "solution"}, {"input": "1000000", "output": "[233333166668]", "fn_name": "solut... | code_functional |
[
{
"content": "In olden days finding square roots seemed to be difficult but nowadays it can be easily done using in-built functions available across many languages \n.\n\nAssume that you happen to hear the above words and you want to give a try in finding the square root of any given integer using in-built func... | [{"input": "3\n18\n10\n10000", "output": "4\n3\n100\n"}, {"input": "3\n17\n16\n10010", "output": "4\n4\n100\n"}, {"input": "3\n10\n5\n10010", "output": "3\n2\n100\n"}, {"input": "3\n1\n11\n10000", "output": "1\n3\n100\n"}, {"input": "3\n10\n2\n10100", "output": "3\n1\n100\n"}, {"input": "3\n1\n12\n11100", "output": "1\... | code_stdio |
[
{
"content": "Some time ago Mister B detected a strange signal from the space, which he started to study.\n\nAfter some transformation the signal turned out to be a permutation p of length n or its cyclic shift. For the further investigation Mister B need some basis, that's why he decided to choose cyclic shift... | [{"input": "108\n1 102 33 99 6 83 4 20 61 100 76 71 44 9 24 87 57 2 81 82 90 85 12 30 66 53 47 36 43 29 31 64 96 84 77 23 93 78 58 68 42 55 13 70 62 19 92 14 10 65 63 75 91 48 11 105 37 50 32 94 18 26 52 89 104 106 86 97 80 95 17 72 40 22 79 103 25 101 35 51 15 98 67 5 34 69 54 27 45 88 56 16 46 60 74 108 21 41 73 39 1... | code_stdio |
[
{
"content": "We have two distinct integers A and B.\nPrint the integer K such that |A - K| = |B - K|.\nIf such an integer does not exist, print IMPOSSIBLE instead.\n\n-----Constraints-----\n - All values in input are integers.\n - 0 \\leq A,\\ B \\leq 10^9\n - A and B are distinct.\n\n-----Input-----\nInput is... | [{"input": "999999999 1000000000\n", "output": "IMPOSSIBLE\n"}, {"input": "369673908 845644227\n", "output": "IMPOSSIBLE\n"}, {"input": "232334010 962483782\n", "output": "597408896\n"}, {"input": "274100628 29096111\n", "output": "IMPOSSIBLE\n"}, {"input": "467793935 691627457\n", "output": "579710696\n"}, {"input": "... | code_stdio |
[
{
"content": "Of the real numbers, those with a circular decimal part and those with a finite number of digits can be expressed as fractions.\n\n\n\n\nGiven a real number that can be represented by a fraction, write a program that outputs an irreducible fraction equal to that real number (a fraction that cannot... | [{"input": "3.2(145)", "output": "32113/9990\n"}, {"input": "3.3(145)", "output": "16556/4995\n"}, {"input": "5.21(43)", "output": "25811/4950\n"}, {"input": "3.3(155)", "output": "16561/4995\n"}, {"input": "4.21(43)", "output": "20861/4950\n"}, {"input": "4.21(42)", "output": "13907/3300\n"}, {"input": "4.21(32)", "ou... | code_stdio |
[
{
"content": "Vasiliy is fond of solving different tasks. Today he found one he wasn't able to solve himself, so he asks you to help.\n\nVasiliy is given n strings consisting of lowercase English letters. He wants them to be sorted in lexicographical order (as in the dictionary), but he is not allowed to swap a... | [{"input": "10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\naaaaaaaaaaab\nab\naab\naaab\naaaab\naaaaab\naaaaaab\naaaaaaab\naaaaaaaab\naaaaaaaaab\n", "output": "8000000000\n"}, {"input": "10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000... | code_stdio |
[
{
"content": "You are given $n$ one-dimensional segments (each segment is denoted by two integers β its endpoints).\n\nLet's define the function $f(x)$ as the number of segments covering point $x$ (a segment covers the point $x$ if $l \\le x \\le r$, where $l$ is the left endpoint and $r$ is the right endpoint ... | [{"input": "9\n4 3\n1 3\n7 9\n2 5\n3 6\n2 9\n1 4\n3 7\n1 3\n2 4\n3 5\n1 4\n6 7\n5 5\n4 3\n1 3\n7 9\n2 5\n3 6\n2 9\n1 4\n3 7\n1 3\n2 4\n3 5\n1 4\n6 7\n5 5\n1 4\n3 7\n", "output": "YES\nNO\nNO\nYES\nYES\nNO\nNO\nYES\nNO\n"}, {"input": "4\n4 3\n1 3\n7 9\n2 5\n3 6\n2 9\n1 4\n3 7\n1 3\n2 4\n3 5\n1 4\n6 7\n5 5\n", "output": ... | code_stdio |
[
{
"content": "The restaurant AtCoder serves the following five dishes:\n - ABC Don (rice bowl): takes A minutes to serve.\n - ARC Curry: takes B minutes to serve.\n - AGC Pasta: takes C minutes to serve.\n - APC Ramen: takes D minutes to serve.\n - ATC Hanbagu (hamburger patty): takes E minutes to serve.\nHere,... | [{"input": "123\n123\n123\n123\n123\n", "output": "643\n"}, {"input": "123\n123\n161\n123\n123", "output": "681\n"}, {"input": "123\n123\n161\n123\n163", "output": "721\n"}, {"input": "123\n123\n161\n123\n263", "output": "821\n"}, {"input": "101\n86\n119\n108\n57\n", "output": "481\n"}, {"input": "123\n123\n40\n123\n26... | code_stdio |
[
{
"content": "Fox Ciel is playing a game. In this game there is an infinite long tape with cells indexed by integers (positive, negative and zero). At the beginning she is standing at the cell 0.\n\nThere are also n cards, each card has 2 attributes: length li and cost ci. If she pays ci dollars then she can ap... | [{"input": "35\n512 172290165 12 128 134217728 8192 33554432 33554432 536870912 512 65536 1048576 32768 512 524288 1024 536870912 536870912 16 32 33554432 134217728 2 16 16777216 8192 262144 65536 33554432 128 4096 2097152 33554432 2097152 2\n36157 67877 79710 63062 13319 36255 61053 83828 93590 74236 5281 28143 7350 4... | code_stdio |
[
{
"content": "Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself.\n\nRecently Xenia has bought $n_r$ red gems, $n_g$ green gems and $n_b$ blue gems. Each of the gems has a weight.\n\nNow, she is going to pick three gems.\n\nXeni... | [{"input": "1\n10 10 10\n761 829 1037 1818 133 576 705 131 935 821\n896 163 569 957 169 475 342 1074 760 434\n131 383 243 247 908 799 56 1929 360 189\n", "output": "1928\n"}, {"input": "1\n10 10 10\n761 829 1037 1818 133 576 705 131 935 821\n896 163 569 656 169 475 342 1074 760 434\n131 383 243 247 908 799 56 1929 360 ... | code_stdio |
[
{
"content": "Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.\n\nDuring all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several... | [{"input": "100\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "100\n"}, {"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... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.