Search is not available for this dataset
problem_id stringlengths 32 32 | name stringlengths 2 112 | problem stringlengths 200 14k | test_cases stringlengths 33 79.2M | difficulty stringclasses 33
values | language listlengths 1 1 | source stringclasses 14
values | num_solutions int64 2 1.9M | starter_code stringlengths 0 1.47k | subset stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|
02e9375c13cac03e36e52098a49ad00c | Duff and Weight Lifting | Recently, Duff has been practicing weight lifting. As a hard practice, Malek gave her a task. He gave her a sequence of weights. Weight of *i*-th of them is 2*w**i* pounds. In each step, Duff can lift some of the remaining weights and throw them away. She does this until there's no more weight left. Malek asked her to ... | {"inputs": ["5\n1 1 2 3 3", "4\n0 1 2 3", "1\n120287", "2\n28288 0", "2\n95745 95745", "13\n92 194 580495 0 10855 41704 13 96429 33 213 0 92 140599", "13\n688743 688743 1975 688743 688743 688743 688743 688743 688743 0 0 688743 688743", "35\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", "35\n13... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 18 | codeforces | |
02f31067aa2dceb4da4eac2111fd03a2 | Weather Tomorrow | Vasya came up with his own weather forecasting method. He knows the information about the average air temperature for each of the last *n* days. Assume that the average air temperature for each day is integral.
Vasya believes that if the average temperatures over the last *n* days form an arithmetic progression, where... | {"inputs": ["5\n10 5 0 -5 -10", "4\n1 1 1 1", "3\n5 1 -5", "2\n900 1000", "2\n1 2", "3\n2 5 8", "4\n4 1 -2 -5", "10\n-1000 -995 -990 -985 -980 -975 -970 -965 -960 -955", "11\n-1000 -800 -600 -400 -200 0 200 400 600 800 1000", "31\n1000 978 956 934 912 890 868 846 824 802 780 758 736 714 692 670 648 626 604 582 560 538 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 161 | codeforces | |
030d1fdc1e4a2a83646aa091f343382b | Product Sum | Blake is the boss of Kris, however, this doesn't spoil their friendship. They often gather at the bar to talk about intriguing problems about maximising some values. This time the problem is really special.
You are given an array *a* of length *n*. The characteristic of this array is the value — the sum of the produc... | {"inputs": ["4\n4 3 2 5", "5\n1 1 2 7 1", "3\n1 1 2", "5\n1 2 3 4 5", "5\n-1 -2 -3 -4 -5", "4\n0 0 0 0", "7\n0 0 0 -1 0 0 0", "2\n1000000 -1000000", "2\n1 1", "2\n-1 -1", "2\n-1000000 1000000", "2\n0 0", "4\n2 1 3 4", "5\n1 2 5 4 5", "4\n2 3 4 1", "4\n4 1 2 3", "6\n5 7 11 83 14 999", "4\n87 213 141 1"], "outputs": ["39... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
031738b2a795984b97cacc3dcba12ad1 | NP-Hard Problem | Recently, Pari and Arya did some research about NP-Hard problems and they found the minimum vertex cover problem very interesting.
Suppose the graph *G* is given. Subset *A* of its vertices is called a vertex cover of this graph, if for each edge *uv* there is at least one endpoint of it in this set, i.e. or (or bot... | {"inputs": ["4 2\n1 2\n2 3", "3 3\n1 2\n2 3\n1 3", "5 7\n3 2\n5 4\n3 4\n1 3\n1 5\n1 4\n2 5", "10 11\n4 10\n8 10\n2 3\n2 4\n7 1\n8 5\n2 8\n7 2\n1 2\n2 9\n6 8", "10 9\n2 5\n2 4\n2 7\n2 9\n2 3\n2 8\n2 6\n2 10\n2 1", "10 16\n6 10\n5 2\n6 4\n6 8\n5 3\n5 4\n6 2\n5 9\n5 7\n5 1\n6 9\n5 8\n5 10\n6 1\n6 7\n6 3", "10 17\n5 1\n8 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 63 | codeforces | |
033bfbcebdec2b5dc7db142182fedf45 | Unlucky Ticket | Each of you probably has your personal experience of riding public transportation and buying tickets. After a person buys a ticket (which traditionally has an even number of digits), he usually checks whether the ticket is lucky. Let us remind you that a ticket is lucky if the sum of digits in its first half matches th... | {"inputs": ["2\n2421", "2\n0135", "2\n3754", "1\n33", "2\n3444", "3\n221323", "3\n132432", "1\n10", "3\n999000", "5\n2563434512", "10\n01101001000011011110", "10\n10001222212022211120", "10\n36828132853144011224", "20\n1011022122111202122200100211021100001122", "20\n5232324254212415411311123313002001301121", "20\n74058... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 11 | codeforces | |
03454594327b444c412678ff95f26c95 | none | В Берляндском государственном университете локальная сеть между серверами не всегда работает без ошибок. При передаче двух одинаковых сообщений подряд возможна ошибка, в результате которой эти два сообщения сливаются в одно. При таком слиянии конец первого сообщения совмещается с началом второго. Конечно, совмещение мо... | {"inputs": ["abrakadabrabrakadabra", "acacacaca", "abcabc", "abababab", "tatbt", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "r", "zaz", "zaza", "gg", "gagaga", "hhhh", "sssss", "nxnxnx", "vygvygv", "rlrlrlrl", "zyzyzyzyz", "jjjjjjjjjj", "kkhuskkhusk", "gzgzgz... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 23 | codeforces | |
039b1b6532f6ce80b8a7a1e89f40c15a | Freelancer's Dreams | Mikhail the Freelancer dreams of two things: to become a cool programmer and to buy a flat in Moscow. To become a cool programmer, he needs at least *p* experience points, and a desired flat in Moscow costs *q* dollars. Mikhail is determined to follow his dreams and registered at a freelance site.
He has suggestions t... | {"inputs": ["3 20 20\n6 2\n1 3\n2 6", "4 1 1\n2 3\n3 2\n2 3\n3 2", "3 12 12\n5 1\n2 2\n1 5", "3 12 12\n5 1\n4 4\n1 5", "3 1 1\n1 1\n1 1\n1 1", "1 4 6\n2 3", "1 3 4\n2 3", "2 1 1000000\n2 4\n5 2", "2 1000000 1\n2 4\n5 2", "2 1000000 1000000\n2 4\n5 2", "6 2 2\n2 4\n5 2\n5 2\n2 4\n2 4\n5 2", "1 3 5\n2 3", "2 10 3\n2 4\n5... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
039e46a507fde708d36bb8263ef7e2c3 | Supermarket | We often go to supermarkets to buy some fruits or vegetables, and on the tag there prints the price for a kilo. But in some supermarkets, when asked how much the items are, the clerk will say that $a$ yuan for $b$ kilos (You don't need to care about what "yuan" is), the same as $a/b$ yuan for a kilo.
Now imagine you'd... | {"inputs": ["3 5\n1 2\n3 4\n1 3", "2 1\n99 100\n98 99", "50 37\n78 49\n96 4\n86 62\n28 4\n19 2\n79 43\n79 92\n95 35\n33 60\n54 84\n90 25\n2 25\n53 21\n86 52\n72 25\n6 78\n41 46\n3 68\n42 89\n33 35\n57 43\n99 45\n1 82\n38 62\n11 50\n55 84\n1 97\n12 67\n51 96\n51 7\n1 100\n79 61\n66 54\n97 93\n52 75\n80 54\n98 73\n29 28\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 128 | codeforces | |
03d5dd4aac643323dbd9adf0c37c9842 | Mysterious strings | The input contains a single integer *a* (1<=≤<=*a*<=≤<=40).
Output a single string.
The input contains a single integer *a* (1<=≤<=*a*<=≤<=40).
Output a single string.
Sample Input
2
8
29
Sample Output
Adams
Van Buren
Harding
| {"inputs": ["2", "8", "29", "1", "3", "4", "5", "6", "7", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40"], "outputs": ["Adams", "Van Buren", "Harding", "Washington", "Jefferson", "Mad... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 10 | codeforces | |
03d757ac8e067015d78fcba7c26d2d05 | Pair Of Lines | You are given *n* points on Cartesian plane. Every point is a lattice point (i.<=e. both of its coordinates are integers), and all points are distinct.
You may draw two straight lines (not necessarily distinct). Is it possible to do this in such a way that every point lies on at least one of these lines?
The first lin... | {"inputs": ["5\n0 0\n0 1\n1 1\n1 -1\n2 2", "5\n0 0\n1 0\n2 1\n1 1\n2 3", "1\n-1000000000 1000000000", "5\n2 -1\n-4 1\n0 -9\n5 -9\n9 -10", "5\n6 1\n10 5\n10 -2\n-2 -10\n-4 -9", "5\n-10 3\n4 -5\n-9 5\n-5 -3\n-4 -6", "5\n2 9\n-1 -4\n-3 -8\n-4 8\n7 2", "10\n315 202\n315 203\n315 204\n-138 -298\n-136 -295\n-134 -292\n-132 -... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 18 | codeforces | |
03db32b23169c055b48a935a37e2844e | Good Matrix Elements | The Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an *n*<=×<=*n* size matrix, where *n* is odd. The Smart Beaver considers the following matrix elements good:
- Elements of the main diagonal. - Elements of the secondary diagonal. - Elements of the "middle" row — the row which ha... | {"inputs": ["3\n1 2 3\n4 5 6\n7 8 9", "5\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1", "1\n3", "5\n27 7 3 11 72\n19 49 68 19 59\n41 25 37 64 65\n8 39 96 62 90\n13 37 43 26 33", "3\n19 7 16\n12 15 5\n15 15 5", "3\n36 4 33\n11 46 32\n20 49 34", "3\n79 91 74\n33 82 22\n18 28 54", "5\n7 0 8 1 7\n5 1 1 0 4\n4 2 8... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 434 | codeforces | |
03edda8ff108e60d56a12e459a0e1a1f | Mahmoud and Ehab and the message | Mahmoud wants to send a message to his friend Ehab. Their language consists of *n* words numbered from 1 to *n*. Some words have the same meaning so there are *k* groups of words such that all the words in some group have the same meaning.
Mahmoud knows that the *i*-th word can be sent with cost *a**i*. For each word ... | {"inputs": ["5 4 4\ni loser am the second\n100 1 1 5 10\n1 1\n1 3\n2 2 5\n1 4\ni am the second", "5 4 4\ni loser am the second\n100 20 1 5 10\n1 1\n1 3\n2 2 5\n1 4\ni am the second", "1 1 1\na\n1000000000\n1 1\na", "1 1 10\na\n1000000000\n1 1\na a a a a a a a a a"], "outputs": ["107", "116", "1000000000", "10000000000"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 47 | codeforces | |
040bb78bbb1dd5c653a6320cc380215f | They Are Everywhere | Sergei B., the young coach of Pokemons, has found the big house which consists of *n* flats ordered in a row from left to right. It is possible to enter each flat from the street. It is possible to go out from each flat. Also, each flat is connected with the flat to the left and the flat to the right. Flat number 1 is ... | {"inputs": ["3\nAaA", "7\nbcAAcbc", "6\naaBCCe", "1\nA", "1\ng", "52\nabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", "2\nAA", "4\nqqqE", "10\nrrrrroooro", "15\nOCOCCCCiCOCCCOi", "20\nVEVnVVnWnVEVVnEVBEWn", "25\ncpcyPPjPPcPPPPcppPcPpppcP", "30\nsssssAsesssssssssssssessssssss", "35\ngdXdddgddddddddggggXdbgdggdgdd... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 109 | codeforces | |
04143337bc6301f1c0a0f52dec037b2b | Secrets | Gerald has been selling state secrets at leisure. All the secrets cost the same: *n* marks. The state which secrets Gerald is selling, has no paper money, only coins. But there are coins of all positive integer denominations that are powers of three: 1 mark, 3 marks, 9 marks, 27 marks and so on. There are no coins of o... | {"inputs": ["1", "4", "3", "8", "10", "100000000000000000", "99999999999999999", "50031545098999707", "16677181699666569", "72900000000000", "99999999999999997", "58061299250691018", "49664023559436051", "66708726798666276", "29442431889534807", "70414767176369958", "93886356235159944", "97626528902553453", "5201315788... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 44 | codeforces | |
0416ef6a5a2762f89c51ac4faf0ffdc7 | Fishes | While Grisha was celebrating New Year with Ded Moroz, Misha gifted Sasha a small rectangular pond of size *n*<=×<=*m*, divided into cells of size 1<=×<=1, inhabited by tiny evil fishes (no more than one fish per cell, otherwise they'll strife!).
The gift bundle also includes a square scoop of size *r*<=×<=*r*, designe... | {"inputs": ["3 3 2 3", "12 17 9 40", "1 1 1 1", "10 10 5 100", "7 1 1 4", "1000 1000 59 100000", "100000 100000 1000 100000", "100000 100000 100000 100000", "3 100000 2 88700", "200 100000 55 100000", "74 2 1 36", "2 59 1 112", "96 33 24 928", "20 78 8 997", "44 22 13 515", "68 66 33 2353", "96 7 4 534", "20 59 2 88", ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 7 | codeforces | |
0437e878aba50d6c66e452cc1721fe0a | Inversion Counting | A permutation of size *n* is an array of size *n* such that each integer from 1 to *n* occurs exactly once in this array. An inversion in a permutation *p* is a pair of indices (*i*,<=*j*) such that *i*<=><=*j* and *a**i*<=<<=*a**j*. For example, a permutation [4,<=1,<=3,<=2] contains 4 inversions: (2,<=1), (3,<=... | {"inputs": ["3\n1 2 3\n2\n1 2\n2 3", "4\n1 2 4 3\n4\n1 1\n1 4\n1 4\n2 3", "7\n2 6 1 7 4 5 3\n5\n4 5\n7 7\n5 6\n4 5\n4 5", "3\n2 1 3\n3\n2 3\n1 1\n1 3", "1\n1\n10\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1"], "outputs": ["odd\neven", "odd\nodd\nodd\neven", "odd\nodd\neven\nodd\neven", "even\neven\nodd", "even\nev... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 22 | codeforces | |
0440d4b084c8c1d84009e461ec1ace99 | Monitor | Recently Luba bought a monitor. Monitor is a rectangular matrix of size *n*<=×<=*m*. But then she started to notice that some pixels cease to work properly. Luba thinks that the monitor will become broken the first moment when it contains a square *k*<=×<=*k* consisting entirely of broken pixels. She knows that *q* pix... | {"inputs": ["2 3 2 5\n2 1 8\n2 2 8\n1 2 1\n1 3 4\n2 3 2", "3 3 2 5\n1 2 2\n2 2 1\n2 3 5\n3 2 10\n2 1 100", "29 50 5 29\n21 42 1565821\n21 43 53275635\n21 44 2717830\n21 45 9579585\n21 46 20725775\n22 42 2568372\n22 43 9584662\n22 44 31411635\n22 45 5089311\n22 46 4960702\n23 42 11362237\n23 43 42200296\n23 44 18762146\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 9 | codeforces | |
04481b5ba35a75a5c9e06aebb7a9aecb | none | A subsequence of length |*x*| of string *s*<==<=*s*1*s*2... *s*|*s*| (where |*s*| is the length of string *s*) is a string *x*<==<=*s**k*1*s**k*2... *s**k*|*x*| (1<=≤<=*k*1<=<<=*k*2<=<<=...<=<<=*k*|*x*|<=≤<=|*s*|).
You've got two strings — *s* and *t*. Let's consider all subsequences of string *s*, coinciding... | {"inputs": ["abab\nab", "abacaba\naba", "abc\nba", "babbbbbaba\nab", "accbacabaa\nbada", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "hqxibotrjfqrgwrydtlpkzeqrkfgzdylfokmaguwafdgwltgvqobnouttrrfuavfkqcoqxk... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
0476ba2ad7a62519c2f6fdbd6fda8d81 | Three-dimensional Turtle Super Computer | A super computer has been built in the Turtle Academy of Sciences. The computer consists of *n*·*m*·*k* CPUs. The architecture was the paralellepiped of size *n*<=×<=*m*<=×<=*k*, split into 1<=×<=1<=×<=1 cells, each cell contains exactly one CPU. Thus, each CPU can be simultaneously identified as a group of three numbe... | {"inputs": ["2 2 3\n000\n000\n\n111\n111", "3 3 3\n111\n111\n111\n\n111\n111\n111\n\n111\n111\n111", "1 1 10\n0101010101", "1 1 1\n0", "1 1 1\n1", "3 1 1\n1\n\n1\n\n1", "3 1 1\n1\n\n0\n\n1", "1 3 1\n1\n1\n1", "1 3 1\n1\n0\n1", "1 1 3\n111", "1 1 3\n101", "1 1 3\n011", "1 1 3\n110", "1 1 1\n0", "1 1 1\n1", "1 1 1\n1", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
04864f2df7b493cedb5e2f8c34d74442 | Mahmoud and Ehab and the wrong algorithm | Mahmoud was trying to solve the vertex cover problem on trees. The problem statement is:
Given an undirected tree consisting of *n* nodes, find the minimum number of vertices that cover all the edges. Formally, we need to find a set of vertices such that for each edge (*u*,<=*v*) that belongs to the tree, either *u* i... | {"inputs": ["2", "8", "99", "100", "100000", "3212", "54321", "54320", "3", "4", "5", "6", "7", "67575", "99999", "2048", "2047", "2049", "10101", "11", "13", "21", "31", "43", "57", "73", "91", "111", "133", "157", "183", "211", "241", "273", "307", "343", "381", "421"], "outputs": ["-1\n1 2", "1 2\n1 3\n1 4\n2 5\n2 6... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 25 | codeforces | |
04e13680b7777e44cc9c0ac35893c010 | Fractal | Ever since Kalevitch, a famous Berland abstractionist, heard of fractals, he made them the main topic of his canvases. Every morning the artist takes a piece of graph paper and starts with making a model of his future canvas. He takes a square as big as *n*<=×<=*n* squares and paints some of them black. Then he takes a... | {"inputs": ["2 3\n.*\n..", "3 2\n.*.\n***\n.*.", "2 1\n..\n..", "2 2\n*.\n*.", "2 2\n**\n*.", "2 2\n*.\n..", "2 3\n*.\n.*", "2 3\n..\n**", "2 3\n*.\n**", "2 4\n**\n..", "2 4\n*.\n.*", "2 4\n.*\n.*", "2 5\n.*\n*.", "2 5\n*.\n..", "2 5\n..\n*.", "2 5\n**\n*.", "3 1\n*..\n...\n..*", "3 2\n**.\n.**\n..*", "3 2\n..*\n***\n*... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 11 | codeforces | |
0508cbfc663dea93f2f87627fdcebe7e | none | Limak is a little bear who learns to draw. People usually start with houses, fences and flowers but why would bears do it? Limak lives in the forest and he decides to draw a tree.
Recall that tree is a connected graph consisting of *n* vertices and *n*<=-<=1 edges.
Limak chose a tree with *n* vertices. He has infinit... | {"inputs": ["8\n1 2\n1 3\n1 6\n6 4\n6 7\n6 5\n7 8", "13\n1 2\n1 3\n1 4\n2 5\n2 6\n2 7\n3 8\n3 9\n3 10\n4 11\n4 12\n4 13", "1", "20\n5 15\n20 4\n11 18\n1 14\n18 2\n14 17\n8 10\n13 1\n11 6\n14 16\n12 8\n9 3\n13 15\n8 17\n3 13\n1 18\n17 7\n9 20\n19 12", "50\n38 13\n29 35\n32 25\n34 1\n11 26\n26 14\n31 35\n10 40\n34 2\n28 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
0518fb8493dd93509d6e21921f277812 | Graph And Its Complement | Given three numbers $n, a, b$. You need to find an adjacency matrix of such an undirected graph that the number of components in it is equal to $a$, and the number of components in its complement is $b$. The matrix must be symmetric, and all digits on the main diagonal must be zeroes.
In an undirected graph loops (edg... | {"inputs": ["3 1 2", "3 3 3", "5 1 1", "123 1 84", "2 1 1", "1 1 1", "3 1 1", "5 2 2", "1000 734 1", "1000 1 1000", "1000 1 1", "4 1 1", "4 4 1", "3 1 3", "2 1 2", "101 1 1", "102 1 1", "103 1 1", "104 1 1", "6 1 1", "3 2 1", "5 1 2", "4 1 2", "2 2 1", "3 3 1", "2 2 2", "1 1 1", "2 1 1", "2 1 2", "2 2 1", "2 2 2", "3 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 14 | codeforces | |
052458b267a31782153438b583a8d4da | none | ZS the Coder is playing a game. There is a number displayed on the screen and there are two buttons, '<=+<=' (plus) and '' (square root). Initially, the number 2 is displayed on the screen. There are *n*<=+<=1 levels in the game and ZS the Coder start at the level 1.
When ZS the Coder is at level *k*, he can :
1. Pr... | {"inputs": ["3", "2", "4", "1", "100000", "2016", "12345", "99997", "99998", "9999", "99999", "17823", "22222", "29137", "7"], "outputs": ["2\n17\n46", "2\n17", "2\n17\n46\n97", "2", "2\n17\n46\n97\n176\n289\n442\n641\n892\n1201\n1574\n2017\n2536\n3137\n3826\n4609\n5492\n6481\n7582\n8801\n10144\n11617\n13226\n14977\n16... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 75 | codeforces | |
054ce7512149b0f6a34fc8b79aa13f5d | Inna and Nine | Inna loves digit 9 very much. That's why she asked Dima to write a small number consisting of nines. But Dima must have misunderstood her and he wrote a very large number *a*, consisting of digits from 1 to 9.
Inna wants to slightly alter the number Dima wrote so that in the end the number contained as many digits nin... | {"inputs": ["369727", "123456789987654321", "1", "3636363636363454545454543636363636454545452727272727218181818181999111777", "1188", "121212912121291299129191219", "181818918181891918918181918189181818181891818191818191819189", "121912191219121912191219121912191219121912191219121912191219121912191219121912191219121912... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 23 | codeforces | |
05568f0510335c290838d9a7505f1465 | Physical Education | Vasya is a school PE teacher. Unlike other PE teachers, Vasya doesn't like it when the students stand in line according to their height. Instead, he demands that the children stand in the following order: *a*1,<=*a*2,<=...,<=*a**n*, where *a**i* is the height of the *i*-th student in the line and *n* is the number of s... | {"inputs": ["4\n1 2 3 2\n3 2 1 2", "2\n1 100500\n1 100500", "3\n652586118 652586118 652586118\n652586118 652586118 652586118", "4\n681106577 681106577 675077178 675077178\n675077178 681106577 681106577 675077178", "5\n470138369 747764103 729004864 491957578 874531368\n874531368 729004864 491957578 747764103 470138369",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 20 | codeforces | |
056de076ab150c454056758d41d8219c | Sereja and Array | Sereja has got an array, consisting of *n* integers, *a*1,<=*a*2,<=...,<=*a**n*. Sereja is an active boy, so he is now going to complete *m* operations. Each operation will have one of the three forms:
1. Make *v**i*-th array element equal to *x**i*. In other words, perform the assignment *a**v**i*<==<=*x**i*. 1. In... | {"inputs": ["10 11\n1 2 3 4 5 6 7 8 9 10\n3 2\n3 9\n2 10\n3 1\n3 10\n1 1 10\n2 10\n2 10\n3 1\n3 10\n3 9", "1 3\n1\n1 1 2\n2 1\n3 1", "1 1\n1\n3 1", "6 6\n202714501 613423725 367325359 862808465 182588146 745008828\n2 492\n2 1943\n1 3 173984392\n1 3 9356383\n3 4\n1 5 472683539", "6 5\n545129895 918519812 2334334 5655406... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 49 | codeforces | |
05716554bbc7565df04ab6d6e39d8f9f | Complete the Word | ZS the Coder loves to read the dictionary. He thinks that a word is nice if there exists a substring (contiguous segment of letters) of it of length 26 where each letter of English alphabet appears exactly once. In particular, if the string has length strictly less than 26, no such substring exists and thus it is not n... | {"inputs": ["ABC??FGHIJK???OPQR?TUVWXY?", "WELCOMETOCODEFORCESROUNDTHREEHUNDREDANDSEVENTYTWO", "??????????????????????????", "AABCDEFGHIJKLMNOPQRSTUVW??M", "QWERTYUIOPASDFGHJKL???????", "ABABABBAB????????????ABABABABA???????????ABABABABA?????????KLCSJB?????????Z", "Q?E?T?U?O?A?D?G?J?L?X?V?MMQ?E?T?U?O?A?D?G?J?L?X?V?N", ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 50 | codeforces | |
0588fa72eb0c014d60c9745d2add7b81 | Codehorses T-shirts | Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.
The valid sizes of T-shirts are either "M" or from $0$ to $3$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are not.
... | {"inputs": ["3\nXS\nXS\nM\nXL\nS\nXS", "2\nXXXL\nXXL\nXXL\nXXXS", "2\nM\nXS\nXS\nM", "1\nXXXL\nXXXL", "1\nM\nM", "4\nS\nL\nXXS\nXXS\nM\nL\nXXS\nXXL", "5\nXS\nXXXS\nL\nXS\nM\nXL\nS\nXS\nM\nXXXL", "1\nS\nM", "26\nS\nL\nM\nL\nS\nXXXS\nXXXS\nM\nXXXS\nXXXS\nM\nXXS\nM\nXXXL\nM\nXL\nXXXL\nXXXS\nXXL\nL\nM\nM\nL\nXL\nXS\nXXL\nX... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 11 | codeforces | |
059a71d9633f932c6edaabb9305ea26a | Mancala | Mancala is a game famous in the Middle East. It is played on a board that consists of 14 holes.
Initially, each hole has $a_i$ stones. When a player makes a move, he chooses a hole which contains a positive number of stones. He takes all the stones inside it and then redistributes these stones one by one in the next ... | {"inputs": ["0 1 1 0 0 0 0 0 0 7 0 0 0 0", "5 1 1 1 1 0 0 0 0 0 0 0 0 0", "10001 10001 10001 10001 10001 10001 10001 10001 10001 10001 10001 10001 10001 1", "0 0 0 0 0 0 0 0 0 0 0 0 0 15", "1 0 0 0 0 1 0 0 0 0 1 0 0 0", "5 5 1 1 1 3 3 3 5 7 5 3 7 5", "787 393 649 463 803 365 81 961 989 531 303 407 579 915", "8789651 44... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 111 | codeforces | |
05ac57c4c15a08896e1efcdb65649bac | Numbers Joke | The input contains a single integer *a* (1<=≤<=*a*<=≤<=30).
Output a single integer.
The input contains a single integer *a* (1<=≤<=*a*<=≤<=30).
Output a single integer.
Sample Input
3
Sample Output
27
| {"inputs": ["3", "1", "2", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30"], "outputs": ["27", "4", "22", "58", "85", "94", "121", "166", "202", "265", "274", "319", "346", "355", "378", "382", "391", "438", "454"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 24 | codeforces | |
05c9845a84c52803655e2c54586f7453 | Team | One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution.... | {"inputs": ["3\n1 1 0\n1 1 1\n1 0 0", "2\n1 0 0\n0 1 1", "1\n1 0 0", "2\n1 0 0\n1 1 1", "5\n1 0 0\n0 1 0\n1 1 1\n0 0 1\n0 0 0", "10\n0 1 0\n0 1 0\n1 1 0\n1 0 0\n0 0 1\n0 1 1\n1 1 1\n1 1 0\n0 0 0\n0 0 0", "15\n0 1 0\n1 0 0\n1 1 0\n1 1 1\n0 1 0\n0 0 1\n1 0 1\n1 0 1\n1 0 1\n0 0 0\n1 1 1\n1 1 0\n0 1 1\n1 1 0\n1 1 1", "50\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 999 | codeforces | |
05f0b9b170e310374e26b71e9260191f | Cards with Numbers | Petya has got 2*n* cards, each card contains some integer. The numbers on the cards can be the same. Let's index all cards by consecutive integers from 1 to 2*n*. We'll denote the number that is written on a card with number *i*, as *a**i*. In order to play one entertaining game with his friends, Petya needs to split t... | {"inputs": ["3\n20 30 10 30 20 10", "1\n1 2", "5\n2 2 2 2 2 1 2 2 1 2", "5\n2 1 2 2 1 1 1 1 1 2", "5\n1 2 2 2 1 2 2 1 2 1", "5\n3 3 1 1 1 3 2 3 1 2", "5\n1 1 3 1 3 3 3 1 1 1", "5\n3 1 1 1 2 3 3 3 2 1", "5\n3 3 2 2 3 3 1 3 1 3", "5\n4 1 3 1 4 1 2 2 3 1", "100\n8 6 7 8 7 9 1 7 3 3 5 8 7 8 5 4 8 4 8 1 2 8 3 7 8 7 6 5 7 9 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 39 | codeforces | |
05f3813e54a31452a7c624ac072aa875 | Little Artem and Time Machine | Little Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply this time machine to a well-known data structure: multiset.
Artem wants to create a basic multiset of integers. He wants these structure to support operations of three typ... | {"inputs": ["6\n1 1 5\n3 5 5\n1 2 5\n3 6 5\n2 3 5\n3 7 5", "3\n1 1 1\n2 2 1\n3 3 1", "10\n1 1 1000000000\n1 4 1000000000\n2 2 1000000000\n1 5 1000000000\n1 8 1000000000\n2 15 1000000000\n3 3 1000000000\n3 10 1000000000\n3 6 1000000000\n3 7 1000000000", "12\n1 9 1\n1 8 1\n1 7 1\n1 6 1\n1 1 1\n1 2 1\n1 3 1\n1 4 1\n2 5 1\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
05fa03f3eb832b74a941e6432563aadd | Dima and Bacteria | Dima took up the biology of bacteria, as a result of his experiments, he invented *k* types of bacteria. Overall, there are *n* bacteria at his laboratory right now, and the number of bacteria of type *i* equals *c**i*. For convenience, we will assume that all the bacteria are numbered from 1 to *n*. The bacteria of ty... | {"inputs": ["4 4 2\n1 3\n2 3 0\n3 4 0\n2 4 1\n2 1 2", "3 1 2\n2 1\n1 2 0", "3 2 2\n2 1\n1 2 0\n2 3 1", "3 0 2\n1 2", "10 9 3\n4 4 2\n1 2 0\n2 4 0\n3 2 0\n5 6 0\n6 7 0\n7 8 0\n9 10 0\n1 5 2\n2 6 1", "10 9 1\n10\n1 2 0\n2 3 0\n3 4 0\n4 5 0\n5 6 0\n6 7 0\n7 8 0\n8 9 0\n9 10 0", "10 0 10\n1 1 1 1 1 1 1 1 1 1", "16 20 4\n4 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
0615c80fbe63792e7a7c26d2d3476754 | none | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.
Each club's full name consist of two wo... | {"inputs": ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO", "3\nABC DEF\nABC EFG\nABC EEEEE", "3\nABC DEF\nABC EFG\nABD CABA", "3\nABC DEF\nABC EFG\nABD EABA", "1\nAAA AAA", "1\nAAAAAAAAAAAAAAAAAA... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 20 | codeforces | |
06173cd8b7ea515c61bf91fb1fbd4364 | Checkpoints | Vasya takes part in the orienteering competition. There are *n* checkpoints located along the line at coordinates *x*1,<=*x*2,<=...,<=*x**n*. Vasya starts at the point with coordinate *a*. His goal is to visit at least *n*<=-<=1 checkpoint in order to finish the competition. Participant are allowed to visit checkpoints... | {"inputs": ["3 10\n1 7 12", "2 0\n11 -10", "5 0\n0 0 1000 0 0", "1 0\n0", "2 1\n4 -8", "3 4\n4 2 4", "4 7\n8 -4 -10 6", "5 7\n8 3 1 6 4", "6 -9\n-10 -7 4 -7 0 3", "9 -3\n-10 -7 -3 -4 7 -6 10 -10 -7", "18 8\n19 18 20 11 16 12 20 17 15 11 16 13 20 13 14 16 10 12", "26 3\n20 15 19 20 17 10 15 20 16 14 19 12 18 15 14 16 13... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 15 | codeforces | |
062efed583eda19d45f4333603d05a53 | Palindromic characteristics | 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.
A string is 1-palindrome if and only if it reads the same backward as forward.
A string is *k*-palindrome (*k*<=><=1) if and... | {"inputs": ["abba", "abacaba", "qqqpvmgd", "wyemcafatp"], "outputs": ["6 1 0 0 ", "12 4 1 0 0 0 0 ", "11 3 0 0 0 0 0 0 ", "11 1 0 0 0 0 0 0 0 0 "]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
06386d77d27605b3fec1289bcc6af161 | Bamboo Partition | Vladimir wants to modernize partitions in his office. To make the office more comfortable he decided to remove a partition and plant several bamboos in a row. He thinks it would be nice if there are *n* bamboos in a row, and the *i*-th from the left is *a**i* meters high.
Vladimir has just planted *n* bamboos in a ro... | {"inputs": ["3 4\n1 3 5", "3 40\n10 30 50", "20 53\n32 64 20 41 97 50 20 66 68 22 60 74 61 97 54 80 30 72 59 18", "100 82\n51 81 14 37 17 78 92 64 15 8 86 89 8 87 77 66 10 15 12 100 25 92 47 21 78 20 63 13 49 41 36 41 79 16 87 87 69 3 76 80 60 100 49 70 59 72 8 38 71 45 97 71 14 76 54 81 4 59 46 39 29 92 3 49 22 53 99 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
067e7234724da9d9c1cb31ab72d4a909 | Magic Powder - 2 | The term of this problem is the same as the previous one, the only exception — increased restrictions.
The first line contains two positive integers *n* and *k* (1<=≤<=*n*<=≤<=100<=000,<=1<=≤<=*k*<=≤<=109) — the number of ingredients and the number of grams of the magic powder.
The second line contains the sequence *a... | {"inputs": ["1 1000000000\n1\n1000000000", "10 1\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n1 1 1 1 1 1 1 1 1 1", "3 1\n2 1 4\n11 3 16", "4 3\n4 3 5 6\n11 12 14 20", "10 926\n5 6 8 1 2 5 1 8 4 4\n351 739 998 725 953 970 906 691 707 1000", "20 925\n7 3... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 29 | codeforces | |
0681fa22f91c489c7e99aad261d5855a | Nicholas and Permutation | Nicholas has an array *a* that contains *n* distinct integers from 1 to *n*. In other words, Nicholas has a permutation of size *n*.
Nicholas want the minimum element (integer 1) and the maximum element (integer *n*) to be as far as possible from each other. He wants to perform exactly one swap in order to maximize th... | {"inputs": ["5\n4 5 1 3 2", "7\n1 6 5 3 4 7 2", "6\n6 5 4 3 2 1", "2\n1 2", "2\n2 1", "3\n2 3 1", "4\n4 1 3 2", "5\n1 4 5 2 3", "6\n4 6 3 5 2 1", "7\n1 5 3 6 2 4 7", "100\n76 70 67 54 40 1 48 63 64 36 42 90 99 27 47 17 93 7 13 84 16 57 74 5 83 61 19 56 52 92 38 91 82 79 34 66 71 28 37 98 35 94 77 53 73 10 26 80 15 32 8... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 173 | codeforces | |
06e6a39440ec9fd2a3aa96176416c5ee | k-th divisor | You are given two integers *n* and *k*. Find *k*-th smallest divisor of *n*, or report that it doesn't exist.
Divisor of *n* is any such natural number, that *n* can be divided by it without remainder.
The first line contains two integers *n* and *k* (1<=≤<=*n*<=≤<=1015, 1<=≤<=*k*<=≤<=109).
If *n* has less than *k* di... | {"inputs": ["4 2", "5 3", "12 5", "1 1", "866421317361600 26880", "866421317361600 26881", "1000000000000000 1000000000", "1000000000000000 100", "1 2", "4 3", "4 4", "9 3", "21 3", "67280421310721 1", "6 3", "3 3", "16 3", "1 1000", "16 4", "36 8", "49 4", "9 4", "16 1", "16 6", "16 5", "25 4", "4010815561 2", "49 3",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 124 | codeforces | |
070bac60163b9e1c87fd09be5eaeae25 | Lucky Sum of Digits | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Petya wonders eagerly what minimum lucky number has the sum of digits equal to *n*. Help him cope wi... | {"inputs": ["11", "10", "64", "1", "4", "7", "12", "1000000", "47", "100", "700", "485", "111", "85", "114", "474", "74", "1000", "1024", "4444", "45784", "10000", "9854", "186", "10416", "10417", "3840", "100000", "9876", "99999", "777777", "854759", "11000", "18951", "999999", "888887", "999998", "40008", "10691", "5... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 219 | codeforces | |
07177f40679304b8f0d506e8d92c9512 | Team Olympiad | The School №0 of the capital of Berland has *n* children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). Hence, for each child we know value *t**i*:
- *t**i*<==<=1, if the *i*-th child is good at prog... | {"inputs": ["7\n1 3 1 3 2 1 2", "4\n2 1 1 2", "1\n2", "2\n3 1", "3\n2 1 2", "3\n1 2 3", "12\n3 3 3 3 3 3 3 3 1 3 3 2", "60\n3 3 1 2 2 1 3 1 1 1 3 2 2 2 3 3 1 3 2 3 2 2 1 3 3 2 3 1 2 2 2 1 3 2 1 1 3 3 1 1 1 3 1 2 1 1 3 3 3 2 3 2 3 2 2 2 1 1 1 2", "12\n3 1 1 1 1 1 1 2 1 1 1 1", "22\n2 2 2 2 2 2 2 2 2 2 3 2 2 2 2 2 2 1 2 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 694 | codeforces | |
073164f4014b9db1f36759f83b7074e3 | Fedor and New Game | After you had helped George and Alex to move in the dorm, they went to help their friend Fedor play a new computer game «Call of Soldiers 3».
The game has (*m*<=+<=1) players and *n* types of soldiers in total. Players «Call of Soldiers 3» are numbered form 1 to (*m*<=+<=1). Types of soldiers are numbered from 0 to *n... | {"inputs": ["7 3 1\n8\n5\n111\n17", "3 3 3\n1\n2\n3\n4", "4 2 2\n5\n6\n7", "4 7 4\n9\n10\n5\n12\n4\n12\n7\n10", "2 7 2\n1\n1\n1\n1\n1\n1\n1\n1", "6 8 2\n46\n59\n38\n5\n13\n54\n26\n62\n18", "5 6 3\n16\n9\n24\n5\n17\n27\n20", "7 9 1\n27\n7\n12\n29\n51\n67\n9\n112\n62\n68", "9 20 2\n197\n45\n217\n9\n156\n335\n21\n90\n33\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 41 | codeforces | |
07492363653c8057e4b8cca99052bbec | Suspects | As Sherlock Holmes was investigating a crime, he identified *n* suspects. He knows for sure that exactly one of them committed the crime. To find out which one did it, the detective lines up the suspects and numbered them from 1 to *n*. After that, he asked each one: "Which one committed the crime?". Suspect number *i*... | {"inputs": ["1 1\n+1", "3 2\n-1\n-2\n-3", "4 1\n+2\n-3\n+4\n-1", "1 0\n-1", "2 2\n+1\n+1", "2 1\n+2\n+1", "2 0\n-2\n-2", "3 1\n+2\n+3\n+3", "6 3\n+5\n+5\n+5\n+1\n+1\n+1", "4 3\n-4\n-3\n-1\n-3", "10 4\n-8\n+1\n-6\n-10\n+5\n-6\n-8\n-8\n-4\n-8", "10 5\n-4\n+4\n+4\n-9\n-9\n-4\n-4\n+2\n-9\n-4", "7 2\n+5\n+5\n+5\n-2\n+1\n-5\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 10 | codeforces | |
074aa427f0a9d0b96a63e7af248d4ad5 | Hard Process | You are given an array *a* with *n* elements. Each element of *a* is either 0 or 1.
Let's denote the length of the longest subsegment of consecutive elements in *a*, consisting of only numbers one, as *f*(*a*). You can change no more than *k* zeroes to ones to maximize *f*(*a*).
The first line contains two integers *n... | {"inputs": ["7 1\n1 0 0 1 1 0 1", "10 2\n1 0 0 1 0 1 0 1 0 1", "1 0\n0", "1 0\n0", "7 0\n0 1 0 0 0 1 0", "7 2\n1 0 1 1 0 0 0", "7 3\n1 0 0 0 0 1 0", "3 0\n1 1 1", "1 0\n1", "2 0\n0 1", "1 1\n0", "3 1\n0 0 1", "2 0\n0 0", "3 1\n0 0 0", "7 7\n1 0 1 0 0 0 0", "1 1\n1", "3 0\n0 0 0", "7 3\n1 1 1 1 1 1 1", "10 3\n0 0 1 0 0 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 104 | codeforces | |
075ac97ff5b98f22b52883039bbd0352 | I_love_\%username\% | 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.
One day Vasya decided to collect the results of all contests where his favorite coder participated and track the progress of his coolness. For e... | {"inputs": ["5\n100 50 200 150 200", "10\n4664 6496 5814 7010 5762 5736 6944 4850 3698 7242", "1\n6", "2\n2 1", "5\n100 36 53 7 81", "5\n7 36 53 81 100", "5\n100 81 53 36 7", "10\n8 6 3 4 9 10 7 7 1 3", "10\n1627 1675 1488 1390 1812 1137 1746 1324 1952 1862", "10\n1 3 3 4 6 7 7 8 9 10", "10\n1952 1862 1812 1746 1675 16... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 810 | codeforces | |
075aef5c4937c2c8ac9c008072e0cfb6 | Automatic Door | There is an automatic door at the entrance of a factory. The door works in the following way:
- when one or several people come to the door and it is closed, the door immediately opens automatically and all people immediately come inside, - when one or several people come to the door and it is open, all people immed... | {"inputs": ["1 1 3 4\n7", "4 3 4 2\n7 9 11", "10 10 51 69\n154 170 170 183 251 337 412 426 445 452", "70 10 26 17\n361 371 579 585 629 872 944 1017 1048 1541", "100 20 49 52\n224 380 690 1585 1830 1973 2490 2592 3240 3341 3406 3429 3549 3560 3895 3944 4344 4390 4649 4800", "100 30 36 47\n44 155 275 390 464 532 1186 120... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
07674258e17dc495bf72c77045b75824 | Devu and Partitioning of the Array | Devu being a small kid, likes to play a lot, but he only likes to play with arrays. While playing he came up with an interesting question which he could not solve, can you please solve it for him?
Given an array consisting of distinct integers. Is it possible to partition the whole array into *k* disjoint non-empty pa... | {"inputs": ["5 5 3\n2 6 10 5 9", "5 5 3\n7 14 2 9 5", "5 3 1\n1 2 3 7 5", "10 5 3\n194757070 828985446 11164 80016 84729 117765558 111730436 164044532 419732980 48834", "10 6 3\n861947514 34945 190135645 68731 44833 387988147 84308862 878151920 458358978 809653252", "10 8 3\n677037706 41099140 89128206 168458947 367939... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 12 | codeforces | |
0778aa7a20f7b27334849051c11f9602 | Students and Shoelaces | Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with each other. Specifically, each string ties together two students. Besides, if two students are tied, then the lace connects the f... | {"inputs": ["3 3\n1 2\n2 3\n3 1", "6 3\n1 2\n2 3\n3 4", "6 5\n1 4\n2 4\n3 4\n5 4\n6 4", "100 0", "5 5\n1 2\n2 3\n3 4\n4 5\n5 1", "5 4\n1 4\n4 3\n4 5\n5 2", "11 10\n1 2\n1 3\n3 4\n1 5\n5 6\n6 7\n1 8\n8 9\n9 10\n10 11", "7 7\n1 2\n2 3\n3 1\n1 4\n4 5\n4 6\n4 7", "12 49\n6 3\n12 9\n10 11\n3 5\n10 2\n6 9\n8 5\n6 12\n7 3\n3 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 237 | codeforces | |
07902d236432619d14659700820648c9 | Print Check | Kris works in a large company "Blake Technologies". As a best engineer of the company he was assigned a task to develop a printer that will be able to print horizontal and vertical strips. First prototype is already built and Kris wants to tests it. He wants you to implement the program that checks the result of the pr... | {"inputs": ["3 3 3\n1 1 3\n2 2 1\n1 2 2", "5 3 5\n1 1 1\n1 3 1\n1 5 1\n2 1 1\n2 3 1", "5 5 4\n1 2 1\n1 4 1\n2 2 1\n2 4 1", "4 6 8\n1 2 1\n2 2 2\n2 5 2\n1 1 1\n1 4 1\n1 3 2\n2 1 1\n2 6 1", "2 2 3\n1 1 1\n1 2 1\n2 1 2", "1 2 4\n1 1 1\n2 1 2\n2 2 3\n1 1 4", "2 1 5\n1 1 7\n1 2 77\n2 1 777\n1 1 77\n1 2 7", "2 1 1\n1 2 10000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 67 | codeforces | |
07989c83d8bc7dc0fdea38e2fd47631e | Limit | You are given two polynomials:
- *P*(*x*)<==<=*a*0·*x**n*<=+<=*a*1·*x**n*<=-<=1<=+<=...<=+<=*a**n*<=-<=1·*x*<=+<=*a**n* and - *Q*(*x*)<==<=*b*0·*x**m*<=+<=*b*1·*x**m*<=-<=1<=+<=...<=+<=*b**m*<=-<=1·*x*<=+<=*b**m*.
Calculate limit .
The first line contains two space-separated integers *n* and *m* (0<=≤<=*n*,<=*m*<=≤... | {"inputs": ["2 1\n1 1 1\n2 5", "1 0\n-1 3\n2", "0 1\n1\n1 0", "2 2\n2 1 6\n4 5 -7", "1 1\n9 0\n-5 2", "1 2\n5 3\n-3 2 -1", "1 2\n-4 8\n-2 5 -3", "3 2\n4 3 1 2\n-5 7 0", "2 1\n-3 5 1\n-8 0", "1 1\n-5 7\n3 1", "2 2\n-4 2 1\n-5 8 -19", "0 100\n1\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 26 | codeforces | |
07cfb7284bc4b16ef707dca90a4ae19b | Ciel and Flowers | Fox Ciel has some flowers: *r* red flowers, *g* green flowers and *b* blue flowers. She wants to use these flowers to make several bouquets. There are 4 types of bouquets:
- To make a "red bouquet", it needs 3 red flowers. - To make a "green bouquet", it needs 3 green flowers. - To make a "blue bouquet", it needs 3... | {"inputs": ["3 6 9", "4 4 4", "0 0 0", "0 3 6", "7 8 9", "8 8 9", "15 3 999", "32 62 92", "123456789 123456789 123456789", "3 5 5", "666806767 385540591 357848286", "80010646 727118126 817880463", "829651016 732259171 572879931", "242854896 442432924 180395753", "139978911 5123031 935395222", "553182792 10264076 395427... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 164 | codeforces | |
07e8e7ca410450aa80ee6f50332b2730 | Nested Segments | You are given a sequence *a*1,<=*a*2,<=...,<=*a**n* of one-dimensional segments numbered 1 through *n*. Your task is to find two distinct indices *i* and *j* such that segment *a**i* lies within segment *a**j*.
Segment [*l*1,<=*r*1] lies within segment [*l*2,<=*r*2] iff *l*1<=≥<=*l*2 and *r*1<=≤<=*r*2.
Print indices ... | {"inputs": ["5\n1 10\n2 9\n3 9\n2 3\n2 9", "3\n1 5\n2 6\n6 20", "1\n1 1000000000", "2\n1 1000000000\n1 1000000000", "2\n1 1000000000\n500000000 500000000", "2\n1 10\n2 10", "2\n10 20\n10 11", "3\n1 10\n10 20\n9 11", "3\n1 1\n2 3\n2 2", "4\n1 10\n2 11\n3 10000000\n3 100000000", "2\n3 7\n3 9", "3\n1 2\n2 3\n1 2", "3\n5 6... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 26 | codeforces | |
0805544b42a2fa2cf7c8af86b1828a24 | Woodcutters | Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below.
There are *n* trees located along the road at points with coordinates *x*1,<=*x*2,<=...,<=... | {"inputs": ["5\n1 2\n2 1\n5 10\n10 9\n19 1", "5\n1 2\n2 1\n5 10\n10 9\n20 1", "4\n10 4\n15 1\n19 3\n20 1", "35\n1 7\n3 11\n6 12\n7 6\n8 5\n9 11\n15 3\n16 10\n22 2\n23 3\n25 7\n27 3\n34 5\n35 10\n37 3\n39 4\n40 5\n41 1\n44 1\n47 7\n48 11\n50 6\n52 5\n57 2\n58 7\n60 4\n62 1\n67 3\n68 12\n69 8\n70 1\n71 5\n72 5\n73 6\n74 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 119 | codeforces | |
0809402a1a60bd55b9c7d727fb789750 | I'm Feeling Lucky! | You have one chip and one chance to play roulette. Are you feeling lucky?
none
Print your bet. Your chip must be placed entirely within some square (not on an edge or a corner shared by adjacent squares).
Sample Input
Sample Output
| {"inputs": ["1", "2"], "outputs": ["Red", "Red"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
081a9bd5d32d2b49603b55c4d22f0f1a | CGCDSSQ | Given a sequence of integers *a*1,<=...,<=*a**n* and *q* queries *x*1,<=...,<=*x**q* on it. For each query *x**i* you have to count the number of pairs (*l*,<=*r*) such that 1<=≤<=*l*<=≤<=*r*<=≤<=*n* and *gcd*(*a**l*,<=*a**l*<=+<=1,<=...,<=*a**r*)<==<=*x**i*.
is a greatest common divisor of *v*1,<=*v*2,<=...,<=*v**n*... | {"inputs": ["3\n2 6 3\n5\n1\n2\n3\n4\n6", "7\n10 20 3 15 1000 60 16\n10\n1\n2\n3\n4\n5\n6\n10\n20\n60\n1000", "10\n2 2 4 3 2 4 4 2 4 2\n104\n3\n3\n1\n4\n1\n1\n4\n1\n1\n3\n1\n1\n4\n1\n1\n1\n4\n3\n1\n1\n4\n1\n1\n1\n1\n1\n4\n1\n1\n1\n4\n1\n1\n4\n1\n1\n1\n1\n1\n4\n4\n1\n3\n1\n4\n1\n1\n1\n4\n1\n2\n4\n1\n4\n1\n4\n1\n4\n3\n1\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 14 | codeforces | |
081d8e6da4564dd6581c8fa783184064 | Bear and Tower of Cubes | Limak is a little polar bear. He plays by building towers from blocks. Every block is a cube with positive integer length of side. Limak has infinitely many blocks of each side length.
A block with side *a* has volume *a*3. A tower consisting of blocks with sides *a*1,<=*a*2,<=...,<=*a**k* has the total volume *a*13<=... | {"inputs": ["48", "6", "1", "994", "567000123", "123830583943", "3842529393411", "999999993700000", "2", "7", "8", "9", "112", "113", "114", "265", "995", "200385", "909383000", "108000000057", "385925923480002", "735412349812385", "980123123123123", "999088000000000", "409477218238716", "409477218238717", "40947721823... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 12 | codeforces | |
083a9815944008ba711925b5f50cf089 | Quest | Polycarp is making a quest for his friends. He has already made *n* tasks, for each task the boy evaluated how interesting it is as an integer *q**i*, and the time *t**i* in minutes needed to complete the task.
An interesting feature of his quest is: each participant should get the task that is best suited for him, d... | {"inputs": ["5 5\n1 1\n1 1\n2 2\n3 3\n4 4", "5 5\n4 1\n4 2\n4 3\n4 4\n4 5", "2 2\n1 1\n2 10", "10 1\n1 732\n1 649\n1 821\n1 756\n1 377\n1 216\n1 733\n1 420\n1 857\n1 193", "26 5\n2 377\n3 103\n1 547\n2 700\n3 616\n5 363\n2 316\n5 260\n3 385\n2 460\n4 206\n4 201\n3 236\n1 207\n1 400\n2 382\n2 365\n1 633\n1 775\n4 880\n1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
084b9cdce2412ac171a9ce35f14235bf | A and B and Compilation Errors | A and B are preparing themselves for programming contests.
B loves to debug his code. But before he runs the solution and starts debugging, he has to first compile the code.
Initially, the compiler displayed *n* compilation errors, each of them is represented as a positive integer. After some effort, B managed to fix... | {"inputs": ["5\n1 5 8 123 7\n123 7 5 1\n5 1 7", "6\n1 4 3 3 5 7\n3 7 5 4 3\n4 3 7 5", "3\n1 2 3\n3 2\n2", "10\n460626451 802090732 277246428 661369649 388684428 784303821 376287098 656422756 9301599 25720377\n277246428 388684428 661369649 460626451 656422756 802090732 9301599 784303821 376287098\n376287098 802090732 38... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 469 | codeforces | |
085cd5f8330878529b11be96555d4370 | Modular Exponentiation | The following problem is well-known: given integers *n* and *m*, calculate
where 2*n*<==<=2·2·...·2 (*n* factors), and denotes the remainder of division of *x* by *y*.
You are asked to solve the "reverse" problem. Given integers *n* and *m*, calculate
The first line contains a single integer *n* (1<=≤<=*n*<=≤<=108).... | {"inputs": ["4\n42", "1\n58", "98765432\n23456789", "8\n88127381", "32\n92831989", "92831989\n25", "100000000\n100000000", "7\n1234", "1\n1", "1\n100000000", "100000000\n1", "1\n2", "2\n1", "2\n2", "2\n3", "2\n4", "2\n5", "25\n33554432", "26\n33554432", "25\n67108864", "26\n67108864", "25\n92831989", "26\n92831989", "2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 207 | codeforces | |
0882f289635cddade3200c48974d967a | Summer sell-off | Summer holidays! Someone is going on trips, someone is visiting grandparents, but someone is trying to get a part-time job. This summer Noora decided that she wants to earn some money, and took a job in a shop as an assistant.
Shop, where Noora is working, has a plan on the following *n* days. For each day sales manag... | {"inputs": ["4 2\n2 1\n3 5\n2 3\n1 5", "4 1\n0 2\n0 3\n3 5\n0 6", "1 1\n5 8", "2 1\n8 12\n6 11", "2 1\n6 7\n5 7", "2 1\n5 7\n6 7", "2 1\n7 8\n3 6", "2 1\n9 10\n5 8", "2 1\n3 6\n7 8", "1 0\n10 20", "2 1\n99 100\n3 6", "4 2\n2 10\n3 10\n9 9\n5 10", "2 1\n3 4\n2 8", "50 2\n74 90\n68 33\n49 88\n52 13\n73 21\n77 63\n27 62\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 161 | codeforces | |
088b9540ecc22ef3dbc2ddd6c0379edb | Mysterious numbers - 1 | The input contains two integers *a*1,<=*a*2 (0<=≤<=*a**i*<=≤<=109), separated by a single space.
Output a single integer.
The input contains two integers *a*1,<=*a*2 (0<=≤<=*a**i*<=≤<=109), separated by a single space.
Output a single integer.
Sample Input
3 14
27 12
100 200
Sample Output
44
48
102
| {"inputs": ["3 14", "27 12", "100 200", "0 0", "31415 92653", "1000000000 0", "0 1000000000", "1000000000 1000000000", "804289383 846930886", "681692777 714636915", "957747793 424238335", "719885386 649760492", "596516649 189641421", "25202362 350490027", "783368690 102520059", "44897763 967513926", "365180540 54038342... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 134 | codeforces | |
088e63003cb5ff192da74dde87343ee2 | Cubes for Masha | Absent-minded Masha got set of *n* cubes for her birthday.
At each of 6 faces of each cube, there is exactly one digit from 0 to 9. Masha became interested what is the largest natural *x* such she can make using her new cubes all integers from 1 to *x*.
To make a number Masha can rotate her cubes and put them in a ro... | {"inputs": ["3\n0 1 2 3 4 5\n6 7 8 9 0 1\n2 3 4 5 6 7", "3\n0 1 3 5 6 8\n1 2 4 5 7 8\n2 3 4 6 7 9", "3\n0 1 2 3 4 5\n0 1 2 3 4 5\n0 1 2 3 4 5", "3\n1 2 3 7 8 9\n9 8 7 1 2 3\n7 9 2 3 1 8", "1\n5 2 2 5 6 7", "1\n7 6 5 8 9 0", "1\n2 5 9 6 7 9", "1\n6 3 1 9 4 9", "1\n1 9 8 3 7 8", "2\n1 7 2 0 4 3\n5 2 3 6 1 0", "2\n6 0 1 7... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 66 | codeforces | |
088f715b6f6f4cbc5ca4bf8d45009bac | Shark | For long time scientists study the behavior of sharks. Sharks, as many other species, alternate short movements in a certain location and long movements between locations.
Max is a young biologist. For $n$ days he watched a specific shark, and now he knows the distance the shark traveled in each of the days. All the d... | {"inputs": ["8\n1 2 7 3 4 8 5 6", "6\n25 1 2 3 14 36", "20\n1 20 2 19 3 18 4 17 5 16 6 15 7 14 8 13 9 12 10 11", "7\n1 2 5 7 3 4 6", "1\n1000000000", "1\n1", "2\n1 2", "2\n2 1", "22\n22 1 20 2 19 3 18 4 17 5 16 6 15 7 14 8 13 9 12 10 11 21", "63\n32 48 31 56 30 47 29 60 28 46 27 55 26 45 25 62 24 44 23 54 22 43 21 59 2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
089b8a488dba959a972c0b836cdecbcb | Ice Cave | You play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on forward, you need to descend one level lower and the only way to do this is to fall through the ice.
The level of the cave where you are is a rectangular square grid of *n* rows and *m* columns. Each cell consis... | {"inputs": ["4 6\nX...XX\n...XX.\n.X..X.\n......\n1 6\n2 2", "5 4\n.X..\n...X\nX.X.\n....\n.XX.\n5 3\n1 1", "4 7\n..X.XX.\n.XX..X.\nX...X..\nX......\n2 2\n1 6", "5 3\n.XX\n...\n.X.\n.X.\n...\n1 3\n4 1", "1 1\nX\n1 1\n1 1", "1 6\n.X...X\n1 2\n1 5", "7 1\nX\n.\n.\n.\nX\n.\n.\n5 1\n3 1", "1 2\nXX\n1 1\n1 1", "2 1\n.\nX\n2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 10 | codeforces | |
08aee82431bd65836b8729845b0259d3 | Building Permutation | Permutation *p* is an ordered set of integers *p*1,<=<=*p*2,<=<=...,<=<=*p**n*, consisting of *n* distinct positive integers, each of them doesn't exceed *n*. We'll denote the *i*-th element of permutation *p* as *p**i*. We'll call number *n* the size or the length of permutation *p*1,<=<=*p*2,<=<=...,<=<=*p**n*.
You ... | {"inputs": ["2\n3 0", "3\n-1 -1 2", "5\n-3 5 -3 3 3", "10\n9 6 -2 4 1 1 1 9 6 2", "9\n2 0 0 6 5 4 1 9 3", "100\n-77 57 -95 -23 53 -28 82 -83 38 -73 85 28 25 6 -43 4 -10 -30 -9 -92 14 34 -93 61 36 -100 90 -68 28 16 100 -3 97 30 36 -55 62 -62 53 74 -50 -23 67 11 22 -30 -19 83 7 84 43 90 -65 -75 -15 97 90 15 66 2 13 -91 9... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 473 | codeforces | |
08db6a75d49bfd251c8032e15206044e | Soldier and Badges | Colonel has *n* badges. He wants to give one badge to every of his *n* soldiers. Each badge has a coolness factor, which shows how much it's owner reached. Coolness factor can be increased by one for the cost of one coin.
For every pair of soldiers one of them should get a badge with strictly higher factor than the s... | {"inputs": ["4\n1 3 1 4", "5\n1 2 3 2 5", "5\n1 5 3 2 4", "10\n1 1 2 3 4 5 6 7 8 9", "11\n9 2 10 3 1 5 7 1 4 8 6", "4\n4 3 2 2", "1\n1", "50\n49 37 30 2 18 48 14 48 50 27 1 43 46 5 21 28 44 2 24 17 41 38 25 18 43 28 25 21 28 23 26 27 4 31 50 18 23 11 13 28 44 47 1 26 43 25 22 46 32 45", "50\n37 31 19 46 45 1 9 37 15 19... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
08e9079042b97f8649aeb560cccf9ea4 | Plug-in | Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy... | {"inputs": ["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa", "xraccabccbry", "a", "b", "il", "gfj", "babbbbbababa", "babbbbabbabbbababbabbbbbbabaabaababaaabbbbbabbbbaaaaabbaaabbaabaabbbbabbbababbabaaabbababaaababbbaaa", "aab", "abb", "aba", "ab"], "outputs": ["wre", "rezy", "a", "xy", "a", "b", "il", "gfj", "bababab... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 193 | codeforces | |
09028546725df22927fed193057b8579 | Interesting Array | We'll call an array of *n* non-negative integers *a*[1],<=*a*[2],<=...,<=*a*[*n*] interesting, if it meets *m* constraints. The *i*-th of the *m* constraints consists of three integers *l**i*, *r**i*, *q**i* (1<=≤<=*l**i*<=≤<=*r**i*<=≤<=*n*) meaning that value should be equal to *q**i*.
Your task is to find any inte... | {"inputs": ["3 1\n1 3 3", "3 2\n1 3 3\n1 3 2", "3 2\n1 2 536870912\n2 3 536870911", "1 1\n1 1 10", "1 2\n1 1 10\n1 1 5", "1 2\n1 1 1\n1 1 3"], "outputs": ["YES\n3 3 3", "NO", "YES\n536870912 1073741823 536870911", "YES\n10", "NO", "NO"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
093473bbf5193af87dcc821da582c09a | Mice problem | Igor the analyst fell asleep on the work and had a strange dream. In the dream his desk was crowded with computer mice, so he bought a mousetrap to catch them.
The desk can be considered as an infinite plane, then the mousetrap is a rectangle which sides are parallel to the axes, and which opposite sides are located i... | {"inputs": ["4\n7 7 9 8\n3 5 7 5\n7 5 2 4\n3 3 7 8\n6 6 3 2", "4\n7 7 9 8\n0 3 -5 4\n5 0 5 4\n9 9 -1 -6\n10 5 -7 -10", "4\n8 42 60 54\n9 54 -58 -62\n46 47 52 -76\n15 50 -37 -40\n54 51 78 64", "4\n17501 63318 51967 74514\n1305 84026 79493 -78504\n41159 81000 -44104 -42722\n31063 65435 25578 33487\n18330 79949 83467 -745... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
0934a086c394bd534e3de5e39e4d2d6d | none | Ryouko is an extremely forgetful girl, she could even forget something that has just happened. So in order to remember, she takes a notebook with her, called Ryouko's Memory Note. She writes what she sees and what she hears on the notebook, and the notebook became her memory.
Though Ryouko is forgetful, she is also bo... | {"inputs": ["4 6\n1 2 3 4 3 2", "10 5\n9 4 3 8 8", "5 10\n2 5 2 2 3 5 3 2 1 3", "10 20\n6 3 9 6 1 9 1 9 8 2 7 6 9 8 4 7 1 2 4 2", "100 100\n28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
09461ae3143b37d74a6e1f5d636239d7 | F1 Champions | Formula One championship consists of series of races called Grand Prix. After every race drivers receive points according to their final position. Only the top 10 drivers receive points in the following order 25, 18, 15, 12, 10, 8, 6, 4, 2, 1. At the conclusion of the championship the driver with most points is the cha... | {"inputs": ["3\n3\nHamilton\nVettel\nWebber\n2\nWebber\nVettel\n2\nHamilton\nVettel", "2\n7\nProst\nSurtees\nNakajima\nSchumacher\nButton\nDeLaRosa\nBuemi\n8\nAlonso\nProst\nNinoFarina\nJimClark\nDeLaRosa\nNakajima\nPatrese\nSurtees", "5\n3\nWebber\nTrulli\nJones\n9\nVilleneuve\nBerger\nJimClark\nReneArnoux\nKubica\nJo... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 15 | codeforces | |
09721cc3e0498b7c44b09aaff2a73aec | Fibonacci-ish | Yash has recently learnt about the Fibonacci sequence and is very excited about it. He calls a sequence Fibonacci-ish if
1. the sequence consists of at least two elements 1. *f*0 and *f*1 are arbitrary 1. *f**n*<=+<=2<==<=*f**n*<=+<=1<=+<=*f**n* for all *n*<=≥<=0.
You are given some sequence of integers *a*1,<=*a... | {"inputs": ["3\n1 2 -1", "5\n28 35 7 14 21", "11\n-9 -1 -10 9 7 -4 0 -8 -3 3 5", "10\n-4 -8 -8 8 -9 0 -7 9 1 0", "2\n2 2", "4\n1 -1 0 -2", "2\n1000000000 1000000000", "3\n1 1 2", "5\n0 0 0 0 0", "6\n1 -1 0 -1 -1 -2", "5\n-7 0 -7 -7 -14", "3\n0 -44 -49", "5\n-1 1 0 0 0", "2\n0 0", "3\n0 0 0", "4\n0 0 0 0", "5\n0 0 0 0 0... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 8 | codeforces | |
0997d5cbc678eb115b8bcdbbc2972483 | OR in Matrix | Let's define logical *OR* as an operation on two logical values (i. e. values that belong to the set {0,<=1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical *OR* of three or more logical values in the same manner:
where is equal to 1 if some *a**i*<==... | {"inputs": ["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1", "5 5\n1 1 1 1 1\n1 0 0 0 0\n1 0 0 0 0\n1 0 0 0 0\n1 0 0 0 0", "5 5\n1 1 1 0 1\n1 1 0 0 1\n0 0 1 1 1\n1 1 1 1 0\n1 0 1 1 1", "5 6\n1 0 0 0 1 1\n1 1 1 1 1 1\n1 1 1 1 1 1\n1 0 0 0 1 1\n1 0 0 0 1 1", "5 6\n1 1 1 1 0 1\n1 1 1 1 0 1\n1 1 1 0 1 1\n1 1 0 1 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 9 | codeforces | |
09d000220511dfbd7fd7cc548757d59f | Cinema Line | The new "Die Hard" movie has just been released! There are *n* people at the cinema box office standing in a huge line. Each of them has a single 100, 50 or 25 ruble bill. A "Die Hard" ticket costs 25 rubles. Can the booking clerk sell a ticket to each person and give the change if he initially has no money and sells t... | {"inputs": ["4\n25 25 50 50", "2\n25 100", "4\n50 50 25 25", "3\n25 50 100", "10\n25 25 25 25 25 25 25 25 25 25", "10\n50 50 50 50 50 50 50 50 50 50", "10\n100 100 100 100 100 100 100 100 100 100", "7\n25 25 25 25 50 100 50", "2\n25 25", "3\n50 100 100", "3\n25 50 50", "2\n50 25", "14\n25 25 25 25 25 25 25 50 50 50 100... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 231 | codeforces | |
09d40e2bc0055c8680e6d11af183944d | Chocolate | Bob has a rectangular chocolate bar of the size *W*<=×<=*H*. He introduced a cartesian coordinate system so that the point (0,<=0) corresponds to the lower-left corner of the bar, and the point (*W*,<=*H*) corresponds to the upper-right corner. Bob decided to split the bar into pieces by breaking it. Each break is a se... | {"inputs": ["2 2 2\n1 0 1 2\n0 1 1 1", "2 2 3\n1 0 1 2\n0 1 1 1\n1 1 2 1", "2 4 2\n0 1 2 1\n0 3 2 3", "5 5 3\n2 1 2 5\n0 1 5 1\n4 0 4 1", "10 10 4\n9 0 9 10\n4 0 4 10\n1 0 1 10\n1 4 4 4", "9 8 5\n4 3 4 4\n0 4 9 4\n5 4 5 8\n0 3 9 3\n1 4 1 8", "100 100 1\n0 14 100 14"], "outputs": ["1 1 2 ", "1 1 1 1 ", "2 2 4 ", "1 4 8 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
09f17070acfce7ef738cea733b9580cc | Guard Duty (easy) | The Rebel fleet is afraid that the Empire might want to strike back again. Princess Heidi needs to know if it is possible to assign *R* Rebel spaceships to guard *B* bases so that every base has exactly one guardian and each spaceship has exactly one assigned base (in other words, the assignment is a perfect matching).... | {"inputs": ["3 3\n0 0\n2 0\n3 1\n-2 1\n0 3\n2 2", "2 1\n1 0\n2 2\n3 1", "1 1\n3686 4362\n-7485 5112", "1 2\n1152 -7324\n-5137 -35\n-6045 -5271", "1 3\n-8824 -9306\n-5646 -9767\n8123 9355\n-6203 -1643", "1 5\n-8775 6730\n-3806 -6906\n-9256 -8240\n-1320 6849\n8155 746\n8284 -7317", "1 8\n8741 3638\n381 -9191\n7534 8792\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 31 | codeforces | |
0a0588ca9a3a9fe73cf3652e5a256608 | Counting Sticks | When new students come to the Specialized Educational and Scientific Centre (SESC) they need to start many things from the beginning. Sometimes the teachers say (not always unfairly) that we cannot even count. So our teachers decided to teach us arithmetics from the start. And what is the best way to teach students add... | {"inputs": ["||+|=|||||", "|||||+||=||", "|+|=||||||", "||||+||=||||||", "||||||||||||+|||||||||||=||||||||||||||||||||||", "||||||||||||||||||+||||||||||||||||||=||||||||||||||||||||||||||||||||||||||||||", "|||||||||||||||||||||||||||||||||||||||||||||||||+|||||||||||||||||||||||||=|||||||||||||||||||||||||", "||||||... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 66 | codeforces | |
0a48bba8bf70b092497deaa39818e3b3 | Replacement | Daniel has a string *s*, consisting of lowercase English letters and period signs (characters '.'). Let's define the operation of replacement as the following sequence of steps: find a substring ".." (two consecutive periods) in string *s*, of all occurrences of the substring let's choose the first one, and replace thi... | {"inputs": ["10 3\n.b..bz....\n1 h\n3 c\n9 f", "4 4\n.cc.\n2 .\n3 .\n2 a\n1 a", "3 3\n...\n1 .\n2 a\n3 b", "5 1\n.....\n5 z", "1 5\n.\n1 .\n1 w\n1 w\n1 .\n1 .", "2 7\nab\n1 w\n2 w\n1 c\n2 .\n2 .\n1 .\n2 b"], "outputs": ["4\n3\n1", "1\n3\n1\n1", "2\n0\n0", "3", "0\n0\n0\n0\n0", "0\n0\n0\n0\n0\n1\n0"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 24 | codeforces | |
0a6472dce2494a2e91dfd077f9e702f5 | Ksusha and Square | Ksusha is a vigorous mathematician. She is keen on absolutely incredible mathematical riddles.
Today Ksusha came across a convex polygon of non-zero area. She is now wondering: if she chooses a pair of distinct points uniformly among all integer points (points with integer coordinates) inside or on the border of the ... | {"inputs": ["3\n0 0\n5 5\n5 0", "4\n-1 3\n4 5\n6 2\n3 -5", "3\n17 136\n859 937\n16 641", "6\n-29 6\n-28 27\n-2 18\n13 9\n20 -18\n19 -27", "7\n-29 5\n-20 13\n-4 22\n8 20\n21 9\n16 -29\n-23 -30", "8\n-18 -20\n16 -28\n29 -29\n29 25\n15 27\n-19 30\n-28 18\n-30 -16", "6\n13 -22\n26 -11\n30 12\n22 19\n-10 24\n-29 6", "6\n13 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
0a77299d877452686d821dfc2e1a59db | Kingdom and its Cities | Meanwhile, the kingdom of K is getting ready for the marriage of the King's daughter. However, in order not to lose face in front of the relatives, the King should first finish reforms in his kingdom. As the King can not wait for his daughter's marriage, reforms must be finished as soon as possible.
The kingdom curren... | {"inputs": ["4\n1 3\n2 3\n4 3\n4\n2 1 2\n3 2 3 4\n3 1 2 4\n4 1 2 3 4", "7\n1 2\n2 3\n3 4\n1 5\n5 6\n5 7\n1\n4 2 4 6 7", "7\n1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n5\n4 1 3 5 7\n3 2 4 6\n2 1 7\n2 3 4\n3 1 6 7", "30\n1 2\n1 3\n1 4\n2 5\n2 6\n2 7\n4 8\n4 9\n6 10\n6 11\n11 30\n11 23\n30 24\n30 25\n25 26\n25 27\n27 29\n27 28\n23 20\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
0a8a38ebf3e78262dba34af1e7e92873 | LCS Again | You are given a string *S* of length *n* with each character being one of the first *m* lowercase English letters.
Calculate how many different strings *T* of length *n* composed from the first *m* lowercase English letters exist such that the length of LCS (longest common subsequence) between *S* and *T* is *n*<=-<=... | {"inputs": ["3 3\naaa", "3 3\naab", "1 2\na", "10 9\nabacadefgh", "15 3\nabababababababa", "100 26\njysrixyptvsesnapfljeqkytlpeepjopspmkviqdqbdkylvfiawhdjjdvqqvcjmmsgfdmpjwahuwhgsyfcgnefzmqlvtvqqfbfsf", "1 26\nz"], "outputs": ["6", "11", "1", "789", "345", "237400", "25"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
0a939d1c828a3ea1733a4fa8264770f0 | Sereja and Bottles | Sereja and his friends went to a picnic. The guys had *n* soda bottles just for it. Sereja forgot the bottle opener as usual, so the guys had to come up with another way to open bottles.
Sereja knows that the *i*-th bottle is from brand *a**i*, besides, you can use it to open other bottles of brand *b**i*. You can use... | {"inputs": ["4\n1 1\n2 2\n3 3\n4 4", "4\n1 2\n2 3\n3 4\n4 1", "3\n2 828\n4 392\n4 903", "4\n2 3\n1 772\n3 870\n3 668", "5\n1 4\n6 6\n4 3\n3 4\n4 758", "6\n4 843\n2 107\n10 943\n9 649\n7 806\n6 730", "7\n351 955\n7 841\n102 377\n394 102\n549 440\n630 324\n624 624", "8\n83 978\n930 674\n542 22\n834 116\n116 271\n640 930\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 152 | codeforces | |
0a95eeba755158f174d4cf94db15d536 | Playing on Graph | Vova and Marina love offering puzzles to each other. Today Marina offered Vova to cope with the following task.
Vova has a non-directed graph consisting of *n* vertices and *m* edges without loops and multiple edges. Let's define the operation of contraction two vertices *a* and *b* that are not connected by an edge. ... | {"inputs": ["5 4\n1 2\n2 3\n3 4\n3 5", "4 6\n1 2\n2 3\n1 3\n3 4\n2 4\n1 4", "4 2\n1 3\n2 4", "1 0", "1000 0", "1000 4\n100 200\n200 300\n300 400\n400 100", "14 30\n12 10\n1 7\n12 13\n7 3\n14 10\n3 12\n11 1\n2 12\n2 5\n14 3\n14 1\n14 4\n6 7\n12 6\n9 5\n7 10\n8 5\n6 14\n13 7\n4 12\n9 10\n1 9\n14 5\n1 8\n2 13\n5 11\n8 6\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
0aafc953e4cb8c334f377fa3d8dade25 | Mike and Cellphone | While swimming at the beach, Mike has accidentally dropped his cellphone into the water. There was no worry as he bought a cheap replacement phone with an old-fashioned keyboard. The keyboard has only ten digital equal-sized keys, located in the following way:
Together with his old phone, he lost all his contacts and ... | {"inputs": ["3\n586", "2\n09", "9\n123456789", "3\n911", "3\n089", "3\n159", "9\n000000000", "4\n0874", "6\n235689", "2\n10", "3\n358", "6\n123456", "1\n0", "4\n0068", "6\n021149", "5\n04918", "2\n05", "4\n0585", "4\n0755", "2\n08", "4\n0840", "9\n103481226", "4\n1468", "7\n1588216", "9\n188758557", "1\n2", "2\n22", "8... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 74 | codeforces | |
0ac572944c18ff62cd4cdee0e5b6d977 | Prefix Sums | Consider the function *p*(*x*), where *x* is an array of *m* integers, which returns an array *y* consisting of *m*<=+<=1 integers such that *y**i* is equal to the sum of first *i* elements of array *x* (0<=≤<=*i*<=≤<=*m*).
You have an infinite sequence of arrays *A*0,<=*A*1,<=*A*2..., where *A*0 is given in the input... | {"inputs": ["2 2\n1 1", "3 6\n1 1 1", "3 1\n1 0 1", "3 1000000000000000000\n5 4 5", "4 1000000000000000000\n0 4 4 5", "5 1000000000000000000\n5 7 4 2 5", "3 999999999000999944\n7 2 6", "4 999999999000531216\n8 7 4 6", "5 152742477016321721\n0 0 2 6 2", "6 1000000000000000000\n1 1 0 1 0 1", "7 1000000000000000000\n77 94... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 9 | codeforces | |
0accdcf59f157331ff148bce81f9c08f | The Child and Binary Tree | Our child likes computer science very much, especially he likes binary trees.
Consider the sequence of *n* distinct positive integers: *c*1,<=*c*2,<=...,<=*c**n*. The child calls a vertex-weighted rooted binary tree good if and only if for every vertex *v*, the weight of *v* is in the set {*c*1,<=*c*2,<=...,<=*c**n*}.... | {"inputs": ["2 3\n1 2", "3 10\n9 4 3", "5 10\n13 10 6 4 15", "1 1\n1", "10 100\n9 95 37 56 39 86 59 5 68 82", "10 100\n7 9 8 6 4 10 1 3 5 2", "50 1000\n10 93 11 34 85 17 61 87 58 38 56 83 55 52 70 18 47 82 36 67 53 98 81 41 23 39 13 99 64 16 91 48 22 12 92 78 86 1 65 46 21 57 7 72 31 71 90 68 35 45", "100 1000\n302 622... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
0adb4a5d61e65a02984cf51e149b2854 | Hongcow Builds A Nation | Hongcow is ruler of the world. As ruler of the world, he wants to make it easier for people to travel by road within their own countries.
The world can be modeled as an undirected graph with *n* nodes and *m* edges. *k* of the nodes are home to the governments of the *k* countries that make up the world.
There is at ... | {"inputs": ["4 1 2\n1 3\n1 2", "3 3 1\n2\n1 2\n1 3\n2 3", "10 3 2\n1 10\n1 2\n1 3\n4 5", "1 0 1\n1", "1000 0 1\n72", "24 38 2\n4 13\n7 1\n24 1\n2 8\n17 2\n2 18\n22 2\n23 3\n5 9\n21 5\n6 7\n6 19\n6 20\n11 7\n7 20\n13 8\n16 8\n9 10\n14 9\n21 9\n12 10\n10 22\n23 10\n17 11\n11 24\n20 12\n13 16\n13 23\n15 14\n17 14\n14 20\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 70 | codeforces | |
0ae8a5a7b4f9d9d1a43757a5dda02216 | Three States | The famous global economic crisis is approaching rapidly, so the states of Berman, Berance and Bertaly formed an alliance and allowed the residents of all member states to freely pass through the territory of any of them. In addition, it was decided that a road between the states should be built to guarantee so that on... | {"inputs": ["4 5\n11..2\n#..22\n#.323\n.#333", "1 5\n1#2#3", "3 4\n.2..\n...3\n.1#.", "10 10\n##.#..#.#2\n...###....\n#..#....##\n.....#....\n.#........\n.....#####\n...#..#...\n....###...\n###.##...#\n.#...1#.3.", "4 3\n..#\n.3.\n..2\n..1", "5 5\n.2...\n#2.3.\n.#..#\n.#.11\n#..#.", "1 3\n231", "3 1\n3\n1\n2", "1 4\n12... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
0af3b1bc78e71d52499dca72feb7585a | Matrix | You have a string of decimal digits *s*. Let's define *b**ij*<==<=*s**i*·*s**j*. Find in matrix *b* the number of such rectangles that the sum *b**ij* for all cells (*i*,<=*j*) that are the elements of the rectangle equals *a* in each rectangle.
A rectangle in a matrix is a group of four integers (*x*,<=*y*,<=*z*,<=*t... | {"inputs": ["10\n12345", "16\n439873893693495623498263984765", "0\n1230", "8398\n67950927224842887617892831243606761170908507858527", "2\n11", "4\n111", "0\n0", "1\n0", "0\n1", "0\n0000", "1\n00", "1\n000", "1\n11111", "700\n10010101101100110011110110010100010000000001100111100011111000101101110001011000000000010010000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
0afab2f715e57b35f1e1aec2cc5c45c4 | Mike and Feet | Mike is the president of country What-The-Fatherland. There are *n* bears living in this country besides Mike. All of them are standing in a line and they are numbered from 1 to *n* from left to right. *i*-th bear is exactly *a**i* feet high.
A group of bears is a non-empty contiguous segment of the line. The size of... | {"inputs": ["10\n1 2 3 4 5 4 3 2 1 6", "3\n524125987 923264237 374288891", "5\n585325539 365329221 412106895 291882089 564718673", "20\n452405440 586588704 509061481 552472140 16115810 148658854 66743034 628305150 677780684 519361360 208050516 401554301 954478790 346543678 387546138 832279893 641889899 80960260 7178028... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 41 | codeforces | |
0afd39c0566d0ee67cbd847e8bb6ed43 | Chess | Two chess pieces, a rook and a knight, stand on a standard chessboard 8<=×<=8 in size. The positions in which they are situated are known. It is guaranteed that none of them beats the other one.
Your task is to find the number of ways to place another knight on the board so that none of the three pieces on the board b... | {"inputs": ["a1\nb2", "a8\nd4", "a8\nf1", "f8\nh3", "g8\nb7", "h1\ng5", "c6\nb5", "c1\nd2", "g3\nh4", "e3\ng5", "f8\na3", "a2\nh8", "a3\nc5", "g1\ne6", "e1\na7", "b5\nc1", "b2\ne1", "h8\ng2", "a3\nd6", "g6\nb7", "c8\ne6", "e6\nf2", "b6\nd8", "a4\nd1", "b5\nh8", "h6\na1", "c3\na8", "g5\nd2", "b6\ng7", "h6\na8", "a8\nb7"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 63 | codeforces | |
0b127ebd2dca7cee059e0809b100c238 | Forgotten Episode | Polycarpus adores TV series. Right now he is ready to finish watching a season of a popular sitcom "Graph Theory". In total, the season has *n* episodes, numbered with integers from 1 to *n*.
Polycarpus watches episodes not one by one but in a random order. He has already watched all the episodes except for one. Which... | {"inputs": ["10\n3 8 10 1 7 9 6 5 2", "5\n4 3 2 1", "2\n1", "2\n2", "3\n1 2", "3\n1 3", "3\n2 3", "3\n2 1", "3\n3 1", "3\n3 2", "5\n2 3 4 5", "5\n5 4 3 2", "5\n5 2 4 3", "5\n1 2 3 4", "5\n2 1 3 4", "5\n1 5 3 4", "5\n1 4 5 2", "5\n2 1 5 3", "5\n2 3 4 5"], "outputs": ["4", "5", "2", "1", "3", "2", "1", "3", "2", "1", "1"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 226 | codeforces | |
0b317f93ef6e52490255f4b48d43b09a | Tickets | As a big fan of Formula One, Charlie is really happy with the fact that he has to organize ticket sells for the next Grand Prix race in his own city. Unfortunately, the finacial crisis is striking everywhere and all the banknotes left in his country are valued either 10 euros or 20 euros. The price of all tickets for t... | {"inputs": ["5 3 1", "0 5 5", "0 1 0", "95105 76851 10", "60503 53620 1", "25902 30390 2", "53475 7159 4", "18874 21756 8", "84273 98526 10", "49672 75296 0", "15071 89892 4", "80471 66661 6", "39377 94889 10", "15566 15472 0", "91756 73882 2", "67945 32292 4", "44133 52876 8", "100000 100000 10", "100000 50000 10", "1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 11 | codeforces | |
0b43e528e6abeac53cf533a31aa42623 | Old Peykan | There are *n* cities in the country where the Old Peykan lives. These cities are located on a straight line, we'll denote them from left to right as *c*1,<=*c*2,<=...,<=*c**n*. The Old Peykan wants to travel from city *c*1 to *c**n* using roads. There are (*n*<=-<=1) one way roads, the *i*-th road goes from city *c**i*... | {"inputs": ["4 6\n1 2 5 2\n2 3 3 4", "2 3\n5 6\n5 5", "24 3\n11 8 8 12 17 4 4 25 39 37 31 32 38 34 29 29 34 39 39 39 17 9 24 6\n3 5 4 3 3 3 4 3 4 3 3 3 3 4 3 3 4 3 4 3 3 3 3 3", "43 5\n6 7 15 12 15 7 22 33 38 15 7 23 31 21 26 41 25 14 26 33 5 28 22 6 35 17 19 32 41 27 20 25 5 32 37 19 40 9 25 22 10 24 9\n3 5 3 6 5 4 5 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 14 | codeforces | |
0b492da43be959fece6400df5847d362 | Greg and Array | Greg has an array *a*<==<=*a*1,<=*a*2,<=...,<=*a**n* and *m* operations. Each operation looks as: *l**i*, *r**i*, *d**i*, (1<=≤<=*l**i*<=≤<=*r**i*<=≤<=*n*). To apply operation *i* to the array means to increase all array elements with numbers *l**i*,<=*l**i*<=+<=1,<=...,<=*r**i* by value *d**i*.
Greg wrote down *k* qu... | {"inputs": ["3 3 3\n1 2 3\n1 2 1\n1 3 2\n2 3 4\n1 2\n1 3\n2 3", "1 1 1\n1\n1 1 1\n1 1", "4 3 6\n1 2 3 4\n1 2 1\n2 3 2\n3 4 4\n1 2\n1 3\n2 3\n1 2\n1 3\n2 3", "1 1 1\n0\n1 1 0\n1 1"], "outputs": ["9 18 17", "2", "5 18 31 20", "0"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 126 | codeforces | |
0b99387d2eff332b59651e06fd553dc0 | none | Jeff loves regular bracket sequences.
Today Jeff is going to take a piece of paper and write out the regular bracket sequence, consisting of *nm* brackets. Let's number all brackets of this sequence from 0 to *nm* - 1 from left to right. Jeff knows that he is going to spend *a**i* *mod* *n* liters of ink on the *i*-th... | {"inputs": ["2 6\n1 2\n2 1", "1 10000000\n2\n3", "3 184\n3 2 8\n3 9 2", "4 26\n10 2 5 9\n5 4 2 5", "3 76\n4 7 9\n10 1 1", "3 98\n6 1 9\n10 2 4", "5 114\n7 5 8 10 10\n2 7 9 4 5", "1 14\n7\n6", "5 142\n8 7 6 2 2\n8 2 6 1 7", "1 184\n8\n8", "2 1900670\n10 3\n9 6", "6 17656\n2 7 4 7 7 3\n3 5 3 6 9 10", "16 3273408\n3 2 8 8... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
0bd6a065baad38a3fd4c209f4a95f13b | LCIS | This problem differs from one which was on the online contest.
The sequence *a*1,<=*a*2,<=...,<=*a**n* is called increasing, if *a**i*<=<<=*a**i*<=+<=1 for *i*<=<<=*n*.
The sequence *s*1,<=*s*2,<=...,<=*s**k* is called the subsequence of the sequence *a*1,<=*a*2,<=...,<=*a**n*, if there exist such a set of inde... | {"inputs": ["7\n2 3 1 6 5 4 6\n4\n1 3 5 6", "5\n1 2 0 2 1\n3\n1 0 1", "2\n6 10\n3\n6 3 3", "1\n7\n2\n7 9", "3\n37 49 24\n3\n33 5 70", "10\n7 10 1 2 1 7 1 5 9 9\n9\n6 2 5 6 7 7 5 5 2", "9\n7 0 1 2 6 0 10 3 5\n4\n8 4 0 3", "9\n7 4 4 5 0 6 5 4 10\n4\n5 2 10 9", "8\n7 8 6 6 8 10 3 3\n5\n7 4 10 8 7", "7\n4 2 4 3 10 3 6\n9\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 13 | codeforces |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.