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\nYou came to a local shop and want to buy some chocolate bars. There are $n$ bars in the shop, $i$-th of them ... | [{"input": "9\n7 2 3 3 2 5 6 3 3\n6\n7 5 4 8 9 2\n", "output": "31\n31\n31\n32\n32\n28\n"}, {"input": "9\n7 2 3 3 2 5 6 3 3\n6\n7 5 4 8 9 2\n", "output": "31\n31\n31\n32\n32\n28\n"}, {"input": "9\n7 2 3 3 2 5 6 3 3\n6\n7 5 4 8 9 3\n", "output": "31\n31\n31\n32\n32\n29\n"}, {"input": "9\n7 2 3 3 2 5 5 3 3\n6\n7 5 4 8 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\nDr. Moriarty is about to send a message to Sherlock Holmes. He has a string s. \n\nString p is called a subst... | [{"input": "ksmbytfyhhnstlecripupiwdhbkhfpfmimrbqgszohcqnezcybvwasxmkxfupvuecsctcpadccnqexsglwaiyxcoyheefcjmdedesgjqdtqgrvfjonzesffousooutsjumrxl\nhgjqihcfbnmgufonaiudbjegexexthrzcdkuimwogpbyovemztzcmqnrbhabxyyxyfuzpyhjgnioexbezzupcxlyzuuncstiiqsjzdtqppqhxilvqimlpjejiqbwpeekzweeyvthvjffgfvqauqrugajjjzibgzhxphcvtncjzecb... | 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\nDuring the \"Russian Code Cup\" programming competition, the testing system stores all sent solutions for eac... | [{"input": "7\n0 2\n0 3\n0 2\n0 1\n0 10\n1 10\n0 5\n", "output": "YES\n"}, {"input": "7\n0 2\n0 3\n0 2\n0 1\n0 10\n1 10\n0 5\n", "output": "YES\n"}, {"input": "7\n0 2\n0 5\n0 2\n0 1\n0 10\n1 10\n0 5\n", "output": "YES\n"}, {"input": "4\n1 2\n2 100000\n1 2\n-1 100000\n", "output": "NO\n"}, {"input": "4\n0 1\n1 100000\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\nMasha really loves algebra. On the last lesson, her strict teacher Dvastan gave she new exercise.\n\nYou are ... | [{"input": "-3 0 92055 36\n-92974174 -486557474 -663622151 695596393 177960746 -563227474 -364263320 -676254242 -614140218 71456762 -764104225 705056581 -106398436 332755134 -199942822 -732751692 658942664 677739866 886535704 183687802 -784248291 -22550621 -938674499 637055091 -704750213 780395802 778342470 -999059668 ... | 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\nTanya is learning how to add numbers, but so far she is not doing it correctly. She is adding two numbers $a$... | [{"input": "6\n17236 1106911\n1 5\n108 112\n12345 1023412\n1 11\n1 20\n", "output": "3465\n4\n-1\n90007\n10\n-1\n"}, {"input": "6\n17236 1106911\n1 5\n108 112\n12345 1023412\n1 11\n1 20\n", "output": "3465\n4\n-1\n90007\n10\n-1\n"}, {"input": "6\n17236 1106911\n1 5\n108 112\n7038 799289\n1 11\n1 32\n", "output": "3465\... | 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\nI've got a crazy mental illness.\nI dislike numbers a lot. But it's a little complicated:\nThe number I'm afr... | [{"input": "\"Wednesday\"\n35", "output": "[false]", "fn_name": "am_I_afraid"}, {"input": "\"Wednesday\"\n34", "output": "[true]", "fn_name": "am_I_afraid"}, {"input": "\"Saturday\"\n55", "output": "[false]", "fn_name": "am_I_afraid"}, {"input": "\"Tuesday\"\n100", "output": "[true]", "fn_name": "am_I_afraid"}, {"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\nToastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. C... | [{"input": "19\noxoxoxoxooxoooxxoox\nxxxxxxxxoxxoxoooooo\noxoxoxooxxxooxxxooo\nxxoxxxooxooxxxoxxox\noxoxooxxxooooxxoxox\nxxxoooxoxxoxxoxxxoo\noxooxxxoooooxxoooxo\nxxooxooxoxxoxxoxxoo\noxxxxooooxxxooooxxx\nooxooxoxxoxxoxooxoo\nxxxooooxxxooooxoxox\noooxoxooxxoxooxooxx\nxxoooxxxooooxxoooxo\nooxxxooxoxooxooxxxx\nxoxoxxooxo... | 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\nB-Mansion and courier\n\nProblem Statement\n\nTaro lives alone in a mansion. Taro, who loves studying, intend... | [{"input": "1 1 110\n18", "output": "108\n"}, {"input": "1 0 110\n11", "output": "110\n"}, {"input": "1 3 110\n18", "output": "104\n"}, {"input": "1 0 192\n16", "output": "192\n"}, {"input": "1 1 192\n29", "output": "190\n"}, {"input": "1 2 454\n14", "output": "450\n"}, {"input": "1 3 454\n14", "output": "448\n"}, {"in... | 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 an integer N. Find the number of digits that N has in base K.\n\n-----Notes-----\nFor information on... | [{"input": "1000000000 2\n", "output": "30\n"}, {"input": "314159265 3\n", "output": "18\n"}, {"input": "282475249 7\n", "output": "11\n"}, {"input": "282475248 7\n", "output": "10\n"}, {"input": "282475250 7\n", "output": "11\n"}, {"input": "801037529 8\n", "output": "10\n"}, {"input": "1568902019 2", "output": "31\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\nAlice likes word \"nineteen\" very much. She has a string s and wants the string to contain as many such word... | [{"input": "nnnnnnnnnneeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeiiiiiiiiiiiiiiiiiiiitttttttttttttttttttt\n", "output": "4\n"}, {"input": "nnnnnnnnnneeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeedeeeeeeeeeeeeeeeeiiiiiiiiiiiiiiiiiiiitttttttttttttttttttt\n", "output": "4\n"}, {"input": "nnnnnnnnnneeeeeeeeeeeeeeeeeeeeeeeedeeeee... | 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 tree with N vertices, numbered 1, 2, \\ldots, N. For each i (1 \\leq i \\leq N - 1), the i-th edge... | [{"input": "10\n3 5\n10 8\n6 10\n1 5\n4 10\n2 10\n3 6\n9 2\n2 7", "output": "180\n"}, {"input": "10\n3 5\n10 8\n6 10\n1 5\n4 10\n2 10\n3 6\n9 3\n2 7", "output": "184\n"}, {"input": "10\n3 5\n10 8\n6 10\n1 5\n4 10\n2 10\n3 6\n9 2\n3 7", "output": "184\n"}, {"input": "10\n3 5\n10 8\n6 10\n1 5\n4 10\n2 10\n3 6\n9 2\n6 7",... | 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 to create a function,named `insertMissingLetters`, that takes in a `string` and outputs the same str... | [{"input": "\"hellllllllllllooooo\"", "output": "[\"hIJKMNPQRSTUVWXYZeFGIJKMNPQRSTUVWXYZlMNPQRSTUVWXYZllllllllllloPQRSTUVWXYZoooo\"]", "fn_name": "insert_missing_letters"}, {"input": "\"hello\"", "output": "[\"hIJKMNPQRSTUVWXYZeFGIJKMNPQRSTUVWXYZlMNPQRSTUVWXYZloPQRSTUVWXYZ\"]", "fn_name": "insert_missing_letters"}, {"i... | 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\nIn elementary arithmetic a \"carry\" is a digit that is transferred from one column of digits to another colu... | [{"input": "\"1 9\\n123456789 111111101\\n01 09\\n11 09\\n123 457\"", "output": "[\"1 carry operations\\n1 carry operations\\n1 carry operations\\n1 carry operations\\n1 carry operations\"]", "fn_name": "solve"}, {"input": "\"123 457\\n123 456\\n654 312\\n999 000\\n123 457\"", "output": "[\"1 carry operations\\nNo carr... | 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\nPolycarp is a big lover of killing time in social networks. A page with a chatlist in his favourite network i... | [{"input": "50\njcg\nvle\njopb\nepdb\nnkef\nfv\nxj\nufe\nfuy\noqta\ngbc\nyuz\nec\nyji\nkuux\ncwm\ntq\nnno\nhp\nzry\nxxpp\ntjvo\ngyz\nkwo\nvwqz\nyaqc\njnj\nwoav\nqcv\ndcu\ngc\nhovn\nop\nevy\ndc\ntrpu\nyb\nuzfa\npca\noq\nnhxy\nsiqu\nde\nhphy\nc\nwovu\nf\nbvv\ndsik\nlwyg\n", "output": "lwyg\ndsik\nbvv\nf\nwovu\nc\nhphy\nd... | 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\nTake a sentence (string) and reverse each word in the sentence. Do not reverse the order of the words, just t... | [{"input": "\"The red pen wrote on the wall\"", "output": "[\"ehT der nep etorw no eht llaw\"]", "fn_name": "reverser"}, {"input": "\"Green trucks drive fast\"", "output": "[\"neerG skcurt evird tsaf\"]", "fn_name": "reverser"}, {"input": "\"Pink trucks drive slow\"", "output": "[\"kniP skcurt evird wols\"]", "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\nA tennis tournament with n participants is running. The participants are playing by an olympic system, so the... | [{"input": "2426 500 665\n", "output": "2427425 1613290\n"}, {"input": "1353 500 665\n", "output": "1353352 899745\n"}, {"input": "500 500 500\n", "output": "499499 250000\n"}, {"input": "500 237 474\n", "output": "237025 237000\n"}, {"input": "456 456 456\n", "output": "415415 207936\n"}, {"input": "500 500 500\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\nBerland Music is a music streaming service built specifically to support Berland local artist. Its developers... | [{"input": "1\n50\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50\n10101010101010101010101010101010101010101010101010\n", "output": "26 1 27 2 28 3 29 4 30 5 31 6 32 7 33 8 34 9 35 10 36 11 37 12 38 13 39 14 40 15 41 16 42 17 ... | 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 an array $a$ of length $n$, tell us whether it has a non-empty subsequence such that the product of its... | [{"input": "1\n69\n1 1 2 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\n", "output": "YES\n"}, {"input": "1\n69\n1 1 2 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 0 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": "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 a large electronic screen which can display up to $998244353$ decimal digits. The digits are display... | [{"input": "1\n140047\n", "output": "7111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111... | 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\nChef loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representati... | [{"input": "3\n-1\n-10\n101", "output": "84589473\n84520290\n1310\n"}, {"input": "3\n-1\n-5\n110", "output": "84589473\n84552155\n1658\n"}, {"input": "3\n-1\n-5\n111", "output": "84589473\n84552155\n1709\n"}, {"input": "3\n-1\n-5\n101", "output": "84589473\n84552155\n1310\n"}, {"input": "3\n-1\n-6\n101", "output": "845... | 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 four towns, numbered 1,2,3 and 4. Also, there are three roads. The i-th road connects different tow... | [{"input": "1 1\n3 2\n4 3", "output": "YES\n"}, {"input": "1 2\n3 2\n4 3", "output": "YES\n"}, {"input": "3 2\n2 4\n1 4", "output": "YES\n"}, {"input": "1 4\n2 2\n4 3", "output": "YES\n"}, {"input": "3 2\n3 4\n1 4", "output": "YES\n"}, {"input": "2 1\n3 2\n4 1", "output": "YES\n"}, {"input": "3 2\n1 4\n1 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\nTakahashi is participating in a programming contest, AXC001. He has just submitted his code to Problem A.\n\n... | [{"input": "22 22\n", "output": "Yes\n"}, {"input": "75 75\n", "output": "Yes\n"}, {"input": "26 26\n", "output": "Yes\n"}, {"input": "45 45\n", "output": "Yes\n"}, {"input": "72 72\n", "output": "Yes\n"}, {"input": "-1 -102", "output": "No\n"}, {"input": "-2 -102", "output": "No\n"}, {"input": "81 69\n", "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\nThere are $n$ segments on a $Ox$ axis $[l_1, r_1]$, $[l_2, r_2]$, ..., $[l_n, r_n]$. Segment $[l, r]$ covers ... | [{"input": "4\n2\n-1000000000 1000000000\n-1000000000 1000000000\n2\n-1000000000 -1\n0 1000000000\n2\n-1000000000 -1\n1 1000000000\n2\n-1000000000 1\n-1 1000000000\n", "output": "1\n1\n1\n1\n"}, {"input": "4\n2\n-1000000000 1000000000\n-1000000000 1000000000\n2\n-1000000000 -1\n0 1000000000\n2\n-1000000000 -1\n1 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\nYour task is to determine how many files of the copy queue you will be able to save into your Hard Disk Drive... | [{"input": "[4, 8, 15, 16, 23, 42]\n108", "output": "[6]", "fn_name": "save"}, {"input": "[11, 13, 15, 17, 19]\n8", "output": "[0]", "fn_name": "save"}, {"input": "[4, 4, 4, 3, 3]\n12", "output": "[3]", "fn_name": "save"}, {"input": "[4, 4, 4, 3, 3]\n11", "output": "[2]", "fn_name": "save"}, {"input": "[1, 2, 3, 4]\n25... | 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\nTakahashi has received an undirected graph with N vertices, numbered 1, 2, ..., N. The edges in this graph ar... | [{"input": "19 5\n1 4\n5 4\n4 7\n12 10\n4 6", "output": "320\n"}, {"input": "21 5\n1 2\n3 4\n3 5\n4 1\n6 10", "output": "400\n"}, {"input": "21 5\n1 2\n3 3\n3 5\n4 1\n6 10", "output": "405\n"}, {"input": "21 5\n1 2\n3 5\n3 5\n4 1\n6 10", "output": "410\n"}, {"input": "12 5\n2 2\n3 4\n2 10\n4 1\n2 2", "output": "124\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\nGiven is an integer sequence of length N+1: A_0, A_1, A_2, \\ldots, A_N. Is there a binary tree of depth N su... | [{"input": "10\n0 -1 1 1 3 3 4 8 13 23 34", "output": "360\n"}, {"input": "10\n-1 0 1 0 2 3 5 8 13 21 34", "output": "421\n"}, {"input": "10\n0 -1 1 1 3 4 4 8 13 23 34", "output": "358\n"}, {"input": "10\n-1 0 1 0 2 3 5 8 13 30 34", "output": "457\n"}, {"input": "10\n-1 0 1 0 2 3 5 8 13 16 34", "output": "401\n"}, {"in... | 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 string s of length n.\nDoes a tree with n vertices that satisfies the following conditions ex... | [{"input": "1110\n", "output": "1 2\n2 3\n3 4\n"}, {"input": "1010\n", "output": "1 2\n1 3\n1 4\n"}, {"input": "1110", "output": "1 2\n2 3\n3 4"}, {"input": "1010", "output": "1 2\n1 3\n1 4"}, {"input": "1111\n", "output": "-1\n"}, {"input": "1011", "output": "-1\n"}, {"input": "0111", "output": "-1\n"}, {"input": "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\nA sum of p rubles is charged from Arkady's mobile phone account every day in the morning. Among the following... | [{"input": "10 1 10\n1 1000000000\n2 1000000000\n3 1000000000\n4 1000000000\n5 1000000000\n6 1000000000\n7 1000000000\n8 1000000000\n9 1000000000\n10 1000000000\n", "output": " 0"}, {"input": "14 4115 100\n18 72959\n20 5578\n28 36578\n32 12797\n33 4242\n42 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\nSpecial Agent Smart Beaver works in a secret research department of ABBYY. He's been working there for a long... | [{"input": "1023456789??????????????????????????????????????ABCDIFGHIJ\n", "output": "362880000000000000000000000000000000000000000\n"}, {"input": "B??C?\n", "output": "81000\n"}, {"input": "IJ?GH\n", "output": "45360\n"}, {"input": "??JG?\n", "output": "81000\n"}, {"input": "CDEFG\n", "output": "27216\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\nAn elephant decided to visit his friend. It turned out that the elephant's house is located at point 0 and hi... | [{"input": "6972384\n", "output": "1394477\n"}, {"input": "5118712\n", "output": "1023743\n"}, {"input": "1000000\n", "output": "200000\n"}, {"input": "1000000\n", "output": "200000\n"}, {"input": "1925720\n", "output": "385144\n"}, {"input": "1093799\n", "output": "218760\n"}, {"input": "1000010\n", "output": "200002\... | 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 and Petya take part in a Codeforces round. The round lasts for two hours and contains five problems.\n\... | [{"input": "26\n3 -1 71 -1 42\n85 72 48 38 -1\n-1 -1 66 24 -1\n46 -1 60 99 107\n53 106 51 -1 104\n-1 17 135 54 -1\n44 107 66 65 102\n47 40 62 34 5\n-1 10 -1 98 -1\n-1 69 47 85 75\n12 62 -1 15 -1\n48 63 72 32 99\n116 104 111 -1 -1\n92 -1 52 -1 11\n118 25 97 1 108\n-1 78 97 37 -1\n87 47 -1 -1 21\n79 87 73 82 70\n90 108 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\nYou are an experienced Codeforces user. Today you found out that during your activity on Codeforces you have ... | [{"input": "5\n99999997 999999998 999999998 999999999\n99999996 999999997 999999997 999999999\n99999997 999999998 999999998 999999999\n99999996 999999997 999999997 999999999\n162133301 999999998 999999998 999999999\n", "output": "899999999100000001\n449999999550000002\n899999999100000001\n449999999550000002\n8378666951... | 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 might know some pretty large perfect squares. But what about the NEXT one?\n\nComplete the `findNextSqua... | [{"input": "15241383936", "output": "[15241630849]", "fn_name": "find_next_square"}, {"input": "319225", "output": "[320356]", "fn_name": "find_next_square"}, {"input": "342786627", "output": "[-1]", "fn_name": "find_next_square"}, {"input": "121", "output": "[144]", "fn_name": "find_next_square"}, {"input": "625", "ou... | 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\nTsuruga Castle, a symbol of Aizuwakamatsu City, was named \"Tsuruga Castle\" after Gamo Ujisato built a full-... | [{"input": "8\n106\n29\n127\n11\n41\n39\n2\n5\n4\n67\n81\n78\n65\n0", "output": "2\n1\n1\n1\n1\n0\n2\n0\n0\n0\n0\n0\n0\n4\n"}, {"input": "8\n001\n21\n127\n11\n41\n39\n2\n5\n4\n67\n81\n78\n65\n0", "output": "3\n1\n1\n1\n1\n0\n1\n0\n0\n0\n0\n0\n0\n4\n"}, {"input": "8\n001\n21\n127\n11\n41\n39\n2\n5\n4\n67\n81\n54\n65\n0"... | 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\nRecently, Tokitsukaze found an interesting game. Tokitsukaze had n items at the beginning of this game. Howev... | [{"input": "1000000000000000000 20 365\n31881893160049984 103938857870698567 103962228223609431 140762820261865064 175962215264653912 239086305245565642 354522451098745823 383839975876242372 443471287955807705 478923027151493682 511195154588214957 619570919279066139 677571312513476877 705864797651447277 789633853044745... | 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's most recent follower, Ajit, has entered the Holy Forest. Ajit realizes that Omkar's forest is an n by... | [{"input": "4\n3 4\n0000\n00#0\n0000\n2 1\n#\n#\n1 2\n##\n6 29\n#############################\n#000##0###0##0#0####0####000#\n#0#0##00#00##00####0#0###0#0#\n#0#0##0#0#0##00###00000##00##\n#000##0###0##0#0##0###0##0#0#\n#############################\n", "output": "\n2\n3\n3\n319908071\n"}, {"input": "4\n3 4\n0000\n00#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\nA boy named Vasya wants to play an old Russian solitaire called \"Accordion\". In this solitaire, the player ... | [{"input": "52\n2D 5S 4S 4S 4C 2S 4H 4S 4H 4C 3S 4S 4S 4H 5S 4H 4H 5S 2S 4S 4S 2S 4S 4C 4S 4S 9S 4H 4S 3S 3H 4S 4S 7S 3S 3S 2H 3S 7S 4S 2S 7S 2S 2S 3S 3C 2S 3S 3S 2S 5S 3S\n", "output": "YES\n"}, {"input": "52\nAC 4C TC 9C TH AD 3C TC 4S 5C TD QD TH 4C 4D 3H TC 4S TH 8H 7H 4D TH QD 4D 8H QH 4D 4H 8D 4H 4D 8H 3D 9D 8H 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\nThe only difference between this problem and D2 is that you don't have to provide the way to construct the an... | [{"input": "10\n100 100 5000\n100 100 5000\n100 100 5000\n100 100 5000\n100 100 5000\n100 100 5000\n100 100 5000\n100 100 5000\n100 100 5000\n100 100 5000\n", "output": "YES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\n"}, {"input": "10\n100 100 5000\n100 100 5000\n100 100 5000\n100 100 5000\n100 100 5000\n100 100 500... | 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\nSample testcase 3 has a mistake, so we erased this case and rejudged all solutions of this problem. (21:01)\n... | [{"input": "25 250\n13 10 11 20 25 30 35 40 45 50 55 60 65 36 83 80 85 90 95 100 176 110 115 120 125", "output": "322439703\n"}, {"input": "25 127\n5 10 15 20 39 30 35 40 45 50 108 37 81 70 75 80 82 175 58 000 99 110 115 120 125", "output": "712861496\n"}, {"input": "25 127\n5 10 15 20 39 30 35 69 45 50 108 37 81 70 75... | 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\nMonocarp plays \"Rage of Empires II: Definitive Edition\" — a strategic computer game. Right now he's plannin... | [{"input": "71\n76468 749982 526217 695732 169602 557600 719698 698344 105043 522755 113036 693415 502619 741227 932643 534995 954172 87407 742242 172680 901819 194280 523575 413309 242835 918390 108115 823507 810672 916889 407735 504768 301602 942625 742419 779364 595511 775444 721352 115825 451351 182260 478289 63957... | 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\nPolycarp found on the street an array $a$ of $n$ elements.\n\nPolycarp invented his criterion for the beauty ... | [{"input": "10\n5\n4 3 1 5 2\n5\n1 5 1 1 5\n5\n4 1 2 1 2\n5\n5 5 6 1 4\n5\n5 2 4 5 4\n5\n3 1 2 3 4\n5\n1 3 9 4 1\n5\n5 2 10 5 4\n5\n1 1 2 3 2\n4\n2 2 5 1\n", "output": "2\n0\n0\n2\n2\n2\n1\n2\n1\n1\n"}, {"input": "10\n5\n4 3 1 5 1\n5\n1 4 1 1 3\n5\n4 1 2 1 2\n5\n5 5 5 1 4\n5\n5 2 4 5 4\n5\n3 1 2 3 4\n5\n2 3 5 4 1\n5\n5... | 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\nPetya loves football very much. One day, as he was watching a football match, he was writing the players' cur... | [{"input": "1111111111111111111111111111111111111111011111111111111111111111111111111111111111111111111111111111\n", "output": "YES\n"}, {"input": "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001\n", "output": "YES\n"}, {"input": "000110111001110111000000001001111110... | 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 main characters have been omitted to be short.\n\nYou are given a directed unweighted graph without loops... | [{"input": "20\n01001100001100011011\n00111101001100001101\n01010010000010000110\n10101001000000000110\n00110110111101100000\n00111010110011100011\n01101000111001110100\n11111100011110000100\n11111010011110011000\n10001100000101100101\n11001111010010100011\n00001111001001111111\n10011110000101001110\n100011010100001110... | 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\nCongratulations! That Special Someone has given you their phone number.\n\nBut WAIT, is it a valid number? \n... | [{"input": "\"+447+4435512555\"", "output": "[\"Plenty more fish in the sea\"]", "fn_name": "validate_number"}, {"input": "\"+337535512555\"", "output": "[\"Plenty more fish in the sea\"]", "fn_name": "validate_number"}, {"input": "\"075335440555\"", "output": "[\"Plenty more fish in the sea\"]", "fn_name": "validate_n... | 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 takes two dates as input and outputs the number of days between the two dates.\n\nDate ... | [{"input": "2006 9 2 522 9 3\n2006 8 1 1174 11 11\n2004 1 2 1365 1 1\n3334 2 1 2180 1 1\n2000 1 1 2101 1 1\n-1 -1 -1 -1 -1 -1", "output": "-542019\n-303780\n-233390\n-421521\n36890\n"}, {"input": "2006 9 2 522 8 3\n2006 8 1 1174 11 11\n2004 1 2 1365 1 1\n3334 2 1 2180 1 1\n2000 1 1 2101 1 1\n-1 -1 -1 -1 -1 -1", "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\nGiven the number n, find the smallest positive integer which has exactly n divisors. It is guaranteed that fo... | [{"input": "118\n", "output": "864691128455135232"}, {"input": "473\n", "output": "259700248434180096"}, {"input": "940\n", "output": "199495389743677440"}, {"input": "265\n", "output": "364791569817010176"}, {"input": "902\n", "output": "324625310542725120"}, {"input": "106\n", "output": "13510798882111488\n"}, {"inpu... | 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 are a builder and you are assigned a job of building a wall with a specific size (God knows ... | [{"input": "10\n7", "output": "[\"\\u25a0|\\u25a0\\u25a0|\\u25a0\\u25a0|\\u25a0\\u25a0|\\u25a0\\u25a0|\\u25a0\\u25a0|\\u25a0\\u25a0|\\u25a0\\n\\u25a0\\u25a0|\\u25a0\\u25a0|\\u25a0\\u25a0|\\u25a0\\u25a0|\\u25a0\\u25a0|\\u25a0\\u25a0|\\u25a0\\u25a0\\n\\u25a0|\\u25a0\\u25a0|\\u25a0\\u25a0|\\u25a0\\u25a0|\\u25a0\\u25a0|\\u... | 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\nAthenaeus has just finished creating his latest musical composition and will present it tomorrow to the peopl... | [{"input": "5\n6\n1 2 2 2 5 11\n2\n2 4\n6\n1 1 3 4 4 10\n1\n1\n6\n1 1 1 2 2 2\n", "output": "5\n2\n6\n1\n3\n"}, {"input": "5\n6\n1 2 2 4 6 11\n2\n1 4\n6\n1 1 1 4 4 10\n1\n1\n6\n1 1 2 2 2 2\n", "output": "6\n2\n5\n1\n3\n"}, {"input": "5\n6\n2 2 2 2 9 12\n2\n4 4\n6\n1 1 1 4 4 5\n1\n1\n6\n1 1 2 2 2 2\n", "output": "4\n2\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\nA magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several value... | [{"input": "50\n474421 421097 217233 156339 27075 733996 281778 863492 184707 956857 288561 70997 393786 337382 663642 131184 637 273801 799870 295017 392338 842567 161819 297705 102013 930684 375703 838048 154915 138503 629056 256591 893619 19263 787927 684541 320265 841090 421423 490879 394582 493952 619247 633202 61... | 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 can find anything whatsoever in our Galaxy! A cubical planet goes round an icosahedral star. Let us intro... | [{"input": "1 0 0\n0 0 0\n", "output": "YES\n"}, {"input": "1 1 1\n0 1 1\n", "output": "YES\n"}, {"input": "0 0 1\n1 0 0\n", "output": "YES\n"}, {"input": "1 0 0\n0 1 0\n", "output": "YES\n"}, {"input": "0 0 1\n1 0 1\n", "output": "YES\n"}, {"input": "0 1 0\n0 1 1\n", "output": "YES\n"}, {"input": "1 0 0\n0 0 1\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\nFor the given integer $n$ ($n > 2$) let's write down all the strings of length $n$ which contain $n-2$ letter... | [{"input": "2\n39776 83767477\n50000 1249975000\n", "output": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... | 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\nPetya started to attend programming lessons. On the first lesson his task was to write a simple program. The ... | [{"input": "FSNRBXLFQHZXGVMKLQDVHWLDSLKGKFMDRQWMWSSKPKKQBNDZRSCBLRSKCKKFFKRDMZFZGCNSMXNPMZVDLKXGNXGZQCLRTTDXLMXQ\n", "output": ".f.s.n.r.b.x.l.f.q.h.z.x.g.v.m.k.l.q.d.v.h.w.l.d.s.l.k.g.k.f.m.d.r.q.w.m.w.s.s.k.p.k.k.q.b.n.d.z.r.s.c.b.l.r.s.k.c.k.k.f.f.k.r.d.m.z.f.z.g.c.n.s.m.x.n.p.m.z.v.d.l.k.x.g.n.x.g.z.q.c.l.r.t.t.d.x... | 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\nSoon a school Olympiad in Informatics will be held in Berland, n schoolchildren will participate there.\n\nAt... | [{"input": "3000000\n1000000 1000000\n1000000 1000000\n1000000 1000000\n", "output": "1000000 1000000 1000000 \n"}, {"input": "3000000\n1000000 1000000\n1000000 1000000\n1000000 1000000\n", "output": "1000000 1000000 1000000\n"}, {"input": "1629279\n267360 999930\n183077 674527\n202618 786988\n", "output": "999930 4267... | 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\"We've tried solitary confinement, waterboarding and listening to Just In Beaver, to no avail. We need somet... | [{"input": "98\n-99 -98 -95 -90 97 93 96 95 98 98 -94 -92 -99 -92 -91 -87 -83 -84 -87 -88 -90 -79 -79 -82 -77 -76 92 82 91 91 90 91 -69 -72 -65 -68 -65 -58 -59 -63 -56 -57 -59 -53 -55 -45 -51 -52 73 81 75 71 77 72 67 70 60 70 61 64 -34 -41 -41 -41 -37 -39 -36 -33 -36 -36 -33 -36 54 49 53 51 50 -23 -26 -22 -23 -31 -30 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 a tube which is reflective inside represented as two non-coinciding, but parallel to $Ox$ lines... | [{"input": "13 968288\n0 67108864 134217728 201326592 268435456 335544320 402653184 469762048 536870912 603979776 671088640 738197504 805306368\n13 986214\n33554432 100663296 167772160 234881024 301989888 369098752 436207616 503316480 570425344 637534208 704643072 771751936 838860800\n", "output": "26\n"}, {"input": "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\nAn n × n table a is defined as follows:\n\n The first row and the first column contain ones, that is: a_{i},... | [{"input": "010\n", "output": "48620\n"}, {"input": "10\n", "output": "48620\n"}, {"input": "10\n", "output": "48620"}, {"input": "9\n", "output": "12870\n"}, {"input": "9\n", "output": "12870"}, {"input": "8\n", "output": "3432\n"}, {"input": "8\n", "output": "3432"}, {"input": "7\n", "output": "924\n"}, {"input": "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\nA tree is a graph with n vertices and exactly n - 1 edges; this graph should meet the following condition: th... | [{"input": "12\n1 6\n10 1\n4 1\n7 1\n1 2\n5 1\n1 8\n1 11\n3 1\n12 1\n9 1\n580660007 861441526 -264928594 462352906 253254575 -974301934 1176789404 662215161 87511873 514836444 -774450572 848928657\n", "output": "2529263875\n"}, {"input": "12\n1 6\n10 1\n4 1\n7 1\n1 2\n5 1\n1 8\n1 11\n3 1\n12 1\n9 1\n580660007 152568581... | 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 has two arrays $A$ and $B$ of lengths $n$ and $m$, respectively.\n\nHe can perform the following operat... | [{"input": "49\n18 1 7 2 1 1 50 22 8 2 2 1 30 2 46 10 1 4 5 18 25 21 38 11 2 15 29 8 7 2 45 12 14 16 16 23 11 1 1 4 48 18 3 1 1 23 4 10 7\n50\n5 25 34 22 19 4 4 2 40 52 1 4 1 3 47 9 4 1 8 47 4 5 1 1 9 22 9 2 2 1 1 48 7 2 8 16 4 2 41 12 3 30 21 10 2 2 5 1 31 13\n", "output": "14\n"}, {"input": "49\n18 1 7 2 1 1 50 22 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\nYoung Teodor enjoys drawing. His favourite hobby is drawing segments with integer borders inside his huge [1;... | [{"input": "43 1319\n750 1030\n857 946\n941 1203\n407 1034\n1052 1290\n546 585\n630 1201\n133 342\n693 1315\n34 719\n176 1097\n39 931\n198 885\n3 1025\n892 1054\n461 1287\n195 1273\n832 1039\n308 955\n642 866\n770 838\n440 777\n289 948\n98 814\n458 768\n82 265\n300 596\n182 706\n368 1225\n237 626\n36 348\n100 222\n46 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\nWrite a program which reads a sequence and prints it in the reverse order.\n\nNote\n\n解説\n\nConstraints\n\n* ... | [{"input": "8\n-2 0 0 32 -1 -2 153 26", "output": "26 153 -2 -1 32 0 0 -2\n"}, {"input": "8\n-2 0 0 32 -2 -2 153 26", "output": "26 153 -2 -2 32 0 0 -2\n"}, {"input": "8\n-2 1 0 32 -2 -2 153 26", "output": "26 153 -2 -2 32 0 1 -2\n"}, {"input": "8\n-2 1 0 32 -2 -1 153 26", "output": "26 153 -1 -2 32 0 1 -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\n«Next please», — the princess called and cast an estimating glance at the next groom.\n\nThe princess intends... | [{"input": "110 29 15\n", "output": "1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 32769 32770 32771 32772 32773 32774 32775 32776 32777 32778 32779 32780 32781 32782 32783 32784 32785 32786 32787 32788 32789 32790 32791 32792 32793 32794 32795 32796 32797 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": "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 as well. \n\nTriangle classification is... | [{"input": "2\n6\n0 0 4 1 1 2\n0 -1 1 0 1 4\n1 0 1 1 1 3\n0 0 2 1 1 2\n3 0 0 4 4 7\n0 0 2 1 4 0", "output": "Scalene obtuse triangle\nScalene obtuse triangle\nScalene obtuse triangle\nIsosceles acute triangle\nIsosceles right triangle\nIsosceles obtuse triangle\n"}, {"input": "2\n6\n0 0 4 1 1 2\n0 0 1 0 1 4\n0 0 1 1 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\nSereja has an array a, consisting of n integers a_1, a_2, ..., a_{n}. The boy cannot sit and do nothing, he d... | [{"input": "10 10\n1 2 3 4 1 2 3 4 100000 99999\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n", "output": "6\n6\n6\n6\n6\n5\n4\n3\n2\n1\n"}, {"input": "10 10\n1 2 3 4 1 2 3 4 100000 99999\n1\n2\n3\n4\n5\n6\n7\n7\n9\n10\n", "output": "6\n6\n6\n6\n6\n5\n4\n4\n2\n1\n"}, {"input": "10 10\n1 2 3 4 1 2 3 6 100000 99999\n1\n2\n3\n4\n5\n6\... | 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\nAmr lives in Lala Land. Lala Land is a very beautiful country that is located on a coordinate line. Lala Land... | [{"input": "28\n49728 91049\n-42863 4175\n-89214 22191\n77977 16965\n-42960 87627\n-84329 97494\n89270 75906\n-13695 28908\n-72279 13607\n-97327 87062\n-58682 32094\n39108 99936\n29304 93784\n-63886 48237\n-77359 57648\n-87013 79017\n-41086 35033\n-60613 83555\n-48955 56816\n-20568 26802\n52113 25160\n-88885 45294\n226... | 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\nVanya got an important task — he should enumerate books in the library and label each book with its number. E... | [{"input": "1000000000\n", "output": "8888888899\n"}, {"input": "1000000000\n", "output": "8888888899\n"}, {"input": "222222222\n", "output": "1888888896\n"}, {"input": "943006819\n", "output": "8375950269\n"}, {"input": "986747865\n", "output": "8769619683\n"}, {"input": "999999999\n", "output": "8888888889\n"}, {"inp... | 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 an integer, take the (mean) average of each pair of consecutive digits. Repeat this process until you h... | [{"input": "3700", "output": "[4]", "fn_name": "digits_average"}, {"input": "246", "output": "[4]", "fn_name": "digits_average"}, {"input": "245", "output": "[4]", "fn_name": "digits_average"}, {"input": "345", "output": "[5]", "fn_name": "digits_average"}, {"input": "346", "output": "[5]", "fn_name": "digits_average"}... | 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\nDmitry has an array of $n$ non-negative integers $a_1, a_2, \\dots, a_n$.\n\nIn one operation, Dmitry can cho... | [{"input": "5\n3\n0 1 3\n7\n0 2 2 3 4 3 2\n4\n3 0 0 0\n7\n4 6 2 3 5 0 5\n5\n4 0 1 0 4\n", "output": "1 1 0 -1 \n1 0 -1 -1 -1 -1 -1 -1 \n3 0 1 4 3 \n1 0 -1 -1 -1 -1 -1 -1 \n2 1 0 2 -1 -1 \n"}, {"input": "5\n3\n0 1 3\n7\n0 2 2 3 4 3 2\n4\n3 1 0 0\n7\n4 6 2 3 5 0 5\n5\n4 0 1 0 4\n", "output": "1 1 0 -1 \n1 0 -1 -1 -1 -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\nWe have a tree with N vertices. Vertex 1 is the root of the tree, and the parent of Vertex i (2 \\leq i \\leq... | [{"input": "1000\n1 1 2 3 4 5 5 7 8 9 10 11 12 12 14 14 15 16 18 19 20 19 20 23 24 24 25 27 28 29 30 31 32 32 32 35 36 36 38 39 39 41 42 42 43 45 45 47 48 49 50 50 52 52 53 55 56 57 57 59 59 61 62 62 64 64 66 67 67 69 70 70 71 72 73 73 76 77 78 79 79 81 82 83 83 84 86 87 87 88 90 91 91 92 94 95 96 97 98 99 100 101 102 ... | 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 another Start[c]up finals, and that means there is pizza to order for the onsite contestants. There are ... | [{"input": "25 6\n1 10 5\n1 8 4\n1 8 2\n4 8 9\n3 2 8\n1 9 5\n2 10 10\n3 9 6\n3 5 4\n2 7 8\n2 3 2\n2 6 8\n3 7 8\n4 3 7\n1 8 1\n3 6 4\n3 2 8\n2 2 1\n4 8 8\n4 15 4\n3 10 2\n3 6 6\n2 2 5\n1 6 2\n4 1 5\n", "output": "477\n"}, {"input": "25 6\n1 10 5\n1 8 4\n1 8 2\n4 8 9\n3 2 8\n1 9 5\n2 10 10\n3 9 6\n3 5 4\n2 7 8\n2 3 2\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\nRead problems statements in Mandarin Chinese and Russian. \n\nYou have an array of integers A_{1}, A_{2}, ..... | [{"input": "1\n-1 13\n-1 13 -2", "output": "13\n"}, {"input": "1\n-1 13\n-2 13 -2", "output": "13\n"}, {"input": "1\n-1 13\n-1 8 -2", "output": "13\n"}, {"input": "1\n0 26\n0 14 -2", "output": "26\n"}, {"input": "1\n0 12\n0 14 -2", "output": "12\n"}, {"input": "1\n0 22\n0 14 -2", "output": "24\n"}, {"input": "1\n0 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\nKevin has just recevied his disappointing results on the USA Identification of Cows Olympiad (USAICO) in the ... | [{"input": "93\n010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010\n", "output": "93\n"}, {"input": "93\n010101000101010101010101010101010101010101010101010101010101010101010101010101010101010101010\n", "output": "93\n"}, {"input": "93\n0100010001010101010101010101010101010101... | 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\nRecently, Vladimir got bad mark in algebra again. To avoid such unpleasant events in future he decided to tra... | [{"input": "1000 1000 999 1000\n* * *\n", "output": "999000000000\n"}, {"input": "720 903 589 804\n* * *\n", "output": "307887168960\n"}, {"input": "573 598 1387 124\n* * *\n", "output": "58932376152\n"}, {"input": "739 903 589 804\n* * *\n", "output": "316011969252\n"}, {"input": "573 598 1256 124\n* * *\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\nTakahashi loves numbers divisible by 2.\nYou are given a positive integer N. Among the integers between 1 and... | [{"input": "100\n", "output": "64\n"}, {"input": "32\n", "output": "32\n"}, {"input": "101", "output": "64\n"}, {"input": "111", "output": "64\n"}, {"input": "110", "output": "64\n"}, {"input": "121", "output": "64\n"}, {"input": "104", "output": "64\n"}, {"input": "107", "output": "64\n"}, {"input": "113", "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\nThe Resistance is trying to take control over all planets in a particular solar system. This solar system is ... | [{"input": "10\n4 3\n2 10\n10 1\n5 7\n9 8\n10 6\n5 10\n1 3\n2 9\n", "output": "4\n"}, {"input": "10\n4 1\n2 10\n10 1\n5 7\n3 8\n10 6\n5 9\n1 3\n1 9\n", "output": "5\n"}, {"input": "10\n4 3\n2 10\n10 1\n5 7\n5 8\n10 6\n5 9\n1 3\n1 9\n", "output": "5\n"}, {"input": "10\n4 3\n2 10\n10 1\n5 7\n5 8\n10 6\n5 9\n1 3\n2 9\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 have a computer literacy course in your university. In the computer system, the login/logout records of a... | [{"input": "6 2\n10\n775 1 1 1\n780 4 2 1\n790 2 1 1\n800 2 1 0\n810 3 1 1\n820 1 1 0\n825 3 1 0\n860 1 1 1\n870 4 2 -1\n880 1 1 0\n1\n780 870 1\n13 15\n12\n540 12 13 1\n600 12 13 0\n650 13 15 1\n660 12 15 1\n665 11 13 1\n670 13 15 0\n675 11 13 0\n680 12 15 0\n1000 11 14 1\n1060 12 14 1\n1060 11 14 0\n1080 12 14 0\n3\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\nRecently, the bear started studying data structures and faced the following problem.\n\nYou are given a seque... | [{"input": "9\n9999991 9999943 9999883 4658161 4657997 2315407 2315263 1000003 1000033\n13\n9999991 9999991\n9999943 9999943\n9999883 9999883\n4658161 4658161\n4657997 4657997\n2315407 2315407\n2315263 2315263\n1000003 1000003\n1000033 1000033\n2 2000000000\n2000000000 2000000000\n9999992 2000000000\n1000033 9999990\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 given the following points with integer coordinates on the plane: M0, A0, A1, ..., An - 1, where n is... | [{"input": "1 900000000000000001\n-1000 -1000\n-1000 -1000\n", "output": "-1000 -1000\n"}, {"input": "1 730435287519116102\n-1000 -1000\n-802 -1000\n", "output": "-1000 -1000\n"}, {"input": "1 1000000000000000000\n-1000 1000\n1000 -1000\n", "output": "-1000 1000\n"}, {"input": "1 1000000000000000000\n-1000 1000\n1001 -... | 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\nPolycarpus develops an interesting theory about the interrelation of arithmetic progressions with just everyt... | [{"input": "20\n-1 32 37 -1 -1 -1 57 -1 -1 40 31 33 -1 -1 39 47 43 -1 35 32\n", "output": "5\n"}, {"input": "20\n-1 32 37 -1 -1 -1 57 -1 -1 40 31 33 -1 -1 39 47 43 -1 35 32\n", "output": "5\n"}, {"input": "19\n23 26 -1 -1 35 38 41 -1 -1 -1 53 -1 59 62 6 7 8 9 -1\n", "output": "2\n"}, {"input": "19\n23 26 -1 -1 35 38 41... | 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 task is to calculate the number of arrays such that: each array contains $n$ elements; each element is... | [{"input": "100000 200000\n", "output": "707899035\n"}, {"input": "150000 200000\n", "output": "270223789\n"}, {"input": "200000 200000\n", "output": "668956439\n"}, {"input": "150000 200000\n", "output": "270223789\n"}, {"input": "200000 200000\n", "output": "668956439\n"}, {"input": "113870 200000\n", "output": "8454... | 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\nDreamoon loves summing up something for no reason. One day he obtains two integers a and b occasionally. He w... | [{"input": "10000000 10000000\n", "output": "425362313\n"}, {"input": "10000000 10000000\n", "output": "425362313\n"}, {"input": "10000000 11383836\n", "output": "113242098\n"}, {"input": "10000100 10000000\n", "output": "778965806\n"}, {"input": "12520154 17573427\n", "output": "525729623\n"}, {"input": "10000001 1138... | 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\nLet us call a pair of integer numbers m-perfect, if at least one number in the pair is greater than or equal ... | [{"input": "-1000000000000000000 -1000000000000000000 -1000000000000000000\n", "output": " 0\n"}, {"input": "-1000000000 -1000000000 -1000000000\n", "output": " 0\n"}, {"input": "-868993006 -38900... | 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 of numbers 1, 2, ..., n. Let's define f(p) as the following sum:\n\n<image>\n\n... | [{"input": "50 562949953421312\n", "output": "50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 \n"}, {"input": "50 500000000000007\n", "output": "4 5 6 9 11 18 20 22 23 25 26 29 30 31 34 36 37 38 39 40 41 42 43 44 45 46 49 50 48... | 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 tree with N vertices numbered 1, 2, ..., N. The edges of the tree are denoted by (x_i, y_i).\n\nOn... | [{"input": "7\n1 2\n0 7\n4 6\n2 3\n2 4\n1 5", "output": "Alice\n"}, {"input": "7\n2 2\n0 7\n4 6\n2 3\n2 4\n1 5", "output": "Alice\n"}, {"input": "7\n2 1\n0 7\n4 6\n2 3\n2 4\n1 5", "output": "Alice\n"}, {"input": "7\n2 1\n0 7\n4 6\n2 3\n0 4\n1 5", "output": "Alice\n"}, {"input": "7\n1 2\n3 7\n4 6\n2 3\n2 4\n1 5", "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\nA palindrome is a word, phrase, number, or other sequence of characters which reads the same backward as forw... | [{"input": "\"BGHHGB\"", "output": "[\"Not valid\"]", "fn_name": "palindrome"}, {"input": "\"11029\"", "output": "[\"Not valid\"]", "fn_name": "palindrome"}, {"input": "-1029", "output": "[\"Not valid\"]", "fn_name": "palindrome"}, {"input": "1029", "output": "[1001]", "fn_name": "palindrome"}, {"input": "1221", "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\nNow we will confect a reagent. There are eight materials to choose from, numbered 1,2,..., 8 respectively.\n\... | [{"input": "[1, 5, 6, 7, 3]", "output": "[true]", "fn_name": "isValid"}, {"input": "[7, 1, 2, 3]", "output": "[false]", "fn_name": "isValid"}, {"input": "[1, 3, 5, 7]", "output": "[false]", "fn_name": "isValid"}, {"input": "[5, 6, 7, 8]", "output": "[true]", "fn_name": "isValid"}, {"input": "[6, 7, 8]", "output": "[fal... | 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\nEveryone knows that hobbits love to organize all sorts of parties and celebrations. There are n hobbits livin... | [{"input": "10000\n", "output": "141\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 ... | 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 heard about Megamind? Megamind and Metro Man are two aliens who came to earth. Megamind wanted to de... | [{"input": "100000\n1\n50000\n49999", "output": "[2500050000]", "fn_name": "mega_mind"}, {"input": "100000\n100000\n100000\n100000", "output": "[1]", "fn_name": "mega_mind"}, {"input": "100000\n99999\n100000\n100000", "output": "[2]", "fn_name": "mega_mind"}, {"input": "100000\n1\n1000\n999", "output": "[99001000]", "f... | 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\nIn some other world, today is Christmas Eve.\nThere are N trees planted in Mr. Takaha's garden. The height of... | [{"input": "3 2\n1\n500000000\n1000000000\n", "output": "499999999\n"}, {"input": "5 3\n10\n15\n11\n14\n12\n", "output": "2\n"}, {"input": "3 3\n10\n15\n33\n14\n12", "output": "23\n"}, {"input": "4 3\n10\n21\n21\n-1\n10", "output": "11\n"}, {"input": "4 3\n10\n21\n21\n-2\n10", "output": "11\n"}, {"input": "4 3\n10\n8\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\nWrite a program which computes the area of a shape represented by the following three lines:\n\n$y = x^2$\n$y... | [{"input": "20\n100", "output": "68440000\n55000000\n"}, {"input": "20\n120", "output": "68440000\n51840000\n"}, {"input": "20\n150", "output": "68440000\n47250000\n"}, {"input": "20\n200", "output": "68440000\n40000000\n"}, {"input": "20\n010", "output": "68440000\n70210000\n"}, {"input": "20\n15", "output": "68440000... | 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 the programmer lives in the middle of the Programming subway branch. He has two girlfriends: Dasha and ... | [{"input": "999999 1000000\n", "output": "Equal\n"}, {"input": "999997 1000000\n", "output": "Dasha\n"}, {"input": "1000000 999993\n", "output": "Masha\n"}, {"input": "999997 1000001\n", "output": "Dasha\n"}, {"input": "1000000 670055\n", "output": "Masha\n"}, {"input": "782250 1078229\n", "output": "Dasha\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 screen that displays digital numbers that you often see on calculators is called a \"7-segment display\" ... | [{"input": "3\n0\n5\n1\n1\n1\n-1", "output": "0111111\n1010010\n1101011\n0000110\n"}, {"input": "3\n0\n9\n1\n1\n0\n-1", "output": "0111111\n1010000\n1101001\n0111111\n"}, {"input": "3\n0\n5\n1\n1\n2\n-1", "output": "0111111\n1010010\n1101011\n1011011\n"}, {"input": "3\n1\n9\n1\n1\n0\n-1", "output": "0000110\n1101001\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\nSnuke has decided to play a game, where the player runs a railway company.\nThere are M+1 stations on Snuke L... | [{"input": "2 22\n1 9\n5 9\n4 5\n4 9\n0 1\n0 12\n2 4", "output": "2\n2\n2\n2\n2\n2\n2\n2\n2\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n"}, {"input": "2 18\n1 9\n5 9\n4 5\n4 9\n0 1\n0 12\n2 4", "output": "2\n2\n2\n2\n2\n2\n2\n2\n2\n0\n0\n0\n0\n0\n0\n0\n0\n0\n"}, {"input": "5 17\n1 2\n5 9\n5 7\n5 12\n1 1\n6 2\n3 4", "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\nThe new operating system BerOS has a nice feature. It is possible to use any number of characters '/' as a de... | [{"input": "/zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\n", "output": "/zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\n"}, {"input": "/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/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\nRecently, on the course of algorithms and data structures, Valeriy learned how to use a deque. He built a deq... | [{"input": "71 57\n9 26 80 10 65 60 63 1 15 85 71 1 58 27 41 97 42 15 42 56 87 22 10 28 34 90 13 70 71 56 65 21 0 78 47 191 56 77 32 83 28 16 10 41 0 18 92 12 27 58 4 67 21 41 99 20 21 52 74 10 83 45 43 65 2 15 1 63 46 97 72\n150\n21\n81\n81\n5\n9\n41\n76\n81\n92\n95\n94\n78\n93\n47\n30\n92\n3\n45\n81\n42\n88\n17\n3\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\nWhile working at DTL, Ela is very aware of her physical and mental health. She started to practice various sp... | [{"input": "10\n84693792843120399 722933352461265626\n1054414613006002 919996041213106080\n141147461122848960 215953152568344802\n36758866361588362 220526816065597583\n135781915245644528 740842808859507601\n49755792151684097 147448792408078224\n101352931056782000 386376107245094465\n480981404419876442 57625018137531936... | 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\nOur Chef is very happy that his son was selected for training in one of the finest culinary schools of the wo... | [{"input": "3 3\n13 1 11\n0 6 34\n5 10 11", "output": "GUESS\n"}, {"input": "3 3\n9 8 11\n0 6 34\n5 10 11", "output": "GUESS\n"}, {"input": "3 3\n9 1 11\n0 6 34\n5 10 11", "output": "GUESS\n"}, {"input": "3 3\n9 8 11\n0 8 34\n5 10 11", "output": "GUESS\n"}, {"input": "3 3\n18 1 15\n0 6 34\n5 10 9", "output": "GUESS\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\nConsider a sequence of integers $a_1, a_2, \\ldots, a_n$. In one move, you can select any element of the sequ... | [{"input": "4\n7 6\n1 1 2 3 4 5 6\n5 2\n5 1 3 2 3\n5 2\n5 5 5 5 4\n8 4\n1 3 3 3 1 2 5 5\n", "output": "1\n2\n-1\n-1\n"}, {"input": "4\n7 6\n1 1 2 3 4 5 6\n5 2\n5 1 3 2 3\n5 2\n5 5 5 5 4\n8 4\n1 2 3 3 2 2 5 5\n", "output": "1\n2\n-1\n2\n"}, {"input": "4\n7 6\n1 1 2 3 4 5 6\n5 2\n5 1 3 2 3\n5 2\n5 5 5 5 4\n8 4\n1 2 3 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\nWe held two competitions: Coding Contest and Robot Maneuver.\n\nIn each competition, the contestants taking t... | [{"input": "1 001", "output": "1000000\n"}, {"input": "10 001", "output": "300000\n"}, {"input": "11 001", "output": "300000\n"}, {"input": "3 001", "output": "400000\n"}, {"input": "5 001", "output": "300000\n"}, {"input": "1 011", "output": "300000\n"}, {"input": "1 010", "output": "300000\n"}, {"input": "3 111", "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\nWe have an integer sequence A, whose length is N.\n\nFind the number of the non-empty contiguous subsequences... | [{"input": "7\n-1 -4 0 -20 -1 0 0", "output": "4\n"}, {"input": "7\n0 -1 1 -1 1 -1 1", "output": "13\n"}, {"input": "7\n0 -1 0 -5 0 -1 -3", "output": "3\n"}, {"input": "7\n0 -1 0 -5 0 -2 -3", "output": "3\n"}, {"input": "7\n0 -1 0 -7 -1 0 -3", "output": "3\n"}, {"input": "7\n0 -1 0 -4 -1 0 -3", "output": "3\n"}, {"inpu... | 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 Petya very much likes playing with little Masha. Recently he has received a game called \"Zero-One\" a... | [{"input": "1110110101111111001111111110111011100001110111011001011111111111011010011111?111111?011111110001010110011111010111100111?111101010011101010?011111101010111111111101111010111?1111111100110110001111101111100100110011101111011110111000111?011110?111110?1011010111101111101111010100111110101111011101110011101001... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.