messages
listlengths
1
1
ground_truth
stringlengths
88
726k
dataset
stringclasses
2 values
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array consisting of n integers a_1, a_2, ..., a_n. Initially a_x = 1, all other elements are equal to 0.\n\nYou have to perform m operations. During the i-th operation, you choose two indices c and d such...
[{"type": "stdin_stdout", "input": "9\n100 50 6\n1 49\n51 100\n40 60\n30 70\n20 30\n70 80\n100 1 11\n1 1\n1 1\n1 1\n2 2\n2 100\n1 4\n2 3\n3 7\n5 6\n6 100\n4 5\n1 1 5\n1 1\n1 1\n1 1\n1 1\n1 1\n11 6 4\n6 6\n1 5\n7 11\n6 6\n3 3 2\n1 2\n2 3\n1000000000 1 1\n1 1000000000\n1000000000 1 1\n1 999999999\n1000000000 1 1\n2 10000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a non-decreasing array of non-negative integers a_1, a_2, …, a_n. Also you are given a positive integer k.\n\nYou want to find m non-decreasing arrays of non-negative integers b_1, b_2, …, b_m, such that:\n\...
[{"type": "stdin_stdout", "input": "6\n4 1\n0 0 0 1\n3 1\n3 3 3\n11 3\n0 1 2 2 3 3 3 4 4 4 4\n5 3\n1 2 3 4 5\n9 4\n2 2 3 5 7 11 13 13 17\n10 7\n0 1 1 2 3 3 4 5 5 6\n", "output": "-1\n1\n2\n2\n2\n1\n"}, {"type": "stdin_stdout", "input": "1\n5 5\n5 5 5 5 5\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1\n5 3\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are some rabbits in Singapore Zoo. To feed them, Zookeeper bought n carrots with lengths a_1, a_2, a_3, …, a_n. However, rabbits are very fertile and multiply very quickly. Zookeeper now has k rabbits and does not h...
[{"type": "stdin_stdout", "input": "54 42164\n810471 434523 262846 930807 148016 633714 247313 376546 142288 30094 599543 829013 182512 647950 512266 827248 452285 531124 257259 453752 114536 833190 737596 267349 598567 781294 390500 318098 354290 725051 978831 905185 849542 761886 55532 608148 631077 557070 355245 929...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nJeel and Ashish play a game on an n Γ— m matrix. The rows are numbered 1 to n from top to bottom and the columns are numbered 1 to m from left to right. They play turn by turn. Ashish goes first.\n\nInitially, each cell of...
[{"type": "stdin_stdout", "input": "5\n5 5\n0 126 30 105 44\n126 98 21 0 108\n124 30 110 82 31\n119 117 87 99 97\n55 72 124 61 0\n5 5\n0 154 44 96 5\n82 20 16 99 66\n56 10 90 63 70\n99 87 103 0 23\n107 26 70 23 -1\n5 5\n100 112 41 120 29\n32 20 36 160 50\n100 11 92 7 30\n80 93 0 83 60\n69 31 24 102 48\n5 2\n0 100\n73 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMasha works in an advertising agency. In order to promote the new brand, she wants to conclude contracts with some bloggers. In total, Masha has connections of n different bloggers. Blogger numbered i has a_i followers.\n...
[{"type": "stdin_stdout", "input": "3\n4 3\n1 3 1 2\n4 2\n1 1 1 1\n2 1\n1 2\n", "output": "\n2\n6\n1\n"}, {"type": "stdin_stdout", "input": "3\n4 3\n1 3 1 2\n4 2\n1 2 1 1\n2 1\n1 2\n", "output": "2\n3\n1\n"}, {"type": "stdin_stdout", "input": "3\n4 3\n1 3 1 2\n4 2\n1 1 1 1\n2 1\n2 2\n", "output": "2\n6\n2\n"}, {"type":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMonocarp is playing a game \"Assimilation IV\". In this game he manages a great empire: builds cities and conquers new lands.\n\nMonocarp's empire has n cities. In order to conquer new lands he plans to build one Monument...
[{"type": "stdin_stdout", "input": "3 5\n1 4 4 3 4\n1 4 1 4 2\n1 4 4 4 3\n", "output": "\n166374062\n"}, {"type": "stdin_stdout", "input": "3 5\n1 4 4 3 4\n1 4 2 4 2\n1 4 4 4 3\n", "output": "831870297\n"}, {"type": "stdin_stdout", "input": "3 5\n1 4 4 3 4\n1 4 2 4 2\n1 3 4 4 3\n", "output": "166374062\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had several concentric circles that divided the...
[{"type": "stdin_stdout", "input": "100\n901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.\n\nThe playing field is a sequence of n non-negative integers ai numbered ...
[{"type": "stdin_stdout", "input": "120\n242 524 420 973 816 432 247 666 134 849 145 366 1119 930 613 315 863 628 97 109 65 704 741 314 736 17 872 971 559 648 223 771 171 327 782 837 303 393 292 339 730 834 794 868 540 251 789 893 23 305 116 220 699 863 580 992 861 393 98 253 544 171 336 207 348 496 316 285 286 727 613...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOnce Bob saw a string. It contained so many different letters, that the letters were marked by numbers, but at the same time each letter could be met in the string at most 10 times. Bob didn't like that string, because it...
[{"type": "stdin_stdout", "input": "100\n8 43 55 27 70 81 66 10 49 67 24 61 53 0 2 76 96 16 16 1 78 1 69 69 4 59 6 87 98 14 98 20 12 48 20 41 67 90 20 96 44 8 77 94 84 2 61 27 90 42 66 84 5 19 68 13 5 53 13 87 70 41 48 40 19 61 72 31 4 4 59 100 50 64 84 10 96 16 73 3 63 85 67 91 74 63 22 34 6 96 78 42 61 85 3 95 98 84 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDima's got a staircase that consists of n stairs. The first stair is at height a1, the second one is at a2, the last one is at an (1 ≀ a1 ≀ a2 ≀ ... ≀ an). \n\nDima decided to play with the staircase, so he is throwing re...
[{"type": "stdin_stdout", "input": "5\n1 2 3 6 6\n25\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKalila and Dimna are two jackals living in a huge jungle. One day they decided to join a logging factory in order to make money. \n\nThe manager of logging factory wants them to go to the jungle and cut n trees with heigh...
[{"type": "stdin_stdout", "input": "6\n1 2 3 10 20 30\n6 5 4 3 2 0\n", "output": "138\n"}, {"type": "stdin_stdout", "input": "6\n2 2 3 10 20 30\n6 5 4 3 2 0\n", "output": "138\n"}, {"type": "stdin_stdout", "input": "6\n1 2 3 10 20 25\n6 5 4 3 2 0\n", "output": "118\n"}, {"type": "stdin_stdout", "input": "6\n1 1 2 10 20...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMad scientist Mike does not use slow hard disks. His modification of a hard drive has not one, but n different heads that can read data in parallel.\n\nWhen viewed from the side, Mike's hard drive is an endless array of t...
[{"type": "stdin_stdout", "input": "10 11\n1 909090909 1818181817 2727272725 3636363633 4545454541 5454545449 6363636357 7272727265 8181818173\n454545455 1363636363 2272727271 3181818179 4090909087 4999999995 5909090903 6818181811 7727272719 8636363627 9545454535\n", "output": "1363636362\n"}, {"type": "stdin_stdout", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDima loves Inna very much. He decided to write a song for her. Dima has a magic guitar with n strings and m frets. Dima makes the guitar produce sounds like that: to play a note, he needs to hold one of the strings on one...
[{"type": "stdin_stdout", "input": "11 11 9 11\n1 1 1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 2 2 1\n1 1 1 1 1 1 1 1 3 1 1\n1 1 1 1 1 1 1 3 1 1 1\n1 1 1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1 1 1\n1 1 1 2 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1 1 1\n3 3 3 3 3 3 3 3 3 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOnce Vasya played bricks. All the bricks in the set had regular cubical shape. Vasya vas a talented architect, however the tower he built kept falling apart.\n\nLet us consider the building process. Vasya takes a brick an...
[{"type": "stdin_stdout", "input": "20\n-10 17 -4 11\n1 22 -15 6\n-5 12 -9 16\n-9 16 -5 12\n-2 19 -12 9\n-10 17 -4 11\n-8 13 -6 15\n-5 12 -9 16\n-3 18 -11 10\n-1 20 -13 8\n29 9 -12 50\n29 50 -11 10\n29 9 -12 50\n29 50 -10 11\n-14 50 29 7\n-9 12 29 50\n-14 7 29 50\n29 9 -12 50\n-11 10 29 50\n-11 50 29 10\n", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLast year the world's largest square was built in Berland. It is known that the square can be represented as an infinite plane with an introduced Cartesian system of coordinates. On that square two sets of concentric circ...
[{"type": "stdin_stdout", "input": "100000 -100000 100000 100000\n", "output": " 200001\n"}, {"type": "stdin_stdout", "input": "100000 100000 100000 -100000\n", "output": " 200001\n"}, {"type": "stdin_stdou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOf course our child likes walking in a zoo. The zoo has n areas, that are numbered from 1 to n. The i-th area contains ai animals in it. Also there are m roads in the zoo, and each road connects two distinct areas. Natura...
[{"type": "stdin_stdout", "input": "10 19\n13637 26970 19043 3616 12880 19387 12539 25190 2452 1261\n1 2\n1 3\n1 4\n2 5\n3 6\n6 7\n3 8\n5 9\n3 10\n4 10\n9 3\n2 8\n4 3\n2 3\n7 10\n7 8\n5 10\n5 6\n7 4\n", "output": "8241.4222222222\n"}, {"type": "stdin_stdout", "input": "10 19\n15704 19758 26631 25050 22778 15041 8487 26...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPermutation p is an ordered set of integers p1, p2, ..., pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1, p2, ..., pn.\n\nYour task is to find such permutat...
[{"type": "stdin_stdout", "input": "18247 939\n", "output": "1 940 2 939 3 938 4 937 5 936 6 935 7 934 8 933 9 932 10 931 11 930 12 929 13 928 14 927 15 926 16 925 17 924 18 923 19 922 20 921 21 920 22 919 23 918 24 917 25 916 26 915 27 914 28 913 29 912 30 911 31 910 32 909 33 908 34 907 35 906 36 905 37 904 38 903 39...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an array of positive integers a1, a2, ..., an Γ— T of length n Γ— T. We know that for any i > n it is true that ai = ai - n. Find the length of the longest non-decreasing sequence of the given array.\n\nInput\...
[{"type": "stdin_stdout", "input": "100 10000000\n300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 30...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKevin Sun wants to move his precious collection of n cowbells from Naperthrill to Exeter, where there is actually grass instead of corn. Before moving, he must pack his cowbells into k boxes of a fixed size. In order to k...
[{"type": "stdin_stdout", "input": "100 49990\n221 257 543 613 818 855 884 1195 1233 1293 1327 1474 1567 1568 1728 1789 1809 1957 1994 2198 2217 2289 2298 2360 2441 2454 2517 2519 2597 2652 2909 2958 2970 3271 3310 3409 3450 3646 3950 3965 4016 4116 4134 4159 4462 4624 4631 4783 4804 5031 5276 5538 5729 5845 5880 5894 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDefine the simple skewness of a collection of numbers to be the collection's mean minus its median. You are given a list of n (not necessarily distinct) integers. Find the non-empty subset (with repetition) with the maxim...
[{"type": "stdin_stdout", "input": "40\n999999 999999 999998 999998 999996 999996 999992 999992 999984 999984 999968 999968 999936 999936 999872 999872 999744 999744 999488 999488 998976 998976 997952 997952 995904 995904 991808 991808 983616 983616 967232 967232 934464 934464 868928 868928 737856 737856 475712 0\n", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere exists an island called Arpa’s land, some beautiful girls live there, as ugly ones do.\n\nMehrdad wants to become minister of Arpa’s land. Arpa has prepared an exam. Exam has only one question, given n, print the la...
[{"type": "stdin_stdout", "input": "1000000000\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "1902349577\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "0000000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1065810635\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "1760197508\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVanya wants to minimize a tree. He can perform the following operation multiple times: choose a vertex v, and two disjoint (except for v) paths of equal length a0 = v, a1, ..., ak, and b0 = v, b1, ..., bk. Additionally, v...
[{"type": "stdin_stdout", "input": "12\n12 6\n6 7\n8 11\n4 8\n10 4\n12 3\n2 10\n6 2\n12 9\n4 1\n9 5\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "12\n12 6\n6 7\n8 11\n7 8\n10 4\n12 3\n2 10\n6 2\n12 9\n4 1\n9 5\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "11\n11 9\n6 7\n7 1\n8 11\n5 6\n3 5\n9 3\...
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 b1 and q. Remind that a geometric progression is a sequenc...
[{"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\nFor some reason in many American cartoons anvils fall from time to time onto heroes' heads. Of course, safes, wardrobes, cruisers, planes fall sometimes too... But anvils do so most of all.\n\nAnvils come in different siz...
[{"type": "stdin_stdout", "input": "90\n1 1\n2 1\n3 1\n4 1\n5 1\n6 1\n7 1\n8 1\n9 1\n1 2\n2 2\n3 2\n4 2\n5 2\n6 2\n7 2\n8 2\n9 2\n1 3\n2 3\n3 3\n4 3\n5 3\n6 3\n7 3\n8 3\n9 3\n1 4\n2 4\n3 4\n4 4\n5 4\n6 4\n7 4\n8 4\n9 4\n1 5\n2 5\n3 5\n4 5\n5 5\n6 5\n7 5\n8 5\n9 5\n1 6\n2 6\n3 6\n4 6\n5 6\n6 6\n7 6\n8 6\n9 6\n1 7\n2 7\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSome natural number was written on the board. Its sum of digits was not less than k. But you were distracted a bit, and someone changed this number to n, replacing some digits with others. It's known that the length of th...
[{"type": "stdin_stdout", "input": "900\n13595314340746721027884681972026445045155446054797436718350397773609081581610067818125738383867204953\n", "output": "86\n"}, {"type": "stdin_stdout", "input": "900\n7570423817272967027553082464863962024635217372307919506594193055572300657732661146354209508997483330\n", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTwo best friends Serozha and Gena play a game.\n\nInitially there is one pile consisting of n stones on the table. During one move one pile should be taken and divided into an arbitrary number of piles consisting of a1 > ...
[{"type": "stdin_stdout", "input": "100000\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "60989\n", "output": "142\n"}, {"type": "stdin_stdout", "input": "14577\n", "output": "113\n"}, {"type": "stdin_stdout", "input": "63478\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "56056\n", "output": "-1\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe had a string s consisting of n lowercase Latin letters. We made k copies of this string, thus obtaining k identical strings s1, s2, ..., sk. After that, in each of these strings we swapped exactly two characters (the c...
[{"type": "stdin_stdout", "input": "100 3\nzsk\nzsk\nzsk\nzsk\nskz\nskz\nkzs\nskz\nkzs\nkzs\nzsk\nkzs\nkzs\nkzs\nskz\nkzs\nskz\nskz\nkzs\nzsk\nkzs\nkzs\nkzs\nskz\nskz\nskz\nzsk\nskz\nzsk\nskz\nkzs\nskz\nskz\nskz\nkzs\nzsk\nzsk\nkzs\nskz\nskz\nkzs\nkzs\nskz\nkzs\nkzs\nskz\nkzs\nskz\nkzs\nkzs\nskz\nkzs\nkzs\nkzs\nkzs\nsk...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nToday you are going to lead a group of elven archers to defend the castle that is attacked by an army of angry orcs. Three sides of the castle are protected by impassable mountains and the remaining side is occupied by a ...
[{"type": "stdin_stdout", "input": "100 100 1000\n814 165 709 628 263 653 940 749 331 437 129 547 575 73 480 429 396 688 489 312 425 946 444 228 547 512 477 849 53 241 643 416 141 502 449 58 686 111 171 844 113 790 79 107 399 846 945 427 361 68 295 630 260 939 679 458 485 738 202 141 166 940 5 73 108 351 245 998 640 77...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n**\nProblem Statement is Updated\n**\n\nXenny had N colors with him, all arranged in a straight line. He was interested in picking up a particular subarray of colors.\n\nA pre-set is a set that contains all subarrays of c...
[{"type": "stdin_stdout", "input": "1\n-3\n-1 -1 -1 -1\n\nANMDPL", "output": "3\n"}, {"type": "stdin_stdout", "input": "1\n-2\n-1 3 -4 0\n\nTEMPLA", "output": "0\n"}, {"type": "stdin_stdout", "input": "1\n-2\n-1 3 -1 0\n\nTEMPLA", "output": "1\n"}, {"type": "stdin_stdout", "input": "1\n-3\n-2 10 2 1\n\nTEMPLA", "output...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Raju recently learnt about binary numbers. After spending some time with it, he decided to count in how many ways he can make N digit numbers that is formed by ones and zeroes. But zeroes can not be next to each ot...
[{"type": "stdin_stdout", "input": "4\n4521\n994\n5000\n10000", "output": "79728179662882457227576647453466692548803597891051066617654120269518723853720729222251526347026397515035442714307188357281539306875295261428766221766658302923133032431051274362347768081743273778236028473510850228289095802566593792840410500407058...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven an array A. Delete an single element from the array such that sum of the differences of adjacent elements should be minimum. \n\nFor more clarification Sum for an array A having N element is defined as : \nabs( A[...
[{"type": "stdin_stdout", "input": "5\n1\n101\n2\n100 0\n2\n1 2\n3\n1 100 4\n3\n1 0 3\n3\n0 5 3\n0\n1 10 8\n1\n8 7 0\n1\n7 9 2\n0\n11 2 17", "output": "0\n0\n0\n1\n2\n"}, {"type": "stdin_stdout", "input": "5\n1\n101\n2\n100 0\n2\n1 2\n3\n1 000 4\n3\n1 0 3\n3\n0 5 3\n0\n1 10 8\n1\n8 7 0\n1\n7 9 2\n0\n11 2 4", "output": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have been given a set of N strings S1, S2, .... SN. Consider any non-empty string S (S need not belong to the given set of N strings). Suppose S occurs (as a substring) in K out of the N given strings in the set. Your...
[{"type": "stdin_stdout", "input": "2\n20\nengagfwhxalwaaucqieavxyutinrmtd\nnxhehybspixeykxillunrhswxskfrzkljeigxwaumrlfqlrrjlngxcyddtunll\nhcqpdelycqspbqrorpslpqwy\nzzjclluwfsyzxvzldjvdpfshbghqcepchuepklddqgtalcbupgexclfdjzjkctlnayuhgrvcsqyxatokefjwbnzvu\nfuxfecjlwilndrijri\naykqwypnriohkyizfvihjkyanijciyqxjslpqdjjjil...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N cells arranged in a row, numbered 1, 2, \\ldots, N from left to right.\n\nTak lives in these cells and is currently on Cell 1. He is trying to reach Cell N by using the procedure described below.\n\nYou are gi...
[{"type": "stdin_stdout", "input": "60 3\n11 16\n1 2\n10 26", "output": "469563953\n"}, {"type": "stdin_stdout", "input": "103 2\n5 4\n1 3\n10 15", "output": "883576557\n"}, {"type": "stdin_stdout", "input": "60 3\n9 16\n1 2\n10 26", "output": "634479161\n"}, {"type": "stdin_stdout", "input": "60 3\n5 4\n1 3\n10 15", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N children, numbered 1,2,\\ldots,N. In the next K days, we will give them some cookies. In the i-th day, we will choose a_i children among the N with equal probability, and give one cookie to each child chosen. ...
[{"type": "stdin_stdout", "input": "856 16\n399 491 665 432 206 61 784 548 422 313 848 478 827 26 398 63", "output": "652418319\n"}, {"type": "stdin_stdout", "input": "856 16\n399 491 665 432 206 61 784 548 422 313 848 478 827 23 222 63", "output": "293415485\n"}, {"type": "stdin_stdout", "input": "856 16\n399 263 665 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence of N integers: A_1,A_2,...,A_N.\n\nFind the number of permutations p_1,p_2,...,p_N of 1,2,...,N that can be changed to A_1,A_2,...,A_N by performing the following operation some number of times (p...
[{"type": "stdin_stdout", "input": "8\n4\n4\n5\n1\n1\n1\n2\n3", "output": "18\n"}, {"type": "stdin_stdout", "input": "8\n5\n11\n3\n1\n2\n1\n2\n2", "output": "0\n"}, {"type": "stdin_stdout", "input": "8\n5\n11\n3\n1\n2\n1\n4\n2", "output": "0\n"}, {"type": "stdin_stdout", "input": "8\n4\n4\n4\n1\n1\n1\n2\n2", "output": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n\"Teishi-zushi\", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is C meters. Customers cannot go inside the counter.\n\nNakahashi entered Teishi-zushi, an...
[{"type": "stdin_stdout", "input": "15 10000000000\n400000000 1000000000\n800000000 1000000000\n1900000000 1000000000\n2400000000 1000000000\n2900000000 1000000000\n3300000000 1000000000\n3700000000 1000000000\n3800000000 1000000000\n4000000000 1000000000\n4100000000 1000000000\n5200000000 1000000000\n6600000000 100000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn AtCoder, a person who has participated in a contest receives a color, which corresponds to the person's rating as follows:\n\n* Rating 1-399 : gray\n* Rating 400-799 : brown\n* Rating 800-1199 : green\n* Rating 1200-15...
[{"type": "stdin_stdout", "input": "20\n800 2054 820 830 840 850 384 433 1213 259 900 1139 920 1007 92 2243 960 970 1357 990", "output": "5 5\n"}, {"type": "stdin_stdout", "input": "20\n800 2108 443 830 840 2012 116 614 620 92 399 1139 1229 646 92 2243 174 1254 1914 990", "output": "6 6\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nN hotels are located on a straight line. The coordinate of the i-th hotel (1 \\leq i \\leq N) is x_i.\n\nTak the traveler has the following two personal principles:\n\n* He never travels a distance of more than L in a sin...
[{"type": "stdin_stdout", "input": "9\n1 3 6 13 15 18 19 29 31\n10\n4\n1 8\n7 3\n6 7\n8 3", "output": "4\n2\n1\n3\n"}, {"type": "stdin_stdout", "input": "9\n1 3 6 13 23 18 19 29 31\n12\n4\n1 8\n1 5\n9 7\n8 7", "output": "3\n2\n1\n1\n"}, {"type": "stdin_stdout", "input": "9\n1 3 6 13 23 19 19 29 31\n10\n4\n1 9\n7 6\n6 7...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAn English booklet has been created for publicizing Aizu to the world. When you read it carefully, you found a misnomer (an error in writing) on the last name of Masayuki Hoshina, the lord of the Aizu domain. The booklet ...
[{"type": "stdin_stdout", "input": "3\nHoshimo\nHashino\nMasayuki Hoshino was the grandson of Ieyasu Tokugawa.", "output": "Hoshimo\nHashino\nMasayuki Hoshina was the grandson of Ieyasu Tokugawa.\n"}, {"type": "stdin_stdout", "input": "3\nHoshimo\nHashino\nMasayuki Hoshino was the grandspn of Ieyasu Tokugawa.", "output...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAizu has an ancient legend of buried treasure. You have finally found the place where the buried treasure is buried. Since we know the depth of the buried treasure and the condition of the strata to be dug, we can reach t...
[{"type": "stdin_stdout", "input": "3 3\n100 10 10\n-100 -10 -100\n-100 -20 -100\n-117 -20 -195\n3 3\n100 10 10\n-100 -20 -100\n-100 -20 -20\n-100 -60 -20\n3 3\n100 19 3\n-100 -20 -100\n-20 -20 -20\n-20 -100 -20\n3 3\n100 3 3\n-100 -20 -30\n-100 -20 2\n-127 -20 -20\n4 5\n1500 5 4\n-10 -380 -250 -312\n-90 2 -144 12\n-25...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPlaying with Stones\n\nKoshiro and Ukiko are playing a game with black and white stones. The rules of the game are as follows:\n\n1. Before starting the game, they define some small areas and place \"one or more black sto...
[{"type": "stdin_stdout", "input": "4\n24 99\n15 68\n12 155\n95 79", "output": "0\n"}, {"type": "stdin_stdout", "input": "4\n24 99\n15 97\n12 149\n95 79", "output": "0\n"}, {"type": "stdin_stdout", "input": "4\n39 99\n15 97\n12 149\n95 79", "output": "0\n"}, {"type": "stdin_stdout", "input": "4\n24 99\n15 68\n12 90\n95...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are working for an administration office of the International Center for Picassonian Cubism (ICPC), which plans to build a new art gallery for young artists. The center is organizing an architectural design competitio...
[{"type": "stdin_stdout", "input": "4 5\n..33\n33..\n2222\n..1.\n.111\n5 7\n....1\n.1..1\n1..1.\n11..1\n.2222\n..111\n...1.\n3 6\n.3.\n233\n23.\n22.\n.11\n.11\n4 3\n2222\n..11\n..11\n4 5\n.3..\n..33\n322.\n2211\n.11.\n3 3\n222\n2.1\n111\n3 4\n11.\n11.\n.2/\n222\n3 4\n.11\n.11\n.2.\n222\n2 7\n11\n.1\n21\n22\n23\n.3\n33\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are working as a night watchman in an office building. Your task is to check whether all the lights in the building are turned off after all the office workers in the building have left the office. If there are lights...
[{"type": "stdin_stdout", "input": "1 1 1\n0\n2 2 1\n1 1\n1 1\n3 2 1\n1 0 1\n0 1 -1\n3 3 1\n1 0 0\n0 1 0\n1 0 1\n4 4 2\n1 1 0 1\n0 0 0 1\n1 0 1 1\n1 0 0 0\n5 5 1\n1 1 1 0 1\n0 1 0 1 0\n1 0 1 0 1\n0 1 1 1 0\n1 0 1 0 0\n5 1 2\n0 0 0 0 0\n0 0 0 0 0\n0 0 1 0 0\n0 0 0 0 0\n0 0 0 0 1\n11 11 3\n0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nAizu Magic School is a school where people who can use magic gather. Haruka, one of the students of that school, can use the magic of warp on the magic team.\n\nFrom her house to the school, there is a straight...
[{"type": "stdin_stdout", "input": "10 3\n2 0 1\n4 2 1\n8 1 1", "output": "9\n"}, {"type": "stdin_stdout", "input": "10 3\n2 2 1\n4 2 1\n8 1 1", "output": "8"}, {"type": "stdin_stdout", "input": "30 0\n2 0 1\n-1 2 1", "output": "30\n"}, {"type": "stdin_stdout", "input": "20 2\n2 6 1\n1 5 -1", "output": "14\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA small country called Maltius was governed by a queen. The queen was known as an oppressive ruler. People in the country suffered from heavy taxes and forced labor. So some young people decided to form a revolutionary ar...
[{"type": "stdin_stdout", "input": "2 2\nQE\nEA\n3 1\nQAE\n3 1\nAQE\n5 5\n..E..\n.###.\nA###Q\n.###.\n..E..\n5 1\nA.E.Q\n5 5\nA....\n.\n..E..\n###.#\n....Q\n0 0", "output": "Queen can not escape and Army can not catch Queen.\nArmy can catch Queen.\nQueen can escape.\nQueen can not escape and Army can not catch Queen.\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is an evil creature in a square on N-by-M grid (2 \\leq N, M \\leq 100), and you want to kill it using a laser generator located in a different square. Since the location and direction of the laser generator are fix...
[{"type": "stdin_stdout", "input": "4 3 3\nS..\n...\n..#\n.#G", "output": "-1\n"}, {"type": "stdin_stdout", "input": "4 3 3\nS/.\n...\n..#\n.#G", "output": "-1\n"}, {"type": "stdin_stdout", "input": "10 3 2\nS..\n..-\n..#\nG#.", "output": "0\n"}, {"type": "stdin_stdout", "input": "10 3 2\nS.-\n..-\n..#\nG#.", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nAOR Ika and you came to the tournament-style table tennis tournament singles section for reconnaissance. For AOR Ika-chan, who wants to record all the games, you decide to ask for the number of games that will ...
[{"type": "stdin_stdout", "input": "66 -51", "output": "116\n"}, {"type": "stdin_stdout", "input": "66 -87", "output": "152\n"}, {"type": "stdin_stdout", "input": "66 -49", "output": "114\n"}, {"type": "stdin_stdout", "input": "96 -49", "output": "144\n"}, {"type": "stdin_stdout", "input": "96 -45", "output": "140\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA histogram is made of a number of contiguous bars, which have same width.\n\nFor a given histogram with $N$ bars which have a width of 1 and a height of $h_i$ = $h_1, h_2, ... , h_N$ respectively, find the area of the la...
[{"type": "stdin_stdout", "input": "8\n1 20 9 13 4 10 1 26", "output": "27\n"}, {"type": "stdin_stdout", "input": "8\n1 36 9 13 4 10 1 26", "output": "36\n"}, {"type": "stdin_stdout", "input": "8\n1 36 9 13 4 10 1 38", "output": "38\n"}, {"type": "stdin_stdout", "input": "8\n1 20 3 13 4 7 1 26", "output": "26\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDifference of Big Integers\n\nGiven two integers $A$ and $B$, compute the difference, $A - B$.\n\nInput\n\nTwo integers $A$ and $B$ separated by a space character are given in a line.\n\nOutput\n\nPrint the difference in ...
[{"type": "stdin_stdout", "input": "-2 -1280", "output": "1278\n"}, {"type": "stdin_stdout", "input": "-2 -1243", "output": "1241\n"}, {"type": "stdin_stdout", "input": "-2 -2265", "output": "2263\n"}, {"type": "stdin_stdout", "input": "-1 -2265", "output": "2264\n"}, {"type": "stdin_stdout", "input": "-1 -2368", "outp...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou received a notebook which is called Death Note. This notebook has infinite number of pages. A rule is written on the last page (huh) of this notebook. It says: \"You have to write names in this notebook during n conse...
[{"type": "stdin_stdout", "input": "16 2\n999999999 999999999 999999999 856501885 1080831631 999999999 768581442 1196229362 999999999 999999999 1341911334 1890212075 1581621479 999999999 999999999 999999999\n", "output": "499999999 500000000 499999999 428250943 540415815 500000000 384290721 598114681 499999999 50000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called \"Testing Pants for Sadness\".\n\nThe test consists of n questio...
[{"type": "stdin_stdout", "input": "50\n515844718 503470143 928669067 209884122 322869098 241621928 844696197 105586164 552680307 968792756 135928721 842094825 298782438 829020472 791637138 285482545 811025527 428952878 887796419 11883658 546401594 6272027 100292274 308219869 372132044 955814846 644008184 521195760 919...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nJATC's math teacher always gives the class some interesting math problems so that they don't get bored. Today the problem is as follows. Given an integer n, you can perform the following operations zero or more times:\n\n...
[{"type": "stdin_stdout", "input": "252601\n", "output": "252601 0\n"}, {"type": "stdin_stdout", "input": "999958\n", "output": "999958 0\n"}, {"type": "stdin_stdout", "input": "999979\n", "output": "999979 0\n"}, {"type": "stdin_stdout", "input": "499979\n", "output": "499979 0\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Fair Nut lives in n story house. a_i people live on the i-th floor of the house. Every person uses elevator twice a day: to get from the floor where he/she lives to the ground (first) floor and to get from the first f...
[{"type": "stdin_stdout", "input": "100\n95 81 40 82 80 78 4 86 37 94 1 46 85 6 41 87 100 69 100 87 12 61 55 81 81 32 40 54 22 32 24 73 61 68 76 16 83 76 73 77 41 37 88 46 72 63 2 37 14 49 45 81 75 56 10 101 73 85 41 17 5 2 16 75 28 53 35 77 66 53 69 82 50 95 2 12 35 62 84 46 29 95 91 49 78 14 88 75 58 52 49 31 56 43 5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Kingdom of Kremland is a tree (a connected undirected graph without cycles) consisting of n vertices. Each vertex i has its own value a_i. All vertices are connected in series by edges. Formally, for every 1 ≀ i < n t...
[{"type": "stdin_stdout", "input": "44\n42 44 4 24 29 17 32 30 30 9 28 9 22 16 20 41 17 19 41 23 28 19 38 44 1 34 41 34 19 36 32 37 22 31 4 3 27 23 21 21 26 39 20 8\n", "output": "6926\n"}, {"type": "stdin_stdout", "input": "40\n35 33 20 13 21 4 16 21 22 35 20 39 32 29 27 5 24 3 12 10 15 13 2 31 1 11 20 39 17 37 21 10 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTokitsukaze is one of the characters in the game \"Kantai Collection\". In this game, every character has a common attribute β€” health points, shortened to HP.\n\nIn general, different values of HP are grouped into 4 categ...
[{"type": "stdin_stdout", "input": "100\n", "output": "1 A\n"}, {"type": "stdin_stdout", "input": "101\n", "output": "0 A\n"}, {"type": "stdin_stdout", "input": "130\n", "output": "1 B\n"}, {"type": "stdin_stdout", "input": "121\n", "output": "0 A\n"}, {"type": "stdin_stdout", "input": "118\n", "output": "1 B\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.\n\...
[{"type": "stdin_stdout", "input": "485 9554485\n7759121368632736852539182753173468028218114958118158732302477551670775608015153610483175626465946144780731573954182900412248382710280376491925985206156109890139333293746203940442347501294009600230166311978044218247083102712257326301109220002496805123344816427514286225153...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a huge integer a consisting of n digits (n is between 1 and 3 β‹… 10^5, inclusive). It may contain leading zeros.\n\nYou can swap two digits on adjacent (neighboring) positions if the swapping digits are of di...
[{"type": "stdin_stdout", "input": "3\n0709\n1337\n246432\n", "output": "0079\n1337\n234642\n"}, {"type": "stdin_stdout", "input": "3\n477\n1337\n246432\n", "output": "477\n1337\n234642\n"}, {"type": "stdin_stdout", "input": "3\n477\n1216\n246432\n", "output": "477\n1126\n234642\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA new delivery of clothing has arrived today to the clothing store. This delivery consists of a ties, b scarves, c vests and d jackets.\n\nThe store does not sell single clothing items β€” instead, it sells suits of two typ...
[{"type": "stdin_stdout", "input": "100000\n100000\n100000\n100000\n1000\n1000\n", "output": "100000000\n"}, {"type": "stdin_stdout", "input": "100000\n100000\n100100\n100000\n1000\n1000\n", "output": "100000000\n"}, {"type": "stdin_stdout", "input": "100000\n100000\n100000\n100000\n1000\n1\n", "output": "100000000\n"}...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a robot in a warehouse and n packages he wants to collect. The warehouse can be represented as a coordinate grid. Initially, the robot stays at the point (0, 0). The i-th package is at the point (x_i, y_i). It is...
[{"type": "stdin_stdout", "input": "3\n5\n1 3\n1 2\n3 3\n5 5\n4 3\n2\n1 0\n0 1\n1\n4 3\n", "output": "YES\nRUUURRRRUU\nNO\nYES\nRRRRUUU\n"}, {"type": "stdin_stdout", "input": "3\n5\n1 3\n1 2\n3 3\n5 5\n2 3\n2\n1 0\n0 1\n1\n4 3\n", "output": "YES\nRUUURRRRUU\nNO\nYES\nRRRRUUU\n"}, {"type": "stdin_stdout", "input": "3\n5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis is the easy version of the problem. The only difference between easy and hard versions is the constraint of m. You can make hacks only if both versions are solved.\n\nChiori loves dolls and now she is going to decora...
[{"type": "stdin_stdout", "input": "54 53\n8192 2147483648 134217728 8589934592 64 131072 137438953472 67108864 16384 536870912 256 4096 1099511627776 549755813888 32768 2 1048576 8 4194304 4294967296 262144 268435456 8388608 140737488355328 1073741824 4398046511104 512 2199023255552 2048 281474976710656 16777216 70368...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou might have remembered Theatre square from the [problem 1A](https://codeforces.com/problemset/problem/1/A). Now it's finally getting repaved.\n\nThe square still has a rectangular shape of n Γ— m meters. However, the pi...
[{"type": "stdin_stdout", "input": "1\n9 9 9 9\n.........\n.........\n.........\n.........\n.........\n.........\n.........\n.........\n.........\n", "output": "405\n"}, {"type": "stdin_stdout", "input": "4\n1 1 10 1\n.\n1 2 10 1\n..\n2 1 10 1\n.\n.\n3 3 3 7\n..*\n*..\n.*.\n", "output": "10\n1\n20\n18\n"}, {"type": "st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHaving bought his own apartment, Boris decided to paper the walls in every room. Boris's flat has n rooms, each of which has the form of a rectangular parallelepiped. For every room we known its length, width and height o...
[{"type": "stdin_stdout", "input": "20\n110 466 472\n112 153 152\n424 492 490\n348 366 113\n208 337 415\n491 448 139\n287 457 403\n444 382 160\n325 486 284\n447 454 136\n216 412 418\n217 208 228\n109 436 291\n293 382 421\n483 339 174\n213 327 183\n278 268 147\n181 424 457\n388 289 430\n174 269 305\n20\n221 4 334\n257 4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA famous gang of pirates, Sea Dogs, has come back to their hideout from one of their extravagant plunders. They want to split their treasure fairly amongst themselves, that is why You, their trusted financial advisor, dev...
[{"type": "stdin_stdout", "input": "1000000000 3\n30490 19232\n45250 999980767\n264372930 1\n", "output": "-1"}, {"type": "stdin_stdout", "input": "221407444 1\n999999999 999999999\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "300 4\n1 200\n2 200\n50 100\n70 100\n", "output": "-1"}, {"type": "stdin_stdout",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe hobbits Frodo and Sam are carrying the One Ring to Mordor. In order not to be spotted by orcs, they decided to go through the mountains.\n\nThe mountain relief can be represented as a polyline with n points (x_i, y_i)...
[{"type": "stdin_stdout", "input": "5 9990\n300000 909\n366685 9999\n370849 9998\n379178 9996\n400000 1\n", "output": "25178.6601865589\n"}, {"type": "stdin_stdout", "input": "4 90\n362174 10000\n365957 13123\n373522 9997\n400000 3804\n", "output": "35378.024406478464\n"}, {"type": "stdin_stdout", "input": "4 90\n36217...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn Fire City, there are n intersections and m one-way roads. The i-th road goes from intersection a_i to b_i and has length l_i miles. \n\nThere are q cars that may only drive along those roads. The i-th car starts at int...
[{"type": "stdin_stdout", "input": "4 4\n1 2 1\n2 3 1\n3 1 2\n1 4 3\n3\n1 1 3\n1 2 4\n4 0 1\n", "output": "\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "4 4\n1 2 0\n2 3 1\n3 1 2\n1 4 3\n3\n1 1 2\n1 2 1\n4 0 1\n", "output": "YES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "4 4\n1 2 1\n2 3 1\n3 1 2\n1 4 3\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n\n\nInput\n\nThe input contains two integers a1, a2 (0 ≀ ai ≀ 109), separated by a single space.\n\nOutput\n\nOutput a single integer.\n\nExamples\n\nInput\n\n3 14\n\n\nOutput\n\n44\n\n\nInput\n\n27 12\n\n\nOutput\n\n48\n...
[{"type": "stdin_stdout", "input": "1000000000 1000000000\n", "output": "1000000001\n"}, {"type": "stdin_stdout", "input": "1000000000 0000000000\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 999999999\n", "output": "1999999999\n"}, {"type": "stdin_stdout", "input": "937477084 827336327\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBerland starts to seize the initiative on the war with Flatland. To drive the enemy from their native land, the berlanders need to know exactly how many more flatland soldiers are left in the enemy's reserve. Fortunately,...
[{"type": "stdin_stdout", "input": "63 5\n76826 79919 83599 93821 79919 46132 46132 46132 79919 76826 79919 79919 76826 79919 79919 76826 76826 46132 76826 40347 79919 46132 76826 83599 79919 79919 46132 46132 46132 83599 83599 79919 46132 83599 93821 76826 81314 79919 79919 83599 76826 76826 76826 76826 46132 76826 46...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a programming language in which every program is a non-empty sequence of \"<\" and \">\" signs and digits. Let's explain how the interpreter of this programming language works. A program is interpreted using move...
[{"type": "stdin_stdout", "input": "2 100\n44\n1 2\n2 2\n2 2\n1 2\n1 1\n2 2\n2 2\n1 2\n1 1\n1 1\n1 2\n1 1\n1 2\n1 1\n2 2\n1 1\n1 2\n2 2\n1 2\n1 2\n2 2\n2 2\n1 2\n1 1\n1 1\n1 2\n1 1\n2 2\n1 2\n1 2\n2 2\n1 2\n1 2\n2 2\n1 2\n2 2\n1 1\n1 1\n1 2\n1 2\n2 2\n1 2\n1 1\n1 2\n1 2\n2 2\n1 1\n2 2\n1 2\n1 1\n2 2\n1 1\n1 2\n2 2\n1 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVova, the Ultimate Thule new shaman, wants to build a pipeline. As there are exactly n houses in Ultimate Thule, Vova wants the city to have exactly n pipes, each such pipe should be connected to the water supply. A pipe ...
[{"type": "stdin_stdout", "input": "499999998500000000 1000000000\n", "output": "999955279\n"}, {"type": "stdin_stdout", "input": "499999999500000000 1000000000\n", "output": "999999998\n"}, {"type": "stdin_stdout", "input": "499999998500000001 1000000000\n", "output": "999955279\n"}, {"type": "stdin_stdout", "input": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is <image> for SmallR while <image> ...
[{"type": "stdin_stdout", "input": "125 1283 234 1112\n", "output": "0.33904754471037046\n"}, {"type": "stdin_stdout", "input": "719 1275 626 1265\n", "output": "0.7232359328271274\n"}, {"type": "stdin_stdout", "input": "125 1283 148 603\n", "output": "0.30545998322249646\n"}, {"type": "stdin_stdout", "input": "125 128...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIahub and Sorin are the best competitive programmers in their town. However, they can't both qualify to an important contest. The selection will be made with the help of a single problem. Blatnatalag, a friend of Iahub, m...
[{"type": "stdin_stdout", "input": "100\n-57 -64 83 76 80 27 60 76 -80 -56 52 72 -17 92 -96 87 41 -88 94 89 12 42 36 34 -100 -43 -42 62 3 87 -69 -6 -27 -59 -7 5 -90 -23 63 -87 -60 -92 -40 54 -16 -47 67 -64 10 33 -19 53 -7 -62 16 -74 -36 4 -75 -55 92 3 -22 43 -30 48 -27 88 -58 41 36 8 -40 -30 -18 16 22 -66 -91 -46 48 -6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOur good friend Mole is trying to code a big message. He is typing on an unusual keyboard with characters arranged in following way:\n \n \n \n qwertyuiop \n asdfghjkl; \n zxcvbnm,./ \n \n\nUnfor...
[{"type": "stdin_stdout", "input": "R\nwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n", "output": "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\n"}, {"type": "stdin_stdout", "input": "R\nxxxxxxxxxxxxxxxxxxxxx...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya became interested in bioinformatics. He's going to write an article about similar cyclic DNA sequences, so he invented a new method for determining the similarity of cyclic sequences.\n\nLet's assume that strings s ...
[{"type": "stdin_stdout", "input": "318\nTATCAATCGGTACGTGCGCATCATTGTCAATCGGGCTTCATGGCTTGCGGGCGCTACCCGAGGGGAAGCTGCGGACAGGTAGGTAAGATACACACGAACCAAACGGAGTTATGTTGGATAAATTGGCTGGAAGGGCGTAGGTATATCGAGTCGCGGACCTGGCATAGACTATCAGGGGCAGCGGTACAAGGCAACCGTGAGCGGGGTCTGCCCACCATTAGACCGATGCGCCGGCTCGTATATGTGATTCTGGTGAAAAGTATCATGCCGGGACGCGTA...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWilbur is playing with a set of n points on the coordinate plane. All points have non-negative integer coordinates. Moreover, if some point (x, y) belongs to the set, then all points (x', y'), such that 0 ≀ x' ≀ x and 0 ≀...
[{"type": "stdin_stdout", "input": "40\n0 0\n0 1\n0 2\n0 3\n0 4\n0 5\n0 6\n0 7\n0 8\n0 9\n0 10\n0 11\n0 12\n1 0\n1 1\n1 2\n1 3\n1 4\n1 5\n1 6\n1 7\n2 0\n3 0\n4 0\n5 0\n6 0\n7 0\n8 0\n9 0\n10 0\n11 0\n12 0\n13 0\n14 0\n15 0\n16 0\n17 0\n18 0\n19 0\n20 0\n0 1 2 -1 -2 3 4 -3 5 6 7 8 0 -4 -5 1 -6 -7 -8 -9 -10 -11 9 2 -12 -...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBerland scientists face a very important task - given the parts of short DNA fragments, restore the dinosaur DNA! The genome of a berland dinosaur has noting in common with the genome that we've used to: it can have 26 di...
[{"type": "stdin_stdout", "input": "94\nkmwbq\nmw\nwbq\ns\nlx\nf\npf\nl\nkmwb\na\nfoynt\nnt\nx\npf\npf\nep\nqs\nwbqse\nrl\nfoynt\nntzjd\nlxc\npfoy\nlx\nr\nagikm\nr\ntzjd\nep\nyntz\nu\nmw\nyntz\nfoynt\ntzjd\njdrlx\nwbqse\nr\nkmw\nwbq\nlx\nfoyn\nkm\nsepfo\nikmw\nf\nrlxch\nzjdrl\nyn\nhv\nynt\nbqs\nvu\nik\nqse\nxchvu\nmwbq...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMemory is performing a walk on the two-dimensional plane, starting at the origin. He is given a string s with his directions for motion:\n\n * An 'L' indicates he should move one unit left. \n * An 'R' indicates he shou...
[{"type": "stdin_stdout", "input": "RDDLLDLUUUDDRDRURLUUURLLDDLRLUURRLLRRLDRLLUDRLRULLDLRRLRLRLRUDUUDLULURLLDUURULURLLRRRURRRDRUUDLDRLRDRLRRDDLDLDLLUDRUDRLLLLDRDUULRUURRDLULLULDUDULRURRDDDLLUDRLUDDLDDDRRDDDULLLLDLDRLRRLRRDDRLULURRUDRDUUUULDURUDRDLDDUDUDRRURDULRRUDRLRRDLUURURDLDRLRDUDDDLDDDURURLUULRDUUULRURUDUDRRUDULLLU...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became interested what is the minimum jump ability he should have in order to be able to reach the far end of the stri...
[{"type": "stdin_stdout", "input": "VRPHBNWNWVWBWMFJJDCTJQJDJBKSJRZLVQRVVFLTZFSGCGDXCWQVWWWMFVCQHPKXXVRKTGWGPSMQTPKNDQJHNSKLXPCXDJDQDZZD\n", "output": "101\n"}, {"type": "stdin_stdout", "input": "DZZDQDJDXCPXLKSNHJQDNKPTQMSPGWGTKRVXXKPHQCVFMWWWVQWCXDGCGSFZTLFVVRQVLZRJSKBJDJQJTCDJJFMWBWVWNWNBHPRV\n", "output": "101\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBash has set out on a journey to become the greatest Pokemon master. To get his first Pokemon, he went to Professor Zulu's Lab. Since Bash is Professor Zulu's favourite student, Zulu allows him to take as many Pokemon fro...
[{"type": "stdin_stdout", "input": "95\n72 38 75 62 87 30 11 65 35 16 73 23 18 48 19 4 22 42 14 60 49 83 59 15 51 27 80 97 37 100 64 81 54 71 52 20 5 98 78 86 26 55 25 57 36 3 8 74 82 21 29 1 76 2 79 61 39 9 89 77 70 63 56 28 92 53 31 45 93 47 67 99 58 12 84 44 32 34 69 40 13 7 66 68 17 85 6 90 33 91 94 24 46 10 50\n",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPeter decided to lay a parquet in the room of size n Γ— m, the parquet consists of tiles of size 1 Γ— 2. When the workers laid the parquet, it became clear that the tiles pattern looks not like Peter likes, and workers will...
[{"type": "stdin_stdout", "input": "13 14\nLRLRLRLRLRLRLR\nULRLRLRLRLRLRU\nDULRLRLRLRLRUD\nUDULRLRLRLRUDU\nDUDULRLRLRUDUD\nUDUDULRLRUDUDU\nDUDUDULRUDUDUD\nUDUDUDLRDUDUDU\nDUDUDLRLRDUDUD\nUDUDLRLRLRDUDU\nDUDLRLRLRLRDUD\nUDLRLRLRLRLRDU\nDLRLRLRLRLRLRD\nLRLRLRLRLRLRLR\nULRLRLRLRLRLRU\nDULRLRLRLRLRUD\nUDULRLRLRLRUDU\nDUDUL...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs it's the first of April, Heidi is suspecting that the news she reads today are fake, and she does not want to look silly in front of all the contestants. She knows that a newspiece is fake if it contains heidi as a sub...
[{"type": "stdin_stdout", "input": "sjvmovplbrnakthytvanvvbscgdcdkdkbgginnbiyczyrkywcuvbgolznifdyiilonvqblbywxzgjnntldeuhhlecubshirsdxugezholvufotprjovwqiitypvaghlcxlrajrtufmysbpegjfvdboewogamnunalynjvwiopqfhndupfqxfatbpklpzdsdmzwvtitvdxkefremodmlferuxyisxmvjydjthekokldjkwoiffmhlquulcbogdnnzqaisoxqpgztuzvbleiitrqbzljbb...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMakes solves problems on Decoforces and lots of other different online judges. Each problem is denoted by its difficulty β€” a positive integer number. Difficulties are measured the same across all the judges (the problem w...
[{"type": "stdin_stdout", "input": "100 10\n246 286 693 607 87 612 909 312 621 37 801 558 504 914 416 762 187 974 976 123 635 488 416 659 988 998 93 662 92 749 889 78 214 786 735 625 921 372 713 617 975 119 402 411 878 138 548 905 802 762 940 336 529 373 745 835 805 880 816 94 166 114 475 699 974 462 61 337 555 805 968...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nArkady wants to water his only flower. Unfortunately, he has a very poor watering system that was designed for n flowers and so it looks like a pipe with n holes. Arkady can only use the water that flows from the first ho...
[{"type": "stdin_stdout", "input": "10 300 100\n35 25 110 40 60 7 44 145 23 96\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "10 300 100\n35 42 110 40 60 7 44 145 23 96\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "10 300 100\n35 42 110 40 60 7 26 145 23 96\n", "output": "6\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTwo participants are each given a pair of distinct numbers from 1 to 9 such that there's exactly one number that is present in both pairs. They want to figure out the number that matches by using a communication channel y...
[{"type": "stdin_stdout", "input": "12 12\n1 6 2 6 8 3 6 4 4 8 7 2 7 5 9 4 2 4 9 5 8 5 3 6\n2 8 6 15 2 6 7 4 6 5 6 3 5 8 7 8 7 1 1 9 9 7 7 3\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "12 12\n6 7 5 4 4 8 2 9 8 5 3 5 1 6 7 3 7 9 5 7 1 8 6 8\n6 4 2 1 7 8 1 6 8 5 9 8 1 5 7 2 5 9 6 3 9 2 9 4\n", "output": "-1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Chiku is very choosy about numbers. He considers 0 and 1 together as bad omen. So he hates 0 and 1 appearing adjacent to each other. So he wants you to remove these 0 and 1 combinations from a string. So you procee...
[{"type": "stdin_stdout", "input": "3\n11101111\n1100\n01010\n\nSAMPLE", "output": "6\n0\n1\n"}, {"type": "stdin_stdout", "input": "3\n11101111\n1100\n01110\n\nSAMPLE", "output": "6\n0\n1\n"}, {"type": "stdin_stdout", "input": "3\n11101111\n0100\n01110\n\nSAMPLE", "output": "6\n2\n1\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGudi enters the castle, and moves along the main path. Suddenly, a block in the ground opens and she falls into it! Gudi slides down and lands in a dark room. A mysterious voice announces: \nIntruders are not allowed in...
[{"type": "stdin_stdout", "input": "2\n12\n4 1\n152\n24 3\n\nSAMOLE", "output": "01\n112\n"}, {"type": "stdin_stdout", "input": "2\n10\n4 2\n152\n24 3\n\nSAMOLE", "output": "10\n112\n"}, {"type": "stdin_stdout", "input": "2\n20\n4 1\n152\n24 3\n\nSAMOLE", "output": "00\n112\n"}, {"type": "stdin_stdout", "input": "2\n12...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Shino loves to play with numbers. She just came to know about Fibonacci Series.\nFibonacci Series is a series of number such that\n\nFib(1) = 0\nFib(2) = 1\nFib(x) = Fib(x-1) + Fib(x-2)\\;where\\;2 < x\n\nSoon Litt...
[{"type": "stdin_stdout", "input": "10\n10 15\n1 110\n4 100\n110 100\n15 7\n99 86\n14 46\n4 3\n5 0\n4 0", "output": "932\n474113\n424098\n999956003\n999999418\n999943239\n144696\n0\n1000000003\n1000000005\n"}, {"type": "stdin_stdout", "input": "10\n10 15\n1 110\n2 100\n110 100\n15 7\n121 103\n14 73\n4 3\n5 0\n2 2", "ou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBob loves sorting very much. He is always thinking of new ways to sort an array.His friend Ram gives him a challenging task.He gives Bob an array and an integer K .The challenge is to produce the lexicographical minimal a...
[{"type": "stdin_stdout", "input": "10\n41 467\n6334 26500 19169 15724 11478 29358 26962 24464 5705 28145 23281 16827 9961 491 2995 11942 4827 5436 32391 14604 3902 153 292 12382 17421 18716 19718 19895 5447 21726 14771 11538 1869 19912 25667 26299 17035 9894 28703 23811 31322 \n333 673\n4664 15141 7711 28253 6868 2554...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA shop sells N kinds of fruits, Fruit 1, \\ldots, N, at prices of p_1, \\ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)\n\nHere, we will choose K kinds of fruits and buy one of each chosen kind. Fi...
[{"type": "stdin_stdout", "input": "5 3\n83 000 130 120 145", "output": "203\n"}, {"type": "stdin_stdout", "input": "3 3\n83 001 130 120 145", "output": "204\n"}, {"type": "stdin_stdout", "input": "3 3\n158 001 113 -1 126", "output": "113\n"}, {"type": "stdin_stdout", "input": "3 4\n158 001 113 -1 126", "output": "239\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.\n\nAt least how many sheets of paper does he need?\n\nConstraints\n\n* N is an integer.\n* 1 \\l...
[{"type": "stdin_stdout", "input": "1073", "output": "537\n"}, {"type": "stdin_stdout", "input": "282", "output": "141\n"}, {"type": "stdin_stdout", "input": "557", "output": "279\n"}, {"type": "stdin_stdout", "input": "284", "output": "142\n"}, {"type": "stdin_stdout", "input": "276", "output": "138\n"}, {"type": "std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven are N points on the circumference of a circle centered at (0,0) in an xy-plane. The coordinates of the i-th point are (\\cos(\\frac{2\\pi T_i}{L}),\\sin(\\frac{2\\pi T_i}{L})).\n\nThree distinct points will be chose...
[{"type": "stdin_stdout", "input": "10 100\n2\n11\n35\n42\n54\n69\n89\n91\n93\n99", "output": "0.352886583546338 -0.109065017701873"}, {"type": "stdin_stdout", "input": "10 100\n2\n11\n40\n46\n54\n69\n89\n91\n93\n183", "output": "-0.215229840673 -0.027898226758\n"}, {"type": "stdin_stdout", "input": "10 100\n2\n10\n35\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have A apples and P pieces of apple.\n\nWe can cut an apple into three pieces of apple, and make one apple pie by simmering two pieces of apple in a pan.\n\nFind the maximum number of apple pies we can make with what w...
[{"type": "stdin_stdout", "input": "1052 1", "output": "1578\n"}, {"type": "stdin_stdout", "input": "1829 1", "output": "2744\n"}, {"type": "stdin_stdout", "input": "3156 1", "output": "4734\n"}, {"type": "stdin_stdout", "input": "1450 1", "output": "2175\n"}, {"type": "stdin_stdout", "input": "845 4", "output": "1269\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is always an integer in Takahashi's mind.\n\nInitially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increa...
[{"type": "stdin_stdout", "input": "--+-", "output": "-2\n"}, {"type": "stdin_stdout", "input": "---+", "output": "-2\n"}, {"type": "stdin_stdout", "input": "+---", "output": "-2\n"}, {"type": "stdin_stdout", "input": "--+-", "output": "-2\n"}, {"type": "stdin_stdout", "input": "---+", "output": "-2\n"}, {"type": "stdi...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, …, Katana N, and can perform the following two kinds of attacks in any order:\n\n* Wield on...
[{"type": "stdin_stdout", "input": "2 1000000000\n1 1\n1 00000000\n0 30000000\n2 164820504", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "4 1000000000\n1 1\n1 00000000\n1 30000000\n1 164820504", "output": "805179498\n"}, {"type": "stdin_stdout", "input": "4 1000000000\n1 1\n1 00000000\n0 30000000\n2 16...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a tree with N vertices.\nHere, a tree is a kind of graph, and more specifically, a connected undirected graph with N-1 edges, where N is the number of its vertices.\nThe i-th edge (1≀i≀N-1) connects Vertices...
[{"type": "stdin_stdout", "input": "10\n1 2 1000000000\n2 3 1000000000\n3 4 1000000000\n4 5 1000000000\n5 6 1000000000\n6 7 1000000000\n7 9 1000000000\n8 9 1000000000\n9 10 1000000000\n1 1\n9 10", "output": "15000000000\n"}, {"type": "stdin_stdout", "input": "10\n1 2 1000100000\n2 3 1000000000\n3 4 1000000000\n4 5 1000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a square-shaped grid with N vertical rows and N horizontal columns. We will denote the square at the i-th row from the top and the j-th column from the left as (i,\\ j).\n\nInitially, each square is either white ...
[{"type": "stdin_stdout", "input": "3\n...\n.$.\n../", "output": "-1"}, {"type": "stdin_stdout", "input": "3\n...\n/$.\n../", "output": "-1"}, {"type": "stdin_stdout", "input": "3\n...\n/$.\n...", "output": "-1"}, {"type": "stdin_stdout", "input": "3\n...\n/$.\n./.", "output": "-1"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nn! = n Γ— (n βˆ’ 1) Γ— (n βˆ’ 2) Γ— ... Γ— 3 Γ— 2 Γ— 1\n\nIs called the factorial of n. For example, the factorial of 12\n\n12! = 12 x 11 x 10 x 9 x 8 x 7 x 6 x 5 x 4 x 3 x 2 x 1 = 479001600\n\nAnd there are two consecutive 0s at t...
[{"type": "stdin_stdout", "input": "2\n51\n11000\n0", "output": "0\n12\n2748\n"}, {"type": "stdin_stdout", "input": "2\n58\n10011\n0", "output": "0\n13\n2501\n"}, {"type": "stdin_stdout", "input": "2\n59\n10111\n0", "output": "0\n13\n2525\n"}, {"type": "stdin_stdout", "input": "2\n62\n10110\n0", "output": "0\n14\n2525\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWhite Tiger University holds a programming contest every year. The contest starts with a score of 0 for all teams, and points are added according to the answer status. In this contest, rankings will be made in descending ...
[{"type": "stdin_stdout", "input": "4 11\n0 2 7\n0 2 5\n0 3 8\n1 1\n1 2\n1 3\n0 3 2\n1 1\n0 2 1\n1 2\n1 1", "output": "2 12\n3 8\n1 0\n2 12\n3 10\n2 13\n"}, {"type": "stdin_stdout", "input": "4 11\n0 2 7\n0 2 5\n0 3 8\n1 1\n1 2\n1 3\n0 3 2\n1 1\n0 2 1\n1 2\n1 3", "output": "2 12\n3 8\n1 0\n2 12\n3 10\n1 0\n"}, {"type":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe deadline of Prof. Hachioji’s assignment is tomorrow. To complete the task, students have to copy pages of many reference books in the library.\n\nAll the reference books are in a storeroom and only the librarian is al...
[{"type": "stdin_stdout", "input": "2 1 1\n1\n50\n4 2 2\n1\n50\n1\n60\n2 1 2\n2\n60 61\n1\n93\n4 2 3\n3\n89 61 62\n1\n70\n2\n47 50\n3 1 2\n3\n60 61 62\n2\n70 60\n1 2 5\n2\n87 95\n3\n96 71 35\n2\n68 2\n3\n1 18 93\n2\n57 2\n2 2 1\n4\n1 0 1 3 1\n0 0 0", "output": "4\n12\n28\n68\n58\n98\n21\n0\n"}, {"type": "stdin_stdout",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nArithmetic Progressions\n\nAn arithmetic progression is a sequence of numbers $a_1, a_2, ..., a_k$ where the difference of consecutive members $a_{i+1} - a_i$ is a constant ($1 \\leq i \\leq k-1$). For example, the sequen...
[{"type": "stdin_stdout", "input": "6\n-2 11 12 30 3 0", "output": "2\n"}, {"type": "stdin_stdout", "input": "6\n-4 1 6 2 13 -1", "output": "3\n"}, {"type": "stdin_stdout", "input": "6\n-2 1 -1 8 13 9", "output": "2\n"}, {"type": "stdin_stdout", "input": "6\n-2 11 5 20 8 0", "output": "3\n"}, {"type": "stdin_stdout", "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTaro's Shopping\n\nMammy decided to give Taro his first shopping experience. Mammy tells him to choose any two items he wants from those listed in the shopping catalogue, but Taro cannot decide which two, as all the items...
[{"type": "stdin_stdout", "input": "3 13\n17 20 30\n6 7\n1 2 5 1 4 11\n7 000\n22 34 102 94 59 39 61\n4 100\n133 98 100 50\n4 5\n10 5 10 13\n0 0", "output": "NONE\n7\nNONE\nNONE\nNONE\n"}, {"type": "stdin_stdout", "input": "3 48\n17 20 30\n6 1\n1 2 5 1 4 11\n7 000\n22 34 102 94 59 39 70\n4 100\n80 70 119 50\n4 20\n10 5 ...
code_stdio