diff --git "a/MBPP.json" "b/MBPP.json" deleted file mode 100644--- "a/MBPP.json" +++ /dev/null @@ -1,7752 +0,0 @@ -[ - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 0, - "prompt": "Write a python function to remove first and last occurrence of a given character from the string.", - "code": "def remove_Occ(s,ch): \n for i in range(len(s)): \n if (s[i] == ch): \n s = s[0 : i] + s[i + 1:] \n break\n for i in range(len(s) - 1,-1,-1): \n if (s[i] == ch): \n s = s[0 : i] + s[i + 1:] \n break\n return s ", - "test_imports": [], - "test_list": [ - "assert remove_Occ(\"hello\",\"l\") == \"heo\"", - "assert remove_Occ(\"abcda\",\"a\") == \"bcd\"", - "assert remove_Occ(\"PHP\",\"P\") == \"H\"" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "hello\nl\n", - "abcda\na\n", - "PHP\nP\n" - ], - "test_output": [ - "heo\n", - "bcd\n", - "H\n" - ], - "example_input": [ - "hello\nl\n", - "abcda\na\n" - ], - "example_output": [ - "heo\n", - "bcd\n" - ], - "question": "Original problem description:\nWrite a python function to remove first and last occurrence of a given character from the string.\nWe have its functional test sample:\nassert remove_Occ(\"hello\",\"l\") == \"heo\"\nassert remove_Occ(\"abcda\",\"a\") == \"bcd\"\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nhello\nl\n\nOutput:\nheo\n\n\nExample 2:\nInput:\nabcda\na\n\nOutput:\nbcd\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 1, - "prompt": "Write a function to sort a given matrix in ascending order according to the sum of its rows.", - "code": "def sort_matrix(M):\n result = sorted(M, key=sum)\n return result", - "test_imports": [], - "test_list": [ - "assert sort_matrix([[1, 2, 3], [2, 4, 5], [1, 1, 1]])==[[1, 1, 1], [1, 2, 3], [2, 4, 5]]", - "assert sort_matrix([[1, 2, 3], [-2, 4, -5], [1, -1, 1]])==[[-2, 4, -5], [1, -1, 1], [1, 2, 3]]", - "assert sort_matrix([[5,8,9],[6,4,3],[2,1,4]])==[[2, 1, 4], [6, 4, 3], [5, 8, 9]]" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 2 3\n2 4 5\n1 1 1\n", - "1 2 3\n-2 4 -5\n1 -1 1\n", - "5 8 9\n6 4 3\n2 1 4\n" - ], - "test_output": [ - "1 1 1\n1 2 3\n2 4 5\n", - "-2 4 -5\n1 -1 1\n1 2 3\n", - "2 1 4\n6 4 3\n5 8 9\n" - ], - "example_input": [ - "1 2 3\n2 4 5\n1 1 1\n", - "1 2 3\n-2 4 -5\n1 -1 1\n" - ], - "example_output": [ - "1 1 1\n1 2 3\n2 4 5\n", - "-2 4 -5\n1 -1 1\n1 2 3\n" - ], - "question": "Original problem description:\nWrite a function to sort a given matrix in ascending order according to the sum of its rows.\nWe have its functional test sample:\nassert sort_matrix([[1, 2, 3], [2, 4, 5], [1, 1, 1]])==[[1, 1, 1], [1, 2, 3], [2, 4, 5]]\nassert sort_matrix([[1, 2, 3], [-2, 4, -5], [1, -1, 1]])==[[-2, 4, -5], [1, -1, 1], [1, 2, 3]]\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 2 3\n2 4 5\n1 1 1\n\nOutput:\n1 1 1\n1 2 3\n2 4 5\n\n\nExample 2:\nInput:\n1 2 3\n-2 4 -5\n1 -1 1\n\nOutput:\n-2 4 -5\n1 -1 1\n1 2 3\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 2, - "prompt": "Write a python function to find the volume of a triangular prism.", - "code": "def find_Volume(l,b,h) : \n return ((l * b * h) / 2) ", - "test_imports": [], - "test_list": [ - "assert find_Volume(10,8,6) == 240", - "assert find_Volume(3,2,2) == 6", - "assert find_Volume(1,2,1) == 1" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "10\n8\n6\n", - "3\n2\n2\n", - "1\n2\n1\n" - ], - "test_output": [ - "240\n", - "6\n", - "1\n" - ], - "example_input": [ - "10\n8\n6\n", - "3\n2\n2\n" - ], - "example_output": [ - "240\n", - "6\n" - ], - "question": "Original problem description:\nWrite a python function to find the volume of a triangular prism.\nWe have its functional test sample:\nassert find_Volume(10,8,6) == 240\nassert find_Volume(3,2,2) == 6\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n10\n8\n6\n\nOutput:\n240\n\n\nExample 2:\nInput:\n3\n2\n2\n\nOutput:\n6\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 3, - "prompt": "Write a function to that returns true if the input string contains sequences of lowercase letters joined with an underscore and false otherwise.", - "code": "import re\ndef text_lowercase_underscore(text):\n patterns = '^[a-z]+_[a-z]+$'\n if re.search(patterns, text):\n return True\n else:\n return False", - "test_imports": [], - "test_list": [ - "assert text_lowercase_underscore(\"aab_cbbbc\")==(True)", - "assert text_lowercase_underscore(\"aab_Abbbc\")==(False)", - "assert text_lowercase_underscore(\"Aaab_abbbc\")==(False)" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "aab_cbbbc\n", - "aab_Abbbc\n", - "Aaab_abbbc\n" - ], - "test_output": [ - "True\n", - "False\n", - "False\n" - ], - "example_input": [ - "aab_cbbbc\n", - "aab_Abbbc\n" - ], - "example_output": [ - "True\n", - "False\n" - ], - "question": "Original problem description:\nWrite a function to that returns true if the input string contains sequences of lowercase letters joined with an underscore and false otherwise.\nWe have its functional test sample:\nassert text_lowercase_underscore(\"aab_cbbbc\")==(True)\nassert text_lowercase_underscore(\"aab_Abbbc\")==(False)\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\naab_cbbbc\n\nOutput:\nTrue\n\n\nExample 2:\nInput:\naab_Abbbc\n\nOutput:\nFalse\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 4, - "prompt": "Write a function that returns the perimeter of a square given its side length as input.", - "code": "def square_perimeter(a):\n perimeter=4*a\n return perimeter", - "test_imports": [], - "test_list": [ - "assert square_perimeter(10)==40", - "assert square_perimeter(5)==20", - "assert square_perimeter(4)==16" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "10\n", - "5\n", - "4\n" - ], - "test_output": [ - "40\n", - "20\n", - "16\n" - ], - "example_input": [ - "10\n", - "5\n" - ], - "example_output": [ - "40\n", - "20\n" - ], - "question": "Original problem description:\nWrite a function that returns the perimeter of a square given its side length as input.\nWe have its functional test sample:\nassert square_perimeter(10)==40\nassert square_perimeter(5)==20\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n10\n\nOutput:\n40\n\n\nExample 2:\nInput:\n5\n\nOutput:\n20\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 5, - "prompt": "Write a function to remove characters from the first string which are present in the second string.", - "code": "NO_OF_CHARS = 256\ndef str_to_list(string): \n\ttemp = [] \n\tfor x in string: \n\t\ttemp.append(x) \n\treturn temp \ndef lst_to_string(List): \n\treturn ''.join(List) \ndef get_char_count_array(string): \n\tcount = [0] * NO_OF_CHARS \n\tfor i in string: \n\t\tcount[ord(i)] += 1\n\treturn count \ndef remove_dirty_chars(string, second_string): \n\tcount = get_char_count_array(second_string) \n\tip_ind = 0\n\tres_ind = 0\n\ttemp = '' \n\tstr_list = str_to_list(string) \n\twhile ip_ind != len(str_list): \n\t\ttemp = str_list[ip_ind] \n\t\tif count[ord(temp)] == 0: \n\t\t\tstr_list[res_ind] = str_list[ip_ind] \n\t\t\tres_ind += 1\n\t\tip_ind+=1\n\treturn lst_to_string(str_list[0:res_ind]) ", - "test_imports": [], - "test_list": [ - "assert remove_dirty_chars(\"probasscurve\", \"pros\") == 'bacuve'", - "assert remove_dirty_chars(\"digitalindia\", \"talent\") == 'digiidi'", - "assert remove_dirty_chars(\"exoticmiles\", \"toxic\") == 'emles'" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "probasscurve\npros\n", - "digitalindia\ntalent\n", - "exoticmiles\ntoxic\n" - ], - "test_output": [ - "bacuve\n", - "digiidi\n", - "emles\n" - ], - "example_input": [ - "probasscurve\npros\n", - "digitalindia\ntalent\n" - ], - "example_output": [ - "bacuve\n", - "digiidi\n" - ], - "question": "Original problem description:\nWrite a function to remove characters from the first string which are present in the second string.\nWe have its functional test sample:\nassert remove_dirty_chars(\"probasscurve\", \"pros\") == 'bacuve'\nassert remove_dirty_chars(\"digitalindia\", \"talent\") == 'digiidi'\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nprobasscurve\npros\n\nOutput:\nbacuve\n\n\nExample 2:\nInput:\ndigitalindia\ntalent\n\nOutput:\ndigiidi\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 6, - "prompt": "Write a function to find whether a given array of integers contains any duplicate element.", - "code": "def test_duplicate(arraynums):\n nums_set = set(arraynums) \n return len(arraynums) != len(nums_set) ", - "test_imports": [], - "test_list": [ - "assert test_duplicate(([1,2,3,4,5]))==False", - "assert test_duplicate(([1,2,3,4, 4]))==True", - "assert test_duplicate([1,1,2,2,3,3,4,4,5])==True" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 2 3 4 5\n", - "1 2 3 4 4\n", - "1 1 2 2 3 3 4 4 5\n" - ], - "test_output": [ - "False\n", - "True\n", - "True\n" - ], - "example_input": [ - "1 2 3 4 5\n", - "1 2 3 4 4\n" - ], - "example_output": [ - "False\n", - "True\n" - ], - "question": "Original problem description:\nWrite a function to find whether a given array of integers contains any duplicate element.\nWe have its functional test sample:\nassert test_duplicate(([1,2,3,4,5]))==False\nassert test_duplicate(([1,2,3,4, 4]))==True\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 2 3 4 5\n\nOutput:\nFalse\n\n\nExample 2:\nInput:\n1 2 3 4 4\n\nOutput:\nTrue\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 7, - "prompt": "Write a function to check if the given number is woodball or not.", - "code": "def is_woodall(x): \n\tif (x % 2 == 0): \n\t\treturn False\n\tif (x == 1): \n\t\treturn True\n\tx = x + 1 \n\tp = 0\n\twhile (x % 2 == 0): \n\t\tx = x/2\n\t\tp = p + 1\n\t\tif (p == x): \n\t\t\treturn True\n\treturn False", - "test_imports": [], - "test_list": [ - "assert is_woodall(383) == True", - "assert is_woodall(254) == False", - "assert is_woodall(200) == False" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "383\n", - "254\n", - "200\n" - ], - "test_output": [ - "True\n", - "False\n", - "False\n" - ], - "example_input": [ - "383\n", - "254\n" - ], - "example_output": [ - "True\n", - "False\n" - ], - "question": "Original problem description:\nWrite a function to check if the given number is woodball or not.\nWe have its functional test sample:\nassert is_woodall(383) == True\nassert is_woodall(254) == False\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n383\n\nOutput:\nTrue\n\n\nExample 2:\nInput:\n254\n\nOutput:\nFalse\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 8, - "prompt": "Write a python function to check if a given number is one less than twice its reverse.", - "code": "def rev(num): \n rev_num = 0\n while (num > 0): \n rev_num = (rev_num * 10 + num % 10) \n num = num // 10 \n return rev_num \ndef check(n): \n return (2 * rev(n) == n + 1) ", - "test_imports": [], - "test_list": [ - "assert check(70) == False", - "assert check(23) == False", - "assert check(73) == True" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "70\n", - "23\n", - "73\n" - ], - "test_output": [ - "False\n", - "False\n", - "True\n" - ], - "example_input": [ - "70\n", - "23\n" - ], - "example_output": [ - "False\n", - "False\n" - ], - "question": "Original problem description:\nWrite a python function to check if a given number is one less than twice its reverse.\nWe have its functional test sample:\nassert check(70) == False\nassert check(23) == False\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n70\n\nOutput:\nFalse\n\n\nExample 2:\nInput:\n23\n\nOutput:\nFalse\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 9, - "prompt": "Write a python function to find the largest number that can be formed with the given list of digits.", - "code": "def find_Max_Num(arr) : \n n = len(arr)\n arr.sort(reverse = True) \n num = arr[0] \n for i in range(1,n) : \n num = num * 10 + arr[i] \n return num ", - "test_imports": [], - "test_list": [ - "assert find_Max_Num([1,2,3]) == 321", - "assert find_Max_Num([4,5,6,1]) == 6541", - "assert find_Max_Num([1,2,3,9]) == 9321" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 2 3\n", - "4 5 6 1\n", - "1 2 3 9\n" - ], - "test_output": [ - "321\n", - "6541\n", - "9321\n" - ], - "example_input": [ - "1 2 3\n", - "4 5 6 1\n" - ], - "example_output": [ - "321\n", - "6541\n" - ], - "question": "Original problem description:\nWrite a python function to find the largest number that can be formed with the given list of digits.\nWe have its functional test sample:\nassert find_Max_Num([1,2,3]) == 321\nassert find_Max_Num([4,5,6,1]) == 6541\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 2 3\n\nOutput:\n321\n\n\nExample 2:\nInput:\n4 5 6 1\n\nOutput:\n6541\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 10, - "prompt": "Write a python function to check whether the given two integers have opposite sign or not.", - "code": "def opposite_Signs(x,y): \n return ((x ^ y) < 0); ", - "test_imports": [], - "test_list": [ - "assert opposite_Signs(1,-2) == True", - "assert opposite_Signs(3,2) == False", - "assert opposite_Signs(-10,-10) == False", - "assert opposite_Signs(-2,2) == True" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1\n-2\n", - "3\n2\n", - "-10\n-10\n", - "-2\n2\n" - ], - "test_output": [ - "True\n", - "False\n", - "False\n", - "True\n" - ], - "example_input": [ - "1\n-2\n", - "3\n2\n" - ], - "example_output": [ - "True\n", - "False\n" - ], - "question": "Original problem description:\nWrite a python function to check whether the given two integers have opposite sign or not.\nWe have its functional test sample:\nassert opposite_Signs(1,-2) == True\nassert opposite_Signs(3,2) == False\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1\n-2\n\nOutput:\nTrue\n\n\nExample 2:\nInput:\n3\n2\n\nOutput:\nFalse\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 11, - "prompt": "Write a function to find the nth octagonal number.", - "code": "def is_octagonal(n): \n\treturn 3 * n * n - 2 * n ", - "test_imports": [], - "test_list": [ - "assert is_octagonal(5) == 65", - "assert is_octagonal(10) == 280", - "assert is_octagonal(15) == 645" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "5\n", - "10\n", - "15\n" - ], - "test_output": [ - "65\n", - "280\n", - "645\n" - ], - "example_input": [ - "5\n", - "10\n" - ], - "example_output": [ - "65\n", - "280\n" - ], - "question": "Original problem description:\nWrite a function to find the nth octagonal number.\nWe have its functional test sample:\nassert is_octagonal(5) == 65\nassert is_octagonal(10) == 280\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n5\n\nOutput:\n65\n\n\nExample 2:\nInput:\n10\n\nOutput:\n280\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 12, - "prompt": "Write a python function to count the number of substrings with the sum of digits equal to their length.", - "code": "from collections import defaultdict\ndef count_Substrings(s):\n n = len(s)\n count,sum = 0,0\n mp = defaultdict(lambda : 0)\n mp[0] += 1\n for i in range(n):\n sum += ord(s[i]) - ord('0')\n count += mp[sum - (i + 1)]\n mp[sum - (i + 1)] += 1\n return count", - "test_imports": [], - "test_list": [ - "assert count_Substrings('112112') == 6", - "assert count_Substrings('111') == 6", - "assert count_Substrings('1101112') == 12" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "112112\n", - "111\n", - "1101112\n" - ], - "test_output": [ - "6\n", - "6\n", - "12\n" - ], - "example_input": [ - "112112\n", - "111\n" - ], - "example_output": [ - "6\n", - "6\n" - ], - "question": "Original problem description:\nWrite a python function to count the number of substrings with the sum of digits equal to their length.\nWe have its functional test sample:\nassert count_Substrings('112112') == 6\nassert count_Substrings('111') == 6\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n112112\n\nOutput:\n6\n\n\nExample 2:\nInput:\n111\n\nOutput:\n6\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 13, - "prompt": "Write a python function to find smallest number in a list.", - "code": "def smallest_num(xs):\n return min(xs)\n", - "test_imports": [], - "test_list": [ - "assert smallest_num([10, 20, 1, 45, 99]) == 1", - "assert smallest_num([1, 2, 3]) == 1", - "assert smallest_num([45, 46, 50, 60]) == 45" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "10 20 1 45 99\n", - "1 2 3\n", - "45 46 50 60\n" - ], - "test_output": [ - "1\n", - "1\n", - "45\n" - ], - "example_input": [ - "10 20 1 45 99\n", - "1 2 3\n" - ], - "example_output": [ - "1\n", - "1\n" - ], - "question": "Original problem description:\nWrite a python function to find smallest number in a list.\nWe have its functional test sample:\nassert smallest_num([10, 20, 1, 45, 99]) == 1\nassert smallest_num([1, 2, 3]) == 1\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n10 20 1 45 99\n\nOutput:\n1\n\n\nExample 2:\nInput:\n1 2 3\n\nOutput:\n1\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 14, - "prompt": "Write a function to find the maximum difference between available pairs in the given tuple list.", - "code": "def max_difference(test_list):\n temp = [abs(b - a) for a, b in test_list]\n res = max(temp)\n return (res) ", - "test_imports": [], - "test_list": [ - "assert max_difference([(3, 5), (1, 7), (10, 3), (1, 2)]) == 7", - "assert max_difference([(4, 6), (2, 17), (9, 13), (11, 12)]) == 15", - "assert max_difference([(12, 35), (21, 27), (13, 23), (41, 22)]) == 23" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "3 5\n1 7\n10 3\n1 2\n", - "4 6\n2 17\n9 13\n11 12\n", - "12 35\n21 27\n13 23\n41 22\n" - ], - "test_output": [ - "7\n", - "15\n", - "23\n" - ], - "example_input": [ - "3 5\n1 7\n10 3\n1 2\n", - "4 6\n2 17\n9 13\n11 12\n" - ], - "example_output": [ - "7\n", - "15\n" - ], - "question": "Original problem description:\nWrite a function to find the maximum difference between available pairs in the given tuple list.\nWe have its functional test sample:\nassert max_difference([(3, 5), (1, 7), (10, 3), (1, 2)]) == 7\nassert max_difference([(4, 6), (2, 17), (9, 13), (11, 12)]) == 15\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n3 5\n1 7\n10 3\n1 2\n\nOutput:\n7\n\n\nExample 2:\nInput:\n4 6\n2 17\n9 13\n11 12\n\nOutput:\n15\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 17, - "prompt": "Write a python function to count the number of positive numbers in a list.", - "code": "def pos_count(list):\n pos_count= 0\n for num in list: \n if num >= 0: \n pos_count += 1\n return pos_count ", - "test_imports": [], - "test_list": [ - "assert pos_count([1,-2,3,-4]) == 2", - "assert pos_count([3,4,5,-1]) == 3", - "assert pos_count([1,2,3,4]) == 4" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 -2 3 -4\n", - "3 4 5 -1\n", - "1 2 3 4\n" - ], - "test_output": [ - "2\n", - "3\n", - "4\n" - ], - "example_input": [ - "1 -2 3 -4\n", - "3 4 5 -1\n" - ], - "example_output": [ - "2\n", - "3\n" - ], - "question": "Original problem description:\nWrite a python function to count the number of positive numbers in a list.\nWe have its functional test sample:\nassert pos_count([1,-2,3,-4]) == 2\nassert pos_count([3,4,5,-1]) == 3\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 -2 3 -4\n\nOutput:\n2\n\n\nExample 2:\nInput:\n3 4 5 -1\n\nOutput:\n3\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 18, - "prompt": "Write a function to find the number of ways to partition a set of Bell numbers.", - "code": "def bell_number(n): \n bell = [[0 for i in range(n+1)] for j in range(n+1)] \n bell[0][0] = 1\n for i in range(1, n+1): \n bell[i][0] = bell[i-1][i-1] \n for j in range(1, i+1): \n bell[i][j] = bell[i-1][j-1] + bell[i][j-1] \n return bell[n][0] ", - "test_imports": [], - "test_list": [ - "assert bell_number(2)==2", - "assert bell_number(10)==115975", - "assert bell_number(56)==6775685320645824322581483068371419745979053216268760300" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "2\n", - "10\n", - "56\n" - ], - "test_output": [ - "2\n", - "115975\n", - "6775685320645824322581483068371419745979053216268760300\n" - ], - "example_input": [ - "2\n", - "10\n" - ], - "example_output": [ - "2\n", - "115975\n" - ], - "question": "Original problem description:\nWrite a function to find the number of ways to partition a set of Bell numbers.\nWe have its functional test sample:\nassert bell_number(2)==2\nassert bell_number(10)==115975\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n2\n\nOutput:\n2\n\n\nExample 2:\nInput:\n10\n\nOutput:\n115975\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 19, - "prompt": "Write a python function to check whether the given array is monotonic or not.", - "code": "def is_Monotonic(A): \n return (all(A[i] <= A[i + 1] for i in range(len(A) - 1)) or\n all(A[i] >= A[i + 1] for i in range(len(A) - 1))) ", - "test_imports": [], - "test_list": [ - "assert is_Monotonic([6, 5, 4, 4]) == True", - "assert is_Monotonic([1, 2, 2, 3]) == True", - "assert is_Monotonic([1, 3, 2]) == False" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "6 5 4 4\n", - "1 2 2 3\n", - "1 3 2\n" - ], - "test_output": [ - "True\n", - "True\n", - "False\n" - ], - "example_input": [ - "6 5 4 4\n", - "1 2 2 3\n" - ], - "example_output": [ - "True\n", - "True\n" - ], - "question": "Original problem description:\nWrite a python function to check whether the given array is monotonic or not.\nWe have its functional test sample:\nassert is_Monotonic([6, 5, 4, 4]) == True\nassert is_Monotonic([1, 2, 2, 3]) == True\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n6 5 4 4\n\nOutput:\nTrue\n\n\nExample 2:\nInput:\n1 2 2 3\n\nOutput:\nTrue\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 20, - "prompt": "Write a function to check whether a list contains the given sublist or not.", - "code": "def is_sublist(l, s):\n\tsub_set = False\n\tif s == []:\n\t\tsub_set = True\n\telif s == l:\n\t\tsub_set = True\n\telif len(s) > len(l):\n\t\tsub_set = False\n\telse:\n\t\tfor i in range(len(l)):\n\t\t\tif l[i] == s[0]:\n\t\t\t\tn = 1\n\t\t\t\twhile (n < len(s)) and (l[i+n] == s[n]):\n\t\t\t\t\tn += 1\t\t\t\t\n\t\t\t\tif n == len(s):\n\t\t\t\t\tsub_set = True\n\treturn sub_set", - "test_imports": [], - "test_list": [ - "assert is_sublist([2,4,3,5,7],[3,7])==False", - "assert is_sublist([2,4,3,5,7],[4,3])==True", - "assert is_sublist([2,4,3,5,7],[1,6])==False" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "2 4 3 5 7\n3 7\n", - "2 4 3 5 7\n4 3\n", - "2 4 3 5 7\n1 6\n" - ], - "test_output": [ - "False\n", - "True\n", - "False\n" - ], - "example_input": [ - "2 4 3 5 7\n3 7\n", - "2 4 3 5 7\n4 3\n" - ], - "example_output": [ - "False\n", - "True\n" - ], - "question": "Original problem description:\nWrite a function to check whether a list contains the given sublist or not.\nWe have its functional test sample:\nassert is_sublist([2,4,3,5,7],[3,7])==False\nassert is_sublist([2,4,3,5,7],[4,3])==True\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n2 4 3 5 7\n3 7\n\nOutput:\nFalse\n\n\nExample 2:\nInput:\n2 4 3 5 7\n4 3\n\nOutput:\nTrue\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 21, - "prompt": "Write a function to find whether all the given tuples have equal length or not.", - "code": "def find_equal_tuple(Input):\n k = 0 if not Input else len(Input[0])\n flag = 1\n for tuple in Input:\n if len(tuple) != k:\n flag = 0\n break\n return flag\ndef get_equal(Input):\n return find_equal_tuple(Input) == 1", - "test_imports": [], - "test_list": [ - "assert get_equal([(11, 22, 33), (44, 55, 66)]) == True", - "assert get_equal([(1, 2, 3), (4, 5, 6, 7)]) == False", - "assert get_equal([(1, 2), (3, 4)]) == True" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "11 22 33\n44 55 66\n", - "1 2 3\n4 5 6 7\n", - "1 2\n3 4\n" - ], - "test_output": [ - "True\n", - "False\n", - "True\n" - ], - "example_input": [ - "11 22 33\n44 55 66\n", - "1 2 3\n4 5 6 7\n" - ], - "example_output": [ - "True\n", - "False\n" - ], - "question": "Original problem description:\nWrite a function to find whether all the given tuples have equal length or not.\nWe have its functional test sample:\nassert get_equal([(11, 22, 33), (44, 55, 66)]) == True\nassert get_equal([(1, 2, 3), (4, 5, 6, 7)]) == False\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n11 22 33\n44 55 66\n\nOutput:\nTrue\n\n\nExample 2:\nInput:\n1 2 3\n4 5 6 7\n\nOutput:\nFalse\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 22, - "prompt": "Write a function to sort a list of elements.", - "code": "def comb_sort(nums):\n shrink_fact = 1.3\n gaps = len(nums)\n swapped = True\n i = 0\n while gaps > 1 or swapped:\n gaps = int(float(gaps) / shrink_fact)\n swapped = False\n i = 0\n while gaps + i < len(nums):\n if nums[i] > nums[i+gaps]:\n nums[i], nums[i+gaps] = nums[i+gaps], nums[i]\n swapped = True\n i += 1\n return nums", - "test_imports": [], - "test_list": [ - "assert comb_sort([5, 15, 37, 25, 79]) == [5, 15, 25, 37, 79]", - "assert comb_sort([41, 32, 15, 19, 22]) == [15, 19, 22, 32, 41]", - "assert comb_sort([99, 15, 13, 47]) == [13, 15, 47, 99]" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "5 15 37 25 79\n", - "41 32 15 19 22\n", - "99 15 13 47\n" - ], - "test_output": [ - "5 15 25 37 79\n", - "15 19 22 32 41\n", - "13 15 47 99\n" - ], - "example_input": [ - "5 15 37 25 79\n", - "41 32 15 19 22\n" - ], - "example_output": [ - "5 15 25 37 79\n", - "15 19 22 32 41\n" - ], - "question": "Original problem description:\nWrite a function to sort a list of elements.\nWe have its functional test sample:\nassert comb_sort([5, 15, 37, 25, 79]) == [5, 15, 25, 37, 79]\nassert comb_sort([41, 32, 15, 19, 22]) == [15, 19, 22, 32, 41]\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n5 15 37 25 79\n\nOutput:\n5 15 25 37 79\n\n\nExample 2:\nInput:\n41 32 15 19 22\n\nOutput:\n15 19 22 32 41\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 23, - "prompt": "Write a python function to check whether the given number can be represented as the difference of two squares or not.", - "code": "def dif_Square(n): \n if (n % 4 != 2): \n return True\n return False", - "test_imports": [], - "test_list": [ - "assert dif_Square(5) == True", - "assert dif_Square(10) == False", - "assert dif_Square(15) == True" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "5\n", - "10\n", - "15\n" - ], - "test_output": [ - "True\n", - "False\n", - "True\n" - ], - "example_input": [ - "5\n", - "10\n" - ], - "example_output": [ - "True\n", - "False\n" - ], - "question": "Original problem description:\nWrite a python function to check whether the given number can be represented as the difference of two squares or not.\nWe have its functional test sample:\nassert dif_Square(5) == True\nassert dif_Square(10) == False\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n5\n\nOutput:\nTrue\n\n\nExample 2:\nInput:\n10\n\nOutput:\nFalse\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 24, - "prompt": "Write a function to check whether it follows the sequence given in the patterns array.", - "code": "def is_samepatterns(colors, patterns): \n if len(colors) != len(patterns):\n return False \n sdict = {}\n pset = set()\n sset = set() \n for i in range(len(patterns)):\n pset.add(patterns[i])\n sset.add(colors[i])\n if patterns[i] not in sdict.keys():\n sdict[patterns[i]] = []\n\n keys = sdict[patterns[i]]\n keys.append(colors[i])\n sdict[patterns[i]] = keys\n\n if len(pset) != len(sset):\n return False \n\n for values in sdict.values():\n\n for i in range(len(values) - 1):\n if values[i] != values[i+1]:\n return False\n\n return True", - "test_imports": [], - "test_list": [ - "assert is_samepatterns([\"red\",\"green\",\"green\"], [\"a\", \"b\", \"b\"])==True", - "assert is_samepatterns([\"red\",\"green\",\"greenn\"], [\"a\",\"b\",\"b\"])==False", - "assert is_samepatterns([\"red\",\"green\",\"greenn\"], [\"a\",\"b\"])==False" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "red green green\na b b\n", - "red green greenn\na b b\n", - "red green greenn\na b\n" - ], - "test_output": [ - "True\n", - "False\n", - "False\n" - ], - "example_input": [ - "red green green\na b b\n", - "red green greenn\na b b\n" - ], - "example_output": [ - "True\n", - "False\n" - ], - "question": "Original problem description:\nWrite a function to check whether it follows the sequence given in the patterns array.\nWe have its functional test sample:\nassert is_samepatterns([\"red\",\"green\",\"green\"], [\"a\", \"b\", \"b\"])==True\nassert is_samepatterns([\"red\",\"green\",\"greenn\"], [\"a\",\"b\",\"b\"])==False\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nred green green\na b b\n\nOutput:\nTrue\n\n\nExample 2:\nInput:\nred green greenn\na b b\n\nOutput:\nFalse\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 26, - "prompt": "Write a python function to find whether a number is divisible by 11.", - "code": "def is_Diff(n): \n return (n % 11 == 0) ", - "test_imports": [], - "test_list": [ - "assert is_Diff (12345) == False", - "assert is_Diff(1212112) == True", - "assert is_Diff(1212) == False" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "12345\n", - "1212112\n", - "1212\n" - ], - "test_output": [ - "False\n", - "True\n", - "False\n" - ], - "example_input": [ - "12345\n", - "1212112\n" - ], - "example_output": [ - "False\n", - "True\n" - ], - "question": "Original problem description:\nWrite a python function to find whether a number is divisible by 11.\nWe have its functional test sample:\nassert is_Diff (12345) == False\nassert is_Diff(1212112) == True\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n12345\n\nOutput:\nFalse\n\n\nExample 2:\nInput:\n1212112\n\nOutput:\nTrue\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 27, - "prompt": "Write a python function to check whether the length of the word is odd or not.", - "code": "def word_len(s): \n s = s.split(' ') \n for word in s: \n if len(word)%2!=0: \n return True \n else:\n return False", - "test_imports": [], - "test_list": [ - "assert word_len(\"Hadoop\") == False", - "assert word_len(\"great\") == True", - "assert word_len(\"structure\") == True" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "Hadoop\n", - "great\n", - "structure\n" - ], - "test_output": [ - "False\n", - "True\n", - "True\n" - ], - "example_input": [ - "Hadoop\n", - "great\n" - ], - "example_output": [ - "False\n", - "True\n" - ], - "question": "Original problem description:\nWrite a python function to check whether the length of the word is odd or not.\nWe have its functional test sample:\nassert word_len(\"Hadoop\") == False\nassert word_len(\"great\") == True\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nHadoop\n\nOutput:\nFalse\n\n\nExample 2:\nInput:\ngreat\n\nOutput:\nTrue\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 28, - "prompt": "Write a function to find the nth tetrahedral number.", - "code": "def tetrahedral_number(n): \n\treturn (n * (n + 1) * (n + 2)) / 6", - "test_imports": [], - "test_list": [ - "assert tetrahedral_number(5) == 35", - "assert tetrahedral_number(6) == 56", - "assert tetrahedral_number(7) == 84" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "5\n", - "6\n", - "7\n" - ], - "test_output": [ - "35\n", - "56\n", - "84\n" - ], - "example_input": [ - "5\n", - "6\n" - ], - "example_output": [ - "35\n", - "56\n" - ], - "question": "Original problem description:\nWrite a function to find the nth tetrahedral number.\nWe have its functional test sample:\nassert tetrahedral_number(5) == 35\nassert tetrahedral_number(6) == 56\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n5\n\nOutput:\n35\n\n\nExample 2:\nInput:\n6\n\nOutput:\n56\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 30, - "prompt": "Write a python function to find the character made by adding the ASCII value of all the characters of the given string modulo 26.", - "code": "def get_Char(strr): \n summ = 0\n for i in range(len(strr)): \n summ += (ord(strr[i]) - ord('a') + 1) \n if (summ % 26 == 0): \n return ord('z') \n else: \n summ = summ % 26\n return chr(ord('a') + summ - 1)", - "test_imports": [], - "test_list": [ - "assert get_Char(\"abc\") == \"f\"", - "assert get_Char(\"gfg\") == \"t\"", - "assert get_Char(\"ab\") == \"c\"" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "abc\n", - "gfg\n", - "ab\n" - ], - "test_output": [ - "f\n", - "t\n", - "c\n" - ], - "example_input": [ - "abc\n", - "gfg\n" - ], - "example_output": [ - "f\n", - "t\n" - ], - "question": "Original problem description:\nWrite a python function to find the character made by adding the ASCII value of all the characters of the given string modulo 26.\nWe have its functional test sample:\nassert get_Char(\"abc\") == \"f\"\nassert get_Char(\"gfg\") == \"t\"\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nabc\n\nOutput:\nf\n\n\nExample 2:\nInput:\ngfg\n\nOutput:\nt\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 31, - "prompt": "Write a function to find the nth number in the newman conway sequence.", - "code": "def sequence(n): \n\tif n == 1 or n == 2: \n\t\treturn 1\n\telse: \n\t\treturn sequence(sequence(n-1)) + sequence(n-sequence(n-1))", - "test_imports": [], - "test_list": [ - "assert sequence(10) == 6", - "assert sequence(2) == 1", - "assert sequence(3) == 2" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "10\n", - "2\n", - "3\n" - ], - "test_output": [ - "6\n", - "1\n", - "2\n" - ], - "example_input": [ - "10\n", - "2\n" - ], - "example_output": [ - "6\n", - "1\n" - ], - "question": "Original problem description:\nWrite a function to find the nth number in the newman conway sequence.\nWe have its functional test sample:\nassert sequence(10) == 6\nassert sequence(2) == 1\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n10\n\nOutput:\n6\n\n\nExample 2:\nInput:\n2\n\nOutput:\n1\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 33, - "prompt": "Write a function to find nth centered hexagonal number.", - "code": "def centered_hexagonal_number(n):\n return 3 * n * (n - 1) + 1", - "test_imports": [], - "test_list": [ - "assert centered_hexagonal_number(10) == 271", - "assert centered_hexagonal_number(2) == 7", - "assert centered_hexagonal_number(9) == 217" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "10\n", - "2\n", - "9\n" - ], - "test_output": [ - "271\n", - "7\n", - "217\n" - ], - "example_input": [ - "10\n", - "2\n" - ], - "example_output": [ - "271\n", - "7\n" - ], - "question": "Original problem description:\nWrite a function to find nth centered hexagonal number.\nWe have its functional test sample:\nassert centered_hexagonal_number(10) == 271\nassert centered_hexagonal_number(2) == 7\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n10\n\nOutput:\n271\n\n\nExample 2:\nInput:\n2\n\nOutput:\n7\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 36, - "prompt": "Write a function to find the closest smaller number than n.", - "code": "def closest_num(N):\n return (N - 1)", - "test_imports": [], - "test_list": [ - "assert closest_num(11) == 10", - "assert closest_num(7) == 6", - "assert closest_num(12) == 11" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "11\n", - "7\n", - "12\n" - ], - "test_output": [ - "10\n", - "6\n", - "11\n" - ], - "example_input": [ - "11\n", - "7\n" - ], - "example_output": [ - "10\n", - "6\n" - ], - "question": "Original problem description:\nWrite a function to find the closest smaller number than n.\nWe have its functional test sample:\nassert closest_num(11) == 10\nassert closest_num(7) == 6\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n11\n\nOutput:\n10\n\n\nExample 2:\nInput:\n7\n\nOutput:\n6\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 37, - "prompt": "Write a python function to find the length of the longest word.", - "code": "def len_log(list1):\n max=len(list1[0])\n for i in list1:\n if len(i)>max:\n max=len(i)\n return max", - "test_imports": [], - "test_list": [ - "assert len_log([\"python\",\"PHP\",\"bigdata\"]) == 7", - "assert len_log([\"a\",\"ab\",\"abc\"]) == 3", - "assert len_log([\"small\",\"big\",\"tall\"]) == 5" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "python PHP bigdata\n", - "a ab abc\n", - "small big tall\n" - ], - "test_output": [ - "7\n", - "3\n", - "5\n" - ], - "example_input": [ - "python PHP bigdata\n", - "a ab abc\n" - ], - "example_output": [ - "7\n", - "3\n" - ], - "question": "Original problem description:\nWrite a python function to find the length of the longest word.\nWe have its functional test sample:\nassert len_log([\"python\",\"PHP\",\"bigdata\"]) == 7\nassert len_log([\"a\",\"ab\",\"abc\"]) == 3\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\npython PHP bigdata\n\nOutput:\n7\n\n\nExample 2:\nInput:\na ab abc\n\nOutput:\n3\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 38, - "prompt": "Write a function to check if a string is present as a substring in a given list of string values.", - "code": "def find_substring(str1, sub_str):\n if any(sub_str in s for s in str1):\n return True\n return False", - "test_imports": [], - "test_list": [ - "assert find_substring([\"red\", \"black\", \"white\", \"green\", \"orange\"],\"ack\")==True", - "assert find_substring([\"red\", \"black\", \"white\", \"green\", \"orange\"],\"abc\")==False", - "assert find_substring([\"red\", \"black\", \"white\", \"green\", \"orange\"],\"ange\")==True" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "red black white green orange\nack\n", - "red black white green orange\nabc\n", - "red black white green orange\nange\n" - ], - "test_output": [ - "True\n", - "False\n", - "True\n" - ], - "example_input": [ - "red black white green orange\nack\n", - "red black white green orange\nabc\n" - ], - "example_output": [ - "True\n", - "False\n" - ], - "question": "Original problem description:\nWrite a function to check if a string is present as a substring in a given list of string values.\nWe have its functional test sample:\nassert find_substring([\"red\", \"black\", \"white\", \"green\", \"orange\"],\"ack\")==True\nassert find_substring([\"red\", \"black\", \"white\", \"green\", \"orange\"],\"abc\")==False\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nred black white green orange\nack\n\nOutput:\nTrue\n\n\nExample 2:\nInput:\nred black white green orange\nabc\n\nOutput:\nFalse\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 39, - "prompt": "Write a function to check whether the given number is undulating or not.", - "code": "def is_undulating(n): \n\tn = str(n)\n\tif (len(n) <= 2): \n\t\treturn False\n\tfor i in range(2, len(n)): \n\t\tif (n[i - 2] != n[i]): \n\t\t\treturn False\n\treturn True", - "test_imports": [], - "test_list": [ - "assert is_undulating(1212121) == True", - "assert is_undulating(1991) == False", - "assert is_undulating(121) == True" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1212121\n", - "1991\n", - "121\n" - ], - "test_output": [ - "True\n", - "False\n", - "True\n" - ], - "example_input": [ - "1212121\n", - "1991\n" - ], - "example_output": [ - "True\n", - "False\n" - ], - "question": "Original problem description:\nWrite a function to check whether the given number is undulating or not.\nWe have its functional test sample:\nassert is_undulating(1212121) == True\nassert is_undulating(1991) == False\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1212121\n\nOutput:\nTrue\n\n\nExample 2:\nInput:\n1991\n\nOutput:\nFalse\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 40, - "prompt": "Write a function to calculate the value of 'a' to the power 'b'.", - "code": "def power(a,b):\n\tif b==0:\n\t\treturn 1\n\telif a==0:\n\t\treturn 0\n\telif b==1:\n\t\treturn a\n\telse:\n\t\treturn a*power(a,b-1)", - "test_imports": [], - "test_list": [ - "assert power(3,4) == 81", - "assert power(2,3) == 8", - "assert power(5,5) == 3125" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "3\n4\n", - "2\n3\n", - "5\n5\n" - ], - "test_output": [ - "81\n", - "8\n", - "3125\n" - ], - "example_input": [ - "3\n4\n", - "2\n3\n" - ], - "example_output": [ - "81\n", - "8\n" - ], - "question": "Original problem description:\nWrite a function to calculate the value of 'a' to the power 'b'.\nWe have its functional test sample:\nassert power(3,4) == 81\nassert power(2,3) == 8\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n3\n4\n\nOutput:\n81\n\n\nExample 2:\nInput:\n2\n3\n\nOutput:\n8\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 41, - "prompt": "Given a list of tuples, write a function that returns the first value of the tuple with the smallest second value.", - "code": "from operator import itemgetter \ndef index_minimum(test_list):\n res = min(test_list, key = itemgetter(1))[0]\n return (res) ", - "test_imports": [], - "test_list": [ - "assert index_minimum([('Rash', 143), ('Manjeet', 200), ('Varsha', 100)]) == 'Varsha'", - "assert index_minimum([('Yash', 185), ('Dawood', 125), ('Sanya', 175)]) == 'Dawood'", - "assert index_minimum([('Sai', 345), ('Salman', 145), ('Ayesha', 96)]) == 'Ayesha'" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "Rash 143\nManjeet 200\nVarsha 100\n", - "Yash 185\nDawood 125\nSanya 175\n", - "Sai 345\nSalman 145\nAyesha 96\n" - ], - "test_output": [ - "Varsha\n", - "Dawood\n", - "Ayesha\n" - ], - "example_input": [ - "Rash 143\nManjeet 200\nVarsha 100\n", - "Yash 185\nDawood 125\nSanya 175\n" - ], - "example_output": [ - "Varsha\n", - "Dawood\n" - ], - "question": "Original problem description:\nGiven a list of tuples, write a function that returns the first value of the tuple with the smallest second value.\nWe have its functional test sample:\nassert index_minimum([('Rash', 143), ('Manjeet', 200), ('Varsha', 100)]) == 'Varsha'\nassert index_minimum([('Yash', 185), ('Dawood', 125), ('Sanya', 175)]) == 'Dawood'\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nRash 143\nManjeet 200\nVarsha 100\n\nOutput:\nVarsha\n\n\nExample 2:\nInput:\nYash 185\nDawood 125\nSanya 175\n\nOutput:\nDawood\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 42, - "prompt": "Write a python function to find the length of the smallest list in a list of lists.", - "code": "def Find_Min_Length(lst): \n minLength = min(len(x) for x in lst )\n return minLength ", - "test_imports": [], - "test_list": [ - "assert Find_Min_Length([[1],[1,2]]) == 1", - "assert Find_Min_Length([[1,2],[1,2,3],[1,2,3,4]]) == 2", - "assert Find_Min_Length([[3,3,3],[4,4,4,4]]) == 3" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1\n1 2\n", - "1 2\n1 2 3\n1 2 3 4\n", - "3 3 3\n4 4 4 4\n" - ], - "test_output": [ - "1\n", - "2\n", - "3\n" - ], - "example_input": [ - "1\n1 2\n", - "1 2\n1 2 3\n1 2 3 4\n" - ], - "example_output": [ - "1\n", - "2\n" - ], - "question": "Original problem description:\nWrite a python function to find the length of the smallest list in a list of lists.\nWe have its functional test sample:\nassert Find_Min_Length([[1],[1,2]]) == 1\nassert Find_Min_Length([[1,2],[1,2,3],[1,2,3,4]]) == 2\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1\n1 2\n\nOutput:\n1\n\n\nExample 2:\nInput:\n1 2\n1 2 3\n1 2 3 4\n\nOutput:\n2\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 43, - "prompt": "Write a python function to find the number of divisors of a given integer.", - "code": "def divisor(n):\n for i in range(n):\n x = len([i for i in range(1,n+1) if not n % i])\n return x", - "test_imports": [], - "test_list": [ - "assert divisor(15) == 4", - "assert divisor(12) == 6", - "assert divisor(9) == 3" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "15\n", - "12\n", - "9\n" - ], - "test_output": [ - "4\n", - "6\n", - "3\n" - ], - "example_input": [ - "15\n", - "12\n" - ], - "example_output": [ - "4\n", - "6\n" - ], - "question": "Original problem description:\nWrite a python function to find the number of divisors of a given integer.\nWe have its functional test sample:\nassert divisor(15) == 4\nassert divisor(12) == 6\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n15\n\nOutput:\n4\n\n\nExample 2:\nInput:\n12\n\nOutput:\n6\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 46, - "prompt": "Write a function to convert the given decimal number to its binary equivalent, represented as a string with no leading zeros.", - "code": "def decimal_to_binary(n): \n return bin(n).replace(\"0b\",\"\") ", - "test_imports": [], - "test_list": [ - "assert decimal_to_binary(8) == '1000'", - "assert decimal_to_binary(18) == '10010'", - "assert decimal_to_binary(7) == '111'" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "8\n", - "18\n", - "7\n" - ], - "test_output": [ - "1000\n", - "10010\n", - "111\n" - ], - "example_input": [ - "8\n", - "18\n" - ], - "example_output": [ - "1000\n", - "10010\n" - ], - "question": "Original problem description:\nWrite a function to convert the given decimal number to its binary equivalent, represented as a string with no leading zeros.\nWe have its functional test sample:\nassert decimal_to_binary(8) == '1000'\nassert decimal_to_binary(18) == '10010'\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n8\n\nOutput:\n1000\n\n\nExample 2:\nInput:\n18\n\nOutput:\n10010\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 47, - "prompt": "Write a function to find the next smallest palindrome of a specified integer, returned as an integer.", - "code": "import sys\ndef next_smallest_palindrome(num):\n numstr = str(num)\n for i in range(num+1,sys.maxsize):\n if str(i) == str(i)[::-1]:\n return i", - "test_imports": [], - "test_list": [ - "assert next_smallest_palindrome(99)==101", - "assert next_smallest_palindrome(1221)==1331", - "assert next_smallest_palindrome(120)==121" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "99\n", - "1221\n", - "120\n" - ], - "test_output": [ - "101\n", - "1331\n", - "121\n" - ], - "example_input": [ - "99\n", - "1221\n" - ], - "example_output": [ - "101\n", - "1331\n" - ], - "question": "Original problem description:\nWrite a function to find the next smallest palindrome of a specified integer, returned as an integer.\nWe have its functional test sample:\nassert next_smallest_palindrome(99)==101\nassert next_smallest_palindrome(1221)==1331\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n99\n\nOutput:\n101\n\n\nExample 2:\nInput:\n1221\n\nOutput:\n1331\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 48, - "prompt": "Write a function to find the kth element in the given array using 1-based indexing.", - "code": "def kth_element(arr, k):\n n = len(arr)\n for i in range(n):\n for j in range(0, n-i-1):\n if arr[j] > arr[j+1]:\n arr[j], arr[j+1] == arr[j+1], arr[j]\n return arr[k-1]", - "test_imports": [], - "test_list": [ - "assert kth_element([12,3,5,7,19], 2) == 3", - "assert kth_element([17,24,8,23], 3) == 8", - "assert kth_element([16,21,25,36,4], 4) == 36" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "12 3 5 7 19\n2\n", - "17 24 8 23\n3\n", - "16 21 25 36 4\n4\n" - ], - "test_output": [ - "3\n", - "8\n", - "36\n" - ], - "example_input": [ - "12 3 5 7 19\n2\n", - "17 24 8 23\n3\n" - ], - "example_output": [ - "3\n", - "8\n" - ], - "question": "Original problem description:\nWrite a function to find the kth element in the given array using 1-based indexing.\nWe have its functional test sample:\nassert kth_element([12,3,5,7,19], 2) == 3\nassert kth_element([17,24,8,23], 3) == 8\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n12 3 5 7 19\n2\n\nOutput:\n3\n\n\nExample 2:\nInput:\n17 24 8 23\n3\n\nOutput:\n8\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 49, - "prompt": "Write a function to convert a snake case string to camel case string.", - "code": "def snake_to_camel(word):\n import re\n return ''.join(x.capitalize() or '_' for x in word.split('_'))", - "test_imports": [], - "test_list": [ - "assert snake_to_camel('python_program')=='PythonProgram'", - "assert snake_to_camel('python_language')==('PythonLanguage')", - "assert snake_to_camel('programming_language')==('ProgrammingLanguage')" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "python_program\n", - "python_language\n", - "programming_language\n" - ], - "test_output": [ - "PythonProgram\n", - "PythonLanguage\n", - "ProgrammingLanguage\n" - ], - "example_input": [ - "python_program\n", - "python_language\n" - ], - "example_output": [ - "PythonProgram\n", - "PythonLanguage\n" - ], - "question": "Original problem description:\nWrite a function to convert a snake case string to camel case string.\nWe have its functional test sample:\nassert snake_to_camel('python_program')=='PythonProgram'\nassert snake_to_camel('python_language')==('PythonLanguage')\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\npython_program\n\nOutput:\nPythonProgram\n\n\nExample 2:\nInput:\npython_language\n\nOutput:\nPythonLanguage\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 50, - "prompt": "Write a function to find the Eulerian number a(n, m).", - "code": "def eulerian_num(n, m): \n\tif (m >= n or n == 0): \n\t\treturn 0 \n\tif (m == 0): \n\t\treturn 1 \n\treturn ((n - m) * eulerian_num(n - 1, m - 1) +(m + 1) * eulerian_num(n - 1, m))", - "test_imports": [], - "test_list": [ - "assert eulerian_num(3, 1) == 4", - "assert eulerian_num(4, 1) == 11", - "assert eulerian_num(5, 3) == 26" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "3\n1\n", - "4\n1\n", - "5\n3\n" - ], - "test_output": [ - "4\n", - "11\n", - "26\n" - ], - "example_input": [ - "3\n1\n", - "4\n1\n" - ], - "example_output": [ - "4\n", - "11\n" - ], - "question": "Original problem description:\nWrite a function to find the Eulerian number a(n, m).\nWe have its functional test sample:\nassert eulerian_num(3, 1) == 4\nassert eulerian_num(4, 1) == 11\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n3\n1\n\nOutput:\n4\n\n\nExample 2:\nInput:\n4\n1\n\nOutput:\n11\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 51, - "prompt": "Write a function to sort each sublist of strings in a given list of lists.", - "code": "def sort_sublists(input_list):\n result = [sorted(x, key = lambda x:x[0]) for x in input_list] \n return result\n", - "test_imports": [], - "test_list": [ - "assert sort_sublists(([\"green\", \"orange\"], [\"black\", \"white\"], [\"white\", \"black\", \"orange\"]))==[['green', 'orange'], ['black', 'white'], ['black', 'orange', 'white']]", - "assert sort_sublists(([\" red \",\"green\" ],[\"blue \",\" black\"],[\" orange\",\"brown\"]))==[[' red ', 'green'], [' black', 'blue '], [' orange', 'brown']]", - "assert sort_sublists(([\"zilver\",\"gold\"], [\"magnesium\",\"aluminium\"], [\"steel\", \"bronze\"]))==[['gold', 'zilver'],['aluminium', 'magnesium'], ['bronze', 'steel']]" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "green orange\nblack white\nwhite black orange\n", - "red green\nblue black\n orange brown\n", - "zilver gold\nmagnesium aluminium\nsteel bronze\n" - ], - "test_output": [ - "green orange\nblack white\nblack orange white\n", - "red green\n black blue \n orange brown\n", - "gold zilver\naluminium magnesium\nbronze steel\n" - ], - "example_input": [ - "green orange\nblack white\nwhite black orange\n", - "red green\nblue black\n orange brown\n" - ], - "example_output": [ - "green orange\nblack white\nblack orange white\n", - "red green\n black blue \n orange brown\n" - ], - "question": "Original problem description:\nWrite a function to sort each sublist of strings in a given list of lists.\nWe have its functional test sample:\nassert sort_sublists(([\"green\", \"orange\"], [\"black\", \"white\"], [\"white\", \"black\", \"orange\"]))==[['green', 'orange'], ['black', 'white'], ['black', 'orange', 'white']]\nassert sort_sublists(([\" red \",\"green\" ],[\"blue \",\" black\"],[\" orange\",\"brown\"]))==[[' red ', 'green'], [' black', 'blue '], [' orange', 'brown']]\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\ngreen orange\nblack white\nwhite black orange\n\nOutput:\ngreen orange\nblack white\nblack orange white\n\n\nExample 2:\nInput:\nred green\nblue black\n orange brown\n\nOutput:\nred green\n black blue \n orange brown\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 52, - "prompt": "Write a python function to count true booleans in the given list.", - "code": "def count(lst): \n return sum(lst) ", - "test_imports": [], - "test_list": [ - "assert count([True,False,True]) == 2", - "assert count([False,False]) == 0", - "assert count([True,True,True]) == 3" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "True False True\n", - "False False\n", - "True True True\n" - ], - "test_output": [ - "2\n", - "0\n", - "3\n" - ], - "example_input": [ - "True False True\n", - "False False\n" - ], - "example_output": [ - "2\n", - "0\n" - ], - "question": "Original problem description:\nWrite a python function to count true booleans in the given list.\nWe have its functional test sample:\nassert count([True,False,True]) == 2\nassert count([False,False]) == 0\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nTrue False True\n\nOutput:\n2\n\n\nExample 2:\nInput:\nFalse False\n\nOutput:\n0\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 53, - "prompt": "Write a function to append the given list to the given tuples.", - "code": "def add_lists(test_list, test_tup):\n res = tuple(list(test_tup) + test_list)\n return (res) ", - "test_imports": [], - "test_list": [ - "assert add_lists([5, 6, 7], (9, 10)) == (9, 10, 5, 6, 7)", - "assert add_lists([6, 7, 8], (10, 11)) == (10, 11, 6, 7, 8)", - "assert add_lists([7, 8, 9], (11, 12)) == (11, 12, 7, 8, 9)" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "5 6 7\n9 10\n", - "6 7 8\n10 11\n", - "7 8 9\n11 12\n" - ], - "test_output": [ - "9 10 5 6 7\n", - "10 11 6 7 8\n", - "11 12 7 8 9\n" - ], - "example_input": [ - "5 6 7\n9 10\n", - "6 7 8\n10 11\n" - ], - "example_output": [ - "9 10 5 6 7\n", - "10 11 6 7 8\n" - ], - "question": "Original problem description:\nWrite a function to append the given list to the given tuples.\nWe have its functional test sample:\nassert add_lists([5, 6, 7], (9, 10)) == (9, 10, 5, 6, 7)\nassert add_lists([6, 7, 8], (10, 11)) == (10, 11, 6, 7, 8)\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n5 6 7\n9 10\n\nOutput:\n9 10 5 6 7\n\n\nExample 2:\nInput:\n6 7 8\n10 11\n\nOutput:\n10 11 6 7 8\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 54, - "prompt": "Write a function to merge three lists into a single sorted list.", - "code": "import heapq\ndef merge_sorted_list(num1,num2,num3):\n num1=sorted(num1)\n num2=sorted(num2)\n num3=sorted(num3)\n result = heapq.merge(num1,num2,num3)\n return list(result)", - "test_imports": [], - "test_list": [ - "assert merge_sorted_list([25, 24, 15, 4, 5, 29, 110],[19, 20, 11, 56, 25, 233, 154],[24, 26, 54, 48])==[4, 5, 11, 15, 19, 20, 24, 24, 25, 25, 26, 29, 48, 54, 56, 110, 154, 233]", - "assert merge_sorted_list([1, 3, 5, 6, 8, 9], [2, 5, 7, 11], [1, 4, 7, 8, 12])==[1, 1, 2, 3, 4, 5, 5, 6, 7, 7, 8, 8, 9, 11, 12]", - "assert merge_sorted_list([18, 14, 10, 9, 8, 7, 9, 3, 2, 4, 1],[25, 35, 22, 85, 14, 65, 75, 25, 58],[12, 74, 9, 50, 61, 41])==[1, 2, 3, 4, 7, 8, 9, 9, 9, 10, 12, 14, 14, 18, 22, 25, 25, 35, 41, 50, 58, 61, 65, 74, 75, 85]" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "25 24 15 4 5 29 110\n19 20 11 56 25 233 154\n24 26 54 48\n", - "1 3 5 6 8 9\n2 5 7 11\n1 4 7 8 12\n", - "18 14 10 9 8 7 9 3 2 4 1\n25 35 22 85 14 65 75 25 58\n12 74 9 50 61 41\n" - ], - "test_output": [ - "4 5 11 15 19 20 24 24 25 25 26 29 48 54 56 110 154 233\n", - "1 1 2 3 4 5 5 6 7 7 8 8 9 11 12\n", - "1 2 3 4 7 8 9 9 9 10 12 14 14 18 22 25 25 35 41 50 58 61 65 74 75 85\n" - ], - "example_input": [ - "25 24 15 4 5 29 110\n19 20 11 56 25 233 154\n24 26 54 48\n", - "1 3 5 6 8 9\n2 5 7 11\n1 4 7 8 12\n" - ], - "example_output": [ - "4 5 11 15 19 20 24 24 25 25 26 29 48 54 56 110 154 233\n", - "1 1 2 3 4 5 5 6 7 7 8 8 9 11 12\n" - ], - "question": "Original problem description:\nWrite a function to merge three lists into a single sorted list.\nWe have its functional test sample:\nassert merge_sorted_list([25, 24, 15, 4, 5, 29, 110],[19, 20, 11, 56, 25, 233, 154],[24, 26, 54, 48])==[4, 5, 11, 15, 19, 20, 24, 24, 25, 25, 26, 29, 48, 54, 56, 110, 154, 233]\nassert merge_sorted_list([1, 3, 5, 6, 8, 9], [2, 5, 7, 11], [1, 4, 7, 8, 12])==[1, 1, 2, 3, 4, 5, 5, 6, 7, 7, 8, 8, 9, 11, 12]\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n25 24 15 4 5 29 110\n19 20 11 56 25 233 154\n24 26 54 48\n\nOutput:\n4 5 11 15 19 20 24 24 25 25 26 29 48 54 56 110 154 233\n\n\nExample 2:\nInput:\n1 3 5 6 8 9\n2 5 7 11\n1 4 7 8 12\n\nOutput:\n1 1 2 3 4 5 5 6 7 7 8 8 9 11 12\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 55, - "prompt": "Write a python function to find the number of numbers with an odd value when rotating a binary string the given number of times.", - "code": "def odd_Equivalent(s,n): \n count=0\n for i in range(0,n): \n if (s[i] == '1'): \n count = count + 1\n return count ", - "test_imports": [], - "test_list": [ - "assert odd_Equivalent(\"011001\",6) == 3", - "assert odd_Equivalent(\"11011\",5) == 4", - "assert odd_Equivalent(\"1010\",4) == 2" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "011001\n6\n", - "11011\n5\n", - "1010\n4\n" - ], - "test_output": [ - "3\n", - "4\n", - "2\n" - ], - "example_input": [ - "011001\n6\n", - "11011\n5\n" - ], - "example_output": [ - "3\n", - "4\n" - ], - "question": "Original problem description:\nWrite a python function to find the number of numbers with an odd value when rotating a binary string the given number of times.\nWe have its functional test sample:\nassert odd_Equivalent(\"011001\",6) == 3\nassert odd_Equivalent(\"11011\",5) == 4\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n011001\n6\n\nOutput:\n3\n\n\nExample 2:\nInput:\n11011\n5\n\nOutput:\n4\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 56, - "prompt": "Write a function to find the common elements in given nested lists.", - "code": "def common_in_nested_lists(nestedlist):\n result = list(set.intersection(*map(set, nestedlist)))\n return result", - "test_imports": [], - "test_list": [ - "assert set(common_in_nested_lists([[12, 18, 23, 25, 45], [7, 12, 18, 24, 28], [1, 5, 8, 12, 15, 16, 18]]))==set([18, 12])", - "assert set(common_in_nested_lists([[12, 5, 23, 25, 45], [7, 11, 5, 23, 28], [1, 5, 8, 18, 23, 16]]))==set([5,23])", - "assert set(common_in_nested_lists([[2, 3,4, 1], [4, 5], [6,4, 8],[4, 5], [6, 8,4]]))==set([4])" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "12 18 23 25 45\n7 12 18 24 28\n1 5 8 12 15 16 18\n", - "12 5 23 25 45\n7 11 5 23 28\n1 5 8 18 23 16\n", - "2 3 4 1\n4 5\n6 4 8\n4 5\n6 8 4\n" - ], - "test_output": [ - "18 12\n", - "5 23\n", - "4\n" - ], - "example_input": [ - "12 18 23 25 45\n7 12 18 24 28\n1 5 8 12 15 16 18\n", - "12 5 23 25 45\n7 11 5 23 28\n1 5 8 18 23 16\n" - ], - "example_output": [ - "18 12\n", - "5 23\n" - ], - "question": "Original problem description:\nWrite a function to find the common elements in given nested lists.\nWe have its functional test sample:\nassert set(common_in_nested_lists([[12, 18, 23, 25, 45], [7, 12, 18, 24, 28], [1, 5, 8, 12, 15, 16, 18]]))==set([18, 12])\nassert set(common_in_nested_lists([[12, 5, 23, 25, 45], [7, 11, 5, 23, 28], [1, 5, 8, 18, 23, 16]]))==set([5,23])\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n12 18 23 25 45\n7 12 18 24 28\n1 5 8 12 15 16 18\n\nOutput:\n18 12\n\n\nExample 2:\nInput:\n12 5 23 25 45\n7 11 5 23 28\n1 5 8 18 23 16\n\nOutput:\n5 23\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 57, - "prompt": "Write a function to check if a string represents an integer or not.", - "code": "def check_integer(text):\n text = text.strip()\n if len(text) < 1:\n return None\n else:\n if all(text[i] in \"0123456789\" for i in range(len(text))):\n return True\n elif (text[0] in \"+-\") and \\\n all(text[i] in \"0123456789\" for i in range(1,len(text))):\n return True\n else:\n return False", - "test_imports": [], - "test_list": [ - "assert check_integer(\"python\")==False", - "assert check_integer(\"1\")==True", - "assert check_integer(\"12345\")==True" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "python\n", - "1\n", - "12345\n" - ], - "test_output": [ - "False\n", - "True\n", - "True\n" - ], - "example_input": [ - "python\n", - "1\n" - ], - "example_output": [ - "False\n", - "True\n" - ], - "question": "Original problem description:\nWrite a function to check if a string represents an integer or not.\nWe have its functional test sample:\nassert check_integer(\"python\")==False\nassert check_integer(\"1\")==True\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\npython\n\nOutput:\nFalse\n\n\nExample 2:\nInput:\n1\n\nOutput:\nTrue\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 59, - "prompt": "Write a function to convert a given tuple of positive integers into a single integer.", - "code": "def tuple_to_int(nums):\n result = int(''.join(map(str,nums)))\n return result", - "test_imports": [], - "test_list": [ - "assert tuple_to_int((1,2,3))==123", - "assert tuple_to_int((4,5,6))==456", - "assert tuple_to_int((5,6,7))==567" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1\n2\n3\n", - "4\n5\n6\n", - "5\n6\n7\n" - ], - "test_output": [ - "123\n", - "456\n", - "567\n" - ], - "example_input": [ - "1\n2\n3\n", - "4\n5\n6\n" - ], - "example_output": [ - "123\n", - "456\n" - ], - "question": "Original problem description:\nWrite a function to convert a given tuple of positive integers into a single integer.\nWe have its functional test sample:\nassert tuple_to_int((1,2,3))==123\nassert tuple_to_int((4,5,6))==456\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1\n2\n3\n\nOutput:\n123\n\n\nExample 2:\nInput:\n4\n5\n6\n\nOutput:\n456\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 60, - "prompt": "Write a function to convert all possible convertible elements in a list of lists to floats.", - "code": "def list_to_float(test_list):\n res = []\n for tup in test_list:\n temp = []\n for ele in tup:\n if ele.isalpha():\n temp.append(ele)\n else:\n temp.append(float(ele))\n res.append((temp[0],temp[1])) \n return res", - "test_imports": [], - "test_list": [ - "assert list_to_float( [(\"3\", \"4\"), (\"1\", \"26.45\"), (\"7.32\", \"8\"), (\"4\", \"8\")] ) == [(3.0, 4.0), (1.0, 26.45), (7.32, 8.0), (4.0, 8.0)]", - "assert list_to_float( [(\"4\", \"4\"), (\"2\", \"27\"), (\"4.12\", \"9\"), (\"7\", \"11\")] ) == [(4.0, 4.0), (2.0, 27.0), (4.12, 9.0), (7.0, 11.0)]", - "assert list_to_float( [(\"6\", \"78\"), (\"5\", \"26.45\"), (\"1.33\", \"4\"), (\"82\", \"13\")] ) == [(6.0, 78.0), (5.0, 26.45), (1.33, 4.0), (82.0, 13.0)]" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "3 4\n1 26.45\n7.32 8\n4 8\n", - "4 4\n2 27\n4.12 9\n7 11\n", - "6 78\n5 26.45\n1.33 4\n82 13\n" - ], - "test_output": [ - "3.0 4.0\n1.0 26.45\n7.32 8.0\n4.0 8.0\n", - "4.0 4.0\n2.0 27.0\n4.12 9.0\n7.0 11.0\n", - "6.0 78.0\n5.0 26.45\n1.33 4.0\n82.0 13.0\n" - ], - "example_input": [ - "3 4\n1 26.45\n7.32 8\n4 8\n", - "4 4\n2 27\n4.12 9\n7 11\n" - ], - "example_output": [ - "3.0 4.0\n1.0 26.45\n7.32 8.0\n4.0 8.0\n", - "4.0 4.0\n2.0 27.0\n4.12 9.0\n7.0 11.0\n" - ], - "question": "Original problem description:\nWrite a function to convert all possible convertible elements in a list of lists to floats.\nWe have its functional test sample:\nassert list_to_float( [(\"3\", \"4\"), (\"1\", \"26.45\"), (\"7.32\", \"8\"), (\"4\", \"8\")] ) == [(3.0, 4.0), (1.0, 26.45), (7.32, 8.0), (4.0, 8.0)]\nassert list_to_float( [(\"4\", \"4\"), (\"2\", \"27\"), (\"4.12\", \"9\"), (\"7\", \"11\")] ) == [(4.0, 4.0), (2.0, 27.0), (4.12, 9.0), (7.0, 11.0)]\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n3 4\n1 26.45\n7.32 8\n4 8\n\nOutput:\n3.0 4.0\n1.0 26.45\n7.32 8.0\n4.0 8.0\n\n\nExample 2:\nInput:\n4 4\n2 27\n4.12 9\n7 11\n\nOutput:\n4.0 4.0\n2.0 27.0\n4.12 9.0\n7.0 11.0\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 61, - "prompt": "Write a function to convert a string to a list of strings split on the space character.", - "code": "def string_to_list(string): \n lst = list(string.split(\" \")) \n return lst", - "test_imports": [], - "test_list": [ - "assert string_to_list(\"python programming\")==['python','programming']", - "assert string_to_list(\"lists tuples strings\")==['lists','tuples','strings']", - "assert string_to_list(\"write a program\")==['write','a','program']" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "python programming\n", - "lists tuples strings\n", - "write a program\n" - ], - "test_output": [ - "python programming\n", - "lists tuples strings\n", - "write a program\n" - ], - "example_input": [ - "python programming\n", - "lists tuples strings\n" - ], - "example_output": [ - "python programming\n", - "lists tuples strings\n" - ], - "question": "Original problem description:\nWrite a function to convert a string to a list of strings split on the space character.\nWe have its functional test sample:\nassert string_to_list(\"python programming\")==['python','programming']\nassert string_to_list(\"lists tuples strings\")==['lists','tuples','strings']\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\npython programming\n\nOutput:\npython programming\n\n\nExample 2:\nInput:\nlists tuples strings\n\nOutput:\nlists tuples strings\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 62, - "prompt": "Write a python function to find the element that appears only once in a sorted array.", - "code": "def search(arr):\n n = len(arr)\n XOR = 0\n for i in range(n) :\n XOR = XOR ^ arr[i]\n return (XOR)", - "test_imports": [], - "test_list": [ - "assert search([1,1,2,2,3]) == 3", - "assert search([1,1,3,3,4,4,5,5,7,7,8]) == 8", - "assert search([1,2,2,3,3,4,4]) == 1" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 1 2 2 3\n", - "1 1 3 3 4 4 5 5 7 7 8\n", - "1 2 2 3 3 4 4\n" - ], - "test_output": [ - "3\n", - "8\n", - "1\n" - ], - "example_input": [ - "1 1 2 2 3\n", - "1 1 3 3 4 4 5 5 7 7 8\n" - ], - "example_output": [ - "3\n", - "8\n" - ], - "question": "Original problem description:\nWrite a python function to find the element that appears only once in a sorted array.\nWe have its functional test sample:\nassert search([1,1,2,2,3]) == 3\nassert search([1,1,3,3,4,4,5,5,7,7,8]) == 8\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 1 2 2 3\n\nOutput:\n3\n\n\nExample 2:\nInput:\n1 1 3 3 4 4 5 5 7 7 8\n\nOutput:\n8\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 63, - "prompt": "Write a function to find the maximum absolute product between numbers in pairs of tuples within a given list.", - "code": "def max_product_tuple(list1):\n result_max = max([abs(x * y) for x, y in list1] )\n return result_max", - "test_imports": [], - "test_list": [ - "assert max_product_tuple([(2, 7), (2, 6), (1, 8), (4, 9)] )==36", - "assert max_product_tuple([(10,20), (15,2), (5,10)] )==200", - "assert max_product_tuple([(11,44), (10,15), (20,5), (12, 9)] )==484" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "2 7\n2 6\n1 8\n4 9\n", - "10 20\n15 2\n5 10\n", - "11 44\n10 15\n20 5\n12 9\n" - ], - "test_output": [ - "36\n", - "200\n", - "484\n" - ], - "example_input": [ - "2 7\n2 6\n1 8\n4 9\n", - "10 20\n15 2\n5 10\n" - ], - "example_output": [ - "36\n", - "200\n" - ], - "question": "Original problem description:\nWrite a function to find the maximum absolute product between numbers in pairs of tuples within a given list.\nWe have its functional test sample:\nassert max_product_tuple([(2, 7), (2, 6), (1, 8), (4, 9)] )==36\nassert max_product_tuple([(10,20), (15,2), (5,10)] )==200\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n2 7\n2 6\n1 8\n4 9\n\nOutput:\n36\n\n\nExample 2:\nInput:\n10 20\n15 2\n5 10\n\nOutput:\n200\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 64, - "prompt": "Write a function to sum all amicable numbers from 1 to a specified number.", - "code": "def amicable_numbers_sum(limit):\n if not isinstance(limit, int):\n return \"Input is not an integer!\"\n if limit < 1:\n return \"Input must be bigger than 0!\"\n amicables = set()\n for num in range(2, limit+1):\n if num in amicables:\n continue\n sum_fact = sum([fact for fact in range(1, num) if num % fact == 0])\n sum_fact2 = sum([fact for fact in range(1, sum_fact) if sum_fact % fact == 0])\n if num == sum_fact2 and num != sum_fact:\n amicables.add(num)\n amicables.add(sum_fact2)\n return sum(amicables)", - "test_imports": [], - "test_list": [ - "assert amicable_numbers_sum(999)==504", - "assert amicable_numbers_sum(9999)==31626", - "assert amicable_numbers_sum(99)==0" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "999\n", - "9999\n", - "99\n" - ], - "test_output": [ - "504\n", - "31626\n", - "0\n" - ], - "example_input": [ - "999\n", - "9999\n" - ], - "example_output": [ - "504\n", - "31626\n" - ], - "question": "Original problem description:\nWrite a function to sum all amicable numbers from 1 to a specified number.\nWe have its functional test sample:\nassert amicable_numbers_sum(999)==504\nassert amicable_numbers_sum(9999)==31626\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n999\n\nOutput:\n504\n\n\nExample 2:\nInput:\n9999\n\nOutput:\n31626\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 66, - "prompt": "Write a function to find the maximum difference between the number of 0s and number of 1s in any sub-string of the given binary string.", - "code": "def find_length(string): \n\tn = len(string)\n\tcurrent_sum = 0\n\tmax_sum = 0\n\tfor i in range(n): \n\t\tcurrent_sum += (1 if string[i] == '0' else -1) \n\t\tif current_sum < 0: \n\t\t\tcurrent_sum = 0\n\t\tmax_sum = max(current_sum, max_sum) \n\treturn max_sum if max_sum else 0", - "test_imports": [], - "test_list": [ - "assert find_length(\"11000010001\") == 6", - "assert find_length(\"10111\") == 1", - "assert find_length(\"11011101100101\") == 2" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "11000010001\n", - "10111\n", - "11011101100101\n" - ], - "test_output": [ - "6\n", - "1\n", - "2\n" - ], - "example_input": [ - "11000010001\n", - "10111\n" - ], - "example_output": [ - "6\n", - "1\n" - ], - "question": "Original problem description:\nWrite a function to find the maximum difference between the number of 0s and number of 1s in any sub-string of the given binary string.\nWe have its functional test sample:\nassert find_length(\"11000010001\") == 6\nassert find_length(\"10111\") == 1\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n11000010001\n\nOutput:\n6\n\n\nExample 2:\nInput:\n10111\n\nOutput:\n1\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 67, - "prompt": "Write a python function to find the sum of common divisors of two given numbers.", - "code": "def sum(a,b): \n sum = 0\n for i in range (1,min(a,b)): \n if (a % i == 0 and b % i == 0): \n sum += i \n return sum", - "test_imports": [], - "test_list": [ - "assert sum(10,15) == 6", - "assert sum(100,150) == 93", - "assert sum(4,6) == 3" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "10\n15\n", - "100\n150\n", - "4\n6\n" - ], - "test_output": [ - "6\n", - "93\n", - "3\n" - ], - "example_input": [ - "10\n15\n", - "100\n150\n" - ], - "example_output": [ - "6\n", - "93\n" - ], - "question": "Original problem description:\nWrite a python function to find the sum of common divisors of two given numbers.\nWe have its functional test sample:\nassert sum(10,15) == 6\nassert sum(100,150) == 93\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n10\n15\n\nOutput:\n6\n\n\nExample 2:\nInput:\n100\n150\n\nOutput:\n93\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 68, - "prompt": "Write a function to multiply two integers.", - "code": "def multiply_int(x, y):\n if y < 0:\n return -multiply_int(x, -y)\n elif y == 0:\n return 0\n elif y == 1:\n return x\n else:\n return x + multiply_int(x, y - 1)", - "test_imports": [], - "test_list": [ - "assert multiply_int(10,20)==200", - "assert multiply_int(5,10)==50", - "assert multiply_int(4,8)==32" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "10\n20\n", - "5\n10\n", - "4\n8\n" - ], - "test_output": [ - "200\n", - "50\n", - "32\n" - ], - "example_input": [ - "10\n20\n", - "5\n10\n" - ], - "example_output": [ - "200\n", - "50\n" - ], - "question": "Original problem description:\nWrite a function to multiply two integers.\nWe have its functional test sample:\nassert multiply_int(10,20)==200\nassert multiply_int(5,10)==50\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n10\n20\n\nOutput:\n200\n\n\nExample 2:\nInput:\n5\n10\n\nOutput:\n50\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 69, - "prompt": "Write a function to find words that are longer than n characters from a given list of words.", - "code": "def long_words(n, str):\n word_len = []\n txt = str.split(\" \")\n for x in txt:\n if len(x) > n:\n word_len.append(x)\n return word_len\t", - "test_imports": [], - "test_list": [ - "assert long_words(3,\"python is a programming language\")==['python','programming','language']", - "assert long_words(2,\"writing a program\")==['writing','program']", - "assert long_words(5,\"sorting list\")==['sorting']" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "3\npython is a programming language\n", - "2\nwriting a program\n", - "5\nsorting list\n" - ], - "test_output": [ - "python programming language\n", - "writing program\n", - "sorting\n" - ], - "example_input": [ - "3\npython is a programming language\n", - "2\nwriting a program\n" - ], - "example_output": [ - "python programming language\n", - "writing program\n" - ], - "question": "Original problem description:\nWrite a function to find words that are longer than n characters from a given list of words.\nWe have its functional test sample:\nassert long_words(3,\"python is a programming language\")==['python','programming','language']\nassert long_words(2,\"writing a program\")==['writing','program']\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n3\npython is a programming language\n\nOutput:\npython programming language\n\n\nExample 2:\nInput:\n2\nwriting a program\n\nOutput:\nwriting program\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 70, - "prompt": "Write a function to calculate whether the matrix is a magic square.", - "code": "def magic_square_test(my_matrix):\n iSize = len(my_matrix[0])\n sum_list = []\n sum_list.extend([sum (lines) for lines in my_matrix]) \n for col in range(iSize):\n sum_list.append(sum(row[col] for row in my_matrix))\n result1 = 0\n for i in range(0,iSize):\n result1 +=my_matrix[i][i]\n sum_list.append(result1) \n result2 = 0\n for i in range(iSize-1,-1,-1):\n result2 +=my_matrix[i][i]\n sum_list.append(result2)\n if len(set(sum_list))>1:\n return False\n return True", - "test_imports": [], - "test_list": [ - "assert magic_square_test([[7, 12, 1, 14], [2, 13, 8, 11], [16, 3, 10, 5], [9, 6, 15, 4]])==True", - "assert magic_square_test([[2, 7, 6], [9, 5, 1], [4, 3, 8]])==True", - "assert magic_square_test([[2, 7, 6], [9, 5, 1], [4, 3, 7]])==False" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "7 12 1 14\n2 13 8 11\n16 3 10 5\n9 6 15 4\n", - "2 7 6\n9 5 1\n4 3 8\n", - "2 7 6\n9 5 1\n4 3 7\n" - ], - "test_output": [ - "True\n", - "True\n", - "False\n" - ], - "example_input": [ - "7 12 1 14\n2 13 8 11\n16 3 10 5\n9 6 15 4\n", - "2 7 6\n9 5 1\n4 3 8\n" - ], - "example_output": [ - "True\n", - "True\n" - ], - "question": "Original problem description:\nWrite a function to calculate whether the matrix is a magic square.\nWe have its functional test sample:\nassert magic_square_test([[7, 12, 1, 14], [2, 13, 8, 11], [16, 3, 10, 5], [9, 6, 15, 4]])==True\nassert magic_square_test([[2, 7, 6], [9, 5, 1], [4, 3, 8]])==True\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n7 12 1 14\n2 13 8 11\n16 3 10 5\n9 6 15 4\n\nOutput:\nTrue\n\n\nExample 2:\nInput:\n2 7 6\n9 5 1\n4 3 8\n\nOutput:\nTrue\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 71, - "prompt": "Write a function to find the item with maximum frequency in a given list.", - "code": "from collections import defaultdict\ndef max_occurrences(nums):\n dict = defaultdict(int)\n for i in nums:\n dict[i] += 1\n result = max(dict.items(), key=lambda x: x[1]) \n return result[0]", - "test_imports": [], - "test_list": [ - "assert max_occurrences([2,3,8,4,7,9,8,2,6,5,1,6,1,2,3,2,4,6,9,1,2])==2", - "assert max_occurrences([2,3,8,4,7,9,8,7,9,15,14,10,12,13,16,18])==8", - "assert max_occurrences([10,20,20,30,40,90,80,50,30,20,50,10])==20" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "2 3 8 4 7 9 8 2 6 5 1 6 1 2 3 2 4 6 9 1 2\n", - "2 3 8 4 7 9 8 7 9 15 14 10 12 13 16 18\n", - "10 20 20 30 40 90 80 50 30 20 50 10\n" - ], - "test_output": [ - "2\n", - "8\n", - "20\n" - ], - "example_input": [ - "2 3 8 4 7 9 8 2 6 5 1 6 1 2 3 2 4 6 9 1 2\n", - "2 3 8 4 7 9 8 7 9 15 14 10 12 13 16 18\n" - ], - "example_output": [ - "2\n", - "8\n" - ], - "question": "Original problem description:\nWrite a function to find the item with maximum frequency in a given list.\nWe have its functional test sample:\nassert max_occurrences([2,3,8,4,7,9,8,2,6,5,1,6,1,2,3,2,4,6,9,1,2])==2\nassert max_occurrences([2,3,8,4,7,9,8,7,9,15,14,10,12,13,16,18])==8\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n2 3 8 4 7 9 8 2 6 5 1 6 1 2 3 2 4 6 9 1 2\n\nOutput:\n2\n\n\nExample 2:\nInput:\n2 3 8 4 7 9 8 7 9 15 14 10 12 13 16 18\n\nOutput:\n8\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 72, - "prompt": "Write a python function to reverse only the vowels of a given string (where y is not a vowel).", - "code": "def reverse_vowels(str1):\n\tvowels = \"\"\n\tfor char in str1:\n\t\tif char in \"aeiouAEIOU\":\n\t\t\tvowels += char\n\tresult_string = \"\"\n\tfor char in str1:\n\t\tif char in \"aeiouAEIOU\":\n\t\t\tresult_string += vowels[-1]\n\t\t\tvowels = vowels[:-1]\n\t\telse:\n\t\t\tresult_string += char\n\treturn result_string", - "test_imports": [], - "test_list": [ - "assert reverse_vowels(\"Python\") == \"Python\"", - "assert reverse_vowels(\"USA\") == \"ASU\"", - "assert reverse_vowels(\"ab\") == \"ab\"" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "Python\n", - "USA\n", - "ab\n" - ], - "test_output": [ - "Python\n", - "ASU\n", - "ab\n" - ], - "example_input": [ - "Python\n", - "USA\n" - ], - "example_output": [ - "Python\n", - "ASU\n" - ], - "question": "Original problem description:\nWrite a python function to reverse only the vowels of a given string (where y is not a vowel).\nWe have its functional test sample:\nassert reverse_vowels(\"Python\") == \"Python\"\nassert reverse_vowels(\"USA\") == \"ASU\"\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nPython\n\nOutput:\nPython\n\n\nExample 2:\nInput:\nUSA\n\nOutput:\nASU\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 73, - "prompt": "Write a function to convert a tuple to a string.", - "code": "def tup_string(tup1):\n str = ''.join(tup1)\n return str", - "test_imports": [], - "test_list": [ - "assert tup_string(('e', 'x', 'e', 'r', 'c', 'i', 's', 'e', 's'))==(\"exercises\")", - "assert tup_string(('p','y','t','h','o','n'))==(\"python\")", - "assert tup_string(('p','r','o','g','r','a','m'))==(\"program\")" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "e\nx\ne\nr\nc\ni\ns\ne\ns\n", - "p\ny\nt\nh\no\nn\n", - "p\nr\no\ng\nr\na\nm\n" - ], - "test_output": [ - "exercises\n", - "python\n", - "program\n" - ], - "example_input": [ - "e\nx\ne\nr\nc\ni\ns\ne\ns\n", - "p\ny\nt\nh\no\nn\n" - ], - "example_output": [ - "exercises\n", - "python\n" - ], - "question": "Original problem description:\nWrite a function to convert a tuple to a string.\nWe have its functional test sample:\nassert tup_string(('e', 'x', 'e', 'r', 'c', 'i', 's', 'e', 's'))==(\"exercises\")\nassert tup_string(('p','y','t','h','o','n'))==(\"python\")\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\ne\nx\ne\nr\nc\ni\ns\ne\ns\n\nOutput:\nexercises\n\n\nExample 2:\nInput:\np\ny\nt\nh\no\nn\n\nOutput:\npython\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 74, - "prompt": "Write a function to calculate the sum of the negative numbers of a given list of numbers.", - "code": "def sum_negativenum(nums):\n sum_negativenum = list(filter(lambda nums:nums<0,nums))\n return sum(sum_negativenum)", - "test_imports": [], - "test_list": [ - "assert sum_negativenum([2, 4, -6, -9, 11, -12, 14, -5, 17])==-32", - "assert sum_negativenum([10,15,-14,13,-18,12,-20])==-52", - "assert sum_negativenum([19, -65, 57, 39, 152,-639, 121, 44, 90, -190])==-894" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "2 4 -6 -9 11 -12 14 -5 17\n", - "10 15 -14 13 -18 12 -20\n", - "19 -65 57 39 152 -639 121 44 90 -190\n" - ], - "test_output": [ - "-32\n", - "-52\n", - "-894\n" - ], - "example_input": [ - "2 4 -6 -9 11 -12 14 -5 17\n", - "10 15 -14 13 -18 12 -20\n" - ], - "example_output": [ - "-32\n", - "-52\n" - ], - "question": "Original problem description:\nWrite a function to calculate the sum of the negative numbers of a given list of numbers.\nWe have its functional test sample:\nassert sum_negativenum([2, 4, -6, -9, 11, -12, 14, -5, 17])==-32\nassert sum_negativenum([10,15,-14,13,-18,12,-20])==-52\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n2 4 -6 -9 11 -12 14 -5 17\n\nOutput:\n-32\n\n\nExample 2:\nInput:\n10 15 -14 13 -18 12 -20\n\nOutput:\n-52\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 75, - "prompt": "Write a function to find the nth hexagonal number.", - "code": "def hexagonal_num(n): \n\treturn n*(2*n - 1) ", - "test_imports": [], - "test_list": [ - "assert hexagonal_num(10) == 190", - "assert hexagonal_num(5) == 45", - "assert hexagonal_num(7) == 91" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "10\n", - "5\n", - "7\n" - ], - "test_output": [ - "190\n", - "45\n", - "91\n" - ], - "example_input": [ - "10\n", - "5\n" - ], - "example_output": [ - "190\n", - "45\n" - ], - "question": "Original problem description:\nWrite a function to find the nth hexagonal number.\nWe have its functional test sample:\nassert hexagonal_num(10) == 190\nassert hexagonal_num(5) == 45\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n10\n\nOutput:\n190\n\n\nExample 2:\nInput:\n5\n\nOutput:\n45\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 77, - "prompt": "Write a python function to check whether the given number can be represented as sum of non-zero powers of 2 or not.", - "code": "def is_Sum_Of_Powers_Of_Two(n): \n if (n % 2 == 1): \n return False\n else: \n return True", - "test_imports": [], - "test_list": [ - "assert is_Sum_Of_Powers_Of_Two(10) == True", - "assert is_Sum_Of_Powers_Of_Two(7) == False", - "assert is_Sum_Of_Powers_Of_Two(14) == True" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "10\n", - "7\n", - "14\n" - ], - "test_output": [ - "True\n", - "False\n", - "True\n" - ], - "example_input": [ - "10\n", - "7\n" - ], - "example_output": [ - "True\n", - "False\n" - ], - "question": "Original problem description:\nWrite a python function to check whether the given number can be represented as sum of non-zero powers of 2 or not.\nWe have its functional test sample:\nassert is_Sum_Of_Powers_Of_Two(10) == True\nassert is_Sum_Of_Powers_Of_Two(7) == False\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n10\n\nOutput:\nTrue\n\n\nExample 2:\nInput:\n7\n\nOutput:\nFalse\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 79, - "prompt": "Write a function to flatten the list of lists into a single set of numbers.", - "code": "def extract_singly(test_list):\n res = []\n temp = set()\n for inner in test_list:\n for ele in inner:\n if not ele in temp:\n temp.add(ele)\n res.append(ele)\n return (res) ", - "test_imports": [], - "test_list": [ - "assert set(extract_singly([(3, 4, 5), (4, 5, 7), (1, 4)])) == set([3, 4, 5, 7, 1])", - "assert set(extract_singly([(1, 2, 3), (4, 2, 3), (7, 8)])) == set([1, 2, 3, 4, 7, 8])", - "assert set(extract_singly([(7, 8, 9), (10, 11, 12), (10, 11)])) == set([7, 8, 9, 10, 11, 12])" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "3 4 5\n4 5 7\n1 4\n", - "1 2 3\n4 2 3\n7 8\n", - "7 8 9\n10 11 12\n10 11\n" - ], - "test_output": [ - "3 4 5 7 1\n", - "1 2 3 4 7 8\n", - "7 8 9 10 11 12\n" - ], - "example_input": [ - "3 4 5\n4 5 7\n1 4\n", - "1 2 3\n4 2 3\n7 8\n" - ], - "example_output": [ - "3 4 5 7 1\n", - "1 2 3 4 7 8\n" - ], - "question": "Original problem description:\nWrite a function to flatten the list of lists into a single set of numbers.\nWe have its functional test sample:\nassert set(extract_singly([(3, 4, 5), (4, 5, 7), (1, 4)])) == set([3, 4, 5, 7, 1])\nassert set(extract_singly([(1, 2, 3), (4, 2, 3), (7, 8)])) == set([1, 2, 3, 4, 7, 8])\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n3 4 5\n4 5 7\n1 4\n\nOutput:\n3 4 5 7 1\n\n\nExample 2:\nInput:\n1 2 3\n4 2 3\n7 8\n\nOutput:\n1 2 3 4 7 8\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 80, - "prompt": "Write a function to sort a list of elements.", - "code": "def pancake_sort(nums):\n arr_len = len(nums)\n while arr_len > 1:\n mi = nums.index(max(nums[0:arr_len]))\n nums = nums[mi::-1] + nums[mi+1:len(nums)]\n nums = nums[arr_len-1::-1] + nums[arr_len:len(nums)]\n arr_len -= 1\n return nums", - "test_imports": [], - "test_list": [ - "assert pancake_sort([15, 79, 25, 38, 69]) == [15, 25, 38, 69, 79]", - "assert pancake_sort([98, 12, 54, 36, 85]) == [12, 36, 54, 85, 98]", - "assert pancake_sort([41, 42, 32, 12, 23]) == [12, 23, 32, 41, 42]" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "15 79 25 38 69\n", - "98 12 54 36 85\n", - "41 42 32 12 23\n" - ], - "test_output": [ - "15 25 38 69 79\n", - "12 36 54 85 98\n", - "12 23 32 41 42\n" - ], - "example_input": [ - "15 79 25 38 69\n", - "98 12 54 36 85\n" - ], - "example_output": [ - "15 25 38 69 79\n", - "12 36 54 85 98\n" - ], - "question": "Original problem description:\nWrite a function to sort a list of elements.\nWe have its functional test sample:\nassert pancake_sort([15, 79, 25, 38, 69]) == [15, 25, 38, 69, 79]\nassert pancake_sort([98, 12, 54, 36, 85]) == [12, 36, 54, 85, 98]\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n15 79 25 38 69\n\nOutput:\n15 25 38 69 79\n\n\nExample 2:\nInput:\n98 12 54 36 85\n\nOutput:\n12 36 54 85 98\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 81, - "prompt": "Write a function to count number items that are identical in the same position of three given lists.", - "code": "def count_samepair(list1,list2,list3):\n result = sum(m == n == o for m, n, o in zip(list1,list2,list3))\n return result", - "test_imports": [], - "test_list": [ - "assert count_samepair([1,2,3,4,5,6,7,8],[2,2,3,1,2,6,7,9],[2,1,3,1,2,6,7,9])==3", - "assert count_samepair([1,2,3,4,5,6,7,8],[2,2,3,1,2,6,7,8],[2,1,3,1,2,6,7,8])==4", - "assert count_samepair([1,2,3,4,2,6,7,8],[2,2,3,1,2,6,7,8],[2,1,3,1,2,6,7,8])==5" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 2 3 4 5 6 7 8\n2 2 3 1 2 6 7 9\n2 1 3 1 2 6 7 9\n", - "1 2 3 4 5 6 7 8\n2 2 3 1 2 6 7 8\n2 1 3 1 2 6 7 8\n", - "1 2 3 4 2 6 7 8\n2 2 3 1 2 6 7 8\n2 1 3 1 2 6 7 8\n" - ], - "test_output": [ - "3\n", - "4\n", - "5\n" - ], - "example_input": [ - "1 2 3 4 5 6 7 8\n2 2 3 1 2 6 7 9\n2 1 3 1 2 6 7 9\n", - "1 2 3 4 5 6 7 8\n2 2 3 1 2 6 7 8\n2 1 3 1 2 6 7 8\n" - ], - "example_output": [ - "3\n", - "4\n" - ], - "question": "Original problem description:\nWrite a function to count number items that are identical in the same position of three given lists.\nWe have its functional test sample:\nassert count_samepair([1,2,3,4,5,6,7,8],[2,2,3,1,2,6,7,9],[2,1,3,1,2,6,7,9])==3\nassert count_samepair([1,2,3,4,5,6,7,8],[2,2,3,1,2,6,7,8],[2,1,3,1,2,6,7,8])==4\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 2 3 4 5 6 7 8\n2 2 3 1 2 6 7 9\n2 1 3 1 2 6 7 9\n\nOutput:\n3\n\n\nExample 2:\nInput:\n1 2 3 4 5 6 7 8\n2 2 3 1 2 6 7 8\n2 1 3 1 2 6 7 8\n\nOutput:\n4\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 82, - "prompt": "Write a function to find number of lists present in the given tuple.", - "code": "def find_lists(Input): \n\tif isinstance(Input, list): \n\t\treturn 1\n\telse: \n\t\treturn len(Input) ", - "test_imports": [], - "test_list": [ - "assert find_lists(([1, 2, 3, 4], [5, 6, 7, 8])) == 2", - "assert find_lists(([1, 2], [3, 4], [5, 6])) == 3", - "assert find_lists(([9, 8, 7, 6, 5, 4, 3, 2, 1])) == 1" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 2 3 4\n5 6 7 8\n", - "1 2\n3 4\n5 6\n", - "9 8 7 6 5 4 3 2 1\n" - ], - "test_output": [ - "2\n", - "3\n", - "1\n" - ], - "example_input": [ - "1 2 3 4\n5 6 7 8\n", - "1 2\n3 4\n5 6\n" - ], - "example_output": [ - "2\n", - "3\n" - ], - "question": "Original problem description:\nWrite a function to find number of lists present in the given tuple.\nWe have its functional test sample:\nassert find_lists(([1, 2, 3, 4], [5, 6, 7, 8])) == 2\nassert find_lists(([1, 2], [3, 4], [5, 6])) == 3\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 2 3 4\n5 6 7 8\n\nOutput:\n2\n\n\nExample 2:\nInput:\n1 2\n3 4\n5 6\n\nOutput:\n3\n\n\n" - }, - { - "source_file": "Mike's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 83, - "prompt": "Write a python function to find the maximum difference between any two elements in a given array.", - "code": "def max_Abs_Diff(arr): \n n = len(arr)\n minEle = arr[0] \n maxEle = arr[0] \n for i in range(1, n): \n minEle = min(minEle,arr[i]) \n maxEle = max(maxEle,arr[i]) \n return (maxEle - minEle) ", - "test_imports": [], - "test_list": [ - "assert max_Abs_Diff((2,1,5,3)) == 4", - "assert max_Abs_Diff((9,3,2,5,1)) == 8", - "assert max_Abs_Diff((3,2,1)) == 2" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "2\n1\n5\n3\n", - "9\n3\n2\n5\n1\n", - "3\n2\n1\n" - ], - "test_output": [ - "4\n", - "8\n", - "2\n" - ], - "example_input": [ - "2\n1\n5\n3\n", - "9\n3\n2\n5\n1\n" - ], - "example_output": [ - "4\n", - "8\n" - ], - "question": "Original problem description:\nWrite a python function to find the maximum difference between any two elements in a given array.\nWe have its functional test sample:\nassert max_Abs_Diff((2,1,5,3)) == 4\nassert max_Abs_Diff((9,3,2,5,1)) == 8\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n2\n1\n5\n3\n\nOutput:\n4\n\n\nExample 2:\nInput:\n9\n3\n2\n5\n1\n\nOutput:\n8\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 84, - "prompt": "Write a function that returns integers x and y that satisfy ax + by = n as a tuple, or return None if no solution exists.", - "code": "def find_solution(a, b, n):\n\ti = 0\n\twhile i * a <= n:\n\t\tif (n - (i * a)) % b == 0: \n\t\t\treturn (i, (n - (i * a)) // b)\n\t\ti = i + 1\n\treturn None", - "test_imports": [], - "test_list": [ - "assert find_solution(2, 3, 7) == (2, 1)", - "assert find_solution(4, 2, 7) == None", - "assert find_solution(1, 13, 17) == (4, 1)" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "2\n3\n7\n", - "4\n2\n7\n", - "1\n13\n17\n" - ], - "test_output": [ - "2 1\n", - "None\n", - "4 1\n" - ], - "example_input": [ - "2\n3\n7\n", - "4\n2\n7\n" - ], - "example_output": [ - "2 1\n", - "None\n" - ], - "question": "Original problem description:\nWrite a function that returns integers x and y that satisfy ax + by = n as a tuple, or return None if no solution exists.\nWe have its functional test sample:\nassert find_solution(2, 3, 7) == (2, 1)\nassert find_solution(4, 2, 7) == None\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n2\n3\n7\n\nOutput:\n2 1\n\n\nExample 2:\nInput:\n4\n2\n7\n\nOutput:\nNone\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 85, - "prompt": "Write a function to remove all elements from a given list present in another list.", - "code": "def remove_elements(list1, list2):\n result = [x for x in list1 if x not in list2]\n return result", - "test_imports": [], - "test_list": [ - "assert remove_elements([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [2, 4, 6, 8]) == [1, 3, 5, 7, 9, 10]", - "assert remove_elements([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 3, 5, 7]) == [2, 4, 6, 8, 9, 10]", - "assert remove_elements([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [5, 7]) == [1, 2, 3, 4, 6, 8, 9, 10]" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 2 3 4 5 6 7 8 9 10\n2 4 6 8\n", - "1 2 3 4 5 6 7 8 9 10\n1 3 5 7\n", - "1 2 3 4 5 6 7 8 9 10\n5 7\n" - ], - "test_output": [ - "1 3 5 7 9 10\n", - "2 4 6 8 9 10\n", - "1 2 3 4 6 8 9 10\n" - ], - "example_input": [ - "1 2 3 4 5 6 7 8 9 10\n2 4 6 8\n", - "1 2 3 4 5 6 7 8 9 10\n1 3 5 7\n" - ], - "example_output": [ - "1 3 5 7 9 10\n", - "2 4 6 8 9 10\n" - ], - "question": "Original problem description:\nWrite a function to remove all elements from a given list present in another list.\nWe have its functional test sample:\nassert remove_elements([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [2, 4, 6, 8]) == [1, 3, 5, 7, 9, 10]\nassert remove_elements([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 3, 5, 7]) == [2, 4, 6, 8, 9, 10]\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 2 3 4 5 6 7 8 9 10\n2 4 6 8\n\nOutput:\n1 3 5 7 9 10\n\n\nExample 2:\nInput:\n1 2 3 4 5 6 7 8 9 10\n1 3 5 7\n\nOutput:\n2 4 6 8 9 10\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 86, - "prompt": "Write a function to calculate the sum (n - 2*i) from i=0 to n // 2, for instance n + (n-2) + (n-4)... (until n-x =< 0).", - "code": "def sum_series(n):\n if n < 1:\n return 0\n else:\n return n + sum_series(n - 2)", - "test_imports": [], - "test_list": [ - "assert sum_series(6) == 12", - "assert sum_series(10) == 30", - "assert sum_series(9) == 25" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "6\n", - "10\n", - "9\n" - ], - "test_output": [ - "12\n", - "30\n", - "25\n" - ], - "example_input": [ - "6\n", - "10\n" - ], - "example_output": [ - "12\n", - "30\n" - ], - "question": "Original problem description:\nWrite a function to calculate the sum (n - 2*i) from i=0 to n // 2, for instance n + (n-2) + (n-4)... (until n-x =< 0).\nWe have its functional test sample:\nassert sum_series(6) == 12\nassert sum_series(10) == 30\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n6\n\nOutput:\n12\n\n\nExample 2:\nInput:\n10\n\nOutput:\n30\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 88, - "prompt": "Write a function to determine if the sum of the divisors of two integers are the same.", - "code": "import math \ndef div_sum(n): \n total = 1\n i = 2\n\n while i * i <= n:\n if (n % i == 0):\n total = (total + i + math.floor(n / i))\n i += 1\n\n return total\n\ndef are_equivalent(num1, num2): \n return div_sum(num1) == div_sum(num2); ", - "test_imports": [], - "test_list": [ - "assert are_equivalent(36, 57) == False", - "assert are_equivalent(2, 4) == False", - "assert are_equivalent(23, 47) == True" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "36\n57\n", - "2\n4\n", - "23\n47\n" - ], - "test_output": [ - "False\n", - "False\n", - "True\n" - ], - "example_input": [ - "36\n57\n", - "2\n4\n" - ], - "example_output": [ - "False\n", - "False\n" - ], - "question": "Original problem description:\nWrite a function to determine if the sum of the divisors of two integers are the same.\nWe have its functional test sample:\nassert are_equivalent(36, 57) == False\nassert are_equivalent(2, 4) == False\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n36\n57\n\nOutput:\nFalse\n\n\nExample 2:\nInput:\n2\n4\n\nOutput:\nFalse\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 89, - "prompt": "Write a function to count the number of characters in a string that occur at the same position in the string as in the English alphabet (case insensitive).", - "code": "def count_char_position(str1): \n count_chars = 0\n for i in range(len(str1)):\n if ((i == ord(str1[i]) - ord('A')) or \n (i == ord(str1[i]) - ord('a'))): \n count_chars += 1\n return count_chars ", - "test_imports": [], - "test_list": [ - "assert count_char_position(\"xbcefg\") == 2", - "assert count_char_position(\"ABcED\") == 3", - "assert count_char_position(\"AbgdeF\") == 5" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "xbcefg\n", - "ABcED\n", - "AbgdeF\n" - ], - "test_output": [ - "2\n", - "3\n", - "5\n" - ], - "example_input": [ - "xbcefg\n", - "ABcED\n" - ], - "example_output": [ - "2\n", - "3\n" - ], - "question": "Original problem description:\nWrite a function to count the number of characters in a string that occur at the same position in the string as in the English alphabet (case insensitive).\nWe have its functional test sample:\nassert count_char_position(\"xbcefg\") == 2\nassert count_char_position(\"ABcED\") == 3\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nxbcefg\n\nOutput:\n2\n\n\nExample 2:\nInput:\nABcED\n\nOutput:\n3\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 90, - "prompt": "Write a function that counts the number of pairs of integers in a list that xor to an even number.", - "code": "def find_even_pair(A): \n count = 0\n for i in range(0, len(A)): \n for j in range(i+1, len(A)): \n if ((A[i] ^ A[j]) % 2 == 0): \n count += 1\n\n return count", - "test_imports": [], - "test_list": [ - "assert find_even_pair([5, 4, 7, 2, 1]) == 4", - "assert find_even_pair([7, 2, 8, 1, 0, 5, 11]) == 9", - "assert find_even_pair([1, 2, 3]) == 1" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "5 4 7 2 1\n", - "7 2 8 1 0 5 11\n", - "1 2 3\n" - ], - "test_output": [ - "4\n", - "9\n", - "1\n" - ], - "example_input": [ - "5 4 7 2 1\n", - "7 2 8 1 0 5 11\n" - ], - "example_output": [ - "4\n", - "9\n" - ], - "question": "Original problem description:\nWrite a function that counts the number of pairs of integers in a list that xor to an even number.\nWe have its functional test sample:\nassert find_even_pair([5, 4, 7, 2, 1]) == 4\nassert find_even_pair([7, 2, 8, 1, 0, 5, 11]) == 9\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n5 4 7 2 1\n\nOutput:\n4\n\n\nExample 2:\nInput:\n7 2 8 1 0 5 11\n\nOutput:\n9\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 91, - "prompt": "Write a python function to find the smallest power of 2 greater than or equal to n.", - "code": "def next_power_of_2(n): \n if n and not n & (n - 1):\n return n\n\n count = 0\n while n != 0: \n n >>= 1\n count += 1\n\n return 1 << count; ", - "test_imports": [], - "test_list": [ - "assert next_power_of_2(0) == 1", - "assert next_power_of_2(5) == 8", - "assert next_power_of_2(17) == 32" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "0\n", - "5\n", - "17\n" - ], - "test_output": [ - "1\n", - "8\n", - "32\n" - ], - "example_input": [ - "0\n", - "5\n" - ], - "example_output": [ - "1\n", - "8\n" - ], - "question": "Original problem description:\nWrite a python function to find the smallest power of 2 greater than or equal to n.\nWe have its functional test sample:\nassert next_power_of_2(0) == 1\nassert next_power_of_2(5) == 8\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n0\n\nOutput:\n1\n\n\nExample 2:\nInput:\n5\n\nOutput:\n8\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 92, - "prompt": "Write a function to count the number of occurrences of a number in a given list.", - "code": "def frequency(a,x): \n count = 0 \n for i in a: \n if i == x: \n count += 1\n\n return count ", - "test_imports": [], - "test_list": [ - "assert frequency([1,2,3], 4) == 0", - "assert frequency([1,2,2,3,3,3,4], 3) == 3", - "assert frequency([0,1,2,3,1,2], 1) == 2" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 2 3\n4\n", - "1 2 2 3 3 3 4\n3\n", - "0 1 2 3 1 2\n1\n" - ], - "test_output": [ - "0\n", - "3\n", - "2\n" - ], - "example_input": [ - "1 2 3\n4\n", - "1 2 2 3 3 3 4\n3\n" - ], - "example_output": [ - "0\n", - "3\n" - ], - "question": "Original problem description:\nWrite a function to count the number of occurrences of a number in a given list.\nWe have its functional test sample:\nassert frequency([1,2,3], 4) == 0\nassert frequency([1,2,2,3,3,3,4], 3) == 3\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 2 3\n4\n\nOutput:\n0\n\n\nExample 2:\nInput:\n1 2 2 3 3 3 4\n3\n\nOutput:\n3\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 93, - "prompt": "Write a function to find the sum of numbers in a list within a range specified by two indices.", - "code": "def sum_range_list(list1, m, n): \n sum_range = 0 \n for i in range(m, n+1, 1): \n sum_range += list1[i] \n return sum_range ", - "test_imports": [], - "test_list": [ - "assert sum_range_list([2,1,5,6,8,3,4,9,10,11,8,12], 8, 10) == 29", - "assert sum_range_list([2,1,5,6,8,3,4,9,10,11,8,12], 5, 7) == 16", - "assert sum_range_list([2,1,5,6,8,3,4,9,10,11,8,12], 7, 10) == 38" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "2 1 5 6 8 3 4 9 10 11 8 12\n8\n10\n", - "2 1 5 6 8 3 4 9 10 11 8 12\n5\n7\n", - "2 1 5 6 8 3 4 9 10 11 8 12\n7\n10\n" - ], - "test_output": [ - "29\n", - "16\n", - "38\n" - ], - "example_input": [ - "2 1 5 6 8 3 4 9 10 11 8 12\n8\n10\n", - "2 1 5 6 8 3 4 9 10 11 8 12\n5\n7\n" - ], - "example_output": [ - "29\n", - "16\n" - ], - "question": "Original problem description:\nWrite a function to find the sum of numbers in a list within a range specified by two indices.\nWe have its functional test sample:\nassert sum_range_list([2,1,5,6,8,3,4,9,10,11,8,12], 8, 10) == 29\nassert sum_range_list([2,1,5,6,8,3,4,9,10,11,8,12], 5, 7) == 16\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n2 1 5 6 8 3 4 9 10 11 8 12\n8\n10\n\nOutput:\n29\n\n\nExample 2:\nInput:\n2 1 5 6 8 3 4 9 10 11 8 12\n5\n7\n\nOutput:\n16\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 94, - "prompt": "Write a function to find the perimeter of a regular pentagon from the length of its sides.", - "code": "import math\ndef perimeter_pentagon(a):\n perimeter=(5*a)\n return perimeter", - "test_imports": [], - "test_list": [ - "assert perimeter_pentagon(5) == 25", - "assert perimeter_pentagon(10) == 50", - "assert perimeter_pentagon(15) == 75" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "5\n", - "10\n", - "15\n" - ], - "test_output": [ - "25\n", - "50\n", - "75\n" - ], - "example_input": [ - "5\n", - "10\n" - ], - "example_output": [ - "25\n", - "50\n" - ], - "question": "Original problem description:\nWrite a function to find the perimeter of a regular pentagon from the length of its sides.\nWe have its functional test sample:\nassert perimeter_pentagon(5) == 25\nassert perimeter_pentagon(10) == 50\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n5\n\nOutput:\n25\n\n\nExample 2:\nInput:\n10\n\nOutput:\n50\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 95, - "prompt": "Write a function to count the number of occurence of the string 'std' in a given string.", - "code": "def count_occurance(s):\n count = 0\n for i in range(len(s) - 2):\n if (s[i] == 's' and s[i+1] == 't' and s[i+2] == 'd'):\n count = count + 1\n return count", - "test_imports": [], - "test_list": [ - "assert count_occurance(\"letstdlenstdporstd\") == 3", - "assert count_occurance(\"truststdsolensporsd\") == 1", - "assert count_occurance(\"makestdsostdworthit\") == 2", - "assert count_occurance(\"stds\") == 1", - "assert count_occurance(\"\") == 0" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "letstdlenstdporstd\n", - "truststdsolensporsd\n", - "makestdsostdworthit\n", - "stds\n", - "\n" - ], - "test_output": [ - "3\n", - "1\n", - "2\n", - "1\n", - "0\n" - ], - "example_input": [ - "letstdlenstdporstd\n", - "truststdsolensporsd\n" - ], - "example_output": [ - "3\n", - "1\n" - ], - "question": "Original problem description:\nWrite a function to count the number of occurence of the string 'std' in a given string.\nWe have its functional test sample:\nassert count_occurance(\"letstdlenstdporstd\") == 3\nassert count_occurance(\"truststdsolensporsd\") == 1\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nletstdlenstdporstd\n\nOutput:\n3\n\n\nExample 2:\nInput:\ntruststdsolensporsd\n\nOutput:\n1\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 96, - "prompt": "Write a function to check if all the elements in tuple have same data type or not.", - "code": "def check_type(test_tuple):\n res = True\n for ele in test_tuple:\n if not isinstance(ele, type(test_tuple[0])):\n res = False\n break\n return (res) ", - "test_imports": [], - "test_list": [ - "assert check_type((5, 6, 7, 3, 5, 6) ) == True", - "assert check_type((1, 2, \"4\") ) == False", - "assert check_type((3, 2, 1, 4, 5) ) == True" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "5\n6\n7\n3\n5\n6\n", - "1\n2\n4\n", - "3\n2\n1\n4\n5\n" - ], - "test_output": [ - "True\n", - "False\n", - "True\n" - ], - "example_input": [ - "5\n6\n7\n3\n5\n6\n", - "1\n2\n4\n" - ], - "example_output": [ - "True\n", - "False\n" - ], - "question": "Original problem description:\nWrite a function to check if all the elements in tuple have same data type or not.\nWe have its functional test sample:\nassert check_type((5, 6, 7, 3, 5, 6) ) == True\nassert check_type((1, 2, \"4\") ) == False\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n5\n6\n7\n3\n5\n6\n\nOutput:\nTrue\n\n\nExample 2:\nInput:\n1\n2\n4\n\nOutput:\nFalse\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 97, - "prompt": "Write a function that takes in a sorted array, its length (n), and an element and returns whether the element is the majority element in the given sorted array. (The majority element is the element that occurs more than n/2 times.)", - "code": "def is_majority(arr, n, x):\n\ti = binary_search(arr, 0, n-1, x)\n\tif i == -1:\n\t\treturn False\n\tif ((i + n//2) <= (n -1)) and arr[i + n//2] == x:\n\t\treturn True\n\telse:\n\t\treturn False\ndef binary_search(arr, low, high, x):\n\tif high >= low:\n\t\tmid = (low + high)//2 \n\t\tif (mid == 0 or x > arr[mid-1]) and (arr[mid] == x):\n\t\t\treturn mid\n\t\telif x > arr[mid]:\n\t\t\treturn binary_search(arr, (mid + 1), high, x)\n\t\telse:\n\t\t\treturn binary_search(arr, low, (mid -1), x)\n\treturn -1", - "test_imports": [], - "test_list": [ - "assert is_majority([1, 2, 3, 3, 3, 3, 10], 7, 3) == True", - "assert is_majority([1, 1, 2, 4, 4, 4, 6, 6], 8, 4) == False", - "assert is_majority([1, 1, 1, 2, 2], 5, 1) == True", - "assert is_majority([1, 1, 2, 2], 5, 1) == False" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 2 3 3 3 3 10\n7\n3\n", - "1 1 2 4 4 4 6 6\n8\n4\n", - "1 1 1 2 2\n5\n1\n", - "1 1 2 2\n5\n1\n" - ], - "test_output": [ - "True\n", - "False\n", - "True\n", - "False\n" - ], - "example_input": [ - "1 2 3 3 3 3 10\n7\n3\n", - "1 1 2 4 4 4 6 6\n8\n4\n" - ], - "example_output": [ - "True\n", - "False\n" - ], - "question": "Original problem description:\nWrite a function that takes in a sorted array, its length (n), and an element and returns whether the element is the majority element in the given sorted array. (The majority element is the element that occurs more than n/2 times.)\nWe have its functional test sample:\nassert is_majority([1, 2, 3, 3, 3, 3, 10], 7, 3) == True\nassert is_majority([1, 1, 2, 4, 4, 4, 6, 6], 8, 4) == False\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 2 3 3 3 3 10\n7\n3\n\nOutput:\nTrue\n\n\nExample 2:\nInput:\n1 1 2 4 4 4 6 6\n8\n4\n\nOutput:\nFalse\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 98, - "prompt": "Write a python function to count the number of set bits (binary digits with value 1) in a given number.", - "code": "def count_Set_Bits(n): \n count = 0\n while (n): \n count += n & 1\n n >>= 1\n return count ", - "test_imports": [], - "test_list": [ - "assert count_Set_Bits(2) == 1", - "assert count_Set_Bits(4) == 1", - "assert count_Set_Bits(6) == 2" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "2\n", - "4\n", - "6\n" - ], - "test_output": [ - "1\n", - "1\n", - "2\n" - ], - "example_input": [ - "2\n", - "4\n" - ], - "example_output": [ - "1\n", - "1\n" - ], - "question": "Original problem description:\nWrite a python function to count the number of set bits (binary digits with value 1) in a given number.\nWe have its functional test sample:\nassert count_Set_Bits(2) == 1\nassert count_Set_Bits(4) == 1\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n2\n\nOutput:\n1\n\n\nExample 2:\nInput:\n4\n\nOutput:\n1\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 99, - "prompt": "Write a python function to remove the characters which have odd index values of a given string.", - "code": "def odd_values_string(str):\n result = \"\" \n for i in range(len(str)):\n if i % 2 == 0:\n result = result + str[i]\n return result", - "test_imports": [], - "test_list": [ - "assert odd_values_string('abcdef') == 'ace'", - "assert odd_values_string('python') == 'pto'", - "assert odd_values_string('data') == 'dt'", - "assert odd_values_string('lambs') == 'lms'" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "abcdef\n", - "python\n", - "data\n", - "lambs\n" - ], - "test_output": [ - "ace\n", - "pto\n", - "dt\n", - "lms\n" - ], - "example_input": [ - "abcdef\n", - "python\n" - ], - "example_output": [ - "ace\n", - "pto\n" - ], - "question": "Original problem description:\nWrite a python function to remove the characters which have odd index values of a given string.\nWe have its functional test sample:\nassert odd_values_string('abcdef') == 'ace'\nassert odd_values_string('python') == 'pto'\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nabcdef\n\nOutput:\nace\n\n\nExample 2:\nInput:\npython\n\nOutput:\npto\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 100, - "prompt": "Write a function to find minimum of three numbers.", - "code": "def min_of_three(a,b,c): \n if (a <= b) and (a <= c): \n smallest = a \n elif (b <= a) and (b <= c): \n smallest = b \n else: \n smallest = c \n return smallest ", - "test_imports": [], - "test_list": [ - "assert min_of_three(10,20,0)==0", - "assert min_of_three(19,15,18)==15", - "assert min_of_three(-10,-20,-30)==-30" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "10\n20\n0\n", - "19\n15\n18\n", - "-10\n-20\n-30\n" - ], - "test_output": [ - "0\n", - "15\n", - "-30\n" - ], - "example_input": [ - "10\n20\n0\n", - "19\n15\n18\n" - ], - "example_output": [ - "0\n", - "15\n" - ], - "question": "Original problem description:\nWrite a function to find minimum of three numbers.\nWe have its functional test sample:\nassert min_of_three(10,20,0)==0\nassert min_of_three(19,15,18)==15\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n10\n20\n0\n\nOutput:\n0\n\n\nExample 2:\nInput:\n19\n15\n18\n\nOutput:\n15\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 101, - "prompt": "Write a python function to check whether all the bits are unset in the given range or not.", - "code": "def all_Bits_Set_In_The_Given_Range(n,l,r): \n num = (((1 << r) - 1) ^ ((1 << (l - 1)) - 1)) \n new_num = n & num\n if (new_num == 0): \n return True\n return False", - "test_imports": [], - "test_list": [ - "assert all_Bits_Set_In_The_Given_Range(4,1,2) == True", - "assert all_Bits_Set_In_The_Given_Range(17,2,4) == True", - "assert all_Bits_Set_In_The_Given_Range(39,4,6) == False" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "4\n1\n2\n", - "17\n2\n4\n", - "39\n4\n6\n" - ], - "test_output": [ - "True\n", - "True\n", - "False\n" - ], - "example_input": [ - "4\n1\n2\n", - "17\n2\n4\n" - ], - "example_output": [ - "True\n", - "True\n" - ], - "question": "Original problem description:\nWrite a python function to check whether all the bits are unset in the given range or not.\nWe have its functional test sample:\nassert all_Bits_Set_In_The_Given_Range(4,1,2) == True\nassert all_Bits_Set_In_The_Given_Range(17,2,4) == True\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n4\n1\n2\n\nOutput:\nTrue\n\n\nExample 2:\nInput:\n17\n2\n4\n\nOutput:\nTrue\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 102, - "prompt": "Write a function that takes in an array and an integer n, and re-arranges the first n elements of the given array so that all negative elements appear before positive ones, and where the relative order among negative and positive elements is preserved.", - "code": "def re_arrange_array(arr, n):\n j=0\n for i in range(0, n):\n if (arr[i] < 0):\n temp = arr[i]\n arr[i] = arr[j]\n arr[j] = temp\n j = j + 1\n return arr", - "test_imports": [], - "test_list": [ - "assert re_arrange_array([-1, 2, -3, 4, 5, 6, -7, 8, 9], 9) == [-1, -3, -7, 4, 5, 6, 2, 8, 9]", - "assert re_arrange_array([12, -14, -26, 13, 15], 5) == [-14, -26, 12, 13, 15]", - "assert re_arrange_array([10, 24, 36, -42, -39, -78, 85], 7) == [-42, -39, -78, 10, 24, 36, 85]" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "-1 2 -3 4 5 6 -7 8 9\n9\n", - "12 -14 -26 13 15\n5\n", - "10 24 36 -42 -39 -78 85\n7\n" - ], - "test_output": [ - "-1 -3 -7 4 5 6 2 8 9\n", - "-14 -26 12 13 15\n", - "-42 -39 -78 10 24 36 85\n" - ], - "example_input": [ - "-1 2 -3 4 5 6 -7 8 9\n9\n", - "12 -14 -26 13 15\n5\n" - ], - "example_output": [ - "-1 -3 -7 4 5 6 2 8 9\n", - "-14 -26 12 13 15\n" - ], - "question": "Original problem description:\nWrite a function that takes in an array and an integer n, and re-arranges the first n elements of the given array so that all negative elements appear before positive ones, and where the relative order among negative and positive elements is preserved.\nWe have its functional test sample:\nassert re_arrange_array([-1, 2, -3, 4, 5, 6, -7, 8, 9], 9) == [-1, -3, -7, 4, 5, 6, 2, 8, 9]\nassert re_arrange_array([12, -14, -26, 13, 15], 5) == [-14, -26, 12, 13, 15]\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n-1 2 -3 4 5 6 -7 8 9\n9\n\nOutput:\n-1 -3 -7 4 5 6 2 8 9\n\n\nExample 2:\nInput:\n12 -14 -26 13 15\n5\n\nOutput:\n-14 -26 12 13 15\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 103, - "prompt": "Write a function that takes in a string and character, replaces blank spaces in the string with the character, and returns the string.", - "code": "def replace_blank(str1,char):\n str2 = str1.replace(' ', char)\n return str2", - "test_imports": [], - "test_list": [ - "assert replace_blank(\"hello people\",'@')==(\"hello@people\")", - "assert replace_blank(\"python program language\",'$')==(\"python$program$language\")", - "assert replace_blank(\"blank space\",\"-\")==(\"blank-space\")" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "hello people\n@\n", - "python program language\n$\n", - "blank space\n-\n" - ], - "test_output": [ - "hello@people\n", - "python$program$language\n", - "blank-space\n" - ], - "example_input": [ - "hello people\n@\n", - "python program language\n$\n" - ], - "example_output": [ - "hello@people\n", - "python$program$language\n" - ], - "question": "Original problem description:\nWrite a function that takes in a string and character, replaces blank spaces in the string with the character, and returns the string.\nWe have its functional test sample:\nassert replace_blank(\"hello people\",'@')==(\"hello@people\")\nassert replace_blank(\"python program language\",'$')==(\"python$program$language\")\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nhello people\n@\n\nOutput:\nhello@people\n\n\nExample 2:\nInput:\npython program language\n$\n\nOutput:\npython$program$language\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 104, - "prompt": "Write a function that takes in a list and an integer n and returns a list containing the n largest items from the list.", - "code": "import heapq\ndef larg_nnum(list1,n):\n largest=heapq.nlargest(n,list1)\n return largest", - "test_imports": [], - "test_list": [ - "assert set(larg_nnum([10, 20, 50, 70, 90, 20, 50, 40, 60, 80, 100],2))==set([100,90])", - "assert set(larg_nnum([10, 20, 50, 70, 90, 20, 50, 40, 60, 80, 100],5))==set([100,90,80,70,60])", - "assert set(larg_nnum([10, 20, 50, 70, 90, 20, 50, 40, 60, 80, 100],3))==set([100,90,80])" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "10 20 50 70 90 20 50 40 60 80 100\n2\n", - "10 20 50 70 90 20 50 40 60 80 100\n5\n", - "10 20 50 70 90 20 50 40 60 80 100\n3\n" - ], - "test_output": [ - "100 90\n", - "100 90 80 70 60\n", - "100 90 80\n" - ], - "example_input": [ - "10 20 50 70 90 20 50 40 60 80 100\n2\n", - "10 20 50 70 90 20 50 40 60 80 100\n5\n" - ], - "example_output": [ - "100 90\n", - "100 90 80 70 60\n" - ], - "question": "Original problem description:\nWrite a function that takes in a list and an integer n and returns a list containing the n largest items from the list.\nWe have its functional test sample:\nassert set(larg_nnum([10, 20, 50, 70, 90, 20, 50, 40, 60, 80, 100],2))==set([100,90])\nassert set(larg_nnum([10, 20, 50, 70, 90, 20, 50, 40, 60, 80, 100],5))==set([100,90,80,70,60])\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n10 20 50 70 90 20 50 40 60 80 100\n2\n\nOutput:\n100 90\n\n\nExample 2:\nInput:\n10 20 50 70 90 20 50 40 60 80 100\n5\n\nOutput:\n100 90 80 70 60\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 106, - "prompt": "Write a function to find the volume of a cube given its side length.", - "code": "def volume_cube(l):\n volume = l * l * l\n return volume", - "test_imports": [], - "test_list": [ - "assert volume_cube(3)==27", - "assert volume_cube(2)==8", - "assert volume_cube(5)==125" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "3\n", - "2\n", - "5\n" - ], - "test_output": [ - "27\n", - "8\n", - "125\n" - ], - "example_input": [ - "3\n", - "2\n" - ], - "example_output": [ - "27\n", - "8\n" - ], - "question": "Original problem description:\nWrite a function to find the volume of a cube given its side length.\nWe have its functional test sample:\nassert volume_cube(3)==27\nassert volume_cube(2)==8\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n3\n\nOutput:\n27\n\n\nExample 2:\nInput:\n2\n\nOutput:\n8\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 107, - "prompt": "Write a python function to set all even bits of a given number.", - "code": "def even_bit_set_number(n): \n count = 0;res = 0;temp = n \n while(temp > 0): \n if (count % 2 == 1): \n res |= (1 << count)\n count+=1\n temp >>= 1\n return (n | res) ", - "test_imports": [], - "test_list": [ - "assert even_bit_set_number(10) == 10", - "assert even_bit_set_number(20) == 30", - "assert even_bit_set_number(30) == 30" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "10\n", - "20\n", - "30\n" - ], - "test_output": [ - "10\n", - "30\n", - "30\n" - ], - "example_input": [ - "10\n", - "20\n" - ], - "example_output": [ - "10\n", - "30\n" - ], - "question": "Original problem description:\nWrite a python function to set all even bits of a given number.\nWe have its functional test sample:\nassert even_bit_set_number(10) == 10\nassert even_bit_set_number(20) == 30\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n10\n\nOutput:\n10\n\n\nExample 2:\nInput:\n20\n\nOutput:\n30\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 109, - "prompt": "Write a python function to count the number of non-empty substrings of a given string.", - "code": "def number_of_substrings(str): \n\tstr_len = len(str); \n\treturn int(str_len * (str_len + 1) / 2); ", - "test_imports": [], - "test_list": [ - "assert number_of_substrings(\"abc\") == 6", - "assert number_of_substrings(\"abcd\") == 10", - "assert number_of_substrings(\"abcde\") == 15" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "abc\n", - "abcd\n", - "abcde\n" - ], - "test_output": [ - "6\n", - "10\n", - "15\n" - ], - "example_input": [ - "abc\n", - "abcd\n" - ], - "example_output": [ - "6\n", - "10\n" - ], - "question": "Original problem description:\nWrite a python function to count the number of non-empty substrings of a given string.\nWe have its functional test sample:\nassert number_of_substrings(\"abc\") == 6\nassert number_of_substrings(\"abcd\") == 10\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nabc\n\nOutput:\n6\n\n\nExample 2:\nInput:\nabcd\n\nOutput:\n10\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 110, - "prompt": "Write a function that takes in positive integers m and n and finds the number of possible sequences of length n, such that each element is a positive integer and is greater than or equal to twice the previous element but less than or equal to m.", - "code": "def get_total_number_of_sequences(m,n): \n\tT=[[0 for i in range(n+1)] for i in range(m+1)] \n\tfor i in range(m+1): \n\t\tfor j in range(n+1): \n\t\t\tif i==0 or j==0: \n\t\t\t\tT[i][j]=0\n\t\t\telif i arr[j] and MSIBS[i] < MSIBS[j] + arr[i]: \n\t\t\t\tMSIBS[i] = MSIBS[j] + arr[i] \n\tMSDBS = arr[:] \n\tfor i in range(1, len(arr) + 1): \n\t\tfor j in range(1, i): \n\t\t\tif arr[-i] > arr[-j] and MSDBS[-i] < MSDBS[-j] + arr[-i]: \n\t\t\t\tMSDBS[-i] = MSDBS[-j] + arr[-i] \n\tmax_sum = float(\"-Inf\") \n\tfor i, j, k in zip(MSIBS, MSDBS, arr): \n\t\tmax_sum = max(max_sum, i + j - k) \n\treturn max_sum", - "test_imports": [], - "test_list": [ - "assert max_sum([1, 15, 51, 45, 33, 100, 12, 18, 9]) == 194", - "assert max_sum([80, 60, 30, 40, 20, 10]) == 210", - "assert max_sum([2, 3 ,14, 16, 21, 23, 29, 30]) == 138" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 15 51 45 33 100 12 18 9\n", - "80 60 30 40 20 10\n", - "2 3 14 16 21 23 29 30\n" - ], - "test_output": [ - "194\n", - "210\n", - "138\n" - ], - "example_input": [ - "1 15 51 45 33 100 12 18 9\n", - "80 60 30 40 20 10\n" - ], - "example_output": [ - "194\n", - "210\n" - ], - "question": "Original problem description:\nWrite a function that takes an array and finds the maximum sum of a bitonic subsequence for the given array, where a sequence is bitonic if it is first increasing and then decreasing.\nWe have its functional test sample:\nassert max_sum([1, 15, 51, 45, 33, 100, 12, 18, 9]) == 194\nassert max_sum([80, 60, 30, 40, 20, 10]) == 210\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 15 51 45 33 100 12 18 9\n\nOutput:\n194\n\n\nExample 2:\nInput:\n80 60 30 40 20 10\n\nOutput:\n210\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 116, - "prompt": "Write a function to find the length of the longest palindromic subsequence in the given string.", - "code": "def lps(str): \n\tn = len(str) \n\tL = [[0 for x in range(n)] for x in range(n)] \n\tfor i in range(n): \n\t\tL[i][i] = 1\n\tfor cl in range(2, n+1): \n\t\tfor i in range(n-cl+1): \n\t\t\tj = i+cl-1\n\t\t\tif str[i] == str[j] and cl == 2: \n\t\t\t\tL[i][j] = 2\n\t\t\telif str[i] == str[j]: \n\t\t\t\tL[i][j] = L[i+1][j-1] + 2\n\t\t\telse: \n\t\t\t\tL[i][j] = max(L[i][j-1], L[i+1][j]); \n\treturn L[0][n-1]", - "test_imports": [], - "test_list": [ - "assert lps(\"TENS FOR TENS\") == 5", - "assert lps(\"CARDIO FOR CARDS\") == 7", - "assert lps(\"PART OF THE JOURNEY IS PART\") == 9" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "TENS FOR TENS\n", - "CARDIO FOR CARDS\n", - "PART OF THE JOURNEY IS PART\n" - ], - "test_output": [ - "5\n", - "7\n", - "9\n" - ], - "example_input": [ - "TENS FOR TENS\n", - "CARDIO FOR CARDS\n" - ], - "example_output": [ - "5\n", - "7\n" - ], - "question": "Original problem description:\nWrite a function to find the length of the longest palindromic subsequence in the given string.\nWe have its functional test sample:\nassert lps(\"TENS FOR TENS\") == 5\nassert lps(\"CARDIO FOR CARDS\") == 7\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nTENS FOR TENS\n\nOutput:\n5\n\n\nExample 2:\nInput:\nCARDIO FOR CARDS\n\nOutput:\n7\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 118, - "prompt": "Write a function to find the intersection of two arrays.", - "code": "def intersection_array(array_nums1,array_nums2):\n result = list(filter(lambda x: x in array_nums1, array_nums2)) \n return result", - "test_imports": [], - "test_list": [ - "assert intersection_array([1, 2, 3, 5, 7, 8, 9, 10],[1, 2, 4, 8, 9])==[1, 2, 8, 9]", - "assert intersection_array([1, 2, 3, 5, 7, 8, 9, 10],[3,5,7,9])==[3,5,7,9]", - "assert intersection_array([1, 2, 3, 5, 7, 8, 9, 10],[10,20,30,40])==[10]" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 2 3 5 7 8 9 10\n1 2 4 8 9\n", - "1 2 3 5 7 8 9 10\n3 5 7 9\n", - "1 2 3 5 7 8 9 10\n10 20 30 40\n" - ], - "test_output": [ - "1 2 8 9\n", - "3 5 7 9\n", - "10\n" - ], - "example_input": [ - "1 2 3 5 7 8 9 10\n1 2 4 8 9\n", - "1 2 3 5 7 8 9 10\n3 5 7 9\n" - ], - "example_output": [ - "1 2 8 9\n", - "3 5 7 9\n" - ], - "question": "Original problem description:\nWrite a function to find the intersection of two arrays.\nWe have its functional test sample:\nassert intersection_array([1, 2, 3, 5, 7, 8, 9, 10],[1, 2, 4, 8, 9])==[1, 2, 8, 9]\nassert intersection_array([1, 2, 3, 5, 7, 8, 9, 10],[3,5,7,9])==[3,5,7,9]\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 2 3 5 7 8 9 10\n1 2 4 8 9\n\nOutput:\n1 2 8 9\n\n\nExample 2:\nInput:\n1 2 3 5 7 8 9 10\n3 5 7 9\n\nOutput:\n3 5 7 9\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 119, - "prompt": "Write a python function that takes in a tuple and an element and counts the occcurences of the element in the tuple.", - "code": "def count_X(tup, x): \n count = 0\n for ele in tup: \n if (ele == x): \n count = count + 1\n return count ", - "test_imports": [], - "test_list": [ - "assert count_X((10, 8, 5, 2, 10, 15, 10, 8, 5, 8, 8, 2),4) == 0", - "assert count_X((10, 8, 5, 2, 10, 15, 10, 8, 5, 8, 8, 2),10) == 3", - "assert count_X((10, 8, 5, 2, 10, 15, 10, 8, 5, 8, 8, 2),8) == 4" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "10 8 5 2 10 15 10 8 5 8 8 2\n4\n", - "10 8 5 2 10 15 10 8 5 8 8 2\n10\n", - "10 8 5 2 10 15 10 8 5 8 8 2\n8\n" - ], - "test_output": [ - "0\n", - "3\n", - "4\n" - ], - "example_input": [ - "10 8 5 2 10 15 10 8 5 8 8 2\n4\n", - "10 8 5 2 10 15 10 8 5 8 8 2\n10\n" - ], - "example_output": [ - "0\n", - "3\n" - ], - "question": "Original problem description:\nWrite a python function that takes in a tuple and an element and counts the occcurences of the element in the tuple.\nWe have its functional test sample:\nassert count_X((10, 8, 5, 2, 10, 15, 10, 8, 5, 8, 8, 2),4) == 0\nassert count_X((10, 8, 5, 2, 10, 15, 10, 8, 5, 8, 8, 2),10) == 3\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n10 8 5 2 10 15 10 8 5 8 8 2\n4\n\nOutput:\n0\n\n\nExample 2:\nInput:\n10 8 5 2 10 15 10 8 5 8 8 2\n10\n\nOutput:\n3\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 120, - "prompt": "Write a function that takes in a list and an element and inserts the element before each element in the list, and returns the resulting list.", - "code": "def insert_element(list,element):\n list = [v for elt in list for v in (element, elt)]\n return list", - "test_imports": [], - "test_list": [ - "assert insert_element(['Red', 'Green', 'Black'] ,'c')==['c', 'Red', 'c', 'Green', 'c', 'Black']", - "assert insert_element(['python', 'java'] ,'program')==['program', 'python', 'program', 'java']", - "assert insert_element(['happy', 'sad'] ,'laugh')==['laugh', 'happy', 'laugh', 'sad']" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "Red Green Black\nc\n", - "python java\nprogram\n", - "happy sad\nlaugh\n" - ], - "test_output": [ - "c Red c Green c Black\n", - "program python program java\n", - "laugh happy laugh sad\n" - ], - "example_input": [ - "Red Green Black\nc\n", - "python java\nprogram\n" - ], - "example_output": [ - "c Red c Green c Black\n", - "program python program java\n" - ], - "question": "Original problem description:\nWrite a function that takes in a list and an element and inserts the element before each element in the list, and returns the resulting list.\nWe have its functional test sample:\nassert insert_element(['Red', 'Green', 'Black'] ,'c')==['c', 'Red', 'c', 'Green', 'c', 'Black']\nassert insert_element(['python', 'java'] ,'program')==['program', 'python', 'program', 'java']\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nRed Green Black\nc\n\nOutput:\nc Red c Green c Black\n\n\nExample 2:\nInput:\npython java\nprogram\n\nOutput:\nprogram python program java\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 121, - "prompt": "Write a python function to convert complex numbers to polar coordinates.", - "code": "import cmath \ndef convert(numbers): \n num = cmath.polar(numbers) \n return (num) ", - "test_imports": [], - "test_list": [ - "assert convert(1) == (1.0, 0.0)", - "assert convert(4) == (4.0,0.0)", - "assert convert(5) == (5.0,0.0)" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1\n", - "4\n", - "5\n" - ], - "test_output": [ - "1.0 0.0\n", - "4.0 0.0\n", - "5.0 0.0\n" - ], - "example_input": [ - "1\n", - "4\n" - ], - "example_output": [ - "1.0 0.0\n", - "4.0 0.0\n" - ], - "question": "Original problem description:\nWrite a python function to convert complex numbers to polar coordinates.\nWe have its functional test sample:\nassert convert(1) == (1.0, 0.0)\nassert convert(4) == (4.0,0.0)\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1\n\nOutput:\n1.0 0.0\n\n\nExample 2:\nInput:\n4\n\nOutput:\n4.0 0.0\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 122, - "prompt": "Write a python function that returns the number of integer elements in a given list.", - "code": "def count_integer(list1):\n ctr = 0\n for i in list1:\n if isinstance(i, int):\n ctr = ctr + 1\n return ctr", - "test_imports": [], - "test_list": [ - "assert count_integer([1,2,'abc',1.2]) == 2", - "assert count_integer([1,2,3]) == 3", - "assert count_integer([1,1.2,4,5.1]) == 2" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 2 abc 1.2\n", - "1 2 3\n", - "1 1.2 4 5.1\n" - ], - "test_output": [ - "2\n", - "3\n", - "2\n" - ], - "example_input": [ - "1 2 abc 1.2\n", - "1 2 3\n" - ], - "example_output": [ - "2\n", - "3\n" - ], - "question": "Original problem description:\nWrite a python function that returns the number of integer elements in a given list.\nWe have its functional test sample:\nassert count_integer([1,2,'abc',1.2]) == 2\nassert count_integer([1,2,3]) == 3\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 2 abc 1.2\n\nOutput:\n2\n\n\nExample 2:\nInput:\n1 2 3\n\nOutput:\n3\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 123, - "prompt": "Write a function that takes in a list and length n, and generates all combinations (with repetition) of the elements of the list and returns a list with a tuple for each combination.", - "code": "from itertools import combinations_with_replacement \ndef combinations_colors(l, n):\n return list(combinations_with_replacement(l,n))\n", - "test_imports": [], - "test_list": [ - "assert combinations_colors( [\"Red\",\"Green\",\"Blue\"],1)==[('Red',), ('Green',), ('Blue',)]", - "assert combinations_colors( [\"Red\",\"Green\",\"Blue\"],2)==[('Red', 'Red'), ('Red', 'Green'), ('Red', 'Blue'), ('Green', 'Green'), ('Green', 'Blue'), ('Blue', 'Blue')]", - "assert combinations_colors( [\"Red\",\"Green\",\"Blue\"],3)==[('Red', 'Red', 'Red'), ('Red', 'Red', 'Green'), ('Red', 'Red', 'Blue'), ('Red', 'Green', 'Green'), ('Red', 'Green', 'Blue'), ('Red', 'Blue', 'Blue'), ('Green', 'Green', 'Green'), ('Green', 'Green', 'Blue'), ('Green', 'Blue', 'Blue'), ('Blue', 'Blue', 'Blue')]" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "Red Green Blue\n1\n", - "Red Green Blue\n2\n", - "Red Green Blue\n3\n" - ], - "test_output": [ - "Red\nGreen\nBlue\n", - "Red Red\nRed Green\nRed Blue\nGreen Green\nGreen Blue\nBlue Blue\n", - "Red Red Red\nRed Red Green\nRed Red Blue\nRed Green Green\nRed Green Blue\nRed Blue Blue\nGreen Green Green\nGreen Green Blue\nGreen Blue Blue\nBlue Blue Blue\n" - ], - "example_input": [ - "Red Green Blue\n1\n", - "Red Green Blue\n2\n" - ], - "example_output": [ - "Red\nGreen\nBlue\n", - "Red Red\nRed Green\nRed Blue\nGreen Green\nGreen Blue\nBlue Blue\n" - ], - "question": "Original problem description:\nWrite a function that takes in a list and length n, and generates all combinations (with repetition) of the elements of the list and returns a list with a tuple for each combination.\nWe have its functional test sample:\nassert combinations_colors( [\"Red\",\"Green\",\"Blue\"],1)==[('Red',), ('Green',), ('Blue',)]\nassert combinations_colors( [\"Red\",\"Green\",\"Blue\"],2)==[('Red', 'Red'), ('Red', 'Green'), ('Red', 'Blue'), ('Green', 'Green'), ('Green', 'Blue'), ('Blue', 'Blue')]\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nRed Green Blue\n1\n\nOutput:\nRed\nGreen\nBlue\n\n\nExample 2:\nInput:\nRed Green Blue\n2\n\nOutput:\nRed Red\nRed Green\nRed Blue\nGreen Green\nGreen Blue\nBlue Blue\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 124, - "prompt": "Write a python function that takes in a non-negative number and returns the number of prime numbers less than the given non-negative number.", - "code": "def count_Primes_nums(n):\n ctr = 0\n for num in range(n):\n if num <= 1:\n continue\n for i in range(2,num):\n if (num % i) == 0:\n break\n else:\n ctr += 1\n return ctr", - "test_imports": [], - "test_list": [ - "assert count_Primes_nums(5) == 2", - "assert count_Primes_nums(10) == 4", - "assert count_Primes_nums(100) == 25" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "5\n", - "10\n", - "100\n" - ], - "test_output": [ - "2\n", - "4\n", - "25\n" - ], - "example_input": [ - "5\n", - "10\n" - ], - "example_output": [ - "2\n", - "4\n" - ], - "question": "Original problem description:\nWrite a python function that takes in a non-negative number and returns the number of prime numbers less than the given non-negative number.\nWe have its functional test sample:\nassert count_Primes_nums(5) == 2\nassert count_Primes_nums(10) == 4\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n5\n\nOutput:\n2\n\n\nExample 2:\nInput:\n10\n\nOutput:\n4\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 125, - "prompt": "Write a function that takes in two numbers and returns a tuple with the second number and then the first number.", - "code": "def swap_numbers(a,b):\n temp = a\n a = b\n b = temp\n return (a,b)", - "test_imports": [], - "test_list": [ - "assert swap_numbers(10,20)==(20,10)", - "assert swap_numbers(15,17)==(17,15)", - "assert swap_numbers(100,200)==(200,100)" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "10\n20\n", - "15\n17\n", - "100\n200\n" - ], - "test_output": [ - "20 10\n", - "17 15\n", - "200 100\n" - ], - "example_input": [ - "10\n20\n", - "15\n17\n" - ], - "example_output": [ - "20 10\n", - "17 15\n" - ], - "question": "Original problem description:\nWrite a function that takes in two numbers and returns a tuple with the second number and then the first number.\nWe have its functional test sample:\nassert swap_numbers(10,20)==(20,10)\nassert swap_numbers(15,17)==(17,15)\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n10\n20\n\nOutput:\n20 10\n\n\nExample 2:\nInput:\n15\n17\n\nOutput:\n17 15\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 127, - "prompt": "Write a function to find the nth newman–shanks–williams prime number.", - "code": "def newman_prime(n): \n\tif n == 0 or n == 1: \n\t\treturn 1\n\treturn 2 * newman_prime(n - 1) + newman_prime(n - 2)", - "test_imports": [], - "test_list": [ - "assert newman_prime(3) == 7", - "assert newman_prime(4) == 17", - "assert newman_prime(5) == 41" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "3\n", - "4\n", - "5\n" - ], - "test_output": [ - "7\n", - "17\n", - "41\n" - ], - "example_input": [ - "3\n", - "4\n" - ], - "example_output": [ - "7\n", - "17\n" - ], - "question": "Original problem description:\nWrite a function to find the nth newman–shanks–williams prime number.\nWe have its functional test sample:\nassert newman_prime(3) == 7\nassert newman_prime(4) == 17\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n3\n\nOutput:\n7\n\n\nExample 2:\nInput:\n4\n\nOutput:\n17\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 128, - "prompt": "Write a function that takes in two tuples and performs mathematical division operation element-wise across the given tuples.", - "code": "def division_elements(test_tup1, test_tup2):\n res = tuple(ele1 // ele2 for ele1, ele2 in zip(test_tup1, test_tup2))\n return (res) ", - "test_imports": [], - "test_list": [ - "assert division_elements((10, 4, 6, 9),(5, 2, 3, 3)) == (2, 2, 2, 3)", - "assert division_elements((12, 6, 8, 16),(6, 3, 4, 4)) == (2, 2, 2, 4)", - "assert division_elements((20, 14, 36, 18),(5, 7, 6, 9)) == (4, 2, 6, 2)" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "10 4 6 9\n5 2 3 3\n", - "12 6 8 16\n6 3 4 4\n", - "20 14 36 18\n5 7 6 9\n" - ], - "test_output": [ - "2 2 2 3\n", - "2 2 2 4\n", - "4 2 6 2\n" - ], - "example_input": [ - "10 4 6 9\n5 2 3 3\n", - "12 6 8 16\n6 3 4 4\n" - ], - "example_output": [ - "2 2 2 3\n", - "2 2 2 4\n" - ], - "question": "Original problem description:\nWrite a function that takes in two tuples and performs mathematical division operation element-wise across the given tuples.\nWe have its functional test sample:\nassert division_elements((10, 4, 6, 9),(5, 2, 3, 3)) == (2, 2, 2, 3)\nassert division_elements((12, 6, 8, 16),(6, 3, 4, 4)) == (2, 2, 2, 4)\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n10 4 6 9\n5 2 3 3\n\nOutput:\n2 2 2 3\n\n\nExample 2:\nInput:\n12 6 8 16\n6 3 4 4\n\nOutput:\n2 2 2 4\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 130, - "prompt": "Write a function to calculate a dog's age in dog's years.", - "code": "def dog_age(h_age):\n if h_age < 0:\n \texit()\n elif h_age <= 2:\n\t d_age = h_age * 10.5\n else:\n\t d_age = 21 + (h_age - 2)*4\n return d_age", - "test_imports": [], - "test_list": [ - "assert dog_age(12)==61", - "assert dog_age(15)==73", - "assert dog_age(24)==109" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "12\n", - "15\n", - "24\n" - ], - "test_output": [ - "61\n", - "73\n", - "109\n" - ], - "example_input": [ - "12\n", - "15\n" - ], - "example_output": [ - "61\n", - "73\n" - ], - "question": "Original problem description:\nWrite a function to calculate a dog's age in dog's years.\nWe have its functional test sample:\nassert dog_age(12)==61\nassert dog_age(15)==73\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n12\n\nOutput:\n61\n\n\nExample 2:\nInput:\n15\n\nOutput:\n73\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 131, - "prompt": "Write a function that takes in a list and an integer n and splits a list for every nth element, returning a list of the resulting lists.", - "code": "def list_split(S, step):\n return [S[i::step] for i in range(step)]", - "test_imports": [], - "test_list": [ - "assert list_split(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n'],3)==[['a', 'd', 'g', 'j', 'm'], ['b', 'e', 'h', 'k', 'n'], ['c', 'f', 'i', 'l']]", - "assert list_split([1,2,3,4,5,6,7,8,9,10,11,12,13,14],3)==[[1,4,7,10,13], [2,5,8,11,14], [3,6,9,12]]", - "assert list_split(['python','java','C','C++','DBMS','SQL'],2)==[['python', 'C', 'DBMS'], ['java', 'C++', 'SQL']]" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "a b c d e f g h i j k l m n\n3\n", - "1 2 3 4 5 6 7 8 9 10 11 12 13 14\n3\n", - "python java C C++ DBMS SQL\n2\n" - ], - "test_output": [ - "a d g j m\nb e h k n\nc f i l\n", - "1 4 7 10 13\n2 5 8 11 14\n3 6 9 12\n", - "python C DBMS\njava C++ SQL\n" - ], - "example_input": [ - "a b c d e f g h i j k l m n\n3\n", - "1 2 3 4 5 6 7 8 9 10 11 12 13 14\n3\n" - ], - "example_output": [ - "a d g j m\nb e h k n\nc f i l\n", - "1 4 7 10 13\n2 5 8 11 14\n3 6 9 12\n" - ], - "question": "Original problem description:\nWrite a function that takes in a list and an integer n and splits a list for every nth element, returning a list of the resulting lists.\nWe have its functional test sample:\nassert list_split(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n'],3)==[['a', 'd', 'g', 'j', 'm'], ['b', 'e', 'h', 'k', 'n'], ['c', 'f', 'i', 'l']]\nassert list_split([1,2,3,4,5,6,7,8,9,10,11,12,13,14],3)==[[1,4,7,10,13], [2,5,8,11,14], [3,6,9,12]]\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\na b c d e f g h i j k l m n\n3\n\nOutput:\na d g j m\nb e h k n\nc f i l\n\n\nExample 2:\nInput:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14\n3\n\nOutput:\n1 4 7 10 13\n2 5 8 11 14\n3 6 9 12\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 132, - "prompt": "Write a function to find the lateral surface area of a cube given its side length.", - "code": "def lateralsurface_cube(l):\n LSA = 4 * (l * l)\n return LSA", - "test_imports": [], - "test_list": [ - "assert lateralsurface_cube(5)==100", - "assert lateralsurface_cube(9)==324", - "assert lateralsurface_cube(10)==400" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "5\n", - "9\n", - "10\n" - ], - "test_output": [ - "100\n", - "324\n", - "400\n" - ], - "example_input": [ - "5\n", - "9\n" - ], - "example_output": [ - "100\n", - "324\n" - ], - "question": "Original problem description:\nWrite a function to find the lateral surface area of a cube given its side length.\nWe have its functional test sample:\nassert lateralsurface_cube(5)==100\nassert lateralsurface_cube(9)==324\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n5\n\nOutput:\n100\n\n\nExample 2:\nInput:\n9\n\nOutput:\n324\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 133, - "prompt": "Write a python function that takes in an integer n and returns the sum of the squares of the first n odd natural numbers.", - "code": "def square_Sum(n): \n return int(n*(4*n*n-1)/3) ", - "test_imports": [], - "test_list": [ - "assert square_Sum(2) == 10", - "assert square_Sum(3) == 35", - "assert square_Sum(4) == 84" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "2\n", - "3\n", - "4\n" - ], - "test_output": [ - "10\n", - "35\n", - "84\n" - ], - "example_input": [ - "2\n", - "3\n" - ], - "example_output": [ - "10\n", - "35\n" - ], - "question": "Original problem description:\nWrite a python function that takes in an integer n and returns the sum of the squares of the first n odd natural numbers.\nWe have its functional test sample:\nassert square_Sum(2) == 10\nassert square_Sum(3) == 35\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n2\n\nOutput:\n10\n\n\nExample 2:\nInput:\n3\n\nOutput:\n35\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 134, - "prompt": "Write a function to find the n'th star number.", - "code": "def find_star_num(n): \n\treturn (6 * n * (n - 1) + 1) ", - "test_imports": [], - "test_list": [ - "assert find_star_num(3) == 37", - "assert find_star_num(4) == 73", - "assert find_star_num(5) == 121" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "3\n", - "4\n", - "5\n" - ], - "test_output": [ - "37\n", - "73\n", - "121\n" - ], - "example_input": [ - "3\n", - "4\n" - ], - "example_output": [ - "37\n", - "73\n" - ], - "question": "Original problem description:\nWrite a function to find the n'th star number.\nWe have its functional test sample:\nassert find_star_num(3) == 37\nassert find_star_num(4) == 73\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n3\n\nOutput:\n37\n\n\nExample 2:\nInput:\n4\n\nOutput:\n73\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 135, - "prompt": "Write a function to find the ascii value of a character.", - "code": "def ascii_value(k):\n ch=k\n return ord(ch)", - "test_imports": [], - "test_list": [ - "assert ascii_value('A')==65", - "assert ascii_value('R')==82", - "assert ascii_value('S')==83" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "A\n", - "R\n", - "S\n" - ], - "test_output": [ - "65\n", - "82\n", - "83\n" - ], - "example_input": [ - "A\n", - "R\n" - ], - "example_output": [ - "65\n", - "82\n" - ], - "question": "Original problem description:\nWrite a function to find the ascii value of a character.\nWe have its functional test sample:\nassert ascii_value('A')==65\nassert ascii_value('R')==82\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nA\n\nOutput:\n65\n\n\nExample 2:\nInput:\nR\n\nOutput:\n82\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 136, - "prompt": "Write a python function to find the sum of even numbers at even positions of a list.", - "code": "def sum_even_and_even_index(arr): \n i = 0\n sum = 0\n for i in range(0, len(arr),2): \n if (arr[i] % 2 == 0) : \n sum += arr[i] \n return sum", - "test_imports": [], - "test_list": [ - "assert sum_even_and_even_index([5, 6, 12, 1, 18, 8]) == 30", - "assert sum_even_and_even_index([3, 20, 17, 9, 2, 10, 18, 13, 6, 18]) == 26", - "assert sum_even_and_even_index([5, 6, 12, 1]) == 12" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "5 6 12 1 18 8\n", - "3 20 17 9 2 10 18 13 6 18\n", - "5 6 12 1\n" - ], - "test_output": [ - "30\n", - "26\n", - "12\n" - ], - "example_input": [ - "5 6 12 1 18 8\n", - "3 20 17 9 2 10 18 13 6 18\n" - ], - "example_output": [ - "30\n", - "26\n" - ], - "question": "Original problem description:\nWrite a python function to find the sum of even numbers at even positions of a list.\nWe have its functional test sample:\nassert sum_even_and_even_index([5, 6, 12, 1, 18, 8]) == 30\nassert sum_even_and_even_index([3, 20, 17, 9, 2, 10, 18, 13, 6, 18]) == 26\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n5 6 12 1 18 8\n\nOutput:\n30\n\n\nExample 2:\nInput:\n3 20 17 9 2 10 18 13 6 18\n\nOutput:\n26\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 137, - "prompt": "Write a python function that takes in an integer n and finds the sum of the first n even natural numbers that are raised to the fifth power.", - "code": "def even_Power_Sum(n): \n sum = 0; \n for i in range(1,n+1): \n j = 2*i; \n sum = sum + (j*j*j*j*j); \n return sum; ", - "test_imports": [], - "test_list": [ - "assert even_Power_Sum(2) == 1056", - "assert even_Power_Sum(3) == 8832", - "assert even_Power_Sum(1) == 32" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "2\n", - "3\n", - "1\n" - ], - "test_output": [ - "1056\n", - "8832\n", - "32\n" - ], - "example_input": [ - "2\n", - "3\n" - ], - "example_output": [ - "1056\n", - "8832\n" - ], - "question": "Original problem description:\nWrite a python function that takes in an integer n and finds the sum of the first n even natural numbers that are raised to the fifth power.\nWe have its functional test sample:\nassert even_Power_Sum(2) == 1056\nassert even_Power_Sum(3) == 8832\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n2\n\nOutput:\n1056\n\n\nExample 2:\nInput:\n3\n\nOutput:\n8832\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 138, - "prompt": "Write a function that takes in a list of tuples and returns a list containing the rear element of each tuple.", - "code": "def rear_extract(test_list):\n res = [lis[-1] for lis in test_list]\n return (res) ", - "test_imports": [], - "test_list": [ - "assert rear_extract([(1, 'Rash', 21), (2, 'Varsha', 20), (3, 'Kil', 19)]) == [21, 20, 19]", - "assert rear_extract([(1, 'Sai', 36), (2, 'Ayesha', 25), (3, 'Salman', 45)]) == [36, 25, 45]", - "assert rear_extract([(1, 'Sudeep', 14), (2, 'Vandana', 36), (3, 'Dawood', 56)]) == [14, 36, 56]" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 Rash 21\n2 Varsha 20\n3 Kil 19\n", - "1 Sai 36\n2 Ayesha 25\n3 Salman 45\n", - "1 Sudeep 14\n2 Vandana 36\n3 Dawood 56\n" - ], - "test_output": [ - "21 20 19\n", - "36 25 45\n", - "14 36 56\n" - ], - "example_input": [ - "1 Rash 21\n2 Varsha 20\n3 Kil 19\n", - "1 Sai 36\n2 Ayesha 25\n3 Salman 45\n" - ], - "example_output": [ - "21 20 19\n", - "36 25 45\n" - ], - "question": "Original problem description:\nWrite a function that takes in a list of tuples and returns a list containing the rear element of each tuple.\nWe have its functional test sample:\nassert rear_extract([(1, 'Rash', 21), (2, 'Varsha', 20), (3, 'Kil', 19)]) == [21, 20, 19]\nassert rear_extract([(1, 'Sai', 36), (2, 'Ayesha', 25), (3, 'Salman', 45)]) == [36, 25, 45]\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 Rash 21\n2 Varsha 20\n3 Kil 19\n\nOutput:\n21 20 19\n\n\nExample 2:\nInput:\n1 Sai 36\n2 Ayesha 25\n3 Salman 45\n\nOutput:\n36 25 45\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 139, - "prompt": "Write a function that takes in two tuples and subtracts the elements of the first tuple by the elements of the second tuple with the same index.", - "code": "def substract_elements(test_tup1, test_tup2):\n res = tuple(map(lambda i, j: i - j, test_tup1, test_tup2))\n return (res) ", - "test_imports": [], - "test_list": [ - "assert substract_elements((10, 4, 5), (2, 5, 18)) == (8, -1, -13)", - "assert substract_elements((11, 2, 3), (24, 45 ,16)) == (-13, -43, -13)", - "assert substract_elements((7, 18, 9), (10, 11, 12)) == (-3, 7, -3)" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "10 4 5\n2 5 18\n", - "11 2 3\n24 45 16\n", - "7 18 9\n10 11 12\n" - ], - "test_output": [ - "8 -1 -13\n", - "-13 -43 -13\n", - "-3 7 -3\n" - ], - "example_input": [ - "10 4 5\n2 5 18\n", - "11 2 3\n24 45 16\n" - ], - "example_output": [ - "8 -1 -13\n", - "-13 -43 -13\n" - ], - "question": "Original problem description:\nWrite a function that takes in two tuples and subtracts the elements of the first tuple by the elements of the second tuple with the same index.\nWe have its functional test sample:\nassert substract_elements((10, 4, 5), (2, 5, 18)) == (8, -1, -13)\nassert substract_elements((11, 2, 3), (24, 45 ,16)) == (-13, -43, -13)\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n10 4 5\n2 5 18\n\nOutput:\n8 -1 -13\n\n\nExample 2:\nInput:\n11 2 3\n24 45 16\n\nOutput:\n-13 -43 -13\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 140, - "prompt": "Write a python function that takes in a positive integer n and finds the sum of even index binomial coefficients.", - "code": "import math \ndef even_binomial_Coeff_Sum( n): \n return (1 << (n - 1)) ", - "test_imports": [], - "test_list": [ - "assert even_binomial_Coeff_Sum(4) == 8", - "assert even_binomial_Coeff_Sum(6) == 32", - "assert even_binomial_Coeff_Sum(2) == 2" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "4\n", - "6\n", - "2\n" - ], - "test_output": [ - "8\n", - "32\n", - "2\n" - ], - "example_input": [ - "4\n", - "6\n" - ], - "example_output": [ - "8\n", - "32\n" - ], - "question": "Original problem description:\nWrite a python function that takes in a positive integer n and finds the sum of even index binomial coefficients.\nWe have its functional test sample:\nassert even_binomial_Coeff_Sum(4) == 8\nassert even_binomial_Coeff_Sum(6) == 32\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n4\n\nOutput:\n8\n\n\nExample 2:\nInput:\n6\n\nOutput:\n32\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 142, - "prompt": "Write a function that takes in a dictionary and integer n and filters the dictionary to only include entries with values greater than or equal to n.", - "code": "def dict_filter(dict,n):\n result = {key:value for (key, value) in dict.items() if value >=n}\n return result", - "test_imports": [], - "test_list": [ - "assert dict_filter({'Cierra Vega': 175, 'Alden Cantrell': 180, 'Kierra Gentry': 165, 'Pierre Cox': 190},170)=={'Cierra Vega': 175, 'Alden Cantrell': 180, 'Pierre Cox': 190}", - "assert dict_filter({'Cierra Vega': 175, 'Alden Cantrell': 180, 'Kierra Gentry': 165, 'Pierre Cox': 190},180)=={ 'Alden Cantrell': 180, 'Pierre Cox': 190}", - "assert dict_filter({'Cierra Vega': 175, 'Alden Cantrell': 180, 'Kierra Gentry': 165, 'Pierre Cox': 190},190)=={ 'Pierre Cox': 190}" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "{'Cierra Vega': 175, 'Alden Cantrell': 180, 'Kierra Gentry': 165, 'Pierre Cox': 190}\n170\n", - "{'Cierra Vega': 175, 'Alden Cantrell': 180, 'Kierra Gentry': 165, 'Pierre Cox': 190}\n180\n", - "{'Cierra Vega': 175, 'Alden Cantrell': 180, 'Kierra Gentry': 165, 'Pierre Cox': 190}\n190\n" - ], - "test_output": [ - "{'Cierra Vega': 175, 'Alden Cantrell': 180, 'Pierre Cox': 190}\n", - "{'Alden Cantrell': 180, 'Pierre Cox': 190}\n", - "{'Pierre Cox': 190}\n" - ], - "example_input": [ - "{'Cierra Vega': 175, 'Alden Cantrell': 180, 'Kierra Gentry': 165, 'Pierre Cox': 190}\n170\n", - "{'Cierra Vega': 175, 'Alden Cantrell': 180, 'Kierra Gentry': 165, 'Pierre Cox': 190}\n180\n" - ], - "example_output": [ - "{'Cierra Vega': 175, 'Alden Cantrell': 180, 'Pierre Cox': 190}\n", - "{'Alden Cantrell': 180, 'Pierre Cox': 190}\n" - ], - "question": "Original problem description:\nWrite a function that takes in a dictionary and integer n and filters the dictionary to only include entries with values greater than or equal to n.\nWe have its functional test sample:\nassert dict_filter({'Cierra Vega': 175, 'Alden Cantrell': 180, 'Kierra Gentry': 165, 'Pierre Cox': 190},170)=={'Cierra Vega': 175, 'Alden Cantrell': 180, 'Pierre Cox': 190}\nassert dict_filter({'Cierra Vega': 175, 'Alden Cantrell': 180, 'Kierra Gentry': 165, 'Pierre Cox': 190},180)=={ 'Alden Cantrell': 180, 'Pierre Cox': 190}\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n{'Cierra Vega': 175, 'Alden Cantrell': 180, 'Kierra Gentry': 165, 'Pierre Cox': 190}\n170\n\nOutput:\n{'Cierra Vega': 175, 'Alden Cantrell': 180, 'Pierre Cox': 190}\n\n\nExample 2:\nInput:\n{'Cierra Vega': 175, 'Alden Cantrell': 180, 'Kierra Gentry': 165, 'Pierre Cox': 190}\n180\n\nOutput:\n{'Alden Cantrell': 180, 'Pierre Cox': 190}\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 143, - "prompt": "Write a function to find the number of elements that occurs before the tuple element in the given tuple.", - "code": "def count_first_elements(test_tup):\n for count, ele in enumerate(test_tup):\n if isinstance(ele, tuple):\n break\n return (count) ", - "test_imports": [], - "test_list": [ - "assert count_first_elements((1, 5, 7, (4, 6), 10) ) == 3", - "assert count_first_elements((2, 9, (5, 7), 11) ) == 2", - "assert count_first_elements((11, 15, 5, 8, (2, 3), 8) ) == 4" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1\n5\n7\n4 6\n10\n", - "2\n9\n5 7\n11\n", - "11\n15\n5\n8\n2 3\n8\n" - ], - "test_output": [ - "3\n", - "2\n", - "4\n" - ], - "example_input": [ - "1\n5\n7\n4 6\n10\n", - "2\n9\n5 7\n11\n" - ], - "example_output": [ - "3\n", - "2\n" - ], - "question": "Original problem description:\nWrite a function to find the number of elements that occurs before the tuple element in the given tuple.\nWe have its functional test sample:\nassert count_first_elements((1, 5, 7, (4, 6), 10) ) == 3\nassert count_first_elements((2, 9, (5, 7), 11) ) == 2\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1\n5\n7\n4 6\n10\n\nOutput:\n3\n\n\nExample 2:\nInput:\n2\n9\n5 7\n11\n\nOutput:\n2\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 144, - "prompt": "Write a function to find the nth decagonal number.", - "code": "def is_num_decagonal(n): \n\treturn 4 * n * n - 3 * n ", - "test_imports": [], - "test_list": [ - "assert is_num_decagonal(3) == 27", - "assert is_num_decagonal(7) == 175", - "assert is_num_decagonal(10) == 370" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "3\n", - "7\n", - "10\n" - ], - "test_output": [ - "27\n", - "175\n", - "370\n" - ], - "example_input": [ - "3\n", - "7\n" - ], - "example_output": [ - "27\n", - "175\n" - ], - "question": "Original problem description:\nWrite a function to find the nth decagonal number.\nWe have its functional test sample:\nassert is_num_decagonal(3) == 27\nassert is_num_decagonal(7) == 175\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n3\n\nOutput:\n27\n\n\nExample 2:\nInput:\n7\n\nOutput:\n175\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 145, - "prompt": "Write a function that takes in an array and element and returns a tuple containing a boolean that indicates if the element is in the array and the index position of the element (or -1 if the element is not found).", - "code": "def sequential_search(dlist, item):\n pos = 0\n found = False\n while pos < len(dlist) and not found:\n if dlist[pos] == item:\n found = True\n else:\n pos = pos + 1\n return found, pos", - "test_imports": [], - "test_list": [ - "assert sequential_search([11,23,58,31,56,77,43,12,65,19],31) == (True, 3)", - "assert sequential_search([12, 32, 45, 62, 35, 47, 44, 61],61) == (True, 7)", - "assert sequential_search([9, 10, 17, 19, 22, 39, 48, 56],48) == (True, 6)" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "11 23 58 31 56 77 43 12 65 19\n31\n", - "12 32 45 62 35 47 44 61\n61\n", - "9 10 17 19 22 39 48 56\n48\n" - ], - "test_output": [ - "True 3\n", - "True 7\n", - "True 6\n" - ], - "example_input": [ - "11 23 58 31 56 77 43 12 65 19\n31\n", - "12 32 45 62 35 47 44 61\n61\n" - ], - "example_output": [ - "True 3\n", - "True 7\n" - ], - "question": "Original problem description:\nWrite a function that takes in an array and element and returns a tuple containing a boolean that indicates if the element is in the array and the index position of the element (or -1 if the element is not found).\nWe have its functional test sample:\nassert sequential_search([11,23,58,31,56,77,43,12,65,19],31) == (True, 3)\nassert sequential_search([12, 32, 45, 62, 35, 47, 44, 61],61) == (True, 7)\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n11 23 58 31 56 77 43 12 65 19\n31\n\nOutput:\nTrue 3\n\n\nExample 2:\nInput:\n12 32 45 62 35 47 44 61\n61\n\nOutput:\nTrue 7\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 146, - "prompt": "Write a python function to check if the elements of a given list are unique or not.", - "code": "def all_unique(test_list):\n if len(test_list) > len(set(test_list)):\n return False\n return True", - "test_imports": [], - "test_list": [ - "assert all_unique([1,2,3]) == True", - "assert all_unique([1,2,1,2]) == False", - "assert all_unique([1,2,3,4,5]) == True" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 2 3\n", - "1 2 1 2\n", - "1 2 3 4 5\n" - ], - "test_output": [ - "True\n", - "False\n", - "True\n" - ], - "example_input": [ - "1 2 3\n", - "1 2 1 2\n" - ], - "example_output": [ - "True\n", - "False\n" - ], - "question": "Original problem description:\nWrite a python function to check if the elements of a given list are unique or not.\nWe have its functional test sample:\nassert all_unique([1,2,3]) == True\nassert all_unique([1,2,1,2]) == False\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 2 3\n\nOutput:\nTrue\n\n\nExample 2:\nInput:\n1 2 1 2\n\nOutput:\nFalse\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 147, - "prompt": "Write a function to subtract two lists element-wise.", - "code": "def sub_list(nums1,nums2):\n result = map(lambda x, y: x - y, nums1, nums2)\n return list(result)", - "test_imports": [], - "test_list": [ - "assert sub_list([1, 2, 3],[4,5,6])==[-3,-3,-3]", - "assert sub_list([1,2],[3,4])==[-2,-2]", - "assert sub_list([90,120],[50,70])==[40,50]" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 2 3\n4 5 6\n", - "1 2\n3 4\n", - "90 120\n50 70\n" - ], - "test_output": [ - "-3 -3 -3\n", - "-2 -2\n", - "40 50\n" - ], - "example_input": [ - "1 2 3\n4 5 6\n", - "1 2\n3 4\n" - ], - "example_output": [ - "-3 -3 -3\n", - "-2 -2\n" - ], - "question": "Original problem description:\nWrite a function to subtract two lists element-wise.\nWe have its functional test sample:\nassert sub_list([1, 2, 3],[4,5,6])==[-3,-3,-3]\nassert sub_list([1,2],[3,4])==[-2,-2]\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 2 3\n4 5 6\n\nOutput:\n-3 -3 -3\n\n\nExample 2:\nInput:\n1 2\n3 4\n\nOutput:\n-2 -2\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 148, - "prompt": "Write a python function takes in an integer and check whether the frequency of each digit in the integer is less than or equal to the digit itself.", - "code": "def validate(n): \n for i in range(10): \n temp = n; \n count = 0; \n while (temp): \n if (temp % 10 == i): \n count+=1; \n if (count > i): \n return False\n temp //= 10; \n return True", - "test_imports": [], - "test_list": [ - "assert validate(1234) == True", - "assert validate(51241) == False", - "assert validate(321) == True" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1234\n", - "51241\n", - "321\n" - ], - "test_output": [ - "True\n", - "False\n", - "True\n" - ], - "example_input": [ - "1234\n", - "51241\n" - ], - "example_output": [ - "True\n", - "False\n" - ], - "question": "Original problem description:\nWrite a python function takes in an integer and check whether the frequency of each digit in the integer is less than or equal to the digit itself.\nWe have its functional test sample:\nassert validate(1234) == True\nassert validate(51241) == False\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1234\n\nOutput:\nTrue\n\n\nExample 2:\nInput:\n51241\n\nOutput:\nFalse\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 149, - "prompt": "Write a function that takes in a list and element and checks whether all items in the list are equal to the given element.", - "code": "def check_element(list,element):\n check_element=all(v== element for v in list)\n return check_element", - "test_imports": [], - "test_list": [ - "assert check_element([\"green\", \"orange\", \"black\", \"white\"],'blue')==False", - "assert check_element([1,2,3,4],7)==False", - "assert check_element([\"green\", \"green\", \"green\", \"green\"],'green')==True" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "green orange black white\nblue\n", - "1 2 3 4\n7\n", - "green green green green\ngreen\n" - ], - "test_output": [ - "False\n", - "False\n", - "True\n" - ], - "example_input": [ - "green orange black white\nblue\n", - "1 2 3 4\n7\n" - ], - "example_output": [ - "False\n", - "False\n" - ], - "question": "Original problem description:\nWrite a function that takes in a list and element and checks whether all items in the list are equal to the given element.\nWe have its functional test sample:\nassert check_element([\"green\", \"orange\", \"black\", \"white\"],'blue')==False\nassert check_element([1,2,3,4],7)==False\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\ngreen orange black white\nblue\n\nOutput:\nFalse\n\n\nExample 2:\nInput:\n1 2 3 4\n7\n\nOutput:\nFalse\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 150, - "prompt": "Write a function that checks whether a string contains the 'a' character followed by two or three 'b' characters.", - "code": "import re\ndef text_match_two_three(text):\n patterns = 'ab{2,3}'\n if re.search(patterns, text):\n return True\n else:\n return False", - "test_imports": [], - "test_list": [ - "assert text_match_two_three(\"ac\")==(False)", - "assert text_match_two_three(\"dc\")==(False)", - "assert text_match_two_three(\"abbbba\")==(True)" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "ac\n", - "dc\n", - "abbbba\n" - ], - "test_output": [ - "False\n", - "False\n", - "True\n" - ], - "example_input": [ - "ac\n", - "dc\n" - ], - "example_output": [ - "False\n", - "False\n" - ], - "question": "Original problem description:\nWrite a function that checks whether a string contains the 'a' character followed by two or three 'b' characters.\nWe have its functional test sample:\nassert text_match_two_three(\"ac\")==(False)\nassert text_match_two_three(\"dc\")==(False)\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nac\n\nOutput:\nFalse\n\n\nExample 2:\nInput:\ndc\n\nOutput:\nFalse\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 151, - "prompt": "Write a function to find the largest sum of a contiguous array in the modified array which is formed by repeating the given array k times.", - "code": "def max_sub_array_sum_repeated(a, n, k): \n\tmax_so_far = -2147483648\n\tmax_ending_here = 0\n\tfor i in range(n*k): \n\t\tmax_ending_here = max_ending_here + a[i%n] \n\t\tif (max_so_far < max_ending_here): \n\t\t\tmax_so_far = max_ending_here \n\t\tif (max_ending_here < 0): \n\t\t\tmax_ending_here = 0\n\treturn max_so_far", - "test_imports": [], - "test_list": [ - "assert max_sub_array_sum_repeated([10, 20, -30, -1], 4, 3) == 30", - "assert max_sub_array_sum_repeated([-1, 10, 20], 3, 2) == 59", - "assert max_sub_array_sum_repeated([-1, -2, -3], 3, 3) == -1" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "10 20 -30 -1\n4\n3\n", - "-1 10 20\n3\n2\n", - "-1 -2 -3\n3\n3\n" - ], - "test_output": [ - "30\n", - "59\n", - "-1\n" - ], - "example_input": [ - "10 20 -30 -1\n4\n3\n", - "-1 10 20\n3\n2\n" - ], - "example_output": [ - "30\n", - "59\n" - ], - "question": "Original problem description:\nWrite a function to find the largest sum of a contiguous array in the modified array which is formed by repeating the given array k times.\nWe have its functional test sample:\nassert max_sub_array_sum_repeated([10, 20, -30, -1], 4, 3) == 30\nassert max_sub_array_sum_repeated([-1, 10, 20], 3, 2) == 59\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n10 20 -30 -1\n4\n3\n\nOutput:\n30\n\n\nExample 2:\nInput:\n-1 10 20\n3\n2\n\nOutput:\n59\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 152, - "prompt": "Write a python function takes in an integer n and returns the sum of squares of first n even natural numbers.", - "code": "def square_Sum(n): \n return int(2*n*(n+1)*(2*n+1)/3)", - "test_imports": [], - "test_list": [ - "assert square_Sum(2) == 20", - "assert square_Sum(3) == 56", - "assert square_Sum(4) == 120" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "2\n", - "3\n", - "4\n" - ], - "test_output": [ - "20\n", - "56\n", - "120\n" - ], - "example_input": [ - "2\n", - "3\n" - ], - "example_output": [ - "20\n", - "56\n" - ], - "question": "Original problem description:\nWrite a python function takes in an integer n and returns the sum of squares of first n even natural numbers.\nWe have its functional test sample:\nassert square_Sum(2) == 20\nassert square_Sum(3) == 56\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n2\n\nOutput:\n20\n\n\nExample 2:\nInput:\n3\n\nOutput:\n56\n\n\n" - }, - { - "source_file": "Ellen's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 154, - "prompt": "Write a function to find out the number of ways of painting the fence such that at most 2 adjacent posts have the same color for the given fence with n posts and k colors.", - "code": "def count_no_of_ways(n, k): \n\tdp = [0] * (n + 1) \n\ttotal = k \n\tmod = 1000000007\n\tdp[1] = k \n\tdp[2] = k * k\t \n\tfor i in range(3,n+1): \n\t\tdp[i] = ((k - 1) * (dp[i - 1] + dp[i - 2])) % mod \n\treturn dp[n]", - "test_imports": [], - "test_list": [ - "assert count_no_of_ways(2, 4) == 16", - "assert count_no_of_ways(3, 2) == 6", - "assert count_no_of_ways(4, 4) == 228" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "2\n4\n", - "3\n2\n", - "4\n4\n" - ], - "test_output": [ - "16\n", - "6\n", - "228\n" - ], - "example_input": [ - "2\n4\n", - "3\n2\n" - ], - "example_output": [ - "16\n", - "6\n" - ], - "question": "Original problem description:\nWrite a function to find out the number of ways of painting the fence such that at most 2 adjacent posts have the same color for the given fence with n posts and k colors.\nWe have its functional test sample:\nassert count_no_of_ways(2, 4) == 16\nassert count_no_of_ways(3, 2) == 6\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n2\n4\n\nOutput:\n16\n\n\nExample 2:\nInput:\n3\n2\n\nOutput:\n6\n\n\n" - }, - { - "source_file": "Ellen's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 155, - "prompt": "Write a python function to find quotient of two numbers (rounded down to the nearest integer).", - "code": "def find(n,m): \n q = n//m \n return (q)", - "test_imports": [], - "test_list": [ - "assert find(10,3) == 3", - "assert find(4,2) == 2", - "assert find(20,5) == 4" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "10\n3\n", - "4\n2\n", - "20\n5\n" - ], - "test_output": [ - "3\n", - "2\n", - "4\n" - ], - "example_input": [ - "10\n3\n", - "4\n2\n" - ], - "example_output": [ - "3\n", - "2\n" - ], - "question": "Original problem description:\nWrite a python function to find quotient of two numbers (rounded down to the nearest integer).\nWe have its functional test sample:\nassert find(10,3) == 3\nassert find(4,2) == 2\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n10\n3\n\nOutput:\n3\n\n\nExample 2:\nInput:\n4\n2\n\nOutput:\n2\n\n\n" - }, - { - "source_file": "Ellen's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 157, - "prompt": "Write a function to find the maximum value in a given heterogeneous list.", - "code": "def max_val(listval):\n max_val = max(i for i in listval if isinstance(i, int)) \n return(max_val)", - "test_imports": [], - "test_list": [ - "assert max_val(['Python', 3, 2, 4, 5, 'version'])==5", - "assert max_val(['Python', 15, 20, 25])==25", - "assert max_val(['Python', 30, 20, 40, 50, 'version'])==50" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "Python 3 2 4 5 version\n", - "Python 15 20 25\n", - "Python 30 20 40 50 version\n" - ], - "test_output": [ - "5\n", - "25\n", - "50\n" - ], - "example_input": [ - "Python 3 2 4 5 version\n", - "Python 15 20 25\n" - ], - "example_output": [ - "5\n", - "25\n" - ], - "question": "Original problem description:\nWrite a function to find the maximum value in a given heterogeneous list.\nWe have its functional test sample:\nassert max_val(['Python', 3, 2, 4, 5, 'version'])==5\nassert max_val(['Python', 15, 20, 25])==25\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nPython 3 2 4 5 version\n\nOutput:\n5\n\n\nExample 2:\nInput:\nPython 15 20 25\n\nOutput:\n25\n\n\n" - }, - { - "source_file": "Ellen's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 158, - "prompt": "Write a function to return the sum of all divisors of a number.", - "code": "def sum_div(number):\n divisors = [1]\n for i in range(2, number):\n if (number % i)==0:\n divisors.append(i)\n return sum(divisors)", - "test_imports": [], - "test_list": [ - "assert sum_div(8)==7", - "assert sum_div(12)==16", - "assert sum_div(7)==1" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "8\n", - "12\n", - "7\n" - ], - "test_output": [ - "7\n", - "16\n", - "1\n" - ], - "example_input": [ - "8\n", - "12\n" - ], - "example_output": [ - "7\n", - "16\n" - ], - "question": "Original problem description:\nWrite a function to return the sum of all divisors of a number.\nWe have its functional test sample:\nassert sum_div(8)==7\nassert sum_div(12)==16\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n8\n\nOutput:\n7\n\n\nExample 2:\nInput:\n12\n\nOutput:\n16\n\n\n" - }, - { - "source_file": "Ellen's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 159, - "prompt": "Write a python function to count inversions in an array.", - "code": "def get_Inv_Count(arr): \n inv_count = 0\n for i in range(len(arr)): \n for j in range(i + 1, len(arr)): \n if (arr[i] > arr[j]): \n inv_count += 1\n return inv_count ", - "test_imports": [], - "test_list": [ - "assert get_Inv_Count([1,20,6,4,5]) == 5", - "assert get_Inv_Count([1,2,1]) == 1", - "assert get_Inv_Count([1,2,5,6,1]) == 3" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 20 6 4 5\n", - "1 2 1\n", - "1 2 5 6 1\n" - ], - "test_output": [ - "5\n", - "1\n", - "3\n" - ], - "example_input": [ - "1 20 6 4 5\n", - "1 2 1\n" - ], - "example_output": [ - "5\n", - "1\n" - ], - "question": "Original problem description:\nWrite a python function to count inversions in an array.\nWe have its functional test sample:\nassert get_Inv_Count([1,20,6,4,5]) == 5\nassert get_Inv_Count([1,2,1]) == 1\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 20 6 4 5\n\nOutput:\n5\n\n\nExample 2:\nInput:\n1 2 1\n\nOutput:\n1\n\n\n" - }, - { - "source_file": "Ellen's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 161, - "prompt": "Write a function to calculate the maximum aggregate from the list of tuples.", - "code": "from collections import defaultdict\ndef max_aggregate(stdata):\n temp = defaultdict(int)\n for name, marks in stdata:\n temp[name] += marks\n return max(temp.items(), key=lambda x: x[1])", - "test_imports": [], - "test_list": [ - "assert max_aggregate([('Juan Whelan',90),('Sabah Colley',88),('Peter Nichols',7),('Juan Whelan',122),('Sabah Colley',84)])==('Juan Whelan', 212)", - "assert max_aggregate([('Juan Whelan',50),('Sabah Colley',48),('Peter Nichols',37),('Juan Whelan',22),('Sabah Colley',14)])==('Juan Whelan', 72)", - "assert max_aggregate([('Juan Whelan',10),('Sabah Colley',20),('Peter Nichols',30),('Juan Whelan',40),('Sabah Colley',50)])==('Sabah Colley', 70)" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "Juan Whelan 90\nSabah Colley 88\nPeter Nichols 7\nJuan Whelan 122\nSabah Colley 84\n", - "Juan Whelan 50\nSabah Colley 48\nPeter Nichols 37\nJuan Whelan 22\nSabah Colley 14\n", - "Juan Whelan 10\nSabah Colley 20\nPeter Nichols 30\nJuan Whelan 40\nSabah Colley 50\n" - ], - "test_output": [ - "Juan Whelan 212\n", - "Juan Whelan 72\n", - "Sabah Colley 70\n" - ], - "example_input": [ - "Juan Whelan 90\nSabah Colley 88\nPeter Nichols 7\nJuan Whelan 122\nSabah Colley 84\n", - "Juan Whelan 50\nSabah Colley 48\nPeter Nichols 37\nJuan Whelan 22\nSabah Colley 14\n" - ], - "example_output": [ - "Juan Whelan 212\n", - "Juan Whelan 72\n" - ], - "question": "Original problem description:\nWrite a function to calculate the maximum aggregate from the list of tuples.\nWe have its functional test sample:\nassert max_aggregate([('Juan Whelan',90),('Sabah Colley',88),('Peter Nichols',7),('Juan Whelan',122),('Sabah Colley',84)])==('Juan Whelan', 212)\nassert max_aggregate([('Juan Whelan',50),('Sabah Colley',48),('Peter Nichols',37),('Juan Whelan',22),('Sabah Colley',14)])==('Juan Whelan', 72)\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nJuan Whelan 90\nSabah Colley 88\nPeter Nichols 7\nJuan Whelan 122\nSabah Colley 84\n\nOutput:\nJuan Whelan 212\n\n\nExample 2:\nInput:\nJuan Whelan 50\nSabah Colley 48\nPeter Nichols 37\nJuan Whelan 22\nSabah Colley 14\n\nOutput:\nJuan Whelan 72\n\n\n" - }, - { - "source_file": "Ellen's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 165, - "prompt": "Write a function to return two words from a list of words starting with letter 'p'.", - "code": "import re\ndef start_withp(words):\n for w in words:\n m = re.match(\"(P\\w+)\\W(P\\w+)\", w)\n if m:\n return m.groups()", - "test_imports": [], - "test_list": [ - "assert start_withp([\"Python PHP\", \"Java JavaScript\", \"c c++\"])==('Python', 'PHP')", - "assert start_withp([\"Python Programming\",\"Java Programming\"])==('Python','Programming')", - "assert start_withp([\"Pqrst Pqr\",\"qrstuv\"])==('Pqrst','Pqr')" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "Python PHP Java JavaScript c c++\n", - "Python Programming Java Programming\n", - "Pqrst Pqr qrstuv\n" - ], - "test_output": [ - "Python PHP\n", - "Python Programming\n", - "Pqrst Pqr\n" - ], - "example_input": [ - "Python PHP Java JavaScript c c++\n", - "Python Programming Java Programming\n" - ], - "example_output": [ - "Python PHP\n", - "Python Programming\n" - ], - "question": "Original problem description:\nWrite a function to return two words from a list of words starting with letter 'p'.\nWe have its functional test sample:\nassert start_withp([\"Python PHP\", \"Java JavaScript\", \"c c++\"])==('Python', 'PHP')\nassert start_withp([\"Python Programming\",\"Java Programming\"])==('Python','Programming')\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nPython PHP Java JavaScript c c++\n\nOutput:\nPython PHP\n\n\nExample 2:\nInput:\nPython Programming Java Programming\n\nOutput:\nPython Programming\n\n\n" - }, - { - "source_file": "Ellen's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 166, - "prompt": "Write a function to find the maximum sum of increasing subsequence from prefix until ith index and also including a given kth element which is after i, i.e., k > i .", - "code": "def max_sum_increasing_subseq(a, n, index, k):\n\tdp = [[0 for i in range(n)] \n\t\t\tfor i in range(n)]\n\tfor i in range(n):\n\t\tif a[i] > a[0]:\n\t\t\tdp[0][i] = a[i] + a[0]\n\t\telse:\n\t\t\tdp[0][i] = a[i]\n\tfor i in range(1, n):\n\t\tfor j in range(n):\n\t\t\tif a[j] > a[i] and j > i:\n\t\t\t\tif dp[i - 1][i] + a[j] > dp[i - 1][j]:\n\t\t\t\t\tdp[i][j] = dp[i - 1][i] + a[j]\n\t\t\t\telse:\n\t\t\t\t\tdp[i][j] = dp[i - 1][j]\n\t\t\telse:\n\t\t\t\tdp[i][j] = dp[i - 1][j]\n\treturn dp[index][k]", - "test_imports": [], - "test_list": [ - "assert max_sum_increasing_subseq([1, 101, 2, 3, 100, 4, 5 ], 7, 4, 6) == 11", - "assert max_sum_increasing_subseq([1, 101, 2, 3, 100, 4, 5 ], 7, 2, 5) == 7", - "assert max_sum_increasing_subseq([11, 15, 19, 21, 26, 28, 31], 7, 2, 4) == 71" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 101 2 3 100 4 5\n7\n4\n6\n", - "1 101 2 3 100 4 5\n7\n2\n5\n", - "11 15 19 21 26 28 31\n7\n2\n4\n" - ], - "test_output": [ - "11\n", - "7\n", - "71\n" - ], - "example_input": [ - "1 101 2 3 100 4 5\n7\n4\n6\n", - "1 101 2 3 100 4 5\n7\n2\n5\n" - ], - "example_output": [ - "11\n", - "7\n" - ], - "question": "Original problem description:\nWrite a function to find the maximum sum of increasing subsequence from prefix until ith index and also including a given kth element which is after i, i.e., k > i .\nWe have its functional test sample:\nassert max_sum_increasing_subseq([1, 101, 2, 3, 100, 4, 5 ], 7, 4, 6) == 11\nassert max_sum_increasing_subseq([1, 101, 2, 3, 100, 4, 5 ], 7, 2, 5) == 7\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 101 2 3 100 4 5\n7\n4\n6\n\nOutput:\n11\n\n\nExample 2:\nInput:\n1 101 2 3 100 4 5\n7\n2\n5\n\nOutput:\n7\n\n\n" - }, - { - "source_file": "Ellen's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 168, - "prompt": "Write a function to find the specified number of largest products from two given lists, selecting one factor from each list.", - "code": "def large_product(nums1, nums2, N):\n result = sorted([x*y for x in nums1 for y in nums2], reverse=True)[:N]\n return result", - "test_imports": [], - "test_list": [ - "assert large_product([1, 2, 3, 4, 5, 6],[3, 6, 8, 9, 10, 6],3)==[60, 54, 50]", - "assert large_product([1, 2, 3, 4, 5, 6],[3, 6, 8, 9, 10, 6],4)==[60, 54, 50, 48]", - "assert large_product([1, 2, 3, 4, 5, 6],[3, 6, 8, 9, 10, 6],5)==[60, 54, 50, 48, 45]" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 2 3 4 5 6\n3 6 8 9 10 6\n3\n", - "1 2 3 4 5 6\n3 6 8 9 10 6\n4\n", - "1 2 3 4 5 6\n3 6 8 9 10 6\n5\n" - ], - "test_output": [ - "60 54 50\n", - "60 54 50 48\n", - "60 54 50 48 45\n" - ], - "example_input": [ - "1 2 3 4 5 6\n3 6 8 9 10 6\n3\n", - "1 2 3 4 5 6\n3 6 8 9 10 6\n4\n" - ], - "example_output": [ - "60 54 50\n", - "60 54 50 48\n" - ], - "question": "Original problem description:\nWrite a function to find the specified number of largest products from two given lists, selecting one factor from each list.\nWe have its functional test sample:\nassert large_product([1, 2, 3, 4, 5, 6],[3, 6, 8, 9, 10, 6],3)==[60, 54, 50]\nassert large_product([1, 2, 3, 4, 5, 6],[3, 6, 8, 9, 10, 6],4)==[60, 54, 50, 48]\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 2 3 4 5 6\n3 6 8 9 10 6\n3\n\nOutput:\n60 54 50\n\n\nExample 2:\nInput:\n1 2 3 4 5 6\n3 6 8 9 10 6\n4\n\nOutput:\n60 54 50 48\n\n\n" - }, - { - "source_file": "Ellen's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 169, - "prompt": "Write a python function to find the maximum of two numbers.", - "code": "def maximum(a,b): \n if a >= b: \n return a \n else: \n return b ", - "test_imports": [], - "test_list": [ - "assert maximum(5,10) == 10", - "assert maximum(-1,-2) == -1", - "assert maximum(9,7) == 9" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "5\n10\n", - "-1\n-2\n", - "9\n7\n" - ], - "test_output": [ - "10\n", - "-1\n", - "9\n" - ], - "example_input": [ - "5\n10\n", - "-1\n-2\n" - ], - "example_output": [ - "10\n", - "-1\n" - ], - "question": "Original problem description:\nWrite a python function to find the maximum of two numbers.\nWe have its functional test sample:\nassert maximum(5,10) == 10\nassert maximum(-1,-2) == -1\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n5\n10\n\nOutput:\n10\n\n\nExample 2:\nInput:\n-1\n-2\n\nOutput:\n-1\n\n\n" - }, - { - "source_file": "Ellen's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 170, - "prompt": "Write a function to convert a given string to a tuple of characters.", - "code": "def string_to_tuple(str1):\n result = tuple(x for x in str1 if not x.isspace()) \n return result", - "test_imports": [], - "test_list": [ - "assert string_to_tuple(\"python 3.0\")==('p', 'y', 't', 'h', 'o', 'n', '3', '.', '0')", - "assert string_to_tuple(\"item1\")==('i', 't', 'e', 'm', '1')", - "assert string_to_tuple(\"15.10\")==('1', '5', '.', '1', '0')" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "python 3.0\n", - "item1\n", - "15.10\n" - ], - "test_output": [ - "p y t h o n 3 . 0\n", - "i t e m 1\n", - "1 5 . 1 0\n" - ], - "example_input": [ - "python 3.0\n", - "item1\n" - ], - "example_output": [ - "p y t h o n 3 . 0\n", - "i t e m 1\n" - ], - "question": "Original problem description:\nWrite a function to convert a given string to a tuple of characters.\nWe have its functional test sample:\nassert string_to_tuple(\"python 3.0\")==('p', 'y', 't', 'h', 'o', 'n', '3', '.', '0')\nassert string_to_tuple(\"item1\")==('i', 't', 'e', 'm', '1')\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\npython 3.0\n\nOutput:\np y t h o n 3 . 0\n\n\nExample 2:\nInput:\nitem1\n\nOutput:\ni t e m 1\n\n\n" - }, - { - "source_file": "Ellen's Copy of Benchmark Questions Verification V2.ipynb", - "task_id": 171, - "prompt": "Write a python function to set the left most unset bit.", - "code": "def set_left_most_unset_bit(n): \n if not (n & (n + 1)): \n return n \n pos, temp, count = 0, n, 0 \n while temp: \n if not (temp & 1): \n pos = count \n count += 1; temp>>=1\n return (n | (1 << (pos))) ", - "test_imports": [], - "test_list": [ - "assert set_left_most_unset_bit(10) == 14", - "assert set_left_most_unset_bit(12) == 14", - "assert set_left_most_unset_bit(15) == 15" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "10\n", - "12\n", - "15\n" - ], - "test_output": [ - "14\n", - "14\n", - "15\n" - ], - "example_input": [ - "10\n", - "12\n" - ], - "example_output": [ - "14\n", - "14\n" - ], - "question": "Original problem description:\nWrite a python function to set the left most unset bit.\nWe have its functional test sample:\nassert set_left_most_unset_bit(10) == 14\nassert set_left_most_unset_bit(12) == 14\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n10\n\nOutput:\n14\n\n\nExample 2:\nInput:\n12\n\nOutput:\n14\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 173, - "prompt": "Write a python function to find the highest power of 2 that is less than or equal to n.", - "code": "def highest_Power_of_2(n): \n res = 0 \n for i in range(n, 0, -1): \n if ((i & (i - 1)) == 0): \n res = i \n break \n return res ", - "test_imports": [], - "test_list": [ - "assert highest_Power_of_2(10) == 8", - "assert highest_Power_of_2(19) == 16", - "assert highest_Power_of_2(32) == 32" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "10\n", - "19\n", - "32\n" - ], - "test_output": [ - "8\n", - "16\n", - "32\n" - ], - "example_input": [ - "10\n", - "19\n" - ], - "example_output": [ - "8\n", - "16\n" - ], - "question": "Original problem description:\nWrite a python function to find the highest power of 2 that is less than or equal to n.\nWe have its functional test sample:\nassert highest_Power_of_2(10) == 8\nassert highest_Power_of_2(19) == 16\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n10\n\nOutput:\n8\n\n\nExample 2:\nInput:\n19\n\nOutput:\n16\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 174, - "prompt": "Write a function to find the n'th lucas number.", - "code": "def find_lucas(n): \n\tif (n == 0): \n\t\treturn 2\n\tif (n == 1): \n\t\treturn 1\n\treturn find_lucas(n - 1) + find_lucas(n - 2) ", - "test_imports": [], - "test_list": [ - "assert find_lucas(9) == 76", - "assert find_lucas(4) == 7", - "assert find_lucas(3) == 4" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "9\n", - "4\n", - "3\n" - ], - "test_output": [ - "76\n", - "7\n", - "4\n" - ], - "example_input": [ - "9\n", - "4\n" - ], - "example_output": [ - "76\n", - "7\n" - ], - "question": "Original problem description:\nWrite a function to find the n'th lucas number.\nWe have its functional test sample:\nassert find_lucas(9) == 76\nassert find_lucas(4) == 7\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n9\n\nOutput:\n76\n\n\nExample 2:\nInput:\n4\n\nOutput:\n7\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 175, - "prompt": "Write a function to apply a given format string to all of the elements in a list.", - "code": "def add_string(list_, string):\n add_string=[string.format(i) for i in list_]\n return add_string", - "test_imports": [], - "test_list": [ - "assert add_string([1,2,3,4],'temp{0}')==['temp1', 'temp2', 'temp3', 'temp4']", - "assert add_string(['a','b','c','d'], 'python{0}')==[ 'pythona', 'pythonb', 'pythonc', 'pythond']", - "assert add_string([5,6,7,8],'string{0}')==['string5', 'string6', 'string7', 'string8']" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 2 3 4\ntemp{0}\n", - "a b c d\npython{0}\n", - "5 6 7 8\nstring{0}\n" - ], - "test_output": [ - "temp1 temp2 temp3 temp4\n", - "pythona pythonb pythonc pythond\n", - "string5 string6 string7 string8\n" - ], - "example_input": [ - "1 2 3 4\ntemp{0}\n", - "a b c d\npython{0}\n" - ], - "example_output": [ - "temp1 temp2 temp3 temp4\n", - "pythona pythonb pythonc pythond\n" - ], - "question": "Original problem description:\nWrite a function to apply a given format string to all of the elements in a list.\nWe have its functional test sample:\nassert add_string([1,2,3,4],'temp{0}')==['temp1', 'temp2', 'temp3', 'temp4']\nassert add_string(['a','b','c','d'], 'python{0}')==[ 'pythona', 'pythonb', 'pythonc', 'pythond']\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 2 3 4\ntemp{0}\n\nOutput:\ntemp1 temp2 temp3 temp4\n\n\nExample 2:\nInput:\na b c d\npython{0}\n\nOutput:\npythona pythonb pythonc pythond\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 177, - "prompt": "Write a function to find the maximum sum possible by using the given equation f(n) = max( (f(n/2) + f(n/3) + f(n/4) + f(n/5)), n).", - "code": "def get_max_sum (n):\n\tres = list()\n\tres.append(0)\n\tres.append(1)\n\ti = 2\n\twhile i b:\n if a < c:\n median = a\n elif b > c:\n median = b\n else:\n median = c\n else:\n if a > c:\n median = a\n elif b < c:\n median = b\n else:\n median = c\n return median", - "test_imports": [], - "test_list": [ - "assert median_numbers(25,55,65)==55.0", - "assert median_numbers(20,10,30)==20.0", - "assert median_numbers(15,45,75)==45.0" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "25\n55\n65\n", - "20\n10\n30\n", - "15\n45\n75\n" - ], - "test_output": [ - "55.0\n", - "20.0\n", - "45.0\n" - ], - "example_input": [ - "25\n55\n65\n", - "20\n10\n30\n" - ], - "example_output": [ - "55.0\n", - "20.0\n" - ], - "question": "Original problem description:\nWrite a function to find the median of three numbers.\nWe have its functional test sample:\nassert median_numbers(25,55,65)==55.0\nassert median_numbers(20,10,30)==20.0\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n25\n55\n65\n\nOutput:\n55.0\n\n\nExample 2:\nInput:\n20\n10\n30\n\nOutput:\n20.0\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 183, - "prompt": "Write a function to compute the sum of digits of each number of a given list.", - "code": "def sum_of_digits(nums):\n return sum(int(el) for n in nums for el in str(n) if el.isdigit())", - "test_imports": [], - "test_list": [ - "assert sum_of_digits([10,2,56])==14", - "assert sum_of_digits([[10,20,4,5,'b',70,'a']])==19", - "assert sum_of_digits([10,20,-4,5,-70])==19" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "10 2 56\n", - "10 20 4 5 b 70 a\n", - "10 20 -4 5 -70\n" - ], - "test_output": [ - "14\n", - "19\n", - "19\n" - ], - "example_input": [ - "10 2 56\n", - "10 20 4 5 b 70 a\n" - ], - "example_output": [ - "14\n", - "19\n" - ], - "question": "Original problem description:\nWrite a function to compute the sum of digits of each number of a given list.\nWe have its functional test sample:\nassert sum_of_digits([10,2,56])==14\nassert sum_of_digits([[10,20,4,5,'b',70,'a']])==19\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n10 2 56\n\nOutput:\n14\n\n\nExample 2:\nInput:\n10 20 4 5 b 70 a\n\nOutput:\n19\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 184, - "prompt": "Write a function to perform the mathematical bitwise xor operation across the given tuples.", - "code": "def bitwise_xor(test_tup1, test_tup2):\n res = tuple(ele1 ^ ele2 for ele1, ele2 in zip(test_tup1, test_tup2))\n return (res) ", - "test_imports": [], - "test_list": [ - "assert bitwise_xor((10, 4, 6, 9), (5, 2, 3, 3)) == (15, 6, 5, 10)", - "assert bitwise_xor((11, 5, 7, 10), (6, 3, 4, 4)) == (13, 6, 3, 14)", - "assert bitwise_xor((12, 6, 8, 11), (7, 4, 5, 6)) == (11, 2, 13, 13)" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "10 4 6 9\n5 2 3 3\n", - "11 5 7 10\n6 3 4 4\n", - "12 6 8 11\n7 4 5 6\n" - ], - "test_output": [ - "15 6 5 10\n", - "13 6 3 14\n", - "11 2 13 13\n" - ], - "example_input": [ - "10 4 6 9\n5 2 3 3\n", - "11 5 7 10\n6 3 4 4\n" - ], - "example_output": [ - "15 6 5 10\n", - "13 6 3 14\n" - ], - "question": "Original problem description:\nWrite a function to perform the mathematical bitwise xor operation across the given tuples.\nWe have its functional test sample:\nassert bitwise_xor((10, 4, 6, 9), (5, 2, 3, 3)) == (15, 6, 5, 10)\nassert bitwise_xor((11, 5, 7, 10), (6, 3, 4, 4)) == (13, 6, 3, 14)\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n10 4 6 9\n5 2 3 3\n\nOutput:\n15 6 5 10\n\n\nExample 2:\nInput:\n11 5 7 10\n6 3 4 4\n\nOutput:\n13 6 3 14\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 185, - "prompt": "Write a function to extract the number of unique tuples in the given list.", - "code": "def extract_freq(test_list):\n res = len(list(set(tuple(sorted(sub)) for sub in test_list)))\n return (res)", - "test_imports": [], - "test_list": [ - "assert extract_freq([(3, 4), (1, 2), (4, 3), (5, 6)] ) == 3", - "assert extract_freq([(4, 15), (2, 3), (5, 4), (6, 7)] ) == 4", - "assert extract_freq([(5, 16), (2, 3), (6, 5), (6, 9)] ) == 4" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "3 4\n1 2\n4 3\n5 6\n", - "4 15\n2 3\n5 4\n6 7\n", - "5 16\n2 3\n6 5\n6 9\n" - ], - "test_output": [ - "3\n", - "4\n", - "4\n" - ], - "example_input": [ - "3 4\n1 2\n4 3\n5 6\n", - "4 15\n2 3\n5 4\n6 7\n" - ], - "example_output": [ - "3\n", - "4\n" - ], - "question": "Original problem description:\nWrite a function to extract the number of unique tuples in the given list.\nWe have its functional test sample:\nassert extract_freq([(3, 4), (1, 2), (4, 3), (5, 6)] ) == 3\nassert extract_freq([(4, 15), (2, 3), (5, 4), (6, 7)] ) == 4\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n3 4\n1 2\n4 3\n5 6\n\nOutput:\n3\n\n\nExample 2:\nInput:\n4 15\n2 3\n5 4\n6 7\n\nOutput:\n4\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 187, - "prompt": "Write a python function to find the minimum of two numbers.", - "code": "def minimum(a,b): \n if a <= b: \n return a \n else: \n return b ", - "test_imports": [], - "test_list": [ - "assert minimum(1,2) == 1", - "assert minimum(-5,-4) == -5", - "assert minimum(0,0) == 0" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1\n2\n", - "-5\n-4\n", - "0\n0\n" - ], - "test_output": [ - "1\n", - "-5\n", - "0\n" - ], - "example_input": [ - "1\n2\n", - "-5\n-4\n" - ], - "example_output": [ - "1\n", - "-5\n" - ], - "question": "Original problem description:\nWrite a python function to find the minimum of two numbers.\nWe have its functional test sample:\nassert minimum(1,2) == 1\nassert minimum(-5,-4) == -5\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1\n2\n\nOutput:\n1\n\n\nExample 2:\nInput:\n-5\n-4\n\nOutput:\n-5\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 188, - "prompt": "Write a function to check whether an element exists within a tuple.", - "code": "def check_tuplex(tuplex,tuple1): \n if tuple1 in tuplex:\n return True\n else:\n return False", - "test_imports": [], - "test_list": [ - "assert check_tuplex((\"w\", 3, \"r\", \"e\", \"s\", \"o\", \"u\", \"r\", \"c\", \"e\"),'r')==True", - "assert check_tuplex((\"w\", 3, \"r\", \"e\", \"s\", \"o\", \"u\", \"r\", \"c\", \"e\"),'5')==False", - "assert check_tuplex((\"w\", 3, \"r\", \"e\", \"s\", \"o\", \"u\", \"r\", \"c\",\"e\"),3)==True" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "w 3 r e s o u r c e\nr\n", - "w 3 r e s o u r c e\n5\n", - "w 3 r e s o u r c e\n3\n" - ], - "test_output": [ - "True\n", - "False\n", - "True\n" - ], - "example_input": [ - "w 3 r e s o u r c e\nr\n", - "w 3 r e s o u r c e\n5\n" - ], - "example_output": [ - "True\n", - "False\n" - ], - "question": "Original problem description:\nWrite a function to check whether an element exists within a tuple.\nWe have its functional test sample:\nassert check_tuplex((\"w\", 3, \"r\", \"e\", \"s\", \"o\", \"u\", \"r\", \"c\", \"e\"),'r')==True\nassert check_tuplex((\"w\", 3, \"r\", \"e\", \"s\", \"o\", \"u\", \"r\", \"c\", \"e\"),'5')==False\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nw 3 r e s o u r c e\nr\n\nOutput:\nTrue\n\n\nExample 2:\nInput:\nw 3 r e s o u r c e\n5\n\nOutput:\nFalse\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 189, - "prompt": "Write a python function to find whether the parity of a given number is odd.", - "code": "def find_Parity(x): \n y = x ^ (x >> 1); \n y = y ^ (y >> 2); \n y = y ^ (y >> 4); \n y = y ^ (y >> 8); \n y = y ^ (y >> 16); \n if (y & 1): \n return True\n return False", - "test_imports": [], - "test_list": [ - "assert find_Parity(12) == False", - "assert find_Parity(7) == True", - "assert find_Parity(10) == False" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "12\n", - "7\n", - "10\n" - ], - "test_output": [ - "False\n", - "True\n", - "False\n" - ], - "example_input": [ - "12\n", - "7\n" - ], - "example_output": [ - "False\n", - "True\n" - ], - "question": "Original problem description:\nWrite a python function to find whether the parity of a given number is odd.\nWe have its functional test sample:\nassert find_Parity(12) == False\nassert find_Parity(7) == True\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n12\n\nOutput:\nFalse\n\n\nExample 2:\nInput:\n7\n\nOutput:\nTrue\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 190, - "prompt": "Write a function to create the next bigger number by rearranging the digits of a given number.", - "code": "def rearrange_bigger(n):\n nums = list(str(n))\n for i in range(len(nums)-2,-1,-1):\n if nums[i] < nums[i+1]:\n z = nums[i:]\n y = min(filter(lambda x: x > z[0], z))\n z.remove(y)\n z.sort()\n nums[i:] = [y] + z\n return int(\"\".join(nums))\n return False", - "test_imports": [], - "test_list": [ - "assert rearrange_bigger(12)==21", - "assert rearrange_bigger(10)==False", - "assert rearrange_bigger(102)==120" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "12\n", - "10\n", - "102\n" - ], - "test_output": [ - "21\n", - "False\n", - "120\n" - ], - "example_input": [ - "12\n", - "10\n" - ], - "example_output": [ - "21\n", - "False\n" - ], - "question": "Original problem description:\nWrite a function to create the next bigger number by rearranging the digits of a given number.\nWe have its functional test sample:\nassert rearrange_bigger(12)==21\nassert rearrange_bigger(10)==False\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n12\n\nOutput:\n21\n\n\nExample 2:\nInput:\n10\n\nOutput:\nFalse\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 191, - "prompt": "Write a function to find k number of smallest pairs which consist of one element from the first array and one element from the second array.", - "code": "import heapq\ndef k_smallest_pairs(nums1, nums2, k):\n queue = []\n def push(i, j):\n if i < len(nums1) and j < len(nums2):\n heapq.heappush(queue, [nums1[i] + nums2[j], i, j])\n push(0, 0)\n pairs = []\n while queue and len(pairs) < k:\n _, i, j = heapq.heappop(queue)\n pairs.append([nums1[i], nums2[j]])\n push(i, j + 1)\n if j == 0:\n push(i + 1, 0)\n return pairs", - "test_imports": [], - "test_list": [ - "assert k_smallest_pairs([1,3,7],[2,4,6],2)==[[1, 2], [1, 4]]", - "assert k_smallest_pairs([1,3,7],[2,4,6],1)==[[1, 2]]", - "assert k_smallest_pairs([1,3,7],[2,4,6],7)==[[1, 2], [1, 4], [3, 2], [1, 6], [3, 4], [3, 6], [7, 2]]" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 3 7\n2 4 6\n2\n", - "1 3 7\n2 4 6\n1\n", - "1 3 7\n2 4 6\n7\n" - ], - "test_output": [ - "1 2\n1 4\n", - "1 2\n", - "1 2\n1 4\n3 2\n1 6\n3 4\n3 6\n7 2\n" - ], - "example_input": [ - "1 3 7\n2 4 6\n2\n", - "1 3 7\n2 4 6\n1\n" - ], - "example_output": [ - "1 2\n1 4\n", - "1 2\n" - ], - "question": "Original problem description:\nWrite a function to find k number of smallest pairs which consist of one element from the first array and one element from the second array.\nWe have its functional test sample:\nassert k_smallest_pairs([1,3,7],[2,4,6],2)==[[1, 2], [1, 4]]\nassert k_smallest_pairs([1,3,7],[2,4,6],1)==[[1, 2]]\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 3 7\n2 4 6\n2\n\nOutput:\n1 2\n1 4\n\n\nExample 2:\nInput:\n1 3 7\n2 4 6\n1\n\nOutput:\n1 2\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 192, - "prompt": "Write a function to find the minimum product from the pairs of tuples within a given list.", - "code": "def min_product_tuple(list1):\n result_min = min([abs(x * y) for x, y in list1] )\n return result_min", - "test_imports": [], - "test_list": [ - "assert min_product_tuple([(2, 7), (2, 6), (1, 8), (4, 9)] )==8", - "assert min_product_tuple([(10,20), (15,2), (5,10)] )==30", - "assert min_product_tuple([(11,44), (10,15), (20,5), (12, 9)] )==100" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "2 7\n2 6\n1 8\n4 9\n", - "10 20\n15 2\n5 10\n", - "11 44\n10 15\n20 5\n12 9\n" - ], - "test_output": [ - "8\n", - "30\n", - "100\n" - ], - "example_input": [ - "2 7\n2 6\n1 8\n4 9\n", - "10 20\n15 2\n5 10\n" - ], - "example_output": [ - "8\n", - "30\n" - ], - "question": "Original problem description:\nWrite a function to find the minimum product from the pairs of tuples within a given list.\nWe have its functional test sample:\nassert min_product_tuple([(2, 7), (2, 6), (1, 8), (4, 9)] )==8\nassert min_product_tuple([(10,20), (15,2), (5,10)] )==30\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n2 7\n2 6\n1 8\n4 9\n\nOutput:\n8\n\n\nExample 2:\nInput:\n10 20\n15 2\n5 10\n\nOutput:\n30\n\n\n" - }, - { - "source_file": "Benchmark Questions Verification V2.ipynb", - "task_id": 193, - "prompt": "Write a function to find the minimum value in a given heterogeneous list.", - "code": "def min_val(listval):\n min_val = min(i for i in listval if isinstance(i, int))\n return min_val", - "test_imports": [], - "test_list": [ - "assert min_val(['Python', 3, 2, 4, 5, 'version'])==2", - "assert min_val(['Python', 15, 20, 25])==15", - "assert min_val(['Python', 30, 20, 40, 50, 'version'])==20" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "Python 3 2 4 5 version\n", - "Python 15 20 25\n", - "Python 30 20 40 50 version\n" - ], - "test_output": [ - "2\n", - "15\n", - "20\n" - ], - "example_input": [ - "Python 3 2 4 5 version\n", - "Python 15 20 25\n" - ], - "example_output": [ - "2\n", - "15\n" - ], - "question": "Original problem description:\nWrite a function to find the minimum value in a given heterogeneous list.\nWe have its functional test sample:\nassert min_val(['Python', 3, 2, 4, 5, 'version'])==2\nassert min_val(['Python', 15, 20, 25])==15\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nPython 3 2 4 5 version\n\nOutput:\n2\n\n\nExample 2:\nInput:\nPython 15 20 25\n\nOutput:\n15\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 194, - "prompt": "Write a function to convert the given snake case string to camel case string.", - "code": "import re\ndef snake_to_camel(word):\n return ''.join(x.capitalize() or '_' for x in word.split('_'))", - "test_imports": [], - "test_list": [ - "assert snake_to_camel('android_tv') == 'AndroidTv'", - "assert snake_to_camel('google_pixel') == 'GooglePixel'", - "assert snake_to_camel('apple_watch') == 'AppleWatch'" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "android_tv\n", - "google_pixel\n", - "apple_watch\n" - ], - "test_output": [ - "AndroidTv\n", - "GooglePixel\n", - "AppleWatch\n" - ], - "example_input": [ - "android_tv\n", - "google_pixel\n" - ], - "example_output": [ - "AndroidTv\n", - "GooglePixel\n" - ], - "question": "Original problem description:\nWrite a function to convert the given snake case string to camel case string.\nWe have its functional test sample:\nassert snake_to_camel('android_tv') == 'AndroidTv'\nassert snake_to_camel('google_pixel') == 'GooglePixel'\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nandroid_tv\n\nOutput:\nAndroidTv\n\n\nExample 2:\nInput:\ngoogle_pixel\n\nOutput:\nGooglePixel\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 195, - "prompt": "Write a python function to remove odd numbers from a given list.", - "code": "def remove_odd(l):\n for i in l:\n if i % 2 != 0:\n l.remove(i)\n return l", - "test_imports": [], - "test_list": [ - "assert remove_odd([1,2,3]) == [2]", - "assert remove_odd([2,4,6]) == [2,4,6]", - "assert remove_odd([10,20,3]) == [10,20]" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 2 3\n", - "2 4 6\n", - "10 20 3\n" - ], - "test_output": [ - "2\n", - "2 4 6\n", - "10 20\n" - ], - "example_input": [ - "1 2 3\n", - "2 4 6\n" - ], - "example_output": [ - "2\n", - "2 4 6\n" - ], - "question": "Original problem description:\nWrite a python function to remove odd numbers from a given list.\nWe have its functional test sample:\nassert remove_odd([1,2,3]) == [2]\nassert remove_odd([2,4,6]) == [2,4,6]\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 2 3\n\nOutput:\n2\n\n\nExample 2:\nInput:\n2 4 6\n\nOutput:\n2 4 6\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 197, - "prompt": "Write a python function to check whether any value in a sequence exists in a sequence or not.", - "code": "def overlapping(list1,list2): \n for i in range(len(list1)): \n for j in range(len(list2)): \n if(list1[i]==list2[j]): \n return True\n return False", - "test_imports": [], - "test_list": [ - "assert overlapping([1,2,3,4,5],[6,7,8,9]) == False", - "assert overlapping([1,2,3],[4,5,6]) == False", - "assert overlapping([1,4,5],[1,4,5]) == True" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 2 3 4 5\n6 7 8 9\n", - "1 2 3\n4 5 6\n", - "1 4 5\n1 4 5\n" - ], - "test_output": [ - "False\n", - "False\n", - "True\n" - ], - "example_input": [ - "1 2 3 4 5\n6 7 8 9\n", - "1 2 3\n4 5 6\n" - ], - "example_output": [ - "False\n", - "False\n" - ], - "question": "Original problem description:\nWrite a python function to check whether any value in a sequence exists in a sequence or not.\nWe have its functional test sample:\nassert overlapping([1,2,3,4,5],[6,7,8,9]) == False\nassert overlapping([1,2,3],[4,5,6]) == False\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 2 3 4 5\n6 7 8 9\n\nOutput:\nFalse\n\n\nExample 2:\nInput:\n1 2 3\n4 5 6\n\nOutput:\nFalse\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 198, - "prompt": "Write a python function to find a pair with highest product from a given array of integers.", - "code": "def max_Product(arr): \n arr_len = len(arr) \n if (arr_len < 2): \n return (\"No pairs exists\") \n x = arr[0]; y = arr[1] \n for i in range(0,arr_len): \n for j in range(i + 1,arr_len): \n if (arr[i] * arr[j] > x * y): \n x = arr[i]; y = arr[j] \n return x,y ", - "test_imports": [], - "test_list": [ - "assert max_Product([1,2,3,4,7,0,8,4]) == (7,8)", - "assert max_Product([0,-1,-2,-4,5,0,-6]) == (-4,-6)", - "assert max_Product([1,2,3]) == (2,3)" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 2 3 4 7 0 8 4\n", - "0 -1 -2 -4 5 0 -6\n", - "1 2 3\n" - ], - "test_output": [ - "7 8\n", - "-4 -6\n", - "2 3\n" - ], - "example_input": [ - "1 2 3 4 7 0 8 4\n", - "0 -1 -2 -4 5 0 -6\n" - ], - "example_output": [ - "7 8\n", - "-4 -6\n" - ], - "question": "Original problem description:\nWrite a python function to find a pair with highest product from a given array of integers.\nWe have its functional test sample:\nassert max_Product([1,2,3,4,7,0,8,4]) == (7,8)\nassert max_Product([0,-1,-2,-4,5,0,-6]) == (-4,-6)\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 2 3 4 7 0 8 4\n\nOutput:\n7 8\n\n\nExample 2:\nInput:\n0 -1 -2 -4 5 0 -6\n\nOutput:\n-4 -6\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 199, - "prompt": "Write a function to find common first element in given list of tuple.", - "code": "def group_tuples(Input): \n\tout = {} \n\tfor elem in Input: \n\t\ttry: \n\t\t\tout[elem[0]].extend(elem[1:]) \n\t\texcept KeyError: \n\t\t\tout[elem[0]] = list(elem) \n\treturn [tuple(values) for values in out.values()] ", - "test_imports": [], - "test_list": [ - "assert group_tuples([('x', 'y'), ('x', 'z'), ('w', 't')]) == [('x', 'y', 'z'), ('w', 't')]", - "assert group_tuples([('a', 'b'), ('a', 'c'), ('d', 'e')]) == [('a', 'b', 'c'), ('d', 'e')]", - "assert group_tuples([('f', 'g'), ('f', 'g'), ('h', 'i')]) == [('f', 'g', 'g'), ('h', 'i')]" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "x y\nx z\nw t\n", - "a b\na c\nd e\n", - "f g\nf g\nh i\n" - ], - "test_output": [ - "x y z\nw t\n", - "a b c\nd e\n", - "f g g\nh i\n" - ], - "example_input": [ - "x y\nx z\nw t\n", - "a b\na c\nd e\n" - ], - "example_output": [ - "x y z\nw t\n", - "a b c\nd e\n" - ], - "question": "Original problem description:\nWrite a function to find common first element in given list of tuple.\nWe have its functional test sample:\nassert group_tuples([('x', 'y'), ('x', 'z'), ('w', 't')]) == [('x', 'y', 'z'), ('w', 't')]\nassert group_tuples([('a', 'b'), ('a', 'c'), ('d', 'e')]) == [('a', 'b', 'c'), ('d', 'e')]\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nx y\nx z\nw t\n\nOutput:\nx y z\nw t\n\n\nExample 2:\nInput:\na b\na c\nd e\n\nOutput:\na b c\nd e\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 200, - "prompt": "Write a python function to find the element of a list having maximum length.", - "code": "def Find_Max(lst): \n maxList = max((x) for x in lst) \n return maxList", - "test_imports": [], - "test_list": [ - "assert Find_Max([['A'],['A','B'],['A','B','C']]) == ['A','B','C']", - "assert Find_Max([[1],[1,2],[1,2,3]]) == [1,2,3]", - "assert Find_Max([[1,1],[1,2,3],[1,5,6,1]]) == [1,5,6,1]" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "A\nA B\nA B C\n", - "1\n1 2\n1 2 3\n", - "1 1\n1 2 3\n1 5 6 1\n" - ], - "test_output": [ - "A B C\n", - "1 2 3\n", - "1 5 6 1\n" - ], - "example_input": [ - "A\nA B\nA B C\n", - "1\n1 2\n1 2 3\n" - ], - "example_output": [ - "A B C\n", - "1 2 3\n" - ], - "question": "Original problem description:\nWrite a python function to find the element of a list having maximum length.\nWe have its functional test sample:\nassert Find_Max([['A'],['A','B'],['A','B','C']]) == ['A','B','C']\nassert Find_Max([[1],[1,2],[1,2,3]]) == [1,2,3]\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nA\nA B\nA B C\n\nOutput:\nA B C\n\n\nExample 2:\nInput:\n1\n1 2\n1 2 3\n\nOutput:\n1 2 3\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 201, - "prompt": "Write a function to round every number of a given list of numbers and print the total sum multiplied by the length of the list.", - "code": "def round_and_sum(list1):\n lenght=len(list1)\n round_and_sum=sum(list(map(round,list1))* lenght)\n return round_and_sum", - "test_imports": [], - "test_list": [ - "assert round_and_sum([22.4, 4.0, -16.22, -9.10, 11.00, -12.22, 14.20, -5.20, 17.50])==243", - "assert round_and_sum([5,2,9,24.3,29])==345", - "assert round_and_sum([25.0,56.7,89.2])==513" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "22.4 4.0 -16.22 -9.1 11.0 -12.22 14.2 -5.2 17.5\n", - "5 2 9 24.3 29\n", - "25.0 56.7 89.2\n" - ], - "test_output": [ - "243\n", - "345\n", - "513\n" - ], - "example_input": [ - "22.4 4.0 -16.22 -9.1 11.0 -12.22 14.2 -5.2 17.5\n", - "5 2 9 24.3 29\n" - ], - "example_output": [ - "243\n", - "345\n" - ], - "question": "Original problem description:\nWrite a function to round every number of a given list of numbers and print the total sum multiplied by the length of the list.\nWe have its functional test sample:\nassert round_and_sum([22.4, 4.0, -16.22, -9.10, 11.00, -12.22, 14.20, -5.20, 17.50])==243\nassert round_and_sum([5,2,9,24.3,29])==345\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n22.4 4.0 -16.22 -9.1 11.0 -12.22 14.2 -5.2 17.5\n\nOutput:\n243\n\n\nExample 2:\nInput:\n5 2 9 24.3 29\n\nOutput:\n345\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 202, - "prompt": "Write a python function to find the cube sum of first n even natural numbers.", - "code": "def cube_Sum(n): \n sum = 0\n for i in range(1,n + 1): \n sum += (2*i)*(2*i)*(2*i) \n return sum", - "test_imports": [], - "test_list": [ - "assert cube_Sum(2) == 72", - "assert cube_Sum(3) == 288", - "assert cube_Sum(4) == 800" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "2\n", - "3\n", - "4\n" - ], - "test_output": [ - "72\n", - "288\n", - "800\n" - ], - "example_input": [ - "2\n", - "3\n" - ], - "example_output": [ - "72\n", - "288\n" - ], - "question": "Original problem description:\nWrite a python function to find the cube sum of first n even natural numbers.\nWe have its functional test sample:\nassert cube_Sum(2) == 72\nassert cube_Sum(3) == 288\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n2\n\nOutput:\n72\n\n\nExample 2:\nInput:\n3\n\nOutput:\n288\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 203, - "prompt": "Write a function to concatenate each element of tuple by the delimiter.", - "code": "def concatenate_tuple(test_tup):\n delim = \"-\"\n res = ''.join([str(ele) + delim for ele in test_tup])\n res = res[ : len(res) - len(delim)]\n return (str(res)) ", - "test_imports": [], - "test_list": [ - "assert concatenate_tuple((\"ID\", \"is\", 4, \"UTS\") ) == 'ID-is-4-UTS'", - "assert concatenate_tuple((\"QWE\", \"is\", 4, \"RTY\") ) == 'QWE-is-4-RTY'", - "assert concatenate_tuple((\"ZEN\", \"is\", 4, \"OP\") ) == 'ZEN-is-4-OP'" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "ID\nis\n4\nUTS\n", - "QWE\nis\n4\nRTY\n", - "ZEN\nis\n4\nOP\n" - ], - "test_output": [ - "ID-is-4-UTS\n", - "QWE-is-4-RTY\n", - "ZEN-is-4-OP\n" - ], - "example_input": [ - "ID\nis\n4\nUTS\n", - "QWE\nis\n4\nRTY\n" - ], - "example_output": [ - "ID-is-4-UTS\n", - "QWE-is-4-RTY\n" - ], - "question": "Original problem description:\nWrite a function to concatenate each element of tuple by the delimiter.\nWe have its functional test sample:\nassert concatenate_tuple((\"ID\", \"is\", 4, \"UTS\") ) == 'ID-is-4-UTS'\nassert concatenate_tuple((\"QWE\", \"is\", 4, \"RTY\") ) == 'QWE-is-4-RTY'\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nID\nis\n4\nUTS\n\nOutput:\nID-is-4-UTS\n\n\nExample 2:\nInput:\nQWE\nis\n4\nRTY\n\nOutput:\nQWE-is-4-RTY\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 204, - "prompt": "Write a python function to find the average of cubes of first n natural numbers.", - "code": "def find_Average_Of_Cube(n): \n sum = 0\n for i in range(1, n + 1): \n sum += i * i * i \n return round(sum / n, 6) ", - "test_imports": [], - "test_list": [ - "assert find_Average_Of_Cube(2) == 4.5", - "assert find_Average_Of_Cube(3) == 12", - "assert find_Average_Of_Cube(1) == 1" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "2\n", - "3\n", - "1\n" - ], - "test_output": [ - "4.5\n", - "12\n", - "1\n" - ], - "example_input": [ - "2\n", - "3\n" - ], - "example_output": [ - "4.5\n", - "12\n" - ], - "question": "Original problem description:\nWrite a python function to find the average of cubes of first n natural numbers.\nWe have its functional test sample:\nassert find_Average_Of_Cube(2) == 4.5\nassert find_Average_Of_Cube(3) == 12\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n2\n\nOutput:\n4.5\n\n\nExample 2:\nInput:\n3\n\nOutput:\n12\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 205, - "prompt": "Write a function to extract only the rear index element of each string in the given tuple.", - "code": "def extract_rear(test_tuple):\n res = list(sub[len(sub) - 1] for sub in test_tuple)\n return (res) ", - "test_imports": [], - "test_list": [ - "assert extract_rear(('Mers', 'for', 'Vers') ) == ['s', 'r', 's']", - "assert extract_rear(('Avenge', 'for', 'People') ) == ['e', 'r', 'e']", - "assert extract_rear(('Gotta', 'get', 'go') ) == ['a', 't', 'o']" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "Mers\nfor\nVers\n", - "Avenge\nfor\nPeople\n", - "Gotta\nget\ngo\n" - ], - "test_output": [ - "s r s\n", - "e r e\n", - "a t o\n" - ], - "example_input": [ - "Mers\nfor\nVers\n", - "Avenge\nfor\nPeople\n" - ], - "example_output": [ - "s r s\n", - "e r e\n" - ], - "question": "Original problem description:\nWrite a function to extract only the rear index element of each string in the given tuple.\nWe have its functional test sample:\nassert extract_rear(('Mers', 'for', 'Vers') ) == ['s', 'r', 's']\nassert extract_rear(('Avenge', 'for', 'People') ) == ['e', 'r', 'e']\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nMers\nfor\nVers\n\nOutput:\ns r s\n\n\nExample 2:\nInput:\nAvenge\nfor\nPeople\n\nOutput:\ne r e\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 207, - "prompt": "Write a function to filter odd numbers.", - "code": "def filter_oddnumbers(nums):\n odd_nums = list(filter(lambda x: x%2 != 0, nums))\n return odd_nums", - "test_imports": [], - "test_list": [ - "assert filter_oddnumbers([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])==[1,3,5,7,9]", - "assert filter_oddnumbers([10,20,45,67,84,93])==[45,67,93]", - "assert filter_oddnumbers([5,7,9,8,6,4,3])==[5,7,9,3]" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 2 3 4 5 6 7 8 9 10\n", - "10 20 45 67 84 93\n", - "5 7 9 8 6 4 3\n" - ], - "test_output": [ - "1 3 5 7 9\n", - "45 67 93\n", - "5 7 9 3\n" - ], - "example_input": [ - "1 2 3 4 5 6 7 8 9 10\n", - "10 20 45 67 84 93\n" - ], - "example_output": [ - "1 3 5 7 9\n", - "45 67 93\n" - ], - "question": "Original problem description:\nWrite a function to filter odd numbers.\nWe have its functional test sample:\nassert filter_oddnumbers([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])==[1,3,5,7,9]\nassert filter_oddnumbers([10,20,45,67,84,93])==[45,67,93]\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 2 3 4 5 6 7 8 9 10\n\nOutput:\n1 3 5 7 9\n\n\nExample 2:\nInput:\n10 20 45 67 84 93\n\nOutput:\n45 67 93\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 208, - "prompt": "Write a function to convert a date of yyyy-mm-dd format to dd-mm-yyyy format.", - "code": "import re\ndef change_date_format(dt):\n return re.sub(r'(\\d{4})-(\\d{1,2})-(\\d{1,2})', '\\\\3-\\\\2-\\\\1', dt)", - "test_imports": [], - "test_list": [ - "assert change_date_format(\"2026-01-02\") == '02-01-2026'", - "assert change_date_format(\"2020-11-13\") == '13-11-2020'", - "assert change_date_format(\"2021-04-26\") == '26-04-2021'" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "2026-01-02\n", - "2020-11-13\n", - "2021-04-26\n" - ], - "test_output": [ - "02-01-2026\n", - "13-11-2020\n", - "26-04-2021\n" - ], - "example_input": [ - "2026-01-02\n", - "2020-11-13\n" - ], - "example_output": [ - "02-01-2026\n", - "13-11-2020\n" - ], - "question": "Original problem description:\nWrite a function to convert a date of yyyy-mm-dd format to dd-mm-yyyy format.\nWe have its functional test sample:\nassert change_date_format(\"2026-01-02\") == '02-01-2026'\nassert change_date_format(\"2020-11-13\") == '13-11-2020'\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n2026-01-02\n\nOutput:\n02-01-2026\n\n\nExample 2:\nInput:\n2020-11-13\n\nOutput:\n13-11-2020\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 209, - "prompt": "Write a function to sort the given array by using shell sort.", - "code": "def shell_sort(my_list):\n gap = len(my_list) // 2\n while gap > 0:\n for i in range(gap, len(my_list)):\n current_item = my_list[i]\n j = i\n while j >= gap and my_list[j - gap] > current_item:\n my_list[j] = my_list[j - gap]\n j -= gap\n my_list[j] = current_item\n gap //= 2\n\n return my_list", - "test_imports": [], - "test_list": [ - "assert shell_sort([12, 23, 4, 5, 3, 2, 12, 81, 56, 95]) == [2, 3, 4, 5, 12, 12, 23, 56, 81, 95]", - "assert shell_sort([24, 22, 39, 34, 87, 73, 68]) == [22, 24, 34, 39, 68, 73, 87]", - "assert shell_sort([32, 30, 16, 96, 82, 83, 74]) == [16, 30, 32, 74, 82, 83, 96]" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "12 23 4 5 3 2 12 81 56 95\n", - "24 22 39 34 87 73 68\n", - "32 30 16 96 82 83 74\n" - ], - "test_output": [ - "2 3 4 5 12 12 23 56 81 95\n", - "22 24 34 39 68 73 87\n", - "16 30 32 74 82 83 96\n" - ], - "example_input": [ - "12 23 4 5 3 2 12 81 56 95\n", - "24 22 39 34 87 73 68\n" - ], - "example_output": [ - "2 3 4 5 12 12 23 56 81 95\n", - "22 24 34 39 68 73 87\n" - ], - "question": "Original problem description:\nWrite a function to sort the given array by using shell sort.\nWe have its functional test sample:\nassert shell_sort([12, 23, 4, 5, 3, 2, 12, 81, 56, 95]) == [2, 3, 4, 5, 12, 12, 23, 56, 81, 95]\nassert shell_sort([24, 22, 39, 34, 87, 73, 68]) == [22, 24, 34, 39, 68, 73, 87]\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n12 23 4 5 3 2 12 81 56 95\n\nOutput:\n2 3 4 5 12 12 23 56 81 95\n\n\nExample 2:\nInput:\n24 22 39 34 87 73 68\n\nOutput:\n22 24 34 39 68 73 87\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 210, - "prompt": "Write a function to extract the elementwise and tuples from the given two tuples.", - "code": "def and_tuples(test_tup1, test_tup2):\n res = tuple(ele1 & ele2 for ele1, ele2 in zip(test_tup1, test_tup2))\n return (res) ", - "test_imports": [], - "test_list": [ - "assert and_tuples((10, 4, 6, 9), (5, 2, 3, 3)) == (0, 0, 2, 1)", - "assert and_tuples((1, 2, 3, 4), (5, 6, 7, 8)) == (1, 2, 3, 0)", - "assert and_tuples((8, 9, 11, 12), (7, 13, 14, 17)) == (0, 9, 10, 0)" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "10 4 6 9\n5 2 3 3\n", - "1 2 3 4\n5 6 7 8\n", - "8 9 11 12\n7 13 14 17\n" - ], - "test_output": [ - "0 0 2 1\n", - "1 2 3 0\n", - "0 9 10 0\n" - ], - "example_input": [ - "10 4 6 9\n5 2 3 3\n", - "1 2 3 4\n5 6 7 8\n" - ], - "example_output": [ - "0 0 2 1\n", - "1 2 3 0\n" - ], - "question": "Original problem description:\nWrite a function to extract the elementwise and tuples from the given two tuples.\nWe have its functional test sample:\nassert and_tuples((10, 4, 6, 9), (5, 2, 3, 3)) == (0, 0, 2, 1)\nassert and_tuples((1, 2, 3, 4), (5, 6, 7, 8)) == (1, 2, 3, 0)\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n10 4 6 9\n5 2 3 3\n\nOutput:\n0 0 2 1\n\n\nExample 2:\nInput:\n1 2 3 4\n5 6 7 8\n\nOutput:\n1 2 3 0\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 211, - "prompt": "Write a function to find the directrix of a parabola.", - "code": "def parabola_directrix(a, b, c): \n directrix=((int)(c - ((b * b) + 1) * 4 * a ))\n return directrix", - "test_imports": [], - "test_list": [ - "assert parabola_directrix(5,3,2)==-198", - "assert parabola_directrix(9,8,4)==-2336", - "assert parabola_directrix(2,4,6)==-130" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "5\n3\n2\n", - "9\n8\n4\n", - "2\n4\n6\n" - ], - "test_output": [ - "-198\n", - "-2336\n", - "-130\n" - ], - "example_input": [ - "5\n3\n2\n", - "9\n8\n4\n" - ], - "example_output": [ - "-198\n", - "-2336\n" - ], - "question": "Original problem description:\nWrite a function to find the directrix of a parabola.\nWe have its functional test sample:\nassert parabola_directrix(5,3,2)==-198\nassert parabola_directrix(9,8,4)==-2336\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n5\n3\n2\n\nOutput:\n-198\n\n\nExample 2:\nInput:\n9\n8\n4\n\nOutput:\n-2336\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 212, - "prompt": "Write a function that takes two lists and returns true if they have at least one common element.", - "code": "def common_element(list1, list2):\n result = False\n for x in list1:\n for y in list2:\n if x == y:\n result = True\n return result", - "test_imports": [], - "test_list": [ - "assert common_element([1,2,3,4,5], [5,6,7,8,9])==True", - "assert common_element([1,2,3,4,5], [6,7,8,9])==None", - "assert common_element(['a','b','c'], ['d','b','e'])==True" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 2 3 4 5\n5 6 7 8 9\n", - "1 2 3 4 5\n6 7 8 9\n", - "a b c\nd b e\n" - ], - "test_output": [ - "True\n", - "None\n", - "True\n" - ], - "example_input": [ - "1 2 3 4 5\n5 6 7 8 9\n", - "1 2 3 4 5\n6 7 8 9\n" - ], - "example_output": [ - "True\n", - "None\n" - ], - "question": "Original problem description:\nWrite a function that takes two lists and returns true if they have at least one common element.\nWe have its functional test sample:\nassert common_element([1,2,3,4,5], [5,6,7,8,9])==True\nassert common_element([1,2,3,4,5], [6,7,8,9])==None\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 2 3 4 5\n5 6 7 8 9\n\nOutput:\nTrue\n\n\nExample 2:\nInput:\n1 2 3 4 5\n6 7 8 9\n\nOutput:\nNone\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 213, - "prompt": "Write a function to find the median length of a trapezium.", - "code": "def median_trapezium(base1,base2,height):\n median = 0.5 * (base1+ base2)\n return median", - "test_imports": [], - "test_list": [ - "assert median_trapezium(15,25,35)==20", - "assert median_trapezium(10,20,30)==15", - "assert median_trapezium(6,9,4)==7.5" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "15\n25\n35\n", - "10\n20\n30\n", - "6\n9\n4\n" - ], - "test_output": [ - "20\n", - "15\n", - "7.5\n" - ], - "example_input": [ - "15\n25\n35\n", - "10\n20\n30\n" - ], - "example_output": [ - "20\n", - "15\n" - ], - "question": "Original problem description:\nWrite a function to find the median length of a trapezium.\nWe have its functional test sample:\nassert median_trapezium(15,25,35)==20\nassert median_trapezium(10,20,30)==15\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n15\n25\n35\n\nOutput:\n20\n\n\nExample 2:\nInput:\n10\n20\n30\n\nOutput:\n15\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 214, - "prompt": "Write a function to check whether the entered number is greater than the elements of the given array.", - "code": "def check_greater(arr, number):\n arr.sort()\n return number > arr[-1]", - "test_imports": [], - "test_list": [ - "assert check_greater([1, 2, 3, 4, 5], 4) == False", - "assert check_greater([2, 3, 4, 5, 6], 8) == True", - "assert check_greater([9, 7, 4, 8, 6, 1], 11) == True" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 2 3 4 5\n4\n", - "2 3 4 5 6\n8\n", - "9 7 4 8 6 1\n11\n" - ], - "test_output": [ - "False\n", - "True\n", - "True\n" - ], - "example_input": [ - "1 2 3 4 5\n4\n", - "2 3 4 5 6\n8\n" - ], - "example_output": [ - "False\n", - "True\n" - ], - "question": "Original problem description:\nWrite a function to check whether the entered number is greater than the elements of the given array.\nWe have its functional test sample:\nassert check_greater([1, 2, 3, 4, 5], 4) == False\nassert check_greater([2, 3, 4, 5, 6], 8) == True\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 2 3 4 5\n4\n\nOutput:\nFalse\n\n\nExample 2:\nInput:\n2 3 4 5 6\n8\n\nOutput:\nTrue\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 215, - "prompt": "Write a function that matches a string that has an a followed by one or more b's.", - "code": "import re\ndef text_match_one(text):\n patterns = 'ab+?'\n if re.search(patterns, text):\n return True\n else:\n return False\n", - "test_imports": [], - "test_list": [ - "assert text_match_one(\"ac\")==False", - "assert text_match_one(\"dc\")==False", - "assert text_match_one(\"abba\")==True" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "ac\n", - "dc\n", - "abba\n" - ], - "test_output": [ - "False\n", - "False\n", - "True\n" - ], - "example_input": [ - "ac\n", - "dc\n" - ], - "example_output": [ - "False\n", - "False\n" - ], - "question": "Original problem description:\nWrite a function that matches a string that has an a followed by one or more b's.\nWe have its functional test sample:\nassert text_match_one(\"ac\")==False\nassert text_match_one(\"dc\")==False\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nac\n\nOutput:\nFalse\n\n\nExample 2:\nInput:\ndc\n\nOutput:\nFalse\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 216, - "prompt": "Write a python function to find the last digit of a given number.", - "code": "def last_Digit(n) :\n return (n % 10) ", - "test_imports": [], - "test_list": [ - "assert last_Digit(123) == 3", - "assert last_Digit(25) == 5", - "assert last_Digit(30) == 0" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "123\n", - "25\n", - "30\n" - ], - "test_output": [ - "3\n", - "5\n", - "0\n" - ], - "example_input": [ - "123\n", - "25\n" - ], - "example_output": [ - "3\n", - "5\n" - ], - "question": "Original problem description:\nWrite a python function to find the last digit of a given number.\nWe have its functional test sample:\nassert last_Digit(123) == 3\nassert last_Digit(25) == 5\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n123\n\nOutput:\n3\n\n\nExample 2:\nInput:\n25\n\nOutput:\n5\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 217, - "prompt": "Write a python function to return the negative numbers in a list.", - "code": "def neg_nos(list1):\n out = []\n for num in list1: \n if num < 0: \n out.append(num)\n return out ", - "test_imports": [], - "test_list": [ - "assert neg_nos([-1,4,5,-6]) == [-1,-6]", - "assert neg_nos([-1,-2,3,4]) == [-1,-2]", - "assert neg_nos([-7,-6,8,9]) == [-7,-6]" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "-1 4 5 -6\n", - "-1 -2 3 4\n", - "-7 -6 8 9\n" - ], - "test_output": [ - "-1 -6\n", - "-1 -2\n", - "-7 -6\n" - ], - "example_input": [ - "-1 4 5 -6\n", - "-1 -2 3 4\n" - ], - "example_output": [ - "-1 -6\n", - "-1 -2\n" - ], - "question": "Original problem description:\nWrite a python function to return the negative numbers in a list.\nWe have its functional test sample:\nassert neg_nos([-1,4,5,-6]) == [-1,-6]\nassert neg_nos([-1,-2,3,4]) == [-1,-2]\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n-1 4 5 -6\n\nOutput:\n-1 -6\n\n\nExample 2:\nInput:\n-1 -2 3 4\n\nOutput:\n-1 -2\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 218, - "prompt": "Write a function to remove odd characters in a string.", - "code": "def remove_odd(str1):\n str2 = ''\n for i in range(1, len(str1) + 1):\n if(i % 2 == 0):\n str2 = str2 + str1[i - 1]\n return str2", - "test_imports": [], - "test_list": [ - "assert remove_odd(\"python\")==(\"yhn\")", - "assert remove_odd(\"program\")==(\"rga\")", - "assert remove_odd(\"language\")==(\"agae\")" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "python\n", - "program\n", - "language\n" - ], - "test_output": [ - "yhn\n", - "rga\n", - "agae\n" - ], - "example_input": [ - "python\n", - "program\n" - ], - "example_output": [ - "yhn\n", - "rga\n" - ], - "question": "Original problem description:\nWrite a function to remove odd characters in a string.\nWe have its functional test sample:\nassert remove_odd(\"python\")==(\"yhn\")\nassert remove_odd(\"program\")==(\"rga\")\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\npython\n\nOutput:\nyhn\n\n\nExample 2:\nInput:\nprogram\n\nOutput:\nrga\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 219, - "prompt": "Write a function to count bidirectional tuple pairs.", - "code": "def count_bidirectional(test_list):\n res = 0\n for idx in range(0, len(test_list)):\n for iidx in range(idx + 1, len(test_list)):\n if test_list[iidx][0] == test_list[idx][1] and test_list[idx][1] == test_list[iidx][0]:\n res += 1\n return res", - "test_imports": [], - "test_list": [ - "assert count_bidirectional([(5, 6), (1, 2), (6, 5), (9, 1), (6, 5), (2, 1)] ) == 3", - "assert count_bidirectional([(5, 6), (1, 3), (6, 5), (9, 1), (6, 5), (2, 1)] ) == 2", - "assert count_bidirectional([(5, 6), (1, 2), (6, 5), (9, 2), (6, 5), (2, 1)] ) == 4" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "5 6\n1 2\n6 5\n9 1\n6 5\n2 1\n", - "5 6\n1 3\n6 5\n9 1\n6 5\n2 1\n", - "5 6\n1 2\n6 5\n9 2\n6 5\n2 1\n" - ], - "test_output": [ - "3\n", - "2\n", - "4\n" - ], - "example_input": [ - "5 6\n1 2\n6 5\n9 1\n6 5\n2 1\n", - "5 6\n1 3\n6 5\n9 1\n6 5\n2 1\n" - ], - "example_output": [ - "3\n", - "2\n" - ], - "question": "Original problem description:\nWrite a function to count bidirectional tuple pairs.\nWe have its functional test sample:\nassert count_bidirectional([(5, 6), (1, 2), (6, 5), (9, 1), (6, 5), (2, 1)] ) == 3\nassert count_bidirectional([(5, 6), (1, 3), (6, 5), (9, 1), (6, 5), (2, 1)] ) == 2\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n5 6\n1 2\n6 5\n9 1\n6 5\n2 1\n\nOutput:\n3\n\n\nExample 2:\nInput:\n5 6\n1 3\n6 5\n9 1\n6 5\n2 1\n\nOutput:\n2\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 220, - "prompt": "Write a function to join a list of multiple integers into a single integer.", - "code": "def multiple_to_single(L):\n x = int(\"\".join(map(str, L)))\n return x", - "test_imports": [], - "test_list": [ - "assert multiple_to_single([11, 33, 50])==113350", - "assert multiple_to_single([-1,2,3,4,5,6])==-123456", - "assert multiple_to_single([10,15,20,25])==10152025" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "11 33 50\n", - "-1 2 3 4 5 6\n", - "10 15 20 25\n" - ], - "test_output": [ - "113350\n", - "-123456\n", - "10152025\n" - ], - "example_input": [ - "11 33 50\n", - "-1 2 3 4 5 6\n" - ], - "example_output": [ - "113350\n", - "-123456\n" - ], - "question": "Original problem description:\nWrite a function to join a list of multiple integers into a single integer.\nWe have its functional test sample:\nassert multiple_to_single([11, 33, 50])==113350\nassert multiple_to_single([-1,2,3,4,5,6])==-123456\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n11 33 50\n\nOutput:\n113350\n\n\nExample 2:\nInput:\n-1 2 3 4 5 6\n\nOutput:\n-123456\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 221, - "prompt": "Write a function to find the first adverb and their positions in a given sentence.", - "code": "import re\ndef find_adverb_position(text):\n for m in re.finditer(r\"\\w+ly\", text):\n return (m.start(), m.end(), m.group(0))", - "test_imports": [], - "test_list": [ - "assert find_adverb_position(\"clearly!! we can see the sky\")==(0, 7, 'clearly')", - "assert find_adverb_position(\"seriously!! there are many roses\")==(0, 9, 'seriously')", - "assert find_adverb_position(\"unfortunately!! sita is going to home\")==(0, 13, 'unfortunately')" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "clearly!! we can see the sky\n", - "seriously!! there are many roses\n", - "unfortunately!! sita is going to home\n" - ], - "test_output": [ - "0 7 clearly\n", - "0 9 seriously\n", - "0 13 unfortunately\n" - ], - "example_input": [ - "clearly!! we can see the sky\n", - "seriously!! there are many roses\n" - ], - "example_output": [ - "0 7 clearly\n", - "0 9 seriously\n" - ], - "question": "Original problem description:\nWrite a function to find the first adverb and their positions in a given sentence.\nWe have its functional test sample:\nassert find_adverb_position(\"clearly!! we can see the sky\")==(0, 7, 'clearly')\nassert find_adverb_position(\"seriously!! there are many roses\")==(0, 9, 'seriously')\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nclearly!! we can see the sky\n\nOutput:\n0 7 clearly\n\n\nExample 2:\nInput:\nseriously!! there are many roses\n\nOutput:\n0 9 seriously\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 222, - "prompt": "Write a function to find the surface area of a cube of a given size.", - "code": "def surfacearea_cube(l):\n surfacearea= 6*l*l\n return surfacearea", - "test_imports": [], - "test_list": [ - "assert surfacearea_cube(5)==150", - "assert surfacearea_cube(3)==54", - "assert surfacearea_cube(10)==600" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "5\n", - "3\n", - "10\n" - ], - "test_output": [ - "150\n", - "54\n", - "600\n" - ], - "example_input": [ - "5\n", - "3\n" - ], - "example_output": [ - "150\n", - "54\n" - ], - "question": "Original problem description:\nWrite a function to find the surface area of a cube of a given size.\nWe have its functional test sample:\nassert surfacearea_cube(5)==150\nassert surfacearea_cube(3)==54\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n5\n\nOutput:\n150\n\n\nExample 2:\nInput:\n3\n\nOutput:\n54\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 223, - "prompt": "Write a function to find the ration of positive numbers in an array of integers.", - "code": "from array import array\ndef positive_count(nums):\n n = len(nums)\n n1 = 0\n for x in nums:\n if x > 0:\n n1 += 1\n else:\n None\n return round(n1/n,2)", - "test_imports": [], - "test_list": [ - "assert positive_count([0, 1, 2, -1, -5, 6, 0, -3, -2, 3, 4, 6, 8])==0.54", - "assert positive_count([2, 1, 2, -1, -5, 6, 4, -3, -2, 3, 4, 6, 8])==0.69", - "assert positive_count([2, 4, -6, -9, 11, -12, 14, -5, 17])==0.56" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "0 1 2 -1 -5 6 0 -3 -2 3 4 6 8\n", - "2 1 2 -1 -5 6 4 -3 -2 3 4 6 8\n", - "2 4 -6 -9 11 -12 14 -5 17\n" - ], - "test_output": [ - "0.54\n", - "0.69\n", - "0.56\n" - ], - "example_input": [ - "0 1 2 -1 -5 6 0 -3 -2 3 4 6 8\n", - "2 1 2 -1 -5 6 4 -3 -2 3 4 6 8\n" - ], - "example_output": [ - "0.54\n", - "0.69\n" - ], - "question": "Original problem description:\nWrite a function to find the ration of positive numbers in an array of integers.\nWe have its functional test sample:\nassert positive_count([0, 1, 2, -1, -5, 6, 0, -3, -2, 3, 4, 6, 8])==0.54\nassert positive_count([2, 1, 2, -1, -5, 6, 4, -3, -2, 3, 4, 6, 8])==0.69\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n0 1 2 -1 -5 6 0 -3 -2 3 4 6 8\n\nOutput:\n0.54\n\n\nExample 2:\nInput:\n2 1 2 -1 -5 6 4 -3 -2 3 4 6 8\n\nOutput:\n0.69\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 224, - "prompt": "Write a python function to find the largest negative number from the given list.", - "code": "def largest_neg(list1): \n max = list1[0] \n for x in list1: \n if x < max : \n max = x \n return max", - "test_imports": [], - "test_list": [ - "assert largest_neg([1,2,3,-4,-6]) == -6", - "assert largest_neg([1,2,3,-8,-9]) == -9", - "assert largest_neg([1,2,3,4,-1]) == -1" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 2 3 -4 -6\n", - "1 2 3 -8 -9\n", - "1 2 3 4 -1\n" - ], - "test_output": [ - "-6\n", - "-9\n", - "-1\n" - ], - "example_input": [ - "1 2 3 -4 -6\n", - "1 2 3 -8 -9\n" - ], - "example_output": [ - "-6\n", - "-9\n" - ], - "question": "Original problem description:\nWrite a python function to find the largest negative number from the given list.\nWe have its functional test sample:\nassert largest_neg([1,2,3,-4,-6]) == -6\nassert largest_neg([1,2,3,-8,-9]) == -9\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 2 3 -4 -6\n\nOutput:\n-6\n\n\nExample 2:\nInput:\n1 2 3 -8 -9\n\nOutput:\n-9\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 227, - "prompt": "Write a python function to count the occurence of all elements of list in a tuple.", - "code": "from collections import Counter \ndef count_Occurrence(tup, lst): \n count = 0\n for item in tup: \n if item in lst: \n count+= 1 \n return count ", - "test_imports": [], - "test_list": [ - "assert count_Occurrence(('a', 'a', 'c', 'b', 'd'),['a', 'b'] ) == 3", - "assert count_Occurrence((1, 2, 3, 1, 4, 6, 7, 1, 4),[1, 4, 7]) == 6", - "assert count_Occurrence((1,2,3,4,5,6),[1,2]) == 2" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "a a c b d\na b\n", - "1 2 3 1 4 6 7 1 4\n1 4 7\n", - "1 2 3 4 5 6\n1 2\n" - ], - "test_output": [ - "3\n", - "6\n", - "2\n" - ], - "example_input": [ - "a a c b d\na b\n", - "1 2 3 1 4 6 7 1 4\n1 4 7\n" - ], - "example_output": [ - "3\n", - "6\n" - ], - "question": "Original problem description:\nWrite a python function to count the occurence of all elements of list in a tuple.\nWe have its functional test sample:\nassert count_Occurrence(('a', 'a', 'c', 'b', 'd'),['a', 'b'] ) == 3\nassert count_Occurrence((1, 2, 3, 1, 4, 6, 7, 1, 4),[1, 4, 7]) == 6\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\na a c b d\na b\n\nOutput:\n3\n\n\nExample 2:\nInput:\n1 2 3 1 4 6 7 1 4\n1 4 7\n\nOutput:\n6\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 228, - "prompt": "Write a function to find cubes of individual elements in a list.", - "code": "def cube_nums(nums):\n cube_nums = list(map(lambda x: x ** 3, nums))\n return cube_nums", - "test_imports": [], - "test_list": [ - "assert cube_nums([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])==[1, 8, 27, 64, 125, 216, 343, 512, 729, 1000]", - "assert cube_nums([10,20,30])==([1000, 8000, 27000])", - "assert cube_nums([12,15])==([1728, 3375])" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 2 3 4 5 6 7 8 9 10\n", - "10 20 30\n", - "12 15\n" - ], - "test_output": [ - "1 8 27 64 125 216 343 512 729 1000\n", - "1000 8000 27000\n", - "1728 3375\n" - ], - "example_input": [ - "1 2 3 4 5 6 7 8 9 10\n", - "10 20 30\n" - ], - "example_output": [ - "1 8 27 64 125 216 343 512 729 1000\n", - "1000 8000 27000\n" - ], - "question": "Original problem description:\nWrite a function to find cubes of individual elements in a list.\nWe have its functional test sample:\nassert cube_nums([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])==[1, 8, 27, 64, 125, 216, 343, 512, 729, 1000]\nassert cube_nums([10,20,30])==([1000, 8000, 27000])\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 2 3 4 5 6 7 8 9 10\n\nOutput:\n1 8 27 64 125 216 343 512 729 1000\n\n\nExample 2:\nInput:\n10 20 30\n\nOutput:\n1000 8000 27000\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 229, - "prompt": "Write a function to calculate the sum of perrin numbers.", - "code": "def cal_sum(n): \n\ta = 3\n\tb = 0\n\tc = 2\n\tif (n == 0): \n\t\treturn 3\n\tif (n == 1): \n\t\treturn 3\n\tif (n == 2): \n\t\treturn 5\n\tsum = 5\n\twhile (n > 2): \n\t\td = a + b \n\t\tsum = sum + d \n\t\ta = b \n\t\tb = c \n\t\tc = d \n\t\tn = n-1\n\treturn sum", - "test_imports": [], - "test_list": [ - "assert cal_sum(9) == 49", - "assert cal_sum(10) == 66", - "assert cal_sum(11) == 88" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "9\n", - "10\n", - "11\n" - ], - "test_output": [ - "49\n", - "66\n", - "88\n" - ], - "example_input": [ - "9\n", - "10\n" - ], - "example_output": [ - "49\n", - "66\n" - ], - "question": "Original problem description:\nWrite a function to calculate the sum of perrin numbers.\nWe have its functional test sample:\nassert cal_sum(9) == 49\nassert cal_sum(10) == 66\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n9\n\nOutput:\n49\n\n\nExample 2:\nInput:\n10\n\nOutput:\n66\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 230, - "prompt": "Write a function to extract specified size of strings from a given list of string values.", - "code": "def extract_string(str, l):\n result = [e for e in str if len(e) == l] \n return result", - "test_imports": [], - "test_list": [ - "assert extract_string(['Python', 'list', 'exercises', 'practice', 'solution'] ,8)==['practice', 'solution']", - "assert extract_string(['Python', 'list', 'exercises', 'practice', 'solution'] ,6)==['Python']", - "assert extract_string(['Python', 'list', 'exercises', 'practice', 'solution'] ,9)==['exercises']" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "Python list exercises practice solution\n8\n", - "Python list exercises practice solution\n6\n", - "Python list exercises practice solution\n9\n" - ], - "test_output": [ - "practice solution\n", - "Python\n", - "exercises\n" - ], - "example_input": [ - "Python list exercises practice solution\n8\n", - "Python list exercises practice solution\n6\n" - ], - "example_output": [ - "practice solution\n", - "Python\n" - ], - "question": "Original problem description:\nWrite a function to extract specified size of strings from a given list of string values.\nWe have its functional test sample:\nassert extract_string(['Python', 'list', 'exercises', 'practice', 'solution'] ,8)==['practice', 'solution']\nassert extract_string(['Python', 'list', 'exercises', 'practice', 'solution'] ,6)==['Python']\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nPython list exercises practice solution\n8\n\nOutput:\npractice solution\n\n\nExample 2:\nInput:\nPython list exercises practice solution\n6\n\nOutput:\nPython\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 231, - "prompt": "Write a function to remove all whitespaces from the given string.", - "code": "import re\ndef remove_whitespaces(text1):\n return (re.sub(r'\\s+', '',text1))", - "test_imports": [], - "test_list": [ - "assert remove_whitespaces(' Google Flutter ') == 'GoogleFlutter'", - "assert remove_whitespaces(' Google Dart ') == 'GoogleDart'", - "assert remove_whitespaces(' iOS Swift ') == 'iOSSwift'" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "Google Flutter\n", - "Google Dart\n", - "iOS Swift\n" - ], - "test_output": [ - "GoogleFlutter\n", - "GoogleDart\n", - "iOSSwift\n" - ], - "example_input": [ - "Google Flutter\n", - "Google Dart\n" - ], - "example_output": [ - "GoogleFlutter\n", - "GoogleDart\n" - ], - "question": "Original problem description:\nWrite a function to remove all whitespaces from the given string.\nWe have its functional test sample:\nassert remove_whitespaces(' Google Flutter ') == 'GoogleFlutter'\nassert remove_whitespaces(' Google Dart ') == 'GoogleDart'\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nGoogle Flutter\n\nOutput:\nGoogleFlutter\n\n\nExample 2:\nInput:\nGoogle Dart\n\nOutput:\nGoogleDart\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 232, - "prompt": "Write a function that gives loss amount on a sale if the given amount has loss else return 0.", - "code": "def loss_amount(actual_cost,sale_amount): \n if(sale_amount > actual_cost):\n amount = sale_amount - actual_cost\n return amount\n else:\n return 0", - "test_imports": [], - "test_list": [ - "assert loss_amount(1500,1200)==0", - "assert loss_amount(100,200)==100", - "assert loss_amount(2000,5000)==3000" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1500\n1200\n", - "100\n200\n", - "2000\n5000\n" - ], - "test_output": [ - "0\n", - "100\n", - "3000\n" - ], - "example_input": [ - "1500\n1200\n", - "100\n200\n" - ], - "example_output": [ - "0\n", - "100\n" - ], - "question": "Original problem description:\nWrite a function that gives loss amount on a sale if the given amount has loss else return 0.\nWe have its functional test sample:\nassert loss_amount(1500,1200)==0\nassert loss_amount(100,200)==100\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1500\n1200\n\nOutput:\n0\n\n\nExample 2:\nInput:\n100\n200\n\nOutput:\n100\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 233, - "prompt": "Write a python function to find the sum of even factors of a number.", - "code": "import math \ndef sumofFactors(n) : \n if (n % 2 != 0) : \n return 0\n res = 1\n for i in range(2, (int)(math.sqrt(n)) + 1) : \n count = 0\n curr_sum = 1\n curr_term = 1\n while (n % i == 0) : \n count= count + 1\n n = n // i \n if (i == 2 and count == 1) : \n curr_sum = 0\n curr_term = curr_term * i \n curr_sum = curr_sum + curr_term \n res = res * curr_sum \n if (n >= 2) : \n res = res * (1 + n) \n return res", - "test_imports": [], - "test_list": [ - "assert sumofFactors(18) == 26", - "assert sumofFactors(30) == 48", - "assert sumofFactors(6) == 8" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "18\n", - "30\n", - "6\n" - ], - "test_output": [ - "26\n", - "48\n", - "8\n" - ], - "example_input": [ - "18\n", - "30\n" - ], - "example_output": [ - "26\n", - "48\n" - ], - "question": "Original problem description:\nWrite a python function to find the sum of even factors of a number.\nWe have its functional test sample:\nassert sumofFactors(18) == 26\nassert sumofFactors(30) == 48\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n18\n\nOutput:\n26\n\n\nExample 2:\nInput:\n30\n\nOutput:\n48\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 234, - "prompt": "Write a function that matches a word containing 'z'.", - "code": "import re\ndef text_match_wordz(text):\n patterns = '\\w*z.\\w*'\n if re.search(patterns, text):\n return True\n else:\n return False", - "test_imports": [], - "test_list": [ - "assert text_match_wordz(\"pythonz.\")==True", - "assert text_match_wordz(\"xyz.\")==True", - "assert text_match_wordz(\" lang .\")==False" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "pythonz.\n", - "xyz.\n", - "lang .\n" - ], - "test_output": [ - "True\n", - "True\n", - "False\n" - ], - "example_input": [ - "pythonz.\n", - "xyz.\n" - ], - "example_output": [ - "True\n", - "True\n" - ], - "question": "Original problem description:\nWrite a function that matches a word containing 'z'.\nWe have its functional test sample:\nassert text_match_wordz(\"pythonz.\")==True\nassert text_match_wordz(\"xyz.\")==True\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\npythonz.\n\nOutput:\nTrue\n\n\nExample 2:\nInput:\nxyz.\n\nOutput:\nTrue\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 235, - "prompt": "Write a function to check whether the given month number contains 31 days or not.", - "code": "def check_monthnumb_number(monthnum2):\n if(monthnum2==1 or monthnum2==3 or monthnum2==5 or monthnum2==7 or monthnum2==8 or monthnum2==10 or monthnum2==12):\n return True\n else:\n return False", - "test_imports": [], - "test_list": [ - "assert check_monthnumb_number(5)==True", - "assert check_monthnumb_number(2)==False", - "assert check_monthnumb_number(6)==False" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "5\n", - "2\n", - "6\n" - ], - "test_output": [ - "True\n", - "False\n", - "False\n" - ], - "example_input": [ - "5\n", - "2\n" - ], - "example_output": [ - "True\n", - "False\n" - ], - "question": "Original problem description:\nWrite a function to check whether the given month number contains 31 days or not.\nWe have its functional test sample:\nassert check_monthnumb_number(5)==True\nassert check_monthnumb_number(2)==False\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n5\n\nOutput:\nTrue\n\n\nExample 2:\nInput:\n2\n\nOutput:\nFalse\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 236, - "prompt": "Write a function to reverse each string in a given list of string values.", - "code": "def reverse_string_list(stringlist):\n result = [x[::-1] for x in stringlist]\n return result", - "test_imports": [], - "test_list": [ - "assert reverse_string_list(['Red', 'Green', 'Blue', 'White', 'Black'])==['deR', 'neerG', 'eulB', 'etihW', 'kcalB']", - "assert reverse_string_list(['john','amal','joel','george'])==['nhoj','lama','leoj','egroeg']", - "assert reverse_string_list(['jack','john','mary'])==['kcaj','nhoj','yram']" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "Red Green Blue White Black\n", - "john amal joel george\n", - "jack john mary\n" - ], - "test_output": [ - "deR neerG eulB etihW kcalB\n", - "nhoj lama leoj egroeg\n", - "kcaj nhoj yram\n" - ], - "example_input": [ - "Red Green Blue White Black\n", - "john amal joel george\n" - ], - "example_output": [ - "deR neerG eulB etihW kcalB\n", - "nhoj lama leoj egroeg\n" - ], - "question": "Original problem description:\nWrite a function to reverse each string in a given list of string values.\nWe have its functional test sample:\nassert reverse_string_list(['Red', 'Green', 'Blue', 'White', 'Black'])==['deR', 'neerG', 'eulB', 'etihW', 'kcalB']\nassert reverse_string_list(['john','amal','joel','george'])==['nhoj','lama','leoj','egroeg']\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nRed Green Blue White Black\n\nOutput:\ndeR neerG eulB etihW kcalB\n\n\nExample 2:\nInput:\njohn amal joel george\n\nOutput:\nnhoj lama leoj egroeg\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 237, - "prompt": "Write a python function to find the sublist having minimum length.", - "code": "def Find_Min(lst): \n return min(lst, key=len) ", - "test_imports": [], - "test_list": [ - "assert Find_Min([[1],[1,2],[1,2,3]]) == [1]", - "assert Find_Min([[1,1],[1,1,1],[1,2,7,8]]) == [1,1]", - "assert Find_Min([['x'],['x','y'],['x','y','z']]) == ['x']" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1\n1 2\n1 2 3\n", - "1 1\n1 1 1\n1 2 7 8\n", - "x\nx y\nx y z\n" - ], - "test_output": [ - "1\n", - "1 1\n", - "x\n" - ], - "example_input": [ - "1\n1 2\n1 2 3\n", - "1 1\n1 1 1\n1 2 7 8\n" - ], - "example_output": [ - "1\n", - "1 1\n" - ], - "question": "Original problem description:\nWrite a python function to find the sublist having minimum length.\nWe have its functional test sample:\nassert Find_Min([[1],[1,2],[1,2,3]]) == [1]\nassert Find_Min([[1,1],[1,1,1],[1,2,7,8]]) == [1,1]\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1\n1 2\n1 2 3\n\nOutput:\n1\n\n\nExample 2:\nInput:\n1 1\n1 1 1\n1 2 7 8\n\nOutput:\n1 1\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 238, - "prompt": "Write a function to find the area of a rectangle.", - "code": "def rectangle_area(l,b):\n area=l*b\n return area", - "test_imports": [], - "test_list": [ - "assert rectangle_area(10,20)==200", - "assert rectangle_area(10,5)==50", - "assert rectangle_area(4,2)==8" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "10\n20\n", - "10\n5\n", - "4\n2\n" - ], - "test_output": [ - "200\n", - "50\n", - "8\n" - ], - "example_input": [ - "10\n20\n", - "10\n5\n" - ], - "example_output": [ - "200\n", - "50\n" - ], - "question": "Original problem description:\nWrite a function to find the area of a rectangle.\nWe have its functional test sample:\nassert rectangle_area(10,20)==200\nassert rectangle_area(10,5)==50\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n10\n20\n\nOutput:\n200\n\n\nExample 2:\nInput:\n10\n5\n\nOutput:\n50\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 239, - "prompt": "Write a function to remove uppercase substrings from a given string.", - "code": "import re\ndef remove_uppercase(str1):\n return re.sub('[A-Z]', '', str1)", - "test_imports": [], - "test_list": [ - "assert remove_uppercase('cAstyoUrFavoRitETVshoWs') == 'cstyoravoitshos'", - "assert remove_uppercase('wAtchTheinTernEtrAdIo') == 'wtchheinerntrdo'", - "assert remove_uppercase('VoicESeaRchAndreComMendaTionS') == 'oiceachndreomendaion'" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "cAstyoUrFavoRitETVshoWs\n", - "wAtchTheinTernEtrAdIo\n", - "VoicESeaRchAndreComMendaTionS\n" - ], - "test_output": [ - "cstyoravoitshos\n", - "wtchheinerntrdo\n", - "oiceachndreomendaion\n" - ], - "example_input": [ - "cAstyoUrFavoRitETVshoWs\n", - "wAtchTheinTernEtrAdIo\n" - ], - "example_output": [ - "cstyoravoitshos\n", - "wtchheinerntrdo\n" - ], - "question": "Original problem description:\nWrite a function to remove uppercase substrings from a given string.\nWe have its functional test sample:\nassert remove_uppercase('cAstyoUrFavoRitETVshoWs') == 'cstyoravoitshos'\nassert remove_uppercase('wAtchTheinTernEtrAdIo') == 'wtchheinerntrdo'\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\ncAstyoUrFavoRitETVshoWs\n\nOutput:\ncstyoravoitshos\n\n\nExample 2:\nInput:\nwAtchTheinTernEtrAdIo\n\nOutput:\nwtchheinerntrdo\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 240, - "prompt": "Write a python function to get the first element of each sublist.", - "code": "def Extract(lst): \n return [item[0] for item in lst] ", - "test_imports": [], - "test_list": [ - "assert Extract([[1, 2], [3, 4, 5], [6, 7, 8, 9]]) == [1, 3, 6]", - "assert Extract([[1,2,3],[4, 5]]) == [1,4]", - "assert Extract([[9,8,1],[1,2]]) == [9,1]" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 2\n3 4 5\n6 7 8 9\n", - "1 2 3\n4 5\n", - "9 8 1\n1 2\n" - ], - "test_output": [ - "1 3 6\n", - "1 4\n", - "9 1\n" - ], - "example_input": [ - "1 2\n3 4 5\n6 7 8 9\n", - "1 2 3\n4 5\n" - ], - "example_output": [ - "1 3 6\n", - "1 4\n" - ], - "question": "Original problem description:\nWrite a python function to get the first element of each sublist.\nWe have its functional test sample:\nassert Extract([[1, 2], [3, 4, 5], [6, 7, 8, 9]]) == [1, 3, 6]\nassert Extract([[1,2,3],[4, 5]]) == [1,4]\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 2\n3 4 5\n6 7 8 9\n\nOutput:\n1 3 6\n\n\nExample 2:\nInput:\n1 2 3\n4 5\n\nOutput:\n1 4\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 241, - "prompt": "Write a python function to count the upper case characters in a given string.", - "code": "def upper_ctr(str):\n upper_ctr = 0\n for i in range(len(str)):\n if str[i] >= 'A' and str[i] <= 'Z': upper_ctr += 1\n return upper_ctr", - "test_imports": [], - "test_list": [ - "assert upper_ctr('PYthon') == 1", - "assert upper_ctr('BigData') == 1", - "assert upper_ctr('program') == 0" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "PYthon\n", - "BigData\n", - "program\n" - ], - "test_output": [ - "1\n", - "1\n", - "0\n" - ], - "example_input": [ - "PYthon\n", - "BigData\n" - ], - "example_output": [ - "1\n", - "1\n" - ], - "question": "Original problem description:\nWrite a python function to count the upper case characters in a given string.\nWe have its functional test sample:\nassert upper_ctr('PYthon') == 1\nassert upper_ctr('BigData') == 1\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nPYthon\n\nOutput:\n1\n\n\nExample 2:\nInput:\nBigData\n\nOutput:\n1\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 242, - "prompt": "Write a function to find all possible combinations of the elements of a given list.", - "code": "def combinations_list(list1):\n if len(list1) == 0:\n return [[]]\n result = []\n for el in combinations_list(list1[1:]):\n result += [el, el+[list1[0]]]\n return result", - "test_imports": [], - "test_list": [ - "assert combinations_list(['orange', 'red', 'green', 'blue'])==[[], ['orange'], ['red'], ['red', 'orange'], ['green'], ['green', 'orange'], ['green', 'red'], ['green', 'red', 'orange'], ['blue'], ['blue', 'orange'], ['blue', 'red'], ['blue', 'red', 'orange'], ['blue', 'green'], ['blue', 'green', 'orange'], ['blue', 'green', 'red'], ['blue', 'green', 'red', 'orange']]", - "assert combinations_list(['red', 'green', 'blue', 'white', 'black', 'orange'])==[[], ['red'], ['green'], ['green', 'red'], ['blue'], ['blue', 'red'], ['blue', 'green'], ['blue', 'green', 'red'], ['white'], ['white', 'red'], ['white', 'green'], ['white', 'green', 'red'], ['white', 'blue'], ['white', 'blue', 'red'], ['white', 'blue', 'green'], ['white', 'blue', 'green', 'red'], ['black'], ['black', 'red'], ['black', 'green'], ['black', 'green', 'red'], ['black', 'blue'], ['black', 'blue', 'red'], ['black', 'blue', 'green'], ['black', 'blue', 'green', 'red'], ['black', 'white'], ['black', 'white', 'red'], ['black', 'white', 'green'], ['black', 'white', 'green', 'red'], ['black', 'white', 'blue'], ['black', 'white', 'blue', 'red'], ['black', 'white', 'blue', 'green'], ['black', 'white', 'blue', 'green', 'red'], ['orange'], ['orange', 'red'], ['orange', 'green'], ['orange', 'green', 'red'], ['orange', 'blue'], ['orange', 'blue', 'red'], ['orange', 'blue', 'green'], ['orange', 'blue', 'green', 'red'], ['orange', 'white'], ['orange', 'white', 'red'], ['orange', 'white', 'green'], ['orange', 'white', 'green', 'red'], ['orange', 'white', 'blue'], ['orange', 'white', 'blue', 'red'], ['orange', 'white', 'blue', 'green'], ['orange', 'white', 'blue', 'green', 'red'], ['orange', 'black'], ['orange', 'black', 'red'], ['orange', 'black', 'green'], ['orange', 'black', 'green', 'red'], ['orange', 'black', 'blue'], ['orange', 'black', 'blue', 'red'], ['orange', 'black', 'blue', 'green'], ['orange', 'black', 'blue', 'green', 'red'], ['orange', 'black', 'white'], ['orange', 'black', 'white', 'red'], ['orange', 'black', 'white', 'green'], ['orange', 'black', 'white', 'green', 'red'], ['orange', 'black', 'white', 'blue'], ['orange', 'black', 'white', 'blue', 'red'], ['orange', 'black', 'white', 'blue', 'green'], ['orange', 'black', 'white', 'blue', 'green', 'red']]", - "assert combinations_list(['red', 'green', 'black', 'orange'])==[[], ['red'], ['green'], ['green', 'red'], ['black'], ['black', 'red'], ['black', 'green'], ['black', 'green', 'red'], ['orange'], ['orange', 'red'], ['orange', 'green'], ['orange', 'green', 'red'], ['orange', 'black'], ['orange', 'black', 'red'], ['orange', 'black', 'green'], ['orange', 'black', 'green', 'red']]" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "orange red green blue\n", - "red green blue white black orange\n", - "red green black orange\n" - ], - "test_output": [ - "orange\nred\nred orange\ngreen\ngreen orange\ngreen red\ngreen red orange\nblue\nblue orange\nblue red\nblue red orange\nblue green\nblue green orange\nblue green red\nblue green red orange\n", - "red\ngreen\ngreen red\nblue\nblue red\nblue green\nblue green red\nwhite\nwhite red\nwhite green\nwhite green red\nwhite blue\nwhite blue red\nwhite blue green\nwhite blue green red\nblack\nblack red\nblack green\nblack green red\nblack blue\nblack blue red\nblack blue green\nblack blue green red\nblack white\nblack white red\nblack white green\nblack white green red\nblack white blue\nblack white blue red\nblack white blue green\nblack white blue green red\norange\norange red\norange green\norange green red\norange blue\norange blue red\norange blue green\norange blue green red\norange white\norange white red\norange white green\norange white green red\norange white blue\norange white blue red\norange white blue green\norange white blue green red\norange black\norange black red\norange black green\norange black green red\norange black blue\norange black blue red\norange black blue green\norange black blue green red\norange black white\norange black white red\norange black white green\norange black white green red\norange black white blue\norange black white blue red\norange black white blue green\norange black white blue green red\n", - "red\ngreen\ngreen red\nblack\nblack red\nblack green\nblack green red\norange\norange red\norange green\norange green red\norange black\norange black red\norange black green\norange black green red\n" - ], - "example_input": [ - "orange red green blue\n", - "red green blue white black orange\n" - ], - "example_output": [ - "orange\nred\nred orange\ngreen\ngreen orange\ngreen red\ngreen red orange\nblue\nblue orange\nblue red\nblue red orange\nblue green\nblue green orange\nblue green red\nblue green red orange\n", - "red\ngreen\ngreen red\nblue\nblue red\nblue green\nblue green red\nwhite\nwhite red\nwhite green\nwhite green red\nwhite blue\nwhite blue red\nwhite blue green\nwhite blue green red\nblack\nblack red\nblack green\nblack green red\nblack blue\nblack blue red\nblack blue green\nblack blue green red\nblack white\nblack white red\nblack white green\nblack white green red\nblack white blue\nblack white blue red\nblack white blue green\nblack white blue green red\norange\norange red\norange green\norange green red\norange blue\norange blue red\norange blue green\norange blue green red\norange white\norange white red\norange white green\norange white green red\norange white blue\norange white blue red\norange white blue green\norange white blue green red\norange black\norange black red\norange black green\norange black green red\norange black blue\norange black blue red\norange black blue green\norange black blue green red\norange black white\norange black white red\norange black white green\norange black white green red\norange black white blue\norange black white blue red\norange black white blue green\norange black white blue green red\n" - ], - "question": "Original problem description:\nWrite a function to find all possible combinations of the elements of a given list.\nWe have its functional test sample:\nassert combinations_list(['orange', 'red', 'green', 'blue'])==[[], ['orange'], ['red'], ['red', 'orange'], ['green'], ['green', 'orange'], ['green', 'red'], ['green', 'red', 'orange'], ['blue'], ['blue', 'orange'], ['blue', 'red'], ['blue', 'red', 'orange'], ['blue', 'green'], ['blue', 'green', 'orange'], ['blue', 'green', 'red'], ['blue', 'green', 'red', 'orange']]\nassert combinations_list(['red', 'green', 'blue', 'white', 'black', 'orange'])==[[], ['red'], ['green'], ['green', 'red'], ['blue'], ['blue', 'red'], ['blue', 'green'], ['blue', 'green', 'red'], ['white'], ['white', 'red'], ['white', 'green'], ['white', 'green', 'red'], ['white', 'blue'], ['white', 'blue', 'red'], ['white', 'blue', 'green'], ['white', 'blue', 'green', 'red'], ['black'], ['black', 'red'], ['black', 'green'], ['black', 'green', 'red'], ['black', 'blue'], ['black', 'blue', 'red'], ['black', 'blue', 'green'], ['black', 'blue', 'green', 'red'], ['black', 'white'], ['black', 'white', 'red'], ['black', 'white', 'green'], ['black', 'white', 'green', 'red'], ['black', 'white', 'blue'], ['black', 'white', 'blue', 'red'], ['black', 'white', 'blue', 'green'], ['black', 'white', 'blue', 'green', 'red'], ['orange'], ['orange', 'red'], ['orange', 'green'], ['orange', 'green', 'red'], ['orange', 'blue'], ['orange', 'blue', 'red'], ['orange', 'blue', 'green'], ['orange', 'blue', 'green', 'red'], ['orange', 'white'], ['orange', 'white', 'red'], ['orange', 'white', 'green'], ['orange', 'white', 'green', 'red'], ['orange', 'white', 'blue'], ['orange', 'white', 'blue', 'red'], ['orange', 'white', 'blue', 'green'], ['orange', 'white', 'blue', 'green', 'red'], ['orange', 'black'], ['orange', 'black', 'red'], ['orange', 'black', 'green'], ['orange', 'black', 'green', 'red'], ['orange', 'black', 'blue'], ['orange', 'black', 'blue', 'red'], ['orange', 'black', 'blue', 'green'], ['orange', 'black', 'blue', 'green', 'red'], ['orange', 'black', 'white'], ['orange', 'black', 'white', 'red'], ['orange', 'black', 'white', 'green'], ['orange', 'black', 'white', 'green', 'red'], ['orange', 'black', 'white', 'blue'], ['orange', 'black', 'white', 'blue', 'red'], ['orange', 'black', 'white', 'blue', 'green'], ['orange', 'black', 'white', 'blue', 'green', 'red']]\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\norange red green blue\n\nOutput:\norange\nred\nred orange\ngreen\ngreen orange\ngreen red\ngreen red orange\nblue\nblue orange\nblue red\nblue red orange\nblue green\nblue green orange\nblue green red\nblue green red orange\n\n\nExample 2:\nInput:\nred green blue white black orange\n\nOutput:\nred\ngreen\ngreen red\nblue\nblue red\nblue green\nblue green red\nwhite\nwhite red\nwhite green\nwhite green red\nwhite blue\nwhite blue red\nwhite blue green\nwhite blue green red\nblack\nblack red\nblack green\nblack green red\nblack blue\nblack blue red\nblack blue green\nblack blue green red\nblack white\nblack white red\nblack white green\nblack white green red\nblack white blue\nblack white blue red\nblack white blue green\nblack white blue green red\norange\norange red\norange green\norange green red\norange blue\norange blue red\norange blue green\norange blue green red\norange white\norange white red\norange white green\norange white green red\norange white blue\norange white blue red\norange white blue green\norange white blue green red\norange black\norange black red\norange black green\norange black green red\norange black blue\norange black blue red\norange black blue green\norange black blue green red\norange black white\norange black white red\norange black white green\norange black white green red\norange black white blue\norange black white blue red\norange black white blue green\norange black white blue green red\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 243, - "prompt": "Write a function to find the maximum product subarray of the given array.", - "code": "def max_subarray_product(arr):\n\tn = len(arr)\n\tmax_ending_here = 1\n\tmin_ending_here = 1\n\tmax_so_far = 0\n\tflag = 0\n\tfor i in range(0, n):\n\t\tif arr[i] > 0:\n\t\t\tmax_ending_here = max_ending_here * arr[i]\n\t\t\tmin_ending_here = min (min_ending_here * arr[i], 1)\n\t\t\tflag = 1\n\t\telif arr[i] == 0:\n\t\t\tmax_ending_here = 1\n\t\t\tmin_ending_here = 1\n\t\telse:\n\t\t\ttemp = max_ending_here\n\t\t\tmax_ending_here = max (min_ending_here * arr[i], 1)\n\t\t\tmin_ending_here = temp * arr[i]\n\t\tif (max_so_far < max_ending_here):\n\t\t\tmax_so_far = max_ending_here\n\tif flag == 0 and max_so_far == 0:\n\t\treturn 0\n\treturn max_so_far", - "test_imports": [], - "test_list": [ - "assert max_subarray_product([1, -2, -3, 0, 7, -8, -2]) == 112", - "assert max_subarray_product([6, -3, -10, 0, 2]) == 180", - "assert max_subarray_product([-2, -40, 0, -2, -3]) == 80" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 -2 -3 0 7 -8 -2\n", - "6 -3 -10 0 2\n", - "-2 -40 0 -2 -3\n" - ], - "test_output": [ - "112\n", - "180\n", - "80\n" - ], - "example_input": [ - "1 -2 -3 0 7 -8 -2\n", - "6 -3 -10 0 2\n" - ], - "example_output": [ - "112\n", - "180\n" - ], - "question": "Original problem description:\nWrite a function to find the maximum product subarray of the given array.\nWe have its functional test sample:\nassert max_subarray_product([1, -2, -3, 0, 7, -8, -2]) == 112\nassert max_subarray_product([6, -3, -10, 0, 2]) == 180\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 -2 -3 0 7 -8 -2\n\nOutput:\n112\n\n\nExample 2:\nInput:\n6 -3 -10 0 2\n\nOutput:\n180\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 244, - "prompt": "Write a function to check if all values are same in a dictionary.", - "code": "def check_value(dict, n):\n result = all(x == n for x in dict.values()) \n return result", - "test_imports": [], - "test_list": [ - "assert check_value({'Cierra Vega': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12},10)==False", - "assert check_value({'Cierra Vega': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12},12)==True", - "assert check_value({'Cierra Vega': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12},5)==False" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "{'Cierra Vega': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12}\n10\n", - "{'Cierra Vega': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12}\n12\n", - "{'Cierra Vega': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12}\n5\n" - ], - "test_output": [ - "False\n", - "True\n", - "False\n" - ], - "example_input": [ - "{'Cierra Vega': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12}\n10\n", - "{'Cierra Vega': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12}\n12\n" - ], - "example_output": [ - "False\n", - "True\n" - ], - "question": "Original problem description:\nWrite a function to check if all values are same in a dictionary.\nWe have its functional test sample:\nassert check_value({'Cierra Vega': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12},10)==False\nassert check_value({'Cierra Vega': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12},12)==True\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n{'Cierra Vega': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12}\n10\n\nOutput:\nFalse\n\n\nExample 2:\nInput:\n{'Cierra Vega': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12}\n12\n\nOutput:\nTrue\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 245, - "prompt": "Write a function to drop empty items from a given dictionary.", - "code": "def drop_empty(dict1):\n dict1 = {key:value for (key, value) in dict1.items() if value is not None}\n return dict1", - "test_imports": [], - "test_list": [ - "assert drop_empty({'c1': 'Red', 'c2': 'Green', 'c3':None})=={'c1': 'Red', 'c2': 'Green'}", - "assert drop_empty({'c1': 'Red', 'c2': None, 'c3':None})=={'c1': 'Red'}", - "assert drop_empty({'c1': None, 'c2': 'Green', 'c3':None})=={ 'c2': 'Green'}" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "{'c1': 'Red', 'c2': 'Green', 'c3': None}\n", - "{'c1': 'Red', 'c2': None, 'c3': None}\n", - "{'c1': None, 'c2': 'Green', 'c3': None}\n" - ], - "test_output": [ - "{'c1': 'Red', 'c2': 'Green'}\n", - "{'c1': 'Red'}\n", - "{'c2': 'Green'}\n" - ], - "example_input": [ - "{'c1': 'Red', 'c2': 'Green', 'c3': None}\n", - "{'c1': 'Red', 'c2': None, 'c3': None}\n" - ], - "example_output": [ - "{'c1': 'Red', 'c2': 'Green'}\n", - "{'c1': 'Red'}\n" - ], - "question": "Original problem description:\nWrite a function to drop empty items from a given dictionary.\nWe have its functional test sample:\nassert drop_empty({'c1': 'Red', 'c2': 'Green', 'c3':None})=={'c1': 'Red', 'c2': 'Green'}\nassert drop_empty({'c1': 'Red', 'c2': None, 'c3':None})=={'c1': 'Red'}\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n{'c1': 'Red', 'c2': 'Green', 'c3': None}\n\nOutput:\n{'c1': 'Red', 'c2': 'Green'}\n\n\nExample 2:\nInput:\n{'c1': 'Red', 'c2': None, 'c3': None}\n\nOutput:\n{'c1': 'Red'}\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 246, - "prompt": "Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array.", - "code": "def max_product(arr): \n n = len(arr)\n mpis = arr[:]\n for i in range(n): \n current_prod = arr[i]\n j = i + 1\n while j < n:\n if arr[j-1] > arr[j]: \n break\n current_prod *= arr[j]\n if current_prod > mpis[j]:\n mpis[j] = current_prod \n j = j + 1\n return max(mpis)", - "test_imports": [], - "test_list": [ - "assert max_product([3, 100, 4, 5, 150, 6]) == 3000", - "assert max_product([4, 42, 55, 68, 80]) == 50265600", - "assert max_product([10, 22, 9, 33, 21, 50, 41, 60]) == 2460" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "3 100 4 5 150 6\n", - "4 42 55 68 80\n", - "10 22 9 33 21 50 41 60\n" - ], - "test_output": [ - "3000\n", - "50265600\n", - "2460\n" - ], - "example_input": [ - "3 100 4 5 150 6\n", - "4 42 55 68 80\n" - ], - "example_output": [ - "3000\n", - "50265600\n" - ], - "question": "Original problem description:\nWrite a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array.\nWe have its functional test sample:\nassert max_product([3, 100, 4, 5, 150, 6]) == 3000\nassert max_product([4, 42, 55, 68, 80]) == 50265600\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n3 100 4 5 150 6\n\nOutput:\n3000\n\n\nExample 2:\nInput:\n4 42 55 68 80\n\nOutput:\n50265600\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 247, - "prompt": "Write a function to find the pairwise addition of the neighboring elements of the given tuple.", - "code": "def add_pairwise(test_tup):\n res = tuple(i + j for i, j in zip(test_tup, test_tup[1:]))\n return (res) ", - "test_imports": [], - "test_list": [ - "assert add_pairwise((1, 5, 7, 8, 10)) == (6, 12, 15, 18)", - "assert add_pairwise((2, 6, 8, 9, 11)) == (8, 14, 17, 20)", - "assert add_pairwise((3, 7, 9, 10, 12)) == (10, 16, 19, 22)" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1\n5\n7\n8\n10\n", - "2\n6\n8\n9\n11\n", - "3\n7\n9\n10\n12\n" - ], - "test_output": [ - "6 12 15 18\n", - "8 14 17 20\n", - "10 16 19 22\n" - ], - "example_input": [ - "1\n5\n7\n8\n10\n", - "2\n6\n8\n9\n11\n" - ], - "example_output": [ - "6 12 15 18\n", - "8 14 17 20\n" - ], - "question": "Original problem description:\nWrite a function to find the pairwise addition of the neighboring elements of the given tuple.\nWe have its functional test sample:\nassert add_pairwise((1, 5, 7, 8, 10)) == (6, 12, 15, 18)\nassert add_pairwise((2, 6, 8, 9, 11)) == (8, 14, 17, 20)\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1\n5\n7\n8\n10\n\nOutput:\n6 12 15 18\n\n\nExample 2:\nInput:\n2\n6\n8\n9\n11\n\nOutput:\n8 14 17 20\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 248, - "prompt": "Write a python function to find the product of the array multiplication modulo n.", - "code": "def find_remainder(arr, n): \n mul = 1\n for i in range(len(arr)): \n mul = (mul * (arr[i] % n)) % n \n return mul % n ", - "test_imports": [], - "test_list": [ - "assert find_remainder([ 100, 10, 5, 25, 35, 14 ],11) ==9", - "assert find_remainder([1,1,1],1) == 0", - "assert find_remainder([1,2,1],2) == 0" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "100 10 5 25 35 14\n11\n", - "1 1 1\n1\n", - "1 2 1\n2\n" - ], - "test_output": [ - "9\n", - "0\n", - "0\n" - ], - "example_input": [ - "100 10 5 25 35 14\n11\n", - "1 1 1\n1\n" - ], - "example_output": [ - "9\n", - "0\n" - ], - "question": "Original problem description:\nWrite a python function to find the product of the array multiplication modulo n.\nWe have its functional test sample:\nassert find_remainder([ 100, 10, 5, 25, 35, 14 ],11) ==9\nassert find_remainder([1,1,1],1) == 0\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n100 10 5 25 35 14\n11\n\nOutput:\n9\n\n\nExample 2:\nInput:\n1 1 1\n1\n\nOutput:\n0\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 249, - "prompt": "Write a python function to check whether the given list contains consecutive numbers or not.", - "code": "def check_Consecutive(l): \n return sorted(l) == list(range(min(l),max(l)+1)) ", - "test_imports": [], - "test_list": [ - "assert check_Consecutive([1,2,3,4,5]) == True", - "assert check_Consecutive([1,2,3,5,6]) == False", - "assert check_Consecutive([1,2,1]) == False" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 2 3 4 5\n", - "1 2 3 5 6\n", - "1 2 1\n" - ], - "test_output": [ - "True\n", - "False\n", - "False\n" - ], - "example_input": [ - "1 2 3 4 5\n", - "1 2 3 5 6\n" - ], - "example_output": [ - "True\n", - "False\n" - ], - "question": "Original problem description:\nWrite a python function to check whether the given list contains consecutive numbers or not.\nWe have its functional test sample:\nassert check_Consecutive([1,2,3,4,5]) == True\nassert check_Consecutive([1,2,3,5,6]) == False\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 2 3 4 5\n\nOutput:\nTrue\n\n\nExample 2:\nInput:\n1 2 3 5 6\n\nOutput:\nFalse\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 251, - "prompt": "Write a function to replace characters in a string.", - "code": "def replace_char(str1,ch,newch):\n str2 = str1.replace(ch, newch)\n return str2", - "test_imports": [], - "test_list": [ - "assert replace_char(\"polygon\",'y','l')==(\"pollgon\")", - "assert replace_char(\"character\",'c','a')==(\"aharaater\")", - "assert replace_char(\"python\",'l','a')==(\"python\")" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "polygon\ny\nl\n", - "character\nc\na\n", - "python\nl\na\n" - ], - "test_output": [ - "pollgon\n", - "aharaater\n", - "python\n" - ], - "example_input": [ - "polygon\ny\nl\n", - "character\nc\na\n" - ], - "example_output": [ - "pollgon\n", - "aharaater\n" - ], - "question": "Original problem description:\nWrite a function to replace characters in a string.\nWe have its functional test sample:\nassert replace_char(\"polygon\",'y','l')==(\"pollgon\")\nassert replace_char(\"character\",'c','a')==(\"aharaater\")\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\npolygon\ny\nl\n\nOutput:\npollgon\n\n\nExample 2:\nInput:\ncharacter\nc\na\n\nOutput:\naharaater\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 252, - "prompt": "Write a function to sort a dictionary by value.", - "code": "from collections import Counter\ndef sort_counter(dict1):\n x = Counter(dict1)\n sort_counter=x.most_common()\n return sort_counter", - "test_imports": [], - "test_list": [ - "assert sort_counter({'Math':81, 'Physics':83, 'Chemistry':87})==[('Chemistry', 87), ('Physics', 83), ('Math', 81)]", - "assert sort_counter({'Math':400, 'Physics':300, 'Chemistry':250})==[('Math', 400), ('Physics', 300), ('Chemistry', 250)]", - "assert sort_counter({'Math':900, 'Physics':1000, 'Chemistry':1250})==[('Chemistry', 1250), ('Physics', 1000), ('Math', 900)]" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "{'Math': 81, 'Physics': 83, 'Chemistry': 87}\n", - "{'Math': 400, 'Physics': 300, 'Chemistry': 250}\n", - "{'Math': 900, 'Physics': 1000, 'Chemistry': 1250}\n" - ], - "test_output": [ - "Chemistry 87\nPhysics 83\nMath 81\n", - "Math 400\nPhysics 300\nChemistry 250\n", - "Chemistry 1250\nPhysics 1000\nMath 900\n" - ], - "example_input": [ - "{'Math': 81, 'Physics': 83, 'Chemistry': 87}\n", - "{'Math': 400, 'Physics': 300, 'Chemistry': 250}\n" - ], - "example_output": [ - "Chemistry 87\nPhysics 83\nMath 81\n", - "Math 400\nPhysics 300\nChemistry 250\n" - ], - "question": "Original problem description:\nWrite a function to sort a dictionary by value.\nWe have its functional test sample:\nassert sort_counter({'Math':81, 'Physics':83, 'Chemistry':87})==[('Chemistry', 87), ('Physics', 83), ('Math', 81)]\nassert sort_counter({'Math':400, 'Physics':300, 'Chemistry':250})==[('Math', 400), ('Physics', 300), ('Chemistry', 250)]\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n{'Math': 81, 'Physics': 83, 'Chemistry': 87}\n\nOutput:\nChemistry 87\nPhysics 83\nMath 81\n\n\nExample 2:\nInput:\n{'Math': 400, 'Physics': 300, 'Chemistry': 250}\n\nOutput:\nMath 400\nPhysics 300\nChemistry 250\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 253, - "prompt": "Write a python function to find the sum of the largest and smallest value in a given array.", - "code": "def big_sum(nums):\n sum= max(nums)+min(nums)\n return sum", - "test_imports": [], - "test_list": [ - "assert big_sum([1,2,3]) == 4", - "assert big_sum([-1,2,3,4]) == 3", - "assert big_sum([2,3,6]) == 8" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "1 2 3\n", - "-1 2 3 4\n", - "2 3 6\n" - ], - "test_output": [ - "4\n", - "3\n", - "8\n" - ], - "example_input": [ - "1 2 3\n", - "-1 2 3 4\n" - ], - "example_output": [ - "4\n", - "3\n" - ], - "question": "Original problem description:\nWrite a python function to find the sum of the largest and smallest value in a given array.\nWe have its functional test sample:\nassert big_sum([1,2,3]) == 4\nassert big_sum([-1,2,3,4]) == 3\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n1 2 3\n\nOutput:\n4\n\n\nExample 2:\nInput:\n-1 2 3 4\n\nOutput:\n3\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 254, - "prompt": "Write a python function to convert the given string to lower case.", - "code": "def is_lower(string):\n return (string.lower())", - "test_imports": [], - "test_list": [ - "assert is_lower(\"InValid\") == \"invalid\"", - "assert is_lower(\"TruE\") == \"true\"", - "assert is_lower(\"SenTenCE\") == \"sentence\"" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "InValid\n", - "TruE\n", - "SenTenCE\n" - ], - "test_output": [ - "invalid\n", - "true\n", - "sentence\n" - ], - "example_input": [ - "InValid\n", - "TruE\n" - ], - "example_output": [ - "invalid\n", - "true\n" - ], - "question": "Original problem description:\nWrite a python function to convert the given string to lower case.\nWe have its functional test sample:\nassert is_lower(\"InValid\") == \"invalid\"\nassert is_lower(\"TruE\") == \"true\"\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nInValid\n\nOutput:\ninvalid\n\n\nExample 2:\nInput:\nTruE\n\nOutput:\ntrue\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 255, - "prompt": "Write a function to remove lowercase substrings from a given string.", - "code": "import re\ndef remove_lowercase(str1):\n return re.sub('[a-z]', '', str1)", - "test_imports": [], - "test_list": [ - "assert remove_lowercase(\"PYTHon\")==('PYTH')", - "assert remove_lowercase(\"FInD\")==('FID')", - "assert remove_lowercase(\"STRinG\")==('STRG')" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "PYTHon\n", - "FInD\n", - "STRinG\n" - ], - "test_output": [ - "PYTH\n", - "FID\n", - "STRG\n" - ], - "example_input": [ - "PYTHon\n", - "FInD\n" - ], - "example_output": [ - "PYTH\n", - "FID\n" - ], - "question": "Original problem description:\nWrite a function to remove lowercase substrings from a given string.\nWe have its functional test sample:\nassert remove_lowercase(\"PYTHon\")==('PYTH')\nassert remove_lowercase(\"FInD\")==('FID')\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\nPYTHon\n\nOutput:\nPYTH\n\n\nExample 2:\nInput:\nFInD\n\nOutput:\nFID\n\n\n" - }, - { - "source_file": "charlessutton@: Benchmark Questions Verification V2.ipynb", - "task_id": 256, - "prompt": "Write a python function to find the first digit of a given number.", - "code": "def first_Digit(n) : \n while n >= 10: \n n = n / 10 \n return int(n) ", - "test_imports": [], - "test_list": [ - "assert first_Digit(123) == 1", - "assert first_Digit(456) == 4", - "assert first_Digit(12) == 1" - ], - "exe_method": "stdin", - "test_time_limit": 1, - "solutions": null, - "dataset": "MBPP", - "test_input": [ - "123\n", - "456\n", - "12\n" - ], - "test_output": [ - "1\n", - "4\n", - "1\n" - ], - "example_input": [ - "123\n", - "456\n" - ], - "example_output": [ - "1\n", - "4\n" - ], - "question": "Original problem description:\nWrite a python function to find the first digit of a given number.\nWe have its functional test sample:\nassert first_Digit(123) == 1\nassert first_Digit(456) == 4\n\nHowever, the functional I/O tests have been converted to a standard stdin/stdout format for this task. The followings are some input and output examples. Please read from stdin and write to stdout exactly as shown below. \nYour solution must strictly follow these formats. For instance, many raw functional test cases contain a list like [a1, a2, a3, ...]. After conversion, these may appear as a single line of input: \"a1 a2 a3 ...\". You should read this line directly, without first reading the length of the list.\n\nExample 1:\nInput:\n123\n\nOutput:\n1\n\n\nExample 2:\nInput:\n456\n\nOutput:\n4\n\n\n" - } -] \ No newline at end of file