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 |
|---|---|---|---|---|---|---|---|---|---|
1cf5b764b7c020a63fed240ea3c9ed09 | Pasha and Phone | Pasha has recently bought a new phone jPager and started adding his friends' phone numbers there. Each phone number consists of exactly *n* digits.
Also Pasha has a number *k* and two sequences of length *n*<=/<=*k* (*n* is divisible by *k*) *a*1,<=*a*2,<=...,<=*a**n*<=/<=*k* and *b*1,<=*b*2,<=...,<=*b**n*<=/<=*k*. Le... | {"inputs": ["6 2\n38 56 49\n7 3 4", "8 2\n1 22 3 44\n5 4 3 2", "2 1\n9 9\n9 9", "2 1\n9 9\n0 9", "4 1\n4 3 2 1\n1 2 3 4", "18 9\n2 3\n0 4", "4 4\n1122\n2", "10 5\n8378 11089\n7 5", "10 5\n52057 11807\n0 1", "10 1\n3 1 1 4 8 7 5 6 4 1\n0 0 0 5 5 6 8 8 4 0", "100 4\n388 2056 122 1525 2912 1465 3066 257 5708 3604 3039 618... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 30 | codeforces | |
1cfd8e00daefe70b7d76fc42938a21b8 | New Password | Innokentiy decides to change the password in the social net "Contact!", but he is too lazy to invent a new password by himself. That is why he needs your help.
Innokentiy decides that new password should satisfy the following conditions:
- the length of the password must be equal to *n*, - the password should cons... | {"inputs": ["4 3", "6 6", "5 2", "3 2", "10 2", "26 13", "100 2", "100 10", "3 3", "6 3", "10 3", "50 3", "90 2", "6 2", "99 3", "4 2", "100 3", "40 22", "13 8", "16 15", "17 17", "19 4", "100 26", "100 25", "26 26", "27 26", "2 2", "26 25", "99 2", "99 26", "4 4", "5 3", "5 4", "5 5", "24 22", "26 14", "26 15", "30 12... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 611 | codeforces | |
1d1a1e0764f53ad7c036de5671142880 | Sad powers | You're given *Q* queries of the form (*L*,<=*R*).
For each query you have to find the number of such *x* that *L*<=≤<=*x*<=≤<=*R* and there exist integer numbers *a*<=><=0, *p*<=><=1 such that *x*<==<=*a**p*.
The first line contains the number of queries *Q* (1<=≤<=*Q*<=≤<=105).
The next *Q* lines contains two... | {"inputs": ["6\n1 4\n9 9\n5 7\n12 29\n137 591\n1 1000000", "20\n862 928\n758 964\n541 789\n622 943\n328 900\n14 764\n217 972\n461 847\n442 468\n900 986\n518 529\n938 993\n549 851\n690 944\n484 601\n320 910\n98 868\n816 915\n765 880\n551 770"], "outputs": ["2\n1\n0\n3\n17\n1111", "1\n4\n5\n6\n14\n32\n20\n9\n0\n2\n1\n1\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
1d43ed69859cb281bfafbf1d2a06eb3f | Promocodes with Mistakes | During a New Year special offer the "Sudislavl Bars" offered *n* promo codes. Each promo code consists of exactly six digits and gives right to one free cocktail at the bar "Mosquito Shelter". Of course, all the promocodes differ.
As the "Mosquito Shelter" opens only at 9, and partying in Sudislavl usually begins at a... | {"inputs": ["2\n000000\n999999", "6\n211111\n212111\n222111\n111111\n112111\n121111", "1\n123456", "2\n000000\n099999", "2\n000000\n009999", "2\n000000\n000999", "2\n000000\n000099", "2\n000000\n000009", "1\n000000", "1\n999999", "10\n946965\n781372\n029568\n336430\n456975\n119377\n179098\n925374\n878716\n461563", "10\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 15 | codeforces | |
1d8453764c751d2f477673148a740919 | Points and Segments (easy) | Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following.
Iahub wants to draw *n* distinct points and *m* s... | {"inputs": ["3 3\n3 7 14\n1 5\n6 10\n11 15", "3 4\n1 2 3\n1 2\n2 3\n5 6\n2 2", "10 10\n3 4 2 6 1 9 0 5 8 7\n5 7\n2 6\n0 1\n5 6\n3 4\n2 5\n2 10\n4 6\n3 6\n3 7", "3 3\n50 51 52\n1 5\n6 10\n11 15", "3 1\n1 2 3\n2 3"], "outputs": ["0 0 0", "1 0 1 ", "0 1 1 1 0 0 1 0 1 0 ", "1 0 1 ", "1 0 1 "]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 29 | codeforces | |
1d95be69ba194a67b9185fef152c655f | Army Creation | As you might remember from our previous rounds, Vova really likes computer games. Now he is playing a strategy game known as Rage of Empires.
In the game Vova can hire *n* different warriors; *i*th warrior has the type *a**i*. Vova wants to create a balanced army hiring some subset of warriors. An army is called balan... | {"inputs": ["6 2\n1 1 1 2 2 2\n5\n1 6\n4 3\n1 1\n2 6\n2 6", "5 5\n3 4 4 2 1\n5\n5 5\n5 4\n5 4\n3 4\n5 5", "5 5\n2 1 2 4 1\n5\n5 3\n1 1\n5 1\n2 1\n2 3", "10 5\n4 5 7 3 5 6 6 8 10 9\n5\n10 8\n9 8\n7 5\n8 10\n5 8", "20 5\n9 5 4 10 2 1 8 9 7 4 1 5 4 9 8 10 5 8 4 10\n5\n9 13\n17 13\n6 12\n13 11\n8 8", "100 5\n45 51 23 10 62... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
1dab00c247d5b6f4504eecd845bdc5a9 | Rotate, Flip and Zoom | Polycarp is writing the prototype of a graphic editor. He has already made up his mind that the basic image transformations in his editor will be: rotate the image 90 degrees clockwise, flip the image horizontally (symmetry relative to the vertical line, that is, the right part of the image moves to the left, and vice ... | {"inputs": ["3 2\n.*.\n.*.", "9 20\n**.......\n****.....\n******...\n*******..\n..******.\n....****.\n......***\n*.....***\n*********\n*********\n*********\n*********\n....**...\n...****..\n..******.\n.********\n****..***\n***...***\n**.....**\n*.......*", "1 100\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.\n.... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 65 | codeforces | |
1dad4aab8c75f71ea2952a36002504ad | Predict Outcome of the Game | There are *n* games in a football tournament. Three teams are participating in it. Currently *k* games had already been played.
You are an avid football fan, but recently you missed the whole *k* games. Fortunately, you remember a guess of your friend for these *k* games. Your friend did not tell exact number of wins... | {"inputs": ["5\n3 0 0 0\n3 3 0 0\n6 4 1 0\n6 3 3 0\n3 3 3 2"], "outputs": ["yes\nyes\nyes\nno\nno"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
1dafc81807943eded66d0fe91f4eb6db | Help Chef Gerasim | In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup... | {"inputs": ["5\n270\n250\n250\n230\n250", "5\n250\n250\n250\n250\n250", "5\n270\n250\n249\n230\n250", "4\n200\n190\n210\n200", "4\n1\n2\n3\n4", "1\n0", "2\n0\n0", "2\n0\n1", "2\n0\n2", "2\n1\n0", "2\n1\n1", "2\n1\n2", "2\n2\n0", "2\n2\n1", "2\n2\n2", "3\n0\n0\n0", "3\n0\n0\n1", "3\n0\n0\n2", "3\n0\n1\n0", "3\n0\n1\n1",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 15 | codeforces | |
1df64825d70c19acab8be693fb95a789 | Bear and Three Musketeers | Do you know a story about the three musketeers? Anyway, you will learn about its origins now.
Richelimakieu is a cardinal in the city of Bearis. He is tired of dealing with crime by himself. He needs three brave warriors to help him to fight against bad guys.
There are *n* warriors. Richelimakieu wants to choose thre... | {"inputs": ["5 6\n1 2\n1 3\n2 3\n2 4\n3 4\n4 5", "7 4\n2 1\n3 6\n5 1\n1 7", "5 0", "7 14\n3 6\n2 3\n5 2\n5 6\n7 5\n7 4\n6 2\n3 5\n7 1\n4 1\n6 1\n7 6\n6 4\n5 4", "15 15\n4 15\n12 1\n15 6\n11 6\n15 7\n6 8\n15 10\n6 12\n12 8\n15 8\n15 3\n11 9\n7 3\n6 4\n12 11", "12 66\n9 12\n1 4\n8 4\n5 3\n10 5\n12 2\n3 2\n2 7\n1 7\n3 7\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 101 | codeforces | |
1e05022190289ddb4726bb4ad2a1b069 | Ancient Berland Circus | Nowadays all circuses in Berland have a round arena with diameter 13 meters, but in the past things were different.
In Ancient Berland arenas in circuses were shaped as a regular (equiangular) polygon, the size and the number of angles could vary from one circus to another. In each corner of the arena there was a spec... | {"inputs": ["0.000000 0.000000\n1.000000 1.000000\n0.000000 1.000000", "71.756151 7.532275\n-48.634784 100.159986\n91.778633 158.107739", "18.716839 40.852752\n66.147248 -4.083161\n111.083161 43.347248", "-13.242302 -45.014124\n-33.825369 51.083964\n84.512928 -55.134407", "115.715093 141.583620\n136.158119 -23.780834\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 15 | codeforces | |
1e05c048abf89b10b87662857fb3d340 | Porcelain | During her tantrums the princess usually smashes some collectable porcelain. Every furious shriek is accompanied with one item smashed.
The collection of porcelain is arranged neatly on *n* shelves. Within each shelf the items are placed in one row, so that one can access only the outermost items — the leftmost or the... | {"inputs": ["2 3\n3 3 7 2\n3 4 1 5", "1 3\n4 4 3 1 2", "1 4\n6 5 1 10 1 1 5", "3 2\n1 10\n1 2\n1 5", "1 68\n100 26 58 15 8 69 66 49 97 18 74 27 39 19 76 37 25 4 88 75 17 79 41 21 44 39 7 42 63 82 92 87 41 85 25 30 43 80 95 70 98 88 16 15 97 74 81 76 33 19 64 3 14 72 17 36 33 21 34 59 38 75 48 1 57 20 81 56 74 67 14 89 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
1e20de0e4e64dcaf65977de7275cd6b7 | Array | Vitaly has an array of *n* distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold:
1. The product of all numbers in the first set is less than zero (<=<<=0). 1. The product of all numbers in the second set is greater than zero (<=><=0). 1. The produ... | {"inputs": ["3\n-1 2 0", "4\n-1 -2 -3 0", "5\n-1 -2 1 2 0", "100\n-64 -51 -75 -98 74 -26 -1 -8 -99 -76 -53 -80 -43 -22 -100 -62 -34 -5 -65 -81 -18 -91 -92 -16 -23 -95 -9 -19 -44 -46 -79 52 -35 4 -87 -7 -90 -20 -71 -61 -67 -50 -66 -68 -49 -27 -32 -57 -85 -59 -30 -36 -3 -77 86 -25 -94 -56 60 -24 -37 -72 -41 -31 11 -48 28... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 248 | codeforces | |
1e526c78e232fa1191bd872a5767a30a | Maximum Control (easy) | The Resistance is trying to take control over all planets in a particular solar system. This solar system is shaped like a tree. More precisely, some planets are connected by bidirectional hyperspace tunnels in such a way that there is a path between every pair of the planets, but removing any tunnel would disconnect s... | {"inputs": ["5\n4 1\n4 2\n1 3\n1 5", "4\n1 2\n4 3\n1 4", "10\n4 3\n2 6\n10 1\n5 7\n5 8\n10 6\n5 9\n9 3\n2 9"], "outputs": ["3", "2", "4"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 104 | codeforces | |
1e55fccee6224084c321804a4e02e995 | Forecast | The Department of economic development of IT City created a model of city development till year 2100.
To prepare report about growth perspectives it is required to get growth estimates from the model.
To get the growth estimates it is required to solve a quadratic equation. Since the Department of economic developmen... | {"inputs": ["1 30 200", "1 1 -1", "-1 1 1", "1000 1 -1", "-1 1000 1", "1000 1000 -999", "633 304 -186", "-181 -227 368", "-779 -814 321", "1 1 0", "1 0 -9"], "outputs": ["-10.000000000000000\n-20.000000000000000", "0.618033988749895\n-1.618033988749895", "1.618033988749895\n-0.618033988749895", "0.031126729201737\n-0.0... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 10 | codeforces | |
1e5d848978933dde5b192f0f60219f6d | Credit Card | Recenlty Luba got a credit card and started to use it. Let's consider *n* consecutive days Luba uses the card.
She starts with 0 money on her account.
In the evening of *i*-th day a transaction *a**i* occurs. If *a**i*<=><=0, then *a**i* bourles are deposited to Luba's account. If *a**i*<=<<=0, then *a**i* bour... | {"inputs": ["5 10\n-1 5 0 -5 3", "3 4\n-10 0 20", "5 10\n-5 0 10 -11 0", "5 13756\n-2 -9 -10 0 10", "20 23036\n-1 1 -1 -1 -1 -1 1 -1 -1 0 0 1 1 0 0 1 0 0 -1 -1", "12 82016\n1 -2 -1 -1 -2 -1 0 -2 -1 1 -2 2", "7 8555\n-2 -3 -2 3 0 -2 0", "16 76798\n-1 11 -7 -4 0 -11 -12 3 0 -7 6 -4 8 6 5 -10", "20 23079\n0 1 1 -1 1 0 -1 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
1e69e3da1ef219365379e87e1145a53c | Crosses | There is a board with a grid consisting of *n* rows and *m* columns, the rows are numbered from 1 from top to bottom and the columns are numbered from 1 from left to right. In this grid we will denote the cell that lies on row number *i* and column number *j* as (*i*,<=*j*).
A group of six numbers (*a*,<=*b*,<=*c*,<=*... | {"inputs": ["2 2 1", "3 4 5", "2 2 3", "5 1 3", "9 7 55", "5 10 25", "20 12 101", "21 10 155", "49 7 105", "74 99 5057", "9 10 5", "10 14 47", "6 14 23", "27 9 57", "20 17 319", "2 20 37", "10 4 33", "30 8 53", "48 76 2921", "2 78 117", "2 55 9", "56 54 2639", "72 65 2843", "32 71 297", "48 81 2573", "1 1 1", "100 100 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
1e6b1ebdeec5065319d5165cebc63f4d | Robbers' watch | Robbers, who attacked the Gerda's cab, are very successful in covering from the kingdom police. To make the goal of catching them even harder, they use their own watches.
First, as they know that kingdom police is bad at math, robbers use the positional numeral system with base 7. Second, they divide one day in *n* ho... | {"inputs": ["2 3", "8 2", "1 1", "1 2", "8 8", "50 50", "344 344", "282475250 282475250", "8 282475250", "1000000000 1000000000", "16808 7", "2402 50", "343 2401", "1582 301", "421414245 4768815", "2401 343", "2 1", "282475250 8", "8 7", "50 7", "16808 8", "2402 49", "123 123", "123 456", "1 9", "1 10", "50 67", "7 117... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 14 | codeforces | |
1e74392cb55352ace00ff81a62ba0aa3 | Calculating Function | For a positive integer *n* let's define a function *f*:
*f*(*n*)<==<=<=-<=1<=+<=2<=-<=3<=+<=..<=+<=(<=-<=1)*n**n*
Your task is to calculate *f*(*n*) for a given integer *n*.
The single line contains the positive integer *n* (1<=≤<=*n*<=≤<=1015).
Print *f*(*n*) in a single line.
Sample Input
4
5
Sample Output
2
-3
| {"inputs": ["4", "5", "1000000000", "1000000001", "1000000000000000", "100", "101", "102", "103", "104", "105", "106", "107", "108", "109", "208170109961052", "46017661651072", "4018154546667", "288565475053", "3052460231", "29906716", "87897701693326", "8240", "577935", "62", "1", "2", "9999999999999", "1000000000000"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 371 | codeforces | |
1ebe3a50c08a441116f53867534813de | A Serial Killer | Our beloved detective, Sherlock is currently trying to catch a serial killer who kills a person each day. Using his powers of deduction, he came to know that the killer has a strategy for selecting his next victim.
The killer starts with two potential victims on his first day, selects one of these two, kills selected ... | {"inputs": ["ross rachel\n4\nross joey\nrachel phoebe\nphoebe monica\nmonica chandler", "icm codeforces\n1\ncodeforces technex", "a b\n3\na c\nb d\nd e", "ze udggmyop\n4\nze szhrbmft\nudggmyop mjorab\nszhrbmft ojdtfnzxj\nojdtfnzxj yjlkg", "q s\n10\nq b\nb j\ns g\nj f\nf m\ng c\nc a\nm d\nd z\nz o", "iii iiiiii\n7\niii ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 264 | codeforces | |
1ebfd6c2cb572ab66eb2884fa508a34f | k-Interesting Pairs Of Integers | Vasya has the sequence consisting of *n* integers. Vasya consider the pair of integers *x* and *y* k-interesting, if their binary representation differs from each other exactly in *k* bits. For example, if *k*<==<=2, the pair of integers *x*<==<=5 and *y*<==<=3 is k-interesting, because their binary representation *x*=... | {"inputs": ["4 1\n0 3 2 1", "6 0\n200 100 100 100 200 200", "2 0\n1 1", "2 0\n0 0", "2 0\n10000 10000", "2 0\n0 10000", "2 1\n0 1", "2 1\n0 2", "3 1\n0 1 2", "3 2\n0 3 3", "3 2\n3 3 3", "10 0\n1 1 1 1 1 1 1 1 1 1", "100 14\n8192 8192 8192 8192 8191 8192 8192 8192 8192 8192 8191 8191 8191 8192 8191 8191 8191 8192 8192 8... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
1ec7fb216711d8f95bde17bc32969245 | Clear Symmetry | Consider some square matrix *A* with side *n* consisting of zeros and ones. There are *n* rows numbered from 1 to *n* from top to bottom and *n* columns numbered from 1 to *n* from left to right in this matrix. We'll denote the element of the matrix which is located at the intersection of the *i*-row and the *j*-th col... | {"inputs": ["4", "9", "10", "12", "1", "19", "3", "2", "5", "6", "7", "8", "11", "13", "14", "15", "16", "17", "18", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 20 | codeforces | |
1ed6ca77cf602d8ebffe43cfd3e5166b | Party | To celebrate the second ABBYY Cup tournament, the Smart Beaver decided to throw a party. The Beaver has a lot of acquaintances, some of them are friends with each other, and some of them dislike each other. To make party successful, the Smart Beaver wants to invite only those of his friends who are connected by friends... | {"inputs": ["9\n8\n1 2\n1 3\n2 3\n4 5\n6 7\n7 8\n8 9\n9 6\n2\n1 6\n7 9", "2\n1\n1 2\n0", "2\n0\n1\n1 2", "3\n2\n1 2\n1 3\n1\n2 3", "3\n3\n1 3\n2 1\n2 3\n0", "4\n3\n1 2\n2 3\n3 1\n3\n1 4\n4 2\n3 4", "7\n8\n1 2\n1 3\n1 4\n1 5\n2 4\n2 5\n3 4\n5 6\n3\n2 6\n5 7\n6 7", "14\n20\n1 2\n4 5\n4 6\n4 11\n5 7\n5 8\n5 13\n5 14\n7 8\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 13 | codeforces | |
1f1dcedf1144203ac39ca0e477b614f3 | Pasha Maximizes | 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.
Help Pasha count the maximum number he can get if he has the time to make at most *k... | {"inputs": ["1990 1", "300 0", "1034 2", "9090000078001234 6", "1234 3", "5 100", "1234 5", "1234 6", "9022 2", "66838 4", "39940894417248510 10", "5314 4", "1026 9", "4529 8", "83811284 3", "92153348 6", "5846059 3", "521325125110071928 4", "39940894417248510 10", "77172428736634377 29", "337775999910796051 37", "1169... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 90 | codeforces | |
1f4cbe261ba5bc12af16f0c6bfe7bd72 | Load Testing | Polycarp plans to conduct a load testing of its new project Fakebook. He already agreed with his friends that at certain points in time they will send requests to Fakebook. The load testing will last *n* minutes and in the *i*-th minute friends will send *a**i* requests.
Polycarp plans to test Fakebook under a special... | {"inputs": ["5\n1 4 3 2 5", "5\n1 2 2 2 1", "7\n10 20 40 50 70 90 30", "1\n1", "2\n1 15", "4\n36 54 55 9", "5\n984181411 215198610 969039668 60631313 85746445", "10\n12528139 986722043 1595702 997595062 997565216 997677838 999394520 999593240 772077 998195916", "100\n9997 9615 4045 2846 7656 2941 2233 9214 837 2369 583... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 8 | codeforces | |
1f4e69ed4131031462be5f829f047a10 | Sonya and Exhibition | Sonya decided to organize an exhibition of flowers. Since the girl likes only roses and lilies, she decided that only these two kinds of flowers should be in this exhibition.
There are $n$ flowers in a row in the exhibition. Sonya can put either a rose or a lily in the $i$-th position. Thus each of $n$ positions shoul... | {"inputs": ["5 3\n1 3\n2 4\n2 5", "6 3\n5 6\n1 4\n4 6", "10 4\n3 3\n1 6\n9 9\n10 10", "1 1\n1 1", "1000 10\n3 998\n2 1000\n1 999\n2 1000\n3 998\n2 1000\n3 998\n1 1000\n2 1000\n3 999", "1000 20\n50 109\n317 370\n710 770\n440 488\n711 757\n236 278\n314 355\n131 190\n115 162\n784 834\n16 56\n677 730\n802 844\n632 689\n23 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 202 | codeforces | |
1f5631011a2485df36b8c0ae1a556024 | Peculiar apple-tree | In Arcady's garden there grows a peculiar apple-tree that fruits one time per year. Its peculiarity can be explained in following way: there are *n* inflorescences, numbered from 1 to *n*. Inflorescence number 1 is situated near base of tree and any other inflorescence with number *i* (*i*<=><=1) is situated at the ... | {"inputs": ["3\n1 1", "5\n1 2 2 2", "18\n1 1 1 4 4 3 2 2 2 10 8 9 9 9 10 10 4", "2\n1", "3\n1 2", "20\n1 1 1 1 1 4 1 2 4 1 2 1 7 1 2 2 9 7 1", "20\n1 2 1 2 2 1 2 4 1 6 2 2 4 3 2 6 2 5 9", "20\n1 1 1 4 2 4 3 1 2 8 3 2 11 13 15 1 12 13 12", "20\n1 2 2 4 3 5 5 6 6 9 11 9 9 12 13 10 15 13 15", "20\n1 2 3 4 5 6 7 8 9 6 11 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 60 | codeforces | |
1f5ecc480ea7750a08db8a7787697704 | Cupboards | One foggy Stockholm morning, Karlsson decided to snack on some jam in his friend Lillebror Svantenson's house. Fortunately for Karlsson, there wasn't anybody in his friend's house. Karlsson was not going to be hungry any longer, so he decided to get some food in the house.
Karlsson's gaze immediately fell on *n* woode... | {"inputs": ["5\n0 1\n1 0\n0 1\n1 1\n0 1", "2\n0 0\n0 0", "3\n0 1\n1 1\n1 1", "8\n0 1\n1 0\n0 1\n1 1\n0 1\n1 0\n0 1\n1 0", "8\n1 0\n1 0\n1 0\n0 1\n0 1\n1 1\n1 1\n0 1", "15\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0", "5\n1 0\n1 0\n1 0\n0 1\n0 1"], "outputs": ["3", "0", "1", "7", "6", "0",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 738 | codeforces | |
1fa51f9955817acd74ac1d152389d2d2 | Correct Bracket Sequence Editor | Recently Polycarp started to develop a text editor that works only with correct bracket sequences (abbreviated as CBS).
Note that a bracket sequence is correct if it is possible to get a correct mathematical expression by adding "+"-s and "1"-s to it. For example, sequences "(())()", "()" and "(()(()))" are correct, ... | {"inputs": ["8 4 5\n(())()()\nRDLD", "12 5 3\n((()())(()))\nRRDLD", "8 8 8\n(())()()\nLLLLLLDD", "4 2 2\n()()\nLD", "6 4 1\n()()()\nDRRD", "8 2 4\n(())()()\nRR", "10 7 3\n(()())()()\nRDLRDRD", "12 10 11\n(())()()()()\nDLRDLRDDLR", "14 8 13\n((())())((()))\nDLRLLRLR", "16 2 10\n(((())())())()()\nLD", "18 8 11\n((()))(()... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
1fb3786e6d9b85eeaa60c2c28a859b75 | Sail | The polar bears are going fishing. They plan to sail from (*s**x*,<=*s**y*) to (*e**x*,<=*e**y*). However, the boat can only sail by wind. At each second, the wind blows in one of these directions: east, south, west or north. Assume the boat is currently at (*x*,<=*y*).
- If the wind blows to the east, the boat will ... | {"inputs": ["5 0 0 1 1\nSESNW", "10 5 3 3 6\nNENSWESNEE", "19 -172106364 -468680119 -172106365 -468680119\nSSEEESSSESESWSEESSS", "39 -1000000000 -1000000000 -999999997 -1000000000\nENEENWSWSSWESNSSEESNSESWSWNSWESNENWNWEE", "41 -264908123 -86993764 -264908123 -86993723\nNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN", "34 -1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 225 | codeforces | |
1fc7fba6d45b4304f5f03ecf43c6b69a | Yet Another Problem On a Subsequence | The sequence of integers $a_1, a_2, \dots, a_k$ is called a good array if $a_1 = k - 1$ and $a_1 > 0$. For example, the sequences $[3, -1, 44, 0], [1, -99]$ are good arrays, and the sequences $[3, 7, 8], [2, 5, 4, 1], [0]$ — are not.
A sequence of integers is called good if it can be divided into a positive number ... | {"inputs": ["3\n2 1 1", "4\n1 1 1 1", "1\n0", "1\n1"], "outputs": ["2", "7", "0", "0"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
1fcdb4cf00b2bfe5bedab19d41b730b4 | We Need More Bosses | Your friend is developing a computer game. He has already decided how the game world should look like — it should consist of $n$ locations connected by $m$ two-way passages. The passages are designed in such a way that it should be possible to get from any location to any other location.
Of course, some passages shoul... | {"inputs": ["5 5\n1 2\n2 3\n3 1\n4 1\n5 2", "4 3\n1 2\n4 3\n3 2", "50 72\n35 38\n19 46\n35 12\n27 30\n23 41\n50 16\n31 6\n20 33\n38 1\n10 35\n13 43\n29 25\n25 4\n1 13\n4 20\n36 29\n13 47\n48 5\n30 21\n30 38\n28 50\n41 45\n25 43\n40 36\n19 47\n31 32\n26 28\n8 13\n43 24\n27 35\n14 29\n14 38\n50 9\n34 49\n12 34\n43 42\n41... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
1ffbf62bfc508f4f29980f6d780c61fa | Anton and Danik | Anton likes to play chess, and so does his friend Danik.
Once they have played *n* games in a row. For each game it's known who was the winner — Anton or Danik. None of the games ended with a tie.
Now Anton wonders, who won more games, he or Danik? Help him determine this.
The first line of the input contains a singl... | {"inputs": ["6\nADAAAA", "7\nDDDAADA", "6\nDADADA", "10\nDDDDADDADD", "40\nAAAAAAAAADDAAAAAAAAAAADADDAAAAAAAAAAADAA", "200\nDDDDDDDADDDDDDAADADAADAAADAADADAAADDDADDDDDDADDDAADDDAADADDDDDADDDAAAADAAADDDDDAAADAADDDAAAADDADADDDAADDAADAAADAADAAAADDAADDADAAAADADDDAAAAAADDAADAADAADADDDAAADAAAADADDADAAAAAADADADDDADDDAADDADDDA... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 731 | codeforces | |
203a84df1d79d9a67272cb7eb7e52e97 | Sale | Once Bob got to a sale of old TV sets. There were *n* TV sets at that sale. TV set with index *i* costs *a**i* bellars. Some TV sets have a negative price — their owners are ready to pay Bob if he buys their useless apparatus. Bob can «buy» any TV sets he wants. Though he's very strong, Bob can carry at most *m* TV set... | {"inputs": ["5 3\n-6 0 35 -2 4", "4 2\n7 0 0 -7", "6 6\n756 -611 251 -66 572 -818", "5 5\n976 437 937 788 518", "5 3\n-2 -2 -2 -2 -2", "5 1\n998 997 985 937 998", "2 2\n-742 -187", "3 3\n522 597 384", "4 2\n-215 -620 192 647", "10 6\n557 605 685 231 910 633 130 838 -564 -85", "20 14\n932 442 960 943 624 624 955 998 631... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 841 | codeforces | |
205ab1b2596b19d0ff35371ea3cf18a1 | Mashmokh and Lights | Mashmokh works in a factory. At the end of each day he must turn off all of the lights.
The lights on the factory are indexed from 1 to *n*. There are *n* buttons in Mashmokh's room indexed from 1 to *n* as well. If Mashmokh pushes button with index *i*, then each light with index not less than *i* that is still turn... | {"inputs": ["5 4\n4 3 1 2", "5 5\n5 4 3 2 1", "16 11\n8 5 12 10 14 2 6 3 15 9 1", "79 22\n76 32 48 28 33 44 58 59 1 51 77 13 15 64 49 72 74 21 61 12 60 57", "25 19\n3 12 21 11 19 6 5 15 4 16 20 8 9 1 22 23 25 18 13", "48 8\n42 27 40 1 18 3 19 2", "44 19\n13 20 7 10 9 14 43 17 18 39 21 42 37 1 33 8 35 4 6", "80 29\n79 5... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 214 | codeforces | |
205c37248279a0d5d0fe8acbffb500f4 | Quasi Binary | A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 110011 — are quasibinary and numbers 2, 12, 900 are not.
You are given a positive integer *n*. Represent it as a sum of minimum number of quasibinary numbers.
The first line contains a single integ... | {"inputs": ["9", "32", "1", "415", "10011", "10201", "314159", "999999", "2", "10", "21", "98", "102030", "909090", "909823", "1000000", "111111", "123456", "987654", "908172", "8", "100009", "900000", "1435", "1453"], "outputs": ["9\n1 1 1 1 1 1 1 1 1 ", "3\n10 11 11 ", "1\n1 ", "5\n1 101 101 101 111 ", "1\n10011 ", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 288 | codeforces | |
2069be9dcf332b37be07c41ab9a6cbe3 | Prime Number | Simon has a prime number *x* and an array of non-negative integers *a*1,<=*a*2,<=...,<=*a**n*.
Simon loves fractions very much. Today he wrote out number on a piece of paper. After Simon led all fractions to a common denominator and summed them up, he got a fraction: , where number *t* equals *x**a*1<=+<=*a*2<=+<=...... | {"inputs": ["2 2\n2 2", "3 3\n1 2 3", "2 2\n29 29", "4 5\n0 0 0 0", "1 2\n1000000000", "26 2\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2", "26 7\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2", "3 2\n0 1 1", "1 127\n1000000000", "1 800000011\n800000011", "1 800000011\n999999999", "3 3\n1 1 1"], "outputs"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 13 | codeforces | |
207081d9060d847aa6f8df056fb88ba6 | Divisibility | IT City company developing computer games invented a new way to reward its employees. After a new game release users start buying it actively, and the company tracks the number of sales with precision to each transaction. Every time when the next number of sales is divisible by all numbers from 2 to 10 every developer ... | {"inputs": ["3000", "2520", "2519", "2521", "1", "314159265", "718281828459045235", "1000000000000000000", "987654321234567890", "3628800", "504000000000000000"], "outputs": ["1", "1", "0", "1", "0", "124666", "285032471610732", "396825396825396", "391926317950225", "1440", "200000000000000"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 13 | codeforces | |
207eede200d9ba24f994330c2b8cfabe | Pearls in a Row | There are *n* pearls in a row. Let's enumerate them with integers from 1 to *n* from the left to the right. The pearl number *i* has the type *a**i*.
Let's call a sequence of consecutive pearls a segment. Let's call a segment good if it contains two pearls of the same type.
Split the row of the pearls to the maximal ... | {"inputs": ["5\n1 2 3 4 1", "5\n1 2 3 4 5", "7\n1 2 1 3 1 2 1", "9\n1 2 1 2 1 2 1 2 1", "11\n1 1 2 1 2 1 2 1 2 1 1", "1\n576560149", "10\n460626451 460626451 460626451 460626451 460626451 460626451 460626451 460626451 460626451 460626451", "10\n933677171 80672280 80672280 933677171 933677171 933677171 933677171 8067228... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 39 | codeforces | |
208c10eb84654fa8b3a2fc7a644f7f88 | Grammar Lessons | Petya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the language's grammar can be described with the following set of rules:
- There are three parts of spee... | {"inputs": ["petr", "etis atis animatis etis atis amatis", "nataliala kataliala vetra feinites", "qweasbvflios", "lios lios petr initis qwe", "lios initis", "petr initis lios", "petra petra petra", "in", "liala petra initis", "liala petra inites", "liala initis", "liala petra petr inites", "liala petr inites", "llilito... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 17 | codeforces | |
208e0d102a4aff006ad18836092a1fd9 | Jeff and Digits | Jeff's got *n* cards, each card contains either digit 0, or digit 5. Jeff can choose several cards and put them in a line so that he gets some number. What is the largest possible number divisible by 90 Jeff can make from the cards he's got?
Jeff must make the number without leading zero. At that, we assume that numbe... | {"inputs": ["4\n5 0 5 0", "11\n5 5 5 5 5 5 5 5 0 5 5", "7\n5 5 5 5 5 5 5", "1\n5", "1\n0", "11\n5 0 5 5 5 0 0 5 5 5 5", "23\n5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 0 0 0 0 0", "9\n5 5 5 5 5 5 5 5 5", "24\n5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 0 0 0 0 0", "10\n0 0 0 0 0 0 0 0 0 0", "10\n5 5 5 5 5 0 0 5 0 5", "3\n5 5 0", "5... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 159 | codeforces | |
2098cd490c69f659d881f9271b7531fc | String Game | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.
Sergey gives Nastya the word *t* and wants to get the word *p* out of it. Nastya removes letters in a cert... | {"inputs": ["ababcba\nabb\n5 3 4 1 7 6 2", "bbbabb\nbb\n1 6 3 4 2 5", "cacaccccccacccc\ncacc\n10 9 14 5 1 7 15 3 6 12 4 8 11 13 2", "aaaabaaabaabaaaaaaaa\naaaa\n18 5 4 6 13 9 1 3 7 8 16 10 12 19 17 15 14 11 20 2", "aaaaaaaadbaaabbbbbddaaabdadbbbbbdbbabbbabaabdbbdababbbddddbdaabbddbbbbabbbbbabadaadabaaaadbbabbbaddb\naaa... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 82 | codeforces | |
20bba2c3e5ff8b9338dc245960535aab | Vanya and Triangles | Vanya got bored and he painted *n* distinct points on the plane. After that he connected all the points pairwise and saw that as a result many triangles were formed with vertices in the painted points. He asks you to count the number of the formed triangles with the non-zero area.
The first line contains integer *n* (1... | {"inputs": ["4\n0 0\n1 1\n2 0\n2 2", "3\n0 0\n1 1\n2 0", "1\n1 1", "5\n0 0\n1 1\n2 2\n3 3\n4 4", "5\n0 0\n1 1\n2 3\n3 6\n4 10", "4\n-100 -100\n-100 100\n100 -100\n100 100", "5\n-100 -100\n-100 100\n100 -100\n100 100\n0 0", "4\n1 -100\n2 -100\n100 -99\n99 -99", "25\n26 -54\n16 56\n-42 -51\n92 -58\n100 52\n57 -98\n-84 -2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 11 | codeforces | |
20bfb8b140bbbbc6164f4c0a84a2dc05 | Sonya and Problem Wihtout a Legend | Sonya was unable to think of a story for this problem, so here comes the formal description.
You are given the array containing *n* positive integers. At one turn you can pick any element and increase or decrease it by 1. The goal is the make the array strictly increasing by making the minimum possible number of opera... | {"inputs": ["7\n2 1 5 11 5 9 11", "5\n5 4 3 2 1", "2\n1 1000", "2\n1000 1", "5\n100 80 60 70 90", "10\n10 16 17 11 1213 1216 1216 1209 3061 3062", "20\n103 103 110 105 107 119 113 121 116 132 128 124 128 125 138 137 140 136 154 158", "1\n1", "5\n1 1 1 2 3", "1\n1000", "50\n499 780 837 984 481 526 944 482 862 136 265 60... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 14 | codeforces | |
20c1e9422796af441c387c631d2715ab | Code Parsing | Little Vitaly loves different algorithms. Today he has invented a new algorithm just for you. Vitaly's algorithm works with string *s*, consisting of characters "x" and "y", and uses two following operations at runtime:
1. Find two consecutive characters in the string, such that the first of them equals "y", and the ... | {"inputs": ["x", "yxyxy", "xxxxxy", "yxyyxyyx", "yxxyxyx", "xxx", "xxyxx", "xxxyx", "yxxxx", "xyyxyyyyyxxxxxxxyxyxyyxyyxyyxxyxyxyxxxyxxy", "xyyxyyyyyxxxxxxxyxyxyyxyyxyyxxyxyxyxxxyxxy", "xxxxxxxxxxxyxyyxxxxyxxxxxyxxxxxyxxxxxxxxyx", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 54 | codeforces | |
20c573c0f46f02b35925d1e59ce6fc1e | Voting | There are *n* employees in Alternative Cake Manufacturing (ACM). They are now voting on some very important question and the leading world media are trying to predict the outcome of the vote.
Each of the employees belongs to one of two fractions: depublicans or remocrats, and these two fractions have opposite opinions... | {"inputs": ["5\nDDRRR", "6\nDDRRRR", "1\nD", "1\nR", "2\nDR", "3\nRDD", "3\nDRD", "4\nDRRD", "4\nDRRR", "4\nRDRD", "5\nDRDRR", "4\nRRRR", "5\nRDDRD", "5\nDDRRD", "5\nDRRRD", "5\nDDDDD", "6\nDRRDDR", "7\nRDRDRDD", "7\nRDRDDRD", "7\nRRRDDDD", "8\nRRRDDDDD", "9\nRRRDDDDDR", "9\nRRDDDRRDD", "9\nRRDDDRDRD", "10\nDDRRRDRRDD"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 11 | codeforces | |
20ca84dc7382a495acdf33245bff71ca | Bear and Fair Set | Limak is a grizzly bear. He is big and dreadful. You were chilling in the forest when you suddenly met him. It's very unfortunate for you. He will eat all your cookies unless you can demonstrate your mathematical skills. To test you, Limak is going to give you a puzzle to solve.
It's a well-known fact that Limak, as e... | {"inputs": ["10 20 1\n10 10", "10 20 3\n15 10\n5 0\n10 5", "10 20 2\n15 3\n20 10", "15 27 2\n6 4\n23 5", "50 7654 4\n1273 11\n6327 38\n1244 3\n5208 22", "50 7654 4\n2899 15\n3848 26\n2718 12\n5511 36", "50 7654 4\n4881 20\n4957 6\n4764 50\n944 44", "50 6457 1\n945 41", "500 5000 5\n1289 221\n694 178\n2179 454\n160 11\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
20e1b109cf2c373246172c975ecfd79e | Polo the Penguin and Matrix | Little penguin Polo has an *n*<=×<=*m* matrix, consisting of integers. Let's index the matrix rows from 1 to *n* from top to bottom and let's index the columns from 1 to *m* from left to right. Let's represent the matrix element on the intersection of row *i* and column *j* as *a**ij*.
In one move the penguin can add ... | {"inputs": ["2 2 2\n2 4\n6 8", "1 2 7\n6 7", "3 2 1\n5 7\n1 2\n5 100", "3 3 3\n5 8 5\n11 11 17\n14 5 2", "3 3 3\n5 8 5\n11 11 17\n14 5 3", "2 2 4\n5 5\n5 5", "7 4 5\n7 7 7 12\n7 12 12 7\n7 7 7 7\n7 7 12 7\n7 7 12 12\n12 12 7 12\n7 7 7 7", "7 7 47\n91 91 91 91 91 91 91\n91 91 91 91 91 91 91\n91 91 91 91 91 91 91\n91 91 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 200 | codeforces | |
20f1c94c1e992cb8f01b83ea4ed216fb | none | Bob recently read about bitwise operations used in computers: AND, OR and XOR. He have studied their properties and invented a new game.
Initially, Bob chooses integer *m*, bit depth of the game, which means that all numbers in the game will consist of *m* bits. Then he asks Peter to choose some *m*-bit number. After ... | {"inputs": ["3 3\na := 101\nb := 011\nc := ? XOR b", "5 1\na := 1\nbb := 0\ncx := ? OR a\nd := ? XOR ?\ne := d AND bb", "2 10\nb := 0100101101\na := ? XOR b", "1 10\na := 0110110011", "1 6\na := ? OR ?", "13 6\na := 111010\nb := 100100\nc := 001110\nd := b AND b\ne := c AND ?\nf := e OR c\ng := 011110\nh := d XOR ?\ni ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 6 | codeforces | |
20fd49f9c64735d6bfb5a2ded627b23d | Shifts | You are given a table consisting of *n* rows and *m* columns. Each cell of the table contains a number, 0 or 1. In one move we can choose some row of the table and cyclically shift its values either one cell to the left, or one cell to the right.
To cyclically shift a table row one cell to the right means to move the ... | {"inputs": ["3 6\n101010\n000100\n100000", "2 3\n111\n000", "1 1\n1", "1 1\n0", "3 1\n1\n1\n0", "6 2\n10\n11\n01\n01\n10\n11", "3 3\n001\n010\n100", "4 4\n0001\n0100\n0010\n1000", "5 5\n10000\n01000\n00100\n00010\n00001", "5 5\n10001\n00100\n01000\n01001\n11111", "5 5\n11111\n11111\n11111\n11111\n00000", "5 10\n0001000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 9 | codeforces | |
20fee0d2046c45179bcd2f922d225aae | Queue | There are *n* walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the *n*-th walrus stands at the beginning of the queue. The *i*-th walrus has the age equal to *a**i*.
The *i*-th walrus becomes displeased if there's a younger... | {"inputs": ["6\n10 8 5 3 50 45", "7\n10 4 6 3 2 8 15", "5\n10 3 1 10 11", "13\n18 9 8 9 23 20 18 18 33 25 31 37 36", "10\n15 21 17 22 27 21 31 26 32 30", "10\n18 20 18 17 17 13 22 20 34 29", "13\n16 14 12 9 11 28 30 21 35 30 32 31 43", "15\n18 6 18 21 14 20 13 9 18 20 28 13 19 25 21", "11\n15 17 18 18 26 22 23 33 33 21... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 51 | codeforces | |
20ffe02488c708a6ac25d6687efe45a2 | Snacktower | According to an old legeng, a long time ago Ankh-Morpork residents did something wrong to miss Fortune, and she cursed them. She said that at some time *n* snacks of distinct sizes will fall on the city, and the residents should build a Snacktower of them by placing snacks one on another. Of course, big snacks should b... | {"inputs": ["3\n3 1 2", "5\n4 5 1 2 3", "1\n1", "2\n1 2", "10\n5 1 6 2 8 3 4 10 9 7", "30\n16 10 4 29 5 28 12 21 11 30 18 6 14 3 17 22 20 15 9 1 27 19 24 26 13 25 2 23 8 7", "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 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 283 | codeforces | |
2107d7677a31fc3b2e3f2f48f90ea65d | Coach | A programming coach has *n* students to teach. We know that *n* is divisible by 3. Let's assume that all students are numbered from 1 to *n*, inclusive.
Before the university programming championship the coach wants to split all students into groups of three. For some pairs of students we know that they want to be on ... | {"inputs": ["3 0", "6 4\n1 2\n2 3\n3 4\n5 6", "3 3\n1 2\n2 3\n1 3", "6 3\n1 2\n3 4\n5 6", "15 9\n1 4\n1 6\n2 7\n2 11\n4 6\n5 12\n7 11\n9 14\n13 15", "3 1\n1 3", "15 13\n1 9\n1 11\n2 7\n2 12\n3 8\n3 15\n4 10\n5 6\n5 14\n6 14\n7 12\n8 15\n9 11", "36 27\n1 34\n2 18\n2 20\n3 9\n3 21\n4 5\n4 25\n5 25\n6 13\n6 22\n8 23\n8 31... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 17 | codeforces | |
210b0dcb71762d4b15aa74549a099ce5 | Compote | Nikolay has *a* lemons, *b* apples and *c* pears. He decided to cook a compote. According to the recipe the fruits should be in the ratio 1:<=2:<=4. It means that for each lemon in the compote should be exactly 2 apples and exactly 4 pears. You can't crumble up, break up or cut these fruits into pieces. These fruits — ... | {"inputs": ["2\n5\n7", "4\n7\n13", "2\n3\n2", "1\n1\n1", "1\n2\n4", "1000\n1000\n1000", "1\n1\n4", "1\n2\n3", "1\n1000\n1000", "1000\n1\n1000", "1000\n2\n1000", "1000\n500\n1000", "1000\n1000\n4", "1000\n1000\n3", "4\n8\n12", "10\n20\n40", "100\n200\n399", "200\n400\n800", "199\n400\n800", "201\n400\n800", "200\n399\n8... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 334 | codeforces | |
21597ff5cde4d9dc159f25a26dd6a0ce | Directed Roads | ZS the Coder and Chris the Baboon has explored Udayland for quite some time. They realize that it consists of *n* towns numbered from 1 to *n*.
There are *n* directed roads in the Udayland. *i*-th of them goes from town *i* to some other town *a**i* (*a**i*<=≠<=*i*). ZS the Coder can flip the direction of any road in... | {"inputs": ["3\n2 3 1", "4\n2 1 1 1", "5\n2 4 2 5 3", "4\n2 1 4 3", "7\n2 3 4 1 6 5 4", "20\n2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1", "2\n2 1", "84\n2 50 67 79 71 45 43 40 57 20 25 8 60 47 52 10 37 23 1 28 22 26 3 42 11 63 61 68 49 32 55 18 5 24 31 70 66 27 38 41 54 12 65 51 15 34 30 35 77 74 21 62 33 16 81... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 8 | codeforces | |
216626f8e3129d6463eb791d51eaa0ad | Permutation Cycle | For a permutation *P*[1... *N*] of integers from 1 to *N*, function *f* is defined as follows:
Let *g*(*i*) be the minimum positive integer *j* such that *f*(*i*,<=*j*)<==<=*i*. We can show such *j* always exists.
For given *N*,<=*A*,<=*B*, find a permutation *P* of integers from 1 to *N* such that for 1<=≤<=*i*<=≤<=... | {"inputs": ["9 2 5", "3 2 1", "7 4 4", "1000000 999998 3", "1 1 1", "993012 997 1001", "1000000 2017 881", "390612 20831 55790", "689292 69319 96267", "99929 99929 2", "807990 72713 11616", "514004 50866 26101", "631610 7702 63553", "391861 47354 60383", "822954 53638 55936", "794948 794948 85946", "786009 37429 59524"... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 21 | codeforces | |
21675d66e7006d324b0336d4ffb917d7 | Almost Permutation | Recently Ivan noticed an array *a* while debugging his code. Now Ivan can't remember this array, but the bug he was trying to fix didn't go away, so Ivan thinks that the data from this array might help him to reproduce the bug.
Ivan clearly remembers that there were *n* elements in the array, and each element was not ... | {"inputs": ["3 0", "3 1\n1 1 3 2", "3 2\n1 1 3 2\n2 1 3 2", "3 2\n1 1 3 2\n2 1 3 1", "50 0", "50 1\n2 31 38 25", "50 2\n2 38 41 49\n1 19 25 24", "50 10\n2 4 24 29\n1 14 49 9\n2 21 29 12\n2 2 46 11\n2 4 11 38\n2 3 36 8\n1 24 47 28\n2 23 40 32\n1 16 50 38\n1 31 49 38", "50 20\n1 14 22 40\n1 23 41 3\n1 32 39 26\n1 8 47 25... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
216b7c32d3e33f332f60bc12ab2da822 | Logo Turtle | A lot of people associate Logo programming language with turtle graphics. In this case the turtle moves along the straight line and accepts commands "T" ("turn around") and "F" ("move 1 unit forward").
You are given a list of commands that will be given to the turtle. You have to change exactly *n* commands from the l... | {"inputs": ["FT\n1", "FFFTFFF\n2", "F\n1", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF\n50", "FTFTFTFFFFTFTFTTTTTTFFTTTTFFTFFFTFTFTFFTFTFTFFFTTTFTTFTTTTTFFFFTTT\n12", "TTFFTFTTFTTTFFFTFTFFTFFTTFFTFTFTFTFFTTTFTFFTFFTTTTFTTTFFT\n46", "TTFFFFFFFTTTTFTTFTFFTTFFFTFTT... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 7 | codeforces | |
217e38012c7854256183c07a6bdc62c5 | Petya's Exams | Petya studies at university. The current academic year finishes with $n$ special days. Petya needs to pass $m$ exams in those special days. The special days in this problem are numbered from $1$ to $n$.
There are three values about each exam:
- $s_i$ — the day, when questions for the $i$-th exam will be published, -... | {"inputs": ["5 2\n1 3 1\n1 5 1", "3 2\n1 3 1\n1 2 1", "10 3\n4 7 2\n1 10 3\n8 9 1", "2 1\n1 2 1", "3 1\n1 2 2", "3 1\n1 3 2", "100 1\n1 100 99", "100 1\n1 100 100", "100 1\n1 100 98", "100 2\n1 100 49\n1 99 49", "10 2\n3 7 4\n6 10 1", "10 4\n2 5 1\n1 4 2\n4 7 1\n7 10 2", "20 5\n6 16 3\n4 14 4\n3 13 1\n1 11 1\n10 20 4",... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 10 | codeforces | |
2189a2c8e311addc29b933b2d542edfc | Circle of Numbers | *n* evenly spaced points have been marked around the edge of a circle. There is a number written at each point. You choose a positive real number *k*. Then you may repeatedly select a set of 2 or more points which are evenly spaced, and either increase all numbers at points in the set by *k* or decrease all numbers at ... | {"inputs": ["30\n000100000100000110000000001100", "6\n314159", "3\n000", "15\n522085220852208", "300\n51849955123882532841766314023795544655059625429948511546532555041357758442089311502553567597180892645169105593021958599780734407001184543473352601711893354858975964992001656857820176956422821004573923066450696828141422... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
218df72e4efbe2b7cc341ffe3d16707e | Rebranding | The name of one small but proud corporation consists of *n* lowercase English letters. The Corporation has decided to try rebranding — an active marketing strategy, that includes a set of measures to change either the brand (both for the company and the goods it produces) or its components: the name, the logo, the slog... | {"inputs": ["6 1\npolice\np m", "11 6\nabacabadaba\na b\nb c\na d\ne g\nf a\nb b", "1 1\nf\nz h", "1 1\na\na b", "10 10\nlellelleel\ne l\ne l\ne l\ne l\ne l\ne e\nl l\nl e\nl l\ne e"], "outputs": ["molice", "cdcbcdcfcdc", "f", "b", "lellelleel"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 119 | codeforces | |
219366dfd3d5a68d977c0efa6cb0721a | DZY Loves Sequences | DZY has a sequence *a*, consisting of *n* integers.
We'll call a sequence *a**i*,<=*a**i*<=+<=1,<=...,<=*a**j* (1<=≤<=*i*<=≤<=*j*<=≤<=*n*) a subsegment of the sequence *a*. The value (*j*<=-<=*i*<=+<=1) denotes the length of the subsegment.
Your task is to find the longest subsegment of *a*, such that it is possible ... | {"inputs": ["6\n7 2 3 1 5 6", "10\n424238336 649760493 681692778 714636916 719885387 804289384 846930887 957747794 596516650 189641422", "50\n804289384 846930887 681692778 714636916 957747794 424238336 719885387 649760493 596516650 189641422 25202363 350490028 783368691 102520060 44897764 967513927 365180541 540383427 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 59 | codeforces | |
21981a6dd776117fe98a2f0d77c136c9 | Average Sleep Time | It's been almost a week since Polycarp couldn't get rid of insomnia. And as you may already know, one week in Berland lasts *k* days!
When Polycarp went to a doctor with his problem, the doctor asked him about his sleeping schedule (more specifically, the average amount of hours of sleep per week). Luckily, Polycarp k... | {"inputs": ["3 2\n3 4 7", "1 1\n10", "8 2\n1 2 4 100000 123 456 789 1", "1 1\n1", "1 1\n100000", "3 1\n1 2 3", "10 4\n11 3 5 20 12 7 9 2 2 20", "10 5\n15 9 3 2 17 10 9 18 4 19", "10 6\n19 3 20 16 14 10 1 13 7 3", "10 7\n8 16 2 13 15 9 5 13 9 2", "10 4\n127 1459 718 1183 880 1044 1857 1340 725 1496", "10 5\n1384 1129 17... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 97 | codeforces | |
21b7de902f49277b20a3051ca8ba9528 | Rook, Bishop and King | Little Petya is learning to play chess. He has already learned how to move a king, a rook and a bishop. Let us remind you the rules of moving chess pieces. A chessboard is 64 square fields organized into an 8<=×<=8 table. A field is represented by a pair of integers (*r*,<=*c*) — the number of the row and the number of... | {"inputs": ["4 3 1 6", "5 5 5 6", "1 1 8 8", "1 1 8 1", "1 1 1 8", "8 1 1 1", "8 1 1 8", "7 7 6 6", "8 1 8 8", "1 8 1 1", "1 8 8 1", "1 8 8 8", "8 8 1 1", "8 8 1 8", "8 8 8 1", "1 3 1 6", "1 3 1 4", "1 3 1 5", "3 3 2 4", "3 3 1 5", "1 6 2 1", "1 5 6 4", "1 3 3 7", "1 1 8 1", "1 7 5 4", "1 5 2 7", "1 4 6 2", "1 2 3 5", ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 217 | codeforces | |
21c7afb1480e78ad47c23361b6dbbc61 | Valera and Plates | Valera is a lazy student. He has *m* clean bowls and *k* clean plates.
Valera has made an eating plan for the next *n* days. As Valera is lazy, he will eat exactly one dish per day. At that, in order to eat a dish, he needs exactly one clean plate or bowl. We know that Valera can cook only two types of dishes. He can... | {"inputs": ["3 1 1\n1 2 1", "4 3 1\n1 1 1 1", "3 1 2\n2 2 2", "8 2 2\n1 2 1 2 1 2 1 2", "2 100 100\n2 2", "1 1 1\n2", "233 100 1\n2 2 1 1 1 2 2 2 2 1 1 2 2 2 1 2 2 1 1 1 2 2 1 1 1 1 2 1 2 2 1 1 2 2 1 2 2 1 2 1 2 1 2 2 2 1 1 1 1 2 1 2 1 1 2 1 1 2 2 1 2 1 2 1 1 1 1 1 1 1 1 1 2 1 2 2 2 1 1 2 2 1 1 1 1 2 1 1 2 1 2 2 2 1 1 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 223 | codeforces | |
21c80b84de37c0a6a459ebd411c862bc | Maxim and Discounts | Maxim always goes to the supermarket on Sundays. Today the supermarket has a special offer of discount systems.
There are *m* types of discounts. We assume that the discounts are indexed from 1 to *m*. To use the discount number *i*, the customer takes a special basket, where he puts exactly *q**i* items he buys. Unde... | {"inputs": ["1\n2\n4\n50 50 100 100", "2\n2 3\n5\n50 50 50 50 50", "1\n1\n7\n1 1 1 1 1 1 1", "60\n7 4 20 15 17 6 2 2 3 18 13 14 16 11 13 12 6 10 14 1 16 6 4 9 10 8 10 15 16 13 13 9 16 11 5 4 11 1 20 5 11 20 19 9 14 13 10 6 6 9 2 13 11 4 1 6 8 18 10 3\n26\n2481 6519 9153 741 9008 6601 6117 1689 5911 2031 2538 5553 1358 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 35 | codeforces | |
21d3086ee327553584f533280fdd7ad2 | Broken checker | "This problem is rubbish! There is not statement, and there are only 5 test cases. The problemsetter took liberties with this problem!" — people complained in the comments to one round on Codeforces. And even more... No, wait, the checker for the problem was alright, that's a mercy.
The only line of the input contains ... | {"inputs": ["3", "1", "4", "2", "5"], "outputs": ["1", "2", "2", "3", "1"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 39 | codeforces | |
21daae042f23778474d174e49a3103bf | DravDe saves the world | How horrible! The empire of galactic chickens tries to conquer a beautiful city "Z", they have built a huge incubator that produces millions of chicken soldiers a day, and fenced it around. The huge incubator looks like a polygon on the plane *Oxy* with *n* vertices. Naturally, DravDe can't keep still, he wants to dest... | {"inputs": ["4\n0 0\n1 0\n1 1\n0 1\n0 -1\n1 0 1\n-1\n0 1 -1", "4\n0 0\n0 1\n1 1\n1 0\n0 -1\n-1 -1 1\n-1\n0 1 -1", "4\n0 0\n1 0\n1 1\n0 1\n0 -1\n1 1 1\n-1\n1 1 -1", "3\n-3 4\n5 -1\n-1 0\n-4 3\n4 4 5\n-3\n0 -3 -4", "4\n-2 1\n3 3\n2 -4\n0 -5\n-4 3\n2 4 4\n-4\n2 5 -4", "5\n10 10\n9 10\n8 9\n9 8\n10 9\n-10 -10\n1 1 1\n-1\n0... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
21e1ee2d6df8c4908bb9a6d812841345 | Word Folding | You will receive 5 points for solving this problem.
Manao has invented a new operation on strings that is called folding. Each fold happens between a pair of consecutive letters and places the second part of the string above first part, running in the opposite direction and aligned to the position of the fold. Using t... | {"inputs": ["ABRACADABRA", "ABBBCBDB", "AB", "ABBCDEFB", "THISISATEST", "Z", "ZZ", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "ABACBCABACACB", "LEHLLLLLLHAFGEGLLHAFDLHHLLLLLDGGEHGGHLLLLLLLLDFLCBLLEFLLCBLLCGLEDLGGLECLDGLEHLLLGELLLEGLLLLGDLLLDALD", "THISISTHELASTTEST"], "outputs": ["3", "3", "1", "3", "3", "1", "2", "1", "4", "49", "... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
21fc26573a8d903daa076191d191a0f5 | Unbearable Controversy of Being | Tomash keeps wandering off and getting lost while he is walking along the streets of Berland. It's no surprise! In his home town, for any pair of intersections there is exactly one way to walk from one intersection to the other one. The capital of Berland is very different!
Tomash has noticed that even simple cases of... | {"inputs": ["5 4\n1 2\n2 3\n1 4\n4 3", "4 12\n1 2\n1 3\n1 4\n2 1\n2 3\n2 4\n3 1\n3 2\n3 4\n4 1\n4 2\n4 3", "1 0", "10 20\n6 10\n4 2\n1 5\n6 1\n8 9\n1 3\n2 6\n9 7\n4 5\n3 7\n9 2\n3 9\n4 8\n1 10\n6 9\n8 5\n7 6\n1 8\n8 10\n5 6", "3000 0", "1 0", "2 0", "2 1\n1 2", "2 2\n1 2\n2 1", "3 0", "3 6\n1 2\n1 3\n2 1\n2 3\n3 1\n3 2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
21fddb423e53f4d61cb410a6f5bbb7a7 | Sleep in Class | The academic year has just begun, but lessons and olympiads have already occupied all the free time. It is not a surprise that today Olga fell asleep on the Literature. She had a dream in which she was on a stairs.
The stairs consists of *n* steps. The steps are numbered from bottom to top, it means that the lowest s... | {"inputs": ["3\nUUD", "10\nUUDUDUUDDU", "10\nDUDDUUDUDD", "1\nD", "2\nDU", "3\nDUU", "4\nDDDU", "5\nDDDUD", "50\nDDDDDDDDDDDDDDDDDDDDDDDDDUUUUUUUUUUUUUUUUUUUUUUUUU", "50\nUUUUUUUUUUUUUUUUUUUUUUUUUDDDDDDDDDDDDDDDDDDDDDDDDD", "1\nD", "1\nU"], "outputs": ["5 6 3 ", "5 12 23 34 36 27 18 11 6 1 ", "1 4 7 14 23 32 30 19 12 5... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
22091ef7481b60323c746ca6fbc97fc7 | Vitya in the Countryside | Every summer Vitya comes to visit his grandmother in the countryside. This summer, he got a huge wart. Every grandma knows that one should treat warts when the moon goes down. Thus, Vitya has to catch the moment when the moon is down.
Moon cycle lasts 30 days. The size of the visible part of the moon (in Vitya's units... | {"inputs": ["5\n3 4 5 6 7", "7\n12 13 14 15 14 13 12", "1\n8", "44\n7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10", "92\n3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 123 | codeforces | |
22198e3a7c0abd019255159882cb5048 | Eevee | You are solving the crossword problem K from IPSC 2014. You solved all the clues except for one: who does Eevee evolve into? You are not very into pokemons, but quick googling helped you find out, that Eevee can evolve into eight different pokemons: Vaporeon, Jolteon, Flareon, Espeon, Umbreon, Leafeon, Glaceon, and Syl... | {"inputs": ["7\n...feon", "7\n.l.r.o.", "6\n.s..o.", "7\nglaceon", "8\n.a.o.e.n", "7\n.laceon", "7\n..lveon", "7\n.l.ceon", "7\n..areon"], "outputs": ["leafeon", "flareon", "espeon", "glaceon", "vaporeon", "glaceon", "sylveon", "glaceon", "flareon"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 172 | codeforces | |
221a624387ca6d14359b006a62613cd2 | Pyramids | IT City administration has no rest because of the fame of the Pyramids in Egypt. There is a project of construction of pyramid complex near the city in the place called Emerald Walley. The distinction of the complex is that its pyramids will be not only quadrangular as in Egypt but also triangular and pentagonal. Of co... | {"inputs": ["2 5 3", "3 4 5", "1 1 1", "1000 1000 1000", "999 997 998", "1 999 1000", "709 328 709", "982 948 879", "99 23 530", "1 2 998"], "outputs": ["38.546168065709", "55.954779230131", "0.655056222989", "655056222.989098310000", "650782658.915145640000", "536498692.999083940000", "157775455.683012100000", "517178... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
2233068987c95f8e6f31d0648e88a1bb | Gena's Code | It's the year 4527 and the tanks game that we all know and love still exists. There also exists Great Gena's code, written in 2016. The problem this code solves is: given the number of tanks that go into the battle from each country, find their product. If it is turns to be too large, then the servers might have not en... | {"inputs": ["3\n5 10 1", "4\n1 1 10 11", "5\n0 3 1 100 1", "40\n10 100 10 1 10 10 100 10 10 100 10 100 100 10 1824868942 100 100 1 10 100 100 10 100 100 10 100 10 1 10 100 100 100 10 1 10 1 10 10 100 100", "6\n1000000000000000000000000000000000000 6643573784 1000000000000000000000000000000000000 10000000000000000000000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 81 | codeforces | |
22c337ec8ce9b0fba407e3224879d095 | Consecutive Subsequence | You are given an integer array of length $n$.
You have to choose some subsequence of this array of maximum length such that this subsequence forms a increasing sequence of consecutive integers. In other words the required sequence should be equal to $[x, x + 1, \dots, x + k - 1]$ for some value $x$ and length $k$.
Su... | {"inputs": ["7\n3 3 4 7 5 6 8", "6\n1 3 5 2 4 6", "4\n10 9 8 7", "9\n6 7 8 3 4 5 9 10 11", "1\n1337", "2\n456 123", "7\n100 3 4 7 5 6 8", "7\n3 3 4 5 6 7 8", "12\n1 2 3 4 5 6 7 8 9 10 11 12"], "outputs": ["4\n2 3 5 6 ", "2\n1 4 ", "1\n1 ", "6\n1 2 3 7 8 9 ", "1\n1 ", "1\n1 ", "4\n2 3 5 6 ", "6\n2 3 4 5 6 7 ", "12\n1 2 ... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 5 | codeforces | |
22e73f576e0a29ac8f1acaad7b95ca42 | Kuriyama Mirai's Stones | Kuriyama Mirai has killed many monsters and got many (namely *n*) stones. She numbers the stones from 1 to *n*. The cost of the *i*-th stone is *v**i*. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions:
1. She will tell you two numbers, *l* and *r* (1<=≤<=*l*<=≤<=*r*... | {"inputs": ["6\n6 4 2 7 2 7\n3\n2 3 6\n1 3 4\n1 1 6", "4\n5 5 2 3\n10\n1 2 4\n2 1 4\n1 1 1\n2 1 4\n2 1 2\n1 1 1\n1 3 3\n1 1 3\n1 4 4\n1 2 2", "4\n2 2 3 6\n9\n2 2 3\n1 1 3\n2 2 3\n2 2 3\n2 2 2\n1 1 3\n1 1 3\n2 1 4\n1 1 2", "18\n26 46 56 18 78 88 86 93 13 77 21 84 59 61 5 74 72 52\n25\n1 10 10\n1 9 13\n2 13 17\n1 8 14\n2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 467 | codeforces | |
23300678e886bea71fe9a35c71bc04e8 | R2D2 and Droid Army | An army of *n* droids is lined up in one row. Each droid is described by *m* integers *a*1,<=*a*2,<=...,<=*a**m*, where *a**i* is the number of details of the *i*-th type in this droid's mechanism. R2-D2 wants to destroy the sequence of consecutive droids of maximum length. He has *m* weapons, the *i*-th weapon can aff... | {"inputs": ["5 2 4\n4 0\n1 2\n2 1\n0 2\n1 3", "3 2 4\n1 2\n1 3\n2 2", "1 1 0\n0", "1 1 0\n1", "1 1 1\n0", "4 5 33\n2 10 2 3 2\n10 6 4 5 0\n3 1 7 3 2\n4 4 2 1 5", "4 5 40\n0 10 9 0 4\n10 5 5 7 4\n9 9 5 5 2\n6 7 9 4 3", "31 2 1913\n845 576\n862 325\n914 283\n431 837\n193 171\n30 248\n290 488\n810 552\n463 74\n765 469\n78... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
233f32c704219a8929d73e179f9d4a8f | Little Pony and Crystal Mine | Twilight Sparkle once got a crystal from the Crystal Mine. A crystal of size *n* (*n* is odd; *n*<=><=1) is an *n*<=×<=*n* matrix with a diamond inscribed into it.
You are given an odd integer *n*. You need to draw a crystal of size *n*. The diamond cells of the matrix should be represented by character "D". All ot... | {"inputs": ["3", "5", "7", "11", "15", "21", "33", "57", "69", "81", "91", "101"], "outputs": ["*D*\nDDD\n*D*", "**D**\n*DDD*\nDDDDD\n*DDD*\n**D**", "***D***\n**DDD**\n*DDDDD*\nDDDDDDD\n*DDDDD*\n**DDD**\n***D***", "*****D*****\n****DDD****\n***DDDDD***\n**DDDDDDD**\n*DDDDDDDDD*\nDDDDDDDDDDD\n*DDDDDDDDD*\n**DDDDDDD**\n*... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 308 | codeforces | |
23522805b8d87a2adfb4a95b8c4ba94f | Functions On The Segments | You have an array *f* of *n* functions.The function *f**i*(*x*) (1<=≤<=*i*<=≤<=*n*) is characterized by parameters: *x*1,<=*x*2,<=*y*1,<=*a*,<=*b*,<=*y*2 and take values:
- *y*1, if *x*<=≤<=*x*1. - *a*·*x*<=+<=*b*, if *x*1<=<<=*x*<=≤<=*x*2. - *y*2, if *x*<=><=*x*2.
There are *m* queries. Each query is deter... | {"inputs": ["1\n1 2 1 4 5 10\n1\n1 1 2", "3\n2 5 1 1 1 4\n3 6 8 2 5 7\n1 3 5 1 4 10\n3\n1 3 3\n2 3 2\n1 2 5", "7\n4 8 562244866 6 8 140807945\n5 7 415374420 7 6 596093578\n3 4 766370993 3 7 973128805\n4 6 841321398 3 2 893107667\n4 9 968214628 5 8 329310838\n0 10 64315145 9 4 716996081\n1 6 568407659 3 0 22184171\n15\n... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
23782452cf5313c2d3b5626ea74e0e61 | Water Taps | Consider a system of *n* water taps all pouring water into the same container. The *i*-th water tap can be set to deliver any amount of water from 0 to *a**i* ml per second (this amount may be a real number). The water delivered by *i*-th tap has temperature *t**i*.
If for every you set *i*-th tap to deliver exactly ... | {"inputs": ["2 100\n3 10\n50 150", "3 9\n5 5 30\n6 6 10", "2 12\n1 3\n10 15", "20 30\n70 97 14 31 83 22 83 56 19 87 59 7 7 89 24 82 34 40 6 24\n10 4 47 46 11 18 32 55 16 32 53 37 43 32 41 46 57 14 60 44", "1 1\n1000000\n1", "1 200\n1000000\n100", "1 1000000\n1000000\n1000000"], "outputs": ["6.000000000000000", "40.0000... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
237ca36d287733e0a58c9626c31d87aa | Businessmen Problems | Two famous competing companies ChemForces and TopChemist decided to show their sets of recently discovered chemical elements on an exhibition. However they know that no element should be present in the sets of both companies.
In order to avoid this representatives of both companies decided to make an agreement on the ... | {"inputs": ["3\n1 2\n7 2\n3 10\n4\n1 4\n2 4\n3 4\n4 4", "1\n1000000000 239\n3\n14 15\n92 65\n35 89", "10\n598654597 488228616\n544064902 21923894\n329635457 980089248\n988262691 654502493\n967529230 543358150\n835120075 128123793\n809901567 613170206\n152157661 479980560\n859252956 318029856\n614959273 735298093\n10\n8... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 212 | codeforces | |
2397732f27101ac11fd5369b72448274 | Epidemic in Monstropolis | There was an epidemic in Monstropolis and all monsters became sick. To recover, all monsters lined up in queue for an appointment to the only doctor in the city.
Soon, monsters became hungry and began to eat each other.
One monster can eat other monster if its weight is strictly greater than the weight of the monste... | {"inputs": ["6\n1 2 2 2 1 2\n2\n5 5", "5\n1 2 3 4 5\n1\n15", "5\n1 1 1 3 3\n3\n2 1 6", "5\n1 1 1 1 2\n3\n1 1 4", "5\n1 1 1 1 1\n4\n1 1 2 1", "6\n2 1 2 2 1 2\n2\n5 5", "8\n2 5 3 1 4 2 3 4\n3\n10 6 8", "1\n959139\n1\n470888", "3\n2 2 1\n1\n5", "3\n1 2 2\n1\n5", "5\n1 2 3 4 5\n1\n10", "5\n325539 329221 106895 882089 71867... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 3 | codeforces | |
239a5762998495b0fe4bf42d3952fd48 | Tea Queue | Recently *n* students from city S moved to city P to attend a programming camp.
They moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can use the same teapot simultaneously, so the students had to form a queue to get their tea.
*i*-th s... | {"inputs": ["2\n2\n1 3\n1 4\n3\n1 5\n1 1\n2 3", "19\n1\n1 1\n1\n1 2\n1\n1 1000\n1\n1 2000\n1\n2 2\n1\n2 3\n1\n2 1000\n1\n2 2000\n1\n1999 1999\n1\n1999 2000\n1\n2000 2000\n2\n1 1\n1 1\n2\n1 1\n1 2\n2\n1 2\n1 1\n2\n1 2000\n1 1\n2\n1 1\n1 2000\n2\n1 2000\n2 2\n2\n2 2000\n2 2\n2\n2 2\n2 2000", "1\n11\n1 1\n1 1\n1 1\n1 1\n1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 72 | codeforces | |
23c012a6f7008cf0064bf7ecf55b2fd3 | Antichain | You have a directed acyclic graph *G*, consisting of *n* vertexes, numbered from 0 to *n*<=-<=1. The graph contains *n* edges numbered from 0 to *n*<=-<=1. An edge with number *i* connects vertexes *i* and (*i*<=+<=1) *mod* *n*, and it can be directed in either direction (from *i* to (*i*<=+<=1) *mod* *n*, or vise vers... | {"inputs": ["001", "110010", "0010011110", "0111001010101110001100000010011000100101110010001100111110101110001110101010111000010010011000000110", "0110101100", "0111110110", "0001011111", "0000011010101001001100101111111011100000011000101001011001000111110000010000100011011011101101100110", "00001000001100101000100101... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
23c3c1aedb4a37389c4a191f8443ae42 | Interesting drink | Vasiliy likes to rest after a hard work, so you may often meet him in some bar nearby. As all programmers do, he loves the famous drink "Beecola", which can be bought in *n* different shops in the city. It's known that the price of one bottle in the shop *i* is equal to *x**i* coins.
Vasiliy plans to buy his favorite ... | {"inputs": ["5\n3 10 8 6 11\n4\n1\n10\n3\n11", "5\n868 987 714 168 123\n10\n424\n192\n795\n873\n117\n914\n735\n158\n631\n471", "3\n435 482 309\n7\n245\n241\n909\n745\n980\n29\n521", "1\n653\n9\n903\n980\n80\n770\n965\n874\n381\n657\n969", "12\n35345 58181 32223 84621 35905 73863 99537 30666 67771 39229 36847 29038\n23\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 284 | codeforces | |
23ebcca15bd46dead8f1b185628d3dc9 | Packmen | A game field is a strip of 1<=×<=*n* square cells. In some cells there are Packmen, in some cells — asterisks, other cells are empty.
Packman can move to neighboring cell in 1 time unit. If there is an asterisk in the target cell then Packman eats it. Packman doesn't spend any time to eat an asterisk.
In the initial ... | {"inputs": ["7\n*..P*P*", "10\n.**PP.*P.*", "19\n**P.*..*..P..*.*P**", "12\nP**.*P*P*P**", "58\n..P.P*.P*.P...PPP...P*....*..*.**......*P.*P.....**P...*P*", "10\n..P*.P.*.*", "10\n***.*.*..P", "15\nP***..PPP..P*.P", "20\n.P**P**P**PP.PP**PP*", "20\n.....*.**..........P", "25\n...*..**..*.....*..*...P.", "30\n*P.*...*.*... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 7 | codeforces | |
23eee3079293ce0dc454eed8b1e186ab | Let's Play Osu! | You're playing a game called Osu! Here's a simplified version of it. There are *n* clicks in a game. For each click there are two outcomes: correct or bad. Let us denote correct as "O", bad as "X", then the whole play can be encoded as a sequence of *n* characters "O" and "X".
Using the play sequence you can calculate... | {"inputs": ["3\n0.5 0.5 0.5", "4\n0.7 0.2 0.1 0.9", "5\n1 1 1 1 1", "10\n0.684846 0.156794 0.153696 0.714526 0.281868 0.628256 0.745339 0.123854 0.748936 0.856333", "10\n0.684488 0.834971 0.834886 0.643646 0.162710 0.119851 0.659401 0.743950 0.220986 0.839665", "10\n0.684416 0.170607 0.491124 0.469470 0.458879 0.658170... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 14 | codeforces | |
23f7e534541a11b5794fceedb3aa1919 | Road Map | There are *n* cities in Berland. Each city has its index — an integer number from 1 to *n*. The capital has index *r*1. 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 the road map is... | {"inputs": ["3 2 3\n2 2", "6 2 4\n6 1 2 4 2", "7 7 6\n7 7 5 5 7 7", "4 2 3\n2 1 3", "5 5 4\n5 4 1 5", "6 2 1\n4 1 2 2 2", "2 1 2\n1", "2 2 1\n2", "3 1 3\n1 2", "10 4 3\n5 6 9 10 1 9 6 8 4", "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 9... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 12 | codeforces | |
241db9c5a973ea82a73166583a928c0d | Mahmoud and Ehab and another array construction task | Mahmoud has an array *a* consisting of *n* integers. He asked Ehab to find another array *b* of the same length such that:
- *b* is lexicographically greater than or equal to *a*. - *b**i*<=≥<=2. - *b* is pairwise coprime: for every 1<=≤<=*i*<=<<=*j*<=≤<=*n*, *b**i* and *b**j* are coprime, i. e. *GCD*(*b**i*,<=*... | {"inputs": ["5\n2 3 5 4 13", "3\n10 3 7", "5\n7 10 2 5 5", "7\n20 9 7 6 7 9 15", "10\n5 3 2 2 3 3 3 4 2 5", "3\n3 18 2"], "outputs": ["2 3 5 7 11 ", "10 3 7 ", "7 10 3 11 13 ", "20 9 7 11 13 17 19 ", "5 3 2 7 11 13 17 19 23 29 ", "3 19 2 "]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 4 | codeforces | |
2429f322b7cc404abce8166b8b9136a5 | Caisa and Sugar | Caisa is going to have a party and he needs to buy the ingredients for a big chocolate cake. For that he is going to the biggest supermarket in town.
Unfortunately, he has just *s* dollars for sugar. But that's not a reason to be sad, because there are *n* types of sugar in the supermarket, maybe he able to buy one. B... | {"inputs": ["5 10\n3 90\n12 0\n9 70\n5 50\n7 0", "5 5\n10 10\n20 20\n30 30\n40 40\n50 50", "1 2\n1 0", "2 10\n20 99\n30 99", "15 21\n16 51\n33 44\n32 92\n19 91\n67 81\n94 94\n40 67\n77 38\n42 22\n48 19\n9 35\n90 36\n57 80\n58 97\n13 15", "1 2\n5 0", "37 10\n57 61\n78 79\n59 60\n48 17\n39 22\n11 87\n19 55\n56 78\n25 12\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 36 | codeforces | |
242feae3e5b6572f61ecbafac4a4cf6f | Berland Local Positioning System | In Berland a bus travels along the main street of the capital. The street begins from the main square and looks like a very long segment. There are *n* bus stops located along the street, the *i*-th of them is located at the distance *a**i* from the central square, all distances are distinct, the stops are numbered in ... | {"inputs": ["6\n2 3 5 7 11 13\n5\n3 4 5 5 6", "6\n2 3 5 7 11 13\n9\n1 2 2 3 3 4 5 5 6", "3\n10 200 300\n4\n1 2 2 3", "3\n1 2 3\n4\n1 2 2 3", "2\n1 1000000000\n1\n1", "2\n1 1000000000\n1\n2", "2\n1 1000000000\n2\n1 2", "2\n1 1000000000\n3\n1 1 2", "2\n1 1000000000\n3\n1 2 2", "2\n1 1000000000\n4\n1 1 2 2", "3\n1 3 11\n2... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
245edba82711e93fa3c7b2d0769daac0 | none |
Nephren is playing a game with little leprechauns.
She gives them an infinite array of strings, *f*0... ∞.
*f*0 is "What are you doing at the end of the world? Are you busy? Will you save us?".
She wants to let more people know about it, so she defines *f**i*<==<= "What are you doing while sending "*f**i*<=-<=1"? ... | {"inputs": ["3\n1 1\n1 2\n1 111111111111", "5\n0 69\n1 194\n1 139\n0 47\n1 66", "10\n4 1825\n3 75\n3 530\n4 1829\n4 1651\n3 187\n4 584\n4 255\n4 774\n2 474", "1\n0 1", "1\n999 1000000000000000000", "10\n1 8\n1 8\n9 5\n0 1\n8 1\n7 3\n5 2\n0 9\n4 6\n9 4", "10\n5 235941360876088213\n10 65160787148797531\n0 531970131175601... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 11 | codeforces | |
2461eb7af104edc7e4dc97240eba293c | Tanya and Password | While dad was at work, a little girl Tanya decided to play with dad's password to his secret database. Dad's password is a string consisting of *n*<=+<=2 characters. She has written all the possible *n* three-letter continuous substrings of the password on pieces of paper, one for each piece of paper, and threw the pas... | {"inputs": ["5\naca\naba\naba\ncab\nbac", "4\nabc\nbCb\ncb1\nb13", "7\naaa\naaa\naaa\naaa\naaa\naaa\naaa", "1\nabc", "2\nbba\nabb", "3\naaa\naaa\naab", "2\naba\nbab", "2\nabc\nbga", "4\naba\nbab\ncdc\ndcd", "4\nbaa\ncaa\naax\naay", "2\naba\naba", "5\n123\n234\n345\n456\n567", "3\n42y\n2ya\nya6", "8\nzHW\ncwx\nxmo\nWcw\... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
24727c565c8de8d98b5f7525b92f4188 | Plumber | Little John aspires to become a plumber! Today he has drawn a grid consisting of *n* rows and *m* columns, consisting of *n*<=×<=*m* square cells.
In each cell he will draw a pipe segment. He can only draw four types of segments numbered from 1 to 4, illustrated as follows:
Each pipe segment has two ends, illustrated... | {"inputs": ["2 2\n13\n..", "3 1\n1\n4\n.", "2 2\n3.\n.1", "2 2\n..\n..", "2 2\n32\n41", "4 4\n....\n.3.3\n....\n.3.3", "1 3\n12.", "1 1\n4", "2 2\n..\n1.", "1 1\n."], "outputs": ["2", "0", "1", "16", "1", "16", "0", "1", "4", "4"]} | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 1 | codeforces | |
249f6787700af82291a3ea226be0f68f | Soft Drinking | This winter is so cold in Nvodsk! A group of *n* friends decided to buy *k* bottles of a soft drink called "Take-It-Light" to warm up a bit. Each bottle has *l* milliliters of the drink. Also they bought *c* limes and cut each of them into *d* slices. After that they found *p* grams of salt.
To make a toast, each frie... | {"inputs": ["3 4 5 10 8 100 3 1", "5 100 10 1 19 90 4 3", "10 1000 1000 25 23 1 50 1", "1 7 4 5 5 8 3 2", "2 3 3 5 5 10 1 3", "2 6 4 5 6 5 1 3", "1 7 3 5 3 6 2 1", "2 4 5 4 5 7 3 2", "2 3 6 5 7 8 2 1", "1 4 5 5 3 10 3 1", "1 4 6 7 3 5 1 3", "1 6 5 5 5 8 3 1", "1 7 5 3 3 9 2 1", "3 5 3 7 6 10 3 1", "3 6 3 5 3 6 3 1", "1... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 713 | codeforces | |
24a5265e9508929ff7aba46a658ca400 | Interview | Blake is a CEO of a large company called "Blake Technologies". He loves his company very much and he thinks that his company should be the best. That is why every candidate needs to pass through the interview that consists of the following problem.
We define function *f*(*x*,<=*l*,<=*r*) as a bitwise OR of integers *x... | {"inputs": ["5\n1 2 4 3 2\n2 3 3 12 1", "10\n13 2 7 11 8 4 9 8 5 1\n5 7 18 9 2 3 0 11 8 6", "25\n12 30 38 109 81 124 80 33 38 48 29 78 96 48 96 27 80 77 102 65 80 113 31 118 35\n25 64 95 13 12 6 111 80 85 16 61 119 23 65 73 65 20 95 124 18 28 79 125 106 116", "20\n64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 6... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 187 | codeforces | |
24c217d715fb4fddc13a3e2389631c73 | Tree Queries | You are given a tree consisting of *n* vertices (numbered from 1 to *n*). Initially all vertices are white. You have to process *q* queries of two different types:
1. 1 *x* — change the color of vertex *x* to black. It is guaranteed that the first query will be of this type. 1. 2 *x* — for the vertex *x*, find the m... | {"inputs": ["4 6\n1 2\n2 3\n3 4\n1 2\n1 2\n2 2\n1 3\n2 2\n2 2", "10 10\n1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n7 8\n8 9\n9 10\n1 3\n2 10\n1 8\n1 7\n1 6\n1 4\n2 9\n2 7\n1 5\n1 5", "10 10\n1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n7 8\n8 9\n9 10\n1 10\n1 4\n1 1\n2 7\n2 4\n1 2\n2 6\n2 4\n2 3\n1 3", "10 10\n1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n7 8\n8... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 2 | codeforces | |
24d955e00035d7cf0cc67a95de0b508b | Vasya and the Bus | One day Vasya heard a story: "In the city of High Bertown a bus number 62 left from the bus station. It had *n* grown-ups and *m* kids..."
The latter events happen to be of no importance to us. Vasya is an accountant and he loves counting money. So he wondered what maximum and minimum sum of money these passengers cou... | {"inputs": ["1 2", "0 5", "2 2", "2 7", "4 10", "6 0", "7 1", "0 0", "71 24", "16 70", "0 1", "1 0", "1 1", "63 82", "8 26", "21 27", "0 38", "46 84", "59 96", "63028 0", "9458 0", "80236 0", "26666 0", "59617 0", "0 6048", "63028 28217", "9458 39163", "80236 14868", "26666 52747", "59617 28452", "6048 4158", "76826 42... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 41 | codeforces | |
24d9f8e55c368c2af7b5d03bbea4d3f5 | none | Little Artem likes electronics. He can spend lots of time making different schemas and looking for novelties in the nearest electronics store. The new control element was delivered to the store recently and Artem immediately bought it.
That element can store information about the matrix of integers size *n*<=×<=*m*. T... | {"inputs": ["2 2 6\n2 1\n2 2\n3 1 1 1\n3 2 2 2\n3 1 2 8\n3 2 1 8", "3 3 2\n1 2\n3 2 2 5", "5 5 1\n1 5", "1 1 3\n1 1\n2 1\n3 1 1 1000000000", "1 1 3\n1 1\n2 1\n3 1 1 -1000000000", "2 2 6\n2 1\n2 2\n3 1 1 -1\n3 2 2 -1\n3 1 2 -1\n3 2 1 -1", "1 4 5\n1 1\n3 1 1 1\n3 1 2 2\n3 1 3 3\n3 1 4 4", "4 2 5\n2 1\n3 1 1 5\n3 2 1 6\n3... | UNKNOWN | [
"PYTHON3"
] | CODEFORCES | 25 | codeforces |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.