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\nXenia lives in a city that has n houses built along the main ringroad. The ringroad houses are numbered 1 thr... | [{"input": "100 100\n48 73 63 16 49 88 36 17 66 6 87 13 94 52 58 70 71 52 7 70 25 42 24 36 57 9 79 26 75 39 13 14 38 26 33 66 88 28 75 98 53 48 67 54 63 25 69 87 88 32 72 17 36 35 29 67 74 89 70 47 20 90 78 13 94 57 32 73 29 74 45 78 85 64 81 56 12 65 19 67 34 86 55 71 41 33 76 13 100 47 44 76 86 78 37 15 26 98 83 98\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 string is called a KEYENCE string when it can be changed to `keyence` by removing its contiguous substring ... | [{"input": "eeyofscienck", "output": "NO\n"}, {"input": "eeyofsciencj", "output": "NO\n"}, {"input": "eeyofscienci", "output": "NO\n"}, {"input": "eeyofscjenci", "output": "NO\n"}, {"input": "icnejcsfoyee", "output": "NO\n"}, {"input": "icnyjcsfoeee", "output": "NO\n"}, {"input": "icmyjcsfoeee", "output": "NO\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\nIn English and programming, groups can be made using symbols such as `()` and `{}` that change meaning. Howev... | [{"input": "\"{[{}[]()[]{}{}{}{}{}{}()()()()()()()()]{{{[[[((()))]]]}}}}(())[[]]{{}}[][][][][][][]({[]})\"", "output": "[true]", "fn_name": "group_check"}, {"input": "\"{{{{{{{{{{{((((((([])))))))}}}}}}}}}}\"", "output": "[false]", "fn_name": "group_check"}, {"input": "\"[{}{}())\"", "output": "[false]", "fn_name": "gr... | 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 21XX, humanity finally began a plan to relocate to Mars. Selected as the first group of immigrants to Mars... | [{"input": "7 5 1 3 4\n1 2 10\n3 6 0\n2 4 5\n1 3 2\n1 4 12\n0 0 0 0 0", "output": "14\n"}, {"input": "6 5 1 2 4\n1 2 5\n4 3 5\n2 3 -1\n1 3 8\n1 4 36\n0 0 0 0 0", "output": "41\n"}, {"input": "6 5 1 3 4\n1 2 5\n3 3 5\n2 3 5\n1 3 8\n1 4 11\n0 0 0 0 0", "output": "19\n"}, {"input": "7 5 1 3 4\n1 2 5\n3 6 9\n2 4 5\n1 3 18\... | 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\nProof of knowledge\n\nThe entrance door of the apartment you live in has a password-type lock. This password ... | [{"input": "[+c[+a[^bd]]]\n0404\n[*b[*[*cd]a]]\n15341\n[^[^ab][^cd]]\n1295\na\n9876\n[^dd]\n9090\n.", "output": "0 10\n0 8895\n15 544\n9 1000\n0 10000\n"}, {"input": "[+c[+a[^bd]]]\n0404\n[*b[*[*cd]a]]\n15341\n[^[^ab][^cd]]\n1295\na\n4682\n[^dd]\n1131\n.", "output": "0 10\n0 8895\n15 544\n4 1000\n0 10000\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\nSnuke is buying a lamp.\nThe light of the lamp can be adjusted to m levels of brightness, represented by inte... | [{"input": "17181 9591\n8631 7910 866 4907 8538 8598 2993 9142 2493 4555 1343 1342 8441 2990 6402 514 8876 7271 3637 2648 8238 2119 5408 6110 6306 1057 3666 5651 9035 1593 7642 2543 4646 669 9090 261 3119 9534 4066 6874 4328 4894 2933 6769 9582 4302 6147 5501 4658 4708 72 1848 815 4682 6712 6890 3507 5336 4979 8575 958... | 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\nOleg's favorite subjects are History and Math, and his favorite branch of mathematics is division.\n\nTo impr... | [{"input": "10\n238517256500070918 988176216\n363959778883784349 933416507\n631238591652944446 530795521\n557307185726829409 1481431174\n86402035814143715 513728064\n101626841876448103 26556040\n598448092106640578 746411314\n733629261048200000 361714100\n624561301519202735 38\n1062588104563887715 98227203\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\nEdo has got a collection of n refrigerator magnets!\n\nHe decided to buy a refrigerator and hang the magnets ... | [{"input": "20 5\n1 12 21 22\n9 10 15 20\n10 12 12 20\n1 1 25 29\n5 10 21 22\n4 9 16 25\n12 10 14 24\n3 3 19 27\n3 4 23 28\n12 1 11 31\n9 14 17 18\n8 12 14 20\n8 11 18 19\n12 3 14 29\n7 8 13 22\n6 4 16 30\n11 3 13 27\n9 16 15 18\n6 13 14 21\n9 12 15 22\n", "output": "4\n"}, {"input": "20 5\n1 12 21 22\n9 10 15 20\n10 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 given a permutation of numbers from 1 to n. Determine whether there's a pair of integers a, b (1 ≤ a,... | [{"input": "100\n1 65 33 97 17 81 49 11 73 41 25 89 57 5 69 39 21 85 53 13 77 45 29 93 61 3 67 60 99 19 83 51 11 75 43 27 91 59 7 71 39 23 87 55 15 79 47 31 2 95 63 66 34 98 18 82 50 10 74 42 26 90 58 6 70 38 22 86 54 14 78 46 30 94 62 4 68 36 100 20 84 52 12 76 44 28 92 60 8 72 40 24 88 56 16 80 48 32 96 64\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\nAlice and Bob are playing yet another card game. This time the rules are the following. There are $n$ cards l... | [{"input": "131\n30 -29 29 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28 -28 28... | 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 has k matches, placed in n matchboxes lying in a line from left to right. We know that k is divisible b... | [{"input": "100\n6 3 4 5 3 4 2 4 1 2 4 1 8 5 2 2 4 4 6 8 4 10 4 4 6 8 6 5 5 4 8 4 3 3 6 5 7 2 9 7 6 5 6 3 2 6 8 10 3 6 8 7 2 3 5 4 8 6 5 6 6 8 4 1 5 6 1 8 12 5 3 3 8 2 4 2 4 5 6 6 9 5 1 2 8 8 3 7 5 3 4 5 7 6 3 9 4 6 3 6\n", "output": "867\n"}, {"input": "100\n6 3 4 5 3 4 2 4 1 2 4 1 8 5 2 2 4 4 6 8 4 10 4 4 6 8 6 5 5 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 string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDete... | [{"input": "dreamereraserdreamererasereraseeraserdreamererasereraserdreamdreamerdreamerdreamerdreamererasedreamereraseeraserdreamereraserdreamereraseeraserdreamdreamdreamerdreamerdreamerdreamdreamerdreameraseerasedreamererasererasererasedreamereraseerasererasedreamerasereraserdreamerdreamerasedreamereraseeraserdreamera... | 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 appearance of the sun is called \"sunrise\" and the hiding is called \"sunset\". What is the exact time w... | [{"input": "-12 3", "output": "-1\n"}, {"input": "-15 3", "output": "-1\n"}, {"input": "-23 3", "output": "-1\n"}, {"input": "-10 6", "output": "-1\n"}, {"input": "-2 -1", "output": "-1\n"}, {"input": "-1 -1", "output": "-1\n"}, {"input": "-1 -2", "output": "-1\n"}, {"input": "-1 -4", "output": "-1\n"}, {"input": "-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 are $n$ houses along the road where Anya lives, each one is painted in one of $k$ possible colors.\n\nA... | [{"input": "100 100\n82 51 81 14 37 17 78 92 64 15 8 86 89 8 87 77 66 10 15 12 100 25 109 47 21 78 20 63 13 49 76 36 41 79 16 87 87 69 3 76 80 60 100 62 70 59 72 8 38 71 45 97 71 14 76 54 81 4 59 46 39 29 92 3 49 22 53 99 59 52 74 31 92 43 42 23 44 9 82 47 7 40 12 9 3 55 37 85 46 22 84 52 98 41 21 77 63 17 62 91\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\nInna loves sleeping very much, so she needs n alarm clocks in total to wake up. Let's suppose that Inna's roo... | [{"input": "42\n28 87\n26 16\n59 90\n47 61\n28 83\n36 30\n67 10\n6 95\n9 49\n86 94\n52 24\n74 9\n86 24\n28 51\n25 99\n40 98\n57 33\n18 96\n43 36\n3 79\n4 86\n38 61\n25 61\n6 100\n58 81\n28 19\n64 4\n3 40\n2 56\n41 49\n97 100\n86 34\n42 36\n44 40\n14 85\n21 60\n76 99\n64 47\n69 13\n49 37\n97 37\n3 70\n", "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\nLittle X has met the following problem recently. \n\nLet's define f(x) as the sum of digits in decimal repres... | [{"input": "1000000000000000000\n", "output": "1000000000000000000 1999999999999999999"}, {"input": "1000000000000000000\n", "output": "1000000000000000000 1999999999999999999"}, {"input": "1000000000000000000\n", "output": "1000000000000000000 1999999999999999999"}, {"input": "1000000000000000000\n", "output": "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\nWabbit is playing a game with $n$ bosses numbered from $1$ to $n$. The bosses can be fought in any order. Eac... | [{"input": "70 2\n1 1 1 1 1 -1 -1 -1 -1 -1 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3\n", "output": "-1685\n"}, {"input": "10 3\n950 882 856 786 677 480 302 258 147 98\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\nRecently, a start up by two students of a state university of city F gained incredible popularity. Now it's t... | [{"input": "OVWIHIWVYXMVAAAATOXWOIUUHYXHIHHVUIOOXWHOXTUUMUUVHVWWYUTIAUAITAOMHXWMTTOIVMIVOTHOVOIOHYHAOXWAUVWAVIVM\n", "output": "NO\n"}, {"input": "QDPINBMCRFWXPDBFGOZVVOCEMJRUCTOADEWEGTVBVBFWWRPGYEEYGPRWWFBVBVTGEWEDAOTCURJMECOVVZOGFBDPXWFRCMBNIPDQ\n", "output": "NO\n"}, {"input": "OVWIHIWVYXMVAAAATOXWOIUUHYXHIHHVUIOOXW... | 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 2 or 3 consisting of lowercase English letters. If the length of the strin... | [{"input": "acc", "output": "cca\n"}, {"input": "acb", "output": "bca\n"}, {"input": "adb", "output": "bda\n"}, {"input": "`cb", "output": "bc`\n"}, {"input": "bc`", "output": "`cb\n"}, {"input": "cb`", "output": "`bc\n"}, {"input": "cba", "output": "abc\n"}, {"input": "cab", "output": "bac\n"}, {"input": "bac", "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\nWe have a pyramid with N steps, built with blocks. The steps are numbered 1 through N from top to bottom. For... | [{"input": "4\n-1 1 0 1 2 18 2", "output": "1\n"}, {"input": "4\n-2 1 0 1 2 18 2", "output": "1\n"}, {"input": "4\n1 12 1 -1 4 5 2", "output": "1\n"}, {"input": "4\n-1 5 5 0 8 2 0", "output": "5\n"}, {"input": "4\n-2 3 3 7 7 5 0", "output": "7\n"}, {"input": "4\n-2 3 3 7 6 1 0", "output": "6\n"}, {"input": "4\n0 2 0 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\n## Task:\n\nYou have to write a function `pattern` which returns the following Pattern(See Examples) upto des... | [{"input": "15\n3", "output": "[\"1 1 1 1\\n 2 2 2 2 2 2 \\n 3 3 3 3 3 3 \\n 4 ... | 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 two arrays: an array $a$ consisting of $n$ zeros and an array $b$ consisting of $n$ integers.\n... | [{"input": "17 10\n465 868 29 633 291 357 62 929 22 124 182 995 903 75 71 924 416\n", "output": "611\n"}, {"input": "1 1\n1000000000000\n", "output": "1000000000000\n"}, {"input": "7 4\n1 10000 1 1 1 1 10000\n", "output": "7500\n"}, {"input": "7 3\n50 17 81 25 42 39 96\n", "output": "92\n"}, {"input": "3 3\n14159 26535... | 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 problem at each moment you have a set of intervals. You can move from interval (a, b) from our set to... | [{"input": "20\n1 1208 1583\n1 -258 729\n1 -409 1201\n1 194 1938\n1 -958 1575\n1 -1466 1752\n2 1 2\n2 1 2\n2 6 5\n1 -1870 1881\n1 -2002 2749\n1 -2002 2984\n1 -2002 3293\n2 2 4\n2 8 10\n2 9 6\n1 -2002 3572\n1 -2002 4175\n1 -2002 4452\n1 -2002 4605\n", "output": "YES\nYES\nYES\nYES\nYES\nNO\n"}, {"input": "20\n1 1208 158... | 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\nSimilarly to the [previous kata](https://www.codewars.com/kata/string-subpattern-recognition-i/), you will ne... | [{"input": "\"babababababababa\"", "output": "[true]", "fn_name": "has_subpattern"}, {"input": "\"12aa13a21233A\"", "output": "[false]", "fn_name": "has_subpattern"}, {"input": "\"123A123a123a\"", "output": "[false]", "fn_name": "has_subpattern"}, {"input": "\"123a123a123a\"", "output": "[true]", "fn_name": "has_subpat... | 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\nGiven a matrix (H × W) which contains only 1 and 0, find the area of the largest square matrix which only con... | [{"input": "1 1\n1 0 -1 -1 1\n1 0 0 0 1\n0 -2 0 1 -1\n0 -1 0 2 0", "output": "0\n"}, {"input": "3 2\n-1 0 1 0 0\n1 0 0 -1 1\n-1 -1 0 1 1\n0 0 0 -2 1", "output": "1\n"}, {"input": "1 1\n0 0 -1 -1 1\n1 0 0 0 1\n0 -2 0 1 -1\n0 -1 0 2 0", "output": "1\n"}, {"input": "3 2\n-1 0 1 0 0\n1 0 0 -1 1\n-1 -1 0 1 2\n0 0 0 -2 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\nDrazil is playing a math game with Varda.\n\nLet's define <image> for positive integer x as a product of fact... | [{"input": "15\n989898989898989\n", "output": "777777777777777333333333333333322222222222222222222222222222\n"}, {"input": "15\n999999999999990\n", "output": "77777777777777333333333333333333333333333322222222222222\n"}, {"input": "15\n987654329876543\n", "output": "777777555533333333332222222222222\n"}, {"input": "12\... | 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## Overview\nResistors are electrical components marked with colorful stripes/bands to indicate both their re... | [{"input": "\"yellow violet brown silver\"", "output": "[\"470 ohms, 10%\"]", "fn_name": "decode_resistor_colors"}, {"input": "\"orange orange yellow gold\"", "output": "[\"330k ohms, 5%\"]", "fn_name": "decode_resistor_colors"}, {"input": "\"yellow violet orange gold\"", "output": "[\"47k ohms, 5%\"]", "fn_name": "dec... | 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 new delivery of clothing has arrived today to the clothing store. This delivery consists of $a$ ties, $b$ s... | [{"input": "100000\n100000\n100000\n100000\n1000\n1000\n", "output": "100000000\n"}, {"input": "100000\n100000\n100000\n100000\n1000\n1000\n", "output": "100000000\n"}, {"input": "100000\n100000\n100100\n100000\n1000\n1000\n", "output": "100000000\n"}, {"input": "100000\n100000\n100000\n100000\n1000\n1\n", "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\nYou are given n positive integers a_1, a_2, ..., a_{n}.\n\nFor every a_{i} you need to find a positive intege... | [{"input": "100\n822\n991\n907\n729\n120\n707\n197\n280\n444\n45\n590\n951\n338\n740\n502\n345\n969\n240\n710\n476\n530\n674\n327\n187\n890\n530\n626\n767\n178\n831\n819\n406\n413\n119\n855\n13\n17\n460\n708\n30\n364\n974\n32\n615\n231\n758\n39\n731\n288\n955\n897\n897\n365\n246\n209\n17\n836\n496\n916\n610\n961\n181\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\nAmong Johnny's numerous hobbies, there are two seemingly harmless ones: applying bitwise operations and sneak... | [{"input": "6\n4\n1 0 2 5\n6\n10 7 14 16 0 12\n2\n0 1\n3\n1 2 6\n6\n1 4 6 10 11 20\n2\n0 1023\n", "output": "-1\n-1\n1\n-1\n-1\n1023\n"}, {"input": "6\n4\n1 0 2 6\n6\n10 7 27 16 1 12\n2\n0 1\n3\n1 2 6\n6\n0 8 6 10 11 33\n2\n0 1023\n", "output": "-1\n11\n1\n-1\n-1\n1023\n"}, {"input": "6\n4\n1 0 2 5\n6\n10 7 14 16 0 12\... | 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 group of $n$ dancers rehearses a performance for the closing ceremony. The dancers are arranged in a row, t... | [{"input": "20 53 67\n1 2 1 2 0 0 0 2 2 2 1 0 0 2 0 0 0 1 1 2\n", "output": "413\n"}, {"input": "20 53 67\n1 2 1 2 0 0 0 2 2 2 1 0 0 2 0 0 0 1 1 2\n", "output": "413\n"}, {"input": "20 53 67\n1 2 1 2 0 0 0 2 2 2 1 0 0 2 0 0 1 1 1 2\n", "output": "427\n"}, {"input": "20 53 67\n1 2 1 2 0 0 0 2 2 2 1 0 0 2 0 0 1 2 1 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\nReziba has many magic gems. Each magic gem can be split into $M$ normal gems. The amount of space each magic ... | [{"input": "1000000000000000000 100\n", "output": "161502719\n"}, {"input": "1000000000000000000 100\n", "output": "161502719\n"}, {"input": "1000000000000000000 42\n", "output": "683499162\n"}, {"input": "1000000000000000000 69\n", "output": "864131130\n"}, {"input": "1000000000000000000 99\n", "output": "847914677\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'Twas the night before Christmas, and Santa's frantically setting up his new Christmas tree! There are n node... | [{"input": "4\n6 5\n1 2 -1\n1 3 1\n4 2 7\n6 3 0\n2 5 -1\n2 3 1\n2 5 0\n5 6 1\n6 1 1\n4 5 1\n5 3\n1 2 -1\n1 3 -1\n1 4 1\n4 5 -1\n2 4 0\n3 4 1\n2 3 1\n3 3\n1 2 -1\n1 3 -1\n2 2 0\n1 3 1\n2 3 0\n2 0\n1 2 1\n1 2 0\n", "output": "YES\n1 2 0\n1 3 1\n4 2 7\n6 3 0\n2 5 0\nYES\n1 2 1\n1 3 0\n1 4 1\n4 5 1\nYES\n1 2 1\n1 3 1\nYES\... | 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\nCount the pairs of length-N sequences consisting of integers between 1 and M (inclusive), A_1, A_2, \\cdots, ... | [{"input": "141421 356237\n", "output": "881613484\n"}, {"input": "500000 500000\n", "output": "869509376\n"}, {"input": "436426 479445\n", "output": "710501305\n"}, {"input": "148772 190081\n", "output": "685499830\n"}, {"input": "190629 433447\n", "output": "627318091\n"}, {"input": "47202 203497\n", "output": "37412... | 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 is crazy about round numbers. He especially likes the numbers divisible by 10^{k}.\n\nIn the given n... | [{"input": "1000000001 10\n", "output": "9\n"}, {"input": "1234567890 14\n", "output": "9\n"}, {"input": "1000999999 3\n", "output": "6\n"}, {"input": "1090090090 5\n", "output": "2\n"}, {"input": "1234567890 1\n", "output": "0\n"}, {"input": "1234567890 2\n", "output": "9\n"}, {"input": "1234567890 9\n", "output": "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\nAt Aizu Shingakujuku, students are divided into classes by conducting a proficiency test when they enter the ... | [{"input": "4\n100 217 28\n253 43 197\n18 34 24\n19 22 189\n2\n190 106 20\n66 72 171\n0", "output": "A\nA\nC\nB\nA\nA\n"}, {"input": "4\n100 137 28\n143 43 197\n18 34 24\n19 19 65\n2\n196 106 20\n66 72 171\n0", "output": "A\nA\nC\nC\nA\nA\n"}, {"input": "4\n111 273 20\n165 86 15\n80 41 202\n0 88 65\n2\n147 81 12\n119 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\nVadim loves decorating the Christmas tree, so he got a beautiful garland as a present. It consists of n light... | [{"input": "100\n13 92 99 100 89 6 64 32 36 40 62 30 53 31 60 4 54 83 10 59 15 67 47 93 70 41 78 34 20 69 1 74 39 16 95 48 25 80 21 85 50 33 88 71 75 73 77 87 7 5 90 28 14 96 49 57 68 22 8 27 37 86 51 94 11 66 55 29 63 91 45 65 97 23 52 17 81 42 46 35 24 19 44 43 9 84 26 82 2 18 76 56 3 38 72 61 58 98 12 79\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\nDasha logged into the system and began to solve problems. One of them is as follows:\n\nGiven two sequences a... | [{"input": "30 100 200\n102 108 122 116 107 145 195 145 119 110 187 196 140 174 104 190 193 181 118 127 157 111 139 175 173 191 181 105 142 166\n30 26 20 23 27 15 2 14 21 25 6 1 17 10 29 5 3 7 22 19 13 24 18 9 11 4 8 28 16 12\n", "output": "100 100 100 100 100 101 100 100 100 100 100 100 100 100 100 100 100 100 100 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\nLevko loves array a1, a2, ... , an, consisting of integers, very much. That is why Levko is playing with arra... | [{"input": "97 29\n2 78 82 356152\n2 14 29 430177\n1 59 84 3680\n1 49 89 -2247\n1 92 96 3701\n2 54 89 377271\n1 62 70 -507\n2 94 97 431563\n1 46 55 -9257\n1 51 83 1627\n1 10 20 6633\n1 17 34 -9263\n2 66 92 383251\n1 12 82 3884\n1 78 96 -5379\n2 13 35 424798\n1 68 91 2939\n2 80 84 214725\n1 61 85 -4390\n1 85 96 3106\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\nChef likes to travel very much. He plans some travel routes and wants to know their lengths. He hired you to ... | [{"input": "5\nDonetsk Kiev New-York Miami Hollywood\n9\nDonetsk Kiev 930\nKiev New-York 7507\nNew-York Miami 1764\nMiami Hollywood 28\nHollywood Miami 30\nMiami New-York 1764\nKiev Donetsk 550\nHollywood New-York 1736\nNew-York Hollywood 1738\n13\n5 Donetsk Kiev New-York Miami Hollywood\n5 Hlolywood Miami New-York Kie... | 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\nDoor's family is going celebrate Famil Doors's birthday party. They love Famil Door so they are planning to m... | [{"input": "21\n...CCC.....CC..C..C.C\n..CCC...CC...CC.CCC.C\n....C.C.C..CCC..C.C.C\n....CCC..C..C.CC.CCC.\n...CCC.C..C.C.....CCC\n.CCC.....CCC..C...C.C\nCCCC.C...CCC.C...C.CC\nC..C...C.CCC..CC..C..\nC...CC..C.C.CC..C.CC.\nCC..CCCCCCCCC..C....C\n.C..CCCC.CCCC.CCC...C\nCCC...CCC...CCC.C..C.\n.CCCCCCCC.CCCC.CC.C..\n.C.C.... | 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 sequence D_1, D_2, ..., D_N of length N.\nThe values of D_i are all distinct.\nDoes a tree wi... | [{"input": "15\n57\n62\n47\n45\n42\n74\n90\n75\n54\n50\n66\n63\n77\n87\n51\n", "output": "1 10\n1 11\n2 8\n2 15\n3 5\n3 9\n4 5\n4 10\n5 15\n6 12\n6 14\n7 13\n9 12\n11 13\n"}, {"input": "15\n57\n62\n47\n45\n42\n74\n90\n75\n54\n50\n66\n63\n77\n87\n51", "output": "1 10\n1 11\n2 8\n2 15\n3 5\n3 9\n4 5\n4 10\n5 15\n6 12\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\nLet's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the num... | [{"input": "36\n6\n165310\n6\n177978\n6\n211759\n6\n212643\n6\n229540\n6\n250029\n6\n211519\n6\n256097\n6\n163478\n5\n91505\n5\n79280\n6\n260629\n6\n128051\n6\n121972\n6\n261633\n6\n172044\n6\n119055\n6\n208323\n6\n149942\n6\n161236\n6\n177150\n6\n233766\n5\n97949\n6\n230107\n6\n175822\n6\n213545\n6\n232837\n6\n179166\... | 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\nGiven an integer array `arr`. Your task is to remove one element, maximize the product of elements. \... | [{"input": "[-1, -2, -3, 0, 1, 2, 3]", "output": "[-3]", "fn_name": "maximum_product"}, {"input": "[-1, -2, -3, 1, 2, 3]", "output": "[-1]", "fn_name": "maximum_product"}, {"input": "[0, -1, -2, -3, -4]", "output": "[0]", "fn_name": "maximum_product"}, {"input": "[0, -1, -2, -3, 4]", "output": "[-3]", "fn_name": "maxim... | 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\nAt an arcade, Takahashi is playing a game called RPS Battle, which is played as follows:\n - The player plays... | [{"input": "99901 2\n3193 1797 2772\nssrprrspsrprsrpsrprsssprrsrssrrprppprrrrrrrsprrrrsprsprsspsspprrrrpprsrprrrrpsspprrrspspsprprprprrpprppsrspprrsssssprsrrsrrsssppsprsrprpprpspppsprrspsspsppsrpspprpprsrsrssrrrrprspprpprrspssprsrrsppsrsrpssprsssprspppspspssrrpsrprpsrpprsrpppsprssssprsrrrrpsrprrrppsrrrrrsssrrsrprrrrrpp... | 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 next \"Data Structures and Algorithms\" lesson will be about Longest Increasing Subsequence (LIS for shor... | [{"input": "100\n102 157 177 149 138 193 19 74 127 156 128 122 6 101 154 92 24 188 51 89 18 77 112 100 65 11 113 173 79 124 102 81 11 171 114 43 60 168 44 86 87 82 177 8 12 181 139 121 140 28 108 17 173 63 18 4 148 125 117 153 193 180 188 142 46 75 163 126 128 22 32 163 164 1 161 19 162 59 190 14 93 85 93 37 73 64 64 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\nAhmed and Mostafa used to compete together in many programming contests for several years. Their coach Fegla ... | [{"input": "14 14\n6 -1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 2 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 -1\n1 2 3 4 5 6 7 8 9 10 11 12 13 14\n", "output": "83\n"}, {"input": "14 14\n6 -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\n«Bersoft» company is working on a new version of its most popular text editor — Bord 2010. Bord, like many ot... | [{"input": "713,572,318,890,577,657,646,146,373,783,392,229,455,871,20,593,573,336,26,381,280,916,907,732,820,713,111,840,570,446,184,711,481,399,788,647,492,15,40,530,549,506,719,782,126,20,778,996,712,761,9,74,812,418,488,175,103,585,900,3,604,521,509,513,145,708,990,361,682,827,791,22,596,780,596,385,450,643,118,496... | 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\nPiegirl was asked to implement two table join operation for distributed database system, minimizing the netwo... | [{"input": "10 10\n933168403 308417110 823216696 818565876 448948583 884328249 809244579 473034231 407137956 871269623\n1302355559 145998557 644003076 138712151 839886312 479712343 709513279 138285801 858528549 643830064\n", "output": "11375801438\n"}, {"input": "10 10\n933168403 308417110 823216696 818565876 448948583... | 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 $n$ rectangles, each of height $1$. Each rectangle's width is a power of $2$ (i. e. it can be r... | [{"input": "2\n5 20\n1 2 16 2 8\n6 12\n4 8 8 4 2 8\n", "output": "2\n3\n"}, {"input": "2\n5 13\n2 2 8 2 8\n6 23\n1 16 8 2 2 1\n", "output": "2\n2\n"}, {"input": "2\n5 16\n1 2 8 4 8\n6 10\n2 8 8 2 2 8\n", "output": "\n2\n3\n"}, {"input": "2\n5 16\n1 2 8 4 8\n6 10\n2 8 8 2 2 8\n", "output": "2\n3\n"}, {"input": "2\n5 13\... | 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 social network for dogs called DH (DogHouse) has k special servers to recompress uploaded videos of cute ca... | [{"input": "10 10\n999999991 1000000000\n999999992 1000000000\n999999993 1000000000\n999999994 1000000000\n999999995 1000000000\n999999996 1000000000\n999999997 1000000000\n999999998 1000000000\n999999999 1000000000\n1000000000 1000000000\n", "output": "1999999991\n1999999992\n1999999993\n1999999994\n1999999995\n199999... | 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\nEverybody knows that the $m$-coder Tournament will happen soon. $m$ schools participate in the tournament, an... | [{"input": "100 10 1\n62 68 24 82 66 47 73 43 85 23 78 13 94 14 84 17 27 5 72 48 59 46 97 81 88 9 76 69 11 15 12 61 70 7 91 34 99 52 54 57 56 64 55 67 40 38 74 25 30 4 22 92 33 3 86 45 37 26 87 53 75 71 58 96 98 20 36 1 95 63 10 49 19 41 89 21 39 100 93 42 32 90 28 83 6 29 60 65 44 35 18 16 8 50 80 31 51 2 77 79\n6 6 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\n# Pythagorean Triples\n\nA Pythagorean triplet is a set of three numbers a, b, and c where `a^2 + b^2 = c^2`.... | [{"input": "1440600", "output": "[[49, 168, 175]]", "fn_name": "pythagorean_triplet"}, {"input": "907200", "output": "[[42, 144, 150]]", "fn_name": "pythagorean_triplet"}, {"input": "120120", "output": "[[33, 56, 65]]", "fn_name": "pythagorean_triplet"}, {"input": "192720", "output": "[[48, 55, 73]]", "fn_name": "pytha... | 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\nOne very experienced problem writer decided to prepare a problem for April Fools Day contest. The task was ve... | [{"input": "255+255+255+255+255+255+255+255+255+255\n", "output": "-42450\n"}, {"input": "101+200+195+231+107+222+146+254+160+209\n", "output": "-43175\n"}, {"input": "101+200+195+231+107+222+146+254+160+209\n", "output": "-43175\n"}, {"input": "255+255+255+255+255+255+255+255+255+255\n", "output": "-42450\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\nRecently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation p of length n, and Skynyrd bough... | [{"input": "3 6 3\n2 1 3\n1 2 3 1 2 3\n1 6\n2 6\n3 5\n", "output": "110\n"}, {"input": "3 6 3\n2 1 3\n1 2 3 2 2 3\n1 5\n2 6\n3 5\n", "output": "100\n"}, {"input": "3 6 3\n2 1 3\n2 2 3 1 2 3\n1 6\n2 6\n3 5\n", "output": "110\n"}, {"input": "3 6 3\n2 1 3\n1 2 1 1 2 3\n1 5\n2 6\n3 5\n", "output": "010\n"}, {"input": "3 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\n# Task\n Your task is to find the smallest number which is evenly divided by all numbers between `m` and `n` ... | [{"input": "1\n25", "output": "[26771144400]", "fn_name": "mn_lcm"}, {"input": "10\n20", "output": "[232792560]", "fn_name": "mn_lcm"}, {"input": "1\n10", "output": "[2520]", "fn_name": "mn_lcm"}, {"input": "24\n25", "output": "[600]", "fn_name": "mn_lcm"}, {"input": "1\n5", "output": "[60]", "fn_name": "mn_lcm"}, {"in... | 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\nPetya and Vasya are tossing a coin. Their friend Valera is appointed as a judge. The game is very simple. Fir... | [{"input": "100 100 1 1\n", "output": "4950\n2 1\n3 1\n3 2\n4 1\n4 2\n4 3\n5 1\n5 2\n5 3\n5 4\n6 1\n6 2\n6 3\n6 4\n6 5\n7 1\n7 2\n7 3\n7 4\n7 5\n7 6\n8 1\n8 2\n8 3\n8 4\n8 5\n8 6\n8 7\n9 1\n9 2\n9 3\n9 4\n9 5\n9 6\n9 7\n9 8\n10 1\n10 2\n10 3\n10 4\n10 5\n10 6\n10 7\n10 8\n10 9\n11 1\n11 2\n11 3\n11 4\n11 5\n11 6\n11 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 are given an array of N integers a1, a2, ..., aN and an integer K. Find the number of such unordered pair... | [{"input": "1 \n4 192\n14 -1 2 8", "output": "170 1\n"}, {"input": "1 \n4 279\n14 -1 2 8", "output": "257 1\n"}, {"input": "1 \n4 107\n1 -1 -1 2", "output": "104 1\n"}, {"input": "1 \n4 253\n14 -1 2 8", "output": "231 1\n"}, {"input": "1 \n4 51\n0 -1 -1 13", "output": "38 1\n"}, {"input": "1 \n4 51\n-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\nKsusha the Squirrel is standing at the beginning of a straight road, divided into n sectors. The sectors are ... | [{"input": "10 3\n..........\n", "output": "YES\n"}, {"input": "10 3\n..........\n", "output": "YES\n"}, {"input": "10 1\n..........\n", "output": "YES\n"}, {"input": "10 4\n..........\n", "output": "YES\n"}, {"input": "10 2\n..........\n", "output": "YES\n"}, {"input": "8 2\n..........\n", "output": "YES\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 has a sequence a consisting of n integers a_1, a_2, ..., a_n. Vasya may pefrom the following operation:... | [{"input": "5\n1000000000000000000 352839520853234088 165431853141398699 753467583475385837 895062156280564685\n", "output": "4\n"}, {"input": "5\n1000000000000000000 352839520853234088 257894004782222768 753467583475385837 895062156280564685\n", "output": "4\n"}, {"input": "5\n1000000000000000000 352839520853234088 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\nPlease notice the unusual memory limit of this problem.\n\nOrac likes games. Recently he came up with the new... | [{"input": "5 5 3\n01011\n10110\n01101\n11010\n00101\n2 1 -1\n1 2 3\n5 5 3\n", "output": "1\n0\n1\n"}, {"input": "5 5 3\n00011\n10110\n01101\n11010\n00101\n2 1 -1\n1 2 3\n5 5 3\n", "output": "1\n1\n1\n"}, {"input": "5 5 3\n01011\n10110\n01101\n11010\n10101\n2 1 4\n1 2 3\n5 5 3\n", "output": "1\n0\n1\n"}, {"input": "5 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\nThe only difference between the two versions is that this version asks the maximal possible answer.\n\nHomer ... | [{"input": "15\n3 5 2 5 3 2 2 5 5 4 5 5 1 3 1\n", "output": "14\n"}, {"input": "11\n2 3 10 3 3 8 9 2 11 10 3\n", "output": "11\n"}, {"input": "11\n10 5 8 8 2 7 9 3 5 1 10\n", "output": "11\n"}, {"input": "8\n1 2 4 1 4 5 4 4\n", "output": "8\n"}, {"input": "7\n1 1 2 2 3 3 3\n", "output": "6\n"}, {"input": "7\n1 2 3 4 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\nPalindrome\n\nProblem Statement\n\nFind the number of palindromes closest to the integer n.\n\nNote that the ... | [{"input": "4752", "output": "4774\n"}, {"input": "8517", "output": "8558\n"}, {"input": "3483", "output": "3443\n"}, {"input": "1868", "output": "1881\n"}, {"input": "2667", "output": "2662\n"}, {"input": "3332", "output": "3333\n"}, {"input": "4989", "output": "4994\n"}, {"input": "5975", "output": "5995\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\nYour Goal is to create a function that takes two strings, a guess and a phone number. \n\nBased on the guess... | [{"input": "\"012345\"", "output": "[\"123-451-2345\"]", "fn_name": "guess_my_number"}, {"input": "\"01234\"", "output": "[\"123-4#1-234#\"]", "fn_name": "guess_my_number"}, {"input": "\"0123\"", "output": "[\"123-##1-23##\"]", "fn_name": "guess_my_number"}, {"input": "\"012\"", "output": "[\"12#-##1-2###\"]", "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 and B are preparing themselves for programming contests.\n\nAn important part of preparing for a competitio... | [{"input": "500000 500000\n", "output": "333333\n"}, {"input": "250000 500000\n", "output": "250000\n"}, {"input": "500000 250000\n", "output": "250000\n"}, {"input": "231646 398487\n", "output": "210044\n"}, {"input": "332019 281112\n", "output": "204377\n"}, {"input": "473686 122443\n", "output": "122443\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\nAs the first step in algebra, students learn quadratic formulas and their factorization. Often, the factoriza... | [{"input": "2 5 4\n1 0 1\n10 -7 -1\n2 0 -5\n0 0 0", "output": "Impossible\nImpossible\nImpossible\nImpossible\n"}, {"input": "4 5 2\n1 1 1\n11 -10 0\n1 0 -3\n0 0 0", "output": "Impossible\nImpossible\n11 -10 1 0\nImpossible\n"}, {"input": "4 5 4\n2 0 1\n10 -7 1\n1 -1 -1\n0 0 0", "output": "Impossible\nImpossible\n5 -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\nIt's a Pokemon battle! Your task is to calculate the damage that a particular move would do using the followi... | [{"input": "\"electric\"\n\"fire\"\n100\n100", "output": "[50]", "fn_name": "calculate_damage"}, {"input": "\"grass\"\n\"electric\"\n57\n19", "output": "[150]", "fn_name": "calculate_damage"}, {"input": "\"grass\"\n\"water\"\n100\n100", "output": "[100]", "fn_name": "calculate_damage"}, {"input": "\"fire\"\n\"electric\... | 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 plays a well-known computer game (we won't mention its name). In this game, he can craft tools of tw... | [{"input": "4\n4 4\n1000000000 0\n12 15\n8 7\n", "output": "2\n0\n9\n5\n"}, {"input": "4\n4 4\n1010000000 0\n12 15\n8 7\n", "output": "2\n0\n9\n5\n"}, {"input": "4\n4 4\n1000000000 0\n7 15\n8 7\n", "output": "2\n0\n7\n5\n"}, {"input": "4\n4 4\n1000000000 0\n7 15\n8 7\n", "output": "2\n0\n7\n5\n"}, {"input": "1\n1319 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\nHeidi has finally found the mythical Tree of Life – a legendary combinatorial structure which is said to cont... | [{"input": "10\n5 1\n1 2\n9 1\n10 8\n6 3\n8 5\n2 7\n2 3\n10 4\n", "output": "10\n"}, {"input": "10\n5 1\n1 2\n9 5\n10 5\n6 3\n8 10\n2 7\n2 3\n1 4\n", "output": "11\n"}, {"input": "10\n5 1\n1 2\n9 5\n10 5\n6 3\n8 10\n2 7\n1 3\n1 4\n", "output": "12\n"}, {"input": "10\n5 1\n1 2\n9 5\n10 5\n6 3\n8 10\n2 7\n1 3\n2 4\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\nA popular reality show is recruiting a new cast for the third season! $n$ candidates numbered from $1$ to $n$... | [{"input": "34 5\n2 2 5 4 3 1 3 5 3 1 3 1 3 5 5 2 1 3 3 3 1 1 1 4 5 1 3 2 5 5 2 1 2 2\n1357 797 4642 4072 3953 4020 207 344 1412 4061 400 214 708 389 567 3294 1336 3746 1513 3539 4220 4720 329 4516 1741 1744 2537 3963 4941 664 1169 4512 3358 4144\n-4668 -1085 109 -899 769 -1132 -2587 1503 760 -2869 4020 -3282 2208 -232... | 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 plays a computer game (yet again). In this game, he fights monsters using magic spells.\n\nThere are... | [{"input": "6\n1 5\n0 10\n1 -5\n1 14\n1 11\n0 -10\n", "output": "5\n25\n10\n34\n59\n39\n"}, {"input": "6\n1 5\n0 10\n1 -5\n0 14\n1 11\n0 -10\n", "output": "5\n25\n10\n24\n49\n39\n"}, {"input": "6\n1 5\n0 10\n1 -5\n1 14\n1 16\n0 -10\n", "output": "5\n25\n10\n34\n66\n46\n"}, {"input": "6\n1 5\n0 10\n1 -5\n0 5\n1 11\n0 -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\nLet's call an array good if there is an element in the array that equals to the sum of all other elements. Fo... | [{"input": "4\n500000 500000 1000000 1000000\n", "output": "2\n3 4 \n"}, {"input": "4\n500000 500000 1000000 1000000\n", "output": "2\n3 4\n"}, {"input": "4\n500000 251993 1000000 1000000\n", "output": "0\n\n"}, {"input": "6\n4 7 1 1 1 1\n", "output": "5\n2 3 4 5 6 \n"}, {"input": "4\n2 1000000 1000000 14\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\nIn Aizuwakamatsu Village, which is located far north of Aizuwakamatsu City, a bridge called \"Yabashi\" is th... | [{"input": "3\n125 -1 15\n108 12 25\n149 10 50\n3\n32 -1 10\n70 10 41\n22 67 84\n0", "output": "NG\nOK\n"}, {"input": "3\n125 -1 15\n108 8 25\n246 10 42\n3\n32 -1 10\n70 10 41\n22 67 129\n0", "output": "NG\nOK\n"}, {"input": "3\n125 -1 15\n108 7 25\n246 10 42\n3\n32 -1 10\n70 10 41\n22 67 129\n0", "output": "NG\nOK\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\nValera loves to participate in competitions. Especially in programming contests. Today he has participated in... | [{"input": "1000 1000 1 1000 1000000 1000000\n", "output": "1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ... | code_stdio |
[
{
"content": "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\nAssume we take a number `x` and perform any one of the following operations:\n```Pearl\na) Divide x by 3 (if ... | [{"input": "[558, 744, 1488, 279, 2232, 1116]", "output": "[[279, 558, 1116, 2232, 744, 1488]]", "fn_name": "solve"}, {"input": "[12, 3, 9, 4, 6, 8]", "output": "[[9, 3, 6, 12, 4, 8]]", "fn_name": "solve"}, {"input": "[4, 8, 6, 3, 12, 9]", "output": "[[9, 3, 6, 12, 4, 8]]", "fn_name": "solve"}, {"input": "[3000, 9000]"... | 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\nWe have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents ... | [{"input": "RRS\n", "output": "2\n"}, {"input": "SSS\n", "output": "0\n"}, {"input": "RSR\n", "output": "1\n"}, {"input": "SRS\n", "output": "1\n"}, {"input": "SSR\n", "output": "1\n"}, {"input": "RRR\n", "output": "3\n"}, {"input": "RSS\n", "output": "1\n"}, {"input": "SRR\n", "output": "2\n"}, {"input": "SRR", "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\nYou are given a marine area map that is a mesh of squares, each representing either a land or sea area. Figur... | [{"input": "1 1\n0\n2 1\n0 1\n1 0\n3 2\n1 1 1\n1 1 1\n5 4\n1 0 1 0 0\n1 -1 1 0 0\n1 1 1 0 1\n1 0 0 1 0\n5 4\n1 1 1 0 2\n1 0 1 0 1\n0 0 1 0 1\n2 0 1 1 1\n5 5\n1 0 1 0 1\n0 0 1 0 0\n1 1 1 0 1\n0 0 1 0 0\n1 0 0 1 1\n0 0", "output": "0\n1\n0\n1\n1\n1\n5\n"}, {"input": "1 1\n0\n2 1\n0 1\n1 0\n3 2\n1 1 1\n1 1 1\n5 4\n1 0 1 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\nVova again tries to play some computer card game.\n\nThe rules of deck creation in this game are simple. Vova... | [{"input": "100 72\n8 8 7 9 6 1 4 5 3 7 5 10 5 4 1 3 4 1 3 1 6 6 4 5 4 5 6 1 10 7 9 1 6 10 6 6 9 3 3 4 5 9 4 9 8 1 5 9 3 7 1 8 5 2 1 1 7 7 7 6 6 4 2 9 10 2 8 3 1 1 4 8 5 9 7 10 9 4 2 3 7 7 6 7 8 5 1 3 8 5 1 8 9 10 3 7 1 8 10 5\n", "output": "4549\n"}, {"input": "100 72\n8 8 7 9 6 1 4 5 3 7 5 10 5 4 1 3 4 1 3 1 6 6 4 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\nYour job is to build a function which determines whether or not there are double characters in a string (incl... | [{"input": "\"a!@\\u20ac\\u00a3#$%^&*()_-+=}]{[|':;?/>.<,~\"", "output": "[false]", "fn_name": "double_check"}, {"input": "\"a b c d e f g h i h k\"", "output": "[false]", "fn_name": "double_check"}, {"input": "\"a 11 c d\"", "output": "[true]", "fn_name": "double_check"}, {"input": "\"AabBcC\"", "output": "[true]", "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\nThe beauty of a sequence a of length n is defined as a_1 \\oplus \\cdots \\oplus a_n, where \\oplus denotes t... | [{"input": "32\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 1 0 0", "output": "268435465\n"}, {"input": "32\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0", "output": "33554438\n"}, {"input": "32\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0", "output": "147483634"}, {... | 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\nOn a circle lie $2n$ distinct points, with the following property: however you choose $3$ chords that connect... | [{"input": "4\n6 2\n8 2\n1 4\n1 1\n2 1\n2 0\n10 2\n14 12\n4 20\n9 10\n13 18\n30 18\n11 7\n", "output": "12\n0\n1\n32\n"}, {"input": "4\n5 2\n8 2\n1 4\n1 1\n2 1\n2 0\n15 1\n13 12\n4 20\n9 10\n13 18\n30 18\n13 12\n", "output": "7\n0\n1\n91\n"}, {"input": "4\n7 2\n14 2\n1 4\n1 1\n2 1\n0 0\n10 6\n19 2\n3 20\n8 10\n16 18\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\nYou are given a string s consisting only of characters 0 and 1. A substring [l, r] of s is a string s_{l}s_{l... | [{"input": "65\n11001000110001001011011110111100000000101001001010101111000100010\n", "output": "48\n"}, {"input": "65\n11001000110001001011011110111100000000101001001010101111000100010\n", "output": "48\n"}, {"input": "65\n11001000110101001011011110111100000000101001001010101111000100010\n", "output": "56\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\nThere is a square matrix n × n, consisting of non-negative integer numbers. You should find such a way on it ... | [{"input": "10\n10 8 6 5 9 8 2 5 3 2\n3 1 8 10 8 10 5 10 7 8\n5 9 7 7 4 9 7 2 5 2\n5 9 9 5 4 2 6 6 8 1\n10 6 9 9 10 5 6 3 5 9\n6 7 10 3 1 4 3 6 7 6\n10 10 4 7 4 4 8 2 7 4\n10 5 8 2 2 7 4 4 1 4\n8 4 6 10 10 6 1 3 3 1\n9 9 7 2 11 5 1 8 6 3\n", "output": "1\nDRDDDRRDDDRRDRDRRR\n"}, {"input": "10\n10 8 6 5 9 8 2 5 3 2\n3 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\nPavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that ... | [{"input": "2\n282238675 111160538 526707498 169652181\n", "output": "14299383119546189\n"}, {"input": "2\n229872385 40870434 715428884 160550871\n", "output": "46761413035493300\n"}, {"input": "2\n186213023 111160538 526707498 169652181\n", "output": "6881807548140320\n"}, {"input": "2\n229872385 25548581 715428884 16... | 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 fact, the problems E1 and E2 do not have much in common. You should probably think of them as two separate... | [{"input": "6\n4\n2 11 8 -1\n3\n10 2 1\n3\n3 10 2\n4\n1 2 1 -1\n4\n4 0 1 6\n5\n1 5 1 -1 0\n", "output": "1\n0\n0\n0\n1\n1\n"}, {"input": "6\n4\n2 11 8 -1\n3\n10 2 1\n3\n5 10 2\n4\n1 2 1 -1\n4\n1 0 1 6\n5\n1 5 1 -1 0\n", "output": "1\n0\n0\n0\n0\n1\n"}, {"input": "6\n4\n3 7 8 15\n3\n3 2 1\n3\n3 0 0\n4\n-1 2 1 -1\n4\n2 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\nHiroshi:? D-C'KOPUA\n\nPeter: What's wrong, Dr. David? I'm used to shouting something I don't understand, but... | [{"input": "?DKC'-OPUB", "output": "PES WP E EIERD\n"}, {"input": "?DKC'-OPUA", "output": "PES WP E EIER\n"}, {"input": ".UPDL'BCN?", "output": "EP.PD IP?DSPP\n"}, {"input": ".UQDL'BCN?", "output": "EPF'K PEWLEPP\n"}, {"input": "?NDBULDQ'.", "output": "PEERED DKT,EE\n"}, {"input": ".'QDLUBDN?", "output": "EPPHD IHLKEPP... | 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’s try a dice puzzle. The rules of this puzzle are as follows.\n\n1. Dice with six faces as shown in Figur... | [{"input": "4\n0 0 1\n0 1 0\n0 2 2\n0 2 2\n1 2 2\n6 -1 0\n0 7 4\n0 4 1\n4 1 0\n6 1 0\n12 -1 0\n4 1 -2\n1 -1 0\n1 2 0\n0 -1 -1\n5 1 2\n10 0 2\n-2 1 -2\n3 -1 -1\n-1 6 -2\n0 0 -1\n0 1 0\n-2 1 0\n3 0 0", "output": "0\n0\n0\n0\n"}, {"input": "4\n0 0 1\n0 1 0\n0 2 2\n0 2 2\n1 2 2\n6 -1 0\n0 7 4\n0 4 1\n4 1 0\n6 1 0\n12 -2 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\nImplement a function which \ncreates a **[radix tree](https://en.wikipedia.org/wiki/Radix_tree)** (a space-op... | [{"input": "\"ape\"\n\"apple\"\n\"applet\"\n\"appendix\"", "output": "[{\"ap\": {\"e\": {}, \"p\": {\"le\": {\"t\": {}}, \"endix\": {}}}}]", "fn_name": "radix_tree"}, {"input": "\"abc\"\n\"def\"\n\"ghi\"\n\"jklm\"\n\"nop\"", "output": "[{\"abc\": {}, \"def\": {}, \"ghi\": {}, \"jklm\": {}, \"nop\": {}}]", "fn_name": "r... | 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\nImplement a function to calculate the sum of the numerical values in a nested list. For example :\n\n```pytho... | [{"input": "[[[[], [], [[[[[[[[[[]]]]]]]]]]], [], [], [[[], [[]]]]], []]", "output": "[0]", "fn_name": "sum_nested"}, {"input": "[1, [1], [1, [1]], [1, [1], [1, [1]]]]", "output": "[8]", "fn_name": "sum_nested"}, {"input": "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]", "output": "[55]", "fn_name": "sum_nested"}, {"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\nConsider the numbers `6969` and `9116`. When you rotate them `180 degrees` (upside down), these numbers remai... | [{"input": "60000\n130000", "output": "[55]", "fn_name": "solve"}, {"input": "60000\n70000", "output": "[15]", "fn_name": "solve"}, {"input": "1000\n10000", "output": "[20]", "fn_name": "solve"}, {"input": "10000\n15000", "output": "[6]", "fn_name": "solve"}, {"input": "15000\n20000", "output": "[9]", "fn_name": "solve... | 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 has spent the entire day preparing problems for you. Now he has to sleep for at least $a$ minutes to... | [{"input": "7\n10 3 6 4\n11 3 6 4\n5 9 4 10\n6 5 2 3\n1 1 1 1\n3947465 47342 338129 123123\n234123843 13 361451236 361451000\n", "output": "27\n27\n9\n-1\n1\n6471793\n358578060125049\n"}, {"input": "7\n10 3 6 4\n11 3 6 0\n5 9 4 10\n6 5 2 3\n1 1 1 1\n3947465 47342 338129 123123\n234123843 13 361451236 361451000\n", "out... | 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 and Aoki will play a game. They will repeatedly play it until one of them have N wins in total.\n\n... | [{"input": "100001 31 41 28", "output": "904789367\n"}, {"input": "000001 31 41 28", "output": "388888893\n"}, {"input": "000011 31 41 28", "output": "339871354\n"}, {"input": "010001 31 41 28", "output": "24577229\n"}, {"input": "100000 31 41 28", "output": "104136146"}, {"input": "14 110 0 -10", "output": "545454562\... | 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 three strings $a$, $b$ and $c$ of the same length $n$. The strings consist of lowercase English... | [{"input": "4\naaa\nbbb\nccc\nabc\nbca\nbca\naabb\nbbaa\nbaba\nimi\nmii\niim\n", "output": "NO\nYES\nYES\nNO\n"}, {"input": "4\naaa\nbbb\nccc\nabc\nbca\ncca\naabb\nbbaa\nbaba\niim\nmii\niim\n", "output": "NO\nNO\nYES\nYES\n"}, {"input": "4\naa`\ncbc\ncac\ncba\naca\ncca\nbaab\nbdaa\nabab\niil\nmih\nimj\n", "output": "YE... | 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\nPalo Alto is an unusual city because it is an endless coordinate line. It is also known for the office of Lyf... | [{"input": "1 4\n2 4 6 10 15\n1 1 1 1 0\n", "output": "0 0 0 1 "}, {"input": "1 4\n2 4 6 10 14\n1 1 1 1 0\n", "output": "0 0 0 1\n"}, {"input": "1 4\n3 4 6 10 15\n1 1 1 1 0\n", "output": "0 0 0 1\n"}, {"input": "1 4\n2 4 6 10 27\n1 1 1 1 0\n", "output": "0 0 0 1\n"}, {"input": "1 4\n2 4 6 10 15\n1 1 1 1 0\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\nThere is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., ... | [{"input": "128 2\n35 6 2 5 0 4 2 5", "output": "127\n"}, {"input": "163 2\n35 6 2 5 0 4 2 5", "output": "162\n"}, {"input": "128 6\n35 6 2 5 0 5 2 5", "output": "26\n"}, {"input": "8 3\n14 3 1 8 4 6 2 5", "output": "4\n"}, {"input": "8 2\n14 5 1 4 2 6 2 5", "output": "7\n"}, {"input": "8 3\n14 5 1 8 4 6 2 5", "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\nDo you know Just Odd Inventions? The business of this company is to \"just odd inventions\". Here, it is abbr... | [{"input": "6\n12 13\n5 9\n2 4\n10 12\n6 12\n6 11", "output": "5\n"}, {"input": "6\n12 38\n5 9\n2 4\n10 12\n6 12\n11 9", "output": "5\n"}, {"input": "6\n12 13\n5 9\n2 2\n10 12\n6 12\n6 11", "output": "5\n"}, {"input": "6\n12 38\n5 9\n0 4\n10 12\n6 12\n11 9", "output": "5\n"}, {"input": "6\n12 9\n5 9\n2 4\n10 12\n10 12\... | 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\nPeter wrote on the board a strictly increasing sequence of positive integers a_1, a_2, ..., a_{n}. Then Vasil... | [{"input": "98\n?\n?0\n2?\n6?\n6?\n69\n??\n??\n96\n1?2\n??3\n104\n??4\n1?9\n??2\n18?\n?01\n205\n?19\n244\n??8\n?5?\n?5?\n276\n??3\n???\n???\n?28\n?3?\n3??\n??8\n355\n4?0\n4??\n?10\n??1\n417\n4?9\n?3?\n4?4\n?61\n?8?\n???\n507\n?2?\n???\n??6\n5?7\n540\n5?9\n???\n?7?\n5??\n591\n?9?\n6?0\n620\n??4\n??1\n?35\n65?\n65?\n6?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\nExample\n\nInput\n\n3\n\n\nOutput\n\n1### Format: Read the inputs from stdin solve the problem and write the ... | [{"input": "20093", "output": "276\n"}, {"input": "5663", "output": "100\n"}, {"input": "1761", "output": "292\n"}, {"input": "2283", "output": "36\n"}, {"input": "1253", "output": "88\n"}, {"input": "1203", "output": "20\n"}, {"input": "1457", "output": "44\n"}, {"input": "2031", "output": "78\n"}, {"input": "2941", "... | 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're given an array $a$ of $n$ integers, such that $a_1 + a_2 + \\cdots + a_n = 0$.\n\nIn one operation, yo... | [{"input": "7\n4\n-3 5 -3 1\n2\n1 -1\n4\n-3 2 -3 4\n4\n-1 1 1 -1\n7\n-5 7 -6 -4 17 -13 4\n6\n-1000000000 -1000000000 -1000000000 1000000000 1000000000 1000000000\n1\n0\n", "output": "3\n0\n4\n1\n8\n3000000000\n0\n"}, {"input": "7\n4\n-3 5 -3 1\n2\n1 -1\n4\n-3 2 -3 4\n4\n-1 1 1 -1\n7\n-5 7 -6 -4 17 -13 4\n6\n-1000000000... | 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\n\nCryptography is all the rage at xryuseix's school. Xryuseix, who lives in a grid of cities, has co... | [{"input": "5\nAMazA", "output": "3\nAAA\n"}, {"input": "5\nAMAza", "output": "3\nAAA\n"}, {"input": "5\nAMBza", "output": "3\nAAA\n"}, {"input": "5\nAaBzM", "output": "3\nAAA\n"}, {"input": "5\nAazBM", "output": "3\nAAA\n"}, {"input": "5\nazAMA", "output": "3\nAAA\n"}, {"input": "5\nALBza", "output": "3\nAAA\n"}, {"in... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.