messages listlengths 1 1 | ground_truth stringlengths 156 726k | dataset stringclasses 2
values |
|---|---|---|
[
{
"content": "Given an integer N not less than 3, find the sum of the interior angles of a regular polygon with N sides.\n\nPrint the answer in degrees, but do not print units.\n\nConstraints\n\n* 3 \\leq N \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\n\nN\n\n\nOutput\n\nP... | [{"input": "-636", "output": "-114840\n"}, {"input": "-729", "output": "-131580\n"}, {"input": "-102", "output": "-18720\n"}, {"input": "-161", "output": "-29340\n"}, {"input": "-151", "output": "-27540\n"}, {"input": "-119", "output": "-21780\n"}, {"input": "-135", "output": "-24660\n"}, {"input": "-246", "output": "-... | code_stdio |
[
{
"content": "---\n\n# Story\n\nThe Pied Piper has been enlisted to play his magical tune and coax all the rats out of town.\n\nBut some of the rats are deaf and are going the wrong way!\n\n# Kata Task\n\nHow many deaf rats are there?\n\n# Legend\n\n* ```P``` = The Pied Piper\n* ```O~``` = Rat going left\n* ```... | [{"input": "\"O~~OO~~OO~~OO~P~OO~~OO~~OO~~O\"", "output": "[8]", "fn_name": "count_deaf_rats"}, {"input": "\" P \"", "output": "[0]", "fn_name": "count_deaf_rats"}, {"input": "\"~O~O~O~OP~O~OO~\"", "output": "[2]", "fn_name": "count_deaf_rats"}, {"input": "\"P O~ O~ ~O O~\"", "output": "[1]", "fn_name": "c... | code_functional |
[
{
"content": "Little Petya loves looking for numbers' divisors. One day Petya came across the following problem:\n\nYou are given n queries in the form \"xi yi\". For each query Petya should count how many divisors of number xi divide none of the numbers xi - yi, xi - yi + 1, ..., xi - 1. Help him.\n\nInput\n\n... | [{"input": "20\n68260 0\n1140 1\n54174 1\n20460 1\n25696 2\n81647 4\n26528 4\n91307 5\n5210 4\n87730 2\n4653 8\n11044 6\n15776 4\n17068 7\n73738 7\n36004 12\n83183 7\n75700 12\n84270 14\n16120 5\n", "output": "12\n18\n4\n44\n18\n1\n6\n7\n6\n12\n8\n8\n21\n3\n14\n3\n3\n13\n19\n26\n"}, {"input": "20\n68260 0\n819 1\n54174... | code_stdio |
[
{
"content": "The math faculty of Berland State University has suffered the sudden drop in the math skills of enrolling students. This year the highest grade on the entrance math test was 8. Out of 100! Thus, the decision was made to make the test easier.\n\nFuture students will be asked just a single question.... | [{"input": "100\n1 2 1 2 1 2 1 2 1 3 1 3 1 2 1 3 1 2 1 3 1 2 1 3 1 2 1 2 1 3 1 2 1 2 1 3 1 3 1 2 1 2 1 3 1 2 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 2 1 3 1 3 1 3 1 2 1 2 1 2 1 2 1 2 1 2 1 3 1 3 1 2 1 2 1 2 1 3 1 2 1 3 1 2 1 2\n", "output": "Finite\n331\n"}, {"input": "100\n2 1 3 1 3 1 3 1 2 1 2 1 3 1 2 1 3 1 2 1 3 1 2 1 3 1 3 1... | code_stdio |
[
{
"content": "ABC Gene\n\nThere is a gene sequence represented by the string `ABC`. You can rewrite this gene sequence by performing the following operations several times.\n\n* Choose one of the letters `A`,` B`, `C`. Let this be x. Replace all x in the gene sequence with `ABC` at the same time.\n\n\n\nGiven a... | [{"input": "BAC", "output": "No\n"}, {"input": "ACB", "output": "No\n"}, {"input": "CAB", "output": "No\n"}, {"input": "CBA", "output": "No\n"}, {"input": "ACA", "output": "No\n"}, {"input": "BCA", "output": "No\n"}, {"input": "BAB", "output": "No\n"}, {"input": "ABA", "output": "No\n"}, {"input": "BAA", "output": "No\... | code_stdio |
[
{
"content": "Mr. Funt now lives in a country with a very specific tax laws. The total income of mr. Funt during this year is equal to n (n ≥ 2) burles and the amount of tax he has to pay is calculated as the maximum divisor of n (not equal to n, of course). For example, if n = 6 then Funt has to pay 3 burles, ... | [{"input": "2000000000\n", "output": "2\n"}, {"input": "1000000007\n", "output": "1\n"}, {"input": "1000000009\n", "output": "1\n"}, {"input": "1999999999\n", "output": "3\n"}, {"input": "1000000011\n", "output": "2\n"}, {"input": "1234567890\n", "output": "2\n"}, {"input": "1999999929\n", "output": "2\n"}, {"input": "... | code_stdio |
[
{
"content": "Vasya plays The Elder Trolls IV: Oblivon. Oh, those creators of computer games! What they do not come up with! Absolutely unique monsters have been added to the The Elder Trolls IV: Oblivon. One of these monsters is Unkillable Slug. Why it is \"Unkillable\"? Firstly, because it can be killed with ... | [{"input": "1000000 1000000 1000000 1000000000\n", "output": "1000000000000000000\n"}, {"input": "1000000 1000000 1001000 1000000000\n", "output": "1001000000000000000\n"}, {"input": "1000000 1000000 1011000 1000000000\n", "output": "1011000000000000000\n"}, {"input": "1000000 1000000 1000000 2999997\n", "output": "100... | code_stdio |
[
{
"content": "Dr .: Peter, I've finally done it.\nPeter: What's wrong, Dr. David? Is it a silly invention again?\nDr .: This table, this table.\n\n\n| Character | Sign\n--- | ---\n(Blank) | 101\n'| 000000\n, | 000011\n-| 10010001\n. | 010001\n? | 000001\nA | 100101\nB | 10011010\n| Character | Sign\n--- | ---\n... | [{"input": "URQDE ERQSQN", "output": "TSE?DV E?GT'PA\n"}, {"input": "UEQDR ERQSQN", "output": "TTJ'GF E?GT'PA\n"}, {"input": "RDQEU ERQSQN", "output": "QGP-HF E?GT'PA\n"}, {"input": "QDQEU ERQSQN", "output": "T,M? OLUJ'NH,'\n"}, {"input": "QDQFU ORFSRQ", "output": "T,M?JTSSYJGRHY\n"}, {"input": "UFQDQ ORFSRQ", "output"... | code_stdio |
[
{
"content": "You are given two strings A and B representing essays of two students who are suspected cheaters. For any two strings C, D we define their similarity score S(C,D) as 4⋅ LCS(C,D) - |C| - |D|, where LCS(C,D) denotes the length of the Longest Common Subsequence of strings C and D. \n\nYou believe tha... | [{"input": "175 190\nqnnnnnnnnnnrnnnnrnrnnnnnrnnnnrqnnnnnnannnnnnnrnrrnrnnnnnrnnrnnnnnnrnrnnnnnrnnnannnrrnnnnrnnnnnnnnnnnrnannnnnrnnnnrnnnnrnnnnnnrnarnnnnnnnnanrnnnnnnnrnnrrnrnrrnnnnnrnnnnnrnnnnnn\nnnnnnrnnnnrnnnnnrnnnnnnrnnqnnnnnnrnnnnnnnrnnrnnnnrnqnannnnnnnannnnnnnrnrnnnrnnnnrnnnnnnnrrnqnnnnnnnnnnnrnrnnrannnnrnnnnrnr... | code_stdio |
[
{
"content": "Of course you have heard the famous task about Hanoi Towers, but did you know that there is a special factory producing the rings for this wonderful game? Once upon a time, the ruler of the ancient Egypt ordered the workers of Hanoi Factory to create as high tower as possible. They were not ready ... | [{"input": "15\n1 30 1409523818\n12 13 463027806\n9 14 846985104\n20 21 770345346\n17 22 514758030\n2 15 438137019\n18 19 331182033\n16 29 613043570\n10 19 765879041\n6 7 960155075\n13 27 323764310\n24 25 724736351\n4 9 107208241\n3 8 992951987\n23 28 125300818\n", "output": "6581903942\n"}, {"input": "15\n1 30 1409523... | code_stdio |
[
{
"content": "Read problems statements in Mandarin Chinese , Russian and Vietnamese \n\nA number is called palindromic if its decimal representation is a palindrome. You are given a range, described by a pair of integers L and R. Find the sum of all palindromic numbers lying in the range [L, R], inclusive of b... | [{"input": "2\n2 10\n123 150", "output": "44\n272\n"}, {"input": "2\n1 10\n123 150", "output": "45\n272\n"}, {"input": "2\n1 10\n123 150", "output": "45\n272"}, {"input": "2\n1 7\n100 112", "output": "28\n212\n"}, {"input": "2\n1 7\n110 112", "output": "28\n111\n"}, {"input": "2\n-1 120\n000 0", "output": "752\n0\n"}, ... | code_stdio |
[
{
"content": "## **Task**\n\nYou are given a positive integer (`n`), and your task is to find the largest number **less than** `n`, which can be written in the form `a**b`, where `a` can be any non-negative integer and `b` is an integer greater than or equal to `2`. Try not to make the code time out :)\n\nThe i... | [{"input": "90", "output": "[[81, 2]]", "fn_name": "largest_power"}, {"input": "65", "output": "[[64, 3]]", "fn_name": "largest_power"}, {"input": "81", "output": "[[64, 3]]", "fn_name": "largest_power"}, {"input": "29", "output": "[[27, 1]]", "fn_name": "largest_power"}, {"input": "2", "output": "[[1, -1]]", "fn_name"... | code_functional |
[
{
"content": "Create a program that converts data based on the given conversion table.\n\nThe characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table.\n\nThe conversion table has two charact... | [{"input": "3\nA a\n0 5\n5 4\n10\nB\nB\nC\n0\n1\n4\n5\na\nb\nA\n3\nA a\n0 5\n5 4\n10\nA\nB\nC\n0\n1\n4\n5\na\nb\nA\n0", "output": "BBC5144aba\naBC5144aba\n"}, {"input": "3\nA a\n0 0\n5 4\n10\nB\nB\nC\n0\n1\n4\n5\na\nb\nA\n3\nA a\n0 5\n5 4\n10\nA\nB\nC\n0\n1\n4\n5\na\nb\nA\n0", "output": "BBC0144aba\naBC5144aba\n"}, {"i... | code_stdio |
[
{
"content": "You are given a tree consisting of $n$ vertices. A number is written on each vertex; the number on vertex $i$ is equal to $a_i$.\n\nRecall that a simple path is a path that visits each vertex at most once. Let the weight of the path be the bitwise XOR of the values written on vertices it consists ... | [{"input": "20\n4 1 3 4 7 3 8 7 7 3 1 1 7 1 9 5 1 10 6 3\n6 15\n12 11\n18 1\n9 17\n8 1\n1 20\n13 7\n10 15\n20 19\n10 16\n8 5\n2 11\n14 3\n6 1\n1 12\n3 18\n6 4\n8 13\n9 18\n", "output": "3\n"}, {"input": "10\n7 4 6 7 6 6 7 5 7 5\n8 7\n4 5\n9 6\n2 5\n4 8\n9 10\n4 3\n9 4\n1 8\n", "output": "1\n"}, {"input": "6\n3 2 1 3 2 ... | code_stdio |
[
{
"content": "There is a game called \"Unique Bid Auction\". You can read more about it here:\n\nhttps://en.wikipedia.org/wiki/Unique_bid_auction\n\n(though you don't have to do it to solve this problem).\n\nLet's simplify this game a bit. Formally, there are $n$ participants, the $i$-th participant chose the n... | [{"input": "8\n12\n10 1 3 3 11 5 12 11 12 12 9 4\n11\n10 9 7 6 6 3 8 4 1 7 9\n12\n3 11 8 4 5 9 6 5 11 12 8 1\n15\n12 6 13 12 7 6 1 7 14 12 14 13 11 3 11\n40\n31 32 2 37 19 39 21 19 18 14 17 11 33 7 17 30 33 27 16 37 37 29 19 32 20 32 24 20 20 24 32 2 7 33 30 25 23 11 35 39\n16\n11 9 16 2 10 5 10 4 13 11 8 1 13 7 4 12\n... | code_stdio |
[
{
"content": "Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct.\n\nFortunately the child knows how to solve such c... | [{"input": "A.He_nan_de_yang_guang_zhao_yao_zhe_wo_men_mei_guo_ren_lian_shang_dou_xiao_kai_yan_wahaaaaaaaaaaaaaaaa\nB.Li_bai_li_bai_fei_liu_zhi_xia_san_qian_chi_yi_si_yin_he_luo_jiu_tian_li_bai_li_bai_li_bai_li_bai_shi\nC.Peng_yu_xiang_shi_zai_tai_shen_le_jian_zhi_jiu_shi_ye_jie_du_liu_a_si_mi_da_zhen_shi_tai_shen_le_a... | code_stdio |
[
{
"content": "Sensation, sensation in the two-dimensional kingdom! The police have caught a highly dangerous outlaw, member of the notorious \"Pihters\" gang. The law department states that the outlaw was driving from the gang's headquarters in his car when he crashed into an ice cream stall. The stall, the car... | [{"input": "10\nUR\nDR\nUL\nDR\nUL\nULDR\nUR\nUL\nULDR\nUL\n", "output": "45\n"}, {"input": "10\nUL\nUL\nUL\nUL\nUL\nUL\nUL\nUL\nUL\nUL\n", "output": "11\n"}, {"input": "10\nUL\nUR\nUR\nDR\nDR\nDR\nDL\nDL\nDL\nDL\n", "output": "35\n"}, {"input": "6\nUL\nDL\nDL\nUL\nUL\nDL\n", "output": "16\n"}, {"input": "6\nUR\nDL\nUR... | code_stdio |
[
{
"content": "Being a nonconformist, Volodya is displeased with the current state of things, particularly with the order of natural numbers (natural number is positive integer number). He is determined to rearrange them. But there are too many natural numbers, so Volodya decided to start with the first n. He wr... | [{"input": "1000000000000 1000000000000\n", "output": "1000000000000\n"}, {"input": "1000000000000 1276759536556\n", "output": "1553519073112\n"}, {"input": "1000000000000 1000000000000\n", "output": "1000000000000"}, {"input": "1000100000000 1000000000000\n", "output": "999900000000\n"}, {"input": "1001100000000 10000... | code_stdio |
[
{
"content": "Today, Mezo is playing a game. Zoma, a character in that game, is initially at position $x = 0$. Mezo starts sending $n$ commands to Zoma. There are two possible commands: 'L' (Left) sets the position $x: =x - 1$; 'R' (Right) sets the position $x: =x + 1$. \n\nUnfortunately, Mezo's controller ma... | [{"input": "13\nLRLLLLRRLLRLR\n", "output": "14\n"}, {"input": "13\nLRLLLLRRLLRLR\n", "output": "14\n"}, {"input": "13\nLRLRLLRLLLRLR\n", "output": "14\n"}, {"input": "13\nRLRLLRRLLLLRL\n", "output": "14\n"}, {"input": "13\nLRLRLLRLRLRLL\n", "output": "14\n"}, {"input": "13\nRLRLLRLLLLRRL\n", "output": "14\n"}, {"input... | code_stdio |
[
{
"content": "You have $n$ stacks of blocks. The $i$-th stack contains $h_i$ blocks and it's height is the number of blocks in it. In one move you can take a block from the $i$-th stack (if there is at least one block) and put it to the $i + 1$-th stack. Can you make the sequence of heights strictly increasing?... | [{"input": "1\n30\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000... | code_stdio |
[
{
"content": "Taro made a sugoroku so that everyone can play at the children's association event. In order to make the game interesting, I wrote instructions such as \"advance 6\" and \"back 5\" in some of the sugoroku squares other than \"Furidashi\" and \"Agari\". Turn the roulette wheel to advance as many ti... | [{"input": "3\n3\n-1\n1\n-1\n3\n0\n4\n2\n0\n-6\n4\n2\n-1\n-7\n0", "output": "OK\nOK\nOK\nOK\n"}, {"input": "3\n3\n0\n1\n-1\n3\n0\n4\n2\n0\n-6\n4\n2\n-1\n-8\n0", "output": "OK\nOK\nOK\nOK\n"}, {"input": "3\n3\n0\n1\n-1\n3\n0\n4\n2\n0\n-6\n4\n2\n-1\n-7\n0", "output": "OK\nOK\nOK\nOK\n"}, {"input": "3\n3\n-2\n1\n-1\n2\n4\... | code_stdio |
[
{
"content": "One day Vasya painted a Cartesian coordinate system on a piece of paper and marked some set of points (x1, y1), (x2, y2), ..., (xn, yn). Let's define neighbors for some fixed point from the given set (x, y): \n\n * point (x', y') is (x, y)'s right neighbor, if x' > x and y' = y\n * point (x', y'... | [{"input": "30\n507 836\n525 836\n-779 196\n507 -814\n525 -814\n525 42\n525 196\n525 -136\n-779 311\n507 -360\n525 300\n507 578\n507 311\n-779 836\n507 300\n525 -360\n525 311\n-779 -360\n-779 578\n-779 300\n507 42\n525 578\n-779 379\n507 196\n525 379\n507 379\n-779 -814\n-779 42\n-779 -136\n507 -136\n", "output": "8\n"... | code_stdio |
[
{
"content": "<image>\n\n\nMy grandmother uses a balance. The balance will balance if you place the same size on both of the two dishes, otherwise it will tilt to the heavier side. The weights of the 10 weights are 1g, 2g, 4g, 8g, 16g, 32g, 64g, 128g, 256g, 512g in order of lightness.\n\nMy grandmother says, \"... | [{"input": "5\n11\n731", "output": "1 4\n1 2 8\n1 2 8 16 64 128 512\n"}, {"input": "5\n17\n731", "output": "1 4\n1 16\n1 2 8 16 64 128 512\n"}, {"input": "5\n17\n994", "output": "1 4\n1 16\n2 32 64 128 256 512\n"}, {"input": "5\n27\n186", "output": "1 4\n1 2 8 16\n2 8 16 32 128\n"}, {"input": "5\n6\n731", "output": "1 ... | code_stdio |
[
{
"content": "Pasha has a positive integer a without leading zeroes. Today he decided that the number is too small and he should make it larger. Unfortunately, the only operation Pasha can do is to swap two adjacent decimal digits of the integer.\n\nHelp Pasha count the maximum number he can get if he has the t... | [{"input": "1541326723729813719 14\n", "output": "9541132672372813719\n"}, {"input": "219810011901120912 100\n", "output": "999822211111110000\n"}, {"input": "191919191919119911 100\n", "output": "999999991111111111\n"}, {"input": "123456789123456789 100\n", "output": "998877665544213123\n"}, {"input": "191919191919119... | code_stdio |
[
{
"content": "Omkar is creating a mosaic using colored square tiles, which he places in an n × n grid. When the mosaic is complete, each cell in the grid will have either a glaucous or sinoper tile. However, currently he has only placed tiles in some cells. \n\nA completed mosaic will be a mastapeece if and onl... | [{"input": "20\n..............S.....\n....................\n.............S.....S\n....................\n....................\n...S................\n....................\n....................\n....................\n....................\n....................\n....................\n....................\n..................... | code_stdio |
[
{
"content": "Aiz Onsen has a bathhouse and a pool. To use the bathhouse, you need to buy a bathing ticket, and to use the pool, you need to buy a pool ticket. Prices for these tickets may vary from day to day. In addition, Aiz Onsen has the following rules.\n\n* Tickets are valid only once on the day of purcha... | [{"input": "2\n111 101 -1 -2\n1001 722 131 -3", "output": "-313\n106060\n"}, {"input": "2\n111 001 -1 -2\n1001 722 131 -3", "output": "-113\n106060\n"}, {"input": "2\n111 000 -1 -2\n1001 722 131 -3", "output": "-111\n106060\n"}, {"input": "2\n011 101 -1 -2\n1001 722 102 -3", "output": "-213\n82836\n"}, {"input": "2\n01... | code_stdio |
[
{
"content": "Jett is tired after destroying the town and she wants to have a rest. She likes high places, that's why for having a rest she wants to get high and she decided to craft staircases.\n\nA staircase is a squared figure that consists of square cells. Each staircase consists of an arbitrary number of s... | [{"input": "4\n1\n10\n28\n0111101000000000100\n", "output": "1\n2\n2\n28\n"}, {"input": "4\n1\n10\n28\n0101101000000000100\n", "output": "1\n2\n2\n28\n"}, {"input": "4\n2\n10\n28\n0101101000000000100\n", "output": "1\n2\n2\n28\n"}, {"input": "4\n2\n10\n26\n0101101000000000100\n", "output": "1\n2\n2\n28\n"}, {"input": "... | code_stdio |
[
{
"content": "You are given an array $a$ consisting of $n$ integers $a_1, a_2, \\dots, a_n$.\n\nYour problem is to find such pair of indices $i, j$ ($1 \\le i < j \\le n$) that $lcm(a_i, a_j)$ is minimum possible.\n\n$lcm(x, y)$ is the least common multiple of $x$ and $y$ (minimum positive number such that both... | [{"input": "4\n9999991 9999883 9999659 9999433\n", "output": "3 4\n"}, {"input": "4\n9999991 9999883 9999659 9999433\n", "output": "3 4\n"}, {"input": "4\n9999991 5101198 9999659 9999433\n", "output": "2 4\n"}, {"input": "3\n10000000 9999999 9999997\n", "output": "2 3\n"}, {"input": "3\n10000000 9999999 9999998\n", "ou... | code_stdio |
[
{
"content": "Today, as a friendship gift, Bakry gave Badawy $n$ integers $a_1, a_2, \\dots, a_n$ and challenged him to choose an integer $X$ such that the value $\\underset{1 \\leq i \\leq n}{\\max} (a_i \\oplus X)$ is minimum possible, where $\\oplus$ denotes the bitwise XOR operation.\n\nAs always, Badawy is... | [{"input": "5\n1073741823 1073741823 181085488 1073741823 1073741823\n", "output": "536870912\n"}, {"input": "5\n1073741823 29972487 1073741823 1073741823 1073741823\n", "output": "536870912\n"}, {"input": "5\n219338430 29972487 1073741823 1073741823 1073741823\n", "output": "536870912\n"}, {"input": "5\n684690029 2997... | code_stdio |
[
{
"content": "Taro has decided to move. Taro has a lot of luggage, so I decided to ask a moving company to carry the luggage. Since there are various weights of luggage, I asked them to arrange them in order from the lightest one for easy understanding, but the mover left the luggage in a different order. So Ta... | [{"input": "8\n7 2 1 3 8 5 4 6", "output": "20\n"}, {"input": "8\n5 2 1 3 8 6 4 7", "output": "18\n"}, {"input": "8\n6 4 1 1 8 5 4 7", "output": "20\n"}, {"input": "8\n6 2 1 3 8 5 4 7", "output": "19"}, {"input": "7\n1 2 5 4 3 6 7", "output": "7\n"}, {"input": "7\n1 3 2 4 5 6 7", "output": "2\n"}, {"input": "7\n1 2 8 1... | code_stdio |
[
{
"content": "Two moving objects A and B are moving accross the same orbit (those can be anything: two planets, two satellites, two spaceships,two flying saucers, or spiderman with batman if you prefer).\nIf the two objects start to move from the same point and the orbit is circular, write a function that gives... | [{"input": "-24\n0\n10", "output": "[\"24.00\"]", "fn_name": "meeting_time"}, {"input": "0\n-18\n14", "output": "[\"18.00\"]", "fn_name": "meeting_time"}, {"input": "32\n-14\n14", "output": "[\"9.74\"]", "fn_name": "meeting_time"}, {"input": "12\n15\n5", "output": "[\"60.00\"]", "fn_name": "meeting_time"}, {"input": "1... | code_functional |
[
{
"content": "You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.\n\nWe'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.\n\nString x = x1x2... x|x| is lexicographically ... | [{"input": "zyxzxzwyxywxxwabcdabdacdbcacdbcacabaaba\n", "output": "zzzyyxxwddddccbba\n"}, {"input": "zyxzxzwyxywxxwabcdabcacdbcacdbdacabaaba\n", "output": "zzzyyxxwddddcbba\n"}, {"input": "thankstosamarasauteddybearsforthiscontest\n", "output": "yttt\n"}, {"input": "shankstosamarasauteddybearsforthiscontest\n", "output... | code_stdio |
[
{
"content": "For given a circle $c$ and a line $l$, print the coordinates of the cross points of them.\n\nConstraints\n\n* $p1$ and $p2$ are different\n* The circle and line have at least one cross point\n* $1 \\leq q \\leq 1,000$\n* $-10,000 \\leq cx, cy, x1, y1, x2, y2 \\leq 10,000$\n* $1 \\leq r \\leq 10,00... | [{"input": "2 0 3\n2\n-1 -1 11 0\n1 -1 12 3", "output": "-0.83330025 -0.98610835 4.95743818 -0.50354682\n-0.55841103 -1.56669492 4.96717016 0.44260733\n"}, {"input": "2 -1 3\n2\n0 -1 14 0\n1 0 10 11", "output": "-0.99915098 -1.07136793 4.97884641 -0.64436811\n-0.76686667 -2.15950371 2.58864885 1.94168192\n"}, {"input":... | code_stdio |
[
{
"content": "The clique problem is one of the most well-known NP-complete problems. Under some simplification it can be formulated as follows. Consider an undirected graph G. It is required to find a subset of vertices C of the maximum size such that any two of them are connected by an edge in graph G. Sounds ... | [{"input": "12\n66 4\n12 7\n60 1\n24 4\n48 4\n-1 4\n36 4\n30 4\n6 4\n54 4\n42 2\n18 4\n", "output": "8\n"}, {"input": "12\n67 4\n12 7\n60 1\n24 4\n48 4\n-1 4\n36 4\n30 4\n6 4\n54 4\n42 2\n18 4\n", "output": "8\n"}, {"input": "12\n67 8\n12 7\n60 1\n24 4\n48 4\n-1 4\n36 4\n30 4\n6 4\n54 4\n42 2\n18 4\n", "output": "7\n"}... | code_stdio |
[
{
"content": "----- Statement -----\n\nYou need to find a string which has exactly K positions in it such that the character at that position comes alphabetically later than the character immediately after it. If there are many such strings, print the one which has the shortest length. If there is still a tie, ... | [{"input": "2\n1\n38", "output": "ba\nnmlkjihgfedcbazyxwvutsrqponmlkjihgfedcba\n"}, {"input": "2\n4\n31", "output": "edcba\ngfedcbazyxwvutsrqponmlkjihgfedcba\n"}, {"input": "2\n1\n31", "output": "ba\ngfedcbazyxwvutsrqponmlkjihgfedcba\n"}, {"input": "2\n8\n23", "output": "ihgfedcba\nxwvutsrqponmlkjihgfedcba\n"}, {"input... | code_stdio |
[
{
"content": "Little Joty has got a task to do. She has a line of n tiles indexed from 1 to n. She has to paint them in a strange pattern.\n\nAn unpainted tile should be painted Red if it's index is divisible by a and an unpainted tile should be painted Blue if it's index is divisible by b. So the tile with the... | [{"input": "1000000000 1000000000 1000000000 1000000000 1000000000\n", "output": "1000000000\n"}, {"input": "1000000000 1000000000 1 1000000000 1000000000\n", "output": "1000000000000000000\n"}, {"input": "1000000000 1000000000 1000000000 1000000000 1000000000\n", "output": "1000000000\n"}, {"input": "1000000000 100000... | code_stdio |
[
{
"content": "# Remove Duplicates\n\nYou are to write a function called `unique` that takes an array of integers and returns the array with duplicates removed. It must return the values in the same order as first seen in the given array. Thus no sorting should be done, if 52 appears before 10 in the given array... | [{"input": "[-1, 5, 10, -100, 3, 2]", "output": "[[-1, 5, 10, -100, 3, 2]]", "fn_name": "unique"}, {"input": "[1, 2, 3, 3, 2, 1, 2, 3, 1, 1, 3, 2]", "output": "[[1, 2, 3]]", "fn_name": "unique"}, {"input": "[1, 3, 2, 3, 2, 1, 2, 3, 1, 1, 3, 2]", "output": "[[1, 3, 2]]", "fn_name": "unique"}, {"input": "[3, 2, 3, 3, 2, ... | code_functional |
[
{
"content": "There are a number of ways to shuffle a deck of cards. Hanafuda shuffling for Japanese card game 'Hanafuda' is one such example. The following is how to perform Hanafuda shuffling.\n\nThere is a deck of n cards. Starting from the p-th card from the top of the deck, c cards are pulled out and put o... | [{"input": "1 -2\n3 1\n3 1\n10 1\n1 10\n10 0\n8 -1\n0 0", "output": "1\n1\n10\n10\n8\n"}, {"input": "1 -2\n3 1\n3 1\n10 1\n4 10\n10 0\n8 -1\n0 0", "output": "1\n1\n7\n10\n8\n"}, {"input": "5 -1\n3 1\n1 1\n10 2\n1 10\n14 1\n11 0\n0 0", "output": "5\n3\n10\n11\n"}, {"input": "5 0\n3 1\n3 1\n19 2\n1 10\n10 2\n11 -1\n0 0",... | code_stdio |
[
{
"content": "Fox Ciel has a board with n rows and n columns. So, the board consists of n × n cells. Each cell contains either a symbol '.', or a symbol '#'.\n\nA cross on the board is a connected set of exactly five cells of the board that looks like a cross. The picture below shows how it looks.[Image]\n\nCie... | [{"input": "15\n.#...##.##.....\n.###.#.#.##..#.\n##.#####......#\n#....###.#..#..\n#.##.#.###.###.\n.###....#.###.#\n##.....##..#...\n.#.########...#\n##..#..##..#.##\n#...#....##....\n.......#.......\n.#..#.#.####...\n.#..#...#..###.\n#..#.#..#......\n###.....##....#\n", "output": "NO\n"}, {"input": "15\n.#...##.##..... | code_stdio |
[
{
"content": "You are enthusiastic about the popular web game \"Moonlight Ranch\". The purpose of this game is to grow crops in the fields, sell them to earn income, and use that income to grow the ranch.\n\nYou wanted to grow the field quickly. Therefore, we decided to arrange the crops that can be grown in th... | [{"input": "5\nelppa 2 2 -1 1 1 0 1 13 1\nan`ban 1 0 3 9 2 2 4 1 0\ncatror 0 2 2 2 1 4 1 18 2\ncqniau 1 3 0 2 -1 3 1 -1 1\nfghplant 0 4 0 3 2 3 0 110 1\n4\nenoki 1 3 2 -1 6 3 1 10 1\ntpmato 1 0 0 10 0 3 -1 1 1\nqotato -1 0 8 4 1 -1 4 7 1\nonion 3 4 0 3 3 7 0 10 1\n3\na 15 1 1 1 1 1 1 14 5\nc 16 -1 2 0 2 1 2 10 2\nc 14 ... | code_stdio |
[
{
"content": "You are given a permutation p_1, p_2, …, p_n.\n\nIn one move you can swap two adjacent values.\n\nYou want to perform a minimum number of moves, such that in the end there will exist a subsegment 1,2,…, k, in other words in the end there should be an integer i, 1 ≤ i ≤ n-k+1 such that p_i = 1, p_{... | [{"input": "100\n98 52 63 2 18 96 31 58 84 40 41 45 66 100 46 71 26 48 81 20 73 91 68 76 13 93 17 29 64 95 79 21 55 75 19 85 54 51 89 78 15 87 43 59 36 1 90 35 65 56 62 28 86 5 82 49 3 99 33 9 92 32 74 69 27 22 77 16 44 94 34 6 57 70 23 12 61 25 8 11 67 47 83 88 10 14 30 7 97 60 42 37 24 38 53 50 4 80 72 39\n", "output... | code_stdio |
[
{
"content": "Seryozha conducts a course dedicated to building a map of heights of Stepanovo recreation center. He laid a rectangle grid of size $n \\times m$ cells on a map (rows of grid are numbered from $1$ to $n$ from north to south, and columns are numbered from $1$ to $m$ from west to east). After that he... | [{"input": "3000 3000 4 10\n623629309 917769297 890844966 987654319\n", "output": "215591588260257\n"}, {"input": "3000 3000 10 4\n122375063 551934841 132649021 999999937\n", "output": "218197599525055\n"}, {"input": "3000 3000 1000 1000\n794639486 477380537 986566001 987456307\n", "output": "3906368067\n"}, {"input": ... | code_stdio |
[
{
"content": "Natasha is planning an expedition to Mars for $n$ people. One of the important tasks is to provide food for each participant.\n\nThe warehouse has $m$ daily food packages. Each package has some food type $a_i$.\n\nEach participant must eat exactly one food package each day. Due to extreme loads, e... | [{"input": "4 100\n84 99 66 69 86 94 89 96 98 93 93 82 87 93 91 100 69 99 93 81 99 84 75 100 86 88 98 100 84 96 44 70 94 91 85 78 86 79 45 88 91 78 98 94 81 87 93 72 96 88 96 97 96 62 86 72 94 84 80 98 88 90 93 73 73 98 78 50 91 96 97 82 85 90 87 41 97 82 97 77 100 100 92 83 98 81 70 81 74 78 84 79 98 98 55 99 97 99 79... | code_stdio |
[
{
"content": "You need to execute several tasks, each associated with number of processors it needs, and the compute power it will consume.\n\nYou have sufficient number of analog computers, each with enough processors for any task. Each computer can execute up to one task at a time, and no more than two tasks ... | [{"input": "50\n83 43 73 75 11 53 6 43 67 38 83 12 70 27 60 13 9 79 61 30 29 71 10 11 95 87 26 26 19 99 13 47 66 93 91 47 90 75 68 3 22 29 59 12 44 41 64 3 99 100\n31 36 69 25 18 33 15 70 12 91 41 44 1 96 80 74 12 80 16 82 88 25 87 17 53 63 3 42 81 6 50 78 34 68 65 78 94 14 53 14 41 97 63 44 21 62 95 37 36 31\n", "outp... | code_stdio |
[
{
"content": "There is a sequence X of length N, where every element is initially 0. Let X_i denote the i-th element of X.\n\nYou are given a sequence A of length N. The i-th element of A is A_i. Determine if we can make X equal to A by repeating the operation below. If we can, find the minimum number of operat... | [{"input": "9\n0\n-1\n-1\n-1\n-2\n2\n1\n1\n-2", "output": "-1\n"}, {"input": "9\n0\n-1\n-1\n-1\n-1\n2\n1\n1\n-2", "output": "-1\n"}, {"input": "9\n0\n-1\n-1\n-1\n-1\n2\n0\n1\n-2", "output": "-1\n"}, {"input": "9\n0\n-1\n-1\n-1\n-1\n2\n0\n1\n-4", "output": "-1\n"}, {"input": "9\n0\n-1\n-1\n-1\n-1\n2\n0\n1\n-6", "output"... | code_stdio |
[
{
"content": "Two participants are each given a pair of distinct numbers from 1 to 9 such that there's exactly one number that is present in both pairs. They want to figure out the number that matches by using a communication channel you have access to without revealing it to you.\n\nBoth participants communica... | [{"input": "12 12\n6 7 5 4 7 8 2 9 12 5 3 5 1 6 7 3 7 9 5 7 1 8 6 8\n6 4 2 1 7 8 1 6 8 5 9 8 1 5 7 2 5 9 6 3 9 2 9 4\n", "output": "-1\n"}, {"input": "12 12\n1 6 2 6 8 3 6 4 4 8 7 2 7 5 9 4 2 4 9 5 8 5 3 2\n2 8 6 9 2 6 7 4 6 5 6 3 5 8 7 8 7 1 1 9 9 7 7 3\n", "output": "-1\n"}, {"input": "12 2\n6 7 5 4 7 8 2 9 12 5 3 5 ... | code_stdio |
[
{
"content": "Consider the number triangle below, in which each number is equal to the number above plus the number to the left. If there is no number above, assume it's a `0`.\n\nThe triangle has `5` rows and the sum of the last row is `sum([1,4,9,14,14]) = 42`.\n\nYou will be given an integer `n` and your tas... | [{"input": "20", "output": "[6564120420]", "fn_name": "solve"}, {"input": "8", "output": "[1430]", "fn_name": "solve"}, {"input": "6", "output": "[132]", "fn_name": "solve"}, {"input": "7", "output": "[429]", "fn_name": "solve"}, {"input": "4", "output": "[14]", "fn_name": "solve"}, {"input": "5", "output": "[42]", "fn... | code_functional |
[
{
"content": "A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string \"aabaabaabaab\" is at the same time a 1-string, a 2-string and a 4-string, but it is not a 3-string, a 5-string, or a 6-string and so on. Obviously any string is a 1-string.\n\n... | [{"input": "250\ncececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececec... | code_stdio |
[
{
"content": "The AKS algorithm for testing whether a number is prime is a polynomial-time test based on the following theorem: \n\nA number p is prime if and only if all the coefficients of the polynomial expansion of `(x − 1)^p − (x^p − 1)` are divisible by `p`.\n\nFor example, trying `p = 3`:\n\n (x − 1)... | [{"input": "11213", "output": "[true]", "fn_name": "aks_test"}, {"input": "8192", "output": "[false]", "fn_name": "aks_test"}, {"input": "8191", "output": "[true]", "fn_name": "aks_test"}, {"input": "10", "output": "[false]", "fn_name": "aks_test"}, {"input": "33", "output": "[false]", "fn_name": "aks_test"}, {"input":... | code_functional |
[
{
"content": "There are n cities in Berland. Each city has its index — an integer number from 1 to n. The capital has index r1. All the roads in Berland are two-way. The road system is such that there is exactly one path from the capital to each city, i.e. the road map looks like a tree. In Berland's chronicles... | [{"input": "100 62 42\n45 66 13 18 93 47 83 19 41 66 5 70 16 29 54 28 65 91 92 24 90 54 7 40 77 53 68 58 70 65 68 30 94 80 16 18 69 21 94 1 99 61 97 2 69 15 79 38 61 46 88 32 57 84 35 18 17 77 38 91 84 2 53 54 68 19 13 78 62 16 63 17 76 49 28 45 94 13 35 69 37 56 12 41 95 70 57 24 45 84 87 65 14 76 95 94 31 67 5\n", "o... | code_stdio |
[
{
"content": "Every year a race takes place on the motorway between cities A and B. This year Vanya decided to take part in the race and drive his own car that has been around and bears its own noble name — The Huff-puffer.\n\nSo, Vasya leaves city A on the Huff-puffer, besides, at the very beginning he fills t... | [{"input": "76\n342 684 1027 1369 1711 2054 2396 2738 3081 3423 3765 4108 4450 4792 5135 5477 5819 6162 6504 6846 7189 7531 7873 8216 8558 8900 9243 9585 9927 10270 10612 10954 11297 11639 11981 12324 12666 13009 13351 13693 14036 14378 14720 15063 15405 15747 16090 16432 16774 17117 17459 17801 18144 18486 18828 19171... | code_stdio |
[
{
"content": "The Little Elephant has an integer a, written in the binary notation. He wants to write this number on a piece of paper.\n\nTo make sure that the number a fits on the piece of paper, the Little Elephant ought to delete exactly one any digit from number a in the binary record. At that a new number ... | [{"input": "11100010010010000110101101101100111111001010001101101001001111010110010111001011010000001100110101000101111000001111101111110010000010101110011110101101010110001100011101111011100010011101100111110010111111100110101000000111101000000000110100100101111101000110101010101101001110001110000101011010101100011100... | code_stdio |
[
{
"content": "Even if the world is full of counterfeits, I still regard it as wonderful.\n\nPile up herbs and incense, and arise again from the flames and ashes of its predecessor — as is known to many, the phoenix does it like this.\n\nThe phoenix has a rather long lifespan, and reincarnates itself once every ... | [{"input": "1000000000000000000 1000000000000000000\n", "output": "1\n"}, {"input": "1000000000000000000 1000000000000000000\n", "output": "1\n"}, {"input": "1000000000000000000 1000000000100000000\n", "output": "0\n"}, {"input": "1000000000001000000 1000000000100000000\n", "output": "0\n"}, {"input": "1000000000001000... | code_stdio |
[
{
"content": "Read problems statements in Mandarin Chinese and Russian as well. \n\nIn every contest there should be an easy problem about matrices. December Cook-Off is not an exception.\n\nGiven a matrix A which consists of n rows and m columns, and contains integer numbers.\n\nConsider every possible vector ... | [{"input": "1 2\n1 -1\n14 -2", "output": "10000006\n"}, {"input": "2 2\n-1 0\n8 -1", "output": "10000000\n"}, {"input": "2 2\n0 0\n14 -1", "output": "9999993\n"}, {"input": "1 2\n-1 2\n3 4", "output": "10000005\n"}, {"input": "1 2\n-2 2\n3 4", "output": "10000003\n"}, {"input": "2 2\n1 -1\n15 0", "output": "9999991\n"}... | code_stdio |
[
{
"content": "There are $n$ boxers, the weight of the $i$-th boxer is $a_i$. Each of them can change the weight by no more than $1$ before the competition (the weight cannot become equal to zero, that is, it must remain positive). Weight is always an integer number.\n\nIt is necessary to choose the largest boxi... | [{"input": "125\n8 85 125 177 140 158 2 152 67 102 9 61 29 188 102 193 112 194 15 7 133 134 145 7 89 193 130 149 134 51 13 194 191 149 73 106 151 85 42 53 163 134 127 7 51 61 178 105 117 197 35 21 122 164 133 165 135 12 192 60 54 187 173 75 74 195 85 62 166 195 131 109 191 196 61 44 61 20 95 147 199 142 71 198 36 153 5... | code_stdio |
[
{
"content": "Kirill plays a new computer game. He came to the potion store where he can buy any potion. Each potion is characterized by two integers — amount of experience and cost. The efficiency of a potion is the ratio of the amount of experience to the cost. Efficiency may be a non-integer number.\n\nFor e... | [{"input": "6134912 6134912 10000000 10000000 999869\n", "output": "NO\n"}, {"input": "9222174 9829060 9418763 14615160 9092468\n", "output": "NO\n"}, {"input": "6134912 8670745 10000000 10000000 999869\n", "output": "NO\n"}, {"input": "9222174 9829060 9418763 9955619 9092468\n", "output": "NO\n"}, {"input": "5426234 6... | code_stdio |
[
{
"content": "Having bought his own apartment, Boris decided to paper the walls in every room. Boris's flat has n rooms, each of which has the form of a rectangular parallelepiped. For every room we known its length, width and height of the walls in meters (different rooms can have different dimensions, includi... | [{"input": "20\n110 466 472\n112 153 152\n424 492 490\n348 366 113\n208 337 415\n491 448 139\n287 457 403\n444 382 160\n325 486 284\n447 454 136\n216 412 418\n217 208 228\n109 436 291\n293 382 421\n483 339 174\n213 327 183\n278 268 147\n181 424 457\n388 289 430\n174 269 305\n20\n221 4 334\n257 4 331\n444 3 127\n492 3 3... | code_stdio |
[
{
"content": "To decide which is the strongest among Rock, Paper, and Scissors, we will hold an RPS tournament.\nThere are 2^k players in this tournament, numbered 0 through 2^k-1. Each player has his/her favorite hand, which he/she will use in every match.\nA string s of length n consisting of R, P, and S repr... | [{"input": "100 100\nPSRRPRRSPSPSSSPSSSPSSSSSPSRSPRRPSRSSPSPPRRSRRRRPSSRRRRPSPSPSSRPRPPRSSRSSPSRPRSRPPSRPRPRPSPSPRRSRSPSP\n", "output": "R\n"}, {"input": "100 100\nRRPSSPPPPSRSRPSSPRSPPSPRSRRPSSPRRPSPPSPSPPRSSRPRPRRSSPSRSSRPSRSRRPRPPPSSSRRRPPRRRSPRRSPSSRRRRRPPPRPP\n", "output": "R\n"}, {"input": "100 100\nRSPSRSSPSPPPS... | code_stdio |
[
{
"content": "Consider the following well known rules:\n\n- A number is divisible by 3 if the sum of its digits is divisible by 3. Let's call '3' a \"1-sum\" prime\n- For 37, we take numbers in groups of threes from the right and check if the sum of these groups is divisible by 37. \n Example: 37 * 123456787 =... | [{"input": "45939401", "output": "[\"11484850-altsum\"]", "fn_name": "solve"}, {"input": "24701723", "output": "[\"12350861-sum\"]", "fn_name": "solve"}, {"input": "376049", "output": "[\"47006-altsum\"]", "fn_name": "solve"}, {"input": "999883", "output": "[\"499941-sum\"]", "fn_name": "solve"}, {"input": "47", "outpu... | code_functional |
[
{
"content": "You are given a sequence A, where its elements are either in the form + x or -, where x is an integer.\n\nFor such a sequence S where its elements are either in the form + x or -, define f(S) as follows:\n\n * iterate through S's elements from the first one to the last one, and maintain a multise... | [{"input": "15\n+ 2101039\n-\n+ 4567886\n+ 113371486\n-\n+ 578943\n-\n-\n+ 62356680\n-\n+ 711111\n-\n+ 797735011\n-\n-\n", "output": "431927902\n"}, {"input": "15\n+ 2168539\n-\n+ 4567886\n+ 113371486\n-\n+ 578943\n-\n-\n+ 62356680\n-\n+ 711111\n-\n+ 797735011\n-\n-\n", "output": "465407902\n"}, {"input": "15\n+ 216853... | code_stdio |
[
{
"content": "Manao is taking part in a quiz. The quiz consists of n consecutive questions. A correct answer gives one point to the player. The game also has a counter of consecutive correct answers. When the player answers a question correctly, the number on this counter increases by 1. If the player answers a... | [{"input": "1000000000 1000000000 1000000000\n", "output": " 999999991"}, {"input": "1000000000 1000000000 772625255\n", "output": " 772625246"}, {"input": "999998212 999998211 499998210\n", "output": " ... | code_stdio |
[
{
"content": "C: Skewering\n\nproblem\n\nOne day, when Homura was playing with blocks, Tempura came. Homura decided to play with blocks with Tempura.\n\nThere is a rectangular parallelepiped of A \\ times B \\ times C, which is made by stacking A \\ times B \\ times C blocks of cubic blocks with a side length o... | [{"input": "28 11 20", "output": "Tem\n"}, {"input": "28 11 17", "output": "Hom\n"}, {"input": "54 11 17", "output": "Hom\n"}, {"input": "12 6 20", "output": "Tem\n"}, {"input": "24 6 20", "output": "Tem\n"}, {"input": "28 6 20", "output": "Tem\n"}, {"input": "54 11 1", "output": "Hom\n"}, {"input": "15 10 2", "output"... | code_stdio |
[
{
"content": "## Your story\nYou've always loved both Fizz Buzz katas and cuckoo clocks, and when you walked by a garage sale and saw an ornate cuckoo clock with a missing pendulum, and a \"Beyond-Ultimate Raspberry Pi Starter Kit\" filled with all sorts of sensors and motors and other components, it's like you... | [{"input": "\"00:00\"", "output": "[\"Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo\"]", "fn_name": "fizz_buzz_cuckoo_clock"}, {"input": "\"12:00\"", "output": "[\"Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo\"]", "fn_name": "fizz_buzz_cuckoo_... | code_functional |
[
{
"content": "Ujan has been lazy lately, but now has decided to bring his yard to good shape. First, he decided to paint the path from his house to the gate.\n\nThe path consists of $n$ consecutive tiles, numbered from $1$ to $n$. Ujan will paint each tile in some color. He will consider the path aesthetic if f... | [{"input": "963201794869\n", "output": "963201794869\n"}, {"input": "930881829259\n", "output": "930881829259\n"}, {"input": "974059904437\n", "output": "974059904437\n"}, {"input": "912943012301\n", "output": "912943012301\n"}, {"input": "912943012301\n", "output": "912943012301\n"}, {"input": "974059904437\n", "outpu... | code_stdio |
[
{
"content": "Lots of geeky customers visit our chef's restaurant everyday. So, when asked to fill the feedback form, these customers represent the feedback using a binary string (i.e a string that contains only characters '0' and '1'. \n\nNow since chef is not that great in deciphering binary strings, he has d... | [{"input": "2\n11101110\n10101010101010", "output": "Good\nGood\n"}, {"input": "2\n11101110\n10101010111010", "output": "Good\nGood\n"}, {"input": "2\n01111010\n10100010111010", "output": "Good\nGood\n"}, {"input": "2\n01111010\n10100010111011", "output": "Good\nGood\n"}, {"input": "2\n01110010\n10100010111011", "outpu... | code_stdio |
[
{
"content": "At the end of last year, Santa Claus forgot to give Christmas presents to the children in JOI village. Therefore, I decided to deliver the chocolate cake to the children as an apology. The day to deliver is approaching tomorrow, so it's time to come up with a move plan.\n\nJOI village is divided i... | [{"input": "12 8\n3\n-1 1\n3 4\n18 6", "output": "31\n3 4\n"}, {"input": "1 4\n3\n1 -1\n0 6\n2 -1", "output": "10\n1 -1\n"}, {"input": "12 8\n3\n-1 1\n3 4\n18 5", "output": "30\n3 4\n"}, {"input": "12 8\n3\n-1 1\n5 4\n10 5", "output": "21\n5 4\n"}, {"input": "12 8\n3\n-1 1\n5 3\n10 5", "output": "22\n5 3\n"}, {"input":... | code_stdio |
[
{
"content": "A [Power Law](https://en.wikipedia.org/wiki/Power_law) distribution occurs whenever \"a relative change in one quantity results in a proportional relative change in the other quantity.\" For example, if *y* = 120 when *x* = 1 and *y* = 60 when *x* = 2 (i.e. *y* halves whenever *x* doubles) then wh... | [{"input": "[1, 120]\n[1, 120]\n1", "output": "[120]", "fn_name": "power_law"}, {"input": "[1, 120]\n[3, 60]\n27", "output": "[15]", "fn_name": "power_law"}, {"input": "[1, 120]\n[9, 30]\n27", "output": "[15]", "fn_name": "power_law"}, {"input": "[1, 120]\n[2, 60]\n4", "output": "[30]", "fn_name": "power_law"}, {"input... | code_functional |
[
{
"content": "As we all know, F.C. Barcelona is the best soccer team of our era! Their entangling and mesmerizing game style usually translates into very high ball possession, consecutive counter-attack plays and goals. Lots of goals, thanks to the natural talent of their attacker and best player in history, Li... | [{"input": "2\n28 3\n8 2", "output": "198073708\n86\n"}, {"input": "2\n28 3\n8 1", "output": "198073708\n1\n"}, {"input": "2\n28 3\n8 0", "output": "198073708\n0\n"}, {"input": "2\n16 3\n8 2", "output": "10761681\n86\n"}, {"input": "2\n31 3\n8 1", "output": "347990060\n1\n"}, {"input": "2\n28 4\n3 0", "output": "706704... | code_stdio |
[
{
"content": "Limak is a little polar bear. He has n balls, the i-th ball has size t_{i}.\n\nLimak wants to give one ball to each of his three friends. Giving gifts isn't easy — there are two rules Limak must obey to make friends happy: No two friends can get balls of the same size. No two friends can get bal... | [{"input": "50\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\n", "output": "NO\n"}, {"input": "50\n1000 1000 1000 1... | code_stdio |
[
{
"content": "In this Kata, you will be given an array and your task will be to determine if an array is in ascending or descending order and if it is rotated or not. \n\nConsider the array `[1,2,3,4,5,7,12]`. This array is sorted in `Ascending` order. If we rotate this array once to the left, we get `[12,1,2,3... | [{"input": "[7, 12, 1, 2, 3, 4, 5]", "output": "[\"RA\"]", "fn_name": "solve"}, {"input": "[7, 1, 2, 3, 4, 5]", "output": "[\"RA\"]", "fn_name": "solve"}, {"input": "[2, 3, 4, 5, 7, 12]", "output": "[\"A\"]", "fn_name": "solve"}, {"input": "[4, 5, 6, 1, 2, 3]", "output": "[\"RA\"]", "fn_name": "solve"}, {"input": "[1, ... | code_functional |
[
{
"content": "There are two towers consisting of blocks of two colors: red and blue. Both towers are represented by strings of characters B and/or R denoting the order of blocks in them from the bottom to the top, where B corresponds to a blue block, and R corresponds to a red block.\n\nThese two towers are rep... | [{"input": "23\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n", "output": "YES\nYES\nYES\nYES\nYES\nYES\nYES\nYE... | code_stdio |
[
{
"content": "Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns all the lights off.\n\nThe building consists of n floors with stairs at the ... | [{"input": "5 93\n00000000000000000000000000000000000000000000000000000000100000000000000000000000000000000001010\n00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n00000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n00000000000... | code_stdio |
[
{
"content": "There are an integer sequence A_1,...,A_N consisting of N terms, and N buttons. When the i-th (1 ≦ i ≦ N) button is pressed, the values of the i terms from the first through the i-th are all incremented by 1.\n\nThere is also another integer sequence B_1,...,B_N. Takahashi will push the buttons so... | [{"input": "7\n4 1\n11 1\n11 20\n2 4\n6 3\n5 12\n9 7", "output": "29\n"}, {"input": "7\n5 1\n4 2\n10 12\n2 4\n6 1\n1 8\n24 5", "output": "14\n"}, {"input": "7\n0 1\n4 2\n0 11\n2 8\n6 1\n5 16\n24 6", "output": "22\n"}, {"input": "7\n3 1\n4 2\n9 17\n2 4\n1 3\n5 15\n5 12", "output": "26\n"}, {"input": "7\n3 1\n4 2\n5 12\n... | code_stdio |
[
{
"content": "Okabe needs bananas for one of his experiments for some strange reason. So he decides to go to the forest and cut banana trees.\n\nConsider the point (x, y) in the 2D plane such that x and y are integers and 0 ≤ x, y. There is a tree in such a point, and it has x + y bananas. There are no trees no... | [{"input": "1000 10000\n", "output": "74133360011484445\n"}, {"input": "1000 10000\n", "output": "74133360011484445"}, {"input": "1581 6030\n", "output": "40628923515290265\n"}, {"input": "1061 8096\n", "output": "44286779591578800\n"}, {"input": "1581 5974\n", "output": "39507636740343456\n"}, {"input": "1486 5974\n",... | code_stdio |
[
{
"content": "It's Galactik Football time! The Galactik Football Assosiation (GFA) has announced a football tournament between all the teams of all the planets in the galaxy.\n\nEach planet of the galaxy has a government. Some governments have a mutual agreement between them. If planet $A$ has mutual agreement ... | [{"input": "6 6\n1 2\n1 5\n1 3\n4 5\n5 4\n4 6\n1\n3\n-1\n2\n2\n10", "output": "0\n"}, {"input": "6 6\n1 2\n1 5\n2 2\n4 5\n5 4\n2 1\n1\n1\n5\n2\n2\n6", "output": "13\n"}, {"input": "6 6\n1 2\n2 3\n1 3\n2 5\n5 2\n4 4\n1\n2\n8\n3\n4\n6", "output": "11\n"}, {"input": "6 6\n1 2\n1 5\n1 3\n4 5\n5 4\n4 6\n1\n3\n0\n2\n7\n12", ... | code_stdio |
[
{
"content": "When you enter 8 numbers from 0 to 9, write a program that outputs the difference between the largest integer and the smallest integer that can sort the 8 numbers. The number that can be sorted may start from 0, such as 00135569.\n\n\n\nInput\n\nGiven multiple datasets. The number of datasets n (n... | [{"input": "2\n65539010\n102034250", "output": "96417531\n543098655\n"}, {"input": "2\n124008976\n66277190", "output": "986395311\n96499431\n"}, {"input": "2\n188122632\n66277190", "output": "774098523\n96499431\n"}, {"input": "2\n169123376\n66277190", "output": "864296532\n96499431\n"}, {"input": "2\n211592187\n662771... | code_stdio |
[
{
"content": "A dice is a cube, its faces contain distinct integers from 1 to 6 as black points. The sum of numbers at the opposite dice faces always equals 7. Please note that there are only two dice (these dices are mirror of each other) that satisfy the given constraints (both of them are shown on the pictur... | [{"input": "100\n3\n6 5\n1 5\n2 1\n5 1\n6 5\n5 1\n6 2\n1 2\n6 5\n5 1\n5 1\n1 5\n2 6\n6 2\n5 6\n1 2\n1 5\n5 6\n1 5\n1 2\n2 6\n1 2\n6 2\n1 5\n6 2\n2 6\n1 5\n6 2\n6 5\n5 6\n1 5\n5 6\n5 1\n5 1\n2 1\n1 2\n5 6\n6 5\n1 5\n5 1\n1 2\n1 5\n1 2\n2 6\n5 1\n2 6\n2 6\n5 6\n2 6\n6 5\n6 5\n1 5\n2 1\n5 6\n5 6\n1 2\n2 1\n1 2\n1 2\n1 2\n... | code_stdio |
[
{
"content": "Someday, Drazil wanted to go on date with Varda. Drazil and Varda live on Cartesian plane. Drazil's home is located in point (0, 0) and Varda's home is located in point (a, b). In each step, he can move in a unit distance in horizontal or vertical direction. In other words, from position (x, y) he... | [{"input": "-1000000000 -1000000000 2000000000\n", "output": "Yes\n"}, {"input": "-1000000000 1000000000 2000000000\n", "output": "Yes\n"}, {"input": "-1000000000 -1000000000 1000000000\n", "output": "No\n"}, {"input": "-1000000000 -1000000000 1000000100\n", "output": "No\n"}, {"input": "-232833910 -880680184 177454979... | code_stdio |
[
{
"content": "Arkady plays Gardenscapes a lot. Arkady wants to build two new fountains. There are n available fountains, for each fountain its beauty and cost are known. There are two types of money in the game: coins and diamonds, so each fountain cost can be either in coins or diamonds. No money changes betwe... | [{"input": "52 38 22\n9 25 D\n28 29 C\n29 25 D\n4 28 D\n23 29 D\n24 25 D\n17 12 C\n11 19 C\n13 14 C\n12 15 D\n7 25 C\n2 25 C\n6 17 C\n2 20 C\n15 23 D\n8 21 C\n13 15 D\n29 15 C\n25 20 D\n22 20 C\n2 13 D\n13 22 D\n27 20 C\n1 21 D\n22 17 C\n14 21 D\n4 25 D\n5 23 C\n9 21 C\n2 20 C\n14 18 C\n29 24 C\n14 29 D\n9 27 C\n23 21 ... | code_stdio |
[
{
"content": "Mishka received a gift of multicolored pencils for his birthday! Unfortunately he lives in a monochrome world, where everything is of the same color and only saturation differs. This pack can be represented as a sequence a_1, a_2, ..., a_{n} of n integer numbers — saturation of the color of each p... | [{"input": "10 5 293149357\n79072863 760382815 358896034 663269192 233367425 32795628 837363300 46932461 179556769 763342555\n", "output": "NO\n"}, {"input": "10 5 293149357\n79072863 760382815 358896034 663269192 233367425 32795628 837363300 46932461 179556769 763342555\n", "output": "NO\n"}, {"input": "18 2 86\n665 4... | code_stdio |
[
{
"content": "You are given an array a. Some element of this array a_{i} is a local minimum iff it is strictly less than both of its neighbours (that is, a_{i} < a_{i} - 1 and a_{i} < a_{i} + 1). Also the element can be called local maximum iff it is strictly greater than its neighbours (that is, a_{i} > a_{i} ... | [{"input": "4\n1 5 2 5\n", "output": "2\n"}, {"input": "4\n1 5 2 1\n", "output": "1\n"}, {"input": "4\n1 7 2 1\n", "output": "1\n"}, {"input": "2\n-1 1100\n", "output": "0\n"}, {"input": "4\n1 3 2 1\n", "output": "1\n"}, {"input": "2\n-1 1110\n", "output": "0\n"}, {"input": "4\n1 1 2 1\n", "output": "1\n"}, {"input": "... | code_stdio |
[
{
"content": "You are playing one famous sandbox game with the three-dimensional world. The map of the world can be represented as a matrix of size n × m, where the height of the cell (i, j) is a_{i, j}.\n\nYou are in the cell (1, 1) right now and want to get in the cell (n, m). You can move only down (from the... | [{"input": "1\n8 6\n1 2 3 4 5 6\n7 8 9 10 11 12\n13 14 15 16 17 18\n19 20 21 22 23 24\n26 27 28 29 30 31\n33 34 35 36 34 35\n37 38 39 40 41 42\n44 45 46 47 48 49\n", "output": " 141\n"}, {"input": "5\n3 4\n1 2 3 4\n5 6 7 12\n9 10 11 12\n5 5\n2 5 4 4 3\n9 14 11... | code_stdio |
[
{
"content": "Omkar is building a waterslide in his water park, and he needs your help to ensure that he does it as efficiently as possible.\n\nOmkar currently has $n$ supports arranged in a line, the $i$-th of which has height $a_i$. Omkar wants to build his waterslide from the right to the left, so his suppor... | [{"input": "3\n4\n5 3 2 1\n5\n1 2 3 10 3\n3\n1 1 1\n", "output": "4\n7\n0\n"}, {"input": "3\n4\n5 3 2 0\n5\n1 2 3 10 3\n3\n1 1 1\n", "output": "5\n7\n0\n"}, {"input": "3\n4\n5 3 2 0\n5\n1 2 3 10 3\n3\n2 1 1\n", "output": "5\n7\n1\n"}, {"input": "3\n4\n5 3 2 0\n5\n1 2 3 10 1\n3\n2 1 1\n", "output": "5\n9\n1\n"}, {"input... | code_stdio |
[
{
"content": "It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.\n\nMarmot brought Mole n ordered piles of worms such that i-th pile contains a_{i} worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a_1, worms in second ... | [{"input": "5\n2 12 3 4 9\n3\n1 25 11\n", "output": "1\n5\n2\n"}, {"input": "5\n2 12 3 4 9\n3\n1 25 17\n", "output": "1\n5\n3\n"}, {"input": "5\n2 17 3 4 9\n3\n1 25 13\n", "output": "1\n4\n2\n"}, {"input": "5\n2 12 3 4 9\n3\n1 25 13\n", "output": "1\n5\n2\n"}, {"input": "5\n4 10 4 4 9\n3\n1 25 17\n", "output": "1\n5\n3... | code_stdio |
[
{
"content": "Ashish has a tree consisting of $n$ nodes numbered $1$ to $n$ rooted at node $1$. The $i$-th node in the tree has a cost $a_i$, and binary digit $b_i$ is written in it. He wants to have binary digit $c_i$ written in the $i$-th node in the end.\n\nTo achieve this, he can perform the following opera... | [{"input": "10\n64 0 0\n10 0 0\n17 0 1\n90 1 1\n97 1 1\n19 1 0\n26 1 1\n95 1 1\n46 0 0\n86 0 0\n5 4\n7 1\n9 5\n6 8\n1 6\n7 5\n8 10\n3 7\n3 2\n", "output": "128"}, {"input": "10\n92 0 1\n19 1 0\n46 1 0\n53 1 0\n13 1 0\n63 0 1\n3 0 1\n67 1 0\n20 0 1\n82 0 1\n6 5\n9 1\n3 7\n10 4\n4 8\n2 8\n5 2\n3 8\n9 10\n", "output": "33... | code_stdio |
[
{
"content": "Your job is to change the given string `s` using a non-negative integer `n`.\n\nEach bit in `n` will specify whether or not to swap the case for each alphabetic character in `s`: if the bit is `1`, swap the case; if its `0`, leave it as is. When you finished with the last bit of `n`, start again w... | [{"input": "\"the quick broWn fox leapt over the fence\"\n9", "output": "[\"The QUicK BrowN foX LeaPT ovER thE FenCE\"]", "fn_name": "swap"}, {"input": "\"eVerybody likes ice cReam\"\n85", "output": "[\"EVErYbODy LiKeS IcE creAM\"]", "fn_name": "swap"}, {"input": "\"the lord of the rings\"\n0", "output": "[\"the lord o... | code_functional |
[
{
"content": "Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.\n\nTo ensure the security, you have to build some police checkposts. Checkposts can only be built in a junction. A checkpost at junction i can p... | [{"input": "100\n174 174 49 152 10 185 101 157 28 177 105 83 155 178 119 123 197 197 56 174 39 53 85 94 72 166 71 43 177 123 186 11 64 82 145 81 11 29 100 10 106 45 138 79 131 90 80 104 149 116 129 30 96 192 11 182 92 157 95 136 152 38 68 34 42 95 164 134 117 75 186 185 28 146 86 24 147 12 166 169 116 44 46 99 55 179 8... | code_stdio |
[
{
"content": "Read the coordinates of four different points on the plane, $ A (x_A, y_A) $, $ B (x_B, y_B) $, $ C (x_C, y_C) $, $ D (x_D, y_D) $, and straight line $ Create a program that outputs YES if AB $ and $ CD $ are orthogonal, and NO if they are not orthogonal. Here, \"straight line\" does not mean a li... | [{"input": "3.338679167476614 4.153021285774258 3.5962681645685493 3.0562783924178016 0.7824583380395241 0.6535611152381731 1.4307644766957708 0.2352661769827814\n2.6749426974072605 2.336361124342693 3.280415305064114 1.6735605571901062 -0.04476814775527138 2.2725919391555047 3.1294550602222495 2.8167160930096795\n10.9... | code_stdio |
[
{
"content": "Snuke has a string s. From this string, Anuke, Bnuke, and Cnuke obtained strings a, b, and c, respectively, as follows:\n\n* Choose a non-empty (contiguous) substring of s (possibly s itself). Then, replace some characters (possibly all or none) in it with `?`s.\n\n\n\nFor example, if s is `missis... | [{"input": "redocta\natcoder\n?????>?", "output": "15\n"}, {"input": "eacodtr\naoetdcr\n?????>>", "output": "16\n"}, {"input": "ebdobur\nppedact\n>>????@", "output": "21\n"}, {"input": "qcbdpvg\nbfpepbs\n?>A>>@<", "output": "20\n"}, {"input": "tocojcb\nbs_fpph\n=?>@@@?", "output": "19\n"}, {"input": "redocta\nateodcr\n... | code_stdio |
[
{
"content": "Problem A: Swap crypto\n\nA 2D enthusiast at R University, he often writes embarrassing sentences that blush when seen by people. Therefore, in order for a third party to not be able to see the text he is writing, he encrypts the text using a method called swap encryption that he devised independe... | [{"input": "1\ntojxo\n1 4\n5\nuhcqmlnkv\n4 5\n6 9\n3 6\n1 4\n3 6\n5\nshzxadexonr\n8 9\n3 9\n5 10\n4 9\n10 11\n0", "output": "aojwo\nthinyynku\nshitxdegyfo\n"}, {"input": "1\ntojxo\n1 4\n5\nuhcqmlnkv\n4 6\n6 9\n3 6\n1 4\n3 6\n5\nshzxadexonr\n8 9\n3 9\n5 10\n4 9\n10 11\n0", "output": "aojwo\nthiamznku\nshitxdegyfo\n"}, {... | code_stdio |
[
{
"content": "Pashmak has fallen in love with an attractive girl called Parmida since one year ago...\n\nToday, Pashmak set up a meeting with his partner in a romantic garden. Unfortunately, Pashmak has forgotten where the garden is. But he remembers that the garden looks like a square with sides parallel to th... | [{"input": "-100 -100 100 100\n", "output": "-100 100 100 -100\n"}, {"input": "-100 100 100 -100\n", "output": "-100 -100 100 100\n"}, {"input": "-100 -100 -100 100\n", "output": "100 -100 100 100\n"}, {"input": "100 -100 -100 -100\n", "output": "100 100 -100 100\n"}, {"input": "-100 -100 100 100\n", "output": "-100 10... | code_stdio |
[
{
"content": "You know combinations: for example, \nif you take 5 cards from a 52 cards deck you have 2,598,960 different combinations.\n\nIn mathematics the number of x combinations you can take from a set of n elements\nis called the binomial coefficient of n and x, or more often `n choose x`.\nThe formula to... | [{"input": "155117520\n30", "output": "[15]", "fn_name": "checkchoose"}, {"input": "155117530\n30", "output": "[-1]", "fn_name": "checkchoose"}, {"input": "3268760\n25", "output": "[10]", "fn_name": "checkchoose"}, {"input": "184756\n20", "output": "[10]", "fn_name": "checkchoose"}, {"input": "184756\n10", "output": "[... | code_functional |
[
{
"content": "problem\n\nThere are the following two-player card games.\n\n* This game uses a total of 2n cards with each integer from 1 to 2n written on it. Here, n is an integer between 1 and 100.\n* Deal n cards to each of the two.\n* Put cards into play alternately one by one according to the following rule... | [{"input": "5\n1\n7\n9\n6\n4\n10\n10\n7\n13\n18\n1\n11\n12\n17\n5\n19\n0", "output": "0\n1\n2\n0\n"}, {"input": "5\n1\n7\n9\n6\n4\n10\n10\n7\n13\n18\n1\n20\n12\n17\n5\n19\n0", "output": "0\n1\n4\n0\n"}, {"input": "5\n1\n2\n9\n6\n10\n10\n16\n7\n14\n18\n4\n11\n6\n17\n5\n19\n0", "output": "2\n0\n2\n0\n"}, {"input": "5\n1\... | code_stdio |
[
{
"content": "# Scenario\n\n**_Several people_** are standing in *a row divided into two teams*. \nThe **_first person_** goes into **_team 1_**, **_the second_** goes into **_team 2_**, **_the third_** goes into **_team 1_**, and so on.\n___\n# Task\n\n**_Given_** *an array of positive integers (the weights o... | [{"input": "[39, 84, 74, 18, 59, 72, 35, 61]", "output": "[[207, 235]]", "fn_name": "row_weights"}, {"input": "[29, 83, 67, 53, 19, 28, 96]", "output": "[[211, 164]]", "fn_name": "row_weights"}, {"input": "[70, 58, 75, 34, 91]", "output": "[[236, 92]]", "fn_name": "row_weights"}, {"input": "[100, 51, 50, 100]", "output... | code_functional |
[
{
"content": "Valery is a PE teacher at a school in Berland. Soon the students are going to take a test in long jumps, and Valery has lost his favorite ruler! \n\nHowever, there is no reason for disappointment, as Valery has found another ruler, its length is l centimeters. The ruler already has n marks, with w... | [{"input": "112 1867 1261 1606\n0 7 17 43 67 70 87 112 129 141 148 162 179 180 189 202 211 220 231 247 250 277 308 311 327 376 400 406 409 417 418 444 480 512 514 515 518 547 572 575 578 587 612 617 654 684 701 742 757 761 788 821 825 835 841 843 850 858 869 872 881 936 939 969 970 971 997 1026 1040 1045 1068 1070 1073... | code_stdio |
[
{
"content": "Have you ever played Hanabi? If not, then you've got to try it out! This problem deals with a simplified version of the game.\n\nOverall, the game has 25 types of cards (5 distinct colors and 5 distinct values). Borya is holding n cards. The game is somewhat complicated by the fact that everybody ... | [{"input": "100\nW4 Y1 W5 R4 W3 Y1 R4 W2 G3 G1 B5 Y5 Y2 Y3 G4 B5 W1 G5 Y5 Y3 G2 Y5 Y5 G5 R2 B3 B1 W5 Y1 W5 B4 W4 R4 B1 R1 W3 R5 R4 G2 W3 W3 R2 W5 Y2 B2 R3 R3 Y1 G5 G2 Y1 R4 Y5 W5 G5 B3 W2 R1 B2 W2 W2 Y5 W3 G1 B1 G2 Y3 W3 G1 W5 W1 G5 G2 Y1 W5 B5 W4 Y5 G2 R3 B4 R5 B1 R1 B4 Y4 Y4 Y3 R5 Y3 B3 W5 R5 Y5 G2 G5 W5 B4 G4 W5\n",... | code_stdio |
[
{
"content": "Bessie and the cows are playing with sequences and need your help. They start with a sequence, initially containing just the number 0, and perform n operations. Each operation is one of the following: Add the integer x_{i} to the first a_{i} elements of the sequence. Append an integer k_{i} to t... | [{"input": "5\n2 -1569\n1 2 -156\n2 641\n2 -253\n2 -400\n", "output": "-784.500000\n-940.500000\n-413.333333\n-373.250000\n-378.600000\n"}, {"input": "5\n2 -1481\n1 2 -156\n2 194\n2 -253\n2 -400\n", "output": "-740.500000\n-896.500000\n-533.000000\n-463.000000\n-450.400000\n"}, {"input": "5\n2 -980\n1 2 -156\n2 641\n2 ... | code_stdio |
[
{
"content": "Welcome to PC Koshien, players. At PC Koshien, competitions are currently being held in a total of three categories: programming category, mobile category, and Ichimai's picture CG category.\n\nGiven the number of participants in each department, create a program that calculates the total number o... | [{"input": "0000 1000 1000", "output": "2000\n"}, {"input": "0000 0000 1000", "output": "1000\n"}, {"input": "0001 0000 1000", "output": "1001\n"}, {"input": "0101 0000 1000", "output": "1101\n"}, {"input": "0100 0000 1000", "output": "1100\n"}, {"input": "0100 0010 1000", "output": "1110\n"}, {"input": "0101 1001 0000... | code_stdio |
[
{
"content": "Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into gr... | [{"input": "100\n4004223124942730640235383244438257614581534320356060987241659784249551110165034719443327659510644224\n", "output": "40-04-22-31-24-94-27-30-64-02-35-38-32-44-43-82-57-61-45-81-53-43-20-35-60-60-98-72-41-65-97-84-24-95-51-11-01-65-03-47-19-44-33-27-65-95-10-64-42-24\n"}, {"input": "100\n2131060505689219... | code_stdio |
[
{
"content": "Given is a string S, where each character is `0`, `1`, or `?`.\n\nConsider making a string S' by replacing each occurrence of `?` with `0` or `1` (we can choose the character for each `?` independently). Let us define the unbalancedness of S' as follows:\n\n* (The unbalancedness of S') = \\max \\\... | [{"input": "??00????0??1????0?0??00??1???11?1?1???1?11?111???1", "output": "4\n"}, {"input": "1???11??11?1???1?1?11???1??00??0?0?1??1??0>>??00??", "output": "3\n"}, {"input": "1???111?11?1???111?11???1??00??0?0?@?????0????00??", "output": "5\n"}, {"input": "????111?11?1?1?111?11???1??00??0???@?????0???000??", "output":... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.