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\nHackerMan has brought a new drawing book for his child, which consists only of geometric shapes. Its consists of lessons where the child has to make drawings using the geometric shapes. The first lesson is based on how to... | [{"type": "stdin_stdout", "input": "91\n31\n631\n598\n172\n710\n453\n948\n108\n898\n299\n490\n24\n572\n769\n397\n449\n830\n398\n326\n973\n473\n453\n580\n341\n331\n510\n139\n595\n399\n952\n925\n474\n419\n481\n462\n847\n257\n865\n323\n881\n812\n352\n595\n503\n985\n583\n512\n354\n374\n777\n505\n247\n587\n994\n85\n441\n336... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRaja tranports boxes from one place to another.But the boxes are too heavy it is very diffcult for him to transport them.But he is Raja:-p he has a magical power he can choose any random number D and if sum of weight of t... | [{"type": "stdin_stdout", "input": "1\n5\n10 14 12 15 3\n25\n\nSAMPLE", "output": "10 14 12 15 3\n"}, {"type": "stdin_stdout", "input": "1\n5\n5 14 12 15 3\n25\n\nSAMPLE", "output": "5 14 12 15 3\n"}, {"type": "stdin_stdout", "input": "1\n5\n10 14 6 15 3\n25\n\nSAMPLE", "output": "10 14 6 15 3\n"}, {"type": "stdin_stdo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Jhool always wanted to have some psychic powers so that he could showoff his skills, and magic to people and impress them. (Specially, his girlfriend Big Jhool!) But, in spite all his efforts, hardwork, dedication,... | [{"type": "stdin_stdout", "input": "1111010100010100101011101100101101110011000010100010000001111100010011100101010001101111000001011000", "output": "Sorry, sorry!\n"}, {"type": "stdin_stdout", "input": "0101100011001110001110100111100011010101011000000000110110010010111100101111010111100011101100100101", "output": "So... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nShil, Aditya and Utkarsh go to a candy shop. There are N candies present in the shop, which are indexed from 1 to N. All three of them select one candy to eat.\n\nHowever, a candy tastes delicious if and only if, the inde... | [{"type": "stdin_stdout", "input": "891", "output": "234989370\n"}, {"type": "stdin_stdout", "input": "828", "output": "188536152\n"}, {"type": "stdin_stdout", "input": "563", "output": "59167922\n"}, {"type": "stdin_stdout", "input": "550", "output": "55156200\n"}, {"type": "stdin_stdout", "input": "318", "output": "1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nXsquare likes strings a lot but much more, he likes palindromic strings. Today, he has a string S consisting of lower case English letters. Xsquare wants to convert his string S to a palindromic string. For the above purp... | [{"type": "stdin_stdout", "input": "100\nctaqinomqgoggfkanhrhfriftpfbohogtcalpcqknmphlntahibtlloqcthforeflhorcjdolcdanpgkdofimtaonmrq\nahbcsqjthirinsntrrbcmosictmqtkctnsgktmmclnsfcihgsianpbeatmqcheddodqjmcocboggomtenadaalgntoqgdtrtapa\nahkalidekjcckifcalkimkljkjjgmidbagjhjgdcfbdalkgkkdelejhigacichfjiabeejcjfkcafbkclgbe... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven N integers A_1, ..., A_N, compute A_1 \\times ... \\times A_N.\n\nHowever, if the result exceeds 10^{18}, print `-1` instead.\n\nConstraints\n\n* 2 \\leq N \\leq 10^5\n* 0 \\leq A_i \\leq 10^{18}\n* All values in in... | [{"type": "stdin_stdout", "input": "31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 0 2 7 9 5 0", "output": "0\n"}, {"type": "stdin_stdout", "input": "31\n4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0", "output": "0"}, {"type": "stdin_stdout", "input": "2\n1000000000 1000000000", "output": "100000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N squares arranged in a row from left to right.\n\nThe height of the i-th square from the left is H_i.\n\nYou will land on a square of your choice, then repeat moving to the adjacent square on the right as long ... | [{"type": "stdin_stdout", "input": "7\n20 7 -1 1 3 -2 2", "output": "2\n"}, {"type": "stdin_stdout", "input": "7\n64 3 0 4 -1 -2 5", "output": "2\n"}, {"type": "stdin_stdout", "input": "7\n64 3 1 4 -1 -2 5", "output": "2\n"}, {"type": "stdin_stdout", "input": "7\n20 7 3 0 3 -1 2", "output": "3\n"}, {"type": "stdin_stdo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N strings arranged in a row. It is known that, for any two adjacent strings, the string to the left is lexicographically smaller than the string to the right. That is, S_1<S_2<...<S_N holds lexicographically, wh... | [{"type": "stdin_stdout", "input": "5\n11 1 2 2 2", "output": "3"}, {"type": "stdin_stdout", "input": "5\n14 1 2 2 2", "output": "3"}, {"type": "stdin_stdout", "input": "5\n28 1 2 2 2", "output": "3"}, {"type": "stdin_stdout", "input": "5\n3 1 2 1 13", "output": "3"}, {"type": "stdin_stdout", "input": "5\n11 1 2 2 1", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRingo Kingdom Congress is voting on a bill.\n\nN members are present, and the i-th member (1 ≤ i ≤ N) has w_i white ballots and b_i blue ballots. Each member i will put all the w_i white ballots into the box if he/she is ... | [{"type": "stdin_stdout", "input": "1 60\n11 10\n5 8\n3 4\n13 -1\n4 7", "output": "1\n"}, {"type": "stdin_stdout", "input": "1 60\n11 10\n5 8\n4 4\n13 -1\n4 7", "output": "1\n"}, {"type": "stdin_stdout", "input": "1 60\n11 10\n5 8\n4 4\n13 -1\n7 7", "output": "1\n"}, {"type": "stdin_stdout", "input": "1 60\n11 10\n5 8\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis contest is `CODE FESTIVAL`. However, Mr. Takahashi always writes it `CODEFESTIVAL`, omitting the single space between `CODE` and `FESTIVAL`.\n\nSo he has decided to make a program that puts the single space he omitte... | [{"type": "stdin_stdout", "input": "ETAUDARGTSOP", "output": "ETAU DARGTSOP\n"}, {"type": "stdin_stdout", "input": "AACDEFGHIJKL", "output": "AACD EFGHIJKL\n"}, {"type": "stdin_stdout", "input": "COCEFESTIVAL", "output": "COCE FESTIVAL\n"}, {"type": "stdin_stdout", "input": "POSTGRADUATF", "output": "POST GRADUATF\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe solution of $ x ^ 3 = q $ is to calculate the recurrence formula $ x_ {n + 1} = x_n-\\ frac {x_ {n} ^ 3 --q} {3x_ {n} ^ 2} $ It can be calculated approximately with.\n\nPut a positive number $ \\ frac {q} {2} $ in $ x... | [{"type": "stdin_stdout", "input": "15\n153\n-1", "output": "2.466212\n5.348481\n"}, {"type": "stdin_stdout", "input": "15\n123\n-1", "output": "2.466212\n4.973190\n"}, {"type": "stdin_stdout", "input": "15\n194\n-1", "output": "2.466212\n5.788963\n"}, {"type": "stdin_stdout", "input": "15\n103\n-1", "output": "2.46621... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMr. A is planning to travel alone on a highway bus (hereinafter referred to as \"bus\") during his high school holidays. First, Mr. A chose the town he wanted to visit the most and made it his destination. Next, you have ... | [{"type": "stdin_stdout", "input": "1 3 3 1 3\n1 3 2000\n1 2 1000\n2 3 1001\n2 3 3 1 3\n1 3 2300\n1 2 1000\n2 3 1200\n2 6 6 5 1\n1 2 1500\n1 3 4500\n2 6 2000\n5 4 1000\n6 4 2200\n3 5 3000\n0 0 0 0 0", "output": "1000\n1100\n3750\n"}, {"type": "stdin_stdout", "input": "1 3 3 1 3\n1 3 2000\n1 2 1000\n2 3 1001\n2 3 3 1 3\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nShe loves e-mail so much! She sends e-mails by her cellular phone to her friends when she has breakfast, she talks with other friends, and even when she works in the library! Her cellular phone has somewhat simple layout ... | [{"type": "stdin_stdout", "input": "666660666\n134424306396481246895756\n12784174432754272468162", "output": "No\n'dhagdmdwmgt'agmtwjpjm\n'aptg'phdapjgapagmt'ma\n"}, {"type": "stdin_stdout", "input": "666660666\n113124756735251440964347\n33891614279093528467517", "output": "No\n,d'agpjmpdjaj'hwmgdgp\netw'm'gapwwdjatgmp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn 2300, the Life Science Division of Federal Republic of Space starts a very ambitious project to complete the genome sequencing of all living creatures in the entire universe and develop the genomic database of all spac... | [{"type": "stdin_stdout", "input": "ABC 3\nABC 2\n2(4()B)3(XY)A10C 30\n1000(1000(1000(1000(1000(1000(OM)))))) 1090860\n0 0", "output": "0\nC\n0\nO\n"}, {"type": "stdin_stdout", "input": "CBA 3\nABC 0\n2(4(AB)3(XY))10C 10\n1000(1000(1000(1000(1000(1000(NM)))))) 1889091\n0 0", "output": "0\nA\nX\nM\n"}, {"type": "stdin_s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the middle of Tyrrhenian Sea, there is a small volcanic island called Chronus. The island is now uninhabited but it used to be a civilized island. Some historical records imply that the island was annihilated by an eru... | [{"type": "stdin_stdout", "input": "3\n8 8 28\n32 34 32\n57 2 108\n5\n49 3 49\n7 46 44\n27 21 21\n33 56 56\n21 46 4\n3\n45 52 28\n46 26 36\n40 55 62\n10\n33 8 39\n50 57 43\n61 21 12\n21 17 11\n16 22 106\n45 40 53\n45 30 53\n39 1 8\n24 48 30\n7 48 15\n0", "output": "03:16:36 03:21:07\n06:14:56 06:32:09\n02:18:54 02:21:0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProfessor Matsuzaki is a scientist studying the truth of the universe. Life, the universe, all the answers are said to be 42, but Professor Matsuzaki thinks that this alone is not enough to elucidate the truth of the univ... | [{"type": "stdin_stdout", "input": "0 55\n0 1\n0 2\n0 3\n10 1\n10 2\n10 3\n10 4\n10 5\n10 6\n11 1\n11 2\n11 3\n100001 100\n-1 -1", "output": "42\n4\n5\n6\n22\n24\n26\n28\n30\n30\n26\n30\n32\n200274\n"}, {"type": "stdin_stdout", "input": "0 55\n0 1\n0 2\n0 3\n10 1\n10 2\n10 3\n10 4\n10 5\n10 1\n11 1\n11 2\n11 3\n100001 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nClaire is a man-eater. She's a real man-eater. She's going around with dozens of guys. She's dating all the time. And one day she found some conflicts in her date schedule. D'oh!\n\nSo she needs to pick some dates and giv... | [{"type": "stdin_stdout", "input": "2\n2 100\n10 12\n14 16\n2 200\n12 13\n18 20\n4\n1 100\n6 22\n1 1000\n12 22\n1 10000\n6 22\n1 100000\n6 22\n16\n1 100000000\n6 7\n1 100000000\n7 8\n1 100000000\n8 15\n1 110000000\n9 10\n1 100000000\n10 11\n1 100000000\n11 12\n1 100000000\n12 13\n1 100000000\n13 17\n1 100000000\n14 15\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is an Amidakuji that consists of w vertical bars and has a height (the number of steps to which horizontal bars can be added) of h. w is an even number. Of the candidates for the place to add the horizontal bar of t... | [{"type": "stdin_stdout", "input": "10 8 10\n10 4\n4 4\n5 1\n6 2\n3 3\n1 3\n2 4\n8 2\n7 5\n7 1", "output": "1\n2\n3\n7\n8\n5\n4\n6\n"}, {"type": "stdin_stdout", "input": "10 6 10\n10 4\n4 4\n5 1\n4 2\n7 3\n1 3\n2 4\n8 2\n3 5\n7 1", "output": "1\n4\n3\n5\n6\n2\n"}, {"type": "stdin_stdout", "input": "10 6 10\n10 4\n4 4\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nG: Working\n\nKou decided to do the same number of jobs every day for the next $ N $.\n\n$ A_i $ jobs are added on the $ i $ day of the $ N $ day.\n\nMr. Kou has no work to do now, and he doesn't have to finish all the wo... | [{"type": "stdin_stdout", "input": "5\n6 -27 -3 -2 -29", "output": "-11\n"}, {"type": "stdin_stdout", "input": "5\n6 -27 -3 -1 -29", "output": "-10\n"}, {"type": "stdin_stdout", "input": "5\n4 -31 0 -1 -28", "output": "-13\n"}, {"type": "stdin_stdout", "input": "5\n-2 -12 7 -1 32", "output": "-7\n"}, {"type": "stdin_st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nIt seems that a magician with a smoky smell will show off his magic.\n\n\"Now, think of one favorite integer.\"\nYou decide to think of your counting years in your head.\n\nThe magician has thrown the query $ N... | [{"type": "stdin_stdout", "input": "10\n1 10\n2 10\n1 10\n1 10\n1 10\n1 10\n1 10\n1 10\n1 10\n1 10", "output": "-1000000000 1000000000\n"}, {"type": "stdin_stdout", "input": "10\n1 10\n1 10\n1 10\n1 10\n2 10\n1 10\n1 10\n1 10\n1 10\n1 10", "output": "-1000000 1000000000\n"}, {"type": "stdin_stdout", "input": "10\n1 10\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor a given sequence $A = \\\\{a_0, a_1, ..., a_{n-1}\\\\}$ which is sorted by ascending order, find a specific value $k$ given as a query.\n\nConstraints\n\n* $1 \\leq n \\leq 100,000$\n* $1 \\leq q \\leq 200,000$\n* $0 ... | [{"type": "stdin_stdout", "input": "4\n-1 0 1 4\n3\n-3\n4\n14", "output": "0\n1\n0\n"}, {"type": "stdin_stdout", "input": "4\n-1 0 1 4\n3\n-2\n4\n14", "output": "0\n1\n0\n"}, {"type": "stdin_stdout", "input": "4\n-1 0 1 4\n3\n-4\n4\n14", "output": "0\n1\n0\n"}, {"type": "stdin_stdout", "input": "4\n-1 0 1 4\n3\n-4\n0\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a tree (an undirected connected graph without cycles) and an integer s.\n\nVanya wants to put weights on all edges of the tree so that all weights are non-negative real numbers and their sum is s. At the sam... | [{"type": "stdin_stdout", "input": "6 1\n2 1\n4 3\n2 5\n5 4\n5 6\n", "output": "0.6666666666666666\n"}, {"type": "stdin_stdout", "input": "6 1\n2 1\n1 3\n2 5\n5 4\n5 6\n", "output": "0.6666666666666666\n"}, {"type": "stdin_stdout", "input": "6 1\n2 1\n2 3\n1 5\n5 4\n5 6\n", "output": "0.6666666666666666\n"}, {"type": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven a string s of length n and integer k (1 ≤ k ≤ n). The string s has a level x, if x is largest non-negative integer, such that it's possible to find in s:\n\n * x non-intersecting (non-overlapping) substrings of len... | [{"type": "stdin_stdout", "input": "92 5\nwwwwwwwwwwwwwwwwwgggggggggggggggbbbbyyyyyyyyyyyyyyjjjjjjjjjjjuuuuuuuuaaaaaaaaaaaafooooooooig\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "92 6\nwwwwwwwwwwwwwwwwwgggggggggggggggbbbbyyyyyyyyyyyyyyjjjjjjjjjjjuuuuuuuuaaaaaaaaaaaafooooooooig\n", "output": "2\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a set of items, each having some integer weight not greater than 8. You denote that a subset of items is good if total weight of items in the subset does not exceed W.\n\nYou want to calculate the maximum possibl... | [{"type": "stdin_stdout", "input": "263313949370306890\n4140164751166140 6614205360468614 8773811688442168 7305250350819495 9250632788512985 7714928459050216 8422821279105776 5352796431133309\n", "output": "263313949370306890"}, {"type": "stdin_stdout", "input": "94517213607565382\n9730010615245182 9582835010066942 147... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt is raining heavily. But this is the first day for Serval, who just became 3 years old, to go to the kindergarten. Unfortunately, he lives far from kindergarten, and his father is too busy to drive him there. The only c... | [{"type": "stdin_stdout", "input": "37 99816\n19935 98486\n13473 97526\n12932 94864\n12400 98868\n13485 96232\n10902 93340\n10315 93206\n14926 98755\n13524 99060\n10391 94409\n14740 94040\n16968 94901\n18543 49807\n16376 96008\n16802 95903\n19742 97400\n10380 97416\n13674 91688\n16347 99505\n17541 91909\n19573 93640\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAnia has a large integer S. Its decimal representation has length n and doesn't contain any leading zeroes. Ania is allowed to change at most k digits of S. She wants to do it in such a way that S still won't contain any ... | [{"type": "stdin_stdout", "input": "400 224\n34034718296316650556302576767095880542740697596682657060609028712014739414658241556774411582749368771597248873201583574900424227251655547840887764275893533353440635216728376201808545879398359535670372855472971530695051695650262058940466340529417646357776899296790403916961389... | 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\nYou can remove at most one element from this array. Thus, the final length of the array is n-1 or n.\n\nYour task is to calculate the maximum possible length of the st... | [{"type": "stdin_stdout", "input": "12\n123654 1 2 3 4 5 6 7 16 9 10 11\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "12\n123654 1 2 6 4 5 6 7 16 9 10 11\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "12\n123654 1 2 6 4 5 6 7 16 9 18 11\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "12\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a permutation p_1, p_2, ..., p_n. Recall that sequence of n integers is called a permutation if it contains all integers from 1 to n exactly once.\n\nFind three indices i, j and k such that: \n\n * 1 ≤ i < ... | [{"type": "stdin_stdout", "input": "3\n4\n2 1 4 3\n6\n4 12 1 2 5 3\n5\n5 7 1 2 4\n", "output": "YES\n2 3 4\nYES\n1 2 3\nYES\n1 2 3\n"}, {"type": "stdin_stdout", "input": "3\n4\n2 1 4 3\n6\n4 12 1 2 5 3\n5\n5 8 1 2 4\n", "output": "YES\n2 3 4\nYES\n1 2 3\nYES\n1 2 3\n"}, {"type": "stdin_stdout", "input": "3\n4\n2 1 4 3\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA binary string is a string where each character is either 0 or 1. Two binary strings a and b of equal length are similar, if they have the same character in some position (there exists an integer i such that a_i = b_i). ... | [{"type": "stdin_stdout", "input": "4\n1\n1\n3\n00000\n4\n1110000\n2\n101\n", "output": "1\n000\n1100\n11\n"}, {"type": "stdin_stdout", "input": "4\n1\n1\n3\n00000\n4\n1110000\n2\n101\n", "output": "1\n000\n1100\n11\n"}, {"type": "stdin_stdout", "input": "4\n1\n1\n3\n00100\n4\n1110000\n2\n101\n", "output": "1\n010\n110... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou want to build a fence that will consist of n equal sections. All sections have a width equal to 1 and height equal to k. You will place all sections in one line side by side.\n\nUnfortunately, the ground beneath the f... | [{"type": "stdin_stdout", "input": "6\n2 3\n0 0\n2 3\n0 3\n2 3\n3 0\n3 3\n4 0 4\n3 3\n4 0 5\n3 3\n5 0 4\n", "output": "YES\nNO\nNO\nYES\nNO\nNO\n"}, {"type": "stdin_stdout", "input": "6\n2 3\n0 0\n2 3\n0 3\n2 3\n3 0\n3 3\n4 0 4\n3 3\n4 0 5\n3 3\n5 0 8\n", "output": "YES\nNO\nNO\nYES\nNO\nNO\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a directed graph consisting of n vertices. Each directed edge (or arc) labeled with a single character. Initially, the graph is empty.\n\nYou should process m queries with it. Each query is one of three type... | [{"type": "stdin_stdout", "input": "3 11\n+ 1 2 a\n+ 2 3 b\n+ 3 2 a\n+ 2 1 b\n? 3\n? 2\n- 2 1\n- 3 2\n+ 2 1 c\n+ 3 2 d\n? 5\n", "output": "\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "3 11\n+ 1 2 a\n+ 1 3 c\n+ 3 2 a\n+ 2 1 a\n? 6\n? 5\n- 2 1\n- 3 2\n+ 2 1 c\n+ 3 2 d\n? 5\n", "output": "YES\nYES\nYES\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are wandering in the explorer space of the 2050 Conference.\n\nThe explorer space can be viewed as an undirected weighted grid graph with size n× m. The set of vertices is \\{(i, j)|1≤ i≤ n, 1≤ j≤ m\\}. Two vertices (... | [{"type": "stdin_stdout", "input": "3 3 10\n1 1\n1 1\n1 1\n1 1 1\n1 1 1\n", "output": "\n10 10 10\n10 10 10\n10 10 10\n"}, {"type": "stdin_stdout", "input": "3 3 10\n1 1\n2 1\n1 1\n1 1 1\n1 1 1\n", "output": "10 10 10\n10 10 10\n10 10 10\n"}, {"type": "stdin_stdout", "input": "3 3 10\n1 1\n2 2\n1 1\n1 2 1\n2 2 1\n", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarpus has recently got interested in sequences of pseudorandom numbers. He learned that many programming languages generate such sequences in a similar way: <image> (for i ≥ 1). Here a, b, m are constants, fixed for ... | [{"type": "stdin_stdout", "input": "239 695 50503 21427\n", "output": "\n25251\n"}, {"type": "stdin_stdout", "input": "536 673 81953 56773\n", "output": "\n81952\n"}, {"type": "stdin_stdout", "input": "271 761 99991 77298\n", "output": "\n49995\n"}, {"type": "stdin_stdout", "input": "887 265 64802 22027\n", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe ancient Berlanders believed that the longer the name, the more important its bearer is. Thus, Berland kings were famous for their long names. But long names are somewhat inconvenient, so the Berlanders started to abbr... | [{"type": "stdin_stdout", "input": "50\nagecd\ncghafi\nfiide\niecc\njbdcfjhgd\ndiee\nhfeg\nehc\ngfijgjh\ngacaifebg\ndicbbddc\nhjgciaei\njjcdh\ng\ngc\ncf\nhfdjhd\nc\nicidbec\nji\neeh\ncgeejggc\nacfd\njjg\najefdj\neghhebiic\nbih\ngbb\njjaa\nidc\ngafi\necg\ndbigbjiehj\ncedif\nahidfaaajg\nhfhhiccbgb\ndgegjgieif\nhgjebhfdc\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA new Berland businessman Vitaly is going to open a household appliances' store. All he's got to do now is to hire the staff.\n\nThe store will work seven days a week, but not around the clock. Every day at least k people... | [{"type": "stdin_stdout", "input": "1000 2 1363\n", "output": "2726\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn 2N - 1 boxes there are apples and oranges. Your task is to choose N boxes so, that they will contain not less than half of all the apples and not less than half of all the oranges.\n\nInput\n\nThe first input line cont... | [{"type": "stdin_stdout", "input": "2\n2\n10 15\n5 7\n20 18\n1\n0 0\n", "output": "YES\n1 3 \nYES\n1 \n"}, {"type": "stdin_stdout", "input": "2\n2\n10 15\n5 7\n20 18\n1\n0 0\n", "output": "YES\n1 3 \nYES\n1 \n"}, {"type": "stdin_stdout", "input": "2\n2\n10 15\n5 11\n20 22\n1\n0 0\n", "output": "YES\n1 3\nYES\n1\n"}, {"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle penguin Polo adores integer segments, that is, pairs of integers [l; r] (l ≤ r). \n\nHe has a set that consists of n integer segments: [l1; r1], [l2; r2], ..., [ln; rn]. We know that no two segments of this set int... | [{"type": "stdin_stdout", "input": "47 21\n3 5\n-422 -417\n60 60\n-348 -348\n-3 -3\n-364 -361\n-49 -41\n-436 -430\n-250 -244\n-33 -26\n-162 -158\n-90 -88\n-357 -352\n-339 -337\n-25 -19\n-69 -67\n-261 -260\n-292 -283\n12 18\n44 44\n-277 -275\n-301 -293\n-108 -98\n-180 -172\n-327 -318\n-314 -309\n-12 -7\n-134 -130\n33 35... | 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 -6\n5 2 1 9 5 2 4 4 9 2\n", "output": "2\n3\n4\n5\n6\n7\n8\n9\n"}, {"type": "stdin_stdout", "input": "10 -6\n5 2 1 8 5 2 4 4 9 2\n", "output": "2\n3\n4\n5\n6\n7\n8\n9\n"}, {"type": "stdin_stdout", "input": "10 0\n5 14 1 1 5 1 1 4 9 2\n", "output": "2\n3\n4\n5\n6\n7\n8\n9\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasily the bear has got a sequence of positive integers a1, a2, ..., an. Vasily the Bear wants to write out several numbers on a piece of paper so that the beauty of the numbers he wrote out was maximum. \n\nThe beauty of... | [{"type": "stdin_stdout", "input": "39\n37749932 37750076 37750391 37750488 37750607 37750812 37750978 37751835 37752173 37752254 75497669 75497829 75497852 75498044 75498061 75498155 75498198 75498341 75498382 75498465 150994988 150994989 150995009 150995019 150995024 150995030 150995031 150995069 150995072 805306369 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSimon has an array a1, a2, ..., an, consisting of n positive integers. Today Simon asked you to find a pair of integers l, r (1 ≤ l ≤ r ≤ n), such that the following conditions hold:\n\n 1. there is integer j (l ≤ j ≤ r)... | [{"type": "stdin_stdout", "input": "5\n2 3 5 7 11\n", "output": "5 0\n1 2 3 4 5 "}, {"type": "stdin_stdout", "input": "5\n2 3 5 9 17\n", "output": "5 0\n1 2 3 4 5\n"}, {"type": "stdin_stdout", "input": "5\n3 2 3 4 6\n", "output": "5 0\n1 2 3 4 5\n"}, {"type": "stdin_stdout", "input": "2\n999999 1000000\n", "output": "2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEverybody knows what an arithmetic progression is. Let us remind you just in case that an arithmetic progression is such sequence of numbers a1, a2, ..., an of length n, that the following condition fulfills: \n\na2 - a1 ... | [{"type": "stdin_stdout", "input": "40\n100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIahub is very proud of his recent discovery, propagating trees. Right now, he invented a new tree, called xor-tree. After this new revolutionary discovery, he invented a game for kids which uses xor-trees.\n\nThe game is ... | [{"type": "stdin_stdout", "input": "30\n2 1\n3 2\n4 3\n5 3\n6 5\n7 3\n8 3\n9 2\n10 3\n11 2\n12 11\n13 6\n14 4\n15 5\n16 11\n17 9\n18 14\n19 6\n20 2\n21 19\n22 9\n23 19\n24 20\n25 14\n26 22\n27 1\n28 6\n29 13\n30 27\n1 0 1 1 1 1 0 1 0 0 1 0 0 0 1 0 0 0 0 1 0 0 1 1 0 1 1 1 1 0\n0 1 0 1 1 1 0 0 1 1 0 1 1 1 0 1 1 1 1 0 1 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a permutation of numbers from 1 to n. Determine whether there's a pair of integers a, b (1 ≤ a, b ≤ n; a ≠ b) such that the element <image> (note, that it is usual division, not integer one) is between a and... | [{"type": "stdin_stdout", "input": "100\n1 65 33 97 17 81 49 11 73 41 25 89 57 5 69 39 21 85 53 13 77 45 29 93 61 3 67 60 99 19 83 51 11 75 43 27 91 59 7 71 39 23 87 55 15 79 47 31 2 95 63 66 34 98 18 82 50 10 74 42 26 90 58 6 70 38 22 86 54 14 78 46 30 94 62 4 68 36 100 20 84 52 12 76 44 28 92 60 8 72 40 24 88 56 16 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven a sequence of integers a1, ..., an and q queries x1, ..., xq on it. For each query xi you have to count the number of pairs (l, r) such that 1 ≤ l ≤ r ≤ n and gcd(al, al + 1, ..., ar) = xi.\n\n<image> is a greatest ... | [{"type": "stdin_stdout", "input": "10\n2 2 4 3 2 4 4 2 4 2\n104\n3\n3\n1\n4\n1\n1\n4\n1\n1\n3\n1\n1\n4\n1\n1\n1\n4\n3\n1\n1\n4\n1\n1\n1\n1\n1\n4\n1\n1\n1\n4\n1\n1\n4\n1\n1\n1\n1\n1\n4\n4\n1\n3\n1\n4\n1\n1\n1\n4\n1\n2\n4\n1\n4\n1\n4\n1\n4\n3\n1\n2\n2\n4\n2\n1\n1\n2\n4\n4\n1\n2\n3\n1\n1\n4\n4\n4\n4\n4\n2\n2\n4\n1\n1\n1\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp is writing the prototype of a graphic editor. He has already made up his mind that the basic image transformations in his editor will be: rotate the image 90 degrees clockwise, flip the image horizontally (symmet... | [{"type": "stdin_stdout", "input": "9 20\n**.......\n****.....\n******...\n*******..\n..******.\n....****.\n......***\n*.....***\n*********\n*********\n*********\n*********\n....**...\n...****..\n..******.\n.********\n****..***\n***...***\n**.....**\n*.......*\n", "output": "********......**********........********\n**... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDo you like summer? Residents of Berland do. They especially love eating ice cream in the hot summer. So this summer day a large queue of n Berland residents lined up in front of the ice cream stall. We know that each of ... | [{"type": "stdin_stdout", "input": "10\n520230360 520230361 520230362 520230363 520230364 520230365 520230366 520230367 520230368 520230369\n", "output": "520230360 520230361 520230362 520230363 520230364 520230365 520230366 520230367 520230368 520230369 "}, {"type": "stdin_stdout", "input": "10\n876584065 876584063 87... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIgor is in the museum and he wants to see as many pictures as possible.\n\nMuseum can be represented as a rectangular field of n × m cells. Each cell is either empty or impassable. Empty cells are marked with '.', impassa... | [{"type": "stdin_stdout", "input": "10 10 50\n**********\n*......***\n***..**..*\n***....***\n**..***..*\n**..**.*.*\n*****..***\n*.***..***\n*..****.**\n**********\n5 9\n5 9\n7 7\n6 4\n6 7\n8 7\n6 7\n9 2\n3 9\n9 2\n4 7\n4 6\n2 5\n9 2\n7 7\n5 8\n8 7\n8 6\n7 7\n5 3\n8 7\n3 8\n5 8\n5 9\n9 8\n9 3\n8 7\n5 9\n9 2\n9 8\n9 3\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter the contest in comparing numbers, Shapur's teacher found out that he is a real genius and that no one could possibly do the calculations faster than him even using a super computer!\n\nSome days before the contest, ... | [{"type": "stdin_stdout", "input": "Iran_\nPersian;\nW_o;n;d;e;r;f;u;l;\n7\nWonderfulPersianIran\nwonderful_PersIAN_IRAN;;_\nWONDERFUL___IRAN__PERSIAN__;;\nIra__Persiann__Wonderful\nWonder;;fulPersian___;I;r;a;n;\n__________IranPersianWonderful__________\nPersianIran_is_Wonderful\n", "output": "ACC\nACC\nACC\nWA\nACC\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFurther research on zombie thought processes yielded interesting results. As we know from the previous problem, the nervous system of a zombie consists of n brains and m brain connectors joining some pairs of brains toget... | [{"type": "stdin_stdout", "input": "10 9\n5 1\n1 2\n9 3\n10 5\n6 3\n8 9\n2 7\n2 3\n10 4\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "10 9\n5 1\n1 2\n9 3\n10 5\n6 4\n8 9\n2 7\n2 3\n10 4\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "10 9\n5 1\n1 2\n9 3\n10 5\n6 3\n8 5\n2 7\n2 3\n10 4\n", "output": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nToday an outstanding event is going to happen in the forest — hedgehog Filya will come to his old fried Sonya!\n\nSonya is an owl and she sleeps during the day and stay awake from minute l1 to minute r1 inclusive. Also, d... | [{"type": "stdin_stdout", "input": "519325240668210886 776112702001665034 360568516809443669 1272711703453279586 994594983925273138\n", "output": "256787461333454149\n"}, {"type": "stdin_stdout", "input": "519325240668210886 776112702001665034 360568516809443669 875594219634943179 994594983925273138\n", "output": "2567... | 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\nYou are given matrix with n rows and n columns filled with zeroes. You should put k ones in it in such a way that the resulting matrix is symmetrical with respect to the main diagonal (the diagonal that goes from the top ... | [{"type": "stdin_stdout", "input": "100 10000\n", "output": "1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 \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... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has n burles. One bottle of Ber-Cola costs a burles and one Bars bar costs b burles. He can buy any non-negative integer number of bottles of Ber-Cola and any non-negative integer number of Bars bars.\n\nFind out if... | [{"type": "stdin_stdout", "input": "10000000\n10000000\n10000000\n", "output": "YES\n0 1\n"}, {"type": "stdin_stdout", "input": "10000000\n10000100\n10000000\n", "output": "YES\n0 1\n"}, {"type": "stdin_stdout", "input": "10000000\n9999999\n1\n", "output": "YES\n0 10000000\n"}, {"type": "stdin_stdout", "input": "100000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSuppose that you are in a campus and have to go for classes day by day. As you may see, when you hurry to a classroom, you surprisingly find that many seats there are already occupied. Today you and your friends went for ... | [{"type": "stdin_stdout", "input": "5 5 3\n.....\n.....\n*...*\n*....\n.*...\n", "output": "18\n"}, {"type": "stdin_stdout", "input": "5 5 3\n.....\n.....\n*...*\n*....\n...*.\n", "output": "18\n"}, {"type": "stdin_stdout", "input": "5 5 3\n.....\n.....\n*...*\n....*\n...*.\n", "output": "18\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have two variables a and b. Consider the following sequence of actions performed with these variables:\n\n 1. If a = 0 or b = 0, end the process. Otherwise, go to step 2;\n 2. If a ≥ 2·b, then set the value of a to ... | [{"type": "stdin_stdout", "input": "1100000000000000000 1000000000000000000\n", "output": "1100000000000000000 1000000000000000000\n"}, {"type": "stdin_stdout", "input": "1100000000000000000 1000000000000010000\n", "output": "1100000000000000000 1000000000000010000\n"}, {"type": "stdin_stdout", "input": "10000000000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAkari has n kinds of flowers, one of each kind.\n\nShe is going to choose one or more of these flowers to make a bouquet.\n\nHowever, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b... | [{"type": "stdin_stdout", "input": "1001010000 32745 173205", "output": "733789298\n"}, {"type": "stdin_stdout", "input": "1000000000 60937 173205", "output": "832968201\n"}, {"type": "stdin_stdout", "input": "1000010001 32745 173205", "output": "184550369\n"}, {"type": "stdin_stdout", "input": "1000010101 32745 173205... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a square grid with H rows and W columns. Snuke wants to write 0 or 1 in each of the squares. Here, all of the following conditions have to be satisfied:\n\n* For every row, the smaller of the following is A: the n... | [{"type": "stdin_stdout", "input": "17 183 -1 0", "output": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n00000000000000000000000000000000000000000000000000000000000000000000000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have N cards. On the i-th card, an integer A_i is written.\n\nFor each j = 1, 2, ..., M in this order, you will perform the following operation once:\n\nOperation: Choose at most B_j cards (possibly zero). Replace the... | [{"type": "stdin_stdout", "input": "11 3\n1 1 1 1 1 1 1 1 1 1 1\n3 1000000000\n4 1000000000\n3 1000000001", "output": "10000000004\n"}, {"type": "stdin_stdout", "input": "11 3\n1 1 1 1 1 1 1 1 1 1 1\n3 1000000000\n4 1000000000\n3 1100000000", "output": "10300000001\n"}, {"type": "stdin_stdout", "input": "11 3\n1 1 1 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDecades have passed since the beginning of AtCoder Beginner Contest.\n\nThe contests are labeled as `ABC001`, `ABC002`, ... from the first round, but after the 999-th round `ABC999`, a problem occurred: how the future rou... | [{"type": "stdin_stdout", "input": "1001", "output": "ABD\n"}, {"type": "stdin_stdout", "input": "1506", "output": "ABD\n"}, {"type": "stdin_stdout", "input": "1101", "output": "ABD\n"}, {"type": "stdin_stdout", "input": "1111", "output": "ABD\n"}, {"type": "stdin_stdout", "input": "0111", "output": "ABC\n"}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string S consisting of lowercase English letters. Determine whether we can turn S into a palindrome by repeating the operation of swapping two adjacent characters. If it is possible, find the minimum requi... | [{"type": "stdin_stdout", "input": "aatltmaa", "output": "-1\n"}, {"type": "stdin_stdout", "input": "aamtltaa", "output": "-1\n"}, {"type": "stdin_stdout", "input": "aamaltta", "output": "-1\n"}, {"type": "stdin_stdout", "input": "attlamaa", "output": "-1\n"}, {"type": "stdin_stdout", "input": "alttamaa", "output": "-1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a sequence of length N consisting of non-negative integers. Consider performing the following operation on this sequence until the largest element in this sequence becomes N-1 or smaller.\n\n* Determine the larges... | [{"type": "stdin_stdout", "input": "2307894359683", "output": "50 46157887209 46157887209 46157887209 46157887209 46157887209 46157887209 46157887209 46157887209 46157887209 46157887209 46157887209 46157887209 46157887209 46157887209 46157887209 46157887209 46157887209 46157887259 46157887259 46157887259 46157887259 46... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe time is 2020. There is data that saves the qualifying results of PC Koshien 2020. This data stores the reference number and the number of correct answers assigned to each team. Here, the ranking is determined by the n... | [{"type": "stdin_stdout", "input": "1,20\n2,20\n3,30\n4,10\n5,10\n6,20\n0,0\n1\n2\n4\n1", "output": "2\n2\n3\n2\n"}, {"type": "stdin_stdout", "input": "1,20\n2,20\n3,30\n4,10\n5,10\n0,26\n0,0\n1\n2\n4\n1", "output": "3\n3\n4\n3\n"}, {"type": "stdin_stdout", "input": "1,20\n2,20\n3,30\n4,10\n5,10\n0,26\n0,0\n0\n2\n4\n1"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are various parking lots such as three-dimensional type and tower type in the city to improve the utilization efficiency of the parking lot. In some parking lots, a \"two-stage parking device\" as shown in the figur... | [{"type": "stdin_stdout", "input": "5 5\n136\n68\n82\n84\n114\n2 4\n14\n30\n118\n54\n0 0", "output": "2 3 4 1 5\n1 2 4 3\n"}, {"type": "stdin_stdout", "input": "2 5\n123\n52\n195\n87\n105\n2 4\n18\n30\n80\n24\n0 0", "output": "4 2 3 1 5\n1 2 4 3\n"}, {"type": "stdin_stdout", "input": "1 5\n123\n52\n105\n87\n105\n2 4\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNobuo-kun and Shizuo-kun are playing a game of competing for territories on a rectangular island. As shown in Fig. 1 below, the entire island is made up of square compartments divided in a grid pattern, and the profits an... | [{"type": "stdin_stdout", "input": "1 9\n-2 -1 4 -1 -1\n0 1 2 26 -15\n-1 1 -13 6 0\n0 -1 8 -1 -2", "output": "28\n"}, {"type": "stdin_stdout", "input": "1 9\n-3 -1 4 -1 -1\n0 1 2 26 -15\n-1 1 -13 6 0\n0 -1 8 -1 -2", "output": "27\n"}, {"type": "stdin_stdout", "input": "1 9\n-2 -1 4 -1 0\n2 1 2 26 -15\n-1 0 -13 6 0\n0 -... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nN students from JOI High School are lined up in a row from east to west. The i-th student from the western end of the column is student i. Each student has a bib with one integer. Initially, the integer Ai is w... | [{"type": "stdin_stdout", "input": "6 3\n3\n3\n11\n-1\n1\n10", "output": "3\n-1\n3\n10\n1\n11\n"}, {"type": "stdin_stdout", "input": "6 4\n3\n3\n11\n-1\n1\n5", "output": "-1\n3\n1\n3\n5\n11\n"}, {"type": "stdin_stdout", "input": "6 4\n3\n3\n11\n-2\n1\n5", "output": "-2\n3\n1\n3\n5\n11\n"}, {"type": "stdin_stdout", "inp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOrigami, or the art of folding paper\n\nMaster Grus is a famous origami (paper folding) artist, who is enthusiastic about exploring the possibility of origami art. For future creation, he is now planning fundamental exper... | [{"type": "stdin_stdout", "input": "2 1 1 1\n1 1\n0 0\n1 3 2 1\n2 1\n2 1\n0 0\n15 10 3 2\n2 2\n1 1\n1 1\n0 0\n3 4\n4 3 3 2\n1 2\n1 2\n1 1\n0 1\n0 0\n0 0 0 0", "output": "2\n3\n6\n1\n4\n4\n"}, {"type": "stdin_stdout", "input": "2 1 1 1\n2 1\n0 0\n1 3 2 1\n2 0\n2 1\n0 1\n10 13 3 2\n2 2\n1 3\n1 1\n0 1\n3 4\n3 5 3 2\n1 2\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are playing a solitaire puzzle called \"Connect\", which uses several letter tiles.\n\nThere are R × C empty cells. For each i (1 ≤ i ≤ R), you must put a string si (1 ≤ |si| ≤ C) in the i-th row of the table, without... | [{"type": "stdin_stdout", "input": "10 16\nLAAOITNNRETNI\nAOLLCGIFTE\nPROGRAMMJNH\nOSETNTC", "output": "22\n"}, {"type": "stdin_stdout", "input": "10 16\nLANOITANRETNI\nCOLLAGIFTE\nPROGRAMMJNG\nTSETNOC", "output": "18\n"}, {"type": "stdin_stdout", "input": "10 16\nLANOITANRETNI\nCOLLAGIFTE\nPROGRAMMJNG\nOSETNTC", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day, Ikta, an elementary school student, received a piece of paper with mathematical formulas from his grandfather. Apparently, the grandfather will give you as much money as the answer to the formula. Ikta has only l... | [{"type": "stdin_stdout", "input": "(198876743*1-210*4-89)", "output": "3533045339395\n"}, {"type": "stdin_stdout", "input": "(198876744*1-210*4-89)", "output": "3533045357160\n"}, {"type": "stdin_stdout", "input": "(198776744*1-210*4-89)", "output": "3531268857160\n"}, {"type": "stdin_stdout", "input": "(198777744*1-2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nF: Miko Mi String-\n\nstory\n\nMikko Mikkomi ~! Everyone's idol, Miko Miko Tazawa! Today ~, with Mikoto ~, practice the string algorithm, let's do it ☆\n\nMiko's special ~~ character making ~~ The slogan \"MikoMikomi\" be... | [{"type": "stdin_stdout", "input": "iNobiNociN", "output": "mitomerarenaiWA\n"}, {"type": "stdin_stdout", "input": "iNoaiNociN", "output": "mitomerarenaiWA\n"}, {"type": "stdin_stdout", "input": "iNoaiNochN", "output": "mitomerarenaiWA\n"}, {"type": "stdin_stdout", "input": "NhcoNiaoNi", "output": "mitomerarenaiWA\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which performs the following operations to a binary search tree $T$ by adding delete operation to B: Binary Search Tree II.\n\n* insert $k$: Insert a node containing $k$ as key into $T$.\n* find $k$: Repo... | [{"type": "stdin_stdout", "input": "18\ninsert 13\ninsert 2\ninsert 3\ninsert 7\ninsert 22\ninsert 1\nfind 1\nfind 2\nfind 3\nfind 13\nfind 5\nfind 6\nfind 4\nfind 7\nprint\ndelete 3\ndelete 7\nprint", "output": "yes\nyes\nyes\nyes\nno\nno\nno\nyes\n 1 2 3 7 13 22\n 13 2 1 3 7 22\n 1 2 13 22\n 13 2 1 22\n"}, {"type": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor a dynamic array $A = \\\\{a_0, a_1, ...\\\\}$ of integers, perform a sequence of the following operations:\n\n* push($d$, $x$): Add element $x$ at the begining of $A$, if $d = 0$. Add element $x$ at the end of $A$, if... | [{"type": "stdin_stdout", "input": "11\n0 1 0\n0 0 2\n0 1 3\n1 1\n1 1\n1 0\n2 -1\n1 1\n0 1 4\n1 0\n1 0", "output": "0\n0\n2\n0\n2\n2\n"}, {"type": "stdin_stdout", "input": "11\n0 1 1\n0 0 2\n0 1 3\n1 1\n1 1\n1 0\n2 0\n1 1\n0 0 4\n1 0\n1 0", "output": "1\n1\n2\n3\n4\n4\n"}, {"type": "stdin_stdout", "input": "11\n0 0 1\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nToday, Chef woke up to find that he had no clean socks. Doing laundry is such a turn-off for Chef, that in such a situation, he always buys new socks instead of cleaning the old dirty ones. He arrived at the fashion store... | [{"type": "stdin_stdout", "input": "-1 4 14", "output": "Unlucky Chef\n"}, {"type": "stdin_stdout", "input": "1 2 11", "output": "Unlucky Chef\n"}, {"type": "stdin_stdout", "input": "2 1 11", "output": "Unlucky Chef\n"}, {"type": "stdin_stdout", "input": "-1 4 6", "output": "Unlucky Chef\n"}, {"type": "stdin_stdout", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe palindrome is a string that can be read the same way from left to right and from right to left. For example, strings \"aaaaa\", \"1221\", \"bbaabb\" are palindromes, however the string \"chef\" is not a palindrome bec... | [{"type": "stdin_stdout", "input": "2\n12\n12", "output": "12\n12\n"}, {"type": "stdin_stdout", "input": "2\n14\n11", "output": "14\n10\n"}, {"type": "stdin_stdout", "input": "2\n14\n22", "output": "14\n22\n"}, {"type": "stdin_stdout", "input": "2\n119\n1", "output": "118\n0\n"}, {"type": "stdin_stdout", "input": "2\n6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a text consisting of n space-separated words. There is exactly one space character between any pair of adjacent words. There are no spaces before the first word and no spaces after the last word. The length ... | [{"type": "stdin_stdout", "input": "250\nf r s d b f f k d e k v m b t k k j t t a o m m s n d w l v g e k x d w k v a j h c a g x s d e t z z w q z d h n r i k b z k u s q l k c v o d o w w c y i a q v r i g i m l b x z h t a i j t h q u e v j o h w m o v k g r r x j a c m z z i s i r a p p i i l e i g m f f f y v k m... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe campus has m rooms numbered from 0 to m - 1. Also the x-mouse lives in the campus. The x-mouse is not just a mouse: each second x-mouse moves from room i to the room i ⋅ x mod{m} (in fact, it teleports from one room t... | [{"type": "stdin_stdout", "input": "100000000000000 99999999999999\n", "output": "50000000000001\n"}, {"type": "stdin_stdout", "input": "97821761637600 97821761637493\n", "output": "11943039006\n"}, {"type": "stdin_stdout", "input": "97821761637600 97821761637497\n", "output": "8923056792\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter finding and moving to the new planet that supports human life, discussions started on which currency should be used. After long negotiations, Bitcoin was ultimately chosen as the universal currency.\n\nThese were th... | [{"type": "stdin_stdout", "input": "10\n1 10 100 1000 10000 100000 1000000 10000000 100000000 1000000001\n1000000000 999999999\n", "output": "999999999\n"}, {"type": "stdin_stdout", "input": "10\n1 10 100 1000 10000 100000 1000000 11000000 100000000 1000000001\n1000000000 999999999\n", "output": "999999999\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp has a lot of work to do. Recently he has learned a new time management rule: \"if a task takes five minutes or less, do it immediately\". Polycarp likes the new rule, however he is not sure that five minutes is t... | [{"type": "stdin_stdout", "input": "11\n4 2 35\n13 5 6 13\n5 2 35\n13 5 6 13 3\n4 2 35\n14 5 6 13\n5 3 35\n13 5 6 13 3\n6 3 55\n13 5 6 13 3 3\n6 3 55\n13 5 6 3 13 3\n6 3 55\n13 5 6 3 3 13\n6 3 61\n13 5 6 13 3 3\n6 3 65\n13 5 6 13 3 3\n6 3 70\n13 5 6 13 3 3\n6 3 55\n15 5 6 13 3 3\n", "output": "2 6\n3 6\n3 13\n3 6\n4 6\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers n and k.\n\nYour task is to construct such a string s of length n that for each i from 1 to k there is at least one i-th letter of the Latin alphabet in this string (the first letter is 'a', the... | [{"type": "stdin_stdout", "input": "66\n1 1\n1 1\n2 1\n1 1\n1 1\n1 1\n1 1\n2 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n2 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n2 1\n1 1\n1 1\n1 1\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a regular polygon with n vertices labeled from 1 to n in counter-clockwise order. The triangulation of a given polygon is a set of triangles such that each vertex of each triangle is a vertex of the initial ... | [{"type": "stdin_stdout", "input": "455\n", "output": "31398638\n"}, {"type": "stdin_stdout", "input": "452\n", "output": "30781650\n"}, {"type": "stdin_stdout", "input": "494\n", "output": "40184428\n"}, {"type": "stdin_stdout", "input": "485\n", "output": "38027878\n"}, {"type": "stdin_stdout", "input": "473\n", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's call an array of non-negative integers a_1, a_2, …, a_n a k-extension for some non-negative integer k if for all possible pairs of indices 1 ≤ i, j ≤ n the inequality k ⋅ |i - j| ≤ min(a_i, a_j) is satisfied. The ex... | [{"type": "stdin_stdout", "input": "3\n1000000000 1000000000 1000000000\n", "output": "500000000\n"}, {"type": "stdin_stdout", "input": "3\n1000000000 1000000000 1000100000\n", "output": "500000000\n"}, {"type": "stdin_stdout", "input": "3\n1000000000 1000000000 1000100010\n", "output": "500000000\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDima worked all day and wrote down on a long paper strip his favorite number n consisting of l digits. Unfortunately, the strip turned out to be so long that it didn't fit in the Dima's bookshelf.\n\nTo solve the issue, D... | [{"type": "stdin_stdout", "input": "100\n8820100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000026601\n", "output": "88201000000000000000000000000000000000000000000000000000000000000000000000000000000000000026601\n"}, {"type": "stdin_stdout", "input": "99\n92858678988128683760262... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between the easy and the hard versions is the maximum value of k.\n\nYou are given an infinite sequence of form \"112123123412345...\" which consist of blocks of all consecutive positive integers writt... | [{"type": "stdin_stdout", "input": "19\n1\n10\n100\n1000\n10000\n100000\n1000000\n10000000\n100000000\n1000000000\n10000000000\n100000000000\n1000000000000\n10000000000000\n100000000000000\n1000000000000000\n10000000000000000\n100000000000000000\n1000000000000000000\n", "output": "1\n4\n1\n4\n9\n2\n6\n2\n6\n8\n1\n1\n9\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's define a string <x> as an opening tag, where x is any small letter of the Latin alphabet. Each opening tag matches a closing tag of the type </x>, where x is the same letter.\n\nTegs can be nested into each other: i... | [{"type": "stdin_stdout", "input": "<d><d><w><v><g><m></m></g><b><u></u><j><h><n><q><q><c></c></q></q></n></h><c></c><l><r><l></l><b><d></d><x><k><o><w><q><x></x></q></w></o></k><p></p></x><g><m></m></g></b></r></l></j><k><l></l></k><c><v><g><p><p><d><e><z><x></x></z></e><v></v></d><u><o><u></u><k></k></o></u><m><x><h>... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are an all-powerful being and you have created a rectangular world. In fact, your world is so bland that it could be represented by a r × c grid. Each cell on the grid represents a country. Each country has a dominant... | [{"type": "stdin_stdout", "input": "4\n7 8\nAAPAAAAA\nPPPPAAAA\nPPPPAAAA\nAPAAPPPP\nAPAPPAPP\nAAAAPPAP\nAAAAPPAA\n6 5\nAAAAA\nAAAAA\nAAPAA\nAAPAP\nAAAPP\nAAAPP\n4 4\nPPPP\nPPPP\nPPPP\nPPPP\n3 4\nPPPP\nPAAP\nPPPP\n", "output": "2\n1\nMORTAL\n4\n"}, {"type": "stdin_stdout", "input": "4\n7 8\nAAPAAAAA\nAAAAPPPP\nPPPPAAAA\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLogical quantifiers are very useful tools for expressing claims about a set. For this problem, let's focus on the set of real numbers specifically. The set of real numbers includes zero and negatives. There are two kinds ... | [{"type": "stdin_stdout", "input": "100 50\n55 13\n84 2\n22 63\n100 91\n2 18\n98 64\n1 86\n93 11\n17 6\n24 97\n14 35\n24 74\n22 3\n42 5\n63 79\n31 89\n81 22\n86 88\n77 51\n81 34\n19 55\n41 54\n34 57\n45 9\n55 72\n67 61\n41 84\n39 32\n51 89\n58 74\n32 79\n65 6\n86 64\n63 42\n100 57\n46 39\n100 9\n23 58\n26 81\n61 49\n71... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a matrix with n rows (numbered from 1 to n) and m columns (numbered from 1 to m). A number a_{i, j} is written in the cell belonging to the i-th row and the j-th column, each number is either 0 or 1.\n\nA ch... | [{"type": "stdin_stdout", "input": "4\n2 2\n1 1\n0 1\n2 3\n1 1 0\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 0 0 0 0 0\n1 0 1 1 1 0 1\n2 5\n1 0 1 0 0\n1 1 1 1 0\n-1 1 1 0 0\n", "output": "0\n3\n5\n4\n"}, {"type": "stdin_stdout", "input": "4\n2 2\n1 1\n0 1\n2 3\n1 1 1\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 1 0 0 1 0\n1 0 1 0 1 0 1\n2 5\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a road with length l meters. The start of the road has coordinate 0, the end of the road has coordinate l.\n\nThere are two cars, the first standing at the start of the road and the second standing at the end of ... | [{"type": "stdin_stdout", "input": "5\n2 10\n1 6\n1 10\n1\n5 10\n1 2 3 4 6\n2 1000000000\n413470354 988915189\n9 478\n1 10 25 33 239 260 453 468 477\n", "output": "3.625\n3.6666666666666665\n2.6999999999999997\n327473009.875\n57.763636363636365\n"}, {"type": "stdin_stdout", "input": "5\n2 10\n2 9\n1 10\n1\n5 10\n1 2 3 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nZookeeper is buying a carton of fruit to feed his pet wabbit. The fruits are a sequence of apples and oranges, which is represented by a binary string s_1s_2… s_n of length n. 1 represents an apple and 0 represents an ora... | [{"type": "stdin_stdout", "input": "100\n0110110011011111001110000110010010000111111001100001011101101000001011001101100111011111100111101110\n", "output": "23254\n"}, {"type": "stdin_stdout", "input": "100\n0110110011011111001110000110010010000111111001100001011101101000001011001101100110011111100111101110\n", "output... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is an infinite 2-dimensional grid. The robot stands in cell (0, 0) and wants to reach cell (x, y). Here is a list of possible commands the robot can execute:\n\n * move north from cell (i, j) to (i, j + 1); \n * m... | [{"type": "stdin_stdout", "input": "100\n0 0\n0 1\n1 0\n1 1\n0 2\n1 2\n2 0\n2 1\n2 2\n0 3\n1 3\n2 3\n3 0\n3 1\n3 2\n3 3\n0 4\n1 4\n2 4\n3 4\n4 0\n4 1\n4 2\n4 3\n4 4\n0 5\n1 5\n2 5\n3 5\n4 5\n5 0\n5 1\n5 2\n5 3\n5 4\n5 5\n0 6\n1 6\n2 6\n3 6\n4 6\n5 6\n6 0\n6 1\n6 2\n6 3\n6 4\n6 5\n6 6\n0 7\n1 7\n2 7\n3 7\n4 7\n5 7\n6 7\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two binary square matrices a and b of size n × n. A matrix is called binary if each of its elements is equal to 0 or 1. You can do the following operations on the matrix a arbitrary number of times (0 or mor... | [{"type": "stdin_stdout", "input": "3\n3\n110\n001\n110\n\n000\n000\n000\n3\n101\n010\n101\n\n010\n101\n010\n2\n01\n11\n\n10\n10\n", "output": "\nYES\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "3\n3\n110\n001\n110\n\n000\n000\n000\n3\n111\n010\n101\n\n110\n100\n011\n2\n01\n11\n\n10\n10\n", "output": "YES\nYES\nNO\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDr. Moriarty is about to send a message to Sherlock Holmes. He has a string s. \n\nString p is called a substring of string s if you can read it starting from some position in the string s. For example, string \"aba\" has... | [{"type": "stdin_stdout", "input": "ksmbytfyhhnstlecripupiwdhbkhfpfmimrbqgszohcqnezcybvwasxmkxfupvuecsctcpadccnqexsglwaiyxcoyheefcjmdedesgjqdtqgrvfjonzesffousooutsjumrxl\nhgjqihcfbnmgufonaiudbjegexexthrzcdkuimwogpbyovemztzcmqnrbhabxyyxyfuzpyhjgnioexbezzupcxlyzuuncstiiqsjzdtqppqhxilvqimlpjejiqbwpeekzweeyvthvjffgfvqauqru... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\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 608 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\nYaroslav has an array that consists of n integers. In one second Yaroslav can swap two neighboring array elements. Now Yaroslav is wondering if he can obtain an array where any two neighboring elements would be distinct i... | [{"type": "stdin_stdout", "input": "100\n1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSereja loves all sorts of algorithms. He has recently come up with a new algorithm, which receives a string as an input. Let's represent the input string of the algorithm as q = q1q2... qk. The algorithm consists of two s... | [{"type": "stdin_stdout", "input": "yxzyzxzzxyyzzxxxzyyzzyzxxzxyzyyzxyzxyxxyzxyxzyzxyzxyyxzzzyzxyyxyzxxy\n10\n17 67\n6 35\n12 45\n56 56\n14 30\n25 54\n1 1\n46 54\n3 33\n19 40\n", "output": "NO\nNO\nNO\nYES\nYES\nNO\nYES\nNO\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "yxzyzxzzxyyzzxxxzyyzzyzxxzxyzyyzxyzxyxxyzxyxzyz... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn a number axis directed from the left rightwards, n marbles with coordinates x1, x2, ..., xn are situated. Let's assume that the sizes of the marbles are infinitely small, that is in this task each of them is assumed to... | [{"type": "stdin_stdout", "input": "15\n-241250505 -2\n-241250503 0\n-241250502 -5\n-241250501 -1\n-241250500 -3\n-241250499 2\n-241250498 -2\n-241250497 6\n-241250496 0\n-241250495 0\n-241250494 8\n-241250493 -5\n-241250492 7\n-241250491 -7\n-241250490 2\n", "output": "-20\n"}, {"type": "stdin_stdout", "input": "15\n-... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBerland scientists noticed long ago that the world around them depends on Berland population. Due to persistent research in this area the scientists managed to find out that the Berland chronology starts from the moment w... | [{"type": "stdin_stdout", "input": "5833850738115444790123301858525860464609052423198474077217629208584932325696195827387610627649689452307781278299607661979317839675618367523485801890948530770658677574385684508313179053341358796468870615462459993169923271075382282788408147405323998383308800\n", "output": "YES\n1\n465\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAmr doesn't like Maths as he finds it really boring, so he usually sleeps in Maths lectures. But one day the teacher suspected that Amr is sleeping and asked him a question to make sure he wasn't.\n\nFirst he gave Amr two... | [{"type": "stdin_stdout", "input": "1000 100 777767777\n", "output": "577920877\n"}, {"type": "stdin_stdout", "input": "886 10 902171654\n", "output": "134375492\n"}, {"type": "stdin_stdout", "input": "712 53 592302770\n", "output": "147693148\n"}, {"type": "stdin_stdout", "input": "393 71 933802677\n", "output": "3665... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKevin has just recevied his disappointing results on the USA Identification of Cows Olympiad (USAICO) in the form of a binary string of length n. Each character of Kevin's string represents Kevin's score on one of the n q... | [{"type": "stdin_stdout", "input": "93\n010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010\n", "output": "93\n"}, {"type": "stdin_stdout", "input": "93\n010101010101010101010101010101010101010101010101010101010101010101010101011101010101010101010\n", "output": "93\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMary has just graduated from one well-known University and is now attending celebration party. Students like to dream of a beautiful life, so they used champagne glasses to construct a small pyramid. The height of the pyr... | [{"type": "stdin_stdout", "input": "10 10000\n", "output": "55\n"}, {"type": "stdin_stdout", "input": "10 1022\n", "output": "53\n"}, {"type": "stdin_stdout", "input": "10 1023\n", "output": "55\n"}, {"type": "stdin_stdout", "input": "10 9999\n", "output": "55\n"}, {"type": "stdin_stdout", "input": "8 10000\n", "output... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Chelyabinsk lives a much respected businessman Nikita with a strange nickname \"Boss\". Once Nikita decided to go with his friend Alex to the Summer Biathlon World Cup. Nikita, as a very important person, received a to... | [{"type": "stdin_stdout", "input": "20 30\n4 13 78 11\n13 19 56 41\n15 15 46 83\n4 9 74 72\n17 20 97 7\n15 20 29 64\n8 17 44 85\n4 18 26 46\n16 17 13 90\n16 16 39 89\n13 14 46 125\n14 18 67 18\n12 20 84 48\n10 20 49 32\n10 14 14 11\n6 18 80 84\n3 20 13 97\n12 20 62 42\n7 14 64 71\n5 19 38 17\n17 18 99 18\n11 15 83 22\n... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.