messages listlengths 1 1 | ground_truth stringlengths 88 726k | dataset stringclasses 1
value |
|---|---|---|
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp has n dice d1, d2, ..., dn. The i-th dice shows numbers from 1 to di. 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 only the s... | [{"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\n"}, {"type": "stdin_stdout", "input": "10 20\n1 1 1 1 10 100 1 1 1 1\n", "output": "0 0 0 0 0 90 0 0 0 0"}, {"type": "stdin_stdout", "input": "10 20\n1 1 1 1 11 100 1 1 1 1\n", "output": "0 0 0 0 0 89 0 0 0 0"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the game takes place on an h Γ w field, and it is painted in two colors, but not like in chess. Almost all cells ... | [{"type": "stdin_stdout", "input": "100 10 30\n40 4\n15 3\n75 3\n88 10\n32 1\n16 5\n81 8\n45 2\n72 8\n11 6\n86 4\n50 2\n9 4\n11 1\n20 3\n47 3\n2 4\n68 3\n90 5\n85 2\n88 1\n88 5\n86 3\n70 9\n49 3\n34 4\n5 7\n77 5\n50 1\n87 5\n", "output": "402737011\n"}, {"type": "stdin_stdout", "input": "100 10 30\n40 4\n15 3\n75 3\n88... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office.\n\nAll children love to cry loudly at the reception at the dentist. We enumerate th... | [{"type": "stdin_stdout", "input": "10\n9 8 8\n2 9 33\n10 7 42\n7 2 18\n3 5 82\n9 9 25\n3 2 86\n3 5 49\n5 3 72\n4 4 71\n", "output": "10\n1 2 3 4 5 6 7 8 9 10 "}, {"type": "stdin_stdout", "input": "10\n9 8 8\n2 9 33\n10 7 42\n7 2 18\n3 5 82\n9 9 25\n3 2 86\n3 2 49\n5 3 72\n4 4 71\n", "output": "10\n1 2 3 4 5 6 7 8 9 10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys all beacons to its left (direction of decreasing coord... | [{"type": "stdin_stdout", "input": "11\n110 90\n100 70\n148 10\n80 10\n70 1\n60 1\n50 10\n40 1\n30 1\n10 1\n20 1\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "11\n110 61\n100 70\n90 10\n80 10\n70 1\n60 1\n50 10\n40 1\n30 1\n10 1\n20 1\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "11\n110 90\n100 7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLimak is a little polar bear. He has n balls, the i-th ball has size ti.\n\nLimak wants to give one ball to each of his three friends. Giving gifts isn't easy β there are two rules Limak must obey to make friends happy:\n... | [{"type": "stdin_stdout", "input": "50\n1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000\n", "output": "NO"}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe rules of Sith Tournament are well known to everyone. n Sith take part in the Tournament. The Tournament starts with the random choice of two Sith who will fight in the first battle. As one of them loses, his place is ... | [{"type": "stdin_stdout", "input": "7\n0.000000 0.311935 0.623164 0.667542 0.225988 0.921559 0.575083\n0.688065 0.000000 0.889215 0.651525 0.119843 0.635314 0.564710\n0.376836 0.110785 0.000000 0.583317 0.175043 0.795995 0.836790\n0.332458 0.348475 0.416683 0.000000 0.263615 0.469602 0.883191\n0.774012 0.880157 0.82495... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are three friend living on the straight line Ox in Lineland. The first friend lives at the point x1, the second friend lives at the point x2, and the third friend lives at the point x3. They plan to celebrate the Ne... | [{"type": "stdin_stdout", "input": "131 21 80\n", "output": "110\n"}, {"type": "stdin_stdout", "input": "138 23 56\n", "output": "115\n"}, {"type": "stdin_stdout", "input": "149 93 35\n", "output": "114\n"}, {"type": "stdin_stdout", "input": "29 97 147\n", "output": "118\n"}, {"type": "stdin_stdout", "input": "149 93 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJon fought bravely to rescue the wildlings who were attacked by the white-walkers at Hardhome. On his arrival, Sam tells him that he wants to go to Oldtown to train at the Citadel to become a maester, so he can return and... | [{"type": "stdin_stdout", "input": "1125899906842623 1125899906742623 1125899906842623\n", "output": "100001\n"}, {"type": "stdin_stdout", "input": "95173251245550 106288351347530 106288351372022\n", "output": "16565\n"}, {"type": "stdin_stdout", "input": "33534354842198 32529564319236 32529564342569\n", "output": "222... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n cities situated along the main road of Berland. Cities are represented by their coordinates β integer numbers a1, a2, ..., an. All coordinates are pairwise distinct.\n\nIt is possible to get from one city to a... | [{"type": "stdin_stdout", "input": "20\n105619866 106083760 106090730 105809555 106115212 105155938 105979518 106075627 106145216 105637844 105925719 105498536 105927000 106155938 106134226 106125969 106130588 105464813 106145509 106114971\n", "output": "241 1\n"}, {"type": "stdin_stdout", "input": "20\n105619866 10608... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn his trip to Luxor and Aswan, Sagheer went to a Nubian market to buy some souvenirs for his friends and relatives. The market has some strange rules. It contains n different items numbered from 1 to n. The i-th item has... | [{"type": "stdin_stdout", "input": "90 61394040\n2480 6212 4506 829 8191 797 5336 6722 3178 1007 5849 3061 3588 6684 5983 5452 7654 5321 660 2569 2809 2179 679 4858 6887 2580 6880 6120 4159 5542 4999 8703 2386 8221 7046 1229 1662 4542 7089 3548 4298 1973 1854 2473 5507 241 359 5248 7907 5201 9624 4596 1723 2622 4800 47... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour friend has n cards.\n\nYou know that each card has a lowercase English letter on one side and a digit on the other.\n\nCurrently, your friend has laid out the cards on a table so only one side of each card is visible... | [{"type": "stdin_stdout", "input": "kaq7jyialrfp4ilkni90eq8v3amcbygon7py0hb8z26fbl8ss1\n", "output": "13\n"}, {"type": "stdin_stdout", "input": "l3rw91a4m25l8iytxyeuixsegzcbm4h41ornf3pixkrmwznrzc\n", "output": "14\n"}, {"type": "stdin_stdout", "input": "qwertyuioplkjhgfdsazxcvbnmqwertyuioplkjhgfdsazxcvb\n", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nArcady is a copywriter. His today's task is to type up an already well-designed story using his favorite text editor.\n\nArcady types words, punctuation signs and spaces one after another. Each letter and each sign (inclu... | [{"type": "stdin_stdout", "input": "thun-thun-thunder, thunder, thunder\nthunder, thun-, thunder\nthun-thun-thunder, thunder\nthunder, feel the thunder\nlightning then the thunder\nthunder, feel the thunder\nlightning then the thunder\nthunder, thunder\n", "output": "183\n"}, {"type": "stdin_stdout", "input": "thun-thu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe stardate is 1977 and the science and art of detecting Death Stars is in its infancy. Princess Heidi has received information about the stars in the nearby solar system from the Rebel spies and now, to help her identif... | [{"type": "stdin_stdout", "input": "10\nXXXOXOOXXX\nOOXXOXXOXO\nOOOOXOOXOX\nXOOXOXOOXX\nXOXXOXOOXX\nOOOXXOXOXX\nOOOXOOOOXO\nOOXOOXXOXX\nXXOXOOXOOX\nOXXXOOXOXX\nXXOXOOXXXO\nXOOXOOXOXX\nXXOXXOOXOO\nOXOOOOXOOO\nXXOXOXXOOO\nXXOOXOXXOX\nXXOOXOXOOX\nXOXOOXOOOO\nOXOXXOXXOO\nXXXOOXOXXX\n", "output": "Yes\n"}, {"type": "stdin_s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMy flatmate, Sayan, once invited all his relatives and friends from all over the city to join him on his birthday party.\nHe is also famous for boasting that all his friends and relatives belong to \"proper\" families.\nN... | [{"type": "stdin_stdout", "input": "1\n899 188\n8 12 19 22 27 28 29 34 35 38 42 43 53 54 55 60 61 62 64 65 67 68 75 80 81 84 87 88 89 99 106 111 115 128 140 146 150 151 153 155 156 166 167 174 177 181 185 188 190 194 208 216 219 224 231 242 246 254 257 258 261 266 270 284 286 287 292 302 306 310 312 313 317 322 323 328... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Bear has received a home assignment to find the sum of all digits in a number N. Following his affinity towards single digit number, he intends to repeatedly compute the sum of all digits until the sum itself becom... | [{"type": "stdin_stdout", "input": "10\n99\n3925363 2\n2603576 6\n1234862 8\n1520732 1\n4483784 7\n7951627 7\n5033890 8\n7389953 2\n7757037 9\n9773067 8\n3635251 0\n5114761 8\n1307214 1\n2858867 7\n3249775 8\n629201 9\n730520 4\n2575426 1\n1862434 4\n5440118 4\n5414712 5\n7536692 5\n2483418 0\n6733653 7\n8914139 3\n508... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSingh is getting bored at work. He has a lot of ideas (N) to work on (as side projects) but is unable to choose one.\n\nHe chooses a random number (R) and lines up his ideas in a circle. He starts counting from first and ... | [{"type": "stdin_stdout", "input": "274 1100990", "output": "176\n"}, {"type": "stdin_stdout", "input": "507 1100990", "output": "150\n"}, {"type": "stdin_stdout", "input": "23 13769055", "output": "11\n"}, {"type": "stdin_stdout", "input": "39 18832367", "output": "13\n"}, {"type": "stdin_stdout", "input": "120 103385... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing oth... | [{"type": "stdin_stdout", "input": "1000010000000000000", "output": "3760\n"}, {"type": "stdin_stdout", "input": "1100010000000000000", "output": "3770\n"}, {"type": "stdin_stdout", "input": "1110000100001111000", "output": "3771\n"}, {"type": "stdin_stdout", "input": "1010010000000010000", "output": "3761\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N+1 towns. The i-th town is being attacked by A_i monsters.\n\nWe have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters.\n\nWhat is the maximum... | [{"type": "stdin_stdout", "input": "3\n0 34 -2 -1\n-1 111 14", "output": "30\n"}, {"type": "stdin_stdout", "input": "3\n0 14 -2 -1\n0 111 14", "output": "11\n"}, {"type": "stdin_stdout", "input": "3\n0 27 -2 -1\n0 111 14", "output": "24\n"}, {"type": "stdin_stdout", "input": "3\n0 27 -3 -1\n0 111 14", "output": "23\n"}... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string S of length N. Among its subsequences, count the ones such that all characters are different, modulo 10^9+7. Two subsequences are considered different if their characters come from different positio... | [{"type": "stdin_stdout", "input": "5\naabbc", "output": "17\n"}, {"type": "stdin_stdout", "input": "5\nabcda", "output": "23\n"}, {"type": "stdin_stdout", "input": "5\nbdacf", "output": "31\n"}, {"type": "stdin_stdout", "input": "5\nabcaa", "output": "15\n"}, {"type": "stdin_stdout", "input": "5\nabbaa", "output": "11... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given integers N and M.\n\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_... | [{"type": "stdin_stdout", "input": "000001 1010001101", "output": "1010001101\n"}, {"type": "stdin_stdout", "input": "000001 1010011101", "output": "1010011101\n"}, {"type": "stdin_stdout", "input": "000001 1110110010", "output": "1110110010\n"}, {"type": "stdin_stdout", "input": "000001 1110111010", "output": "1110111... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFind the smallest possible sum of the digits in the decimal notation of a positive multiple of K.\n\nConstraints\n\n* 2 \\leq K \\leq 10^5\n* K is an integer.\n\nInput\n\nInput is given from Standard Input in the followin... | [{"type": "stdin_stdout", "input": "10989", "output": "27\n"}, {"type": "stdin_stdout", "input": "79992", "output": "36"}, {"type": "stdin_stdout", "input": "37450", "output": "3\n"}, {"type": "stdin_stdout", "input": "70620", "output": "6\n"}, {"type": "stdin_stdout", "input": "11849", "output": "5\n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are a total of W x H squares, with H rows vertically and W columns horizontally. Some squares are marked. Create a program that reads the marked state of each square and outputs the maximum rectangular area consisti... | [{"type": "stdin_stdout", "input": "10 10\n...*....**\n..........\n**....**..\n........*.\n..*.......\n**........\n.*........\n..........\n....*..***\n.*....*...\n10 10\n..*....*..\n.*.*...*..\n*****..*..\n*...*..*..\n*...*..*..\n..........\n.***.*..**\n..*..*...*\n.*...*...*\n****..***.\n2 3\n...\n...\n0 0", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n sheets of square paper of the same size. Align the bottom of these papers horizontally and arrange them in several rows. However, adjacent rows must be arranged so that the left side is not lower than the righ... | [{"type": "stdin_stdout", "input": "5\n29\n0", "output": "5\n4 1\n3 2\n3 1 1\n2 2 1\n2 1 1 1\n1 1 1 1 1\n29\n28 1\n27 2\n27 1 1\n26 3\n26 2 1\n26 1 1 1\n25 4\n25 3 1\n25 2 2\n25 2 1 1\n25 1 1 1 1\n24 5\n24 4 1\n24 3 2\n24 3 1 1\n24 2 2 1\n24 2 1 1 1\n24 1 1 1 1 1\n23 6\n23 5 1\n23 4 2\n23 4 1 1\n23 3 3\n23 3 2 1\n23 3 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMathematical expressions appearing in old papers and old technical articles are printed with typewriter in several lines, where a fixed-width or monospaced font is required to print characters (digits, symbols and spaces)... | [{"type": "stdin_stdout", "input": "4\n........4...2..........\n(.1.-.----.)..*.-.5.+.6\n........2..............\n.......3...............\n3\n...3.\n-.---\n...4.\n4\n.3.+.4.*.-.2.\n-------------\n..........2..\n...-.1.-.2...\n2\n...2..3\n(.4..).\n1\n2.+.3.*.5.-.7.+.9\n1\n(.2.+.3.).*.(.5.-.7.).+.9\n3\n.2....3.\n4..+.---... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHeiankyo is known as a town with a grid of roads.\n\nHokusai, a cat who lives in Heiankyo, has to go from his home to a secret place on the outskirts of town every day for patrol. However, I get tired of following the sam... | [{"type": "stdin_stdout", "input": "4\n0 2\n0\n1 2\n2\n0 0 0 1\n0 0 1 0\n4 0\n4\n1 0 0 0\n3 5 2 3\n4 0 4 0\n0 2 0 4\n15 5\n0", "output": "1\nMiserable Hokusai!\nMiserable Hokusai!\n15504\n"}, {"type": "stdin_stdout", "input": "4\n2 2\n0\n1 2\n2\n0 0 0 1\n0 0 1 0\n4 0\n4\n1 0 0 0\n3 3 2 3\n4 0 4 0\n0 2 0 3\n15 3\n0", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nToday's Random Number\n\nE869120 You ran a campaign called \"Today's Random Numbers\" for N days. This is a project to generate a random number once a day and post the value on Twitter.\n\nThe \"random numbers of the day\... | [{"type": "stdin_stdout", "input": "5\n15 -1 21 0 20", "output": "2\n"}, {"type": "stdin_stdout", "input": "5\n15 -1 21 0 22", "output": "2\n"}, {"type": "stdin_stdout", "input": "5\n-2 -1 -1 14 2", "output": "2\n"}, {"type": "stdin_stdout", "input": "5\n-2 -1 -1 21 2", "output": "2\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNatasha travels around Mars in the Mars rover. But suddenly it broke down, namely β the logical scheme inside it. The scheme is an undirected tree (connected acyclic graph) with a root in the vertex 1, in which every leaf... | [{"type": "stdin_stdout", "input": "60\nAND 20 4\nNOT 42\nAND 48 59\nOR 17 7\nIN 0\nAND 36 37\nIN 1\nIN 0\nIN 1\nNOT 47\nAND 52 49\nOR 44 35\nIN 0\nIN 1\nAND 33 56\nIN 0\nIN 0\nIN 0\nAND 31 41\nOR 15 3\nOR 43 46\nIN 1\nXOR 22 28\nIN 1\nIN 1\nIN 1\nAND 34 21\nIN 0\nIN 1\nIN 0\nXOR 51 23\nXOR 10 54\nOR 57 40\nIN 0\nNOT 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\n"}, {"type": "stdin_stdout", "input": "10\n1 2 2 4 5 5 6 1 7\n", "output": "1 2 4 5 7 10\n"}, {"type": "stdin_stdout", "input": "10\n1 2 2 4 5 5 9 1 7\n", "output": "1 2 4 5 7 10\n"}, {"type": "stdin_stdout", "input": "10\n1 2 2 4 5 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.\n\... | [{"type": "stdin_stdout", "input": "100\n3 2 4 2 2 2 3 1 2 3 1 4 1 4 1 2 3 3 3 2 3 1 2 1 2 3 3 4 2 3 1 4 2 1 4 3 1 1 3 2 1 1 4 1 1 4 4 2 2 3 4 4 1 4 3 1 3 1 4 3 2 1 2 4 4 2 2 1 4 2 2 2 3 3 2 2 3 2 2 1 2 3 2 1 4 1 1 1 2 3 2 4 1 1 3 4 2 1 1 1\n", "output": "189\n96 1\n1 8\n8 2\n2 11\n11 3\n3 13\n13 4\n4 15\n15 5\n5 22\n2... | 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), β¦, (a_m, b_m). \n\nHe asks you to check if there exist two integers x and y (1 β€ x < y β€ n) such that in... | [{"type": "stdin_stdout", "input": "10 10\n1 3\n1 3\n1 3\n1 3\n1 3\n2 3\n1 5\n2 7\n2 7\n2 9\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "10 10\n1 3\n1 3\n1 3\n1 3\n1 3\n2 3\n1 5\n2 3\n2 7\n2 9\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "10 10\n1 3\n1 3\n1 3\n1 4\n1 3\n2 3\n1 5\n2 7\n2 7\n2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOmkar is building a house. He wants to decide how to make the floor plan for the last floor.\n\nOmkar's floor starts out as n rows of m zeros (1 β€ n,m β€ 100). Every row is divided into intervals such that every 0 in the r... | [{"type": "stdin_stdout", "input": "21 16\n6\n1 7\n8 8\n9 9\n10 12\n13 15\n16 16\n3\n1 1\n2 8\n9 16\n2\n1 13\n14 16\n3\n1 9\n10 13\n14 16\n3\n1 2\n3 15\n16 16\n2\n1 15\n16 16\n4\n1 6\n7 11\n12 13\n14 16\n4\n1 1\n2 10\n11 15\n16 16\n4\n1 7\n8 9\n10 13\n14 16\n3\n1 2\n3 10\n11 16\n2\n1 9\n10 16\n2\n1 2\n3 16\n3\n1 2\n3 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHave you ever used the chat application QQ? Well, in a chat group of QQ, administrators can muzzle a user for days.\n\nIn Boboniu's chat group, there's a person called Du Yi who likes to make fun of Boboniu every day.\n\n... | [{"type": "stdin_stdout", "input": "100 61 71\n11 18 0 47 33 75 91 13 8 21 73 64 50 97 62 50 2 36 68 32 64 74 32 77 81 41 23 44 40 36 45 33 21 68 57 79 75 23 67 37 99 27 30 56 75 62 75 63 46 19 79 42 11 66 21 25 2 12 89 48 75 7 57 85 80 14 82 29 66 47 29 10 1 84 79 39 33 81 73 51 80 67 52 25 38 68 57 53 38 83 83 3 86 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n detachments on the surface, numbered from 1 to n, the i-th detachment is placed in a point with coordinates (x_i, y_i). All detachments are placed in different points.\n\nBrimstone should visit each detachment... | [{"type": "stdin_stdout", "input": "23\n-1000000000 -964752353\n-967012509 -1000000000\n34021744 1000000000\n-931956512 -34021744\n-1034253 967204159\n-1034253 -34021744\n-1034253 -1000000000\n-931956512 -1000000000\n-967012509 1000000000\n964944003 1225903\n1000000000 1225903\n-967012509 1225903\n-1034253 -964752353\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a positive (greater than zero) integer n.\n\nYou have to represent n as the sum of integers (possibly negative) consisting only of ones (digits '1'). For example, 24 = 11 + 11 + 1 + 1 and 102 = 111 - 11 + 1 ... | [{"type": "stdin_stdout", "input": "61728395061728395061728395061728395061345382132589\n", "output": "5012\n"}, {"type": "stdin_stdout", "input": "80460506176325884697749506233871685211117789752006\n", "output": "3588\n"}, {"type": "stdin_stdout", "input": "72917818180005527197542750304849028146262772062284\n", "output... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a card deck of n cards, numbered from top to bottom, i. e. the top card has index 1 and bottom card β index n. Each card has its color: the i-th card has color a_i.\n\nYou should process q queries. The j-th query... | [{"type": "stdin_stdout", "input": "5 15\n1 2 3 4 5\n5 5 5 5 5 5 5 5 5 5 5 5 5 5 5\n", "output": "5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 "}, {"type": "stdin_stdout", "input": "5 15\n1 2 3 4 5\n5 5 5 5 5 5 5 5 2 5 5 5 5 5 5\n", "output": "5 1 1 1 1 1 1 1 3 2 1 1 1 1 1 "}, {"type": "stdin_stdout", "input": "5 15\n1 2 3 4 5\n5 5 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n people participating in some contest, they start participating in x minutes intervals. That means the first participant starts at time 0, the second participant starts at time x, the third β at time 2 β
x, and... | [{"type": "stdin_stdout", "input": "10\n2000000000 2000000000 2000000000\n2000000000 1 2000000000\n2000000000 1 1999999998\n1999999990 1 2000000000\n1033089747 3 2000000000\n2000000000 1520188178 1999999998\n1 1 0\n99990 10 1000000\n100000 20000 2000000000\n998 1 2000000000\n", "output": "1999999999\n199999999900000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs you very well know, the whole Universe traditionally uses three-dimensional Cartesian system of coordinates. In this system each point corresponds to three real coordinates (x, y, z). In this coordinate system, the dis... | [{"type": "stdin_stdout", "input": "1\n1000 1010 1000\n", "output": "0.33222591362126247 0.33554817275747506 0.33222591362126247\n"}, {"type": "stdin_stdout", "input": "1\n1000 1011 1000\n", "output": "0.33211557622052473 0.33576884755895053 0.33211557622052473\n"}, {"type": "stdin_stdout", "input": "1000\n1319 1000 99... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Little Elephant loves permutations of integers from 1 to n very much. But most of all he loves sorting them. To sort a permutation, the Little Elephant repeatedly swaps some elements. As a result, he must receive a pe... | [{"type": "stdin_stdout", "input": "125 8\n111 69 3 82 24 38 4 39 42 22 92 6 16 10 8 45 17 91 84 53 5 46 124 47 18 57 43 73 114 102 121 105 118 95 104 98 72 20 56 60 123 80 103 70 65 107 67 112 101 108 99 49 12 94 2 68 119 109 59 40 86 116 88 63 110 14 13 120 41 64 89 71 15 35 81 51 113 90 55 122 1 75 54 33 28 7 125 9 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou're a mikemon breeder currently in the middle of your journey to become a mikemon master. Your current obstacle is go through the infamous Biridian Forest.\n\nThe forest\n\nThe Biridian Forest is a two-dimensional grid... | [{"type": "stdin_stdout", "input": "9 8\n38030772\n697T83S2\n8T626741\n86T02062\n05402864\nT7504180\n3T368E08\n90637446\n12709560\n", "output": "195\n"}, {"type": "stdin_stdout", "input": "9 8\n38030772\n697T83S2\n8T626741\n86T02062\n05402864\nT7504180\n3T368E08\n90637446\n12793622\n", "output": "197\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day Jeff got hold of an integer sequence a1, a2, ..., an of length n. The boy immediately decided to analyze the sequence. For that, he needs to find all values of x, for which these conditions hold:\n\n * x occurs i... | [{"type": "stdin_stdout", "input": "12\n10 19 7 3 1 8 15 17 14 9 4 5\n", "output": "12\n1 0\n3 0\n4 0\n5 0\n7 0\n8 0\n9 0\n10 0\n14 0\n15 0\n17 0\n19 0\n"}, {"type": "stdin_stdout", "input": "12\n10 19 7 3 1 8 15 17 14 15 4 5\n", "output": "11\n1 0\n3 0\n4 0\n5 0\n7 0\n8 0\n10 0\n14 0\n15 3\n17 0\n19 0\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVanya got n cubes. He decided to build a pyramid from them. Vanya wants to build the pyramid as follows: the top level of the pyramid must consist of 1 cube, the second level must consist of 1 + 2 = 3 cubes, the third lev... | [{"type": "stdin_stdout", "input": "10001\n", "output": "38\n"}, {"type": "stdin_stdout", "input": "10000\n", "output": "38"}, {"type": "stdin_stdout", "input": "8333\n", "output": "35\n"}, {"type": "stdin_stdout", "input": "5943\n", "output": "31\n"}, {"type": "stdin_stdout", "input": "1802\n", "output": "21\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya collects coins: he has exactly one coin for every year from 1 to n. Naturally, Vasya keeps all the coins in his collection in the order in which they were released. Once Vasya's younger brother made a change β he to... | [{"type": "stdin_stdout", "input": "149\n9 120 122 97 93 70 85 56 102 16 103 112 88 84 118 135 113 62 65 19 89 15 108 73 82 21 147 27 115 130 136 6 1 90 29 94 149 17 53 132 99 123 64 95 71 67 141 126 59 8 10 114 121 134 107 87 128 79 66 55 72 39 31 111 60 137 2 4 23 129 133 47 12 54 100 77 98 30 86 125 11 5 45 148 57 4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given n segments on the coordinate axis Ox and the number k. The point is satisfied if it belongs to at least k segments. Find the smallest (by the number of segments) set of segments on the coordinate axis Ox whi... | [{"type": "stdin_stdout", "input": "10 1\n-260424665 -168566709\n299109864 663179811\n769984405 942516913\n-998905510 -707148023\n-167958021 60599275\n658861231 718845364\n79407402 279078536\n13652788 79756488\n-676213666 -339118351\n-349156760 -258185154\n", "output": "5\n-998905510 -707148023\n-676213666 -168566709\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEvery Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower be... | [{"type": "stdin_stdout", "input": "50\n67 1\n89 2\n83 1\n-26 1\n88 2\n-22 2\n-98 2\n-83 1\n58 2\n26 2\n-37 1\n-51 2\n29 1\n47 2\n-70 1\n81 2\n36 1\n52 2\n93 2\n-12 2\n-12 1\n5 2\n91 1\n3 1\n-27 1\n18 1\n-60 1\n-15 1\n17 1\n-33 1\n-74 2\n5 2\n-62 2\n72 1\n-22 1\n-58 1\n-9 1\n57 1\n-18 2\n-11 1\n-103 2\n74 2\n-20 2\n21 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPupils decided to go to amusement park. Some of them were with parents. In total, n people came to the park and they all want to get to the most extreme attraction and roll on it exactly once.\n\nTickets for group of x pe... | [{"type": "stdin_stdout", "input": "100 1000 1000\n0000010100101100110100101111001111111111100101111100111011110001011110110111111010000000101000111000\n", "output": "100000\n"}, {"type": "stdin_stdout", "input": "100 1000 1001\n0000010100101100110100101111001111111111100101111100111011110001011110110111111010000000101... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn some game by Playrix it takes t minutes for an oven to bake k carrot cakes, all cakes are ready at the same moment t minutes after they started baking. Arkady needs at least n cakes to complete a task, but he currently... | [{"type": "stdin_stdout", "input": "1000 1000 1000 1000\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1000 1000 1001 1000\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1000 1000 1 1000\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "1000 1001 1 1000\n", "output": "YES\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSometimes Mister B has free evenings when he doesn't know what to do. Fortunately, Mister B found a new game, where the player can play against aliens.\n\nAll characters in this game are lowercase English letters. There a... | [{"type": "stdin_stdout", "input": "12 12 876543210 1000000000\n", "output": "13\n"}, {"type": "stdin_stdout", "input": "10 12 220000011 220000032\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "5 10 1000000000 1000000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "11 3 378541409 1077499882\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is an interactive problem.\n\nYou are given a sorted in increasing order singly linked list. You should find the minimum integer in the list which is greater than or equal to x.\n\nMore formally, there is a singly li... | [{"type": "stdin_stdout", "input": "10 3 632584719\n378382911 9\n978367651 -1\n176599346 7\n557138623 8\n441019502 4\n823417558 2\n244832688 10\n702148024 6\n385598339 5\n357778234 1\n", "output": "? 3\n? 9\n! 978367651\n"}, {"type": "stdin_stdout", "input": "10 3 632584719\n378382911 9\n978367651 -1\n176599346 7\n5571... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAttention: we lost all the test cases for this problem, so instead of solving the problem, we need you to generate test cases. We're going to give you the answer, and you need to print a test case that produces the given ... | [{"type": "stdin_stdout", "input": "100000\n", "output": "199998 2\n1 2\n"}, {"type": "stdin_stdout", "input": "99991\n", "output": "199980 2\n1 2\n"}, {"type": "stdin_stdout", "input": "99992\n", "output": "199982 2\n1 2\n"}, {"type": "stdin_stdout", "input": "99971\n", "output": "199940 2\n1 2\n"}, {"type": "stdin_st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are preparing for an exam on scheduling theory. The exam will last for exactly T milliseconds and will consist of n problems. You can either solve problem i in exactly ti milliseconds or ignore it and spend no time. Y... | [{"type": "stdin_stdout", "input": "10 481\n6 25\n0 85\n8 96\n6 7\n1 16\n4 32\n2 5\n3 42\n9 126\n7 70\n", "output": "5\n5\n4 1 10 3 9"}, {"type": "stdin_stdout", "input": "10 481\n6 25\n0 85\n8 96\n6 7\n1 16\n4 32\n2 9\n3 42\n9 126\n7 70\n", "output": "5\n5\n4 1 10 3 9"}, {"type": "stdin_stdout", "input": "10 481\n6 25... | 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 <image> to write on the walls of the temples. Fafa and Fifa went to one of the temples and found two non-empty words S1 and S2 of equal lengths on the wall o... | [{"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\nMagnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were ... | [{"type": "stdin_stdout", "input": "3\n101\n010\n101\n\n101\n010\n101\n\n101\n010\n101\n\n101\n010\n101\n", "output": "18\n"}, {"type": "stdin_stdout", "input": "3\n000\n000\n000\n\n111\n111\n111\n\n111\n111\n111\n\n000\n000\n000\n", "output": "16\n"}, {"type": "stdin_stdout", "input": "3\n101\n010\n101\n\n101\n010\n10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWalking along a riverside, Mino silently takes a note of something.\n\n\"Time,\" Mino thinks aloud.\n\n\"What?\"\n\n\"Time and tide wait for no man,\" explains Mino. \"My name, taken from the river, always reminds me of t... | [{"type": "stdin_stdout", "input": "128 108\n01100.110...000.0001.1.11.11.010010.01100.0.1.01.0.0011.11001.000101...1.0.0..100.0110.0110.0.0101.0.0.0001.01100.110...100.0001\n", "output": "01100011000000000001010110110010010001100000100100000110110010000101000100000010000110001100000101000000001001100111011110010001\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA particular name-recording system is used by N employees of a firm. Everyday, they have to enter their names into the system.\n\nTo make it easier to control the system, each employee has his/her name presented as a stri... | [{"type": "stdin_stdout", "input": "10\n100 12\nytdaebgvxwcv\nesqdzhghepjd\nauatffaboemo\nppmwbbkruczy\nybktiiniqdxy\nkoyvegambcby\ndeuacvpcncem\ndexcuwvrblyj\ntvcvbyvofdtb\ndxdzymuxymbg\nweupfgkewdpj\ngtdqvgybjaqy\nfbcfyvsccahy\nesbwylzqscvy\ndgtaaolcxadg\ndgrhcnaaysqs\nczyfvilexdpv\nfbdgbaejbhvv\nshxfzvlaiwel\nwpcnvb... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRoy has played a lot of Mario that he got bored of playing it again and again. So now he wants to design a stage of Mario game.\n\nRight now he is simply designing a group of walls using bricks that little Mario has to cr... | [{"type": "stdin_stdout", "input": "1\n48\n\nFKQUAM", "output": "171507379\n"}, {"type": "stdin_stdout", "input": "1\n49\n\nAKOFTM", "output": "568701031\n"}, {"type": "stdin_stdout", "input": "1\n42\n\nSDAPLM", "output": "641778114\n"}, {"type": "stdin_stdout", "input": "1\n45\n\nAKPFSM", "output": "774313734\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAnton and Artur are old friends. Today they practice in writing strings. Anton must write each string with the lengths exactly N , based on the alphabet of size M . And Arthur, on the contrary, should write each string ... | [{"type": "stdin_stdout", "input": "3\n1 1\n1 1\n100 1393\n\nEAPMLS", "output": "YES\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "3\n1 1\n1 1\n101 1393\n\nEAPMLS", "output": "YES\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "3\n2 4\n1 1\n101 1393\n\nRLMPAE", "output": "YES\nYES\nNO\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\n* Fr... | [{"type": "stdin_stdout", "input": "1359", "output": "4\n"}, {"type": "stdin_stdout", "input": "1855", "output": "1\n"}, {"type": "stdin_stdout", "input": "1485", "output": "3\n"}, {"type": "stdin_stdout", "input": "1125", "output": "5\n"}, {"type": "stdin_stdout", "input": "1764", "output": "2\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is a positive integer L. Find the maximum possible volume of a rectangular cuboid whose sum of the dimensions (not necessarily integers) is L.\n\nConstraints\n\n* 1 β€ L β€ 1000\n* L is an integer.\n\nInput\n\nInput i... | [{"type": "stdin_stdout", "input": "999", "output": "36926037.000000000000"}, {"type": "stdin_stdout", "input": "-143", "output": "-108303.962963\n"}, {"type": "stdin_stdout", "input": "-188", "output": "-246098.962963\n"}, {"type": "stdin_stdout", "input": "-1", "output": "-0.037037037037\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nX and A are integers between 0 and 9 (inclusive).\n\nIf X is less than A, print 0; if X is not less than A, print 10.\n\nConstraints\n\n* 0 \\leq X, A \\leq 9\n* All values in input are integers.\n\nInput\n\nInput is give... | [{"type": "stdin_stdout", "input": "11 -1", "output": "10\n"}, {"type": "stdin_stdout", "input": "10 -1", "output": "10\n"}, {"type": "stdin_stdout", "input": "19 -1", "output": "10\n"}, {"type": "stdin_stdout", "input": "-1 -1", "output": "10\n"}, {"type": "stdin_stdout", "input": "10 -2", "output": "10\n"}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters.\n\nOur objective is to make all these three strings equal. For that, you can repeatedly perform the fo... | [{"type": "stdin_stdout", "input": "9\ncjfferent\ndifferent\ntnereffid", "output": "10\n"}, {"type": "stdin_stdout", "input": "9\ntneredfic\nciffeernt\ndifferent", "output": "11\n"}, {"type": "stdin_stdout", "input": "9\ntnedergia\ncifreefnt\ndifsnfeet", "output": "14\n"}, {"type": "stdin_stdout", "input": "9\ntnedergi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi has decided to distribute N AtCoder Crackers to K users of as evenly as possible. When all the crackers are distributed, find the minimum possible (absolute) difference between the largest number of crackers rec... | [{"type": "stdin_stdout", "input": "111 136", "output": "1\n"}, {"type": "stdin_stdout", "input": "110 112", "output": "1\n"}, {"type": "stdin_stdout", "input": "011 127", "output": "1\n"}, {"type": "stdin_stdout", "input": "100 13", "output": "1\n"}, {"type": "stdin_stdout", "input": "000 16", "output": "0\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N balls in the xy-plane. The coordinates of the i-th of them is (x_i, i). Thus, we have one ball on each of the N lines y = 1, y = 2, ..., y = N.\n\nIn order to collect these balls, Snuke prepared 2N robots, N o... | [{"type": "stdin_stdout", "input": "5\n20\n14 12 16 17 15", "output": "52\n"}, {"type": "stdin_stdout", "input": "5\n20\n14 10 16 17 15", "output": "56\n"}, {"type": "stdin_stdout", "input": "5\n20\n14 10 20 17 15", "output": "48\n"}, {"type": "stdin_stdout", "input": "5\n20\n14 18 20 17 15", "output": "32\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThree poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles beautiful if the tops of the poles lie on the same line, that is, b-a = c-b.... | [{"type": "stdin_stdout", "input": "-1 -1 -1", "output": "YES\n"}, {"type": "stdin_stdout", "input": "-2 -3 -4", "output": "YES\n"}, {"type": "stdin_stdout", "input": "-1 -2 -1", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-1 -3 -1", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-2 -4 -1", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven a sequence of numbers a1, a2, a3, ..., an, find the maximum sum of a contiguous subsequence of those numbers. Note that, a subsequence of one element is also a contiquous subsequence.\n\n\n\nInput\n\nThe input consi... | [{"type": "stdin_stdout", "input": "7\n-4\n-4\n6\n14\n15\n-8\n-14\n13\n1\n0\n3\n2\n-3\n-1\n1\n1\n5\n3\n0\n-6\n2\n3\n1100\n-200\n145\n0", "output": "35\n12\n1100\n"}, {"type": "stdin_stdout", "input": "7\n-5\n-4\n6\n8\n15\n-6\n-12\n13\n1\n2\n3\n2\n-2\n-1\n1\n1\n3\n2\n0\n-4\n2\n3\n1100\n-200\n145\n0", "output": "29\n12\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCreate a program to determine the positional relationship between a triangle and a circle on a plane. All target figures shall include boundaries. The triangle is given the position of three vertices, and the circle is gi... | [{"type": "stdin_stdout", "input": "1 1\n6 0\n3 3\n3 0\n3\n3 11\n1 3\n11 16\n12 4\n5\n15 4\n17 12\n22 5\n7 22\n3\n5 13\n16 2\n16 9\n5 3\n1\n0 0", "output": "b\nd\nd\nd\n"}, {"type": "stdin_stdout", "input": "1 1\n6 0\n3 3\n3 2\n3\n3 11\n1 3\n11 16\n12 7\n5\n15 3\n17 7\n22 5\n7 12\n4\n5 13\n13 2\n16 9\n5 3\n2\n0 0", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWelcome to PC Koshien, players. At PC Koshien, competitions are currently being held in a total of three categories: programming category, mobile category, and Ichimai's picture CG category.\n\nGiven the number of partici... | [{"type": "stdin_stdout", "input": "0000 1000 1000", "output": "2000\n"}, {"type": "stdin_stdout", "input": "0000 0000 1000", "output": "1000\n"}, {"type": "stdin_stdout", "input": "0001 0000 1000", "output": "1001\n"}, {"type": "stdin_stdout", "input": "0101 0000 1000", "output": "1101\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nThere are fine icicles under the eaves of JOI's house in Canada. Because of this, JOI decided to investigate the icicles.\n\nThere are N (2 β€ N β€ 100000 = 105) icicles under the eaves of JOI's house. These icic... | [{"type": "stdin_stdout", "input": "1 56\n4\n-1\n-1\n-1", "output": "52\n"}, {"type": "stdin_stdout", "input": "2 71\n14\n6\n0\n0", "output": "122\n"}, {"type": "stdin_stdout", "input": "2 30\n14\n6\n3\n0", "output": "40\n"}, {"type": "stdin_stdout", "input": "2 17\n2\n3\n3\n-1", "output": "29\n"}, {"type": "stdin_stdo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEvil organizations that attempt to conquer the world are everywhere, regardless of age, east or west fiction, non-fiction, but what on earth did they try to conquer the world? I suddenly thought about that because I was a... | [{"type": "stdin_stdout", "input": "4\n0.200 3 1.3409251190635834\n0.38744720010760914 0 0.400\n0.900 1 1.000\n0.400 2 0.902270275623373\n2\n1.4849846876484776 1 1.1947768336367894\n0.500 0 1.000\n9\n0.200 7 0.600\n0.400 0 0.500\n1.540928395286643 8 1.727681009880635\n0.100 4 0.400\n0.200 2 0.600\n0.100 6 1.20624050513... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nGaccho owns an N-sided field and M potatoes. Each field is numbered from 1 to N. Gaccho wants to increase the number of potatoes by planting and harvesting potatoes in the field.\n\nGaccho lives alone and can o... | [{"type": "stdin_stdout", "input": "5 100 3\n2 2 4 5 100\n50 40 20 10 1", "output": "309\n"}, {"type": "stdin_stdout", "input": "5 100 3\n2 2 4 5 110\n50 40 20 10 1", "output": "319\n"}, {"type": "stdin_stdout", "input": "5 110 3\n2 2 4 5 110\n50 40 20 10 1", "output": "329\n"}, {"type": "stdin_stdout", "input": "5 110... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a grid that consists of W \\times H cells. The upper-left-most cell is (1, 1). You are standing on the cell of (1,1) and you are going to move to cell of (W, H). You can only move to adjacent lower-left, lower or... | [{"type": "stdin_stdout", "input": "2 4 1\n2 2\n2 11 0\n2 2\n0 0 0", "output": "Case 1: 2\nCase 2: 512\nCase 3: 1\n"}, {"type": "stdin_stdout", "input": "5 9 1\n2 1\n4 3 0\n2 2\n0 0 0", "output": "Case 1: 195\nCase 2: 0\nCase 3: 1\n"}, {"type": "stdin_stdout", "input": "2 9 1\n2 1\n4 3 0\n2 2\n0 0 0", "output": "Case 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a tree $T$ and an integer $K$. You can choose arbitrary distinct two vertices $u$ and $v$ on $T$. Let $P$ be the simple path between $u$ and $v$. Then, remove vertices in $P$, and edges such that one or both... | [{"type": "stdin_stdout", "input": "12 2\n1 2\n2 3\n3 4\n4 5\n3 6\n6 7\n7 8\n8 9\n2 10\n10 11\n11 12", "output": "3\n"}, {"type": "stdin_stdout", "input": "12 0\n1 2\n2 3\n3 4\n4 5\n3 6\n6 7\n7 8\n8 9\n6 10\n10 11\n11 12", "output": "4\n"}, {"type": "stdin_stdout", "input": "12 2\n1 2\n2 3\n3 4\n4 5\n3 6\n6 7\n7 8\n3 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFind places where a string P is found within a text T. Print all indices of T where P found. The indices of T start with 0.\n\nConstraints\n\n* 1 β€ length of T β€ 1000\n* 1 β€ length of P β€ 1000\n* The input consists of alp... | [{"type": "stdin_stdout", "input": "aaaaaa\naa", "output": "0\n1\n2\n3\n4\n"}, {"type": "stdin_stdout", "input": "aaaaab\naa", "output": "0\n1\n2\n3\n"}, {"type": "stdin_stdout", "input": "`aaaaa\naa", "output": "1\n2\n3\n4\n"}, {"type": "stdin_stdout", "input": "aaabaa\naa", "output": "0\n1\n4\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads a rectangle and a circle, and determines whether the circle is arranged inside the rectangle. As shown in the following figures, the upper right coordinate $(W, H)$ of the rectangle and the cen... | [{"type": "stdin_stdout", "input": "-2 -1 0 10 -18", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-2 -1 0 11 -18", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-2 1 3 10 -18", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-2 0 3 10 -18", "output": "Yes\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a ternary string (it is a string which consists only of characters '0', '1' and '2').\n\nYou can swap any two adjacent (consecutive) characters '0' and '1' (i.e. replace \"01\" with \"10\" or vice versa) or ... | [{"type": "stdin_stdout", "input": "100022202\n", "output": "000122202\n"}, {"type": "stdin_stdout", "input": "11222121\n", "output": "11112222\n"}, {"type": "stdin_stdout", "input": "2112120\n", "output": "1112220\n"}, {"type": "stdin_stdout", "input": "100210\n", "output": "001120\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a of length n that consists of zeros and ones.\n\nYou can perform the following operation multiple times. The operation consists of two steps: \n\n 1. Choose three integers 1 β€ x < y < z β€ n, that ... | [{"type": "stdin_stdout", "input": "125\n1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0\n", "output": "YES\n26\n120 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEgor came up with a new chips puzzle and suggests you to play.\n\nThe puzzle has the form of a table with n rows and m columns, each cell can contain several black or white chips placed in a row. Thus, the state of the ce... | [{"type": "stdin_stdout", "input": "2 3\n0 0 0\n011 1 0\n0 0 1\n011 0 0\n", "output": "28\n1 2 1 1\n1 3 1 1\n2 1 1 1\n2 1 1 1\n2 1 1 1\n1 1 1 2\n1 1 1 2\n1 1 1 2\n1 1 2 1\n1 1 2 1\n1 1 1 2\n2 2 2 1\n2 3 1 3\n1 3 1 2\n1 2 1 3\n1 3 2 3\n1 2 2 2\n2 1 1 1\n2 1 1 1\n1 2 1 1\n2 1 1 1\n1 2 1 1\n1 2 1 1\n1 1 2 1\n1 1 2 1\n1 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has a tree consisting of n vertices with root in vertex 1. At first all vertices has 0 written on it.\n\nLet d(i, j) be the distance between vertices i and j, i.e. number of edges in the shortest path from i to j. A... | [{"type": "stdin_stdout", "input": "19\n2 1\n3 2\n4 1\n5 1\n6 5\n7 4\n8 1\n9 2\n10 9\n11 9\n12 4\n13 10\n14 2\n15 9\n16 6\n17 13\n18 16\n19 8\n23\n16 259531913 13\n9 484727538 7\n2 174952922 9\n16 555559835 9\n4 835692337 2\n5 656716001 1\n11 981357393 3\n1 281380171 17\n6 150928639 18\n19 431687604 19\n9 609377645 1\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n\n\nInput\n\nThe input contains a single integer a (1 β€ a β€ 99).\n\nOutput\n\nOutput \"YES\" or \"NO\".\n\nExamples\n\nInput\n\n\n5\n\n\nOutput\n\n\nYES\n\n\nInput\n\n\n13\n\n\nOutput\n\n\nNO\n\n\nInput\n\n\n24\n\n\nOutpu... | [{"type": "stdin_stdout", "input": "011\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "010\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "46\n", "output": "YES"}, {"type": "stdin_stdout", "input": "43\n", "output": "YES"}, {"type": "stdin_stdout", "input": "30\n", "output": "YES"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n students in the first grade of Nlogonia high school. The principal wishes to split the students into two classrooms (each student must be in exactly one of the classrooms). Two distinct students whose name sta... | [{"type": "stdin_stdout", "input": "20\ngrkbifiedubnohaektjo\nizxghhzkwfpbsmfsrvzr\njjkvyqppaqotfnqkogvs\ngphjvgjewixdzonunipv\nilfwfngxaiwutzafueot\nirbntjytnvppbgyyllmk\njotpbafckwsufccigskt\njbzfmhjzeoxruiebctsj\nijvxpeybbhrezjuajkkp\njdqriujmuvcvphlcsxfm\nykwqjokeljlnyqpirlvp\nyhcczukakwarzzloccim\nmmygnzejmxmoksms... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is the length of the string.\n\nYou are given a string s and a string t, both consisting only of lowercase Latin letters. It is guaranteed that t can be obtained from s b... | [{"type": "stdin_stdout", "input": "izoiweukqszkkhwapzxyotbaarpqxbybsjxilhylbbjbvoedrezyluaabsfzvtxxvncdwxrlfdtfvbfoqwlzqwneimwzpoygfdcldmxdhoxzensxlspituzocvzzrfomhggrwurdccgfoorvhyzsdkpjhwakuoxwdjhzaalanyzwuuqwlrtmvmdraleyusjqdyxuztvc\nizoiweukqszkkhwapzxyotbaarpqxbybsjxilhylbbjbvoedrezyluaabsfzvtxxvncdwxrlfdtfvbfoqw... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhen Serezha was three years old, he was given a set of cards with letters for his birthday. They were arranged into words in the way which formed the boy's mother favorite number in binary notation. Serezha started playi... | [{"type": "stdin_stdout", "input": "400\nzzzerrzrzzrozrezooreroeoeezerrzeerooereezeeererrezrororoorrzezoeerrorzrezzrzoerrzorrooerzrzeozrrorzzzzeoeereeroeozezeozoozooereoeorrzoroeoezooeerorreeorezeozeroerezoerooooeerozrrorzozeroereerozeozeoerroroereeeerzzrzeeozrezzozeoooeerzzzorozrzezrrorozezoorzzerzroeeeerorreeoezoeroe... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConstanze is the smartest girl in her village but she has bad eyesight.\n\nOne day, she was able to invent an incredible machine! When you pronounce letters, the machine will inscribe them onto a piece of paper. For examp... | [{"type": "stdin_stdout", "input": "nnnnnnnnnnnnnnnnnnnnnuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuunnnnnnnnnnnnnnnnnnnnnuuuuuuuuuunnunnu\n", "output": "281595619\n"}, {"type": "stdin_stdout", "input": "unnunnuuuuuuuuuunnnnnnnnnnnnnnnnnnnnnuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuunnnnnnnnnnnnnnnnnnnnn\n", "output": "28... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA string is called beautiful if no two consecutive characters are equal. For example, \"ababcb\", \"a\" and \"abab\" are beautiful strings, while \"aaaaaa\", \"abaa\" and \"bb\" are not.\n\nAhcl wants to construct a beaut... | [{"type": "stdin_stdout", "input": "23\n?\n??\n???\n????\n????\n?a\n?b\n?c\na?\nb?\nc?\n?a?\n?b?\n?c?\na?a\na?b\na?c\nb?a\nb?b\nb?c\nc?a\nc?b\nc?c\n", "output": "a\nab\naba\nabab\nabab\nba\nab\nac\nab\nba\nca\nbab\naba\naca\naba\nacb\nabc\nbca\nbab\nbac\ncba\ncab\ncac\n"}, {"type": "stdin_stdout", "input": "23\n?\n??\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKuroni is the coordinator of the next Mathforces round written by the \"Proof by AC\" team. All the preparation has been done, and he is discussing with the team about the score distribution for the round.\n\nThe round co... | [{"type": "stdin_stdout", "input": "8955 1107458\n", "output": "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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Petya very much likes playing with little Masha. Recently he has received a game called \"Zero-One\" as a gift from his mother. Petya immediately offered Masha to play the game with him.\n\nBefore the very beginnin... | [{"type": "stdin_stdout", "input": "1110110101111111001111111110111011100001110111011001011111111111011010011111?111111?011111110001010110011111010111100111?111101010011101010?011111101010111111111101111010111?1111111100110110001111101111100100110011101111011110111000111?011110?111110?1011010111101111101111010100111110... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is an interactive problem.\n\nOmkar has just come across a duck! The duck is walking on a grid with n rows and n columns (2 β€ n β€ 25) so that the grid contains a total of n^2 cells. Let's denote by (x, y) the cell in... | [{"type": "stdin_stdout", "input": "25\n1\n1 1\n1 2\n1 3\n2 3\n2 4\n3 4\n3 5\n3 6\n3 7\n4 7\n5 7\n5 8\n6 8\n7 8\n7 9\n8 9\n9 9\n9 10\n9 11\n9 12\n9 13\n10 13\n11 13\n11 14\n11 15\n11 16\n11 17\n12 17\n13 17\n14 17\n15 17\n15 18\n16 18\n17 18\n17 19\n17 20\n17 21\n18 21\n18 22\n19 22\n20 22\n21 22\n21 23\n22 23\n23 23\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nβ Hey folks, how do you like this problem?\n\nβ That'll do it. \n\nBThero is a powerful magician. He has got n piles of candies, the i-th pile initially contains a_i candies. BThero can cast a copy-paste spell as follows:... | [{"type": "stdin_stdout", "input": "3\n2 2\n2 1\n3 5\n1 3 3\n3 12\n1 2 2\n", "output": "0\n4\n20\n"}, {"type": "stdin_stdout", "input": "3\n2 2\n1 1\n3 10\n1 2 4\n3 7\n3 2 2\n", "output": "1\n14\n4\n"}, {"type": "stdin_stdout", "input": "3\n2 2\n2 1\n3 5\n1 3 3\n3 24\n1 2 2\n", "output": "0\n4\n44\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a matrix a of size n Γ m consisting of integers.\n\nYou can choose no more than \\leftβm/2\\rightβ elements in each row. Your task is to choose these elements in such a way that their sum is divisible by k a... | [{"type": "stdin_stdout", "input": "10 20 69\n7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7\n7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7\n7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7\n7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7\n7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7\n7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7\n7 7 7 7 7 7 7 7 7 7 7 7 7 7 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter your debut mobile game \"Nim\" blew up, you decided to make a sequel called \"Nim 2\". This game will expand on the trusted Nim game formula, adding the much awaited second heap! \n\nIn the game, there are two heaps... | [{"type": "stdin_stdout", "input": "3 5\n3 0\n0 1\n2 2\n0 0\n1 1\n2 2\n3 3\n5 4\n", "output": "\nLOSE\nWIN\nLOSE\nWIN\nLOSE\n"}, {"type": "stdin_stdout", "input": "3 5\n3 0\n0 1\n2 2\n0 0\n1 1\n2 2\n3 3\n10 4\n", "output": "LOSE\nWIN\nLOSE\nWIN\nWIN\n"}, {"type": "stdin_stdout", "input": "3 5\n3 0\n0 1\n2 2\n0 0\n1 1\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day you wanted to read something, so you went to your bookshelf to grab some book. But when you saw how messy the bookshelf was you decided to clean it up first.\n\n<image>\n\nThere are n books standing in a row on th... | [{"type": "stdin_stdout", "input": "100\n82 51 81 14 37 17 78 92 64 15 8 86 89 8 87 77 66 10 15 12 100 25 92 47 21 78 20 63 13 49 41 36 41 79 16 87 87 69 3 76 80 60 100 49 70 59 72 8 38 71 45 97 71 14 76 54 81 4 59 46 39 29 92 3 49 22 53 99 59 52 74 31 92 43 42 23 44 9 82 47 7 40 12 9 3 55 37 85 46 22 84 52 98 41 21 77... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTwo players play a game. The game is played on a rectangular board with n Γ m squares. At the beginning of the game two different squares of the board have two chips. The first player's goal is to shift the chips to the s... | [{"type": "stdin_stdout", "input": "100 100 1 1 100 100\n", "output": "Second\n"}, {"type": "stdin_stdout", "input": "100 100 10 10 13 14\n", "output": "Second\n"}, {"type": "stdin_stdout", "input": "110 100 1 1 100 100\n", "output": "Second\n"}, {"type": "stdin_stdout", "input": "99 100 24 1 24 100\n", "output": "Seco... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Little Elephant loves sortings.\n\nHe has an array a consisting of n integers. Let's number the array elements from 1 to n, then the i-th element will be denoted as ai. The Little Elephant can make one move to choose ... | [{"type": "stdin_stdout", "input": "47\n703599938 780784195 912005704 957182560 961181825 964876912 996677776 997012583 999004240 999888999 999980718 999997556 999997940 999999989 999999991 999999991 999999999 999999999 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOnce Bob needed to find the second order statistics of a sequence of integer numbers. Lets choose each number from the sequence exactly once and sort them. The value on the second position is the second order statistics o... | [{"type": "stdin_stdout", "input": "99\n10 -84 -100 -100 73 -64 -100 -94 33 -100 -100 -100 -100 71 64 24 7 -100 -32 -100 -100 77 -100 62 -12 55 45 -100 -100 -80 -100 -100 -100 -100 -100 -100 -100 -100 -100 -39 -48 -100 -34 47 -100 -100 -100 -100 -100 -77 -100 -100 -100 -100 -100 -100 -52 40 -55 -100 -44 -100 72 33 70 -... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya has got 2n cards, each card contains some integer. The numbers on the cards can be the same. Let's index all cards by consecutive integers from 1 to 2n. We'll denote the number that is written on a card with number ... | [{"type": "stdin_stdout", "input": "100\n8 6 7 8 7 9 1 7 3 3 5 8 7 8 5 4 8 4 8 1 2 8 3 7 8 7 6 5 7 9 6 10 7 6 7 8 6 8 9 5 1 5 6 1 4 8 4 8 7 2 6 2 6 6 2 8 2 8 7 1 5 4 4 6 4 9 7 5 1 8 1 3 9 2 3 2 4 7 6 10 5 3 4 10 8 9 6 7 2 7 10 1 8 10 4 1 1 1 2 7 5 4 9 10 6 8 3 1 10 9 9 6 1 5 8 6 6 3 3 4 10 10 8 9 7 10 9 3 7 6 3 2 10 8 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIahub and Iahubina went to a date at a luxury restaurant. Everything went fine until paying for the food. Instead of money, the waiter wants Iahub to write a Hungry sequence consisting of n integers. \n\nA sequence a1, a2... | [{"type": "stdin_stdout", "input": "16663\n", "output": "16663 16664 16665 16666 16667 16668 16669 16670 16671 16672 16673 16674 16675 16676 16677 16678 16679 16680 16681 16682 16683 16684 16685 16686 16687 16688 16689 16690 16691 16692 16693 16694 16695 16696 16697 16698 16699 16700 16701 16702 16703 16704 16705 16706... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhen new students come to the Specialized Educational and Scientific Centre (SESC) they need to start many things from the beginning. Sometimes the teachers say (not always unfairly) that we cannot even count. So our teac... | [{"type": "stdin_stdout", "input": "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||+||=||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||\n", "output": "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDuring the \"Russian Code Cup\" programming competition, the testing system stores all sent solutions for each participant. We know that many participants use random numbers in their programs and are often sent several so... | [{"type": "stdin_stdout", "input": "7\n0 2\n0 3\n0 2\n0 1\n0 10\n1 10\n0 5\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "7\n0 2\n0 5\n0 2\n0 1\n0 10\n1 10\n0 5\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "4\n1 2\n2 100000\n1 2\n-1 100000\n", "output": "NO\n"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAnn has recently started commuting by subway. We know that a one ride subway ticket costs a rubles. Besides, Ann found out that she can buy a special ticket for m rides (she can buy it several times). It costs b rubles. A... | [{"type": "stdin_stdout", "input": "1000 1 1000 1000\n", "output": "1000000\n"}, {"type": "stdin_stdout", "input": "1000 3 1000 1000\n", "output": "334000\n"}, {"type": "stdin_stdout", "input": "1000 3 1001 1000\n", "output": "334000\n"}, {"type": "stdin_stdout", "input": "1000 5 1000 1000\n", "output": "200000\n"}, {"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA traveler is planning a water hike along the river. He noted the suitable rest points for the night and wrote out their distances from the starting point. Each of these locations is further characterized by its picturesq... | [{"type": "stdin_stdout", "input": "19 2\n1 73\n2 96\n3 24\n5 96\n11 13\n14 96\n16 31\n17 60\n34 69\n39 41\n60 40\n61 96\n66 7\n67 56\n70 28\n73 12\n74 81\n78 77\n95 99\n", "output": "2 3 4 6 7 8 11 12 14 15 17 18 19\n"}, {"type": "stdin_stdout", "input": "20 8\n2 37\n9 28\n13 63\n14 85\n27 27\n29 90\n34 96\n36 60\n41 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNowadays, most of the internet advertisements are not statically linked to a web page. Instead, what will be shown to the person opening a web page is determined within 100 milliseconds after the web page is opened. Usual... | [{"type": "stdin_stdout", "input": "5\n3778 9170\n2657 6649\n4038 9722\n3392 7255\n4890 8961\n", "output": "6938.4627241726648\n"}, {"type": "stdin_stdout", "input": "5\n4787 9531\n3133 9597\n1754 9725\n4335 7124\n4269 7752\n", "output": "7046.2404831918329\n"}, {"type": "stdin_stdout", "input": "5\n2194 6947\n2062 824... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.