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 of length n, which consists only of the first k letters of the Latin alphabet. All letters in string s are uppercase.\n\nA subsequence of string s is a string that can be derived from s by deletin...
[{"type": "stdin_stdout", "input": "76 26\nABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYABCDEFGHIJKLMNOPQRSTUVWXY\n", "output": "26\n"}, {"type": "stdin_stdout", "input": "22 1\nAAAAAAAAAAAAAAAAAAAAAA\n", "output": "22\n"}, {"type": "stdin_stdout", "input": "15 26\nWEYYDIADTLCOUEG\n", "output": "0\n"}, {"type": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSergey Semyonovich is a mayor of a county city N and he used to spend his days and nights in thoughts of further improvements of Nkers' lives. Unfortunately for him, anything and everything has been done already, and ther...
[{"type": "stdin_stdout", "input": "10\n2 3\n3 9\n6 3\n9 8\n9 10\n4 10\n3 1\n2 5\n7 2\n", "output": "70\n"}, {"type": "stdin_stdout", "input": "10\n2 3\n2 9\n6 3\n9 8\n9 10\n4 10\n3 1\n2 5\n7 2\n", "output": "70\n"}, {"type": "stdin_stdout", "input": "10\n2 3\n3 9\n6 4\n10 8\n9 10\n4 2\n3 1\n3 5\n7 1\n", "output": "75\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA multi-subject competition is coming! The competition has m different subjects participants can choose from. That's why Alex (the coach) should form a competition delegation among his students. \n\nHe has n candidates. F...
[{"type": "stdin_stdout", "input": "19 2\n1 2\n1 -3\n1 -1\n1 -2\n2 0\n1 -2\n1 -3\n2 -2\n2 -4\n2 -3\n2 0\n1 2\n1 -1\n1 -2\n1 -3\n1 -4\n2 2\n1 1\n1 -4\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "19 2\n1 2\n1 -3\n1 -1\n1 -2\n2 0\n1 -2\n1 -3\n2 -2\n2 -4\n2 -3\n2 0\n1 2\n1 -1\n1 -2\n1 -3\n1 -4\n2 4\n1 1\n1 -4\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.\n\nBerland bills somehow come in lots of different sizes. However, all of them are shaped as rec...
[{"type": "stdin_stdout", "input": "69\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n+ 1 2\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Petya loves inequations. Help him find n positive integers a1, a2, ..., an, such that the following two conditions are satisfied:\n\n * a12 + a22 + ... + an2 β‰₯ x\n * a1 + a2 + ... + an ≀ y\n\nInput\n\nThe first l...
[{"type": "stdin_stdout", "input": "45678 1409926355077 1564465\n", "output": "1518788\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...
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\nPetya started to attend programming lessons. On the first lesson his task was to write a simple program. The program was supposed to do the following: in the given string, consisting if uppercase and lowercase Latin lette...
[{"type": "stdin_stdout", "input": "FSNRBXLFQHZXGVMKLQDVHWLDSLKGKFMDRQWMWSSKPKKQBNDZRSCBLRSKCKKFFKRDMZFZGCNSMXNPMZVDLKXGNXGZQCLRTTDXLMXQ\n", "output": ".f.s.n.r.b.x.l.f.q.h.z.x.g.v.m.k.l.q.d.v.h.w.l.d.s.l.k.g.k.f.m.d.r.q.w.m.w.s.s.k.p.k.k.q.b.n.d.z.r.s.c.b.l.r.s.k.c.k.k.f.f.k.r.d.m.z.f.z.g.c.n.s.m.x.n.p.m.z.v.d.l.k.x.g...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYour program fails again. This time it gets \"Wrong answer on test 233\"\n\n.\n\nThis is the harder version of the problem. In this version, 1 ≀ n ≀ 2β‹…10^5. You can hack this problem if you locked it. But you can hack the...
[{"type": "stdin_stdout", "input": "100 100\n82 51 14 14 37 17 78 92 64 15 8 86 89 8 87 77 30 15 15 12 100 25 161 47 21 78 20 63 13 49 41 36 41 79 16 87 87 69 3 76 80 60 100 49 70 59 72 8 38 71 45 148 71 14 76 54 81 4 59 46 39 29 92 3 49 22 53 99 118 52 74 31 92 43 70 23 44 9 82 47 7 40 12 9 3 55 37 85 46 22 84 52 98 4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n[INSPION FullBand Master - INSPION](https://www.youtube.com/watch?v=kwsciXm_7sA)\n\n[INSPION - IOLITE-SUNSTONE](https://www.youtube.com/watch?v=kwsciXm_7sA)\n\nOn another floor of the A.R.C. Markland-N, the young man Simo...
[{"type": "stdin_stdout", "input": "50\n21 10\n30 22\n3 37\n37 32\n4 27\n18 10\n2 30\n29 19\n6 37\n12 39\n47 25\n41 49\n45 9\n25 48\n16 14\n10 7\n33 28\n3 31\n34 16\n35 37\n27 40\n45 16\n29 44\n16 15\n26 3\n1 12\n2 13\n15 21\n43 14\n9 33\n44 15\n46 1\n38 5\n15 5\n1 32\n42 35\n20 27\n23 12\n1 16\n15 17\n36 50\n13 8\n49 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYour task is to calculate the number of arrays such that:\n\n * each array contains n elements; \n * each element is an integer from 1 to m; \n * for each array, there is exactly one pair of equal elements; \n * for e...
[{"type": "stdin_stdout", "input": "100000 200000\n", "output": "707899035\n"}, {"type": "stdin_stdout", "input": "150000 200000\n", "output": "270223789\n"}, {"type": "stdin_stdout", "input": "200000 200000\n", "output": "668956439\n"}, {"type": "stdin_stdout", "input": "113870 200000\n", "output": "845412257\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are two sisters Alice and Betty. You have n candies. You want to distribute these n candies between two sisters in such a way that:\n\n * Alice will get a (a > 0) candies; \n * Betty will get b (b > 0) candies; \n...
[{"type": "stdin_stdout", "input": "98\n710\n896\n635\n909\n528\n799\n184\n970\n731\n285\n481\n62\n829\n815\n204\n927\n48\n958\n858\n549\n722\n900\n290\n96\n414\n323\n488\n140\n494\n286\n783\n551\n896\n580\n722\n766\n841\n914\n200\n170\n384\n664\n14\n203\n582\n203\n678\n502\n677\n318\n189\n144\n97\n330\n169\n20\n492\n2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLike any unknown mathematician, Yuri has favourite numbers: A, B, C, and D, where A ≀ B ≀ C ≀ D. Yuri also likes triangles and once he thought: how many non-degenerate triangles with integer sides x, y, and z exist, such ...
[{"type": "stdin_stdout", "input": "155884 306288 442497 458131\n", "output": "320309008056750\n"}, {"type": "stdin_stdout", "input": "145490 215252 310765 413147\n", "output": "658223816234250\n"}, {"type": "stdin_stdout", "input": "121979 139527 310648 398855\n", "output": "134130149955704\n"}, {"type": "stdin_stdout...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp plays a computer game (yet again). In this game, he fights monsters using magic spells.\n\nThere are two types of spells: fire spell of power x deals x damage to the monster, and lightning spell of power y deals ...
[{"type": "stdin_stdout", "input": "6\n1 5\n0 10\n1 -5\n1 14\n1 11\n0 -10\n", "output": "5\n25\n10\n34\n59\n39\n"}, {"type": "stdin_stdout", "input": "6\n1 5\n0 10\n1 -5\n0 14\n1 11\n0 -10\n", "output": "5\n25\n10\n24\n49\n39\n"}, {"type": "stdin_stdout", "input": "6\n1 5\n0 10\n1 -5\n1 14\n1 16\n0 -10\n", "output": "5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a new attraction in Singapore Zoo: The Infinite Zoo.\n\nThe Infinite Zoo can be represented by a graph with an infinite number of vertices labeled 1,2,3,…. There is a directed edge from vertex u to vertex u+v if ...
[{"type": "stdin_stdout", "input": "5\n1 4\n3 12\n2 15\n6 6\n10 5\n", "output": "YES\nYES\nNO\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "5\n1 4\n3 6\n1 8\n10 3\n5 5\n", "output": "YES\nYES\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "5\n1 2\n3 12\n2 6\n3 4\n3 5\n", "output": "YES\nYES\nNO\nYES\nYES\n"}, ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven an array a of length n, tell us whether it has a non-empty subsequence such that the product of its elements is not a perfect square.\n\nA sequence b is a subsequence of an array a if b can be obtained from a by del...
[{"type": "stdin_stdout", "input": "1\n69\n1 1 2 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", "input": "1\n69\n1 1 2 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 0 1 1 1 1 1 1...
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": "1000000\n", "output": "999996000003000000\n"}, {"type": "stdin_stdout", "input": "862795\n", "output": "642275489615199390\n"}, {"type": "stdin_stdout", "input": "763116\n", "output": "444394078546562430\n"}, {"type": "stdin_stdout", "input": "756604\n", "output": "433115377058855412...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA long time ago in some far country lived king Copa. After the recent king's reform, he got so large powers that started to keep the books by himself.\n\nThe total income A of his kingdom during 0-th year is known, as wel...
[{"type": "stdin_stdout", "input": "-1 -512 10\n", "output": "No solution\n"}, {"type": "stdin_stdout", "input": "-3 -768 13\n", "output": "No solution\n"}, {"type": "stdin_stdout", "input": "-173 373 3\n", "output": "No solution\n"}, {"type": "stdin_stdout", "input": "-521 526 1\n", "output": "No solution\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe king is left alone on the chessboard. In spite of this loneliness, he doesn't lose heart, because he has business of national importance. For example, he has to pay an official visit to square t. As the king is not in...
[{"type": "stdin_stdout", "input": "a8\nh1\n", "output": "7\nRD\nRD\nRD\nRD\nRD\nRD\nRD\n"}, {"type": "stdin_stdout", "input": "h8\ne1\n", "output": "7\nLD\nLD\nLD\n\nD\nD\nD\nD\n\n"}, {"type": "stdin_stdout", "input": "e8\nb1\n", "output": "7\nLD\nLD\nLD\n\nD\nD\nD\nD\n\n"}, {"type": "stdin_stdout", "input": "f7\nb1\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIt's time polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev got down to business. In total, there are n tasks for the day and each animal should do each of these task...
[{"type": "stdin_stdout", "input": "19\n895 1302 724 952 340 952 939 1302 724 952 939 340 340 1844 770 976 435 1302 1302\n", "output": "YES\n5 12 13 17 3 9 15 1 7 11 4 6 10 16 2 8 18 19 14\n12 5 13 17 3 9 15 1 7 11 4 6 10 16 2 8 18 19 14\n12 13 5 17 3 9 15 1 7 11 4 6 10 16 2 8 18 19 14\n"}, {"type": "stdin_stdout", "in...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCheaterius is a famous in all the Berland astrologist, magician and wizard, and he also is a liar and a cheater. One of his latest inventions is Cheaterius' amulets! They bring luck and wealth, but are rather expensive. C...
[{"type": "stdin_stdout", "input": "7\n21\n33\n**\n33\n12\n**\n32\n31\n**\n21\n33\n**\n33\n12\n**\n32\n31\n**\n13\n23\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "7\n21\n33\n**\n33\n12\n**\n32\n31\n**\n21\n38\n**\n33\n12\n**\n32\n31\n**\n13\n23\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "7\n21\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nColonel has n badges. He wants to give one badge to every of his n soldiers. Each badge has a coolness factor, which shows how much it's owner reached. Coolness factor can be increased by one for the cost of one coin. \n\...
[{"type": "stdin_stdout", "input": "50\n50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50\n", "output": "1225\n"}, {"type": "stdin_stdout", "input": "50\n49 37 30 2 18 48 14 48 50 27 1 43 46 5 21 28 44 2 24 17 41 38 25 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor months Maxim has been coming to work on his favorite bicycle. And quite recently he decided that he is ready to take part in a cyclists' competitions.\n\nHe knows that this year n competitions will take place. During ...
[{"type": "stdin_stdout", "input": "5 9 2\n15 18\n13 15\n9 16\n6 46\n10 11\n", "output": "0.75043463166775847828\n0.50012868026903611884\n1.75555586177032019179\n11.41003014228602907565\n0.25001607758409644111\n"}, {"type": "stdin_stdout", "input": "5 9 2\n15 18\n13 15\n9 16\n5 21\n10 11\n", "output": "0.75043463161594...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAyrat is looking for the perfect code. He decided to start his search from an infinite field tiled by hexagons. For convenience the coordinate system is introduced, take a look at the picture to see how the coordinates of...
[{"type": "stdin_stdout", "input": "1000000000000000000\n", "output": " -418284973 -1154700538\n"}, {"type": "stdin_stdout", "input": "533568904697339792\n", "output": " ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPaul is at the orchestra. The string section is arranged in an r Γ— c rectangular grid and is filled with violinists with the exception of n violists. Paul really likes violas, so he would like to take a picture including ...
[{"type": "stdin_stdout", "input": "10 10 10 1\n8 10\n2 9\n1 10\n3 1\n8 5\n10 1\n4 10\n10 2\n5 3\n9 3\n", "output": "1787\n"}, {"type": "stdin_stdout", "input": "10 10 10 1\n1 10\n10 8\n7 4\n7 2\n1 3\n6 6\n10 1\n2 7\n9 3\n3 10\n", "output": "1991\n"}, {"type": "stdin_stdout", "input": "10 10 10 10\n8 1\n1 8\n10 6\n10 4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given n points on a line with their coordinates xi. Find the point x so the sum of distances to the given points is minimal.\n\nInput\n\nThe first line contains integer n (1 ≀ n ≀ 3Β·105) β€” the number of points on ...
[{"type": "stdin_stdout", "input": "100\n457 827 807 17 871 935 907 -415 536 170 551 -1454 865 758 -457 -892 -875 -488 684 19 0 555 -807 -624 -239 826 318 811 20 -732 -91 460 551 -610 555 -493 -154 442 -141 946 -913 -104 704 -380 699 32 106 -455 -518 214 -464 -861 243 -798 -472 559 529 -844 -32 871 -459 236 387 626 -31...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe programming competition season has already started and it's time to train for ICPC. Sereja coaches his teams for a number of year and he knows that to get ready for the training session it's not enough to prepare only...
[{"type": "stdin_stdout", "input": "100\n56 22 13 79 28 73 16 55 34 0 97 19 22 36 22 80 30 19 36 92 9 38 24 10 61 43 19 12 18 34 21 36 1 17 0 97 72 37 74 70 51 34 33 87 27 33 45 97 38 56 2 32 88 92 64 51 74 94 86 98 57 62 83 3 87 61 9 65 57 13 64 10 50 35 7 75 41 3 70 66 6 55 69 42 91 75 14 22 68 93 2 53 22 98 45 2 78 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolandBall has such a convex polygon with n veritces that no three of its diagonals intersect at the same point. PolandBall decided to improve it and draw some red segments. \n\nHe chose a number k such that gcd(n, k) = 1...
[{"type": "stdin_stdout", "input": "2633 717\n", "output": "2 3 4 6 9 12 15 19 24 29 34 40 47 54 62 71 80 89 99 110 121 132 144 157 170 184 199 214 229 245 262 279 296 314 333 352 372 393 414 435 457 480 503 526 550 575 600 626 653 680 707 735 764 793 822 852 883 914 946 979 1012 1045 1079 1114 1149 1184 1220 1257 1294...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Holmes children are fighting over who amongst them is the cleverest.\n\nMycroft asked Sherlock and Eurus to find value of f(n), where f(1) = 1 and for n β‰₯ 2, f(n) is the number of distinct ordered positive integer pai...
[{"type": "stdin_stdout", "input": "1000000000000 1000000000000\n", "output": "1"}, {"type": "stdin_stdout", "input": "331725641503 465583326659\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "594243639083 188040404706\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "892726102335 265691489675\n", "outp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTonio has a keyboard with only two letters, \"V\" and \"K\".\n\nOne day, he has typed out a string s with only these two letters. He really likes it when the string \"VK\" appears, so he wishes to change at most one lette...
[{"type": "stdin_stdout", "input": "KKVVKKVVVKKVKKVKKVVVKVVVKKVKKVVVKKVVVKVVVKVVVKKVVVKKVVVKVVVKKVVVKVVKKVVVKKVVVKKVVKVVVKKVVKKVKKVVVKKV\n", "output": "24\n"}, {"type": "stdin_stdout", "input": "VVVVVKKVKVKVKVVKVVKKVVKVKKKKKKKVKKKVVVVVVKKVVVKVKVVKVKKVVKVVVKKKKKVVVVVKVVVVKVVVKKVKKVKKKVKKVKKVVKKV\n", "output": "25\n"}, {...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOkabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack.\n\nOkabe, being a control freak, gives Daru 2n commands: n of which are to ad...
[{"type": "stdin_stdout", "input": "19\nadd 1\nadd 2\nadd 3\nadd 4\nadd 5\nadd 6\nadd 7\nadd 8\nadd 9\nadd 10\nadd 11\nadd 12\nadd 13\nadd 14\nadd 15\nadd 16\nadd 17\nadd 18\nadd 19\nremove\nremove\nremove\nremove\nremove\nremove\nremove\nremove\nremove\nremove\nremove\nremove\nremove\nremove\nremove\nremove\nremove\nr...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecall that the bracket sequence is considered regular if it is possible to insert symbols '+' and '1' into it so that the result is a correct arithmetic expression. For example, a sequence \"(()())\" is regular, because ...
[{"type": "stdin_stdout", "input": "9999 41526212\n", "output": "(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRalph has a magic field which is divided into n Γ— m blocks. That is to say, there are n rows and m columns on the field. Ralph can put an integer in each block. However, the magic field doesn't always work properly. It wo...
[{"type": "stdin_stdout", "input": "1319740251273561528 1167937824526374114 1\n", "output": "855801178\n"}, {"type": "stdin_stdout", "input": "999999999999999999 1000000000000000000 1\n", "output": "102810659\n"}, {"type": "stdin_stdout", "input": "987654321987654321 1167937824526374114 1\n", "output": "186450555\n"}, ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's define a split of n as a nonincreasing sequence of positive integers, the sum of which is n. \n\nFor example, the following sequences are splits of 8: [4, 4], [3, 3, 2], [2, 2, 1, 1, 1, 1], [5, 2, 1].\n\nThe followi...
[{"type": "stdin_stdout", "input": "1000000000\n", "output": "500000001\n"}, {"type": "stdin_stdout", "input": "1223796969\n", "output": "611898485\n"}, {"type": "stdin_stdout", "input": "1074371686\n", "output": "537185844\n"}, {"type": "stdin_stdout", "input": "1141423649\n", "output": "570711825\n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTranslator's note: in Russia's most widespread grading system, there are four grades: 5, 4, 3, 2, the higher the better, roughly corresponding to A, B, C and F respectively in American grading system.\n\nThe term is comin...
[{"type": "stdin_stdout", "input": "100\n5 4 3 5 3 5 4 2 3 3 4 5 4 5 5 4 2 4 2 2 5 2 5 3 4 4 4 5 5 5 3 4 4 4 3 5 3 2 5 4 3 3 3 5 2 3 4 2 5 4 3 4 5 2 2 3 4 4 2 3 3 3 2 5 2 3 4 3 3 3 2 5 4 3 4 5 4 2 5 4 5 2 2 4 2 2 5 5 4 5 2 2 2 2 5 2 4 4 4 5\n", "output": "35\n"}, {"type": "stdin_stdout", "input": "100\n2 3 2 2 2 3 2 3 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nChandu is weak in maths. His teacher gave him homework to find maximum possible pair XOR in a matrix of size N x M with some conditions. Condition imposed is that, the pair can be formed between sum of elements in a colum...
[{"type": "stdin_stdout", "input": "2 2\n-1 4\n27 -1\n\nELOLAS", "output": "25\n"}, {"type": "stdin_stdout", "input": "2 2\n-1 3\n27 -1\n\nELOLAS", "output": "24\n"}, {"type": "stdin_stdout", "input": "2 2\n-1 4\n45 -1\n\nELOLAS", "output": "47\n"}, {"type": "stdin_stdout", "input": "2 2\n-1 4\n39 -1\n\nELOLAS", "outpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Deepu and Little Kuldeep are the two best warriors in the realm of Westeros. But, their priorities and their loyalties are very much divided. Little Kuldeep fights for the right, just while Little Deepu fights for ...
[{"type": "stdin_stdout", "input": "100\n826555\n29937\n82698\n346981\n490420\n801306\n142167\n948126\n190048\n472464\n365458\n533781\n651062\n950909\n890012\n952976\n974090\n791611\n937512\n738134\n846008\n922994\n490878\n750703\n484277\n83339\n29296\n849174\n670039\n449489\n103773\n904569\n915035\n269260\n130159\n743...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a sale in the market on clothes , so as usual N girls gathered there to grab great deals.But due to huge popularity of sale crowd has gone uncontrollable. You being head of management team of the mall has been as...
[{"type": "stdin_stdout", "input": "2\n5 3\n1 2\n4 3\n3 5\n4 0\n1 2\n1 -1\n0 4\n\nSAMPLE", "output": "YES\nYES\n"}, {"type": "stdin_stdout", "input": "2\n5 3\n1 2\n4 3\n3 5\n4 0\n1 2\n1 -1\n0 4\n\nPAMSLE", "output": "YES\nYES\n"}, {"type": "stdin_stdout", "input": "2\n5 3\n1 2\n4 2\n3 5\n4 0\n1 2\n1 -1\n0 4\n\nPAMSLE",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDark with his love for the prime numbers wanted to do some arithmetic so he decided to do some additions.\nHe wants to generate all prime numbers between two given numbers and add them up and decide whether that addition...
[{"type": "stdin_stdout", "input": "5796\n887 4384\n1916 2778\n1422 1650\n28 2363\n60 3691\n737 4173\n1430 2568\n124 2863\n3136 4068\n3059 4023\n3538 3785\n1874 4957\n926 2306\n1328 2085\n858 1314\n546 4583\n3368 3815\n365 435\n3751 4044\n2179 2277\n2400 2755\n61 4933\n3369 4677\n13 2740\n2540 3095\n571 796\n379 1435\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven a string S which contains only lowercase characters ['a'-'z'] and an integer K you have to find number of substrings having weight equal to K. \n\nWeight of characters is defined as : \n\nWeight['a']=1\nWeight['b...
[{"type": "stdin_stdout", "input": "2\n10\nabcdef\n4\nabcdefLAMPSE", "output": "1\n1\n"}, {"type": "stdin_stdout", "input": "2\n10\nabbdef\n4\nabcdefKAMPSE", "output": "0\n1\n"}, {"type": "stdin_stdout", "input": "2\n7\needaab\n30\nabcdefKAMPSE", "output": "0\n0\n"}, {"type": "stdin_stdout", "input": "2\n10\nabcdef\n4\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have a tree with N vertices and N-1 edges, respectively numbered 1, 2,\\cdots, N and 1, 2, \\cdots, N-1. Edge i connects Vertex u_i and v_i.\n\nFor integers L, R (1 \\leq L \\leq R \\leq N), let us define a function f(...
[{"type": "stdin_stdout", "input": "10\n5 4\n5 7\n-1 13\n0 9\n12 10\n4 11\n7 4\n11 10\n7 4", "output": "152\n"}, {"type": "stdin_stdout", "input": "10\n5 16\n5 6\n-1 24\n1 10\n13 10\n4 6\n13 4\n6 3\n7 3", "output": "187\n"}, {"type": "stdin_stdout", "input": "10\n5 16\n5 6\n-1 24\n1 10\n13 10\n4 6\n13 4\n6 5\n7 3", "ou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are visiting a large electronics store to buy a refrigerator and a microwave.\n\nThe store sells A kinds of refrigerators and B kinds of microwaves. The i-th refrigerator ( 1 \\le i \\le A ) is sold at a_i yen (the cu...
[{"type": "stdin_stdout", "input": "5 5 0\n-10 0\n12 10 -2\n-1 2 1", "output": "-12\n"}, {"type": "stdin_stdout", "input": "2 10 0\n-5 -1\n13 10 -1\n0 2 7", "output": "-6\n"}, {"type": "stdin_stdout", "input": "3 10 -1\n-5 0\n11 10 -2\n0 2 1", "output": "-7\n"}, {"type": "stdin_stdout", "input": "5 10 0\n-6 0\n12 10 -2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi will take part in an eating contest. Teams of N members will compete in this contest, and Takahashi's team consists of N players numbered 1 through N from youngest to oldest. The consumption coefficient of Membe...
[{"type": "stdin_stdout", "input": "11 14\n3 1 4 1 0 9 0 20 1 2 10\n15 6 7 26 3 2 3 8 4 8 2", "output": "20\n"}, {"type": "stdin_stdout", "input": "11 14\n3 1 4 1 0 9 0 20 1 2 10\n15 6 7 26 3 4 3 8 4 8 2", "output": "22\n"}, {"type": "stdin_stdout", "input": "11 14\n3 1 4 1 2 9 2 11 1 3 10\n15 9 7 26 3 2 3 8 4 8 2", "o...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string s consisting of `A`, `B` and `C`.\n\nSnuke wants to perform the following operation on s as many times as possible:\n\n* Choose a contiguous substring of s that reads `ABC` and replace it with `BCA`...
[{"type": "stdin_stdout", "input": "ABBACCBACCBCAABCB", "output": "2\n"}, {"type": "stdin_stdout", "input": "ACBAACBCCABCCBBBA", "output": "1\n"}, {"type": "stdin_stdout", "input": "ABCAACBCAABCCBBBC", "output": "3\n"}, {"type": "stdin_stdout", "input": "ACCAAABCAABCCBBBC", "output": "8\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAtCoDeer the deer wants a directed graph that satisfies the following conditions:\n\n* The number of vertices, N, is at most 300.\n* There must not be self-loops or multiple edges.\n* The vertices are numbered from 1 thro...
[{"type": "stdin_stdout", "input": "1 1\n100 71 1", "output": "Possible\n202 10401\n1 2 X\n2 3 X\n3 4 X\n4 5 X\n5 6 X\n6 7 X\n7 8 X\n8 9 X\n9 10 X\n10 11 X\n11 12 X\n12 13 X\n13 14 X\n14 15 X\n15 16 X\n16 17 X\n17 18 X\n18 19 X\n19 20 X\n20 21 X\n21 22 X\n22 23 X\n23 24 X\n24 25 X\n25 26 X\n26 27 X\n27 28 X\n28 29 X\n2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAtCoDeer the deer found two rectangles lying on the table, each with height 1 and width W. If we consider the surface of the desk as a two-dimensional plane, the first rectangle covers the vertical range of [0,1] and the ...
[{"type": "stdin_stdout", "input": "-1 -1 100", "output": "102\n"}, {"type": "stdin_stdout", "input": "-1 -1 101", "output": "103\n"}, {"type": "stdin_stdout", "input": "-1 -1 111", "output": "113\n"}, {"type": "stdin_stdout", "input": "0 -116 -1", "output": "115\n"}, {"type": "stdin_stdout", "input": "-2 -1 111", "out...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCounting was a difficult task in ancient Rome. The Arabic numerals 0,1,2,3,…, 9 have not yet been disseminated. Instead, the following symbols were used:\n\nArabic numerals | Roman numerals | Arabic numerals | Roman numer...
[{"type": "stdin_stdout", "input": "VI\nCXDCXXMCXVIIII\nDXDCIX", "output": "6\n1809\n1099\n"}, {"type": "stdin_stdout", "input": "IV\nCXDCXXMCXVIIII\nDXDCIX", "output": "4\n1809\n1099\n"}, {"type": "stdin_stdout", "input": "IV\nCCDIIXXXXVIDLI\nXIDXDC", "output": "4\n1095\n1099\n"}, {"type": "stdin_stdout", "input": "IV...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program to calculate values of arithmetic expressions which may involve complex numbers. Details of the expressions are described below.\n\nIn this problem, basic elements of expressions are non-negative integer n...
[{"type": "stdin_stdout", "input": "(1-10*i)+00007*(3+10*i)\n3+5*i*(4+10*i)\n(102+10*i)*(99+10*i)\n2*i+3+9999*i+4", "output": "22+60i\n-47+20i\n9998+2010i\noverflow\n"}, {"type": "stdin_stdout", "input": "(1010*i)+000-7+(3+10*i)\n3+5*i*(4+11*i)\n(102*10*i)*(99+10*i)\n2+i+3+9999*i+4", "output": "-4+1020i\n-52+20i\noverf...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOnce upon a time when people still believed in magic, there was a great wizard Aranyaka Gondlir. After twenty years of hard training in a deep forest, he had finally mastered ultimate magic, and decided to leave the fores...
[{"type": "stdin_stdout", "input": "8\n-7 9 6 9\n1 5 12 8\n-10 -5 12 -5\n-6 9 -9 -1\n6 13 18 -1\n-1 -2 -4 10\n1 -2 4 10\n0 -3 2 -3\n8\n-7 9 5 7\n-3 5 6 5\n-10 -5 10 -5\n-6 9 -7 -5\n6 5 9 -6\n-1 -2 -3 10\n1 -2 3 10\n-2 -5 2 -3\n0", "output": "no\nyes\n"}, {"type": "stdin_stdout", "input": "8\n-9 9 6 9\n1 5 12 8\n-10 -5 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem A Secret of Chocolate Poles\n\nWendy, the master of a chocolate shop, is thinking of displaying poles of chocolate disks in the showcase. She can use three kinds of chocolate disks: white thin disks, dark thin dis...
[{"type": "stdin_stdout", "input": "88 3", "output": "2971215071\n"}, {"type": "stdin_stdout", "input": "73 3", "output": "102334153\n"}, {"type": "stdin_stdout", "input": "68 4", "output": "3956574\n"}, {"type": "stdin_stdout", "input": "87 6", "output": "8427403\n"}, {"type": "stdin_stdout", "input": "72 4", "output"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBridge Construction Planning\n\nThere is a city consisting of many small islands, and the citizens live in these islands. Citizens feel inconvenience in requiring ferry rides between these islands. The city mayor decided ...
[{"type": "stdin_stdout", "input": "4 5 2\n1 4 2 A\n1 4 2 A\n1 4 2 B\n2 3 1 B\n3 4 1 B\n5 8 2\n1 2 1 A\n2 3 1 A\n3 4 3 A\n4 5 3 A\n1 2 5 B\n2 5 5 B\n3 4 8 B\n4 5 8 B\n5 5 1\n1 2 1 A\n2 3 1 A\n3 4 1 A\n4 5 1 B\n3 5 1 C\n4 5 3\n1 2 2 A\n2 4 3 B\n3 4 4 B\n2 3 5 A\n3 1 6 A\n0 0 0", "output": "-1\n14\n-1\n-1\n"}, {"type": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou decide to develop a game with your friends. The title of the game is \"Battle Town\". This is a game with the theme of urban warfare with tanks. As the first step in game development, we decided to develop the followi...
[{"type": "stdin_stdout", "input": "4\n4 6\n*.*..*\n*.....\n...-..\n^.*#..\n10\nSRSSRRUSSR\n2 2\n<.\n..\n12\nDDSRRSUUSLLS\n3 5\n>-#**\n.-*#*\n.-**#\n15\nSSSDRSSSDRSSSUU\n5 5\nv****\n*****\n*****\n*****\n*****\n44\nSSSSDDRSDRSRDSULUURSSSSRRRRDSSSSDDLSDLSDLSSD", "output": "*....*\n......\n..>-..\n...#..\n\n<.\n..\n\n^-#*...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nJapanese video game company has developed the music video game called Step Step Evolution. The gameplay of Step Step Evolution is very simple. Players stand on the dance platform, and step on panels on it according to a s...
[{"type": "stdin_stdout", "input": "1\n12\n123\n369\n12559\n4247219123\n1232123212321232\n#", "output": "0\n0\n1\n0\n1\n2\n7\n"}, {"type": "stdin_stdout", "input": "1\n16\n275\n333\n3289\n4925833356\n1232123212321232\n#", "output": "0\n0\n0\n0\n1\n0\n7\n"}, {"type": "stdin_stdout", "input": "1\n12\n123\n369\n2355\n1111...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe time was 3xxx, and the highly developed civilization was in a stagnation period. Historians decided to learn the wisdom of the past in an attempt to overcome this situation. What I paid attention to was the material l...
[{"type": "stdin_stdout", "input": "0.010621136904092388", "output": "-1\n"}, {"type": "stdin_stdout", "input": "1.3688811760808033", "output": "-1\n"}, {"type": "stdin_stdout", "input": "0.8381141713181799", "output": "-1\n"}, {"type": "stdin_stdout", "input": "0.8291753111376882", "output": "-1\n"}, {"type": "stdin_s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMake a wish to a shooting star\n\nThe mysterious organization JAG (Japanese Alumni Group) holds regular meetings. One day, the agenda was \"How to enable participating teams to demonstrate their strength in the upcoming I...
[{"type": "stdin_stdout", "input": "1\n0.0000 0.0000 0.0000 2.0000 0.0000 0.0000 4.0000 1.0000\n2\n0.0000 0.0000 0.0000 2.0000 0.0000 0.0000 4.0000 1.0000\n10.0000 0.0000 0.0000 -2.0000 0.0000 0.0000 4.0000 1.0000\n5\n-10.0000 0.5301491670709055 0.0000 10.0000 0.15723569039702578 0.6247894746810593 2.0000 1.0000\n-5.00...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nD --Invisible\n\nProblem Statement\n\nYou are trying to play a card game called \"Invisible\" with your friends. This card game uses two types of cards, a \"scoring card\" and a \"jamming card\". A positive value is writt...
[{"type": "stdin_stdout", "input": "2 2\n100 -1\n200 398", "output": "-100\n"}, {"type": "stdin_stdout", "input": "2 2\n100 -1\n325 300", "output": "-200\n"}, {"type": "stdin_stdout", "input": "2 2\n010 -1\n162 152", "output": "-142\n"}, {"type": "stdin_stdout", "input": "2 2\n100 -1\n200 300", "output": "-100"}, {"typ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlice has a lovely piece of cloth. It has the shape of a square with a side of length a centimeters. Bob also wants such piece of cloth. He would prefer a square with a side of length b centimeters (where b < a). Alice wa...
[{"type": "stdin_stdout", "input": "5\n35838040099 35838040098\n26612022790 26612022789\n23649629085 23649629084\n17783940691 17783940690\n31547284201 31547284200\n", "output": "YES\nYES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "5\n17406961899 17406961898\n21570966087 21570966086\n31354673689 31354673688\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this problem we consider a very simplified model of Barcelona city.\n\nBarcelona can be represented as a plane with streets of kind x = c and y = c for every integer c (that is, the rectangular grid). However, there is...
[{"type": "stdin_stdout", "input": "912738218 530309782 -939253776\n592805323 -930297022 -567581994 -829432319\n", "output": "1218437463.3854325\n"}, {"type": "stdin_stdout", "input": "137446306 341377513 -633738092\n244004352 -854692242 60795776 822516783\n", "output": "1800945736.2511592\n"}, {"type": "stdin_stdout",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nToday's morning was exceptionally snowy. Meshanya decided to go outside and noticed a huge snowball rolling down the mountain! Luckily, there are two stones on that mountain.\n\nInitially, snowball is at height h and it h...
[{"type": "stdin_stdout", "input": "71 100\n56 44\n12 85\n", "output": "5053\n"}, {"type": "stdin_stdout", "input": "46 100\n36 81\n99 28\n", "output": "4961\n"}, {"type": "stdin_stdout", "input": "29 100\n30 51\n28 92\n", "output": "5021\n"}, {"type": "stdin_stdout", "input": "93 80\n13 49\n100 21\n", "output": "3220\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array consisting of n integers a_1, a_2, ... , a_n and an integer x. It is guaranteed that for every i, 1 ≀ a_i ≀ x.\n\nLet's denote a function f(l, r) which erases all values such that l ≀ a_i ≀ r from t...
[{"type": "stdin_stdout", "input": "100 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 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNatasha's favourite numbers are n and 1, and Sasha's favourite numbers are m and -1. One day Natasha and Sasha met and wrote down every possible array of length n+m such that some n of its elements are equal to 1 and anot...
[{"type": "stdin_stdout", "input": "2000 2000\n", "output": "674532367\n"}, {"type": "stdin_stdout", "input": "1994 1981\n", "output": "596939902\n"}, {"type": "stdin_stdout", "input": "1028 1040\n", "output": "119840364\n"}, {"type": "stdin_stdout", "input": "1991 1992\n", "output": "518738831\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have a fence consisting of n vertical boards. The width of each board is 1. The height of the i-th board is a_i. You think that the fence is great if there is no pair of adjacent boards having the same height. More fo...
[{"type": "stdin_stdout", "input": "3\n3\n3 4\n2 1\n3 7\n3\n2 3\n2 2\n2 0\n4\n1 7\n12 2\n2 15\n1000000000 8\n", "output": "0\n2\n0\n"}, {"type": "stdin_stdout", "input": "3\n3\n3 4\n2 1\n3 4\n3\n2 3\n2 2\n2 0\n4\n1 7\n12 2\n2 15\n1000000000 8\n", "output": "0\n2\n0\n"}, {"type": "stdin_stdout", "input": "3\n3\n3 4\n2 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDLS and JLS are bored with a Math lesson. In order to entertain themselves, DLS took a sheet of paper and drew n distinct lines, given by equations y = x + p_i for some distinct p_1, p_2, …, p_n.\n\nThen JLS drew on the s...
[{"type": "stdin_stdout", "input": "7\n2\n1000000000 0\n2\n1000000000 0\n2\n1 0\n2\n1000000000 0\n2\n1 0\n2\n1 0\n2\n1000000000 0\n2\n1 0\n1\n999999999\n1\n99999999\n1\n1000000000\n1\n999999999\n3\n1000000000 999999999 999999998\n7\n2 3 5 7 10 11 12\n", "output": "4\n2\n2\n2\n1\n0\n10\n"}, {"type": "stdin_stdout", "inp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBob is playing a game of Spaceship Solitaire. The goal of this game is to build a spaceship. In order to do this, he first needs to accumulate enough resources for the construction. There are n types of resources, numbere...
[{"type": "stdin_stdout", "input": "2\n4 4\n9\n1 1 1\n1 2 1\n1 3 1\n2 1 2\n2 2 2\n2 3 2\n2 3 1\n2 2 1\n2 1 1\n", "output": "7\n6\n5\n4\n3\n2\n2\n3\n4\n"}, {"type": "stdin_stdout", "input": "2\n4 4\n9\n1 1 1\n2 2 1\n1 3 1\n2 1 2\n2 2 2\n2 3 2\n2 3 1\n2 2 1\n2 1 1\n", "output": "7\n6\n5\n4\n4\n3\n3\n3\n4\n"}, {"type": "s...
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 (0 ≀ a ≀ 63).\n\nOutput\n\nOutput a single number.\n\nExamples\n\nInput\n\n\n2\n\n\nOutput\n\n\n2\n\n\nInput\n\n\n5\n\n\nOutput\n\n\n24\n\n\nInput\n\n\n35\n\n\nOutput\n\n...
[{"type": "stdin_stdout", "input": "011\n", "output": "22\n"}, {"type": "stdin_stdout", "input": "001\n", "output": "16\n"}, {"type": "stdin_stdout", "input": "35\n", "output": "50\n"}, {"type": "stdin_stdout", "input": "45\n", "output": "60\n"}, {"type": "stdin_stdout", "input": "12\n", "output": "12\n"}, {"type": "st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers a and b. Print a+b.\n\nInput\n\nThe first line contains an integer t (1 ≀ t ≀ 10^4) β€” the number of test cases in the input. Then t test cases follow.\n\nEach test case is given as a line of two...
[{"type": "stdin_stdout", "input": "4\n2 4\n314 15\n-99 82\n123 987\n", "output": "6\n329\n-17\n1110\n"}, {"type": "stdin_stdout", "input": "4\n2 9\n314 14\n-99 67\n123 120\n", "output": "11\n328\n-32\n243\n"}, {"type": "stdin_stdout", "input": "4\n2 9\n314 14\n-99 177\n123 120\n", "output": "11\n328\n78\n243\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAnna is a girl so brave that she is loved by everyone in the city and citizens love her cookies. She is planning to hold a party with cookies. Now she has a vanilla cookies and b chocolate cookies for the party.\n\nShe in...
[{"type": "stdin_stdout", "input": "6\n2 2 1 2\n0 100 0 1\n12 13 25 1\n27 83 14 25\n0 0 1 0\n1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000\n", "output": "Yes\nNo\nNo\nYes\nNo\nYes\n"}, {"type": "stdin_stdout", "input": "6\n2 2 1 2\n0 100 0 1\n11 13 25 1\n27 83 14 25\n0 0 1 0\n100000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are playing a computer game. In this game, you have to fight n monsters.\n\nTo defend from monsters, you need a shield. Each shield has two parameters: its current durability a and its defence rating b. Each monster h...
[{"type": "stdin_stdout", "input": "3 3\n4 3 12\n3 1\n2 3\n2 3\n", "output": "0\n332748124\n332748124\n"}, {"type": "stdin_stdout", "input": "3 3\n5 2 6\n2 1\n0 2\n2 3\n", "output": "332748122\n13\n665496236\n"}, {"type": "stdin_stdout", "input": "3 3\n4 1 6\n0 1\n1 2\n2 3\n", "output": "11\n665496241\n332748118\n"}, {...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBandits appeared in the city! One of them is trying to catch as many citizens as he can.\n\nThe city consists of n squares connected by n-1 roads in such a way that it is possible to reach any square from any other square...
[{"type": "stdin_stdout", "input": "100\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\n0 0 63 70 92 75 4 96 52 33 86 57 53 85 91 62 23 0 28 37 41 69 26 64 7 100 41 19 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHolidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an n Γ— m matrix consisting of \"...
[{"type": "stdin_stdout", "input": "6\n4 7\n...*...\n..***..\n.****..\n*******\n6 10\n....*.*...\n...*****..\n..*******.\n.********.\n********.*\n**********\n5 5\n*...*\n**.**\n*****\n**.**\n*...*\n5 6\n.*....\n.**...\n.***..\n.****.\n.*****\n3 3\n*.*\n...\n*.*\n2 4\n.**.\n****\n", "output": "24\n89\n19\n22\n4\n8\n"}, ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe only difference between the easy and the hard version is the limit to the number of queries.\n\nThis is an interactive problem.\n\nThere is an array a of n different numbers. In one query you can ask the position of t...
[{"type": "stdin_stdout", "input": "100\n63 164 12 0 33 10 0 15 41 0 40 143 26 011 4 1 4 72 5 4 317 61 212 76 0 106 30 17 107 74 134 68 63 247 15 75 5 3 111 29 8 87 -1 1 -1 0 172 15 303 100 235 49 263 5 14 30 6 151 12 6 245 21 94 19 18 37 110 0 137 011 7 4 2 70 3 0 16 0 18 17 -1 17 97 180 10 -1 12 4 356 42 22 81 52 5 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOmkar's most recent follower, Ajit, has entered the Holy Forest. Ajit realizes that Omkar's forest is an n by m grid (1 ≀ n, m ≀ 2000) of some non-negative integers. Since the forest is blessed by Omkar, it satisfies some...
[{"type": "stdin_stdout", "input": "4\n3 4\n0000\n00#0\n0000\n2 1\n#\n#\n1 2\n##\n6 29\n#############################\n#000##0###0##0#0####0####000#\n#0#0##00#00##00####0#0###0#0#\n#0#0##0#0#0##00###00000##00##\n#000##0###0##0#0##0###0##0#0#\n#############################\n", "output": "\n2\n3\n3\n319908071\n"}, {"type...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven the number n, find the smallest positive integer which has exactly n divisors. It is guaranteed that for the given n the answer will not exceed 1018.\n\nInput\n\nThe first line of the input contains integer n (1 ≀ n...
[{"type": "stdin_stdout", "input": "118\n", "output": "864691128455135232"}, {"type": "stdin_stdout", "input": "473\n", "output": "259700248434180096"}, {"type": "stdin_stdout", "input": "940\n", "output": "199495389743677440"}, {"type": "stdin_stdout", "input": "265\n", "output": "364791569817010176"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOur old friend Alexey has finally entered the University of City N β€” the Berland capital. Alexey expected his father to get him a place to live in but his father said it was high time for Alexey to practice some financial...
[{"type": "stdin_stdout", "input": "71\n1 99\n11 69\n86 92\n7 49\n31 70\n42 53\n48 81\n86 96\n36 91\n19 38\n39 91\n41 64\n87 93\n83 97\n40 41\n3 32\n15 18\n58 65\n22 32\n1 71\n58 86\n64 77\n15 69\n4 34\n42 89\n9 66\n15 18\n58 65\n59 96\n39 89\n19 38\n6 63\n26 73\n29 47\n55 88\n5 78\n41 74\n48 81\n20 71\n59 96\n42 49\n4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day Vasya got hold of information on the Martian dollar course in bourles for the next n days. The buying prices and the selling prices for one dollar on day i are the same and are equal to ai. Vasya has b bourles. He...
[{"type": "stdin_stdout", "input": "93 867\n131 1270 616 1027 1685 27 1662 947 1480 20 1394 1528 191 1348 37 1694 1772 1706 1394 49 1391 878 1474 307 101 1129 1064 116 143 1239 261 651 1534 1348 1604 636 793 1188 1293 36 1729 1204 1656 1579 1644 661 1470 341 1709 1860 1081 1539 5 1892 1732 1049 419 25 1086 1263 967 128...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle X used to play a card game called \"24 Game\", but recently he has found it too easy. So he invented a new game.\n\nInitially you have a sequence of n integers: 1, 2, ..., n. In a single step, you can pick two of t...
[{"type": "stdin_stdout", "input": "3656\n", "output": "YES\n1 * 2 = 2\n2 * 3 = 6\n6 * 4 = 24\n6 - 5 = 1\n24 * 1 = 24\n8 - 7 = 1\n24 * 1 = 24\n10 - 9 = 1\n24 * 1 = 24\n12 - 11 = 1\n24 * 1 = 24\n14 - 13 = 1\n24 * 1 = 24\n16 - 15 = 1\n24 * 1 = 24\n18 - 17 = 1\n24 * 1 = 24\n20 - 19 = 1\n24 * 1 = 24\n22 - 21 = 1\n24 * 1 = ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe School β„–0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education). ...
[{"type": "stdin_stdout", "input": "220\n1 1 3 1 3 1 1 3 1 3 3 3 3 1 3 3 1 3 3 3 3 3 1 1 1 3 1 1 1 3 2 3 3 3 1 1 3 3 1 1 3 3 3 3 1 3 3 1 1 1 2 3 1 1 1 2 3 3 3 2 3 1 1 3 1 1 1 3 2 1 3 2 3 1 1 3 3 3 1 3 1 1 1 3 3 2 1 3 2 1 1 3 3 1 1 1 2 1 1 3 2 1 2 1 1 1 3 1 3 3 1 2 3 3 3 3 1 3 1 1 1 1 2 3 1 1 1 1 1 1 3 2 3 1 3 1 3 1 1 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLuke Skywalker gave Chewbacca an integer number x. Chewbacca isn't good at numbers but he loves inverting digits in them. Inverting digit t means replacing it with digit 9 - t. \n\nHelp Chewbacca to transform the initial ...
[{"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "1000000000000000000\n"}, {"type": "stdin_stdout", "input": "1000001000000000000\n", "output": "1000001000000000000\n"}, {"type": "stdin_stdout", "input": "1000001000000000010\n", "output": "1000001000000000010\n"}, {"type": "stdin_stdout", "input": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya has recently learned to type and log on to the Internet. He immediately entered a chat room and decided to say hello to everybody. Vasya typed the word s. It is considered that Vasya managed to say hello if several ...
[{"type": "stdin_stdout", "input": "hyyhddqhxhekehkwfhlnlsihzefwchzerevcjtokefplholrbvxlltdlafjxrfhleglrvlolojoqaolagtbeyogxlbgfolllslli\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "jhfbndhyzdvhbvhmhmefqllujdflwdpjbehedlsqfdsqlyelwjtyloxwsvasrbqosblzbowlqjmyeilcvotdlaouxhdpoeloaovb\n", "output": "YES\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThey say \"years are like dominoes, tumbling one after the other\". But would a year fit into a grid? I don't think so.\n\nLimak is a little polar bear who loves to play. He has recently got a rectangular grid with h rows...
[{"type": "stdin_stdout", "input": "7 39\n.......................................\n.###..###..#..###.....###..###..#..###.\n...#..#.#..#..#.........#..#.#..#..#...\n.###..#.#..#..###.....###..#.#..#..###.\n.#....#.#..#....#.....#....#.#..#..#.#.\n.###..###..#..###.....###..###..#..###.\n...................................
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a legend in the IT City college. A student that failed to answer all questions on the game theory exam is given one more chance by his professor. The student has to play a game with the professor.\n\nThe game is ...
[{"type": "stdin_stdout", "input": "1250846005844530517\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1000001000000000000\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "2039244416399039339\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1000001000000001000\n", "output": "2\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBrothers Fred and George Weasley once got into the sporting goods store and opened a box of Quidditch balls. After long and painful experiments they found out that the Golden Snitch is not enchanted at all. It is simply a...
[{"type": "stdin_stdout", "input": "20\n26 47 23\n1 -2 17\n-14 -22 46\n19 34 -18\n22 -10 -34\n15 14 -48\n-30 -12 -12\n-23 40 -48\n-50 -41 -35\n48 -5 46\n-2 -11 10\n-49 47 -15\n31 6 10\n-41 35 15\n28 28 25\n43 -7 -10\n-19 -48 49\n-10 -29 28\n0 -10 28\n41 12 -26\n-14 40 17\n3 2\n-115 1407 1434\n", "output": "YES\n659.975...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasiliy lives at point (a, b) of the coordinate plane. He is hurrying up to work so he wants to get out of his house as soon as possible. New app suggested n available Beru-taxi nearby. The i-th taxi is located at point (...
[{"type": "stdin_stdout", "input": "66 -82\n43\n27 -21 70\n-64 46 58\n-7 -20 41\n-42 60 57\n-93 -7 95\n26 -61 26\n-10 -72 25\n-78 -18 55\n-62 -64 69\n-33 95 50\n24 59 45\n4 72 37\n66 57 61\n16 -60 5\n17 -78 36\n-75 56 59\n-60 98 77\n-94 37 28\n76 6 63\n99 -35 75\n69 -40 1\n9 -48 56\n-94 -11 19\n69 1 63\n43 42 80\n-28 -...
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 194 362 200 157 336 162 77 90 96\n", "output": "1"}, {"type": "stdin_stdout", "input":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's not guaranteed they were from different people. It might happen that some people made no bids at all...
[{"type": "stdin_stdout", "input": "5\n3 4\n1 14\n4 20\n3 22\n5 28\n31\n1 1\n1 2\n2 1 2\n1 3\n2 1 3\n2 2 3\n3 1 2 3\n1 4\n2 1 4\n2 2 4\n3 1 2 4\n2 3 4\n3 1 3 4\n3 2 3 4\n4 1 2 3 4\n1 5\n2 1 5\n2 2 5\n3 1 2 5\n2 3 5\n3 1 3 5\n3 2 3 5\n4 1 2 3 5\n2 4 5\n3 1 4 5\n3 2 4 5\n4 1 2 4 5\n3 3 4 5\n4 1 3 4 5\n4 2 3 4 5\n5 1 2 3 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer m, and a list of n distinct integers between 0 and m - 1.\n\nYou would like to construct a sequence satisfying the properties:\n\n * Each element is an integer between 0 and m - 1, inclusive. \n ...
[{"type": "stdin_stdout", "input": "-1 12758\n", "output": "12757\n1 3 8507 2553 5469 7089 1161 9815 9357 3003 2687 10329 11095 3063 10869 441 3705 8893 11301 11035 7525 9025 5935 11625 7873 9895 9507 9389 233 5149 9083 11295 11949 7067 8189 3699 2337 2273 9527 7457 647 12129 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya recieved a gift of a string s with length up to 105 characters for his birthday. He took two more empty strings t and u and decided to play a game. This game has two possible moves:\n\n * Extract the first characte...
[{"type": "stdin_stdout", "input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n", "output": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"}, {"type": "stdin_stdout", "input": "bccbbcccbccbacacbaccaababcb...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs you might remember from the previous round, Vova is currently playing a strategic game known as Rage of Empires.\n\nVova managed to build a large army, but forgot about the main person in the army - the commander. So h...
[{"type": "stdin_stdout", "input": "5\n1 1\n1 4\n3 6 3\n1 4\n3 10 3\n", "output": "1\n0\n"}, {"type": "stdin_stdout", "input": "5\n1 3\n1 4\n3 11 3\n2 4\n3 6 2\n", "output": "0\n0\n"}, {"type": "stdin_stdout", "input": "5\n1 3\n1 4\n3 12 3\n1 4\n3 4 3\n", "output": "0\n2\n"}, {"type": "stdin_stdout", "input": "5\n1 3\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA substring of some string is called the most frequent, if the number of its occurrences is not less than number of occurrences of any other substring.\n\nYou are given a set of strings. A string (not necessarily from thi...
[{"type": "stdin_stdout", "input": "76\namnctposz\nmnctpos\nos\nu\ne\nam\namnc\neamnctpo\nl\nx\nq\nposzq\neamnc\nctposzq\nctpos\nmnc\ntpos\namnctposzql\ntposzq\nmnctposz\nnctpos\nctposzql\namnctpos\nmnct\np\nux\nposzql\ntpo\nmnctposzql\nmnctp\neamnctpos\namnct\ntposzql\nposz\nz\nct\namnctpo\noszq\neamnct\ntposz\ns\nmn\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two arrays A and B, each of size n. The error, E, between these two arrays is defined <image>. You have to perform exactly k1 operations on array A and exactly k2 operations on array B. In one operation, you...
[{"type": "stdin_stdout", "input": "22 334 246\n-462653 -618002 4973 -348485 366658 192390 274752 200590 138367 779540 -661269 642587 113645 -110388 -604418 -491231 -933401 -219332 -603140 836439 167007 210226\n357638 -646669 -558432 -434313 -285851 -119233 323088 -512237 -729293 215256 39316 -984201 -209814 715016 -27...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Jhool considers Jaadu to be a very close friend of his. But, he ends up having some misunderstanding with him a lot of times, because Jaadu's English isn't perfect, and Little Jhool sucks at the language Jaadu spea...
[{"type": "stdin_stdout", "input": "2\nhackerearth\nhacker\nhackerearth\nwow\nSAMPLE", "output": "YES\nNO\n"}, {"type": "stdin_stdout", "input": "2\nhackerearth\nhacker\nhackerearti\nwow\nSAMPLE", "output": "YES\nNO\n"}, {"type": "stdin_stdout", "input": "2\nhackerdarth\nhacker\nhackerearti\nwow\nSAMPLE", "output": "YE...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCaesar Cipher is one of the earliest and simplest encryption technique.\nTo encrypt a message, we shift the alphabets of the message by a fixed position or key. \n\nFor example, if message is ABC , and we shift each chara...
[{"type": "stdin_stdout", "input": "3\n-1\nw\n2\nnYxj\n-1\nml\n\nRAPMLE", "output": "v\npAzl\nlk\n"}, {"type": "stdin_stdout", "input": "3\n-1\nw\n2\nYnxj\n-1\nml\n\nRAPMLE", "output": "v\nApzl\nlk\n"}, {"type": "stdin_stdout", "input": "3\n-1\nw\n2\nYnxj\n-1\nmm\n\nRAPMLE", "output": "v\nApzl\nll\n"}, {"type": "stdin_...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nInspired by the tv series Stranger Things, bear Limak is going for a walk between two mirror worlds.\n\nThere are two perfect binary trees of height H, each with the standard numeration of vertices from 1 to 2^H-1. The ro...
[{"type": "stdin_stdout", "input": "5\n6 14 15 7 12 16 5 4 11 9 3 10 8 2 13 1", "output": "10199246"}, {"type": "stdin_stdout", "input": "2\n41 11", "output": "114307200"}, {"type": "stdin_stdout", "input": "2\n82 11", "output": "820575944"}, {"type": "stdin_stdout", "input": "2\n41 17", "output": "342921600"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is a positive integer N.\n\nWe will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.\n\n* Operation: if K divides N, replace N with N/K; otherwise...
[{"type": "stdin_stdout", "input": "79815666421", "output": "144\n"}, {"type": "stdin_stdout", "input": "237274827109", "output": "24\n"}, {"type": "stdin_stdout", "input": "13543667986", "output": "33\n"}, {"type": "stdin_stdout", "input": "23472293460", "output": "11\n"}, {"type": "stdin_stdout", "input": "4546820703...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe held two competitions: Coding Contest and Robot Maneuver.\n\nIn each competition, the contestants taking the 3-rd, 2-nd, and 1-st places receive 100000, 200000, and 300000 yen (the currency of Japan), respectively. Fur...
[{"type": "stdin_stdout", "input": "1 001", "output": "1000000\n"}, {"type": "stdin_stdout", "input": "10 001", "output": "300000\n"}, {"type": "stdin_stdout", "input": "11 001", "output": "300000\n"}, {"type": "stdin_stdout", "input": "3 001", "output": "400000\n"}, {"type": "stdin_stdout", "input": "5 001", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).\n\nHe is dividing the problems into two c...
[{"type": "stdin_stdout", "input": "14\n99592 10342 29105 78532 83018 11639 92015 127350 30914 21912 51211 93284 100000 0", "output": "27321\n"}, {"type": "stdin_stdout", "input": "14\n99592 10342 29105 78532 83018 11639 92015 127350 30914 39830 51211 93284 100000 0", "output": "27321\n"}, {"type": "stdin_stdout", "inp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a connected undirected simple graph, which has N vertices and M edges. The vertices are numbered 1 through N, and the edges are numbered 1 through M. Edge i connects vertices A_i and B_i. Your task is to fin...
[{"type": "stdin_stdout", "input": "13 8\n1 4\n4 7\n3 4\n2 1\n5 6\n6 5\n3 5\n2 6", "output": "7\n7 4 1 2 6 5 3\n"}, {"type": "stdin_stdout", "input": "7 8\n1 4\n2 3\n3 4\n4 1\n5 6\n1 7\n3 6\n2 6", "output": "7\n5 6 2 3 4 1 7\n"}, {"type": "stdin_stdout", "input": "7 7\n1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n3 5\n2 6", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a triangle formed by three points $(x_1, y_1)$, $(x_2, y_2)$, $(x_3, y_3)$ on a plain.\n\nWrite a program which prints \"YES\" if a point $P$ $(x_p, y_p)$ is in the triangle and \"NO\" if not.\n\nConstraints\n\nY...
[{"type": "stdin_stdout", "input": "2.5236948660396488 1.2449675008007697 3.467160130839816 2.2489154237675044 4.3267713977209254 3.696599910445261 2.778529750649784 0.5428461273225557\n0.3648696681668867 1.6775294144371997 2.646749575901687 5.368903351235283 5.958977255484857 4.673632823800934 -0.048505034276450476 4....
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOn the Internet, data is divided into packets, and each packet is transferred to a destination via a relay device called a router. Each router determines the next router to forward from the destination described in the pa...
[{"type": "stdin_stdout", "input": "7\n1 4 2 5 5 3\n2 1 5\n3 1 6\n4 1 7\n5 2 7 6\n6 1 2\n7 0\n6\n1 2 0\n1 5 0\n1 2 0\n5 1 3\n6 3 0\n1 7 4", "output": "NA\nNA\nNA\nNA\nNA\n3\n"}, {"type": "stdin_stdout", "input": "7\n1 4 2 5 4 3\n2 1 5\n3 1 6\n4 1 7\n5 2 7 6\n6 1 1\n7 0\n6\n1 2 1\n1 3 6\n1 2 0\n5 2 3\n6 3 0\n3 7 4", "ou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nDo you know Just Odd Inventions? The business of this company is to \"just odd inventions\". Here we call it JOI for short.\n\nJOI has two offices, each of which has square rooms of the same size arranged in a ...
[{"type": "stdin_stdout", "input": "5\n2 2 1 2\n6 5\n1 17\n3 2 2 1\n11 1 20\n10 18 3\n8\n5 4 1 3\n5 5 4 5 2\n8 2 1 9 7\n1 1 3 5 1\n7 2 7 1 3\n6 5 6 2\n2 3 5 8 2 7\n1 6 9 4 5 1\n2 5 1 4 2 2\n5 4 2 5 3 3\n12 1 5 1 5 6\n6\n3 3 2 2\n2 17 2\n9 1 9\n2 9 2\n2 2 1 1\n1 3\n5 7\n0", "output": "17\n4\n9\n"}, {"type": "stdin_stdou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlmost periodic string\n\nGiven the string S. Answer Q queries for this string S. In the i-th query, determine if S [l_i, \\ r_i] can be a string of period t_i when you can change from S [l_i, \\ r_i] to one character. S ...
[{"type": "stdin_stdout", "input": "abcabcaxcabc\n10\n1 3 3\n8 12 3\n1 4 2\n3 6 2", "output": "Yes\nYes\nNo\nNo\nNo\nNo\nNo\nNo\nNo\nNo\n"}, {"type": "stdin_stdout", "input": "abcabcaxcabc\n5\n1 15 3\n8 12 3\n1 4 2\n2 6 2", "output": "No\nYes\nNo\nNo\nNo\n"}, {"type": "stdin_stdout", "input": "abcabcaxcabc\n5\n1 3 3\n8...
code_stdio