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\nThe door of Snuke's laboratory is locked with a security code.\n\nThe security code is a 4-digit number. We say the security code is hard to enter when it contains two consecutive digits that are the same.\n\nYou are give... | [{"type": "stdin_stdout", "input": "12101", "output": "Good\n"}, {"type": "stdin_stdout", "input": "12904", "output": "Good\n"}, {"type": "stdin_stdout", "input": "24106", "output": "Good\n"}, {"type": "stdin_stdout", "input": "16798", "output": "Good\n"}, {"type": "stdin_stdout", "input": "29052", "output": "Good\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have N cards. A number a_i is written on the i-th card.\nAlice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first.\nThe game ends when all the cards are ... | [{"type": "stdin_stdout", "input": "4\n20 18 2 12", "output": "12\n"}, {"type": "stdin_stdout", "input": "4\n139 4 2 5", "output": "136\n"}, {"type": "stdin_stdout", "input": "4\n139 1 2 5", "output": "135\n"}, {"type": "stdin_stdout", "input": "4\n139 0 2 4", "output": "137\n"}, {"type": "stdin_stdout", "input": "4\n2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N towns in Takahashi Kingdom. They are conveniently numbered 1 through N.\n\nTakahashi the king is planning to go on a tour of inspection for M days. He will determine a sequence of towns c, and visit town c_i o... | [{"type": "stdin_stdout", "input": "107 137", "output": "944428092\n"}, {"type": "stdin_stdout", "input": "150 300", "output": "734286322"}, {"type": "stdin_stdout", "input": "21 300", "output": "213825142\n"}, {"type": "stdin_stdout", "input": "13 300", "output": "572293777\n"}, {"type": "stdin_stdout", "input": "13 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhen a boy was cleaning up after his grand father passing, he found an old paper:\n\n<image>\n\n\n\nIn addition, other side of the paper says that \"go ahead a number of steps equivalent to the first integer, and turn clo... | [{"type": "stdin_stdout", "input": "56,65\n97,54\n64,-4\n55,76\n42,-27\n43,80\n87,-86\n55,-6\n89,34\n5,59\n0,0", "output": "181\n-212\n"}, {"type": "stdin_stdout", "input": "56,65\n97,54\n64,-4\n55,76\n42,-27\n43,80\n77,-86\n55,-6\n89,34\n95,5\n0,0", "output": "180\n-297\n"}, {"type": "stdin_stdout", "input": "56,65\n9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Group C of the 3rd year, we decided to use the \"class flag\" used at the sports festival on November 10, 2007 at future class reunions. So, in order to decide which students to keep the \"class flag\", I decided to pl... | [{"type": "stdin_stdout", "input": "50\n5576\n6063\n5578", "output": "3C11\n3C38\n3C18\n3C01\n"}, {"type": "stdin_stdout", "input": "50\n5576\n5577\n5578", "output": "3C11\n3C38\n3C39\n3C01"}, {"type": "stdin_stdout", "input": "50\n5576\n6063\n515", "output": "3C11\n3C38\n3C18\n3C08\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nShe is an apprentice wizard. She first learned the magic of manipulating time. And she decided to open a liquor store to earn a living. It has to do with the fact that all the inhabitants of the country where she lives lo... | [{"type": "stdin_stdout", "input": "12 3\n2 3 6\n12 4\n1 2 3 6\n0 0", "output": "6.0000000000\n0.0000000000"}, {"type": "stdin_stdout", "input": "21 3\n2 3 19\n13 4\n1 2 4 6\n0 0", "output": "10.5\n0.0\n"}, {"type": "stdin_stdout", "input": "21 3\n2 5 19\n13 4\n2 2 4 3\n0 0", "output": "10.5\n6.5\n"}, {"type": "stdin_s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n3\n3 0 1\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 thi... | [{"type": "stdin_stdout", "input": "3\n152 -3 2", "output": "0\n"}, {"type": "stdin_stdout", "input": "3\n-1 -1 1", "output": "0\n"}, {"type": "stdin_stdout", "input": "3\n13 -2 3", "output": "0\n"}, {"type": "stdin_stdout", "input": "3\n25 -2 3", "output": "0\n"}, {"type": "stdin_stdout", "input": "3\n25 -2 4", "outpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads relations in a SNS (Social Network Service), and judges that given pairs of users are reachable each other through the network.\n\nConstraints\n\n* $2 \\leq n \\leq 100,000$\n* $0 \\leq m \\leq... | [{"type": "stdin_stdout", "input": "16 9\n0 1\n0 2\n3 4\n5 7\n5 2\n3 7\n6 13\n11 12\n8 9\n3\n0 1\n5 9\n1 3", "output": "yes\nno\nyes\n"}, {"type": "stdin_stdout", "input": "16 9\n0 1\n0 2\n3 4\n5 7\n5 2\n3 7\n6 13\n7 8\n8 9\n3\n0 1\n5 9\n1 3", "output": "yes\nyes\nyes\n"}, {"type": "stdin_stdout", "input": "16 9\n0 1\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads $n$ dices constructed in the same way as Dice I, and determines whether they are all different. For the determination, use the same way as Dice III.\n\nConstraints\n\n* $2 \\leq n \\leq 100$\n*... | [{"type": "stdin_stdout", "input": "3\n-1 10 1 14 13 17\n6 0 35 1 0 0\n4 4 2 7 -1 -1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "3\n-1 10 1 14 13 17\n6 0 35 1 0 0\n4 4 2 5 -1 -1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "3\n0 10 1 14 9 17\n6 0 35 1 0 0\n13 4 2 7 -1 -1", "output": "Yes\n"}, {"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp has prepared n competitive programming problems. The topic of the i-th problem is a_i, and some problems' topics may coincide.\n\nPolycarp has to host several thematic contests. All problems in each contest shoul... | [{"type": "stdin_stdout", "input": "55\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3\n", "output": "49"}, {"type": "stdin_stdout", "input": "18\n2 1 2 10 2 10 10 2 2 1 10 10 10 10 1 1 10 10\n", "output": "14"}, {"type": "stdin_stdout", "input": "18\n2 1 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPavel has several sticks with lengths equal to powers of two.\n\nHe has a_0 sticks of length 2^0 = 1, a_1 sticks of length 2^1 = 2, ..., a_{n-1} sticks of length 2^{n-1}. \n\nPavel wants to make the maximum possible numbe... | [{"type": "stdin_stdout", "input": "100\n5 5 2 4 5 4 4 4 4 2 5 3 4 2 4 4 1 1 5 3 2 2 1 3 3 2 5 3 4 5 1 3 5 4 4 4 3 1 4 4 3 4 5 2 5 4 2 1 2 2 3 5 6 5 1 4 5 3 1 4 2 2 5 1 5 3 4 1 5 1 2 2 3 5 1 3 2 4 2 4 2 2 4 1 3 5 2 2 2 3 3 4 3 2 2 5 5 4 2 5\n", "output": "106\n"}, {"type": "stdin_stdout", "input": "100\n5 5 2 4 5 4 4 4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBob has a string s consisting of lowercase English letters. He defines s' to be the string after removing all \"a\" characters from s (keeping all other characters in the same order). He then generates a new string t by c... | [{"type": "stdin_stdout", "input": "aeaaaaravazyzaadwaarzajaaawvcakaanbparauaoaaamsmjaaaayaylhaaaxegasgaaaipaakalaspkbaaaaazfacaaafzypraervzyzdwrzjwvcknbpruomsmjyylhxegsgipklspkbzfcfzypr\n", "output": "aeaaaaravazyzaadwaarzajaaawvcakaanbparauaoaaamsmjaaaayaylhaaaxegasgaaaipaakalaspkbaaaaazfacaaafzypra"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe main characters have been omitted to be short.\n\nYou are given a directed unweighted graph without loops with n vertexes and a path in it (that path is not necessary simple) given by a sequence p_1, p_2, …, p_m of m ... | [{"type": "stdin_stdout", "input": "20\n01001100001100011011\n00111101001100001101\n01010010000010000110\n10101001000000000110\n00110110111101100000\n00111010110011100011\n01101000111001110100\n11111100011110000100\n11111010011110011000\n10001100000101100101\n11001111010010100011\n00001111001001111111\n1001111000010100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are playing a variation of game 2048. Initially you have a multiset s of n integers. Every integer in this multiset is a power of two. \n\nYou may perform any number (possibly, zero) operations with this multiset.\n\n... | [{"type": "stdin_stdout", "input": "6\n4\n1024 512 64 512\n1\n2048\n3\n128 512 2\n2\n4096 8\n1\n2048 2 2048 2048 2048 2048 2048\n2\n2048 4898\n", "output": "YES\nYES\nNO\nNO\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "6\n4\n1024 512 64 512\n1\n2048\n3\n64 512 2\n2\n4096 4\n7\n2048 2 2048 2048 2048 2048 2048\n2\n2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBob is playing with 6-sided dice. A net of such standard cube is shown below.\n\n<image>\n\nHe has an unlimited supply of these dice and wants to build a tower by stacking multiple dice on top of each other, while choosin... | [{"type": "stdin_stdout", "input": "4\n29 34 19 30\n", "output": "YES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "4\n29 47 19 30\n", "output": "YES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "4\n15 47 19 30\n", "output": "YES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "4\n29 34 19 38\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEvlampiy was gifted a rooted tree. The vertices of the tree are numbered from 1 to n. Each of its vertices also has an integer a_i written on it. For each vertex i, Evlampiy calculated c_i — the number of vertices j in th... | [{"type": "stdin_stdout", "input": "5\n0 1\n1 3\n2 1\n3 0\n2 0\n", "output": "YES\n2 5 3 1 4 \n"}, {"type": "stdin_stdout", "input": "5\n0 1\n1 3\n2 1\n3 0\n2 0\n", "output": "YES\n2 5 3 1 4 \n"}, {"type": "stdin_stdout", "input": "5\n0 1\n1 2\n2 1\n3 0\n2 0\n", "output": "YES\n2 4 3 1 5 "}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBessie is out grazing on the farm, which consists of n fields connected by m bidirectional roads. She is currently at field 1, and will return to her home at field n at the end of the day.\n\nThe Cowfederation of Barns ha... | [{"type": "stdin_stdout", "input": "42 41 20\n8 34 12 13 38 3 9 10 18 16 2 26 24 17 32 21 4 27 15 39\n1 35\n35 8\n1 31\n31 34\n1 40\n40 12\n1 30\n30 13\n1 33\n33 38\n1 37\n37 3\n1 22\n22 9\n1 20\n20 10\n1 25\n25 18\n1 14\n14 16\n1 42\n42 7\n7 2\n42 11\n11 26\n42 29\n29 24\n42 36\n36 17\n42 41\n41 32\n42 23\n23 21\n42 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDreamoon likes sequences very much. So he created a problem about the sequence that you can't find in OEIS: \n\nYou are given two integers d, m, find the number of arrays a, satisfying the following constraints:\n\n * Th... | [{"type": "stdin_stdout", "input": "10\n1 1100000000\n2 1587398050\n4 99999998\n4 9999997\n5 999996\n10 99995\n9 9994\n8 1104\n12 92\n19 1\n", "output": "1\n3\n11\n11\n17\n119\n89\n59\n87\n0\n"}, {"type": "stdin_stdout", "input": "10\n1 1100000000\n2 1587398050\n3 99999998\n4 9999997\n5 999996\n18 99995\n9 9994\n8 1104... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSlime has a sequence of positive integers a_1, a_2, …, a_n.\n\nIn one operation Orac can choose an arbitrary subsegment [l … r] of this sequence and replace all values a_l, a_{l + 1}, …, a_r to the value of median of \\\\... | [{"type": "stdin_stdout", "input": "5\n5 3\n1 5 2 6 1\n1 6\n6\n3 2\n1 2 3\n4 3\n3 1 2 3\n10 3\n1 2 3 4 5 6 7 8 9 10\n", "output": "no\nyes\nyes\nno\nyes\n"}, {"type": "stdin_stdout", "input": "5\n5 3\n1 5 2 6 1\n1 6\n6\n3 2\n1 2 3\n4 3\n3 1 2 3\n10 3\n1 4 3 4 5 6 7 8 9 10\n", "output": "no\nyes\nyes\nno\nyes\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.\n... | [{"type": "stdin_stdout", "input": "4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4\n", "output": "3\n2\n0\n4\n"}, {"type": "stdin_stdout", "input": "4\n7\n1 7 1 6 4 7 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4\n", "output": "3\n2\n0\n4\n"}, {"type": "stdin_stdout", "input": "4\n7\n1 7 1 6 4 7 6\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a, consisting of n integers.\n\nEach position i (1 ≤ i ≤ n) of the array is either locked or unlocked. You can take the values on the unlocked positions, rearrange them in any order and place them b... | [{"type": "stdin_stdout", "input": "5\n3\n1 3 2\n0 0 0\n4\n2 -3 4 -1\n1 1 1 1\n7\n-8 4 -2 -6 4 7 1\n1 0 0 0 1 1 0\n5\n0 1 -4 6 3\n0 0 0 1 1\n6\n-1 7 10 4 -8 -1\n1 0 0 0 0 1\n", "output": "3 2 1 \n2 -3 4 -1 \n-8 4 1 -2 4 7 -6 \n1 0 -4 6 3 \n-1 10 7 4 -8 -1 \n"}, {"type": "stdin_stdout", "input": "5\n3\n1 3 2\n0 0 0\n4\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor a given array a consisting of n integers and a given integer m find if it is possible to reorder elements of the array a in such a way that ∑_{i=1}^{n}{∑_{j=i}^{n}{(a_j)/(j)}} equals m? It is forbidden to delete eleme... | [{"type": "stdin_stdout", "input": "5\n4 10\n5 5 5 5\n3 5\n5 5 5\n3 4\n10 1 1\n4 5\n5 5 1 5\n5 5\n5 5 5 10 5\n", "output": "NO\nNO\nNO\nNO\nNO\n"}, {"type": "stdin_stdout", "input": "5\n4 10\n5 5 5 5\n3 5\n5 5 5\n3 4\n10 1 1\n4 5\n5 5 1 5\n5 5\n5 5 5 15 5\n", "output": "NO\nNO\nNO\nNO\nNO\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array of integers b_1, b_2, …, b_n.\n\nAn array a_1, a_2, …, a_n of integers is hybrid if for each i (1 ≤ i ≤ n) at least one of these conditions is true: \n\n * b_i = a_i, or \n * b_i = ∑_{j=1}^{i} a_j... | [{"type": "stdin_stdout", "input": "4\n3\n2 -1 1\n4\n-1 2 2 6\n10\n2 -1 1 -2 1 0 -11 0 2 -1\n4\n-1 -2 -1 1\n", "output": "4\n8\n210\n8\n"}, {"type": "stdin_stdout", "input": "4\n3\n2 -1 2\n4\n-1 2 2 5\n10\n2 -1 1 -2 0 0 -11 0 2 -1\n4\n-1 -2 -1 1\n", "output": "4\n8\n150\n8\n"}, {"type": "stdin_stdout", "input": "4\n3\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nI, Fischl, Prinzessin der Verurteilung, descend upon this land by the call of fate an — Oh, you are also a traveler from another world? Very well, I grant you permission to travel with me.\n\nIt is no surprise Fischl spea... | [{"type": "stdin_stdout", "input": "3\n28\nqaabzwsxedcrfvtgbyhnujmiklop\n13\ncleanairactbd\n10\naannttoonn\n", "output": "\nac\nf\nb\n"}, {"type": "stdin_stdout", "input": "4\n5\noisha\n10\niloveoisha\n16\nshahromloveoisha\n16\noishaloveshahrom\n", "output": "b\nb\nb\nb\n"}, {"type": "stdin_stdout", "input": "4\n5\nais... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day Polycarpus got hold of two non-empty strings s and t, consisting of lowercase Latin letters. Polycarpus is quite good with strings, so he immediately wondered, how many different pairs of \"x y\" are there, such t... | [{"type": "stdin_stdout", "input": "pfdempfohomnpgbeegikfmflnalbbajpnpgeacaicoehopgnabnklheepnlnflohjegcciflmfjhachnhekckfjgoffhkblncidn\nidlhklpclcghngeggpjdgefccihndpoikojdjnbkdfjgaanoolfmnifnmbpeeghpicehjdiipnlfnjpglidpnnnjfmjfhbcogojkcfflmmfcgajbjbfaikhmjofbnjnaolbcdkelcieeodbfjcfiblhhmeelmpcmmcdhjcnnfklgedjjbaljnd... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe tournament «Sleepyhead-2010» in the rapid falling asleep has just finished in Berland. n best participants from the country have participated in it. The tournament consists of games, each of them is a match between tw... | [{"type": "stdin_stdout", "input": "9\n4 5\n9 6\n5 6\n8 7\n5 1\n8 5\n9 5\n4 7\n2 6\n7 6\n3 5\n2 1\n8 2\n3 7\n9 1\n2 5\n2 7\n4 2\n8 9\n8 1\n3 6\n7 1\n8 6\n3 2\n3 1\n9 2\n4 6\n5 7\n1 6\n4 8\n4 1\n4 3\n4 9\n9 3\n9 7\n", "output": "8 3\n"}, {"type": "stdin_stdout", "input": "8\n4 3\n6 8\n1 5\n8 3\n1 4\n1 7\n5 6\n5 3\n5 8\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEugeny has array a = a1, a2, ..., an, consisting of n integers. Each integer ai equals to -1, or to 1. Also, he has m queries:\n\n * Query number i is given as a pair of integers li, ri (1 ≤ li ≤ ri ≤ n). \n * The respo... | [{"type": "stdin_stdout", "input": "10 10\n-1 1 -1 1 -1 -1 -1 -1 -1 -1\n6 10\n4 5\n3 6\n2 3\n3 5\n4 5\n3 4\n1 7\n1 1\n1 1\n", "output": "0\n1\n1\n1\n0\n1\n1\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "10 10\n-1 1 -1 1 -1 -1 -1 -1 -1 -1\n6 13\n4 5\n3 6\n2 3\n0 5\n4 5\n3 4\n1 4\n1 1\n1 1\n", "output": "0\n1\n1\n1\n0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou're a mikemon breeder currently in the middle of your journey to become a mikemon master. Your current obstacle is go through the infamous Biridian Forest.\n\nThe forest\n\nThe Biridian Forest is a two-dimensional grid... | [{"type": "stdin_stdout", "input": "9 8\n38030772\n697T83S2\n8T626740\n86T02062\n05402864\nT7504180\n3T368E08\n90637446\n12709560\n", "output": "194\n"}, {"type": "stdin_stdout", "input": "9 8\n38030772\n697T83S2\n8T626740\n86T02062\n05402864\nT7504180\n3T368E08\n90637446\n13738808\n", "output": "202\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn a number line there are n balls. At time moment 0 for each ball the following data is known: its coordinate xi, speed vi (possibly, negative) and weight mi. The radius of the balls can be ignored.\n\nThe balls collide ... | [{"type": "stdin_stdout", "input": "10 88\n-100 -86 12\n-88 -62 9\n-96 -73 1\n-89 -100 34\n-80 -57 18\n-81 -91 2\n-84 -100 7\n-77 -84 3\n-97 -96 10\n-52 -60 3\n", "output": "-9488.033285728\n-7931.120096426\n-8406.936891019\n-8261.349896254\n-5320.095238095\n-5795.666666667\n-6961.166666667\n-5303.428571429\n-8788.1186... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDima and Inna are doing so great! At the moment, Inna is sitting on the magic lawn playing with a pink pony. Dima wanted to play too. He brought an n × m chessboard, a very tasty candy and two numbers a and b.\n\nDima put... | [{"type": "stdin_stdout", "input": "1000000 1000000 1000000 0000000 1000000 1000000\n", "output": "Poor Inna and pony!"}, {"type": "stdin_stdout", "input": "1000100 1000000 1000000 0000000 1000000 1000000\n", "output": "Poor Inna and pony!"}, {"type": "stdin_stdout", "input": "1000100 1000010 1000000 0000000 1000000 10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDZY loves chemistry, and he enjoys mixing chemicals.\n\nDZY has n chemicals, and m pairs of them will react. He wants to pour these chemicals into a test tube, and he needs to pour them in one by one, in any order. \n\nLe... | [{"type": "stdin_stdout", "input": "50 50\n16 21\n23 47\n23 30\n2 12\n23 41\n3 16\n14 20\n4 49\n2 47\n19 29\n13 42\n5 8\n24 38\n13 32\n34 37\n38 46\n3 20\n27 50\n7 42\n33 45\n2 48\n41 47\n9 48\n15 26\n27 37\n32 34\n17 24\n1 39\n27 30\n10 33\n38 47\n32 33\n14 39\n35 50\n2 19\n3 12\n27 34\n18 25\n12 23\n31 44\n5 35\n28 4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough money, so George was going to work as a programmer. Now he faced the following problem at the work.\n\n... | [{"type": "stdin_stdout", "input": "141 12 6\n66 53 86 91 12 27 5 74 79 50 33 2 100 26 2 73 16 14 50 86 75 9 66 48 19 34 25 1 22 50 63 39 38 42 98 71 76 27 80 16 74 21 36 1 32 20 65 28 68 40 41 6 0 77 65 84 0 34 60 0 42 65 2 16 25 85 35 57 74 66 26 33 39 14 0 6 2 15 87 99 47 67 75 63 72 32 93 7 5 63 35 99 89 61 18 25 7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a permutation of n numbers p1, p2, ..., pn. We perform k operations of the following type: choose uniformly at random two indices l and r (l ≤ r) and reverse the order of the elements pl, pl + 1, ..., pr. Yo... | [{"type": "stdin_stdout", "input": "100 83\n6 98 18 72 51 83 66 40 32 60 90 53 91 10 92 47 94 1 77 8 19 78 9 52 85 2 26 12 97 100 82 84 46 79 38 39 50 35 55 99 37 88 74 4 20 23 43 11 87 59 75 61 71 73 34 86 21 17 44 62 42 95 30 54 5 25 64 81 58 65 7 3 45 70 76 24 89 28 80 41 14 31 49 56 22 63 68 13 29 33 67 96 27 36 15... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKing of Berland Berl IV has recently died. Hail Berl V! As a sign of the highest achievements of the deceased king the new king decided to build a mausoleum with Berl IV's body on the main square of the capital.\n\nThe ma... | [{"type": "stdin_stdout", "input": "30 50\n17 >= 29\n19 <= 18\n3 > 50\n54 >= 56\n47 < 15\n50 <= 33\n49 < 8\n57 <= 16\n30 > 35\n49 < 21\n3 >= 37\n56 <= 51\n46 > 51\n35 >= 48\n32 < 15\n12 <= 4\n38 > 57\n55 < 9\n49 <= 1\n9 >= 38\n60 = 60\n1 > 12\n40 >= 43\n13 > 38\n24 >= 39\n9 < 2\n12 > 58\n15 >= 30\n13 > 50\n42 <= 16\n23... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya has recently started working as a programmer in the IT city company that develops computer games.\n\nBesides game mechanics implementation to create a game it is necessary to create tool programs that can be used by... | [{"type": "stdin_stdout", "input": "870 396 187 223 444 202 222 732\n", "output": "999.7945324433952405951409048 550.7817151597707949206572664\n699.8933625471825917263579697 538.6454762496719970710223890\n784.9466812735912958354234092 467.3227381248359985355111945\n314.6021379638620081853339627 -93.56941780067005040577... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLong ago, Vasily built a good fence at his country house. Vasily calls a fence good, if it is a series of n consecutively fastened vertical boards of centimeter width, the height of each in centimeters is a positive integ... | [{"type": "stdin_stdout", "input": "50\n1 3083990 976356336 650365630 1 170272482 1 547248035 1 1 1 1 1 928379588 1 1 1 270052499 315045369 1 1 556091215 1 655608230 424079072 1 1 185387009 77360256 1 1 942696777 228860271 1 487787709 1 437229749 167886535 1 1 904578415 319694007 1 313704390 1 1 957736320 771147030 458... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter returned from forest, Alyona started reading a book. She noticed strings s and t, lengths of which are n and m respectively. As usual, reading bored Alyona and she decided to pay her attention to strings s and t, wh... | [{"type": "stdin_stdout", "input": "120 362 6\ncaaccbbbabbbcbaacbaccacaaccacaaababccaccaabaccacccbbaaaaababbccbbacccaacabacbaaacabbacbabcccbccbcbbcaabaaabaabcccaabacbb\nabcbbaaccbbcabbcbbcacbabaacbaaacabcbabcabbabccbcaaacaccaaabbcbaacccccbcabacaacabbbcabaabcbbccabacbaaaacbbbbbccabccccbababcbacbbbcbbaabcaabcacbaaaaaccba... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notificat... | [{"type": "stdin_stdout", "input": "10 85\n2 2\n1 10\n1 1\n2 6\n1 2\n1 4\n1 7\n2 1\n1 1\n3 3\n1 9\n1 6\n1 8\n1 10\n1 8\n2 8\n1 6\n1 3\n1 9\n1 6\n1 3\n1 8\n1 1\n1 6\n1 10\n2 1\n2 10\n1 10\n1 1\n1 10\n1 6\n1 2\n1 8\n1 3\n1 4\n1 9\n1 5\n1 5\n2 2\n2 4\n1 7\n1 1\n2 4\n1 9\n2 1\n1 7\n1 8\n3 33\n1 10\n2 2\n1 3\n1 10\n1 6\n3 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBachgold problem is very easy to formulate. Given a positive integer n represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1.\n\nRe... | [{"type": "stdin_stdout", "input": "92755\n", "output": "46377\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter returning from the army Makes received a gift — an array a consisting of n positive integer numbers. He hadn't been solving problems for a long time, so he became interested to answer a particular question: how many... | [{"type": "stdin_stdout", "input": "4\n33554432 33554432 67108864 33554432\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "4\n33554432 9657327 117245990 61220571\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "4\n33554432 9657327 67108864 33554432\n", "output": "1\n"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGleb ordered pizza home. When the courier delivered the pizza, he was very upset, because several pieces of sausage lay on the crust, and he does not really like the crust.\n\nThe pizza is a circle of radius r and center ... | [{"type": "stdin_stdout", "input": "10 2\n11\n1 1 0\n2 2 3\n3 3 0\n6 4 0\n5 5 0\n6 6 0\n7 7 4\n8 8 7\n9 18 3\n10 10 100\n9 0 1\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "10 2\n11\n1 1 0\n2 2 3\n3 3 0\n6 4 0\n5 5 0\n6 6 0\n7 7 8\n8 8 7\n9 18 3\n10 10 100\n9 0 1\n", "output": "2\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVadim is really keen on travelling. Recently he heard about kayaking activity near his town and became very excited about it, so he joined a party of kayakers.\n\nNow the party is ready to start its journey, but firstly t... | [{"type": "stdin_stdout", "input": "50\n297 787 34 268 439 629 600 398 425 833 721 908 830 636 64 509 420 647 499 675 427 599 396 119 798 742 577 355 22 847 389 574 766 453 196 772 225 261 106 844 726 975 173 992 874 89 775 616 678 52 69 591 181 573 258 381 665 301 589 379 362 146 790 842 765 100 229 916 938 97 340 793... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n points marked on the plane. The points are situated in such a way that they form a regular polygon (marked points are its vertices, and they are numbered in counter-clockwise order). You can draw n - 1 segment... | [{"type": "stdin_stdout", "input": "10\n0 1 1 0 -1 -2 1 0 0 0\n1 0 0 0 1 0 0 0 0 0\n0 0 1 2 1 0 1 1 0 0\n0 0 1 0 0 0 0 -1 0 0\n-1 0 -1 0 0 0 0 0 1 0\n0 0 -1 0 0 1 -1 0 0 1\n2 0 0 0 0 0 1 0 0 2\n0 -1 0 0 0 0 0 0 0 0\n0 0 0 0 0 -1 0 0 0 0\n0 1 0 -2 0 0 -1 -1 0 0\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA permutation of size n is an array of size n such that each integer from 1 to n occurs exactly once in this array. An inversion in a permutation p is a pair of indices (i, j) such that i > j and ai < aj. For example, a p... | [{"type": "stdin_stdout", "input": "1\n1\n10\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n", "output": "even\neven\neven\neven\neven\neven\neven\neven\neven\neven\n"}, {"type": "stdin_stdout", "input": "7\n2 6 1 7 4 5 3\n5\n4 5\n6 7\n5 6\n4 5\n2 5\n", "output": "odd\neven\nodd\neven\neven\n"}, {"type": "stdin_std... | 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": "1000000000000000000 2\n", "output": "61\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0 1 1 1 1 1 0 0 1 0 1 1 1 1 1 1 0 1 0 0 1 1 1 0 0 0 0 1 0 0 0 1 0 0 1 \n"}, {"type": "stdin_stdout", "input": "1000000000100000000 2\n", "output": "61\n0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 1 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYear 2118. Androids are in mass production for decades now, and they do all the work for humans. But androids have to go to school to be able to solve creative tasks. Just like humans before.\n\nIt turns out that high sch... | [{"type": "stdin_stdout", "input": "1000000000 1000000000\n", "output": "=\n"}, {"type": "stdin_stdout", "input": "1000100000 1000000000\n", "output": "<\n"}, {"type": "stdin_stdout", "input": "1001100000 1000000000\n", "output": "<\n"}, {"type": "stdin_stdout", "input": "1000000000 1025346907\n", "output": ">\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn McD's Burger, n hungry burger fans are ordering burgers. The ith order is placed by the ith fan at ti time and it takes di time to procees. What is the order in which the fans will get their burgers?\n\nInput Format\n\... | [{"type": "stdin_stdout", "input": "5\n13 2\n1 1\n3 0\n16 -1\n-1 2\n\nLESM@P", "output": "5 2 3 1 4 \n"}, {"type": "stdin_stdout", "input": "5\n181 2\n0 2\n0 1\n0 -2\n-1 8\n\nQDLMAQ", "output": "4 3 2 5 1 \n"}, {"type": "stdin_stdout", "input": "5\n23 4\n-1 2\n1 2\n1 0\n-1 13\n\nQMDLAQ", "output": "2 4 3 5 1 \n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have just purchased a new mobile phone and you want to call all of your relatives to brag about your new phone. You have N relatives. You will talk to i^th relative for exactly Ti minutes. Each minute costs you 1 doll... | [{"type": "stdin_stdout", "input": "10\n53 7\n23 17\n96 2\n15 3\n22 1\n21 14\n79 26\n147 60\n145 123\n146 19", "output": "476\n"}, {"type": "stdin_stdout", "input": "10\n53 7\n29 17\n96 2\n15 3\n22 1\n21 14\n79 26\n147 60\n145 76\n146 19", "output": "529\n"}, {"type": "stdin_stdout", "input": "10\n53 7\n29 17\n96 2\n15... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given N real values A_1, A_2, \\ldots, A_N. Compute the number of pairs of indices (i, j) such that i < j and the product A_i \\cdot A_j is integer.\n\nConstraints\n\n* 2 \\leq N \\leq 200\\,000\n* 0 < A_i < 10^4\... | [{"type": "stdin_stdout", "input": "11\n0.9\n1\n1\n1.25\n2.7527267588296525\n5\n70\n0.000000001\n9999.999999999\n0.999999999\n1.7676771981771382", "output": "7\n"}, {"type": "stdin_stdout", "input": "11\n0.9\n1\n1\n1.25\n2.30000\n5\n70\n0.000000001\n9999.999999999\n0.999999999\n1.7676771981771382", "output": "8\n"}, {"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after A... | [{"type": "stdin_stdout", "input": "1000000000000010000 1", "output": "0\n"}, {"type": "stdin_stdout", "input": "1000000000000010000 2", "output": "0\n"}, {"type": "stdin_stdout", "input": "1000000010000010000 1", "output": "0\n"}, {"type": "stdin_stdout", "input": "1000000010000010000 2", "output": "0\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a string S consisting of uppercase English letters. Additionally, an integer N will be given.\n\nShift each character of S by N in alphabetical order (see below), and print the resulting string.\n\nWe assume that ... | [{"type": "stdin_stdout", "input": "13\nABCDEFGGIJKLMNOPQRSTUVWXYZ", "output": "NOPQRSTTVWXYZABCDEFGHIJKLM\n"}, {"type": "stdin_stdout", "input": "13\nABCDEFGGIJKLMNOOQRSTUVWXYZ", "output": "NOPQRSTTVWXYZABBDEFGHIJKLM\n"}, {"type": "stdin_stdout", "input": "13\nABCDEFGOIJKLMNGOQRSTUVWXYZ", "output": "NOPQRSTBVWXYZATBDE... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N monsters, numbered 1, 2, ..., N.\n\nInitially, the health of Monster i is A_i.\n\nBelow, a monster with at least 1 health is called alive.\n\nUntil there is only one alive monster, the following is repeated:\n... | [{"type": "stdin_stdout", "input": "3\n1000000000 1000000000 1000000000", "output": "1000000000"}, {"type": "stdin_stdout", "input": "3\n1000000100 1000000000 1000000000", "output": "100\n"}, {"type": "stdin_stdout", "input": "3\n1000000100 1000100000 1000000000", "output": "100\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi throws N dice, each having K sides with all integers from 1 to K. The dice are NOT pairwise distinguishable. For each i=2,3,...,2K, find the following value modulo 998244353:\n\n* The number of combinations of N... | [{"type": "stdin_stdout", "input": "126 0010", "output": "582339874\n582339874\n130864342\n130864342\n926813445\n926813445\n962697102\n962697102\n227521938\n227521938\n706791283\n706791283\n393039053\n393039053\n273540220\n273540220\n337333399\n337333399\n573465200\n573465200\n970990227\n970990227\n520726724\n520726724... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFind the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.\n\nConstraints\n\n* 1\\leq N \\leq 10^{16}\n* N is an integer.\n\nInput\n\nInput is given from Standard Input in the follo... | [{"type": "stdin_stdout", "input": "1265641936938969", "output": "135\n"}, {"type": "stdin_stdout", "input": "2005985506723837", "output": "136\n"}, {"type": "stdin_stdout", "input": "5193523582167964", "output": "139\n"}, {"type": "stdin_stdout", "input": "4944180382968715", "output": "138\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N lines in the xy-plane. The i-th line is represented by A_ix+B_iy=C_i. Any two lines among the N+2 lines, the above N lines plus the x-axis and y-axis, cross each other at exactly one point.\n\nFor each pair 1 ... | [{"type": "stdin_stdout", "input": "7\n1 7 8\n-2 4 9\n3 -8 -5\n9 2 -14\n6 7 5\n-8 -9 3\n3 8 10", "output": "-1.722222222222222 1.325000000000000"}, {"type": "stdin_stdout", "input": "7\n1 7 9\n-2 4 9\n3 -8 -5\n17 2 -14\n4 11 5\n-8 -9 3\n1 8 10", "output": "-1.027777778 1.210526316\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads an integer n and prints the number of prime numbers which are less than or equal to n. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. F... | [{"type": "stdin_stdout", "input": "10\n10\n126", "output": "4\n4\n30\n"}, {"type": "stdin_stdout", "input": "10\n117\n4", "output": "4\n30\n2\n"}, {"type": "stdin_stdout", "input": "10\n147\n9", "output": "4\n34\n4\n"}, {"type": "stdin_stdout", "input": "10\n54\n18", "output": "4\n16\n7\n"}, {"type": "stdin_stdout", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nI decided to create a program that displays a \"round and round pattern\". The \"round and round pattern\" is as follows.\n\n* If the length of one side is n, it is displayed as a character string with n rows and n column... | [{"type": "stdin_stdout", "input": "2\n9\n64", "output": "#########\n# #\n# ##### #\n# # # #\n# # # # #\n# # # # #\n# # ### #\n# # #\n# #######\n\n################################################################\n# #\n# ###########################... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nJOI Pizza sells pizza home delivery along the d-meter-long ring road that runs through the city center.\n\nJOI Pizza has n stores S1, ..., Sn on the loop line. The head office is S1. The distance from S1 to Si ... | [{"type": "stdin_stdout", "input": "8\n3\n2\n3\n2\n4\n6\n20\n4\n4\n33\n16\n15\n15\n12\n5\n8\n0", "output": "3\n15\n"}, {"type": "stdin_stdout", "input": "8\n3\n2\n3\n0\n4\n6\n20\n4\n4\n14\n14\n23\n7\n7\n11\n8\n0", "output": "3\n23\n"}, {"type": "stdin_stdout", "input": "8\n3\n2\n3\n0\n4\n6\n20\n4\n4\n17\n17\n23\n7\n7\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTurtle Shi-ta and turtle Be-ko decided to divide a chocolate. The shape of the chocolate is rectangle. The corners of the chocolate are put on (0,0), (w,0), (w,h) and (0,h). The chocolate has lines for cutting. They cut t... | [{"type": "stdin_stdout", "input": "2 3 7 10 50\n3 3\n6 6\n10 10\n4.0000000000 4.380940502722975\n7.0000000000 7.0000000000\n2 3 10 10 48\n2 3\n7 6\n10 10\n4.1530399119933294 4.124627510166318\n7.679827074828504 8.063298606739774\n2 3 10 10 30\n3 3\n6 6\n10 10\n4.0000000000 4.920930737803775\n7.0000000000 7.0000000000\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nABC Gene\n\nThere is a gene sequence represented by the string `ABC`. You can rewrite this gene sequence by performing the following operations several times.\n\n* Choose one of the letters `A`,` B`, `C`. Let this be x. R... | [{"type": "stdin_stdout", "input": "ABC", "output": "Yes"}, {"type": "stdin_stdout", "input": "BAC", "output": "No\n"}, {"type": "stdin_stdout", "input": "ACB", "output": "No\n"}, {"type": "stdin_stdout", "input": "CAB", "output": "No\n"}, {"type": "stdin_stdout", "input": "CBA", "output": "No\n"}, {"type": "stdin_stdo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nChokudai loves eating so much. However, his doctor Akensho told him that he was overweight, so he finally decided to lose his weight.\n\nChokudai made a slimming plan of a $D$-day cycle. It is represented by $D$ integers ... | [{"type": "stdin_stdout", "input": "184 2 114\n-9 1 -1", "output": "2281\n"}, {"type": "stdin_stdout", "input": "235 2 31\n-5 1 -1", "output": "1427\n"}, {"type": "stdin_stdout", "input": "235 2 31\n-5 1 -2", "output": "1179\n"}, {"type": "stdin_stdout", "input": "235 1 31\n-5 1 -2", "output": "1181\n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which prints $n$-th fibonacci number for a given integer $n$. The $n$-th fibonacci number is defined by the following recursive formula:\n\n\\begin{equation*} fib(n)= \\left \\\\{ \\begin{array}{ll} 1 & (n... | [{"type": "stdin_stdout", "input": "44", "output": "1134903170\n"}, {"type": "stdin_stdout", "input": "44", "output": "1134903170\n"}, {"type": "stdin_stdout", "input": "41", "output": "267914296\n"}, {"type": "stdin_stdout", "input": "42", "output": "433494437\n"}, {"type": "stdin_stdout", "input": "43", "output": "70... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which calculates the distance between two points P1(x1, y1) and P2(x2, y2).\n\n\n\nInput\n\nFour real numbers x1, y1, x2 and y2 are given in a line.\n\nOutput\n\nPrint the distance in real number. The outp... | [{"type": "stdin_stdout", "input": "-1 -4 3 -115", "output": "111.072048689\n"}, {"type": "stdin_stdout", "input": "-1 -4 3 -190", "output": "186.043005781\n"}, {"type": "stdin_stdout", "input": "-1 -4 1 -190", "output": "186.010752377\n"}, {"type": "stdin_stdout", "input": "-1 -5 1 -190", "output": "185.010810495\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is an interactive problem.\n\nImur Ishakov decided to organize a club for people who love to play the famous game «The hat». The club was visited by n students, where n is even. Imur arranged them all in a circle and... | [{"type": "stdin_stdout", "input": "100\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n benches in the Berland Central park. It is known that a_i people are currently sitting on the i-th bench. Another m people are coming to the park and each of them is going to have a seat on some bench out of n... | [{"type": "stdin_stdout", "input": "100\n3241\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLunar New Year is approaching, and Bob decides to take a wander in a nearby park.\n\nThe park can be represented as a connected graph with n nodes and m bidirectional edges. Initially Bob is at the node 1 and he records 1... | [{"type": "stdin_stdout", "input": "10 10\n1 4\n6 8\n2 5\n3 7\n9 4\n5 6\n3 4\n8 10\n10 2\n1 10\n", "output": "1 4 3 7 9 10 2 5 6 8\n"}, {"type": "stdin_stdout", "input": "10 10\n1 4\n6 8\n2 5\n3 10\n10 2\n5 6\n3 4\n9 7\n8 9\n1 10\n", "output": "1 4 3 10 2 5 6 8 9 7\n"}, {"type": "stdin_stdout", "input": "10 10\n1 4\n3 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are a coach at your local university. There are n students under your supervision, the programming skill of the i-th student is a_i.\n\nYou have to form k teams for yet another new programming competition. As you know... | [{"type": "stdin_stdout", "input": "100 4\n4741 3440 2421 1765 4810 1955 4346 1365 2697 3255 3337 386 1154 115 4951 2306 4058 279 4849 3962 1737 1147 362 4799 4796 3670 481 2913 435 1032 592 1187 4676 1295 2262 3757 2494 862 2134 1898 4159 530 3038 2610 4399 2707 1041 4337 3275 3569 4437 166 4730 3165 4022 3317 1763 22... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence a_1, a_2, ..., a_n consisting of n integers.\n\nYou can choose any non-negative integer D (i.e. D ≥ 0), and for each a_i you can:\n\n * add D (only once), i. e. perform a_i := a_i + D, or \n * s... | [{"type": "stdin_stdout", "input": "100\n49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 49 49 49 100 2 100 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nToday Adilbek is taking his probability theory test. Unfortunately, when Adilbek arrived at the university, there had already been a long queue of students wanting to take the same test. Adilbek has estimated that he will... | [{"type": "stdin_stdout", "input": "20 30\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n", "output": "310937903\n"}, {"type": "stdin_stdout", "input": "20 31\n2 2 1 2 1 1 2 1 2 2 1 2 1 2 1 1 1 2 1 2\n", "output": "153515832\n"}, {"type": "stdin_stdout", "input": "20 26\n1 2 1 1 1 2 1 1 2 2 2 1 2 1 2 1 1 2 2 1\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions are constraints on n and k.\n\nYou are messaging in one of the popular social networks via your smartphone. Your smartphone can show at most k most recent conversations w... | [{"type": "stdin_stdout", "input": "10 4\n2 3 3 1 1 2 1 4 3 3\n", "output": "4\n4 1 3 2\n"}, {"type": "stdin_stdout", "input": "10 4\n2 3 5 1 1 2 1 4 3 3\n", "output": "4\n4 1 5 3\n"}, {"type": "stdin_stdout", "input": "10 4\n2 3 5 2 1 2 1 4 2 3\n", "output": "4\n3 2 4 1\n"}, {"type": "stdin_stdout", "input": "10 4\n2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are four stones on an infinite line in integer coordinates a_1, a_2, a_3, a_4. The goal is to have the stones in coordinates b_1, b_2, b_3, b_4. The order of the stones does not matter, that is, a stone from any pos... | [{"type": "stdin_stdout", "input": "0 1 2 1000000010\n0 0 999999999 1000000000\n", "output": "236\n0 2\n1 4\n2 7\n4 12\n7 20\n12 33\n20 54\n33 88\n54 143\n88 232\n143 376\n232 609\n376 986\n609 1596\n986 2583\n1596 4180\n2583 6764\n4180 10945\n6764 17710\n10945 28656\n17710 46367\n28656 75024\n46367 121392\n75024 19641... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is a hard version of the problem. The actual problems are different, but the easy version is almost a subtask of the hard version. Note that the constraints and the output format are different.\n\nYou are given a str... | [{"type": "stdin_stdout", "input": "500\nhvmmnbwnblqfvwwrcbzkccvcdrhoxbvzwkopagpwntjwwqppduunnenopvyjumjotgcnkoorjcbzctddppezypklfhmxcmufnhcuwxhzbpumlevwdufpyasriaupqdjhpccvtxwqkjseqpsatgbkihgteuclmpaamloxpbtbxhekgpbjvndelmrenhtotvuaymrzpyhmlaujjttwrrlamijsxyegcwagncdscpbvprkwgpwdikdsbqrpkecilprocbyzsupmanekspjzoebjqvm... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given four positive integers n, m, a, b (1 ≤ b ≤ n ≤ 50; 1 ≤ a ≤ m ≤ 50). Find any such rectangular matrix of size n × m that satisfies all of the following conditions:\n\n * each row of the matrix contains exact... | [{"type": "stdin_stdout", "input": "5\n3 6 2 1\n4 2 2 1\n2 2 2 4\n8 4 1 2\n2 2 1 2\n", "output": "YES\n110000\n001100\n000011\nNO\nNO\nYES\n1000\n0100\n0010\n0001\n1000\n0100\n0010\n0001\nNO\n"}, {"type": "stdin_stdout", "input": "5\n3 6 2 1\n4 2 2 1\n2 3 2 4\n8 4 1 2\n2 2 1 2\n", "output": "YES\n110000\n001100\n000011... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a point A with coordinate x = n on OX-axis. We'd like to find an integer point B (also on OX-axis), such that the absolute difference between the distance from O to B and the distance from A to B is equal to k.\n\... | [{"type": "stdin_stdout", "input": "6\n0 0\n5 8\n0 1000000\n1 0\n2 0\n0000000 1000000\n", "output": "0\n3\n1000000\n1\n0\n1000000\n"}, {"type": "stdin_stdout", "input": "6\n6 0\n0 8\n0 1000000\n0 0\n1 0\n0000000 1000000\n", "output": "0\n8\n1000000\n0\n1\n1000000\n"}, {"type": "stdin_stdout", "input": "6\n0 0\n5 8\n1 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.\... | [{"type": "stdin_stdout", "input": "86451 754 85 84\n", "output": "4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp is an organizer of a Berland ICPC regional event. There are n universities in Berland numbered from 1 to n. Polycarp knows all competitive programmers in the region. There are n students: the i-th student is enro... | [{"type": "stdin_stdout", "input": "4\n7\n1 3 1 2 1 2 1\n12 8 3 2 5 1 5\n10\n2 2 2 4 2 2 2 6 3 3\n3435 3014 2197 4336 2893 1527 5359 2175 1961 2567\n6\n3 6 3 3 3 3\n0 11 6 5 9 7\n1\n1\n278\n", "output": "36 28 22 25 0 0 0\n29464 22953 18425 14701 16898 18425 0 0 0 0\n38 27 22 27 27 0\n278\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAquaMoon has n friends. They stand in a row from left to right, and the i-th friend from the left wears a T-shirt with a number a_i written on it. Each friend has a direction (left or right). In the beginning, the directi... | [{"type": "stdin_stdout", "input": "10\n10\n6 2 1 1 1 10 10 2 10 5\n8\n1 3 1 1 4 5 4 4\n9\n9 6 9 9 2 8 7 2 2\n10\n9 4 3 3 5 4 3 10 4 5\n9\n7 5 1 7 5 5 5 5 6\n8\n8 8 4 4 7 6 2 8\n10\n6 8 1 6 8 8 5 6 8 4\n10\n5 5 5 8 3 4 3 3 10 10\n8\n1 1 3 6 6 7 1 2\n8\n4 1 3 5 3 1 3 3\n", "output": "NO\nYES\nYES\nYES\nYES\nYES\nYES\nYE... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJohn Doe has a list of all Fibonacci numbers modulo 1013. This list is infinite, it starts with numbers 0 and 1. Each number in the list, apart from the first two, is a sum of previous two modulo 1013. That is, John's lis... | [{"type": "stdin_stdout", "input": "6138242440179\n", "output": "14000000000092\n"}, {"type": "stdin_stdout", "input": "9999999999999\n", "output": "14999999999998\n"}, {"type": "stdin_stdout", "input": "4917874132879\n", "output": "10929066223558\n"}, {"type": "stdin_stdout", "input": "9999999999979\n", "output": "149... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a square matrix consisting of n rows and n columns. We assume that the rows are numbered from 1 to n from top to bottom and the columns are numbered from 1 to n from left to right. Some cells (n - 1 cells in... | [{"type": "stdin_stdout", "input": "50\n4 24\n7 26\n39 28\n3 37\n29 38\n16 17\n48 49\n27 34\n28 22\n48 47\n34 11\n11 43\n46 34\n33 41\n31 29\n50 36\n43 46\n15 34\n47 22\n36 11\n20 18\n1 39\n18 12\n17 33\n43 30\n45 33\n26 10\n32 9\n20 28\n10 17\n39 4\n39 1\n31 39\n6 7\n18 42\n43 16\n31 46\n48 30\n6 20\n49 13\n28 20\n6 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n students living in the campus. Every morning all students wake up at the same time and go to wash. There are m rooms with wash basins. The i-th of these rooms contains ai wash basins. Every student independent... | [{"type": "stdin_stdout", "input": "50 50\n50 48 38 45 50 48 38 48 49 49 50 50 49 50 38 48 45 40 43 49 48 43 50 50 50 42 47 50 49 34 48 47 48 50 50 50 49 47 48 49 48 48 50 39 45 47 48 47 45 50\n", "output": "1.000000000000001\n"}, {"type": "stdin_stdout", "input": "50 50\n50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDuring the last Sereja's Codesecrof round the server crashed many times, so the round was decided to be made unrated for some participants. \n\nLet's assume that n people took part in the contest. Let's assume that the pa... | [{"type": "stdin_stdout", "input": "10 0\n5 9 1 12 4 2 2 4 12 1\n", "output": "2\n3\n4\n5\n6\n7\n8\n9\n"}, {"type": "stdin_stdout", "input": "10 0\n5 16 1 7 4 2 2 5 18 3\n", "output": "2\n3\n4\n5\n6\n7\n8\n9\n"}, {"type": "stdin_stdout", "input": "10 0\n5 16 1 7 4 2 2 4 18 3\n", "output": "2\n3\n4\n5\n6\n7\n8\n9\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGame \"Minesweeper 1D\" is played on a line of squares, the line's height is 1 square, the line's width is n squares. Some of the squares contain bombs. If a square doesn't contain a bomb, then it contains a number from 0... | [{"type": "stdin_stdout", "input": "?2*?2*??1*2**?2*1???*2???100?????*???*?*????0????2?*?*?1??1??*?01**2**1001??**??**??1*?*???00??**??*\n", "output": "147483634\n"}, {"type": "stdin_stdout", "input": "*??**??00???*?*1??**??**??1001**2**10?*??1??1?*?*?2????0????*?*???*?????001???2*???1*2?**2*1??*2?*2?\n", "output": "14... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day, Twilight Sparkle is interested in how to sort a sequence of integers a1, a2, ..., an in non-decreasing order. Being a young unicorn, the only operation she can perform is a unit shift. That is, she can move the l... | [{"type": "stdin_stdout", "input": "9\n4 5 6 7 1 2 3 4 10\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "9\n4 5 6 7 1 0 3 4 10\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "9\n4 5 6 7 1 0 3 4 2\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "9\n4 5 0 7 1 0 3 4 2\n", "output": "-1\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given string s. Your task is to determine if the given string s contains two non-overlapping substrings \"AB\" and \"BA\" (the substrings can go in any order).\n\nInput\n\nThe only line of input contains a string ... | [{"type": "stdin_stdout", "input": "AABBBACBBBBBBAACBCCACBBAABBBBBCAACABAACABCACCBCBCCCBCBCABCBBCCBCBBAACBACAABACBBCACCBCCACCABBCBABBAAC\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "CAABBABCBBACCACCBCCACBBCABAACABCAABBCBCCBBCBACBCBCCCBCBCCACBACAABACAACBBBBBAABBCACCBCAABBBBBBCABBBAA\n", "output": "YES\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence of numbers a1, a2, ..., an, and a number m.\n\nCheck if it is possible to choose a non-empty subsequence aij such that the sum of numbers in this subsequence is divisible by m.\n\nInput\n\nThe fir... | [{"type": "stdin_stdout", "input": "100 968\n966 966 967 966 967 967 967 967 966 1446 966 967 966 966 966 967 967 966 966 967 967 967 967 966 967 967 967 967 563 967 967 967 600 967 967 966 967 1750 967 966 967 966 967 966 966 966 967 966 967 966 966 967 967 193 966 966 967 966 1294 967 967 966 967 966 966 580 966 967 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Artem is fond of dancing. Most of all dances Artem likes rueda — Cuban dance that is danced by pairs of boys and girls forming a circle and dancing together.\n\nMore detailed, there are n pairs of boys and girls st... | [{"type": "stdin_stdout", "input": "364 57\n1 -101\n1 110\n1 -76\n1 329\n2\n2\n2\n1 -191\n1 97\n1 189\n1 305\n1 -313\n1 312\n1 -148\n2\n1 -104\n1 85\n1 -55\n1 -79\n1 230\n1 -94\n1 58\n1 -72\n2\n2\n2\n1 -104\n1 -351\n1 23\n2\n1 215\n2\n2\n2\n1 58\n1 -237\n2\n2\n2\n1 198\n2\n1 83\n2\n1 -205\n2\n2\n2\n2\n1 -110\n2\n2\n2\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Petya has recently started attending a programming club. Naturally he is facing the problem of choosing a programming language. After long considerations he realized that Java is the best choice. The main argument ... | [{"type": "stdin_stdout", "input": "14391752689956519300788497161416904648305096969559656916798920426154191397931561980203179360129309381\n", "output": "BigInteger\n"}, {"type": "stdin_stdout", "input": "11271203439111662452647816080492937379011458047735472400976277474953429583477559167812276320735634783\n", "output": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHeidi has finally found the mythical Tree of Life – a legendary combinatorial structure which is said to contain a prophecy crucially needed to defeat the undead armies.\n\nOn the surface, the Tree of Life is just a regul... | [{"type": "stdin_stdout", "input": "10\n5 1\n1 2\n9 1\n10 8\n6 3\n8 5\n2 7\n2 3\n10 4\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "10\n5 1\n1 2\n9 5\n10 5\n6 3\n8 10\n2 7\n2 3\n1 4\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "10\n5 1\n1 2\n9 5\n10 5\n6 3\n8 10\n2 7\n1 3\n1 4\n", "output": "12\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInnokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Inno... | [{"type": "stdin_stdout", "input": "10\nIJGDI KHB\nHBI CKKCG\nFHE GCAA\nEDCGH HHICE\nGFH AIHD\nHED KIK\nDCK BCFIJ\nFFIHE FDB\nJGB AKKI\nIJD CAG\n", "output": "YES\nIJG\nHBI\nFHE\nEDC\nGFH\nHED\nDCK\nFFI\nJGB\nIJD\n"}, {"type": "stdin_stdout", "input": "10\nIJGDI KHB\nHBI CKKCG\nFHE GCAA\nEDCGH HHICE\nGFH AIHD\nHED KKI\... | 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": "300997\n", "output": "150498\n"}, {"type": "stdin_stdout", "input": "273658\n", "output": "136828\n"}, {"type": "stdin_stdout", "input": "222057\n", "output": "111028\n"}, {"type": "stdin_stdout", "input": "456496\n", "output": "228247\n"}, {"type": "stdin_stdout", "input": "220343\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou might have heard about the next game in Lara Croft series coming out this year. You also might have watched its trailer. Though you definitely missed the main idea about its plot, so let me lift the veil of secrecy.\n... | [{"type": "stdin_stdout", "input": "636553724 546535019 115079316355948443\n", "output": "425992073 546535018\n"}, {"type": "stdin_stdout", "input": "595261150 794915864 332353903994901365\n", "output": "177161677 794915848\n"}, {"type": "stdin_stdout", "input": "548492800 434105920 179638683192075937\n", "output": "13... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the race for the best Internet browser, there's now a new contender for it, this browser is called the: \"The Semantic Mind-Reader!\" After its promo on the world wide web, everyone's been desperately waiting for the b... | [{"type": "stdin_stdout", "input": "100\nwww.oazqupphakywpbqyfajsmgwcfcxuaaarpxhsyiljjzehrmifcxaldbffnkbdtfvzdrjnlnixdaobbfrppdrbmyducp.com\nwww.wwbikcjsdqqnzrywdmibxbhfiqsmwuvhbsewgjswat.com\nwww.cm.com\nwww.knbwiewnxvdashnytchqsklwzlelczdkhamhlfbpduhefwori.com\nwww.aysuwnxdoradigzeivasglvmkopgnkoayeeiwlgvjqzzkkxaqjva... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \\dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a... | [{"type": "stdin_stdout", "input": "476640020082194381531155118436783393866726953614433851622190777875571135215042541028243752681838573", "output": "259\n"}, {"type": "stdin_stdout", "input": "402419059500366785869358882282163159674165660152915334404536663378232442791064106232595577577780162", "output": "252\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi will do a tap dance. The dance is described by a string S where each character is `L`, `R`, `U`, or `D`. These characters indicate the positions on which Takahashi should step. He will follow these instructions ... | [{"type": "stdin_stdout", "input": "RDULULDURURLRDULRLR", "output": "Yes"}, {"type": "stdin_stdout", "input": "RDULULDURURLLDULRRR", "output": "No\n"}, {"type": "stdin_stdout", "input": "RCULULDURURLLDULRRR", "output": "No\n"}, {"type": "stdin_stdout", "input": "RCVLULDURURLLDULRRR", "output": "No\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N cards placed face down in a row. On each card, an integer 1 or 2 is written.\n\nLet A_i be the integer written on the i-th card.\n\nYour objective is to guess A_1, A_2, ..., A_N correctly.\n\nYou know the foll... | [{"type": "stdin_stdout", "input": "6 5\n1 2 1\n2 3 2\n1 6 3\n4 5 4\n1 4 5", "output": "1\n"}, {"type": "stdin_stdout", "input": "6 5\n1 2 1\n2 3 2\n1 3 3\n4 5 4\n3 6 5", "output": "2\n"}, {"type": "stdin_stdout", "input": "6 5\n1 2 1\n2 3 2\n1 3 3\n4 5 4\n1 6 5", "output": "2\n"}, {"type": "stdin_stdout", "input": "6 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi Lake has a perimeter of L. On the circumference of the lake, there is a residence of the lake's owner, Takahashi. Each point on the circumference of the lake has a coordinate between 0 and L (including 0 but not... | [{"type": "stdin_stdout", "input": "314159265 7\n35438742\n77271666\n139044510\n156626166\n160332356\n331169608\n453863319", "output": "1023255587\n"}, {"type": "stdin_stdout", "input": "314159265 7\n35438742\n77271666\n122238627\n156626166\n160332356\n331169608\n453863319", "output": "1040061470\n"}, {"type": "stdin_s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi is doing a research on sets of points in a plane. Takahashi thinks a set S of points in a coordinate plane is a good set when S satisfies both of the following conditions:\n\n* The distance between any two point... | [{"type": "stdin_stdout", "input": "33 4 2", "output": "0 0\n0 1\n0 4\n0 5\n0 8\n0 9\n0 12\n0 13\n0 16\n0 17\n0 20\n0 21\n0 24\n0 25\n0 28\n0 29\n0 32\n0 33\n0 36\n0 37\n0 40\n0 41\n0 44\n0 45\n0 48\n0 49\n0 52\n0 53\n0 56\n0 57\n0 60\n0 61\n0 64\n0 65\n2 2\n2 3\n2 6\n2 7\n2 10\n2 11\n2 14\n2 15\n2 18\n2 19\n2 22\n2 23... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\n* Replace each integer X on the blackboard by X divided b... | [{"type": "stdin_stdout", "input": "6\n348324507 1154626501 32183854 379425024 590201381 471526144", "output": "0\n"}, {"type": "stdin_stdout", "input": "6\n586050932 1154626501 32183854 379425024 590201381 471526144", "output": "0\n"}, {"type": "stdin_stdout", "input": "6\n586050932 1154626501 31409214 379425024 59020... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N integers written on a blackboard. The i-th integer is A_i.\n\nTakahashi and Aoki will arrange these integers in a row, as follows:\n\n* First, Takahashi will arrange the integers as he wishes.\n* Then, Aoki wi... | [{"type": "stdin_stdout", "input": "5\n1 12 6 0 5", "output": "1 0 6 12 5 "}, {"type": "stdin_stdout", "input": "5\n1 12 2 0 5", "output": "1 0 5 2 12 "}, {"type": "stdin_stdout", "input": "5\n1 12 3 0 5", "output": "1 0 5 3 12 "}, {"type": "stdin_stdout", "input": "5\n1 17 3 0 5", "output": "1 0 17 5 3 "}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHit n nails one by one at the coordinates P1 (x1, y1), P2 (x2, y2), P3 (x3, y3), ..., Pn (xn, yn) on the flat plate, and put them on the rubber band ring. Surround it with a single rubber band so that all the nails fit in... | [{"type": "stdin_stdout", "input": "4\n1.0,0.0\n0.0,1.0\n2.0,1.0\n1.0,2.0\n9\n-509.94,892.63\n567.62,639.99\n-859.32,-64.84\n-445.99,383.96\n667.54,430.49\n551.12,828.21\n-940.2,-877.2\n-361.62,-970\n-125.42,-178.48\n0", "output": "0\n3\n"}, {"type": "stdin_stdout", "input": "4\n0.0,0.1\n0.0,1.0\n0.1,0.2\n1.0,2.0\n9\n-... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.