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\nThe city of Kyoto is well-known for its Chinese plan: streets are either North-South or East-West. Some streets are numbered, but most of them have real names.\nCrossings are named after the two streets crossing there, e....
[{"type": "stdin_stdout", "input": "7\nShijo-Kawaramachi\nKarasuma-Imadegawa\nKawaramachi-Imadegawa\nNishioji-Shijo\nKarasuma-Gojo\nTorimaru-Rokujo\nRokujo-Karasuma\n6\nShijo-Karasuma\nImadegawa-Nishioji\nNishioji-Gojo\nShijo-Torimaru\nTorimaru-Gojo\nShijo-Kawabata\n4\n1jo-Midosuji\nMidosuji-2jo\n2jo-Omotesando\nOmotes...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n<!--\n\nProblem B\n\n-->\n\nOn-Screen Keyboard\n\nYou are to input a string with an OSK (on-screen keyboard). A remote control with five buttons, four arrows and an OK (Fig. B-1), is used for the OSK. Find the minimum num...
[{"type": "stdin_stdout", "input": "3 9\nABCDEFGHI\nJKLMNOPQR\nSTUVWXYZ_\nICPC\n5 11\n___________\n____A______\n________M__\n___________\n_C_________\nACM\n4 21\n1_2_3_4_5_6_7_8_9_0_-\nQqWwEeRrTtYyUuIiOoPp@\nAaSsDdFfGgHhJjKkLl;^:\nZzXxCcVvBbNnMm,_._/__\nICPC2019,AsiaYokohamaRegional,QualificationRound\n0 0", "output": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTaro is a member of a programming contest circle. In this circle, the members manage their schedules in the system called Great Web Calender.\n\nTaro has just added some of his friends to his calendar so that he can brows...
[{"type": "stdin_stdout", "input": "5 2\n12.765198556451168 15.39026707382745 9.233322443088145\n10.815832893726053 -1.9252139692459584 2.3339220907347795\n4.371806005587981 8.307983558511573 9.03829736864434\n3.663558291396137 5.363391652445537 7.212792777097519\n3.0699790954158255 4.913753801376337 -4.249695725207287...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIevan Ritola is a researcher of behavioral ecology. Her group visited a forest to analyze an ecological system of some kinds of foxes.\n\nThe forest can be expressed as a two-dimensional plane. With her previous research,...
[{"type": "stdin_stdout", "input": "2\n1 0 8\n1 -1 3", "output": "11 / 1\n"}, {"type": "stdin_stdout", "input": "2\n1 2 7\n2 3 12", "output": "19 / 1\n"}, {"type": "stdin_stdout", "input": "2\n1 0 7\n2 3 12", "output": "12 / 1\n"}, {"type": "stdin_stdout", "input": "2\n0 1 14\n0 0 0", "output": "14 / 1\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA: My Number-My Number-\n\nproblem\n\nI'm sorry! Late late!\n\nAh! I'm starting to work for this company I've been longing for today!\n\nEven so, I've been oversleeping since the first day ...! ??\n\nToday is an important...
[{"type": "stdin_stdout", "input": "?12345678900", "output": "MULTIPLE\n"}, {"type": "stdin_stdout", "input": "5/47885?3210", "output": "MULTIPLE\n"}, {"type": "stdin_stdout", "input": "?123456789/1", "output": "8\n"}, {"type": "stdin_stdout", "input": "1/987654321?", "output": "0\n"}, {"type": "stdin_stdout", "input":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor given two lines s1 and s2, print \"2\" if they are parallel, \"1\" if they are orthogonal, or \"0\" otherwise.\n\ns1 crosses points p0 and p1, and s2 crosses points p2 and p3.\n\nConstraints\n\n* 1 ≀ q ≀ 1000\n* -1000...
[{"type": "stdin_stdout", "input": "3\n-1 -1 10 1 2 0 2 2\n0 5 6 -1 0 -1 0 22\n-2 -1 1 1 0 -1 2 2", "output": "0\n0\n0\n"}, {"type": "stdin_stdout", "input": "3\n-1 -1 10 1 2 0 2 2\n0 5 6 -1 0 -1 0 22\n-2 -1 1 1 1 -1 2 2", "output": "0\n0\n0\n"}, {"type": "stdin_stdout", "input": "3\n-1 -1 10 1 2 0 2 4\n0 5 6 -1 0 -1 0...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which manipulates a sequence $A = \\\\{a_0, a_1, ..., a_{n-1}\\\\}$ by the following operations:\n\n* min($b, e$): report the minimum element in $a_b, a_{b+1}, ..., a_{e-1}$\n* max($b, e$): report the maxi...
[{"type": "stdin_stdout", "input": "7\n8 3 0 0 1 0 4\n10\n0 0 3\n1 0 5\n1 0 7", "output": "0\n8\n8\n8\n8\n8\n8\n8\n8\n8\n"}, {"type": "stdin_stdout", "input": "7\n7 5 0 1 14 -1 10\n6\n0 1 3\n0 1 3\n1 0 7", "output": "0\n0\n14\n14\n14\n14\n"}, {"type": "stdin_stdout", "input": "7\n7 5 0 1 14 0 10\n6\n0 1 3\n0 1 2\n1 0 7...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n startups. Startups can be active or acquired. If a startup is acquired, then that means it has exactly one active startup that it is following. An active startup can have arbitrarily many acquired startups tha...
[{"type": "stdin_stdout", "input": "50\n36 36 45 44 -1 -1 13 -1 36 -1 44 36 -1 -1 -1 35 -1 36 36 35 -1 -1 -1 14 36 36 22 36 13 -1 35 -1 35 36 -1 -1 13 13 45 36 14 -1 36 -1 -1 -1 22 36 -1 13\n", "output": "949472419\n"}, {"type": "stdin_stdout", "input": "50\n36 36 45 44 -1 -1 13 -1 36 -1 44 36 -1 -1 -1 35 -1 36 36 49 -...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter learning a lot about space exploration, a little girl named Ana wants to change the subject.\n\nAna is a girl who loves palindromes (string that can be read the same backwards as forward). She has learned how to che...
[{"type": "stdin_stdout", "input": "20\niw\nix\nudb\nbg\noi\nuo\njsm\num\ns\nquy\nqo\nbxct\nng\nrmr\nnu\nps\nio\nkh\nw\nk\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "20\nhw\nix\nudb\nbg\noi\nuo\njsm\num\ns\nquy\nqo\nbxct\nng\nrmr\nnu\nps\nio\nkh\nw\nk\n", "output": "5\n"}, {"type": "stdin_stdout", "input":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point T, which coordinates to be found out.\n\nBob travelled around the world and collected clues of the treasure l...
[{"type": "stdin_stdout", "input": "25\n2 2\n1 -2\n1 1\n0 1\n2 1\n-2 2\n-1 -2\n-1 2\n0 -2\n-1 1\n-2 -1\n-1 -1\n1 -1\n2 -1\n1 2\n-2 -2\n2 0\n-2 0\n-2 1\n2 -2\n-1 0\n1 0\n0 -1\n0 2\n0 0\n1 3\n-3 -1\n-2 0\n-3 1\n1 1\n0 0\n-2 2\n-1 -1\n1 -1\n-3 3\n0 3\n-2 1\n0 1\n-3 2\n-1 3\n-2 3\n-2 -1\n1 2\n1 0\n-3 0\n0 -1\n-1 2\n-1 1\n-...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.\n\...
[{"type": "stdin_stdout", "input": "10\n4 8 480392999\n3 4 32525297\n9 7 417904789\n6 2 836294777\n5 3 616099185\n1 7 830574407\n8 10 838073755\n6 10 547050646\n2 1 12607780\n", "output": "0"}, {"type": "stdin_stdout", "input": "5\n1 2 1000000000\n2 3 747774\n3 4 4\n4 5 8447854\n", "output": " ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLong ago, when Petya was a schoolboy, he was very much interested in the Petr# language grammar. During one lesson Petya got interested in the following question: how many different continuous substrings starting with the...
[{"type": "stdin_stdout", "input": "bgphoaomnjcjhgkgbflfclbjmkbfonpbmkdomjmkahaoclcbijdjlllnpfkbilgiiidbabgojbbfmliemhicaanadbaahagmfdldbbklelkihlcbkhchlikhefeeafbhkabfdlhnnjnlimbhneafcfeapcbeifgcnaijdnkjpikedmdbhahhgcijddfmamdiaapaeimdhfblpkedamifbbdndmmljmdcffcpmanndeeclnpnkdoieiahchdnkdmfnbocnimclgckdcbp\npcbeifgcna...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently Petya walked in the forest and found a magic stick.\n\nSince Petya really likes numbers, the first thing he learned was spells for changing numbers. So far, he knows only two spells that can be applied to a posit...
[{"type": "stdin_stdout", "input": "7\n2 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234\n", "output": "Yes\nYes\nNo\nYes\nNo\nYes\nYes\n"}, {"type": "stdin_stdout", "input": "7\n4 3\n1 1\n3 6\n6 8\n1 2\n4 1\n31235 6578234\n", "output": "Yes\nYes\nNo\nYes\nNo\nYes\nYes\n"}, {"type": "stdin_stdout", "input": "1\n858993461 100...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWelcome! Everything is fine.\n\nYou have arrived in The Medium Place, the place between The Good Place and The Bad Place. You are assigned a task that will either make people happier or torture them for eternity.\n\nYou h...
[{"type": "stdin_stdout", "input": "2\n3\n1 2 3\n3 2 4\n2 4 0\n4 5 10\n5 6 5\n1\n1 2 2\n1 5 2\n1 4 6\n", "output": "12 32\n2 2\n"}, {"type": "stdin_stdout", "input": "2\n3\n1 2 3\n3 2 4\n2 4 3\n4 5 6\n5 6 5\n2\n1 2 1\n1 3 2\n1 4 3\n", "output": "15 33\n6 6\n"}, {"type": "stdin_stdout", "input": "2\n3\n1 2 3\n3 2 4\n2 4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nReminder: the [median](https://en.wikipedia.org/wiki/Median) of the array [a_1, a_2, ..., a_{2k+1}] of odd number of elements is defined as follows: let [b_1, b_2, ..., b_{2k+1}] be the elements of the array in the sorted...
[{"type": "stdin_stdout", "input": "3\n1\n1 1\n3\n6 5 4 1 2 3\n5\n13 4 10 22 2 5 10 3 16 16\n", "output": "0\n1\n0\n"}, {"type": "stdin_stdout", "input": "3\n1\n-1 2\n3\n11 1 0 2 2 5\n5\n13 2 7 13 1 5 1 3 23 14\n", "output": "3\n0\n2\n"}, {"type": "stdin_stdout", "input": "3\n1\n1 2\n3\n6 5 4 1 2 1\n5\n13 4 7 14 2 10 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a frog staying to the left of the string s = s_1 s_2 … s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. It means that if the f...
[{"type": "stdin_stdout", "input": "6\nLRLRRLL\nL\nLLR\nRRRR\nLLLLLL\nR\n", "output": "3\n2\n3\n1\n7\n1\n"}, {"type": "stdin_stdout", "input": "6\nRRLRLLL\nL\nLLR\nRRRR\nLLLLLL\nR\n", "output": "4\n2\n3\n1\n7\n1\n"}, {"type": "stdin_stdout", "input": "6\nMRLRRLL\nL\nLLR\nRRRR\nLLLLLL\nR\n", "output": "3\n2\n3\n1\n7\n1\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size n. Let's call ...
[{"type": "stdin_stdout", "input": "20\n9 15 11 8 10 5 19 13 12 18 3 20 17 14 2 16 7 4 1 6\n12 6 7 5 4 20 15 14 1 18 10 17 9 19 16 3 13 11 2 8\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "18\n11 16 18 3 7 12 10 6 14 15 5 13 9 17 4 8 1 2\n16 9 8 7 4 13 6 17 3 18 14 11 5 1 15 12 10 2\n", "output": "3\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a consisting of n integers. You have to find the length of the smallest (shortest) prefix of elements you need to erase from a to make it a good array. Recall that the prefix of the array a=[a_1, a_...
[{"type": "stdin_stdout", "input": "5\n4\n1 2 3 4\n7\n4 8 3 16 4 10 2\n3\n0 1 1\n7\n1 3 1 4 5 3 2\n5\n5 3 3 2 5\n", "output": "0\n4\n0\n2\n3\n"}, {"type": "stdin_stdout", "input": "5\n4\n1 2 3 4\n7\n13 3 4 8 4 5 2\n3\n1 1 1\n7\n1 3 1 7 5 0 2\n5\n5 4 3 2 3\n", "output": "0\n4\n0\n5\n3\n"}, {"type": "stdin_stdout", "inpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlexandra has an even-length array a, consisting of 0s and 1s. The elements of the array are enumerated from 1 to n. She wants to remove at most n/2 elements (where n β€” length of array) in the way that alternating sum of ...
[{"type": "stdin_stdout", "input": "4\n2\n1 1\n2\n0 0\n4\n0 1 1 1\n4\n1 1 0 0\n", "output": "2\n1 1 \n2\n0 0 \n2\n1 1 \n2\n0 0 \n"}, {"type": "stdin_stdout", "input": "4\n2\n0 0\n2\n0 0\n4\n0 1 1 1\n4\n1 1 0 0\n", "output": "2\n0 0 \n2\n0 0 \n2\n1 1 \n2\n0 0 \n"}, {"type": "stdin_stdout", "input": "4\n2\n1 1\n2\n0 0\n4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDr. Moriarty is about to send a message to Sherlock Holmes. He has a string s. \n\nString p is called a substring of string s if you can read it starting from some position in the string s. For example, string \"aba\" has...
[{"type": "stdin_stdout", "input": "ksmbytfyhhnstlecripupiwdhbkhfpfmimrbqgszohcqnezcybvwasxmkxfupvuecsctcpadccnqexsglwaiyxcoyheefcjmdedesgjqdtqgrvfjonzesffousooutsjumrxl\nhgjqihcfbnmgufonaiudbjegexexthrzcdkuimwogpbyovemztzcmqnrbhabxyyxyfuzpyhjgnioexbezzupcxlyzuuncstiiqsjzdtqppqhxilvqimlpjejiqbwpeekzweeyvthvjffgfvqauqru...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Smart Beaver from ABBYY plans a space travel on an ultramodern spaceship. During the voyage he plans to visit n planets. For planet i ai is the maximum number of suitcases that an alien tourist is allowed to bring to ...
[{"type": "stdin_stdout", "input": "26 919241245\n302193 763904252\n302152 990010704\n453347 786598325\n302156 614790744\n151113 552970041\n151053 935503943\n453339 788648514\n453340 819457698\n604398 992471599\n453342 141598754\n302166 998869126\n151098 158907792\n453293 724150038\n604414 436248800\n604434 447578562\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled \"Special Olympics\". He justly thought that, if the regular Olympic games have five rings, then the Special ones wil...
[{"type": "stdin_stdout", "input": "-100 -97 20 40\n-151 -97 30 100\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "-123 -29 20 40\n-39 -19 99 100\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "-100 -97 20 40\n-90 -97 30 100\n", "output": "2"}, {"type": "stdin_stdout", "input": "-45 -93 20 40\n-36 -9...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTo confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the p...
[{"type": "stdin_stdout", "input": "10 10\n2 5 11 17 23 31 41 47 59 67\n3 7 13 19 29 37 43 53 61 71\n", "output": "10 10\n2 5 11 17 23 31 41 47 59 67 \n3 7 13 19 29 37 43 53 61 71 \n"}, {"type": "stdin_stdout", "input": "10 10\n2 5 11 17 23 31 41 47 59 67\n3 8 6 19 29 37 43 53 38 131\n", "output": "10 10\n1 5 11 17 23 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle boy Valera studies an algorithm of sorting an integer array. After studying the theory, he went on to the practical tasks. As a result, he wrote a program that sorts an array of n integers a1, a2, ..., an in the no...
[{"type": "stdin_stdout", "input": "50\n", "output": "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 6 5 4 3 2 1\n"}, {"type": "stdin_stdout", "input": "49\n", "output": "49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou've got an n Γ— m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased ...
[{"type": "stdin_stdout", "input": "10 10\n20 53 6 97 74 12 92 48 13 97\n157 47 32 75 21 69 75 95 54 1\n97 36 1 41 87 1 23 39 44 27\n97 73 1 1 26 6 3 48 69 5\n70 93 42 35 5 12 22 33 29 13\n96 8 13 69 40 91 5 19 16 33\n61 92 54 82 60 24 63 64 59 65\n76 44 60 37 29 16 50 74 59 59\n77 58 95 30 52 25 34 2 49 92\n37 65 12 7...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVolodya likes listening to heavy metal and (occasionally) reading. No wonder Volodya is especially interested in texts concerning his favourite music style.\n\nVolodya calls a string powerful if it starts with \"heavy\" a...
[{"type": "stdin_stdout", "input": "trueheavymetalissotruewellitisalsosoheavythatyoucanalmostfeeltheweightofmetalonyou\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "trueheavymetalissotruewellitisalsosoheavythatyoucanalmosteeeltheweightofmetalonyou\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "true...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nXenia the vigorous detective faced n (n β‰₯ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right. \n\nSpy s has an important note. He has to pass the note to spy f. Xenia inte...
[{"type": "stdin_stdout", "input": "100000 1 11500 86289\n1 86 75626\n", "output": "XRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n\n\nInput\n\nThe input contains a single integer a (1 ≀ a ≀ 64).\n\nOutput\n\nOutput a single integer.\n\nExamples\n\nInput\n\n2\n\n\nOutput\n\n1\n\n\nInput\n\n4\n\n\nOutput\n\n2\n\n\nInput\n\n27\n\n\nOutput\n\n5\n\n\nInp...
[{"type": "stdin_stdout", "input": "64\n", "output": "267"}, {"type": "stdin_stdout", "input": "011\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "010\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "001\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "32\n", "output": "51"}, {"type": "stdin_s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOnce upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the...
[{"type": "stdin_stdout", "input": "A.He_nan_de_yang_guang_zhao_yao_zhe_wo_men_mei_guo_ren_lian_shang_dou_xiao_kai_yan_wahaaaaaaaaaaaaaaaa\nB.Li_bai_li_bai_fei_liu_zhi_xia_san_qian_chi_yi_si_yin_he_luo_jiu_tian_li_bai_li_bai_li_bai_li_bai_shi\nC.Peng_yu_xiang_shi_zai_tai_shen_le_jian_zhi_jiu_shi_ye_jie_du_liu_a_si_mi_d...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nShuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.\n\nThanks to Mr. Kitayuta's research, it has finally become possible to construct telep...
[{"type": "stdin_stdout", "input": "7 13\n6 1\n7 2\n3 7\n6 5\n3 6\n7 4\n3 5\n4 1\n3 1\n1 5\n1 6\n6 2\n2 4\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "8 12\n6 1\n7 5\n2 5\n4 1\n6 3\n4 3\n5 7\n1 3\n5 2\n2 7\n4 6\n7 2\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "8 12\n6 1\n7 5\n2 5\n4 1\n6 3\n4 3\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a given sequence of integers a1, a2, ..., an, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other...
[{"type": "stdin_stdout", "input": "30\n2 1 3 2 3 2 2 2 2 3 2 2 3 2 1 1 3 1 3 2 1 2 3 1 1 3 3 1 3 1\n", "output": "19\n"}, {"type": "stdin_stdout", "input": "30\n2 1 3 2 3 2 2 2 2 3 2 2 1 2 1 1 3 1 3 2 1 2 3 1 1 3 3 1 3 1\n", "output": "19\n"}, {"type": "stdin_stdout", "input": "30\n2 1 3 2 3 2 2 2 2 3 2 2 1 2 1 1 3 1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAndrewid the Android is a galaxy-known detective. Now he does not investigate any case and is eating chocolate out of boredom.\n\nA bar of chocolate can be presented as an n Γ— n table, where each cell represents one piece...
[{"type": "stdin_stdout", "input": "20 10\n10 11 U\n12 9 U\n6 15 L\n17 4 U\n11 10 L\n7 14 L\n4 17 U\n2 19 L\n8 13 L\n14 7 U\n", "output": "11\n9\n6\n4\n1\n7\n2\n2\n8\n7\n"}, {"type": "stdin_stdout", "input": "10 10\n5 6 U\n4 7 U\n8 3 L\n8 3 L\n1 10 U\n9 2 U\n10 1 L\n10 1 L\n8 3 U\n8 3 U\n", "output": "6\n7\n3\n0\n10\n2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.\n\nLet's enumerate all the houses from left to right, starting with one...
[{"type": "stdin_stdout", "input": "100\n9 9 72 55 14 8 55 58 35 67 3 18 73 92 41 49 15 60 18 66 9 26 97 47 43 88 71 97 19 34 48 96 79 53 8 24 69 49 12 23 77 12 21 88 66 9 29 13 61 69 54 77 41 13 4 68 37 74 7 6 29 76 55 72 89 4 78 27 29 82 18 83 12 4 32 69 89 85 66 13 92 54 38 5 26 56 17 55 29 4 17 39 29 94 3 67 85 98 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKevin has just recevied his disappointing results on the USA Identification of Cows Olympiad (USAICO) in the form of a binary string of length n. Each character of Kevin's string represents Kevin's score on one of the n q...
[{"type": "stdin_stdout", "input": "93\n010101000101010101010101010101010101010101010101010101010101010101010101010101010101010101010\n", "output": "93\n"}, {"type": "stdin_stdout", "input": "93\n010001000101010101010101010101010101010101010101010101010101010101010101010101010101010101010\n", "output": "91\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVitya is studying in the third grade. During the last math lesson all the pupils wrote on arithmetic quiz. Vitya is a clever boy, so he managed to finish all the tasks pretty fast and Oksana Fillipovna gave him a new one,...
[{"type": "stdin_stdout", "input": "1000000000000000000000001\n", "output": "1000000000000000000000000\n"}, {"type": "stdin_stdout", "input": "2442173122931392213712431\n", "output": "1776586566965695556855660"}, {"type": "stdin_stdout", "input": "9009900990099009900990098\n", "output": "4555455545554454445444544"}, {"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and there can not be two or...
[{"type": "stdin_stdout", "input": "30\nRLLRLRLLRRRLRRRLLLLLLRRRLRRLRL\n128 610 1680 2436 2896 2994 3008 3358 3392 4020 4298 4582 4712 4728 5136 8517 6088 6232 6282 6858 6934 7186 7224 7256 7614 8802 8872 9170 9384 9794\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "30\nRLLRLRLLRRRLRRRLLLLLLRRRLRRLRL\n128 610...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.\n\nMerlin, the wizard predicted to King Arthur that the next month will turn out to b...
[{"type": "stdin_stdout", "input": "113\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n", "output": "YES\n"}, {"type": "stdin_stdout", "inp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSomething happened in Uzhlyandia again... There are riots on the streets... Famous Uzhlyandian superheroes Shean the Sheep and Stas the Giraffe were called in order to save the situation. Upon the arriving, they found tha...
[{"type": "stdin_stdout", "input": "100\n23 64 60 -45 -36 -64 -59 15 -75 69 -30 -7 -20 17 -77 58 93 -76 -121 -34 -31 16 -50 6 -20 -85 1 64 -88 -8 -15 -6 -57 25 91 10 2 -90 74 -66 -42 73 28 49 -85 30 96 79 -25 49 -59 -89 -75 14 -96 -33 -65 -8 -100 -81 17 99 -91 -5 7 -21 1 85 63 86 -26 85 -31 11 -75 35 -82 15 98 93 -55 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAfter a wonderful evening in the restaurant the time to go home came. Leha as a true gentlemen suggested Noora to give her a lift. Certainly the girl agreed with pleasure. Suddenly one problem appeared: Leha cannot find h...
[{"type": "stdin_stdout", "input": "10\n63468235 40219768 326916221 835104676 1952530008\n297013188 212688608 432392437 887776079 1462376999\n153855395 41506149 261808021 778766232 291194343\n238640217 22153210 642972954 719331789 371665652\n528859722 494055455 831993741 924681396 251221747\n19429387 475067059 56744688...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCountry of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process.\n\nThere ar...
[{"type": "stdin_stdout", "input": "10 10 1\n351 0 3 7\n214 0 9 9\n606 0 7 8\n688 0 9 3\n188 3 0 9\n994 0 1 7\n372 5 0 14\n957 0 3 6\n458 8 0 7\n379 0 4 7\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "4 10 1\n988 0 1 1\n507 1 0 9\n798 1 0 9\n400 0 3 7\n242 2 0 8\n574 4 0 7\n458 0 4 9\n330 0 2 9\n303 2 0 8\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nn people are standing in a line to play table tennis. At first, the first two players in the line play a game. Then the loser goes to the end of the line, and the winner plays with the next person from the line, and so on...
[{"type": "stdin_stdout", "input": "100 2\n62 70 35 14 12 87 94 78 39 92 84 91 129 49 82 33 69 37 19 61 42 8 45 97 81 22 54 67 1 22 77 25 65 17 18 28 25 57 16 90 40 13 4 21 68 35 15 76 73 93 56 111 79 47 74 75 30 71 130 99 68 24 29 83 5 6 31 96 38 80 27 46 51 53 2 86 35 9 20 100 26 36 63 7 52 55 23 3 50 59 48 118 167 4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSuppose you have two polynomials <image> and <image>. Then polynomial <image> can be uniquely represented in the following way:\n\n<image>\n\nThis can be done using [long division](https://en.wikipedia.org/wiki/Polynomial...
[{"type": "stdin_stdout", "input": "150\n", "output": "150\n1 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBenny is given two strings S and T. The length of the string S is N and the length of the string T is M respectively. \n\nAlso, imagine that alphabets are cyclic in nature: a-b-c-…-x-y-z-a-b.. and so on. The distance betw...
[{"type": "stdin_stdout", "input": "45 106 401\nhegghdhehhfjhbhhakkkfgbmrfotpflicgg\nfirkfcbishdehfjbhffedhlargbkhffilgaalfeijffxhgchctnkjlglbfifhgckeheikaghjiexhljbffhgjaaleicjlgikgalhfjdtbf", "output": "2\n"}, {"type": "stdin_stdout", "input": "35 106 798\nhegghdhehhfjhbhhakkkfgbmrfotpflicgg\nfirkfcbishdehfjbhffedhla...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs you know, there is a furious battle going on between Marut and Devil. They are fighting with strings. Marut's strings are denoted by M and Devil's strings are denoted by D. Both of them are throwing strings on each oth...
[{"type": "stdin_stdout", "input": "52 11 93 85 70 88 56 8 94 7 94 88 65 29 85 94 61 81 50 29 96 6 58 50 23 29\n10\numhtlftrgugcjjjjnjyzngmiwvgdtvzfnnsrqtqxlxsjlgbwqzpwxunvhnidywabchxteltjqibkkrnwjzxnctnklgkhpgisyydl\nuoggrzdwptkxmslslsamurtzamyvnkiwyioqjkduttnzdfughnrlhkguthyvinqgtgxfgumiilmnerlaypwdycfoghezpsfsogxm\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ.\n\"Find...
[{"type": "stdin_stdout", "input": "30\n441\n55 33 26 69 20 22 70 84 82 74 32 41 12 39 55 87 37 46 89 55 85 52 48 73 27 50 21 76 11 93 49 84 56 59 83 86 36 91 77 84 42 85 9 100 23 1 83 15 24 36 11 49 91 40 87 99 31 49 33 86 11 35 83 69 21 88 69 54 81 4 29 90 36 16 85 59 74 27 92 31 30 93 62 95 50 21 47 41 87 44 21 68 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N points on a number line, i-th of which is placed on coordinate X_i. These points are numbered in the increasing order of coordinates. In other words, for all i (1 \\leq i \\leq N-1), X_i < X_{i+1} holds. In ad...
[{"type": "stdin_stdout", "input": "15 102222527\n3365326 12864090 23146757 36967106 188518495 252521403 263239555 350278176 401243954 418305779 450172439 560311491 625900495 626194585 891960194\n5\n12 14\n1 14\n1 13\n2 12\n5 12", "output": "3\n14\n13\n11\n8\n"}, {"type": "stdin_stdout", "input": "15 102222527\n3365326...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N people (with different names) and K clubs. For each club you know the list of members (so you have K unordered lists). Each person can be a member of many clubs (and also 0 clubs) and two different clubs might...
[{"type": "stdin_stdout", "input": "119107271329329921", "output": "-1\n"}, {"type": "stdin_stdout", "input": "123456789123456789", "output": "-1"}, {"type": "stdin_stdout", "input": "33213408621377322", "output": "-1\n"}, {"type": "stdin_stdout", "input": "26939847318901699", "output": "-1\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi participated in a contest on AtCoder.\n\nThe contest had N problems.\n\nTakahashi made M submissions during the contest.\n\nThe i-th submission was made for the p_i-th problem and received the verdict S_i (`AC` ...
[{"type": "stdin_stdout", "input": "100000 3\n12676 AC\n7777 AC\n7777 CA", "output": "2 0\n"}, {"type": "stdin_stdout", "input": "100000 3\n7777 AC\n7777 AC\n7777 CA", "output": "1 0\n"}, {"type": "stdin_stdout", "input": "100000 3\n6234 AC\n7777 AC\n7777 AC", "output": "2 0\n"}, {"type": "stdin_stdout", "input": "1000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven are integers L and R. Find the number, modulo 10^9 + 7, of pairs of integers (x, y) (L \\leq x \\leq y \\leq R) such that the remainder when y is divided by x is equal to y \\mbox{ XOR } x.\n\nWhat is \\mbox{ XOR }?...
[{"type": "stdin_stdout", "input": "14 1000100100011001000", "output": "790264986\n"}, {"type": "stdin_stdout", "input": "14 1000100110011001000", "output": "238337561\n"}, {"type": "stdin_stdout", "input": "11 1000100110011001000", "output": "238337569\n"}, {"type": "stdin_stdout", "input": "21 1000100110011001000", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively.\nTwo antennas can communicate dir...
[{"type": "stdin_stdout", "input": "15\n18\n52\n35\n36\n18", "output": ":(\n"}, {"type": "stdin_stdout", "input": "1\n-2\n5\n13\n10\n15", "output": "Yay!\n"}, {"type": "stdin_stdout", "input": "15\n18\n52\n35\n36\n16", "output": ":(\n"}, {"type": "stdin_stdout", "input": "15\n18\n26\n35\n36\n18", "output": ":("}, {"typ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNiwango-kun, an employee of Dwango Co., Ltd., likes Niconico TV-chan, so he collected a lot of soft toys of her and spread them on the floor.\n\nNiwango-kun has N black rare soft toys of Niconico TV-chan and they are spre...
[{"type": "stdin_stdout", "input": "17 2\n0 5\n2 3\n1 0\n1 2\n3 1\n3 1\n3 5\n5 1\n5 4\n7 4\n8 4\n6 1\n1 2\n6 1\n8 1\n11 0\n11 0\n11 -1\n7 0", "output": "5\n"}, {"type": "stdin_stdout", "input": "17 3\n0 5\n2 3\n1 0\n1 2\n3 1\n3 1\n3 5\n5 1\n5 4\n7 4\n8 4\n6 1\n1 2\n6 1\n8 1\n11 1\n11 0\n11 -1\n7 1", "output": "6\n"}, {...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N apartments along a number line, numbered 1 through N. Apartment i is located at coordinate X_i. Also, the office of AtCoder Inc. is located at coordinate S. Every employee of AtCoder lives in one of the N apar...
[{"type": "stdin_stdout", "input": "15 409904902\n94198000 15017\n117995501 7656764\n275583856 313263626\n284496300 356635175\n324233841 607\n360631781 148\n472103717 5224\n497641071 34695\n522945827 816241\n554305668 32\n623788284 22832\n667409501 128425253\n876731548 12078\n904557302 291749534\n918215789 5", "output"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given four integers: H, W, h and w (1 ≀ h ≀ H, 1 ≀ w ≀ W). Determine whether there exists a matrix such that all of the following conditions are held, and construct one such matrix if the answer is positive:\n\n* ...
[{"type": "stdin_stdout", "input": "9 18 6 2", "output": "Yes\n1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000\n1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000\n1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.\n\nCreate a program that reads the list of participant numbers and the number of fish caught and outputs the number of win...
[{"type": "stdin_stdout", "input": "6\n1 14\n2 17\n3 131\n4 11\n4 61\n6 66", "output": "3 131\n"}, {"type": "stdin_stdout", "input": "6\n1 14\n2 25\n3 126\n4 11\n4 40\n6 66", "output": "3 126\n"}, {"type": "stdin_stdout", "input": "6\n1 14\n2 17\n3 169\n4 11\n4 61\n6 66", "output": "3 169\n"}, {"type": "stdin_stdout", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of vegetables. The store is very busy, as you can get vegetables that are hard to find in stores at reasonable pri...
[{"type": "stdin_stdout", "input": "4 2\n50 40 100 80\n7 3\n400 139 100 700 200 600 500\n0 0", "output": "150\n2000\n"}, {"type": "stdin_stdout", "input": "4 2\n50 40 100 80\n7 3\n400 300 100 700 116 600 500\n0 0", "output": "150\n2100\n"}, {"type": "stdin_stdout", "input": "4 3\n50 40 100 80\n7 3\n400 290 000 1162 352...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe make a tower by stacking up blocks. The tower consists of several stages and each stage is constructed by connecting blocks horizontally. Each block is of the same weight and is tough enough to withstand the weight equ...
[{"type": "stdin_stdout", "input": "11 16", "output": "11\n"}, {"type": "stdin_stdout", "input": "31 16", "output": "24\n"}, {"type": "stdin_stdout", "input": "27 16", "output": "22\n"}, {"type": "stdin_stdout", "input": "23 60", "output": "23\n"}, {"type": "stdin_stdout", "input": "31 23", "output": "27\n"}, {"type": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a vampire family of N members. Vampires are also known as extreme gourmets. Of course vampires' foods are human blood. However, not all kinds of blood is acceptable for them. Vampires drink blood that K blood typ...
[{"type": "stdin_stdout", "input": "2 3\n5 4 5\n1 2 3\n3 2 1\n3 5\n1 2 3 4 5\n0 1 -1 1 2\n-1 1 1 2 2\n1 0 3 1 1\n0 0", "output": "Yes\nYes\n"}, {"type": "stdin_stdout", "input": "2 3\n5 4 5\n1 2 3\n3 2 1\n3 5\n1 2 3 7 5\n0 1 -1 1 2\n-1 1 1 2 2\n1 0 3 1 1\n0 0", "output": "Yes\nYes\n"}, {"type": "stdin_stdout", "input":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConsider a closed world and a set of features that are defined for all the objects in the world. Each feature can be answered with \"yes\" or \"no\". Using those features, we can identify any object from the rest of the o...
[{"type": "stdin_stdout", "input": "8 1\n11010101\n11 4\n00111001100\n01001101011\n01010000011\n01100110001\n11 16\n01000101111\n01011000000\n01011111001\n01101101001\n01110010111\n01110100111\n10000001010\n10010001000\n10010110100\n10100010100\n10101010110\n10110100010\n11001010011\n11011001001\n11111000111\n111110111...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPrincess'Marriage\n\nMarriage of a princess\n\nEnglish text is not available in this practice contest.\n\nA brave princess in a poor country, knowing that gambling payouts are determined by the parimutuel method, felt mor...
[{"type": "stdin_stdout", "input": "2 8\n7 6\n4 10\n3 2\n5 10\n3 10\n5 10\n0 0", "output": "18\n110\n"}, {"type": "stdin_stdout", "input": "2 8\n7 6\n4 10\n3 3\n5 10\n3 10\n5 10\n0 0", "output": "18\n100\n"}, {"type": "stdin_stdout", "input": "2 8\n5 6\n5 5\n3 3\n4 10\n13 10\n5 10\n0 0", "output": "10\n190\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA linear congruential generator produces a series R(β‹…) of pseudo-random numbers by the following for- mulas:\n\n<image>\n\nwhere S, A, C, and M are all parameters. In this problem, 0 ≀ S, A, C ≀ 15 and M = 256.\n\nNow sup...
[{"type": "stdin_stdout", "input": "5\n0 1 3 11 0\n5\n-1 12 2 0 7\n10\n46 2 28 27 203 31 14 81 122 141\n0", "output": "9 15 10\n6 11 13\n6 13 6\n"}, {"type": "stdin_stdout", "input": "5\n10 4 3 3 1\n5\n7 12 2 0 7\n10\n372 8 42 18 176 40 12 56 169 141\n0", "output": "0 1 1\n6 11 13\n0 15 15\n"}, {"type": "stdin_stdout",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne morning when you woke up, it was in a springy labyrinth.\n\nI don't know why I'm in such a strange place. You have the option of waiting for help here, but you know from experience that if you stay in a labyrinth like...
[{"type": "stdin_stdout", "input": "21 11\n\n*#*.*.*.*.*.*.*.*#*#\n*#...............#*#\n*#.#.#.#.#.#.#.#.#*#\n.#.#.#.#.#.#.#.#.##\n...................#\n.#.#.#.#.#.#.#.#.##\ns#.#.#.#.#.#.#.#.#g#\n...................#\n...................#", "output": "20.000000000000"}, {"type": "stdin_stdout", "input": "21 11\n\n*#*....
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nB: Yamanote-line Game-Yamanote-line Game-\n\nBean (?) Knowledge\n\nThe Yamanote line is convenient. The reason is that you can ride as many laps as time allows just by paying 130 yen. However, if you board with a ticket, ...
[{"type": "stdin_stdout", "input": "1 130\n130 170 100 122 86", "output": "kusoge\n"}, {"type": "stdin_stdout", "input": "1 130\n130 170 110 122 86", "output": "kusoge\n"}, {"type": "stdin_stdout", "input": "10 130\n130 296 100 171 140", "output": "267\n"}, {"type": "stdin_stdout", "input": "10 130\n130 137 101 171 140...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFactorize a given integer n.\n\nConstraints\n\n* 2 ≀ n ≀ 109\n\nInput\n\n\nn\n\n\nAn integer n is given in a line.\n\nOutput\n\nPrint the given integer n and :. Then, print prime factors in ascending order. If n is divisi...
[{"type": "stdin_stdout", "input": "128", "output": "128: 2 2 2 2 2 2 2\n"}, {"type": "stdin_stdout", "input": "216", "output": "216: 2 2 2 3 3 3\n"}, {"type": "stdin_stdout", "input": "64", "output": "64: 2 2 2 2 2 2\n"}, {"type": "stdin_stdout", "input": "112", "output": "112: 2 2 2 2 7\n"}, {"type": "stdin_stdout", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIt can be seen that the number, 125874, and its double, 251748, contain exactly the same digits, but in a different order. \nWAP to check that if 2 such numbers have this property\n\nInput:\nThe first line will consist of...
[{"type": "stdin_stdout", "input": "5\n23\n45\n123\n123\n1234\n123\n1223\n1222\n1223\n1234", "output": "0\n1\n0\n0\n0"}, {"type": "stdin_stdout", "input": "5\n23\n45\n123\n123\n804\n123\n1223\n1222\n1223\n1234", "output": "0\n1\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "5\n26\n49\n180\n110\n1219\n35\n1223\n1222\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis is an interactive problem.\n\nImur Ishakov decided to organize a club for people who love to play the famous game Β«The hatΒ». The club was visited by n students, where n is even. Imur arranged them all in a circle and...
[{"type": "stdin_stdout", "input": "100\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 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 6 5 4 3 2 1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two huge binary integer numbers a and b of lengths n and m respectively. You will repeat the following process: if b > 0, then add to the answer the value a~ \\&~ b and divide b by 2 rounding down (i.e. remo...
[{"type": "stdin_stdout", "input": "5 5\n11111\n11111\n", "output": "57\n"}, {"type": "stdin_stdout", "input": "5 5\n11111\n10111\n", "output": "42\n"}, {"type": "stdin_stdout", "input": "5 5\n11011\n11111\n", "output": "45\n"}, {"type": "stdin_stdout", "input": "5 5\n11001\n11111\n", "output": "37\n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe math faculty of Berland State University has suffered the sudden drop in the math skills of enrolling students. This year the highest grade on the entrance math test was 8. Out of 100! Thus, the decision was made to m...
[{"type": "stdin_stdout", "input": "100\n1 2 1 2 1 2 1 2 1 2 1 3 1 2 1 3 1 2 1 3 1 2 1 3 1 2 1 2 1 3 1 2 1 2 1 3 1 3 1 2 1 2 1 3 1 2 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 2 1 3 1 3 1 3 1 2 1 2 1 2 1 2 1 2 1 2 1 3 1 3 1 2 1 2 1 2 1 3 1 2 1 3 1 2 1 2\n", "output": "Finite\n329\n"}, {"type": "stdin_stdout", "input": "100\n1 2 1 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is the size of the input.\n\nYou are given a string s consisting of n characters, each character is 'R', 'G' or 'B'.\n\nYou are also given an integer k. Your task is to c...
[{"type": "stdin_stdout", "input": "3\n5 2\nBGGGG\n5 3\nRBRGR\n5 5\nBBBRR\n", "output": "1\n0\n3\n"}, {"type": "stdin_stdout", "input": "3\n5 2\nGGBGG\n5 3\nRBRGR\n5 5\nBBBRR\n", "output": "0\n0\n3\n"}, {"type": "stdin_stdout", "input": "3\n5 2\nBGGGG\n5 1\nRBRGR\n5 5\nBBBRR\n", "output": "1\n0\n3\n"}, {"type": "stdin_...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two strings s and t both of length 2 and both consisting only of characters 'a', 'b' and 'c'.\n\nPossible examples of strings s and t: \"ab\", \"ca\", \"bb\".\n\nYou have to find a string res consisting of 3...
[{"type": "stdin_stdout", "input": "24288\naa\nbc\n", "output": "YES\nacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacba...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe had a really tough time generating tests for problem D. In order to prepare strong tests, we had to solve the following problem.\n\nGiven an undirected labeled tree consisting of n vertices, find a set of segments such...
[{"type": "stdin_stdout", "input": "20\n5 10\n18 10\n4 18\n7 4\n4 12\n4 6\n8 7\n19 10\n8 16\n4 11\n16 9\n15 9\n17 12\n13 15\n11 14\n2 16\n17 1\n20 11\n20 3\n", "output": "1 3\n24 32\n38 40\n6 12\n16 18\n9 33\n10 21\n20 23\n25 28\n13 17\n8 36\n4 7\n29 31\n35 37\n27 30\n22 26\n2 5\n11 14\n15 19\n34 39\n"}, {"type": "stdi...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGuy-Manuel and Thomas are going to build a polygon spaceship.\n\nYou're given a strictly convex (i. e. no three points are collinear) polygon P which is defined by coordinates of its vertices. Define P(x,y) as a polygon o...
[{"type": "stdin_stdout", "input": "8\n-440365664 -897818514\n107345267 -994221803\n248590739 -968608613\n473576011 -880752952\n105203574 994450706\n-164464580 1061907476\n-522092561 852888831\n-874210729 485546704\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "8\n-845415846 -897818514\n107345267 -994221803\...
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 4\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 13 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": "862166308\n"}, {"type": "stdin_stdout", "input": "1\n71 2\n100 99 98 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNote that the only difference between String Transformation 1 and String Transformation 2 is in the move Koa does. In this version the letter y Koa selects must be strictly greater alphabetically than x (read statement fo...
[{"type": "stdin_stdout", "input": "10\n20\nabcdefghijklmnopqrst\nbcdefghijklmnopqrsta\n20\nbcdefghijklmnopqrsta\ncdefghijklmnopqrstab\n20\ncdefghijklmnopqrstab\ndefghijklmnopqrstabc\n20\ndefghijklmnopqrstabc\nefghijklmnopqrstabcd\n20\nefghijklmnopqrstabcd\nfghijklmnopqrstabcde\n20\nfghijklmnopqrstabcde\nghijklmnopqrst...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA bitstring is a string consisting only of the characters 0 and 1. A bitstring is called k-balanced if every substring of size k of this bitstring has an equal amount of 0 and 1 characters (k/2 of each).\n\nYou are given ...
[{"type": "stdin_stdout", "input": "9\n6 4\n100110\n3 2\n1?1\n3 2\n1?0\n4 4\n????\n7 4\n1?0??1?\n10 10\n11??11??11\n4 2\n1?1?\n4 4\n?0?0\n6 4\n00????\n", "output": "YES\nYES\nNO\nYES\nYES\nNO\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "9\n6 4\n100110\n3 2\n1?0\n3 2\n10?\n4 4\n????\n7 4\n1?0??1?\n10 10\n11??1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDuring their New Year holidays, Alice and Bob play the following game using an array a of n integers: \n\n * Players take turns, Alice moves first. \n * Each turn a player chooses any element and removes it from the arr...
[{"type": "stdin_stdout", "input": "4\n4\n5 0 6 3\n3\n1 2 1\n4\n2 4 2 2\n2\n14 2\n", "output": "Alice\nAlice\nAlice\nAlice\n"}, {"type": "stdin_stdout", "input": "4\n4\n5 0 6 3\n3\n1 2 1\n4\n2 4 2 2\n2\n14 3\n", "output": "Alice\nAlice\nAlice\nAlice\n"}, {"type": "stdin_stdout", "input": "4\n4\n5 2 10 3\n3\n6 2 0\n4\n2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis is an interactive problem. Remember to flush your output while communicating with the testing program. You may use fflush(stdout) in C++, system.out.flush() in Java, stdout.flush() in Python or flush(output) in Pasca...
[{"type": "stdin_stdout", "input": "12\n2 1\n1 3\n4 1\n5 1\n1 6\n1 7\n1 8\n1 9\n1 10\n1 11\n12 1\n2 3\n4 2\n2 5\n2 6\n7 2\n2 8\n2 9\n10 2\n2 11\n2 12\n4 3\n5 3\n3 6\n7 3\n8 3\n9 3\n10 3\n11 3\n12 3\n4 5\n4 6\n7 4\n4 8\n9 4\n4 10\n4 11\n12 4\n5 6\n5 7\n5 8\n5 14\n5 10\n5 11\n5 12\n7 6\n6 8\n9 6\n10 6\n11 6\n12 6\n7 8\n7...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a of n integers. Count the number of pairs of indices (i, j) such that i < j and a_j - a_i = j - i.\n\nInput\n\nThe first line contains one integer t (1 ≀ t ≀ 10^4). Then t test cases follow.\n\nThe...
[{"type": "stdin_stdout", "input": "1\n190\n2 1 1 1 0 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 0 2 1 0 1 2 1 2 1 1 2 1 1 1 1 1 1 1 0 2 1 1 1 -1 1 1 1 1 2 0 0 1 1 0 1 1 1 3 1 1 1 1 1 1 1 2 1 1 1 1 1 2 1 2 1 1 1 1 2 1 1 1 1 1 1 4 1 0 1 1 1 2 1 0 3 4 5 3 0 8 9 16 11 14 10 14 16 16 17 5 19 20 21 18 4 17 42 5 88 41 29 30 31 32 33 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBy 2312 there were n Large Hadron Colliders in the inhabited part of the universe. Each of them corresponded to a single natural number from 1 to n. However, scientists did not know what activating several colliders simul...
[{"type": "stdin_stdout", "input": "1 100\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two set of points. The first set is determined by the equation A1x + B1y + C1 = 0, and the second one is determined by the equation A2x + B2y + C2 = 0.\n\nWrite the program which finds the number of points i...
[{"type": "stdin_stdout", "input": "100 100 100\n-100 100 -100\n", "output": "1"}, {"type": "stdin_stdout", "input": "12 -32 89\n0 67 -23\n", "output": "1"}, {"type": "stdin_stdout", "input": "-1 1 -1\n-1 1 -1\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "0 -1 -1\n-1 -1 -1\n", "output": "1\n"}, {"type": "st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEmuskald is an avid horticulturist and owns the world's longest greenhouse β€” it is effectively infinite in length.\n\nOver the years Emuskald has cultivated n plants in his greenhouse, of m different plant species numbere...
[{"type": "stdin_stdout", "input": "20 15\n6 8719.787178\n10 13066.663722\n15 58623.690996\n9 184321.819759\n3 227999.294560\n2 279836.330518\n9 282806.308675\n8 311056.507765\n1 312315.562927\n5 459200.373445\n14 563454.265947\n7 647364.984868\n13 679762.0281866578\n4 684192.647497\n1 733119.607626\n7 748637.778398\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarpus has a computer with n processors. Also, his computer has n memory cells. We'll consider the processors numbered by integers from 1 to n and that the memory cells are consecutively numbered by integers from 1 to...
[{"type": "stdin_stdout", "input": "2000 11\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 89 90 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEveryone loves a freebie. Especially students.\n\nIt is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times \"Fly, freebie, fly!\" β€” then flown...
[{"type": "stdin_stdout", "input": "100\n98 63 672 100 254 218 623 415 426 986 920 915 736 795 407 541 382 213 935 743 961 59 660 512 134 935 248 378 739 356 543 714 28 667 602 596 759 791 103 564 225 520 159 542 966 332 983 655 517 273 95 242 593 940 286 236 41 318 941 727 384 225 319 627 982 359 232 769 854 172 643 5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a right triangle with legs of length a and b. Your task is to determine whether it is possible to locate the triangle on the plane in such a way that none of its sides is parallel to the coordinate axes. All the ...
[{"type": "stdin_stdout", "input": "1000 1000\n", "output": "YES\n0 0\n280 960\n-960 280\n"}, {"type": "stdin_stdout", "input": "455 470\n", "output": "YES\n0 0\n273 364\n-376 282\n"}, {"type": "stdin_stdout", "input": "440 330\n", "output": "YES\n0 0\n264 352\n-264 198\n"}, {"type": "stdin_stdout", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAndrew, Fedor and Alex are inventive guys. Now they invent the game with strings for two players.\n\nGiven a group of n non-empty strings. During the game two players build the word together, initially the word is empty. ...
[{"type": "stdin_stdout", "input": "5 12\nabas\ndsfdf\nabacaba\ndartsidius\nkolobok\n", "output": "Second\n"}, {"type": "stdin_stdout", "input": "5 6\nabas\ndsfdf\nabacaba\ndartsidius\nkolobok\n", "output": "Second\n"}, {"type": "stdin_stdout", "input": "3 3\nabasdfabab\nabaaasdfdsf\nasdfaba\n", "output": "Second\n"}, ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMisha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used o...
[{"type": "stdin_stdout", "input": "17\nn5WhQ U5oiFwKxtxzcCV\nVCczxtxKwFio5U r4pcRL1dc71AGVMW1\n1WMVGA17dc1LRcp4r SJl\nSJl D8bPUoIft5v1\nNAvvUgunbPZNCL9ZY2 ztosYKrakLnj\nD8bPUoIft5v1 DnDkHi7\njnLkarKYsotz GfjX209HSQ81gFEBJc\ncJBEFg18QSH901XjfG kBJ0zrH78mveJ\nkBJ0zrH78mveJ 9DrAypYW\nDnDkHi7 3Wkho2PglMDaFQw\n3Wkho2PglMDa...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVanya has a scales for weighing loads and weights of masses w0, w1, w2, ..., w100 grams where w is some integer not less than 2 (exactly one weight of each nominal value). Vanya wonders whether he can weight an item with ...
[{"type": "stdin_stdout", "input": "1000000000 1000000000\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "1100000000 1000000000\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "285681920 285681919\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "401739553 401739553\n", "output": "YES\n"}, ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a polyline going through points (0, 0) – (x, x) – (2x, 0) – (3x, x) – (4x, 0) – ... - (2kx, 0) – (2kx + x, x) – .... \n\nWe know that the polyline passes through the point (a, b). Find minimum positive value x su...
[{"type": "stdin_stdout", "input": "1000000000 1000000000\n", "output": " 1000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 999999999\n", "output": "999999999.5000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 111111111\n", "output": "111111111...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two arrays of integers a and b. For each element of the second array bj you should find the number of elements in array a that are less than or equal to the value bj.\n\nInput\n\nThe first line contains two ...
[{"type": "stdin_stdout", "input": "20 22\n858276994 -568758442 -918490847 -983345984 -172435358 389604931 200224783 486556113 413281867 -258259500 -627945379 -584563643 444685477 -602481243 -370745158 965672503 630955806 -626138773 -997221880 633102929\n-61330638 -977252080 -212144219 385501731 669589742 1879026542 56...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIt was recycling day in Kekoland. To celebrate it Adil and Bera went to Central Perk where they can take bottles from the ground and put them into a recycling bin.\n\nWe can think Central Perk as coordinate plane. There a...
[{"type": "stdin_stdout", "input": "235810013 344493922 0 0 975204641 211157253\n18\n977686151 621301932\n408277582 166435161\n595105725 194278844\n967498841 705149530\n551735395 659209387\n492239556 317614998\n741520864 843275770\n585383143 903832112\n272581169 285871890\n339100580 134101148\n920610054 824829107\n6579...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAnton's favourite geometric figures are regular polyhedrons. Note that there are five kinds of regular polyhedrons: \n\n * Tetrahedron. Tetrahedron has 4 triangular faces. \n * Cube. Cube has 6 square faces. \n * Octah...
[{"type": "stdin_stdout", "input": "28\nOctahedron\nDodecahedron\nOctahedron\nOctahedron\nDodecahedron\nIcosahedron\nIcosahedron\nDodecahedron\nDodecahedron\nDodecahedron\nCube\nDodecahedron\nCube\nTetrahedron\nCube\nCube\nTetrahedron\nDodecahedron\nDodecahedron\nDodecahedron\nIcosahedron\nIcosahedron\nDodecahedron\nIc...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIs it rated?\n\nHere it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.\n\nAnother Codeforces round has been conducted. No two participants have the same nu...
[{"type": "stdin_stdout", "input": "10\n4078 4078\n2876 2876\n1061 1061\n3721 3721\n143 143\n2992 2992\n3279 3279\n3389 3389\n1702 1702\n1110 1110\n", "output": "unrated\n"}, {"type": "stdin_stdout", "input": "10\n4078 4078\n3721 3721\n3389 3389\n3279 3279\n2992 2992\n2876 2876\n1702 1702\n1110 1110\n1061 1061\n143 143...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are two popular keyboard layouts in Berland, they differ only in letters positions. All the other keys are the same. In Berland they use alphabet with 26 letters which coincides with English alphabet.\n\nYou are giv...
[{"type": "stdin_stdout", "input": "buneohqdgxjsafrmwtzickvlpy\nzblwamjxifyuqtnrgdkchpoves\n4RZf8YivG6414X1GdDfcCbc10GA0Wz8514LI9D647XzPb66UNh7lX1rDQv0hQvJ7aqhyh1Z39yABGKn24g185Y85ER5q9UqPFaQ2JeK97wHZ78CMSuU8Zf091mePl2OX61BLe5KdmUWodt4BXPiseOZkZ4SZ27qtBM4hT499mCirjy6nB0ZqjQie4Wr3uhW2mGqBlHyEZbW7A6QnsNX9d3j5aHQN0H6GF8J0...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBill is a famous mathematician in BubbleLand. Thanks to his revolutionary math discoveries he was able to make enough money to build a beautiful house. Unfortunately, for not paying property tax on time, court decided to ...
[{"type": "stdin_stdout", "input": "100\n54 93 37 83 59 66 74 19 6 75 76 81 41 97 22 86 80 13 55 3 32 40 18 96 95 44 33 53 79 88 28 70 63 35 25 38 85 36 58 98 87 12 52 0 16 61 17 72 46 62 31 20 43 34 4 7 60 15 73 1 78 48 69 30 8 14 94 84 91 27 2 64 57 42 71 51 29 89 5 11 26 90 99 77 68 82 24 65 23 21 67 92 47 10 56 49 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants h...
[{"type": "stdin_stdout", "input": "100\n98 52 63 2 18 96 31 58 84 40 41 45 66 100 46 71 26 48 81 20 73 91 68 76 13 93 17 29 64 95 79 21 55 75 19 85 54 51 89 78 15 87 43 59 36 1 90 35 65 56 62 28 86 5 82 49 3 99 33 9 92 32 74 69 27 22 77 16 44 94 34 6 57 70 23 12 61 25 8 11 67 47 83 88 10 14 30 7 97 60 42 37 24 38 53 5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTwo neighbours, Alan and Bob, live in the city, where there are three buildings only: a cinema, a shop and the house, where they live. The rest is a big asphalt square. \n\nOnce they went to the cinema, and the film impre...
[{"type": "stdin_stdout", "input": "43 30\n88 45\n-41 -146\n-26 -46\n", "output": "260.4821034267\n"}, {"type": "stdin_stdout", "input": "43 30\n88 45\n-41 -76\n-26 -46\n", "output": "206.8671818060\n"}, {"type": "stdin_stdout", "input": "83 99\n53 100\n-74 -28\n-29 32\n", "output": "264.5269918847\n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nImp is watching a documentary about cave painting.\n\n<image>\n\nSome numbers, carved in chaotic order, immediately attracted his attention. Imp rapidly proposed a guess that they are the remainders of division of a numbe...
[{"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 1000000000000100000\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "1174471498216289354 375019787446735639\n", "output": "No\n"}, {"type": "stdin_stdout", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nStudents love to celebrate their holidays. Especially if the holiday is the day of the end of exams!\n\nDespite the fact that Igor K., unlike his groupmates, failed to pass a programming test, he decided to invite them to...
[{"type": "stdin_stdout", "input": "50 1000 49\n", "output": "YES\n1 1000.000000 2 20.408163 \n2 979.591837 3 40.816327 \n3 959.183673 4 61.224490 \n4 938.775510 5 81.632653 \n5 918.367347 6 102.040816 \n6 897.959184 7 122.448980 \n7 877.551020 8 142.857143 \n8 857.142857 9 163.265306 \n9 836.734694 10 183.673469 \n10 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou can not just take the file and send it. When Polycarp trying to send a file in the social network \"Codehorses\", he encountered an unexpected problem. If the name of the file contains three or more \"x\" (lowercase L...
[{"type": "stdin_stdout", "input": "100\nxxxxxxxxxxxjtxxxxxxxxcxxxxxxcfxxxxzxxxxxxgxxxxxbxxxxbxxxxxxxxdycxxxxokixxxkizxxgcxxxxxxxxexxxxxfxxxc\n", "output": "49\n"}, {"type": "stdin_stdout", "input": "100\nuxxxxxlmexxxxxxxwnxxexxxxxcxxfydxxxxxxvmdxxxxxxisxxxxxxxxidkxxxpxxxxxxxxmnuxxxxjxxxqcxxwmxxxxxwxxxxx\n", "output": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nView Russian Translation\n\nLimak is a polar bear who often chats online with his friends.\nNowadays, bears often use emoticons to express their feelings.\nWhile most emoticons are short and boring, there is one exception...
[{"type": "stdin_stdout", "input": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis time Alice and Bob have devised a new game of numbers to decide who is the better player among the two. Each time they are given n positive integers and they perform an operation on these integers in each turn. In a ...
[{"type": "stdin_stdout", "input": "10000\n13317 31849 30358 8116 26712 24993 24212 17920 27358 18703 28046 4752 15612 16018 4014 20849 2259 22742 454 2495 16487 27616 2451 25809 14337 18919 836 5553 16338 1638 26678 21711 216 28527 13058 17398 8454 12610 17593 20094 29343 22558 12142 22980 13027 9303 2549 22999 7149 2...
code_stdio