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\nJulia is going to cook a chicken in the kitchen of her dormitory. To save energy, the stove in the kitchen automatically turns off after k minutes after turning on.\n\nDuring cooking, Julia goes to the kitchen every d min... | [{"type": "stdin_stdout", "input": "312200625484460654 543737694709247394 1000000000000000000\n", "output": "\n1231537069224786756.000000000000\n"}, {"type": "stdin_stdout", "input": "81413279254461199 310548139128293806 1000000000000000000\n", "output": "\n1572837149684581510.000000000000\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe cities of Byteland and Berland are located on the axis Ox. In addition, on this axis there are also disputed cities, which belong to each of the countries in their opinion. Thus, on the line Ox there are three types o... | [{"type": "stdin_stdout", "input": "15\n-9518 R\n-6858 P\n-6726 B\n-6486 R\n-4496 P\n-4191 P\n-772 B\n-258 R\n-194 P\n1035 R\n2297 P\n4816 B\n5779 R\n9342 B\n9713 B\n", "output": "25088\n"}, {"type": "stdin_stdout", "input": "15\n-12454 R\n-6858 P\n-6726 B\n-6486 R\n-4496 P\n-4191 P\n-772 B\n-258 R\n-194 P\n1035 R\n229... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBerland Football Cup starts really soon! Commentators from all over the world come to the event.\n\nOrganizers have already built n commentary boxes. m regional delegations will come to the Cup. Every delegation should ge... | [{"type": "stdin_stdout", "input": "500000000001 1000000000000 100 100\n", "output": "49999999999900\n"}, {"type": "stdin_stdout", "input": "500000000001 1000000000000 110 100\n", "output": "50000000000100\n"}, {"type": "stdin_stdout", "input": "1000000000000 750000000001 10 100\n", "output": "5000000000020\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet \\mathrm{popcount}(n) be the number of `1`s in the binary representation of n. For example, \\mathrm{popcount}(3) = 2, \\mathrm{popcount}(7) = 3, and \\mathrm{popcount}(0) = 0.\n\nLet f(n) be the number of times the f... | [{"type": "stdin_stdout", "input": "23\n00110111001011011001111", "output": "3\n3\n2\n2\n3\n3\n2\n3\n3\n3\n2\n2\n3\n2\n2\n2\n2\n3\n2\n3\n3\n3\n2\n"}, {"type": "stdin_stdout", "input": "23\n00110111001011011101111", "output": "4\n4\n3\n3\n4\n3\n3\n3\n4\n4\n3\n4\n3\n3\n4\n3\n3\n3\n4\n3\n3\n3\n2\n"}, {"type": "stdin_stdou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is a positive even number N.\n\nFind the number of strings s of length N consisting of `A`, `B`, and `C` that satisfy the following condition:\n\n* s can be converted to the empty string by repeating the following o... | [{"type": "stdin_stdout", "input": "1100000", "output": "298228697\n"}, {"type": "stdin_stdout", "input": "0110000", "output": "784164463\n"}, {"type": "stdin_stdout", "input": "0110010", "output": "189920713\n"}, {"type": "stdin_stdout", "input": "1100010", "output": "865187132\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits \"1974\".\n\nConstraints\n\n* 0 \\leq N_1, N_2, N_3, N_4 \\leq 9\n* N_1, N_2, N_3 and N_4 are integers.\n\nIn... | [{"type": "stdin_stdout", "input": "-1 3 13 -1", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-1 2 13 -1", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-1 2 17 -1", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-1 2 -1 24", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-1 2 17 -2", "ou... | 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.\n\nDetermine if S equals T after rotation.\n\nThat is, determine if S equals T after the following operation is performed some number of times:\n\nOper... | [{"type": "stdin_stdout", "input": "aaaaaaaaaaaaaaab\naaaabaaaaaaaaaaa", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "aaaaaaaaaaaaaaab\naaaaaaaaaaaaaaab", "output": "Yes"}, {"type": "stdin_stdout", "input": "aaaaaabaaaaaaaab\naaaabaaaaaaaaaaa", "output": "No\n"}, {"type": "stdin_stdout", "input": "aaaaaabaaaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a sandglass that runs for X seconds. The sand drops from the upper bulb at a rate of 1 gram per second. That is, the upper bulb initially contains X grams of sand.\n\nHow many grams of sand will the upper bulb con... | [{"type": "stdin_stdout", "input": "1111100011 0101011000", "output": "1010089011\n"}, {"type": "stdin_stdout", "input": "1111100111 0101011000", "output": "1010089111\n"}, {"type": "stdin_stdout", "input": "1100001110 0010011100", "output": "1089990010\n"}, {"type": "stdin_stdout", "input": "1110001110 0010011100", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke arranged N colorful balls in a row. The i-th ball from the left has color c_i and weight w_i.\n\nHe can rearrange the balls by performing the following two operations any number of times, in any order:\n\n* Operatio... | [{"type": "stdin_stdout", "input": "21 77 68\n16 73\n16 99\n19 66\n2 87\n2 16\n7 17\n10 36\n18 68\n2 38\n10 74\n13 55\n21 21\n3 7\n12 41\n13 88\n18 6\n2 12\n13 87\n1 18\n2 27\n13 15", "output": "908107200"}, {"type": "stdin_stdout", "input": "21 77 68\n16 73\n16 99\n19 66\n2 87\n2 16\n7 17\n3 36\n18 68\n2 38\n10 74\n13... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N balls and N+1 holes in a line. Balls are numbered 1 through N from left to right. Holes are numbered 1 through N+1 from left to right. The i-th ball is located between the i-th hole and (i+1)-th hole. We denot... | [{"type": "stdin_stdout", "input": "1000 100 100", "output": "649620280.957660079002380"}, {"type": "stdin_stdout", "input": "1110 100 110", "output": "894375868.485796213150\n"}, {"type": "stdin_stdout", "input": "1110 101 110", "output": "894383190.732867240906\n"}, {"type": "stdin_stdout", "input": "1110 111 100", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n<image>\n\n\nMy grandmother uses a balance. The balance will balance if you place the same size on both of the two dishes, otherwise it will tilt to the heavier side. The weights of the 10 weights are 1g, 2g, 4g, 8g, 16g,... | [{"type": "stdin_stdout", "input": "5\n11\n731", "output": "1 4\n1 2 8\n1 2 8 16 64 128 512\n"}, {"type": "stdin_stdout", "input": "5\n17\n731", "output": "1 4\n1 16\n1 2 8 16 64 128 512\n"}, {"type": "stdin_stdout", "input": "5\n17\n994", "output": "1 4\n1 16\n2 32 64 128 256 512\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe number obtained by multiplying 1 by 2, 3, 5 several times (0 or more times) is called the Hamming numbers. For example\n\n* 1\n* 1 x 2 x 2 = 4\n* 1 x 2 x 2 x 3 x 5 x 5 = 300\n\n\n\nEtc. are humming numbers, but 11, 13... | [{"type": "stdin_stdout", "input": "3 16\n2 35\n1 140\n0", "output": "10\n18\n39\n"}, {"type": "stdin_stdout", "input": "6 16\n2 35\n1 140\n0", "output": "7\n18\n39\n"}, {"type": "stdin_stdout", "input": "6 9\n10 36\n1 172\n0", "output": "3\n12\n43\n"}, {"type": "stdin_stdout", "input": "3 8\n2 27\n1 140\n0", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nSoccer is popular in JOI, and a league match called the JOI League is held every week.\n\nThere are N teams in the JOI league, numbered from 1 to N. All combinations of matches are played exactly once. In other... | [{"type": "stdin_stdout", "input": "4\n1 1 0 21\n1 4 2 0\n1 -1 12 2\n4 3 1 3\n4 16 6 1\n-1 1 1 12", "output": "1\n4\n2\n2\n"}, {"type": "stdin_stdout", "input": "4\n1 2 0 19\n2 3 2 2\n1 0 22 1\n3 3 3 -1\n3 16 6 0\n0 1 -1 8", "output": "2\n3\n1\n4\n"}, {"type": "stdin_stdout", "input": "4\n1 2 0 19\n2 3 8 1\n2 0 22 1\n3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\nanagram\ngrandmother\n\n\nOutput\n\n4\n\nThe input will be given via stdin and the output should be printed to stdout by your code.\n\nNow solve the problem by providing the code.\n\nWrite Python code ... | [{"type": "stdin_stdout", "input": "anagram\ngrandmosher", "output": "4\n"}, {"type": "stdin_stdout", "input": "anbgram\ngrandmosher", "output": "3\n"}, {"type": "stdin_stdout", "input": "anbfram\ngrandmosher", "output": "2\n"}, {"type": "stdin_stdout", "input": "narfamb\nreoahmodsrg", "output": "1\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n rabbits, one in each of the huts numbered 0 through n − 1.\n\nAt one point, information came to the rabbits that a secret organization would be constructing an underground passage. The underground passage woul... | [{"type": "stdin_stdout", "input": "4 10\n1 0 1\n1 0 2\n3 1 2\n2 0 1\n1 3 3\n3 0 1\n1 0 1\n3 0 2\n1 2 3\n3 0 2", "output": "YES\nNO\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "8 10\n1 0 1\n1 0 2\n3 1 3\n2 0 1\n1 3 3\n3 0 1\n1 0 1\n3 0 2\n1 1 3\n3 0 0", "output": "NO\nNO\nYES\nYES\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nD: Anipero 2012\n\nAnipero Summer Live, commonly known as Anipero, is the largest anime song live event in Japan where various anime song artists gather. 2D, who loves anime songs, decided to go to Anipero this year as we... | [{"type": "stdin_stdout", "input": "1 1\n-1 -3 54", "output": "54\n"}, {"type": "stdin_stdout", "input": "1 0\n0 -10 25", "output": "25\n"}, {"type": "stdin_stdout", "input": "1 0\n-2 -2 -1", "output": "-1\n"}, {"type": "stdin_stdout", "input": "1 4\n0 2 108", "output": "108\n"}, {"type": "stdin_stdout", "input": "1 0\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nGiven the integer n, output the smallest m such that nCm (the number of combinations that choose m out of n different ones) is even.\n\nConstraints\n\nThe input satisfies the following conditions.\n\n* 1 ≤ n ≤ ... | [{"type": "stdin_stdout", "input": "127", "output": "128\n"}, {"type": "stdin_stdout", "input": "255", "output": "256\n"}, {"type": "stdin_stdout", "input": "175", "output": "16\n"}, {"type": "stdin_stdout", "input": "111", "output": "16"}, {"type": "stdin_stdout", "input": "101", "output": "2\n"}, {"type": "stdin_stdo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDraw a frame which has a height of H cm and a width of W cm. For example, the following figure shows a frame which has a height of 6 cm and a width of 10 cm.\n\n\n\n........#\n........#\n........#\n........#\n\n\n\nConstr... | [{"type": "stdin_stdout", "input": "5 7\n2 1\n17 12\n0 0", "output": "#######\n#.....#\n#.....#\n#.....#\n#######\n\n#\n#\n\n############\n#..........#\n#..........#\n#..........#\n#..........#\n#..........#\n#..........#\n#..........#\n#..........#\n#..........#\n#..........#\n#..........#\n#..........#\n#..........#\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVova plans to go to the conference by train. Initially, the train is at the point 1 and the destination point of the path is the point L. The speed of the train is 1 length unit per minute (i.e. at the first minute the tr... | [{"type": "stdin_stdout", "input": "10\n10 1 1 1\n10 1 1 2\n10 1 1 3\n10 1 1 4\n10 1 1 5\n10 1 1 6\n10 1 1 7\n10 1 1 8\n10 1 1 9\n10 1 1 10\n", "output": "9\n8\n7\n6\n5\n4\n3\n2\n1\n0\n"}, {"type": "stdin_stdout", "input": "10\n10 2 1 1\n10 2 1 2\n10 2 1 3\n10 2 1 4\n10 2 1 5\n10 2 1 6\n10 2 1 7\n10 2 1 8\n10 2 1 9\n10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya wants to buy himself a nice new car. Unfortunately, he lacks some money. Currently he has exactly 0 burles.\n\nHowever, the local bank has n credit offers. Each offer can be described with three numbers a_i, b_i and... | [{"type": "stdin_stdout", "input": "8\n54 29 4\n40 94 7\n54 44 1\n26 74 4\n4 5 1\n25 18 3\n90 28 3\n0 11 9\n", "output": "126\n"}, {"type": "stdin_stdout", "input": "8\n58 29 4\n40 74 5\n54 27 1\n18 74 4\n5 8 1\n25 18 3\n90 28 3\n3 7 5\n", "output": "147\n"}, {"type": "stdin_stdout", "input": "8\n58 29 4\n40 74 5\n54 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by n streets along the Eastern direction and m streets across the Southern direction. Naturally, this city has nm int... | [{"type": "stdin_stdout", "input": "1 100\n855 316 601 28 311 798 783 276 504 1230 521 358 377 467 623 767 481 645 855 608 157 95 273 261 110 713 948 897 872 476 855 337 147 377 648 441 215 1231 505 69 858 99 877 187 237 115 824 98 955 192 773 99 538 385 861 849 772 993 470 249 582 635 986 515 84 7 476 831 903 74 79 54... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIvan is going to sleep now and wants to set his alarm clock. There will be many necessary events tomorrow, the i-th of them will start during the x_i-th minute. Ivan doesn't want to skip any of the events, so he has to se... | [{"type": "stdin_stdout", "input": "2 1\n500000000000000000 1000010000000000000\n700000000\n", "output": "YES\n500000000000000000 1\n"}, {"type": "stdin_stdout", "input": "2 2\n1 1000000000000000000\n1000000000000000000 1000000000000000000\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "2 2\n1 100000000000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's write all the positive integer numbers one after another from 1 without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313... | [{"type": "stdin_stdout", "input": "1000000000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "100000000083\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "523452345325\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "999999999999\n", "output": "9\n"}, {"type": "stdin_stdout", "input": "100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp analyzes the prices of the new berPhone. At his disposal are the prices for n last days: a_1, a_2, ..., a_n, where a_i is the price of berPhone on the day i.\n\nPolycarp considers the price on the day i to be bad... | [{"type": "stdin_stdout", "input": "5\n6\n3 5 4 12 2 5\n1\n1000000\n2\n2 0\n10\n31 41 59 26 82 66 97 127 23 84\n7\n2 2 1 2 3 4 5\n", "output": "4\n0\n1\n8\n2\n"}, {"type": "stdin_stdout", "input": "5\n6\n3 5 4 12 2 5\n1\n1000000\n2\n2 0\n10\n31 41 50 26 82 66 97 127 23 84\n7\n2 2 1 2 3 4 5\n", "output": "4\n0\n1\n8\n2\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn order to do some research, n^2 labs are built on different heights of a mountain. Let's enumerate them with integers from 1 to n^2, such that the lab with the number 1 is at the lowest place, the lab with the number 2 ... | [{"type": "stdin_stdout", "input": "135\n", "output": "1 270 271 540 541 810 811 1080 1081 1350 1351 1620 1621 1890 1891 2160 2161 2430 2431 2700 2701 2970 2971 3240 3241 3510 3511 3780 3781 4050 4051 4320 4321 4590 4591 4860 4861 5130 5131 5400 5401 5670 5671 5940 5941 6210 6211 6480 6481 6750 6751 7020 7021 7290 7291... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is the easier version of the problem. In this version, 1 ≤ n ≤ 10^5 and 0 ≤ a_i ≤ 1. You can hack this problem only if you solve and lock both problems.\n\nChristmas is coming, and our protagonist, Bob, is preparing ... | [{"type": "stdin_stdout", "input": "100\n1 1 0 1 1 1 1 0 1 0 0 1 1 1 1 1 0 1 0 1 0 1 1 1 1 1 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 0 0 1 0 1 0 1 1 0 0 1 0 0 1 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 0 1 0 1 1 1 1\n", "output": "1908\n"}, {"type": "stdin_stdout", "input": "100\n1 1 1 1 0 1 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp has built his own web service. Being a modern web service it includes login feature. And that always implies password security problems.\n\nPolycarp decided to store the hash of the password, generated by the fol... | [{"type": "stdin_stdout", "input": "5\nabacaba\nzyxaabcaabkjh\nonetwothree\nthreetwoone\none\nzzonneyy\none\nnone\ntwenty\nten\n", "output": "YES\nYES\nNO\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "5\nabacaba\nzyxaabcaabkjh\nonetwothree\nthreetwoone\none\nzzonneyy\neno\nnone\ntwenty\nten\n", "output": "YES\nYES\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTanya wants to go on a journey across the cities of Berland. There are n cities situated along the main railroad line of Berland, and these cities are numbered from 1 to n. \n\nTanya plans her journey as follows. First of... | [{"type": "stdin_stdout", "input": "10\n10 60 12 13 14 15 16 66 18 130\n", "output": "130\n"}, {"type": "stdin_stdout", "input": "10\n10 60 12 13 14 15 16 77 18 130\n", "output": "130\n"}, {"type": "stdin_stdout", "input": "9\n18 11 24 7 18 10 1 20 17\n", "output": "24\n"}, {"type": "stdin_stdout", "input": "9\n4 10 21... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJohnny has recently found an ancient, broken computer. The machine has only one register, which allows one to put in there one variable. Then in one operation, you can shift its bits left or right by at most three positio... | [{"type": "stdin_stdout", "input": "10\n10 5\n11 73\n17 21\n1 1\n96 3\n2 128\n0001 1100611139403776\n1000000000000000000 1000000001000000000\n7 1\n10 8\n", "output": "1\n-1\n-1\n0\n2\n2\n-1\n-1\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "10\n10 5\n11 73\n17 18\n1 1\n96 3\n2 128\n0001 1100611139403776\n1000000000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a of length n, and an integer x. You can perform the following operation as many times as you would like (possibly zero): replace two adjacent elements of the array by their sum. For example, if the... | [{"type": "stdin_stdout", "input": "1\n20 1\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n", "output": "20000000000 20000000000\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe \\text{gcdSum} of a positive integer is the gcd of that integer with its sum of digits. Formally, \\text{gcdSum}(x) = gcd(x, sum of digits of x) for a positive integer x. gcd(a, b) denotes the greatest common diviso... | [{"type": "stdin_stdout", "input": "3\n17\n110\n182\n", "output": "18\n110\n183\n"}, {"type": "stdin_stdout", "input": "3\n17\n110\n359\n", "output": "18\n110\n360\n"}, {"type": "stdin_stdout", "input": "3\n17\n100\n359\n", "output": "18\n102\n360\n"}, {"type": "stdin_stdout", "input": "3\n33\n100\n359\n", "output": "3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn a strip of land of length n there are k air conditioners: the i-th air conditioner is placed in cell a_i (1 ≤ a_i ≤ n). Two or more air conditioners cannot be placed in the same cell (i.e. all a_i are distinct).\n\nEac... | [{"type": "stdin_stdout", "input": "1\n\n101 1\n1\n1000000000\n", "output": "1000000000 1000000001 1000000002 1000000003 1000000004 1000000005 1000000006 1000000007 1000000008 1000000009 1000000010 1000000011 1000000012 1000000013 1000000014 1000000015 1000000016 1000000017 1000000018 1000000019 1000000020 1000000021 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has been playing Plane of Tanks with his friends the whole year. Now it is time to divide the participants into several categories depending on their results. \n\nA player is given a non-negative integer number of p... | [{"type": "stdin_stdout", "input": "10\nj 10\ni 9\nh 8\ng 7\nf 6\ne 5\nd 4\nc 3\nb 2\na 1\n", "output": "10\na noob\nb noob\nc noob\nd noob\ne random\nf random\ng random\nh average\ni hardcore\nj pro\n"}, {"type": "stdin_stdout", "input": "10\na 1\nb 2\nc 3\nd 4\ne 5\nf 6\ng 7\nh 8\ni 9\nj 10\n", "output": "10\na noob\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya is developing his own programming language VPL (Vasya Programming Language). Right now he is busy making the system of exceptions. He thinks that the system of exceptions must function like that.\n\nThe exceptions a... | [{"type": "stdin_stdout", "input": "21\n try \n try \n try \n try \n try \n try \n try \n try \n try \n try \n throw( qtSMze) \ncatch(LY,\"x3 j\")\ncatch(hgSAFgbMGx,\"moByu\")\ncatch(LmydVQgv,\"hbZl\")\ncatch(oK,\"B6OZx qy\")\ncatch(rrtnRQB,\"7VFkQMv\")\ncatch(CASqQXaz,\"d9oci1Kx\")\ncatch(CTCzs... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nManao has invented a new mathematical term — a beautiful set of points. He calls a set of points on a plane beautiful if it meets the following conditions:\n\n 1. The coordinates of each point in the set are integers. \n... | [{"type": "stdin_stdout", "input": "105 154\n", "output": "106\n0 105\n1 104\n2 103\n3 102\n4 101\n5 100\n6 99\n7 98\n8 97\n9 96\n10 95\n11 94\n12 93\n13 92\n14 91\n15 90\n16 89\n17 88\n18 87\n19 86\n20 85\n21 84\n22 83\n23 82\n24 81\n25 80\n26 79\n27 78\n28 77\n29 76\n30 75\n31 74\n32 73\n33 72\n34 71\n35 70\n36 69\n3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nXenia has a set of weights and pan scales. Each weight has an integer weight from 1 to 10 kilos. Xenia is going to play with scales and weights a little. For this, she puts weights on the scalepans, one by one. The first ... | [{"type": "stdin_stdout", "input": "1100000011\n1000\n", "output": "YES\n1 2 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 2 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 2 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 2 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 2 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 2 9 10 9 10 9 10 9 10 9 10 9 10 9 10 9 2 9 10 9 10... | 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\nLittle Chris is very keen on his toy blocks. His teacher, however, wants Chris to solve more problems, so he decided to play a trick on Chris.\n\nThere are exactly s blocks in Chris's set, each block has a unique number f... | [{"type": "stdin_stdout", "input": "10\n1 100000 199999 299998 399997 499996 599995 699994 799993 899992\n", "output": "10\n1000000 900001 800002 700003 600004 500005 400006 300007 200008 100009 "}, {"type": "stdin_stdout", "input": "10\n63649 456347 779 458642 201571 534312 583774 283450 377377 79066\n", "output": "10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRyouko is an extremely forgetful girl, she could even forget something that has just happened. So in order to remember, she takes a notebook with her, called Ryouko's Memory Note. She writes what she sees and what she hea... | [{"type": "stdin_stdout", "input": "100 100\n28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCelebrating the new year, many people post videos of falling dominoes; Here's a list of them: https://www.youtube.com/results?search_query=New+Years+Dominos\n\nUser ainta, who lives in a 2D world, is going to post a video... | [{"type": "stdin_stdout", "input": "10\n142699629 183732682\n229190264 203769218\n582937498 331846994\n637776490 872587100\n646511567 582113351\n708368481 242093919\n785185417 665206490\n827596004 933089845\n905276008 416253629\n916536536 583835690\n5\n9 10\n4 9\n1 10\n6 10\n4 5\n", "output": "0\n0\n149978016\n0\n0\n"}... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA sweet little monster Om Nom loves candies very much. One day he found himself in a rather tricky situation that required him to think a bit in order to enjoy candies the most. Would you succeed with the same task if you... | [{"type": "stdin_stdout", "input": "925819493 47350513 28377591 119226256 49881078\n", "output": "510796638\n"}, {"type": "stdin_stdout", "input": "930064129 32726326 25428197 158103592 64501049\n", "output": "355994758\n"}, {"type": "stdin_stdout", "input": "238447222 36679609 23634069 64467968 41539167\n", "output": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider the infinite sequence of integers: 1, 1, 2, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 4, 5.... The sequence is built in the following way: at first the number 1 is written out, then the numbers from 1 to 2, then the numbers ... | [{"type": "stdin_stdout", "input": "99999998250180\n", "output": "14142135\n"}, {"type": "stdin_stdout", "input": "100000000000000\n", "output": "1749820\n"}, {"type": "stdin_stdout", "input": "1001000000000\n", "output": "1404260\n"}, {"type": "stdin_stdout", "input": "1001000001000\n", "output": "1405260\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n workers in a company, each of them has a unique id from 1 to n. Exaclty one of them is a chief, his id is s. Each worker except the chief has exactly one immediate superior.\n\nThere was a request to each of t... | [{"type": "stdin_stdout", "input": "10 6\n3 0 0 0 0 0 0 1 0 0\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "10 6\n3 1 0 0 0 0 0 1 0 0\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "10 6\n3 0 1 0 0 0 0 1 0 1\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "10 6\n3 0 0 0 0 0 0 1 0 1\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRunning with barriers on the circle track is very popular in the country where Dasha lives, so no wonder that on her way to classes she saw the following situation:\n\nThe track is the circle with length L, in distinct po... | [{"type": "stdin_stdout", "input": "50 100\n0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98\n1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n\n\nInput\n\nThe only line of the input contains a string of digits. The length of the string is between 1 and 10, inclusive.\n\nOutput\n\nOutput \"Yes\" or \"No\".\n\nExamples\n\nInput\n\n373\n\n\nOutput\n\nYes\n\n\nInpu... | [{"type": "stdin_stdout", "input": "4357087936\n", "output": "YES"}, {"type": "stdin_stdout", "input": "3333333333\n", "output": "YES"}, {"type": "stdin_stdout", "input": "2577546136\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "1513778395\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "2989131141... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA few years ago Sajjad left his school and register to another one due to security reasons. Now he wishes to find Amir, one of his schoolmates and good friends.\n\nThere are n schools numerated from 1 to n. One can travel... | [{"type": "stdin_stdout", "input": "120494\n", "output": "60246\n"}, {"type": "stdin_stdout", "input": "116591\n", "output": "58295\n"}, {"type": "stdin_stdout", "input": "110052\n", "output": "55025\n"}, {"type": "stdin_stdout", "input": "101000\n", "output": "50499\n"}, {"type": "stdin_stdout", "input": "150380\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Fire Lord attacked the Frost Kingdom. He has already got to the Ice Fortress, where the Snow Queen dwells. He arranged his army on a segment n in length not far from the city walls. And only the frost magician Solomon... | [{"type": "stdin_stdout", "input": "23\n99 110 99 100 100 100 100 99 100 99 99 100 000 100 99 111 100 100 100 99 99 99 99\n", "output": "ARARARARARARARARARARARARALLLLLLLLLLLLAARARARARARARARARARARARARALLLLLLLLLLLLAARARARARARARARARARARARARALLLLLLLLLLLLAARARARARARARARARARARARARALLLLLLLLLLLLAARARARARARARARARARARARARALLLLLL... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp likes to play with numbers. He takes some integer number x, writes it down on the board, and then performs with it n - 1 operations of the two kinds: \n\n * divide the number x by 3 (x must be divisible by 3); \... | [{"type": "stdin_stdout", "input": "19\n46875000000000000 732421875000000 5859375000000000 11444091796875 2929687500000000 187500000000000000 91552734375000 11718750000000000 3000000000000000000 22888183593750 1464843750000000 375000000000000000 45776367187500 183105468750000 93750000000000000 366210937500000 234375000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's introduce a number system which is based on a roman digits. There are digits I, V, X, L which correspond to the numbers 1, 5, 10 and 50 respectively. The use of other roman digits is not allowed.\n\nNumbers in this ... | [{"type": "stdin_stdout", "input": "1000000001\n", "output": "48999999802\n"}, {"type": "stdin_stdout", "input": "1897400395\n", "output": "92972619108\n"}, {"type": "stdin_stdout", "input": "1100000001\n", "output": "53899999802\n"}, {"type": "stdin_stdout", "input": "1533257378\n", "output": "75129611275\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob are fighting over who is a superior debater. However they wish to decide this in a dignified manner. \nSo they decide to fight in the Battle of Words. \n\nIn each game both get to speak a sentence. Because t... | [{"type": "stdin_stdout", "input": "3\nh will niw\nwill g\nuodby ro tomorwor\nyadot ro tnmorsov nda yetterday\nh card yot\ndac daz\n\nT@LPLE", "output": "You draw some.\nYou draw some.\nYou draw some.\n"}, {"type": "stdin_stdout", "input": "3\nh wjll win\nwill i\ntoday or tomorrow\ntoday or tomorrow and yesterday\ni da... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice is climbing stairs. There are total N stairs. She climbs A stairs upwards in day and she comes downstairs in night by B stairs. Find number of days she will take to reach the top of staircase. \n\nInput: \nFirst a... | [{"type": "stdin_stdout", "input": "123461 123460 998998998", "output": "998875538\n"}, {"type": "stdin_stdout", "input": "123461 123460 405371410", "output": "405247950\n"}, {"type": "stdin_stdout", "input": "123461 123460 375772283", "output": "375648823\n"}, {"type": "stdin_stdout", "input": "123461 123460 45956662"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTeam India is playing too much cricket in this season. Team players are getting better in their performance with match by match. Sir Jadeja has become a Trump Card for M.S Dhoni. There is a hidden reason of his special po... | [{"type": "stdin_stdout", "input": "1000\n509869197\n704921863\n747550363\n299599178\n307311852\n292108723\n323673613\n406319034\n5990172\n892556229\n812345922\n189962849\n544886888\n836735222\n79035005\n635127190\n588939927\n354303480\n599514650\n49434020\n908869585\n113013398\n833715652\n721245910\n582288889\n2394574... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have N lamps numbered 1 to N, and N buttons numbered 1 to N. Initially, Lamp 1, 2, \\cdots, A are on, and the other lamps are off.\n\nSnuke and Ringo will play the following game.\n\n* First, Ringo generates a permutat... | [{"type": "stdin_stdout", "input": "9479599 4999", "output": "395563313\n"}, {"type": "stdin_stdout", "input": "4734557 4999", "output": "743624188\n"}, {"type": "stdin_stdout", "input": "9999999 4999", "output": "90395416"}, {"type": "stdin_stdout", "input": "7100253 4999", "output": "2548353\n"}, {"type": "stdin_stdo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A. There is no other way to decrease the monster's health.\n\nServal wins when the monste... | [{"type": "stdin_stdout", "input": "11000 1", "output": "11000\n"}, {"type": "stdin_stdout", "input": "10010 1", "output": "10010\n"}, {"type": "stdin_stdout", "input": "10001 1", "output": "10001\n"}, {"type": "stdin_stdout", "input": "11010 1", "output": "11010\n"}, {"type": "stdin_stdout", "input": "10101 1", "outpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N people standing in a queue from west to east.\n\nGiven is a string S of length N representing the directions of the people. The i-th person from the west is facing west if the i-th character of S is `L`, and e... | [{"type": "stdin_stdout", "input": "13 4\nLRRLRLRRLRLLR", "output": "11\n"}, {"type": "stdin_stdout", "input": "13 8\nLRRLRLRRLRLLR", "output": "12\n"}, {"type": "stdin_stdout", "input": "13 8\nRLLRLRRLRLRRL", "output": "12\n"}, {"type": "stdin_stdout", "input": "13 9\nRLLRLRRLRLRRL", "output": "12\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a rectangular grid of squares with H horizontal rows and W vertical columns. Let (i,j) denote the square at the i-th row from the top and the j-th column from the left. On this grid, there is a piece, which is ini... | [{"type": "stdin_stdout", "input": "2 6 11\n2 1\nRLDRRUDDLRL\nURRDRLLDLRD", "output": "NO\n"}, {"type": "stdin_stdout", "input": "5 6 11\n2 0\nRLDRRUDDLRL\nURRDRLLDLRD", "output": "NO\n"}, {"type": "stdin_stdout", "input": "4 6 11\n2 1\nRLDRRUDDLRL\nURRDRLLDLRD", "output": "NO\n"}, {"type": "stdin_stdout", "input": "5 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nButCoder Inc. runs a programming competition site called ButCoder. In this site, a user is given an integer value called rating that represents his/her skill, which changes each time he/she participates in a contest. The ... | [{"type": "stdin_stdout", "input": "1110010000100001010 -1 -2", "output": "2220020000200002023\n"}, {"type": "stdin_stdout", "input": "1110010000100001010 -1 -3", "output": "1110010000100001013\n"}, {"type": "stdin_stdout", "input": "1100000010001000010 -1 -10", "output": "244444446666888893\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs I was cleaning up the warehouse, I found an old document that describes how to get to the treasures of my ancestors. The following was written in this ancient document.\n\n\n1. First, stand 1m east of the well on the o... | [{"type": "stdin_stdout", "input": "3\n43\n-1", "output": "0.292893218813 1.70710678119\n-0.0858570939893 -6.55687643314\n"}, {"type": "stdin_stdout", "input": "3\n80\n-1", "output": "0.292893218813 1.70710678119\n-8.93660061545 -0.370363928973\n"}, {"type": "stdin_stdout", "input": "3\n159\n-1", "output": "0.292893218... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn architect, Devunky, who lives in Water Deven, has been asked to renovate an old large hospital.\n\nIn some countries, people don't want to use numbers that are disliked as numerophobia (4 and 9 are famous in Japan). Ho... | [{"type": "stdin_stdout", "input": "15\n100\n1000000000\n1\n0", "output": "19\n155\n9358757000\n1\n"}, {"type": "stdin_stdout", "input": "15\n110\n1000000000\n1\n0", "output": "19\n178\n9358757000\n1\n"}, {"type": "stdin_stdout", "input": "15\n101\n1000000000\n3\n0", "output": "19\n157\n9358757000\n3\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a cross-section paper with W x H squares, and each of them is painted either in white or black. You want to re-arrange the squares into a neat checkered pattern, in which black and white squares are arranged alte... | [{"type": "stdin_stdout", "input": "3 5\n1 -1 -1\n1 -1 0", "output": "no\n"}, {"type": "stdin_stdout", "input": "3 5\n1 -1 -1\n1 -1 1", "output": "no\n"}, {"type": "stdin_stdout", "input": "3 2\n1 -1 -1\n1 -1 1", "output": "no\n"}, {"type": "stdin_stdout", "input": "3 5\n1 -1 -1\n1 -2 0", "output": "no\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGood evening, contestants.\n\nIf a and d are relatively prime positive integers, the arithmetic sequence beginning with a and increasing by d, i.e., a, a + d, a + 2d, a + 3d, a + 4d, ..., contains infinitely many prime nu... | [{"type": "stdin_stdout", "input": "367 186 151\n179 10 203\n271 37 39\n103 230 1\n27 104 285\n253 50 85\n1 1 1\n9075 337 210\n307 40 79\n331 221 177\n259 170 40\n269 75 102\n0 0 0", "output": "92809\n6709\n12037\n103\n153739\n14503\n2\n899429\n10667\n412717\n22699\n38669\n"}, {"type": "stdin_stdout", "input": "367 186... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFrom 1603 to 1867, people call that era the EDO era. EDO stands for Enhanced Driving Operation, the most advanced space navigation technology at the time, and was developed by Dr. Izy in 1603.\n\nYou are a space adventure... | [{"type": "stdin_stdout", "input": "2\n10 11\n11 12\n2\nN 2\nE 1\n2\n10 11\n11 12\n2\nN 2\nW 1\n3\n0 15\n5 10\n5 15\n5\nW 20\nS 10\nN 20\nE 10\nS 10\n0", "output": "Yes\nNo\nNo\n"}, {"type": "stdin_stdout", "input": "2\n10 11\n11 12\n2\nN 2\nE 1\n2\n10 11\n11 12\n2\nN 3\nW 1\n3\n0 15\n5 10\n5 15\n5\nW 20\nS 10\nN 20\nE... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n2\n1 2\n\n\nOutput\n\n2\n\nThe input will be given via stdin and the output should be printed to stdout by your code.\n\nNow solve the problem by providing the code.\n\nWrite Python code to solve this ... | [{"type": "stdin_stdout", "input": "2\n-1 -12", "output": "12\n"}, {"type": "stdin_stdout", "input": "2\n-1 12", "output": "-1\n"}, {"type": "stdin_stdout", "input": "2\n-1 24", "output": "-1\n"}, {"type": "stdin_stdout", "input": "2\n-2 24", "output": "-1\n"}, {"type": "stdin_stdout", "input": "2\n-2 22", "output": "-... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nC: Prayer (Pray)\n\nSome twins are famous for praying before the contest.\n\nThere are four integers $ H, W, X, Y $, and it seems unlucky if $ H \\ times W $ and $ x + y $ are both odd numbers.\n\ninput\n\nFour integers $... | [{"type": "stdin_stdout", "input": "-1 -1 -3 -1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-2 -1 -3 -1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-2 -1 -4 -1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "0 -1 -4 -1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "0 -1 -3 -... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which print coordinates $(x_i, y_i)$ of given $n$ points on the plane by the following criteria.\n\n1. first by $x$-coordinate\n2. in case of a tie, by $y$-coordinate\n\nConstraints\n\n* $1 \\leq n \\leq 1... | [{"type": "stdin_stdout", "input": "5\n-1 3\n1 15\n-1 1\n-1 -1\n-1 -1", "output": "-1 -1\n-1 -1\n-1 1\n-1 3\n1 15\n"}, {"type": "stdin_stdout", "input": "5\n-1 3\n1 15\n-1 0\n-1 -1\n-1 -1", "output": "-1 -1\n-1 -1\n-1 0\n-1 3\n1 15\n"}, {"type": "stdin_stdout", "input": "5\n-1 3\n1 22\n-1 0\n-1 -1\n-1 -1", "output": "-... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDigory Kirke and Polly Plummer are two kids living next door to each other. The attics of the two houses are connected to each other through a passage. Digory's Uncle Andrew has been secretly doing strange things in the a... | [{"type": "stdin_stdout", "input": "4\n####\n##.#..#\n##..#.#\n##.#....#", "output": "0\n2\n1\n2\n"}, {"type": "stdin_stdout", "input": "4\n####\n#..#.##\n##..#.#\n##.#....#", "output": "0\n1\n1\n2\n"}, {"type": "stdin_stdout", "input": "4\n####\n#..#.##\n#.#..##\n##.#....#", "output": "0\n1\n2\n2\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is one apple tree in Arkady's garden. It can be represented as a set of junctions connected with branches so that there is only one way to reach any junctions from any other one using branches. The junctions are enu... | [{"type": "stdin_stdout", "input": "10\n1 2 2 3 3 4 4 5 5\n", "output": "1 1 1 1 1 2 2 3 5 5 \n"}, {"type": "stdin_stdout", "input": "10\n1 1 1 1 1 1 1 1 1\n", "output": "1 1 1 1 1 1 1 1 1 9 \n"}, {"type": "stdin_stdout", "input": "10\n1 1 2 4 2 4 1 8 8\n", "output": "1 1 1 1 1 1 2 2 3 6\n"}, {"type": "stdin_stdout", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEveryone knows that computers become faster and faster. Recently Berland scientists have built a machine that can move itself back in time!\n\nMore specifically, it works as follows. It has an infinite grid and a robot wh... | [{"type": "stdin_stdout", "input": "2\n236675740 1140949963\n555555555 555555555\n", "output": "ds10utsusdtedslss10utsusdtedslss10utsusdtedslss10utsusdtedslss10utsusdtedslss10utsusdtedslss10utsusdtedslss10utsusdtedslss10utsusdtedslss10utsusdtedslss10utsusdtedslss10utsusdtedslss10utsusdtedslss10utsusdtedslss10utsusdteds... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob are playing a game on a line with n cells. There are n cells labeled from 1 through n. For each i from 1 to n-1, cells i and i+1 are adjacent.\n\nAlice initially has a token on some cell on the line, and Bob... | [{"type": "stdin_stdout", "input": "50 75\n2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "50 75\n2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVus the Cossack has a field with dimensions n × m, which consists of \"0\" and \"1\". He is building an infinite field from this field. He is doing this in this way:\n\n 1. He takes the current field and finds a new inve... | [{"type": "stdin_stdout", "input": "1 2 10\n01\n4 1 5 1\n1 2 1 16\n3 4 3 5\n1 1 1 5\n4 3 6 5\n1 1 1 3\n1 3 4 5\n3 2 3 6\n3 1 5 2\n3 1 3 5\n", "output": "1\n8\n1\n3\n5\n2\n6\n2\n3\n2\n"}, {"type": "stdin_stdout", "input": "1 2 10\n01\n4 1 5 2\n1 2 1 4\n3 4 3 5\n1 3 1 5\n4 3 5 5\n1 1 3 3\n1 3 4 5\n3 2 3 4\n3 1 5 2\n3 1 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a tree with n nodes. You have to write non-negative integers on its edges so that the following condition would be satisfied:\n\nFor every two nodes i, j, look at the path between them and count the sum of n... | [{"type": "stdin_stdout", "input": "40\n11 8\n18 34\n21 23\n6 7\n23 28\n27 14\n8 18\n12 1\n27 4\n11 30\n40 22\n29 19\n17 32\n13 12\n15 9\n34 5\n27 37\n20 2\n18 33\n39 13\n27 17\n35 1\n40 3\n11 21\n1 35\n20 10\n27 20\n1 16\n27 6\n11 26\n38 36\n40 11\n17 25\n2 38\n40 39\n1 15\n12 27\n30 29\n14 14\n", "output": "12 1 1\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's denote correct match equation (we will denote it as CME) an equation a + b = c there all integers a, b and c are greater than zero.\n\nFor example, equations 2 + 2 = 4 (||+||=||||) and 1 + 2 = 3 (|+||=|||) are CME b... | [{"type": "stdin_stdout", "input": "100\n928\n970\n950\n921\n1007\n974\n353\n999\n964\n920\n926\n942\n934\n918\n930\n901\n977\n961\n978\n962\n951\n909\n994\n953\n946\n993\n982\n922\n1789\n932\n904\n910\n991\n937\n963\n988\n278\n903\n956\n976\n967\n958\n902\n986\n960\n965\n940\n914\n955\n987\n952\n971\n939\n966\n938\n91... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is a harder version of the problem. In this version, n ≤ 300 000.\n\nVasya is an experienced developer of programming competitions' problems. As all great minds at some time, Vasya faced a creative crisis. To improve... | [{"type": "stdin_stdout", "input": "100\n))()()(())()()(()()())((()()())())((())())((()))(())()((()))((())())()((()())())(()())(())(()(()))((\n", "output": "23\n24 31"}, {"type": "stdin_stdout", "input": "100\n()()()()()()()()()()())(()()()()()()()()()()()()()()()()()()()())(()()()()()()()()()()()()()()()()()\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBalph is learning to play a game called Buma. In this game, he is given a row of colored balls. He has to choose the color of one new ball and the place to insert it (between two balls, or to the left of all the balls, or... | [{"type": "stdin_stdout", "input": "WWWOOOOOOWWW\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "WWWOONOOOWWW\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "WWWOONOOOVWW\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "WVWOONOOOVWW\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "WOWO... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given n arrays a_1, a_2, ..., a_n; each array consists of exactly m integers. We denote the y-th element of the x-th array as a_{x, y}.\n\nYou have to choose two arrays a_i and a_j (1 ≤ i, j ≤ n, it is possible th... | [{"type": "stdin_stdout", "input": "100 2\n0 1\n0 0\n0 1\n0 1\n0 1\n1 1\n0 2\n1 1\n0 -1\n0 4\n1 0\n0 0\n1 0\n1 1\n1 1\n0 1\n0 1\n0 1\n1 0\n0 0\n0 1\n0 1\n-1 1\n-1 0\n1 0\n1 1\n1 1\n1 0\n1 0\n0 1\n1 1\n1 -1\n0 0\n1 0\n1 1\n1 1\n1 1\n1 1\n1 0\n1 0\n1 0\n1 1\n0 0\n1 0\n0 1\n0 1\n0 0\n-1 0\n1 1\n2 0\n0 1\n0 0\n1 0\n1 1\n1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n per nextum in unam tum XI conscribementis fac sic \n vestibulo perlegementum da varo. \n morde varo. \n seqis cumula varum. \n cis \n \n per nextum in unam tum XI conscribementis f... | [{"type": "stdin_stdout", "input": "0\n1\n-2\n-3\n-4\n-5\n-6\n-7\n-8\n-9\n10\n", "output": "f(10) = MAGNA NIMIS!\nf(-9) = -3642.00\nf(-8) = -2557.17\nf(-7) = -1712.35\nf(-6) = -1077.55\nf(-5) = -622.76\nf(-4) = -318.00\nf(-3) = -133.27\nf(-2) = -38.59\nf(1) = 6.00\nf(0) = 0.00\n"}, {"type": "stdin_stdout", "input": "0\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJett is tired after destroying the town and she wants to have a rest. She likes high places, that's why for having a rest she wants to get high and she decided to craft staircases.\n\nA staircase is a squared figure that ... | [{"type": "stdin_stdout", "input": "4\n1\n10\n28\n0111101000000000100\n", "output": "1\n2\n2\n28\n"}, {"type": "stdin_stdout", "input": "4\n1\n10\n28\n0101101000000000100\n", "output": "1\n2\n2\n28\n"}, {"type": "stdin_stdout", "input": "4\n2\n10\n28\n0101101000000000100\n", "output": "1\n2\n2\n28\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string s of even length n. String s is binary, in other words, consists only of 0's and 1's.\n\nString s has exactly n/2 zeroes and n/2 ones (n is even).\n\nIn one operation you can reverse any substring o... | [{"type": "stdin_stdout", "input": "3\n2\n10\n4\n0110\n8\n11101000\n", "output": "0\n1\n2\n"}, {"type": "stdin_stdout", "input": "3\n2\n10\n4\n0110\n8\n11100001\n", "output": "0\n1\n3\n"}, {"type": "stdin_stdout", "input": "3\n2\n10\n4\n1010\n8\n11101000\n", "output": "0\n0\n2\n"}, {"type": "stdin_stdout", "input": "3\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBarbara was late for her math class so as a punishment the teacher made her solve the task on a sheet of paper. Barbara looked at the sheet of paper and only saw n numbers a_1, a_2, …, a_n without any mathematical symbols... | [{"type": "stdin_stdout", "input": "100\n1 2 2 2 1 1 2 2 0 2 2 0 1 0 0 0 0 1 0 0 0 1 1 2 1 1 2 2 0 2 0 2 1 1 0 2 1 0 1 2 1 2 2 1 1 1 2 1 1 1 0 1 1 0 0 2 2 1 2 2 1 0 1 0 0 2 1 2 1 1 0 2 1 0 2 0 2 1 2 0 0 0 1 1 2 0 1 0 2 2 2 1 1 1 0 2 2 1 1 1\n*-+\n", "output": "1+2*2*2*1*1*2*2+0+2*2+0+1+0+0+0+0+1+0+0+0+1+1+2*1*1*2*2+0+2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nn heroes fight against each other in the Arena. Initially, the i-th hero has level a_i.\n\nEach minute, a fight between two different heroes occurs. These heroes can be chosen arbitrarily (it's even possible that it is th... | [{"type": "stdin_stdout", "input": "2\n8\n1 9 1 9 8 10 10 10\n5\n10 10 10 10 10\n", "output": "6\n0\n"}, {"type": "stdin_stdout", "input": "2\n8\n1 9 1 9 8 10 16 10\n5\n10 10 10 10 10\n", "output": "6\n0\n"}, {"type": "stdin_stdout", "input": "2\n8\n1 9 2 9 8 10 16 10\n5\n10 10 10 10 10\n", "output": "7\n0\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a of n integers. Find the number of pairs (i, j) (1 ≤ i < j ≤ n) where the sum of a_i + a_j is greater than or equal to l and less than or equal to r (that is, l ≤ a_i + a_j ≤ r).\n\nFor example, if... | [{"type": "stdin_stdout", "input": "1\n100 120 153\n1 1 2 5 4 5 6 7 8 9 10 11 12 13 14 15 16 17 24 19 20 21 22 23 43 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 66 66 67 68 69 70 71 72 73 74 75 76 119 78 79 80 81 82 83 84 85 133 56 88 89 90 91 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA connected undirected graph is called a vertex cactus, if each vertex of this graph belongs to at most one simple cycle.\n\nA simple cycle in a undirected graph is a sequence of distinct vertices v1, v2, ..., vt (t > 2),... | [{"type": "stdin_stdout", "input": "40 43\n1 2\n1 3\n1 4\n4 5\n5 6\n1 7\n5 8\n7 9\n2 10\n10 11\n11 12\n2 13\n13 14\n14 15\n15 16\n16 17\n17 18\n18 19\n19 20\n20 21\n21 22\n22 23\n23 24\n24 25\n25 2\n3 26\n26 27\n27 28\n28 29\n29 30\n30 31\n31 32\n32 3\n4 33\n33 34\n34 35\n35 36\n36 37\n37 4\n5 38\n38 39\n39 40\n40 5\n2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has found a piece of paper with an array written on it. The array consists of n integers a1, a2, ..., an. Vasya noticed that the following condition holds for the array ai ≤ ai + 1 ≤ 2·ai for any positive integer i ... | [{"type": "stdin_stdout", "input": "48\n4 7 12 16 23 43 61 112 134 141 243 267 484 890 1427 1558 1653 2263 2889 3313 3730 5991 10176 18243 18685 36555 40006 62099 70557 106602 122641 125854 213236 309698 379653 713328 999577 1021356 2007207 2886237 4994645 5812125 11576387 14215887 26060277 35989707 36964781 57933366\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA star map in Berland is a checked field n × m squares. In each square there is or there is not a star. The favourite constellation of all Berland's astronomers is the constellation of the Cross. This constellation can be... | [{"type": "stdin_stdout", "input": "10 10 40\n**********\n**********\n**********\n**********\n**********\n**********\n**********\n**********\n**********\n**********\n", "output": "6 9\n5 9\n7 9\n6 8\n6 10\n"}, {"type": "stdin_stdout", "input": "10 10 59\n**.*******\n********.*\n***.******\n**.*******\n*******.**\n*****... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently, a start up by two students of a state university of city F gained incredible popularity. Now it's time to start a new company. But what do we call it?\n\nThe market analysts came up with a very smart plan: the n... | [{"type": "stdin_stdout", "input": "OVWIHIWVYXMVAAAATOXWOIUUHYXHIHHVUIOOXWHOXTUUMUUVHVWWYUTIAUAITAOMHXWMTTOIVMIVOTHOVOIOHYHAOXWAUVWAVIVM\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "QDPINBMCRFWXPDBFGOZVVOCEMJRUCTOADEWEGTVBVBFWWRPGYEEYGPRWWFBVBVTGEWEDAOTCURJMECOVVZOGFBDPXWFRCMBNIPDQ\n", "output": "NO\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPeter wrote on the board a strictly increasing sequence of positive integers a1, a2, ..., an. Then Vasil replaced some digits in the numbers of this sequence by question marks. Thus, each question mark corresponds to exac... | [{"type": "stdin_stdout", "input": "98\n?\n?0\n2?\n6?\n6?\n69\n??\n??\n96\n1?2\n??3\n104\n??4\n1?9\n??2\n18?\n?01\n205\n?19\n244\n??8\n?5?\n?5?\n276\n??3\n???\n???\n?28\n?3?\n3??\n??8\n355\n4?0\n4??\n?10\n??1\n417\n4?9\n?3?\n4?4\n?61\n?8?\n???\n507\n?2?\n???\n??6\n5?7\n540\n5?9\n???\n?7?\n5??\n591\n?9?\n6?0\n620\n??4\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhen Darth Vader gets bored, he sits down on the sofa, closes his eyes and thinks of an infinite rooted tree where each node has exactly n sons, at that for each node, the distance between it an its i-th left child equals... | [{"type": "stdin_stdout", "input": "97 78153\n2 2 1 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 4 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 1 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2\n", "output": "620983468\n"}, {"type": "stdin_stdout", "input": "97 78153\n2 2 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCompanies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those ... | [{"type": "stdin_stdout", "input": "111\n15 45 14 65 49 25 102 86 14 80 54 73 43 78 42 32 47 60 55 66 84 69 49 22 26 72 89 52 26 80 71 35 56 2 88 23 23 53 65 92 46 73 29 65 88 99 19 99 87 10 47 96 109 20 60 89 63 105 29 92 109 20 95 65 31 89 107 3 3 50 58 9 28 39 104 42 41 36 70 49 59 96 16 9 3 108 38 42 2 67 32 86 20 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEach employee of the \"Blake Techologies\" company uses a special messaging app \"Blake Messenger\". All the stuff likes this app and uses it constantly. However, some important futures are missing. For example, many user... | [{"type": "stdin_stdout", "input": "28 7\n1-a 1-b 1-c 1-d 1-e 1-f 1-t 1-a 1-b 1-c 1-d 1-e 1-f 1-j 1-a 1-b 1-c 1-d 1-e 1-f 1-g 1-a 1-b 1-c 1-d 1-e 1-f 2-g\n1-a 1-b 1-c 1-d 1-e 1-f 1-g\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "28 7\n1-a 1-b 1-c 1-d 1-e 1-f 1-t 1-a 1-b 1-c 1-d 1-e 1-f 1-j 1-a 1-b 1-c 1-d 1-... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider 2n rows of the seats in a bus. n rows of the seats on the left and n rows of the seats on the right. Each row can be filled by two people. So the total capacity of the bus is 4n.\n\nConsider that m (m ≤ 4n) peopl... | [{"type": "stdin_stdout", "input": "100 400\n", "output": "201 1 202 2 203 3 204 4 205 5 206 6 207 7 208 8 209 9 210 10 211 11 212 12 213 13 214 14 215 15 216 16 217 17 218 18 219 19 220 20 221 21 222 22 223 23 224 24 225 25 226 26 227 27 228 28 229 29 230 30 231 31 232 32 233 33 234 34 235 35 236 36 237 37 238 38 239 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's imagine: there is a chess piece billiard ball. Its movements resemble the ones of a bishop chess piece. The only difference is that when a billiard ball hits the board's border, it can reflect from it and continue m... | [{"type": "stdin_stdout", "input": "1000000 1000000\n", "output": "1000000\n"}, {"type": "stdin_stdout", "input": "666667 1000000\n", "output": "333334\n"}, {"type": "stdin_stdout", "input": "871866 348747\n", "output": "174374\n"}, {"type": "stdin_stdout", "input": "863029 287677\n", "output": "287677\n"}, {"type": "s... | 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 98 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\n91 104 111 -1 -1\n92 -1 52 -1 11\n118 25 97 1 108\n-1 61 97 37 -1\n87 47 -1 -1 21\n79... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMike has a string s consisting of only lowercase English letters. He wants to change exactly one character from the string so that the resulting one is a palindrome. \n\nA palindrome is a string that reads the same backwa... | [{"type": "stdin_stdout", "input": "scfwrjevejrwfcs\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "thdaonpepdoadht\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "scfwrievejrwfcs\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "thdaodpepnoadht\n", "output": "YES\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYet another round on DecoForces is coming! Grandpa Maks wanted to participate in it but someone has stolen his precious sofa! And how can one perform well with such a major loss?\n\nFortunately, the thief had left a note ... | [{"type": "stdin_stdout", "input": "6\n10 10\n3 6 3 7\n4 9 5 9\n5 4 5 3\n7 1 8 1\n9 10 8 10\n7 7 7 8\n0 5 2 3\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "5\n4 6\n4 3 3 3\n4 2 4 1\n3 6 2 6\n2 4 2 3\n1 1 1 2\n1 2 2 1\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "5\n7 5\n5 3 5 2\n3 5 2 5\n1 3 1 4\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consisting only of lowercase and uppercase Latin letters.\n\nLet A be a set of positions in the string. Let's call it pretty if followin... | [{"type": "stdin_stdout", "input": "200\nZlJwrzzglgkjqtmoseaapqtqxbrorjptpejjmchztutkglqjxxqgnuxeadxksnclizglywqmtxdhrbbmooxijiymikyIOlSBShUOGUghPJtSxmToNUHDdQIMoFzPOVYAtLRtXyuOErmpYQFAeKMJKlqZCEVEuhSCCtBnQnOncTqYpaLbhutwhplyJGxtuXQiEfuvOzWr\n", "output": "24\n"}, {"type": "stdin_stdout", "input": "200\nPUVgmHVAXlBaxUI... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya studies music. \n\nHe has learned lots of interesting stuff. For example, he knows that there are 12 notes: C, C#, D, D#, E, F, F#, G, G#, A, B, H. He also knows that the notes are repeated cyclically: after H goes ... | [{"type": "stdin_stdout", "input": "F# F# F#\n", "output": "strange\n"}, {"type": "stdin_stdout", "input": "D# D# F#\n", "output": "strange\n"}, {"type": "stdin_stdout", "input": "G# G# A\n", "output": "strange\n"}, {"type": "stdin_stdout", "input": "G# C# D\n", "output": "strange\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhile Grisha was celebrating New Year with Ded Moroz, Misha gifted Sasha a small rectangular pond of size n × m, divided into cells of size 1 × 1, inhabited by tiny evil fishes (no more than one fish per cell, otherwise t... | [{"type": "stdin_stdout", "input": "100000 100000 100000 100000\n", "output": "100000.0000000000"}, {"type": "stdin_stdout", "input": "67708 82422 32854 21110\n", "output": "13188.320546325507\n"}, {"type": "stdin_stdout", "input": "51007 74589 14733 37356\n", "output": "3734.3960661418787\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn order to put away old things and welcome a fresh new year, a thorough cleaning of the house is a must.\n\nLittle Tommy finds an old polynomial and cleaned it up by taking it modulo another. But now he regrets doing thi... | [{"type": "stdin_stdout", "input": "20180214 5\n", "output": "11\n 4 3 4 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nUtkarsh being a very talkative child, was scolded by his teacher multiple times. One day, the teacher became very angry and decided to give him a very rigorous punishment. He made him stand on the school field which is X ... | [{"type": "stdin_stdout", "input": "20 11\n\nQAMQLE", "output": "0.389111\n"}, {"type": "stdin_stdout", "input": "24 13\n\nELRMAQ", "output": "0.408818\n"}, {"type": "stdin_stdout", "input": "25 11\n\nELRMAQ", "output": "0.194940\n"}, {"type": "stdin_stdout", "input": "12 12\n\nFLRMAQ", "output": "0.613080\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have an undirected graph G with N vertices numbered 1 to N and N edges as follows:\n\n* For each i=1,2,...,N-1, there is an edge between Vertex i and Vertex i+1.\n* There is an edge between Vertex X and Vertex Y.\n\n\n... | [{"type": "stdin_stdout", "input": "170 1 3", "output": "170\n168\n167\n166\n165\n164\n163\n162\n161\n160\n159\n158\n157\n156\n155\n154\n153\n152\n151\n150\n149\n148\n147\n146\n145\n144\n143\n142\n141\n140\n139\n138\n137\n136\n135\n134\n133\n132\n131\n130\n129\n128\n127\n126\n125\n124\n123\n122\n121\n120\n119\n118\n117... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.