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\nYou have n students under your control and you have to compose exactly two teams consisting of some subset of your students. Each student had his own skill, the i-th student skill is denoted by an integer a_i (different s... | [{"type": "stdin_stdout", "input": "4\n7\n4 2 4 1 4 3 4\n5\n2 1 5 4 3\n1\n1\n4\n1 1 1 3\n", "output": "3\n1\n0\n2\n"}, {"type": "stdin_stdout", "input": "4\n7\n4 2 4 1 4 3 4\n5\n2 1 5 1 3\n1\n1\n4\n1 1 1 3\n", "output": "3\n2\n0\n2\n"}, {"type": "stdin_stdout", "input": "4\n7\n4 2 4 1 4 3 4\n5\n2 1 2 1 3\n1\n1\n4\n1 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSometimes it is not easy to come to an agreement in a bargain. Right now Sasha and Vova can't come to an agreement: Sasha names a price as high as possible, then Vova wants to remove as many digits from the price as possi... | [{"type": "stdin_stdout", "input": "95055178000205260180556042828469886821972993271643754429823604722162451915059073850774876808409097598794600994399688807965137141272981858091943527288664634386153778015566442088186037610366674832297348883687217598717131508310470819945168011745597038777198061493923608045375725309288583... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA median of an array of integers of length n is the number standing on the β {n/2} β (rounding up) position in the non-decreasing ordering of its elements. Positions are numbered starting with 1. For example, a median of ... | [{"type": "stdin_stdout", "input": "6\n2 4\n0 24 37 58 62 64 69 78\n2 2\n27 61 81 91\n4 3\n0 4 16 18 21 27 36 53 82 91 92 95\n3 4\n1 11 12 22 33 35 38 67 69 71 94 99\n2 1\n11 41\n3 3\n1 2 1 1 1 1 1 1 -1\n", "output": "168\n108\n145\n234\n11\n3\n"}, {"type": "stdin_stdout", "input": "6\n2 4\n0 24 25 58 62 64 69 78\n2 2\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given three bags. Each bag contains a non-empty multiset of numbers. You can perform a number of operations on these bags. In one operation, you can choose any two non-empty bags, and choose one number from each o... | [{"type": "stdin_stdout", "input": "3 3 3\n1000 1000 1000\n1000 1000 1000\n1 1 -1\n", "output": "5999\n"}, {"type": "stdin_stdout", "input": "3 3 3\n1010 1000 1000\n1000 1000 1000\n1 1 -1\n", "output": "6009\n"}, {"type": "stdin_stdout", "input": "3 3 3\n1010 1000 1000\n1000 1100 1000\n1 1 -1\n", "output": "6109\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFarmer John has a farm that consists of n pastures connected by one-directional roads. Each road has a weight, representing the time it takes to go from the start to the end of the road. The roads could have negative weig... | [{"type": "stdin_stdout", "input": "3\n3\n0 4 10\n2\n0 0001000000\n1\n0\n", "output": "-10\n0\n0\n"}, {"type": "stdin_stdout", "input": "3\n3\n0 4 19\n2\n0 0001000000\n1\n0\n", "output": "-19\n0\n0\n"}, {"type": "stdin_stdout", "input": "3\n3\n0 2 12\n2\n0 1000010011\n1\n0\n", "output": "-12\n0\n0\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nΠ‘ity N. has a huge problem with roads, food and IT-infrastructure. In total the city has n junctions, some pairs of them are connected by bidirectional roads. The road network consists of n - 1 roads, you can get from any... | [{"type": "stdin_stdout", "input": "20\n3 4\n17 11\n8 15\n7 20\n1 11\n9 4\n6 10\n19 6\n12 5\n7 19\n14 12\n14 16\n19 2\n18 7\n16 13\n17 13\n12 18\n9 11\n6 15\n", "output": "18\n1 18\n2 17\n3 16\n4 15\n5 14\n6 13\n7 12\n8 11\n9 10\n10 9\n11 8\n12 7\n13 6\n14 5\n15 4\n16 3\n17 2\n18 1\n"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPermutation p is an ordered set of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. We'll denote the i-th element of permutation p as pi. We'll call number n the size or... | [{"type": "stdin_stdout", "input": "100\n-77 57 -95 -23 53 -29 82 -83 38 -73 85 28 25 6 -16 4 -10 -30 -9 -92 14 34 -93 61 36 -100 90 -68 28 16 100 -4 49 23 36 -87 62 -62 53 74 -50 -2 102 8 22 -30 -19 83 7 84 43 90 -65 -75 -15 97 90 15 66 2 13 -91 91 -44 62 51 51 -58 95 77 20 45 76 79 91 60 76 2 82 42 -130 94 -70 122 65... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne warm and sunny day king Copa decided to visit the shooting gallery, located at the Central Park, and try to win the main prize β big pink plush panda. The king is not good at shooting, so he invited you to help him.\n... | [{"type": "stdin_stdout", "input": "10\n-4 7 24 1.8252658176990018\n3 -1 50 0.111185\n-2 -8 27 0.976475\n-9 -2 6 0.6362966234482478\n6 -4 21 0.526054\n-7 2 19 0.488637\n-6 -5 50 0.819011\n-7 3 39 0.987596\n-3 -8 9 0.8139131170857096\n4 10 1 0.9052567295555951\n", "output": "4.5371295472545965\n"}, {"type": "stdin_stdou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGerald has been selling state secrets at leisure. All the secrets cost the same: n marks. The state which secrets Gerald is selling, has no paper money, only coins. But there are coins of all positive integer denomination... | [{"type": "stdin_stdout", "input": "108\n", "output": " 2"}, {"type": "stdin_stdout", "input": "243\n", "output": " 1"}, {"type": "stdin_stdout", "input": "81\n", "output": " ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHooray! Berl II, the king of Berland is making a knight tournament. The king has already sent the message to all knights in the kingdom and they in turn agreed to participate in this grand event.\n\nAs for you, you're jus... | [{"type": "stdin_stdout", "input": "11 8\n3 5 5\n8 9 9\n4 6 6\n8 10 10\n5 7 7\n2 7 2\n10 11 11\n1 11 1\n", "output": "0 1 5 5 6 7 2 9 10 11 1 \n"}, {"type": "stdin_stdout", "input": "11 8\n3 5 5\n8 9 9\n4 6 6\n8 10 10\n4 7 7\n2 7 2\n10 11 11\n1 11 1\n", "output": "0 1 5 5 6 7 2 9 10 11 1\n"}, {"type": "stdin_stdout", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCertainly, everyone is familiar with tic-tac-toe game. The rules are very simple indeed. Two players take turns marking the cells in a 3 Γ 3 grid (one player always draws crosses, the other β noughts). The player who succ... | [{"type": "stdin_stdout", "input": "0X0\nX0X\n0X.\n", "output": "the second player won\n"}, {"type": "stdin_stdout", "input": "X.0\n0X0\nXX0\n", "output": "the second player won\n"}, {"type": "stdin_stdout", "input": "XX0\n000\nXX.\n", "output": "the second player won\n"}, {"type": "stdin_stdout", "input": "00X\nX0.\nX... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlas, finding one's true love is not easy. Masha has been unsuccessful in that yet. Her friend Dasha told Masha about a way to determine the phone number of one's Prince Charming through arithmancy. \n\nThe phone number i... | [{"type": "stdin_stdout", "input": "17601120900014764776764048700928872725171605903217\n", "output": "10428170619\n"}, {"type": "stdin_stdout", "input": "78767765544454334445445555455676565433343455432332\n", "output": "11031574582\n"}, {"type": "stdin_stdout", "input": "676765666545656543321110112122111112234332221100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev got hold of lots of wooden cubes somewhere. They started making cube towers by placing the cubes one on top of the o... | [{"type": "stdin_stdout", "input": "53 3\n1 3 4 4 5 7 10 14 19 25 32 40 23 59 70 82 148 109 124 140 157 175 194 214 235 257 280 304 329 355 382 410 439 469 500 532 565 599 634 670 388 745 784 824 865 907 950 994 1039 1085 1132 1180 1229\n1 2 40\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "53 3\n1 3 4 4 5 7 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe New Vasjuki village is stretched along the motorway and that's why every house on it is characterized by its shift relative to some fixed point β the xi coordinate. The village consists of n houses, the i-th house is ... | [{"type": "stdin_stdout", "input": "10\n47 21 20 91 22 28 92 100 47 69\n", "output": "11.000000\n31.000000 58.000000 102.000000 "}, {"type": "stdin_stdout", "input": "10\n26 21 20 91 22 28 92 62 47 69\n", "output": "11.000000\n31.000000 58.000000 102.000000 "}, {"type": "stdin_stdout", "input": "10\n47 21 20 91 22 28 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLimak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are n players (including Limak himself) and right now all of them have bids on the table. i-th of them has bid with siz... | [{"type": "stdin_stdout", "input": "50\n840868705 387420489 387420489 795385082 634350497 206851546 536870912 536870912 414927754 387420489 387420489 536870912 387420489 149011306 373106005 536870912 700746206 387420489 1418799299 847215247 176645254 576664386 387420489 230876513 536870912 536870912 536870912 387420489... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJack decides to invite Emma out for a dinner. Jack is a modest student, he doesn't want to go to an expensive restaurant. Emma is a girl with high taste, she prefers elite places.\n\nMunhattan consists of n streets and m ... | [{"type": "stdin_stdout", "input": "10 10\n256 72 455 45 912 506 235 68 951 92\n246 305 45 212 788 621 449 876 459 899\n732 107 230 357 370 610 997 669 61 192\n131 93 481 527 983 920 825 540 435 54\n777 682 984 20 337 480 264 137 249 502\n51 467 479 228 923 752 714 436 199 973\n3 91 612 571 631 212 751 84 886 948\n252 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTwo positive integers a and b have a sum of s and a bitwise XOR of x. How many possible values are there for the ordered pair (a, b)?\n\nInput\n\nThe first line of the input contains two integers s and x (2 β€ s β€ 1012, 0 ... | [{"type": "stdin_stdout", "input": "549755813887 549755813887\n", "output": "549755813886\n"}, {"type": "stdin_stdout", "input": "549755813888 549755813886\n", "output": "274877906944\n"}, {"type": "stdin_stdout", "input": "547616456703 547599679487\n", "output": "68719476736\n"}, {"type": "stdin_stdout", "input": "552... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a rebus of form ? + ? - ? + ? = n, consisting of only question marks, separated by arithmetic operation '+' and '-', equality and positive integer n. The goal is to replace each question mark with some posit... | [{"type": "stdin_stdout", "input": "? + ? + ? - ? + ? - ? - ? - ? - ? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? + ? - ? - ? - ? + ? - ? - ? + ? - ? - ? + ? - ? + ? + ? - ? + ? - ? - ? + ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPari wants to buy an expensive chocolate from Arya. She has n coins, the value of the i-th coin is ci. The price of the chocolate is k, so Pari will take a subset of her coins with sum equal to k and give it to Arya.\n\nL... | [{"type": "stdin_stdout", "input": "15 388\n33 232 106 369 266 135 22 169 367 37 14 181 232 25 257\n", "output": "89\n0 14 22 25 33 36 37 39 47 51 55 58 59 61 62 69 70 72 73 76 80 84 92 94 95 98 106 109 117 131 135 149 157 160 168 169 172 174 181 182 183 186 191 193 194 195 197 202 205 206 207 214 216 219 220 228 231 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two arithmetic progressions: a1k + b1 and a2l + b2. Find the number of integers x such that L β€ x β€ R and x = a1k' + b1 = a2l' + b2, for some integers k', l' β₯ 0.\n\nInput\n\nThe only line contains six integ... | [{"type": "stdin_stdout", "input": "1789433851 -633540112 1286318222 -1728151682 1438333624 1538194890\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1955378240 -837482305 1743607821 -1623988108 -653286850 178227154\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "219427 -1712095577 1502893658 5552436... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have n devices that you want to use simultaneously.\n\nThe i-th device uses ai units of power per second. This usage is continuous. That is, in λ seconds, the device will use λ·ai units of power. The i-th device curre... | [{"type": "stdin_stdout", "input": "20 16807\n75250 50074\n43659 8931\n11273 27545\n50879 77924\n37710 64441\n38166 84493\n43043 7988\n22504 82328\n31730 78841\n42613 44304\n33170 17710\n97158 31491\n70934 93100\n80279 51817\n95336 99098\n7827 13513\n29268 23811\n77634 80980\n79150 36580\n58822 11968\n", "output": "0.2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA game field is a strip of 1 Γ n square cells. In some cells there are Packmen, in some cells β asterisks, other cells are empty.\n\nPackman can move to neighboring cell in 1 time unit. If there is an asterisk in the targ... | [{"type": "stdin_stdout", "input": "100\n************************************************************P***************************************\n", "output": "138\n"}, {"type": "stdin_stdout", "input": "100\n.....................P............P....P....*.............*.......**.P.................P........*...\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs you could know there are no male planes nor female planes. However, each plane on Earth likes some other plane. There are n planes on Earth, numbered from 1 to n, and the plane with number i likes the plane with number... | [{"type": "stdin_stdout", "input": "100\n25 6 46 37 87 99 70 31 46 12 94 40 87 56 28 14 94 39 13 12 67 13 71 39 83 48 40 14 62 41 16 71 20 41 83 41 68 98 23 82 62 83 62 35 49 22 31 21 66 98 54 39 34 52 11 28 47 89 25 44 68 36 91 46 82 86 88 48 27 93 7 9 53 36 16 100 84 84 44 25 58 66 16 46 72 21 91 78 4 17 44 17 47 67 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBishwock is a chess figure that consists of three squares resembling an \"L-bar\". This figure can be rotated by 90, 180 and 270 degrees so it can have four possible states:\n \n \n \n XX XX .X X. \n ... | [{"type": "stdin_stdout", "input": "0000000000000000000000000000000000000000000000000000000000X0000000000000000000000000000000000000X000\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "output": "66\n"}, {"type": "stdin_stdout", "input": "0000X00X000000X0000X00X... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Syed loves brute force. He thinks that brute force can be the solution to any problem in the world. You give him any question, and he'll have a brute force answer ready for you, almost all the time. His good friend... | [{"type": "stdin_stdout", "input": "2\n101\n17713\n\nRAMPME", "output": "-1\n13832\n"}, {"type": "stdin_stdout", "input": "2\n100\n4150\n\nSAMPLE", "output": "-1\n4104\n"}, {"type": "stdin_stdout", "input": "2\n101\n4150\n\nSAMPLE", "output": "-1\n4104\n"}, {"type": "stdin_stdout", "input": "2\n000\n3041\n\nRAMPLE", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPranav just learned about Modulus(%) and trying to solve a problem on Modulus but he always get TLE. Your task is to help him. Problem is simple, you have been given two numbers A and M and you have to find A%M and print ... | [{"type": "stdin_stdout", "input": "2\n16168 15\n26 123\n\nSAMPLE", "output": "13\n26\n"}, {"type": "stdin_stdout", "input": "2\n16168 15\n18 123\n\nSAMPLE", "output": "13\n18\n"}, {"type": "stdin_stdout", "input": "2\n12344 12\n12 123\n\nSAMPLE", "output": "8\n12\n"}, {"type": "stdin_stdout", "input": "2\n12344 11\n12... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs the students are back in hostel after a long time, the gamers have decided to have a LAN gaming competition to find out who has utilized his time in gaming during vacations. They play \"Counter ATOD\". However, the sco... | [{"type": "stdin_stdout", "input": "-1 5\nMurliaalw 2\nMithaiwal` 4\nMjthaiwala 6\nalbwhahtiM 1\nahawilbriN 18\n\nLSMPAE", "output": "ahawilbriN\n"}, {"type": "stdin_stdout", "input": "0 5\nMurljaalw 7\nMiugaiwala 4\nalawiahsjM 5\nMithajvala -6\nwirchiLala 12\n\nSAMPLE", "output": "wirchiLala\n"}, {"type": "stdin_stdou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)\n\nWe will cl... | [{"type": "stdin_stdout", "input": "2 -777", "output": "1556\n"}, {"type": "stdin_stdout", "input": "2 -839", "output": "1680\n"}, {"type": "stdin_stdout", "input": "1 -839", "output": "1679\n"}, {"type": "stdin_stdout", "input": "181 21", "output": "139\n"}, {"type": "stdin_stdout", "input": "194 13", "output": "168\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke is playing with red and blue balls, placing them on a two-dimensional plane.\n\nFirst, he performed N operations to place red balls. In the i-th of these operations, he placed RC_i red balls at coordinates (RX_i,RY_... | [{"type": "stdin_stdout", "input": "10\n582463373 690528069 8\n621230322 318051944 4\n356524296 974059503 6\n372751381 111542460 9\n392867214 581476334 2\n606955458 513028121 5\n1258194549 791660614 9\n250465517 110090143 3\n618624774 406956634 6\n426294747 736401096 0\n974896051 888765942 2\n424730474 653092928 0\n868... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string S consisting of lowercase English letters. We will write down this string, starting a new line after every w letters. Print the string obtained by concatenating the letters at the beginnings of thes... | [{"type": "stdin_stdout", "input": "dnuoodnuuuhs\n1", "output": "dnuoodnuuuhs\n"}, {"type": "stdin_stdout", "input": "shuuundoound\n1", "output": "shuuundoound\n"}, {"type": "stdin_stdout", "input": "dnuondouuuhs\n1", "output": "dnuondouuuhs\n"}, {"type": "stdin_stdout", "input": "siuuuodnound\n1", "output": "siuuuodno... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of len... | [{"type": "stdin_stdout", "input": "12814", "output": "160\n"}, {"type": "stdin_stdout", "input": "19710", "output": "199\n"}, {"type": "stdin_stdout", "input": "36877", "output": "272\n"}, {"type": "stdin_stdout", "input": "49568", "output": "315\n"}, {"type": "stdin_stdout", "input": "44971", "output": "300\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke is interested in strings that satisfy the following conditions:\n\n* The length of the string is at least N.\n* The first N characters equal to the string s.\n* The last N characters equal to the string t.\n\n\n\nFi... | [{"type": "stdin_stdout", "input": "4\nexpr\nexpq", "output": "8\n"}, {"type": "stdin_stdout", "input": "4\nexpr\nrxep", "output": "7\n"}, {"type": "stdin_stdout", "input": "4\nexpr\nepxq", "output": "8\n"}, {"type": "stdin_stdout", "input": "4\nexpr\npexq", "output": "8\n"}, {"type": "stdin_stdout", "input": "4\nexpr\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nUsing the given four integers from 1 to 9, we create an expression that gives an answer of 10. When you enter four integers a, b, c, d, write a program that outputs an expression that gives an answer of 10 according to th... | [{"type": "stdin_stdout", "input": "8 7 13 9\n1 0 1 1\n4 9 14 2\n0 0 0 0", "output": "((8 - 13) * (7 - 9))\n0\n((4 - 2) * (14 - 9))\n"}, {"type": "stdin_stdout", "input": "8 8 13 10\n1 4 4 4\n5 5 7 5\n0 0 0 0", "output": "(((8 - 8) * 13) + 10)\n0\n((5 * 7) - (5 * 5))\n"}, {"type": "stdin_stdout", "input": "8 7 9 9\n4 4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAizu Gakuen High School holds a school festival every year. The most popular of these is the haunted house. The most popular reason is that 9 classes do haunted houses instead of 1 or 2 classes. Each one has its own uniqu... | [{"type": "stdin_stdout", "input": "1a 132 243\n1c 324 183\n1f 93 199\n2b 372 163\n2c 229 346\n2e 391 206\n3a 118 168\n3b 263 293\n3d 281 102", "output": "1a 375 99300\n1c 507 119700\n1f 292 78300\n2b 535 123300\n2c 575 149600\n2e 597 140000\n3a 286 74000\n3b 556 140500\n3d 383 86800\n"}, {"type": "stdin_stdout", "inpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nDuring this time of winter in Japan, hot days continue in Australia in the Southern Hemisphere. IOI, who lives in Australia, decided to plan what clothes to wear based on the weather forecast for a certain D da... | [{"type": "stdin_stdout", "input": "3 4\n31\n27\n35\n20 25 30\n23 29 90\n21 35 60\n28 48 40", "output": "100\n"}, {"type": "stdin_stdout", "input": "3 4\n31\n27\n35\n20 25 30\n23 29 90\n21 35 60\n28 48 25", "output": "130\n"}, {"type": "stdin_stdout", "input": "3 4\n34\n40\n44\n38 25 30\n24 29 11\n21 69 99\n28 43 40", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have full control over a robot that walks around in a rectangular field paved with square tiles like a chessboard. There are m columns of tiles from west to east, and n rows of tiles from south to north (1 <= m, n <= ... | [{"type": "stdin_stdout", "input": "11 5\nFORWARD 3\nRIGHT\nFORWARD 10\nLEFT\nBACKWARD 3\nSTOP\n3 1\nFORWARD 2\nSTOP\n0 0", "output": "11 1\n1 1\n"}, {"type": "stdin_stdout", "input": "14 5\nFORWARD 3\nRIGHT\nFORWARD 8\nLEFT\nBACKWARD 2\nSTOP\n3 1\nFORVARD 5\nSTOP\n0 0", "output": "9 2\n1 1\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour companyβs next product will be a new game, which is a three-dimensional variant of the classic game βTic-Tac-Toeβ. Two players place balls in a three-dimensional space (board), and try to make a sequence of a certain... | [{"type": "stdin_stdout", "input": "3 3 3\n1 1\n1 1\n1 1\n3 3 7\n3 2\n1 3\n1 1\n2 3\n2 1\n3 3\n3 1\n4 3 15\n1 1\n2 2\n1 1\n3 3\n3 3\n1 1\n3 3\n3 3\n4 4\n1 1\n4 4\n4 4\n4 4\n4 1\n2 2\n0 0 0", "output": "Draw\nWhite 6\nBlack 15\n"}, {"type": "stdin_stdout", "input": "3 3 3\n1 1\n1 1\n1 1\n3 3 7\n3 3\n1 3\n1 1\n2 3\n2 1\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem C Medical Checkup\n\nStudents of the university have to go for a medical checkup, consisting of lots of checkup items, numbered 1, 2, 3, and so on.\n\nStudents are now forming a long queue, waiting for the checkup... | [{"type": "stdin_stdout", "input": "3 102\n1\n3\n0", "output": "103\n34\n34\n"}, {"type": "stdin_stdout", "input": "3 35\n1\n3\n3", "output": "36\n12\n11\n"}, {"type": "stdin_stdout", "input": "3 55\n1\n3\n4", "output": "56\n19\n13\n"}, {"type": "stdin_stdout", "input": "3 55\n1\n3\n0", "output": "56\n19\n19\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAdvanced Computer Music (ACM) sold a rhythm machine that plays music according to a pre-programmed rhythm. At one point, ACM was trying to develop and sell a new rhythm machine. While ACM's old product could only play one... | [{"type": "stdin_stdout", "input": "5\n2\n01000000\n00020202\n2\n0102\n00000810\n1\n0200020008000200\n5\n0001\n000001\n0000000000\n00000000000001\n0000000000000000000001\n1\n000000", "output": "01020202\n01000A10\n02020802\n000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are playing a popular video game which is famous for its depthful story and interesting puzzles. In the game you were locked in a mysterious house alone and there is no way to call for help, so you have to escape on y... | [{"type": "stdin_stdout", "input": "...\n...\n.*.\n...\n...\n.*.\n...\n...\n...\n...\n...\n.*.\n...\n...\n.*.\n...\n...\n...\n\n...\n.*.\n...\n*..\n...\n..*\n*.*\n*/*\n*.*\n*.*\n.*.\n*.*\n*..\n.*.\n..*\n*.*\n...\n*.*\n\n...\n.*.\n.*.\n...\n.**\n*..\n...\n...\n.*.\n.*.\n...\n*..\n..*\n...\n.**\n...\n*..\n...\n\n#", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nF --Land inheritance\n\nProblem Statement\n\nOne $ N $ brother was discussing the inheritance of his parents. The vast heritage left by their parents included vast lands. The land has a rectangular shape extending $ H $ k... | [{"type": "stdin_stdout", "input": "0 2 1\n-1 2 1\n1 -1 -2\n1 -1 0", "output": "0\n"}, {"type": "stdin_stdout", "input": "0 2 1\n-1 2 1\n1 -1 -2\n2 -1 0", "output": "0\n"}, {"type": "stdin_stdout", "input": "0 2 2\n-1 2 1\n1 -1 -2\n2 -1 0", "output": "0\n"}, {"type": "stdin_stdout", "input": "0 2 2\n-1 2 1\n1 -1 -1\n2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nThere are $ N $ balls, each with its own color and value.\nThere are $ C $ types of ball colors from $ 1 $ to $ C $, and each color has an upper limit on the number of balls that can be selected.\nMaximize the ... | [{"type": "stdin_stdout", "input": "22 7 26\n11 14 15 3 11 7 16 17 1 4 2 17 4 14 16 16 3 13 17 12 7 11 2 20 12 22\n6 10\n1 3\n13 1\n16 5\n4 1\n20 7\n18 4\n26 7\n9 1\n12 2\n21 1\n21 7\n18 1\n14 5\n24 5\n6 1\n1 1\n2 5\n21 2\n7 6\n10 14\n15 7", "output": "58\n"}, {"type": "stdin_stdout", "input": "22 7 26\n11 14 15 3 11 7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads a $n \\times m$ matrix $A$ and a $m \\times l$ matrix $B$, and prints their product, a $n \\times l$ matrix $C$. An element of matrix $C$ is obtained by the following formula:\n\n\\\\[ c_{ij} =... | [{"type": "stdin_stdout", "input": "4 0 13\n1 1\n2 4\n4 15\n-1 0 2\n1 5 2", "output": "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\n0 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\n"}, {"type": "stdin_stdout", "input": "4 0 12\n1 1\n-1 2\n4 1\n1 0 -1\n1 12 5", "output": "0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt was exam time in pesce, mandya and Rubal was feeling hungry.However being late night and exam time he decided to look for snacks in every room.However because of his bad luck he missed the room which actually had snack... | [{"type": "stdin_stdout", "input": "2\n9\n5 4 2 8 3 1 3 13\n5\n1 5 2 4", "output": "6\n3\n"}, {"type": "stdin_stdout", "input": "2\n9\n5 4 2 8 3 1 3 13\n5\n1 3 2 4", "output": "6\n5\n"}, {"type": "stdin_stdout", "input": "2\n9\n5 4 2 8 3 1 7 9\n5\n1 5 2 3", "output": "6\n4\n"}, {"type": "stdin_stdout", "input": "2\n9\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya has an array a consisting of n integers. He has learned partial sums recently, and now he can calculate the sum of elements on any segment of the array really fast. The segment is a non-empty sequence of elements st... | [{"type": "stdin_stdout", "input": "10 -196228170\n-181402541 328251238 624722764 682518931 783857631 969228879 547715844 -149364638 823684584 563974794\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10 -196228170\n-181402541 328251238 624722764 682518931 783857631 969228879 547715844 -149364638 823684584 833... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a toy building consisting of n towers. Each tower consists of several cubes standing on each other. The i-th tower consists of h_i cubes, so it has height h_i.\n\nLet's define operation slice on some height H as ... | [{"type": "stdin_stdout", "input": "10 10\n1 1 1 1 1 1 1 1 1 1\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10 10\n3 3 3 3 3 3 3 3 3 3\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10 10\n1 1 1 1 2 1 1 1 1 1\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "10 10\n3 3 3 3 1 3 3 3 3 3\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence s consisting of n digits from 1 to 9.\n\nYou have to divide it into at least two segments (segment β is a consecutive sequence of elements) (in other words, you have to place separators between so... | [{"type": "stdin_stdout", "input": "21\n3\n123\n3\n123\n3\n123\n3\n123\n3\n123\n3\n213\n3\n123\n3\n123\n3\n123\n3\n321\n3\n123\n3\n321\n3\n132\n3\n322\n3\n321\n3\n341\n3\n123\n3\n421\n3\n421\n3\n421\n3\n421\n", "output": "YES\n2\n1 23\nYES\n2\n1 23\nYES\n2\n1 23\nYES\n2\n1 23\nYES\n2\n1 23\nYES\n2\n2 13\nYES\n2\n1 23\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter lessons Nastya decided to read a book. The book contains n chapters, going one after another, so that one page of the book belongs to exactly one chapter and each chapter contains at least one page.\n\nYesterday eve... | [{"type": "stdin_stdout", "input": "49\n1 17\n18 115\n116 211\n212 269\n270 345\n346 404\n405 441\n442 467\n468 526\n527 583\n584 664\n665 757\n758 794\n795 802\n803 882\n883 920\n921 960\n961 962\n963 1006\n1007 1081\n1082 1112\n1113 1149\n1150 1217\n1218 1282\n1283 1287\n1288 1365\n1366 1374\n1375 1379\n1380 1478\n14... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n students standing in a row. Two coaches are forming two teams β the first coach chooses the first team and the second coach chooses the second team.\n\nThe i-th student has integer programming skill a_i. All p... | [{"type": "stdin_stdout", "input": "100 10\n19 55 91 50 31 23 60 84 38 1 22 51 27 76 28 98 11 44 61 63 15 93 52 3 66 16 53 36 18 62 35 85 78 37 73 64 87 74 46 26 82 69 49 33 83 89 56 67 71 25 39 94 96 17 21 6 47 68 34 42 57 81 13 10 54 2 48 80 20 77 4 5 59 30 90 95 45 75 8 88 24 41 40 14 97 32 7 9 65 70 100 99 72 58 92... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a consisting of n integers. Each a_i is one of the six following numbers: 4, 8, 15, 16, 23, 42.\n\nYour task is to remove the minimum number of elements to make this array good.\n\nAn array of lengt... | [{"type": "stdin_stdout", "input": "100\n4 42 23 23 16 42 16 23 42 16 42 8 4 23 4 4 23 42 16 42 23 23 23 42 4 42 8 8 16 23 15 23 16 4 42 15 15 23 16 15 16 4 4 15 23 42 42 15 8 23 8 23 4 15 16 15 42 8 23 16 15 42 23 8 4 16 15 16 23 16 16 4 23 16 8 23 16 15 23 4 4 8 15 4 4 15 8 23 23 4 4 8 8 4 42 15 4 4 42 16\n", "output... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEach evening after the dinner the SIS's students gather together to play the game of Sport Mafia. \n\nFor the tournament, Alya puts candies into the box, which will serve as a prize for a winner. To do that, she performs ... | [{"type": "stdin_stdout", "input": "1000000000 846040702\n", "output": "999939239\n"}, {"type": "stdin_stdout", "input": "1000000000 315152540\n", "output": "999948715\n"}, {"type": "stdin_stdout", "input": "999999998 434363581\n", "output": "999946439\n"}, {"type": "stdin_stdout", "input": "999999994 108004280\n", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string s consisting of lowercase Latin letters and q queries for this string.\n\nRecall that the substring s[l; r] of the string s is the string s_l s_{l + 1} ... s_r. For example, the substrings of \"code... | [{"type": "stdin_stdout", "input": "dfcbbcfeeedbaea\n15\n1 1 e\n1 4 b\n2 10 15\n1 7 b\n1 12 c\n2 6 8\n2 1 6\n1 7 c\n1 2 f\n1 10 a\n2 7 11\n1 10 a\n1 14 b\n1 1 f\n2 1 11\n", "output": "4\n3\n4\n4\n6\n"}, {"type": "stdin_stdout", "input": "decbbcfeeedbafa\n15\n1 1 e\n1 4 b\n2 10 15\n1 7 b\n1 12 c\n2 6 8\n2 1 6\n1 7 c\n1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTsumugi brought n delicious sweets to the Light Music Club. They are numbered from 1 to n, where the i-th sweet has a sugar concentration described by an integer a_i.\n\nYui loves sweets, but she can eat at most m sweets ... | [{"type": "stdin_stdout", "input": "37 13\n164823 8992 21818 77521 130870 83201 174985 168799 9565 84443 105083 54131 130813 42829 98759 60103 198520 125068 59611 45609 124003 106143 54167 179002 103755 152802 146640 74767 91309 11941 131534 32533 67324 27272 49166 129157 41630\n", "output": "8992 18557 30498 52316 795... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRoma is playing a new expansion for his favorite game World of Darkraft. He made a new character and is going for his first grind.\n\nRoma has a choice to buy exactly one of n different weapons and exactly one of m differ... | [{"type": "stdin_stdout", "input": "10 10 10\n51 87\n68 743\n82 1284\n73 936\n55 242\n89 1554\n58 357\n66 666\n62 512\n51 87\n92 1670\n56 280\n56 280\n91 1631\n77 1091\n89 1554\n61 473\n98 1901\n77 1091\n77 1091\n86 15 386\n43 58 386\n68 33 386\n39 62 386\n95 6 386\n74 27 386\n94 7 386\n17 84 386\n97 4 386\n45 56 386\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHQ9+ is a joke programming language which has only four one-character instructions:\n\n * \"H\" prints \"Hello, World!\",\n * \"Q\" prints the source code of the program itself,\n * \"9\" prints the lyrics of \"99 Bott... | [{"type": "stdin_stdout", "input": "mzbmweyydiadtlcouegmdbyfwurpwbpuvhifnuapwyndmhtqvkgkbhtytszotwflegsjzzszfwtzfpnscguemwrczqxycivdqnkH\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "Qzbmweyydiadtlcouegmdbyfwurpwbpuvhifnuapwyndmhtqvkgkbhtytszotwflegsjzzszfwtzfpnscguemwrczqxycivdqnky\n", "output": "YES\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJohnny has just found the new, great tutorial: \"How to become a grandmaster?\". The tutorial tells many strange and unexpected for Johnny things, such as you have to be patient or that very important is solving many hard... | [{"type": "stdin_stdout", "input": "1\n71 2\n100 99 98 97 96 95 94 93 92 91 90 87 86 82 79 78 76 71 70 69 68 66 64 63 62 56 55 53 52 51 50 46 43 42 39 38 37 35 33 31 30 29 22 20 19 18 11 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "999999985\n"}, {"type": "stdin_stdout", "input": "1\n71 2\n100 99 98 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the game of Mastermind, there are two players β Alice and Bob. Alice has a secret code, which Bob tries to guess. Here, a code is defined as a sequence of n colors. There are exactly n+1 colors in the entire universe, ... | [{"type": "stdin_stdout", "input": "7\n5 0 4\n3 1 1 2 5\n5 3 0\n1 1 2 1 2\n4 -1 4\n5 5 3 3\n4 1 4\n2 3 2 3\n6 0 2\n3 2 1 1 1 1\n6 2 4\n3 3 2 1 1 1\n6 2 6\n1 1 3 2 0 1\n", "output": "YES\n1 4 3 5 1\nYES\n3 1 3 1 2\nYES\n3 3 5 5\nNO\nYES\n1 1 4 4 4 4\nYES\n4 4 3 3 1 1\nYES\n3 1 1 0 2 1\n"}, {"type": "stdin_stdout", "inpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a tree that consists of n nodes. You should label each of its n-1 edges with an integer in such way that satisfies the following conditions: \n\n * each integer must be greater than 0; \n * the product of ... | [{"type": "stdin_stdout", "input": "4\n3\n3 1\n2 1\n4\n22861 20707 59627 9293\n3\n3 1\n1 2\n6\n15767 40973 20807 24419 46439 62816\n3\n3 2\n1 2\n6\n31575 54493 10799 37529 59743 30529\n3\n3 1\n2 1\n1\n51618\n", "output": "783349080\n372565328\n603348715\n103238\n"}, {"type": "stdin_stdout", "input": "4\n3\n3 1\n2 1\n4\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet us call two integers x and y adjacent if (lcm(x, y))/(gcd(x, y)) is a perfect square. For example, 3 and 12 are adjacent, but 6 and 9 are not.\n\nHere gcd(x, y) denotes the [greatest common divisor (GCD)](https://en.w... | [{"type": "stdin_stdout", "input": "1\n40\n1 1 5 6 2 10 12 10 4 2 17 18 6 3 1 4 1 1 7 2 9 10 3 2 4 1 9 1 1 4 2 7 8 1 7 9 2 17 7 2\n40\n1\n10\n1\n9\n0\n12\n9\n2\n1\n5\n13\n7\n3\n10\n4\n5\n0\n9\n0\n8\n5\n5\n3\n0\n6\n9\n1\n10\n13\n8\n3\n1\n2\n2\n7\n2\n2\n8\n4\n1\n", "output": "24\n24\n24\n24\n16\n24\n24\n24\n24\n24\n24\n2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEudokimus, a system administrator is in trouble again. As a result of an error in some script, a list of names of very important files has been damaged. Since they were files in the BerFS file system, it is known that eac... | [{"type": "stdin_stdout", "input": "b.baba.ebpbac.iabaeabac.abab.adabacaba.ahcggibij.adaacab.ebaba.aa.abacaba.dacabada.daqjcpc.jadab.dab\n", "output": "YES\nb.bab\na.ebp\nbac.iab\naeabac.aba\nb.ada\nbacaba.ahc\nggibij.ada\nacab.eba\nba.a\na.aba\ncaba.dac\nabada.daq\njcpc.jad\nab.dab\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another snow drift. He has noticed t... | [{"type": "stdin_stdout", "input": "40\n685 711\n433 403\n703 710\n491 485\n616 619\n288 282\n884 871\n367 352\n500 511\n977 982\n51 31\n576 564\n508 519\n755 762\n22 20\n368 353\n232 225\n953 955\n452 436\n311 330\n967 988\n369 364\n791 803\n150 149\n651 661\n118 93\n398 387\n748 766\n852 852\n230 228\n555 545\n515 51... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou've got two numbers. As long as they are both larger than zero, they go through the same operation: subtract the lesser number from the larger one. If they equal substract one number from the another. For example, one ... | [{"type": "stdin_stdout", "input": "20\n1000000000 999999999\n1000000000 999999999\n1000000000 999999999\n1000000000 999999999\n1000000000 999999999\n1000000000 999999999\n1000000000 999999999\n1000000000 999999999\n1000000000 999999999\n1000000000 999999999\n1000000000 999999999\n1000000000 999999999\n1000000000 99999... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSpecial Agent Smart Beaver works in a secret research department of ABBYY. He's been working there for a long time and is satisfied with his job, as it allows him to eat out in the best restaurants and order the most expe... | [{"type": "stdin_stdout", "input": "1023456789??????????????????????????????????????ABCDIFGHIJ\n", "output": "362880000000000000000000000000000000000000000\n"}, {"type": "stdin_stdout", "input": "??JG?\n", "output": "81000\n"}, {"type": "stdin_stdout", "input": "B??C?\n", "output": "81000\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Chris knows there's no fun in playing dominoes, he thinks it's too random and doesn't require skill. Instead, he decided to play with the dominoes and make a \"domino show\".\n\nChris arranges n dominoes in a line,... | [{"type": "stdin_stdout", "input": "400\nRLR.LRL..RLRLRLRL.R..L...R...LR.L...RLR...L.RLRLR..L..RL.RLRLR.L.R..LR..L.R.L...R.LRLRLR.LRLR..LRLRLRL.......RLR..LR..LRLR.....LRL.RL.R.L..R.L.RLRL..RLR.LRLR..L.RLRLR.LR.LR..L..RL.R....LRLRLR.LR.L.R.L.R.LRLRL..R.LRL..R.LRLRLRLR..LR...LRLR.LRL..R...LRL.R..LRLRL.R..LR...LR.LR.LRLR... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have an array a[1], a[2], ..., a[n], containing distinct integers from 1 to n. Your task is to sort this array in increasing order with the following operation (you may need to apply it multiple times):\n\n * choose ... | [{"type": "stdin_stdout", "input": "100\n100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTwilight Sparkle learnt that the evil Nightmare Moon would return during the upcoming Summer Sun Celebration after one thousand years of imprisonment on the moon. She tried to warn her mentor Princess Celestia, but the pr... | [{"type": "stdin_stdout", "input": "10 10\n2 1\n3 1\n4 1\n3 5\n6 2\n5 7\n1 8\n5 9\n10 5\n7 2\n1 0 0 0 1 1 1 0 0 1\n", "output": "31\n1 2 6 2 7 5 3 5 3 5 9 5 9 5 10 5 7 5 7 2 1 2 1 4 1 4 1 8 1 8 1\n"}, {"type": "stdin_stdout", "input": "10 10\n1 2\n3 1\n4 3\n1 5\n6 5\n7 4\n8 7\n9 5\n10 4\n6 10\n1 0 0 1 1 0 0 1 0 1\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPeter decided to wish happy birthday to his friend from Australia and send him a card. To make his present more mysterious, he decided to make a chain. Chain here is such a sequence of envelopes A = {a1, a2, ..., an}, whe... | [{"type": "stdin_stdout", "input": "30 900 15\n1396 562\n1265 475\n3329 2605\n1016 340\n2369 1595\n2085 1245\n2677 1934\n1953 1154\n3002 2199\n1688 855\n1147 407\n2762 2064\n2202 1359\n700 30\n3265 2488\n1884 1034\n2571 1836\n3067 2269\n882 212\n3505 2793\n1602 785\n2292 1460\n2442 1712\n2889 2127\n3187 2361\n1770 932\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the evening, after the contest Ilya was bored, and he really felt like maximizing. He remembered that he had a set of n sticks and an instrument. Each stick is characterized by its length li.\n\nIlya decided to make a ... | [{"type": "stdin_stdout", "input": "100\n4116 4116 4117 4117 4117 4117 4118 4119 4119 4119 4119 4120 4120 4120 4120 4121 4122 4123 4123 4123 4123 4124 4124 4124 4124 4125 4126 4126 4126 4126 4127 4127 4127 4127 4128 4128 4128 4128 4129 4129 4130 4130 4131 4132 4133 4133 4134 4134 4135 4135 4136 4137 4137 4137 4138 4139... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has recently finished writing a book. Now he faces the problem of giving it the title. Vasya wants the title to be vague and mysterious for his book to be noticeable among others. That's why the title should be repr... | [{"type": "stdin_stdout", "input": "26\nabcdefghijklmnopqrstuvwxyzfgvnsltvvohywvqhuhtydghtthgdythuhqvwyhovvtlsnvgfzyxwvutsrqponmlkjihgfedcba\n", "output": "abcdefghijklmnopqrstuvwxyzfgvnsltvvohywvqhuhtydghtthgdythuhqvwyhovvtlsnvgfzyxwvutsrqponmlkjihgfedcba\n"}, {"type": "stdin_stdout", "input": "26\nab?defg??j??mnopqrs... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nToday, Wet Shark is given n integers. Using any of these integers no more than once, Wet Shark wants to get maximum possible even (divisible by 2) sum. Please, calculate this value for Wet Shark. \n\nNote, that if Wet Sha... | [{"type": "stdin_stdout", "input": "5\n999999999 503514429 850382710 999999999 1620498919\n", "output": "4974396056\n"}, {"type": "stdin_stdout", "input": "5\n999999999 503514429 850382710 999999999 1246839866\n", "output": "4097222574\n"}, {"type": "stdin_stdout", "input": "5\n999999999 999999999 850382710 999999999 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAccording to rules of the Berland fashion, a jacket should be fastened by all the buttons except only one, but not necessarily it should be the last one. Also if the jacket has only one button, it should be fastened, so t... | [{"type": "stdin_stdout", "input": "231\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nZS the Coder is coding on a crazy computer. If you don't type in a word for a c consecutive seconds, everything you typed disappear! \n\nMore formally, if you typed a word at second a and then the next word at second b, t... | [{"type": "stdin_stdout", "input": "2 1000000000\n1 1000000000\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "6 5\n1 3 8 14 19 20\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "6 5\n1 5 8 14 19 20\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "5 10\n-1 1 22 32 34\n", "output": "3\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEighth-grader Vova is on duty today in the class. After classes, he went into the office to wash the board, and found on it the number n. He asked what is this number and the teacher of mathematics Inna Petrovna answered ... | [{"type": "stdin_stdout", "input": "101000010\n", "output": "2\n100999959\n 101000004\n"}, {"type": "stdin_stdout", "input": "101110010\n", "output": "2\n101109976\n 101110003\n"}, {"type": "stdin_stdout", "input": "100010010\n", "output": "2\n100009977\n 100010004\n"}, {"type": "stdin_stdout", "input": "110010011\n", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya has a string of length n consisting of small and large English letters and digits.\n\nHe performs m operations. Each operation is described with two integers l and r and a character c: Petya removes from the string ... | [{"type": "stdin_stdout", "input": "40 24\nYYUcKDEUVLUCU8EKiUVxnD8TZSSidW8TUDS8Sccb\n3 38 L\n24 33 d\n6 36 d\n5 10 d\n13 14 E\n12 23 S\n3 30 U\n4 11 C\n12 15 Y\n5 27 x\n25 28 W\n25 26 E\n17 26 C\n17 22 d\n6 25 n\n19 22 K\n2 26 T\n1 22 W\n7 19 d\n12 18 K\n4 12 L\n9 18 6\n4 8 i\n6 8 M\n", "output": "YYcKDEV8KiVD8ZSSi8DS8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently n students from city S moved to city P to attend a programming camp.\n\nThey moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can ... | [{"type": "stdin_stdout", "input": "19\n1\n1 1\n1\n1 2\n1\n1 1000\n1\n1 2000\n1\n2 2\n1\n2 3\n1\n2 1000\n1\n2 2000\n1\n1999 1999\n1\n1999 2000\n1\n2000 2000\n2\n1 1\n1 1\n2\n1 1\n1 2\n2\n1 2\n1 1\n2\n1 2000\n1 1\n2\n1 1\n1 2000\n2\n1 2000\n2 2\n2\n2 2000\n2 2\n2\n2 2\n2 2000\n", "output": "1\n1\n1\n1\n2\n2\n2\n2\n1999\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently Max has got himself into popular CCG \"BrainStone\". As \"BrainStone\" is a pretty intellectual game, Max has to solve numerous hard problems during the gameplay. Here is one of them:\n\nMax owns n creatures, i-t... | [{"type": "stdin_stdout", "input": "10 9 0\n620118469 704168608\n528098892 341451371\n15150469 449838744\n960504540 722185004\n271837337 344050133\n940943201 419522619\n85569623 788965215\n161962866 563795701\n943389281 445744350\n610994199 473866838\n", "output": "5253588583\n"}, {"type": "stdin_stdout", "input": "10 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAllen dreams of one day owning a enormous fleet of electric cars, the car of the future! He knows that this will give him a big status boost. As Allen is planning out all of the different types of cars he will own and how... | [{"type": "stdin_stdout", "input": "40 77\n60 31 50 41 4 12 27 6 65 11 0 34 44 13 42 18 64 15 76 59 36 69 70 71 66 57 37 25 26 2 23 24 45 55 67 29 75 49 33 40\n11 14 65 44 74 51 55 16 19 29 75 41 27 35 69 10 70 2 73 58 45 61 0 7 30 6 23 25 66 63 28 62 24 77 20 43 0 18 50 52\n54 64 60 57 31 8 72 26 76 0 71 48 32 17 12 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn extraterrestrial visit!\nRemember your childhood friend JAADU from outer space?? Well, he is back again to our mighty Planet Earth.\n\nBut do you expect us geeks to introduce a character like Rohit Mehra in this story?... | [{"type": "stdin_stdout", "input": "659\n8 972726106237281\n29 516908306\n9 294\n27 84664275\n30 888188693\n6 40\n6 29\n8 877878903230015\n29 66695922\n2 38\n31 1799217893\n3 3\n12 311\n31 631884547720169\n15 26933\n9 497416784631326\n26 47553572\n35 27143570505\n33 4229111886\n17 86199\n20 789098\n20 8186139\n13 4681\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProtection of the Indian border and safe transport of items from one point to another along the border are the paramount jobs for the Indian army. However they need some information about the protection status along the l... | [{"type": "stdin_stdout", "input": "5 1875 14243\n3322 21\n788 589\n1479 200\n7295 2325\n4033 1259\n\nEATPLM", "output": "5522\n"}, {"type": "stdin_stdout", "input": "5 2234 14243\n3322 21\n788 589\n1479 200\n7295 2325\n4033 1259\n\nEASPLM", "output": "5163\n"}, {"type": "stdin_stdout", "input": "5 1875 14243\n3322 21\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNavi is a famous mathematician. He is working on Division, Multiplication and Addition. He is in need of some hidden patterns to discover some new concepts. He is giving you a task to find that sub-sequence of an array wh... | [{"type": "stdin_stdout", "input": "2\n2\n-1 2\n2\n3 4\n\nSAMELP", "output": "Case #1: 1000000005\nCase #2: 714285721\n"}, {"type": "stdin_stdout", "input": "2\n2\n1 1\n2\n12 5\n\nTAMOEL", "output": "Case #1: 500000004\nCase #2: 176470593\n"}, {"type": "stdin_stdout", "input": "2\n2\n1 1\n2\n12 2\n\nTAMOEL", "output": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAditya is a professor in Engilsh loves to play with words. Today he asks his assistant Abishek to perform an experiment where he wants him to calculate the total number of word that can be formed from a given word such th... | [{"type": "stdin_stdout", "input": "100\nyqypgenznlzztptieaqkgldlzzvfptbgkaxbfygoqyaagbvulzulemtnybvszhmpbrqmyodsudywprbyfbdlwdusnrgxytlrcaybobwugeosucuqreyfzgktbatrcponfibpsbfwbsrrkobtpmodiywsccddvpkbtnsclwoofmfkdxqhkzrvlnypxkiwodvhsefkayhy\nkgrmgjuxgpnrnozmjtflxdnpskyolhwcytjsurjavhdkcbehynyeuizynsrcxsxeehkwlzjkrcnhj... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is a string S. Replace every character in S with `x` and print the result.\n\nConstraints\n\n* S is a string consisting of lowercase English letters.\n* The length of S is between 1 and 100 (inclusive).\n\nInput\n\n... | [{"type": "stdin_stdout", "input": "sardnie", "output": "xxxxxxx\n"}, {"type": "stdin_stdout", "input": "sardnif", "output": "xxxxxxx\n"}, {"type": "stdin_stdout", "input": "findras", "output": "xxxxxxx\n"}, {"type": "stdin_stdout", "input": "findrbs", "output": "xxxxxxx\n"}, {"type": "stdin_stdout", "input": "frndibs"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is a string S of length N.\n\nFind the maximum length of a non-empty string that occurs twice or more in S as contiguous substrings without overlapping.\n\nMore formally, find the maximum positive integer len such t... | [{"type": "stdin_stdout", "input": "13\nstrangeoranfe", "output": "3\n"}, {"type": "stdin_stdout", "input": "13\nefnaroegnarts", "output": "3\n"}, {"type": "stdin_stdout", "input": "13\nefnarotgnares", "output": "3\n"}, {"type": "stdin_stdout", "input": "13\nserangtoranfe", "output": "3\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke has N strings. The i-th string is s_i.\n\nLet us concatenate these strings into one string after arranging them in some order. Find the maximum possible number of occurrences of `AB` in the resulting string.\n\nCons... | [{"type": "stdin_stdout", "input": "9\nBEWPVCRWH\nZQNZYIJX\nBAVREA\nPA\nHJMYITEOX\nBCJHMRMNK\nBP\nQVFABZ\nPRGKSPUNA", "output": "4\n"}, {"type": "stdin_stdout", "input": "9\nBEWPVCRWH\nZQNZYIJX\nAERVAB\nPA\nHJMYITEOX\nBCJHMRMNK\nBP\nQVFABZ\nPRGKSPUNA", "output": "4\n"}, {"type": "stdin_stdout", "input": "9\nBEWPVCRWH\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers A and B. Find the largest value among A+B, A-B and A \\times B.\n\nConstraints\n\n* -1000 \\leq A,B \\leq 1000\n* All values in input are integers.\n\nInput\n\nInput is given from Standard Input... | [{"type": "stdin_stdout", "input": "-17 -10", "output": "170\n"}, {"type": "stdin_stdout", "input": "-10 -10", "output": "100\n"}, {"type": "stdin_stdout", "input": "-156 -1", "output": "156\n"}, {"type": "stdin_stdout", "input": "-156 -2", "output": "312\n"}, {"type": "stdin_stdout", "input": "-156 -3", "output": "468... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke has a rooted tree with N+1 vertices. The vertices are numbered 0 through N, and Vertex 0 is the root of the tree. The parent of Vertex i (1 \\leq i \\leq N) is Vertex p_i.\n\nBesides this tree, Snuke also has an box... | [{"type": "stdin_stdout", "input": "31\n0 1 0 2 4 0 4 1 6 4 3 9 7 3 7 3 15 6 12 10 12 16 5 3 20 1 25 20 23 24 23", "output": "831058846\n"}, {"type": "stdin_stdout", "input": "31\n0 1 0 2 4 0 4 0 6 4 3 9 7 3 7 3 15 6 12 10 12 16 5 3 20 1 25 20 23 24 23", "output": "227079070\n"}, {"type": "stdin_stdout", "input": "31\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke has N sticks. The length of the i-th stick is l_i.\n\nSnuke is making a snake toy by joining K of the sticks together.\n\nThe length of the toy is represented by the sum of the individual sticks that compose it. Fin... | [{"type": "stdin_stdout", "input": "15 14\n49 26 27 21 41 12 42 35 7 5 5 36 39 1 45", "output": "390\n"}, {"type": "stdin_stdout", "input": "15 14\n49 26 27 21 33 14 42 35 7 5 5 31 39 1 45", "output": "379\n"}, {"type": "stdin_stdout", "input": "15 14\n42 26 27 21 12 14 42 35 7 5 5 31 39 1 45", "output": "351\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a consecutive part of s).\n\nFind the greatest length of the string Snuke can construct. He... | [{"type": "stdin_stdout", "input": "HASFJGHOGAK[ZFEGA", "output": "12\n"}, {"type": "stdin_stdout", "input": "IBAG[IHNGFKKZSFGB", "output": "11\n"}, {"type": "stdin_stdout", "input": "AIEFZGKAFOFGJZSAH", "output": "14\n"}, {"type": "stdin_stdout", "input": "ICAF[IHNGFKZKSFGB", "output": "10\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a plane like Figure 1 with 8 vertical and 8 horizontal squares. There are several bombs on that plane. Figure 2 shows an example (β = bomb).\n\n| β‘ | β‘ | β‘ | β‘ | β‘ | β‘ | β‘ | β‘\n--- | --- | --- | --- | --- | --- |... | [{"type": "stdin_stdout", "input": "2\n\n00010010\n00000100\n10001001\n00100010\n01000000\n00001000\n10100010\n01010010\n2\n5\n\n00010010\n00000100\n10001001\n00100010\n01000000\n00001000\n10100000\n01010010\n2\n5", "output": "Data 1:\n00000000\n00000100\n10001001\n00100000\n00000000\n00001000\n10100000\n00000000\nData... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYukiya, the owner of Aizuyama Ski Resort, has prepared a course for advanced skiers with obstacles and jumping hills. There are various ways to slide on the course, and users who can slide in all patterns during the seaso... | [{"type": "stdin_stdout", "input": "5 5\n0 0 0 0 1\n2 1 0 2 0\n1 0 0 1 1\n0 2 1 2 0\n0 1 -1 0 0\n5 5\n0 0 1 0 0\n2 1 0 2 0\n1 0 0 0 1\n0 2 1 2 0\n0 1 0 0 0\n15 15\n0 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\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 1 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBob is playing a popular game called \"Dungeon\". The game is played on a rectangular board consisting of W Γ H squares. Each square is identified with its column and row number, thus the square located in the x-th column... | [{"type": "stdin_stdout", "input": "6 6 12\n0 2\n5 2\n1 4\n3 4\n1 5", "output": "5\n"}, {"type": "stdin_stdout", "input": "6 6 12\n0 2\n5 2\n1 4\n3 4\n1 4", "output": "4\n"}, {"type": "stdin_stdout", "input": "6 6 5\n2 1\n5 2\n3 3\n2 4\n1 5", "output": "5\n"}, {"type": "stdin_stdout", "input": "6 6 5\n2 1\n5 2\n1 3\n2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJOI has a stove in your room. JOI himself is resistant to the cold, so he doesn't need to put on the stove when he is alone in the room, but he needs to put on the stove when there are visitors.\n\nOn this day, there are ... | [{"type": "stdin_stdout", "input": "2 1\n-10\n31\n0", "output": "42\n"}, {"type": "stdin_stdout", "input": "3 1\n-1\n4\n11", "output": "13\n"}, {"type": "stdin_stdout", "input": "3 1\n-1\n0\n23", "output": "25\n"}, {"type": "stdin_stdout", "input": "3 2\n-2\n6\n21", "output": "10\n"}, {"type": "stdin_stdout", "input": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMultiple polygonal lines are given on the xy-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template.\n\nA polygonal line consists of several line... | [{"type": "stdin_stdout", "input": "5\n5\n0 0\n2 0\n2 1\n4 1\n4 0\n5\n0 0\n0 2\n-1 2\n-1 4\n0 4\n5\n0 0\n0 1\n-2 1\n-2 2\n0 2\n5\n0 0\n0 -1\n2 -1\n2 0\n4 0\n5\n0 0\n2 0\n2 -1\n4 -1\n4 0\n5\n0 0\n2 0\n2 1\n4 1\n4 0\n4\n4\n-60 -75\n-60 -78\n-42 -78\n-42 -6\n4\n10 3\n10 7\n-4 7\n-4 40\n4\n-74 66\n-74 63\n-92 63\n-92 135\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n<!--\n\nProblem D\n\n-->\n\nTally Counters\n\nA number of tally counters are placed in a row. Pushing the button on a counter will increment the displayed value by one, or, when the value is already the maximum, it goes d... | [{"type": "stdin_stdout", "input": "4 5\n-1 3 1 5\n2 5 5 2\n3 100\n1 10 110\n0 10 100\n5 10000\n4971 7482 1238 8523 1823\n3287 9013 9928 297 1809\n0 0", "output": "5\n100\n14615\n"}, {"type": "stdin_stdout", "input": "4 5\n3 3 1 4\n2 5 5 2\n3 100\n1 10 101\n2 10 100\n5 11000\n4971 13457 1238 8523 1823\n3287 9013 9928 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSaving electricity is very important!\n\nYou are in the office represented as R \\times C grid that consists of walls and rooms. It is guaranteed that, for any pair of rooms in the office, there exists exactly one route b... | [{"type": "stdin_stdout", "input": "5 5 10\n.###\n....\n.#\n..#.#\n....\n0 12 0 0 0\n0 4 3 2 10\n0 0 0 99 0\n11 13 0 2 0\n0 1 1 2 1\n0 4 0 0 0\n0 13 8 2 4\n0 0 0 16 0\n1 1 0 1 0\n0 2 3 1 99\n0 2 0 0 0\n0 12 2 12 2\n0 0 0 3 0\n4 14 0 16 0\n0 2 14 2 90\n0 1\n3 0\n4 4\n1 4\n1 1\n4 4\n1 1\n4 3\n3 0\n1 4", "output": "882\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor given two segments s1 and s2, print the coordinate of the cross point of them.\n\ns1 is formed by end points p0 and p1, and s2 is formed by end points p2 and p3.\n\nConstraints\n\n* 1 β€ q β€ 1000\n* -10000 β€ xpi, ypi β€... | [{"type": "stdin_stdout", "input": "3\n-1 -2 2 -1 2 0 2 -1\n0 0 2 0 -1 1 1 -1\n0 0 0 2 4 -1 0 2", "output": "2.000000000 -1.000000000\n0.000000000 0.000000000\n0.000000000 2.000000000\n"}, {"type": "stdin_stdout", "input": "3\n-1 -2 2 -1 2 0 2 -1\n0 0 2 0 0 1 1 -1\n0 -1 1 2 2 0 0 2", "output": "2.000000000 -1.000000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCompare given two sequence $A = \\\\{a_0, a_1, ..., a_{n-1}\\\\}$ and $B = \\\\{b_0, b_1, ..., b_{m-1}$ lexicographically.\n\nConstraints\n\n* $1 \\leq n, m \\leq 1,000$\n* $0 \\leq a_i, b_i \\leq 1,000$\n\nInput\n\nThe i... | [{"type": "stdin_stdout", "input": "4\n0 4 12 1\n5\n1 2 5 4 1", "output": "1\n"}, {"type": "stdin_stdout", "input": "4\n1 4 1 1\n2\n-1 4 5 4 2", "output": "0\n"}, {"type": "stdin_stdout", "input": "4\n1 4 1 1\n2\n-1 4 9 4 2", "output": "0\n"}, {"type": "stdin_stdout", "input": "4\n1 4 1 1\n2\n-2 4 9 4 2", "output": "0\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIvan has n songs on his phone. The size of the i-th song is a_i bytes. Ivan also has a flash drive which can hold at most m bytes in total. Initially, his flash drive is empty.\n\nIvan wants to copy all n songs to the fla... | [{"type": "stdin_stdout", "input": "1 1364355877\n1000000000 1343571090\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1 1000000000\n1000000000 999999999\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1 1992779579\n1000000000 999999999\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1 19927... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are two bus stops denoted A and B, and there n buses that go from A to B every day. The shortest path from A to B takes t units of time but some buses might take longer paths. Moreover, buses are allowed to overtake... | [{"type": "stdin_stdout", "input": "2 1000000000\n999999999 1000000000\n1 2\n", "output": "Yes\n1999999999 2000000000\n"}, {"type": "stdin_stdout", "input": "2 1000000000\n1 1000000000\n2 2\n", "output": "Yes\n2000000000 2000000001\n"}, {"type": "stdin_stdout", "input": "2 1000010000\n1 1000000000\n2 2\n", "output": "Y... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer array a_1, a_2, β¦, a_n.\n\nThe array b is called to be a subsequence of a if it is possible to remove some elements from a to get b.\n\nArray b_1, b_2, β¦, b_k is called to be good if it is not emp... | [{"type": "stdin_stdout", "input": "50\n170081 797965 40736 224325 102476 20832 954026 923972 391400 247099 95141 927386 79799 749285 104039 200818 623552 872203 355273 838168 352783 850365 389351 930945 847154 608047 727586 549184 520573 608953 338849 536466 345479 589848 882827 771475 874283 787115 992590 128903 9780... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.