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\nRecently, the Fair Nut has written k strings of length n, consisting of letters \"a\" and \"b\". He calculated c β the number of strings that are prefixes of at least one of the written strings. Every string was counted o... | [{"type": "stdin_stdout", "input": "100 1000000000\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbaabaabbb\nbaaaaaaaaababbbbaaabbbbbababbbbabbbabbaaaaabaabbaabbbbabaaaabbaaaabaaabaabbbabbbbbbbbabaaabbababbabb\n", "output": "71075285949\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string s consisting of exactly n characters, and each character is either '0', '1' or '2'. Such strings are called ternary strings.\n\nYour task is to replace minimum number of characters in this string wi... | [{"type": "stdin_stdout", "input": "69\n000000000000000000000000000000000000000000000000000000000000000000000\n", "output": "000000000000000000000001111111111111111111111122222222222222222222222\n"}, {"type": "stdin_stdout", "input": "69\n000000000000000000000000000000000000000000000000000000000010000000000\n", "output... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is a simplified version of the task Toy Train. These two versions differ only in the constraints. Hacks for this version are disabled.\n\nAlice received a set of Toy Trainβ’ from Bob. It consists of one train and a co... | [{"type": "stdin_stdout", "input": "100 50\n29 35\n10 75\n29 34\n10 87\n29 13\n29 38\n41 21\n10 6\n29 94\n10 47\n31 27\n41 24\n41 8\n10 93\n41 52\n41 36\n31 32\n85 81\n31 32\n41 79\n41 99\n85 88\n41 25\n31 68\n41 93\n10 87\n85 97\n41 85\n10 64\n10 68\n85 22\n10 45\n85 15\n10 16\n10 21\n41 66\n29 68\n41 96\n29 34\n10 22... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTokitsukaze and CSL are playing a little game of stones.\n\nIn the beginning, there are n piles of stones, the i-th pile of which has a_i stones. The two players take turns making moves. Tokitsukaze moves first. On each t... | [{"type": "stdin_stdout", "input": "14\n9 9 1000 2000 39999 48888 16 32 123456 959658 111 987584 125632 125468\n", "output": "sjfnb\n"}, {"type": "stdin_stdout", "input": "14\n9 9 1000 2000 39999 48888 16 32 123456 959658 111 987584 125632 125477\n", "output": "cslnb\n"}, {"type": "stdin_stdout", "input": "14\n6 66 143... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have n Γ n square grid and an integer k. Put an integer in each cell while satisfying the conditions below.\n\n * All numbers in the grid should be between 1 and k inclusive. \n * Minimum number of the i-th row is 1... | [{"type": "stdin_stdout", "input": "250 1000000000\n", "output": "770503193\n"}, {"type": "stdin_stdout", "input": "216 1142401243\n", "output": "820247611\n"}, {"type": "stdin_stdout", "input": "246 1140071398\n", "output": "783102336\n"}, {"type": "stdin_stdout", "input": "218 1771958988\n", "output": "699159875\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a set of nβ₯ 2 pairwise different points with integer coordinates. Your task is to partition these points into two nonempty groups A and B, such that the following condition holds:\n\nFor every two points P a... | [{"type": "stdin_stdout", "input": "30\n356796 133718\n-38697 -144546\n752937 -464381\n-392266 -895367\n726142 440342\n499761 520681\n21493 780572\n-145605 -690458\n229737 334279\n-428414 -690909\n981381 -134684\n805755 -16870\n-195583 -163277\n-210762 -226125\n-616716 -572983\n-881116 774672\n-767924 -504231\n-101294 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n[3R2 as DJ Mashiro - Happiness Breeze](https://open.spotify.com/track/2qGqK8GRS65Wlf20qUBEak)\n\n[Ice - DJ Mashiro is dead or alive](https://soundcloud.com/iceloki/dj-mashiro-is-dead-or-alive)\n\nNEKO#Ξ¦ΟΞ¦ has just got a n... | [{"type": "stdin_stdout", "input": "10 83\n1 3\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n1 4\n2 2\n2 3\n2 3\n2 3\n2 3\n2 3\n2 3\n1 4\n1 5\n1 7\n2 2\n2 2\n1 5\n2 2\n1 3\n2 1\n2 6\n1 5\n2 6\n2 9\n1 2\n2 5\n1 2\n2 5\n2 4\n2 4\n1 2\n1 2\n1 4\n2 6\n2 6\n2 4\n2 4\n1 2\n1 2\n2 4\n2 4\n2 3\n2 3\n1 2\n2 9\n1 2\n1 2\n1 2\n2 6\n2 6\n2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is an easier version of the problem. In this version n β€ 1000\n\nThe outskirts of the capital are being actively built up in Berland. The company \"Kernel Panic\" manages the construction of a residential complex of ... | [{"type": "stdin_stdout", "input": "100\n82 51 81 14 37 17 78 92 64 15 8 86 89 8 87 77 66 10 15 12 100 25 92 47 21 78 20 63 22 49 41 36 41 79 16 87 87 69 3 76 80 60 100 49 70 59 72 8 38 71 45 97 71 14 76 54 81 4 59 46 39 29 92 3 49 22 53 99 59 52 74 31 92 43 42 23 44 9 82 47 7 40 12 9 3 55 37 85 46 22 84 52 98 41 21 77... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a rectangular grid of size n Γ m. Each cell of the grid is colored black ('0') or white ('1'). The color of the cell (i, j) is c_{i, j}. You are also given a map of directions: for each cell, there is a direction... | [{"type": "stdin_stdout", "input": "3\n1 2\n01\nRL\n3 3\n001\n101\n110\nRLL\nDLD\nULL\n3 3\n000\n000\n000\nRRD\nRLD\nULL\n", "output": "2 1\n4 3\n2 2\n"}, {"type": "stdin_stdout", "input": "3\n1 2\n01\nRL\n3 3\n000\n101\n110\nRLL\nDLD\nULL\n3 3\n000\n000\n000\nRRD\nRLD\nULL\n", "output": "2 1\n4 3\n2 2\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDuring the quarantine, Sicromoft has more free time to create the new functions in \"Celex-2021\". The developers made a new function GAZ-GIZ, which infinitely fills an infinite table to the right and down from the upper ... | [{"type": "stdin_stdout", "input": "1\n118730819 699217111 1229905591 978426672\n", "output": "310250620284395093\n"}, {"type": "stdin_stdout", "input": "1\n118730819 699217111 995255402 1762535216\n", "output": "932024458581475216\n"}, {"type": "stdin_stdout", "input": "1\n118730819 699217111 1571293294 978426672\n", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a binary string s consisting of n zeros and ones.\n\nYour task is to divide the given string into the minimum number of subsequences in such a way that each character of the string belongs to exactly one sub... | [{"type": "stdin_stdout", "input": "4\n4\n0011\n6\n111111\n5\n10101\n8\n01010000\n", "output": "2\n1 2 2 1 \n6\n1 2 3 4 5 6 \n1\n1 1 1 1 1 \n4\n1 1 1 1 1 2 3 4 \n"}, {"type": "stdin_stdout", "input": "4\n4\n0011\n6\n111111\n5\n10101\n8\n01000000\n", "output": "2\n1 2 2 1\n6\n1 2 3 4 5 6\n1\n1 1 1 1 1\n6\n1 1 1 2 3 4 5 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThree swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.\n\nIt takes the first swimmer exactly a minutes to swim across the entire pool and come back, ... | [{"type": "stdin_stdout", "input": "10\n992222955174044630 49635415 8474 173727148\n618311281854681640 657834994 40173216 75996939\n710602478618400425 332897175 71490165 534449640\n768753872531302819 113476460 449 799174641\n633188994852953277 834175592 3132 788542124\n964246686346975322 539872840 295075 782348226\n683... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPhoenix is playing with a new puzzle, which consists of n identical puzzle pieces. Each puzzle piece is a right isosceles triangle as shown below.\n\n<image> A puzzle piece\n\nThe goal of the puzzle is to create a square ... | [{"type": "stdin_stdout", "input": "3\n524304\n61032704\n61560720\n", "output": "NO\nNO\nNO\n"}, {"type": "stdin_stdout", "input": "3\n524304\n61032704\n10950212\n", "output": "NO\nNO\nNO\n"}, {"type": "stdin_stdout", "input": "3\n524304\n61032704\n14778357\n", "output": "NO\nNO\nNO\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a multiset (i. e. a set that can contain multiple equal integers) containing 2n integers. Determine if you can split it into exactly n pairs (i. e. each element should be in exactly one pair) so that the sum... | [{"type": "stdin_stdout", "input": "2\n28\n15 72 79 36 2 43 100 11 236 94 76 83 90 20 58 39 47 57 37 88 92 92 59 80 97 22 20 47 9 88 21 82 94 71 25 38 45 51 23 76 58 5 39 11 15 9 11 24 9 84 90 58 0 37 54 65\n43\n79 24 82 7 26 19 63 22 94 22 4 72 19 5 92 92 83 93 35 19 45 87 40 61 58 65 21 48 96 85 63 100 86 63 30 50 58... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAccording to a new ISO standard, a flag of every country should have a chequered field n Γ m, each square should be of one of 10 colours, and the flag should be Β«stripedΒ»: each horizontal row of the flag should contain sq... | [{"type": "stdin_stdout", "input": "20 19\n1111111111111111111\n8247715032316286876\n0000001000000000000\n4784876473600342372\n1111111111111111111\n2222222222222222222\n4444444444444444444\n5555555555555555555\n0000000000000000010\n4444444444444444444\n0000000000000000000\n5555555555555555555\n11500026576261848309\n999... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLast year Bob earned by selling memory sticks. During each of n days of his work one of the two following events took place: \n\n * A customer came to Bob and asked to sell him a 2x MB memory stick. If Bob had such a sti... | [{"type": "stdin_stdout", "input": "50\nwin 596\nwin 1799\nwin 1462\nsell 460\nwin 731\nwin 723\nwin 731\nwin 329\nwin 838\nsell 728\nwin 728\nwin 460\nwin 723\nwin 1462\nwin 1462\nwin 460\nwin 329\nwin 1462\nwin 460\nwin 460\nwin 723\nwin 731\nwin 723\nwin 596\nwin 731\nwin 596\nwin 329\nwin 728\nwin 715\nwin 329\nwin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou've got a undirected tree s, consisting of n nodes. Your task is to build an optimal T-decomposition for it. Let's define a T-decomposition as follows.\n\nLet's denote the set of all nodes s as v. Let's consider an und... | [{"type": "stdin_stdout", "input": "25\n13 1\n4 17\n15 25\n3 21\n1 6\n1 9\n12 15\n13 4\n24 19\n22 24\n8 20\n4 11\n11 14\n17 16\n15 7\n23 3\n22 13\n3 5\n6 10\n16 18\n24 23\n10 2\n9 8\n7 22\n", "output": "24\n2 13 1\n2 4 17\n2 15 25\n2 3 21\n2 1 6\n2 1 9\n2 12 15\n2 13 4\n2 24 19\n2 22 24\n2 8 20\n2 4 11\n2 11 14\n2 17 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRoma works in a company that sells TVs. Now he has to prepare a report for the last year.\n\nRoma has got a list of the company's incomes. The list is a sequence that consists of n integers. The total income of the compan... | [{"type": "stdin_stdout", "input": "78 13\n-9961 -9922 -9817 -9813 -9521 -9368 -9361 -9207 -9153 -9124 -9008 -8981 -8951 -8911 -8551 -8479 -8245 -8216 -7988 -7841 -7748 -7741 -7734 -7101 -6846 -6804 -6651 -6526 -6519 -6463 -6297 -6148 -6090 -5845 -5209 -5201 -5161 -5061 -4537 -4529 -4433 -4370 -4266 -4189 -4125 -3945 -... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInna and Dima decided to surprise Sereja. They brought a really huge candy matrix, it's big even for Sereja! Let's number the rows of the giant matrix from 1 to n from top to bottom and the columns β from 1 to m, from lef... | [{"type": "stdin_stdout", "input": "63 67 18046757 61758841 85367218 68\n22 30\n25 40\n56 58\n29 11\n34 63\n28 66\n51 5\n39 64\n1 23\n24 61\n19 47\n10 31\n55 28\n52 26\n38 7\n28 31\n13 27\n37 42\n10 52\n19 33\n7 36\n13 1\n46 40\n21 41\n1 1\n6 35\n10 4\n46 9\n21 57\n1 49\n34 14\n14 35\n43 4\n1 41\n25 22\n18 25\n27 23\n4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJzzhu has invented a kind of sequences, they meet the following property:\n\n<image>\n\nYou are given x and y, please calculate fn modulo 1000000007 (109 + 7).\n\nInput\n\nThe first line contains two integers x and y (|x|... | [{"type": "stdin_stdout", "input": "-1000000000 1000000000\n2000000000\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "-1030333966 -143148799\n1287886520\n", "output": "856851208\n"}, {"type": "stdin_stdout", "input": "-1048223347 -1308375581\n154879215\n", "output": "739847773\n"}, {"type": "stdin_st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA way to make a new task is to make it nondeterministic or probabilistic. For example, the hard task of Topcoder SRM 595, Constellation, is the probabilistic version of a convex hull.\n\nLet's try to make a new task. Firs... | [{"type": "stdin_stdout", "input": "6\nzfnkpxaavrcvqhhkclcuiswawpghlqrlq wnvbzhvsjozlkwxowcvyclmehjkkvkxin\nzkxkvlnovnloxjdydujkjydaegzjypsgrzq dmiilhmkspokltabpvwalijhlitbfp\nldfbfggqsdqethdgkmbcwloluguxiluqjyr fewoondewvndcxticvpiqnvvdhsnzfd\nepokfmixjnawdfgkmqlcyirxuprrvudh xvijbdzqdyjwsyhjucytuxrxuiynxf\nxntrjusjwb... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this p... | [{"type": "stdin_stdout", "input": "186\n2 1 2 1 1 1 1 1 2 1 1 2 2 2 1 1 2 2 1 1 1 2 1 1 2 2 1 1 1 2 2 1 1 1 1 1 2 1 1 1 2 1 2 1 1 2 1 1 1 2 2 2 2 2 2 2 1 2 1 2 1 1 2 1 2 2 1 1 1 1 1 2 2 1 2 2 1 2 2 1 1 1 2 2 1 1 2 2 1 2 2 1 2 2 2 2 2 1 1 1 1 2 1 1 2 2 2 2 2 2 1 1 1 1 1 2 1 1 2 2 1 2 2 1 1 1 1 1 2 2 1 1 2 2 1 2 2 2 1 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA word or a sentence in some language is called a pangram if all the characters of the alphabet of this language appear in it at least once. Pangrams are often used to demonstrate fonts in printing or test the output devi... | [{"type": "stdin_stdout", "input": "100\nmKtsiDRJypUieHIkvJaMFkwaKxcCIbBszZQLIyPpCDCjhNpAnYFngLjRpnKWpKWtGnwoSteeZXuFHWQxxxOpFlNeYTwKocsXuCoa\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100\naoCuXscoKwTYeNlFpOxxxQWHFuXZeetSownGtWKpWKnpRjLgnFYnApNhjCDCpPyILQZzsBbICcxKawkFMaJvkIHeiUpyJRDistKm\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the official contest this problem has a different statement, for which jury's solution was working incorrectly, and for this reason it was excluded from the contest. This mistake have been fixed and the current given p... | [{"type": "stdin_stdout", "input": "20\n713900269 224495293 592111899 609607891 585084800 601258511 223103775 876894656 751583891 230837577 971499807 312977833 344314550 397998873 558637732 216574673 913028292 762852863 464376621 61315042\n", "output": "375537226\n"}, {"type": "stdin_stdout", "input": "20\n713900269 22... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter celebrating the midcourse the students of one of the faculties of the Berland State University decided to conduct a vote for the best photo. They published the photos in the social network and agreed on the rules to... | [{"type": "stdin_stdout", "input": "40\n119631 119631 772776 119631 658661 119631 108862 524470 125132 700668 69196 844949 154577 108862 108862 108862 597344 940938 989698 108862 154577 69196 125132 687080 940938 125132 69196 69196 125132 566152 953083 406319 380068 119631 134748 125132 413984 69196 154577 154577\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBuses run between the cities A and B, the first one is at 05:00 AM and the last one departs not later than at 11:59 PM. A bus from the city A departs every a minutes and arrives to the city B in a ta minutes, and a bus fr... | [{"type": "stdin_stdout", "input": "60 120\n17 120\n23:00\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "60 120\n17 175\n23:00\n", "output": "14\n"}, {"type": "stdin_stdout", "input": "111 120\n24 100\n13:00\n", "output": "9\n"}, {"type": "stdin_stdout", "input": "88 120\n17 175\n23:00\n", "output": "14\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMike and !Mike are old childhood rivals, they are opposite in everything they do, except programming. Today they have a problem they cannot solve on their own, but together (with you) β who knows? \n\nEvery one of them ha... | [{"type": "stdin_stdout", "input": "17\n714413739 -959271262 714413739 -745891378 926207665 -404845105 -404845105 -959271262 -189641729 -670860364 714413739 -189641729 192457837 -745891378 -670860364 536388097 -959271262\n-417715348 -959271262 -959271262 714413739 -189641729 559486188 571055593 571055593 -417715348 -41... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nZS the Coder and Chris the Baboon arrived at the entrance of Udayland. There is a n Γ n magic grid on the entrance which is filled with integers. Chris noticed that exactly one of the cells in the grid is empty, and to en... | [{"type": "stdin_stdout", "input": "9\n1 1000000000 1 1000000000 1 1000000000 1 1000000000 1\n1000000000 1 1000000000 1 1 1 1000000000 1 1000000000\n1 1000000000 1 1000000000 1 1000000000 1 1000000000 1\n1000000000 1 1000000000 1 1 1 1000000000 1 1000000000\n1 1 1 1 0 1 1 1 1\n1000000000 1 1000000000 1 1 1 1000000000 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently a dog was bought for Polycarp. The dog's name is Cormen. Now Polycarp has a lot of troubles. For example, Cormen likes going for a walk. \n\nEmpirically Polycarp learned that the dog needs at least k walks for an... | [{"type": "stdin_stdout", "input": "100 500\n64 140 15 221 24 106 73 30 275 97 296 55 5 30 47 199 130 44 72 170 7 204 359 40 128 117 45 192 344 112 0 11 196 78 73 53 222 93 88 151 99 283 60 71 4 87 226 46 66 74 23 89 77 60 397 181 0 101 358 54 124 155 19 218 9 140 161 130 308 85 103 85 300 128 19 108 225 136 100 54 30 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya is an administrator of a public page of organization \"Mouse and keyboard\" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates a list of hashtags to mak... | [{"type": "stdin_stdout", "input": "2\n#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab\n#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n", "output": "#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhereas humans nowadays read fewer and fewer books on paper, book readership among marmots has surged. Heidi has expanded the library and is now serving longer request sequences.\n\nInput\n\nSame as the easy version, but ... | [{"type": "stdin_stdout", "input": "11 1\n1 2 3 10 1 10 10 1 1 3 5\n", "output": "9\n"}, {"type": "stdin_stdout", "input": "11 1\n1 2 3 5 1 10 10 1 1 3 5\n", "output": "9\n"}, {"type": "stdin_stdout", "input": "11 1\n1 4 3 5 1 10 10 1 1 3 5\n", "output": "9\n"}, {"type": "stdin_stdout", "input": "11 1\n1 2 3 5 1 10 8 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya was late for the lesson too. The teacher gave him an additional task. For some array a Petya should find the number of different ways to select non-empty subset of elements from it in such a way that their product i... | [{"type": "stdin_stdout", "input": "20\n20 34 51 40 70 64 14 30 24 20 6 1 70 28 38 43 9 60 31 69\n", "output": "2047\n"}, {"type": "stdin_stdout", "input": "18\n22 41 40 8 36 48 23 5 58 12 26 44 53 49 3 56 58 57\n", "output": "127\n"}, {"type": "stdin_stdout", "input": "17\n44 57 54 57 54 65 40 57 59 16 39 51 32 51 20 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a multiset S consisting of positive integers (initially empty). There are two kind of queries: \n\n 1. Add a positive integer to S, the newly added integer is not less than any number in it. \n 2. Find a s... | [{"type": "stdin_stdout", "input": "88\n1 1411\n2\n1 1783\n1 2132\n2\n2\n1 2799\n2\n2\n1 7856\n1 10551\n2\n2\n1 10868\n1 15159\n1 16497\n2\n1 20266\n2\n2\n2\n1 21665\n2\n2\n2\n2\n1 25670\n2\n2\n2\n1 26767\n1 31392\n2\n2\n2\n1 35319\n1 38575\n1 40111\n2\n1 41305\n1 49444\n1 53013\n2\n2\n1 53117\n2\n2\n1 55113\n2\n2\n2\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nArkady is playing Battleship. The rules of this game aren't really important.\n\nThere is a field of n Γ n cells. There should be exactly one k-decker on the field, i. e. a ship that is k cells long oriented either horizo... | [{"type": "stdin_stdout", "input": "19 6\n##..............###\n#......#####.....##\n.....#########.....\n....###########....\n...#############...\n..###############..\n.#################.\n.#################.\n.#################.\n.#################.\n#####....##....####\n####............###\n###............####\n#####... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nToday on Informatics class Nastya learned about GCD and LCM (see links below). Nastya is very intelligent, so she solved all the tasks momentarily and now suggests you to solve one of them as well.\n\nWe define a pair of ... | [{"type": "stdin_stdout", "input": "1000000000 1000000000 1000000000 1000000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000 1000100000 1000000000\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "11678540 172842392 2335708 864211960\n", "output": "4\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKuldeep is tired from all the fun he's having with Christie, so now all he needs is a good night's sleep to get some rest. \n\nBeing a math nerd, he even dreams about maths. \n\nBut in this dreamland some mathematical ent... | [{"type": "stdin_stdout", "input": "2\n4 12\n1 2\n\nNUMALG", "output": "239439360000\n1\n"}, {"type": "stdin_stdout", "input": "2\n4 9\n3 2\n\nNUMALG", "output": "439360000\n20\n"}, {"type": "stdin_stdout", "input": "2\n1 1\n4 9\n\nGLMSAO", "output": "1\n439360000\n"}, {"type": "stdin_stdout", "input": "2\n2 1\n4 9\n\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Jhool is still out of his mind - exploring all his happy childhood memories. And one of his favorite memory is when he found a magical ghost, who promised to fulfill one of Little Jhool's wish. \n\nNow, Little Jhoo... | [{"type": "stdin_stdout", "input": "73\naclnbkbzqtvjvtvxdahhimirlsk\nxdcraywfygqxzctmtqsxqmsnbrswwvazwrhgzjo\nxwikhrbybfbvmzbildlhjidjhuoukqxxgadscimzfeiwnzhfeaxkgtehfjslrowxyvjbn\nyvlhmfqxvhbhnwixluolzwflqsvnoqsgpcgxjrxpanofgnhevk\nwpykolkxskhjhryenwliuscqdevoutaknwnjwyaj\naeswrxzrngwdttkwhbcvbcsqxggeezmwenvcpiunnwspx... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAshima has brought home n cats. Now, being a cat lover, she is taking care of the cats and has asked me to bring cat food for them. Being a guy with no idea what to buy, I brought some n packets of cat food (I atleast kne... | [{"type": "stdin_stdout", "input": "2\n-1 -1\n-1 11\n\nUMHAIR", "output": "-10\n"}, {"type": "stdin_stdout", "input": "2\n15 -1\n-1 -2\n\nSOKI@P", "output": "-13\n"}, {"type": "stdin_stdout", "input": "2\n-1 -1\n0 11\n\nUMHAIR", "output": "-11\n"}, {"type": "stdin_stdout", "input": "2\n-2 -2\n-1 7\n\nIMHBUR", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the Mathematical world of Dr. Ramanujam, every new student must have to pass a exam to take the classes of Advance mathematics from Dr. Ramanujam.\nOne day Ram wants to have classes of Advance mathematics, so he arrive... | [{"type": "stdin_stdout", "input": "2\n2+3+5\n1+3*3\n\nS@LPLF", "output": "10\n10\n"}, {"type": "stdin_stdout", "input": "2\n2+5*3\n2*3*2\n\nELPMSA", "output": "17\n12\n"}, {"type": "stdin_stdout", "input": "2\n3+5*2\n2*3*2\n\nPLENAR", "output": "13\n12\n"}, {"type": "stdin_stdout", "input": "2\n1+5*3\n2*3*2\n\nELPMSA"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSamu is in super market and in a mood to do a lot of shopping. She needs to buy shirts, pants and shoes for herself and her family. There are N different shops. Each shop contains all these three items but at different pr... | [{"type": "stdin_stdout", "input": "10\n82\n9414 595 5212\n2756 7474 3494\n787 9298 9010\n1897 4914 3531\n2321 8057 2194\n392 6614 2713\n2540 761 9297\n6482 693 4263\n4213 2219 7479\n1705 9724 3161\n1842 4363 7671\n1208 2195 1036\n5718 1227 595\n6438 2392 640\n1683 148 4386\n2071 5238 111\n5621 885 4033\n2265 3147 4948... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.\n\nIt takes us A_i minutes to read the i-th book from the top on Desk A (1 \\leq i \\leq N), and B_i minute... | [{"type": "stdin_stdout", "input": "5 4 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000010 1000000000", "output": "0\n"}, {"type": "stdin_stdout", "input": "5 4 1\n1000000000 1000000001 1000000000 1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000", "output": "0\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi has many red balls and blue balls. Now, he will place them in a row.\n\nInitially, there is no ball placed.\n\nTakahashi, who is very patient, will do the following operation 10^{100} times:\n\n* Place A blue ba... | [{"type": "stdin_stdout", "input": "69 -13 14", "output": "-910\n"}, {"type": "stdin_stdout", "input": "32 -13 14", "output": "-429\n"}, {"type": "stdin_stdout", "input": "149 -3 -1", "output": "111\n"}, {"type": "stdin_stdout", "input": "189 -3 -1", "output": "141\n"}, {"type": "stdin_stdout", "input": "248 -3 -1", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi is competing in a sumo tournament. The tournament lasts for 15 days, during which he performs in one match per day. If he wins 8 or more matches, he can also participate in the next tournament.\n\nThe matches fo... | [{"type": "stdin_stdout", "input": "xoxoxoxoxoxoxo", "output": "YES\n"}, {"type": "stdin_stdout", "input": "oxoxowoxoxoxox", "output": "YES\n"}, {"type": "stdin_stdout", "input": "oxoxowoooxoxxx", "output": "YES\n"}, {"type": "stdin_stdout", "input": "xxxoxooowoxoxo", "output": "YES\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given strings s and t. Find one longest string that is a subsequence of both s and t.\n\nConstraints\n\n* s and t are strings consisting of lowercase English letters.\n* 1 \\leq |s|, |t| \\leq 3000\n\nInput\n\nInp... | [{"type": "stdin_stdout", "input": "abracadabra\navaeakedavra", "output": "aaadara\n"}, {"type": "stdin_stdout", "input": "abracbdaara\navadakedavra", "output": "aadaara\n"}, {"type": "stdin_stdout", "input": "abracbdaara\narvadekadava", "output": "aradaaa\n"}, {"type": "stdin_stdout", "input": "araadbcarba\narvadekada... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a positive integer N. Find the minimum positive integer divisible by both 2 and N.\n\nConstraints\n\n* 1 \\leq N \\leq 10^9\n* All values in input are integers.\n\nInput\n\nInput is given from Standard Input... | [{"type": "stdin_stdout", "input": "15607691432", "output": "15607691432\n"}, {"type": "stdin_stdout", "input": "8325199727", "output": "16650399454\n"}, {"type": "stdin_stdout", "input": "1604548808", "output": "1604548808\n"}, {"type": "stdin_stdout", "input": "1558666763", "output": "3117333526\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA subsequence of a string S is a string that can be obtained by deleting zero or more characters from S without changing the order of the remaining characters. For example, `arc`, `artistic` and (an empty string) are all ... | [{"type": "stdin_stdout", "input": "frqnvhydscshfcgdemurlfrutcpzhopfotpifgepnqjxupnskapziurswqazdwnwbgdhzktfyhqqxpoidfhjdakoxraiedxskywuepzfniuyskxiyjpjlxuqnfgmnjcvtlpnclfkpervxmdbvrbrdn", "output": "aca\n"}, {"type": "stdin_stdout", "input": "ndrbrvbdmxvrepkflcnpltvcjnmgenquxldpjyhxksyuhnfzpeuwykpxdeiarxojajjhfdiopxqq... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a grid with 3 rows and N columns. The cell at the i-th row and j-th column is denoted (i, j). Initially, each cell (i, j) contains the integer i+3j-3.\n\n<image>\n\nA grid with N=5 columns\n\nSnuke can perform the... | [{"type": "stdin_stdout", "input": "7\n21 12 1 16 14 6 10\n20 11 0 27 14 7 8\n19 10 3 18 7 4 12", "output": "No\n"}, {"type": "stdin_stdout", "input": "7\n21 12 1 16 14 6 10\n20 12 0 27 14 7 8\n19 10 3 18 7 4 12", "output": "No\n"}, {"type": "stdin_stdout", "input": "7\n21 12 1 16 12 6 10\n20 12 0 27 14 7 8\n19 10 3 18... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCreate a program that reads the sales unit price and sales quantity and outputs the total sales amount and the average sales quantity.\n\n\n\nInput\n\nThe input is given in the following format:\n\n\nSales unit price, sal... | [{"type": "stdin_stdout", "input": "02,001\n50,10\n8,531", "output": "4750\n181\n"}, {"type": "stdin_stdout", "input": "0,1000\n01,05\n134,8", "output": "1077\n338\n"}, {"type": "stdin_stdout", "input": "0,1000\n01,05\n134,9", "output": "1211\n338\n"}, {"type": "stdin_stdout", "input": "0,1000\n11,05\n134,9", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCreate a program that calculates and outputs the surface distance by inputting the north latitude and east longitude of two cities on the earth. However, the earth is a sphere with a radius of 6,378.1 km, and the surface ... | [{"type": "stdin_stdout", "input": "35.997652258458864 139.77 51.15 361.449066466584\n1.6512558665331527 105.35573273382599 41.78 272.61282853754\n51.62303215206055 360.59086045680647 -34.03891385785915 302.61951676416413\n-1 -1 -1 -1", "output": "9516\n15035\n11082\n"}, {"type": "stdin_stdout", "input": "36.4199056430... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Aizu prefecture, we decided to create a new town to increase the population. To that end, we decided to cultivate a new rectangular land and divide this land into squares of the same size. The cost of developing this l... | [{"type": "stdin_stdout", "input": "10 29 10", "output": "2900\n"}, {"type": "stdin_stdout", "input": "10 29 13", "output": "3770\n"}, {"type": "stdin_stdout", "input": "4 -1 104", "output": "-416\n"}, {"type": "stdin_stdout", "input": "20 -1 18", "output": "-360\n"}, {"type": "stdin_stdout", "input": "12 -1 14", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nFive students, Taro, Jiro, Saburo, Shiro, and Hanako, participated in the JOI High School class.\n\nIn this class, a final exam was conducted. All five people took the final exam. For students with a final exam... | [{"type": "stdin_stdout", "input": "10\n130\n100\n37\n101", "output": "82\n"}, {"type": "stdin_stdout", "input": "10\n130\n100\n65\n101", "output": "87\n"}, {"type": "stdin_stdout", "input": "10\n130\n100\n98\n101", "output": "93\n"}, {"type": "stdin_stdout", "input": "10\n130\n110\n98\n100", "output": "95\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the 17th century, Fermat wrote that he proved for any integer $n \\geq 3$, there exist no positive integers $x$, $y$, $z$ such that $x^n + y^n = z^n$. However he never disclosed the proof. Later, this claim was named F... | [{"type": "stdin_stdout", "input": "6\n3\n13\n0", "output": "27\n11\n126\n"}, {"type": "stdin_stdout", "input": "6\n25\n12\n0", "output": "27\n64\n54\n"}, {"type": "stdin_stdout", "input": "6\n6\n15\n0", "output": "27\n27\n119\n"}, {"type": "stdin_stdout", "input": "6\n15\n2\n0", "output": "27\n119\n6\n"}, {"type": "st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLetβs try a dice puzzle. The rules of this puzzle are as follows.\n\n1. Dice with six faces as shown in Figure 1 are used in the puzzle.\n\n<image>\n\nFigure 1: Faces of a die\n\n2. With twenty seven such dice, a 3 Γ 3 Γ ... | [{"type": "stdin_stdout", "input": "4\n0 0 1\n0 1 0\n0 2 2\n0 2 2\n1 2 2\n6 -1 0\n0 7 4\n0 4 1\n4 1 0\n6 1 0\n12 -1 0\n4 1 -2\n1 -1 0\n1 2 0\n0 -1 -1\n5 1 2\n10 0 2\n-2 1 -2\n3 -1 -1\n-1 6 -2\n0 0 -1\n0 1 0\n-2 1 0\n3 0 0", "output": "0\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "4\n0 0 1\n0 1 0\n0 2 2\n0 2 2\n1 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem Statement\n\nWe have planted $N$ flower seeds, all of which come into different flowers. We want to make all the flowers come out together.\n\nEach plant has a value called vitality, which is initially zero. Water... | [{"type": "stdin_stdout", "input": "3\n10\n4 3 4 14\n5 4 5 39\n6 5 1 30\n3\n0\n-4 3 4 -10\n5 4 5 36\n6 5 6 30\n3\n1\n0 3 4 -10\n-5 4 5 -20\n6 5 7 30\n3\n10\n-4 3 8 -10\n-5 5 5 -20\n-6 5 6 -30\n0", "output": "61.2\n14.1\n8.28571\n0\n"}, {"type": "stdin_stdout", "input": "3\n10\n4 3 4 10\n5 4 5 18\n6 5 6 30\n3\n7\n-4 3 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEarly morning in summer camp\n\nThe morning of JAG summer training camp is early. To be exact, it is not so fast, but many participants feel that it is fast.\n\nAt the facility that is the venue for the training camp ever... | [{"type": "stdin_stdout", "input": "2\n0.60 1 2\n0.60 0\n2\n0.60 1 2\n0.60 1 1\n5\n0.10 1 2\n0.20 1 3\n0.30 1 4\n0.40 1 5\n0.7162042433937126 1 1\n5\n0.10 0\n0.20 1 1\n0.8904968944594156 1 1\n0.40 1 1\n0.50 1 1\n5\n0.5337845409531047 4 2 3 4 5\n0.20 0\n0.30 0\n0.6372471713101545 0\n0.8924320362064917 0\n4\n0.10 1 2\n0.... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNumber of tanka\n\nWishing to die in the spring under the flowers\n\nThis is one of the famous tanka poems that Saigyo Hoshi wrote. Tanka is a type of waka poem that has been popular in Japan for a long time, and most of ... | [{"type": "stdin_stdout", "input": "1\n1\n3\n1531\n2317\n714\n225725068861419081\n0", "output": "10\n10\n13\n55955\n155155\n7277\n3223333233333322222322232232233222323233333233223332\n"}, {"type": "stdin_stdout", "input": "1\n1\n4\n1531\n2317\n714\n225725068861419081\n0", "output": "10\n10\n14\n55955\n155155\n7277\n322... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nGiven $ N $ a pair of non-negative integers $ (a_i, b_i) $ and non-negative integers $ A $, $ B $.\nI want to do as many of the following operations as possible.\n\n\n* $ | a_i --b_i | \\ leq A $ or $ B \\ leq ... | [{"type": "stdin_stdout", "input": "10 1 12\n15 70\n36 -1\n18 43\n26 46\n33 20\n58 10\n0 -1\n80 5\n98 32\n23 84", "output": "1\n"}, {"type": "stdin_stdout", "input": "10 1 12\n15 70\n36 -1\n18 43\n26 46\n33 20\n58 10\n0 -1\n80 5\n98 32\n23 30", "output": "1\n"}, {"type": "stdin_stdout", "input": "10 1 12\n15 70\n58 -1\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads a sequence A of n elements and an integer M, and outputs \"yes\" if you can make M by adding elements in A, otherwise \"no\". You can use an element only once.\n\nYou are given the sequence A a... | [{"type": "stdin_stdout", "input": "5\n-1 5 10 1 21\n8\n1 8 31 11 16 14 001 40", "output": "yes\nno\nyes\nyes\nyes\nyes\nyes\nno\n"}, {"type": "stdin_stdout", "input": "5\n1 5 13 3 21\n8\n0 4 17 11 22 21 010 42", "output": "yes\nyes\nyes\nno\nyes\nyes\nno\nyes\n"}, {"type": "stdin_stdout", "input": "5\n1 5 7 3 21\n8\n0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which finds a pattern $p$ in a ring shaped text $s$.\n\n\n<image>\n\nConstraints\n\n* $1 \\leq $ length of $p \\leq $ length of $s \\leq 100$\n* $s$ and $p$ consists of lower-case letters\n\nInput\n\nIn th... | [{"type": "stdin_stdout", "input": "vanceknowledgetoad\nbdvanced", "output": "No\n"}, {"type": "stdin_stdout", "input": "vanceknowledgetoad\ncdvanced", "output": "No\n"}, {"type": "stdin_stdout", "input": "vanceknowmedgetoad\ncdvanced", "output": "No\n"}, {"type": "stdin_stdout", "input": "vbnceknowmedgetoad\ncdvanced"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe get more and more news about DDoS-attacks of popular websites.\n\nArseny is an admin and he thinks that a website is under a DDoS-attack if the total number of requests for a some period of time exceeds 100 β
t, where ... | [{"type": "stdin_stdout", "input": "100\n70 111 5 73 69 22 79 62 101 99 249 88 75 31 27 49 7 36 37 62 61 77 75 38 203 61 81 43 98 224 114 48 98 8 67 46 80 83 81 64 15 72 95 39 79 93 79 140 27 65 67 44 294 170 89 97 73 48 18 53 31 49 47 13 88 70 5 46 256 81 26 9 89 38 43 28 219 30 10 71 96 95 241 96 98 96 82 29 219 85 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya is having a party soon, and he has decided to invite his n friends.\n\nHe wants to make invitations in the form of origami. For each invitation, he needs two red sheets, five green sheets, and eight blue sheets. The... | [{"type": "stdin_stdout", "input": "100000000 1\n", "output": "1500000000\n"}, {"type": "stdin_stdout", "input": "100000010 1\n", "output": "1500000150\n"}, {"type": "stdin_stdout", "input": "100010010 1\n", "output": "1500150150\n"}, {"type": "stdin_stdout", "input": "103616972 10575\n", "output": "146976\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's call a string good if and only if it consists of only two types of letters β 'a' and 'b' and every two consecutive letters are distinct. For example \"baba\" and \"aba\" are good strings and \"abb\" is a bad string.... | [{"type": "stdin_stdout", "input": "1000000000 1000000000 1000000000\n", "output": "4000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 1010000000 1000000000\n", "output": "4000000001\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000 99999999\n", "output": "2199999998\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is the maximum value of n.\n\nYou are given a positive integer number n. You really love good numbers so you want to find the smallest good number greater than or equal t... | [{"type": "stdin_stdout", "input": "100\n1\n2\n3\n4\n5\n6\n7\n8\n14\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\n67\n68\n69\n70\n71\n72\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day Anna got the following task at school: to arrange several numbers in a circle so that any two neighboring numbers differs exactly by 1. Anna was given several numbers and arranged them in a circle to fulfill the t... | [{"type": "stdin_stdout", "input": "50\n363510947 363510954 363510943 363510964 363510969 363510950 363510951 363510960 363510967 363510952 363510956 363510948 363510944 363510946 363510965 363510946 363510963 363510962 363510947 363510955 363510954 363510948 363510961 363510964 363510963 363510945 363510965 363510953 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice has got addicted to a game called Sirtet recently.\n\nIn Sirtet, player is given an n Γ m grid. Initially a_{i,j} cubes are stacked up in the cell (i,j). Two cells are called adjacent if they share a side. Player ca... | [{"type": "stdin_stdout", "input": "1555494676 853938121 172337487 490664825\n", "output": "866256663\n"}, {"type": "stdin_stdout", "input": "885636311 1133047284 232531966 493119835\n", "output": "572179871\n"}, {"type": "stdin_stdout", "input": "1076117758 300009121 565317265 947272048\n", "output": "963831390\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers n and m. You have to construct the array a of length n consisting of non-negative integers (i.e. integers greater than or equal to zero) such that the sum of elements of this array is exactly m ... | [{"type": "stdin_stdout", "input": "5\n1 100\n2 -1\n5 5\n2 1000000000\n1000100000 1000000000\n", "output": "0\n-1\n10\n1000000000\n2000000000\n"}, {"type": "stdin_stdout", "input": "5\n1 100\n2 2\n5 5\n2 1000000000\n1000000000 1000000000\n", "output": "0\n2\n10\n1000000000\n2000000000\n"}, {"type": "stdin_stdout", "inp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSo, the New Year holidays are over. Santa Claus and his colleagues can take a rest and have guests at last. When two \"New Year and Christmas Men\" meet, thear assistants cut out of cardboard the letters from the guest's ... | [{"type": "stdin_stdout", "input": "VXINHOMEQCATZUGAJEIUIZZLPYFGUTVLNBNWCUVMEENUXKBWBGZTMRJJVJDLVSLBABVCEUDDSQFHOYPYQTWVAGTWOLKYISAGHBMC\nZMRGXPZSHOGCSAECAPGVOIGCWEOWWOJXLGYRDMPXBLOKZVRACPYQLEQGFQCVYXAGBEBELUTDAYEAGPFKXRULZCKFHZCHVCWIRGPK\nTRBRDDGGZIAVEXBCWGMEYAXATPQSLCWPKLEPIVOLTKMWVYYHJEQDNNELLDURGFWNVQGXUVCR\n", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAndre has very specific tastes. Recently he started falling in love with arrays.\n\nAndre calls an nonempty array b good, if sum of its elements is divisible by the length of this array. For example, array [2, 3, 1] is go... | [{"type": "stdin_stdout", "input": "100\n1\n0\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n19\n18\n19\n16\n21\n74\n23\n24\n45\n26\n23\n14\n57\n30\n22\n32\n33\n34\n35\n1\n37\n38\n11\n40\n53\n42\n43\n86\n45\n46\n19\n62\n95\n50\n9\n52\n53\n54\n55\n56\n57\n58\n59\n60\n61\n62\n89\n64\n65\n66\n17\n68\n69\n114\n71\n72\n7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp found n segments on the street. A segment with the index i is described by two integers l_i and r_i β coordinates of the beginning and end of the segment, respectively. Polycarp realized that he didn't need all t... | [{"type": "stdin_stdout", "input": "4\n3\n1 4\n2 3\n3 6\n4\n1 2\n2 3\n3 5\n2 5\n5\n0 0\n1 13\n4 1\n6 14\n9 10\n5\n1 5\n2 4\n3 5\n2 8\n4 8\n", "output": "0\n0\n1\n0\n"}, {"type": "stdin_stdout", "input": "4\n3\n1 4\n2 3\n3 6\n4\n1 2\n2 3\n3 5\n2 5\n5\n0 0\n1 13\n4 1\n6 14\n9 10\n5\n1 5\n2 4\n3 5\n2 9\n4 8\n", "output": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's define the cost of a string s as the number of index pairs i and j (1 β€ i < j < |s|) such that s_i = s_j and s_{i+1} = s_{j+1}.\n\nYou are given two positive integers n and k. Among all strings with length n that co... | [{"type": "stdin_stdout", "input": "97849 7\n", "output": "aabacadaeafagbbcbdbebfbgccdcecfcgddedfdgeefegffggaabacadaeafagbbcbdbebfbgccdcecfcgddedfdgeefegffggaabacadaeafagbbcbdbebfbgccdcecfcgddedfdgeefegffggaabacadaeafagbbcbdbebfbgccdcecfcgddedfdgeefegffggaabacadaeafagbbcbdbebfbgccdcecfcgddedfdgeefegffggaabacadaeafagbbc... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya once wrote a sad love song and shared it to Vasya. The song is a string consisting of lowercase English letters. Vasya made up q questions about this song. Each question is about a subsegment of the song starting fr... | [{"type": "stdin_stdout", "input": "13 7\nsonokhisumiwo\n1 5\n2 10\n7 10\n1 13\n1 8\n1 9\n3 6\n", "output": "74\n125\n62\n191\n110\n131\n48\n"}, {"type": "stdin_stdout", "input": "13 7\nowimusihkooos\n1 7\n2 10\n7 8\n2 13\n2 8\n2 4\n6 9\n", "output": "109\n128\n17\n177\n102\n45\n47\n"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA permutation is a sequence of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. Let's denote the i-th element of permutation p as pi. We'll call number n the size of per... | [{"type": "stdin_stdout", "input": "102\n", "output": "2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 50 49 52 51 54 53 56 55 58 57 60 59 62 61 64 63 66 65 68 67 70 69 72 71 74 73 76 75 78 77 80 79 82 81 84 83 86 85 88 87 90 89 92 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a rectangle grid. That grid's size is n Γ m. Let's denote the coordinate system on the grid. So, each point on the grid will have coordinates β a pair of integers (x, y) (0 β€ x β€ n, 0 β€ y β€ m).\n\nYour task ... | [{"type": "stdin_stdout", "input": "1000000000 1000001000 286536427 579261823 230782719 1150170645\n", "output": "209608854 195871608 363464000 962652038\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000 500000000 500000000 500000000 500000001\n", "output": "250000000 249999999 750000000 750000000\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nUser ainta is making a web site. This time he is going to make a navigation of the pages. In his site, there are n pages numbered by integers from 1 to n. Assume that somebody is on the p-th page now. The navigation will ... | [{"type": "stdin_stdout", "input": "100 10 100\n", "output": "1 2 3 4 5 6 7 8 9 (10) 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently, a start up by two students of a state university of city F gained incredible popularity. Now it's time to start a new company. But what do we call it?\n\nThe market analysts came up with a very smart plan: the n... | [{"type": "stdin_stdout", "input": "OVWIHIWVYXMVAAAATOXWOIUUHYXHIHHVUIOOXWHOXTUUMUUVHVWWYUTIAUAITAOMHXWMTTOIVMIVOTHOVOIOHYHAOXWAUVWAVIVM\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "QDPINBMCRFWXPDBFGOZVVOCEMJRUCTOADEWEGTVBVBFWWRPGYEEYGPRWWFBVBVTGEWEDAOTCURJMECOVVZOGFBDPXWFRCMBNIPDQ\n", "output": "NO\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA kindergarten teacher Natalia Pavlovna has invented a new ball game. This game not only develops the children's physique, but also teaches them how to count. \n\nThe game goes as follows. Kids stand in circle. Let's agre... | [{"type": "stdin_stdout", "input": "102\n", "output": "2 4 7 11 16 22 29 37 46 56 67 79 92 4 19 35 52 70 89 7 28 50 73 97 20 46 73 101 28 58 89 19 52 86 19 55 92 28 67 5 46 88 29 73 16 62 7 55 2 52 1 53 4 58 11 67 22 80 37 97 56 16 79 41 4 70 35 1 70 38 7 79 50 22 97 71 46 22 101 79 58 38 19 1 86 70 55 41 28 16 5 97 88... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVanya walks late at night along a straight street of length l, lit by n lanterns. Consider the coordinate system with the beginning of the street corresponding to the point 0, and its end corresponding to the point l. The... | [{"type": "stdin_stdout", "input": "46 615683844\n431749087 271781274 274974690 324606253 480870261 401650581 13285442 478090364 266585394 425024433 588791449 492057200 391293435 563090494 317950 173675329 473068378 356306865 311731938 192959832 321180686 141984626 578985584 512026637 175885185 590844074 47103801 21221... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDrazil is playing a math game with Varda.\n\nLet's define <image> for positive integer x as a product of factorials of its digits. For example, <image>.\n\nFirst, they choose a decimal number a consisting of n digits that... | [{"type": "stdin_stdout", "input": "15\n989898989898989\n", "output": "777777777777777333333333333333322222222222222222222222222222\n"}, {"type": "stdin_stdout", "input": "15\n999999999999990\n", "output": "77777777777777333333333333333333333333333322222222222222\n"}, {"type": "stdin_stdout", "input": "15\n987654329876... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Beroil corporation structure is hierarchical, that is it can be represented as a tree. Let's examine the presentation of this structure as follows:\n\n * employee ::= name. | name:employee1,employee2, ... ,employeek.... | [{"type": "stdin_stdout", "input": "ZLWSYH:WNMTNAI:FTCKPGZBJ.,UZSCFZVXXK.,LNGCU.,TCT.,LNGCU.,U.,NEHYSET..,FBLI:NEHYSET:IFY..,VN.,VN.,IFY.,FBLI.,YH.,FBLI.,DTXG.,NEHYSET.,WNMTNAI.,VN.,SVXN.,NEHYSET.,TCT.,DTXG..,UZSCFZVXXK:KZQRJFST.,FTCKPGZBJ.,WNMTNAI.,SVXN:DHONBXRZAL..,NEHYSET.,IFY..,MPOEEMVOP:DHONBXRZAL.,DTXG.,FTCKPGZBJ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHarry Potter and He-Who-Must-Not-Be-Named engaged in a fight to the death once again. This time they are located at opposite ends of the corridor of length l. Two opponents simultaneously charge a deadly spell in the enem... | [{"type": "stdin_stdout", "input": "1000\n148\n500\n", "output": "228.39506172839506\n"}, {"type": "stdin_stdout", "input": "425\n458\n118\n", "output": "337.93402777777777\n"}, {"type": "stdin_stdout", "input": "496\n326\n429\n", "output": "214.16688741721853\n"}, {"type": "stdin_stdout", "input": "745\n152\n417\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA permutation of length n is an array containing each integer from 1 to n exactly once. For example, q = [4, 5, 1, 2, 3] is a permutation. For the permutation q the square of permutation is the permutation p that p[i] = q... | [{"type": "stdin_stdout", "input": "100\n94 22 24 99 58 97 20 29 67 30 38 64 77 50 15 44 92 88 39 42 25 70 2 76 84 6 37 49 17 71 31 19 26 79 10 35 65 63 32 95 5 8 52 27 83 18 53 93 13 81 48 68 54 82 34 60 87 23 16 86 55 40 61 45 28 7 74 41 14 91 3 72 33 11 98 89 90 69 78 36 80 59 56 21 43 1 75 46 47 12 96 73 57 51 4 85... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter the piece of a devilish mirror hit the Kay's eye, he is no longer interested in the beauty of the roses. Now he likes to watch snowflakes.\n\nOnce upon a time, he found a huge snowflake that has a form of the tree (... | [{"type": "stdin_stdout", "input": "7 4\n1 1 3 3 5 3\n1\n2\n3\n5\n", "output": "3\n2\n3\n5\n"}, {"type": "stdin_stdout", "input": "7 4\n1 1 3 3 5 3\n2\n2\n3\n5\n", "output": "2\n2\n3\n5\n"}, {"type": "stdin_stdout", "input": "7 4\n1 1 3 3 5 3\n2\n4\n3\n5\n", "output": "2\n4\n3\n5\n"}, {"type": "stdin_stdout", "input": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne tradition of welcoming the New Year is launching fireworks into the sky. Usually a launched firework flies vertically upward for some period of time, then explodes, splitting into several parts flying in different dir... | [{"type": "stdin_stdout", "input": "30\n4 1 3 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5\n", "output": "60096\n"}, {"type": "stdin_stdout", "input": "30\n1 3 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5\n", "output": "61237\n"}, {"type": "stdin_stdout", "input": "30\n2 5 5 5 5 5 5 5 5 5 5 5 5 5 5 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nStepan is a very experienced olympiad participant. He has n cups for Physics olympiads and m cups for Informatics olympiads. Each cup is characterized by two parameters β its significance ci and width wi.\n\nStepan decide... | [{"type": "stdin_stdout", "input": "20 10 761\n66 41\n47 7\n35 6\n22 40\n15 2\n47 28\n46 47\n3 45\n12 19\n44 41\n46 2\n49 23\n9 8\n7 41\n5 3\n16 42\n12 50\n17 22\n25 9\n45 12\n56 44\n34 47\n33 35\n32 47\n119 6\n27 18\n43 36\n23 6\n39 22\n38 45\n", "output": "1009\n"}, {"type": "stdin_stdout", "input": "20 10 761\n66 41... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA new pack of n t-shirts came to a shop. Each of the t-shirts is characterized by three integers pi, ai and bi, where pi is the price of the i-th t-shirt, ai is front color of the i-th t-shirt and bi is back color of the ... | [{"type": "stdin_stdout", "input": "20\n414468312 20329584 106106409 584924603 666547477 670032002 726095027 276840253 368277336 940941705 531635095 213813062 440421387 959075599 240727854 495316522 838268432 786936631 586382273 806443734\n3 1 2 3 3 2 2 1 3 2 3 2 3 3 3 2 1 3 1 2\n3 1 2 2 2 2 3 1 2 3 2 1 1 2 3 1 2 3 3 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSome time ago Mister B detected a strange signal from the space, which he started to study.\n\nAfter some transformation the signal turned out to be a permutation p of length n or its cyclic shift. For the further investi... | [{"type": "stdin_stdout", "input": "108\n1 102 33 99 6 83 4 20 61 100 76 71 44 9 24 87 57 2 81 82 90 85 12 30 66 53 47 36 43 29 31 64 96 84 77 23 93 78 58 68 42 55 13 70 62 19 92 14 10 65 63 75 91 48 11 105 37 50 32 94 18 26 52 89 104 106 86 97 80 95 17 72 40 22 79 103 25 101 35 51 15 98 67 5 34 69 54 27 45 88 56 16 46... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt's another Start[c]up finals, and that means there is pizza to order for the onsite contestants. There are only 2 types of pizza (obviously not, but let's just pretend for the sake of the problem), and all pizzas contai... | [{"type": "stdin_stdout", "input": "25 6\n1 10 5\n1 8 4\n1 8 2\n4 8 9\n3 2 8\n1 9 5\n2 10 10\n1 9 6\n3 5 4\n2 7 8\n2 3 2\n2 6 8\n3 7 8\n4 3 7\n1 8 1\n3 6 4\n3 2 8\n2 2 1\n4 8 8\n4 13 4\n3 10 2\n3 6 6\n2 2 5\n1 6 2\n4 1 5\n", "output": "451\n"}, {"type": "stdin_stdout", "input": "25 6\n1 10 5\n1 8 4\n1 5 2\n4 8 9\n3 2 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a with n distinct integers. Construct an array b by permuting a such that for every non-empty subset of indices S = {x1, x2, ..., xk} (1 β€ xi β€ n, 0 < k < n) the sums of elements on that positions i... | [{"type": "stdin_stdout", "input": "22\n133295371 188010892 71730560 282666912 193069109 184556873 87395258 234247052 230809052 211444018 148989732 17810977 158722706 11753932 100093528 1000000000 43672080 61357581 171830832 13873487 34865589 114340079\n", "output": "148989732 193069109 87395258 1000000000 211444018 18... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAncient Egyptians are known to have understood difficult concepts in mathematics. The ancient Egyptian mathematician Ahmes liked to write a kind of arithmetic expressions on papyrus paper which he called as Ahmes arithmet... | [{"type": "stdin_stdout", "input": "((((4?6)?9)?((5?(7?1))?(6?(4?(((((((7?3)?7)?(((((8?(6?7))?((1?2)?(5?8)))?8)?7)?4))?6)?7)?1)?((7?(2?((1?(((8?(((((2?7)?(((((3?6)?3)?(((((9?4)?7)?(1?(5?5)))?(8?((3?(1?2))?((8?5)?(7?((9?((9?8)?7))?1))))))?1))?1)?(9?2)))?((7?5)?((9?(4?(9?6)))?(8?(((5?7)?2)?(6?(3?8)))))))?(((4?(2?2))?(7?9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given n points on Cartesian plane. Every point is a lattice point (i. e. both of its coordinates are integers), and all points are distinct.\n\nYou may draw two straight lines (not necessarily distinct). Is it pos... | [{"type": "stdin_stdout", "input": "59\n1 0\n0 2\n0 3\n0 4\n0 5\n6 0\n7 0\n8 0\n9 0\n10 0\n0 11\n12 0\n13 0\n14 0\n15 0\n0 16\n0 17\n18 0\n19 0\n20 0\n21 0\n0 22\n23 0\n24 0\n0 25\n26 0\n27 0\n0 28\n0 29\n30 0\n31 0\n0 32\n33 0\n34 0\n0 35\n0 36\n37 0\n0 38\n39 0\n40 0\n0 41\n42 0\n0 43\n0 44\n0 45\n0 46\n47 0\n0 48\n0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs the boat drifts down the river, a wood full of blossoms shows up on the riverfront.\n\n\"I've been here once,\" Mino exclaims with delight, \"it's breathtakingly amazing.\"\n\n\"What is it like?\"\n\n\"Look, Kanno, you... | [{"type": "stdin_stdout", "input": "100 100 100 100\n", "output": "50 50\nAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBB\nABABABABABABABABABABABABABCBCBCBCBCBCBCBCBCBCBCBCB\nAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBB\nABABABABABABABABABABABABABCBCBCBCBCBCBCBCBCBCBCBCB\nAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBB... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are looking for a place to park your car on a wall street. You can park at any position that meets the following requirements:\n1. It is not directly in front of a private driveway.\n2. It is not directly in front o... | [{"type": "stdin_stdout", "input": "46\n---B--S-D--S--\nDDBDDBDDBDD\n--S--S--S--S--\nSSD-B---BD-DDSB-----S-S--------S-B----BSB-S--B-S-D\n-SB---S----DD-D-DS---B--BD-S-SD---D----D-B---B-SDD\n------BB-----D--------S--D-BSSS-----B---S-S-SSS---\n----------S--S----D---------SD---DD--D---DSB-B----\n-S---------DDDB---BB----SSD... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have some boxes. All of them are assigned a unique positive integer. This number is written on them with a marker. Your task is simple that is to evaluate a number of queries. The description of a single query is \ngi... | [{"type": "stdin_stdout", "input": "5\n-1 3 2 1 1\n4\n2 2\n1 3\n5 8\n1 1\n\nMASPLF", "output": "1\n4\n0\n2\n"}, {"type": "stdin_stdout", "input": "5\n2 3 2 1 2\n4\n0 1\n1 3\n5 11\n1 2\n\nMASPLF", "output": "1\n5\n0\n4\n"}, {"type": "stdin_stdout", "input": "5\n-1 3 2 1 2\n4\n2 2\n1 3\n5 8\n1 1\n\nMASPLF", "output": "2\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMonk A loves to complete all his tasks just before the deadlines for introducing unwanted thrill in his life. But, there is another Monk D who hates this habit of Monk A and thinks it's risky. \n\nTo test Monk A, Monk D ... | [{"type": "stdin_stdout", "input": "10\n384\n846930887 1681692778 1714636916 1957747794 424238336 719885387 1649760493 596516650 1189641422 1025202363 1350490028 783368691 1102520060 2044897764 1967513927 1365180541 1540383427 304089173 1303455737 35005212 521595369 294702568 1726956430 336465783 861021531 278722863 23... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs we have seen our little Vaishanavi playing with the plywood, her brother Vaishnav was playing\nwith numbers. \n\nRead about Factorial \n\nAs we all know this kid always thinks in a different way than others think. He h... | [{"type": "stdin_stdout", "input": "100\n200\n201\n202\n203\n204\n205\n206\n207\n208\n209\n210\n211\n212\n213\n214\n215\n216\n217\n218\n219\n220\n221\n222\n223\n224\n225\n226\n227\n228\n229\n230\n231\n232\n233\n234\n235\n236\n237\n238\n239\n240\n241\n242\n243\n244\n245\n246\n247\n248\n249\n200\n201\n202\n203\n204\n205\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nM-kun has the following three cards:\n\n* A red card with the integer A.\n* A green card with the integer B.\n* A blue card with the integer C.\n\n\n\nHe is a genius magician who can do the following operation at most K t... | [{"type": "stdin_stdout", "input": "13 4 1\n10", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "13 5 1\n10", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "12 3 4\n9", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "12 4 4\n9", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "12 4 2\n9", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have N balls. The i-th ball has an integer A_i written on it.\nFor each k=1, 2, ..., N, solve the following problem and print the answer.\n\n* Find the number of ways to choose two distinct balls (disregarding order) f... | [{"type": "stdin_stdout", "input": "8\n1 1 1 1 1 0 4 1", "output": "10\n10\n10\n10\n10\n15\n15\n10\n"}, {"type": "stdin_stdout", "input": "8\n1 1 0 1 1 1 6 1", "output": "10\n10\n15\n10\n10\n10\n15\n10\n"}, {"type": "stdin_stdout", "input": "8\n1 1 1 3 1 0 4 1", "output": "6\n6\n6\n10\n6\n10\n10\n6\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHow many ways are there to choose two distinct positive integers totaling N, disregarding the order?\n\nConstraints\n\n* 1 \\leq N \\leq 10^6\n* N is an integer.\n\nInput\n\nInput is given from Standard Input in the follo... | [{"type": "stdin_stdout", "input": "3256265", "output": "1628132\n"}, {"type": "stdin_stdout", "input": "1527191", "output": "763595\n"}, {"type": "stdin_stdout", "input": "1743342", "output": "871670\n"}, {"type": "stdin_stdout", "input": "1412384", "output": "706191\n"}, {"type": "stdin_stdout", "input": "1339977", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA ball will bounce along a number line, making N + 1 bounces. It will make the first bounce at coordinate D_1 = 0, and the i-th bounce (2 \\leq i \\leq N+1) at coordinate D_i = D_{i-1} + L_{i-1}.\n\nHow many times will th... | [{"type": "stdin_stdout", "input": "3 12\n16 5 1 12", "output": "1\n"}, {"type": "stdin_stdout", "input": "3 12\n16 5 1 17", "output": "1\n"}, {"type": "stdin_stdout", "input": "1 14\n13 18 1 1", "output": "2\n"}, {"type": "stdin_stdout", "input": "3 12\n16 9 1 17", "output": "1\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLa Confiserie d'ABC sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you ca... | [{"type": "stdin_stdout", "input": "-111", "output": "No\n"}, {"type": "stdin_stdout", "input": "-106", "output": "No\n"}, {"type": "stdin_stdout", "input": "-123", "output": "No\n"}, {"type": "stdin_stdout", "input": "-207", "output": "No\n"}, {"type": "stdin_stdout", "input": "-226", "output": "No\n"}, {"type": "stdi... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.