messages
listlengths
1
1
ground_truth
stringlengths
156
726k
dataset
stringclasses
2 values
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nGiven an integer N not less than 3, find the sum of the interior angles of a regular polygon with N sides.\n\...
[{"input": "-636", "output": "-114840\n"}, {"input": "-729", "output": "-131580\n"}, {"input": "-102", "output": "-18720\n"}, {"input": "-161", "output": "-29340\n"}, {"input": "-151", "output": "-27540\n"}, {"input": "-119", "output": "-21780\n"}, {"input": "-135", "output": "-24660\n"}, {"input": "-246", "output": "-...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n---\n\n# Story\n\nThe Pied Piper has been enlisted to play his magical tune and coax all the rats out of town...
[{"input": "\"O~~OO~~OO~~OO~P~OO~~OO~~OO~~O\"", "output": "[8]", "fn_name": "count_deaf_rats"}, {"input": "\" P \"", "output": "[0]", "fn_name": "count_deaf_rats"}, {"input": "\"~O~O~O~OP~O~OO~\"", "output": "[2]", "fn_name": "count_deaf_rats"}, {"input": "\"P O~ O~ ~O O~\"", "output": "[1]", "fn_name": "c...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nLittle Petya loves looking for numbers' divisors. One day Petya came across the following problem:\n\nYou are...
[{"input": "20\n68260 0\n1140 1\n54174 1\n20460 1\n25696 2\n81647 4\n26528 4\n91307 5\n5210 4\n87730 2\n4653 8\n11044 6\n15776 4\n17068 7\n73738 7\n36004 12\n83183 7\n75700 12\n84270 14\n16120 5\n", "output": "12\n18\n4\n44\n18\n1\n6\n7\n6\n12\n8\n8\n21\n3\n14\n3\n3\n13\n19\n26\n"}, {"input": "20\n68260 0\n819 1\n54174...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThe math faculty of Berland State University has suffered the sudden drop in the math skills of enrolling stu...
[{"input": "100\n1 2 1 2 1 2 1 2 1 3 1 3 1 2 1 3 1 2 1 3 1 2 1 3 1 2 1 2 1 3 1 2 1 2 1 3 1 3 1 2 1 2 1 3 1 2 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 2 1 3 1 3 1 3 1 2 1 2 1 2 1 2 1 2 1 2 1 3 1 3 1 2 1 2 1 2 1 3 1 2 1 3 1 2 1 2\n", "output": "Finite\n331\n"}, {"input": "100\n2 1 3 1 3 1 3 1 2 1 2 1 3 1 2 1 3 1 2 1 3 1 2 1 3 1 3 1...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nABC Gene\n\nThere is a gene sequence represented by the string `ABC`. You can rewrite this gene sequence by p...
[{"input": "BAC", "output": "No\n"}, {"input": "ACB", "output": "No\n"}, {"input": "CAB", "output": "No\n"}, {"input": "CBA", "output": "No\n"}, {"input": "ACA", "output": "No\n"}, {"input": "BCA", "output": "No\n"}, {"input": "BAB", "output": "No\n"}, {"input": "ABA", "output": "No\n"}, {"input": "BAA", "output": "No\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nMr. Funt now lives in a country with a very specific tax laws. The total income of mr. Funt during this year ...
[{"input": "2000000000\n", "output": "2\n"}, {"input": "1000000007\n", "output": "1\n"}, {"input": "1000000009\n", "output": "1\n"}, {"input": "1999999999\n", "output": "3\n"}, {"input": "1000000011\n", "output": "2\n"}, {"input": "1234567890\n", "output": "2\n"}, {"input": "1999999929\n", "output": "2\n"}, {"input": "...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nVasya plays The Elder Trolls IV: Oblivon. Oh, those creators of computer games! What they do not come up with...
[{"input": "1000000 1000000 1000000 1000000000\n", "output": "1000000000000000000\n"}, {"input": "1000000 1000000 1001000 1000000000\n", "output": "1001000000000000000\n"}, {"input": "1000000 1000000 1011000 1000000000\n", "output": "1011000000000000000\n"}, {"input": "1000000 1000000 1000000 2999997\n", "output": "100...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nDr .: Peter, I've finally done it.\nPeter: What's wrong, Dr. David? Is it a silly invention again?\nDr .: Thi...
[{"input": "URQDE ERQSQN", "output": "TSE?DV E?GT'PA\n"}, {"input": "UEQDR ERQSQN", "output": "TTJ'GF E?GT'PA\n"}, {"input": "RDQEU ERQSQN", "output": "QGP-HF E?GT'PA\n"}, {"input": "QDQEU ERQSQN", "output": "T,M? OLUJ'NH,'\n"}, {"input": "QDQFU ORFSRQ", "output": "T,M?JTSSYJGRHY\n"}, {"input": "UFQDQ ORFSRQ", "output"...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given two strings A and B representing essays of two students who are suspected cheaters. For any two...
[{"input": "175 190\nqnnnnnnnnnnrnnnnrnrnnnnnrnnnnrqnnnnnnannnnnnnrnrrnrnnnnnrnnrnnnnnnrnrnnnnnrnnnannnrrnnnnrnnnnnnnnnnnrnannnnnrnnnnrnnnnrnnnnnnrnarnnnnnnnnanrnnnnnnnrnnrrnrnrrnnnnnrnnnnnrnnnnnn\nnnnnnrnnnnrnnnnnrnnnnnnrnnqnnnnnnrnnnnnnnrnnrnnnnrnqnannnnnnnannnnnnnrnrnnnrnnnnrnnnnnnnrrnqnnnnnnnnnnnrnrnnrannnnrnnnnrnr...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nOf course you have heard the famous task about Hanoi Towers, but did you know that there is a special factory...
[{"input": "15\n1 30 1409523818\n12 13 463027806\n9 14 846985104\n20 21 770345346\n17 22 514758030\n2 15 438137019\n18 19 331182033\n16 29 613043570\n10 19 765879041\n6 7 960155075\n13 27 323764310\n24 25 724736351\n4 9 107208241\n3 8 992951987\n23 28 125300818\n", "output": "6581903942\n"}, {"input": "15\n1 30 1409523...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nRead problems statements in Mandarin Chinese , Russian and Vietnamese \n\nA number is called palindromic if ...
[{"input": "2\n2 10\n123 150", "output": "44\n272\n"}, {"input": "2\n1 10\n123 150", "output": "45\n272\n"}, {"input": "2\n1 10\n123 150", "output": "45\n272"}, {"input": "2\n1 7\n100 112", "output": "28\n212\n"}, {"input": "2\n1 7\n110 112", "output": "28\n111\n"}, {"input": "2\n-1 120\n000 0", "output": "752\n0\n"}, ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n## **Task**\n\nYou are given a positive integer (`n`), and your task is to find the largest number **less tha...
[{"input": "90", "output": "[[81, 2]]", "fn_name": "largest_power"}, {"input": "65", "output": "[[64, 3]]", "fn_name": "largest_power"}, {"input": "81", "output": "[[64, 3]]", "fn_name": "largest_power"}, {"input": "29", "output": "[[27, 1]]", "fn_name": "largest_power"}, {"input": "2", "output": "[[1, -1]]", "fn_name"...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nCreate a program that converts data based on the given conversion table.\n\nThe characters used in the data a...
[{"input": "3\nA a\n0 5\n5 4\n10\nB\nB\nC\n0\n1\n4\n5\na\nb\nA\n3\nA a\n0 5\n5 4\n10\nA\nB\nC\n0\n1\n4\n5\na\nb\nA\n0", "output": "BBC5144aba\naBC5144aba\n"}, {"input": "3\nA a\n0 0\n5 4\n10\nB\nB\nC\n0\n1\n4\n5\na\nb\nA\n3\nA a\n0 5\n5 4\n10\nA\nB\nC\n0\n1\n4\n5\na\nb\nA\n0", "output": "BBC0144aba\naBC5144aba\n"}, {"i...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given a tree consisting of $n$ vertices. A number is written on each vertex; the number on vertex $i$...
[{"input": "20\n4 1 3 4 7 3 8 7 7 3 1 1 7 1 9 5 1 10 6 3\n6 15\n12 11\n18 1\n9 17\n8 1\n1 20\n13 7\n10 15\n20 19\n10 16\n8 5\n2 11\n14 3\n6 1\n1 12\n3 18\n6 4\n8 13\n9 18\n", "output": "3\n"}, {"input": "10\n7 4 6 7 6 6 7 5 7 5\n8 7\n4 5\n9 6\n2 5\n4 8\n9 10\n4 3\n9 4\n1 8\n", "output": "1\n"}, {"input": "6\n3 2 1 3 2 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere is a game called \"Unique Bid Auction\". You can read more about it here:\n\nhttps://en.wikipedia.org/w...
[{"input": "8\n12\n10 1 3 3 11 5 12 11 12 12 9 4\n11\n10 9 7 6 6 3 8 4 1 7 9\n12\n3 11 8 4 5 9 6 5 11 12 8 1\n15\n12 6 13 12 7 6 1 7 14 12 14 13 11 3 11\n40\n31 32 2 37 19 39 21 19 18 14 17 11 33 7 17 30 33 27 16 37 37 29 19 32 20 32 24 20 20 24 32 2 7 33 30 25 23 11 35 39\n16\n11 9 16 2 10 5 10 4 13 11 8 1 13 7 4 12\n...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nOnce upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice qu...
[{"input": "A.He_nan_de_yang_guang_zhao_yao_zhe_wo_men_mei_guo_ren_lian_shang_dou_xiao_kai_yan_wahaaaaaaaaaaaaaaaa\nB.Li_bai_li_bai_fei_liu_zhi_xia_san_qian_chi_yi_si_yin_he_luo_jiu_tian_li_bai_li_bai_li_bai_li_bai_shi\nC.Peng_yu_xiang_shi_zai_tai_shen_le_jian_zhi_jiu_shi_ye_jie_du_liu_a_si_mi_da_zhen_shi_tai_shen_le_a...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSensation, sensation in the two-dimensional kingdom! The police have caught a highly dangerous outlaw, member...
[{"input": "10\nUR\nDR\nUL\nDR\nUL\nULDR\nUR\nUL\nULDR\nUL\n", "output": "45\n"}, {"input": "10\nUL\nUL\nUL\nUL\nUL\nUL\nUL\nUL\nUL\nUL\n", "output": "11\n"}, {"input": "10\nUL\nUR\nUR\nDR\nDR\nDR\nDL\nDL\nDL\nDL\n", "output": "35\n"}, {"input": "6\nUL\nDL\nDL\nUL\nUL\nDL\n", "output": "16\n"}, {"input": "6\nUR\nDL\nUR...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nBeing a nonconformist, Volodya is displeased with the current state of things, particularly with the order of...
[{"input": "1000000000000 1000000000000\n", "output": "1000000000000\n"}, {"input": "1000000000000 1276759536556\n", "output": "1553519073112\n"}, {"input": "1000000000000 1000000000000\n", "output": "1000000000000"}, {"input": "1000100000000 1000000000000\n", "output": "999900000000\n"}, {"input": "1001100000000 10000...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nToday, Mezo is playing a game. Zoma, a character in that game, is initially at position $x = 0$. Mezo starts ...
[{"input": "13\nLRLLLLRRLLRLR\n", "output": "14\n"}, {"input": "13\nLRLLLLRRLLRLR\n", "output": "14\n"}, {"input": "13\nLRLRLLRLLLRLR\n", "output": "14\n"}, {"input": "13\nRLRLLRRLLLLRL\n", "output": "14\n"}, {"input": "13\nLRLRLLRLRLRLL\n", "output": "14\n"}, {"input": "13\nRLRLLRLLLLRRL\n", "output": "14\n"}, {"input...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou have $n$ stacks of blocks. The $i$-th stack contains $h_i$ blocks and it's height is the number of blocks...
[{"input": "1\n30\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nTaro made a sugoroku so that everyone can play at the children's association event. In order to make the game...
[{"input": "3\n3\n-1\n1\n-1\n3\n0\n4\n2\n0\n-6\n4\n2\n-1\n-7\n0", "output": "OK\nOK\nOK\nOK\n"}, {"input": "3\n3\n0\n1\n-1\n3\n0\n4\n2\n0\n-6\n4\n2\n-1\n-8\n0", "output": "OK\nOK\nOK\nOK\n"}, {"input": "3\n3\n0\n1\n-1\n3\n0\n4\n2\n0\n-6\n4\n2\n-1\n-7\n0", "output": "OK\nOK\nOK\nOK\n"}, {"input": "3\n3\n-2\n1\n-1\n2\n4\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nOne day Vasya painted a Cartesian coordinate system on a piece of paper and marked some set of points (x1, y1...
[{"input": "30\n507 836\n525 836\n-779 196\n507 -814\n525 -814\n525 42\n525 196\n525 -136\n-779 311\n507 -360\n525 300\n507 578\n507 311\n-779 836\n507 300\n525 -360\n525 311\n-779 -360\n-779 578\n-779 300\n507 42\n525 578\n-779 379\n507 196\n525 379\n507 379\n-779 -814\n-779 42\n-779 -136\n507 -136\n", "output": "8\n"...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n<image>\n\n\nMy grandmother uses a balance. The balance will balance if you place the same size on both of th...
[{"input": "5\n11\n731", "output": "1 4\n1 2 8\n1 2 8 16 64 128 512\n"}, {"input": "5\n17\n731", "output": "1 4\n1 16\n1 2 8 16 64 128 512\n"}, {"input": "5\n17\n994", "output": "1 4\n1 16\n2 32 64 128 256 512\n"}, {"input": "5\n27\n186", "output": "1 4\n1 2 8 16\n2 8 16 32 128\n"}, {"input": "5\n6\n731", "output": "1 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nPasha has a positive integer a without leading zeroes. Today he decided that the number is too small and he s...
[{"input": "1541326723729813719 14\n", "output": "9541132672372813719\n"}, {"input": "219810011901120912 100\n", "output": "999822211111110000\n"}, {"input": "191919191919119911 100\n", "output": "999999991111111111\n"}, {"input": "123456789123456789 100\n", "output": "998877665544213123\n"}, {"input": "191919191919119...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nOmkar is creating a mosaic using colored square tiles, which he places in an n × n grid. When the mosaic is c...
[{"input": "20\n..............S.....\n....................\n.............S.....S\n....................\n....................\n...S................\n....................\n....................\n....................\n....................\n....................\n....................\n....................\n.....................
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAiz Onsen has a bathhouse and a pool. To use the bathhouse, you need to buy a bathing ticket, and to use the ...
[{"input": "2\n111 101 -1 -2\n1001 722 131 -3", "output": "-313\n106060\n"}, {"input": "2\n111 001 -1 -2\n1001 722 131 -3", "output": "-113\n106060\n"}, {"input": "2\n111 000 -1 -2\n1001 722 131 -3", "output": "-111\n106060\n"}, {"input": "2\n011 101 -1 -2\n1001 722 102 -3", "output": "-213\n82836\n"}, {"input": "2\n01...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nJett is tired after destroying the town and she wants to have a rest. She likes high places, that's why for h...
[{"input": "4\n1\n10\n28\n0111101000000000100\n", "output": "1\n2\n2\n28\n"}, {"input": "4\n1\n10\n28\n0101101000000000100\n", "output": "1\n2\n2\n28\n"}, {"input": "4\n2\n10\n28\n0101101000000000100\n", "output": "1\n2\n2\n28\n"}, {"input": "4\n2\n10\n26\n0101101000000000100\n", "output": "1\n2\n2\n28\n"}, {"input": "...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given an array $a$ consisting of $n$ integers $a_1, a_2, \\dots, a_n$.\n\nYour problem is to find suc...
[{"input": "4\n9999991 9999883 9999659 9999433\n", "output": "3 4\n"}, {"input": "4\n9999991 9999883 9999659 9999433\n", "output": "3 4\n"}, {"input": "4\n9999991 5101198 9999659 9999433\n", "output": "2 4\n"}, {"input": "3\n10000000 9999999 9999997\n", "output": "2 3\n"}, {"input": "3\n10000000 9999999 9999998\n", "ou...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nToday, as a friendship gift, Bakry gave Badawy $n$ integers $a_1, a_2, \\dots, a_n$ and challenged him to cho...
[{"input": "5\n1073741823 1073741823 181085488 1073741823 1073741823\n", "output": "536870912\n"}, {"input": "5\n1073741823 29972487 1073741823 1073741823 1073741823\n", "output": "536870912\n"}, {"input": "5\n219338430 29972487 1073741823 1073741823 1073741823\n", "output": "536870912\n"}, {"input": "5\n684690029 2997...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nTaro has decided to move. Taro has a lot of luggage, so I decided to ask a moving company to carry the luggag...
[{"input": "8\n7 2 1 3 8 5 4 6", "output": "20\n"}, {"input": "8\n5 2 1 3 8 6 4 7", "output": "18\n"}, {"input": "8\n6 4 1 1 8 5 4 7", "output": "20\n"}, {"input": "8\n6 2 1 3 8 5 4 7", "output": "19"}, {"input": "7\n1 2 5 4 3 6 7", "output": "7\n"}, {"input": "7\n1 3 2 4 5 6 7", "output": "2\n"}, {"input": "7\n1 2 8 1...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nTwo moving objects A and B are moving accross the same orbit (those can be anything: two planets, two satelli...
[{"input": "-24\n0\n10", "output": "[\"24.00\"]", "fn_name": "meeting_time"}, {"input": "0\n-18\n14", "output": "[\"18.00\"]", "fn_name": "meeting_time"}, {"input": "32\n-14\n14", "output": "[\"9.74\"]", "fn_name": "meeting_time"}, {"input": "12\n15\n5", "output": "[\"60.00\"]", "fn_name": "meeting_time"}, {"input": "1...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequ...
[{"input": "zyxzxzwyxywxxwabcdabdacdbcacdbcacabaaba\n", "output": "zzzyyxxwddddccbba\n"}, {"input": "zyxzxzwyxywxxwabcdabcacdbcacdbdacabaaba\n", "output": "zzzyyxxwddddcbba\n"}, {"input": "thankstosamarasauteddybearsforthiscontest\n", "output": "yttt\n"}, {"input": "shankstosamarasauteddybearsforthiscontest\n", "output...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nFor given a circle $c$ and a line $l$, print the coordinates of the cross points of them.\n\nConstraints\n\n*...
[{"input": "2 0 3\n2\n-1 -1 11 0\n1 -1 12 3", "output": "-0.83330025 -0.98610835 4.95743818 -0.50354682\n-0.55841103 -1.56669492 4.96717016 0.44260733\n"}, {"input": "2 -1 3\n2\n0 -1 14 0\n1 0 10 11", "output": "-0.99915098 -1.07136793 4.97884641 -0.64436811\n-0.76686667 -2.15950371 2.58864885 1.94168192\n"}, {"input":...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThe clique problem is one of the most well-known NP-complete problems. Under some simplification it can be fo...
[{"input": "12\n66 4\n12 7\n60 1\n24 4\n48 4\n-1 4\n36 4\n30 4\n6 4\n54 4\n42 2\n18 4\n", "output": "8\n"}, {"input": "12\n67 4\n12 7\n60 1\n24 4\n48 4\n-1 4\n36 4\n30 4\n6 4\n54 4\n42 2\n18 4\n", "output": "8\n"}, {"input": "12\n67 8\n12 7\n60 1\n24 4\n48 4\n-1 4\n36 4\n30 4\n6 4\n54 4\n42 2\n18 4\n", "output": "7\n"}...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n----- Statement -----\n\nYou need to find a string which has exactly K positions in it such that the characte...
[{"input": "2\n1\n38", "output": "ba\nnmlkjihgfedcbazyxwvutsrqponmlkjihgfedcba\n"}, {"input": "2\n4\n31", "output": "edcba\ngfedcbazyxwvutsrqponmlkjihgfedcba\n"}, {"input": "2\n1\n31", "output": "ba\ngfedcbazyxwvutsrqponmlkjihgfedcba\n"}, {"input": "2\n8\n23", "output": "ihgfedcba\nxwvutsrqponmlkjihgfedcba\n"}, {"input...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nLittle Joty has got a task to do. She has a line of n tiles indexed from 1 to n. She has to paint them in a s...
[{"input": "1000000000 1000000000 1000000000 1000000000 1000000000\n", "output": "1000000000\n"}, {"input": "1000000000 1000000000 1 1000000000 1000000000\n", "output": "1000000000000000000\n"}, {"input": "1000000000 1000000000 1000000000 1000000000 1000000000\n", "output": "1000000000\n"}, {"input": "1000000000 100000...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n# Remove Duplicates\n\nYou are to write a function called `unique` that takes an array of integers and return...
[{"input": "[-1, 5, 10, -100, 3, 2]", "output": "[[-1, 5, 10, -100, 3, 2]]", "fn_name": "unique"}, {"input": "[1, 2, 3, 3, 2, 1, 2, 3, 1, 1, 3, 2]", "output": "[[1, 2, 3]]", "fn_name": "unique"}, {"input": "[1, 3, 2, 3, 2, 1, 2, 3, 1, 1, 3, 2]", "output": "[[1, 3, 2]]", "fn_name": "unique"}, {"input": "[3, 2, 3, 3, 2, ...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are a number of ways to shuffle a deck of cards. Hanafuda shuffling for Japanese card game 'Hanafuda' i...
[{"input": "1 -2\n3 1\n3 1\n10 1\n1 10\n10 0\n8 -1\n0 0", "output": "1\n1\n10\n10\n8\n"}, {"input": "1 -2\n3 1\n3 1\n10 1\n4 10\n10 0\n8 -1\n0 0", "output": "1\n1\n7\n10\n8\n"}, {"input": "5 -1\n3 1\n1 1\n10 2\n1 10\n14 1\n11 0\n0 0", "output": "5\n3\n10\n11\n"}, {"input": "5 0\n3 1\n3 1\n19 2\n1 10\n10 2\n11 -1\n0 0",...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nFox Ciel has a board with n rows and n columns. So, the board consists of n × n cells. Each cell contains eit...
[{"input": "15\n.#...##.##.....\n.###.#.#.##..#.\n##.#####......#\n#....###.#..#..\n#.##.#.###.###.\n.###....#.###.#\n##.....##..#...\n.#.########...#\n##..#..##..#.##\n#...#....##....\n.......#.......\n.#..#.#.####...\n.#..#...#..###.\n#..#.#..#......\n###.....##....#\n", "output": "NO\n"}, {"input": "15\n.#...##.##.....
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are enthusiastic about the popular web game \"Moonlight Ranch\". The purpose of this game is to grow crop...
[{"input": "5\nelppa 2 2 -1 1 1 0 1 13 1\nan`ban 1 0 3 9 2 2 4 1 0\ncatror 0 2 2 2 1 4 1 18 2\ncqniau 1 3 0 2 -1 3 1 -1 1\nfghplant 0 4 0 3 2 3 0 110 1\n4\nenoki 1 3 2 -1 6 3 1 10 1\ntpmato 1 0 0 10 0 3 -1 1 1\nqotato -1 0 8 4 1 -1 4 7 1\nonion 3 4 0 3 3 7 0 10 1\n3\na 15 1 1 1 1 1 1 14 5\nc 16 -1 2 0 2 1 2 10 2\nc 14 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given a permutation p_1, p_2, …, p_n.\n\nIn one move you can swap two adjacent values.\n\nYou want to...
[{"input": "100\n98 52 63 2 18 96 31 58 84 40 41 45 66 100 46 71 26 48 81 20 73 91 68 76 13 93 17 29 64 95 79 21 55 75 19 85 54 51 89 78 15 87 43 59 36 1 90 35 65 56 62 28 86 5 82 49 3 99 33 9 92 32 74 69 27 22 77 16 44 94 34 6 57 70 23 12 61 25 8 11 67 47 83 88 10 14 30 7 97 60 42 37 24 38 53 50 4 80 72 39\n", "output...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSeryozha conducts a course dedicated to building a map of heights of Stepanovo recreation center. He laid a r...
[{"input": "3000 3000 4 10\n623629309 917769297 890844966 987654319\n", "output": "215591588260257\n"}, {"input": "3000 3000 10 4\n122375063 551934841 132649021 999999937\n", "output": "218197599525055\n"}, {"input": "3000 3000 1000 1000\n794639486 477380537 986566001 987456307\n", "output": "3906368067\n"}, {"input": ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nNatasha is planning an expedition to Mars for $n$ people. One of the important tasks is to provide food for e...
[{"input": "4 100\n84 99 66 69 86 94 89 96 98 93 93 82 87 93 91 100 69 99 93 81 99 84 75 100 86 88 98 100 84 96 44 70 94 91 85 78 86 79 45 88 91 78 98 94 81 87 93 72 96 88 96 97 96 62 86 72 94 84 80 98 88 90 93 73 73 98 78 50 91 96 97 82 85 90 87 41 97 82 97 77 100 100 92 83 98 81 70 81 74 78 84 79 98 98 55 99 97 99 79...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou need to execute several tasks, each associated with number of processors it needs, and the compute power ...
[{"input": "50\n83 43 73 75 11 53 6 43 67 38 83 12 70 27 60 13 9 79 61 30 29 71 10 11 95 87 26 26 19 99 13 47 66 93 91 47 90 75 68 3 22 29 59 12 44 41 64 3 99 100\n31 36 69 25 18 33 15 70 12 91 41 44 1 96 80 74 12 80 16 82 88 25 87 17 53 63 3 42 81 6 50 78 34 68 65 78 94 14 53 14 41 97 63 44 21 62 95 37 36 31\n", "outp...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere is a sequence X of length N, where every element is initially 0. Let X_i denote the i-th element of X.\...
[{"input": "9\n0\n-1\n-1\n-1\n-2\n2\n1\n1\n-2", "output": "-1\n"}, {"input": "9\n0\n-1\n-1\n-1\n-1\n2\n1\n1\n-2", "output": "-1\n"}, {"input": "9\n0\n-1\n-1\n-1\n-1\n2\n0\n1\n-2", "output": "-1\n"}, {"input": "9\n0\n-1\n-1\n-1\n-1\n2\n0\n1\n-4", "output": "-1\n"}, {"input": "9\n0\n-1\n-1\n-1\n-1\n2\n0\n1\n-6", "output"...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nTwo participants are each given a pair of distinct numbers from 1 to 9 such that there's exactly one number t...
[{"input": "12 12\n6 7 5 4 7 8 2 9 12 5 3 5 1 6 7 3 7 9 5 7 1 8 6 8\n6 4 2 1 7 8 1 6 8 5 9 8 1 5 7 2 5 9 6 3 9 2 9 4\n", "output": "-1\n"}, {"input": "12 12\n1 6 2 6 8 3 6 4 4 8 7 2 7 5 9 4 2 4 9 5 8 5 3 2\n2 8 6 9 2 6 7 4 6 5 6 3 5 8 7 8 7 1 1 9 9 7 7 3\n", "output": "-1\n"}, {"input": "12 2\n6 7 5 4 7 8 2 9 12 5 3 5 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nConsider the number triangle below, in which each number is equal to the number above plus the number to the ...
[{"input": "20", "output": "[6564120420]", "fn_name": "solve"}, {"input": "8", "output": "[1430]", "fn_name": "solve"}, {"input": "6", "output": "[132]", "fn_name": "solve"}, {"input": "7", "output": "[429]", "fn_name": "solve"}, {"input": "4", "output": "[14]", "fn_name": "solve"}, {"input": "5", "output": "[42]", "fn...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA string is called a k-string if it can be represented as k concatenated copies of some string. For example, ...
[{"input": "250\ncececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececececec...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThe AKS algorithm for testing whether a number is prime is a polynomial-time test based on the following theo...
[{"input": "11213", "output": "[true]", "fn_name": "aks_test"}, {"input": "8192", "output": "[false]", "fn_name": "aks_test"}, {"input": "8191", "output": "[true]", "fn_name": "aks_test"}, {"input": "10", "output": "[false]", "fn_name": "aks_test"}, {"input": "33", "output": "[false]", "fn_name": "aks_test"}, {"input":...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are n cities in Berland. Each city has its index — an integer number from 1 to n. The capital has index...
[{"input": "100 62 42\n45 66 13 18 93 47 83 19 41 66 5 70 16 29 54 28 65 91 92 24 90 54 7 40 77 53 68 58 70 65 68 30 94 80 16 18 69 21 94 1 99 61 97 2 69 15 79 38 61 46 88 32 57 84 35 18 17 77 38 91 84 2 53 54 68 19 13 78 62 16 63 17 76 49 28 45 94 13 35 69 37 56 12 41 95 70 57 24 45 84 87 65 14 76 95 94 31 67 5\n", "o...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nEvery year a race takes place on the motorway between cities A and B. This year Vanya decided to take part in...
[{"input": "76\n342 684 1027 1369 1711 2054 2396 2738 3081 3423 3765 4108 4450 4792 5135 5477 5819 6162 6504 6846 7189 7531 7873 8216 8558 8900 9243 9585 9927 10270 10612 10954 11297 11639 11981 12324 12666 13009 13351 13693 14036 14378 14720 15063 15405 15747 16090 16432 16774 17117 17459 17801 18144 18486 18828 19171...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThe Little Elephant has an integer a, written in the binary notation. He wants to write this number on a piec...
[{"input": "11100010010010000110101101101100111111001010001101101001001111010110010111001011010000001100110101000101111000001111101111110010000010101110011110101101010110001100011101111011100010011101100111110010111111100110101000000111101000000000110100100101111101000110101010101101001110001110000101011010101100011100...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nEven if the world is full of counterfeits, I still regard it as wonderful.\n\nPile up herbs and incense, and ...
[{"input": "1000000000000000000 1000000000000000000\n", "output": "1\n"}, {"input": "1000000000000000000 1000000000000000000\n", "output": "1\n"}, {"input": "1000000000000000000 1000000000100000000\n", "output": "0\n"}, {"input": "1000000000001000000 1000000000100000000\n", "output": "0\n"}, {"input": "1000000000001000...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nRead problems statements in Mandarin Chinese and Russian as well. \n\nIn every contest there should be an eas...
[{"input": "1 2\n1 -1\n14 -2", "output": "10000006\n"}, {"input": "2 2\n-1 0\n8 -1", "output": "10000000\n"}, {"input": "2 2\n0 0\n14 -1", "output": "9999993\n"}, {"input": "1 2\n-1 2\n3 4", "output": "10000005\n"}, {"input": "1 2\n-2 2\n3 4", "output": "10000003\n"}, {"input": "2 2\n1 -1\n15 0", "output": "9999991\n"}...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are $n$ boxers, the weight of the $i$-th boxer is $a_i$. Each of them can change the weight by no more ...
[{"input": "125\n8 85 125 177 140 158 2 152 67 102 9 61 29 188 102 193 112 194 15 7 133 134 145 7 89 193 130 149 134 51 13 194 191 149 73 106 151 85 42 53 163 134 127 7 51 61 178 105 117 197 35 21 122 164 133 165 135 12 192 60 54 187 173 75 74 195 85 62 166 195 131 109 191 196 61 44 61 20 95 147 199 142 71 198 36 153 5...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nKirill plays a new computer game. He came to the potion store where he can buy any potion. Each potion is cha...
[{"input": "6134912 6134912 10000000 10000000 999869\n", "output": "NO\n"}, {"input": "9222174 9829060 9418763 14615160 9092468\n", "output": "NO\n"}, {"input": "6134912 8670745 10000000 10000000 999869\n", "output": "NO\n"}, {"input": "9222174 9829060 9418763 9955619 9092468\n", "output": "NO\n"}, {"input": "5426234 6...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nHaving bought his own apartment, Boris decided to paper the walls in every room. Boris's flat has n rooms, ea...
[{"input": "20\n110 466 472\n112 153 152\n424 492 490\n348 366 113\n208 337 415\n491 448 139\n287 457 403\n444 382 160\n325 486 284\n447 454 136\n216 412 418\n217 208 228\n109 436 291\n293 382 421\n483 339 174\n213 327 183\n278 268 147\n181 424 457\n388 289 430\n174 269 305\n20\n221 4 334\n257 4 331\n444 3 127\n492 3 3...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nTo decide which is the strongest among Rock, Paper, and Scissors, we will hold an RPS tournament.\nThere are ...
[{"input": "100 100\nPSRRPRRSPSPSSSPSSSPSSSSSPSRSPRRPSRSSPSPPRRSRRRRPSSRRRRPSPSPSSRPRPPRSSRSSPSRPRSRPPSRPRPRPSPSPRRSRSPSP\n", "output": "R\n"}, {"input": "100 100\nRRPSSPPPPSRSRPSSPRSPPSPRSRRPSSPRRPSPPSPSPPRSSRPRPRRSSPSRSSRPSRSRRPRPPPSSSRRRPPRRRSPRRSPSSRRRRRPPPRPP\n", "output": "R\n"}, {"input": "100 100\nRSPSRSSPSPPPS...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nConsider the following well known rules:\n\n- A number is divisible by 3 if the sum of its digits is divisibl...
[{"input": "45939401", "output": "[\"11484850-altsum\"]", "fn_name": "solve"}, {"input": "24701723", "output": "[\"12350861-sum\"]", "fn_name": "solve"}, {"input": "376049", "output": "[\"47006-altsum\"]", "fn_name": "solve"}, {"input": "999883", "output": "[\"499941-sum\"]", "fn_name": "solve"}, {"input": "47", "outpu...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given a sequence A, where its elements are either in the form + x or -, where x is an integer.\n\nFor...
[{"input": "15\n+ 2101039\n-\n+ 4567886\n+ 113371486\n-\n+ 578943\n-\n-\n+ 62356680\n-\n+ 711111\n-\n+ 797735011\n-\n-\n", "output": "431927902\n"}, {"input": "15\n+ 2168539\n-\n+ 4567886\n+ 113371486\n-\n+ 578943\n-\n-\n+ 62356680\n-\n+ 711111\n-\n+ 797735011\n-\n-\n", "output": "465407902\n"}, {"input": "15\n+ 216853...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nManao is taking part in a quiz. The quiz consists of n consecutive questions. A correct answer gives one poin...
[{"input": "1000000000 1000000000 1000000000\n", "output": " 999999991"}, {"input": "1000000000 1000000000 772625255\n", "output": " 772625246"}, {"input": "999998212 999998211 499998210\n", "output": " ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nC: Skewering\n\nproblem\n\nOne day, when Homura was playing with blocks, Tempura came. Homura decided to play...
[{"input": "28 11 20", "output": "Tem\n"}, {"input": "28 11 17", "output": "Hom\n"}, {"input": "54 11 17", "output": "Hom\n"}, {"input": "12 6 20", "output": "Tem\n"}, {"input": "24 6 20", "output": "Tem\n"}, {"input": "28 6 20", "output": "Tem\n"}, {"input": "54 11 1", "output": "Hom\n"}, {"input": "15 10 2", "output"...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n## Your story\nYou've always loved both Fizz Buzz katas and cuckoo clocks, and when you walked by a garage sa...
[{"input": "\"00:00\"", "output": "[\"Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo\"]", "fn_name": "fizz_buzz_cuckoo_clock"}, {"input": "\"12:00\"", "output": "[\"Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo\"]", "fn_name": "fizz_buzz_cuckoo_...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nUjan has been lazy lately, but now has decided to bring his yard to good shape. First, he decided to paint th...
[{"input": "963201794869\n", "output": "963201794869\n"}, {"input": "930881829259\n", "output": "930881829259\n"}, {"input": "974059904437\n", "output": "974059904437\n"}, {"input": "912943012301\n", "output": "912943012301\n"}, {"input": "912943012301\n", "output": "912943012301\n"}, {"input": "974059904437\n", "outpu...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nLots of geeky customers visit our chef's restaurant everyday. So, when asked to fill the feedback form, these...
[{"input": "2\n11101110\n10101010101010", "output": "Good\nGood\n"}, {"input": "2\n11101110\n10101010111010", "output": "Good\nGood\n"}, {"input": "2\n01111010\n10100010111010", "output": "Good\nGood\n"}, {"input": "2\n01111010\n10100010111011", "output": "Good\nGood\n"}, {"input": "2\n01110010\n10100010111011", "outpu...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAt the end of last year, Santa Claus forgot to give Christmas presents to the children in JOI village. Theref...
[{"input": "12 8\n3\n-1 1\n3 4\n18 6", "output": "31\n3 4\n"}, {"input": "1 4\n3\n1 -1\n0 6\n2 -1", "output": "10\n1 -1\n"}, {"input": "12 8\n3\n-1 1\n3 4\n18 5", "output": "30\n3 4\n"}, {"input": "12 8\n3\n-1 1\n5 4\n10 5", "output": "21\n5 4\n"}, {"input": "12 8\n3\n-1 1\n5 3\n10 5", "output": "22\n5 3\n"}, {"input":...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA [Power Law](https://en.wikipedia.org/wiki/Power_law) distribution occurs whenever \"a relative change in on...
[{"input": "[1, 120]\n[1, 120]\n1", "output": "[120]", "fn_name": "power_law"}, {"input": "[1, 120]\n[3, 60]\n27", "output": "[15]", "fn_name": "power_law"}, {"input": "[1, 120]\n[9, 30]\n27", "output": "[15]", "fn_name": "power_law"}, {"input": "[1, 120]\n[2, 60]\n4", "output": "[30]", "fn_name": "power_law"}, {"input...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAs we all know, F.C. Barcelona is the best soccer team of our era! Their entangling and mesmerizing game styl...
[{"input": "2\n28 3\n8 2", "output": "198073708\n86\n"}, {"input": "2\n28 3\n8 1", "output": "198073708\n1\n"}, {"input": "2\n28 3\n8 0", "output": "198073708\n0\n"}, {"input": "2\n16 3\n8 2", "output": "10761681\n86\n"}, {"input": "2\n31 3\n8 1", "output": "347990060\n1\n"}, {"input": "2\n28 4\n3 0", "output": "706704...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nLimak is a little polar bear. He has n balls, the i-th ball has size t_{i}.\n\nLimak wants to give one ball t...
[{"input": "50\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\n", "output": "NO\n"}, {"input": "50\n1000 1000 1000 1...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIn this Kata, you will be given an array and your task will be to determine if an array is in ascending or de...
[{"input": "[7, 12, 1, 2, 3, 4, 5]", "output": "[\"RA\"]", "fn_name": "solve"}, {"input": "[7, 1, 2, 3, 4, 5]", "output": "[\"RA\"]", "fn_name": "solve"}, {"input": "[2, 3, 4, 5, 7, 12]", "output": "[\"A\"]", "fn_name": "solve"}, {"input": "[4, 5, 6, 1, 2, 3]", "output": "[\"RA\"]", "fn_name": "solve"}, {"input": "[1, ...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are two towers consisting of blocks of two colors: red and blue. Both towers are represented by strings...
[{"input": "23\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n1 1\nR\nB\n", "output": "YES\nYES\nYES\nYES\nYES\nYES\nYES\nYE...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSome people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausme...
[{"input": "5 93\n00000000000000000000000000000000000000000000000000000000100000000000000000000000000000000001010\n00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n00000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n00000000000...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are an integer sequence A_1,...,A_N consisting of N terms, and N buttons. When the i-th (1 ≦ i ≦ N) but...
[{"input": "7\n4 1\n11 1\n11 20\n2 4\n6 3\n5 12\n9 7", "output": "29\n"}, {"input": "7\n5 1\n4 2\n10 12\n2 4\n6 1\n1 8\n24 5", "output": "14\n"}, {"input": "7\n0 1\n4 2\n0 11\n2 8\n6 1\n5 16\n24 6", "output": "22\n"}, {"input": "7\n3 1\n4 2\n9 17\n2 4\n1 3\n5 15\n5 12", "output": "26\n"}, {"input": "7\n3 1\n4 2\n5 12\n...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nOkabe needs bananas for one of his experiments for some strange reason. So he decides to go to the forest and...
[{"input": "1000 10000\n", "output": "74133360011484445\n"}, {"input": "1000 10000\n", "output": "74133360011484445"}, {"input": "1581 6030\n", "output": "40628923515290265\n"}, {"input": "1061 8096\n", "output": "44286779591578800\n"}, {"input": "1581 5974\n", "output": "39507636740343456\n"}, {"input": "1486 5974\n",...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIt's Galactik Football time! The Galactik Football Assosiation (GFA) has announced a football tournament betw...
[{"input": "6 6\n1 2\n1 5\n1 3\n4 5\n5 4\n4 6\n1\n3\n-1\n2\n2\n10", "output": "0\n"}, {"input": "6 6\n1 2\n1 5\n2 2\n4 5\n5 4\n2 1\n1\n1\n5\n2\n2\n6", "output": "13\n"}, {"input": "6 6\n1 2\n2 3\n1 3\n2 5\n5 2\n4 4\n1\n2\n8\n3\n4\n6", "output": "11\n"}, {"input": "6 6\n1 2\n1 5\n1 3\n4 5\n5 4\n4 6\n1\n3\n0\n2\n7\n12", ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nWhen you enter 8 numbers from 0 to 9, write a program that outputs the difference between the largest integer...
[{"input": "2\n65539010\n102034250", "output": "96417531\n543098655\n"}, {"input": "2\n124008976\n66277190", "output": "986395311\n96499431\n"}, {"input": "2\n188122632\n66277190", "output": "774098523\n96499431\n"}, {"input": "2\n169123376\n66277190", "output": "864296532\n96499431\n"}, {"input": "2\n211592187\n662771...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA dice is a cube, its faces contain distinct integers from 1 to 6 as black points. The sum of numbers at the ...
[{"input": "100\n3\n6 5\n1 5\n2 1\n5 1\n6 5\n5 1\n6 2\n1 2\n6 5\n5 1\n5 1\n1 5\n2 6\n6 2\n5 6\n1 2\n1 5\n5 6\n1 5\n1 2\n2 6\n1 2\n6 2\n1 5\n6 2\n2 6\n1 5\n6 2\n6 5\n5 6\n1 5\n5 6\n5 1\n5 1\n2 1\n1 2\n5 6\n6 5\n1 5\n5 1\n1 2\n1 5\n1 2\n2 6\n5 1\n2 6\n2 6\n5 6\n2 6\n6 5\n6 5\n1 5\n2 1\n5 6\n5 6\n1 2\n2 1\n1 2\n1 2\n1 2\n...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSomeday, Drazil wanted to go on date with Varda. Drazil and Varda live on Cartesian plane. Drazil's home is l...
[{"input": "-1000000000 -1000000000 2000000000\n", "output": "Yes\n"}, {"input": "-1000000000 1000000000 2000000000\n", "output": "Yes\n"}, {"input": "-1000000000 -1000000000 1000000000\n", "output": "No\n"}, {"input": "-1000000000 -1000000000 1000000100\n", "output": "No\n"}, {"input": "-232833910 -880680184 177454979...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nArkady plays Gardenscapes a lot. Arkady wants to build two new fountains. There are n available fountains, fo...
[{"input": "52 38 22\n9 25 D\n28 29 C\n29 25 D\n4 28 D\n23 29 D\n24 25 D\n17 12 C\n11 19 C\n13 14 C\n12 15 D\n7 25 C\n2 25 C\n6 17 C\n2 20 C\n15 23 D\n8 21 C\n13 15 D\n29 15 C\n25 20 D\n22 20 C\n2 13 D\n13 22 D\n27 20 C\n1 21 D\n22 17 C\n14 21 D\n4 25 D\n5 23 C\n9 21 C\n2 20 C\n14 18 C\n29 24 C\n14 29 D\n9 27 C\n23 21 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nMishka received a gift of multicolored pencils for his birthday! Unfortunately he lives in a monochrome world...
[{"input": "10 5 293149357\n79072863 760382815 358896034 663269192 233367425 32795628 837363300 46932461 179556769 763342555\n", "output": "NO\n"}, {"input": "10 5 293149357\n79072863 760382815 358896034 663269192 233367425 32795628 837363300 46932461 179556769 763342555\n", "output": "NO\n"}, {"input": "18 2 86\n665 4...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given an array a. Some element of this array a_{i} is a local minimum iff it is strictly less than bo...
[{"input": "4\n1 5 2 5\n", "output": "2\n"}, {"input": "4\n1 5 2 1\n", "output": "1\n"}, {"input": "4\n1 7 2 1\n", "output": "1\n"}, {"input": "2\n-1 1100\n", "output": "0\n"}, {"input": "4\n1 3 2 1\n", "output": "1\n"}, {"input": "2\n-1 1110\n", "output": "0\n"}, {"input": "4\n1 1 2 1\n", "output": "1\n"}, {"input": "...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are playing one famous sandbox game with the three-dimensional world. The map of the world can be represe...
[{"input": "1\n8 6\n1 2 3 4 5 6\n7 8 9 10 11 12\n13 14 15 16 17 18\n19 20 21 22 23 24\n26 27 28 29 30 31\n33 34 35 36 34 35\n37 38 39 40 41 42\n44 45 46 47 48 49\n", "output": " 141\n"}, {"input": "5\n3 4\n1 2 3 4\n5 6 7 12\n9 10 11 12\n5 5\n2 5 4 4 3\n9 14 11...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nOmkar is building a waterslide in his water park, and he needs your help to ensure that he does it as efficie...
[{"input": "3\n4\n5 3 2 1\n5\n1 2 3 10 3\n3\n1 1 1\n", "output": "4\n7\n0\n"}, {"input": "3\n4\n5 3 2 0\n5\n1 2 3 10 3\n3\n1 1 1\n", "output": "5\n7\n0\n"}, {"input": "3\n4\n5 3 2 0\n5\n1 2 3 10 3\n3\n2 1 1\n", "output": "5\n7\n1\n"}, {"input": "3\n4\n5 3 2 0\n5\n1 2 3 10 1\n3\n2 1 1\n", "output": "5\n9\n1\n"}, {"input...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIt is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.\n\nMarmot brought Mole n o...
[{"input": "5\n2 12 3 4 9\n3\n1 25 11\n", "output": "1\n5\n2\n"}, {"input": "5\n2 12 3 4 9\n3\n1 25 17\n", "output": "1\n5\n3\n"}, {"input": "5\n2 17 3 4 9\n3\n1 25 13\n", "output": "1\n4\n2\n"}, {"input": "5\n2 12 3 4 9\n3\n1 25 13\n", "output": "1\n5\n2\n"}, {"input": "5\n4 10 4 4 9\n3\n1 25 17\n", "output": "1\n5\n3...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAshish has a tree consisting of $n$ nodes numbered $1$ to $n$ rooted at node $1$. The $i$-th node in the tree...
[{"input": "10\n64 0 0\n10 0 0\n17 0 1\n90 1 1\n97 1 1\n19 1 0\n26 1 1\n95 1 1\n46 0 0\n86 0 0\n5 4\n7 1\n9 5\n6 8\n1 6\n7 5\n8 10\n3 7\n3 2\n", "output": "128"}, {"input": "10\n92 0 1\n19 1 0\n46 1 0\n53 1 0\n13 1 0\n63 0 1\n3 0 1\n67 1 0\n20 0 1\n82 0 1\n6 5\n9 1\n3 7\n10 4\n4 8\n2 8\n5 2\n3 8\n9 10\n", "output": "33...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYour job is to change the given string `s` using a non-negative integer `n`.\n\nEach bit in `n` will specify ...
[{"input": "\"the quick broWn fox leapt over the fence\"\n9", "output": "[\"The QUicK BrowN foX LeaPT ovER thE FenCE\"]", "fn_name": "swap"}, {"input": "\"eVerybody likes ice cReam\"\n85", "output": "[\"EVErYbODy LiKeS IcE creAM\"]", "fn_name": "swap"}, {"input": "\"the lord of the rings\"\n0", "output": "[\"the lord o...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYour city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have ...
[{"input": "100\n174 174 49 152 10 185 101 157 28 177 105 83 155 178 119 123 197 197 56 174 39 53 85 94 72 166 71 43 177 123 186 11 64 82 145 81 11 29 100 10 106 45 138 79 131 90 80 104 149 116 129 30 96 192 11 182 92 157 95 136 152 38 68 34 42 95 164 134 117 75 186 185 28 146 86 24 147 12 166 169 116 44 46 99 55 179 8...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nRead the coordinates of four different points on the plane, $ A (x_A, y_A) $, $ B (x_B, y_B) $, $ C (x_C, y_C...
[{"input": "3.338679167476614 4.153021285774258 3.5962681645685493 3.0562783924178016 0.7824583380395241 0.6535611152381731 1.4307644766957708 0.2352661769827814\n2.6749426974072605 2.336361124342693 3.280415305064114 1.6735605571901062 -0.04476814775527138 2.2725919391555047 3.1294550602222495 2.8167160930096795\n10.9...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSnuke has a string s. From this string, Anuke, Bnuke, and Cnuke obtained strings a, b, and c, respectively, a...
[{"input": "redocta\natcoder\n?????>?", "output": "15\n"}, {"input": "eacodtr\naoetdcr\n?????>>", "output": "16\n"}, {"input": "ebdobur\nppedact\n>>????@", "output": "21\n"}, {"input": "qcbdpvg\nbfpepbs\n?>A>>@<", "output": "20\n"}, {"input": "tocojcb\nbs_fpph\n=?>@@@?", "output": "19\n"}, {"input": "redocta\nateodcr\n...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nProblem A: Swap crypto\n\nA 2D enthusiast at R University, he often writes embarrassing sentences that blush ...
[{"input": "1\ntojxo\n1 4\n5\nuhcqmlnkv\n4 5\n6 9\n3 6\n1 4\n3 6\n5\nshzxadexonr\n8 9\n3 9\n5 10\n4 9\n10 11\n0", "output": "aojwo\nthinyynku\nshitxdegyfo\n"}, {"input": "1\ntojxo\n1 4\n5\nuhcqmlnkv\n4 6\n6 9\n3 6\n1 4\n3 6\n5\nshzxadexonr\n8 9\n3 9\n5 10\n4 9\n10 11\n0", "output": "aojwo\nthiamznku\nshitxdegyfo\n"}, {...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nPashmak has fallen in love with an attractive girl called Parmida since one year ago...\n\nToday, Pashmak set...
[{"input": "-100 -100 100 100\n", "output": "-100 100 100 -100\n"}, {"input": "-100 100 100 -100\n", "output": "-100 -100 100 100\n"}, {"input": "-100 -100 -100 100\n", "output": "100 -100 100 100\n"}, {"input": "100 -100 -100 -100\n", "output": "100 100 -100 100\n"}, {"input": "-100 -100 100 100\n", "output": "-100 10...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou know combinations: for example, \nif you take 5 cards from a 52 cards deck you have 2,598,960 different c...
[{"input": "155117520\n30", "output": "[15]", "fn_name": "checkchoose"}, {"input": "155117530\n30", "output": "[-1]", "fn_name": "checkchoose"}, {"input": "3268760\n25", "output": "[10]", "fn_name": "checkchoose"}, {"input": "184756\n20", "output": "[10]", "fn_name": "checkchoose"}, {"input": "184756\n10", "output": "[...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nproblem\n\nThere are the following two-player card games.\n\n* This game uses a total of 2n cards with each i...
[{"input": "5\n1\n7\n9\n6\n4\n10\n10\n7\n13\n18\n1\n11\n12\n17\n5\n19\n0", "output": "0\n1\n2\n0\n"}, {"input": "5\n1\n7\n9\n6\n4\n10\n10\n7\n13\n18\n1\n20\n12\n17\n5\n19\n0", "output": "0\n1\n4\n0\n"}, {"input": "5\n1\n2\n9\n6\n10\n10\n16\n7\n14\n18\n4\n11\n6\n17\n5\n19\n0", "output": "2\n0\n2\n0\n"}, {"input": "5\n1\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n# Scenario\n\n**_Several people_** are standing in *a row divided into two teams*. \nThe **_first person_** ...
[{"input": "[39, 84, 74, 18, 59, 72, 35, 61]", "output": "[[207, 235]]", "fn_name": "row_weights"}, {"input": "[29, 83, 67, 53, 19, 28, 96]", "output": "[[211, 164]]", "fn_name": "row_weights"}, {"input": "[70, 58, 75, 34, 91]", "output": "[[236, 92]]", "fn_name": "row_weights"}, {"input": "[100, 51, 50, 100]", "output...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nValery is a PE teacher at a school in Berland. Soon the students are going to take a test in long jumps, and ...
[{"input": "112 1867 1261 1606\n0 7 17 43 67 70 87 112 129 141 148 162 179 180 189 202 211 220 231 247 250 277 308 311 327 376 400 406 409 417 418 444 480 512 514 515 518 547 572 575 578 587 612 617 654 684 701 742 757 761 788 821 825 835 841 843 850 858 869 872 881 936 939 969 970 971 997 1026 1040 1045 1068 1070 1073...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nHave you ever played Hanabi? If not, then you've got to try it out! This problem deals with a simplified vers...
[{"input": "100\nW4 Y1 W5 R4 W3 Y1 R4 W2 G3 G1 B5 Y5 Y2 Y3 G4 B5 W1 G5 Y5 Y3 G2 Y5 Y5 G5 R2 B3 B1 W5 Y1 W5 B4 W4 R4 B1 R1 W3 R5 R4 G2 W3 W3 R2 W5 Y2 B2 R3 R3 Y1 G5 G2 Y1 R4 Y5 W5 G5 B3 W2 R1 B2 W2 W2 Y5 W3 G1 B1 G2 Y3 W3 G1 W5 W1 G5 G2 Y1 W5 B5 W4 Y5 G2 R3 B4 R5 B1 R1 B4 Y4 Y4 Y3 R5 Y3 B3 W5 R5 Y5 G2 G5 W5 B4 G4 W5\n",...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nBessie and the cows are playing with sequences and need your help. They start with a sequence, initially cont...
[{"input": "5\n2 -1569\n1 2 -156\n2 641\n2 -253\n2 -400\n", "output": "-784.500000\n-940.500000\n-413.333333\n-373.250000\n-378.600000\n"}, {"input": "5\n2 -1481\n1 2 -156\n2 194\n2 -253\n2 -400\n", "output": "-740.500000\n-896.500000\n-533.000000\n-463.000000\n-450.400000\n"}, {"input": "5\n2 -980\n1 2 -156\n2 641\n2 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nWelcome to PC Koshien, players. At PC Koshien, competitions are currently being held in a total of three cate...
[{"input": "0000 1000 1000", "output": "2000\n"}, {"input": "0000 0000 1000", "output": "1000\n"}, {"input": "0001 0000 1000", "output": "1001\n"}, {"input": "0101 0000 1000", "output": "1101\n"}, {"input": "0100 0000 1000", "output": "1100\n"}, {"input": "0100 0010 1000", "output": "1110\n"}, {"input": "0101 1001 0000...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nPhone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is div...
[{"input": "100\n4004223124942730640235383244438257614581534320356060987241659784249551110165034719443327659510644224\n", "output": "40-04-22-31-24-94-27-30-64-02-35-38-32-44-43-82-57-61-45-81-53-43-20-35-60-60-98-72-41-65-97-84-24-95-51-11-01-65-03-47-19-44-33-27-65-95-10-64-42-24\n"}, {"input": "100\n2131060505689219...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nGiven is a string S, where each character is `0`, `1`, or `?`.\n\nConsider making a string S' by replacing ea...
[{"input": "??00????0??1????0?0??00??1???11?1?1???1?11?111???1", "output": "4\n"}, {"input": "1???11??11?1???1?1?11???1??00??0?0?1??1??0>>??00??", "output": "3\n"}, {"input": "1???111?11?1???111?11???1??00??0?0?@?????0????00??", "output": "5\n"}, {"input": "????111?11?1?1?111?11???1??00??0???@?????0???000??", "output":...
code_stdio