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\nThere are n persons located on a plane. The i-th person is located at the point (x_i, y_i) and initially looks at the point (u_i, v_i).\n\nAt the same moment of time, all persons will start to rotate clockwise synchronous... | [{"type": "stdin_stdout", "input": "2\n2\n1000000000 1000000000 -1000000000 -1685444969\n-1000000000 -1073004450 1000010100 1000100000\n2\n1100000000 1000000000 -1000000000 -1742607922\n-1854126016 -1929941902 1000000000 1000000000\n", "output": "0\n0\n"}, {"type": "stdin_stdout", "input": "2\n2\n1000000000 1000000000 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are storing an integer array of length m in a database. To maintain internal integrity and protect data, the database stores n copies of this array.\n\nUnfortunately, the recent incident may have altered the stored in... | [{"type": "stdin_stdout", "input": "7 7\n819259078 205583658 361196257 308947393 279447438 979945924 723265333\n819259078 205583658 747427404 308947393 24523132 349917646 723265333\n819259078 538483784 747427404 308947393 24523132 979945924 723265333\n819259078 484729909 747427404 482521039 24523132 979945924 723265333... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is the easy version of the problem. The only difference between the easy version and the hard version is the constraints on n. You can only make hacks if both versions are solved.\n\nA permutation of 1, 2, …, n is a ... | [{"type": "stdin_stdout", "input": "23 1000000000\n", "output": "181477629\n"}, {"type": "stdin_stdout", "input": "24 1000000000\n", "output": "751045235\n"}, {"type": "stdin_stdout", "input": "39 1000000000\n", "output": "289091346\n"}, {"type": "stdin_stdout", "input": "10 802030518\n", "output": "754910371\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nn fish, numbered from 1 to n, live in a lake. Every day right one pair of fish meet, and the probability of each other pair meeting is the same. If two fish with indexes i and j meet, the first will eat up the second with... | [{"type": "stdin_stdout", "input": "8\n0.000 0.147 0.783 0.224 0.220 0.651 0.453 0.209\n0.853 0.000 0.246 0.076 0.018 0.349 0.896 0.315\n0.217 0.754 0.000 0.307 0.968 0.400 0.531 0.086\n0.776 0.924 0.693 0.000 0.707 0.842 0.116 0.949\n0.780 0.982 0.032 0.293 0.000 0.908 0.307 0.266\n0.349 0.651 0.600 0.158 0.092 0.000 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya used to be an accountant before the war began and he is one of the few who knows how to operate a computer, so he was assigned as the programmer.\n\nWe all know that programs often store sets of integers. For exampl... | [{"type": "stdin_stdout", "input": "56\npair pair pair int int pair pair pair pair pair int pair int int pair pair int pair pair pair int pair int int pair int pair int pair pair pair pair int pair pair int int pair int int pair int int int int int pair pair pair pair pair pair pair pair pair int pair pair int pair pai... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFurik and Rubik love playing computer games. Furik has recently found a new game that greatly interested Rubik. The game consists of n parts and to complete each part a player may probably need to complete some other ones... | [{"type": "stdin_stdout", "input": "20\n2 2 3 2 3 1 1 3 1 1 1 1 1 3 2 1 3 1 1 1\n1 7\n13 7 1 11 4 6 16 20 12 5 18 19 15 10\n8 7 1 11 4 6 17 8 16\n3 7 1 11\n9 7 1 11 4 6 8 20 12 3\n4 7 1 11 4\n0\n6 7 1 11 4 6 17\n4 7 1 11 4\n7 7 1 11 4 6 17 5\n2 7 1\n9 7 1 11 4 6 17 8 14 20\n11 7 1 11 4 6 20 3 5 15 10 2\n5 7 1 11 4 6\n9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day, liouzhou_101 got a chat record of Freda and Rainbow. Out of curiosity, he wanted to know which sentences were said by Freda, and which were said by Rainbow. According to his experience, he thought that Freda alwa... | [{"type": "stdin_stdout", "input": "10\nmiao.vyscfysAtWcPkpFHdwZqAQ,UPPcjhKQTlala.\nmiao.KESqus DybUuYFoWVpo..LWZh.UqEdUsTHFlKfzqkThAUPklala.\nUNoE vfZIAdxkiWKhsHPfsqRPTNQoHgAxooVLYxRzugHjo jaEHWQFF\nCCmdIwr.UkoiYWK.Z,,ZesMpISTXNgnpYnJaWquCyL,gO\n.JvOayhXK_bgoYbfAtnXg\nbvdSzRrXoGxVgWvdXnsjEnEfxDzIQo_aZVGDGrzwuAMtzVAHio... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGerald plays the following game. He has a checkered field of size n × n cells, where m various cells are banned. Before the game, he has to put a few chips on some border (but not corner) board cells. Then for n - 1 minut... | [{"type": "stdin_stdout", "input": "14 5\n4 2\n5 4\n3 3\n2 3\n1 2\n", "output": "17\n"}, {"type": "stdin_stdout", "input": "14 5\n4 2\n3 8\n3 3\n2 3\n1 2\n", "output": "18\n"}, {"type": "stdin_stdout", "input": "14 5\n4 2\n5 4\n3 3\n2 3\n1 1\n", "output": "17\n"}, {"type": "stdin_stdout", "input": "14 5\n4 2\n9 4\n3 3\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSereja has a bracket sequence s1, s2, ..., sn, or, in other words, a string s of length n, consisting of characters \"(\" and \")\".\n\nSereja needs to answer m queries, each of them is described by two integers li, ri (1... | [{"type": "stdin_stdout", "input": "(()((((()(())((((((((()((((((()((((\n71\n15 29\n17 18\n5 26\n7 10\n16 31\n26 35\n2 30\n16 24\n2 24\n7 12\n15 18\n12 13\n25 30\n1 30\n12 13\n16 20\n6 35\n20 28\n18 23\n9 31\n12 35\n14 17\n8 16\n3 10\n12 33\n7 19\n2 33\n7 17\n21 27\n10 30\n29 32\n9 28\n18 32\n28 31\n31 33\n4 26\n15 27\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSereja is a coder and he likes to take part in Codesorfes rounds. However, Uzhland doesn't have good internet connection, so Sereja sometimes skips rounds.\n\nCodesorfes has rounds of two types: Div1 (for advanced coders)... | [{"type": "stdin_stdout", "input": "1122 54\n2 1031\n1 363 364\n1 14 15\n1 902 903\n1 1052 1053\n2 170\n2 36\n2 194\n1 340 341\n1 1018 1019\n1 670 671\n1 558 559\n2 431\n2 351\n2 201\n1 1104 1105\n2 1056\n2 823\n1 274 275\n2 980\n1 542 543\n1 807 808\n2 157\n2 895\n1 505 506\n2 658\n1 484 485\n1 533 534\n1 384 385\n2 7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya is sitting on an extremely boring math class. To have fun, he took a piece of paper and wrote out n numbers on a single line. After that, Vasya began to write out different ways to put pluses (\"+\") in the line bet... | [{"type": "stdin_stdout", "input": "200 100\n56988719755815575893282254081467698462485803782142631369385180999746639622554559884281193367342283559238834106917388166048020056852911293394377949964185368886333934084399980368238188117302968424219707\n", "output": "295455656\n"}, {"type": "stdin_stdout", "input": "200 100\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row num... | [{"type": "stdin_stdout", "input": "5 5 30\n0 1 1 1 0\n1 1 0 1 1\n0 1 1 1 1\n0 0 1 1 0\n0 0 0 0 0\n3 2\n2 2\n2 2\n4 3\n1 4\n3 2\n4 1\n2 4\n1 4\n2 1\n5 2\n4 1\n4 1\n5 1\n2 4\n2 4\n4 4\n1 2\n3 1\n4 5\n1 2\n2 3\n1 1\n5 1\n3 4\n1 1\n5 4\n1 5\n5 4\n2 2\n", "output": "3\n3\n3\n3\n3\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n5\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLimak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.\n\nL... | [{"type": "stdin_stdout", "input": "170\n1 2 1 2 1 1 1 1 2 3 2 1 1 2 2 1 2 1 2 1 1 2 3 3 2 1 1 1 1 1 1 1 1 2 1 2 3 3 2 1 2 2 1 2 3 2 1 1 2 3 2 1 2 1 1 1 2 3 3 2 1 2 1 2 1 1 1 2 1 2 1 1 2 2 1 1 2 1 2 2 1 2 1 2 2 1 2 1 2 3 2 1 1 2 3 4 4 3 2 1 2 1 2 1 2 3 3 2 1 2 1 1 1 1 1 1 1 2 2 1 1 2 1 1 1 1 2 1 1 2 3 2 1 2 2 1 2 1 1 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWilbur the pig is tinkering with arrays again. He has the array a1, a2, ..., an initially consisting of n zeros. At one step, he can choose any index i and either add 1 to all elements ai, ai + 1, ... , an or subtract 1 f... | [{"type": "stdin_stdout", "input": "22\n1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000\n", "output": "43000000000\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are three points marked on the coordinate plane. The goal is to make a simple polyline, without self-intersections and self-touches, such that it passes through all these points. Also, the polyline must consist of o... | [{"type": "stdin_stdout", "input": "1000000000 -1000000000\n1000000000 1000000000\n-1000000000 -1000000000\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "1000000000 -1000000000\n1000000000 1000000010\n-1000000000 -1000000000\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "-636111887 -755135651\n-4114... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe main street of Berland is a straight line with n houses built along it (n is an even number). The houses are located at both sides of the street. The houses with odd numbers are at one side of the street and are numbe... | [{"type": "stdin_stdout", "input": "100000 99999\n", "output": "50000"}, {"type": "stdin_stdout", "input": "100000 23457\n", "output": "11729"}, {"type": "stdin_stdout", "input": "100000 23458\n", "output": "38272"}, {"type": "stdin_stdout", "input": "92388 40801\n", "output": "20401\n"}, {"type": "stdin_stdout", "inpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n integers b1, b2, ..., bn written in a row. For all i from 1 to n, values ai are defined by the crows performing the following procedure:\n\n * The crow sets ai initially 0. \n * The crow then adds bi to ai, ... | [{"type": "stdin_stdout", "input": "10\n-38980 0001000000 -1000000000 1000000000 -1000000000 1000010010 -1000000000 1010000010 -1556535198 1000000000\n", "output": "961020 -999000000 0 0 10010 10010 10000010 -546535188 -556535198 1000000000\n"}, {"type": "stdin_stdout", "input": "10\n-38980 0001000000 -1000000000 10000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBash wants to become a Pokemon master one day. Although he liked a lot of Pokemon, he has always been fascinated by Bulbasaur the most. Soon, things started getting serious and his fascination turned into an obsession. Si... | [{"type": "stdin_stdout", "input": "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBbbbbbbbbbbbbbbbbbbbbuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuullllllllllllllllllllssssssssssssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya came up with his own weather forecasting method. He knows the information about the average air temperature for each of the last n days. Assume that the average air temperature for each day is integral.\n\nVasya bel... | [{"type": "stdin_stdout", "input": "100\n-85 -80 -76 -72 -68 -64 -60 -56 -52 -48 -44 -40 -36 -32 -28 -24 -20 -16 -12 -8 -4 0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter the Search Ultimate program that searched for strings in a text failed, Igor K. got to think: \"Why on Earth does my program work so slowly?\" As he double-checked his code, he said: \"My code contains no errors, ye... | [{"type": "stdin_stdout", "input": "254\n", "output": "5\nlea ebx, [2*eax]\nlea ecx, [eax + 2*eax]\nlea edx, [eax + 2*ecx]\nlea eex, [edx + 8*edx]\nlea efx, [ebx + 4*eex]"}, {"type": "stdin_stdout", "input": "238\n", "output": "4\nlea ebx, [eax + 4*eax]\nlea ecx, [eax + 1*ebx]\nlea edx, [ebx + 4*ecx]\nlea eex, [ecx + 8... | 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 are given two squares, one with sides parallel to the coordinate axes, and another one with sides at 45 degrees to the coordinate axes. Find whether the two squares intersect.\n\nThe interior of the square is consider... | [{"type": "stdin_stdout", "input": "-17 -91 -17 -27 -81 -27 -81 -91\n-48 -21 -12 -57 -48 -93 -84 -57\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "-100 -100 -100 -99 -99 -99 -99 -100\n-10 -10 -9 -9 -10 -8 -11 -9\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-100 -100 -100 100 100 100 100 -100\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMoving ahead, Gudi now enters a room where the floor is divided into N x M square tiles, forming a grid with N rows and M columns.\nEach square in the grid contains a number of Magical Orbs that Gudi has to absorb if she... | [{"type": "stdin_stdout", "input": "10\n9 8 343\n11 10 4 15 10 9 13 15\n12 13 9 18 3 3 18 17\n16 15 6 2 14 14 3 15\n4 14 14 3 17 8 3 16\n19 12 4 11 11 9 8 3\n19 3 13 17 3 17 5 15\n9 5 3 12 15 6 12 7\n13 15 2 17 4 13 6 15\n8 8 10 6 18 3 3 14\n18 12 343\n6 14 4 16 3 10 5 18 3 6 19 11\n14 11 18 8 13 5 9 3 13 15 8 6\n4 19 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Shino loves to play with coins. In the city she lives, there are 26 different types of coins. Each coin is represented with a lowercase letter a, b, c, ... , y, z. Shino has some number of coins and she placed them... | [{"type": "stdin_stdout", "input": "18\nabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrst... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSuresh is a strange boy. He neither likes an array in ascending order nor in descending order. Then what does he like?\nHe likes an array if and only if it is mixed i.e, both ascending and descending. He has got lots of a... | [{"type": "stdin_stdout", "input": "65\n40\n476855 9157812 15278 6467817 130592 3732511 3500060 1577432 3746144 1473833 1162927 491769 8971510 9511983 3090464 2222773 7900479 9437122 3038224 9263310 4890964 6753736 5016606 9875001 5001777 4538627 5859406 9622719 7344989 8262871 5667311 7821844 9937036 5682589 4289661 6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn uppercase or lowercase English letter \\alpha will be given as input. If \\alpha is uppercase, print `A`; if it is lowercase, print `a`.\n\nConstraints\n\n* \\alpha is an uppercase (`A` - `Z`) or lowercase (`a` - `z`) ... | [{"type": "stdin_stdout", "input": "b", "output": "a\n"}, {"type": "stdin_stdout", "input": "C", "output": "A\n"}, {"type": "stdin_stdout", "input": "`", "output": "a\n"}, {"type": "stdin_stdout", "input": "D", "output": "A\n"}, {"type": "stdin_stdout", "input": "c", "output": "a\n"}, {"type": "stdin_stdout", "input": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe will host a rock-paper-scissors tournament with N people. The participants are called Person 1, Person 2, \\ldots, Person N. For any two participants, the result of the match between them is determined in advance. This... | [{"type": "stdin_stdout", "input": "6\n0\n11\n111\n1111\n11001", "output": "3"}, {"type": "stdin_stdout", "input": "6\n0\n11\n110\n1111\n11001", "output": "2"}, {"type": "stdin_stdout", "input": "6\n0\n11\n100\n0101\n11001", "output": "1"}, {"type": "stdin_stdout", "input": "6\n0\n11\n011\n1111\n11001", "output": "4"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N dishes, numbered 1, 2, \\ldots, N. Initially, for each i (1 \\leq i \\leq N), Dish i has a_i (1 \\leq a_i \\leq 3) pieces of sushi on it.\n\nTaro will perform the following operation repeatedly until all the p... | [{"type": "stdin_stdout", "input": "10\n1 3 2 3 3 2 3 2 1 3", "output": "54.48064457488221"}, {"type": "stdin_stdout", "input": "10\n1 3 2 2 3 2 3 2 1 3", "output": "52.8643923040\n"}, {"type": "stdin_stdout", "input": "10\n1 3 3 3 3 2 3 2 1 3", "output": "55.9466970748\n"}, {"type": "stdin_stdout", "input": "10\n1 3 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given integers N, K, and an integer sequence A of length M.\n\nAn integer sequence where each element is between 1 and K (inclusive) is said to be colorful when there exists a contiguous subsequence of length K of... | [{"type": "stdin_stdout", "input": "9954 310 12\n267 193 278 294 6 63 86 166 157 193 168 43", "output": "979180369"}, {"type": "stdin_stdout", "input": "25000 400 4\n3 7 31 127", "output": "923966268"}, {"type": "stdin_stdout", "input": "24477 400 4\n3 7 31 127", "output": "187656138"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word \"bill\" refers to only these.\n\nAccording to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandf... | [{"type": "stdin_stdout", "input": "2000 25743705", "output": "-1 -1 -1\n"}, {"type": "stdin_stdout", "input": "2000 40151179", "output": "-1 -1 -1\n"}, {"type": "stdin_stdout", "input": "1000 1234000", "output": "14 27 959"}, {"type": "stdin_stdout", "input": "2000 20000000", "output": "2000 0 0"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have N clocks. The hand of the i-th clock (1≤i≤N) rotates through 360° in exactly T_i seconds.\nInitially, the hand of every clock stands still, pointing directly upward.\nNow, Dolphin starts all the clocks simultaneou... | [{"type": "stdin_stdout", "input": "5\n1\n23\n3\n1101000001000001010\n1100000100011001001", "output": "27855302557878606201578346278553253230\n"}, {"type": "stdin_stdout", "input": "5\n1\n5\n10\n1101000001000001001\n1100000000000011100", "output": "1211100001100013322200011100011111100\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMountaineers Mr. Takahashi and Mr. Aoki recently trekked across a certain famous mountain range. The mountain range consists of N mountains, extending from west to east in a straight line as Mt. 1, Mt. 2, ..., Mt. N. Mr. ... | [{"type": "stdin_stdout", "input": "10\n1 3776 3776 8848 8848 8848 8848 8848 8848 8848\n8848 8848 8848 8848 8848 8848 8848 8848 3776 5", "output": "884111967"}, {"type": "stdin_stdout", "input": "5\n16 0 4 -1 2\n19 24 -3 0 -11", "output": "0\n"}, {"type": "stdin_stdout", "input": "5\n16 0 1 -1 2\n19 24 -3 0 -11", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhen you enter 8 numbers from 0 to 9, write a program that outputs the difference between the largest integer and the smallest integer that can sort the 8 numbers. The number that can be sorted may start from 0, such as 0... | [{"type": "stdin_stdout", "input": "2\n65539010\n102034250", "output": "96417531\n543098655\n"}, {"type": "stdin_stdout", "input": "2\n124008976\n66277190", "output": "986395311\n96499431\n"}, {"type": "stdin_stdout", "input": "2\n188122632\n66277190", "output": "774098523\n96499431\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTaro is addicted to a novel. The novel has n volumes in total, and each volume has a different thickness. Taro likes this novel so much that he wants to buy a bookshelf dedicated to it. However, if you put a large bookshe... | [{"type": "stdin_stdout", "input": "3 9\n1051\n300\n800\n200\n100\n600\n900\n1032\n400\n4 3\n1000\n1000\n1000\n0 0", "output": "2151\n1000\n"}, {"type": "stdin_stdout", "input": "3 9\n1051\n300\n800\n200\n100\n600\n900\n1032\n400\n4 3\n1000\n1000\n1001\n0 0", "output": "2151\n1001\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVillages were scattered in the Wakamatsu Plain of Aizu. Several settlements are connected by straight roads that allow them to travel to and from each other, and any settlement in the plain can be traced back and forth. E... | [{"type": "stdin_stdout", "input": "7 6\n-1 2\n3 0\n2 2\n1 -1\n4 1\n2 3\n3 5\n1 3\n2 4\n2 3\n3 5\n3 7\n6 7", "output": "20.8510743960\n"}, {"type": "stdin_stdout", "input": "7 6\n-1 2\n3 0\n2 4\n1 -1\n4 1\n2 3\n3 5\n1 3\n2 4\n2 3\n3 5\n3 7\n6 7", "output": "20.0292199808\n"}, {"type": "stdin_stdout", "input": "7 6\n-1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nModern Mansion\n\nYou got lost in a big mansion. This mansion has a structure in which square rooms are arranged in a grid pattern from north, south, east, and west, with M columns in the east-west direction and N rows in... | [{"type": "stdin_stdout", "input": "0 -1 0\n5 -1", "output": "-1\n"}, {"type": "stdin_stdout", "input": "0 -1 2\n7 -1", "output": "-1\n"}, {"type": "stdin_stdout", "input": "3 1 2\n0 -1", "output": "-1\n"}, {"type": "stdin_stdout", "input": "4 0 0\n5 -1", "output": "-1\n"}, {"type": "stdin_stdout", "input": "4 0 0\n4 -... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKarnaugh is a poor farmer who has a very small field. He wants to reclaim wasteland in the kingdom to get a new field. But the king who loves regular shape made a rule that a settler can only get a rectangular land as his... | [{"type": "stdin_stdout", "input": "3\n1 1 0 1 0\n0 1 0 1 1\n1 0 1 0 1\n0 1 1 1 0\n0 1 0 0 -1\n\n0 1 0 1 1\n0 1 0 0 0\n0 0 1 0 0\n0 0 1 1 0\n1 0 1 0 0\n\n1 1 1 1 0\n0 1 1 1 0\n0 1 1 0 1\n-1 1 1 1 -1\n0 0 0 0 1", "output": "3\n3\n8\n"}, {"type": "stdin_stdout", "input": "3\n1 1 0 1 0\n0 1 0 1 1\n1 0 1 0 1\n0 1 1 1 0\n0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDigits Are Not Just Characters\n\nMr. Manuel Majorana Minore made a number of files with numbers in their names. He wants to have a list of the files, but the file listing command commonly used lists them in an order diff... | [{"type": "stdin_stdout", "input": "2\nfile10\nfi2el0\nfile3", "output": "-\n-\n"}, {"type": "stdin_stdout", "input": "2\nfjle10\nfi2el0\niele3", "output": "-\n+\n"}, {"type": "stdin_stdout", "input": "2\n01eljf\nfi2el0\niele3", "output": "+\n+\n"}, {"type": "stdin_stdout", "input": "2\nflje10\nif3el0\n2elei", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYAML (YAML Ain't Markup Language) is one of the formats for expressing an object as a character string.\n\nYou will be given an object represented by a subset of YAML and a query that specifies the property, so please ans... | [{"type": "stdin_stdout", "input": ".tweets.1\nname: shimeki\nid: shimejitan\ntweets:\n 1: shimejilove\n 2: azupero", "output": "string \"shimejilove\"\n"}, {"type": "stdin_stdout", "input": ".tweets.1\nname: shimeji\nid: shimejitan\ntweets:\n 1: shivejilome\n :2 azupero", "output": "string \"shivejilome\"\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem Statement\n\nOne day, you found an old scroll with strange texts on it.\n\nYou revealed that the text was actually an expression denoting the position of treasure. The expression consists of following three operat... | [{"type": "stdin_stdout", "input": "((0,0)@(1,1))@((4,1)@(2,5))\n((0,0)@(3,1))@((1,-3)@(2,-1))\n(0,0)@(1,1)@(4,1)\n(0,0)@((1,1)@(4,1))\n(((0,0)@((10,20)@(((30,40))))))\n((0,0)@(3,1))@((1,-3)@(2,-1))@(100,-100)@(100,100)\n#", "output": "3.00000000 3.00000000\n3.00000000 1.00000000\n1.00000000 4.00000000\n0.00000000 2.00... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem statement\n\nN first-year students of the Faculty of Information Science and Technology of R University take the final exam of the lecture called Programming Exercise 1. The test is a perfect score of m. In other ... | [{"type": "stdin_stdout", "input": "89 111", "output": "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 11... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCounting sort can be used for sorting elements in an array which each of the n input elements is an integer in the range 0 to k. The idea of counting sort is to determine, for each input element x, the number of elements ... | [{"type": "stdin_stdout", "input": "7\n4 11 2 3 4 3 1", "output": "1 2 3 3 4 4 11\n"}, {"type": "stdin_stdout", "input": "7\n8 9 2 0 12 3 3", "output": "0 2 3 3 8 9 12\n"}, {"type": "stdin_stdout", "input": "7\n10 9 3 0 6 3 3", "output": "0 3 3 3 6 9 10\n"}, {"type": "stdin_stdout", "input": "7\n6 5 3 0 12 3 3", "outpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTransformation\n\n\n\n\nWrite a program which performs a sequence of commands to a given string $str$. The command is one of:\n\n* print a b: print from the a-th character to the b-th character of $str$\n* reverse a b: re... | [{"type": "stdin_stdout", "input": "abcde\n3\nreplace 1 0 xy{\nreverse 0 2\nprint 1 6", "output": "xa{bcd\n"}, {"type": "stdin_stdout", "input": "abcde\n3\nreplace 1 0 xy{\nreverse 0 1\nprint 1 6", "output": "ay{bcd\n"}, {"type": "stdin_stdout", "input": "abcde\n3\nreplace 1 3 xyz\nreverse 0 2\nprint 0 4", "output": "y... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is an interactive problem.\n\nNatasha is going to fly to Mars. Finally, Natasha sat in the rocket. She flies, flies... but gets bored. She wishes to arrive to Mars already! So she decides to find something to occupy ... | [{"type": "stdin_stdout", "input": "1000000000 30 1000000000\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\n", "output": "1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n500000000\n750000000\n875000000\n937500000\n968750000\n984375000\n992187500\n996093750\n99804... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given n segments on a Cartesian plane. Each segment's endpoints have integer coordinates. Segments can intersect with each other. No two segments lie on the same line.\n\nCount the number of distinct points with i... | [{"type": "stdin_stdout", "input": "10\n841746 527518 -841746 -527518\n595261 331297 -595261 -331297\n-946901 129987 946901 -129987\n670374 -140388 -670374 140388\n-684770 309555 684770 -309555\n-302589 415564 302589 -415564\n-387435 613331 387435 -613331\n-624940 -95922 624940 95922\n945847 -199224 -945847 199224\n246... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a forest that we model as a plane and live n rare animals. Animal number i has its lair in the point (x_{i}, y_{i}). In order to protect them, a decision to build a nature reserve has been made.\n\nThe reserve mu... | [{"type": "stdin_stdout", "input": "20\n7571542 9868879\n3634934 5986987\n2297651 5538795\n9701582 8250721\n-2913168 4968483\n8838674 5771883\n-3348778 8326335\n-577797 750161\n-7223138 9113512\n-1808146 6044926\n-756446 417388\n4700417 1550148\n-5568937 20029\n-9170707 6103893\n7445655 7161843\n8820510 4145867\n-44669... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBilly investigates the question of applying greedy algorithm to different spheres of life. At the moment he is studying the application of greedy algorithm to the problem about change. There is an amount of n coins of dif... | [{"type": "stdin_stdout", "input": "91\n4000000 3000000 2900000 2511334 2511333 2102003 1901011 1700000 1200000 999999 800000 750000 600000 508111 202000 101000 35000 20000 9000 5000 2000 899 630 629 628 627 626 625 624 623 622 621 620 619 618 617 616 615 614 613 612 611 610 609 608 607 606 605 604 603 602 601 504 405 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAt the first holiday in spring, the town Shortriver traditionally conducts a flower festival. Townsfolk wear traditional wreaths during these festivals. Each wreath contains exactly k flowers.\n\nThe work material for the... | [{"type": "stdin_stdout", "input": "100 15 6 10\n12 9 1 7 6 4 1 9 3 2 4 6 2 5 3 8 9 2 9 1 6 5 6 2 3 10 7 10 7 4 5 4 4 4 4 7 1 10 8 4 8 3 10 10 7 4 4 10 6 1 8 5 4 6 2 4 10 3 2 5 7 5 6 10 10 3 4 5 4 3 3 1 7 8 10 10 10 10 8 3 7 4 2 1 8 6 5 6 5 8 7 9 2 1 9 2 4 6 10 8\n6 9 7 8 7 1 4 5 5 8\n", "output": "9\n18 19 23 24 25 26... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA company has n employees numbered from 1 to n. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. An employee A is said to be the superior of ... | [{"type": "stdin_stdout", "input": "77\n53\n-1\n48\n-1\n51\n-1\n54\n43\n70\n19\n64\n31\n45\n58\n6\n61\n41\n56\n34\n-1\n54\n-1\n66\n65\n74\n16\n38\n1\n2\n61\n-1\n34\n-1\n-1\n7\n19\n57\n13\n61\n42\n-1\n34\n65\n16\n31\n61\n6\n5\n34\n15\n-1\n13\n4\n22\n74\n7\n-1\n70\n38\n61\n45\n53\n46\n22\n-1\n65\n34\n19\n43\n48\n33\n58\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a prime number p, n integers a_1, a_2, …, a_n, and an integer k. \n\nFind the number of pairs of indexes (i, j) (1 ≤ i < j ≤ n) for which (a_i + a_j)(a_i^2 + a_j^2) ≡ k mod p.\n\nInput\n\nThe first line cont... | [{"type": "stdin_stdout", "input": "7 7 3\n4 0 5 3 1 2 6\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "6 7 2\n1 2 3 4 5 6\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "5 5 3\n3 0 4 1 2\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "2 54 10\n57 10\n", "output": "0\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are responsible for installing a gas pipeline along a road. Let's consider the road (for simplicity) as a segment [0, n] on OX axis. The road can have several crossroads, but for simplicity, we'll denote each crossroa... | [{"type": "stdin_stdout", "input": "4\n8 2 5\n00110010\n8 1 1\n00110010\n9 100000000 100000000\n010101010\n2 5 1\n00\n", "output": "94\n25\n2900000000\n13\n"}, {"type": "stdin_stdout", "input": "4\n8 2 5\n00110010\n8 1 1\n01110010\n9 100000000 100000000\n010101010\n2 5 1\n00\n", "output": "94\n26\n2900000000\n13\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given n positive integers a_1, …, a_n, and an integer k ≥ 2. Count the number of pairs i, j such that 1 ≤ i < j ≤ n, and there exists an integer x such that a_i ⋅ a_j = x^k.\n\nInput\n\nThe first line contains two... | [{"type": "stdin_stdout", "input": "100 3\n94 94 149 27 80 73 61 38 34 139 72 96 59 36 113 15 83 78 39 22 21 57 54 20 9 32 81 64 55 90 67 41 18 57 93 76 44 62 77 66 31 70 39 73 81 57 43 31 20 104 62 26 44 26 23 23 66 53 3 14 10 170 53 19 43 81 98 12 91 15 122 90 89 86 58 30 67 73 46 69 68 47 30 7 89 35 17 93 45 6 4 23 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a tree, which consists of n vertices. Recall that a tree is a connected undirected graph without cycles. \n\n<image> Example of a tree.\n\nVertices are numbered from 1 to n. All vertices have weights, the we... | [{"type": "stdin_stdout", "input": "14 2\n3 2 3 1 2 3 6 2 3 1 4 2 1 3\n12 10\n2 7\n13 12\n14 11\n10 5\n1 2\n11 4\n4 9\n14 8\n12 4\n7 14\n13 6\n10 3\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "14 2\n3 2 3 1 2 3 4 2 3 1 4 2 1 3\n12 10\n2 7\n13 12\n14 11\n10 5\n1 2\n11 4\n4 9\n14 8\n12 4\n7 9\n13 6\n10 3\n",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEugene likes working with arrays. And today he needs your help in solving one challenging task.\n\nAn array c is a subarray of an array b if c can be obtained from b by deletion of several (possibly, zero or all) elements... | [{"type": "stdin_stdout", "input": "3\n41 -41 41\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "3\n41 -60 41\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "3\n57 -60 41\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "3\n57 -33 41\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "3\n5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are playing one famous sandbox game with the three-dimensional world. The map of the world can be represented as a matrix of size n × m, where the height of the cell (i, j) is a_{i, j}.\n\nYou are in the cell (1, 1) r... | [{"type": "stdin_stdout", "input": "1\n8 6\n1 2 3 4 5 6\n7 8 9 10 11 12\n13 14 15 16 17 18\n19 20 21 22 23 24\n26 27 28 29 30 31\n33 34 35 36 34 35\n37 38 39 40 41 42\n44 45 46 47 48 49\n", "output": " 141\n"}, {"type": "stdin_stdout", "input": "5\n3 4\n1 2 3 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet f(x) be the sum of digits of a decimal number x.\n\nFind the smallest non-negative integer x such that f(x) + f(x + 1) + ... + f(x + k) = n.\n\nInput\n\nThe first line contains one integer t (1 ≤ t ≤ 150) — the number... | [{"type": "stdin_stdout", "input": "7\n1 0\n2 1\n42 7\n1 9\n64 0\n99 0\n99 2\n", "output": "1\n-1\n4\n-1\n19999999\n99999999999\n7997\n"}, {"type": "stdin_stdout", "input": "7\n1 0\n1 1\n42 7\n1 9\n64 0\n99 0\n99 2\n", "output": "1\n0\n4\n-1\n19999999\n99999999999\n7997\n"}, {"type": "stdin_stdout", "input": "7\n1 0\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor god's sake, you're boxes with legs! It is literally your only purpose! Walking onto buttons! How can you not do the one thing you were designed for?\n\nOh, that's funny, is it? Oh it's funny? Because we've been at thi... | [{"type": "stdin_stdout", "input": "5\n2\n1 1\n2\n1 1000000000\n2\n1000000000 1\n2\n1000000000 1000000000\n2\n228 1337\n", "output": "YES\nYES\nNO\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "5\n2\n1 1\n2\n1 1000000000\n2\n1000000000 1\n2\n1000000000 1010000000\n2\n228 1337\n", "output": "YES\nYES\nNO\nYES\nYES\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDuring her tantrums the princess usually smashes some collectable porcelain. Every furious shriek is accompanied with one item smashed.\n\nThe collection of porcelain is arranged neatly on n shelves. Within each shelf the... | [{"type": "stdin_stdout", "input": "1 68\n100 26 58 15 8 69 66 49 97 18 74 27 39 19 76 37 25 4 88 75 17 79 41 21 44 39 7 42 63 82 92 87 41 85 25 30 43 80 165 106 98 88 16 15 97 74 81 76 33 19 64 3 14 72 17 36 33 21 34 59 38 75 48 1 57 20 81 56 74 67 14 89 51 30 1 66 20 58 64 58 16 99 33 97 31 5 54 87 6 64 70 40 93 25 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string s consisting of the characters '0', '1', and '?'. You need to replace all the characters with '?' in the string s by '0' or '1' so that the string becomes a palindrome and has exactly a characters '... | [{"type": "stdin_stdout", "input": "9\n4 4\n0????1?0\n3 3\n??????\n1 0\n?\n2 2\n1001\n2 2\n01?0\n0 1\n0\n0 3\n?11\n2 2\n?00?\n4 3\n??010?0\n", "output": "00111100\n-1\n0\n1001\n0110\n-1\n111\n1001\n0101010\n"}, {"type": "stdin_stdout", "input": "9\n4 4\n0?????10\n3 3\n??????\n1 0\n?\n2 2\n0110\n2 2\n01?0\n0 1\n0\n0 3\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Berland road network consists of n cities and of m bidirectional roads. The cities are numbered from 1 to n, where the main capital city has number n, and the culture capital — number 1. The road network is set up so ... | [{"type": "stdin_stdout", "input": "34 53\n9 6\n25 28\n27 24\n15 18\n34 33\n27 30\n1 4\n4 7\n11 9\n11 8\n30 26\n15 12\n26 23\n17 15\n29 26\n11 15\n7 10\n14 12\n5 9\n8 5\n2 1\n24 21\n3 5\n14 17\n23 20\n25 22\n32 29\n8 6\n3 6\n33 31\n5 2\n21 18\n16 19\n19 22\n17 21\n14 11\n23 27\n3 1\n34 32\n32 30\n26 24\n17 20\n18 20\n2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYet another Armageddon is coming! This time the culprit is the Julya tribe calendar. \n\nThe beavers in this tribe knew math very well. Smart Beaver, an archaeologist, got a sacred plate with a magic integer on it. The tr... | [{"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "113502443819651915\n"}, {"type": "stdin_stdout", "input": "999999899799299198\n", "output": "113502432686240713\n"}, {"type": "stdin_stdout", "input": "999999999999999998\n", "output": "113502443819651913\n"}, {"type": "stdin_stdout", "input": "9999... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nValera has array a, consisting of n integers a0, a1, ..., an - 1, and function f(x), taking an integer from 0 to 2n - 1 as its single argument. Value f(x) is calculated by formula <image>, where value bit(i) equals one if... | [{"type": "stdin_stdout", "input": "43\n761 2165 6131 8874 8980 119 8300 9006 6278 7582 4740 6321 10042 6869 3788 17625 1707 5070 3809 335 2494 8255 1123 1430 190 5712 7313 3286 15423 133 1032 3067 8043 5297 5398 12168 13897 2141 1436 10227 362 8438 2300\n0111011100100011110010011110011011010001101\n", "output": "23536... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPavel is going to make a game of his dream. However, he knows that he can't make it on his own so he founded a development company and hired n workers of staff. Now he wants to pick n workers from the staff who will be di... | [{"type": "stdin_stdout", "input": "20\n30 35 55\n58 58 58\n40 40 40\n8 20 37\n46 47 48\n36 50 51\n32 47 55\n13 13 14\n48 49 57\n7 22 23\n42 46 51\n6 8 46\n37 38 45\n57 58 58\n19 32 45\n46 50 56\n26 40 43\n9 50 55\n21 34 52\n40 49 57\n", "output": "6\n6 7 11 16 18 20 \n"}, {"type": "stdin_stdout", "input": "20\n12 16 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nC*++ language is quite similar to C++. The similarity manifests itself in the fact that the programs written in C*++ sometimes behave unpredictably and lead to absolutely unexpected effects. For example, let's imagine an ... | [{"type": "stdin_stdout", "input": "399\n469*++a-935*++a-838*++a-468*++a+79*++a-89*++a-863*++a+531*a++-523*a++-583*++a-411*++a+301*++a+201*a++-108*a+++581*a+++938*++a-16*a++-632*a+++146*a++-230*++a+151*++a-618*a+++593*a+++320*++a+750*++a+185*a++-68*++a+839*a++-853*a+++761*a++-442*a++-385*a++-487*a++-573*a++-820*a++-123... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe administration of the Tomsk Region firmly believes that it's time to become a megacity (that is, get population of one million). Instead of improving the demographic situation, they decided to achieve its goal by expa... | [{"type": "stdin_stdout", "input": "30 505231\n-18 16 88130\n-10 16 15693\n16 -32 660\n-27 17 19042\n30 -37 6680\n36 19 299674\n-45 21 3300\n11 27 76\n-49 -34 28649\n-1 11 31401\n25 42 20858\n-40 6 455660\n-29 43 105001\n-38 10 6042\n19 -45 65551\n20 -9 148533\n-5 -24 393442\n-43 2 8577\n-39 18 97059\n12 28 39189\n35 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBizon the Champion isn't just friendly, he also is a rigorous coder.\n\nLet's define function f(a), where a is a sequence of integers. Function f(a) returns the following sequence: first all divisors of a1 go in the incre... | [{"type": "stdin_stdout", "input": "571312007450 10\n", "output": " 1 1 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nToday you are to solve the problem even the famous Hercule Poirot can't cope with! That's why this crime has not yet been solved and this story was never included in Agatha Christie's detective story books. \n\nYou are no... | [{"type": "stdin_stdout", "input": "10 20 10\n1 10\n5 10\n2 9\n2 6\n9 6\n3 9\n7 1\n10 5\n7 8\n8 7\n2 4\n9 6\n1 6\n5 3\n4 3\n3 7\n8 2\n6 4\n2 3\n4 1\nTjOMmYPRUY 7 3 1 3 9\nj 6 2 11 15\nBanBSrUA 4 2 19 20\ncSWZxzR 8 1 8\nzVoRlNgt 10 2 6 7\nWLGaq 1 3 10 13 17\nKahHtTDj 1 2 2 14\nrUFZmkpI 6 1 16\ni 4 3 4 5 12\nKLGiua 6 1 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has become interested in wrestling. In wrestling wrestlers use techniques for which they are awarded points by judges. The wrestler who gets the most points wins.\n\nWhen the numbers of points of both wrestlers are ... | [{"type": "stdin_stdout", "input": "131\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n0\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\n1\n-1\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVitaly is a diligent student who never missed a lesson in his five years of studying in the university. He always does his homework on time and passes his exams in time. \n\nDuring the last lesson the teacher has provided... | [{"type": "stdin_stdout", "input": "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyzyyyyyyyyyyyyyyyyyyyyyy\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\n", "output": "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string q. A sequence of k strings s1, s2, ..., sk is called beautiful, if the concatenation of these strings is string q (formally, s1 + s2 + ... + sk = q) and the first characters of these strings are dis... | [{"type": "stdin_stdout", "input": "26\nlllplzkkzflzflffzznnnnfgflqlttlmtnkzlztskngyymitqagattkdllyutzimsrskpapcmuupjdopxqlnhqcscwvdtxbflefy\n", "output": "YES\nlll\npl\nz\nkkz\nflzflffzz\nnnnnf\ngfl\nql\nttl\nmtnkzlzt\nskng\nyym\nitq\nagattk\ndlly\nutzims\nrskpap\ncmuup\njd\nop\nxqln\nhqcsc\nw\nvdtx\nbfl\nefy\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDaniel has a string s, consisting of lowercase English letters and period signs (characters '.'). Let's define the operation of replacement as the following sequence of steps: find a substring \"..\" (two consecutive peri... | [{"type": "stdin_stdout", "input": "2 7\nab\n1 w\n2 w\n1 c\n2 .\n2 .\n1 .\n2 b\n", "output": "0\n0\n0\n0\n0\n1\n0\n"}, {"type": "stdin_stdout", "input": "2 7\nab\n2 w\n2 w\n1 c\n2 .\n2 .\n1 .\n2 b\n", "output": "0\n0\n0\n0\n0\n1\n0\n"}, {"type": "stdin_stdout", "input": "2 7\nab\n2 w\n2 w\n1 c\n2 /\n2 .\n1 .\n2 b\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGalois is one of the strongest chess players of Byteforces. He has even invented a new variant of chess, which he named «PawnChess».\n\nThis new game is played on a board consisting of 8 rows and 8 columns. At the beginni... | [{"type": "stdin_stdout", "input": "........\n........\n.B....B.\n....W...\n........\n..W.....\n........\n........\n", "output": "A\n"}, {"type": "stdin_stdout", "input": "..B.....\n..W.....\n......B.\n........\n.....W..\n......B.\n........\n........\n", "output": "B\n"}, {"type": "stdin_stdout", "input": "........\n..... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMeanwhile, the kingdom of K is getting ready for the marriage of the King's daughter. However, in order not to lose face in front of the relatives, the King should first finish reforms in his kingdom. As the King can not ... | [{"type": "stdin_stdout", "input": "30\n1 2\n1 3\n1 4\n4 5\n2 6\n2 7\n4 8\n4 9\n6 10\n6 11\n11 30\n11 23\n30 24\n30 29\n25 26\n25 27\n27 29\n27 28\n23 20\n23 22\n20 21\n20 19\n3 12\n3 13\n13 14\n13 15\n15 16\n15 17\n15 18\n2\n6 17 25 20 5 9 13\n10 2 4 3 14 16 18 22 29 30 19\n", "output": "3\n-1\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYash has recently learnt about the Fibonacci sequence and is very excited about it. He calls a sequence Fibonacci-ish if \n\n 1. the sequence consists of at least two elements \n 2. f0 and f1 are arbitrary \n 3. fn + 2... | [{"type": "stdin_stdout", "input": "11\n-9 -1 -10 9 7 -4 0 -13 -3 3 5\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "11\n-9 -1 -10 9 7 -4 0 -13 -2 3 5\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "11\n-9 -1 -2 9 7 -4 -1 -13 -3 3 5\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "11\n-9 -1 -... | 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 a1, a2, ..., an. Kolya will put them in the juicer in the fixed order, starting with orange of size a1, then orange of size a2 and so on. To be put in t... | [{"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 1322 572 961 579 318 721 337 488 717 111 70 416 685 987 130 353 107 61 191 827 849 106 815 21... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSanta Claus has n candies, he dreams to give them as gifts to children.\n\nWhat is the maximal number of children for whose he can give candies if Santa Claus want each kid should get distinct positive integer number of c... | [{"type": "stdin_stdout", "input": "1000\n", "output": "44\n1 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 54 "}, {"type": "stdin_stdout", "input": "999\n", "output": "44\n1 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 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nArkadiy has lots square photos with size a × a. He wants to put some of them on a rectangular wall with size h × w. \n\nThe photos which Arkadiy will put on the wall must form a rectangular grid and the distances between ... | [{"type": "stdin_stdout", "input": "469568633 681052815 681052815\n", "output": "105742091.0000000000\n"}, {"type": "stdin_stdout", "input": "452081307 790635695 790635695\n", "output": "169277194.0000000000\n"}, {"type": "stdin_stdout", "input": "338084774 564168943 564168943\n", "output": "113042084.5000000000\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp is very careful. He even types numeric sequences carefully, unlike his classmates. If he sees a sequence without a space after the comma, with two spaces in a row, or when something else does not look neat, he ru... | [{"type": "stdin_stdout", "input": ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\n", "output": ", , , , , , ,... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe capital of Berland looks like a rectangle of size n × m of the square blocks of same size.\n\nFire!\n\nIt is known that k + 1 blocks got caught on fire (k + 1 ≤ n·m). Those blocks are centers of ignition. Moreover pos... | [{"type": "stdin_stdout", "input": "1000000000 1010000000 10\n668983398 843926244\n730038846 389721428\n400508549 779159281\n683648123 559948749\n105869012 181419826\n391396726 503295408\n248489591 686114055\n102102370 108241714\n610800354 28286278\n587730768 379340837\n", "output": "331016602\n"}, {"type": "stdin_stdo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHands that shed innocent blood!\n\nThere are n guilty people in a line, the i-th of them holds a claw with length Li. The bell rings and every person kills some of people in front of him. All people kill others at the sam... | [{"type": "stdin_stdout", "input": "11\n1 0 0 1 1 3 2 0 0 2 3\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "11\n1 0 0 1 0 3 2 0 0 2 3\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "11\n1 0 0 1 0 3 2 0 0 2 2\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "2\n1000000000 1000000000\n", "outpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEdogawa Conan got tired of solving cases, and invited his friend, Professor Agasa, over. They decided to play a game of cards. Conan has n cards, and the i-th card has a number ai written on it.\n\nThey take turns playing... | [{"type": "stdin_stdout", "input": "10\n50096 50096 50096 50096 50096 50096 55337 50096 50096 50096\n", "output": "Conan\n"}, {"type": "stdin_stdout", "input": "10\n53335 35239 26741 28797 35239 26741 35239 35239 53335 35239\n", "output": "Conan\n"}, {"type": "stdin_stdout", "input": "10\n38282 53699 38282 69689 38282 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n consecutive seat places in a railway carriage. Each place is either empty or occupied by a passenger.\n\nThe university team for the Olympiad consists of a student-programmers and b student-athletes. Determine... | [{"type": "stdin_stdout", "input": "64 59 2\n.*.***......****.*..**..**..****.*.*.*.**...**..***.***.*..*..*.\n", "output": "23\n"}, {"type": "stdin_stdout", "input": "64 59 3\n.*.***......****.*..**..**..****.*.*.*.**...**..***.***.*..*..*.\n", "output": "24\n"}, {"type": "stdin_stdout", "input": "64 8 3\n.*.***......... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA very unusual citizen lives in a far away kingdom — Dwarf Gracula. However, his unusual name is not the weirdest thing (besides, everyone long ago got used to calling him simply Dwarf Greg). What is special about Dwarf G... | [{"type": "stdin_stdout", "input": "10000 10000 10000\n", "output": "10000.0000000000\n"}, {"type": "stdin_stdout", "input": "11000 10000 10000\n", "output": "10000.0000000000\n"}, {"type": "stdin_stdout", "input": "9999 10000 10000\n", "output": "9999.0000000000\n"}, {"type": "stdin_stdout", "input": "10000 9999 10000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRaju and Rani and playing games in the school. Raju has recently learned how to draw angles. \nHe knows how to draw some angles. He also can add/subtract any of the two angles he draws. Rani now wants to test Raju. \n\... | [{"type": "stdin_stdout", "input": "6 10\n202 354 122 286 138 46\n124 266 181 2 140 246 227 153 68 346", "output": "YES\nYES\nNO\nYES\nYES\nYES\nNO\nNO\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "6 10\n202 354 122 286 244 46\n16 266 181 4 203 246 227 288 68 346", "output": "YES\nYES\nNO\nYES\nNO\nYES\nNO\nYES\nYE... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFebruary Easy Challenge 2015 is underway. Hackerearth welcomes you all and hope that all you awesome coders have a great time. So without wasting much of the time let's begin the contest. \n\nPrime Numbers have always b... | [{"type": "stdin_stdout", "input": "82\n9640\n4797\n29790\n23696\n9640\n2691\n3070\n26136\n12309\n11629\n14060\n7053\n6461\n20643\n16255\n120\n28371\n16925\n5789\n29110\n19346\n23993\n25728\n808\n3619\n30858\n5818\n26028\n30529\n5747\n3959\n26956\n29467\n7669\n23043\n28598\n4602\n32326\n2188\n25324\n29731\n31651\n7976\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMonk has to visit a land where strange creatures, known as Pokemons, roam around in the wild. Each Pokemon in the land will attack any visitor. They can only be pacified by feeding them their favorite food. \nThe Pokemon... | [{"type": "stdin_stdout", "input": "1\n5\n2 1\n2 2\n3 1\n4 7\n2 10\n\nEMPMAS", "output": "4\n"}, {"type": "stdin_stdout", "input": "1\n5\n1 1\n2 2\n3 1\n4 5\n2 10\n\nSAMPME", "output": "3\n"}, {"type": "stdin_stdout", "input": "1\n5\n1 1\n2 2\n3 1\n4 5\n2 10\n\nEMPMAS", "output": "3\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHow many multiples of d are there among the integers between L and R (inclusive)?\n\nConstraints\n\n* All values in input are integers.\n* 1 \\leq L \\leq R \\leq 100\n* 1 \\leq d \\leq 100\n\nInput\n\nInput is given from... | [{"type": "stdin_stdout", "input": "-1 110 1", "output": "112\n"}, {"type": "stdin_stdout", "input": "-1 111 1", "output": "113\n"}, {"type": "stdin_stdout", "input": "-1 101 1", "output": "103\n"}, {"type": "stdin_stdout", "input": "12 139 1", "output": "128\n"}, {"type": "stdin_stdout", "input": "12 152 1", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven are simple undirected graphs X, Y, Z, with N vertices each and M_1, M_2, M_3 edges, respectively. The vertices in X, Y, Z are respectively called x_1, x_2, \\dots, x_N, y_1, y_2, \\dots, y_N, z_1, z_2, \\dots, z_N. ... | [{"type": "stdin_stdout", "input": "100000\n-1\n0 -1\n0\n49829 100010\n1\n2 101000", "output": "174435630"}, {"type": "stdin_stdout", "input": "100000\n0\n0 -1\n1\n49829 100010\n1\n1 100000", "output": "174435630"}, {"type": "stdin_stdout", "input": "100000\n0\n0 -1\n1\n49829 100010\n1\n1 100100", "output": "174435630"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRequirements\n\n* All inputs are of non-negative integer value.\n* T_{\\text{max}} = 10000\n* 200 \\leq |V| \\leq 400\n* 1.5 |V| \\leq |E| \\leq 2 |V|\n* 1 \\leq u_{i}, v_{i} \\leq |V| (1 \\leq i \\leq |E|)\n* 1 \\leq d_{... | [{"type": "stdin_stdout", "input": "5 7\n1 2 5\n5 3 4\n2 4 12\n1 5 1\n2 1 3\n4 5 3\n4 3 9\n12\n1\n1 1\n1\n2 6\n1\n3 4\n0", "output": "-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "5 7\n1 2 5\n5 3 4\n4 4 12\n1 5 1\n3 2 3\n5 5 2\n4 3 8\n10\n1\n0 1\n2\n2 1\n1\n3 8\n0", "output": "-... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA sequence a=\\\\{a_1,a_2,a_3,......\\\\} is determined as follows:\n\n* The first term s is given as input.\n\n* Let f(n) be the following function: f(n) = n/2 if n is even, and f(n) = 3n+1 if n is odd.\n\n* a_i = s when... | [{"type": "stdin_stdout", "input": "108", "output": "115\n"}, {"type": "stdin_stdout", "input": "107", "output": "102\n"}, {"type": "stdin_stdout", "input": "161", "output": "100\n"}, {"type": "stdin_stdout", "input": "220", "output": "116\n"}, {"type": "stdin_stdout", "input": "588", "output": "120\n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJoisino is working as a receptionist at a theater.\n\nThe theater has 100000 seats, numbered from 1 to 100000.\n\nAccording to her memo, N groups of audiences have come so far, and the i-th group occupies the consecutive ... | [{"type": "stdin_stdout", "input": "2\n151 -2\n0 4", "output": "-147\n"}, {"type": "stdin_stdout", "input": "2\n276 -2\n0 4", "output": "-272\n"}, {"type": "stdin_stdout", "input": "2\n276 -1\n0 4", "output": "-271\n"}, {"type": "stdin_stdout", "input": "2\n276 -1\n0 7", "output": "-268\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nE869120 defined a sequence $a$ like this:\n\n\n* $a_1=a_2=1$, $a_{k+2}=a_{k+1}+a_k \\ (k \\ge 1)$\n\n\nHe also defined sequences $d_1, d_2, d_3, \\dots , d_n$, as the following recurrence relation :\n\n\n* $d_{1, j} = a_j... | [{"type": "stdin_stdout", "input": "42 102", "output": "184174004\n"}, {"type": "stdin_stdout", "input": "42 123", "output": "268300608\n"}, {"type": "stdin_stdout", "input": "46 123", "output": "960087486\n"}, {"type": "stdin_stdout", "input": "70 123", "output": "396400358\n"}, {"type": "stdin_stdout", "input": "42 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour task is to write a program which reads a sequence of integers and prints mode values of the sequence. The mode value is the element which occurs most frequently.\n\n\n\nInput\n\nA sequence of integers ai (1 ≤ ai ≤ 10... | [{"type": "stdin_stdout", "input": "5\n11\n3\n5\n8\n10\n11\n8\n29\n1\n3\n2", "output": "3\n5\n8\n11\n"}, {"type": "stdin_stdout", "input": "5\n11\n4\n10\n4\n-1\n20\n8\n20\n2\n8\n0", "output": "4\n8\n20\n"}, {"type": "stdin_stdout", "input": "5\n11\n2\n11\n1\n-2\n20\n8\n22\n2\n6\n1", "output": "1\n2\n11\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is BMI (Body Mass Index) as an index showing the degree of obesity. The BMI value is calculated using the following formula.\n\nBMI = weight (kg) / (height (m)) 2\n\nThe closer the BMI value is to the standard value... | [{"type": "stdin_stdout", "input": "6\n2 165 27\n-1 317 60\n2 68 72\n11 160 75\n7 185 001\n10 182 113\n3\n3 37 105\n0 229 6\n2 204 75\n0", "output": "11\n2\n"}, {"type": "stdin_stdout", "input": "6\n2 95 27\n-1 317 60\n2 68 72\n11 160 75\n7 185 101\n10 182 113\n3\n3 37 105\n0 229 6\n1 204 75\n0", "output": "11\n1\n"}, ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAkira, the student council president of A High School, decided to investigate which club activities the A High School students belong to. A High School has N students numbered 1 to N and M types of club activities numbere... | [{"type": "stdin_stdout", "input": "3 2 7\n1 1 2\n1 2 3\n2 1 1\n2 3 2\n2 2 1", "output": "4\n"}, {"type": "stdin_stdout", "input": "3 2 5\n2 1 2\n1 2 3\n2 1 1\n2 3 2\n2 2 1", "output": "3\n"}, {"type": "stdin_stdout", "input": "3 2 6\n1 1 2\n1 2 3\n2 1 1\n2 3 1\n2 2 2", "output": "5\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAt the end of last year, Santa Claus forgot to give Christmas presents to the children in JOI village. Therefore, I decided to deliver the chocolate cake to the children as an apology. The day to deliver is approaching to... | [{"type": "stdin_stdout", "input": "12 8\n3\n-1 1\n3 4\n18 6", "output": "31\n3 4\n"}, {"type": "stdin_stdout", "input": "1 4\n3\n1 -1\n0 6\n2 -1", "output": "10\n1 -1\n"}, {"type": "stdin_stdout", "input": "12 8\n3\n-1 1\n3 4\n18 5", "output": "30\n3 4\n"}, {"type": "stdin_stdout", "input": "12 8\n3\n-1 1\n5 4\n10 5",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn old document says that a Ninja House in Kanazawa City was in fact a defensive fortress, which was designed like a maze. Its rooms were connected by hidden doors in a complicated manner, so that any invader would become... | [{"type": "stdin_stdout", "input": "2\n3 3 3 3 -3 3 2 -5 3 2 -5 -3 0\n3 5 3 -2 4 -3 -2 -2 -1 0", "output": "1 2 4 6\n2 1 3 8\n3 2 4 7\n4 1 3 5\n5 4 6 7\n6 1 5\n7 3 5 8\n8 2 7\n1 2 2 3 4\n2 1 1 3 4 4\n3 1 2 4\n4 1 2 2 3\n"}, {"type": "stdin_stdout", "input": "2\n3 3 3 3 -3 3 2 -5 3 2 -5 -3 0\n3 5 4 -2 4 -1 -2 -2 -1 0", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n5 3\n4\n2\n5\n\n\nOutput\n\n5\n2\n4\n1\n3\n\nThe input will be given via stdin and the output should be printed to stdout by your code.\n\nNow solve the problem by providing the code.\n\nWrite Python c... | [{"type": "stdin_stdout", "input": "92 1\n1\n-2\n2", "output": "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n43\n44\n45\n46\n47\n48\n49\n50\n51\n52\n53\n54\n55\n56\n57\n58\n59\n60\n61\n62\n63\n64\n65\n66\n6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are a treasure hunter traveling around the world. Finally, you’ve got an ancient text indicating the place where the treasure was hidden. The ancient text looks like a meaningless string of characters at first glance.... | [{"type": "stdin_stdout", "input": "ABCABCABAB\nZZZZZZZZZZZZ\nNDD", "output": "ABAB\nZZZZZZ\nD\n"}, {"type": "stdin_stdout", "input": "ABCABCACAB\nZZZZZZZZZZZZ\nNDD", "output": "ACAB\nZZZZZZ\nD\n"}, {"type": "stdin_stdout", "input": "ABCABCABAB\nZZZZZZZZZZZZ\nNEE", "output": "ABAB\nZZZZZZ\nE\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA rabbit who came to the fair found that the prize for a game at a store was a carrot cake. The rules for this game are as follows.\n\nThere is a grid-like field of vertical h squares x horizontal w squares, and each bloc... | [{"type": "stdin_stdout", "input": "4 6 1\n......\n...Y..\n/..Z..\nYRRRYY", "output": "YES\n"}, {"type": "stdin_stdout", "input": "4 6 1\n......\n...Y..\n..Z../\nYRRRYY", "output": "YES\n"}, {"type": "stdin_stdout", "input": "4 6 1\n......\n...Y./\n/..Z..\nYRRRYY", "output": "YES\n"}, {"type": "stdin_stdout", "input": ... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.