task_id stringlengths 7 43 | category stringclasses 1
value | difficulty int64 6 9 | instruction stringlengths 320 4.55k | tests_io listlengths 1 5 |
|---|---|---|---|---|
cc_brcktsrm | contest | 6 | Problem description.
Vipul is a hardworking super-hero who maintains the bracket ratio of all the strings in the world. Recently he indulged himself in saving the string population so much that he lost his ability for checking brackets (luckily, not permanently ).Being his super-hero friendΒ help him in his time of hard... | [
[
"3\n((()))\n(())()\n()(()",
"YES\nYES\nNO"
],
[
"3\n((()))\n(())()\n()())",
"YES\nYES\nNO\n"
],
[
"3\n((()()\n(())()\n()(()",
"NO\nYES\nNO\n"
],
[
"3\n((()))\n(())))\n()())",
"YES\nNO\nNO\n"
],
[
"3\n)))(((\n(())))\n()())",
"NO\nNO\nNO\n"
]
] |
cc_tf01 | contest | 6 | An established group of scientists are working on finding solution to NP hard problems. They claim Subset Sum as an NP-hard problem. The problem is to determine whether there exists a subset of a given set S whose sum is a given number K.
You are a computer engineer and you claim to solve this problem given that all... | [
[
"2\n5 10\n3 4 6 1 9\n3 2\n1 3 4",
"1\n0"
]
] |
cc_1060_A._Phone_Numbers | contest | 7 | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | [
[
"22\n0011223344556677889988\n",
"2\n"
],
[
"11\n00000000008\n",
"1\n"
],
[
"11\n31415926535\n",
"0\n"
],
[
"51\n1732111733638718702525811518175029394157760329139501\n",
"4\n"
],
[
"55\n8150965228922987149322123425550549439018369681986057802\n",
"5\n"
]
] |
cc_1101_A._Minimum_Integer | contest | 7 | You are given q queries in the following form:
Given three integers l_i, r_i and d_i, find minimum positive integer x_i such that it is divisible by d_i and it does not belong to the segment [l_i, r_i].
Can you answer all the queries?
Recall that a number x belongs to segment [l, r] if l β€ x β€ r.
Input
The first l... | [
[
"5\n2 4 2\n5 10 4\n3 10 1\n1 2 3\n4 6 5\n",
"6\n4\n1\n3\n10\n"
],
[
"1\n78 1 79\n",
"79\n"
],
[
"1\n2 6 6\n",
"12\n"
],
[
"20\n1 1 1\n1 999999999 1\n1 999999999 1\n1 999999999 1\n1 999999999 1\n1 999999999 1\n1 999999999 1\n1 999999999 1\n1 999999999 1\n1 832136582 1\n1 999... |
cc_1250_B._The_Feast_and_the_Bus | contest | 8 | Employees of JebTrains are on their way to celebrate the 256-th day of the year! There are n employees and k teams in JebTrains. Each employee is a member of some (exactly one) team. All teams are numbered from 1 to k. You are given an array of numbers t_1, t_2, ..., t_n where t_i is the i-th employee's team number.
J... | [
[
"6 3\n3 1 2 3 2 3\n",
"\n6\n"
],
[
"10 1\n1 1 1 1 1 1 1 1 1 1\n",
"\n10\n"
],
[
"12 4\n1 2 3 1 2 3 4 1 2 1 2 1\n",
"\n12\n"
]
] |
cc_1398_A._Bad_Triangle | contest | 7 | You are given an array a_1, a_2, ... , a_n, which is sorted in non-decreasing order (a_i β€ a_{i + 1}).
Find three indices i, j, k such that 1 β€ i < j < k β€ n and it is impossible to construct a non-degenerate triangle (a triangle with nonzero area) having sides equal to a_i, a_j and a_k (for example it is possible to... | [
[
"3\n7\n4 6 11 11 15 18 20\n4\n10 10 10 11\n3\n1 1 1000000000\n",
"1 2 7\n-1\n1 2 3\n"
],
[
"3\n7\n4 6 11 11 15 18 34\n4\n10 10 10 11\n3\n1 1 1000000000\n",
"1 2 7\n-1\n1 2 3\n"
],
[
"1\n3\n39 78868 80000\n",
"1 2 3\n"
],
[
"1\n3\n78788 143221 157577\n",
"-1\n"
],
[
... |
cc_1421_B._Putting_Bricks_in_the_Wall | contest | 8 | Pink Floyd are pulling a prank on Roger Waters. They know he doesn't like [walls](https://www.youtube.com/watch?v=YR5ApYxkU-U), he wants to be able to walk freely, so they are blocking him from exiting his room which can be seen as a grid.
Roger Waters has a square grid of size nΓ n and he wants to traverse his grid f... | [
[
"3\n4\nS010\n0001\n1000\n111F\n3\nS10\n101\n01F\n5\nS0101\n00000\n01111\n11111\n0001F\n",
"1\n3 4\n2\n1 2\n2 1\n0\n"
],
[
"1\n3\nS10\n111\n00F\n",
"1\n2 3\n"
],
[
"1\n5\nS0000\n10000\n00000\n00000\n0000F\n",
"1\n1 2\n"
],
[
"1\n3\nS10\n110\n11F\n",
"1\n3 2\n"
],
[
... |
cc_143_A._Help_Vasilisa_the_Wise_2 | contest | 7 | Vasilisa the Wise from the Kingdom of Far Far Away got a magic box with a secret as a present from her friend Hellawisa the Wise from the Kingdom of A Little Closer. However, Vasilisa the Wise does not know what the box's secret is, since she cannot open it again. She hopes that you will help her one more time with tha... | [
[
"1 2\n3 4\n5 6\n",
"-1\n"
],
[
"11 10\n13 8\n5 16\n",
"4 7\n9 1\n"
],
[
"3 7\n4 6\n5 5\n",
"1 2\n3 4\n"
],
[
"10 10\n10 10\n10 10\n",
"-1\n"
],
[
"12 11\n11 12\n25 7\n",
"-1\n"
]
] |
cc_1513_C._Add_One | contest | 9 | You are given an integer n. You have to apply m operations to it.
In a single operation, you must replace every digit d of the number with the decimal representation of integer d + 1. For example, 1912 becomes 21023 after applying the operation once.
You have to find the length of n after applying m operations. Since... | [
[
"5\n1912 1\n5 6\n999 1\n88 2\n12 100\n",
"\n5\n2\n6\n4\n2115\n"
],
[
"5\n90 94\n26 25\n64 84\n18 6\n20 96\n",
"1842\n12\n1015\n3\n1908\n"
],
[
"5\n1912 1\n5 6\n999 1\n88 2\n11 100\n",
"5\n2\n6\n4\n2070\n"
],
[
"5\n90 94\n26 25\n64 84\n22 6\n20 96\n",
"1842\n12\n1015\n2\... |
cc_1540_C1._Converging_Array_(Easy_Version) | contest | 9 | This is the easy version of the problem. The only difference is that in this version q = 1. You can make hacks only if both versions of the problem are solved.
There is a process that takes place on arrays a and b of length n and length n-1 respectively.
The process is an infinite sequence of operations. Each operat... | [
[
"3\n2 3 4\n2 1\n1\n-1\n",
"56\n"
],
[
"100\n95 54 23 27 51 58 94 34 29 95 53 53 8 5 64 32 17 62 14 37 26 95 27 85 94 37 85 72 88 69 43 9 60 3 48 26 81 48 89 56 34 28 2 63 26 6 13 19 99 41 70 24 92 41 9 73 52 42 34 98 16 82 7 81 28 80 18 33 90 69 19 13 51 96 8 21 86 32 96 7 5 42 52 87 24 82 14 88 4... |
cc_168_A._Wizards_and_Demonstration | contest | 7 | Some country is populated by wizards. They want to organize a demonstration.
There are n people living in the city, x of them are the wizards who will surely go to the demonstration. Other city people (n - x people) do not support the wizards and aren't going to go to the demonstration. We know that the city administr... | [
[
"1000 352 146\n",
"1108\n"
],
[
"10 1 14\n",
"1\n"
],
[
"20 10 50\n",
"0\n"
],
[
"13372 2590 2818\n",
"374233\n"
],
[
"78 28 44\n",
"7\n"
]
] |
cc_20_B._Equation | contest | 8 | You are given an equation:
Ax2 + Bx + C = 0.
Your task is to find the number of distinct roots of the equation and print all of them in ascending order.
Input
The first line contains three integer numbers A, B and C ( - 105 β€ A, B, C β€ 105). Any coefficient may be equal to 0.
Output
In case of infinite root cou... | [
[
"1 -5 6\n",
"2\n2.000000\n3.000000\n"
],
[
"0 -2 -1\n",
"1\n-0.5\n"
],
[
"563 -23532 1232\n",
"2\n0.05241998309345938\n41.74509333839855\n"
],
[
"0 2 0\n",
"1\n0.0\n"
],
[
"0 10 20\n",
"1\n-2.0\n"
]
] |
cc_260_B._Ancient_Prophesy | contest | 8 | A recently found Ancient Prophesy is believed to contain the exact Apocalypse date. The prophesy is a string that only consists of digits and characters "-".
We'll say that some date is mentioned in the Prophesy if there is a substring in the Prophesy that is the date's record in the format "dd-mm-yyyy". We'll say tha... | [
[
"777-444---21-12-2013-12-2013-12-2013---444-777\n",
"13-12-2013\n"
],
[
"11--01--2013-02-2013-01--01--2013\n",
"13-02-2013\n"
],
[
"00-12-2014-00-12-2013-00-12-2014-12-12-2014\n",
"12-12-2014\n"
],
[
"23-11-201413-07-201412-06-2015124-03-20140-19-201323-11-201424-03-2024537... |
cc_284_B._Cows_and_Poker_Game | contest | 8 | There are n cows playing poker at a table. For the current betting phase, each player's status is either "ALLIN", "IN", or "FOLDED", and does not change throughout the phase. To increase the suspense, a player whose current status is not "FOLDED" may show his/her hand to the table. However, so as not to affect any bett... | [
[
"3\nAFI\n",
"1"
],
[
"6\nAFFAAA\n",
"4"
],
[
"5\nFFFAF\n",
"1\n"
],
[
"5\nIIAAF\n",
"0\n"
],
[
"5\nAAFFA\n",
"3\n"
]
] |
cc_309_B._Context_Advertising | contest | 8 | Advertising has become part of our routine. And now, in the era of progressive technologies, we need your ideas to make advertising better!
In this problem we'll look at a simplified version of context advertising. You've got a text, consisting of exactly n words. A standard advertising banner has exactly r lines, eac... | [
[
"9 4 12\nthis is a sample text for croc final round\n",
"this is a\nsample text\nfor croc\nfinal round\n"
],
[
"9 1 9\nthis is a sample text for croc final round\n",
"this is a\n"
],
[
"2 2 5\nfirst second\n",
"first\n\n"
],
[
"6 2 3\ncroc a a a croc a\n",
"a a\na\n"
... |
cc_379_A._New_Year_Candles | contest | 7 | Vasily the Programmer loves romance, so this year he decided to illuminate his room with candles.
Vasily has a candles.When Vasily lights up a new candle, it first burns for an hour and then it goes out. Vasily is smart, so he can make b went out candles into a new candle. As a result, this new candle can be used like... | [
[
"4 2\n",
"7\n"
],
[
"6 3\n",
"8\n"
],
[
"777 20\n",
"817\n"
],
[
"110 4\n",
"146\n"
],
[
"12 4\n",
"15\n"
]
] |
cc_44_B._Cola | contest | 8 | To celebrate the opening of the Winter Computer School the organizers decided to buy in n liters of cola. However, an unexpected difficulty occurred in the shop: it turned out that cola is sold in bottles 0.5, 1 and 2 liters in volume. At that, there are exactly a bottles 0.5 in volume, b one-liter bottles and c of two... | [
[
"10 5 5 5\n",
"9\n"
],
[
"3 0 0 2\n",
"0\n"
],
[
"10 15 10 5\n",
"32"
],
[
"20 0 2 3\n",
"0"
],
[
"7 3 2 2\n",
"1"
]
] |
cc_519_B._A_and_B_and_Compilation_Errors | contest | 8 | 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 s... | [
[
"6\n1 4 3 3 5 7\n3 7 5 4 3\n4 3 7 5\n",
"1\n3\n"
],
[
"5\n1 5 8 123 7\n123 7 5 1\n5 1 7\n",
"8\n123\n"
],
[
"3\n77 42 77\n77 77\n77\n",
"42\n77\n"
],
[
"3\n77 31 77\n77 77\n77\n",
"31\n77\n"
],
[
"4\n1 5 7 12\n1 5 7\n1 5\n",
"12\n7\n"
]
] |
cc_545_C._Woodcutters | contest | 9 | 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 x1, x2, ..., xn. Each ... | [
[
"5\n1 2\n2 1\n5 10\n10 9\n20 1\n",
"4\n"
],
[
"5\n1 2\n2 1\n5 10\n10 9\n19 1\n",
"3\n"
],
[
"2\n1 222168095\n1000000000 1000000000\n",
"2\n"
],
[
"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 0\n37 3\n39 4\n40 5\n41 1\n44 1\n47 7\n48 11... |
cc_593_C._Beautiful_Function | contest | 9 | Every day Ruslan tried to count sheep to fall asleep, but this didn't help. Now he has found a more interesting thing to do. First, he thinks of some set of circles on a plane, and then tries to choose a beautiful set of points, such that there is at least one point from the set inside or on the border of each of the i... | [
[
"3\n0 10 4\n10 0 4\n20 10 4\n",
"(((0*((1-abs((t-0)))+abs((abs((t-0))-1))))+(5*((1-abs((t-1)))+abs((abs((t-1))-1)))))+(10*((1-abs((t-2)))+abs((abs((t-2))-1)))))\n(((5*((1-abs((t-0)))+abs((abs((t-0))-1))))+(0*((1-abs((t-1)))+abs((abs((t-1))-1)))))+(5*((1-abs((t-2)))+abs((abs((t-2))-1)))))\n"
],
[
"... |
cc_615_A._Bulbs | contest | 7 | Vasya wants to turn on Christmas lights consisting of m bulbs. Initially, all bulbs are turned off. There are n buttons, each of them is connected to some set of bulbs. Vasya can press any of these buttons. When the button is pressed, it turns on all the bulbs it's connected to. Can Vasya light up all the bulbs?
If Va... | [
[
"3 4\n2 1 4\n3 1 3 1\n1 2\n",
"YES\n"
],
[
"3 3\n1 1\n1 2\n1 1\n",
"NO\n"
],
[
"5 6\n3 1 2 6\n3 1 2 6\n1 1\n2 3 6\n3 1 5 6\n",
"NO\n"
],
[
"5 7\n2 6 7\n5 1 1 1 1 1\n3 6 5 5\n0\n4 4 3 2 1\n",
"YES\n"
],
[
"1 100\n100 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 16 18 1... |
cc_634_C._Factory_Repairs | contest | 9 | A factory produces thimbles in bulk. Typically, it can produce up to a thimbles a day. However, some of the machinery is defective, so it can currently only produce b thimbles each day. The factory intends to choose a k-day period to do maintenance and construction; it cannot produce any thimbles during this time, but ... | [
[
"5 4 10 1 6\n1 1 5\n1 5 5\n1 3 2\n1 5 2\n2 1\n2 2\n",
"7\n1\n"
],
[
"5 2 2 1 8\n1 1 2\n1 5 3\n1 2 1\n2 2\n1 4 2\n1 3 2\n2 1\n2 3\n",
"3\n6\n4\n"
],
[
"1 1 2 2 1\n2 1\n",
"0\n"
],
[
"5 2 2 1 8\n1 1 2\n1 5 3\n1 2 1\n2 2\n1 4 2\n1 3 0\n2 1\n2 3\n",
"3\n4\n4\n"
],
[
... |
cc_663_A._Rebus | contest | 7 | You are given a rebus of form ? + ? - ? + ? = n, consisting of only question marks, separated by arithmetic operation '+' and '-', equality and positive integer n. The goal is to replace each question mark with some positive integer from 1 to n, such that equality holds.
Input
The only line of the input contains a re... | [
[
"? - ? = 1\n",
"Impossible\n"
],
[
"? + ? - ? + ? + ? = 42\n",
"Possible\n40 + 1 - 1 + 1 + 1 = 42\n"
],
[
"? = 1000000\n",
"Possible\n1000000 = 1000000\n"
],
[
"? + ? + ? + ? + ? + ? + ? + ? + ? + ? - ? = 9\n",
"Possible \n1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 = 9 \... |
cc_70_C._Lucky_Tickets | contest | 9 | In Walrusland public transport tickets are characterized by two integers: by the number of the series and by the number of the ticket in the series. Let the series number be represented by a and the ticket number β by b, then a ticket is described by the ordered pair of numbers (a, b).
The walruses believe that a tic... | [
[
"5 18 1000\n",
"-1"
],
[
"132 10 35\n",
"5 7\n"
],
[
"48 132 235\n",
"22 111"
],
[
"2 2 1\n",
"1 1"
],
[
"85 36 123\n",
"22 22\n"
]
] |
cc_776_A._A_Serial_Killer | contest | 7 | 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 ... | [
[
"icm codeforces\n1\ncodeforces technex\n",
"icm codeforces\nicm technex\n"
],
[
"ross rachel\n4\nross joey\nrachel phoebe\nphoebe monica\nmonica chandler\n",
"ross rachel\njoey rachel\njoey phoebe\njoey monica\njoey chandler\n"
],
[
"qqqqqqqqqq qqqqqqqq\n3\nqqqqqqqq qqqqqqqqq\nqqqqqqqq... |
cc_7_B._Memory_Manager | contest | 8 | There is little time left before the release of the first national operating system BerlOS. Some of its components are not finished yet β the memory manager is among them. According to the developers' plan, in the first release the memory manager will be very simple and rectilinear. It will support three operations:
... | [
[
"6 10\nalloc 5\nalloc 3\nerase 1\nalloc 6\ndefragment\nalloc 6\n",
"1\n2\nNULL\n3\n"
],
[
"7 6\nalloc 2\nalloc 2\nalloc 3\nerase 1\ndefragment\nerase 3\nalloc 4\n",
"1\n2\nNULL\nILLEGAL_ERASE_ARGUMENT\n3\n"
],
[
"8 50\nalloc 51\ndefragment\nalloc 101\ndefragment\nerase 1\nalloc 50\ndef... |
cc_868_A._Bark_to_Unlock | contest | 7 | As technologies develop, manufacturers are making the process of unlocking a phone as user-friendly as possible. To unlock its new phone, Arkady's pet dog Mu-mu has to bark the password once. The phone represents a password as a string of two lowercase English letters.
Mu-mu's enemy Kashtanka wants to unlock Mu-mu's p... | [
[
"ah\n1\nha\n",
"YES"
],
[
"ya\n4\nah\noy\nto\nha\n",
"YES"
],
[
"hp\n2\nht\ntp\n",
"NO"
],
[
"aa\n2\nbb\nbc\n",
"NO\n"
],
[
"th\n1\nht\n",
"YES\n"
]
] |
cc_915_A._Garden | contest | 7 | Luba thinks about watering her garden. The garden can be represented as a segment of length k. Luba has got n buckets, the i-th bucket allows her to water some continuous subsegment of garden of length exactly ai each hour. Luba can't water any parts of the garden that were already watered, also she can't water the gro... | [
[
"3 6\n2 3 5\n",
"2\n"
],
[
"6 7\n1 2 3 4 5 6\n",
"7\n"
],
[
"3 4\n3 2 1\n",
"2\n"
],
[
"5 97\n1 10 76 97 2\n",
"1\n"
],
[
"2 16\n12 4\n",
"4\n"
]
] |
cc_938_B._Run_For_Your_Prize | contest | 8 | You and your friend are participating in a TV show "Run For Your Prize".
At the start of the show n prizes are located on a straight line. i-th prize is located at position ai. Positions of all prizes are distinct. You start at position 1, your friend β at position 106 (and there is no prize in any of these two positi... | [
[
"2\n2 999995\n",
"5\n"
],
[
"3\n2 3 9\n",
"8\n"
],
[
"3\n184427 500001 500002\n",
"499999\n"
],
[
"1\n413243\n",
"413242\n"
],
[
"1\n256223\n",
"256222\n"
]
] |
cc_963_B._Destruction_of_a_Tree | contest | 8 | You are given a tree (a graph with n vertices and n - 1 edges in which it's possible to reach any vertex from any other vertex using only its edges).
A vertex can be destroyed if this vertex has even degree. If you destroy a vertex, all edges connected to it are also deleted.
Destroy all vertices in the given tree or... | [
[
"5\n0 1 2 1 2\n",
"YES\n1\n2\n3\n5\n4\n"
],
[
"4\n0 1 2 3\n",
"NO\n"
],
[
"21\n11 19 4 19 6 0 13 7 6 2 5 3 16 16 1 9 15 21 9 21 2\n",
"YES\n11\n6\n9\n16\n7\n8\n13\n14\n19\n2\n10\n21\n18\n20\n3\n12\n4\n5\n15\n17\n1\n"
],
[
"100\n57 85 27 81 41 27 73 10 73 95 91 90 89 41 86 4... |
cc_cdva1502 | contest | 6 | Your task is very simple. Given K numbers A1, A2, ..., AK. You need to find f(N) mod max(A1, A2, ..., AK) .
f(N)=N!
Input
First line contains single integer T denoting the number of test cases..
First line of each test case contains two integers N and K.
Next line contains K integers Ak
Output
For each test case,... | [
[
"1\n5 3\n200 6 9",
"120"
],
[
"1\n5 3\n200 12 9",
"120\n"
],
[
"1\n9 3\n200 12 9",
"80\n"
],
[
"1\n7 3\n200 12 9",
"40\n"
],
[
"1\n7 3\n141 12 9",
"105\n"
]
] |
cc_dbyz15t | contest | 6 | Problem Desrcription
Shil likes to play with trees a lot.He is playing with an undirected tree containing N nodes.He wants to find out total number of unordered triplets (A,B,C) such that A is not connected to B, B is not connected to C and A is not connected to C by a direct edge (No two of A, B, C are mutually conne... | [
[
"5\n1 2\n1 3\n3 4\n2 5",
"1"
]
] |
cc_ig01 | contest | 6 | This is a simple game you must have played around with during your school days, calculating FLAMES of you and your crush! Given the names of two people, cancel out the common letters (repeated occurrence of a letter is treated separately, so 2A's in one name and one A in the other would cancel one A in each name), coun... | [
[
"2\nSHILPA\nAAMIR\nMATT\nDENISE",
"ENEMIES\nLOVE"
]
] |
cc_101_C._Vectors | contest | 9 | At a geometry lesson Gerald was given a task: to get vector B out of vector A. Besides, the teacher permitted him to perform the following operations with vector Π:
* Turn the vector by 90 degrees clockwise.
* Add to the vector a certain vector C.
Operations could be performed in any order any number of times.
... | [
[
"0 0\n1 1\n1 1\n",
"YES\n"
],
[
"0 0\n1 1\n0 1\n",
"YES\n"
],
[
"0 0\n1 1\n2 2\n",
"NO\n"
],
[
"3 1\n-1 3\n-2 -2\n",
"YES\n"
],
[
"-8360 9282\n2666 2344\n9109 -2730\n",
"NO\n"
]
] |
cc_1043_A._Elections | contest | 7 | Awruk is taking part in elections in his school. It is the final round. He has only one opponent β Elodreip. The are n students in the school. Each student has exactly k votes and is obligated to use all of them. So Awruk knows that if a person gives a_i votes for Elodreip, than he will get exactly k - a_i votes from t... | [
[
"5\n2 2 3 2 2\n",
"5\n"
],
[
"5\n1 1 1 5 1\n",
"5\n"
],
[
"3\n1 0 6\n",
"6\n"
],
[
"10\n7 7 7 7 7 7 7 7 7 3\n",
"14\n"
],
[
"76\n13 13 5 6 20 20 6 1 18 18 13 15 20 3 9 11 3 11 2 8 12 15 2 4 16 17 8 11 15 6 6 5 3 12 19 15 17 8 5 20 12 6 9 7 20 15 8 7 5 17 9 12 12... |
cc_1155_A._Reverse_a_Substring | contest | 7 | You are given a string s consisting of n lowercase Latin letters.
Let's define a substring as a contiguous subsegment of a string. For example, "acab" is a substring of "abacaba" (it starts in position 3 and ends in position 6), but "aa" or "d" aren't substrings of this string. So the substring of the string s from po... | [
[
"7\nabacaba\n",
"YES\n2 3\n"
],
[
"6\naabcfg\n",
"NO\n"
],
[
"6\nbabddc\n",
"YES\n1 2\n"
],
[
"7\nbd`dccd\n",
"YES\n2 3\n"
],
[
"2\nab\n",
"NO\n"
]
] |
cc_1236_A._Stones | contest | 7 | Alice is playing with some stones.
Now there are three numbered heaps of stones. The first of them contains a stones, the second of them contains b stones and the third of them contains c stones.
Each time she can do one of two operations:
1. take one stone from the first heap and two stones from the second heap (... | [
[
"3\n3 4 5\n1 0 5\n5 3 2\n",
"9\n0\n6\n"
],
[
"20\n9 4 8\n10 6 7\n4 6 0\n7 7 6\n3 6 10\n4 2 1\n4 4 0\n2 0 0\n8 8 7\n3 1 7\n3 10 7\n1 7 3\n7 9 1\n1 6 9\n0 9 5\n4 0 0\n2 10 0\n4 8 5\n10 0 1\n8 1 1\n",
"12\n12\n9\n15\n15\n3\n6\n0\n15\n3\n18\n6\n12\n15\n6\n0\n6\n15\n0\n0\n"
],
[
"64\n0 0 0\... |
cc_1382_A._Common_Subsequence | contest | 7 | You are given two arrays of integers a_1,β¦,a_n and b_1,β¦,b_m.
Your task is to find a non-empty array c_1,β¦,c_k that is a subsequence of a_1,β¦,a_n, and also a subsequence of b_1,β¦,b_m. If there are multiple answers, find one of the smallest possible length. If there are still multiple of the smallest possible length, f... | [
[
"5\n4 5\n10 8 6 4\n1 2 3 4 5\n1 1\n3\n3\n1 1\n3\n2\n5 3\n1000 2 2 2 3\n3 1 5\n5 5\n1 2 3 4 5\n1 2 3 4 5\n",
"YES\n1 4\nYES\n1 3\nNO\nYES\n1 3\nYES\n1 1\n"
],
[
"1\n2 2\n1 1\n1 3\n",
"YES\n1 1\n"
],
[
"1\n1 3\n3\n1 2 0\n",
"NO\n"
],
[
"5\n4 5\n10 8 6 4\n1 2 3 4 5\n1 1\n3\n3\... |
cc_1402_A._Fancy_Fence | contest | 7 | Everybody knows that BalΓ‘zs has the fanciest fence in the whole town. It's built up from N fancy sections. The sections are rectangles standing closely next to each other on the ground. The ith section has integer height h_i and integer width w_i. We are looking for fancy rectangles on this fancy fence. A rectangle is ... | [
[
"2\n1 2\n1 2\n",
"\n12\n"
]
] |
cc_151_C._Win_or_Freeze | contest | 9 | You can't possibly imagine how cold our friends are this winter in Nvodsk! Two of them play the following game to warm up: initially a piece of paper has an integer q. During a move a player should write any integer number that is a non-trivial divisor of the last written number. Then he should run this number of circl... | [
[
"1\n",
"1\n0"
],
[
"6\n",
"2"
],
[
"30\n",
"1\n6"
],
[
"10803140200\n",
"1\n4\n"
],
[
"14\n",
"2\n"
]
] |
cc_1547_C._Pair_Programming | contest | 9 | Monocarp and Polycarp are learning new programming techniques. Now they decided to try pair programming.
It's known that they have worked together on the same file for n + m minutes. Every minute exactly one of them made one change to the file. Before they started, there were already k lines written in the file.
Ever... | [
[
"5\n\n3 2 2\n2 0\n0 5\n\n4 3 2\n2 0 5\n0 6\n\n0 2 2\n1 0\n2 3\n\n5 4 4\n6 0 8 0\n0 7 0 9\n\n5 4 1\n8 7 8 0\n0\n",
"0 2 0 5\n0 2 0 5 6\n-1\n0 6 0 7 0 8 0 9\n-1\n"
],
[
"5\n\n3 2 2\n2 0\n0 5\n\n4 3 2\n2 1 5\n0 6\n\n0 2 2\n1 0\n2 3\n\n5 4 4\n6 0 8 0\n0 7 0 9\n\n5 4 1\n8 7 8 0\n0\n",
"0 2 0 5\n-1\... |
cc_195_A._Let's_Watch_Football | contest | 7 | Valeric and Valerko missed the last Euro football game, so they decided to watch the game's key moments on the Net. They want to start watching as soon as possible but the connection speed is too low. If they turn on the video right now, it will "hang up" as the size of data to watch per second will be more than the si... | [
[
"10 3 2\n",
"5\n"
],
[
"13 12 1\n",
"1\n"
],
[
"4 1 1\n",
"3\n"
],
[
"993 992 471\n",
"1\n"
],
[
"960 935 1422\n",
"39\n"
]
] |
cc_219_A._k-String | contest | 7 | A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, but it is not a 3-string, a 5-string, or a 6-string and so on. Obviously any string is a 1-string.
You are given a string s, ... | [
[
"2\naazz\n",
"azaz"
],
[
"3\nabcabcabz\n",
"-1\n"
],
[
"2\naaba\n",
"-1\n"
],
[
"2\nabaaaababb\n",
"aaabbaaabb\n"
],
[
"2\naabbbccccbccdddddddd\n",
"abbcccddddabbcccdddd\n"
]
] |
cc_242_C._King's_Path | contest | 9 | The black king is standing on a chess field consisting of 109 rows and 109 columns. We will consider the rows of the field numbered with integers from 1 to 109 from top to bottom. The columns are similarly numbered with integers from 1 to 109 from left to right. We will denote a cell of the field that is located in the... | [
[
"3 4 3 10\n3\n3 1 4\n4 5 9\n3 10 10\n",
"6\n"
],
[
"1 1 2 10\n2\n1 1 3\n2 6 10\n",
"-1\n"
],
[
"5 7 6 11\n3\n5 3 8\n6 7 11\n5 2 5\n",
"4\n"
],
[
"1 1 1 2\n5\n1000000000 1 10000\n35510851 1188 5566\n1000000000 1 10000\n1 1 10000\n5 100 200\n",
"1\n"
],
[
"1 1 100... |
cc_268_A._Games | contest | 7 | Manao works on a sports TV. He's spent much time watching the football games of some country. After a while he began to notice different patterns. For example, each team has two sets of uniforms: home uniform and guest uniform. When a team plays a game at home, the players put on the home uniform. When a team plays as ... | [
[
"2\n1 2\n1 2\n",
"0\n"
],
[
"4\n100 42\n42 100\n5 42\n100 5\n",
"5\n"
],
[
"3\n1 2\n2 4\n3 4\n",
"1\n"
],
[
"25\n91 57\n2 73\n54 57\n2 57\n23 57\n2 6\n57 54\n57 23\n91 54\n91 23\n57 23\n91 57\n54 2\n6 91\n57 54\n2 57\n57 91\n73 91\n57 23\n91 57\n2 73\n91 2\n23 6\n2 73\n23 1... |
cc_316_B2._EKG | contest | 8 | In the rush of modern life, people often forget how beautiful the world is. The time to enjoy those around them is so little that some even stand in queues to several rooms at the same time in the clinic, running from one queue to another.
(Cultural note: standing in huge and disorganized queues for hours is a native ... | [
[
"6 2\n2 3 0 5 6 0\n",
"2\n5\n"
],
[
"6 2\n0 0 1 0 4 5\n",
"1\n3\n4\n6\n"
],
[
"6 1\n2 0 4 0 6 0\n",
"2\n4\n6\n"
],
[
"4 1\n0 0 0 0\n",
"1\n2\n3\n4\n"
],
[
"10 4\n0 1 4 2 3 0 10 0 5 8\n",
"3\n4\n6\n7\n"
]
] |
cc_339_A._Helpful_Maths | contest | 7 | Xenia the beginner mathematician is a third year student at elementary school. She is now learning the addition operation.
The teacher has written down the sum of multiple numbers. Pupils should calculate the sum. To make the calculation easier, the sum only contains numbers 1, 2 and 3. Still, that isn't enough for Xe... | [
[
"2\n",
"2\n"
],
[
"3+2+1\n",
"1+2+3\n"
],
[
"1+1+3+1+3\n",
"1+1+1+3+3\n"
],
[
"1+1+3+1+2+1+2+2+1+2+2+1+3+3+3+1+1+2+3+2+3+1+2+3+3+3+1+1+1+3+3+3+2+2+3+3+2+2+3+1+2+1+1+2+2+2+1+3+3+2\n",
"1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+2+2+2+2+2+2+2+2+2+2+2+2+2+2+2+2+2+3+3+3+3+3+3+3+3+3+3+... |
cc_361_C._Levko_and_Array_Recovery | contest | 9 | Levko loves array a1, a2, ... , an, consisting of integers, very much. That is why Levko is playing with array a, performing all sorts of operations with it. Each operation Levko performs is of one of two types:
1. Increase all elements from li to ri by di. In other words, perform assignments aj = aj + di for all j ... | [
[
"4 5\n1 2 3 1\n2 1 2 8\n2 3 4 7\n1 1 3 3\n2 3 4 8\n",
"YES\n8 7 4 7 "
],
[
"4 5\n1 2 3 1\n2 1 2 8\n2 3 4 7\n1 1 3 3\n2 3 4 13\n",
"NO\n"
],
[
"2 2\n2 1 2 16\n2 1 2 7\n",
"NO\n"
],
[
"1 2\n1 1 1 10\n2 1 1 5\n",
"YES\n-5\n"
],
[
"6 5\n1 2 3 1\n2 1 2 8\n2 3 4 7\n1 ... |
cc_385_A._Bear_and_Raspberry | contest | 7 | The bear decided to store some raspberry for the winter. He cunningly found out the price for a barrel of honey in kilos of raspberry for each of the following n days. According to the bear's data, on the i-th (1 β€ i β€ n) day, the price for one barrel of honey is going to is xi kilos of raspberry.
Unfortunately, the b... | [
[
"6 2\n100 1 10 40 10 40\n",
"97\n"
],
[
"5 1\n5 10 7 3 20\n",
"3\n"
],
[
"3 0\n1 2 3\n",
"0\n"
],
[
"89 1\n50 53 97 41 68 27 53 66 93 19 11 78 35 49 38 69 96 9 43 16 1 63 95 64 96 6 34 34 45 40 19 4 53 8 11 18 95 25 50 16 64 33 97 49 23 81 63 10 30 73 76 55 7 70 9 98 6 36 7... |
cc_433_A._Kitahara_Haruki's_Gift | contest | 7 | Kitahara Haruki has bought n apples for Touma Kazusa and Ogiso Setsuna. Now he wants to divide all the apples between the friends.
Each apple weights 100 grams or 200 grams. Of course Kitahara Haruki doesn't want to offend any of his friend. Therefore the total weight of the apples given to Touma Kazusa must be equal ... | [
[
"4\n100 100 100 200\n",
"NO\n"
],
[
"3\n100 200 100\n",
"YES\n"
]
] |
cc_455_C._Civilization | contest | 9 | Andrew plays a game called "Civilization". Dima helps him.
The game has n cities and m bidirectional roads. The cities are numbered from 1 to n. Between any pair of cities there either is a single (unique) path, or there is no path at all. A path is such a sequence of distinct cities v1, v2, ..., vk, that there is a r... | [
[
"6 0 6\n2 1 2\n2 3 4\n2 5 6\n2 3 2\n2 5 3\n1 1\n",
"4\n"
],
[
"10 2 6\n1 2\n1 4\n2 1 8\n2 9 2\n1 2\n1 9\n2 3 5\n1 8\n",
"2\n2\n2\n"
],
[
"10 5 2\n1 2\n1 3\n2 4\n2 5\n1 6\n1 5\n1 8\n",
"3\n0\n"
],
[
"10 9 16\n1 2\n1 3\n2 4\n2 5\n5 6\n4 7\n6 8\n4 9\n5 10\n2 1 5\n2 4 4\n1 7\n1... |
cc_478_A._Initial_Bet | contest | 7 | There are five people playing a game called "Generosity". Each person gives some non-zero number of coins b as an initial bet. After all players make their bets of b coins, the following operation is repeated for several times: a coin is passed from one player to some other player.
Your task is to write a program that... | [
[
"2 5 4 0 4\n",
"3\n"
],
[
"4 5 9 2 1\n",
"-1\n"
],
[
"180 100 100 100 100\n",
"116\n"
],
[
"103 83 11 4 93\n",
"-1\n"
],
[
"100 000 100 100 100\n",
"80\n"
]
] |
cc_500_C._New_Year_Book_Reading | contest | 9 | New Year is coming, and Jaehyun decided to read many books during 2015, unlike this year. He has n books numbered by integers from 1 to n. The weight of the i-th (1 β€ i β€ n) book is wi.
As Jaehyun's house is not large enough to have a bookshelf, he keeps the n books by stacking them vertically. When he wants to read a... | [
[
"3 5\n1 2 3\n1 3 2 3 1\n",
"12\n"
],
[
"50 50\n75 54 23 37 28 23 69 75 5 62 3 11 96 100 13 50 57 51 8 90 4 6 84 27 11 89 95 81 10 62 48 52 69 87 97 95 30 74 21 42 36 64 31 80 81 50 56 53 33 99\n26 30 5 33 35 29 6 15 36 17 32 16 14 1 29 34 22 40 12 42 38 48 39 50 13 47 18 43 10 8 49 45 11 31 21 37 ... |
cc_526_A._King_of_Thieves | contest | 7 | In this problem you will meet the simplified model of game King of Thieves.
In a new ZeptoLab game called "King of Thieves" your aim is to reach a chest with gold by controlling your character, avoiding traps and obstacles on your way.
<image>
An interesting feature of the game is that you can design your own levels... | [
[
"16\n.**.*..*.***.**.\n",
"yes"
],
[
"11\n.*.*...*.*.\n",
"no"
],
[
"20\n.*..*...*....*.../.*\n",
"no\n"
],
[
"97\n.*****.**.***.*.**.*..*.***.*.***.*.**.***.*......*..*............*.***.*.*.**.**..*.***.***.****\n",
"yes\n"
],
[
"5\n*+*.*\n",
"no\n"
]
] |
cc_551_B._ZgukistringZ | contest | 8 | Professor GukiZ doesn't accept string as they are. He likes to swap some letters in string to obtain a new one.
GukiZ has strings a, b, and c. He wants to obtain string k by swapping some letters in a, so that k should contain as many non-overlapping substrings equal either to b or c as possible. Substring of string x... | [
[
"pozdravstaklenidodiri\nniste\ndobri\n",
"nisteaadddiiklooprrvz\n"
],
[
"aaa\na\nb\n",
"aaa\n"
],
[
"abbbaaccca\nab\naca\n",
"ababacabcc\n"
],
[
"brtakoktrosttttttttttosafasfkalsfkodfdasiofhadfhasdsajfdsafoasodsafahaihfdisoadspapsapiosapdsajdipsahdhasuirhaeuifhhfkjgosoooooo... |
cc_578_C._Weakness_and_Poorness | contest | 9 | You are given a sequence of n integers a1, a2, ..., an.
Determine a real number x such that the weakness of the sequence a1 - x, a2 - x, ..., an - x is as small as possible.
The weakness of a sequence is defined as the maximum value of the poorness over all segments (contiguous subsequences) of a sequence.
The poor... | [
[
"10\n1 10 2 9 3 8 4 7 5 6\n",
"4.500000000000024\n"
],
[
"4\n1 2 3 4\n",
"2.000000000000003\n"
],
[
"3\n1 2 3\n",
"1.000000000000000\n"
],
[
"10\n-405 -230 252 -393 -271 -259 97 163 81 -129\n",
"662.6666666666667\n"
],
[
"10\n1 10 2 9 6 8 4 7 5 6\n",
"5.0000... |
cc_5_A._Chat_Server's_Outgoing_Traffic | contest | 7 | Polycarp is working on a new project called "Polychat". Following modern tendencies in IT, he decided, that this project should contain chat as well. To achieve this goal, Polycarp has spent several hours in front of his laptop and implemented a chat server that can process three types of commands:
* Include a perso... | [
[
"+Mike\nMike:hello\n+Kate\n+Dmitry\n-Dmitry\nKate:hi\n-Kate\n",
"9\n"
],
[
"+Mike\n-Mike\n+Mike\nMike:Hi I am here\n-Mike\n+Kate\n-Kate\n",
"14\n"
],
[
"+dab\n+abac\n-abac\n+baca\n",
"0\n"
],
[
"+Dmitry\n+Mike\nDmitry:All letters will be used\nDmitry:qwertyuiopasdfghjklzx... |
cc_643_B._Bear_and_Two_Paths | contest | 8 | Bearland has n cities, numbered 1 through n. Cities are connected via bidirectional roads. Each road connects two distinct cities. No two roads connect the same pair of cities.
Bear Limak was once in a city a and he wanted to go to a city b. There was no direct connection so he decided to take a long walk, visiting ea... | [
[
"1000 999\n10 20 30 40\n",
"-1"
],
[
"7 11\n2 4 7 3\n",
"2 7 1 5 6 3 4 \n7 2 1 5 6 4 3 "
],
[
"1000 1001\n82 636 713 516\n",
"82 713 1 2 3 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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53... |
cc_670_B._Game_of_Robots | contest | 8 | In late autumn evening n robots gathered in the cheerful company of friends. Each robot has a unique identifier β an integer from 1 to 109.
At some moment, robots decided to play the game "Snowball". Below there are the rules of this game. First, all robots stand in a row. Then the first robot says his identifier. Aft... | [
[
"4 5\n10 4 18 3\n",
"4"
],
[
"2 2\n1 2\n",
"1"
],
[
"4 9\n5 1000000000 999999999 19\n",
"999999999\n"
],
[
"4 6\n5 1000000000 1790978867 12\n",
"1790978867\n"
],
[
"3 5\n8 5 6\n",
"5\n"
]
] |
cc_737_A._Road_to_Cinema | contest | 7 | Vasya is currently at a car rental service, and he wants to reach cinema. The film he has bought a ticket for starts in t minutes. There is a straight road of length s from the service to the cinema. Let's introduce a coordinate system so that the car rental service is at the point 0, and the cinema is at the point s.
... | [
[
"3 1 8 10\n10 8\n5 7\n11 9\n3\n",
"10\n"
],
[
"2 2 10 18\n10 4\n20 6\n5 3\n",
"20\n"
],
[
"1 1 1000000000 1000000100\n100 1000000000\n1\n",
"-1\n"
],
[
"1 1 10 18\n3 6\n5\n",
"3\n"
],
[
"4 13 400 600\n13 30\n1 19\n1 160\n1 113\n58 73 15 319 209 362 128 157 336 1... |
cc_784_B._Kids'_Riddle | contest | 8 | Programmers' kids solve this riddle in 5-10 minutes. How fast can you do it?
Input
The input contains a single integer n (0 β€ n β€ 2000000000).
Output
Output a single integer.
Examples
Input
11
Output
2
Input
14
Output
0
Input
61441
Output
2
Input
571576
Output
10
Input
2128506
Output
3 | [
[
"14\n",
"0"
],
[
"2128506\n",
"3"
],
[
"11\n",
"2"
],
[
"571576\n",
"10"
],
[
"61441\n",
"2"
]
] |
cc_805_A._Fake_NP | contest | 7 | Tavak and Seyyed are good friends. Seyyed is very funny and he told Tavak to solve the following problem instead of longest-path.
You are given l and r. For all integers from l to r, inclusive, we wrote down all of their integer divisors except 1. Find the integer that we wrote down the maximum number of times.
Solve... | [
[
"19 29\n",
"2\n"
],
[
"3 6\n",
"2\n"
],
[
"252662256 275638265\n",
"2\n"
],
[
"10 10\n",
"10\n"
],
[
"38 38\n",
"38\n"
]
] |
cc_830_A._Office_Keys | contest | 7 | There are n people and k keys on a straight line. Every person wants to get to the office which is located on the line as well. To do that, he needs to reach some point with a key, take the key and then go to the office. Once a key is taken by somebody, it couldn't be taken by anybody else.
You are to determine the mi... | [
[
"1 2 10\n11\n15 7\n",
"7"
],
[
"2 4 50\n20 100\n60 10 40 80\n",
"50"
],
[
"1 1 16\n10\n10\n",
"6\n"
],
[
"2 2 10\n9 11\n11 16\n",
"11\n"
],
[
"2 2 5\n2 3\n4 8\n",
"8\n"
]
] |
cc_851_B._Arpa_and_an_exam_about_geometry | contest | 8 | Arpa is taking a geometry exam. Here is the last problem of the exam.
You are given three points a, b, c.
Find a point and an angle such that if we rotate the page around the point by the angle, the new position of a is the same as the old position of b, and the new position of b is the same as the old position of c.... | [
[
"0 1 1 1 1 0\n",
"Yes\n"
],
[
"1 1 0 0 1000 1000\n",
"No\n"
],
[
"264193194 -448876521 716456020 -633906160 -328597212 -47935734\n",
"NO\n"
],
[
"1 0 2 1 3 0\n",
"YES\n"
],
[
"-357531221 381512519 -761132895 -249724943 328888775 -237692564\n",
"NO\n"
]
] |
cc_89_C._Chip_Play | contest | 9 | Let's consider the following game. We have a rectangular field n Γ m in size. Some squares of the field contain chips.
Each chip has an arrow painted on it. Thus, each chip on the field points in one of the following directions: up, down, left or right.
The player may choose a chip and make a move with it.
The move ... | [
[
"4 4\nDRLD\nU.UL\n.UUR\nRDDL\n",
"10 1\n"
],
[
"3 5\n.D...\nRRRLL\n.U...\n",
"6 2\n"
],
[
"19 23\nU..U..R........L...D...\n.D.....UL.U.U........DR\n..D.U..D....L......R...\nD.......RL.L....D.....R\nU..D.....U...U.L..D...U\n...........L...........\nU....U....D.U......LRR.\n......RL...U.... |
cc_949_C._Data_Center_Maintenance | contest | 9 | BigData Inc. is a corporation that has n data centers indexed from 1 to n that are located all over the world. These data centers provide storage for client data (you can figure out that client data is really big!).
Main feature of services offered by BigData Inc. is the access availability guarantee even under the ci... | [
[
"3 3 5\n4 4 0\n1 3\n3 2\n3 1\n",
"1\n3 \n"
],
[
"4 5 4\n2 1 0 3\n4 3\n3 2\n1 2\n1 4\n1 3\n",
"4\n1 2 3 4 \n"
],
[
"10 9 5\n0 0 0 0 0 0 0 -1 0 4\n10 3\n10 7\n10 5\n10 8\n10 9\n10 1\n10 4\n10 6\n10 2\n",
"1\n1 "
],
[
"10 20 5\n2 2 1 4 0 3 0 4 1 3\n6 1\n8 5\n2 10\n3 2\n1 9\n4 ... |
cc_977_B._Two-gram | contest | 8 | Two-gram is an ordered pair (i.e. string of length two) of capital Latin letters. For example, "AZ", "AA", "ZA" β three distinct two-grams.
You are given a string s consisting of n capital Latin letters. Your task is to find any two-gram contained in the given string as a substring (i.e. two consecutive characters of ... | [
[
"5\nZZZAA\n",
"ZZ\n"
],
[
"7\nABACABA\n",
"AB\n"
],
[
"15\nLIRZOYANOVECLOX\n",
"LI\n"
],
[
"23\nAACBBAAACCCCBAAADDDDDDD\n",
"DD\n"
],
[
"2\nAQ\n",
"AQ\n"
]
] |
cc_tech07 | contest | 6 | You are given a square with 'n' points on each side of the square. None of these points co-incide with the corners of this square. You have to compute the total number of triangles that can be formed using these '4n' points (n points on each side of the square) as vertices of the triangle.
Input
First line contains ... | [
[
"1\n1",
"4"
],
[
"1\n2",
"56\n"
],
[
"1\n0",
"0\n"
],
[
"1\n-1",
"-16\n"
],
[
"1\n-2",
"-104\n"
]
] |
cc_1012_B._Chemical_table | contest | 8 | Innopolis University scientists continue to investigate the periodic table. There are nΒ·m known elements and they form a periodic table: a rectangle with n rows and m columns. Each element can be described by its coordinates (r, c) (1 β€ r β€ n, 1 β€ c β€ m) in the table.
Recently scientists discovered that for every four... | [
[
"1 5 3\n1 3\n1 1\n1 5\n",
"2\n"
],
[
"2 2 3\n1 2\n2 2\n2 1\n",
"0\n"
],
[
"4 3 6\n1 2\n1 3\n2 2\n2 3\n3 1\n3 3\n",
"1\n"
],
[
"34 20 1\n17 13\n",
"52\n"
],
[
"1 0 0\n",
"0\n"
]
] |
cc_1037_B._Reach_Median | contest | 8 | You are given an array a of n integers and an integer s. It is guaranteed that n is odd.
In one operation you can either increase or decrease any single element by one. Calculate the minimum number of operations required to make the median of the array being equal to s.
The median of the array with odd length is the ... | [
[
"3 8\n6 5 8\n",
"2\n"
],
[
"7 20\n21 15 12 11 20 19 12\n",
"6\n"
],
[
"3 2\n1 2 5\n",
"0\n"
],
[
"3 10\n5 3 10\n",
"5\n"
],
[
"3 4\n0 2 5\n",
"2\n"
]
] |
cc_105_C._Item_World | contest | 9 | Each item in the game has a level. The higher the level is, the higher basic parameters the item has. We shall consider only the following basic parameters: attack (atk), defense (def) and resistance to different types of impact (res).
Each item belongs to one class. In this problem we will only consider three of such... | [
[
"4\nsword weapon 10 2 3 2\npagstarmor armor 0 15 3 1\niceorb orb 3 2 13 2\nlongbow weapon 9 1 2 1\n6\nmike gladiator 5 longbow\nbobby sentry 6 pagstarmor\npetr gladiator 7 iceorb\nteddy physician 6 sword\nblackjack sentry 8 sword\njoe physician 6 iceorb\n",
"longbow 1 mike\npagstarmor 1 bobby\niceorb 2 pe... |
cc_1129_A2._Toy_Train | contest | 7 | Alice received a set of Toy Trainβ’ from Bob. It consists of one train and a connected railway network of n stations, enumerated from 1 through n. The train occupies one station at a time and travels around the network of stations in a circular manner. More precisely, the immediate station that the train will visit afte... | [
[
"2 3\n1 2\n1 2\n1 2\n",
"5 6 "
],
[
"5 7\n2 4\n5 1\n2 3\n3 4\n4 1\n5 3\n3 5\n",
"10 9 10 10 9 "
],
[
"3 3\n1 2\n1 2\n1 3\n",
"7 9 8 "
],
[
"5 3\n2 1\n5 4\n3 2\n",
"8 7 8 8 7 "
],
[
"20 5\n3 12\n5 20\n16 4\n13 2\n9 14\n",
"23 22 21 28 27 34 33 32 31 30 29 28 ... |
cc_1149_B._Three_Religions | contest | 8 | During the archaeological research in the Middle East you found the traces of three ancient religions: First religion, Second religion and Third religion. You compiled the information on the evolution of each of these beliefs, and you now wonder if the followers of each religion could coexist in peace.
The Word of Uni... | [
[
"6 8\nabdabc\n+ 1 a\n+ 1 d\n+ 2 b\n+ 2 c\n+ 3 a\n+ 3 b\n+ 1 c\n- 2\n",
"YES\nYES\nYES\nYES\nYES\nYES\nNO\nYES\n"
],
[
"6 8\nabbaab\n+ 1 a\n+ 2 a\n+ 3 a\n+ 1 b\n+ 2 b\n+ 3 b\n- 1\n+ 2 z\n",
"YES\nYES\nYES\nYES\nYES\nNO\nYES\nNO\n"
],
[
"6 8\nabbaab\n+ 1 a\n+ 3 a\n+ 3 a\n+ 1 b\n+ 2 b\n+ ... |
cc_1170_B._Bad_Days | contest | 8 | Every day Kotlin heroes analyze the statistics of their website. For n days, they wrote out n numbers a_1, a_2, ..., a_n, where a_i is the number of visits on the i-th day.
They believe that a day is bad if there are at least 2 days before it with a strictly greater number of visits. For example, if n=8 and a=[3, 1, 4... | [
[
"8\n3 1 4 1 5 9 2 6\n",
"\n2\n"
],
[
"5\n1 1 1 1 1\n",
"\n0\n"
],
[
"13\n2 7 1 8 2 8 1 8 2 8 4 5 9\n",
"\n6\n"
]
] |
cc_1189_A._Keanu_Reeves | contest | 7 | After playing Neo in the legendary "Matrix" trilogy, Keanu Reeves started doubting himself: maybe we really live in virtual reality? To find if this is true, he needs to solve the following problem.
Let's call a string consisting of only zeroes and ones good if it contains different numbers of zeroes and ones. For exa... | [
[
"1\n1\n",
"1\n1\n"
],
[
"6\n100011\n",
"2\n1 00011\n"
],
[
"2\n10\n",
"2\n1 0\n"
],
[
"72\n111101100111001110000000100010100000111011100110001010111010101011111100\n",
"1\n111101100111001110000000100010100000111011100110001010111010101011111100\n"
],
[
"3\n001\n... |
YAML Metadata Warning:The task_categories "text2text-generation" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, audio-text-to-text, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-ranking, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, image-text-to-image, image-text-to-video, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, visual-document-retrieval, any-to-any, video-to-video, other
Compete-then-Collaborate Task Bank
Companion dataset for the paper "Compete then Collaborate: Frontier AI Teachers Build a Verifiable Curriculum to Improve a Coding Student Beyond Imitation" (Kim, 2026).
This dataset contains the execution-verified task bank used to (a) rank four frontier LLM teachers (Claude, Codex-GPT, Grok, Gemini) and (b) train the coding student model Qwen2.5-Coder-7B via imitation (SFT) and verifiable-reward RL (RLVR/GRPO).
- π Paper: https://github.com/shawnkim678/compete-then-collaborate
- π€ Companion RLVR model:
shawnmkim/qwen2.5-coder-7b-rlvr-compete-collab - π¦ Code / verifier / harness: https://github.com/shawnkim678/compete-then-collaborate
Splits & sizes
| Config | Split | Rows | Size | Source | Held-out from training? |
|---|---|---|---|---|---|
mbpp |
train |
~350 | 106 KB | google-research-datasets/mbpp (teaching split) | training |
mbpp |
heldout |
150 | 76 KB | MBPP test split | held-out for evaluation |
contests |
train |
~150 | 383 KB | deepmind/code_contests d6β9 | training / RLVR reward env. |
contests |
heldout |
68 | 254 KB | disjoint subset from above | held-out for evaluation |
Leakage verified: the held-out splits are disjoint from the training splits at
the task_id level.
Data schema
mbpp split β function tasks with unit-test asserts
{
"task_id": "mbpp_11",
"category": "function",
"instruction": "Write a function that ...",
"input": "<function signature or example>",
"tests": ["assert f(1) == 2", "assert f(3) == 5", ...]
}
contests split β competition problems with stdin/stdout tests
{
"task_id": "cc_1234",
"category": "competition",
"difficulty": 7,
"instruction": "<problem statement>",
"tests_io": [{"stdin": "3\n1 2 3\n", "stdout": "6\n"}, ...]
}
Load (π€ datasets)
from datasets import load_dataset
mbpp_train = load_dataset("shawnmkim/compete-collab-taskbank", "mbpp", split="train")
mbpp_heldout = load_dataset("shawnmkim/compete-collab-taskbank", "mbpp", split="heldout")
cc_train = load_dataset("shawnmkim/compete-collab-taskbank", "contests", split="train")
cc_heldout = load_dataset("shawnmkim/compete-collab-taskbank", "contests", split="heldout")
How it was built
- MBPP source (Google, Apache-2.0). Function-signature disambiguated; externally-dependent tasks excluded to keep function-only comparison valid. Teaching / held-out split separated with a fixed seed.
- code_contests source (DeepMind, CC-BY-4.0). Restricted to difficulty 6β9 ("hard"), with stdin/stdout tests preserved verbatim.
- Intersection control (paper Β§3.2): the student training set is further restricted to problems all teachers solved, giving identical problems and equal counts across teachers so only solution / explanation style differs.
The full build scripts are in the GitHub repo (build_taskbank_mbpp.py,
build_contests_bank.py).
Reward for RLVR
For the RLVR (GRPO) reward computation, we execute the student's generated code
in an isolated subprocess (rlimits + timeout) against the hidden tests /
tests_io fields. Reward = fraction of tests passed + small format bonus. See
paper Β§3.3 and Β§4.
License & attribution
This dataset is a derivative curation of two upstream sources; the strictest compatible terms apply:
- MBPP-derived rows: Apache-2.0 (Google Research)
- code_contests-derived rows: CC-BY-4.0 (Google DeepMind)
Please cite both the paper (below) and the upstream sources when using.
Citation
@misc{kim2026compete,
title = {Compete then Collaborate: Frontier AI Teachers Build a Verifiable Curriculum to Improve a Coding Student Beyond Imitation},
author = {Kim, Miseong (Shawn)},
year = {2026},
note = {Preprint, Genesis Cortex AI Inc.},
url = {https://github.com/shawnkim678/compete-then-collaborate}
}
@article{austin2021mbpp,
title = {Program Synthesis with Large Language Models},
author = {Austin, Jacob and Odena, Augustus and Nye, Maxwell and others},
journal = {arXiv preprint arXiv:2108.07732},
year = {2021}
}
@article{li2022codecontests,
title = {Competition-level code generation with AlphaCode},
author = {Li, Yujia and Choi, David and Chung, Junyoung and others},
journal = {Science},
year = {2022}
}
Ethics / ToS note
No teacher raw outputs are redistributed. This dataset consists exclusively of task specifications and hidden tests derived from publicly licensed sources (MBPP Β· code_contests). Users regenerate teacher solutions with their own API keys under their own provider terms.
- Downloads last month
- 45