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\nSome time ago Mister B detected a strange signal from the space, which he started to study.\n\nAfter some transformation the signal turned out to be a permutation p of length n or its cyclic shift. For the further investi... | [{"type": "stdin_stdout", "input": "108\n1 102 33 99 6 83 4 20 61 100 76 71 44 9 24 87 57 2 81 82 90 85 12 30 66 53 47 36 43 29 31 64 96 84 77 23 93 78 58 68 42 55 13 70 62 19 92 14 10 65 63 75 91 48 11 105 37 50 32 94 18 26 52 89 104 106 86 97 80 95 17 72 40 22 79 103 25 101 35 51 15 98 67 5 34 69 54 27 45 88 56 16 46... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour task is to develop a tiny little part of spreadsheet software.\n\nWrite a program which adds up columns and rows of given table as shown in the following figure:\n\n<image>\n\n\n\nInput\n\nThe input consists of sever... | [{"type": "stdin_stdout", "input": "4\n52 26 16 20\n143 22 35 45\n45 78 54 36\n10 86 74 55\n4\n52 151 15 28\n86 22 24 45\n45 78 54 36\n16 86 74 55\n0", "output": " 52 26 16 20 114\n 143 22 35 45 245\n 45 78 54 36 213\n 10 86 74 55 225\n 250 212 179 156 797\n 52 151 15 28 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor given integers m and n, compute mn (mod 1,000,000,007). Here, A (mod M) is the remainder when A is divided by M.\n\nConstraints\n\n* 1 ≤ m ≤ 100\n* 1 ≤ n ≤ 109\n\nInput\n\n\nm n\n\n\nTwo integers m and n are given in ... | [{"type": "stdin_stdout", "input": "-1 1", "output": "1000000006\n"}, {"type": "stdin_stdout", "input": "-2 1", "output": "1000000005\n"}, {"type": "stdin_stdout", "input": "-4 1", "output": "1000000003\n"}, {"type": "stdin_stdout", "input": "-3 1", "output": "1000000004\n"}, {"type": "stdin_stdout", "input": "-5 1", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n\"You must lift the dam. With a lever. I will give it to you.\n\nYou must block the canal. With a rock. I will not give the rock to you.\" \n\nDanik urgently needs rock and lever! Obviously, the easiest way to get these t... | [{"type": "stdin_stdout", "input": "5\n5\n1 5 3 12 10\n3\n1 1 2\n4\n6 2 5 3\n2\n2 4\n1\n1\n", "output": "1\n1\n2\n0\n0\n"}, {"type": "stdin_stdout", "input": "5\n5\n1 5 3 12 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1\n", "output": "1\n3\n2\n0\n0\n"}, {"type": "stdin_stdout", "input": "5\n5\n1 5 3 12 10\n3\n2 1 2\n4\n6 2 5 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upp... | [{"type": "stdin_stdout", "input": "6\n5 30 290 0 -1 25\n106 2 21 1619 34 5\n1103 1563 -1 0 26 885", "output": "58\n"}, {"type": "stdin_stdout", "input": "6\n5 26 290 0 -1 25\n106 4 8 1619 60 5\n1103 1563 0 0 26 1803", "output": "64\n"}, {"type": "stdin_stdout", "input": "6\n4 43 290 -1 6 27\n106 13 11 837 28 8\n1103 7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian. \n\nGiven a string S consisting of only 1s and 0s, find the number of substrings which start and end both in 1.\n\nIn this problem, a substring is defined as a se... | [{"type": "stdin_stdout", "input": "2\n4\n1111\n5\n11011", "output": "10\n10\n"}, {"type": "stdin_stdout", "input": "2\n4\n1111\n5\n10000", "output": "10\n1\n"}, {"type": "stdin_stdout", "input": "2\n4\n1111\n5\n10100", "output": "10\n3\n"}, {"type": "stdin_stdout", "input": "2\n4\n1111\n5\n10011", "output": "10\n6\n"}... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n$k$ people want to split $n$ candies between them. Each candy should be given to exactly one of them or be thrown away.\n\nThe people are numbered from $1$ to $k$, and Arkady is the first of them. To split the candies, Ar... | [{"type": "stdin_stdout", "input": "1815995848677761959 576460752303423488 202657637814241276 1000\n", "output": "202657637814241276\n"}, {"type": "stdin_stdout", "input": "576460752303423488 576460752303423488 351082447248993993 1000\n", "output": "351082447248993993\n"}, {"type": "stdin_stdout", "input": "57646075230... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA robot cleaner is placed on the floor of a rectangle room, surrounded by walls. The floor consists of $n$ rows and $m$ columns. The rows of the floor are numbered from $1$ to $n$ from top to bottom, and columns of the fl... | [{"type": "stdin_stdout", "input": "5\n18 20 11 1 2 11\n10 10 5 9 2 1\n17 17 3 10 2 2\n6 9 2 2 5 8\n3 2 1 2 2 2\n", "output": "10\n10\n22\n3\n0\n"}, {"type": "stdin_stdout", "input": "5\n18 20 11 1 2 11\n10 10 5 9 2 1\n17 17 3 10 2 1\n6 9 2 2 5 8\n3 2 1 2 2 2\n", "output": "10\n10\n23\n3\n0\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given $n$ points on the plane. The polygon formed from all the $n$ points is strictly convex, that is, the polygon is convex, and there are no three collinear points (i.e. lying in the same straight line). The poi... | [{"type": "stdin_stdout", "input": "20\n-2967010 48581504\n-2967318 48581765\n-2967443 48581988\n-2967541 48582265\n-2967443 48582542\n-2967318 48582765\n-2967010 48583026\n-2966691 48583154\n-2966252 48583234\n-2965813 48583154\n-2965494 48583026\n-2965186 48582765\n-2965061 48582542\n-2964963 48582265\n-2965061 48581... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBob watches TV every day. He always sets the volume of his TV to $b$. However, today he is angry to find out someone has changed the volume to $a$. Of course, Bob has a remote control that can change the volume.\n\nThere ... | [{"type": "stdin_stdout", "input": "3\n-1 -1\n13 93\n3 2\n", "output": "0\n16\n1\n"}, {"type": "stdin_stdout", "input": "3\n-1 -1\n15 93\n3 2\n", "output": "0\n17\n1\n"}, {"type": "stdin_stdout", "input": "3\n-1 -1\n19 93\n3 2\n", "output": "0\n16\n1\n"}, {"type": "stdin_stdout", "input": "3\n-1 -1\n9 93\n3 6\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe height of the student was measured at the medical examination. Create a program that takes height data as input, creates a frequency distribution, and outputs it. The frequency distribution is divided into 6 classes i... | [{"type": "stdin_stdout", "input": "21\n182.52038838661136\n173.59035199874677\n159.1654152748587\n178.37721834424076\n171.14400777912027\n182.81130283538022\n174.6786970584368\n172.29285424816956\n164.63708333553282\n170.35024430895632\n176.98250427300766\n170.33088547272038\n163.32499378168183\n173.12553016807985\n17... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCirno_9baka has a paper tape with $n$ cells in a row on it. As he thinks that the blank paper tape is too dull, he wants to paint these cells with $m$ kinds of colors. For some aesthetic reasons, he thinks that the $i$-th... | [{"type": "stdin_stdout", "input": "10\n2 1 1\n2\n2 1 1\n2\n1 1 1\n1\n1 1 1\n1\n1 1 1\n1\n2 1 1\n2\n1 1 1\n1\n1 1 1\n1\n2 1 1\n2\n2 1 1\n2\n", "output": "YES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "10\n1 1 1\n1\n1 1 1\n1\n2 1 1\n2\n2 1 1\n2\n2 1 1\n2\n2 1 1\n2\n2 1 1\n2\n2 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPaprika loves permutations. She has an array $a_1, a_2, \\dots, a_n$. She wants to make the array a permutation of integers $1$ to $n$.\n\nIn order to achieve this goal, she can perform operations on the array. In each op... | [{"type": "stdin_stdout", "input": "4\n2\n2 7\n3\n2 5 2\n4\n12345678 87654321 18276684 23571113\n9\n2 3 1 4 18 23 5 12 7\n", "output": "1\n-1\n4\n-1\n"}, {"type": "stdin_stdout", "input": "4\n2\n2 7\n3\n2 5 2\n4\n12345678 87654321 18276684 23571113\n9\n2 3 1 4 18 34 5 12 7\n", "output": "1\n-1\n4\n-1\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's denote as <image> the number of bits set ('1' bits) in the binary representation of the non-negative integer x.\n\nYou are given multiple queries consisting of pairs of integers l and r. For each query, find the x, ... | [{"type": "stdin_stdout", "input": "18\n0 18\n1 101\n1 1001\n0 10000\n2 100000\n1 1001010\n1 10000000\n1 100000001\n1 1000000000\n1 10000010000\n1 100000000000\n0 1100000000000\n2 10000100000000\n0 100000000000000\n1 1000100000000000\n1 10000000000000000\n1 100000000000000001\n2 1000000000000000100\n", "output": "15\n6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTaro is an elementary school student and has graffiti on the back of the leaflet. At one point, Taro came up with the next game.\n\n* Write n × n grid-like squares.\n* The initial state of each square is either marked or ... | [{"type": "stdin_stdout", "input": "4\n1 2 3 4\n1 2 3 4\n1 2 3 4\n2 2 3 4\n1 2 3 4\n1 2 3 4\n1 2 3 4\n1 2 3 4\noooo\noooo\noooo\noooo", "output": "30\n12\n1 1 erase\n1 2 erase\n1 3 erase\n2 1 erase\n2 2 erase\n2 4 erase\n3 1 erase\n3 3 erase\n3 4 erase\n4 2 erase\n4 3 erase\n4 4 erase\n"}, {"type": "stdin_stdout", "inp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider a linear function f(x) = Ax + B. Let's define g^{(0)}(x) = x and g^{(}n)(x) = f(g^{(}n - 1)(x)) for n > 0. For the given integer values A, B, n and x find the value of g^{(}n)(x) modulo 10^9 + 7.\n\n\n-----Input-... | [{"type": "stdin_stdout", "input": "1377612828 606974665 846646545585165081 745145208\n", "output": "891861122\n"}, {"type": "stdin_stdout", "input": "978837295 606974665 846646545585165081 745145208\n", "output": "154788991\n"}, {"type": "stdin_stdout", "input": "978837295 606974665 846646545585165081 745145208\n", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNikolay lives in a two-storied house. There are $n$ rooms on each floor, arranged in a row and numbered from one from left to right. So each room can be represented by the number of the floor and the number of the room on... | [{"type": "stdin_stdout", "input": "1\n100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "1\n100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOrigami, or the art of folding paper\n\nMaster Grus is a famous origami (paper folding) artist, who is enthusiastic about exploring the possibility of origami art. For future creation, he is now planning fundamental exper... | [{"type": "stdin_stdout", "input": "2 1 1 1\n1 1\n0 0\n1 3 2 1\n2 1\n2 1\n0 0\n15 10 3 2\n2 2\n1 1\n1 1\n0 0\n3 4\n4 3 3 2\n1 2\n1 2\n1 1\n0 1\n0 0\n0 0 0 0", "output": "2\n3\n6\n1\n4\n4\n"}, {"type": "stdin_stdout", "input": "2 1 1 1\n2 1\n0 0\n1 3 2 1\n2 0\n2 1\n0 1\n10 13 3 2\n2 2\n1 3\n1 1\n0 1\n3 4\n3 5 3 2\n1 2\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe finalists of the \"Russian Code Cup\" competition in 2214 will be the participants who win in one of the elimination rounds.\n\nThe elimination rounds are divided into main and additional. Each of the main elimination... | [{"type": "stdin_stdout", "input": "100 100\n100 100\n100\n", "output": "9900\n"}, {"type": "stdin_stdout", "input": "100 100\n100 100\n100\n", "output": "9900\n"}, {"type": "stdin_stdout", "input": "10 100\n100 100\n99\n", "output": "1000\n"}, {"type": "stdin_stdout", "input": "10 100\n100 100\n99\n", "output": "1000\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is an automatic door at the entrance of a factory. The door works in the following way: when one or several people come to the door and it is closed, the door immediately opens automatically and all people immediat... | [{"type": "stdin_stdout", "input": "97 60 1 1\n5 6 6 7 9 10 10 11 11 11 12 13 13 13 13 14 14 15 16 18 20 23 23 24 25 26 29 31 32 35 38 41 43 43 46 47 48 48 49 52 53 54 55 56 58 59 68 70 72 74 78 81 81 82 91 92 96 96 97 98\n", "output": "49\n"}, {"type": "stdin_stdout", "input": "97 60 1 1\n5 6 6 7 9 10 10 11 11 11 12 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGerald is setting the New Year table. The table has the form of a circle; its radius equals R. Gerald invited many guests and is concerned whether the table has enough space for plates for all those guests. Consider all p... | [{"type": "stdin_stdout", "input": "10 1000 236\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "1 1484 1100\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "1 1484 0100\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100 821 25\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWilliam has two numbers $a$ and $b$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $k$ is picked, which is th... | [{"type": "stdin_stdout", "input": "6\n7 0\n0 15\n7 12\n2 5\n0 0\n-1 6\n", "output": "-1\n-1\n-1\n-1\n0\n-1\n"}, {"type": "stdin_stdout", "input": "6\n7 0\n0 15\n10 12\n2 5\n0 0\n-1 6\n", "output": "-1\n-1\n2\n-1\n0\n-1\n"}, {"type": "stdin_stdout", "input": "6\n2 -1\n3 0\n0 3\n6 3\n4 1\n0 1\n", "output": "-1\n-1\n-1\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle penguin Polo adores strings. But most of all he adores strings of length n.\n\nOne day he wanted to find a string that meets the following conditions:\n\n 1. The string consists of n lowercase English letters (tha... | [{"type": "stdin_stdout", "input": "70054 25\n", "output": "abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a binary string $s$ (recall that a string is binary if each character is either $0$ or $1$).\n\nLet $f(t)$ be the decimal representation of integer $t$ written in binary form (possibly with leading zeroes). ... | [{"type": "stdin_stdout", "input": "4\n0110\n0101\n00001000\n0001000\n", "output": "4\n3\n4\n3\n"}, {"type": "stdin_stdout", "input": "4\n0110\n1101\n00001000\n0001000\n", "output": "4\n4\n4\n3\n"}, {"type": "stdin_stdout", "input": "4\n0110\n1101\n00001000\n0101000\n", "output": "4\n4\n4\n5\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the game takes place on an h × w field, and it is painted in two colors, but not like in chess. Almost all cells ... | [{"type": "stdin_stdout", "input": "100 10 30\n40 4\n15 3\n75 3\n88 10\n32 1\n16 5\n81 8\n45 2\n72 8\n11 6\n86 4\n50 2\n9 4\n11 1\n20 3\n47 3\n2 4\n68 3\n90 5\n85 2\n88 1\n88 5\n86 3\n70 9\n49 3\n34 4\n5 7\n77 5\n50 1\n87 5\n", "output": "402737011\n"}, {"type": "stdin_stdout", "input": "100 10 30\n40 4\n15 3\n75 3\n88... | 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)!\nThere are five means of transport in this empire:\n - Train: travels from City 1 to 2 in one minute. A ... | [{"type": "stdin_stdout", "input": "802565984633806\n802252530129536\n544410837252078\n872045491508709\n274353138702170\n562308817245826\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "956131704220258\n897098524760050\n55734601880356\n155602009554546\n559895124828099\n830172607676349\n", "output": "22\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is an integer N.\nDetermine whether there is a pair of positive integers (A, B) such that 3^A + 5^B = N, and find one such pair if it exists.\n\n-----Constraints-----\n - 1 \\leq N \\leq 10^{18}\n - All values in in... | [{"type": "stdin_stdout", "input": "748307129767950488\n", "output": "37 25\n"}, {"type": "stdin_stdout", "input": "450283905890997368\n", "output": "37 1\n"}, {"type": "stdin_stdout", "input": "298023223876953128\n", "output": "1 25\n"}, {"type": "stdin_stdout", "input": "150094635296999246\n", "output": "36 3\n"}, {"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice gave Bob two integers $a$ and $b$ ($a > 0$ and $b \\ge 0$). Being a curious boy, Bob wrote down an array of non-negative integers with $\\operatorname{MEX}$ value of all elements equal to $a$ and $\\operatorname{XOR... | [{"type": "stdin_stdout", "input": "5\n1 1\n2 1\n2 0\n1 10000\n2 10000\n", "output": "3\n2\n3\n2\n3\n"}, {"type": "stdin_stdout", "input": "5\n1 1\n2 1\n2 0\n1 10000\n2 10000\n", "output": "3\n2\n3\n2\n3\n"}, {"type": "stdin_stdout", "input": "1\n187994 180766\n", "output": "187995\n"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together.\nGiven an integer N, determine whether N can be represented as the product of two integers between 1 and 9... | [{"type": "stdin_stdout", "input": "00010", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "00001", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "11111", "output": "No\n"}, {"type": "stdin_stdout", "input": "10111", "output": "No\n"}, {"type": "stdin_stdout", "input": "10011", "output": "No\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n2 3 1 3 1 0\n\n\nOutput\n\n2\n\nThe input will be stdin and you should print your solution to stdout\n\n\nNow solve the problem and return the code.\n\nWrite Python code to solve this problem. Your pro... | [{"type": "stdin_stdout", "input": "15 18 0 12 0 4", "output": "138\n"}, {"type": "stdin_stdout", "input": "15 18 0 22 0 4", "output": "124\n"}, {"type": "stdin_stdout", "input": "15 18 1 22 0 4", "output": "120\n"}, {"type": "stdin_stdout", "input": "11 51 4 0 1 -1", "output": "255\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp doesn't like integers that are divisible by $3$ or end with the digit $3$ in their decimal representation. Integers that meet both conditions are disliked by Polycarp, too.\n\nPolycarp starts to write out the pos... | [{"type": "stdin_stdout", "input": "100\n1000\n999\n998\n997\n996\n995\n994\n993\n992\n991\n990\n989\n988\n987\n986\n985\n984\n983\n982\n981\n980\n979\n978\n977\n976\n975\n974\n973\n972\n971\n970\n969\n968\n967\n966\n965\n964\n963\n962\n961\n960\n959\n958\n957\n956\n955\n954\n953\n952\n951\n950\n949\n948\n947\n946\n945... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA: Flick input\n\nA college student who loves 2D, commonly known as 2D, replaced his long-used Galapagos mobile phone with a smartphone. 2D, who operated the smartphone for the first time, noticed that the character input... | [{"type": "stdin_stdout", "input": "5R3D", "output": "neso\n"}, {"type": "stdin_stdout", "input": "5D2R", "output": "noke\n"}, {"type": "stdin_stdout", "input": "5T2D", "output": "nako\n"}, {"type": "stdin_stdout", "input": "5D3R", "output": "nose\n"}, {"type": "stdin_stdout", "input": "5U2D", "output": "nuko\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDr. Moriarty is about to send a message to Sherlock Holmes. He has a string s. \n\nString p is called a substring of string s if you can read it starting from some position in the string s. For example, string \"aba\" has... | [{"type": "stdin_stdout", "input": "ksmbytfyhhnstlecripupiwdhbkhfpfmimrbqgszohcqnezcybvwasxmkxfupvuecsctcpadccnqexsglwaiyxcoyheefcjmdedesgjqdtqgrvfjonzesffousooutsjumrxl\nhgjqihcfbnmgufonaiudbjegexexthrzcdkuimwogpbyovemztzcmqnrbhabxyyxyfuzpyhjgnioexbezzupcxlyzuuncstiiqsjzdtqppqhxilvqimlpjejiqbwpeekzweeyvthvjffgfvqauqru... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMasha really loves algebra. On the last lesson, her strict teacher Dvastan gave she new exercise.\n\nYou are given geometric progression b defined by two integers b_1 and q. Remind that a geometric progression is a sequen... | [{"type": "stdin_stdout", "input": "-3 0 92055 36\n-92974174 -486557474 -663622151 695596393 177960746 -563227474 -364263320 -676254242 -614140218 71456762 -764104225 705056581 -106398436 332755134 -199942822 -732751692 658942664 677739866 886535704 183687802 -784248291 -22550621 -938674499 637055091 -704750213 7803958... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTanya is learning how to add numbers, but so far she is not doing it correctly. She is adding two numbers $a$ and $b$ using the following algorithm:\n\nIf one of the numbers is shorter than the other, Tanya adds leading z... | [{"type": "stdin_stdout", "input": "6\n17236 1106911\n1 5\n108 112\n12345 1023412\n1 11\n1 20\n", "output": "3465\n4\n-1\n90007\n10\n-1\n"}, {"type": "stdin_stdout", "input": "6\n17236 1106911\n1 5\n108 112\n12345 1023412\n1 11\n1 20\n", "output": "3465\n4\n-1\n90007\n10\n-1\n"}, {"type": "stdin_stdout", "input": "6\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is an integer sequence of length N+1: A_0, A_1, A_2, \\ldots, A_N. Is there a binary tree of depth N such that, for each d = 0, 1, \\ldots, N, there are exactly A_d leaves at depth d? If such a tree exists, print th... | [{"type": "stdin_stdout", "input": "10\n0 -1 1 1 3 3 4 8 13 23 34", "output": "360\n"}, {"type": "stdin_stdout", "input": "10\n-1 0 1 0 2 3 5 8 13 21 34", "output": "421\n"}, {"type": "stdin_stdout", "input": "10\n0 -1 1 1 3 4 4 8 13 23 34", "output": "358\n"}, {"type": "stdin_stdout", "input": "10\n-1 0 1 0 2 3 5 8 13... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya and Petya take part in a Codeforces round. The round lasts for two hours and contains five problems.\n\nFor this round the dynamic problem scoring is used. If you were lucky not to participate in any Codeforces roun... | [{"type": "stdin_stdout", "input": "26\n3 -1 71 -1 42\n85 72 48 38 -1\n-1 -1 66 24 -1\n46 -1 60 99 107\n53 106 51 -1 104\n-1 17 135 54 -1\n44 107 66 65 102\n47 40 62 34 5\n-1 10 -1 98 -1\n-1 69 47 85 75\n12 62 -1 15 -1\n48 63 72 32 99\n116 104 111 -1 -1\n92 -1 52 -1 11\n118 25 97 1 108\n-1 78 97 37 -1\n87 47 -1 -1 21\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are an experienced Codeforces user. Today you found out that during your activity on Codeforces you have made y submissions, out of which x have been successful. Thus, your current success rate on Codeforces is equal ... | [{"type": "stdin_stdout", "input": "5\n99999997 999999998 999999998 999999999\n99999996 999999997 999999997 999999999\n99999997 999999998 999999998 999999999\n99999996 999999997 999999997 999999999\n162133301 999999998 999999998 999999999\n", "output": "899999999100000001\n449999999550000002\n899999999100000001\n449999... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTsuruga Castle, a symbol of Aizuwakamatsu City, was named \"Tsuruga Castle\" after Gamo Ujisato built a full-scale castle tower. You can overlook the Aizu basin from the castle tower. On a clear day, you can see Tsuruga C... | [{"type": "stdin_stdout", "input": "8\n106\n29\n127\n11\n41\n39\n2\n5\n4\n67\n81\n78\n65\n0", "output": "2\n1\n1\n1\n1\n0\n2\n0\n0\n0\n0\n0\n0\n4\n"}, {"type": "stdin_stdout", "input": "8\n001\n21\n127\n11\n41\n39\n2\n5\n4\n67\n81\n78\n65\n0", "output": "3\n1\n1\n1\n1\n0\n1\n0\n0\n0\n0\n0\n0\n4\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently, Tokitsukaze found an interesting game. Tokitsukaze had n items at the beginning of this game. However, she thought there were too many items, so now she wants to discard m (1 ≤ m ≤ n) special items of them.\n\nT... | [{"type": "stdin_stdout", "input": "1000000000000000000 20 365\n31881893160049984 103938857870698567 103962228223609431 140762820261865064 175962215264653912 239086305245565642 354522451098745823 383839975876242372 443471287955807705 478923027151493682 511195154588214957 619570919279066139 677571312513476877 7058647976... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOmkar's most recent follower, Ajit, has entered the Holy Forest. Ajit realizes that Omkar's forest is an n by m grid (1 ≤ n, m ≤ 2000) of some non-negative integers. Since the forest is blessed by Omkar, it satisfies some... | [{"type": "stdin_stdout", "input": "4\n3 4\n0000\n00#0\n0000\n2 1\n#\n#\n1 2\n##\n6 29\n#############################\n#000##0###0##0#0####0####000#\n#0#0##00#00##00####0#0###0#0#\n#0#0##0#0#0##00###00000##00##\n#000##0###0##0#0##0###0##0#0#\n#############################\n", "output": "\n2\n3\n3\n319908071\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMonocarp plays \"Rage of Empires II: Definitive Edition\" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the oppo... | [{"type": "stdin_stdout", "input": "71\n76468 749982 526217 695732 169602 557600 719698 698344 105043 522755 113036 693415 502619 741227 932643 534995 954172 87407 742242 172680 901819 194280 523575 413309 242835 918390 108115 823507 810672 916889 407735 504768 301602 942625 742419 779364 595511 775444 721352 115825 45... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a right triangle with legs of length a and b. Your task is to determine whether it is possible to locate the triangle on the plane in such a way that none of its sides is parallel to the coordinate axes. All the ... | [{"type": "stdin_stdout", "input": "1000 1000\n", "output": "YES\n0 0\n280 960\n-960 280\n"}, {"type": "stdin_stdout", "input": "455 470\n", "output": "YES\n0 0\n273 364\n-376 282\n"}, {"type": "stdin_stdout", "input": "440 330\n", "output": "YES\n0 0\n264 352\n-264 198\n"}, {"type": "stdin_stdout", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp found on the street an array $a$ of $n$ elements.\n\nPolycarp invented his criterion for the beauty of an array. He calls an array $a$ beautiful if at least one of the following conditions must be met for each di... | [{"type": "stdin_stdout", "input": "10\n5\n4 3 1 5 2\n5\n1 5 1 1 5\n5\n4 1 2 1 2\n5\n5 5 6 1 4\n5\n5 2 4 5 4\n5\n3 1 2 3 4\n5\n1 3 9 4 1\n5\n5 2 10 5 4\n5\n1 1 2 3 2\n4\n2 2 5 1\n", "output": "2\n0\n0\n2\n2\n2\n1\n2\n1\n1\n"}, {"type": "stdin_stdout", "input": "10\n5\n4 3 1 5 1\n5\n1 4 1 1 3\n5\n4 1 2 1 2\n5\n5 5 5 1 4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya loves football very much. One day, as he was watching a football match, he was writing the players' current positions on a piece of paper. To simplify the situation he depicted it as a string consisting of zeroes an... | [{"type": "stdin_stdout", "input": "1111111111111111111111111111111111111111011111111111111111111111111111111111111111111111111111111111\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001\n", "output": "YES\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a complete directed graph $K_n$ with $n$ vertices: each pair of vertices $u \\neq v$ in $K_n$ have both directed edges $(u, v)$ and $(v, u)$; there are no self-loops.\n\nYou should find such a cycle in $K_n$... | [{"type": "stdin_stdout", "input": "1\n132 8 1257\n", "output": "5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAshish has $n$ elements arranged in a line. \n\nThese elements are represented by two integers $a_i$ — the value of the element and $b_i$ — the type of the element (there are only two possible types: $0$ and $1$). He want... | [{"type": "stdin_stdout", "input": "10\n8\n94616 28275 43594 32192 68030 82703 84250 96281\n1 0 0 0 0 0 0 0\n5\n28821 83833 62399 69723 77684\n1 1 0 1 1\n8\n115822 94805 71389 67802 43519 34364 17842 98783\n0 1 0 1 0 1 0 0\n3\n63630 83145 89435\n1 1 1\n5\n66195 67879 10777 54269 80789\n1 1 1 1 0\n8\n42696 26113 2424 33... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe main characters have been omitted to be short.\n\nYou are given a directed unweighted graph without loops with $n$ vertexes and a path in it (that path is not necessary simple) given by a sequence $p_1, p_2, \\ldots, ... | [{"type": "stdin_stdout", "input": "20\n01001100001100011011\n00111101001100001101\n01010010000010000110\n10101001000000000110\n00110110111101100000\n00111010110011100011\n01101000111001110100\n11111100011110000100\n11111010011110011000\n10001100000101100101\n11001111010010100011\n00001111001001111111\n1001111000010100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven the number n, find the smallest positive integer which has exactly n divisors. It is guaranteed that for the given n the answer will not exceed 1018.\n\nInput\n\nThe first line of the input contains integer n (1 ≤ n... | [{"type": "stdin_stdout", "input": "118\n", "output": "864691128455135232"}, {"type": "stdin_stdout", "input": "473\n", "output": "259700248434180096"}, {"type": "stdin_stdout", "input": "940\n", "output": "199495389743677440"}, {"type": "stdin_stdout", "input": "265\n", "output": "364791569817010176"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAthenaeus has just finished creating his latest musical composition and will present it tomorrow to the people of Athens. Unfortunately, the melody is rather dull and highly likely won't be met with a warm reception.\n\nH... | [{"type": "stdin_stdout", "input": "5\n6\n1 2 2 2 5 11\n2\n2 4\n6\n1 1 3 4 4 10\n1\n1\n6\n1 1 1 2 2 2\n", "output": "5\n2\n6\n1\n3\n"}, {"type": "stdin_stdout", "input": "5\n6\n1 2 2 4 6 11\n2\n1 4\n6\n1 1 1 4 4 10\n1\n1\n6\n1 1 2 2 2 2\n", "output": "6\n2\n5\n1\n3\n"}, {"type": "stdin_stdout", "input": "5\n6\n2 2 2 2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a ce... | [{"type": "stdin_stdout", "input": "50\n474421 421097 217233 156339 27075 733996 281778 863492 184707 956857 288561 70997 393786 337382 663642 131184 637 273801 799870 295017 392338 842567 161819 297705 102013 930684 375703 838048 154915 138503 629056 256591 893619 19263 787927 684541 320265 841090 421423 490879 394582... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou can find anything whatsoever in our Galaxy! A cubical planet goes round an icosahedral star. Let us introduce a system of axes so that the edges of the cubical planet are parallel to the coordinate axes and two opposi... | [{"type": "stdin_stdout", "input": "1 0 0\n0 0 0\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "1 1 1\n0 1 1\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "0 0 1\n1 0 0\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "1 0 0\n0 1 0\n", "output": "YES\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor the given integer $n$ ($n > 2$) let's write down all the strings of length $n$ which contain $n-2$ letters 'a' and two letters 'b' in lexicographical (alphabetical) order.\n\nRecall that the string $s$ of length $n$ i... | [{"type": "stdin_stdout", "input": "2\n39776 83767477\n50000 1249975000\n", "output": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya started to attend programming lessons. On the first lesson his task was to write a simple program. The program was supposed to do the following: in the given string, consisting if uppercase and lowercase Latin lette... | [{"type": "stdin_stdout", "input": "FSNRBXLFQHZXGVMKLQDVHWLDSLKGKFMDRQWMWSSKPKKQBNDZRSCBLRSKCKKFFKRDMZFZGCNSMXNPMZVDLKXGNXGZQCLRTTDXLMXQ\n", "output": ".f.s.n.r.b.x.l.f.q.h.z.x.g.v.m.k.l.q.d.v.h.w.l.d.s.l.k.g.k.f.m.d.r.q.w.m.w.s.s.k.p.k.k.q.b.n.d.z.r.s.c.b.l.r.s.k.c.k.k.f.f.k.r.d.m.z.f.z.g.c.n.s.m.x.n.p.m.z.v.d.l.k.x.g... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSoon a school Olympiad in Informatics will be held in Berland, n schoolchildren will participate there.\n\nAt a meeting of the jury of the Olympiad it was decided that each of the n participants, depending on the results,... | [{"type": "stdin_stdout", "input": "3000000\n1000000 1000000\n1000000 1000000\n1000000 1000000\n", "output": "1000000 1000000 1000000 \n"}, {"type": "stdin_stdout", "input": "3000000\n1000000 1000000\n1000000 1000000\n1000000 1000000\n", "output": "1000000 1000000 1000000\n"}, {"type": "stdin_stdout", "input": "1629279... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n\"We've tried solitary confinement, waterboarding and listening to Just In Beaver, to no avail. We need something extreme.\"\n\n\"Little Alena got an array as a birthday present...\"\n\nThe array b of length n is obtained... | [{"type": "stdin_stdout", "input": "98\n-99 -98 -95 -90 97 93 96 95 98 98 -94 -92 -99 -92 -91 -87 -83 -84 -87 -88 -90 -79 -79 -82 -77 -76 92 82 91 91 90 91 -69 -72 -65 -68 -65 -58 -59 -63 -56 -57 -59 -53 -55 -45 -51 -52 73 81 75 71 77 72 67 70 60 70 61 64 -34 -41 -41 -41 -37 -39 -36 -33 -36 -36 -33 -36 54 49 53 51 50 -... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a tube which is reflective inside represented as two non-coinciding, but parallel to $Ox$ lines. Each line has some special integer points — positions of sensors on sides of the tube.\n\nYou are going to emi... | [{"type": "stdin_stdout", "input": "13 968288\n0 67108864 134217728 201326592 268435456 335544320 402653184 469762048 536870912 603979776 671088640 738197504 805306368\n13 986214\n33554432 100663296 167772160 234881024 301989888 369098752 436207616 503316480 570425344 637534208 704643072 771751936 838860800\n", "output... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn n × n table a is defined as follows:\n\n The first row and the first column contain ones, that is: a_{i}, 1 = a_{1, }i = 1 for all i = 1, 2, ..., n. Each of the remaining numbers in the table is equal to the sum of t... | [{"type": "stdin_stdout", "input": "010\n", "output": "48620\n"}, {"type": "stdin_stdout", "input": "10\n", "output": "48620\n"}, {"type": "stdin_stdout", "input": "10\n", "output": "48620"}, {"type": "stdin_stdout", "input": "9\n", "output": "12870\n"}, {"type": "stdin_stdout", "input": "9\n", "output": "12870"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has two arrays $A$ and $B$ of lengths $n$ and $m$, respectively.\n\nHe can perform the following operation arbitrary number of times (possibly zero): he takes some consecutive subsegment of the array and replaces it... | [{"type": "stdin_stdout", "input": "49\n18 1 7 2 1 1 50 22 8 2 2 1 30 2 46 10 1 4 5 18 25 21 38 11 2 15 29 8 7 2 45 12 14 16 16 23 11 1 1 4 48 18 3 1 1 23 4 10 7\n50\n5 25 34 22 19 4 4 2 40 52 1 4 1 3 47 9 4 1 8 47 4 5 1 1 9 22 9 2 2 1 1 48 7 2 8 16 4 2 41 12 3 30 21 10 2 2 5 1 31 13\n", "output": "14\n"}, {"type": "st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYoung Teodor enjoys drawing. His favourite hobby is drawing segments with integer borders inside his huge [1;m] segment. One day Teodor noticed that picture he just drawn has one interesting feature: there doesn't exist a... | [{"type": "stdin_stdout", "input": "43 1319\n750 1030\n857 946\n941 1203\n407 1034\n1052 1290\n546 585\n630 1201\n133 342\n693 1315\n34 719\n176 1097\n39 931\n198 885\n3 1025\n892 1054\n461 1287\n195 1273\n832 1039\n308 955\n642 866\n770 838\n440 777\n289 948\n98 814\n458 768\n82 265\n300 596\n182 706\n368 1225\n237 62... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads a sequence and prints it in the reverse order.\n\nNote\n\n解説\n\nConstraints\n\n* n ≤ 100\n* 0 ≤ ai < 1000\n\nInput\n\nThe input is given in the following format:\n\n\nn\na1 a2 . . . an\n\n\nn i... | [{"type": "stdin_stdout", "input": "8\n-2 0 0 32 -1 -2 153 26", "output": "26 153 -2 -1 32 0 0 -2\n"}, {"type": "stdin_stdout", "input": "8\n-2 0 0 32 -2 -2 153 26", "output": "26 153 -2 -2 32 0 0 -2\n"}, {"type": "stdin_stdout", "input": "8\n-2 1 0 32 -2 -2 153 26", "output": "26 153 -2 -2 32 0 1 -2\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese , Russian and Vietnamese as well. \n\nTriangle classification is an important problem in modern mathematics. Mathematicians have developed many criteria according to which a tr... | [{"type": "stdin_stdout", "input": "2\n6\n0 0 4 1 1 2\n0 -1 1 0 1 4\n1 0 1 1 1 3\n0 0 2 1 1 2\n3 0 0 4 4 7\n0 0 2 1 4 0", "output": "Scalene obtuse triangle\nScalene obtuse triangle\nScalene obtuse triangle\nIsosceles acute triangle\nIsosceles right triangle\nIsosceles obtuse triangle\n"}, {"type": "stdin_stdout", "inp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSereja has an array a, consisting of n integers a_1, a_2, ..., a_{n}. The boy cannot sit and do nothing, he decided to study an array. Sereja took a piece of paper and wrote out m integers l_1, l_2, ..., l_{m} (1 ≤ l_{i} ... | [{"type": "stdin_stdout", "input": "10 10\n1 2 3 4 1 2 3 4 100000 99999\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n", "output": "6\n6\n6\n6\n6\n5\n4\n3\n2\n1\n"}, {"type": "stdin_stdout", "input": "10 10\n1 2 3 4 1 2 3 4 100000 99999\n1\n2\n3\n4\n5\n6\n7\n7\n9\n10\n", "output": "6\n6\n6\n6\n6\n5\n4\n4\n2\n1\n"}, {"type": "stdin_s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVanya got an important task — he should enumerate books in the library and label each book with its number. Each of the n books should be assigned with a number from 1 to n. Naturally, distinct books should be assigned di... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "8888888899\n"}, {"type": "stdin_stdout", "input": "1000000000\n", "output": "8888888899\n"}, {"type": "stdin_stdout", "input": "222222222\n", "output": "1888888896\n"}, {"type": "stdin_stdout", "input": "943006819\n", "output": "8375950269\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDmitry has an array of $n$ non-negative integers $a_1, a_2, \\dots, a_n$.\n\nIn one operation, Dmitry can choose any index $j$ ($1 \\le j \\le n$) and increase the value of the element $a_j$ by $1$. He can choose the same... | [{"type": "stdin_stdout", "input": "5\n3\n0 1 3\n7\n0 2 2 3 4 3 2\n4\n3 0 0 0\n7\n4 6 2 3 5 0 5\n5\n4 0 1 0 4\n", "output": "1 1 0 -1 \n1 0 -1 -1 -1 -1 -1 -1 \n3 0 1 4 3 \n1 0 -1 -1 -1 -1 -1 -1 \n2 1 0 2 -1 -1 \n"}, {"type": "stdin_stdout", "input": "5\n3\n0 1 3\n7\n0 2 2 3 4 3 2\n4\n3 1 0 0\n7\n4 6 2 3 5 0 5\n5\n4 0 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a tree with N vertices. Vertex 1 is the root of the tree, and the parent of Vertex i (2 \\leq i \\leq N) is Vertex P_i.\nTo each vertex in the tree, Snuke will allocate a color, either black or white, and a non-ne... | [{"type": "stdin_stdout", "input": "1000\n1 1 2 3 4 5 5 7 8 9 10 11 12 12 14 14 15 16 18 19 20 19 20 23 24 24 25 27 28 29 30 31 32 32 32 35 36 36 38 39 39 41 42 42 43 45 45 47 48 49 50 50 52 52 53 55 56 57 57 59 59 61 62 62 64 64 66 67 67 69 70 70 71 72 73 73 76 77 78 79 79 81 82 83 83 84 86 87 87 88 90 91 91 92 94 95 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt's another Start[c]up finals, and that means there is pizza to order for the onsite contestants. There are only 2 types of pizza (obviously not, but let's just pretend for the sake of the problem), and all pizzas contai... | [{"type": "stdin_stdout", "input": "25 6\n1 10 5\n1 8 4\n1 8 2\n4 8 9\n3 2 8\n1 9 5\n2 10 10\n3 9 6\n3 5 4\n2 7 8\n2 3 2\n2 6 8\n3 7 8\n4 3 7\n1 8 1\n3 6 4\n3 2 8\n2 2 1\n4 8 8\n4 15 4\n3 10 2\n3 6 6\n2 2 5\n1 6 2\n4 1 5\n", "output": "477\n"}, {"type": "stdin_stdout", "input": "25 6\n1 10 5\n1 8 4\n1 8 2\n4 8 9\n3 2 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKevin has just recevied his disappointing results on the USA Identification of Cows Olympiad (USAICO) in the form of a binary string of length n. Each character of Kevin's string represents Kevin's score on one of the n q... | [{"type": "stdin_stdout", "input": "93\n010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010\n", "output": "93\n"}, {"type": "stdin_stdout", "input": "93\n010101000101010101010101010101010101010101010101010101010101010101010101010101010101010101010\n", "output": "93\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently, Vladimir got bad mark in algebra again. To avoid such unpleasant events in future he decided to train his arithmetic skills. He wrote four integer numbers a, b, c, d on the blackboard. During each of the next th... | [{"type": "stdin_stdout", "input": "1000 1000 999 1000\n* * *\n", "output": "999000000000\n"}, {"type": "stdin_stdout", "input": "720 903 589 804\n* * *\n", "output": "307887168960\n"}, {"type": "stdin_stdout", "input": "573 598 1387 124\n* * *\n", "output": "58932376152\n"}, {"type": "stdin_stdout", "input": "739 903 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi loves numbers divisible by 2.\nYou are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always uni... | [{"type": "stdin_stdout", "input": "100\n", "output": "64\n"}, {"type": "stdin_stdout", "input": "32\n", "output": "32\n"}, {"type": "stdin_stdout", "input": "101", "output": "64\n"}, {"type": "stdin_stdout", "input": "111", "output": "64\n"}, {"type": "stdin_stdout", "input": "110", "output": "64\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Resistance is trying to take control over all planets in a particular solar system. This solar system is shaped like a tree. More precisely, some planets are connected by bidirectional hyperspace tunnels in such a way... | [{"type": "stdin_stdout", "input": "10\n4 3\n2 10\n10 1\n5 7\n9 8\n10 6\n5 10\n1 3\n2 9\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "10\n4 1\n2 10\n10 1\n5 7\n3 8\n10 6\n5 9\n1 3\n1 9\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "10\n4 3\n2 10\n10 1\n5 7\n5 8\n10 6\n5 9\n1 3\n1 9\n", "output": "5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently, the bear started studying data structures and faced the following problem.\n\nYou are given a sequence of integers x1, x2, ..., xn of length n and m queries, each of them is characterized by two integers li, ri.... | [{"type": "stdin_stdout", "input": "9\n9999991 9999943 9999883 4658161 4657997 2315407 2315263 1000003 1000033\n13\n9999991 9999991\n9999943 9999943\n9999883 9999883\n4658161 4658161\n4657997 4657997\n2315407 2315407\n2315263 2315263\n1000003 1000003\n1000033 1000033\n2 2000000000\n2000000000 2000000000\n9999992 200000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarpus develops an interesting theory about the interrelation of arithmetic progressions with just everything in the world. His current idea is that the population of the capital of Berland changes over time like an a... | [{"type": "stdin_stdout", "input": "20\n-1 32 37 -1 -1 -1 57 -1 -1 40 31 33 -1 -1 39 47 43 -1 35 32\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "20\n-1 32 37 -1 -1 -1 57 -1 -1 40 31 33 -1 -1 39 47 43 -1 35 32\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "19\n23 26 -1 -1 35 38 41 -1 -1 -1 53 -1 59... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDreamoon loves summing up something for no reason. One day he obtains two integers a and b occasionally. He wants to calculate the sum of all nice integers. Positive integer x is called nice if $\\operatorname{mod}(x, b) ... | [{"type": "stdin_stdout", "input": "10000000 10000000\n", "output": "425362313\n"}, {"type": "stdin_stdout", "input": "10000000 10000000\n", "output": "425362313\n"}, {"type": "stdin_stdout", "input": "10000000 11383836\n", "output": "113242098\n"}, {"type": "stdin_stdout", "input": "10000100 10000000\n", "output": "77... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMonocarp and Polycarp are learning new programming techniques. Now they decided to try pair programming.\n\nIt's known that they have worked together on the same file for $n + m$ minutes. Every minute exactly one of them ... | [{"type": "stdin_stdout", "input": "5\n\n3 2 2\n2 0\n0 5\n\n4 3 2\n2 0 5\n0 6\n\n0 2 2\n1 0\n2 3\n\n5 4 4\n6 0 8 0\n0 7 0 9\n\n5 4 1\n8 7 8 0\n0\n", "output": "0 2 0 5 \n0 2 0 5 6 \n-1\n0 6 0 7 0 8 0 9 \n-1\n"}, {"type": "stdin_stdout", "input": "5\n\n3 2 2\n2 0\n0 5\n\n4 3 2\n2 0 5\n0 6\n\n0 2 2\n1 0\n3 3\n\n5 4 4\n6 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFlatland has recently introduced a new type of an eye check for the driver's licence. The check goes like that: there is a plane with mannequins standing on it. You should tell the value of the minimum angle with the vert... | [{"type": "stdin_stdout", "input": "38\n96 416\n24 104\n6 26\n12 52\n210 910\n150 650\n54 234\n174 754\n114 494\n18 78\n90 390\n36 156\n222 962\n186 806\n126 546\n78 338\n108 468\n180 780\n120 520\n84 364\n66 286\n138 598\n30 130\n228 988\n72 312\n144 624\n198 858\n60 403\n48 208\n102 442\n42 182\n162 702\n132 572\n156... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn some other world, today is Christmas Eve.\nThere are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \\leq i \\leq N) is h_i meters.\nHe decides to choose K trees from these trees and decorate th... | [{"type": "stdin_stdout", "input": "3 2\n1\n500000000\n1000000000\n", "output": "499999999\n"}, {"type": "stdin_stdout", "input": "5 3\n10\n15\n11\n14\n12\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "3 3\n10\n15\n33\n14\n12", "output": "23\n"}, {"type": "stdin_stdout", "input": "4 3\n10\n21\n21\n-1\n10", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which computes the area of a shape represented by the following three lines:\n\n$y = x^2$\n$y = 0$\n$x = 600$\n\n\n\nIt is clear that the area is $72000000$, if you use an integral you learn in high school... | [{"type": "stdin_stdout", "input": "20\n100", "output": "68440000\n55000000\n"}, {"type": "stdin_stdout", "input": "20\n120", "output": "68440000\n51840000\n"}, {"type": "stdin_stdout", "input": "20\n150", "output": "68440000\n47250000\n"}, {"type": "stdin_stdout", "input": "20\n200", "output": "68440000\n40000000\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya the programmer lives in the middle of the Programming subway branch. He has two girlfriends: Dasha and Masha, who live at the different ends of the branch, each one is unaware of the other one's existence.\n\nWhen V... | [{"type": "stdin_stdout", "input": "999999 1000000\n", "output": "Equal\n"}, {"type": "stdin_stdout", "input": "999997 1000000\n", "output": "Dasha\n"}, {"type": "stdin_stdout", "input": "1000000 999993\n", "output": "Masha\n"}, {"type": "stdin_stdout", "input": "999997 1000001\n", "output": "Dasha\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe screen that displays digital numbers that you often see on calculators is called a \"7-segment display\" because the digital numbers consist of seven parts (segments).\n\nThe new product to be launched by Wakamatsu wi... | [{"type": "stdin_stdout", "input": "3\n0\n5\n1\n1\n1\n-1", "output": "0111111\n1010010\n1101011\n0000110\n"}, {"type": "stdin_stdout", "input": "3\n0\n9\n1\n1\n0\n-1", "output": "0111111\n1010000\n1101001\n0111111\n"}, {"type": "stdin_stdout", "input": "3\n0\n5\n1\n1\n2\n-1", "output": "0111111\n1010010\n1101011\n10110... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke has decided to play a game, where the player runs a railway company.\nThere are M+1 stations on Snuke Line, numbered 0 through M.\nA train on Snuke Line stops at station 0 and every d-th station thereafter, where d ... | [{"type": "stdin_stdout", "input": "2 22\n1 9\n5 9\n4 5\n4 9\n0 1\n0 12\n2 4", "output": "2\n2\n2\n2\n2\n2\n2\n2\n2\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "2 18\n1 9\n5 9\n4 5\n4 9\n0 1\n0 12\n2 4", "output": "2\n2\n2\n2\n2\n2\n2\n2\n2\n0\n0\n0\n0\n0\n0\n0\n0\n0\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe new operating system BerOS has a nice feature. It is possible to use any number of characters '/' as a delimiter in path instead of one traditional '/'. For example, strings //usr///local//nginx/sbin// and /usr/local/... | [{"type": "stdin_stdout", "input": "/zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\n", "output": "/zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\n"}, {"type": "stdin_stdout", "input": "/a/a/a/a/a/a/a/a/a/a/a/a/a/... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently, on the course of algorithms and data structures, Valeriy learned how to use a deque. He built a deque filled with n elements. The i-th element is a_i (i = 1, 2, …, n). He gradually takes the first two leftmost e... | [{"type": "stdin_stdout", "input": "71 57\n9 26 80 10 65 60 63 1 15 85 71 1 58 27 41 97 42 15 42 56 87 22 10 28 34 90 13 70 71 56 65 21 0 78 47 191 56 77 32 83 28 16 10 41 0 18 92 12 27 58 4 67 21 41 99 20 21 52 74 10 83 45 43 65 2 15 1 63 46 97 72\n150\n21\n81\n81\n5\n9\n41\n76\n81\n92\n95\n94\n78\n93\n47\n30\n92\n3\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhile working at DTL, Ela is very aware of her physical and mental health. She started to practice various sports, such as Archery, Yoga, and Football.\n\nSince she started engaging in sports activities, Ela switches to t... | [{"type": "stdin_stdout", "input": "10\n84693792843120399 722933352461265626\n1054414613006002 919996041213106080\n141147461122848960 215953152568344802\n36758866361588362 220526816065597583\n135781915245644528 740842808859507601\n49755792151684097 147448792408078224\n101352931056782000 386376107245094465\n480981404419... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider a sequence of integers $a_1, a_2, \\ldots, a_n$. In one move, you can select any element of the sequence and delete it. After an element is deleted, all elements to the right are shifted to the left by $1$ positi... | [{"type": "stdin_stdout", "input": "4\n7 6\n1 1 2 3 4 5 6\n5 2\n5 1 3 2 3\n5 2\n5 5 5 5 4\n8 4\n1 3 3 3 1 2 5 5\n", "output": "1\n2\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "4\n7 6\n1 1 2 3 4 5 6\n5 2\n5 1 3 2 3\n5 2\n5 5 5 5 4\n8 4\n1 2 3 3 2 2 5 5\n", "output": "1\n2\n-1\n2\n"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe held two competitions: Coding Contest and Robot Maneuver.\n\nIn each competition, the contestants taking the 3-rd, 2-nd, and 1-st places receive 100000, 200000, and 300000 yen (the currency of Japan), respectively. Fur... | [{"type": "stdin_stdout", "input": "1 001", "output": "1000000\n"}, {"type": "stdin_stdout", "input": "10 001", "output": "300000\n"}, {"type": "stdin_stdout", "input": "11 001", "output": "300000\n"}, {"type": "stdin_stdout", "input": "3 001", "output": "400000\n"}, {"type": "stdin_stdout", "input": "5 001", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have an integer sequence A, whose length is N.\n\nFind the number of the non-empty contiguous subsequences of A whose sums are 0. Note that we are counting the ways to take out subsequences. That is, even if the conten... | [{"type": "stdin_stdout", "input": "7\n-1 -4 0 -20 -1 0 0", "output": "4\n"}, {"type": "stdin_stdout", "input": "7\n0 -1 1 -1 1 -1 1", "output": "13\n"}, {"type": "stdin_stdout", "input": "7\n0 -1 0 -5 0 -1 -3", "output": "3\n"}, {"type": "stdin_stdout", "input": "7\n0 -1 0 -5 0 -2 -3", "output": "3\n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Petya very much likes playing with little Masha. Recently he has received a game called \"Zero-One\" as a gift from his mother. Petya immediately offered Masha to play the game with him.\n\nBefore the very beginnin... | [{"type": "stdin_stdout", "input": "1110110101111111001111111110111011100001110111011001011111111111011010011111?111111?011111110001010110011111010111100111?111101010011101010?011111101010111111111101111010111?1111111100110110001111101111100100110011101111011110111000111?011110?111110?1011010111101111101111010100111110... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven an integer N not less than 3, find the sum of the interior angles of a regular polygon with N sides.\n\nPrint the answer in degrees, but do not print units.\n\nConstraints\n\n* 3 \\leq N \\leq 100\n\nInput\n\nInput ... | [{"type": "stdin_stdout", "input": "-636", "output": "-114840\n"}, {"type": "stdin_stdout", "input": "-729", "output": "-131580\n"}, {"type": "stdin_stdout", "input": "-102", "output": "-18720\n"}, {"type": "stdin_stdout", "input": "-161", "output": "-29340\n"}, {"type": "stdin_stdout", "input": "-151", "output": "-275... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe math faculty of Berland State University has suffered the sudden drop in the math skills of enrolling students. This year the highest grade on the entrance math test was 8. Out of 100! Thus, the decision was made to m... | [{"type": "stdin_stdout", "input": "100\n1 2 1 2 1 2 1 2 1 3 1 3 1 2 1 3 1 2 1 3 1 2 1 3 1 2 1 2 1 3 1 2 1 2 1 3 1 3 1 2 1 2 1 3 1 2 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 2 1 3 1 3 1 3 1 2 1 2 1 2 1 2 1 2 1 2 1 3 1 3 1 2 1 2 1 2 1 3 1 2 1 3 1 2 1 2\n", "output": "Finite\n331\n"}, {"type": "stdin_stdout", "input": "100\n2 1 3 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nABC Gene\n\nThere is a gene sequence represented by the string `ABC`. You can rewrite this gene sequence by performing the following operations several times.\n\n* Choose one of the letters `A`,` B`, `C`. Let this be x. R... | [{"type": "stdin_stdout", "input": "BAC", "output": "No\n"}, {"type": "stdin_stdout", "input": "ACB", "output": "No\n"}, {"type": "stdin_stdout", "input": "CAB", "output": "No\n"}, {"type": "stdin_stdout", "input": "CBA", "output": "No\n"}, {"type": "stdin_stdout", "input": "ACA", "output": "No\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya plays The Elder Trolls IV: Oblivon. Oh, those creators of computer games! What they do not come up with! Absolutely unique monsters have been added to the The Elder Trolls IV: Oblivon. One of these monsters is Unkil... | [{"type": "stdin_stdout", "input": "1000000 1000000 1000000 1000000000\n", "output": "1000000000000000000\n"}, {"type": "stdin_stdout", "input": "1000000 1000000 1001000 1000000000\n", "output": "1001000000000000000\n"}, {"type": "stdin_stdout", "input": "1000000 1000000 1011000 1000000000\n", "output": "10110000000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDr .: Peter, I've finally done it.\nPeter: What's wrong, Dr. David? Is it a silly invention again?\nDr .: This table, this table.\n\n\n| Character | Sign\n--- | ---\n(Blank) | 101\n'| 000000\n, | 000011\n-| 10010001\n. | ... | [{"type": "stdin_stdout", "input": "URQDE ERQSQN", "output": "TSE?DV E?GT'PA\n"}, {"type": "stdin_stdout", "input": "UEQDR ERQSQN", "output": "TTJ'GF E?GT'PA\n"}, {"type": "stdin_stdout", "input": "RDQEU ERQSQN", "output": "QGP-HF E?GT'PA\n"}, {"type": "stdin_stdout", "input": "QDQEU ERQSQN", "output": "T,M? OLUJ'NH,'\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two strings A and B representing essays of two students who are suspected cheaters. For any two strings C, D we define their similarity score S(C,D) as 4⋅ LCS(C,D) - |C| - |D|, where LCS(C,D) denotes the len... | [{"type": "stdin_stdout", "input": "175 190\nqnnnnnnnnnnrnnnnrnrnnnnnrnnnnrqnnnnnnannnnnnnrnrrnrnnnnnrnnrnnnnnnrnrnnnnnrnnnannnrrnnnnrnnnnnnnnnnnrnannnnnrnnnnrnnnnrnnnnnnrnarnnnnnnnnanrnnnnnnnrnnrrnrnrrnnnnnrnnnnnrnnnnnn\nnnnnnrnnnnrnnnnnrnnnnnnrnnqnnnnnnrnnnnnnnrnnrnnnnrnqnannnnnnnannnnnnnrnrnnnrnnnnrnnnnnnnrrnqnnnnnn... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOf course you have heard the famous task about Hanoi Towers, but did you know that there is a special factory producing the rings for this wonderful game? Once upon a time, the ruler of the ancient Egypt ordered the worke... | [{"type": "stdin_stdout", "input": "15\n1 30 1409523818\n12 13 463027806\n9 14 846985104\n20 21 770345346\n17 22 514758030\n2 15 438137019\n18 19 331182033\n16 29 613043570\n10 19 765879041\n6 7 960155075\n13 27 323764310\n24 25 724736351\n4 9 107208241\n3 8 992951987\n23 28 125300818\n", "output": "6581903942\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese , Russian and Vietnamese \n\nA number is called palindromic if its decimal representation is a palindrome. You are given a range, described by a pair of integers L and R. Find... | [{"type": "stdin_stdout", "input": "2\n2 10\n123 150", "output": "44\n272\n"}, {"type": "stdin_stdout", "input": "2\n1 10\n123 150", "output": "45\n272\n"}, {"type": "stdin_stdout", "input": "2\n1 10\n123 150", "output": "45\n272"}, {"type": "stdin_stdout", "input": "2\n1 7\n100 112", "output": "28\n212\n"}, {"type": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCreate a program that converts data based on the given conversion table.\n\nThe characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters... | [{"type": "stdin_stdout", "input": "3\nA a\n0 5\n5 4\n10\nB\nB\nC\n0\n1\n4\n5\na\nb\nA\n3\nA a\n0 5\n5 4\n10\nA\nB\nC\n0\n1\n4\n5\na\nb\nA\n0", "output": "BBC5144aba\naBC5144aba\n"}, {"type": "stdin_stdout", "input": "3\nA a\n0 0\n5 4\n10\nB\nB\nC\n0\n1\n4\n5\na\nb\nA\n3\nA a\n0 5\n5 4\n10\nA\nB\nC\n0\n1\n4\n5\na\nb\nA... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a tree consisting of $n$ vertices. A number is written on each vertex; the number on vertex $i$ is equal to $a_i$.\n\nRecall that a simple path is a path that visits each vertex at most once. Let the weight ... | [{"type": "stdin_stdout", "input": "20\n4 1 3 4 7 3 8 7 7 3 1 1 7 1 9 5 1 10 6 3\n6 15\n12 11\n18 1\n9 17\n8 1\n1 20\n13 7\n10 15\n20 19\n10 16\n8 5\n2 11\n14 3\n6 1\n1 12\n3 18\n6 4\n8 13\n9 18\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "10\n7 4 6 7 6 6 7 5 7 5\n8 7\n4 5\n9 6\n2 5\n4 8\n9 10\n4 3\n9 4\n1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOnce upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the... | [{"type": "stdin_stdout", "input": "A.He_nan_de_yang_guang_zhao_yao_zhe_wo_men_mei_guo_ren_lian_shang_dou_xiao_kai_yan_wahaaaaaaaaaaaaaaaa\nB.Li_bai_li_bai_fei_liu_zhi_xia_san_qian_chi_yi_si_yin_he_luo_jiu_tian_li_bai_li_bai_li_bai_li_bai_shi\nC.Peng_yu_xiang_shi_zai_tai_shen_le_jian_zhi_jiu_shi_ye_jie_du_liu_a_si_mi_d... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSensation, sensation in the two-dimensional kingdom! The police have caught a highly dangerous outlaw, member of the notorious \"Pihters\" gang. The law department states that the outlaw was driving from the gang's headqu... | [{"type": "stdin_stdout", "input": "10\nUR\nDR\nUL\nDR\nUL\nULDR\nUR\nUL\nULDR\nUL\n", "output": "45\n"}, {"type": "stdin_stdout", "input": "10\nUL\nUL\nUL\nUL\nUL\nUL\nUL\nUL\nUL\nUL\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "10\nUL\nUR\nUR\nDR\nDR\nDR\nDL\nDL\nDL\nDL\n", "output": "35\n"}, {"type": "st... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.