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\nLittle Monty is very fond of Fibonacci numbers and challenges his friend Lopa\nthat he can solve any question regarding the same. Lopa however is jealous\nand after thinking for a long time came up with a problem. \n ... | [{"type": "stdin_stdout", "input": "3\n4\n4\n4\n\nELALPS", "output": "10\n10\n10\n"}, {"type": "stdin_stdout", "input": "3\n4\n11\n2\n\nSALPME", "output": "10\n35\n4\n"}, {"type": "stdin_stdout", "input": "3\n4\n4\n8\n\nELAKPT", "output": "10\n10\n24\n"}, {"type": "stdin_stdout", "input": "3\n7\n10\n2\n\nRAPLMF", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi has a string S of length N consisting of digits from `0` through `9`.\n\nHe loves the prime number P. He wants to know how many non-empty (contiguous) substrings of S - there are N \\times (N + 1) / 2 of them - ... | [{"type": "stdin_stdout", "input": "20 16\n10763178948652303319", "output": "136\n"}, {"type": "stdin_stdout", "input": "20 16\n46280926482052991001", "output": "139\n"}, {"type": "stdin_stdout", "input": "20 8\n33883322005544116655", "output": "171\n"}, {"type": "stdin_stdout", "input": "20 2\n33883322005544116655", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider the following arithmetic progression with n terms:\n\n* x, x + d, x + 2d, \\ldots, x + (n-1)d\n\n\n\nWhat is the product of all terms in this sequence? Compute the answer modulo 1\\ 000\\ 003.\n\nYou are given Q ... | [{"type": "stdin_stdout", "input": "2\n12 1 5\n42764 449743 2019", "output": "524160\n165266\n"}, {"type": "stdin_stdout", "input": "2\n12 1 5\n42764 376063 2019", "output": "524160\n455865\n"}, {"type": "stdin_stdout", "input": "2\n12 1 5\n23772 376063 2019", "output": "524160\n755257\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet N be a positive odd number.\n\nThere are N coins, numbered 1, 2, \\ldots, N. For each i (1 \\leq i \\leq N), when Coin i is tossed, it comes up heads with probability p_i and tails with probability 1 - p_i.\n\nTaro ha... | [{"type": "stdin_stdout", "input": "5\n1.1614561119919404 1.1884479131493024 2.346315137474776 3.457070091264252 0.7256297605857085", "output": "0.0803727774076\n"}, {"type": "stdin_stdout", "input": "5\n1.1614561119919404 1.1884479131493024 2.346315137474776 4.129281462465055 0.7256297605857085", "output": "-0.1355589... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn X-layered kagami mochi (X ≥ 1) is a pile of X round mochi (rice cake) stacked vertically where each mochi (except the bottom one) has a smaller diameter than that of the mochi directly below it. For example, if you sta... | [{"type": "stdin_stdout", "input": "7\n50\n30\n50\n100\n50\n80\n35", "output": "5\n"}, {"type": "stdin_stdout", "input": "7\n50\n40\n91\n110\n50\n34\n59", "output": "6\n"}, {"type": "stdin_stdout", "input": "7\n50\n30\n50\n100\n50\n80\n59", "output": "5\n"}, {"type": "stdin_stdout", "input": "7\n50\n40\n50\n100\n50\n80... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob are controlling a robot. They each have one switch that controls the robot.\nAlice started holding down her button A second after the start-up of the robot, and released her button B second after the start-u... | [{"type": "stdin_stdout", "input": "0 148 36 100", "output": "64\n"}, {"type": "stdin_stdout", "input": "-1 148 38 83", "output": "45\n"}, {"type": "stdin_stdout", "input": "10 94 67 145", "output": "27\n"}, {"type": "stdin_stdout", "input": "1 75 25 100", "output": "50\n"}, {"type": "stdin_stdout", "input": "1 80 25 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a railroad in Takahashi Kingdom. The railroad consists of N sections, numbered 1, 2, ..., N, and N+1 stations, numbered 0, 1, ..., N. Section i directly connects the stations i-1 and i. A train takes exactly A_i ... | [{"type": "stdin_stdout", "input": "20 987654321\n129662684 2\n162021979 1\n458437539 1\n258406183 2\n202863355 1\n112218745 1\n348732033 1\n323036578 1\n382398703 1\n55854389 1\n283445191 1\n151300613 1\n693338042 2\n191178308 2\n386707193 1\n204580036 1\n335134457 1\n122253639 1\n824646518 2\n902554792 2", "output": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFukushima Prefecture is also famous for producing fruits, and among them, peaches and apples boast one of the highest production volumes in Japan. By the way, when I made a print manuscript of an English pamphlet for sale... | [{"type": "stdin_stdout", "input": "the cost of one peach is higher than th`t of one apple.", "output": "the cost of one apple is higher than th`t of one peach.\n"}, {"type": "stdin_stdout", "input": "the cost of ooe peach is higher than th`t of one apple.", "output": "the cost of ooe apple is higher than th`t of one p... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWater Country Water Deven has n cities. Each city is surrounded by water and looks like an island country. Water Deven has m bridges, and transportation between cities is carried out by these bridges, which allows you to ... | [{"type": "stdin_stdout", "input": "5 6\n0 2 0\n0 1 0\n2 3 16\n1 3 2\n3 4 5\n0 0 1\n3 3\n0 2 3\n2 0 3\n0 1 12\n0 0", "output": "7\n15\n"}, {"type": "stdin_stdout", "input": "5 6\n0 0 1\n2 2 3\n2 3 12\n0 3 0\n2 4 14\n1 3 4\n3 3\n0 2 3\n1 0 3\n0 1 1\n0 0", "output": "30\n4\n"}, {"type": "stdin_stdout", "input": "5 6\n0 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe, the researchers who discovered and investigated the ancient nation Iwashiro, finally discovered the temple in the center of Iwashiro. A lithograph dedicated to the god of Iwashiro was stored in the temple. On the lith... | [{"type": "stdin_stdout", "input": "aaaabaaaabaaaabaaaab\naabaa", "output": "1576\n"}, {"type": "stdin_stdout", "input": "aaaabaaaabaa`abaaaab\naabaa", "output": "1248\n"}, {"type": "stdin_stdout", "input": "aaaabaaaabaa`ababaaa\naabaa", "output": "1446\n"}, {"type": "stdin_stdout", "input": "aaaabaaaabaaaabaaaab\naaaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTake the'IOI'train\n\nA new railway has been laid in IOI. Trains running on railways in IOI are a combination of several vehicles, and there are two types of vehicles, I and O. Vehicles can only be connected to different ... | [{"type": "stdin_stdout", "input": "12 -1\nHOOIO\nOHIQO", "output": "0\n"}, {"type": "stdin_stdout", "input": "12 -1\nHPOIO\nOHIQO", "output": "0\n"}, {"type": "stdin_stdout", "input": "10 -1\nOIOOI\nOOINI", "output": "0\n"}, {"type": "stdin_stdout", "input": "10 -1\nOOIOI\nOOINI", "output": "0\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProfessor Tsukuba invented a mysterious jewelry box that can be opened with a special gold key whose shape is very strange. It is composed of gold bars joined at their ends. Each gold bar has the same length and is placed... | [{"type": "stdin_stdout", "input": "19\n 1 +x 1 +y +z 3 +z\n 3 +y -z +x +y -z -x +z 2 +z\n 2 +y\n19\n 1 +x 1 +x +z 3 +y -z +x +y -z -x +z 2 +y\n 3 +z\n 2 +z\n19\n 1 +x 1 +y +z 3 +z\n 3 +y -z +x +y -z -x +z 2 +y\n 2 +z\n18\n 1 -y\n 1 +y -z +x\n 1 +z +y +x +z +y -x -y 1 -y\n 2 +z\n3 +x +y +z\n3 +y +z -x\n0",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA gene is a string consisting of `A`,` T`, `G`,` C`. The genes in this world are strangely known to obey certain syntactic rules.\n\nSyntax rules are given in the following form:\n\n\nNon-terminal symbol 1: Symbol 1_1 Sym... | [{"type": "stdin_stdout", "input": "-1 2 1 1\n3\ninv: at b b b\nat: [ATG] b\nb: [C]", "output": "0\n"}, {"type": "stdin_stdout", "input": "0 -1 2 0\n0\ninv: as c c `\nta: [ATG] b\n:b [C\\", "output": "0\n"}, {"type": "stdin_stdout", "input": "0 -1 2 0\n0\ninv: as c c `\nta: [ATG] b\n:b [C]", "output": "0\n"}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor a given sequence $A = \\\\{a_0, a_1, ... a_{n-1}\\\\}$, the number of pairs $(i, j)$ where $a_i > a_j$ and $i < j$, is called the number of inversions. The number of inversions is equal to the number of swaps of Bubbl... | [{"type": "stdin_stdout", "input": "5\n3 -13 7 -1 -4", "output": "6\n"}, {"type": "stdin_stdout", "input": "5\n3 -13 10 0 -4", "output": "6\n"}, {"type": "stdin_stdout", "input": "5\n3 -13 10 0 -5", "output": "6\n"}, {"type": "stdin_stdout", "input": "5\n2 -13 10 0 -5", "output": "6\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a chessboard of size n × n. It is filled with numbers from 1 to n^2 in the following way: the first ⌈ (n^2)/(2) ⌉ numbers from 1 to ⌈ (n^2)/(2) ⌉ are written in the cells with even sum of coordinates from le... | [{"type": "stdin_stdout", "input": "4 5\n2 1\n1 4\n5 3\n3 2\n2 4\n", "output": "11\n10\n10\n13\n4\n"}, {"type": "stdin_stdout", "input": "4 5\n2 1\n1 4\n5 3\n6 2\n2 4\n", "output": "11\n10\n10\n11\n4\n"}, {"type": "stdin_stdout", "input": "8 5\n2 1\n4 4\n4 3\n3 2\n2 4\n", "output": "37\n14\n46\n41\n6\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet n be an integer. Consider all permutations on integers 1 to n in lexicographic order, and concatenate them into one big sequence p. For example, if n = 3, then p = [1, 2, 3, 1, 3, 2, 2, 1, 3, 2, 3, 1, 3, 1, 2, 3, 2, 1... | [{"type": "stdin_stdout", "input": "1000000\n", "output": " 549766631"}, {"type": "stdin_stdout", "input": "771623\n", "output": " 501916356"}, {"type": "stdin_stdout", "input": "623847\n", "output": " ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a long stick, consisting of m segments enumerated from 1 to m. Each segment is 1 centimeter long. Sadly, some segments are broken and need to be repaired.\n\nYou have an infinitely long repair tape. You want to c... | [{"type": "stdin_stdout", "input": "2 1000000000 1\n1 1001000000\n", "output": "1001000000\n"}, {"type": "stdin_stdout", "input": "2 1000000000 1\n1 1000001000\n", "output": "1000001000\n"}, {"type": "stdin_stdout", "input": "2 1000000000 1\n1 1000000000\n", "output": "1000000000"}, {"type": "stdin_stdout", "input": "2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has written some permutation p_1, p_2, …, p_n of integers from 1 to n, so for all 1 ≤ i ≤ n it is true that 1 ≤ p_i ≤ n and all p_1, p_2, …, p_n are different. After that he wrote n numbers next_1, next_2, …, next_n... | [{"type": "stdin_stdout", "input": "10\n4\n2 4 4 5\n4\n2 -1 4 -1\n4\n4 5 5 5\n4\n2 3 4 5\n4\n2 3 4 5\n4\n-1 3 4 5\n4\n-1 3 4 5\n4\n3 3 4 5\n4\n3 5 5 5\n4\n5 4 5 5\n", "output": "1 3 2 4 \n1 2 3 4 \n-1\n1 2 3 4 \n1 2 3 4 \n1 2 3 4 \n1 2 3 4 \n2 1 3 4 \n-1\n-1\n"}, {"type": "stdin_stdout", "input": "10\n4\n2 4 4 5\n4\n2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhile sailing on a boat, Inessa noticed a beautiful water lily flower above the lake's surface. She came closer and it turned out that the lily was exactly H centimeters above the water surface. Inessa grabbed the flower ... | [{"type": "stdin_stdout", "input": "1 1000000\n", "output": "499999999999.5000000000000\n"}, {"type": "stdin_stdout", "input": "207434 496771\n", "output": "491126.2427687842865\n"}, {"type": "stdin_stdout", "input": "91306 947926\n", "output": "4874963.9445381462574\n"}, {"type": "stdin_stdout", "input": "7882 399082\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNikolay got a string s of even length n, which consists only of lowercase Latin letters 'a' and 'b'. Its positions are numbered from 1 to n.\n\nHe wants to modify his string so that every its prefix of even length has an ... | [{"type": "stdin_stdout", "input": "8\nbbbabbba\n", "output": "2\nabbaabba"}, {"type": "stdin_stdout", "input": "8\nbbabbbaa\n", "output": "3\nabababba"}, {"type": "stdin_stdout", "input": "8\nbbbababa\n", "output": "1\nbabababa"}, {"type": "stdin_stdout", "input": "8\nababbbba\n", "output": "1\nababbaba"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is a harder version of the problem. In this version, n ≤ 300 000.\n\nVasya is an experienced developer of programming competitions' problems. As all great minds at some time, Vasya faced a creative crisis. To improve... | [{"type": "stdin_stdout", "input": "500\n)))())(())((()))()((())())((()))()()(()(()))((()))(()()())()(())()()()(()()(()))((()))(((()))()())()((()))()()(()()(()())())(((()))()())(()())(()()(())())()((()))()()((())())(())()()()()()()(())()()(()())(((())))(()())((()))()((()))()(((()())))()(()(())())()(()())(()())(())((())... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou play a computer game. In this game, you lead a party of m heroes, and you have to clear a dungeon with n monsters. Each monster is characterized by its power a_i. Each hero is characterized by his power p_i and endura... | [{"type": "stdin_stdout", "input": "2\n6\n2 3 11 14 1 8\n2\n3 2\n000 1\n5\n3 5 100 2 3\n2\n30 5\n90 1\n", "output": "-1\n-1\n"}, {"type": "stdin_stdout", "input": "2\n6\n1 3 11 14 1 10\n2\n3 2\n100 1\n5\n3 5 100 2 3\n2\n30 5\n11 1\n", "output": "5\n-1\n"}, {"type": "stdin_stdout", "input": "2\n6\n1 3 11 16 1 10\n2\n3 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGuy-Manuel and Thomas are going to build a polygon spaceship.\n\nYou're given a strictly convex (i. e. no three points are collinear) polygon P which is defined by coordinates of its vertices. Define P(x,y) as a polygon o... | [{"type": "stdin_stdout", "input": "8\n-440365664 -1386303283\n107345267 -994221803\n248590739 -968608613\n473576011 -880752952\n138674534 994450706\n-164464580 986382989\n-522092561 852888831\n-874210729 485546704\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "8\n-440365664 -897818514\n107345267 -994221803\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVova had a pretty weird sleeping schedule. There are h hours in a day. Vova will sleep exactly n times. The i-th time he will sleep exactly after a_i hours from the time he woke up. You can assume that Vova woke up exactl... | [{"type": "stdin_stdout", "input": "65 654 560 571\n83 511 615 263 171 146 241 511 582 216 352 632 506 538 536 217 627 213 324 579 172 241 363 584 450 144 447 536 241 523 162 21 437 291 191 111 567 502 170 570 231 493 169 360 107 114 322 160 574 611 460 558 616 361 284 58 41 345 450 560 543 520 105 416 38\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRidhiman challenged Ashish to find the maximum valued subsequence of an array a of size n consisting of positive integers. \n\nThe value of a non-empty subsequence of k elements of a is defined as ∑ 2^i over all integers ... | [{"type": "stdin_stdout", "input": "20\n541032394951352952 204302388514120798 548305186805250399 743987576790520671 332874928746186630 60150973547887825 600093435051546090 862815570651991829 798946884837606574 383607230476788640 748981752333005915 317959714195378963 824508576221039025 547099154391774856 411018774272655... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is an interactive problem.\n\nWe hid from you a permutation p of length n, consisting of the elements from 1 to n. You want to guess it. To do that, you can give us 2 different indices i and j, and we will reply with... | [{"type": "stdin_stdout", "input": "100\n98 52 63 2 18 96 31 58 84 40 41 45 66 100 46 71 26 48 81 20 73 91 68 76 13 93 17 29 64 95 79 21 55 75 19 85 54 51 89 78 15 87 43 59 36 1 90 35 65 56 62 28 86 5 82 49 3 99 33 9 92 32 74 69 27 22 77 16 44 94 34 6 57 70 23 12 61 25 8 11 67 47 83 88 10 14 30 7 97 60 42 37 24 38 53 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWabbit is trying to move a box containing food for the rest of the zoo in the coordinate plane from the point (x_1,y_1) to the point (x_2,y_2).\n\nHe has a rope, which he can use to pull the box. He can only pull the box ... | [{"type": "stdin_stdout", "input": "5\n1 0 1000000000 1000000000\n1 1 1000000000 1000001100\n1 0 1001000000 1000000000\n1 1 1100010011 1001000000\n2 1 108856 18413\n", "output": "2000000001\n2000001100\n2001000001\n2101010011\n127268\n"}, {"type": "stdin_stdout", "input": "5\n1 0 1000000000 1000000000\n1 1 1001000000 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRidbit starts with an integer n.\n\nIn one move, he can perform one of the following operations: \n\n * divide n by one of its proper divisors, or \n * subtract 1 from n if n is greater than 1. \n\n\n\nA proper divisor ... | [{"type": "stdin_stdout", "input": "6\n1\n2\n3\n10\n10\n18\n", "output": "0\n1\n2\n2\n2\n2\n"}, {"type": "stdin_stdout", "input": "6\n1\n2\n3\n14\n6\n45\n", "output": "0\n1\n2\n2\n2\n3\n"}, {"type": "stdin_stdout", "input": "6\n2\n2\n3\n11\n4\n45\n", "output": "1\n1\n2\n3\n2\n3\n"}, {"type": "stdin_stdout", "input": "6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer n. Check if n has an odd divisor, greater than one (does there exist such a number x (x > 1) that n is divisible by x and x is odd).\n\nFor example, if n=6, then there is x=3. If n=4, then such a ... | [{"type": "stdin_stdout", "input": "6\n3\n3\n4\n5\n998244353\n1368804034442\n", "output": "YES\nYES\nNO\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "6\n2\n3\n4\n5\n998244353\n1099511627776\n", "output": "\nNO\nYES\nNO\nYES\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "6\n3\n3\n4\n5\n998244353\n109951162777... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs you know, Bob's brother lives in Flatland. In Flatland there are n cities, connected by n - 1 two-way roads. The cities are numbered from 1 to n. You can get from one city to another moving along the roads.\n\nThe «Two... | [{"type": "stdin_stdout", "input": "50\n7 34\n5 34\n5 11\n11 23\n42 5\n41 11\n12 41\n41 49\n1 49\n12 6\n7 15\n17 42\n20 6\n17 46\n20 19\n46 22\n49 40\n44 40\n43 46\n22 8\n17 29\n44 18\n31 18\n46 9\n7 16\n32 11\n13 41\n20 36\n34 25\n46 28\n39 34\n30 42\n11 47\n45 15\n37 17\n4 23\n35 17\n17 48\n2 17\n34 24\n1 10\n21 5\n2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have an initially empty cauldron, and you want to brew a potion in it. The potion consists of two ingredients: magic essence and water. The potion you want to brew should contain exactly k\\ \\% magic essence and (100... | [{"type": "stdin_stdout", "input": "100\n2\n36\n43\n19\n99\n100\n98\n9\n79\n57\n1\n78\n56\n14\n66\n93\n62\n50\n76\n33\n25\n41\n15\n61\n97\n33\n51\n97\n95\n96\n83\n53\n12\n77\n87\n85\n37\n72\n82\n70\n44\n69\n58\n52\n48\n73\n21\n24\n20\n8\n31\n32\n45\n55\n29\n13\n28\n49\n60\n54\n90\n86\n94\n10\n71\n47\n40\n74\n80\n23\n26... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSherlock Holmes found a mysterious correspondence of two VIPs and made up his mind to read it. But there is a problem! The correspondence turned out to be encrypted. The detective tried really hard to decipher the corresp... | [{"type": "stdin_stdout", "input": "10\njrojjyqqjtrfjf\nvuwzvmwjyfvifdfddymwfuzmvvummwdfzjzdvzuvfvjiuvyzymviyyumvziyimfzfiji\nwxzwojjzqzyqlojjbrjlbqrrwqw\nqfwppnuvbgegbqgbmeqpbguwmmqhunnquepepeewubbmnenvmwhnvhunnmsqmmgfepevupewvenmwpmgspnebv\nrxqzorkizznsiirciokscrrjqqqzkfijrrkkfrqjjifczcjcnqoisorszkjxcxvqzcfczqfcrvfrs... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya plays a computer game with ninjas. At this stage Vasya's ninja should get out of a deep canyon.\n\nThe canyon consists of two vertical parallel walls, their height is n meters. Let's imagine that we split these wall... | [{"type": "stdin_stdout", "input": "101 1\n----------------------------------------------------------------------------------------------------X\n----------------------------------------------------------------------------------------------------X\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "100 10\n-X----... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently a top secret mission to Mars has taken place. As a result, scientists managed to obtain some information about the Martian DNA. Now we know that any Martian DNA contains at most m different nucleotides, numbered ... | [{"type": "stdin_stdout", "input": "853332331434235 35 77\nBy\nhs\nzB\njs\nIr\nEa\nHG\nxb\nxG\nFp\nAC\nDt\nwo\nFB\nzh\nim\ntx\nyi\ngC\nkp\njz\ndc\nwE\naa\nsG\nng\ncr\npB\nCg\ncv\nxs\nDn\ndg\nyj\nCd\naC\nIi\ngH\nml\nww\nAD\nir\nti\nEr\nCj\nHt\nAe\nsn\naH\nHv\nan\nDf\nGn\nfC\nay\ngB\nlh\nup\nda\nzs\nbh\nHB\nHd\nmg\nzy\nG... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou've got string s, consisting of small English letters. Some of the English letters are good, the rest are bad.\n\nA substring s[l...r] (1 ≤ l ≤ r ≤ |s|) of string s = s1s2...s|s| (where |s| is the length of string s) i... | [{"type": "stdin_stdout", "input": "dcijflpluxgeqlroaktzcujfaaidnrdzgogzhobhsmbwmjpschtvjmivfapddsmxfvlhhgguymgtdjxpiezbnlmnlvdnuaohqskdbcjlyfdrzicflveffvpeyzhwqqdaenbsghuvetpxvqcutjxbelbfzuqpwlfvveebnmkoryxgodpccanzwhziiiumgtwskxhrhwdkwmyreefwmoedcvaokvetcgundyiidsqkolpqkarpszrrmagrfvpnwharotashtwcnrcnhapdwrbltgkpkkml... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGreg has an array a = a1, a2, ..., an and m operations. Each operation looks as: li, ri, di, (1 ≤ li ≤ ri ≤ n). To apply operation i to the array means to increase all array elements with numbers li, li + 1, ..., ri by va... | [{"type": "stdin_stdout", "input": "4 3 6\n1 2 3 4\n1 2 1\n2 3 2\n3 4 4\n1 2\n1 3\n2 3\n1 2\n1 3\n2 3\n", "output": "5 18 31 20 \n"}, {"type": "stdin_stdout", "input": "4 3 6\n2 2 3 4\n1 2 2\n2 3 2\n3 4 4\n1 2\n1 3\n2 3\n1 2\n1 3\n2 3\n", "output": "10 22 31 20\n"}, {"type": "stdin_stdout", "input": "4 3 6\n2 2 3 4\n1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNothing has changed since the last round. Dima and Inna still love each other and want to be together. They've made a deal with Seryozha and now they need to make a deal with the dorm guards...\n\nThere are four guardpost... | [{"type": "stdin_stdout", "input": "100000\n99000 100000 999 100010\n100000 100000 100000 100000\n100000 100000 100000 100000\n100000 100000 100000 100000\n", "output": "1 99000 1000\n"}, {"type": "stdin_stdout", "input": "100000\n99000 100000 999 100010\n100000 100001 100000 100000\n100000 100000 100000 100000\n100000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA + B is often used as an example of the easiest problem possible to show some contest platform. However, some scientists have observed that sometimes this problem is not so easy to get accepted. Want to try?\n\nInput\n\n... | [{"type": "stdin_stdout", "input": "1094 350\n", "output": "1444\n"}, {"type": "stdin_stdout", "input": "1132 485\n", "output": "1617\n"}, {"type": "stdin_stdout", "input": "1062 519\n", "output": "1581\n"}, {"type": "stdin_stdout", "input": "260 1041\n", "output": "1301\n"}, {"type": "stdin_stdout", "input": "1132 306... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMr. Kitayuta has just bought an undirected graph with n vertices and m edges. The vertices of the graph are numbered from 1 to n. Each edge, namely edge i, has a color ci, connecting vertex ai and bi.\n\nMr. Kitayuta want... | [{"type": "stdin_stdout", "input": "5 7\n1 5 1\n2 5 1\n3 5 1\n4 5 1\n1 2 2\n2 3 2\n3 4 2\n5\n1 5\n5 1\n2 5\n1 5\n1 4\n", "output": "1\n1\n1\n1\n2\n"}, {"type": "stdin_stdout", "input": "5 7\n1 5 1\n3 5 1\n3 5 1\n4 5 1\n1 2 2\n2 3 2\n3 4 2\n5\n1 5\n5 1\n2 5\n1 5\n1 4\n", "output": "1\n1\n0\n1\n2\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThree companies decided to order a billboard with pictures of their logos. A billboard is a big square board. A logo of each company is a rectangle of a non-zero area. \n\nAdvertisers will put up the ad only if it is poss... | [{"type": "stdin_stdout", "input": "17 100 100 22 61 100\n", "output": "100\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya works as a watchman in the gallery. Unfortunately, one of the most expensive paintings was stolen while he was on duty. He doesn't want to be fired, so he has to quickly restore the painting. He remembers some facts... | [{"type": "stdin_stdout", "input": "100000 100000 100000 100000 100000\n", "output": "10000000000"}, {"type": "stdin_stdout", "input": "100000 83958 32567 91083 110780\n", "output": "1466200000\n"}, {"type": "stdin_stdout", "input": "100010 87223 66046 27153 40823\n", "output": "1471847170\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has n days of vacations! So he decided to improve his IT skills and do sport. Vasya knows the following information about each of this n days: whether that gym opened and whether a contest was carried out in the Int... | [{"type": "stdin_stdout", "input": "100\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "100\n3 0 3 0 3 0 3 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is the following puzzle popular among nuclear physicists.\n\nA reactor contains a set of n atoms of some chemical elements. We shall understand the phrase \"atomic number\" as the number of this atom's element in th... | [{"type": "stdin_stdout", "input": "17 17\nFm Fm Fm Fm Fm Fm Fm Fm Fm Fm Fm Fm Fm Fm Fm Fm Fm\nFm Fm Fm Fm Fm Fm Fm Fm Fm Fm Fm Fm Fm Fm Fm Fm Fm\n", "output": "YES\nFm->Fm\nFm->Fm\nFm->Fm\nFm->Fm\nFm->Fm\nFm->Fm\nFm->Fm\nFm->Fm\nFm->Fm\nFm->Fm\nFm->Fm\nFm->Fm\nFm->Fm\nFm->Fm\nFm->Fm\nFm->Fm\nFm->Fm\n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJust to remind, girls in Arpa's land are really nice.\n\nMehrdad wants to invite some Hoses to the palace for a dancing party. Each Hos has some weight wi and some beauty bi. Also each Hos may have some friends. Hoses are... | [{"type": "stdin_stdout", "input": "10 5 100\n68 55 15 94 53 100 52 68 24 3\n286803 660813 226501 1031542 215418 290774 416040 961916 910482 50278\n1 5\n7 2\n2 8\n5 3\n10 3\n", "output": "1922676\n"}, {"type": "stdin_stdout", "input": "10 5 100\n68 55 15 94 53 100 52 68 24 3\n286803 660813 226501 624597 215418 290774 4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are literally dozens of snooker competitions held each year, and team Jinotega tries to attend them all (for some reason they prefer name \"snookah\")! When a competition takes place somewhere far from their hometow... | [{"type": "stdin_stdout", "input": "50\nPFH\nJFV->PFH\nBVP->PFH\nPFH->BVP\nPFH->JFV\nPFH->ETQ\nPFH->LQJ\nZTO->PFH\nPFH->BVP\nPFH->RXO\nPFH->ZTO\nHWL->PFH\nPFH->HIV\nPFH->AFP\nPFH->HWL\nOBB->PFH\nHIV->PFH\nPFH->LSR\nAFP->PFH\nLQJ->PFH\nHWL->PFH\nETQ->PFH\nPFH->HWL\nLSR->PFH\nWBR->PFH\nBNZ->PFH\nHQR->PFH\nZTO->PFH\nPFH->... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSasha and Kolya decided to get drunk with Coke, again. This time they have k types of Coke. i-th type is characterised by its carbon dioxide concentration <image>. Today, on the party in honour of Sergiy of Vancouver they... | [{"type": "stdin_stdout", "input": "971 108\n706 706 991 706 988 997 996 997 991 996 706 706 996 706 996 984 1000 991 996 1000 724 724 997 991 997 984 997 1000 984 996 996 997 724 997 997 1000 997 724 984 997 996 988 997 706 706 997 1000 991 706 988 997 724 988 706 996 706 724 997 988 996 991 1000 1000 724 988 996 1000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHarry Potter is on a mission to destroy You-Know-Who's Horcruxes. The first Horcrux that he encountered in the Chamber of Secrets is Tom Riddle's diary. The diary was with Ginny and it forced her to open the Chamber of Se... | [{"type": "stdin_stdout", "input": "9\nliyzmbjwnzryjokufuxcqtzwworjeoxkbaqrujrhdidqdvwdfzilwszgnzglnnbogaclckfnbqovtziuhwvyrqwmskx\nliyzmbjwnzryjokufuxcqtzwworjeoxkbaqrujrhdidqdvwdfzilwszgnzglnnbogaclckfnbqovtziuhwvyrqwmskx\nliyzmbjwnzryjokufuxcqtzwworjeoxkbaqrujrhdidqdvwdfzilwszgnzglnnbogaclckfnbqovtziuhwvyrqwmskx\nhr... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis time the Berland Team Olympiad in Informatics is held in a remote city that can only be reached by one small bus. Bus has n passenger seats, seat i can be occupied only by a participant from the city ai.\n\nToday the... | [{"type": "stdin_stdout", "input": "1 1000000000 1000000000\n100000\n", "output": " 0"}, {"type": "stdin_stdout", "input": "5 3 2\n1 1 2 1 1\n", "output": " 7"}, {"type": "stdin_stdout", "input": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIvan's classes at the university have just finished, and now he wants to go to the local CFK cafe and eat some fried chicken.\n\nCFK sells chicken chunks in small and large portions. A small portion contains 3 chunks; a l... | [{"type": "stdin_stdout", "input": "100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne department of some software company has n servers of different specifications. Servers are indexed with consecutive integers from 1 to n. Suppose that the specifications of the j-th server may be expressed with a sing... | [{"type": "stdin_stdout", "input": "15 250 200\n71 2 77 69 100 53 54 40 73 32 82 58 24 82 41\n", "output": "Yes\n11 3\n13 10 8 15 6 7 12 4 1 9 3 \n11 14 5 "}, {"type": "stdin_stdout", "input": "15 250 200\n71 2 77 69 100 53 54 40 73 32 82 85 24 82 41\n", "output": "Yes\n11 3\n13 10 8 15 6 7 4 1 9 3 11\n14 12 5\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe city of Fishtopia can be imagined as a grid of 4 rows and an odd number of columns. It has two main villages; the first is located at the top-left cell (1,1), people who stay there love fishing at the Tuna pond at the... | [{"type": "stdin_stdout", "input": "100 80\n", "output": "YES\n....................................................................................................\n.########################################...........................................................\n.########################################............... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAnd again a misfortune fell on Poor Student. He is being late for an exam.\n\nHaving rushed to a bus stop that is in point (0, 0), he got on a minibus and they drove along a straight line, parallel to axis OX, in the dire... | [{"type": "stdin_stdout", "input": "94 2 1\n0 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append `...` to the end of them... | [{"type": "stdin_stdout", "input": "40\nferelibenterhominesidquodvomuntcredunt", "output": "ferelibenterhominesidquodvomuntcredunt\n"}, {"type": "stdin_stdout", "input": "40\nferelibenterhominesidquodvonuntcredunt", "output": "ferelibenterhominesidquodvonuntcredunt\n"}, {"type": "stdin_stdout", "input": "40\nferelibent... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor a finite set of integers X, let f(X)=\\max X - \\min X.\n\nGiven are N integers A_1,...,A_N.\n\nWe will choose K of them and let S be the set of the integers chosen. If we distinguish elements with different indices e... | [{"type": "stdin_stdout", "input": "10 8\n1000000000 1100000000 1000001010 1000000000 1000000000 0 0 -2 0 0", "output": "600007816\n"}, {"type": "stdin_stdout", "input": "10 8\n1000000000 1100000000 1000001010 1100000000 1000000000 0 0 -2 0 0", "output": "400000739\n"}, {"type": "stdin_stdout", "input": "10 5\n10000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn 2028 and after a continuous growth, AtCoder Inc. finally built an empire with six cities (City 1, 2, 3, 4, 5, 6)!\n\nThere are five means of transport in this empire:\n\n* Train: travels from City 1 to 2 in one minute.... | [{"type": "stdin_stdout", "input": "10000000007\n2\n3\n1\n3\n11", "output": "10000000011\n"}, {"type": "stdin_stdout", "input": "10000000007\n2\n3\n1\n6\n11", "output": "10000000011\n"}, {"type": "stdin_stdout", "input": "10000000007\n2\n3\n1\n2\n11", "output": "10000000011\n"}, {"type": "stdin_stdout", "input": "10000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a train going from Station A to Station B that costs X yen (the currency of Japan).\n\nAlso, there is a bus going from Station B to Station C that costs Y yen.\n\nJoisino got a special ticket. With this ticket, s... | [{"type": "stdin_stdout", "input": "-1 -17", "output": "-10\n"}, {"type": "stdin_stdout", "input": "-1 -31", "output": "-17\n"}, {"type": "stdin_stdout", "input": "-11 -1", "output": "-12\n"}, {"type": "stdin_stdout", "input": "0 1003", "output": "501\n"}, {"type": "stdin_stdout", "input": "-12 -8", "output": "-16\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJoisino wants to evaluate the formula \"A op B\". Here, A and B are integers, and the binary operator op is either `+` or `-`. Your task is to evaluate the formula instead of her.\n\nConstraints\n\n* 1≦A,B≦10^9\n* op is e... | [{"type": "stdin_stdout", "input": "-1 - 182", "output": "-183\n"}, {"type": "stdin_stdout", "input": "6 - 131", "output": "-125\n"}, {"type": "stdin_stdout", "input": "5 - 118", "output": "-113\n"}, {"type": "stdin_stdout", "input": "-1 + 112", "output": "111\n"}, {"type": "stdin_stdout", "input": "-1 - 15", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program that extracts n different numbers from the numbers 0 to 100 and outputs the number of combinations that add up to s. Each n number is from 0 to 100, and the same number cannot be used in one combination. F... | [{"type": "stdin_stdout", "input": "4 133\n-1 0\n0 0", "output": "15011\n0\n"}, {"type": "stdin_stdout", "input": "4 102\n-1 0\n0 0", "output": "7153\n0\n"}, {"type": "stdin_stdout", "input": "8 80\n2 -2\n0 0", "output": "37638\n0\n"}, {"type": "stdin_stdout", "input": "3 133\n-1 0\n0 0", "output": "1202\n0\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAtaru Oafoot of Aizu Gakuen University High School decided to play with a slot machine.\n\nWhen you insert a medal on this machine, three reels will start spinning and each reel will stop automatically. In a normal game (... | [{"type": "stdin_stdout", "input": "3 2 30 3 41 226\n9 0 18 4 20 118\n5 5 12 0 15 203\n13 4 19 2 22 197\n7 4 24 4 17 209\n0 0 0 0 0 0", "output": "172\n795\n410\n1199\n617\n"}, {"type": "stdin_stdout", "input": "3 2 30 3 41 226\n9 0 36 4 20 118\n5 5 12 0 18 203\n13 4 19 2 22 197\n1 4 42 4 17 209\n0 0 0 0 0 0", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMr. Kobou found a bundle of old paper when he was cleaning his family home. On each paper, two series of numbers are written. Strange as it appeared to him, Mr. Kobou further went through the storehouse and found out a no... | [{"type": "stdin_stdout", "input": "5 4\n3 3 4 0 0\n4 -1 0 -2 4", "output": "0\n"}, {"type": "stdin_stdout", "input": "4 5\n3 2 5 0 0\n4 2 -1 -1 4", "output": "0\n"}, {"type": "stdin_stdout", "input": "4 5\n1 2 5 0 0\n4 2 -1 -1 4", "output": "0\n"}, {"type": "stdin_stdout", "input": "4 5\n1 2 5 0 0\n4 2 -2 -1 4", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEmacs is a text editor which is widely used by many programmers.\n\nThe advantage of Emacs is that we can move a cursor without arrow keys and the mice. For example, the cursor can be moved right, left, down, and up by pu... | [{"type": "stdin_stdout", "input": "hyo\nnh\nEND_OF_TEXT\ne\nd\nf\nf\nk\np\np\ne\ny\na\nk\ny\ny\nn\ny\n-", "output": "hyonhhyonhhyonh\n"}, {"type": "stdin_stdout", "input": "hyn\nnh\nEND_OF_TEXT\ne\nd\nf\nf\nk\np\np\ne\nx\na\nk\ny\ny\nn\ny\n-", "output": "hynnhhynnhhynnh\n"}, {"type": "stdin_stdout", "input": "oyh\nni\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are many blue cards and red cards on the table. For each card, an integer number greater than 1 is printed on its face. The same number may be printed on several cards.\n\nA blue card and a red card can be paired wh... | [{"type": "stdin_stdout", "input": "4 3\n2 6 6 15\n2 3 5\n2 3\n4 9\n8 16 32\n4 2\n4 9 11 13\n2 7\n5 5\n2 3 5 1001 1001\n7 11 13 17 34\n10 10\n2 3 5 7 12 11 13 15 17 29\n3 11 1 22 18 22 26 30 34 38\n20 20\n314 144 903 63 137 609 44 626 75 473\n876 421 909 519 755 840 374 368 570 872\n363 650 155 265 64 26 426 391 15 421... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe earth is under an attack of a deadly virus. Luckily, prompt actions of the Ministry of Health against this emergency successfully confined the spread of the infection within a square grid of areas. Recently, public he... | [{"type": "stdin_stdout", "input": "3\n...\n.@.\n...\n3\n.#\"\n.#.\n@##\n3\n.##\n#..\n@..\n5\n....@\n##...\n#....\n...#.\n##.##\n5\n#...#\n...#.\n#....\n...##\n..@..\n1\n$....\n.....\n.....\n.....\n..@..\n5\n#..#.\n$.#.#\n.#.#.\n....#\n.#@##\n5\n..##.\n..#..\n#....\n#....\n.#@..\n0", "output": "0\n4\n6\n3\n2\n0\n0\n0\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe understand that reading English is a great pain to many of you. So we’ll keep this problem statememt simple. Write a program that reports the point equally distant from a set of lines given as the input. In case of no ... | [{"type": "stdin_stdout", "input": "2\n-35 -35 100 100\n-49 49 1588 -2000\n4\n0 0 0 3\n0 0 3 0\n0 3 3 3\n3 0 3 3\n4\n0 3 -4 6\n3 0 6 -4\n2 3 6 6\n-1 2 -4 6\n0", "output": "Many\n1.500000 1.500000\n1.000000 1.000000\n"}, {"type": "stdin_stdout", "input": "2\n-35 -35 100 100\n-49 49 1588 -2000\n4\n0 0 0 4\n0 0 3 0\n0 3 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem statement\n\nA programming contest will be held in the Russian Federation. The contest has N questions and has M participants. Question i has a score a_i, and it is known that participant j's ability is b_j. For p... | [{"type": "stdin_stdout", "input": "6\n1 2 0 15 0 2\n7\n2 5 4 2 6 1 0\n1 28 1 3 5 1 0", "output": "Yes\nNo\nYes\nYes\nYes\nYes\nYes\n"}, {"type": "stdin_stdout", "input": "6\n1 1 0 15 0 3\n7\n2 5 4 2 10 1 0\n1 28 1 3 0 1 0", "output": "Yes\nNo\nYes\nNo\nYes\nYes\nYes\n"}, {"type": "stdin_stdout", "input": "6\n1 2 0 15 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nD: Sunburn-Suntan-\n\nstory\n\nAizunyan is a second-year student who belongs to the programming contest club of Wakagamatsu High School, commonly known as the Prokon club. Cute like an angel. Aizu Nyan is planning to part... | [{"type": "stdin_stdout", "input": "20\n1\n-1 12", "output": "13\n"}, {"type": "stdin_stdout", "input": "20\n1\n-1 19", "output": "20\n"}, {"type": "stdin_stdout", "input": "20\n1\n0 19", "output": "19\n"}, {"type": "stdin_stdout", "input": "20\n1\n0 12", "output": "12\n"}, {"type": "stdin_stdout", "input": "20\n1\n0 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nThere is a mysterious device $ M $, and if you put Tanuki and Fox in this device, one animal will come out from the device (hereinafter, Tanuki will be $ T $ and Fox will be $ F $).\n\n$ M (x, y) $ represents a... | [{"type": "stdin_stdout", "input": "3\nF S T", "output": "T\n"}, {"type": "stdin_stdout", "input": "3\nF R T", "output": "T\n"}, {"type": "stdin_stdout", "input": "3\nG S T", "output": "T\n"}, {"type": "stdin_stdout", "input": "3\nG R T", "output": "T\n"}, {"type": "stdin_stdout", "input": "3\nH R T", "output": "T\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA: Find the difference\n\nproblem\n\nGiven rectangular boards A and B with N squares vertically and M squares horizontally. For each board, each square is painted white or black.\n\nThe color of the square in the i-th row... | [{"type": "stdin_stdout", "input": "4 3\n..\"\n##.\n.##\n..#", "output": "12\n"}, {"type": "stdin_stdout", "input": "4 3\n..#\n##.\n.##\n..$", "output": "12\n"}, {"type": "stdin_stdout", "input": "4 3\n..\"\n##.\n.##\n#..", "output": "12\n"}, {"type": "stdin_stdout", "input": "4 3\n..\"\n#.#\n.##\n#..", "output": "12\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor a given weighted undirected graph G(V, E), find the distance of the shortest route that meets the following criteria:\n\n* It is a closed cycle where it ends at the same point it starts.\n* The route must go through e... | [{"type": "stdin_stdout", "input": "6 5\n0 1 0\n0 2 2\n1 3 3\n1 4 13\n1 0 6", "output": "42\n"}, {"type": "stdin_stdout", "input": "6 5\n0 1 0\n0 2 2\n1 3 3\n1 1 13\n1 0 6", "output": "29\n"}, {"type": "stdin_stdout", "input": "6 5\n0 0 1\n0 2 2\n1 3 3\n1 4 11\n2 0 6", "output": "37\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFind the least common multiple (LCM) of given n integers.\n\nConstraints\n\n* 2 ≤ n ≤ 10\n* 1 ≤ ai ≤ 1000\n* Product of given integers ai(i = 1, 2, ... n) does not exceed 231-1\n\nInput\n\n\nn\na1 a2 ... an\n\n\nn is give... | [{"type": "stdin_stdout", "input": "3\n12 39 11", "output": "1716\n"}, {"type": "stdin_stdout", "input": "4\n1 2 5 24", "output": "120\n"}, {"type": "stdin_stdout", "input": "3\n3 37 10", "output": "1110\n"}, {"type": "stdin_stdout", "input": "4\n1 2 5 44", "output": "220\n"}, {"type": "stdin_stdout", "input": "3\n9 37... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter a long day, Alice and Bob decided to play a little game. The game board consists of n cells in a straight line, numbered from 1 to n, where each cell contains a number a_i between 1 and n. Furthermore, no two cells ... | [{"type": "stdin_stdout", "input": "40\n5 40 6 27 39 37 17 34 3 30 28 13 12 8 11 10 31 4 1 16 38 22 29 35 33 23 7 9 24 14 18 26 19 21 15 36 2 20 32 25\n", "output": "ABABBBABABAAAAAABAAABBBBBBAAAABABBABABBB"}, {"type": "stdin_stdout", "input": "16\n14 15 3 11 5 4 7 8 1 6 10 2 12 9 13 16\n", "output": "BBBBBAAAAAAAABAB"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a set of n weights. You know that their masses are a_1, a_2, ..., a_n grams, but you don't know which of them has which mass. You can't distinguish the weights.\n\nHowever, your friend does know the mass of each ... | [{"type": "stdin_stdout", "input": "100\n50 50 51 50 51 51 51 51 51 50 50 50 50 50 50 51 50 51 50 51 51 50 50 51 51 51 51 51 51 50 50 51 51 51 50 50 50 51 50 51 51 51 50 51 51 50 50 50 50 50 50 51 50 50 51 51 51 50 50 50 51 50 51 50 51 51 50 51 50 51 51 51 50 51 50 50 51 50 51 51 51 51 50 51 51 51 51 50 51 51 51 51 51 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Sofia is in fourth grade. Today in the geometry lesson she learned about segments and squares. On the way home, she decided to draw n squares in the snow with a side length of 1. For simplicity, we assume that Sofi... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "63246\n"}, {"type": "stdin_stdout", "input": "1010000000\n", "output": "63561\n"}, {"type": "stdin_stdout", "input": "1550090838\n", "output": "78743\n"}, {"type": "stdin_stdout", "input": "1237445143\n", "output": "70355\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a_1, a_2, ..., a_n. All a_i are pairwise distinct.\n\nLet's define function f(l, r) as follows: \n\n * let's define array b_1, b_2, ..., b_{r - l + 1}, where b_i = a_{l - 1 + i}; \n * sort array b... | [{"type": "stdin_stdout", "input": "3\n123456789 214365879 987654321\n", "output": "582491518\n"}, {"type": "stdin_stdout", "input": "3\n240881040 214365879 987654321\n", "output": "987794593\n"}, {"type": "stdin_stdout", "input": "3\n240881040 289153064 987654321\n", "output": "383487374\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVus the [Cossack](https://en.wikipedia.org/wiki/Cossacks) holds a programming competition, in which n people participate. He decided to award them all with pens and notebooks. It is known that Vus has exactly m pens and k... | [{"type": "stdin_stdout", "input": "100 100 100\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "000 100 000\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "000 100 100\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "000 110 100\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob play a game. Initially they have a string s_1, s_2, ..., s_n, consisting of only characters . and X. They take alternating turns, and Alice is moving first. During each turn, the player has to select a conti... | [{"type": "stdin_stdout", "input": "7\n240501 42869\nXX.X.X.X.X.X...\n251441 50561\nX\n247719 194141\nXX..X.XX..\n208260 86427\n....XXX.X..\n290966 269978\n.X.\n298577 171094\nX.X.XX.X..X.XXX..X\n157525 2199\n...XX.X..X...X.XXX.XX.X..XXXX..X\n", "output": "NO\nNO\nNO\nNO\nNO\nNO\nNO\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGardener Alexey teaches competitive programming to high school students. To congratulate Alexey on the Teacher's Day, the students have gifted him a collection of wooden sticks, where every stick has an integer length. No... | [{"type": "stdin_stdout", "input": "11\n9969 9945 12703 11114 8159 10000 9928 9985 6747 9181 9933\n", "output": "5991155360\n"}, {"type": "stdin_stdout", "input": "11\n9969 9945 12703 9914 8159 10000 9928 9985 6747 9939 9933\n", "output": "5907768442\n"}, {"type": "stdin_stdout", "input": "11\n9969 9945 12703 9914 8159... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAdilbek was assigned to a special project. For Adilbek it means that he has n days to run a special program and provide its results. But there is a problem: the program needs to run for d days to calculate the results.\n\... | [{"type": "stdin_stdout", "input": "50\n1000000000 1000000000\n999999999 1000000000\n999999998 1000000000\n999999997 1000000000\n999999996 1000000000\n999999995 1000000000\n999999994 1000000000\n999999900 1000000000\n1 11\n2 11\n3 11\n4 11\n5 11\n6 11\n7 11\n8 11\n9 11\n10 11\n11 11\n4 18\n4 20\n3 19\n3 18\n3 167\n3 15... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n\n\nInput\n\nThe only line of the input contains a 7-digit hexadecimal number. The first \"digit\" of the number is letter A, the rest of the \"digits\" are decimal digits 0-9.\n\nOutput\n\nOutput a single integer.\n\nExa... | [{"type": "stdin_stdout", "input": "A089956\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "A089957\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "A144045\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "A278832\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "A089946\n", "output": "0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya claims that he had a paper square. He cut it into two rectangular parts using one vertical or horizontal cut. Then Vasya informed you the dimensions of these two rectangular parts. You need to check whether Vasya or... | [{"type": "stdin_stdout", "input": "3\n2 3\n3 1\n3 2\n1 3\n3 3\n1 3\n", "output": "Yes\nYes\nNo\n"}, {"type": "stdin_stdout", "input": "3\n2 3\n3 1\n3 2\n1 3\n3 6\n1 3\n", "output": "Yes\nYes\nNo\n"}, {"type": "stdin_stdout", "input": "3\n2 3\n3 1\n3 2\n1 3\n3 6\n1 0\n", "output": "Yes\nYes\nNo\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHave you ever used the chat application QQ? Well, in a chat group of QQ, administrators can muzzle a user for days.\n\nIn Boboniu's chat group, there's a person called Du Yi who likes to make fun of Boboniu every day.\n\n... | [{"type": "stdin_stdout", "input": "100 61 71\n11 18 0 47 33 37 91 13 8 30 73 64 50 97 62 50 2 36 68 32 64 74 32 77 81 41 23 44 40 18 45 33 21 68 57 79 107 23 21 37 99 27 30 56 75 62 75 63 1 15 79 42 18 66 21 25 2 12 89 48 75 7 57 85 80 14 82 29 66 47 29 10 1 84 79 39 33 81 135 26 80 67 52 25 38 68 57 53 38 83 83 3 86 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn this problem MEX of a certain array is the smallest positive integer not contained in this array.\n\nEveryone knows this definition, including Lesha. But Lesha loves MEX, so he comes up with a new problem involving MEX... | [{"type": "stdin_stdout", "input": "100\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRon is a happy owner of a permutation a of length n.\n\nA permutation of length n is an array consisting of n distinct integers from 1 to n in arbitrary order. For example, [2,3,1,5,4] is a permutation, but [1,2,2] is not... | [{"type": "stdin_stdout", "input": "2\n5 12\n3 2 1 4 5\n4 0.024816\n5 0.054959\n2 0.063211\n4 0.057224\n3 0.033510\n5 0.064656\n4 0.080912\n5 0.094426\n2 0.065718\n1 0.002728\n2 0.047829\n4 0.22982062043492948\n15 15\n3 8 5 7 9 2 4 6 1 10 11 12 13 14 15\n7 0.035821\n11 0.044624\n4 0.014940\n12 0.000655\n12 0.002577\n15... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are a given an array a of length n. Find a subarray a[l..r] with length at least k with the largest median.\n\nA median in an array of length n is an element which occupies position number ⌊ (n + 1)/(2) ⌋ after we sor... | [{"type": "stdin_stdout", "input": "100 16\n14 94 97 89 73 165 11 78 10 30 54 57 88 57 44 6 33 40 17 26 69 100 92 67 22 59 80 67 17 29 76 69 133 7 86 45 1 98 99 25 65 102 94 91 7 24 53 40 53 91 59 32 67 24 25 157 55 46 68 53 2 15 92 5 53 37 76 40 49 94 4 8 76 12 50 2 54 86 49 95 81 5 34 28 21 47 97 73 96 56 32 78 71 38... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDiana loves playing with numbers. She's got n cards with positive integer numbers a_i written on them. She spends her free time multiplying the numbers on the cards. She picks a non-empty subset of the cards and multiplie... | [{"type": "stdin_stdout", "input": "10 0\n4 1 6 4 4 7 10 3 10 3\n", "output": "10\n1 3 3 4 4 4 6 7 10 10 \n"}, {"type": "stdin_stdout", "input": "8 0\n65 131 69 91 4 5 79 52\n", "output": "8\n52 79 5 4 91 69 131 65\n"}, {"type": "stdin_stdout", "input": "8 0\n65 131 26 91 4 5 79 52\n", "output": "8\n52 79 5 4 91 26 131... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya the Great Magician and Conjurer loves all kinds of miracles and wizardry. In one wave of a magic wand he can turn an object into something else. But, as you all know, there is no better magic in the Universe than th... | [{"type": "stdin_stdout", "input": "100 -4900 100\n", "output": "1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 100 1 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has got many devices that work on electricity. He's got n supply-line filters to plug the devices, the i-th supply-line filter has ai sockets.\n\nOverall Vasya has got m devices and k electrical sockets in his flat,... | [{"type": "stdin_stdout", "input": "50 50 2\n2 2 4 5 2 1 5 4 5 4 5 2 1 2 3 3 5 1 2 2 1 3 4 5 5 4 3 2 2 1 3 2 3 2 4 4 1 3 5 4 3 2 4 3 4 4 4 4 3 4\n", "output": "14\n"}, {"type": "stdin_stdout", "input": "50 23 2\n2 1 2 2 3 2 1 2 3 3 3 1 3 1 3 2 1 3 2 2 1 1 3 2 2 1 1 3 2 1 2 3 2 2 2 2 1 3 1 2 2 3 3 1 3 3 3 1 2 3\n", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two rectangles on a plane. The centers of both rectangles are located in the origin of coordinates (meaning the center of the rectangle's symmetry). The first rectangle's sides are parallel to the coordinate... | [{"type": "stdin_stdout", "input": "988480 1151420 106\n", "output": "981327901099.81217265129089355"}, {"type": "stdin_stdout", "input": "1503946 527535 69\n", "output": "298092342476.75622430443763733"}, {"type": "stdin_stdout", "input": "988480 819219 106\n", "output": "684860009476.82913672924041748"}, {"type": "st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYaroslav likes algorithms. We'll describe one of his favorite algorithms.\n\n 1. The algorithm receives a string as the input. We denote this input string as a. \n 2. The algorithm consists of some number of command. Сo... | [{"type": "stdin_stdout", "input": "10\n630\n624\n110\n955\n551\n841\n1668\n377\n664\n309\n", "output": "0??<>1\n1??<>2\n2??<>3\n3??<>4\n4??<>5\n5??<>6\n6??<>7\n7??<>8\n8??<>9\n9??>>??0\n??<>1\n?0>>0?\n?1>>1?\n?2>>2?\n?3>>3?\n?4>>4?\n?5>>5?\n?6>>6?\n?7>>7?\n?8>>8?\n?9>>9?\n?>>??\n>>?\n"}, {"type": "stdin_stdout", "inpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAccording to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob ... | [{"type": "stdin_stdout", "input": "100 100\n51 93 101 960 2 477 213 129 663 925 254 78 1486 274 160 481 132 156 589 372 3 57 210 298 1771 7 359 468 254 406 202 929 221 366 552 97 555 29 634 118 539 140 992 854 7 163 134 103 940 30 409 1003 564 43 555 79 107 40 23 103 643 171 310 382 770 288 18 189 570 177 29 54 855 17... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlexey, a merry Berland entrant, got sick of the gray reality and he zealously wants to go to university. There are a lot of universities nowadays, so Alexey is getting lost in the diversity — he has not yet decided what ... | [{"type": "stdin_stdout", "input": "50\n69 6 6\n22 1 1\n23 3 3\n60 13 13\n13 3 3\n7 4 7\n6 1 1\n49 7 9\n68 8 8\n20 2 2\n34 1 1\n143 5 5\n22 1 1\n77 58 65\n10 3 3\n72 5 5\n47 1 1\n82 3 3\n92 8 8\n34 1 1\n42 9 10\n63 14 14\n10 3 3\n38 2 2\n80 6 6\n79 5 5\n53 5 5\n44 7 7\n85 2 2\n24 2 2\n57 3 3\n95 29 145\n77 6 6\n24 1 1\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle X has n distinct integers: p1, p2, ..., pn. He wants to divide all of them into two sets A and B. The following two conditions must be satisfied:\n\n * If number x belongs to set A, then number a - x must also bel... | [{"type": "stdin_stdout", "input": "70 416035 416023\n70034 70322 345689 345965 345701 70046 345737 345713 70166 345821 70010 345749 345677 345725 69962 345869 70178 70310 345785 69998 70070 69974 70058 346001 70106 345953 70226 70154 345929 69950 70298 346049 70346 345989 70286 69986 345893 70082 70238 345797 70250 34... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDuring the lunch break all n Berland State University students lined up in the food court. However, it turned out that the food court, too, has a lunch break and it temporarily stopped working.\n\nStanding in a queue that... | [{"type": "stdin_stdout", "input": "10\n419946 201769\n245945 0\n842799 113073\n836998 245945\n0 794376\n692107 836998\n113073 904403\n904403 987165\n201769 692107\n794376 842799\n", "output": "419946 794376 201769 842799 692107 113073 836998 904403 245945 987165\n"}, {"type": "stdin_stdout", "input": "10\n189071 85225... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n Imperial stormtroopers on the field. The battle field is a plane with Cartesian coordinate system. Each stormtrooper is associated with his coordinates (x, y) on this plane. \n\nHan Solo has the newest duplex ... | [{"type": "stdin_stdout", "input": "10 -4 -4\n2 -4\n2 0\n-4 2\n5 -4\n-3 -5\n1 4\n-4 2\n-3 5\n0 -3\n2 4\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "10 -4 -4\n1 -4\n2 0\n-4 2\n5 -4\n-3 -5\n1 4\n-4 2\n-3 5\n0 -3\n2 4\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "10 -4 -4\n1 -4\n2 0\n-4 2\n5 -4\n-3 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on forward, you need to descend one level lower and the only way to do this is to fall through the ice.\n\nThe level... | [{"type": "stdin_stdout", "input": "21 21\n.....X...X.........X.\n...X...XX......X.....\n..X........X.X...XX..\n.........X....X...X..\nX...X...........XX...\n...X...X....XX...XXX.\n.X............X......\n......X.X............\n.X...X.........X.X...\n......XX......X.X....\n....X.......X.XXX....\n.X.......X..XXX.X..X.\n.... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLimak is a little polar bear. In the snow he found a scroll with the ancient prophecy. Limak doesn't know any ancient languages and thus is unable to understand the prophecy. But he knows digits!\n\nOne fragment of the pr... | [{"type": "stdin_stdout", "input": "100\n9898888999899988989898898898898888889889888988989988999888989899888888889899889989898989898988989999\n", "output": "1225541\n"}, {"type": "stdin_stdout", "input": "65\n25852165999999999999942386995999999999999999999999999999999999999\n", "output": "90036\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBlake is a CEO of a large company called \"Blake Technologies\". He loves his company very much and he thinks that his company should be the best. That is why every candidate needs to pass through the interview that consi... | [{"type": "stdin_stdout", "input": "25\n12 30 47 109 81 124 80 33 38 48 29 78 96 48 96 27 80 77 102 65 80 113 31 194 35\n25 64 177 13 12 6 111 80 85 16 61 119 23 65 73 65 20 95 124 18 28 79 125 106 116\n", "output": "510\n"}, {"type": "stdin_stdout", "input": "25\n12 30 47 109 81 124 80 33 38 48 29 78 96 48 96 27 80 77... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasiliy likes to rest after a hard work, so you may often meet him in some bar nearby. As all programmers do, he loves the famous drink \"Beecola\", which can be bought in n different shops in the city. It's known that th... | [{"type": "stdin_stdout", "input": "12\n35345 58181 32223 84621 35905 73863 99537 30666 67771 39229 36847 29038\n23\n55052824\n82504840\n35160556\n78141700\n73401989\n86305919\n39430705\n31939373\n23501765\n4406029\n61436920\n14295390\n34275309\n28028753\n91433780\n70158847\n2396455\n66994588\n84024224\n30175981\n34941... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a permutation of integers from 1 to n. Exactly once you apply the following operation to this permutation: pick a random segment and shuffle its elements. Formally:\n\n 1. Pick a random segment (continuous ... | [{"type": "stdin_stdout", "input": "100\n39 8 87 59 49 19 6 64 81 26 90 58 30 93 51 94 91 10 37 68 14 86 75 41 15 73 76 85 13 84 34 25 54 92 23 11 99 53 80 74 22 29 20 79 7 66 62 72 28 71 12 48 18 9 78 38 43 47 5 50 77 82 52 96 97 65 55 88 16 45 69 4 61 42 60 100 24 32 57 21 89 70 27 35 98 83 56 40 46 44 1 2 3 17 31 95... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet T be arbitrary binary tree — tree, every vertex of which has no more than two children. Given tree is rooted, so there exists only one vertex which doesn't have a parent — it's the root of a tree. Every vertex has an ... | [{"type": "stdin_stdout", "input": "10\n911605217 -1 -1\n801852416 -1 -1\n140035920 -1 9\n981454947 10 2\n404988051 6 3\n307545107 8 7\n278188888 4 1\n523010786 -1 -1\n441817740 -1 -1\n789680429 -1 -1\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "10\n911605217 -1 -1\n801852416 -1 -1\n260560214 -1 9\n98145494... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.