messages listlengths 1 1 | ground_truth stringlengths 88 726k | dataset stringclasses 2
values |
|---|---|---|
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBeing stuck at home, Ray became extremely bored. To pass time, he asks Lord Omkar to use his time bending power: Infinity Clock! However, Lord Omkar will only listen to mortals who can solve the following problem:\n\nYou ... | [{"type": "stdin_stdout", "input": "5\n20 809014\n289 -254 1 -109 -167 93 23 -37 -31 -109 204 59 296 49 132 0 -28 35 -197 -266\n20 458494\n113 218 -292 -298 179 258 -257 -20 296 76 -145 93 -282 -261 -159 -45 255 -107 171 63\n14 876161\n69 74 12 2 177 -113 103 93 38 -48 282 169 205 145\n26 731742\n76 190 -227 -81 -293 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWay to go! Heidi now knows how many brains there must be for her to get one. But throwing herself in the midst of a clutch of hungry zombies is quite a risky endeavor. Hence Heidi wonders: what is the smallest number of b... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "231564544\n"}, {"type": "stdin_stdout", "input": "536870910\n", "output": "134217727\n"}, {"type": "stdin_stdout", "input": "876543210\n", "output": "169836149\n"}, {"type": "stdin_stdout", "input": "987654321\n", "output": "493827160\n"}, {"type": "stdin_st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDreamoon is standing at the position 0 on a number line. Drazil is sending a list of commands through Wi-Fi to Dreamoon's smartphone and Dreamoon follows them.\n\nEach command is one of the following two types: Go 1 uni... | [{"type": "stdin_stdout", "input": "++++++++++\n+++??++?++\n", "output": "0.125000000000\n"}, {"type": "stdin_stdout", "input": "--+++---+-\n??????????\n", "output": "0.205078125000\n"}, {"type": "stdin_stdout", "input": "+--+++--+-\n??????????\n", "output": "0.246093750000\n"}, {"type": "stdin_stdout", "input": "+++++... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn February, 30th n students came in the Center for Training Olympiad Programmers (CTOP) of the Berland State University. They came one by one, one after another. Each of them went in, and before sitting down at his desk,... | [{"type": "stdin_stdout", "input": "123\n114 105 49 11 115 106 92 74 101 86 39 116 5 48 87 19 40 25 22 42 111 75 84 68 57 119 46 41 23 58 90 102 3 10 78 108 2 21 122 121 120 64 85 32 34 71 4 110 36 30 18 81 52 76 47 33 54 45 29 17 100 27 70 31 89 99 61 6 9 53 20 35 0 79 112 55 96 51 16 62 72 26 44 15 80 82 8 109 14 63 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne beautiful day Vasily the bear painted 2m circles of the same radius R on a coordinate plane. Circles with numbers from 1 to m had centers at points (2R - R, 0), (4R - R, 0), ..., (2Rm - R, 0), respectively. Circles wi... | [{"type": "stdin_stdout", "input": "100000 10\n", "output": "666674.9511055604\n"}, {"type": "stdin_stdout", "input": "100000 3\n", "output": "200002.4853316681\n"}, {"type": "stdin_stdout", "input": "33333 9\n", "output": "200005.4562967670\n"}, {"type": "stdin_stdout", "input": "99999 9\n", "output": "600001.45599500... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAllen wants to enter a fan zone that occupies a round square and has $n$ entrances.\n\nThere already is a queue of $a_i$ people in front of the $i$-th entrance. Each entrance allows one person from its queue to enter the ... | [{"type": "stdin_stdout", "input": "30\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 10000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBuses run between the cities A and B, the first one is at 05:00 AM and the last one departs not later than at 11:59 PM. A bus from the city A departs every a minutes and arrives to the city B in a t_{a} minutes, and a bus... | [{"type": "stdin_stdout", "input": "60 120\n17 120\n23:00\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "60 120\n24 100\n13:00\n", "output": "9\n"}, {"type": "stdin_stdout", "input": "23 118\n118 20\n23:24\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1 120\n1 100\n23:59\n", "output": "100\n"}, {"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNatasha is planning an expedition to Mars for $n$ people. One of the important tasks is to provide food for each participant.\n\nThe warehouse has $m$ daily food packages. Each package has some food type $a_i$.\n\nEach pa... | [{"type": "stdin_stdout", "input": "4 100\n84 99 66 69 86 94 89 96 98 93 93 82 87 93 91 100 69 99 93 81 99 84 75 100 86 88 98 100 84 96 44 70 94 91 85 78 86 79 45 88 91 78 98 94 81 87 93 72 96 88 96 97 96 62 86 72 94 84 80 98 88 90 93 73 73 98 78 50 91 96 97 82 85 90 87 41 97 82 97 77 100 100 92 83 98 81 70 81 74 78 84... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTonight is brain dinner night and all zombies will gather together to scarf down some delicious brains. The artful Heidi plans to crash the party, incognito, disguised as one of them. Her objective is to get away with at ... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "500000000\n"}, {"type": "stdin_stdout", "input": "536870910\n", "output": "268435455\n"}, {"type": "stdin_stdout", "input": "536870912\n", "output": "268435456\n"}, {"type": "stdin_stdout", "input": "876543210\n", "output": "438271605\n"}, {"type": "stdin_st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere exists an island called Arpa’s land, some beautiful girls live there, as ugly ones do.\n\nMehrdad wants to become minister of Arpa’s land. Arpa has prepared an exam. Exam has only one question, given n, print the la... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "6"}, {"type": "stdin_stdout", "input": "999999999\n", "output": "2"}, {"type": "stdin_stdout", "input": "999999998\n", "output": "4"}, {"type": "stdin_stdout", "input": "999999997\n", "output": "8"}, {"type": "stdin_stdout", "input": "989898989\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day Vasya the Hipster decided to count how many socks he had. It turned out that he had a red socks and b blue socks.\n\nAccording to the latest fashion, hipsters should wear the socks of different colors: a red one o... | [{"type": "stdin_stdout", "input": "100 100\n", "output": "100 0\n"}, {"type": "stdin_stdout", "input": "100 45\n", "output": "45 27\n"}, {"type": "stdin_stdout", "input": "100 23\n", "output": "23 38\n"}, {"type": "stdin_stdout", "input": "100 11\n", "output": "11 44\n"}, {"type": "stdin_stdout", "input": "100 10\n", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLuke Skywalker got locked up in a rubbish shredder between two presses. R2D2 is already working on his rescue, but Luke needs to stay alive as long as possible. For simplicity we will assume that everything happens on a s... | [{"type": "stdin_stdout", "input": "9999 10000 10000 10000\n", "output": "0.000050\n"}, {"type": "stdin_stdout", "input": "2173 2176 10000 9989\n", "output": "0.000150\n"}, {"type": "stdin_stdout", "input": "1023 2340 1029 3021\n", "output": "0.325185\n"}, {"type": "stdin_stdout", "input": "1 10000 10000 10000\n", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThese days Arkady works as an air traffic controller at a large airport. He controls a runway which is usually used for landings only. Thus, he has a schedule of planes that are landing in the nearest future, each landing... | [{"type": "stdin_stdout", "input": "66 20\n0 16\n0 45\n0 58\n1 6\n1 19\n2 7\n2 9\n3 9\n3 25\n3 57\n4 38\n4 58\n5 21\n5 40\n6 16\n6 19\n6 58\n7 6\n7 26\n7 51\n8 13\n8 36\n8 55\n9 1\n9 15\n9 33\n10 12\n10 37\n11 15\n11 34\n12 8\n12 37\n12 55\n13 26\n14 0\n14 34\n14 36\n14 48\n15 23\n15 29\n15 43\n16 8\n16 41\n16 45\n17 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou're given an array $a$ of length $n$. You can perform the following operation on it as many times as you want: Pick two integers $i$ and $j$ $(1 \\le i,j \\le n)$ such that $a_i+a_j$ is odd, then swap $a_i$ and $a_j$.... | [{"type": "stdin_stdout", "input": "36\n398353608 662365068 456456182 594572278 958026500 524977116 903404403 382220192 142092809 137516115 522872496 527845939 116437661 423289717 907151540 961740613 981968938 143206666 773454188 691188206 95402302 602570397 986508327 617421132 46091276 866348540 485487643 843511039 76... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA permutation is a sequence of integers p_1, p_2, ..., p_{n}, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as p_{i}. We'll call number n the siz... | [{"type": "stdin_stdout", "input": "100\n", "output": "2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 50 49 52 51 54 53 56 55 58 57 60 59 62 61 64 63 66 65 68 67 70 69 72 71 74 73 76 75 78 77 80 79 82 81 84 83 86 85 88 87 90 89 92 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are playing the following game. There are n points on a plane. They are the vertices of a regular n-polygon. Points are labeled with integer numbers from 1 to n. Each pair of distinct points is connected by a diagonal... | [{"type": "stdin_stdout", "input": "9\n7 8 9\n*addcbaba\na*dbbbbbb\ndd*cccbdc\ndbc*ccccc\ncbcc*abdb\nbbcca*cbd\nabbcbc*bb\nbbdcdbb*c\nabccbdbc*\n", "output": "10\n7 4\n9 3\n3 5\n5 1\n8 3\n3 2\n1 8\n8 7\n7 3\n4 1\n"}, {"type": "stdin_stdout", "input": "10\n6 5 10\n*aababbbab\na*bbbbaaaa\nab*aaaabaa\nbba*abbbaa\nabaa*aba... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n problems prepared for the next Codeforces round. They are arranged in ascending order by their difficulty, and no two problems have the same difficulty. Moreover, there are m pairs of similar problems. Authors... | [{"type": "stdin_stdout", "input": "100000 10\n99562 479\n643 99684\n593 99867\n99529 175\n99738 616\n99523 766\n99503 121\n99784 158\n199 99199\n15 99849\n", "output": "98433\n"}, {"type": "stdin_stdout", "input": "10 11\n1 10\n1 9\n1 8\n1 7\n2 10\n2 9\n2 8\n2 7\n3 10\n3 9\n3 8\n", "output": "4\n"}, {"type": "stdin_st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe math faculty of Berland State University has suffered the sudden drop in the math skills of enrolling students. This year the highest grade on the entrance math test was 8. Out of 100! Thus, the decision was made to m... | [{"type": "stdin_stdout", "input": "100\n1 2 1 2 1 2 1 2 1 3 1 3 1 2 1 3 1 2 1 3 1 2 1 3 1 2 1 2 1 3 1 2 1 2 1 3 1 3 1 2 1 2 1 3 1 2 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 2 1 3 1 3 1 3 1 2 1 2 1 2 1 2 1 2 1 2 1 3 1 3 1 2 1 2 1 2 1 3 1 2 1 3 1 2 1 2\n", "output": "Finite\n331\n"}, {"type": "stdin_stdout", "input": "100\n2 1 3 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOnce upon a time there was only one router in the well-known company Bmail. Years went by and over time new routers were purchased. Every time they bought a new router, they connected it to one of the routers bought befor... | [{"type": "stdin_stdout", "input": "10\n1 2 2 4 5 5 6 4 7\n", "output": "1 2 4 5 7 10 "}, {"type": "stdin_stdout", "input": "9\n1 1 3 4 4 6 5 8\n", "output": "1 3 4 5 8 9 "}, {"type": "stdin_stdout", "input": "10\n1 1 1 3 3 5 6 8 3\n", "output": "1 3 10 "}, {"type": "stdin_stdout", "input": "10\n1 1 1 2 3 2 1 2 3\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet $n$ be an integer. Consider all permutations on integers $1$ to $n$ in lexicographic order, and concatenate them into one big sequence $p$. For example, if $n = 3$, then $p = [1, 2, 3, 1, 3, 2, 2, 1, 3, 2, 3, 1, 3, 1,... | [{"type": "stdin_stdout", "input": "1000000\n", "output": "549766631\n"}, {"type": "stdin_stdout", "input": "623847\n", "output": "407299584\n"}, {"type": "stdin_stdout", "input": "771623\n", "output": "501916356\n"}, {"type": "stdin_stdout", "input": "259813\n", "output": "285457511\n"}, {"type": "stdin_stdout", "inpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a_1, a_2, \\dots, a_n$. You can perform the following operation any number of times: Choose a pair of two neighboring equal elements $a_i = a_{i + 1}$ (if there is at least one such pair). Replac... | [{"type": "stdin_stdout", "input": "50\n1 1 1 1 1 2 1 1 2 1 2 1 1 1 2 1 1 1 2 2 2 1 1 2 2 1 2 1 1 2 2 1 1 2 2 1 1 1 1 1 2 2 2 2 2 1 2 2 2 1\n", "output": "19\n"}, {"type": "stdin_stdout", "input": "20\n24 20 23 33 22 18 42 47 47 50 38 37 27 12 25 24 24 43 17 24\n", "output": "17\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBerland has a long and glorious history. To increase awareness about it among younger citizens, King of Berland decided to compose an anthem.\n\nThough there are lots and lots of victories in history of Berland, there is ... | [{"type": "stdin_stdout", "input": "????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDima and his friends have been playing hide and seek at Dima's place all night. As a result, Dima's place got messy. In the morning they decided that they need to clean the place.\n\nTo decide who exactly would clean the ... | [{"type": "stdin_stdout", "input": "100\n3 3 1 4 2 4 4 3 1 5 1 1 4 4 3 4 4 3 5 4 5 2 4 3 4 1 2 4 5 4 2 1 5 4 1 1 4 3 2 4 1 2 1 4 4 5 5 4 4 5 3 2 5 1 4 2 2 1 1 2 5 2 5 1 5 3 1 4 3 2 4 3 2 2 4 5 5 1 2 3 1 4 1 2 2 2 5 5 2 3 2 4 3 1 1 2 1 2 1 2\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "100\n2 1 1 3 5 4 4 2 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n— This is not playing but duty as allies of justice, Nii-chan!\n\n— Not allies but justice itself, Onii-chan!\n\nWith hands joined, go everywhere at a speed faster than our thoughts! This time, the Fire Sisters — Karen an... | [{"type": "stdin_stdout", "input": "5000 5000 5000\n", "output": "986778560\n"}, {"type": "stdin_stdout", "input": "1171 2989 2853\n", "output": "234725427\n"}, {"type": "stdin_stdout", "input": "3238 2923 4661\n", "output": "636587126\n"}, {"type": "stdin_stdout", "input": "4539 2805 2702\n", "output": "356944655\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEric is the teacher of graph theory class. Today, Eric teaches independent set and edge-induced subgraph.\n\nGiven a graph $G=(V,E)$, an independent set is a subset of vertices $V' \\subset V$ such that for every pair $u,... | [{"type": "stdin_stdout", "input": "50\n21 10\n30 22\n3 37\n37 32\n4 27\n18 7\n2 30\n29 19\n6 37\n12 39\n47 25\n41 49\n45 9\n25 48\n16 14\n9 7\n33 28\n3 31\n34 16\n35 37\n27 40\n45 16\n29 44\n16 15\n26 15\n1 12\n2 13\n15 21\n43 14\n9 33\n44 15\n46 1\n38 5\n15 5\n1 32\n42 35\n20 27\n23 8\n1 16\n15 17\n36 50\n13 8\n49 45... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBerland, 2016. The exchange rate of currency you all know against the burle has increased so much that to simplify the calculations, its fractional part was neglected and the exchange rate is now assumed to be an integer.... | [{"type": "stdin_stdout", "input": "4314752277691991627730686134692292422155753465948025897701703862445837045929984759093775762579123919\n", "output": "9314752277691991627730686134692292422155753465948025897701703862445837045929984759093775762579123914\n"}, {"type": "stdin_stdout", "input": "354515198058487122724043653... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAccording to rules of the Berland fashion, a jacket should be fastened by all the buttons except only one, but not necessarily it should be the last one. Also if the jacket has only one button, it should be fastened, so t... | [{"type": "stdin_stdout", "input": "231\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAnton loves transforming one permutation into another one by swapping elements for money, and Ira doesn't like paying for stupid games. Help them obtain the required permutation by paying as little money as possible.\n\nM... | [{"type": "stdin_stdout", "input": "12\n3 4 10 1 2 6 7 9 12 5 8 11\n5 8 11 3 4 10 1 2 6 7 9 12\n", "output": "27\n27\n9 10\n10 11\n11 12\n8 9\n9 10\n10 11\n7 8\n8 9\n9 10\n6 7\n7 8\n8 9\n5 6\n6 7\n7 8\n4 5\n5 6\n6 7\n3 4\n4 5\n5 6\n2 3\n3 4\n4 5\n1 2\n2 3\n3 4\n"}, {"type": "stdin_stdout", "input": "10\n9 5 8 6 3 2 4 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the city of Ultima Thule job applicants are often offered an IQ test. \n\nThe test is as follows: the person gets a piece of squared paper with a 4 × 4 square painted on it. Some of the square's cells are painted black... | [{"type": "stdin_stdout", "input": "####\n.#..\n####\n....\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "....\n....\n....\n....\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "#..#\n.##.\n####\n####\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "#.#.\n.###\n#.#.\n.###\n", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ chips arranged in a circle, numbered from $1$ to $n$. \n\nInitially each chip has black or white color. Then $k$ iterations occur. During each iteration the chips change their colors according to the followi... | [{"type": "stdin_stdout", "input": "101 2\nBWBWBWWWBWBWBWWWBWWWBWWWBWBBBBBWBWBBBWBWBWWBBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWWWBWBWBWB\n", "output": "BBBWWWWWWWBWWWWWWWWWWWWWWBBBBBBBBBBBBBBWWWWBBBBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWWWWWWWBWBBB\n"}, {"type": "stdin_stdout", "input": "50 4\nBWBWBWBWBWBW... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given array a with n elements and the number m. Consider some subsequence of a and the value of least common multiple (LCM) of its elements. Denote LCM as l. Find any longest subsequence of a with the value l ≤ m.... | [{"type": "stdin_stdout", "input": "100 343\n999 284 486 785 176 742 856 415 992 601 600 122 460 214 338 92 627 913 376 835 384 914 335 179 409 957 96 784 531 43 584 206 971 799 592 801 870 978 437 517 466 952 1 327 731 689 816 681 383 969 452 298 114 687 314 436 267 154 827 197 805 207 284 550 351 700 94 567 524 329 4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs you know, an undirected connected graph with n nodes and n - 1 edges is called a tree. You are given an integer d and a tree consisting of n nodes. Each node i has a value a_{i} associated with it.\n\nWe call a set S o... | [{"type": "stdin_stdout", "input": "300 34\n777 497 1099 1221 1255 733 1119 533 1130 822 1000 1272 1104 575 1012 1137 1125 733 1036 823 845 923 1271 949 709 766 935 1226 1088 765 1269 475 1020 977\n5 18\n5 8\n1 20\n2 25\n4 19\n11 34\n6 9\n14 23\n21 22\n12 30\n7 11\n3 12\n18 21\n1 4\n2 6\n1 2\n11 15\n2 31\n4 13\n25 28\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasily the bear has a favorite rectangle, it has one vertex at point (0, 0), and the opposite vertex at point (x, y). Of course, the sides of Vasya's favorite rectangle are parallel to the coordinate axes. \n\nVasya also ... | [{"type": "stdin_stdout", "input": "-1000000000 -1000000000\n", "output": "-2000000000 0 0 -2000000000\n"}, {"type": "stdin_stdout", "input": "-1000000000 -999999999\n", "output": "-1999999999 0 0 -1999999999\n"}, {"type": "stdin_stdout", "input": "-999999999 -1000000000\n", "output": "-1999999999 0 0 -1999999999\n"}, ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEveryone loves a freebie. Especially students.\n\nIt is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times \"Fly, freebie, fly!\" — then flown... | [{"type": "stdin_stdout", "input": "100\n98 63 672 100 254 218 623 415 426 986 920 915 736 795 407 541 382 213 935 743 961 59 660 512 134 935 248 378 739 356 543 714 28 667 602 596 759 791 103 564 225 520 159 542 966 332 983 655 517 273 95 242 593 940 286 236 41 318 941 727 384 225 319 627 982 359 232 769 854 172 643 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNow Vasya is taking an exam in mathematics. In order to get a good mark, Vasya needs to guess the matrix that the teacher has constructed!\n\nVasya knows that the matrix consists of n rows and m columns. For each row, he ... | [{"type": "stdin_stdout", "input": "10 10\n522 84 340 666 203 545 475 106 1012 955\n72 764 778 197 586 124 407 834 126 866\n", "output": "YES\n0 0 0 0 0 0 0 0 0 522 \n0 0 0 0 0 0 0 0 0 84 \n0 0 0 0 0 0 0 0 0 340 \n0 0 0 0 0 0 0 0 0 666 \n0 0 0 0 0 0 0 0 0 203 \n0 0 0 0 0 0 0 0 0 545 \n0 0 0 0 0 0 0 0 0 475 \n0 0 0 0 0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAncient Egyptians are known to have used a large set of symbols $\\sum$ to write on the walls of the temples. Fafa and Fifa went to one of the temples and found two non-empty words S_1 and S_2 of equal lengths on the wall... | [{"type": "stdin_stdout", "input": "107 100000\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given integers N and M.\nConsider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.... | [{"type": "stdin_stdout", "input": "100000 1000000000\n", "output": "10000\n"}, {"type": "stdin_stdout", "input": "1 1000000000\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "100000 921100000\n", "output": "9211\n"}, {"type": "stdin_stdout", "input": "100000 932262032\n", "output": "6362\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an undirected connected weighted graph with N vertices and M edges that contains neither self-loops nor double edges.\n\nThe i-th (1≤i≤M) edge connects vertex a_i and vertex b_i with a distance of c_i.\n\nHe... | [{"type": "stdin_stdout", "input": "100 1000\n1 2 1\n1 3 1\n1 4 1\n1 5 1\n1 6 1\n1 7 1\n1 8 1\n1 9 1\n1 10 1\n1 11 1\n1 12 1\n1 13 1\n1 14 1\n1 15 1\n1 16 1\n1 17 1\n1 18 1\n1 19 1\n1 20 1\n1 21 1\n1 22 1\n1 23 1\n1 24 1\n1 25 1\n1 26 1\n1 27 1\n1 28 1\n1 29 1\n1 30 1\n1 31 1\n1 32 1\n1 33 1\n1 34 1\n1 35 1\n1 36 1\n1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is a string S. Each character in S is either a digit (0, ..., 9) or ?.\nAmong the integers obtained by replacing each occurrence of ? with a digit, how many have a remainder of 5 when divided by 13? An integer may b... | [{"type": "stdin_stdout", "input": "???????????????2?????????????8???????????6????????5?6?5????1???8????1???????????????????????????????????3??????9????????????3??6???????????6???????????????????3???????????9???????3????6?5?????????????????2???????????5418??????????8????????9????????????0????????????????????????9??????... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSince the giant heads have appeared in the sky all humanity is in danger, so all Ricks and Mortys from all parallel universes are gathering in groups to find a solution to get rid of them. \n\nThere are n parallel univers... | [{"type": "stdin_stdout", "input": "100 50\n2 62 -62\n2 19 -19\n2 38 -38\n2 -84 84\n2 -16 16\n2 67 -67\n2 41 -41\n2 -32 32\n2 32 -32\n2 -62 62\n2 89 -89\n2 -84 84\n2 96 -96\n2 -11 11\n2 59 -59\n2 -13 13\n2 -70 70\n2 -3 3\n2 -41 41\n2 -74 74\n2 47 -47\n2 87 -87\n2 17 -17\n2 20 -20\n2 -14 14\n2 -67 67\n2 -95 95\n2 -15 15... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a$ of $n$ integers, where $n$ is odd. You can make the following operation with it: Choose one of the elements of the array (for example $a_i$) and increase it by $1$ (that is, replace it with $a_... | [{"type": "stdin_stdout", "input": "23 691688417\n162011045 845692742 774584765 103906675 222286673 251540072 657857114 45615854 71306611 790640347 835976636 327687572 570766082 48938195 769656348 341889962 393959831 928029640 320443541 248114937 798473713 159552755 533648295\n", "output": "632988146"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a text of single-space separated words, consisting of small and capital Latin letters.\n\nVolume of the word is number of capital letters in the word. Volume of the text is maximum volume of all words in the... | [{"type": "stdin_stdout", "input": "200\nLBmJKQLCKUgtTxMoDsEerwvLOXsxASSydOqWyULsRcjMYDWdDCgaDvBfATIWPVSXlbcCLHPYahhxMEYUiaxoCebghJqvmRnaNHYTKLeOiaLDnATPZAOgSNfBzaxLymTGjfzvTegbXsAthTxyDTcmBUkqyGlVGZhoazQzVSoKbTFcCRvYsgSCwjGMxBfWEwMHuagTBxkz\n", "output": "105\n"}, {"type": "stdin_stdout", "input": "200\nAAAAAAAAAAAAAA... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCaisa 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.\n\nUnfortunately, he has just s dollars for sugar. But that's not a rea... | [{"type": "stdin_stdout", "input": "69 9\n39 15\n70 44\n90 89\n84 58\n83 97\n24 28\n90 18\n7 96\n43 86\n99 50\n77 12\n12 34\n100 19\n21 86\n55 30\n99 29\n26 92\n82 67\n78 14\n64 16\n98 12\n31 39\n36 86\n73 36\n87 29\n42 23\n58 15\n35 52\n91 56\n39 6\n88 45\n38 36\n57 12\n79 71\n40 33\n98 42\n34 36\n23 79\n69 68\n50 47\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nToad Ivan has $m$ pairs of integers, each integer is between $1$ and $n$, inclusive. The pairs are $(a_1, b_1), (a_2, b_2), \\ldots, (a_m, b_m)$. \n\nHe asks you to check if there exist two integers $x$ and $y$ ($1 \\leq ... | [{"type": "stdin_stdout", "input": "10 10\n1 3\n1 3\n1 3\n1 3\n1 3\n2 3\n1 5\n2 6\n2 7\n2 9\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "9 10\n6 5\n9 8\n7 8\n4 5\n5 8\n3 5\n7 8\n9 8\n8 5\n1 5\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "5 10\n1 2\n1 3\n1 4\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n4 5\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasiliy is fond of solving different tasks. Today he found one he wasn't able to solve himself, so he asks you to help.\n\nVasiliy is given n strings consisting of lowercase English letters. He wants them to be sorted in ... | [{"type": "stdin_stdout", "input": "10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\naaaaaaaaaaab\nab\naab\naaab\naaaab\naaaaab\naaaaaab\naaaaaaab\naaaaaaaab\naaaaaaaaab\n", "output": "8000000000\n"}, {"type": "stdin_stdout", "input": "10\n1000000000 100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya studies in a school and he adores Maths. His class has been studying arithmetic expressions. On the last class the teacher wrote three positive integers a, b, c on the blackboard. The task was to insert signs of ope... | [{"type": "stdin_stdout", "input": "10\n10\n10\n", "output": "1000\n"}, {"type": "stdin_stdout", "input": "10\n5\n6\n", "output": "300\n"}, {"type": "stdin_stdout", "input": "2\n10\n3\n", "output": "60\n"}, {"type": "stdin_stdout", "input": "9\n7\n2\n", "output": "126\n"}, {"type": "stdin_stdout", "input": "1\n1\n10\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n parliamentarians in Berland. They are numbered with integers from 1 to n. It happened that all parliamentarians with odd indices are Democrats and all parliamentarians with even indices are Republicans.\n\nNew... | [{"type": "stdin_stdout", "input": "109 37 3\n", "output": "1 2 3 \n4 5 6 \n7 8 9 \n10 11 12 \n13 14 15 \n16 17 18 \n19 20 21 \n22 23 24 \n25 26 27 \n28 29 30 \n31 32 33 \n34 35 36 \n37 38 39 \n40 41 42 \n43 44 45 \n46 47 48 \n49 50 51 \n52 53 54 \n55 56 57 \n58 59 60 \n61 62 63 \n64 65 66 \n67 68 69 \n70 71 72 \n73 74... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLimak and Radewoosh are going to compete against each other in the upcoming algorithmic contest. They are equally skilled but they won't solve problems in the same order.\n\nThere will be n problems. The i-th problem has ... | [{"type": "stdin_stdout", "input": "50 1\n5 14 18 73 137 187 195 197 212 226 235 251 262 278 287 304 310 322 342 379 393 420 442 444 448 472 483 485 508 515 517 523 559 585 618 627 636 646 666 682 703 707 780 853 937 951 959 989 991 992\n30 84 113 173 199 220 235 261 266 277 300 306 310 312 347 356 394 396 397 409 414 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSakuzyo - Imprinting\n\nA.R.C. Markland-N is a tall building with $n$ floors numbered from $1$ to $n$. Between each two adjacent floors in the building, there is a staircase connecting them.\n\nIt's lunchtime for our sens... | [{"type": "stdin_stdout", "input": "1\n100 52 99\n51 69 42 32 34 62 12 75 88 18 57 47 40 91 100 81 72 15 26 14 93 68 6 50 5 24 97 52 10 20 54 9 56 39 21 55 7 98 59 87 77 17 29 13 30 46 37 76 71 78 96 82 49 64 84 60 67 19 2 25 85 89 38 41 11 90 35 48 27 28 70 65 66 16 79 3 80 44 36 43 61 99 22 33 86 4 83 94 74 31 73 95 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp is preparing the first programming contest for robots. There are $n$ problems in it, and a lot of robots are going to participate in it. Each robot solving the problem $i$ gets $p_i$ points, and the score of each... | [{"type": "stdin_stdout", "input": "100\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPiegirl is buying stickers for a project. Stickers come on sheets, and each sheet of stickers contains exactly n stickers. Each sticker has exactly one character printed on it, so a sheet of stickers can be described by a... | [{"type": "stdin_stdout", "input": "aaaaa\n100\n", "output": "1\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"}, {"type": "stdin_stdout", "input": "abc\n100\n", "output": "1\nabcaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKarl likes Codeforces and subsequences. He wants to find a string of lowercase English letters that contains at least $k$ subsequences codeforces. Out of all possible strings, Karl wants to find a shortest one.\n\nFormall... | [{"type": "stdin_stdout", "input": "10000000000000000\n", "output": "ccccccccccccccccccccccccccccccccccccccccooooooooooooooooooooooooooooooooooooooooddddddddddddddddddddddddddddddddddddddddeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeffffffffffffffffffffffffffffffffffffffffoooooooooooooooooooooooooooooooooooooooorrrrrrrrrrr... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSagheer is playing a game with his best friend Soliman. He brought a tree with n nodes numbered from 1 to n and rooted at node 1. The i-th node has a_{i} apples. This tree has a special property: the lengths of all paths ... | [{"type": "stdin_stdout", "input": "21\n6194737 6429360 6047962 1014039 9196042 2483033 9232471 5444322 4437778 6614229 4791649 7417126 7679607 790939 3062370 174847 8404336 832859 2083127 9041108 3074902\n1 2 3 4 4 6 7 2 9 10 9 12 12 1 15 1 17 1 19 19\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "23\n795895... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are planning to build housing on a street. There are $n$ spots available on the street on which you can build a house. The spots are labeled from $1$ to $n$ from left to right. In each spot, you can build a house with... | [{"type": "stdin_stdout", "input": "50 50 50\n28 29 9\n33 43 30\n12 34 3\n9 12 26\n24 39 10\n12 47 35\n29 41 47\n43 44 49\n19 37 36\n11 18 46\n19 42 20\n9 40 47\n18 34 22\n11 20 44\n5 31 44\n29 40 0\n1 26 19\n7 50 4\n14 34 48\n43 48 21\n12 49 23\n6 40 47\n22 37 50\n39 48 29\n12 34 13\n5 10 25\n30 45 46\n26 32 29\n2 4 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVery soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was a... | [{"type": "stdin_stdout", "input": "10 4\nigtVqPgoW 3 24\nuc 1 381\nOxmovZAv 4 727\nxyRAaAk 2 378\nvYCV 4 67\nuf 2 478\nDawOytiYiH 2 775\nRS 1 374\npLhTehhjA 2 38\nYkWfb 3 595\n", "output": "uc RS\nDawOytiYiH uf\nYkWfb igtVqPgoW\nOxmovZAv vYCV\n"}, {"type": "stdin_stdout", "input": "10 2\nSHiBIEz 2 628\nXxwaAxB 1 190\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNatasha is going to fly to Mars. She needs to build a rocket, which consists of several stages in some order. Each of the stages is defined by a lowercase Latin letter. This way, the rocket can be described by the string ... | [{"type": "stdin_stdout", "input": "50 13\nqwertyuiopasdfghjklzxcvbnmaaaaaaaaaaaaaaaaaaaaaaaa\n", "output": "169"}, {"type": "stdin_stdout", "input": "50 14\nqwertyuiopasdfghjklzxcvbnmaaaaaaaaaaaaaaaaaaaaaaaa\n", "output": "-1"}, {"type": "stdin_stdout", "input": "50 31\nahbyyoxltryqdmvenemaqnbakglgqolxnaifnqtoclnnqiab... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNothing has changed since the last round. Dima and Inna still love each other and want to be together. They've made a deal with Seryozha and now they need to make a deal with the dorm guards...\n\nThere are four guardpost... | [{"type": "stdin_stdout", "input": "100000\n99000 100000 999 100000\n100000 100000 100000 100000\n100000 100000 100000 100000\n100000 100000 100000 100000\n", "output": "1 99000 1000\n"}, {"type": "stdin_stdout", "input": "100000\n100000 100000 100000 100000\n100000 100000 100000 100000\n100000 100000 100000 100000\n10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp has n dice d_1, d_2, ..., d_{n}. The i-th dice shows numbers from 1 to d_{i}. Polycarp rolled all the dice and the sum of numbers they showed is A. Agrippina didn't see which dice showed what number, she knows on... | [{"type": "stdin_stdout", "input": "10 20\n1 1 1 1 5 100 1 1 1 1\n", "output": "0 0 0 0 0 95 0 0 0 0 "}, {"type": "stdin_stdout", "input": "10 13\n9 9 6 9 10 4 5 10 8 9\n", "output": "5 5 2 5 6 0 1 6 4 5 "}, {"type": "stdin_stdout", "input": "10 79\n9 9 6 9 10 4 5 10 8 9\n", "output": "8 8 5 8 9 3 4 9 7 8 "}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAndrewid the Android is a galaxy-famous detective. He is now investigating a case of frauds who make fake copies of the famous Stolp's gears, puzzles that are as famous as the Rubik's cube once was.\n\nIts most important ... | [{"type": "stdin_stdout", "input": "100\n15 86 17 88 19 90 21 92 23 94 25 96 27 98 29 0 31 2 33 4 35 6 37 8 39 10 41 12 43 14 45 16 47 18 49 20 51 22 53 24 55 26 57 28 59 30 61 32 63 34 65 36 67 38 69 40 71 42 73 44 75 46 77 48 79 50 81 52 83 54 85 56 87 58 89 60 91 62 93 64 95 66 97 68 99 70 1 72 3 74 5 76 7 78 9 80 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBob and Alice are often participating in various programming competitions. Like many competitive programmers, Alice and Bob have good and bad days. They noticed, that their lucky and unlucky days are repeating with some p... | [{"type": "stdin_stdout", "input": "372839920 992839201 1000000000\n100293021 773829394 999999993\n", "output": "619999282\n"}, {"type": "stdin_stdout", "input": "111111111 888888889 999999999\n998997996 999999999 1000000000\n", "output": "1002004\n"}, {"type": "stdin_stdout", "input": "100293023 882738299 1000000000\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKostya is a genial sculptor, he has an idea: to carve a marble sculpture in the shape of a sphere. Kostya has a friend Zahar who works at a career. Zahar knows about Kostya's idea and wants to present him a rectangular pa... | [{"type": "stdin_stdout", "input": "2\n999999999 1000000000 1000000000\n1000000000 1000000000 1000000000\n", "output": "2\n2 1\n"}, {"type": "stdin_stdout", "input": "9\n1 3 2\n3 3 1\n3 1 2\n3 3 2\n2 2 2\n3 2 1\n3 3 1\n3 3 1\n2 1 2\n", "output": "2\n4 8\n"}, {"type": "stdin_stdout", "input": "7\n10 7 8\n5 10 3\n4 2 6\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a grid of square cells with H horizontal rows and W vertical columns. The cell at the i-th row and the j-th column will be denoted as Cell (i, j).\nIn Cell (i, j), a_{ij} coins are placed.\nYou can perform the fo... | [{"type": "stdin_stdout", "input": "22 75\n5 4 1 0 6 8 6 1 4 4 1 3 6 5 1 1 7 6 6 8 7 0 8 5 9 7 7 5 9 2 2 8 0 9 4 7 0 9 6 7 3 7 5 4 0 9 1 4 0 6 6 3 0 3 4 3 4 9 0 4 0 1 4 0 1 2 5 1 8 8 6 5 1 1 7\n2 4 1 3 9 3 7 3 1 8 9 2 0 0 1 9 6 6 4 6 6 7 9 5 3 2 9 5 0 7 8 2 1 3 1 4 4 8 3 6 8 1 4 9 9 7 8 1 9 6 8 7 0 9 5 2 8 4 0 9 4 7 7 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInna and Dima decided to surprise Sereja. They brought a really huge candy matrix, it's big even for Sereja! Let's number the rows of the giant matrix from 1 to n from top to bottom and the columns — from 1 to m, from lef... | [{"type": "stdin_stdout", "input": "63 67 18046757 61758841 85367218 68\n22 30\n25 40\n56 58\n29 11\n34 63\n28 66\n51 5\n39 64\n1 23\n24 61\n19 47\n10 31\n55 28\n52 26\n38 7\n28 31\n13 27\n37 42\n10 52\n19 33\n7 36\n13 1\n46 40\n21 41\n1 1\n6 35\n10 4\n46 9\n21 57\n1 49\n34 14\n14 35\n43 4\n1 41\n25 22\n18 25\n27 23\n4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical O... | [{"type": "stdin_stdout", "input": "7 10\n1 0 1 0 0 0 1 0 1 0\n1 0 1 0 0 0 1 0 1 0\n1 1 1 1 1 1 1 1 1 1\n1 0 1 0 0 0 1 0 1 0\n1 1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1 1\n", "output": "YES\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n1 0 1 0 0 0 1 0 1 0\n0 0 0 0 0 0 0 0 0 0\n1 0 1 0 0 0 1 0 1 0\n1 0 1 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGennady owns a small hotel in the countryside where he lives a peaceful life. He loves to take long walks, watch sunsets and play cards with tourists staying in his hotel. His favorite game is called \"Mau-Mau\".\n\nTo pl... | [{"type": "stdin_stdout", "input": "AS\n2H 4C TH JH AD\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "4D\nAS AC AD AH 5H\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "KH\n3C QD 9S KS 8D\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "4H\nJH QC 5H 9H KD\n", "output": "YES\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter celebrating the midcourse the students of one of the faculties of the Berland State University decided to conduct a vote for the best photo. They published the photos in the social network and agreed on the rules to... | [{"type": "stdin_stdout", "input": "40\n119631 119631 772776 119631 658661 119631 108862 524470 125132 700668 69196 844949 154577 108862 108862 108862 597344 940938 989698 108862 154577 69196 125132 687080 940938 125132 69196 69196 125132 566152 953083 406319 380068 119631 154577 125132 413984 69196 154577 154577\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour friend Mishka and you attend a calculus lecture. Lecture lasts n minutes. Lecturer tells a_{i} theorems during the i-th minute.\n\nMishka is really interested in calculus, though it is so hard to stay awake for all t... | [{"type": "stdin_stdout", "input": "10 5\n1 1 1 1 1 1 1 1 10000 1\n1 1 1 1 1 1 1 1 0 1\n", "output": "10009\n"}, {"type": "stdin_stdout", "input": "10 4\n9 5 6 4 3 9 5 1 10 7\n0 0 0 0 0 0 1 0 0 1\n", "output": "36\n"}, {"type": "stdin_stdout", "input": "10 5\n3 5 9 2 5 9 3 8 8 1\n0 1 1 1 0 1 0 0 0 0\n", "output": "49\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn a galaxy far, far away Lesha the student has just got to know that he has an exam in two days. As always, he hasn't attended any single class during the previous year, so he decided to spend the remaining time wisely.\... | [{"type": "stdin_stdout", "input": "90 900\n", "output": "12\n13 12 11 10 9 8 7 6 5 4 3 2 \n32\n44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 1 "}, {"type": "stdin_stdout", "input": "660 6\n", "output": "33\n36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Berland, there is the national holiday coming — the Flag Day. In the honor of this event the president of the country decided to make a big dance party and asked your agency to organize it. He has several conditions: ... | [{"type": "stdin_stdout", "input": "99 42\n61 66 47\n10 47 96\n68 86 67\n21 29 10\n55 44 47\n12 82 4\n45 71 55\n86 3 95\n16 99 93\n14 92 82\n12 59 20\n73 24 8\n79 72 48\n44 87 39\n87 84 97\n47 70 37\n49 77 95\n39 75 28\n75 25 5\n44 41 36\n76 86 78\n73 6 90\n8 22 58\n9 72 63\n81 42 14\n1 21 35\n91 54 15\n30 13 39\n56 89... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMasha has three sticks of length $a$, $b$ and $c$ centimeters respectively. In one minute Masha can pick one arbitrary stick and increase its length by one centimeter. She is not allowed to break sticks.\n\nWhat is the mi... | [{"type": "stdin_stdout", "input": "100 100 100\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "100 10 10\n", "output": "81\n"}, {"type": "stdin_stdout", "input": "100 100 99\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "12 34 56\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "100 100 1\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer $n$ ($n \\ge 0$) represented with $k$ digits in base (radix) $b$. So,\n\n$$n = a_1 \\cdot b^{k-1} + a_2 \\cdot b^{k-2} + \\ldots a_{k-1} \\cdot b + a_k.$$\n\nFor example, if $b=17, k=3$ and $a=[11... | [{"type": "stdin_stdout", "input": "97 100\n93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nChouti and his classmates are going to the university soon. To say goodbye to each other, the class has planned a big farewell party in which classmates, teachers and parents sang and danced.\n\nChouti remembered that $n$... | [{"type": "stdin_stdout", "input": "36\n34 35 34 34 32 32 35 34 34 32 33 35 33 35 35 34 35 33 34 35 34 35 35 35 34 35 32 35 33 35 33 33 35 35 35 34\n", "output": "Possible\n17 1 17 18 24 24 2 18 19 24 22 3 22 4 5 19 6 22 20 7 20 8 9 10 21 11 24 12 23 13 23 23 14 15 16 21 "}, {"type": "stdin_stdout", "input": "10\n7 7 7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nToday, Wet Shark is given n integers. Using any of these integers no more than once, Wet Shark wants to get maximum possible even (divisible by 2) sum. Please, calculate this value for Wet Shark. \n\nNote, that if Wet Sha... | [{"type": "stdin_stdout", "input": "5\n999999999 999999999 999999999 999999999 999999999\n", "output": "3999999996"}, {"type": "stdin_stdout", "input": "15\n87 22 98 32 88 36 72 31 100 97 17 16 60 22 20\n", "output": "798"}, {"type": "stdin_stdout", "input": "15\n87 37 91 29 58 45 51 74 70 71 47 38 91 89 44\n", "output... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Berland there are n cities and n - 1 bidirectional roads. Each road connects some pair of cities, from any city you can get to any other one using only the given roads.\n\nIn each city there is exactly one repair briga... | [{"type": "stdin_stdout", "input": "12\n1 2\n2 3\n2 4\n2 5\n5 7\n5 6\n5 8\n5 12\n12 10\n12 11\n12 9\n", "output": "5\n2 4 9 \n3 1 5 10 \n3 2 6 11 \n2 3 7 \n1 8 \n"}, {"type": "stdin_stdout", "input": "10\n2 8\n5 10\n3 4\n1 6\n3 9\n1 7\n4 8\n10 8\n1 8\n", "output": "4\n4 1 2 3 4 \n3 5 6 7 \n1 8 \n1 9 \n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDima and Seryozha live in an ordinary dormitory room for two. One day Dima had a date with his girl and he asked Seryozha to leave the room. As a compensation, Seryozha made Dima do his homework.\n\nThe teacher gave Seryo... | [{"type": "stdin_stdout", "input": "50\n384672 661179 -775591 -989608 611120 442691 601796 502406 384323 -315945 -934146 873993 -156910 -94123 -930137 208544 816236 466922 473696 463604 794454 -872433 -149791 -858684 -467655 -555239 623978 -217138 -408658 493342 -733576 -350871 711210 884148 -426172 519986 -356885 5271... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhen preparing a tournament, Codeforces coordinators try treir best to make the first problem as easy as possible. This time the coordinator had chosen some problem and asked $n$ people about their opinions. Each person a... | [{"type": "stdin_stdout", "input": "100\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "EASY\n"}, {"type": "stdin_stdout", "input": "100\n0 0 0 0 0 0 0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Omkar's last class of math, he learned about the least common multiple, or $LCM$. $LCM(a, b)$ is the smallest positive integer $x$ which is divisible by both $a$ and $b$.\n\nOmkar, having a laudably curious mind, immed... | [{"type": "stdin_stdout", "input": "10\n1000000000\n1000000000\n1000000000\n1000000000\n1000000000\n1000000000\n1000000000\n1000000000\n1000000000\n1000000000\n", "output": "500000000 500000000\n500000000 500000000\n500000000 500000000\n500000000 500000000\n500000000 500000000\n500000000 500000000\n500000000 500000000\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGreatest common divisor GCD(a, b) of two positive integers a and b is equal to the biggest integer d such that both integers a and b are divisible by d. There are many efficient algorithms to find greatest common divisor ... | [{"type": "stdin_stdout", "input": "10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "output": "10000000000000000000000000000000000000000000000000000000000000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter overcoming the stairs Dasha came to classes. She needed to write a password to begin her classes. The password is a string of length n which satisfies the following requirements: There is at least one digit in the ... | [{"type": "stdin_stdout", "input": "25 16\nvza**ooxkmd#*ywa\ndip#*#&ef&z&&&pv\nwggob&&72#*&&nku\nrsb##*&jm&#u**te\nzif#lu#t&2w#jbqb\nwfo&#&***0xp#&hp\njbw##h*###nkmkdn\nqrn*&y#3cnf&d*rc\nend*zg&0f*&g*&ak\niayh&r#8om#o**yq\nwym&e&*v0j&#zono\ntzu*vj&i18iew&ht\nhpfnceb193&#&acf\ngesvq&l&*&m*l*ru\nfot#u&pq&0y&s*pg\nqdfgs&h... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSome natural number was written on the board. Its sum of digits was not less than k. But you were distracted a bit, and someone changed this number to n, replacing some digits with others. It's known that the length of th... | [{"type": "stdin_stdout", "input": "200\n1000000010000000000000000000010000000000000001000001000000000000000000000000000000000000000000000000\n", "output": "22\n"}, {"type": "stdin_stdout", "input": "700\n9307216756404590162143344901558545760612901767837570518638460182990196397856220673189163417019781185\n", "output": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAndrew prefers taxi to other means of transport, but recently most taxi drivers have been acting inappropriately. In order to earn more money, taxi drivers started to drive in circles. Roads in Andrew's city are one-way, ... | [{"type": "stdin_stdout", "input": "10 45\n5 6 894\n9 4 197\n7 1 325\n9 7 232\n7 2 902\n1 4 183\n5 7 41\n10 5 481\n7 8 495\n8 5 266\n4 7 152\n1 8 704\n3 1 790\n9 1 458\n10 2 546\n6 2 258\n2 5 30\n5 4 366\n6 7 747\n4 2 546\n6 8 332\n6 10 816\n3 6 523\n10 3 683\n4 3 771\n3 9 152\n5 1 647\n2 3 967\n3 8 785\n9 10 793\n9 8 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nUser ainta has a permutation p_1, p_2, ..., p_{n}. As the New Year is coming, he wants to make his permutation as pretty as possible.\n\nPermutation a_1, a_2, ..., a_{n} is prettier than permutation b_1, b_2, ..., b_{n}, ... | [{"type": "stdin_stdout", "input": "15\n6 1 2 7 9 13 14 8 4 5 3 12 10 15 11\n000100100100100\n000010010010010\n000001001001001\n100000100100100\n010000010010010\n001000001001001\n100100000100100\n010010000010010\n001001000001001\n100100100000100\n010010010000010\n001001001000001\n100100100100000\n010010010010000\n00100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.\n\nHongcow has decided to try to make new words fr... | [{"type": "stdin_stdout", "input": "abcdefghijklmnopqrstuvwxyabcdefghijklmnopqrstuvwxy\n", "output": "25\n"}, {"type": "stdin_stdout", "input": "zyzzzyyzyyyzyyzyzyzyzyzzzyyyzzyzyyzzzzzyyyzzzzyzyy\n", "output": "50\n"}, {"type": "stdin_stdout", "input": "aaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaab\n", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBerland shop sells $n$ kinds of juices. Each juice has its price $c_i$. Each juice includes some set of vitamins in it. There are three types of vitamins: vitamin \"A\", vitamin \"B\" and vitamin \"C\". Each juice can con... | [{"type": "stdin_stdout", "input": "25\n8 CA\n4 AB\n8 CA\n4 CA\n7 CB\n4 CB\n4 CB\n2 AC\n2 CA\n3 BC\n4 AC\n7 AB\n3 CA\n5 BC\n7 CB\n9 CA\n7 AB\n7 CA\n9 BA\n8 AC\n6 BA\n2 AC\n1 CB\n5 AB\n3 AB\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "20\n10 CA\n1 CB\n10 BC\n4 AC\n4 BA\n6 CB\n10 CB\n8 BC\n9 BC\n1 BA\n10 AB\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nОсновой любой социальной сети является отношение дружбы между двумя пользователями в том или ином смысле. В одной известной социальной сети дружба симметрична, то есть если a является другом b, то b также является другом ... | [{"type": "stdin_stdout", "input": "10 50\n946010975 207263044\n923545573 749203275\n862015642 426425906\n749203275 839134958\n910721783 289091881\n827003531 333726912\n49704846 538788252\n382891592 207263044\n333726912 438209022\n974360048 49704846\n", "output": "49704846: 0\n207263044: 0\n289091881: 0\n333726912: 0\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs it's the first of April, Heidi is suspecting that the news she reads today are fake, and she does not want to look silly in front of all the contestants. She knows that a newspiece is fake if it contains heidi as a sub... | [{"type": "stdin_stdout", "input": "plqaykgovxkvsiahdbglktdlhcqwelxxmtlyymrsyubxdskvyjkrowvcbpdofpjqspsrgpakdczletxujzlsegepzleipiyycpinzxgwjsgslnxsotouddgfcybozfpjhhocpybfjbaywsehbcfrayvancbrumdfngqytnhihyxnlvilrqyhnxeckprqafofelospffhtwguzjbbjlzbqrtiielbvzutzgpqxosiaqznndgobcluuqlhmffiowkjdlkokehtjdyjvmxsiyxureflmdom... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLimak is a little polar bear. He likes nice strings — strings of length n, consisting of lowercase English letters only.\n\nThe distance between two letters is defined as the difference between their positions in the alph... | [{"type": "stdin_stdout", "input": "69 1701\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzy\n", "output": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaax\n"}, {"type": "stdin_stdout", "input": "50 100\ntewducenaqgpilgftjcmzttrgebnyldwfgbtttrygaiqtkgbjb\n", "output": "azazec... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn n × n square matrix is special, if: it is binary, that is, each cell contains either a 0, or a 1; the number of ones in each row and column equals 2. \n\nYou are given n and the first m rows of the matrix. Print the ... | [{"type": "stdin_stdout", "input": "7 4 100501\n0100010\n0000101\n0100100\n0000011\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "6 4 100501\n100010\n100100\n010100\n000011\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "8 2 910911\n01000100\n01010000\n", "output": "148140\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya likes to solve equations. Today he wants to solve $(x~\\mathrm{div}~k) \\cdot (x \\bmod k) = n$, where $\\mathrm{div}$ and $\\mathrm{mod}$ stand for integer division and modulo operations (refer to the Notes below f... | [{"type": "stdin_stdout", "input": "999983 1000\n", "output": "999983001\n"}, {"type": "stdin_stdout", "input": "999995 1000\n", "output": "199999005\n"}, {"type": "stdin_stdout", "input": "1000000 1000\n", "output": "1250800\n"}, {"type": "stdin_stdout", "input": "994009 997\n", "output": "991026974\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:\n\nVladik is at initial train station, and now n people (including Vladik) want to get... | [{"type": "stdin_stdout", "input": "100\n931 4584 2116 3004 3813 62 2819 2998 2080 4906 3198 2443 2952 3793 1958 3864 3985 3169 3134 4011 4525 995 4163 308 4362 1148 4906 3092 1647 244 1370 1424 2753 84 2997 1197 2606 425 3501 2606 683 4747 3884 4787 2166 3017 3080 4303 3352 1667 2636 3994 757 2388 870 1788 988 1303 0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is a directed graph G with N vertices and M edges.\n\nThe vertices are numbered 1 to N, and the i-th edge is directed from Vertex A_i to Vertex B_i.\n\nIt is guaranteed that the graph contains no self-loops or multi... | [{"type": "stdin_stdout", "input": "1000 2000\n284 896\n114 756\n378 967\n409 521\n21 743\n663 470\n940 331\n253 190\n101 967\n445 448\n229 742\n208 887\n481 989\n212 276\n886 105\n522 952\n70 458\n108 793\n883 175\n392 676\n432 113\n997 710\n643 649\n813 939\n796 315\n586 763\n746 409\n160 722\n577 249\n897 905\n332 4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N cells arranged in a row, numbered 1, 2, \\ldots, N from left to right.\nTak lives in these cells and is currently on Cell 1. He is trying to reach Cell N by using the procedure described below.\nYou are given ... | [{"type": "stdin_stdout", "input": "200000 10\n195313 197047\n198503 199144\n199910 200000\n193793 195312\n186922 193792\n199860 199909\n199145 199570\n197048 198502\n1 186921\n199571 199859\n", "output": "946746535\n"}, {"type": "stdin_stdout", "input": "199993 10\n23896 23905\n92651 92660\n184931 184940\n101332 10134... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThree companies decided to order a billboard with pictures of their logos. A billboard is a big square board. A logo of each company is a rectangle of a non-zero area. \n\nAdvertisers will put up the ad only if it is poss... | [{"type": "stdin_stdout", "input": "20 1 20 1 18 20\n", "output": "20\nAAAAAAAAAAAAAAAAAAAA\nBBBBBBBBBBBBBBBBBBBB\nCCCCCCCCCCCCCCCCCCCC\nCCCCCCCCCCCCCCCCCCCC\nCCCCCCCCCCCCCCCCCCCC\nCCCCCCCCCCCCCCCCCCCC\nCCCCCCCCCCCCCCCCCCCC\nCCCCCCCCCCCCCCCCCCCC\nCCCCCCCCCCCCCCCCCCCC\nCCCCCCCCCCCCCCCCCCCC\nCCCCCCCCCCCCCCCCCCCC\nCCCCCCC... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt seems like the year of 2013 came only yesterday. Do you know a curious fact? The year of 2013 is the first year after the old 1987 with only distinct digits.\n\nNow you are suggested to solve the following problem: giv... | [{"type": "stdin_stdout", "input": "1987\n", "output": "2013\n"}, {"type": "stdin_stdout", "input": "2013\n", "output": "2014\n"}, {"type": "stdin_stdout", "input": "1000\n", "output": "1023\n"}, {"type": "stdin_stdout", "input": "1001\n", "output": "1023\n"}, {"type": "stdin_stdout", "input": "1234\n", "output": "1235... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEmuskald is addicted to Codeforces, and keeps refreshing the main page not to miss any changes in the \"recent actions\" list. He likes to read thread conversations where each thread consists of multiple messages.\n\nRece... | [{"type": "stdin_stdout", "input": "132\n13 7 33 124 118 76 94 92 16 107 130 1 46 58 28 119 42 53 102 81 99 29 57 70 125 45 100 68 10 63 34 38 19 49 56 30 103 72 106 3 121 110 78 2 31 129 128 24 77 61 87 47 15 21 88 60 5 101 82 108 84 41 86 66 79 75 54 97 55 12 69 44 83 131 9 95 11 85 52 35 115 80 111 27 109 36 39 104 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA way to make a new task is to make it nondeterministic or probabilistic. For example, the hard task of Topcoder SRM 595, Constellation, is the probabilistic version of a convex hull.\n\nLet's try to make a new task. Firs... | [{"type": "stdin_stdout", "input": "6\nzfnkpxaavrcvqhhkclcuiswawpghlqrlq wnvbzhvsjozlkwxowcvyclmehjkkvkxin\nzkxkvlnovnloxjdydujkjydaegzjypsgrzq dmiilhmkspokltabpvwalijhlitbfp\nldfbfggqsdqethdgkmbcwloluguxiluqjyr fewoondewvndcxticvpiqnvvdhsnzfd\nepokfmixjnawdfgkmqlcyirxuprrvudh xvijbdzqdyjwsyhjucytuxrxuiynxf\nxntrjusjwb... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA boy named Ayrat lives on planet AMI-1511. Each inhabitant of this planet has a talent. Specifically, Ayrat loves running, moreover, just running is not enough for him. He is dreaming of making running a real art.\n\nFir... | [{"type": "stdin_stdout", "input": "jjjbjjbjbbbbbbjbjbbjbjbbbjbjbbjbbjbbjjbjbjjjbbbbjbjjjjbbbjbjjjjjbjbjbjjjbjjjjjjjjbbjbjbbjbbjbbbbbjjjbbjjbjjbbbbjbbjbbbbbjbbjjbjjbbjjjbjjbbbbjbjjbjbbjbbjbjbjbbbjjjjbjbjbbjbjjjjbbjbjbbbjjjjjbjjbjbjjjbjjjbbbjbjjbbbbbbbjjjjbbbbj\njjbbjbbjjjbjbbjjjjjbjbjjjbjbbbbjbbjbjjbjbbjbbbjjbjjbjbbbjb... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a chessboard of size 1 × n. It is guaranteed that n is even. The chessboard is painted like this: \"BWBW...BW\".\n\nSome cells of the board are occupied by the chess pieces. Each cell contains no more than o... | [{"type": "stdin_stdout", "input": "100\n93 54 57 61 68 66 70 96 64 82 80 75 69 77 76 94 67 86 90 73 74 58 100 83 92 89 56 99 88 59 95 72 81 51 85 71 97 60 91 63 65 98 79 84 53 62 87 55 52 78\n", "output": "1225\n"}, {"type": "stdin_stdout", "input": "100\n9 63 62 88 3 67 54 33 79 51 71 80 37 46 43 57 69 17 34 6 18 40 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKolya is going to make fresh orange juice. He has n oranges of sizes a_1, a_2, ..., a_{n}. Kolya will put them in the juicer in the fixed order, starting with orange of size a_1, then orange of size a_2 and so on. To be p... | [{"type": "stdin_stdout", "input": "100 1000 1083\n992 616 818 359 609 783 263 989 501 929 362 394 919 1081 870 830 1097 975 62 346 531 367 323 457 707 360 949 334 867 116 478 417 961 963 1029 114 867 1008 988 916 983 1077 959 942 572 961 579 318 721 337 488 717 111 70 416 685 987 130 353 107 61 191 827 849 106 815 211... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.\n\nThe pasture i... | [{"type": "stdin_stdout", "input": "10 10\n....W.W.W.\n.........S\n.S.S...S..\nW.......SS\n.W..W.....\n.W...W....\nS..S...S.S\n....W...S.\n..S..S.S.S\nSS.......S\n", "output": "Yes\nDDDDWDWDWD\nDDDDDDDDDS\nDSDSDDDSDD\nWDDDDDDDSS\nDWDDWDDDDD\nDWDDDWDDDD\nSDDSDDDSDS\nDDDDWDDDSD\nDDSDDSDSDS\nSSDDDDDDDS\n"}, {"type": "stdi... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.