messages listlengths 1 1 | ground_truth stringlengths 88 726k | dataset stringclasses 1
value |
|---|---|---|
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string s consisting of n lowercase Latin letters.\n\nLet's define a substring as a contiguous subsegment of a string. For example, \"acab\" is a substring of \"abacaba\" (it starts in position 3 and ends i... | [{"type": "stdin_stdout", "input": "12\nparapapapaaa\n", "output": "YES\n1 2\n"}, {"type": "stdin_stdout", "input": "12\nparap`papaaa\n", "output": "YES\n1 2\n"}, {"type": "stdin_stdout", "input": "12\nparaq`papaaa\n", "output": "YES\n1 2\n"}, {"type": "stdin_stdout", "input": "12\noaraq`papaaa\n", "output": "YES\n1 2\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are playing a computer card game called Splay the Sire. Currently you are struggling to defeat the final boss of the game.\n\nThe boss battle consists of n turns. During each turn, you will get several cards. Each car... | [{"type": "stdin_stdout", "input": "5\n3\n1 1\n1 1\n1 1\n3\n1 1\n1 1\n1 1\n3\n1 1\n1 1\n1 1\n3\n1 1\n1 1\n1 1\n3\n1 100\n1 1\n1 1\n", "output": "211\n"}, {"type": "stdin_stdout", "input": "5\n3\n1 1\n1 1\n1 1\n3\n1 1\n1 1\n1 1\n3\n1 1\n1 1\n1 1\n3\n1 2\n1 1\n1 1\n3\n1 100\n1 1\n1 1\n", "output": "212\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis problem differs from the previous one only in the absence of the constraint on the equal length of all numbers a_1, a_2, ..., a_n.\n\nA team of SIS students is going to make a trip on a submarine. Their target is an ... | [{"type": "stdin_stdout", "input": "100\n463 6421 2912 1546 3999 5175 4357 2259 7380 6081 1148 7857 3532 4168 5643 8819 2568 6681 975 9216 4590 5217 6215 7422 6631 1651 39 4268 8290 2022 3175 8281 1552 980 9314 234 934 5133 6712 1880 2766 5042 5004 5455 6038 6010 6022 1553 4015 4544 3985 4033 223 7682 6302 2121 4832 39... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice is playing with some stones.\n\nNow there are three numbered heaps of stones. The first of them contains a stones, the second of them contains b stones and the third of them contains c stones.\n\nEach time she can d... | [{"type": "stdin_stdout", "input": "64\n0 0 0\n0 0 1\n0 0 2\n0 0 3\n0 1 0\n0 1 1\n0 1 2\n0 1 3\n0 2 0\n0 2 1\n0 2 2\n0 2 3\n0 3 0\n0 3 1\n0 3 2\n0 3 3\n1 0 0\n1 0 1\n1 0 2\n1 0 3\n1 1 0\n1 1 1\n1 1 2\n1 1 3\n1 2 0\n1 2 1\n1 2 2\n1 2 3\n1 3 0\n1 3 1\n1 3 2\n1 3 3\n2 0 0\n2 0 1\n2 0 2\n2 0 3\n2 1 0\n2 1 1\n2 1 2\n2 1 3\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPiet is one of the most known visual esoteric programming languages. The programs in Piet are constructed from colorful blocks of pixels and interpreted using pretty complicated rules. In this problem we will use a subset... | [{"type": "stdin_stdout", "input": "16 50000000\n33333885555555555199311111111\n33333885555555555199377777774\n33333965555555555166377777774\n99111112222222222166377777774\n55555555555555543423877777774\n55555555555555543423977777774\n55555555555555577777077777774\n55555555555555577777077777774\n55555555555555511111177... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two arrays of integers a_1,β¦,a_n and b_1,β¦,b_m.\n\nYour task is to find a non-empty array c_1,β¦,c_k that is a subsequence of a_1,β¦,a_n, and also a subsequence of b_1,β¦,b_m. If there are multiple answers, fin... | [{"type": "stdin_stdout", "input": "5\n4 5\n10 1 8 4\n1 2 3 4 5\n1 1\n3\n3\n1 1\n3\n1\n5 3\n1000 2 2 2 3\n3 1 5\n5 5\n1 2 3 4 5\n1 4 3 4 15\n", "output": "YES\n1 1\nYES\n1 3\nNO\nYES\n1 3\nYES\n1 1\n"}, {"type": "stdin_stdout", "input": "5\n4 5\n10 1 8 4\n1 2 3 4 5\n1 1\n3\n3\n1 1\n3\n1\n5 3\n1000 2 2 2 3\n3 1 5\n5 5\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nValeric and Valerko missed the last Euro football game, so they decided to watch the game's key moments on the Net. They want to start watching as soon as possible but the connection speed is too low. If they turn on the ... | [{"type": "stdin_stdout", "input": "1000 1 1000\n", "output": "999000\n"}, {"type": "stdin_stdout", "input": "1286 123 1043\n", "output": "9862\n"}, {"type": "stdin_stdout", "input": "1286 187 1043\n", "output": "6130\n"}, {"type": "stdin_stdout", "input": "1705 812 917\n", "output": "1009\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe black king is standing on a chess field consisting of 109 rows and 109 columns. We will consider the rows of the field numbered with integers from 1 to 109 from top to bottom. The columns are similarly numbered with i... | [{"type": "stdin_stdout", "input": "30 14 39 19\n31\n35 8 11\n37 11 12\n32 13 13\n30 5 6\n46 13 13\n37 14 14\n31 13 13\n43 13 19\n45 15 19\n46 13 13\n32 17 32\n41 14 19\n30 14 14\n43 13 17\n34 16 18\n44 11 19\n38 13 13\n40 12 20\n37 17 18\n45 16 18\n34 10 14\n36 9 10\n36 15 19\n33 15 19\n42 13 19\n33 14 15\n35 15 19\n3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nManao works on a sports TV. He's spent much time watching the football games of some country. After a while he began to notice different patterns. For example, each team has two sets of uniforms: home uniform and guest un... | [{"type": "stdin_stdout", "input": "30\n67 21\n85 39\n85 87\n21 39\n66 85\n10 95\n10 21\n87 85\n82 21\n67 21\n95 10\n21 39\n82 21\n21 66\n66 39\n95 30\n67 85\n66 82\n85 82\n21 66\n10 39\n67 10\n21 85\n10 82\n85 95\n10 85\n21 39\n85 39\n39 10\n95 67\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "30\n44 17\n4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n<image>\n\nInput\n\nThe first line of the input is a string (between 1 and 50 characters long, inclusive). Each character will be a letter of English alphabet, lowercase or uppercase.\n\nThe second line of the input is an... | [{"type": "stdin_stdout", "input": "MDJivQRiOIVRcCdkSuUlNbMEOkIVJRMTAnHbkVaOmOblLfignh\n25\n", "output": "MDJIVQRIOIVRCCDKSUULNBMEOKIVJRMTANHBKVAOMOBLLFIGNH"}, {"type": "stdin_stdout", "input": "aaaaAaaaaaaAAaaAaaAaAaaaAaaaaaAAaaAAAAAaaAaAAAAaAA\n6\n", "output": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"}, ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the rush of modern life, people often forget how beautiful the world is. The time to enjoy those around them is so little that some even stand in queues to several rooms at the same time in the clinic, running from one... | [{"type": "stdin_stdout", "input": "20 20\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"}, {"type": "stdin_stdout", "input": "20 20\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1\n", "output": "2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nXenia the beginner mathematician is a third year student at elementary school. She is now learning the addition operation.\n\nThe teacher has written down the sum of multiple numbers. Pupils should calculate the sum. To m... | [{"type": "stdin_stdout", "input": "2+2+1+1+1+3+1+1+3+3+2+3+1+3+1+1+3+1+1+2+2+2+2+1+2+1+2+1+1+1+3+1+3+2+3+2+3+3+1+1+1+2+3+2+1+3+1+3+2+2\n", "output": "1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+2+2+2+2+2+2+2+2+2+2+2+2+2+2+2+3+3+3+3+3+3+3+3+3+3+3+3+3+3\n"}, {"type": "stdin_stdout", "input": "2+3+3+1+2+2+2+1+1+2+1+3+2+2+3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLevko loves array a1, a2, ... , an, consisting of integers, very much. That is why Levko is playing with array a, performing all sorts of operations with it. Each operation Levko performs is of one of two types:\n\n 1. I... | [{"type": "stdin_stdout", "input": "97 29\n2 78 82 356152\n2 14 29 430177\n1 59 84 3680\n1 49 89 -2247\n1 92 96 3701\n2 54 89 377271\n1 62 70 -507\n2 94 97 431563\n1 46 55 -9257\n1 51 83 1627\n1 10 20 6633\n1 17 34 -9263\n2 66 92 383251\n1 12 82 3884\n1 78 96 -5379\n2 13 35 424798\n1 68 91 2939\n2 80 84 214725\n1 61 85... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe bear decided to store some raspberry for the winter. He cunningly found out the price for a barrel of honey in kilos of raspberry for each of the following n days. According to the bear's data, on the i-th (1 β€ i β€ n)... | [{"type": "stdin_stdout", "input": "100 9\n66 71 37 41 23 38 77 11 74 13 51 26 93 56 81 17 12 70 85 37 54 100 14 99 12 83 44 16 99 65 13 48 92 32 69 33 100 57 58 88 25 45 44 85 5 41 82 15 37 18 21 45 3 68 33 9 52 64 8 73 32 41 87 99 26 26 47 24 79 93 9 44 11 34 85 26 14 61 49 38 25 65 49 81 29 82 28 23 2 64 38 13 77 68... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Chris is participating in a graph cutting contest. He's a pro. The time has come to test his skills to the fullest.\n\nChris is given a simple undirected connected graph with n vertices (numbered from 1 to n) and m... | [{"type": "stdin_stdout", "input": "10 30\n10 4\n3 8\n3 2\n10 1\n3 5\n3 4\n5 1\n8 2\n8 4\n3 10\n7 9\n3 6\n9 5\n5 10\n7 6\n7 5\n9 1\n2 7\n9 10\n1 4\n9 11\n6 2\n2 1\n7 1\n6 4\n4 5\n2 9\n10 8\n7 8\n5 2\n", "output": "5 9 11\n9 7 6\n2 7 5\n6 2 9\n8 2 5\n3 8 7\n2 3 5\n4 3 6\n8 4 6\n10 4 5\n3 10 5\n9 10 8\n10 1 5\n9 1 4\n2 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are five people playing a game called \"Generosity\". Each person gives some non-zero number of coins b as an initial bet. After all players make their bets of b coins, the following operation is repeated for severa... | [{"type": "stdin_stdout", "input": "100 100 100 100 100\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "180 100 100 100 100\n", "output": "116\n"}, {"type": "stdin_stdout", "input": "203 100 101 000 101\n", "output": "101\n"}, {"type": "stdin_stdout", "input": "100 000 100 100 100\n", "output": "80\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNew Year is coming, and Jaehyun decided to read many books during 2015, unlike this year. He has n books numbered by integers from 1 to n. The weight of the i-th (1 β€ i β€ n) book is wi.\n\nAs Jaehyun's house is not large ... | [{"type": "stdin_stdout", "input": "50 60\n86 57 45 93 17 12 40 10 47 80 18 80 3 9 6 55 13 99 5 76 4 70 100 55 27 91 71 3 106 93 41 74 80 56 90 50 58 13 71 9 47 52 26 73 72 21 15 81 88 28\n40 32 5 16 49 23 3 17 14 10 1 15 1 21 28 22 13 45 12 25 44 48 46 32 36 43 11 8 49 7 7 35 10 14 39 4 42 10 30 27 1 17 31 15 6 41 44 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn this problem you will meet the simplified model of game King of Thieves.\n\nIn a new ZeptoLab game called \"King of Thieves\" your aim is to reach a chest with gold by controlling your character, avoiding traps and obs... | [{"type": "stdin_stdout", "input": "100\n*****************************)**********************************************************************\n", "output": "yes\n"}, {"type": "stdin_stdout", "input": "100\n*.....................*.....................*.....................*......../............*...........\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence of n integers a1, a2, ..., an. \n\nDetermine a real number x such that the weakness of the sequence a1 - x, a2 - x, ..., an - x is as small as possible.\n\nThe weakness of a sequence is defined as... | [{"type": "stdin_stdout", "input": "20\n-16 -23 29 44 -40 -50 -41 34 -38 30 -12 28 -44 -49 15 50 -28 38 -2 0\n", "output": "113.875000000000043\n"}, {"type": "stdin_stdout", "input": "10\n-405 -230 252 -393 -390 -259 97 163 81 -129\n", "output": "702.333333333333712\n"}, {"type": "stdin_stdout", "input": "10\n-405 -230... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp is working on a new project called \"Polychat\". Following modern tendencies in IT, he decided, that this project should contain chat as well. To achieve this goal, Polycarp has spent several hours in front of hi... | [{"type": "stdin_stdout", "input": "+qlHEc2AuYy\nqlHE02AuYy:YYRwDc edNZgpE nGfOguRWnMYpTpGUVM aXDKGWo1GL1tHv9\n0Upwze6PcQNBcUovrqmIcPsG3hvy:yYuA2cEHlq oaNiKV49p[KatlVAx\nqlHEc2AuYy:zuCO6Opey L eu7lTwysaSk00zjpv zrDfbt8l ufHph\n+pErDMxgVgh\nsiLF1I:yYu@1cEHlq mmQbZtd8Ui7y 2vcax6yZBMhVdRD6Ahlq7MNCw\nqlHEc2AuYy:lz MFUNJ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWet Shark asked Rat Kwesh to generate three positive real numbers x, y and z, from 0.1 to 200.0, inclusive. Wet Krash wants to impress Wet Shark, so all generated numbers will have exactly one digit after the decimal poin... | [{"type": "stdin_stdout", "input": "1.0 200.44854766953543 1.0\n", "output": "y^x^z\n"}, {"type": "stdin_stdout", "input": "0.3 1.3846300094261417 0.6\n", "output": "y^z^x\n"}, {"type": "stdin_stdout", "input": "1.9430536186545981 0.5 0.8\n", "output": "x^z^y\n"}, {"type": "stdin_stdout", "input": "1.0235346849529432 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBearland has n cities, numbered 1 through n. Cities are connected via bidirectional roads. Each road connects two distinct cities. No two roads connect the same pair of cities.\n\nBear Limak was once in a city a and he wa... | [{"type": "stdin_stdout", "input": "1001 1577\n698 459 326 404\n", "output": "698 326 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 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn late autumn evening n robots gathered in the cheerful company of friends. Each robot has a unique identifier β an integer from 1 to 109.\n\nAt some moment, robots decided to play the game \"Snowball\". Below there are ... | [{"type": "stdin_stdout", "input": "4 6\n5 1000000000 1790978867 12\n", "output": "1790978867\n"}, {"type": "stdin_stdout", "input": "4 9\n5 1000000000 1766326397 19\n", "output": "1766326397\n"}, {"type": "stdin_stdout", "input": "4 9\n5 1000000000 1204240164 12\n", "output": "1204240164\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a permutation of the numbers 1, 2, ..., n and m pairs of positions (aj, bj).\n\nAt each step you can choose a pair from the given positions and swap the numbers in that positions. What is the lexicographical... | [{"type": "stdin_stdout", "input": "83 8\n54 3 52 12 61 36 65 62 69 49 47 77 31 15 21 14 73 29 6 26 37 17 81 75 43 30 58 76 16 8 11 5 27 35 7 66 50 67 2 39 45 28 60 71 38 82 53 1 42 13 44 72 22 4 9 25 19 57 10 70 18 68 32 34 20 80 23 79 24 63 64 51 59 41 74 48 40 33 46 83 55 56 78\n48 80\n1 8\n71 54\n15 59\n72 46\n36 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nZS the Coder has drawn an undirected graph of n vertices numbered from 0 to n - 1 and m edges between them. Each edge of the graph is weighted, each weight is a positive integer.\n\nThe next day, ZS the Coder realized tha... | [{"type": "stdin_stdout", "input": "7 9 999999999 0 3\n0 1 0\n1 2 0\n2 3 0\n0 4 1\n4 1 0\n1 5 499999999\n5 2 499999999\n2 6 1\n6 3 1\n", "output": "YES\n0 1 1\n1 2 999999996\n2 3 999999997\n0 4 1\n4 1 1000000000000000000\n1 5 499999999\n5 2 499999999\n2 6 1\n6 3 1\n"}, {"type": "stdin_stdout", "input": "7 9 999999999 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya is currently at a car rental service, and he wants to reach cinema. The film he has bought a ticket for starts in t minutes. There is a straight road of length s from the service to the cinema. Let's introduce a coo... | [{"type": "stdin_stdout", "input": "4 13 400 600\n13 30\n1 19\n1 160\n1 113\n58 73 15 319 194 362 128 157 336 162 77 90 96\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "4 13 400 600\n13 30\n1 19\n1 160\n1 113\n58 73 15 319 209 362 128 157 336 162 77 90 96\n", "output": "1\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProgrammers' kids solve this riddle in 5-10 minutes. How fast can you do it?\n\nInput\n\nThe input contains a single integer n (0 β€ n β€ 2000000000).\n\nOutput\n\nOutput a single integer.\n\nExamples\n\nInput\n\n11\n\n\nOu... | [{"type": "stdin_stdout", "input": "1215860145\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "1778707511\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "2062310696\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "1438557036\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "1805239711\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nArpa is taking a geometry exam. Here is the last problem of the exam.\n\nYou are given three points a, b, c.\n\nFind a point and an angle such that if we rotate the page around the point by the angle, the new position of ... | [{"type": "stdin_stdout", "input": "-947393823 -495674431 211535284 -877153626 -522763219 -778236665\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "-211700879 -495674431 211535284 -877153626 -522763219 -778236665\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-706921242 -758563024 -588592101 -4434... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDisclaimer: there are lots of untranslateable puns in the Russian version of the statement, so there is one more reason for you to learn Russian :)\n\nRick and Morty like to go to the ridge High Cry for crying loudly β th... | [{"type": "stdin_stdout", "input": "228\n1 3 1 7 1 3 1 15 1 3 1 7 1 3 1 31 1 3 1 7 1 3 1 15 1 3 1 7 1 3 1 63 1 3 1 7 1 3 1 15 1 3 1 7 1 3 1 31 1 3 1 7 1 3 1 15 1 3 1 7 1 3 1 127 1 3 1 7 1 3 1 15 1 3 1 7 1 3 1 31 1 3 1 7 1 3 1 15 1 3 1 7 1 3 1 63 1 3 1 7 1 3 1 15 1 3 1 7 1 3 1 31 1 3 1 7 1 3 1 15 1 3 1 7 1 3 1 255 1 3 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an undirected graph consisting of n vertices and <image> edges. Instead of giving you the edges that exist in the graph, we give you m unordered pairs (x, y) such that there is no edge between x and y, and i... | [{"type": "stdin_stdout", "input": "12 58\n1 2\n1 3\n1 4\n1 5\n1 6\n1 7\n1 8\n1 10\n1 11\n1 12\n2 3\n2 4\n2 5\n2 6\n2 7\n2 8\n2 9\n2 10\n2 11\n2 12\n3 4\n3 5\n3 6\n3 7\n3 8\n3 9\n3 10\n3 11\n3 12\n4 5\n4 6\n4 8\n4 11\n4 12\n5 6\n5 7\n5 8\n5 9\n5 10\n5 11\n6 7\n6 8\n6 9\n6 10\n6 11\n6 12\n7 8\n7 9\n7 10\n7 11\n7 12\n8 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTwo-gram is an ordered pair (i.e. string of length two) of capital Latin letters. For example, \"AZ\", \"AA\", \"ZA\" β three distinct two-grams.\n\nYou are given a string s consisting of n capital Latin letters. Your tas... | [{"type": "stdin_stdout", "input": "100\nURXCAIZFIBNJTPCZHBQIBCILLPXZCFGMKKZMNPLCYGAVJVIBMCZEBSJWPSCPQDYCTTKPOKIJRSKIZPDGCHVOUTMPNECYORSFZFNC\n", "output": "IB\n"}, {"type": "stdin_stdout", "input": "100\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n", "output": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAllen and Bessie are playing a simple number game. They both know a function f: \\{0, 1\\}^n β R, i. e. the function takes n binary arguments and returns a real value. At the start of the game, the variables x_1, x_2, ...... | [{"type": "stdin_stdout", "input": "2 2\n0 1 2 3\n2 5\n0 4\n", "output": "1.5000000000\n2.2500000000\n3.2500000000\n"}, {"type": "stdin_stdout", "input": "2 2\n0 2 0 3\n2 0\n0 13\n", "output": "1.25\n1.25\n4.5\n"}, {"type": "stdin_stdout", "input": "2 2\n0 1 2 2\n2 2\n0 2\n", "output": "1.25\n1.25\n1.75\n"}, {"type": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe bloodiest battle of World War II has started. Germany and its allies have attacked the Soviet union army to gain control of the city of Stalingrad (now Volgograd) in the south-western Soviet Union.The war has become i... | [{"type": "stdin_stdout", "input": "36\n1 1 0 13 7 4 8 5\n-1 1 7 12 12 2 7 -1\n12 3 3 5 11 1 1 1\n11 1 2 1 0 11 0 3\n14 -1 4 22 16 5 -1 10\n1 0 10 0 11 10 0 1\n24 0 10 6 5 5 0 0\n13 0 20 5 0 1 7 6\n7 11 16 3 14 10 3 3\n3 6 1 10 4 11 3 1\n2 0 1 8 3 3 12 3\n7 8 0 18 4 -1 1 2\n5 2 4 2 5 5 7 0\n1 0 2 8 1 7 20 4\n2 5 11 1 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProfessor Sharma gives the following problem to his students: given two integers X( β₯ 2) and Y( β₯ 2)\n and tells them to find the smallest positive integral exponent E such that the decimal expansion of X^E begins with Y.... | [{"type": "stdin_stdout", "input": "8\n4 39\n7 12\n7 14\n7 38\n18 24\n14 12\n65 75\n27 26", "output": "Case 1: 94\nCase 2: 38\nCase 3: 57\nCase 4: 106\nCase 5: 25\nCase 6: 28\nCase 7: 6\nCase 8: 52\n"}, {"type": "stdin_stdout", "input": "8\n4 39\n7 12\n7 14\n7 38\n18 24\n14 12\n65 75\n31 26", "output": "Case 1: 94\nCas... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPowerShell had N natural numbers. He wanted to test Xenny's speed in finding the sum and difference of several numbers.\n\nHe decided to ask Xenny several questions. In each question, he gave him two positive integers L a... | [{"type": "stdin_stdout", "input": "78 78\n-645462 -187679 693035 927066 431506 16023 -173045 698159 -334799 -687770 -747462 789670 726416 385513 579977 -156856 22209 378002 930156 353000 67263 -758921 572468 562437 125912 -422101 -513624 43409 25348 -214377 808094 -88292 566843 910587 -731480 -509056 901506 -374951 -1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFind the number of integers between 1 and N (inclusive) that contains exactly K non-zero digits when written in base ten.\n\nConstraints\n\n* 1 \\leq N < 10^{100}\n* 1 \\leq K \\leq 3\n\nInput\n\nInput is given from Stand... | [{"type": "stdin_stdout", "input": "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\n3", "output": "117879300"}, {"type": "stdin_stdout", "input": "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\n2", "output": "40... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi went to an all-you-can-eat buffet with N kinds of dishes and ate all of them (Dish 1, Dish 2, \\ldots, Dish N) once.\n\nThe i-th dish (1 \\leq i \\leq N) he ate was Dish A_i.\n\nWhen he eats Dish i (1 \\leq i \\... | [{"type": "stdin_stdout", "input": "4\n2 3 4 1\n13 10 9 24\n34 9 15", "output": "80\n"}, {"type": "stdin_stdout", "input": "4\n2 3 4 1\n14 10 1 70\n8 6 16", "output": "117\n"}, {"type": "stdin_stdout", "input": "4\n2 3 4 1\n13 5 9 24\n34 15 15", "output": "81\n"}, {"type": "stdin_stdout", "input": "4\n2 3 4 1\n13 5 1 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N integers a_1, a_2, ..., a_N not less than 1. The values of a_1, a_2, ..., a_N are not known, but it is known that a_1 \\times a_2 \\times ... \\times a_N = P.\n\nFind the maximum possible greatest common divis... | [{"type": "stdin_stdout", "input": "1 1431379180228", "output": "1431379180228\n"}, {"type": "stdin_stdout", "input": "1 1472895801034", "output": "1472895801034\n"}, {"type": "stdin_stdout", "input": "1 1365467213485", "output": "1365467213485\n"}, {"type": "stdin_stdout", "input": "1 2203800626104", "output": "220380... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer sequence A of length N and an integer K. You will perform the following operation on this sequence Q times:\n\n* Choose a contiguous subsequence of length K, then remove the smallest element among... | [{"type": "stdin_stdout", "input": "11 7 5\n10227698 1631672198 623690081 433933447 476190629 262703497 147009374 971407775 628894325 210342416 520756664", "output": "423705749\n"}, {"type": "stdin_stdout", "input": "11 7 5\n10227698 1631672198 623690081 802524328 476190629 262703497 147009374 971407775 628894325 21034... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJoisino is planning to open a shop in a shopping street.\n\nEach of the five weekdays is divided into two periods, the morning and the evening. For each of those ten periods, a shop must be either open during the whole pe... | [{"type": "stdin_stdout", "input": "3\n1 1 1 1 1 1 0 0 1 1\n0 1 0 1 1 0 1 0 1 0\n1 0 1 1 0 0 0 1 0 1\n-8 6 -2 -11 -12 4 14 9 -6 2 2\n-9 2 0 1 7 -5 0 -2 -6 5 5\n6 -6 9 -9 12 -5 8 0 -9 -7 -7", "output": "33\n"}, {"type": "stdin_stdout", "input": "3\n1 1 1 1 1 1 0 0 0 0\n0 1 0 1 1 1 1 0 1 0\n1 0 1 1 0 1 0 1 0 1\n-8 6 -2 -... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMole decided to live in an abandoned mine. The structure of the mine is represented by a simple connected undirected graph which consists of N vertices numbered 1 through N and M edges. The i-th edge connects Vertices a_i... | [{"type": "stdin_stdout", "input": "15 22\n2 13 33418\n14 15 55849\n7 10 15207\n4 6 64328\n6 9 148835\n15 8 46978\n8 6 53526\n1 2 10537\n14 12 57469\n8 3 61543\n6 5 32425\n4 11 20932\n3 12 38234\n8 2 45333\n11 12 77796\n3 9 71922\n12 15 25507\n2 4 25485\n11 6 1259\n2 7 33363\n5 11 97843\n3 1 40491", "output": "137638"}... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke has decided to play a game, where the player runs a railway company. There are M+1 stations on Snuke Line, numbered 0 through M. A train on Snuke Line stops at station 0 and every d-th station thereafter, where d is... | [{"type": "stdin_stdout", "input": "2 22\n1 9\n5 9\n4 5\n4 9\n0 1\n0 12\n2 4", "output": "2\n2\n2\n2\n2\n2\n2\n2\n2\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "2 18\n1 9\n5 9\n4 5\n4 9\n0 1\n0 12\n2 4", "output": "2\n2\n2\n2\n2\n2\n2\n2\n2\n0\n0\n0\n0\n0\n0\n0\n0\n0\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a string X, which has an even number of characters. Half the characters are `S`, and the other half are `T`.\n\nTakahashi, who hates the string `ST`, will perform the following operation 10^{10000} times:\n\n* Amo... | [{"type": "stdin_stdout", "input": "SSTTTSST", "output": "2\n"}, {"type": "stdin_stdout", "input": "TTTTSSSS", "output": "8\n"}, {"type": "stdin_stdout", "input": "TSSTTSST", "output": "2\n"}, {"type": "stdin_stdout", "input": "TTSTSSST", "output": "4\n"}, {"type": "stdin_stdout", "input": "SSTTSTST", "output": "0\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a 120 minute videotape with standard recording. When I set the VCR counter to 00:00:00 with the tape completely rewound and recorded in standard recording mode, I got a certain counter value. Enter this counter v... | [{"type": "stdin_stdout", "input": "1 36 0\n-1 -1 -1", "output": "00:24:00\n01:12:00\n"}, {"type": "stdin_stdout", "input": "0 30 0\n-1 -1 -1", "output": "01:30:00\n04:30:00\n"}, {"type": "stdin_stdout", "input": "0 32 0\n-1 -1 -1", "output": "01:28:00\n04:24:00\n"}, {"type": "stdin_stdout", "input": "1 16 0\n-1 -1 -1"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou want to go on a trip with a friend. However, friends who have a habit of spending money cannot easily save travel expenses. I don't know when my friends will go on a trip if they continue their current lives. So, if y... | [{"type": "stdin_stdout", "input": "10000\n1225 3150\n861 12737\n0 -1\n5000 1050\n5000 4211\n5000 412\n5000 5000\n5000 5000\n-1 -1\n5075 1951\n9143 2494\n5000 2100\n29170\n100000 000000\n100010 110000\n100000 100000\n100000 100000\n100100 100100\n100000 111000\n100000 100000\n101000 100000\n100000 100010\n100000 100000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA trick of fate caused Hatsumi and Taku to come to know each other. To keep the encounter in memory, they decided to calculate the difference between their ages. But the difference in ages varies depending on the day it i... | [{"type": "stdin_stdout", "input": "1505 13 9\n2619 11 3", "output": "1114\n"}, {"type": "stdin_stdout", "input": "2137 -1 28\n1419 -2 1", "output": "719\n"}, {"type": "stdin_stdout", "input": "2137 -1 28\n1818 -1 1", "output": "320\n"}, {"type": "stdin_stdout", "input": "2137 -1 28\n3039 -1 1", "output": "902\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA new type of mobile robot has been developed for environmental earth observation. It moves around on the ground, acquiring and recording various sorts of observational data using high precision sensors. Robots of this ty... | [{"type": "stdin_stdout", "input": "3 5 10\nred\n0 0 0\n5 0 0\ngreen\n0 5 6\n5 6 1\nblue\n0 40 5\n5 0 0\n3 10 5\nbtom\n0 47 32\n5 -10 -7\n10 1 0\npluto\n0 0 0\n7 0 0\n10 3 3\ngesicht\n0 25 7\n5 -7 -2\n10 -1 10\n4 100 7\nimpulse\n0 -500 0\n100 10 1\nfreedom\n0 -491 0\n100 9 2\ndestiny\n0 -472 0\n100 5 4\nstrike\n0 -482 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTwo coordinates (a1, a2) and (b1, b2) on a two-dimensional grid of r Γ c are given. The cost of moving from a cell (e, f) to one of the cells (e + 1, f), (e-1, f), (e, f + 1), (e, f-1) is 1. And. You can also move between... | [{"type": "stdin_stdout", "input": "1226 500 1 0 107 129", "output": "14190866\n"}, {"type": "stdin_stdout", "input": "912 500 2 -1 107 239", "output": "98025026\n"}, {"type": "stdin_stdout", "input": "500 500 -1 0 107 239", "output": "68765037\n"}, {"type": "stdin_stdout", "input": "1174 500 0 0 107 298", "output": "7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKM country has N kinds of coins and each coin has its value a_i.\n\nThe king of the country, Kita_masa, thought that the current currency system is poor, and he decided to make it beautiful by changing the values of some ... | [{"type": "stdin_stdout", "input": "3\n6 11 24", "output": "0.090909090909"}, {"type": "stdin_stdout", "input": "3\n6 11 30", "output": "0.166666666667"}, {"type": "stdin_stdout", "input": "3\n6 11 12", "output": "0.090909090909"}, {"type": "stdin_stdout", "input": "3\n119 10 26", "output": "0.848739496\n"}, {"type": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor a given polygon g, print \"1\" if g is a convex polygon, \"0\" otherwise. Here, in a convex polygon, all interior angles are less than or equal to 180 degrees.\n\ng is represented by a sequence of points p1, p2,..., p... | [{"type": "stdin_stdout", "input": "4\n-1 1\n25 -3\n1 0\n-1 -1", "output": "0\n"}, {"type": "stdin_stdout", "input": "4\n-1 1\n25 -3\n1 -1\n-1 0", "output": "0\n"}, {"type": "stdin_stdout", "input": "4\n-1 1\n25 -3\n1 -1\n-1 1", "output": "0\n"}, {"type": "stdin_stdout", "input": "4\n-1 2\n25 -3\n1 -1\n-1 1", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads a sequence of integers $A = \\\\{a_0, a_1, ..., a_{n-1}\\\\}$ and swap specified elements by a list of the following operation:\n\n* swapRange($b, e, t$): For each integer $k$ ($0 \\leq k < (e ... | [{"type": "stdin_stdout", "input": "11\n-2 0 10 -1 4 6 -1 2 14 10 21\n0\n-1 -1 0", "output": "-2 0 10 -1 4 6 -1 2 14 10 21\n"}, {"type": "stdin_stdout", "input": "11\n-2 0 16 -1 4 6 -1 2 14 10 21\n0\n-1 -4 0", "output": "-2 0 16 -1 4 6 -1 2 14 10 21\n"}, {"type": "stdin_stdout", "input": "11\n-1 0 10 -1 4 6 0 2 14 10 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInnopolis University scientists continue to investigate the periodic table. There are nΒ·m known elements and they form a periodic table: a rectangle with n rows and m columns. Each element can be described by its coordina... | [{"type": "stdin_stdout", "input": "20 20 80\n5 3\n13 13\n8 5\n2 9\n12 16\n1 11\n15 11\n3 20\n10 7\n5 4\n11 2\n5 20\n14 8\n5 1\n8 13\n11 5\n19 2\n15 12\n12 7\n16 5\n17 3\n12 2\n17 16\n12 3\n12 6\n18 20\n2 20\n9 1\n5 10\n9 18\n17 1\n17 10\n20 1\n12 12\n19 14\n7 8\n2 19\n6 14\n5 6\n15 2\n18 14\n5 7\n14 14\n17 2\n20 20\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a of n integers and an integer s. It is guaranteed that n is odd.\n\nIn one operation you can either increase or decrease any single element by one. Calculate the minimum number of operations requir... | [{"type": "stdin_stdout", "input": "7 33\n21 15 12 11 20 19 12\n", "output": "57\n"}, {"type": "stdin_stdout", "input": "7 20\n21 15 12 11 20 19 12\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "7 20\n2 15 12 11 20 19 12\n", "output": "14\n"}, {"type": "stdin_stdout", "input": "7 20\n1 15 12 11 29 20 12\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEach item in the game has a level. The higher the level is, the higher basic parameters the item has. We shall consider only the following basic parameters: attack (atk), defense (def) and resistance to different types of... | [{"type": "stdin_stdout", "input": "5\nhs orb 830 875 879 3\nfudflb weapon 13 854 317 1\nwwvhixixe armor 500 285 382 2\nh orb 58 57 409 2\ny weapon 734 408 297 4\n12\nwvxwgjoera physician 55 hs\nusukedr sentry 41 hs\niu physician 100 hs\ngixlx gladiator 42 fudflb\nrd sentry 95 wwvhixixe\nbaff sentry 6 wwvhixixe\nwkhxou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nChouti was tired of the tedious homework, so he opened up an old programming problem he created years ago.\n\nYou are given a connected undirected graph with n vertices and m weighted edges. There are k special vertices: ... | [{"type": "stdin_stdout", "input": "4 4 2\n3 1\n1 2 1000000000\n2 3 1000000000\n3 1 1000000000\n3 4 1\n", "output": "1000000000 1000000000\n"}, {"type": "stdin_stdout", "input": "4 4 2\n3 1\n1 2 1000000000\n2 3 1000000001\n3 1 1000000000\n3 4 1\n", "output": "1000000000 1000000000\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDuring the archaeological research in the Middle East you found the traces of three ancient religions: First religion, Second religion and Third religion. You compiled the information on the evolution of each of these bel... | [{"type": "stdin_stdout", "input": "2 12\naa\n+ 1 a\n+ 2 a\n+ 3 a\n- 1\n+ 1 a\n- 2\n+ 2 a\n- 3\n+ 3 a\n+ 2 a\n- 1\n- 3\n", "output": "YES\nYES\nNO\nYES\nNO\nYES\nNO\nYES\nNO\nNO\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "2 11\naa\n+ 1 a\n+ 2 a\n+ 3 a\n- 1\n+ 1 a\n- 2\n+ 2 a\n- 3\n+ 1 a\n+ 2 a\n- 1\n- 3\n", "outpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCengiz recently learned Fibonacci numbers and now he is studying different algorithms to find them. After getting bored of reading them, he came with his own new type of numbers that he named XORinacci numbers. He defined... | [{"type": "stdin_stdout", "input": "10\n669924290 408119795 804030560\n663737793 250734602 29671646\n431160679 146708815 289491233\n189259304 606497663 379372476\n707829111 49504411 81710658\n54555019 65618101 626948607\n578351356 288589794 974275296\n400531973 205638174 323247740\n219131617 178762989 799964854\n825160... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour math teacher gave you the following problem:\n\nThere are n segments on the x-axis, [l_1; r_1], [l_2; r_2], β¦, [l_n; r_n]. The segment [l; r] includes the bounds, i.e. it is a set of such x that l β€ x β€ r. The length... | [{"type": "stdin_stdout", "input": "1\n10\n132182352 630066892\n906984407 923129673\n100213482 882571434\n191064823 398771294\n243750814 1483105037\n322757488 608184251\n241900265 682732740\n197067927 815099563\n17475338 866870249\n271628366 729808874\n", "output": "508213113\n"}, {"type": "stdin_stdout", "input": "1\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou're given an array a_1, β¦, a_n of n non-negative integers.\n\nLet's call it sharpened if and only if there exists an integer 1 β€ k β€ n such that a_1 < a_2 < β¦ < a_k and a_k > a_{k+1} > β¦ > a_n. In particular, any stric... | [{"type": "stdin_stdout", "input": "10\n1\n248618\n3\n23 21 11\n6\n110 11 15 10 1 14\n4\n0 2 1 0\n2\n0 0\n2\n0 1\n2\n1 0\n2\n1 0\n3\n0 1 0\n3\n1 0 1\n", "output": "YES\nYES\nYES\nYES\nNO\nYES\nYES\nYES\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "10\n1\n248618\n3\n23 21 11\n6\n110 11 15 0 1 14\n4\n0 2 1 0\n2\n0 0\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou want to perform the combo on your opponent in one popular fighting game. The combo is the string s consisting of n lowercase Latin letters. To perform the combo, you have to press all buttons in the order they appear ... | [{"type": "stdin_stdout", "input": "3\n4 2\nabca\n1 3\n10 5\ncodeforces\n2 8 3 2 9\n26 10\nqwertyuioplkjhgfdsazxcvbnm\n20 10 1 2 3 5 10 5 9 4\n", "output": "4 2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 \n\n0 0 9 4 5 3 0 0 0 0 0 0 0 0 9 0 0 3 1 0 0 0 0 0 0 0 \n\n2 1 1 2 9 2 2 2 5 2 2 2 1 1 5 4 11 8 2 7 5 1 10 1 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp has recently created a new level in this cool new game Berlio Maker 85 and uploaded it online. Now players from all over the world can try his level.\n\nAll levels in this game have two stats to them: the number ... | [{"type": "stdin_stdout", "input": "1\n99\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe statement of this problem is the same as the statement of problem C1. The only difference is that, in problem C1, n is always even, and in C2, n is always odd.\n\nYou are given a regular polygon with 2 β
n vertices (i... | [{"type": "stdin_stdout", "input": "99\n3\n5\n7\n9\n11\n13\n15\n17\n19\n21\n23\n25\n27\n29\n31\n33\n35\n37\n39\n41\n43\n45\n47\n49\n51\n53\n55\n57\n59\n105\n63\n65\n67\n69\n71\n73\n75\n77\n79\n81\n83\n85\n87\n141\n91\n93\n95\n97\n57\n101\n103\n105\n107\n109\n111\n113\n115\n117\n119\n121\n123\n125\n127\n129\n131\n133\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer n. In one move, you can either multiply n by two or divide n by 6 (if it is divisible by 6 without the remainder).\n\nYour task is to find the minimum number of moves needed to obtain 1 from n or ... | [{"type": "stdin_stdout", "input": "7\n2\n2\n2\n12\n45568\n15116544\n387420489\n", "output": "-1\n-1\n-1\n-1\n-1\n12\n36\n"}, {"type": "stdin_stdout", "input": "7\n2\n2\n2\n17\n45568\n15116544\n387420489\n", "output": "-1\n-1\n-1\n-1\n-1\n12\n36\n"}, {"type": "stdin_stdout", "input": "7\n5\n2\n4\n17\n60902\n15116544\n3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a of n integers.\n\nYou want to make all elements of a equal to zero by doing the following operation exactly three times:\n\n * Select a segment, for each number in this segment we can add a multi... | [{"type": "stdin_stdout", "input": "32\n474784688 1134668429 -592758087 -662585781 997003198 333008394 111507813 985930436 -352098852 400811080 770280786 168025633 -258151427 726678951 914413742 -544810046 496546254 -749255284 -332401894 346164819 -207260314 68209011 940966817 -284672239 -655684691 845249877 -632338846... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOri and Sein have overcome many difficult challenges. They finally lit the Shrouded Lantern and found Gumon Seal, the key to the Forlorn Ruins. When they tried to open the door to the ruins... nothing happened.\n\nOri was... | [{"type": "stdin_stdout", "input": "20 7\n18525 35038\n15816 31586\n18641 46864\n35863 38632\n13563 35915\n41614 98684\n13573 35863\n25851 35985\n41687 55831\n31583 80871\n18525 35038\n15816 31586\n18641 46864\n35863 38632\n13563 35915\n41614 98684\n13573 35863\n25851 35985\n41687 55831\n31583 80871\n", "output": "4112... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter his wife's tragic death, Eurydice, Orpheus descended to the realm of death to see her. Reaching its gates was uneasy, but passing through them proved to be even more challenging. Mostly because of Cerberus, the thre... | [{"type": "stdin_stdout", "input": "7\nbabba\nabaac\ncodeforces\nzeroorez\nabcdcba\nbbbbbbb\na\n", "output": "\n1\n1\n0\n1\n1\n4\n0\n"}, {"type": "stdin_stdout", "input": "7\nabbab\nabaac\ncodeforces\nzeroorez\nabcdcba\nbbbbbbb\na\n", "output": "1\n1\n0\n1\n1\n4\n0\n"}, {"type": "stdin_stdout", "input": "7\nabbab\nabaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA permutation β is a sequence of length n integers from 1 to n, in which all the numbers occur exactly once. For example, [1], [3, 5, 2, 1, 4], [1, 3, 2] β permutations, and [2, 3, 2], [4, 3, 1], [0] β no.\n\nPolycarp was... | [{"type": "stdin_stdout", "input": "3\n5\n3 5 2 1 4\n1\n1\n4\n4 3 1 2\n", "output": "\n1 0 2 3 1 \n0 \n0 1 3 2 \n"}, {"type": "stdin_stdout", "input": "3\n5\n3 5 1 2 4\n1\n1\n4\n4 3 1 2\n", "output": "1 0 3 2 1\n0\n0 1 3 2\n"}, {"type": "stdin_stdout", "input": "3\n5\n4 5 2 1 3\n1\n1\n4\n4 3 1 2\n", "output": "1 0 2 3 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn some country live wizards. They love playing with numbers. \n\nThe blackboard has two numbers written on it β a and b. The order of the numbers is not important. Let's consider a β€ b for the sake of definiteness. The p... | [{"type": "stdin_stdout", "input": "66\n7 0\n5 7\n1 3\n3 2\n3 5\n0 6\n1 2\n0 7\n4 5\n4 7\n5 1\n2 0\n4 0\n0 5\n3 6\n7 2\n6 0\n5 3\n6 6\n1 7\n5 6\n2 2\n3 4\n2 0\n5 3\n4 6\n6 1\n5 3\n100000000000 0000000000000000000\n0 1\n4 1\n2 6\n5 5\n4 5\n0 3\n3 7\n3 1\n1 0\n4 4\n1000000000000000000 100000000000\n12 6\n4 2\n7 5\n1 6\n6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFlatland is inhabited by pixels of three colors: red, green and blue. We know that if two pixels of different colors meet in a violent fight, only one of them survives the fight (that is, the total number of pixels decrea... | [{"type": "stdin_stdout", "input": "2147483630 2147483642 2147483610\n", "output": " 2147483630\n"}, {"type": "stdin_stdout", "input": "1944219055 454183506 1369298327\n", "output": " 1944219055\n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSome days ago, I learned the concept of LCM (least common multiple). I've played with it for several times and I want to make a big number with it.\n\nBut I also don't want to use many numbers, so I'll choose three positi... | [{"type": "stdin_stdout", "input": "1559681\n", "output": "3794080223197672320\n"}, {"type": "stdin_stdout", "input": "1362308\n", "output": "2528276952771261580\n"}, {"type": "stdin_stdout", "input": "1165938\n", "output": "1584981275574379920\n"}, {"type": "stdin_stdout", "input": "1001000\n", "output": "100299899299... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBerland Government decided to improve relations with neighboring countries. First of all, it was decided to build new roads so that from each city of Berland and neighboring countries it became possible to reach all the o... | [{"type": "stdin_stdout", "input": "60\n17 34\n46 22\n50 44\n46 33\n41 21\n31 33\n48 6\n38 19\n35 60\n2 24\n49 29\n7 53\n34 1\n19 55\n32 1\n22 42\n27 28\n4 53\n6 50\n21 34\n1 10\n12 36\n54 8\n16 13\n51 43\n45 51\n54 20\n13 31\n34 33\n49 33\n51 11\n59 34\n15 5\n59 28\n30 39\n13 30\n58 4\n34 14\n3 9\n19 34\n4 18\n26 48\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarpus is sure that his life fits the description: \"first there is a white stripe, then a black one, then a white one again\". So, Polycarpus is sure that this rule is going to fulfill during the next n days. Polycar... | [{"type": "stdin_stdout", "input": "4000 2000 2219\n", "output": " 865711019"}, {"type": "stdin_stdout", "input": "4000 1244 4000\n", "output": " 344837886"}, {"type": "stdin_stdout", "input": "4000 1244 2881\n",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPavel loves grid mazes. A grid maze is an n Γ m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side.\n\nPavel drew a grid m... | [{"type": "stdin_stdout", "input": "19 20 196\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\nYou all know the Dirichlet principle, the point of which is that if n boxes have no less than n + 1 items, that leads to the existence of a box in which there are at least two items.\n\nHaving heard of that principle, but... | [{"type": "stdin_stdout", "input": "10000 1 1000000000\n", "output": "Masha\n\n"}, {"type": "stdin_stdout", "input": "1010 1 1000000000\n", "output": "Masha\n\n"}, {"type": "stdin_stdout", "input": "2635 2 1000000000\n", "output": "Masha\n\n"}, {"type": "stdin_stdout", "input": "1 30 1000000000\n", "output": "Missing\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJzzhu have n non-negative integers a1, a2, ..., an. We will call a sequence of indexes i1, i2, ..., ik (1 β€ i1 < i2 < ... < ik β€ n) a group of size k. \n\nJzzhu wonders, how many groups exists such that ai1 & ai2 & ... & ... | [{"type": "stdin_stdout", "input": "55\n0 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 2 3 4 5 6 7 8 9 3 4 5 6 7 8 9 4 5 6 7 8 9 5 6 7 8 9 6 7 8 9 7 8 9 8 9 9\n", "output": "621247139\n"}, {"type": "stdin_stdout", "input": "55\n0 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 2 3 4 10 6 7 8 9 3 4 5 6 7 8 9 4 5 6 7 8 9 5 6 7 8 9 6 7 8 9 7 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter bracket sequences Arthur took up number theory. He has got a new favorite sequence of length n (a1, a2, ..., an), consisting of integers and integer k, not exceeding n.\n\nThis sequence had the following property: i... | [{"type": "stdin_stdout", "input": "39 3\n-5 1 -13 ? 2 -12 ? 3 -11 -2 4 -10 ? 5 -9 0 6 -8 ? 7 -7 ? 8 -6 5 9 -5 ? 10 -4 ? 11 -3 ? 12 -2 10 13 -1\n", "output": "-5 1 -13 -4 2 -12 -3 3 -11 -2 4 -10 -1 5 -9 0 6 -8 1 7 -7 2 8 -6 5 9 -5 6 10 -4 7 11 -3 8 12 -2 10 13 -1\n"}, {"type": "stdin_stdout", "input": "39 3\n-5 1 -13 ?... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou've got array A, consisting of n integers and a positive integer k. Array A is indexed by integers from 1 to n.\n\nYou need to permute the array elements so that value \n\n<image> became minimal possible. In particular... | [{"type": "stdin_stdout", "input": "40 4\n600000080 -199999981 -599999907 -199999935 -199999904 -599999919 200000022 600000032 600000046 -999999980 -199999917 600000027 200000075 -999999949 -599999911 -999999969 600000017 -199999999 -999999923 -599999924 600000091 -599999973 -599999936 600000011 -199999951 600000030 -1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPeter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it w... | [{"type": "stdin_stdout", "input": "29 -999961 689169\n-999960 689169\n-999927 -938525\n-999735 -989464\n-993714 -997911\n-870186 -999686\n-796253 -999950\n-139940 -1023635\n969552 -999972\n985446 -999398\n992690 -997295\n999706 -973137\n999898 -848630\n999997 -192297\n999969 773408\n999495 960350\n1685305 981671\n9983... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently, Pari and Arya did some research about NP-Hard problems and they found the minimum vertex cover problem very interesting.\n\nSuppose the graph G is given. Subset A of its vertices is called a vertex cover of this... | [{"type": "stdin_stdout", "input": "1000 1\n839 771\n", "output": "999\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 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... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp starts his own business. Tomorrow will be the first working day of his car repair shop. For now the car repair shop is very small and only one car can be repaired at a given time.\n\nPolycarp is good at marketing... | [{"type": "stdin_stdout", "input": "30\n522692116 159\n589719489 488\n662495181 961\n915956552 470\n683572975 271\n498400137 480\n327010963 181\n200704287 367\n961198611 54\n978100746 208\n345455616 986\n106372142 876\n446972337 42\n309349333 200\n93462198 543\n167946793 318\n325598940 427\n121873339 459\n174934933 598... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIlya is an experienced player in tic-tac-toe on the 4 Γ 4 field. He always starts and plays with Xs. He played a lot of games today with his friend Arseny. The friends became tired and didn't finish the last game. It was ... | [{"type": "stdin_stdout", "input": "xx..\n.oo.\nx...\noox.\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "x..x\n..oo\no...\nx.xo\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "xoox\n.xx.\no..o\n..xo\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "o.xx\nxo.o\n...o\n..x.\n", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nStepan likes to repeat vowel letters when he writes words. For example, instead of the word \"pobeda\" he can write \"pobeeeedaaaaa\".\n\nSergey does not like such behavior, so he wants to write a program to format the wo... | [{"type": "stdin_stdout", "input": "200\nmmffggzvuuzzlkafduueqocuybiiaaeeoiioouaaurccuqoouuooooooyjjtyyxxiipnoeufyuuoyxxhhkaaeoooxapauuoppzabuuoiiuuggcciissuugejjiirruummsiifaauyypauwoofiemzaeeeeeeiioozzttyyidaaaiggizzerkooooeeepueeauupathhb\n", "output": "mmffggzvuzzlkafdueqocuybiaeeoioouaurccuqoouoyjjtyxxipnoeufyuoyx... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMister B once received a gift: it was a book about aliens, which he started read immediately. This book had c pages.\n\nAt first day Mister B read v0 pages, but after that he started to speed up. Every day, starting from ... | [{"type": "stdin_stdout", "input": "1000 500 500 1000 499\n", "output": "501\n"}, {"type": "stdin_stdout", "input": "1000 999 1000 1000 998\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "1000 500 500 1000 475\n", "output": "21\n"}, {"type": "stdin_stdout", "input": "1000 999 1000 1000 948\n", "output": "2\n"}... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlex, Bob and Carl will soon participate in a team chess tournament. Since they are all in the same team, they have decided to practise really hard before the tournament. But it's a bit difficult for them because chess is... | [{"type": "stdin_stdout", "input": "100\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya and Vasya arranged a game. The game runs by the following rules. Players have a directed graph consisting of n vertices and m edges. One of the vertices contains a chip. Initially the chip is located at vertex s. Pl... | [{"type": "stdin_stdout", "input": "92 69\n1 76\n1 14\n1 9\n0\n1 46\n1 80\n0\n0\n1 77\n0\n1 53\n1 81\n1 61\n1 40\n0\n1 20\n1 71\n1 24\n1 54\n1 82\n1 23\n0\n1 63\n1 25\n1 38\n1 68\n0\n1 65\n0\n1 76\n1 55\n1 87\n1 1\n1 37\n1 68\n1 30\n1 17\n1 19\n0\n1 16\n1 69\n0\n1 60\n1 86\n0\n1 44\n1 32\n1 10\n1 8\n0\n0\n0\n0\n0\n1 2\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRoy is looking for Wobbly Numbers. \n\nAn N-length wobbly number is of the form \"ababababab...\" and so on of length N, where a != b. \n\nA 3-length wobbly number would be of form \"aba\". \nEg: 101, 121, 131, 252, 64... | [{"type": "stdin_stdout", "input": "6\n11 1\n3 1\n5 100\n10 3\n12 5\n8 2\n\nSAMPLE", "output": "10101010101\n101\n-1\n1313131313\n151515151515\n12121212\n"}, {"type": "stdin_stdout", "input": "6\n20 2\n4 1\n5 100\n12 3\n4 5\n5 2\n\nSAMPLE", "output": "12121212121212121212\n1010\n-1\n131313131313\n1515\n12121\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn code world all genders are considered equal ( It means their is nothing like male or female). Now their are N distinct persons living in this hypothetical world. Each person can pair up with any other person or can ev... | [{"type": "stdin_stdout", "input": "2\n4\n24\n\n\nFMPLBT", "output": "10\n190455156\n"}, {"type": "stdin_stdout", "input": "2\n17\n2\n\n\nSBMPME", "output": "211799312\n2\n"}, {"type": "stdin_stdout", "input": "2\n2\n17\n\n\nSLQAND", "output": "2\n211799312\n"}, {"type": "stdin_stdout", "input": "2\n2\n24\n\n\nANDQLS",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPrint the K-th element of the following sequence of length 32:\n\n\n1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51\n\nConstraints\n\n* 1 \\leq K \\leq 32\n* All values in... | [{"type": "stdin_stdout", "input": "16", "output": "14\n"}, {"type": "stdin_stdout", "input": "24", "output": "15\n"}, {"type": "stdin_stdout", "input": "32", "output": "51\n"}, {"type": "stdin_stdout", "input": "-22", "output": "2\n"}, {"type": "stdin_stdout", "input": "-27", "output": "1\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have N balance beams numbered 1 to N. The length of each beam is 1 meters. Snuke walks on Beam i at a speed of 1/A_i meters per second, and Ringo walks on Beam i at a speed of 1/B_i meters per second.\n\nSnuke and Ring... | [{"type": "stdin_stdout", "input": "10\n1375710043 178537096\n1332309236 80797230\n164044598 544580992\n117241210 865935868\n383133839 231371336\n378371075 681212831\n304570952 16537461\n1789737664 267238505\n844917655 218662351\n662961957 100386692", "output": "1121712759 3406064155"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDiverta City is a new city consisting of N towns numbered 1, 2, ..., N.\n\nThe mayor Ringo is planning to connect every pair of two different towns with a bidirectional road. The length of each road is undecided.\n\nA Ham... | [{"type": "stdin_stdout", "input": "010", "output": "0 1 2 7 45 512 9925 321381 15870550 1069877351\n1 0 4 14 90 1024 19850 642762 31741100 2139754702\n2 4 0 28 180 2048 39700 1285524 63482200 4279509404\n7 14 28 0 315 3584 69475 2249667 111093850 7489141457\n45 90 180 315 0 6144 119100 3856572 190446600 12838528212\n5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA string is called a KEYENCE string when it can be changed to `keyence` by removing its contiguous substring (possibly empty) only once.\n\nGiven a string S consisting of lowercase English letters, determine if S is a KEY... | [{"type": "stdin_stdout", "input": "keyofscience", "output": "YES"}, {"type": "stdin_stdout", "input": "eeyofscienck", "output": "NO\n"}, {"type": "stdin_stdout", "input": "eeyofsciencj", "output": "NO\n"}, {"type": "stdin_stdout", "input": "eeyofscienci", "output": "NO\n"}, {"type": "stdin_stdout", "input": "eeyofscje... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given N positive integers a_1, a_2, ..., a_N.\n\nFor a non-negative integer m, let f(m) = (m\\ mod\\ a_1) + (m\\ mod\\ a_2) + ... + (m\\ mod\\ a_N).\n\nHere, X\\ mod\\ Y denotes the remainder of the division of X ... | [{"type": "stdin_stdout", "input": "7\n1387 1446 941 602 647 -2 1411", "output": "6425\n"}, {"type": "stdin_stdout", "input": "7\n850 1446 941 602 647 -2 1411", "output": "5888\n"}, {"type": "stdin_stdout", "input": "7\n850 1446 941 413 647 -1 453", "output": "4742\n"}, {"type": "stdin_stdout", "input": "7\n850 1446 94... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N. You can perform the following operation any number of times (possibly zero):\n\nOperation: Swap two adjacent elements in the permutation.\n\nYou want to ... | [{"type": "stdin_stdout", "input": "9\n1 4 1 2 3 10 2 12 14", "output": "1\n"}, {"type": "stdin_stdout", "input": "9\n1 4 0 2 3 10 2 12 14", "output": "1\n"}, {"type": "stdin_stdout", "input": "9\n1 1 0 2 3 10 2 12 14", "output": "1\n"}, {"type": "stdin_stdout", "input": "9\n1 1 1 2 3 10 2 12 14", "output": "1\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nImagine a game played on a line. Initially, the player is located at position 0 with N candies in his possession, and the exit is at position E. There are also N bears in the game. The i-th bear is located at x_i. The max... | [{"type": "stdin_stdout", "input": "2 1100001000 1000000000\n0 1008716701", "output": "3100001000\n"}, {"type": "stdin_stdout", "input": "2 1000000000 1000000000\n1 199586132", "output": "2000000000\n"}, {"type": "stdin_stdout", "input": "2 1000001000 1000000000\n2 199586132", "output": "2000001000\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn 20XX, the Aizu Chuo Road, which has a total distance of 58km and 6 sections from Atsushiokanomachi, Kitakata City to Minamiaizucho, is scheduled to be completed and opened.\n\nFor half a year after opening, the toll wi... | [{"type": "stdin_stdout", "input": "2\n17 24\n4\n17 45\n2\n17 25\n7\n-1 35\n0", "output": "250\n1500\n"}, {"type": "stdin_stdout", "input": "2\n13 25\n6\n17 14\n4\n17 25\n7\n1 10\n0", "output": "1150\n1300\n"}, {"type": "stdin_stdout", "input": "2\n17 25\n4\n17 45\n4\n17 19\n7\n19 35\n0", "output": "250\n1300\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nChairman K is a regular customer of the JOI pizza shop in the center of JOI city. For some reason, he decided to start a life-saving life this month. So he wanted to order the pizza with the highest calories pe... | [{"type": "stdin_stdout", "input": "3\n16 2\n358\n87\n1601\n010", "output": "108\n"}, {"type": "stdin_stdout", "input": "3\n16 2\n696\n77\n1150\n010", "output": "102\n"}, {"type": "stdin_stdout", "input": "3\n12 2\n200\n87\n1514\n010", "output": "122\n"}, {"type": "stdin_stdout", "input": "3\n12 2\n491\n77\n1150\n010",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nKND is a student programmer at the University of Aizu. His chest is known to be very sexy.\n\n<image>\n\n\nFor simplicity, the part of the skin that can be seen from the chest is represented by the isosceles tr... | [{"type": "stdin_stdout", "input": "3 2 3\n2 1 1\n2 1 1\n1 3 5", "output": "6.56688917825\n0.866025403784\n0.866025403784\n12.6033176764\n"}, {"type": "stdin_stdout", "input": "3 2 2\n2 1 1\n1 1 1\n1 3 16", "output": "5.44841509844\n0.866025403784\n1.29903810568\n29.6215145047\n"}, {"type": "stdin_stdout", "input": "4 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe King of a little Kingdom on a little island in the Pacific Ocean frequently has childish ideas. One day he said, βYou shall make use of a message relaying game when you inform me of something.β In response to the King... | [{"type": "stdin_stdout", "input": "5\nAJMP\naB33d\nE\n86AE\nAM\n-1\nMPJE\nWaEaETC302Q\nCP\nrTurnAGumdam1isdefferentf", "output": "33Bad\nAE86\n2-\nEC302QTWaEa\nTurnAGumdam0isdefferentfr\n"}, {"type": "stdin_stdout", "input": "5\nAJMP\naB33d\nE\n86AE\nMA\n-1\nMPJE\nWaEaETC302Q\nCP\nftnereffedsi1madmuGAnruTr", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\nACM\n\n\nOutput\n\n0\n\nThe input will be given via stdin and the output should be printed to stdout by your code.\n\nNow solve the problem by providing the code.\n\nWrite Python code to solve this pro... | [{"type": "stdin_stdout", "input": "ABM", "output": "0\n"}, {"type": "stdin_stdout", "input": "BIB", "output": "2\n"}, {"type": "stdin_stdout", "input": "1MI", "output": "1\n"}, {"type": "stdin_stdout", "input": "MCA", "output": "0\n"}, {"type": "stdin_stdout", "input": "MAC", "output": "0\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA rabbit is playing a role-playing game. Just before entering the castle, he was ambushed by an enemy!\n\nIt was a battle between one hero operated by a rabbit and n enemies. Each character has four stats, health hi, atta... | [{"type": "stdin_stdout", "input": "1\n-2 11 -1 -2\n11011 11101 11000 00111", "output": "-1\n"}, {"type": "stdin_stdout", "input": "1\n-2 17 -1 -2\n11011 11101 11000 00111", "output": "-1\n"}, {"type": "stdin_stdout", "input": "1\n-2 17 -1 -2\n11011 11101 11000 00011", "output": "-1\n"}, {"type": "stdin_stdout", "input... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.