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\nFox Ciel is playing a card game with her friend Jiro.\n\nJiro has n cards, each one has two attributes: position (Attack or Defense) and strength. Fox Ciel has m cards, each one has these two attributes too. It's known th...
[{"type": "stdin_stdout", "input": "36 30\nATK 116\nATK 120\nATK 122\nATK 120\nATK 116\nATK 118\nATK 123\nDEF 2564\nATK 123\nDEF 1810\nATK 124\nATK 120\nDEF 2598\nATK 119\nDEF 2103\nATK 123\nATK 118\nATK 118\nATK 123\nDEF 1988\nATK 122\nATK 120\nDEF 2494\nATK 122\nATK 124\nATK 117\nATK 121\nATK 118\nATK 117\nATK 122\nA...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a frog staying to the left of the string $s = s_1 s_2 \\ldots s_n$ consisting of $n$ characters (to be more precise, the frog initially stays at the cell $0$). Each character of $s$ is either 'L' or 'R'. It means...
[{"type": "stdin_stdout", "input": "6\nLRLRRLL\nL\nLLR\nRRRR\nLLLLLL\nR\n", "output": "3\n2\n3\n1\n7\n1\n"}, {"type": "stdin_stdout", "input": "6\nRRLRLLL\nL\nLLR\nRRRR\nLLLLLL\nR\n", "output": "4\n2\n3\n1\n7\n1\n"}, {"type": "stdin_stdout", "input": "6\nMRLRRLL\nL\nLLR\nRRRR\nLLLLLL\nR\n", "output": "3\n2\n3\n1\n7\n1\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nToday in the scientific lyceum of the Kingdom of Kremland, there was a biology lesson. The topic of the lesson was the genomes. Let's call the genome the string \"ACTG\".\n\nMaxim was very boring to sit in class, so the t...
[{"type": "stdin_stdout", "input": "50\nROWGGKNUITVHOBMKZXOZNBZMQGSFERNCZDFKLRBCFVVDXJEFLP\n", "output": "13\n"}, {"type": "stdin_stdout", "input": "50\nALWLSFLXYPQYMIWXMYMXFYMIVFYJDTJAIGVOAUDAIIAHKNNVTX\n", "output": "13\n"}, {"type": "stdin_stdout", "input": "50\nHKKUWHLYYKBLLEHKVNIRYAPVFTAPRIFUZELKGRDXZNCNWHSAFG\n",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou wrote down all integers from $0$ to $10^n - 1$, padding them with leading zeroes so their lengths are exactly $n$. For example, if $n = 3$ then you wrote out 000, 001, ..., 998, 999.\n\nA block in an integer $x$ is a ...
[{"type": "stdin_stdout", "input": "2352\n", "output": "388795058 433322746 541969001 523323201 867893102 537695799 837561050 990678065 688882179 577079614 937069914 960273782 761665782 282484628 787581089 314410468 983373531 353249698 130693309 82500826 144964998 247781749 108001361 947489703 358119467 770902487 73956...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYaroslav thinks that two strings s and w, consisting of digits and having length n are non-comparable if there are two numbers, i and j (1 ≤ i, j ≤ n), such that s_{i} > w_{i} and s_{j} < w_{j}. Here sign s_{i} represents...
[{"type": "stdin_stdout", "input": "10\n?8?528?91?\n1???60??54\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "10\n?8?258?91?\n1???60??54\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "10\n0????19?01\n????164759\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "10\n2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are an immigration officer in the Kingdom of AtCoder. The document carried by an immigrant has some number of integers written on it, and you need to check whether they meet certain criteria.\nAccording to the regulat...
[{"type": "stdin_stdout", "input": "100\n768 125 109 300 471 697 999 760 529 42 373 15 59 387 75 823 850 330 756 661 700 610 99 156 367 481 720 588 477 65 513 600 569 531 970 97 456 223 963 625 823 612 421 633 774 529 190 835 245 263 861 456 893 293 762 270 955 457 65 941 787 700 617 813 550 70 807 217 683 935 732 320 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNearly each project of the F company has a whole team of developers working on it. They often are in different rooms of the office in different cities and even countries. To keep in touch and track the results of the proj...
[{"type": "stdin_stdout", "input": "100 5\n- 60\n- 58\n+ 25\n- 32\n+ 86\n", "output": "95\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 26 27 28 29 30 31 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 59 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 8...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given $n$ integers $a_1, a_2, \\ldots, a_n$. You choose any subset of the given numbers (possibly, none or all numbers) and negate these numbers (i. e. change $x \\to (-x)$). What is the maximum number of differen...
[{"type": "stdin_stdout", "input": "1\n30\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\n", "output": "30\n"}, {"type": "stdin_stdout", "input": "4\n3\n100 -100 100\n4\n100 0 0 0\n5\n0 0 0 0 0\n7\n100 3 -2 0 -100 4 5\n", "output": "2\n2\n1\n7\n"}, {"type": "stdin_stdout", "input": "3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a 120 minute videotape with standard recording. When I set the VCR counter to 00:00:00 with the tape completely rewound and recorded in standard recording mode, I got a certain counter value. Enter this counter v...
[{"type": "stdin_stdout", "input": "1 36 0\n-1 -1 -1", "output": "00:24:00\n01:12:00\n"}, {"type": "stdin_stdout", "input": "0 30 0\n-1 -1 -1", "output": "01:30:00\n04:30:00\n"}, {"type": "stdin_stdout", "input": "0 32 0\n-1 -1 -1", "output": "01:28:00\n04:24:00\n"}, {"type": "stdin_stdout", "input": "1 16 0\n-1 -1 -1"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe zombies are gathering in their secret lair! Heidi will strike hard to destroy them once and for all. But there is a little problem... Before she can strike, she needs to know where the lair is. And the intel she has i...
[{"type": "stdin_stdout", "input": "10\n0000000000\n0000000000\n0000000000\n0000000000\n0000000000\n0000000000\n0012100000\n0024200000\n0012100000\n0000000000\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "10\n0000000000\n0122210000\n0244420100\n0122210000\n0000000000\n0000000000\n0000000000\n0000000000\n00...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe start of the new academic year brought about the problem of accommodation students into dormitories. One of such dormitories has a a × b square meter wonder room. The caretaker wants to accommodate exactly n students ...
[{"type": "stdin_stdout", "input": "1000000000 1000000000 1000000000\n", "output": "1000000000000000000\n1000000000 1000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000 1000000000\n", "output": "1000000000000000000\n1000000000 1000000000\n"}, {"type": "stdin_stdout", "input": "1000001000 1000000000 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nN programmers are going to participate in the preliminary stage of DDCC 20XX. Due to the size of the venue, however, at most 9 contestants can participate in the finals.\n\nThe preliminary stage consists of several rounds...
[{"type": "stdin_stdout", "input": "3\n1 0\n0 10\n7 2", "output": "12\n"}, {"type": "stdin_stdout", "input": "3\n1 0\n0 17\n7 2", "output": "19\n"}, {"type": "stdin_stdout", "input": "3\n1 1\n0 17\n7 2", "output": "20\n"}, {"type": "stdin_stdout", "input": "3\n1 0\n0 27\n7 2", "output": "29\n"}, {"type": "stdin_stdout"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n points on the plane, the i-th of which is at (x_i, y_i). Tokitsukaze wants to draw a strange rectangular area and pick all the points in the area.\n\nThe strange area is enclosed by three lines, x = l, y = a a...
[{"type": "stdin_stdout", "input": "35\n8 1\n6 8\n4 1\n1 2\n1 4\n5 10\n10 8\n9 1\n9 9\n10 2\n6 5\n8 8\n7 6\n10 6\n9 4\n4 9\n3 2\n1 8\n3 9\n7 3\n3 7\n2 7\n3 8\n3 1\n2 2\n5 5\n7 2\n4 10\n6 3\n5 1\n8 10\n4 3\n9 8\n9 7\n3 10\n", "output": "316"}, {"type": "stdin_stdout", "input": "35\n4 2\n9 6\n3 10\n2 5\n7 9\n6 9\n10 7\n6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N towns in the State of Atcoder, connected by M bidirectional roads.\nThe i-th road connects Town A_i and B_i and has a length of C_i.\nJoisino is visiting R towns in the state, r_1,r_2,..,r_R (not necessarily i...
[{"type": "stdin_stdout", "input": "4 6 3\n2 3 4\n1 2 4\n2 3 3\n4 3 1\n1 4 1\n4 2 2\n3 1 6\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "4 6 3\n2 3 4\n1 2 4\n2 3 6\n4 3 1\n1 4 1\n4 2 2\n3 1 6", "output": "3\n"}, {"type": "stdin_stdout", "input": "4 6 3\n2 3 4\n1 2 4\n2 3 6\n4 3 1\n1 4 1\n4 1 2\n3 1 6", "outp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a given sequence of integers a1, a2, ..., an, where every number is from 1 to 3 inclusively. You have to replace the minimum number of numbers in it so that all the numbers in the sequence are equal to each other...
[{"type": "stdin_stdout", "input": "30\n2 1 3 2 3 2 2 2 2 3 2 2 3 2 1 1 3 1 3 2 1 2 3 1 1 3 3 1 3 1\n", "output": "19\n"}, {"type": "stdin_stdout", "input": "30\n2 1 3 2 3 2 2 2 2 3 2 2 1 2 1 1 3 1 3 2 1 2 3 1 1 3 3 1 3 1\n", "output": "19\n"}, {"type": "stdin_stdout", "input": "30\n2 1 3 2 3 2 2 2 2 3 2 2 1 2 1 1 3 1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNowadays it is becoming increasingly difficult to park a car in cities successfully. Let's imagine a segment of a street as long as L meters along which a parking lot is located. Drivers should park their cars strictly pa...
[{"type": "stdin_stdout", "input": "50 3 1\n30\n1 9\n2 1\n1 6\n1 5\n1 8\n1 1\n2 6\n1 7\n2 3\n2 8\n1 7\n2 4\n2 5\n2 11\n1 2\n2 15\n1 6\n1 3\n2 17\n1 9\n1 3\n2 18\n1 3\n2 23\n2 21\n1 8\n1 2\n2 27\n1 8\n2 29\n", "output": "0\n0\n9\n17\n28\n28\n0\n0\n0\n9\n15\n0\n6\n0\n11\n27\n"}, {"type": "stdin_stdout", "input": "50 3 2\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKarl is developing a key storage service. Each user has a positive integer key.\n\nKarl knows that storing keys in plain text is bad practice. So, instead of storing a key, he decided to store a fingerprint of a key. Howe...
[{"type": "stdin_stdout", "input": "100\n1\n3\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n14\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n19\n42\n43\n44\n45\n46\n47\n20\n49\n50\n65\n52\n53\n54\n55\n56\n57\n58\n59\n60\n61\n62\n63\n64\n65\n66\n67\n68\n69\n70\n71\n72\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAndrey needs one more problem to conduct a programming contest. He has n friends who are always willing to help. He can ask some of them to come up with a contest problem. Andrey knows one value for each of his fiends — t...
[{"type": "stdin_stdout", "input": "100\n0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.8612181095398133 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKolya is going to make fresh orange juice. He has n oranges of sizes a_1, a_2, ..., a_{n}. Kolya will put them in the juicer in the fixed order, starting with orange of size a_1, then orange of size a_2 and so on. To be p...
[{"type": "stdin_stdout", "input": "100 1000 1083\n992 616 818 359 609 783 263 989 501 929 362 394 919 1081 870 830 1097 975 62 346 531 367 323 457 707 360 949 334 867 116 478 417 961 963 1029 114 867 1008 988 916 983 1077 959 1322 572 961 579 318 721 337 488 717 111 70 416 685 987 130 353 107 61 191 827 849 106 815 21...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya studies divisibility rules at school. Here are some of them:\n\n * Divisibility by 2. A number is divisible by 2 if and only if its last digit is divisible by 2 or in other words, is even.\n * Divisibility by 3. A...
[{"type": "stdin_stdout", "input": "30 100\n", "output": "2-type\n2\n"}, {"type": "stdin_stdout", "input": "10 100\n", "output": "2-type\n2\n"}, {"type": "stdin_stdout", "input": "10 25\n", "output": "2-type\n2\n"}, {"type": "stdin_stdout", "input": "70 14\n", "output": "2-type\n1\n"}, {"type": "stdin_stdout", "input":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are standing on the $\\mathit{OX}$-axis at point $0$ and you want to move to an integer point $x > 0$.\n\nYou can make several jumps. Suppose you're currently at point $y$ ($y$ may be negative) and jump for the $k$-th...
[{"type": "stdin_stdout", "input": "12\n1\n2\n3\n4\n5\n1\n2\n3\n4\n5\n1\n2\n", "output": "1\n3\n2\n3\n4\n1\n3\n2\n3\n4\n1\n3\n"}, {"type": "stdin_stdout", "input": "12\n1\n2\n3\n4\n5\n1\n2\n3\n4\n5\n1\n2\n", "output": "1\n3\n2\n3\n4\n1\n3\n2\n3\n4\n1\n3\n"}, {"type": "stdin_stdout", "input": "12\n1\n2\n3\n4\n5\n2\n2\n3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTwo famous competing companies ChemForces and TopChemist decided to show their sets of recently discovered chemical elements on an exhibition. However they know that no element should be present in the sets of both compan...
[{"type": "stdin_stdout", "input": "10\n598654597 975579682\n117777072 31932499\n223851456 1477480177\n988262691 654502493\n967529230 543358150\n835120075 101574205\n809901567 613170206\n152157661 479980560\n859252956 158469817\n614959273 735298093\n10\n1156316033 361325206\n341655282 740807372\n239996693 809030434\n81...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn this problem, a $n \\times m$ rectangular matrix $a$ is called increasing if, for each row of $i$, when go from left to right, the values strictly increase (that is, $a_{i,1}<a_{i,2}<\\dots<a_{i,m}$) and for each colum...
[{"type": "stdin_stdout", "input": "10 4\n4 9 11 12\n8 11 13 18\n13 16 18 21\n15 21 0 24\n17 0 21 29\n21 26 0 33\n26 31 33 35\n30 32 35 37\n33 37 40 43\n34 41 46 51\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "10 4\n4 9 11 12\n8 11 13 18\n13 16 18 21\n15 21 0 24\n17 0 21 29\n21 26 0 33\n26 31 33 35\n30 32 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIahub is a big fan of tourists. He wants to become a tourist himself, so he planned a trip. There are n destinations on a straight road that Iahub wants to visit. Iahub starts the excursion from kilometer 0. The n destina...
[{"type": "stdin_stdout", "input": "50\n3987477 8934938 4067156 6712855 7269334 5039822 9533601 9335400 5992073 2619268 438734 8620973 4347619 4307947 2249161 815221 7615258 8244100 8341666 5908546 6646952 4812769 6215114 7479369 6290438 5623785 6466133 9953199 3525873 4326034 3510072 8117068 2342953 1717542 9766539 65...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPupils decided to go to amusement park. Some of them were with parents. In total, n people came to the park and they all want to get to the most extreme attraction and roll on it exactly once.\n\nTickets for group of x pe...
[{"type": "stdin_stdout", "input": "100 1000 1000\n0000010100101100110100101111001111111111100101111100111011110001011110110111111010000000101000111000\n", "output": "100000\n"}, {"type": "stdin_stdout", "input": "100 1000 1000\n0000010100101100110100101111001111111111100101111100111011110001011110110111111010000000101...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers a and b. Determine if a+b=15 or a\\times b=15 or neither holds.\n\nNote that a+b=15 and a\\times b=15 do not hold at the same time.\n\nConstraints\n\n* 1 \\leq a,b \\leq 15\n* All values in inpu...
[{"type": "stdin_stdout", "input": "-3 -5", "output": "*\n"}, {"type": "stdin_stdout", "input": "11 -1", "output": "x\n"}, {"type": "stdin_stdout", "input": "15 -1", "output": "x\n"}, {"type": "stdin_stdout", "input": "29 -1", "output": "x\n"}, {"type": "stdin_stdout", "input": "13 -1", "output": "x\n"}, {"type": "stdi...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThree people, A, B and C, are trying to communicate using transceivers.\nThey are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively.\nTwo people can directly communic...
[{"type": "stdin_stdout", "input": "-1 000 -1 15", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-1 100 -1 15", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-1 100 -1 12", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-1 100 -1 13", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-1 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya is the most responsible worker in the Research Institute. So he was asked to make a very important experiment: to melt the chocolate bar with a new laser device. The device consists of a rectangular field of n × m c...
[{"type": "stdin_stdout", "input": "20\n100 200 100 1 100 100\n100 200 1 100 100 100\n2 2 1 1 2 2\n100 100 50 50 1 1\n10 10 5 5 1 1\n100 100 99 1 1 99\n100 100 1 99 99 1\n100 100 1 10 10 1\n100 100 1 1 10 10\n9 6 1 3 3 1\n1000000000 1000000000 1 1 1000000000 1000000000\n9 4 1 4 4 1\n6 4 1 1 5 4\n6 2 1 1 5 2\n8 2 1 1 5 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDanil decided to earn some money, so he had found a part-time job. The interview have went well, so now he is a light switcher.\n\nDanil works in a rooted tree (undirected connected acyclic graph) with n vertices, vertex ...
[{"type": "stdin_stdout", "input": "10\n1 1 3 1 3 1 4 6 3\n0 1 1 1 1 1 1 1 0 0\n10\nget 9\nget 10\nget 4\nget 5\nget 5\nget 5\nget 10\nget 7\nget 5\nget 2\n", "output": "0\n0\n2\n1\n1\n1\n0\n1\n1\n1\n"}, {"type": "stdin_stdout", "input": "10\n1 1 3 1 3 1 4 6 3\n0 1 1 1 1 1 1 1 1 0\n10\nget 9\nget 10\nget 4\nget 5\nget ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian as well. \n\n------ Problem description ------ \n\nYou will be given a zero-indexed array A. You need to rearrange its elements in such a way that the following con...
[{"type": "stdin_stdout", "input": "2\n2\n3 -1\n3\n10 5 2", "output": "-1 3\n2 10 5\n"}, {"type": "stdin_stdout", "input": "2\n2\n1 -1\n3\n10 5 2", "output": "-1 1\n2 10 5\n"}, {"type": "stdin_stdout", "input": "2\n2\n4 5\n3\n15 9 -1", "output": "4 5\n-1 15 9\n"}, {"type": "stdin_stdout", "input": "2\n2\n1 -1\n3\n10 0 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nРодители Васи хотят, чтобы он как можно лучше учился. Поэтому если он получает подряд три положительные оценки («четвёрки» или «пятёрки»), они дарят ему подарок. Соответственно, оценки «единица», «двойка» и «тройка» родит...
[{"type": "stdin_stdout", "input": "250\n4 4 2 5 1 5 5 4 5 4 4 4 4 4 4 5 5 4 4 5 4 5 1 5 5 4 1 5 5 4 5 5 4 4 4 4 5 4 4 5 5 5 5 5 4 5 4 5 5 4 5 4 4 4 4 4 4 5 5 4 5 5 1 4 4 4 5 1 5 3 4 5 4 4 4 4 4 5 5 4 4 4 4 4 5 4 5 5 5 4 4 5 4 4 4 5 5 5 5 4 5 4 5 4 5 5 5 5 4 4 4 4 5 5 5 5 5 5 4 4 3 4 4 5 5 3 5 4 4 4 4 4 4 5 5 5 4 5 4 4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given string S and T consisting of lowercase English letters.\nDetermine if S equals T after rotation.\nThat is, determine if S equals T after the following operation is performed some number of times:\nOperation:...
[{"type": "stdin_stdout", "input": "pgykichjtpukfnlxfcevkjezqsmeycanjlbessrfazdprcomdpjimsfbuslksyveergcgmonctcsvypolplcgsqyfkilrixodiwq\nfnlxfcevkjezqsmeycanjlbessrfazdprcomdpjimsfbuslksyveergcgmonctcsvypolplcgsqyfkilrixodiwqpgykichjtpuk\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "aaaaaaaaaaaaaaaaaaaaaa...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya goes to visit his classmate Petya. Vasya knows that Petya's apartment number is $n$. \n\nThere is only one entrance in Petya's house and the distribution of apartments is the following: the first floor contains $2$ ...
[{"type": "stdin_stdout", "input": "7\n7 3\n1 3\n18 6\n1865 4\n12 2\n2 10\n22 5\n", "output": "3\n1\n4\n467\n6\n1\n5\n"}, {"type": "stdin_stdout", "input": "7\n7 3\n1 3\n18 6\n987 4\n12 2\n2 10\n22 12\n", "output": "3\n1\n4\n248\n6\n1\n3\n"}, {"type": "stdin_stdout", "input": "7\n7 3\n1 3\n18 6\n1865 4\n12 2\n4 10\n22 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's call two strings s and t anagrams of each other if it is possible to rearrange symbols in the string s to get a string, equal to t.\n\nLet's consider two strings s and t which are anagrams of each other. We say that...
[{"type": "stdin_stdout", "input": "aabbbbbbc\n6\n1 1\n2 4\n2 2\n1 9\n5 7\n3 5\n", "output": "YES\nYES\nYES\nYES\nNO\nNO\n"}, {"type": "stdin_stdout", "input": "aabbbbbbc\n6\n1 1\n2 4\n2 2\n1 9\n5 7\n3 8\n", "output": "YES\nYES\nYES\nYES\nNO\nNO\n"}, {"type": "stdin_stdout", "input": "aabbbbbbc\n6\n1 1\n2 7\n2 2\n1 9\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWhile walking down the street Vanya saw a label \"Hide&Seek\". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some str...
[{"type": "stdin_stdout", "input": "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_0123456789ABCDEFGHIJKLMNOPQR...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLately, a national version of a bingo game has become very popular in Berland. There are n players playing the game, each player has a card with numbers. The numbers on each card are distinct, but distinct cards can have ...
[{"type": "stdin_stdout", "input": "40\n2 12 19\n4 10 7 1 3\n2 15 17\n1 6\n3 17 8 20\n4 8 16 11 18\n2 2 7\n4 12 13 8 7\n3 6 1 15\n3 19 11 13\n1 2\n2 16 14\n5 1 17 8 9 5\n1 2\n3 15 17 12\n4 20 4 19 18\n1 10\n4 12 1 17 16\n4 5 10 8 11\n1 10\n1 13\n1 17\n2 19 18\n1 3\n2 6 20\n1 8\n2 3 14\n3 17 3 1\n2 4 3\n1 12\n1 15\n1 2\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nInitially, you have the array $a$ consisting of one element $1$ ($a = [1]$).\n\nIn one move, you can do one of the following things:\n\n Increase some (single) element of $a$ by $1$ (choose some $i$ from $1$ to the curre...
[{"type": "stdin_stdout", "input": "5\n1\n13\n42\n2538\n1000000000\n", "output": "0\n6\n11\n99\n63244\n"}, {"type": "stdin_stdout", "input": "5\n1\n10\n143\n255\n1000000000\n", "output": "0\n5\n22\n30\n63244\n"}, {"type": "stdin_stdout", "input": "5\n1\n13\n143\n751\n1000001000\n", "output": "0\n6\n22\n53\n63244\n"}, {...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDaisy is a senior software engineer at RainyDay, LLC. She has just implemented three new features in their product: the first feature makes their product work, the second one makes their product fast, and the third one ma...
[{"type": "stdin_stdout", "input": "16\n1 1 1\n1 1 0\n1 1 0\n1 1 0\n1 1 0\n1 0 1\n1 0 1\n1 0 1\n1 0 1\n0 1 1\n0 1 1\n0 1 1\n0 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n0 0 0\n1 0 0\n0 1 0\n1 1 0\n0 0 0\n1 0 0\n0 0 1\n1 0 1\n0 0 0\n0 1 0\n0 0 1\n0 1 1\n1 0 0\n0 1 0\n0 0 1\n", "output": "Possible\n1 0 1 1 1 0 1 1 1 0 1 1 1 1 1 1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLolek and Bolek are about to travel abroad by plane. The local airport has a special \"Choose Your Plane\" offer. The offer's conditions are as follows:\n\n * it is up to a passenger to choose a plane to fly on; \n * if...
[{"type": "stdin_stdout", "input": "510 132\n50 76 77 69 94 30 47 65 14 62 18 121 26 35 49 17 105 93 47 16 78 3 7 74 7 37 30 36 30 83 121 113 7 58 86 10 65 57 34 102 55 44 43 47 106 44 115 75 109 70 47 45 16 57 62 55 20 88 74 40 45 84 41 1 9 53 65 25 67 31 115 2 63 51 123 70 65 65 18 14 75 14 103 26 117 105 36 104 81 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAmugae is in a very large round corridor. The corridor consists of two areas. The inner area is equally divided by $n$ sectors, and the outer area is equally divided by $m$ sectors. A wall exists between each pair of sect...
[{"type": "stdin_stdout", "input": "1 1 10\n1 1 1 1\n1 1 1 1\n1 1 2 1\n1 1 1 1\n2 1 2 1\n2 1 1 1\n1 1 2 1\n1 1 2 1\n2 1 1 1\n2 1 1 1\n", "output": "YES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "1 1 10\n1 1 1 1\n1 1 1 1\n1 1 2 1\n1 1 1 1\n2 1 2 1\n2 1 1 1\n1 1 2 1\n1 1 2 1\n2 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIvan has number $b$. He is sorting through the numbers $a$ from $1$ to $10^{18}$, and for every $a$ writes $\\frac{[a, \\,\\, b]}{a}$ on blackboard. Here $[a, \\,\\, b]$ stands for least common multiple of $a$ and $b$. Iv...
[{"type": "stdin_stdout", "input": "2793510720\n", "output": "1792\n"}, {"type": "stdin_stdout", "input": "1102701600\n", "output": "1440\n"}, {"type": "stdin_stdout", "input": "2327925600\n", "output": "1728\n"}, {"type": "stdin_stdout", "input": "2095133040\n", "output": "1600\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nJack is working on his jumping skills recently. Currently he's located at point zero of the number line. He would like to get to the point x. In order to train, he has decided that he'll first jump by only one unit, and e...
[{"type": "stdin_stdout", "input": "-1000000000\n", "output": "44723\n"}, {"type": "stdin_stdout", "input": "-1028109475\n", "output": "45346\n"}, {"type": "stdin_stdout", "input": "-1050321888\n", "output": "45835\n"}, {"type": "stdin_stdout", "input": "-245245154\n", "output": "22147\n"}, {"type": "stdin_stdout", "in...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTax Rate Changed\n\nVAT (value-added tax) is a tax imposed at a certain rate proportional to the sale price.\n\nOur store uses the following rules to calculate the after-tax prices.\n\n* When the VAT rate is x%, for an it...
[{"type": "stdin_stdout", "input": "5 8 105\n8 5 105\n1 2 24\n99 98 24\n12 13 26\n1 22 23\n1 19 201\n13 16 112\n2 24 50\n1 82 61\n1 84 125\n1 99 999\n99 1 3106\n98 99 999\n1 99 11\n99 2 12\n0 0 0", "output": "109\n103\n24\n24\n26\n27\n237\n116\n62\n111\n230\n1972\n1576\n1004\n20\n7\n"}, {"type": "stdin_stdout", "input"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDuring the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.\n\nIt's too hard to learn to solve Rubik's cube instantly, s...
[{"type": "stdin_stdout", "input": "2 6 3 3 5 5 2 6 1 1 12 4 4 4 2 4 6 5 3 1 2 5 3 1\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "5 2 6 1 5 3 5 3 1 1 3 6 6 2 4 2 5 4 4 2 1 3 4 10\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "2 6 3 3 5 5 2 6 2 1 12 4 4 4 2 4 6 5 3 1 2 5 3 1\n", "output": "NO\n"}...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOm Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all. [Image] ...
[{"type": "stdin_stdout", "input": "2 100 59\n....................................................................................................\n.DR.D..DLLR.LDRR..L.LDRRRDLD.LDRR.LLR.R...DRLD.RRLL.L.D..R.LD.DL....LR.LR.DRLD.....L.D..RD...D.LL.R.\n", "output": "0 0 0 1 0 0 0 1 1 0 0 2 0 0 0 1 1 1 0 1 0 0 0 1 1 2 0 0 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nGiven the sequence $ A $ of length $ N $. Find the maximum value of $ \\ sum B_i $, where $ B $ is one of the longest increasing subsequences of the sequence $ A $.\n\nThe longest increasing subsequence of the ...
[{"type": "stdin_stdout", "input": "4\n14 15 0 10", "output": "29\n"}, {"type": "stdin_stdout", "input": "4\n17 19 0 20", "output": "56\n"}, {"type": "stdin_stdout", "input": "4\n12 23 0 10", "output": "35\n"}, {"type": "stdin_stdout", "input": "4\n14 8 0 10", "output": "18\n"}, {"type": "stdin_stdout", "input": "4\n7 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have a set S of N points in a two-dimensional plane. The coordinates of the i-th point are (x_i, y_i). The N points have distinct x-coordinates and distinct y-coordinates.\nFor a non-empty subset T of S, let f(T) be th...
[{"type": "stdin_stdout", "input": "10\n19 -11\n-3 -12\n5 3\n3 -15\n8 -14\n-9 -20\n10 -9\n0 2\n-7 17\n6 -6\n", "output": "7222\n"}, {"type": "stdin_stdout", "input": "10\n19 -11\n-3 -12\n5 3\n3 -15\n13 -14\n-9 -20\n10 -9\n0 2\n-7 17\n6 -6", "output": "7246"}, {"type": "stdin_stdout", "input": "10\n19 -11\n-3 -12\n5 3\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA bitstring is a string consisting only of the characters 0 and 1. A bitstring is called k-balanced if every substring of size k of this bitstring has an equal amount of 0 and 1 characters (k/2 of each).\n\nYou are given ...
[{"type": "stdin_stdout", "input": "9\n6 4\n100110\n3 2\n1?1\n3 2\n1?0\n4 4\n????\n7 4\n1?0??1?\n10 10\n11??11??11\n4 4\n1??1\n4 4\n?0?0\n6 2\n????00\n", "output": "YES\nYES\nNO\nYES\nYES\nNO\nYES\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "9\n6 4\n100110\n3 2\n1?1\n3 2\n0?1\n4 4\n????\n7 4\n1?0??1?\n10 10\n11???1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe little girl loves the problems on array queries very much.\n\nOne day she came across a rather well-known problem: you've got an array of n elements (the elements of the array are indexed starting from 1); also, there...
[{"type": "stdin_stdout", "input": "31 48\n45 19 16 42 38 18 50 7 28 40 39 25 45 14 36 18 27 30 16 4 22 6 1 23 16 47 14 35 27 47 2\n6 16\n11 28\n4 30\n25 26\n11 30\n5 9\n4 17\n15 17\n10 25\n15 26\n1 3\n9 26\n8 29\n16 30\n3 24\n27 30\n9 10\n22 29\n2 6\n15 24\n6 21\n19 21\n4 28\n1 7\n18 21\n10 22\n6 15\n14 28\n4 19\n12 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have a sequence of N integers: A_1, A_2, \\cdots, A_N.\nYou can perform the following operation between 0 and K times (inclusive):\n - Choose two integers i and j such that i \\neq j, each between 1 and N (inclusive). ...
[{"type": "stdin_stdout", "input": "500 1000000000\n1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c of the prisoners to a prison located in another city.\n\nFor this reason, he made the n prison...
[{"type": "stdin_stdout", "input": "57 3 9\n4 5 2 7 12 1 1 3 2 9 4 9 0 6 12 5 -1 6 11 1 0 0 -1 3 1 0 5 1 0 31 8 8 0 1 7 3 1 13 4 4 5 1 4 -2 1 7 1 1 1 4 5 1 24 5 1 9 6\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "57 3 9\n4 5 2 7 12 1 1 0 2 9 4 9 0 6 12 5 -1 6 11 1 0 0 -1 3 1 0 5 1 0 31 8 8 0 1 7 3 1 13 4 4 5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn \"Takahashi-ya\", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions).\nA customer ordered a bowl of ramen and told w...
[{"type": "stdin_stdout", "input": "ooo\n", "output": "1000\n"}, {"type": "stdin_stdout", "input": "oxo\n", "output": "900\n"}, {"type": "stdin_stdout", "input": "xxx\n", "output": "700\n"}, {"type": "stdin_stdout", "input": "pxo", "output": "800\n"}, {"type": "stdin_stdout", "input": "yxx", "output": "700\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nI decided to plant vegetables in the vegetable garden. There were n seeds, so I sown n seeds one by one a day over n days. All seeds sprout and grow quickly. I can't wait for the harvest time.\n\nOne day, when I was water...
[{"type": "stdin_stdout", "input": "5\n1 2 3 11 4 5\n6\n1 3 6 9 12 15 18\n4\n5 7 9 11 12\n0", "output": "11\n1\n12\n"}, {"type": "stdin_stdout", "input": "5\n1 2 3 14 4 5\n6\n1 3 6 9 12 15 18\n4\n5 7 9 11 12\n0", "output": "14\n1\n12\n"}, {"type": "stdin_stdout", "input": "5\n1 2 3 25 4 5\n6\n1 3 6 9 12 15 18\n4\n5 7 9...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe main city magazine offers its readers an opportunity to publish their ads. The format of the ad should be like this:\n\nThere are space-separated non-empty words of lowercase and uppercase Latin letters.\n\nThere are ...
[{"type": "stdin_stdout", "input": "2\nWjrWBWqKIeSndDHeiVmfChQNsoUiRQHVplnIWkwBtxAJhOdTigAAzKtbNEqcgvbWHOopfCNgWHfwXyzSCfNqGMLnmlIdKQonLsmGSJlPBcYfHNJJDGlKNnOGtrWUhaTWuilHWMUlFEzbJYbeAWvgnSOOOPLxX-eJEKRsKqSnMjrPbFDprCqgbTfwAnPjFapVKiTjCcWEzhahwPRHScfcLnUixnxckQJzuHzshyBFKPwVGzHeJWniiRKynDFQdaazmTZtDGnFVTmTUZCRCpUHFmUHA...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's consider a table consisting of n rows and n columns. The cell located at the intersection of i-th row and j-th column contains number i × j. The rows and columns are numbered starting from 1.\n\nYou are given a posi...
[{"type": "stdin_stdout", "input": "100000 1000000000\n", "output": "16\n"}, {"type": "stdin_stdout", "input": "100000 183783600\n", "output": "438\n"}, {"type": "stdin_stdout", "input": "100000 551350800\n", "output": "392\n"}, {"type": "stdin_stdout", "input": "100000 479001600\n", "output": "254\n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasily has a deck of cards consisting of n cards. There is an integer on each of the cards, this integer is between 1 and 100 000, inclusive. It is possible that some cards have the same integers on them.\n\nVasily decide...
[{"type": "stdin_stdout", "input": "100\n12 9 97 55 14 8 55 34 35 67 3 18 73 92 41 49 15 60 18 66 9 26 97 47 43 88 71 97 19 63 48 96 79 53 8 47 69 49 21 23 77 12 21 176 66 9 29 13 61 69 54 77 10 13 4 68 37 74 7 6 29 76 55 72 89 4 78 27 29 82 18 83 12 4 32 69 89 85 66 13 92 54 38 5 26 56 17 55 29 4 17 39 29 94 3 67 85 7...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecall that MEX of an array is a minimum non-negative integer that does not belong to the array. Examples: for the array $[0, 0, 1, 0, 2]$ MEX equals to $3$ because numbers $0, 1$ and $2$ are presented in the array and $...
[{"type": "stdin_stdout", "input": "7 3\n0\n1\n2\n2\n0\n0\n10\n", "output": "1\n2\n3\n3\n4\n4\n7\n"}, {"type": "stdin_stdout", "input": "7 5\n0\n1\n2\n2\n0\n0\n10\n", "output": "1\n2\n3\n3\n3\n3\n3\n"}, {"type": "stdin_stdout", "input": "7 3\n0\n1\n2\n2\n0\n0\n10\n", "output": "1\n2\n3\n3\n4\n4\n7\n"}, {"type": "stdin_...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFriends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at a_1 percent and second one is charged at a_2 percent. You can connect charger to a joystick ...
[{"type": "stdin_stdout", "input": "100 100\n", "output": "197\n"}, {"type": "stdin_stdout", "input": "100 100\n", "output": "197\n"}, {"type": "stdin_stdout", "input": "100 25\n", "output": "122\n"}, {"type": "stdin_stdout", "input": "100 25\n", "output": "122\n"}, {"type": "stdin_stdout", "input": "100 26\n", "output...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently Polycarpus has learned the \"bitwise AND\" operation (which is also called \"AND\") of non-negative integers. Now he wants to demonstrate the school IT teacher his superb manipulation with the learned operation.\...
[{"type": "stdin_stdout", "input": "7\n-1 1000000000 999999488 999999488 1000000000 1000000000 999999488\n1000000000 -1 999999488 999999488 1000000000 1000000000 999999488\n999999488 999999488 -1 999999999 999999488 999999488 999999999\n999999488 999999488 999999999 -1 999999488 999999488 999999999\n1000000000 10000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\n-----Constraints-----\n - S and T are strings consisti...
[{"type": "stdin_stdout", "input": "oekdkfjdjgjknbfkwnfnhaoekdkfjdjgjknbfkwnfnhahjekkengkfoekdkfjdjgjknbfkwnfnhaoekdkfjdjgjknbfkwnfnhahj yowkymbmhkkgjjeokdlakbndkkworqotkfnblgpnkkrogjrfnvmbjisnbkzvmbnrrrigeoibgpefjobvmovpqosqoqrgrkengrlk\n", "output": "yowkymbmhkkgjjeokdlakbndkkworqotkfnblgpnkkrogjrfnvmbjisnbkzvmbnrrri...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCreatnx has $n$ mirrors, numbered from $1$ to $n$. Every day, Creatnx asks exactly one mirror \"Am I beautiful?\". The $i$-th mirror will tell Creatnx that he is beautiful with probability $\\frac{p_i}{100}$ for all $1 \\...
[{"type": "stdin_stdout", "input": "100\n60 79 48 35 18 24 87 1 44 65 60 78 11 43 71 79 90 6 94 49 22 91 58 93 55 21 22 31 7 15 17 65 76 9 100 89 50 96 14 38 27 87 29 93 54 12 99 35 27 51 36 44 6 26 91 1 53 8 49 63 18 4 31 55 95 15 77 1 16 98 75 26 26 43 2 11 18 70 3 65 11 74 64 69 26 54 9 51 25 82 98 12 90 75 19 23 78...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nImagine that your city is an infinite 2D plane with Cartesian coordinate system. The only crime-affected road of your city is the x-axis. Currently, there are n criminals along the road. No police station has been built o...
[{"type": "stdin_stdout", "input": "44 37298\n-100 -100 -98 -93 -92 -91 -91 -89 -87 -86 -84 -80 -79 -76 -71 -70 -58 -53 -52 -52 -49 -48 -45 -45 -40 -39 -37 -35 -31 -30 -30 -29 -29 -28 -22 -22 -21 -11 -8 -7 -7 -6 -1 0\n", "output": "200\n"}, {"type": "stdin_stdout", "input": "45 45\n-95 -94 -92 -83 -83 -76 -75 -74 -71 -...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became interested what is the minimum jump ability he should have in order to be able to reach the far end of the stri...
[{"type": "stdin_stdout", "input": "VRPHBNWNWVWBWMFJJDCTJQJDJBKSJRZLVQRVVFLTZFSGCGDXCWQVWWWMFVCQHPKXXVRKTGWGPSMQTPKNDQJHNSKLXPCXDJDQDZZD\n", "output": "101\n"}, {"type": "stdin_stdout", "input": "DZZDQDJDXCPXLKSNHJQDNKPTQMSPGWGTKRVXXKPHQCVFMWWWVQWCXDGCGSFZTLFVVRQVLZRJSKBJDJQJTCDJJFMWBWVWNWNBHPRV\n", "output": "101\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSnuke has one biscuit and zero Japanese yen (the currency) in his pocket. He will perform the following operations exactly K times in total, in the order he likes:\n\n* Hit his pocket, which magically increases the number...
[{"type": "stdin_stdout", "input": "314159265 35897932 384626433", "output": "48518828981938099"}, {"type": "stdin_stdout", "input": "407766107 9307229 14836778", "output": "1101648954500241\n"}, {"type": "stdin_stdout", "input": "407766107 9307229 25447105", "output": "3215538450316794\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have a sequence of length N, a = (a_1, a_2, ..., a_N).\nEach a_i is a positive integer.\nSnuke's objective is to permute the element in a so that the following condition is satisfied:\n - For each 1 ≤ i ≤ N - 1, the pr...
[{"type": "stdin_stdout", "input": "6\n2 7 1 8 2 8\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "6\n4 7 0 -1 6 4", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "6\n2 7 2 12 2 8", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "6\n4 7 2 8 2 10", "output": "Yes\n"}, {"type": "stdin_stdout", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFind the number of integers between 1 and N (inclusive) that contains exactly K non-zero digits when written in base ten.\n\n-----Constraints-----\n - 1 \\leq N < 10^{100}\n - 1 \\leq K \\leq 3\n\n-----Input-----\nInput i...
[{"type": "stdin_stdout", "input": "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\n3\n", "output": "117879300\n"}, {"type": "stdin_stdout", "input": "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\n3", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nπ (spelled pi in English) is a mathematical constant representing the circumference of a circle whose di- ameter is one unit length. The name π is said to come from the first letter of the Greek words περιφέρεια (meaning ...
[{"type": "stdin_stdout", "input": "1.1386381399168386\n0.08430864816896695\n0.0", "output": "3/1\n16/5\n"}, {"type": "stdin_stdout", "input": "0.5656950408067312\n0.06616503278329884\n0.0", "output": "3/1\n16/5\n"}, {"type": "stdin_stdout", "input": "0.9300839575225542\n0.09342351193849237\n0.0", "output": "3/1\n16/5\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nJack has become a soldier now. Unfortunately, he has trouble with the drill. Instead of marching beginning with the left foot and then changing legs with each step, as ordered, he keeps repeating a sequence of steps, in w...
[{"type": "stdin_stdout", "input": "RXLLRXXLLRLRLLXXXXRXXRLLRRRRXLLRRLXXLRXXLXLRLLLLLRXLRXLXRXLXLRRXXRRLXLXLRLRXRXLXXXLRXLLXLRRRRXRLLXRRLLRRXRRRLRLLRLRXXXRLXLXLLLRXXLLXLRXXLLLRLXRRXRLXLXXXXXXLXRXXRXXXRXLXXRRXLLXRRXLXXRRXLXXRLXLXXLXRXXRLRLLXLXLXLRXLXLXLLLRLXXLXLLRLLLLRLRRRRXRRLLRLXLXXRLRRLXRRXXXRLLXRRRXXRRRXXLRXRLLXRRRX...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGreg the Dwarf has been really busy recently with excavations by the Neverland Mountain. However for the well-known reasons (as you probably remember he is a very unusual dwarf and he cannot stand sunlight) Greg can only ...
[{"type": "stdin_stdout", "input": "1000 1000\n-20.534295190826231 133.273184243935670 865.154166109953510\n-711.474516721095600 -638.507879949720520 44.024947657417599\n", "output": "1355.67674395639642\n"}, {"type": "stdin_stdout", "input": "1000 1000\n-865.729850457726000 -306.217565767793640 81.709538567284440\n891...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA sequence $a_1, a_2, \\dots, a_n$ is called good if, for each element $a_i$, there exists an element $a_j$ ($i \\ne j$) such that $a_i+a_j$ is a power of two (that is, $2^d$ for some non-negative integer $d$).\n\nFor exa...
[{"type": "stdin_stdout", "input": "10\n3 10 14 1 10 12 5 16 5 2\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "10\n3 10 14 1 10 8 5 16 5 2\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "10\n3 10 9 1 10 8 5 16 5 2\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "10\n2 10 9 1 10 4 7 8 5 4\n",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe mayor of Amida, the City of Miracle, is not elected like any other city. Once exhausted by long political struggles and catastrophes, the city has decided to leave the fate of all candidates to the lottery in order to...
[{"type": "stdin_stdout", "input": "4 3 1\n3 1 2\n0 1 3\n4 3 4\n1 0 1\n0 0 0", "output": "2\n1\n"}, {"type": "stdin_stdout", "input": "4 3 1\n3 1 1\n0 1 3\n4 3 4\n1 0 1\n0 0 0", "output": "3\n1\n"}, {"type": "stdin_stdout", "input": "6 4 1\n3 -1 2\n2 2 3\n3 3 4\n0 2 4\n0 0 0", "output": "1\n"}, {"type": "stdin_stdout",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGerald plays the following game. He has a checkered field of size n × n cells, where m various cells are banned. Before the game, he has to put a few chips on some border (but not corner) board cells. Then for n - 1 minut...
[{"type": "stdin_stdout", "input": "14 5\n4 2\n5 4\n3 3\n2 3\n1 2\n", "output": "17\n"}, {"type": "stdin_stdout", "input": "14 5\n4 2\n3 8\n3 3\n2 3\n1 2\n", "output": "18\n"}, {"type": "stdin_stdout", "input": "14 5\n4 2\n5 4\n3 3\n2 3\n1 1\n", "output": "17\n"}, {"type": "stdin_stdout", "input": "14 5\n4 2\n9 4\n3 3\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDr. Asimov, a robotics researcher, released cleaning robots he developed (see Problem B). His robots soon became very popular and he got much income. Now he is pretty rich. Wonderful.\n\nFirst, he renovated his house. Onc...
[{"type": "stdin_stdout", "input": "34 1\n1 6\n2 6\n0 0", "output": "..................................\n.EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE.\n.E..............................E.\n.E.EEEEEEEEEEEEEEEEEEEEEEEEEEEE.E.\n.E.E..........................E.E.\n.E.E.EEEEEEEEEEEEEEEEEEEEEEEE.E.E.\n.E.E.E......................E.E.E.\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he decided to go with just two commands: cd (change the current directory) and pwd (display the current ...
[{"type": "stdin_stdout", "input": "11\npwd\ncd /home/vasya\npwd\ncd ..\npwd\ncd vasya/../../petya\npwd\ncd /a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a\npwd\ncd ..\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an undirected connected weighted graph with N vertices and M edges that contains neither self-loops nor double edges.\n\nThe i-th (1≤i≤M) edge connects vertex a_i and vertex b_i with a distance of c_i.\n\nHe...
[{"type": "stdin_stdout", "input": "100 1000\n1 2 1\n1 3 1\n1 4 1\n1 5 1\n1 6 1\n1 7 1\n1 8 1\n1 9 1\n1 10 1\n1 11 1\n1 12 1\n1 13 1\n1 14 1\n1 15 1\n1 16 1\n1 17 1\n1 18 1\n1 19 1\n1 20 1\n1 21 1\n1 22 1\n1 23 1\n1 24 1\n1 25 1\n1 26 1\n1 27 1\n1 28 1\n1 29 1\n1 30 1\n1 31 1\n1 32 1\n1 33 1\n1 34 1\n1 35 1\n1 36 1\n1 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIvan is collecting coins. There are only $N$ different collectible coins, Ivan has $K$ of them. He will be celebrating his birthday soon, so all his $M$ freinds decided to gift him coins. They all agreed to three terms: ...
[{"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000 1000010000000000000 1000000000000000000\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "10000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA film festival is coming up in the city N. The festival will last for exactly n days and each day will have a premiere of exactly one film. Each film has a genre — an integer from 1 to k.\n\nOn the i-th day the festival ...
[{"type": "stdin_stdout", "input": "129 37\n15 22 28 15 30 16 11 20 4 26 14 37 29 17 15 15 14 18 1 9 16 22 13 32 5 18 25 11 6 33 33 22 17 9 1 5 27 27 37 4 6 1 3 18 17 33 6 17 2 24 23 1 1 37 35 21 21 17 18 6 31 17 29 18 10 10 30 31 8 3 25 20 34 11 12 12 24 13 5 27 20 31 28 1 36 2 4 13 14 9 33 25 4 26 36 6 2 7 15 9 20 33...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKefa wants to celebrate his first big salary by going to restaurant. However, he needs company. \n\nKefa has n friends, each friend will agree to go to the restaurant if Kefa asks. Each friend is characterized by the amou...
[{"type": "stdin_stdout", "input": "15 1234\n2738 322313356\n1160 970909702\n2594 902749351\n3126 324754476\n3151 177963947\n3424 396145897\n5578 737768323\n3423 687640543\n381 848813098\n1058 197211286\n936 650181776\n1025 776492538\n3598 142176544\n3595 680519527\n1191 32199940\n", "output": "3634263641\n"}, {"type":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA little boy Laurenty has been playing his favourite game Nota for quite a while and is now very hungry. The boy wants to make sausage and cheese sandwiches, but first, he needs to buy a sausage and some cheese.\n\nThe to...
[{"type": "stdin_stdout", "input": "50\n31 80 40 85 12 38 30 97 51 18 45 81 56 82 91 94 95 13 26 93 98 35 44 69 98 39 83 77 38 68 13 71 80 41 21 80 81 17 88 46 61 67 65 49 29 55 37 74 88\n71 8 42 74 14 70 100 96 25 56 95 38 41 88 45 43 46 16 55 77 100 68 51 30 73 51 25 88 64 26 22 50 4 57 88 85 45 32 11 96 94 19 9 12 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMaria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus.\n\nShe has $n$ friends who are also grannies (Maria is not included in this num...
[{"type": "stdin_stdout", "input": "4\n5\n1 1 0 2 1\n6\n2 3 4 4 12 7\n6\n2 5 4 5 0 11\n5\n1 2 1 5 6\n", "output": "6\n5\n6\n4\n"}, {"type": "stdin_stdout", "input": "4\n5\n1 1 2 2 1\n6\n2 3 4 4 6 7\n6\n2 5 4 5 0 11\n5\n1 2 1 5 6\n", "output": "6\n5\n6\n4\n"}, {"type": "stdin_stdout", "input": "4\n5\n2 0 2 2 -1\n6\n2 3 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou like the card board game \"Set\". Each card contains $k$ features, each of which is equal to a value from the set $\\{0, 1, 2\\}$. The deck contains all possible variants of cards, that is, there are $3^k$ different c...
[{"type": "stdin_stdout", "input": "37 5\n0 2 0 1 0\n2 2 0 2 2\n2 0 2 0 0\n2 2 2 2 2\n1 2 0 0 2\n0 1 1 1 2\n0 2 0 2 2\n0 0 1 2 2\n2 0 0 1 0\n0 2 2 2 1\n0 2 2 2 0\n2 0 2 2 1\n0 0 2 0 1\n2 1 1 1 2\n1 2 0 1 0\n1 0 1 0 1\n1 2 1 0 0\n1 2 2 2 2\n2 2 1 2 1\n1 0 2 1 2\n2 1 1 2 1\n0 1 0 2 2\n1 0 1 1 1\n0 0 1 0 2\n0 1 0 0 1\n2 0...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis Christmas Santa gave Masha a magic picture and a pencil. The picture consists of n points connected by m segments (they might cross in any way, that doesn't matter). No two segments connect the same pair of points, a...
[{"type": "stdin_stdout", "input": "100 50\n66 3\n92 79\n9 44\n84 45\n30 63\n30 20\n33 86\n8 83\n40 75\n7 36\n91 4\n76 88\n77 76\n28 27\n6 52\n41 57\n8 23\n34 75\n50 15\n86 68\n36 98\n30 84\n37 62\n22 4\n6 45\n72 80\n98 74\n78 84\n1 54\n99 27\n84 91\n78 7\n80 61\n67 48\n51 52\n36 72\n97 87\n25 17\n20 80\n20 39\n72 5\n2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two positive integers $n$ and $s$. Find the maximum possible median of an array of $n$ non-negative integers (not necessarily distinct), such that the sum of its elements is equal to $s$.\n\nA median of an a...
[{"type": "stdin_stdout", "input": "8\n1 1\n1 10\n3 5\n2 2\n14 33\n4 23\n1 1010001000\n1000100000 1\n", "output": "1\n10\n2\n1\n4\n7\n1010001000\n0\n"}, {"type": "stdin_stdout", "input": "8\n1 1\n1 10\n3 5\n2 1\n14 33\n4 23\n1 1010001000\n1000100000 1\n", "output": "1\n10\n2\n0\n4\n7\n1010001000\n0\n"}, {"type": "stdin...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAn n × n square matrix is special, if: it is binary, that is, each cell contains either a 0, or a 1; the number of ones in each row and column equals 2. \n\nYou are given n and the first m rows of the matrix. Print the ...
[{"type": "stdin_stdout", "input": "7 4 100501\n0100010\n0000101\n0100100\n0000011\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "7 4 100501\n0100010\n0000101\n0100100\n0000011\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "6 4 100501\n100010\n100100\n010100\n000011\n", "output": "2\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTwo integer sequences existed initially, one of them was strictly increasing, and another one — strictly decreasing.\n\nStrictly increasing sequence is a sequence of integers $[x_1 < x_2 < \\dots < x_k]$. And strictly dec...
[{"type": "stdin_stdout", "input": "12\n12 8 1 3 7 5 9 6 4 10 11 2\n", "output": "YES\n1 1 0 0 1 0 0 1 1 0 0 1 \n"}, {"type": "stdin_stdout", "input": "12\n12 8 1 3 7 5 9 6 4 10 11 2\n", "output": "YES\n1 1 0 0 1 0 0 1 1 0 0 1 \n"}, {"type": "stdin_stdout", "input": "12\n12 10 1 3 7 5 9 6 4 10 11 2\n", "output": "YES\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMaxim always goes to the supermarket on Sundays. Today the supermarket has a special offer of discount systems.\n\nThere are m types of discounts. We assume that the discounts are indexed from 1 to m. To use the discount ...
[{"type": "stdin_stdout", "input": "48\n14 2 5 3 10 10 5 6 14 8 19 13 4 4 3 13 18 19 9 16 3 1 14 9 13 10 13 4 12 11 8 2 18 20 14 11 3 11 18 11 4 2 7 2 18 19 2 8\n70\n9497 5103 1001 2399 5701 4053 3557 8481 1736 4139 5829 1107 6461 4089 5936 7961 6017 1416 1191 4635 4288 5605 8857 1822 71 1435 2837 5523 6993 2404 2840 8...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou're given an integer N. Write a program to calculate the sum of all the digits of N. \n\n-----Input-----\n\nThe first line contains an integer T, the total number of testcases. Then follow T lines, each line contains a...
[{"type": "stdin_stdout", "input": "3 \n36926\n147301\n1688", "output": "26\n16\n23\n"}, {"type": "stdin_stdout", "input": "3 \n36926\n168223\n1688", "output": "26\n22\n23\n"}, {"type": "stdin_stdout", "input": "3 \n36926\n168223\n2811", "output": "26\n22\n12\n"}, {"type": "stdin_stdout", "input": "3 \n17364\n141737\n8...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.\n\nMerlin, the wizard predicted to King Arthur that the next month will turn out to b...
[{"type": "stdin_stdout", "input": "113\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n", "output": "YES\n"}, {"type": "stdin_stdout", "inp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNash designed an interesting yet simple board game where a player is simply required to follow instructions written on the cell where the player currently stands. \n\nThis board game is played on the n× n board. Rows and ...
[{"type": "stdin_stdout", "input": "10\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1\n-1 -1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 -1 -1\n-1 -1 -1 -1 3 3 3 4 3 5 3 6 3 7 3 8 -1 -1 -1 -1\n-1 -1 4 2 4 3 4 4 4 5 4 6 4 7 4 8 -1 -1 -1 -1\n-1 -1 5 2 5 3 5 3 5 5 5 6 5 7 5 9 5 9 -1 -1\n-1 -1 6 2 6 3 6 5 6 5 6 6 6 7 6 8...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string $s$ of length $n$ consisting of lowercase Latin letters. You may apply some operations to this string: in one operation you can delete some contiguous substring of this string, if all letters in the...
[{"type": "stdin_stdout", "input": "500\nbbababaabaabaabbbbbbaabbabbabbaabababababbbbabaaabbbbaaabbbbbbbabababaaaaabbbbabaababbababbaaaaaabbaaabbaabaaababbbbbabbaabaabaabbbaaabaabbaaabbaabababbaaabaaabaaaaabbbababaabbbbabbbbbababbbaabaabbabaabbabbababbbbbaababbaabbbbbbbbaabbabbbabababaaaaaaaaaabababaaabbaabbbabbabbbbab...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day Greg and his friends were walking in the forest. Overall there were n people walking, including Greg. Soon he found himself in front of a river. The guys immediately decided to get across the river. Luckily, there...
[{"type": "stdin_stdout", "input": "50 207\n50 100 100 100 100 50 100 100 100 50 100 100 100 50 100 100 50 100 50 100 50 100 100 100 50 100 50 50 100 50 100 100 50 100 100 100 100 50 100 100 100 100 50 50 50 100 100 50 100 100\n", "output": "55\n833060250"}, {"type": "stdin_stdout", "input": "50 125\n50 50 50 100 100 5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a rooted tree of $2^n - 1$ vertices. Every vertex of this tree has either $0$ children, or $2$ children. All leaves of this tree have the same distance from the root, and for every non-leaf vertex, one of it...
[{"type": "stdin_stdout", "input": "8\nABBBAAABBBAABABAAAABAABAABBABABBABABBBBBAABBAABBBAABBBBAAABBABAABBBBBAAABBABAABAABBBBBAABBBABAAAAAAABBAAABBAABBABABABABBAABBAAABBBBBAAAABBBBAAAABAABABAABBBAABBBAABBAAABBABAABAAABBBAAAABBAAABABBBABAAAAABBABBABAABBBBBAAABBBBBBAABABBAAABBABBABABAAABBABBABABA\n", "output": "479173089\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nJohnny has just found the new, great tutorial: \"How to become a grandmaster?\". The tutorial tells many strange and unexpected for Johnny things, such as you have to be patient or that very important is solving many hard...
[{"type": "stdin_stdout", "input": "1\n71 4\n100 99 98 97 96 95 94 93 92 91 90 87 86 82 79 78 76 71 70 69 68 66 64 63 62 56 55 53 52 51 50 46 43 42 39 38 37 35 33 31 30 29 22 20 19 18 11 13 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "862166308\n"}, {"type": "stdin_stdout", "input": "1\n71 2\n100 99 98 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n<image>\n\n\nAt the request of a friend who started learning abacus, you decided to create a program to display the abacus beads. Create a program that takes a certain number as input and outputs a row of abacus beads. Ho...
[{"type": "stdin_stdout", "input": "2006\n1101", "output": "**** \n *\n=====\n * *\n**** \n* ***\n*****\n*****\n\n*****\n \n=====\n ** *\n* * \n*****\n*****\n*****\n"}, {"type": "stdin_stdout", "input": "2006\n0101", "output": "**** \n *\n=====\n * *\n**** \n* ***\n*****\n*****\n\n*****\n \n=====\n * ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWelcome to CODE FESTIVAL 2016! In order to celebrate this contest, find a string s that satisfies the following conditions:\n\n* The length of s is between 1 and 5000, inclusive.\n* s consists of uppercase letters.\n* s c...
[{"type": "stdin_stdout", "input": "1441", "output": "FESTIVALLLLLLLFESTIVAFESTIVALLFESTIVALLFESTIVALFESTIVALFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAF...
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\nIn Japan, temperature is usually expressed using the Celsius (℃) scale. In America, they used the Fahrenheit (℉) scale instead. $20$ degrees Celsius is roughly equal to $68$ degrees Fahrenheit. A phrase such as \"Today’s ...
[{"type": "stdin_stdout", "input": "22485", "output": "11227\n"}, {"type": "stdin_stdout", "input": "37535", "output": "18752\n"}, {"type": "stdin_stdout", "input": "54760", "output": "27365\n"}, {"type": "stdin_stdout", "input": "10347", "output": "5158\n"}, {"type": "stdin_stdout", "input": "10699", "output": "5334\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou planned a trip using trains and buses.\nThe train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket.\nSimilarly, the bus fare will be C yen ...
[{"type": "stdin_stdout", "input": "549\n817\n715\n603\n", "output": "1152\n"}, {"type": "stdin_stdout", "input": "600\n300\n220\n420\n", "output": "520\n"}, {"type": "stdin_stdout", "input": "555\n555\n400\n200\n", "output": "755\n"}, {"type": "stdin_stdout", "input": "549\n838\n715\n603", "output": "1152\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLimak is a little polar bear. He doesn't have many toys and thus he often plays with polynomials.\n\nHe considers a polynomial valid if its degree is n and its coefficients are integers not exceeding k by the absolute val...
[{"type": "stdin_stdout", "input": "100 1000\n-62 57 -27 -67 49 -10 66 -64 -36 -78 62 -75 -39 75 -47 -36 41 -88 62 -43 22 29 -20 58 40 16 71 -2 -87 12 86 -90 -92 67 -12 -48 -10 -26 78 68 22 -3 66 -95 -81 34 14 -76 -27 76 -60 87 -84 3 35 -60 46 -65 29 -29 2 -44 -55 18 -75 91 36 34 -86 53 59 -54 -29 33 -95 66 9 72 67 -44...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIt is winter now, and Max decided it's about time he watered the garden.\n\nThe garden can be represented as n consecutive garden beds, numbered from 1 to n. k beds contain water taps (i-th tap is located in the bed x_{i}...
[{"type": "stdin_stdout", "input": "1\n177 99\n1 4 7 10 11 13 14 15 16 17 19 21 22 24 25 26 27 28 32 34 35 38 39 40 42 45 46 52 54 55 57 58 59 60 62 64 65 67 70 71 74 77 78 79 80 81 83 84 88 92 93 94 95 100 101 102 104 106 107 108 109 110 112 113 114 115 116 118 122 123 124 125 127 128 129 130 134 135 137 138 139 140 1...
code_stdio