mirror of
https://github.com/GammaTauAI/reflexion-human-eval
synced 2024-11-16 00:12:59 +00:00
.
This commit is contained in:
parent
82ddab41ff
commit
963d1842b0
@ -287,3 +287,111 @@
|
||||
{"name": "mbpp_296_get_Inv_Count", "language": "py", "prompt": "from typing import List\n\ndef get_Inv_Count(arr: List[int]) -> int:\n \"\"\"\n\tWrite a python function to count inversions in an array.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_296_get_Inv_Count.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "get_Inv_Count", "test": "def check(candidate):\n assert candidate([1, 20, 6, 4, 5]) == 5\n assert candidate([1, 2, 1]) == 1\n assert candidate([1, 2, 5, 6, 1]) == 3\n\ndef test_check():\n check(get_Inv_Count)\n\ntest_check()\n", "solution": "from typing import List\n\ndef get_Inv_Count(arr: List[int]) -> int:\n \"\"\"\n\tWrite a python function to count inversions in an array.\n\t\"\"\"\n inv_count = 0\n n = len(arr)\n\n for i in range(n):\n for j in range(i+1, n):\n if arr[i] > arr[j]:\n inv_count += 1\n\n return inv_count", "is_solved": true}
|
||||
{"name": "mbpp_57_find_Max_Num", "language": "py", "prompt": "from typing import List\n\ndef find_Max_Num(arr: List[int]) -> int:\n \"\"\"\n\tWrite a python function to find the largest number that can be formed with the given list of digits.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_57_find_Max_Num.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "find_Max_Num", "test": "def check(candidate):\n assert candidate([1, 2, 3]) == 321\n assert candidate([4, 5, 6, 1]) == 6541\n assert candidate([1, 2, 3, 9]) == 9321\n\ndef test_check():\n check(find_Max_Num)\n\ntest_check()\n", "solution": "from typing import List\n\ndef find_Max_Num(arr: List[int]) -> int:\n \"\"\"\n\tWrite a python function to find the largest number that can be formed with the given list of digits.\n\t\"\"\"\n arr.sort(reverse=True)\n max_num = int(\"\".join(str(x) for x in arr))\n return max_num", "is_solved": true}
|
||||
{"name": "mbpp_614_cummulative_sum", "language": "py", "prompt": "from typing import List\n\ndef cummulative_sum(test_list: List[List[int]]) -> int:\n \"\"\"\n\tWrite a function to find the cumulative sum of all the values that are present in the given list of lists.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_614_cummulative_sum.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "cummulative_sum", "test": "def check(candidate):\n assert candidate([[1, 3], [5, 6, 7], [2, 6]]) == 30\n assert candidate([[2, 4], [6, 7, 8], [3, 7]]) == 37\n assert candidate([[3, 5], [7, 8, 9], [4, 8]]) == 44\n\ndef test_check():\n check(cummulative_sum)\n\ntest_check()\n", "solution": "from typing import List\n\ndef cummulative_sum(test_list: List[List[int]]) -> int:\n \"\"\"\n\tWrite a function to find the cumulative sum of all the values that are present in the given list of lists.\n\t\"\"\"\n total_sum = 0\n for sublist in test_list:\n for value in sublist:\n total_sum += value\n return total_sum", "is_solved": true}
|
||||
{"name": "mbpp_623_nth_nums", "language": "py", "prompt": "from typing import List\n\ndef nth_nums(nums: List[int], n: int) -> List[int]:\n \"\"\"\n\tWrite a function to compute the n-th power of each number in a list.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_623_nth_nums.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "nth_nums", "test": "def check(candidate):\n assert candidate([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 2) == [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]\n assert candidate([10, 20, 30], 3) == [1000, 8000, 27000]\n assert candidate([12, 15], 5) == [248832, 759375]\n\ndef test_check():\n check(nth_nums)\n\ntest_check()\n", "solution": "from typing import List\n\ndef nth_nums(nums: List[int], n: int) -> List[int]:\n \"\"\"\n\tWrite a function to compute the n-th power of each number in a list.\n\t\"\"\"\n result = []\n for num in nums:\n result.append(num ** n)\n return result", "is_solved": true}
|
||||
{"name": "mbpp_799_left_rotate", "language": "py", "prompt": "def left_rotate(n: int, d: int) -> int:\n \"\"\"\n\tWrite a function to that rotate left bits by d bits a given number. We assume that the number is 32 bit.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_799_left_rotate.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "left_rotate", "test": "def check(candidate):\n assert candidate(16, 2) == 64\n assert candidate(10, 2) == 40\n assert candidate(99, 3) == 792\n assert candidate(99, 3) == 792\n assert candidate(1, 3) == 8\n assert candidate(5, 3) == 40\n assert candidate(29, 3) == 232\n\ndef test_check():\n check(left_rotate)\n\ntest_check()\n", "solution": "def left_rotate(n: int, d: int) -> int:\n \"\"\"\n\tWrite a function to that rotate left bits by d bits a given number. We assume that the number is 32 bit.\n\t\"\"\"\n # Left rotate the bits by d positions\n return (n << d) | (n >> (32 - d))", "is_solved": true}
|
||||
{"name": "mbpp_247_lps", "language": "py", "prompt": "def lps(str: str) -> int:\n \"\"\"\n\tWrite a function to find the length of the longest palindromic subsequence in the given string.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_247_lps.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "lps", "test": "def check(candidate):\n assert candidate('TENS FOR TENS') == 5\n assert candidate('CARDIO FOR CARDS') == 7\n assert candidate('PART OF THE JOURNEY IS PART') == 9\n\ndef test_check():\n check(lps)\n\ntest_check()\n", "solution": "def lps(str: str) -> int:\n \"\"\"\n\tWrite a function to find the length of the longest palindromic subsequence in the given string.\n\t\"\"\"\n n = len(str)\n dp = [[0] * n for _ in range(n)]\n\n for i in range(n - 1, -1, -1):\n dp[i][i] = 1\n for j in range(i + 1, n):\n if str[i] == str[j]:\n dp[i][j] = dp[i + 1][j - 1] + 2\n else:\n dp[i][j] = max(dp[i + 1][j], dp[i][j - 1])\n\n return dp[0][n - 1]", "is_solved": true}
|
||||
{"name": "mbpp_735_toggle_middle_bits", "language": "py", "prompt": "def toggle_middle_bits(n: int) -> int:\n \"\"\"\n\tWrite a python function to toggle bits of the number except the first and the last bit. https://www.geeksforgeeks.org/toggle-bits-number-expect-first-last-bits/\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_735_toggle_middle_bits.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "toggle_middle_bits", "test": "def check(candidate):\n assert candidate(9) == 15\n assert candidate(10) == 12\n assert candidate(11) == 13\n assert candidate(65) == 127\n assert candidate(77) == 115\n\ndef test_check():\n check(toggle_middle_bits)\n\ntest_check()\n", "solution": "def toggle_middle_bits(n: int) -> int:\n \"\"\"\n\tWrite a python function to toggle bits of the number except the first and the last bit. https://www.geeksforgeeks.org/toggle-bits-number-expect-first-last-bits/\n\t\"\"\"\n # Find the number of bits in the given number\n num_bits = n.bit_length()\n\n # If the number has less than 3 bits, return the number as it is\n if num_bits < 3:\n return n\n\n # Create a mask with all bits set except the first and last bits\n mask = (1 << (num_bits - 2)) - 4\n\n # Toggle the middle bits using XOR operation\n result = n ^ mask\n\n return result", "is_solved": false}
|
||||
{"name": "mbpp_132_tup_string", "language": "py", "prompt": "from typing import List\n\ndef tup_string(tup1: List[str]) -> str:\n \"\"\"\n\tWrite a function to convert a list to a string.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_132_tup_string.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "tup_string", "test": "def check(candidate):\n assert candidate(['e', 'x', 'e', 'r', 'c', 'i', 's', 'e', 's']) == 'exercises'\n assert candidate(['p', 'y', 't', 'h', 'o', 'n']) == 'python'\n assert candidate(['p', 'r', 'o', 'g', 'r', 'a', 'm']) == 'program'\n\ndef test_check():\n check(tup_string)\n\ntest_check()\n", "solution": "from typing import List\n\ndef tup_string(tup1: List[str]) -> str:\n \"\"\"\n\tWrite a function to convert a list to a string.\n\t\"\"\"\n result = \"\"\n for item in tup1:\n result += item\n return result", "is_solved": true}
|
||||
{"name": "mbpp_460_Extract", "language": "py", "prompt": "from typing import List\n\ndef Extract(lst: List[List[int]]) -> List[int]:\n \"\"\"\n\tWrite a python function to get the first element of each sublist.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_460_Extract.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "Extract", "test": "def check(candidate):\n assert candidate([[1, 2], [3, 4, 5], [6, 7, 8, 9]]) == [1, 3, 6]\n assert candidate([[1, 2, 3], [4, 5]]) == [1, 4]\n assert candidate([[9, 8, 1], [1, 2]]) == [9, 1]\n\ndef test_check():\n check(Extract)\n\ntest_check()\n", "solution": "from typing import List\n\ndef Extract(lst: List[List[int]]) -> List[int]:\n \"\"\"\n\tWrite a python function to get the first element of each sublist.\n\t\"\"\"\n result = []\n for sublist in lst:\n if len(sublist) > 0:\n result.append(sublist[0])\n return result", "is_solved": true}
|
||||
{"name": "mbpp_606_radian_degree", "language": "py", "prompt": "def radian_degree(degree: int) -> float:\n \"\"\"\n\tWrite a function to convert degrees to radians.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_606_radian_degree.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "radian_degree", "test": "def check(candidate):\n assert candidate(90) == 1.5707963267948966\n assert candidate(60) == 1.0471975511965976\n assert candidate(120) == 2.0943951023931953\n\ndef test_check():\n check(radian_degree)\n\ntest_check()\n", "solution": "def radian_degree(degree: int) -> float:\n \"\"\"\n\tWrite a function to convert degrees to radians.\n\t\"\"\"\n import math\n\n radians = degree * (math.pi / 180)\n return radians", "is_solved": true}
|
||||
{"name": "mbpp_167_next_power_of_2", "language": "py", "prompt": "def next_power_of_2(n: int) -> int:\n \"\"\"\n\tWrite a python function to find the smallest power of 2 greater than or equal to n.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_167_next_power_of_2.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "next_power_of_2", "test": "def check(candidate):\n assert candidate(0) == 1\n assert candidate(5) == 8\n assert candidate(17) == 32\n\ndef test_check():\n check(next_power_of_2)\n\ntest_check()\n", "solution": "def next_power_of_2(n: int) -> int:\n \"\"\"\n\tWrite a python function to find the smallest power of 2 greater than or equal to n.\n\t\"\"\"\n if n <= 0:\n return 1\n\n power = 1\n while power < n:\n power *= 2\n\n return power", "is_solved": true}
|
||||
{"name": "mbpp_756_text_match_zero_one", "language": "py", "prompt": "def text_match_zero_one(text: str) -> bool:\n \"\"\"\n\tWrite a function that matches a string that has an 'a' followed by one or more 'b's. https://www.w3resource.com/python-exercises/re/python-re-exercise-3.php\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_756_text_match_zero_one.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "text_match_zero_one", "test": "def check(candidate):\n assert candidate('ac') == False\n assert candidate('dc') == False\n assert candidate('abbbba') == True\n assert candidate('dsabbbba') == True\n assert candidate('asbbbba') == False\n assert candidate('abaaa') == True\n\ndef test_check():\n check(text_match_zero_one)\n\ntest_check()\n", "solution": "def text_match_zero_one(text: str) -> bool:\n \"\"\"\n\tWrite a function that matches a string that has an 'a' followed by one or more 'b's. https://www.w3resource.com/python-exercises/re/python-re-exercise-3.php\n\t\"\"\"\n import re\n\n pattern = r\"ab+\"\n if re.search(pattern, text):\n return True\n else:\n return False", "is_solved": true}
|
||||
{"name": "mbpp_633_pair_xor_Sum", "language": "py", "prompt": "from typing import List\n\ndef pair_xor_Sum(arr: List[int], n: int) -> int:\n \"\"\"\n\tWrite a python function to find the sum of xor of all pairs of numbers in the given list.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_633_pair_xor_Sum.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "pair_xor_Sum", "test": "def check(candidate):\n assert candidate([5, 9, 7, 6], 4) == 47\n assert candidate([7, 3, 5], 3) == 12\n assert candidate([7, 3], 2) == 4\n\ndef test_check():\n check(pair_xor_Sum)\n\ntest_check()\n", "solution": "from typing import List\n\ndef pair_xor_Sum(arr: List[int], n: int) -> int:\n \"\"\"\n\tWrite a python function to find the sum of xor of all pairs of numbers in the given list.\n\t\"\"\"\n xor_sum = 0\n\n for i in range(n):\n for j in range(i+1, n):\n xor_sum += arr[i] ^ arr[j]\n\n return xor_sum", "is_solved": true}
|
||||
{"name": "mbpp_458_rectangle_area", "language": "py", "prompt": "def rectangle_area(l: int, b: int) -> int:\n \"\"\"\n\tWrite a function to find the area of a rectangle.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_458_rectangle_area.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "rectangle_area", "test": "def check(candidate):\n assert candidate(10, 20) == 200\n assert candidate(10, 5) == 50\n assert candidate(4, 2) == 8\n\ndef test_check():\n check(rectangle_area)\n\ntest_check()\n", "solution": "def rectangle_area(l: int, b: int) -> int:\n \"\"\"\n\tWrite a function to find the area of a rectangle.\n\t\"\"\"\n area = l * b\n return area", "is_solved": true}
|
||||
{"name": "mbpp_738_geometric_sum", "language": "py", "prompt": "def geometric_sum(n: int) -> float:\n \"\"\"\n\tWrite a function to calculate the geometric sum of n-1. https://www.w3resource.com/python-exercises/data-structures-and-algorithms/python-recursion-exercise-9.php\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_738_geometric_sum.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "geometric_sum", "test": "def check(candidate):\n assert candidate(7) == 1.9921875\n assert candidate(4) == 1.9375\n assert candidate(8) == 1.99609375\n\ndef test_check():\n check(geometric_sum)\n\ntest_check()\n", "solution": "def geometric_sum(n: int) -> float:\n \"\"\"\n\tWrite a function to calculate the geometric sum of n-1. https://www.w3resource.com/python-exercises/data-structures-and-algorithms/python-recursion-exercise-9.php\n\t\"\"\"\n if n < 0:\n return 0\n else:\n return 1 / (2 ** n) + geometric_sum(n - 1)", "is_solved": true}
|
||||
{"name": "mbpp_426_filter_oddnumbers", "language": "py", "prompt": "from typing import List\n\ndef filter_oddnumbers(nums: List[int]) -> List[int]:\n \"\"\"\n\tWrite a function to filter odd numbers.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_426_filter_oddnumbers.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "filter_oddnumbers", "test": "def check(candidate):\n assert candidate([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == [1, 3, 5, 7, 9]\n assert candidate([10, 20, 45, 67, 84, 93]) == [45, 67, 93]\n assert candidate([5, 7, 9, 8, 6, 4, 3]) == [5, 7, 9, 3]\n\ndef test_check():\n check(filter_oddnumbers)\n\ntest_check()\n", "solution": "from typing import List\n\ndef filter_oddnumbers(nums: List[int]) -> List[int]:\n \"\"\"\n\tWrite a function to filter odd numbers.\n\t\"\"\"\n return [num for num in nums if num % 2 != 0]", "is_solved": true}
|
||||
{"name": "mbpp_437_remove_odd", "language": "py", "prompt": "def remove_odd(str1: str) -> str:\n \"\"\"\n\tWrite a function to remove odd characters in a string.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_437_remove_odd.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "remove_odd", "test": "def check(candidate):\n assert candidate('python') == 'yhn'\n assert candidate('program') == 'rga'\n assert candidate('language') == 'agae'\n\ndef test_check():\n check(remove_odd)\n\ntest_check()\n", "solution": "def remove_odd(str1: str) -> str:\n \"\"\"\n\tWrite a function to remove odd characters in a string.\n\t\"\"\"\n result = \"\"\n for i in range(len(str1)):\n if i % 2 == 0:\n result += str1[i]\n return result", "is_solved": false}
|
||||
{"name": "mbpp_227_min_of_three", "language": "py", "prompt": "def min_of_three(a: int, b: int, c: int) -> int:\n \"\"\"\n\tWrite a function to find minimum of three numbers.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_227_min_of_three.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "min_of_three", "test": "def check(candidate):\n assert candidate(10, 20, 0) == 0\n assert candidate(19, 15, 18) == 15\n assert candidate(-10, -20, -30) == -30\n\ndef test_check():\n check(min_of_three)\n\ntest_check()\n", "solution": "def min_of_three(a: int, b: int, c: int) -> int:\n \"\"\"\n\tWrite a function to find minimum of three numbers.\n\t\"\"\"\n return min(a, b, c)", "is_solved": true}
|
||||
{"name": "mbpp_172_count_occurance", "language": "py", "prompt": "def count_occurance(s: str) -> int:\n \"\"\"\n\tWrite a function to count the number of occurence of the string 'std' in a given string.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_172_count_occurance.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "count_occurance", "test": "def check(candidate):\n assert candidate('letstdlenstdporstd') == 3\n assert candidate('truststdsolensporsd') == 1\n assert candidate('makestdsostdworthit') == 2\n assert candidate('stds') == 1\n assert candidate('') == 0\n\ndef test_check():\n check(count_occurance)\n\ntest_check()\n", "solution": "def count_occurance(s: str) -> int:\n \"\"\"\n\tWrite a function to count the number of occurence of the string 'std' in a given string.\n\t\"\"\"\n return s.count('std')", "is_solved": true}
|
||||
{"name": "mbpp_434_text_match_one", "language": "py", "prompt": "def text_match_one(text: str) -> bool:\n \"\"\"\n\tWrite a function that matches a string that has an a followed by one or more b's.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_434_text_match_one.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "text_match_one", "test": "def check(candidate):\n assert candidate('ac') == False\n assert candidate('dc') == False\n assert candidate('abba') == True\n\ndef test_check():\n check(text_match_one)\n\ntest_check()\n", "solution": "def text_match_one(text: str) -> bool:\n \"\"\"\n\tWrite a function that matches a string that has an a followed by one or more b's.\n\t\"\"\"\n import re\n\n pattern = re.compile(r\"ab+\")\n match = pattern.search(text)\n\n return bool(match)", "is_solved": true}
|
||||
{"name": "mbpp_291_count_no_of_ways", "language": "py", "prompt": "def count_no_of_ways(n: int, k: int) -> int:\n \"\"\"\n\tWrite 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.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_291_count_no_of_ways.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "count_no_of_ways", "test": "def check(candidate):\n assert candidate(2, 4) == 16\n assert candidate(3, 2) == 6\n assert candidate(4, 4) == 228\n\ndef test_check():\n check(count_no_of_ways)\n\ntest_check()\n", "solution": "def count_no_of_ways(n: int, k: int) -> int:\n \"\"\"\n\tWrite 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.\n\t\"\"\"\n if n == 0:\n return 0\n if n == 1:\n return k\n if n == 2:\n return k * k\n\n dp = [0] * (n + 1)\n dp[1] = k\n dp[2] = k * k\n\n for i in range(3, n + 1):\n dp[i] = (k - 1) * (dp[i - 1] + dp[i - 2])\n\n return dp[n]", "is_solved": true}
|
||||
{"name": "mbpp_471_find_remainder", "language": "py", "prompt": "from typing import List\n\ndef find_remainder(arr: List[int], n: int) -> int:\n \"\"\"\n\tWrite a python function to find the product of the array multiplication modulo n.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_471_find_remainder.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "find_remainder", "test": "def check(candidate):\n assert candidate([100, 10, 5, 25, 35, 14], 11) == 9\n assert candidate([1, 1, 1], 1) == 0\n assert candidate([1, 2, 1], 2) == 0\n\ndef test_check():\n check(find_remainder)\n\ntest_check()\n", "solution": "from typing import List\n\ndef find_remainder(arr: List[int], n: int) -> int:\n \"\"\"\n\tWrite a python function to find the product of the array multiplication modulo n.\n\t\"\"\"\n product = 1\n for num in arr:\n product *= num\n return product % n", "is_solved": true}
|
||||
{"name": "mbpp_808_check_K", "language": "py", "prompt": "from typing import List\n\ndef check_K(test_tup: List[int], K: int) -> bool:\n \"\"\"\n\tWrite a function to check if the given tuples contain the k or not.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_808_check_K.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "check_K", "test": "def check(candidate):\n assert candidate([10, 4, 5, 6, 8], 6) == True\n assert candidate([1, 2, 3, 4, 5, 6], 7) == False\n assert candidate([7, 8, 9, 44, 11, 12], 11) == True\n\ndef test_check():\n check(check_K)\n\ntest_check()\n", "solution": "from typing import List\n\ndef check_K(test_tup: List[int], K: int) -> bool:\n \"\"\"\n\tWrite a function to check if the given tuples contain the k or not.\n\t\"\"\"\n return K in test_tup", "is_solved": true}
|
||||
{"name": "mbpp_68_is_Monotonic", "language": "py", "prompt": "from typing import List\n\ndef is_Monotonic(A: List[int]) -> bool:\n \"\"\"\n\tWrite a python function to check whether the given array is monotonic or not.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_68_is_Monotonic.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "is_Monotonic", "test": "def check(candidate):\n assert candidate([6, 5, 4, 4]) == True\n assert candidate([1, 2, 2, 3]) == True\n assert candidate([1, 3, 2]) == False\n\ndef test_check():\n check(is_Monotonic)\n\ntest_check()\n", "solution": "from typing import List\n\ndef is_Monotonic(A: List[int]) -> bool:\n \"\"\"\n\tWrite a python function to check whether the given array is monotonic or not.\n\t\"\"\"\n if len(A) < 2:\n return True\n\n direction = A[1] - A[0]\n for i in range(2, len(A)):\n if direction == 0:\n direction = A[i] - A[i - 1]\n continue\n\n if (A[i] - A[i - 1]) * direction < 0:\n return False\n\n return True", "is_solved": true}
|
||||
{"name": "mbpp_430_parabola_directrix", "language": "py", "prompt": "def parabola_directrix(a: int, b: int, c: int) -> int:\n \"\"\"\n\tWrite a function to find the directrix of a parabola.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_430_parabola_directrix.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "parabola_directrix", "test": "def check(candidate):\n assert candidate(5, 3, 2) == -198\n assert candidate(9, 8, 4) == -2336\n assert candidate(2, 4, 6) == -130\n\ndef test_check():\n check(parabola_directrix)\n\ntest_check()\n", "solution": "def parabola_directrix(a: int, b: int, c: int) -> int:\n \"\"\"\n\tWrite a function to find the directrix of a parabola.\n\t\"\"\"\n directrix = (c - (b ** 2) / (4 * a))\n return directrix", "is_solved": false}
|
||||
{"name": "mbpp_618_div_list", "language": "py", "prompt": "from typing import List\n\ndef div_list(nums1: List[int], nums2: List[int]) -> List[float]:\n \"\"\"\n\tWrite a function to divide two lists element wise.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_618_div_list.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "div_list", "test": "def check(candidate):\n assert candidate([4, 5, 6], [1, 2, 3]) == [4.0, 2.5, 2.0]\n assert candidate([3, 2], [1, 4]) == [3.0, 0.5]\n assert candidate([90, 120], [50, 70]) == [1.8, 1.7142857142857142]\n\ndef test_check():\n check(div_list)\n\ntest_check()\n", "solution": "from typing import List\n\ndef div_list(nums1: List[int], nums2: List[int]) -> List[float]:\n \"\"\"\n\tWrite a function to divide two lists element wise.\n\t\"\"\"\n result = []\n for i in range(len(nums1)):\n if nums2[i] != 0:\n result.append(nums1[i] / nums2[i])\n else:\n result.append(float('inf'))\n return result", "is_solved": true}
|
||||
{"name": "mbpp_421_concatenate_tuple", "language": "py", "prompt": "from typing import Tuple\n\ndef concatenate_tuple(test_tup: Tuple[str, str, int, str]) -> str:\n \"\"\"\n\tWrite a function to concatenate each element of tuple by the delimiter.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_421_concatenate_tuple.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "concatenate_tuple", "test": "def check(candidate):\n assert candidate(('ID', 'is', 4, 'UTS')) == 'ID-is-4-UTS'\n assert candidate(('QWE', 'is', 4, 'RTY')) == 'QWE-is-4-RTY'\n assert candidate(('ZEN', 'is', 4, 'OP')) == 'ZEN-is-4-OP'\n\ndef test_check():\n check(concatenate_tuple)\n\ntest_check()\n", "solution": "from typing import Tuple\n\ndef concatenate_tuple(test_tup: Tuple[str, str, int, str]) -> str:\n \"\"\"\n\tWrite a function to concatenate each element of tuple by the delimiter.\n\t\"\"\"\n delimiter = \"-\"\n return delimiter.join(str(element) for element in test_tup)", "is_solved": true}
|
||||
{"name": "mbpp_750_add_tuple", "language": "py", "prompt": "from typing import List, Tuple\n\ndef add_tuple(test_list: List[int], test_tup: Tuple[int, int]) -> List[int]:\n \"\"\"\n\tWrite a function to add the given tuple to the given list.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_750_add_tuple.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "add_tuple", "test": "def check(candidate):\n assert candidate([5, 6, 7], (9, 10)) == [5, 6, 7, 9, 10]\n assert candidate([6, 7, 8], (10, 11)) == [6, 7, 8, 10, 11]\n assert candidate([7, 8, 9], (11, 12)) == [7, 8, 9, 11, 12]\n\ndef test_check():\n check(add_tuple)\n\ntest_check()\n", "solution": "from typing import List, Tuple\n\ndef add_tuple(test_list: List[int], test_tup: Tuple[int, int]) -> List[int]:\n \"\"\"\n\tWrite a function to add the given tuple to the given list.\n\t\"\"\"\n # Adding the tuple elements to the list\n test_list.extend(test_tup)\n\n # Returning the modified list\n return test_list", "is_solved": true}
|
||||
{"name": "mbpp_304_find_Element", "language": "py", "prompt": "from typing import List\n\ndef find_Element(arr: List[int], ranges: List[List[int]], rotations: int, index: int) -> int:\n \"\"\"\n\tWrite a python function to find element at a given index after number of rotations.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_304_find_Element.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "find_Element", "test": "def check(candidate):\n assert candidate([1, 2, 3, 4, 5], [[0, 2], [0, 3]], 2, 1) == 3\n assert candidate([1, 2, 3, 4], [[0, 1], [0, 2]], 1, 2) == 3\n assert candidate([1, 2, 3, 4, 5, 6], [[0, 1], [0, 2]], 1, 1) == 1\n\ndef test_check():\n check(find_Element)\n\ntest_check()\n", "solution": "from typing import List\n\ndef find_Element(arr: List[int], ranges: List[List[int]], rotations: int, index: int) -> int:\n \"\"\"\n\tWrite a python function to find element at a given index after number of rotations.\n\t\"\"\"\n def rotate(arr: List[int], start: int, end: int) -> None:\n temp = arr[start]\n for i in range(start, end):\n arr[i] = arr[i + 1]\n arr[end] = temp\n\n for _ in range(rotations):\n for r in ranges:\n start, end = r\n rotate(arr, start, end)\n\n return arr[index]", "is_solved": false}
|
||||
{"name": "mbpp_740_tuple_to_dict", "language": "py", "prompt": "from typing import Tuple, Dict\n\ndef tuple_to_dict(test_tup: Tuple[int, int, int, int, int, int]) -> Dict[int, int]:\n \"\"\"\n\tWrite a function to convert the given tuple to a key-value dictionary using adjacent elements. https://www.geeksforgeeks.org/python-convert-tuple-to-adjacent-pair-dictionary/\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_740_tuple_to_dict.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "tuple_to_dict", "test": "def check(candidate):\n assert candidate((1, 5, 7, 10, 13, 5)) == { 1: 5, 7: 10, 13: 5 }\n assert candidate((1, 2, 3, 4, 5, 6)) == { 1: 2, 3: 4, 5: 6 }\n assert candidate((7, 8, 9, 10, 11, 12)) == { 7: 8, 9: 10, 11: 12 }\n\ndef test_check():\n check(tuple_to_dict)\n\ntest_check()\n", "solution": "from typing import Tuple, Dict\n\ndef tuple_to_dict(test_tup: Tuple[int, int, int, int, int, int]) -> Dict[int, int]:\n \"\"\"\n\tWrite a function to convert the given tuple to a key-value dictionary using adjacent elements. https://www.geeksforgeeks.org/python-convert-tuple-to-adjacent-pair-dictionary/\n\t\"\"\"\n result_dict = {}\n for i in range(0, len(test_tup) - 1, 2):\n result_dict[test_tup[i]] = test_tup[i + 1]\n return result_dict", "is_solved": true}
|
||||
{"name": "mbpp_627_find_First_Missing", "language": "py", "prompt": "from typing import List\n\ndef find_First_Missing(array: List[int]) -> int:\n \"\"\"\n\tWrite a python function to find the smallest missing number from a sorted list of natural numbers.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_627_find_First_Missing.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "find_First_Missing", "test": "def check(candidate):\n assert candidate([0, 1, 2, 3]) == 4\n assert candidate([0, 1, 2, 6, 9]) == 3\n assert candidate([2, 3, 5, 8, 9]) == 0\n\ndef test_check():\n check(find_First_Missing)\n\ntest_check()\n", "solution": "from typing import List\n\ndef find_First_Missing(array: List[int]) -> int:\n \"\"\"\n\tWrite a python function to find the smallest missing number from a sorted list of natural numbers.\n\t\"\"\"\n if not array:\n return 1\n\n for i in range(len(array)):\n if array[i] != i + 1:\n return i + 1\n\n return len(array) + 1", "is_solved": false}
|
||||
{"name": "mbpp_294_max_val", "language": "py", "prompt": "from typing import List, Union\n\ndef max_val(listval: List[Union[str, int]]) -> int:\n \"\"\"\n\tWrite a function to find the maximum value in a given heterogeneous list.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_294_max_val.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "max_val", "test": "def check(candidate):\n assert candidate(['Python', 3, 2, 4, 5, 'version']) == 5\n assert candidate(['Python', 15, 20, 25]) == 25\n assert candidate(['Python', 30, 20, 40, 50, 'version']) == 50\n\ndef test_check():\n check(max_val)\n\ntest_check()\n", "solution": "from typing import List, Union\n\ndef max_val(listval: List[Union[str, int]]) -> int:\n \"\"\"\n\tWrite a function to find the maximum value in a given heterogeneous list.\n\t\"\"\"\n max_value = None\n\n for val in listval:\n if isinstance(val, int):\n if max_value is None or val > max_value:\n max_value = val\n\n return max_value", "is_solved": true}
|
||||
{"name": "mbpp_165_count_char_position", "language": "py", "prompt": "def count_char_position(str1: str) -> int:\n \"\"\"\n\tWrite 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).\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_165_count_char_position.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "count_char_position", "test": "def check(candidate):\n assert candidate('xbcefg') == 2\n assert candidate('ABcED') == 3\n assert candidate('AbgdeF') == 5\n\ndef test_check():\n check(count_char_position)\n\ntest_check()\n", "solution": "def count_char_position(str1: str) -> int:\n \"\"\"\n\tWrite 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).\n\t\"\"\"\n count = 0\n str1 = str1.lower()\n\n for i, char in enumerate(str1):\n if ord(char) - ord('a') == i:\n count += 1\n\n return count", "is_solved": true}
|
||||
{"name": "mbpp_589_perfect_squares", "language": "py", "prompt": "from typing import List\n\ndef perfect_squares(a: int, b: int) -> List[int]:\n \"\"\"\n\tWrite a function to find perfect squares between two given numbers.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_589_perfect_squares.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "perfect_squares", "test": "def check(candidate):\n assert candidate(1, 30) == [1, 4, 9, 16, 25]\n assert candidate(50, 100) == [64, 81, 100]\n assert candidate(100, 200) == [100, 121, 144, 169, 196]\n\ndef test_check():\n check(perfect_squares)\n\ntest_check()\n", "solution": "from typing import List\n\ndef perfect_squares(a: int, b: int) -> List[int]:\n \"\"\"\n\tWrite a function to find perfect squares between two given numbers.\n\t\"\"\"\n result = []\n for i in range(a, b+1):\n if i > 0 and (i ** 0.5).is_integer():\n result.append(i)\n return result", "is_solved": true}
|
||||
{"name": "mbpp_744_check_none", "language": "py", "prompt": "from typing import Any\n\ndef check_none(test_tup: Any) -> bool:\n \"\"\"\n\tWrite a function to check if the given tuple has any none value or not.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_744_check_none.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "check_none", "test": "def check(candidate):\n assert candidate((10, 4, 5, 6, None)) == True\n assert candidate((7, 8, 9, 11, 14)) == False\n assert candidate((1, 2, 3, 4, None)) == True\n\ndef test_check():\n check(check_none)\n\ntest_check()\n", "solution": "from typing import Any\n\ndef check_none(test_tup: Any) -> bool:\n \"\"\"\n\tWrite a function to check if the given tuple has any none value or not.\n\t\"\"\"\n for item in test_tup:\n if item is None:\n return True\n return False", "is_solved": true}
|
||||
{"name": "mbpp_726_multiply_elements", "language": "py", "prompt": "from typing import List, Any\n\ndef multiply_elements(test_tup: List[int]) -> List[Any]:\n \"\"\"\n\tWrite a function that takes as input a list of numbers (t_1,...,t_{N+1}) and returns a list of length N where the i-th element of the tuple is equal to t_i * t_{i+1}.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_726_multiply_elements.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "multiply_elements", "test": "def check(candidate):\n assert candidate([1, 5, 7, 8, 10]) == [5, 35, 56, 80]\n assert candidate([2, 4, 5, 6, 7]) == [8, 20, 30, 42]\n assert candidate([12, 13, 14, 9, 15]) == [156, 182, 126, 135]\n assert candidate([12]) == []\n\ndef test_check():\n check(multiply_elements)\n\ntest_check()\n", "solution": "from typing import List, Any\n\ndef multiply_elements(test_tup: List[int]) -> List[Any]:\n \"\"\"\n\tWrite a function that takes as input a list of numbers (t_1,...,t_{N+1}) and returns a list of length N where the i-th element of the tuple is equal to t_i * t_{i+1}.\n\t\"\"\"\n result = []\n for i in range(len(test_tup) - 1):\n result.append(test_tup[i] * test_tup[i + 1])\n return result", "is_solved": true}
|
||||
{"name": "mbpp_736_left_insertion", "language": "py", "prompt": "from typing import List\n\ndef left_insertion(a: List[int], x: int) -> int:\n \"\"\"\n\tWrite a function to locate the left insertion point for a specified value in sorted order. https://www.w3resource.com/python-exercises/data-structures-and-algorithms/python-data-structure-exercise-24.php\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_736_left_insertion.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "left_insertion", "test": "def check(candidate):\n assert candidate([1, 2, 4, 5], 6) == 4\n assert candidate([1, 2, 4, 5], 3) == 2\n assert candidate([1, 2, 4, 5], 7) == 4\n\ndef test_check():\n check(left_insertion)\n\ntest_check()\n", "solution": "from typing import List\n\ndef left_insertion(a: List[int], x: int) -> int:\n \"\"\"\n\tWrite a function to locate the left insertion point for a specified value in sorted order. https://www.w3resource.com/python-exercises/data-structures-and-algorithms/python-data-structure-exercise-24.php\n\t\"\"\"\n left, right = 0, len(a)\n\n while left < right:\n mid = (left + right) // 2\n if a[mid] < x:\n left = mid + 1\n else:\n right = mid\n\n return left", "is_solved": true}
|
||||
{"name": "mbpp_63_max_difference", "language": "py", "prompt": "from typing import List, Tuple\n\ndef max_difference(test_list: List[Tuple[int, int]]) -> int:\n \"\"\"\n\tWrite a function to find the maximum difference between available pairs in the given tuple list.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_63_max_difference.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "max_difference", "test": "def check(candidate):\n assert candidate([(3, 5), (1, 7), (10, 3), (1, 2)]) == 7\n assert candidate([(4, 6), (2, 17), (9, 13), (11, 12)]) == 15\n assert candidate([(12, 35), (21, 27), (13, 23), (41, 22)]) == 23\n\ndef test_check():\n check(max_difference)\n\ntest_check()\n", "solution": "from typing import List, Tuple\n\ndef max_difference(test_list: List[Tuple[int, int]]) -> int:\n \"\"\"\n\tWrite a function to find the maximum difference between available pairs in the given tuple list.\n\t\"\"\"\n max_diff = 0\n\n for i in range(len(test_list)):\n for j in range(i+1, len(test_list)):\n diff = abs(test_list[i][0] - test_list[j][0]) + abs(test_list[i][1] - test_list[j][1])\n max_diff = max(max_diff, diff)\n\n return max_diff", "is_solved": false}
|
||||
{"name": "mbpp_264_dog_age", "language": "py", "prompt": "def dog_age(h_age: int) -> int:\n \"\"\"\n\tWrite a function to calculate a dog's age in dog's years.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_264_dog_age.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "dog_age", "test": "def check(candidate):\n assert candidate(12) == 61\n assert candidate(15) == 73\n assert candidate(24) == 109\n\ndef test_check():\n check(dog_age)\n\ntest_check()\n", "solution": "def dog_age(h_age: int) -> int:\n \"\"\"\n\tWrite a function to calculate a dog's age in dog's years.\n\t\"\"\"\n dog_years = h_age * 7\n return dog_years", "is_solved": false}
|
||||
{"name": "mbpp_273_substract_elements", "language": "py", "prompt": "from typing import Tuple\n\ndef substract_elements(test_tup1: Tuple[int, int, int], test_tup2: Tuple[int, int, int]) -> Tuple[int, int, int]:\n \"\"\"\n\tWrite 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.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_273_substract_elements.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "substract_elements", "test": "def check(candidate):\n assert candidate((10, 4, 5), (2, 5, 18)) == (8, -1, -13)\n assert candidate((11, 2, 3), (24, 45, 16)) == (-13, -43, -13)\n assert candidate((7, 18, 9), (10, 11, 12)) == (-3, 7, -3)\n\ndef test_check():\n check(substract_elements)\n\ntest_check()\n", "solution": "from typing import Tuple\n\ndef substract_elements(test_tup1: Tuple[int, int, int], test_tup2: Tuple[int, int, int]) -> Tuple[int, int, int]:\n \"\"\"\n\tWrite 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.\n\t\"\"\"\n result = tuple(a - b for a, b in zip(test_tup1, test_tup2))\n return result", "is_solved": true}
|
||||
{"name": "mbpp_83_get_Char", "language": "py", "prompt": "def get_Char(strr: str) -> str:\n \"\"\"\n\tWrite a python function to find the character made by adding the ASCII value of all the characters of the given string modulo 26.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_83_get_Char.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "get_Char", "test": "def check(candidate):\n assert candidate('abc') == 'f'\n assert candidate('gfg') == 't'\n assert candidate('ab') == 'c'\n\ndef test_check():\n check(get_Char)\n\ntest_check()\n", "solution": "def get_Char(strr: str) -> str:\n \"\"\"\n\tWrite a python function to find the character made by adding the ASCII value of all the characters of the given string modulo 26.\n\t\"\"\"\n ascii_sum = 0\n\n for char in strr:\n ascii_sum += ord(char)\n\n result_char = chr(((ascii_sum % 26) + ord('A')))\n\n return result_char", "is_solved": false}
|
||||
{"name": "mbpp_91_find_substring", "language": "py", "prompt": "from typing import List\n\ndef find_substring(str1: List[str], sub_str: str) -> bool:\n \"\"\"\n\tWrite a function to check if a string is present as a substring in a given list of string values.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_91_find_substring.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "find_substring", "test": "def check(candidate):\n assert candidate(['red', 'black', 'white', 'green', 'orange'], 'ack') == True\n assert candidate(['red', 'black', 'white', 'green', 'orange'], 'abc') == False\n assert candidate(['red', 'black', 'white', 'green', 'orange'], 'ange') == True\n\ndef test_check():\n check(find_substring)\n\ntest_check()\n", "solution": "from typing import List\n\ndef find_substring(str1: List[str], sub_str: str) -> bool:\n \"\"\"\n\tWrite a function to check if a string is present as a substring in a given list of string values.\n\t\"\"\"\n for string in str1:\n if sub_str in string:\n return True\n return False", "is_solved": true}
|
||||
{"name": "mbpp_100_next_smallest_palindrome", "language": "py", "prompt": "def next_smallest_palindrome(num: int) -> int:\n \"\"\"\n\tWrite a function to find the next smallest palindrome of a specified integer, returned as an integer.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_100_next_smallest_palindrome.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "next_smallest_palindrome", "test": "def check(candidate):\n assert candidate(99) == 101\n assert candidate(1221) == 1331\n assert candidate(120) == 121\n\ndef test_check():\n check(next_smallest_palindrome)\n\ntest_check()\n", "solution": "def next_smallest_palindrome(num: int) -> int:\n \"\"\"\n\tWrite a function to find the next smallest palindrome of a specified integer, returned as an integer.\n\t\"\"\"\n def is_palindrome(n: int) -> bool:\n return str(n) == str(n)[::-1]\n\n num += 1\n while not is_palindrome(num):\n num += 1\n\n return num", "is_solved": true}
|
||||
{"name": "mbpp_282_sub_list", "language": "py", "prompt": "from typing import List\n\ndef sub_list(nums1: List[int], nums2: List[int]) -> List[int]:\n \"\"\"\n\tWrite a function to subtract two lists element-wise.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_282_sub_list.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "sub_list", "test": "def check(candidate):\n assert candidate([1, 2, 3], [4, 5, 6]) == [-3, -3, -3]\n assert candidate([1, 2], [3, 4]) == [-2, -2]\n assert candidate([90, 120], [50, 70]) == [40, 50]\n\ndef test_check():\n check(sub_list)\n\ntest_check()\n", "solution": "from typing import List\n\ndef sub_list(nums1: List[int], nums2: List[int]) -> List[int]:\n \"\"\"\n\tWrite a function to subtract two lists element-wise.\n\t\"\"\"\n result = []\n for i in range(len(nums1)):\n result.append(nums1[i] - nums2[i])\n return result", "is_solved": true}
|
||||
{"name": "mbpp_790_even_position", "language": "py", "prompt": "from typing import List\n\ndef even_position(nums: List[int]) -> bool:\n \"\"\"\n\tWrite a python function to check whether every even index contains even numbers of a given list.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_790_even_position.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "even_position", "test": "def check(candidate):\n assert candidate([3, 2, 1]) == False\n assert candidate([1, 2, 3]) == False\n assert candidate([2, 1, 4]) == True\n\ndef test_check():\n check(even_position)\n\ntest_check()\n", "solution": "from typing import List\n\ndef even_position(nums: List[int]) -> bool:\n \"\"\"\n\tWrite a python function to check whether every even index contains even numbers of a given list.\n\t\"\"\"\n for i in range(0, len(nums), 2):\n if nums[i] % 2 != 0:\n return False\n return True", "is_solved": true}
|
||||
{"name": "mbpp_411_snake_to_camel", "language": "py", "prompt": "def snake_to_camel(word: str) -> str:\n \"\"\"\n\tWrite a function to convert the given snake case string to camel case string.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_411_snake_to_camel.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "snake_to_camel", "test": "def check(candidate):\n assert candidate('android_tv') == 'AndroidTv'\n assert candidate('google_pixel') == 'GooglePixel'\n assert candidate('apple_watch') == 'AppleWatch'\n\ndef test_check():\n check(snake_to_camel)\n\ntest_check()\n", "solution": "def snake_to_camel(word: str) -> str:\n \"\"\"\n\tWrite a function to convert the given snake case string to camel case string.\n\t\"\"\"\n components = word.split('_')\n return components[0] + ''.join(x.title() for x in components[1:])", "is_solved": false}
|
||||
{"name": "mbpp_754_extract_index_list", "language": "py", "prompt": "from typing import List, Any\n\ndef extract_index_list(l1: List[int], l2: List[int], l3: List[int]) -> List[Any]:\n \"\"\"\n\tWe say that an element is common for lists l1, l2, l3 if it appears in all three lists under the same index. Write a function to find common elements from three lists. The function should return a list.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_754_extract_index_list.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "extract_index_list", "test": "def check(candidate):\n assert candidate([1, 1, 3, 4, 5, 6, 7], [0, 1, 2, 3, 4, 5, 7], [0, 1, 2, 3, 4, 5, 7]) == [1, 7]\n assert candidate([1, 1, 3, 4, 5, 6, 7], [0, 1, 2, 3, 4, 6, 5], [0, 1, 2, 3, 4, 6, 7]) == [1, 6]\n assert candidate([1, 1, 3, 4, 6, 5, 6], [0, 1, 2, 3, 4, 5, 7], [0, 1, 2, 3, 4, 5, 7]) == [1, 5]\n assert candidate([1, 2, 3, 4, 6, 6, 6], [0, 1, 2, 3, 4, 5, 7], [0, 1, 2, 3, 4, 5, 7]) == []\n\ndef test_check():\n check(extract_index_list)\n\ntest_check()\n", "solution": "from typing import List, Any\n\ndef extract_index_list(l1: List[int], l2: List[int], l3: List[int]) -> List[Any]:\n \"\"\"\n\tWe say that an element is common for lists l1, l2, l3 if it appears in all three lists under the same index. Write a function to find common elements from three lists. The function should return a list.\n\t\"\"\"\n common_elements = []\n\n for i in range(min(len(l1), len(l2), len(l3))):\n if l1[i] == l2[i] == l3[i]:\n common_elements.append(l1[i])\n\n return common_elements", "is_solved": true}
|
||||
{"name": "mbpp_56_checks", "language": "py", "prompt": "def checks(n: int) -> bool:\n \"\"\"\n\tWrite a python function to check if a given number is one less than twice its reverse.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_56_checks.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "checks", "test": "def check(candidate):\n assert candidate(70) == False\n assert candidate(23) == False\n assert candidate(73) == True\n\ndef test_check():\n check(checks)\n\ntest_check()\n", "solution": "def checks(n: int) -> bool:\n \"\"\"\n\tWrite a python function to check if a given number is one less than twice its reverse.\n\t\"\"\"\n # Reverse the given number\n reversed_n = int(str(n)[::-1])\n\n # Check if the given number is one less than twice its reverse\n return n == (2 * reversed_n) - 1", "is_solved": true}
|
||||
{"name": "mbpp_724_power_base_sum", "language": "py", "prompt": "def power_base_sum(base: int, power: int) -> int:\n \"\"\"\n\tWrite a function that takes base and power as arguments and calculate the sum of all digits of the base to the specified power.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_724_power_base_sum.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "power_base_sum", "test": "def check(candidate):\n assert candidate(2, 100) == 115\n assert candidate(8, 10) == 37\n assert candidate(8, 15) == 62\n assert candidate(3, 3) == 9\n\ndef test_check():\n check(power_base_sum)\n\ntest_check()\n", "solution": "def power_base_sum(base: int, power: int) -> int:\n \"\"\"\n\tWrite a function that takes base and power as arguments and calculate the sum of all digits of the base to the specified power.\n\t\"\"\"\n result = base ** power\n return sum(int(digit) for digit in str(result))", "is_solved": false}
|
||||
{"name": "mbpp_268_find_star_num", "language": "py", "prompt": "def find_star_num(n: int) -> int:\n \"\"\"\n\tWrite a function to find the n'th star number.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_268_find_star_num.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "find_star_num", "test": "def check(candidate):\n assert candidate(3) == 37\n assert candidate(4) == 73\n assert candidate(5) == 121\n\ndef test_check():\n check(find_star_num)\n\ntest_check()\n", "solution": "def find_star_num(n: int) -> int:\n \"\"\"\n\tWrite a function to find the n'th star number.\n\t\"\"\"\n if n < 1:\n return None\n\n return n * (6 * (n - 1) + 1)", "is_solved": false}
|
||||
{"name": "mbpp_251_insert_element", "language": "py", "prompt": "from typing import List\n\ndef insert_element(list: List[str], element: str) -> List[str]:\n \"\"\"\n\tWrite 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.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_251_insert_element.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "insert_element", "test": "def check(candidate):\n assert candidate(['Red', 'Green', 'Black'], 'c') == ['c', 'Red', 'c', 'Green', 'c', 'Black']\n assert candidate(['python', 'java'], 'program') == ['program', 'python', 'program', 'java']\n assert candidate(['happy', 'sad'], 'laugh') == ['laugh', 'happy', 'laugh', 'sad']\n\ndef test_check():\n check(insert_element)\n\ntest_check()\n", "solution": "from typing import List\n\ndef insert_element(list: List[str], element: str) -> List[str]:\n \"\"\"\n\tWrite 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.\n\t\"\"\"\n result = []\n for item in list:\n result.append(element)\n result.append(item)\n return result", "is_solved": true}
|
||||
{"name": "mbpp_428_shell_sort", "language": "py", "prompt": "from typing import List\n\ndef shell_sort(my_list: List[int]) -> List[int]:\n \"\"\"\n\tWrite a function to sort the given array by using shell sort.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_428_shell_sort.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "shell_sort", "test": "def check(candidate):\n assert candidate([12, 23, 4, 5, 3, 2, 12, 81, 56, 95]) == [2, 3, 4, 5, 12, 12, 23, 56, 81, 95]\n assert candidate([24, 22, 39, 34, 87, 73, 68]) == [22, 24, 34, 39, 68, 73, 87]\n assert candidate([32, 30, 16, 96, 82, 83, 74]) == [16, 30, 32, 74, 82, 83, 96]\n\ndef test_check():\n check(shell_sort)\n\ntest_check()\n", "solution": "from typing import List\n\ndef shell_sort(my_list: List[int]) -> List[int]:\n \"\"\"\n\tWrite a function to sort the given array by using shell sort.\n\t\"\"\"\n n = len(my_list)\n gap = n // 2\n\n while gap > 0:\n for i in range(gap, n):\n temp = my_list[i]\n j = i\n while j >= gap and my_list[j - gap] > temp:\n my_list[j] = my_list[j - gap]\n j -= gap\n my_list[j] = temp\n gap //= 2\n\n return my_list", "is_solved": true}
|
||||
{"name": "mbpp_476_big_sum", "language": "py", "prompt": "from typing import List\n\ndef big_sum(nums: List[int]) -> int:\n \"\"\"\n\tWrite a python function to find the sum of the largest and smallest value in a given array.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_476_big_sum.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "big_sum", "test": "def check(candidate):\n assert candidate([1, 2, 3]) == 4\n assert candidate([-1, 2, 3, 4]) == 3\n assert candidate([2, 3, 6]) == 8\n\ndef test_check():\n check(big_sum)\n\ntest_check()\n", "solution": "from typing import List\n\ndef big_sum(nums: List[int]) -> int:\n \"\"\"\n\tWrite a python function to find the sum of the largest and smallest value in a given array.\n\t\"\"\"\n if not nums:\n return 0\n\n min_num = min(nums)\n max_num = max(nums)\n\n return min_num + max_num", "is_solved": true}
|
||||
{"name": "mbpp_465_drop_empty", "language": "py", "prompt": "from typing import Dict, Optional\n\ndef drop_empty(dict1: Dict[str, Optional[str]]) -> Dict[str, str]:\n \"\"\"\n\tWrite a function to drop empty items from a given dictionary.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_465_drop_empty.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "drop_empty", "test": "def check(candidate):\n assert candidate({ 'c1': 'Red', 'c2': 'Green', 'c3': None }) == { 'c1': 'Red', 'c2': 'Green' }\n assert candidate({ 'c1': 'Red', 'c2': None, 'c3': None }) == { 'c1': 'Red' }\n assert candidate({ 'c1': None, 'c2': 'Green', 'c3': None }) == { 'c2': 'Green' }\n\ndef test_check():\n check(drop_empty)\n\ntest_check()\n", "solution": "from typing import Dict, Optional\n\ndef drop_empty(dict1: Dict[str, Optional[str]]) -> Dict[str, str]:\n \"\"\"\n\tWrite a function to drop empty items from a given dictionary.\n\t\"\"\"\n result = {}\n for key, value in dict1.items():\n if value is not None and value != \"\":\n result[key] = value\n return result", "is_solved": true}
|
||||
{"name": "mbpp_454_text_match_wordz", "language": "py", "prompt": "def text_match_wordz(text: str) -> bool:\n \"\"\"\n\tWrite a function that matches a word containing 'z'.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_454_text_match_wordz.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "text_match_wordz", "test": "def check(candidate):\n assert candidate('pythonz.') == True\n assert candidate('xyz.') == True\n assert candidate(' lang .') == False\n\ndef test_check():\n check(text_match_wordz)\n\ntest_check()\n", "solution": "def text_match_wordz(text: str) -> bool:\n \"\"\"\n\tWrite a function that matches a word containing 'z'.\n\t\"\"\"\n return 'z' in text.lower()", "is_solved": true}
|
||||
{"name": "mbpp_605_prime_num", "language": "py", "prompt": "def prime_num(num: int) -> bool:\n \"\"\"\n\tWrite a function to check if the given integer is a prime number.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_605_prime_num.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "prime_num", "test": "def check(candidate):\n assert candidate(13) == True\n assert candidate(7) == True\n assert candidate(-1010) == False\n\ndef test_check():\n check(prime_num)\n\ntest_check()\n", "solution": "def prime_num(num: int) -> bool:\n \"\"\"\n\tWrite a function to check if the given integer is a prime number.\n\t\"\"\"\n if num <= 1:\n return False\n for i in range(2, num):\n if num % i == 0:\n return False\n return True", "is_solved": true}
|
||||
{"name": "mbpp_108_merge_sorted_list", "language": "py", "prompt": "from typing import List\n\ndef merge_sorted_list(num1: List[int], num2: List[int], num3: List[int]) -> List[int]:\n \"\"\"\n\tWrite a function to merge three lists into a single sorted list.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_108_merge_sorted_list.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "merge_sorted_list", "test": "def check(candidate):\n assert candidate([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]\n assert candidate([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 assert candidate([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]\n\ndef test_check():\n check(merge_sorted_list)\n\ntest_check()\n", "solution": "from typing import List\n\ndef merge_sorted_list(num1: List[int], num2: List[int], num3: List[int]) -> List[int]:\n \"\"\"\n\tWrite a function to merge three lists into a single sorted list.\n\t\"\"\"\n merged_list = num1 + num2 + num3\n merged_list.sort()\n return merged_list", "is_solved": true}
|
||||
{"name": "mbpp_639_sample_nam", "language": "py", "prompt": "from typing import List\n\ndef sample_nam(sample_names: List[str]) -> int:\n \"\"\"\n\tWrite a function to sum the length of the names of a given list of names after removing the names that start with a lowercase letter.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_639_sample_nam.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "sample_nam", "test": "def check(candidate):\n assert candidate(['sally', 'Dylan', 'rebecca', 'Diana', 'Joanne', 'keith']) == 16\n assert candidate(['php', 'res', 'Python', 'abcd', 'Java', 'aaa']) == 10\n assert candidate(['abcd', 'Python', 'abba', 'aba']) == 6\n\ndef test_check():\n check(sample_nam)\n\ntest_check()\n", "solution": "from typing import List\n\ndef sample_nam(sample_names: List[str]) -> int:\n \"\"\"\n\tWrite a function to sum the length of the names of a given list of names after removing the names that start with a lowercase letter.\n\t\"\"\"\n total_length = 0\n\n for name in sample_names:\n if name and name[0].isupper():\n total_length += len(name)\n\n return total_length", "is_solved": true}
|
||||
{"name": "mbpp_409_min_product_tuple", "language": "py", "prompt": "from typing import List, Tuple\n\ndef min_product_tuple(list1: List[Tuple[int, int]]) -> int:\n \"\"\"\n\tWrite a function to find the minimum product from the pairs of tuples within a given list.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_409_min_product_tuple.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "min_product_tuple", "test": "def check(candidate):\n assert candidate([(2, 7), (2, 6), (1, 8), (4, 9)]) == 8\n assert candidate([(10, 20), (15, 2), (5, 10)]) == 30\n assert candidate([(11, 44), (10, 15), (20, 5), (12, 9)]) == 100\n\ndef test_check():\n check(min_product_tuple)\n\ntest_check()\n", "solution": "from typing import List, Tuple\n\ndef min_product_tuple(list1: List[Tuple[int, int]]) -> int:\n \"\"\"\n\tWrite a function to find the minimum product from the pairs of tuples within a given list.\n\t\"\"\"\n min_product = float('inf')\n\n for pair in list1:\n product = pair[0] * pair[1]\n if product < min_product:\n min_product = product\n\n return min_product", "is_solved": true}
|
||||
{"name": "mbpp_791_remove_nested", "language": "py", "prompt": "from typing import Any, Tuple\n\ndef remove_nested(test_tup: Any) -> Tuple[int, int, int, int]:\n \"\"\"\n\tWrite a function to remove tuples from the given tuple.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_791_remove_nested.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "remove_nested", "test": "def check(candidate):\n assert candidate((1, 5, 7, (4, 6), 10)) == (1, 5, 7, 10)\n assert candidate((2, 6, 8, (5, 7), 11)) == (2, 6, 8, 11)\n assert candidate((3, 7, 9, (6, 8), 12)) == (3, 7, 9, 12)\n assert candidate((3, 7, 9, (6, 8), (5, 12), 12)) == (3, 7, 9, 12)\n\ndef test_check():\n check(remove_nested)\n\ntest_check()\n", "solution": "from typing import Any, Tuple\n\ndef remove_nested(test_tup: Any) -> Tuple[int, int, int, int]:\n \"\"\"\n\tWrite a function to remove tuples from the given tuple.\n\t\"\"\"\n flat_tup = ()\n for item in test_tup:\n if not isinstance(item, tuple):\n flat_tup += (item,)\n return flat_tup", "is_solved": true}
|
||||
{"name": "mbpp_591_swap_List", "language": "py", "prompt": "from typing import List\n\ndef swap_List(newList: List[int]) -> List[int]:\n \"\"\"\n\tWrite a python function to interchange the first and last elements in a list.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_591_swap_List.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "swap_List", "test": "def check(candidate):\n assert candidate([12, 35, 9, 56, 24]) == [24, 35, 9, 56, 12]\n assert candidate([1, 2, 3]) == [3, 2, 1]\n assert candidate([4, 5, 6]) == [6, 5, 4]\n\ndef test_check():\n check(swap_List)\n\ntest_check()\n", "solution": "from typing import List\n\ndef swap_List(newList: List[int]) -> List[int]:\n \"\"\"\n\tWrite a python function to interchange the first and last elements in a list.\n\t\"\"\"\n if len(newList) == 0:\n return newList\n\n newList[0], newList[-1] = newList[-1], newList[0]\n return newList", "is_solved": true}
|
||||
{"name": "mbpp_419_round_and_sum", "language": "py", "prompt": "from typing import List, Union\n\ndef round_and_sum(list1: List[Union[float, int]]) -> int:\n \"\"\"\n\tWrite a function to round every number of a given list of numbers and print the total sum multiplied by the length of the list.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_419_round_and_sum.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "round_and_sum", "test": "def check(candidate):\n assert candidate([22.4, 4.0, -16.22, -9.1, 11.0, -12.22, 14.2, -5.2, 17.5]) == 243\n assert candidate([5, 2, 9, 24.3, 29]) == 345\n assert candidate([25.0, 56.7, 89.2]) == 513\n\ndef test_check():\n check(round_and_sum)\n\ntest_check()\n", "solution": "from typing import List, Union\n\ndef round_and_sum(list1: List[Union[float, int]]) -> int:\n \"\"\"\n\tWrite a function to round every number of a given list of numbers and print the total sum multiplied by the length of the list.\n\t\"\"\"\n rounded_list = [round(num) for num in list1]\n total_sum = sum(rounded_list)\n result = total_sum * len(list1)\n return result", "is_solved": false}
|
||||
{"name": "mbpp_84_sequence", "language": "py", "prompt": "def sequence(n: int) -> int:\n \"\"\"\n\tWrite a function to find the nth number in the newman conway sequence.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_84_sequence.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "sequence", "test": "def check(candidate):\n assert candidate(10) == 6\n assert candidate(2) == 1\n assert candidate(3) == 2\n\ndef test_check():\n check(sequence)\n\ntest_check()\n", "solution": "def sequence(n: int) -> int:\n \"\"\"\n\tWrite a function to find the nth number in the newman conway sequence.\n\t\"\"\"\n if n == 1 or n == 2:\n return 1\n\n seq = [0] * (n + 1)\n seq[1] = 1\n seq[2] = 1\n\n for i in range(3, n + 1):\n seq[i] = seq[seq[i - 1]] + seq[i - seq[i - 1]]\n\n return seq[n]", "is_solved": true}
|
||||
{"name": "mbpp_260_newman_prime", "language": "py", "prompt": "def newman_prime(n: int) -> int:\n \"\"\"\n\tWrite a function to find the nth newman–shanks–williams prime number.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_260_newman_prime.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "newman_prime", "test": "def check(candidate):\n assert candidate(3) == 7\n assert candidate(4) == 17\n assert candidate(5) == 41\n\ndef test_check():\n check(newman_prime)\n\ntest_check()\n", "solution": "def newman_prime(n: int) -> int:\n \"\"\"\n\tWrite a function to find the nth newman–shanks–williams prime number.\n\t\"\"\"\n if n < 0:\n raise ValueError(\"n must be a non-negative integer\")\n\n if n == 0:\n return 1\n\n if n == 1:\n return 1\n\n a, b = 1, 1\n for _ in range(2, n + 1):\n a, b = b, 2 * b + a\n\n return b", "is_solved": true}
|
||||
{"name": "mbpp_418_Find_Max", "language": "py", "prompt": "from typing import List, Any\n\ndef Find_Max(lst: List[List[Any]]) -> List[Any]:\n \"\"\"\n\tWrite a python function to find the element of a list having maximum length.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_418_Find_Max.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "Find_Max", "test": "def check(candidate):\n assert candidate([['A'], ['A', 'B'], ['A', 'B', 'C']]) == ['A', 'B', 'C']\n assert candidate([[1], [1, 2], [1, 2, 3]]) == [1, 2, 3]\n assert candidate([[1, 1], [1, 2, 3], [1, 5, 6, 1]]) == [1, 5, 6, 1]\n\ndef test_check():\n check(Find_Max)\n\ntest_check()\n", "solution": "from typing import List, Any\n\ndef Find_Max(lst: List[List[Any]]) -> List[Any]:\n \"\"\"\n\tWrite a python function to find the element of a list having maximum length.\n\t\"\"\"\n max_length = 0\n max_element = None\n\n for element in lst:\n if len(element) > max_length:\n max_length = len(element)\n max_element = element\n\n return max_element", "is_solved": true}
|
||||
{"name": "mbpp_565_split", "language": "py", "prompt": "from typing import List\n\ndef split(word: str) -> List[str]:\n \"\"\"\n\tWrite a python function to split a string into characters.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_565_split.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "split", "test": "def check(candidate):\n assert candidate('python') == ['p', 'y', 't', 'h', 'o', 'n']\n assert candidate('Name') == ['N', 'a', 'm', 'e']\n assert candidate('program') == ['p', 'r', 'o', 'g', 'r', 'a', 'm']\n\ndef test_check():\n check(split)\n\ntest_check()\n", "solution": "from typing import List\n\ndef split(word: str) -> List[str]:\n \"\"\"\n\tWrite a python function to split a string into characters.\n\t\"\"\"\n return [char for char in word]", "is_solved": true}
|
||||
{"name": "mbpp_778_pack_consecutive_duplicates", "language": "py", "prompt": "from typing import List, Any\n\ndef pack_consecutive_duplicates(list1: List[Any]) -> List[List[Any]]:\n \"\"\"\n\tWrite a function to pack consecutive duplicates of a given list elements into sublists.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_778_pack_consecutive_duplicates.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "pack_consecutive_duplicates", "test": "def check(candidate):\n assert candidate([0, 0, 1, 2, 3, 4, 4, 5, 6, 6, 6, 7, 8, 9, 4, 4]) == [[0, 0], [1], [2], [3], [4, 4], [5], [6, 6, 6], [7], [8], [9], [4, 4]]\n assert candidate([10, 10, 15, 19, 18, 18, 17, 26, 26, 17, 18, 10]) == [[10, 10], [15], [19], [18, 18], [17], [26, 26], [17], [18], [10]]\n assert candidate(['a', 'a', 'b', 'c', 'd', 'd']) == [['a', 'a'], ['b'], ['c'], ['d', 'd']]\n\ndef test_check():\n check(pack_consecutive_duplicates)\n\ntest_check()\n", "solution": "from typing import List, Any\n\ndef pack_consecutive_duplicates(list1: List[Any]) -> List[List[Any]]:\n \"\"\"\n\tWrite a function to pack consecutive duplicates of a given list elements into sublists.\n\t\"\"\"\n if not list1:\n return []\n\n packed_list = []\n current_sublist = [list1[0]]\n\n for element in list1[1:]:\n if element == current_sublist[-1]:\n current_sublist.append(element)\n else:\n packed_list.append(current_sublist)\n current_sublist = [element]\n\n packed_list.append(current_sublist)\n return packed_list", "is_solved": true}
|
||||
{"name": "mbpp_753_min_k", "language": "py", "prompt": "from typing import List, Tuple\n\ndef min_k(test_list: List[Tuple[str, int]], K: int) -> List[Tuple[str, int]]:\n \"\"\"\n\tWrite a function to find minimum k records from tuple list. https://www.geeksforgeeks.org/python-find-minimum-k-records-from-tuple-list/ - in this case a verbatim copy of test cases\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_753_min_k.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "min_k", "test": "def check(candidate):\n assert candidate([('Manjeet', 10), ('Akshat', 4), ('Akash', 2), ('Nikhil', 8)], 2) == [('Akash', 2), ('Akshat', 4)]\n assert candidate([('Sanjeev', 11), ('Angat', 5), ('Akash', 3), ('Nepin', 9)], 3) == [('Akash', 3), ('Angat', 5), ('Nepin', 9)]\n assert candidate([('tanmay', 14), ('Amer', 11), ('Ayesha', 9), ('SKD', 16)], 1) == [('Ayesha', 9)]\n\ndef test_check():\n check(min_k)\n\ntest_check()\n", "solution": "from typing import List, Tuple\n\ndef min_k(test_list: List[Tuple[str, int]], K: int) -> List[Tuple[str, int]]:\n \"\"\"\n\tWrite a function to find minimum k records from tuple list. https://www.geeksforgeeks.org/python-find-minimum-k-records-from-tuple-list/ - in this case a verbatim copy of test cases\n\t\"\"\"\n if K > len(test_list):\n K = len(test_list)\n\n sorted_list = sorted(test_list, key=lambda x: x[1])\n return sorted_list[:K]", "is_solved": true}
|
||||
{"name": "mbpp_113_check_integer", "language": "py", "prompt": "def check_integer(text: str) -> bool:\n \"\"\"\n\tWrite a function to check if a string represents an integer or not.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_113_check_integer.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "check_integer", "test": "def check(candidate):\n assert candidate('python') == False\n assert candidate('1') == True\n assert candidate('12345') == True\n\ndef test_check():\n check(check_integer)\n\ntest_check()\n", "solution": "def check_integer(text: str) -> bool:\n \"\"\"\n\tWrite a function to check if a string represents an integer or not.\n\t\"\"\"\n if text.startswith('-'):\n text = text[1:]\n\n return text.isdigit()", "is_solved": true}
|
||||
{"name": "mbpp_743_rotate_right", "language": "py", "prompt": "from typing import List\n\ndef rotate_right(list: List[int], m: int) -> List[int]:\n \"\"\"\n\tWrite a function to rotate a given list by specified number of items to the right direction. https://www.geeksforgeeks.org/python-program-right-rotate-list-n/\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_743_rotate_right.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "rotate_right", "test": "def check(candidate):\n assert candidate([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 3) == [8, 9, 10, 1, 2, 3, 4, 5, 6, 7]\n assert candidate([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 2) == [9, 10, 1, 2, 3, 4, 5, 6, 7, 8]\n assert candidate([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 5) == [6, 7, 8, 9, 10, 1, 2, 3, 4, 5]\n\ndef test_check():\n check(rotate_right)\n\ntest_check()\n", "solution": "from typing import List\n\ndef rotate_right(list: List[int], m: int) -> List[int]:\n \"\"\"\n\tWrite a function to rotate a given list by specified number of items to the right direction. https://www.geeksforgeeks.org/python-program-right-rotate-list-n/\n\t\"\"\"\n n = len(list)\n m = m % n\n return list[-m:] + list[:-m]", "is_solved": true}
|
||||
{"name": "mbpp_598_armstrong_number", "language": "py", "prompt": "def armstrong_number(number: int) -> bool:\n \"\"\"\n\tWrite a function to check whether the given number is armstrong or not.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_598_armstrong_number.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "armstrong_number", "test": "def check(candidate):\n assert candidate(153) == True\n assert candidate(259) == False\n assert candidate(4458) == False\n\ndef test_check():\n check(armstrong_number)\n\ntest_check()\n", "solution": "def armstrong_number(number: int) -> bool:\n \"\"\"\n\tWrite a function to check whether the given number is armstrong or not.\n\t\"\"\"\n num_str = str(number)\n num_digits = len(num_str)\n armstrong_sum = sum(int(digit) ** num_digits for digit in num_str)\n\n return armstrong_sum == number", "is_solved": false}
|
||||
{"name": "mbpp_398_sum_of_digits", "language": "py", "prompt": "from typing import List, Any\n\ndef sum_of_digits(nums: List[Any]) -> int:\n \"\"\"\n\tWrite a function to compute the sum of digits of each number of a given list.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_398_sum_of_digits.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "sum_of_digits", "test": "def check(candidate):\n assert candidate([10, 2, 56]) == 14\n assert candidate([[10, 20, 4, 5, 'b', 70, 'a']]) == 19\n assert candidate([10, 20, -4, 5, -70]) == 19\n\ndef test_check():\n check(sum_of_digits)\n\ntest_check()\n", "solution": "from typing import List, Any\n\ndef sum_of_digits(nums: List[Any]) -> int:\n \"\"\"\n\tWrite a function to compute the sum of digits of each number of a given list.\n\t\"\"\"\n total_sum = 0\n for num in nums:\n if isinstance(num, int):\n num_str = str(abs(num))\n for digit in num_str:\n total_sum += int(digit)\n return total_sum", "is_solved": false}
|
||||
{"name": "mbpp_229_re_arrange_array", "language": "py", "prompt": "from typing import List\n\ndef re_arrange_array(arr: List[int], n: int) -> List[int]:\n \"\"\"\n\tWrite 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.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_229_re_arrange_array.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "re_arrange_array", "test": "def check(candidate):\n assert candidate([-1, 2, -3, 4, 5, 6, -7, 8, 9], 9) == [-1, -3, -7, 4, 5, 6, 2, 8, 9]\n assert candidate([12, -14, -26, 13, 15], 5) == [-14, -26, 12, 13, 15]\n assert candidate([10, 24, 36, -42, -39, -78, 85], 7) == [-42, -39, -78, 10, 24, 36, 85]\n\ndef test_check():\n check(re_arrange_array)\n\ntest_check()\n", "solution": "from typing import List\n\ndef re_arrange_array(arr: List[int], n: int) -> List[int]:\n \"\"\"\n\tWrite 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.\n\t\"\"\"\n neg = []\n pos = []\n\n for i in range(n):\n if arr[i] < 0:\n neg.append(arr[i])\n else:\n pos.append(arr[i])\n\n return neg + pos", "is_solved": false}
|
||||
{"name": "mbpp_638_wind_chill", "language": "py", "prompt": "def wind_chill(v: int, t: int) -> int:\n \"\"\"\n\tWrite a function to calculate the wind chill index rounded to the next integer given the wind velocity in km/h and a temperature in celsius.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_638_wind_chill.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "wind_chill", "test": "def check(candidate):\n assert candidate(120, 35) == 40\n assert candidate(40, 20) == 19\n assert candidate(10, 8) == 6\n\ndef test_check():\n check(wind_chill)\n\ntest_check()\n", "solution": "def wind_chill(v: int, t: int) -> int:\n \"\"\"\n\tWrite a function to calculate the wind chill index rounded to the next integer given the wind velocity in km/h and a temperature in celsius.\n\t\"\"\"\n wind_chill_index = 13.12 + 0.6215 * t - 11.37 * (v ** 0.16) + 0.3965 * t * (v ** 0.16)\n return round(wind_chill_index)", "is_solved": true}
|
||||
{"name": "mbpp_608_bell_Number", "language": "py", "prompt": "def bell_Number(n: int) -> int:\n \"\"\"\n\tWrite a python function to find nth bell number.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_608_bell_Number.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "bell_Number", "test": "def check(candidate):\n assert candidate(2) == 2\n assert candidate(3) == 5\n assert candidate(4) == 15\n\ndef test_check():\n check(bell_Number)\n\ntest_check()\n", "solution": "def bell_Number(n: int) -> int:\n \"\"\"\n\tWrite a python function to find nth bell number.\n\t\"\"\"\n def bell_number_helper(n, k, memo):\n if n == 0 or k == 0 or n < k:\n return 0\n if k == 1 or n == k:\n return 1\n if memo[n][k] != -1:\n return memo[n][k]\n\n memo[n][k] = bell_number_helper(n - 1, k - 1, memo) + k * bell_number_helper(n - 1, k, memo)\n return memo[n][k]\n\n memo = [[-1 for _ in range(n + 1)] for _ in range(n + 1)]\n return bell_number_helper(n, n, memo)", "is_solved": false}
|
||||
{"name": "mbpp_295_sum_div", "language": "py", "prompt": "def sum_div(number: int) -> int:\n \"\"\"\n\tWrite a function to return the sum of all divisors of a number.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_295_sum_div.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "sum_div", "test": "def check(candidate):\n assert candidate(8) == 7\n assert candidate(12) == 16\n assert candidate(7) == 1\n\ndef test_check():\n check(sum_div)\n\ntest_check()\n", "solution": "def sum_div(number: int) -> int:\n \"\"\"\n\tWrite a function to return the sum of all divisors of a number.\n\t\"\"\"\n divisors = [i for i in range(1, number + 1) if number % i == 0]\n return sum(divisors)", "is_solved": false}
|
||||
{"name": "mbpp_630_get_coordinates", "language": "py", "prompt": "from typing import Tuple, List\n\ndef get_coordinates(test_tup: Tuple[int, int]) -> List[List[int]]:\n \"\"\"\n\tWrite a function to extract all the adjacent coordinates of the given coordinate tuple.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_630_get_coordinates.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "get_coordinates", "test": "def check(candidate):\n assert candidate((3, 4)) == [[2, 3], [2, 4], [2, 5], [3, 3], [3, 4], [3, 5], [4, 3], [4, 4], [4, 5]]\n assert candidate((4, 5)) == [[3, 4], [3, 5], [3, 6], [4, 4], [4, 5], [4, 6], [5, 4], [5, 5], [5, 6]]\n assert candidate((5, 6)) == [[4, 5], [4, 6], [4, 7], [5, 5], [5, 6], [5, 7], [6, 5], [6, 6], [6, 7]]\n\ndef test_check():\n check(get_coordinates)\n\ntest_check()\n", "solution": "from typing import Tuple, List\n\ndef get_coordinates(test_tup: Tuple[int, int]) -> List[List[int]]:\n \"\"\"\n\tWrite a function to extract all the adjacent coordinates of the given coordinate tuple.\n\t\"\"\"\n adjacent_coordinates = []\n\n for i in range(-1, 2):\n for j in range(-1, 2):\n if i == 0 and j == 0:\n continue\n adjacent_coordinates.append([test_tup[0] + i, test_tup[1] + j])\n\n return adjacent_coordinates", "is_solved": false}
|
||||
{"name": "mbpp_579_find_dissimilar", "language": "py", "prompt": "from typing import Tuple\n\ndef find_dissimilar(test_tup1: Tuple[int, int, int, int], test_tup2: Tuple[int, int, int, int]) -> Tuple[int, int, int, int]:\n \"\"\"\n\tWrite a function to find the dissimilar elements in the given two tuples.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_579_find_dissimilar.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "find_dissimilar", "test": "def check(candidate):\n assert candidate((3, 4, 5, 6), (5, 7, 4, 10)) == (3, 6, 7, 10)\n assert candidate((1, 2, 3, 4), (7, 2, 3, 9)) == (1, 4, 7, 9)\n assert candidate((21, 11, 25, 26), (26, 34, 21, 36)) == (34, 36, 11, 25)\n\ndef test_check():\n check(find_dissimilar)\n\ntest_check()\n", "solution": "from typing import Tuple\n\ndef find_dissimilar(test_tup1: Tuple[int, int, int, int], test_tup2: Tuple[int, int, int, int]) -> Tuple[int, int, int, int]:\n \"\"\"\n\tWrite a function to find the dissimilar elements in the given two tuples.\n\t\"\"\"\n dissimilar_elements = tuple(set(test_tup1).symmetric_difference(set(test_tup2)))\n return dissimilar_elements", "is_solved": true}
|
||||
{"name": "mbpp_125_find_length", "language": "py", "prompt": "def find_length(string: str) -> int:\n \"\"\"\n\tWrite 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.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_125_find_length.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "find_length", "test": "def check(candidate):\n assert candidate('11000010001') == 6\n assert candidate('10111') == 1\n assert candidate('11011101100101') == 2\n\ndef test_check():\n check(find_length)\n\ntest_check()\n", "solution": "def find_length(string: str) -> int:\n \"\"\"\n\tWrite 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.\n\t\"\"\"\n max_diff = 0\n for i in range(len(string)):\n count_0 = 0\n count_1 = 0\n for j in range(i, len(string)):\n if string[j] == '0':\n count_0 += 1\n else:\n count_1 += 1\n max_diff = max(max_diff, abs(count_0 - count_1))\n return max_diff", "is_solved": false}
|
||||
{"name": "mbpp_262_split_two_parts", "language": "py", "prompt": "from typing import List, Any\n\ndef split_two_parts(list1: List[Any], L: int) -> Any:\n \"\"\"\n\tWrite a function that takes in a list and an integer L and splits the given list into two parts where the length of the first part of the list is L, and returns the resulting lists in a tuple.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_262_split_two_parts.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "split_two_parts", "test": "def check(candidate):\n assert candidate([1, 1, 2, 3, 4, 4, 5, 1], 3) == ([1, 1, 2], [3, 4, 4, 5, 1])\n assert candidate(['a', 'b', 'c', 'd'], 2) == (['a', 'b'], ['c', 'd'])\n assert candidate(['p', 'y', 't', 'h', 'o', 'n'], 4) == (['p', 'y', 't', 'h'], ['o', 'n'])\n\ndef test_check():\n check(split_two_parts)\n\ntest_check()\n", "solution": "from typing import List, Any\n\ndef split_two_parts(list1: List[Any], L: int) -> Any:\n \"\"\"\n\tWrite a function that takes in a list and an integer L and splits the given list into two parts where the length of the first part of the list is L, and returns the resulting lists in a tuple.\n\t\"\"\"\n first_part = list1[:L]\n second_part = list1[L:]\n return (first_part, second_part)", "is_solved": true}
|
||||
{"name": "mbpp_771_check_expression", "language": "py", "prompt": "def check_expression(exp: str) -> bool:\n \"\"\"\n\tWrite a function to check if the given expression is balanced or not. https://www.geeksforgeeks.org/check-for-balanced-parentheses-in-an-expression/\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_771_check_expression.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "check_expression", "test": "def check(candidate):\n assert candidate('{()}[{}]') == True\n assert candidate('{()}[{]') == False\n assert candidate('{()}[{}][]({})') == True\n\ndef test_check():\n check(check_expression)\n\ntest_check()\n", "solution": "def check_expression(exp: str) -> bool:\n \"\"\"\n\tWrite a function to check if the given expression is balanced or not. https://www.geeksforgeeks.org/check-for-balanced-parentheses-in-an-expression/\n\t\"\"\"\n stack = []\n\n # Iterate through the expression\n for char in exp:\n if char in [\"(\", \"{\", \"[\"]:\n stack.append(char)\n elif char in [\")\", \"}\", \"]\"]:\n if not stack:\n return False\n top_element = stack.pop()\n if char == \")\" and top_element != \"(\":\n return False\n elif char == \"}\" and top_element != \"{\":\n return False\n elif char == \"]\" and top_element != \"[\":\n return False\n\n return len(stack) == 0", "is_solved": true}
|
||||
{"name": "mbpp_801_test_three_equal", "language": "py", "prompt": "def test_three_equal(x: int, y: int, z: int) -> int:\n \"\"\"\n\tWrite a python function to count the number of equal numbers from three given integers.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_801_test_three_equal.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "test_three_equal", "test": "def check(candidate):\n assert candidate(1, 1, 1) == 3\n assert candidate(-1, -2, -3) == 0\n assert candidate(1, 2, 2) == 2\n\ndef test_check():\n check(test_three_equal)\n\ntest_check()\n", "solution": "def test_three_equal(x: int, y: int, z: int) -> int:\n \"\"\"\n\tWrite a python function to count the number of equal numbers from three given integers.\n\t\"\"\"\n count = 0\n\n if x == y:\n count += 1\n if x == z:\n count += 1\n if y == z:\n count += 1\n\n if count == 1:\n return 2\n elif count == 3:\n return 3\n else:\n return 0", "is_solved": true}
|
||||
{"name": "mbpp_389_find_lucas", "language": "py", "prompt": "def find_lucas(n: int) -> int:\n \"\"\"\n\tWrite a function to find the n'th lucas number.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_389_find_lucas.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "find_lucas", "test": "def check(candidate):\n assert candidate(9) == 76\n assert candidate(4) == 7\n assert candidate(3) == 4\n\ndef test_check():\n check(find_lucas)\n\ntest_check()\n", "solution": "def find_lucas(n: int) -> int:\n \"\"\"\n\tWrite a function to find the n'th lucas number.\n\t\"\"\"\n if n == 0:\n return 2\n elif n == 1:\n return 1\n else:\n lucas_n_minus_1 = 1\n lucas_n_minus_2 = 2\n for _ in range(2, n + 1):\n lucas_n = lucas_n_minus_1 + lucas_n_minus_2\n lucas_n_minus_2 = lucas_n_minus_1\n lucas_n_minus_1 = lucas_n\n return lucas_n", "is_solved": true}
|
||||
{"name": "mbpp_102_snake_to_camel", "language": "py", "prompt": "def snake_to_camel(word: str) -> str:\n \"\"\"\n\tWrite a function to convert a snake case string to camel case string.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_102_snake_to_camel.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "snake_to_camel", "test": "def check(candidate):\n assert candidate('python_program') == 'PythonProgram'\n assert candidate('python_language') == 'PythonLanguage'\n assert candidate('programming_language') == 'ProgrammingLanguage'\n\ndef test_check():\n check(snake_to_camel)\n\ntest_check()\n", "solution": "def snake_to_camel(word: str) -> str:\n \"\"\"\n\tWrite a function to convert a snake case string to camel case string.\n\t\"\"\"\n components = word.split('_')\n return components[0] + ''.join(x.title() for x in components[1:])", "is_solved": false}
|
||||
{"name": "mbpp_604_reverse_words", "language": "py", "prompt": "def reverse_words(s: str) -> str:\n \"\"\"\n\tWrite a function to reverse words seperated by spaces in a given string.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_604_reverse_words.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "reverse_words", "test": "def check(candidate):\n assert candidate('python program') == 'program python'\n assert candidate('java language') == 'language java'\n assert candidate('indian man') == 'man indian'\n\ndef test_check():\n check(reverse_words)\n\ntest_check()\n", "solution": "def reverse_words(s: str) -> str:\n \"\"\"\n\tWrite a function to reverse words seperated by spaces in a given string.\n\t\"\"\"\n words = s.split(\" \")\n reversed_words = [word[::-1] for word in words]\n return \" \".join(reversed_words)", "is_solved": false}
|
||||
{"name": "mbpp_624_is_upper", "language": "py", "prompt": "def is_upper(string: str) -> str:\n \"\"\"\n\tWrite a python function to convert a given string to uppercase.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_624_is_upper.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "is_upper", "test": "def check(candidate):\n assert candidate('person') == 'PERSON'\n assert candidate('final') == 'FINAL'\n assert candidate('Valid') == 'VALID'\n\ndef test_check():\n check(is_upper)\n\ntest_check()\n", "solution": "def is_upper(string: str) -> str:\n \"\"\"\n\tWrite a python function to convert a given string to uppercase.\n\t\"\"\"\n return string.upper()", "is_solved": true}
|
||||
{"name": "mbpp_558_digit_distance_nums", "language": "py", "prompt": "def digit_distance_nums(n1: int, n2: int) -> int:\n \"\"\"\n\tWrite a python function to find the sum of the per-digit difference between two integers.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_558_digit_distance_nums.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "digit_distance_nums", "test": "def check(candidate):\n assert candidate(1, 2) == 1\n assert candidate(23, 56) == 6\n assert candidate(123, 256) == 7\n\ndef test_check():\n check(digit_distance_nums)\n\ntest_check()\n", "solution": "def digit_distance_nums(n1: int, n2: int) -> int:\n \"\"\"\n\tWrite a python function to find the sum of the per-digit difference between two integers.\n\t\"\"\"\n # Convert the integers to strings to access individual digits\n n1_str = str(n1)\n n2_str = str(n2)\n\n # Ensure both numbers have the same number of digits\n if len(n1_str) != len(n2_str):\n raise ValueError(\"Both numbers must have the same number of digits\")\n\n # Calculate the sum of the per-digit differences\n digit_distance_sum = 0\n for i in range(len(n1_str)):\n digit_distance_sum += abs(int(n1_str[i]) - int(n2_str[i]))\n\n return digit_distance_sum", "is_solved": true}
|
||||
{"name": "mbpp_143_find_lists", "language": "py", "prompt": "from typing import List, Any\n\ndef find_lists(Input: List[Any]) -> int:\n \"\"\"\n\tWrite a function to find number of lists present in the given list.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_143_find_lists.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "find_lists", "test": "def check(candidate):\n assert candidate([[1, 2, 3, 4], [5, 6, 7, 8]]) == 2\n assert candidate([[1, 2], [3, 4], [5, 6]]) == 3\n assert candidate([9, 8, 7, 6, 5, 4, 3, 2, 1]) == 1\n\ndef test_check():\n check(find_lists)\n\ntest_check()\n", "solution": "from typing import List, Any\n\ndef find_lists(Input: List[Any]) -> int:\n \"\"\"\n\tWrite a function to find number of lists present in the given list.\n\t\"\"\"\n count = 0\n for item in Input:\n if isinstance(item, list):\n count += 1\n return count", "is_solved": false}
|
||||
{"name": "mbpp_615_average_tuple", "language": "py", "prompt": "from typing import List\n\ndef average_tuple(nums: List[List[int]]) -> List[float]:\n \"\"\"\n\tWrite a function which takes a lists of lists and returns the average value for each sublist as a list.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_615_average_tuple.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "average_tuple", "test": "def check(candidate):\n assert candidate([[10, 10, 10, 12], [30, 45, 56, 45], [81, 80, 39, 32], [1, 2, 3, 4]]) == [30.5, 34.25, 27.0, 23.25]\n assert candidate([[1, 1, -5], [30, -15, 56], [81, -60, -39], [-10, 2, 3]]) == [25.5, -18.0, 3.75]\n assert candidate([[100, 100, 100, 120], [300, 450, 560, 450], [810, 800, 390, 320], [10, 20, 30, 40]]) == [305.0, 342.5, 270.0, 232.5]\n\ndef test_check():\n check(average_tuple)\n\ntest_check()\n", "solution": "from typing import List\n\ndef average_tuple(nums: List[List[int]]) -> List[float]:\n \"\"\"\n\tWrite a function which takes a lists of lists and returns the average value for each sublist as a list.\n\t\"\"\"\n result = []\n for sublist in nums:\n total = sum(sublist)\n average = total / len(sublist)\n result.append(average)\n return result", "is_solved": false}
|
||||
{"name": "mbpp_166_find_even_pair", "language": "py", "prompt": "from typing import List\n\ndef find_even_pair(A: List[int]) -> int:\n \"\"\"\n\tWrite a function that counts the number of pairs of integers in a list that xor to an even number.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_166_find_even_pair.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "find_even_pair", "test": "def check(candidate):\n assert candidate([5, 4, 7, 2, 1]) == 4\n assert candidate([7, 2, 8, 1, 0, 5, 11]) == 9\n assert candidate([1, 2, 3]) == 1\n\ndef test_check():\n check(find_even_pair)\n\ntest_check()\n", "solution": "from typing import List\n\ndef find_even_pair(A: List[int]) -> int:\n \"\"\"\n\tWrite a function that counts the number of pairs of integers in a list that xor to an even number.\n\t\"\"\"\n count = 0\n for i in range(len(A)):\n for j in range(i+1, len(A)):\n if (A[i] ^ A[j]) % 2 == 0:\n count += 1\n return count", "is_solved": true}
|
||||
{"name": "mbpp_58_opposite_Signs", "language": "py", "prompt": "def opposite_Signs(x: int, y: int) -> bool:\n \"\"\"\n\tWrite a python function to check whether the given two integers have opposite sign or not.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_58_opposite_Signs.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "opposite_Signs", "test": "def check(candidate):\n assert candidate(1, -2) == True\n assert candidate(3, 2) == False\n assert candidate(-10, -10) == False\n assert candidate(-2, 2) == True\n\ndef test_check():\n check(opposite_Signs)\n\ntest_check()\n", "solution": "def opposite_Signs(x: int, y: int) -> bool:\n \"\"\"\n\tWrite a python function to check whether the given two integers have opposite sign or not.\n\t\"\"\"\n if x < 0 and y > 0:\n return True\n elif x > 0 and y < 0:\n return True\n else:\n return False", "is_solved": true}
|
||||
{"name": "mbpp_569_sort_sublists", "language": "py", "prompt": "from typing import List\n\ndef sort_sublists(list1: List[List[str]]) -> List[List[str]]:\n \"\"\"\n\tWrite a function to sort each sublist of strings in a given list of lists.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_569_sort_sublists.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "sort_sublists", "test": "def check(candidate):\n assert candidate([['green', 'orange'], ['black', 'white'], ['white', 'black', 'orange']]) == [['green', 'orange'], ['black', 'white'], ['black', 'orange', 'white']]\n assert candidate([['green', 'orange'], ['black'], ['green', 'orange'], ['white']]) == [['green', 'orange'], ['black'], ['green', 'orange'], ['white']]\n assert candidate([['a', 'b'], ['d', 'c'], ['g', 'h'], ['f', 'e']]) == [['a', 'b'], ['c', 'd'], ['g', 'h'], ['e', 'f']]\n\ndef test_check():\n check(sort_sublists)\n\ntest_check()\n", "solution": "from typing import List\n\ndef sort_sublists(list1: List[List[str]]) -> List[List[str]]:\n \"\"\"\n\tWrite a function to sort each sublist of strings in a given list of lists.\n\t\"\"\"\n sorted_list = []\n\n for sublist in list1:\n sorted_sublist = sorted(sublist)\n sorted_list.append(sorted_sublist)\n\n return sorted_list", "is_solved": true}
|
||||
{"name": "mbpp_255_combinations_colors", "language": "py", "prompt": "from typing import List\n\ndef combinations_colors(l: List[str], n: int) -> List[List[str]]:\n \"\"\"\n\tWrite 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 list for each combination.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_255_combinations_colors.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "combinations_colors", "test": "def check(candidate):\n assert candidate(['Red', 'Green', 'Blue'], 1) == [['Red'], ['Green'], ['Blue']]\n assert candidate(['Red', 'Green', 'Blue'], 2) == [['Red', 'Red'], ['Red', 'Green'], ['Red', 'Blue'], ['Green', 'Green'], ['Green', 'Blue'], ['Blue', 'Blue']]\n assert candidate(['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']]\n\ndef test_check():\n check(combinations_colors)\n\ntest_check()\n", "solution": "from typing import List\n\ndef combinations_colors(l: List[str], n: int) -> List[List[str]]:\n \"\"\"\n\tWrite 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 list for each combination.\n\t\"\"\"\n from itertools import product\n\n return [list(combination) for combination in product(l, repeat=n)]", "is_solved": false}
|
||||
{"name": "mbpp_619_move_num", "language": "py", "prompt": "def move_num(test_str: str) -> str:\n \"\"\"\n\tWrite a function to move all the numbers to the end of the given string.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_619_move_num.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "move_num", "test": "def check(candidate):\n assert candidate('I1love143you55three3000thousand') == 'Iloveyouthreethousand1143553000'\n assert candidate('Avengers124Assemble') == 'AvengersAssemble124'\n assert candidate('Its11our12path13to14see15things16do17things') == 'Itsourpathtoseethingsdothings11121314151617'\n\ndef test_check():\n check(move_num)\n\ntest_check()\n", "solution": "def move_num(test_str: str) -> str:\n \"\"\"\n\tWrite a function to move all the numbers to the end of the given string.\n\t\"\"\"\n num_str = \"\"\n non_num_str = \"\"\n\n for char in test_str:\n if char.isdigit():\n num_str += char\n else:\n non_num_str += char\n\n return non_num_str + num_str", "is_solved": true}
|
||||
{"name": "mbpp_249_intersection_array", "language": "py", "prompt": "from typing import List\n\ndef intersection_array(array_nums1: List[int], array_nums2: List[int]) -> List[int]:\n \"\"\"\n\tWrite a function to find the intersection of two arrays.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_249_intersection_array.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "intersection_array", "test": "def check(candidate):\n assert candidate([1, 2, 3, 5, 7, 8, 9, 10], [1, 2, 4, 8, 9]) == [1, 2, 8, 9]\n assert candidate([1, 2, 3, 5, 7, 8, 9, 10], [3, 5, 7, 9]) == [3, 5, 7, 9]\n assert candidate([1, 2, 3, 5, 7, 8, 9, 10], [10, 20, 30, 40]) == [10]\n\ndef test_check():\n check(intersection_array)\n\ntest_check()\n", "solution": "from typing import List\n\ndef intersection_array(array_nums1: List[int], array_nums2: List[int]) -> List[int]:\n \"\"\"\n\tWrite a function to find the intersection of two arrays.\n\t\"\"\"\n result = list(set(array_nums1) & set(array_nums2))\n return result", "is_solved": false}
|
||||
{"name": "mbpp_250_count_X", "language": "py", "prompt": "from typing import List\n\ndef count_X(tup: List[int], x: int) -> int:\n \"\"\"\n\tWrite a python function that takes in a tuple and an element and counts the occcurences of the element in the list.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_250_count_X.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "count_X", "test": "def check(candidate):\n assert candidate([10, 8, 5, 2, 10, 15, 10, 8, 5, 8, 8, 2], 4) == 0\n assert candidate([10, 8, 5, 2, 10, 15, 10, 8, 5, 8, 8, 2], 10) == 3\n assert candidate([10, 8, 5, 2, 10, 15, 10, 8, 5, 8, 8, 2], 8) == 4\n\ndef test_check():\n check(count_X)\n\ntest_check()\n", "solution": "from typing import List\n\ndef count_X(tup: List[int], x: int) -> int:\n \"\"\"\n\tWrite a python function that takes in a tuple and an element and counts the occcurences of the element in the list.\n\t\"\"\"\n count = 0\n for element in tup:\n if element == x:\n count += 1\n return count", "is_solved": true}
|
||||
{"name": "mbpp_622_get_median", "language": "py", "prompt": "from typing import List\n\ndef get_median(arr1: List[int], arr2: List[int], n: int) -> float:\n \"\"\"\n\tWrite a function to find the median of two sorted lists of same size.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_622_get_median.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "get_median", "test": "def check(candidate):\n assert candidate([1, 12, 15, 26, 38], [2, 13, 17, 30, 45], 5) == 16.0\n assert candidate([2, 4, 8, 9], [7, 13, 19, 28], 4) == 8.5\n assert candidate([3, 6, 14, 23, 36, 42], [2, 18, 27, 39, 49, 55], 6) == 25.0\n\ndef test_check():\n check(get_median)\n\ntest_check()\n", "solution": "from typing import List\n\ndef get_median(arr1: List[int], arr2: List[int], n: int) -> float:\n \"\"\"\n\tWrite a function to find the median of two sorted lists of same size.\n\t\"\"\"\n merged_arr = []\n i, j = 0, 0\n\n while i < n and j < n:\n if arr1[i] < arr2[j]:\n merged_arr.append(arr1[i])\n i += 1\n else:\n merged_arr.append(arr2[j])\n j += 1\n\n while i < n:\n merged_arr.append(arr1[i])\n i += 1\n\n while j < n:\n merged_arr.append(arr2[j])\n j += 1\n\n if len(merged_arr) % 2 == 0:\n median = (merged_arr[len(merged_arr) // 2] + merged_arr[len(merged_arr) // 2 - 1]) / 2\n else:\n median = merged_arr[len(merged_arr) // 2]\n\n return median", "is_solved": true}
|
||||
{"name": "mbpp_80_tetrahedral_number", "language": "py", "prompt": "def tetrahedral_number(n: int) -> int:\n \"\"\"\n\tWrite a function to find the nth tetrahedral number.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_80_tetrahedral_number.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "tetrahedral_number", "test": "def check(candidate):\n assert candidate(5) == 35\n assert candidate(6) == 56\n assert candidate(7) == 84\n\ndef test_check():\n check(tetrahedral_number)\n\ntest_check()\n", "solution": "def tetrahedral_number(n: int) -> int:\n \"\"\"\n\tWrite a function to find the nth tetrahedral number.\n\t\"\"\"\n return (n * (n + 1) * (n + 2)) // 6", "is_solved": true}
|
||||
{"name": "mbpp_780_find_combinations", "language": "py", "prompt": "from typing import List, Tuple\n\ndef find_combinations(test_list: List[Tuple[int, int]]) -> List[Tuple[int, int]]:\n \"\"\"\n\tWrite a function to find the combinations of sums with tuples in the given tuple list. https://www.geeksforgeeks.org/python-combinations-of-sum-with-tuples-in-tuple-list/\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_780_find_combinations.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "find_combinations", "test": "def check(candidate):\n assert candidate([(2, 4), (6, 7), (5, 1), (6, 10)]) == [(8, 11), (7, 5), (8, 14), (11, 8), (12, 17), (11, 11)]\n assert candidate([(3, 5), (7, 8), (6, 2), (7, 11)]) == [(10, 13), (9, 7), (10, 16), (13, 10), (14, 19), (13, 13)]\n assert candidate([(4, 6), (8, 9), (7, 3), (8, 12)]) == [(12, 15), (11, 9), (12, 18), (15, 12), (16, 21), (15, 15)]\n\ndef test_check():\n check(find_combinations)\n\ntest_check()\n", "solution": "from typing import List, Tuple\n\ndef find_combinations(test_list: List[Tuple[int, int]]) -> List[Tuple[int, int]]:\n \"\"\"\n\tWrite a function to find the combinations of sums with tuples in the given tuple list. https://www.geeksforgeeks.org/python-combinations-of-sum-with-tuples-in-tuple-list/\n\t\"\"\"\n from itertools import combinations\n\n result = []\n\n # Iterate through all possible combination lengths\n for length in range(1, len(test_list) + 1):\n # Generate all combinations of the given length\n for comb in combinations(test_list, length):\n # Calculate the sum of the first and second elements of each tuple in the combination\n sum_first = sum(t[0] for t in comb)\n sum_second = sum(t[1] for t in comb)\n\n # Add the combination to the result list if the sums are equal\n if sum_first == sum_second:\n result.append(comb)\n\n return result", "is_solved": false}
|
||||
{"name": "mbpp_733_find_first_occurrence", "language": "py", "prompt": "from typing import List\n\ndef find_first_occurrence(A: List[int], x: int) -> int:\n \"\"\"\n\tWrite a function to find the index of the first occurrence of a given number in a sorted array.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_733_find_first_occurrence.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "find_first_occurrence", "test": "def check(candidate):\n assert candidate([2, 5, 5, 5, 6, 6, 8, 9, 9, 9], 5) == 1\n assert candidate([2, 3, 5, 5, 6, 6, 8, 9, 9, 9], 5) == 2\n assert candidate([2, 4, 1, 5, 6, 6, 8, 9, 9, 9], 6) == 4\n\ndef test_check():\n check(find_first_occurrence)\n\ntest_check()\n", "solution": "from typing import List\n\ndef find_first_occurrence(A: List[int], x: int) -> int:\n \"\"\"\n\tWrite a function to find the index of the first occurrence of a given number in a sorted array.\n\t\"\"\"\n left, right = 0, len(A) - 1\n\n while left <= right:\n mid = left + (right - left) // 2\n\n if A[mid] == x:\n if mid == 0 or A[mid - 1] != x:\n return mid\n else:\n right = mid - 1\n elif A[mid] < x:\n left = mid + 1\n else:\n right = mid - 1\n\n return -1", "is_solved": true}
|
||||
{"name": "mbpp_6_differ_At_One_Bit_Pos", "language": "py", "prompt": "def differ_At_One_Bit_Pos(a: int, b: int) -> bool:\n \"\"\"\n\tWrite a python function to check whether the two numbers differ at one bit position only or not.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_6_differ_At_One_Bit_Pos.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "differ_At_One_Bit_Pos", "test": "def check(candidate):\n assert candidate(13, 9) == True\n assert candidate(15, 8) == False\n assert candidate(2, 4) == False\n assert candidate(2, 3) == True\n assert candidate(5, 1) == True\n assert candidate(1, 5) == True\n\ndef test_check():\n check(differ_At_One_Bit_Pos)\n\ntest_check()\n", "solution": "def differ_At_One_Bit_Pos(a: int, b: int) -> bool:\n \"\"\"\n\tWrite a python function to check whether the two numbers differ at one bit position only or not.\n\t\"\"\"\n # Calculate the XOR of the two numbers\n xor_result = a ^ b\n\n # Check if the XOR result is a power of 2 (i.e., has only one bit set)\n return xor_result != 0 and (xor_result & (xor_result - 1)) == 0", "is_solved": true}
|
||||
{"name": "mbpp_762_check_monthnumber_number", "language": "py", "prompt": "def check_monthnumber_number(monthnum3: int) -> bool:\n \"\"\"\n\tWrite a function to check whether the given month number contains 30 days or not. Months are given as number from 1 to 12.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_762_check_monthnumber_number.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "check_monthnumber_number", "test": "def check(candidate):\n assert candidate(6) == True\n assert candidate(2) == False\n assert candidate(12) == False\n\ndef test_check():\n check(check_monthnumber_number)\n\ntest_check()\n", "solution": "def check_monthnumber_number(monthnum3: int) -> bool:\n \"\"\"\n\tWrite a function to check whether the given month number contains 30 days or not. Months are given as number from 1 to 12.\n\t\"\"\"\n if monthnum3 in [4, 6, 9, 11]:\n return True\n else:\n return False", "is_solved": true}
|
||||
{"name": "mbpp_625_swap_List", "language": "py", "prompt": "from typing import List\n\ndef swap_List(newList: List[int]) -> List[int]:\n \"\"\"\n\tWrite a python function to interchange the first and last element in a given list.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_625_swap_List.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "swap_List", "test": "def check(candidate):\n assert candidate([1, 2, 3]) == [3, 2, 1]\n assert candidate([1, 2, 3, 4, 4]) == [4, 2, 3, 4, 1]\n assert candidate([4, 5, 6]) == [6, 5, 4]\n\ndef test_check():\n check(swap_List)\n\ntest_check()\n", "solution": "from typing import List\n\ndef swap_List(newList: List[int]) -> List[int]:\n \"\"\"\n\tWrite a python function to interchange the first and last element in a given list.\n\t\"\"\"\n if len(newList) == 0:\n return newList\n\n newList[0], newList[-1] = newList[-1], newList[0]\n return newList", "is_solved": true}
|
||||
{"name": "mbpp_407_rearrange_bigger", "language": "py", "prompt": "from typing import Any\n\ndef rearrange_bigger(n: int) -> Any:\n \"\"\"\n\tWrite a function to create the next bigger number by rearranging the digits of a given number.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_407_rearrange_bigger.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "rearrange_bigger", "test": "def check(candidate):\n assert candidate(12) == 21\n assert candidate(10) == False\n assert candidate(102) == 120\n\ndef test_check():\n check(rearrange_bigger)\n\ntest_check()\n", "solution": "from typing import Any\n\ndef rearrange_bigger(n: int) -> Any:\n \"\"\"\n\tWrite a function to create the next bigger number by rearranging the digits of a given number.\n\t\"\"\"\n # Convert the number to a list of digits\n digits = list(str(n))\n\n # Find the rightmost digit that is smaller than the digit next to it\n for i in reversed(range(len(digits) - 1)):\n if digits[i] < digits[i + 1]:\n break\n else:\n # If there is no such digit, the number is already the largest possible\n return -1\n\n # Find the smallest digit larger than the above digit to its right\n for j in reversed(range(i + 1, len(digits))):\n if digits[j] > digits[i]:\n break\n\n # Swap the two digits\n digits[i], digits[j] = digits[j], digits[i]\n\n # Reverse the sublist after the first digit to get the smallest possible number\n digits[i + 1:] = reversed(digits[i + 1:])\n\n # Convert the list of digits back to a number\n return int(\"\".join(digits))", "is_solved": false}
|
||||
{"name": "mbpp_392_get_max_sum", "language": "py", "prompt": "def get_max_sum(n: int) -> int:\n \"\"\"\n\tWrite 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).\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_392_get_max_sum.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "get_max_sum", "test": "def check(candidate):\n assert candidate(60) == 106\n assert candidate(10) == 12\n assert candidate(2) == 2\n\ndef test_check():\n check(get_max_sum)\n\ntest_check()\n", "solution": "def get_max_sum(n: int) -> int:\n \"\"\"\n\tWrite 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).\n\t\"\"\"\n if n == 0:\n return 0\n\n return max(get_max_sum(n // 2) + get_max_sum(n // 3) + get_max_sum(n // 4) + get_max_sum(n // 5), n)", "is_solved": true}
|
||||
{"name": "mbpp_784_mul_even_odd", "language": "py", "prompt": "from typing import List\n\ndef mul_even_odd(list1: List[int]) -> int:\n \"\"\"\n\tWrite a function to find the product of first even and odd number of a given list.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_784_mul_even_odd.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "mul_even_odd", "test": "def check(candidate):\n assert candidate([1, 3, 5, 7, 4, 1, 6, 8]) == 4\n assert candidate([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 2\n assert candidate([1, 5, 7, 9, 10]) == 10\n\ndef test_check():\n check(mul_even_odd)\n\ntest_check()\n", "solution": "from typing import List\n\ndef mul_even_odd(list1: List[int]) -> int:\n \"\"\"\n\tWrite a function to find the product of first even and odd number of a given list.\n\t\"\"\"\n even = None\n odd = None\n\n for num in list1:\n if even is not None and odd is not None:\n break\n if num % 2 == 0 and even is None:\n even = num\n elif num % 2 != 0 and odd is None:\n odd = num\n\n if even is not None and odd is not None:\n return even * odd\n else:\n return 0", "is_solved": true}
|
||||
{"name": "mbpp_109_odd_Equivalent", "language": "py", "prompt": "def odd_Equivalent(s: str, n: int) -> int:\n \"\"\"\n\tWrite a python function to find the number of numbers with an odd value when rotating a binary string the given number of times.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_109_odd_Equivalent.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "odd_Equivalent", "test": "def check(candidate):\n assert candidate('011001', 6) == 3\n assert candidate('11011', 5) == 4\n assert candidate('1010', 4) == 2\n\ndef test_check():\n check(odd_Equivalent)\n\ntest_check()\n", "solution": "def odd_Equivalent(s: str, n: int) -> int:\n \"\"\"\n\tWrite a python function to find the number of numbers with an odd value when rotating a binary string the given number of times.\n\t\"\"\"\n count = 0\n\n for i in range(n):\n s = s[-1] + s[:-1]\n decimal_value = int(s, 2)\n if decimal_value % 2 != 0:\n count += 1\n\n return count", "is_solved": true}
|
||||
{"name": "mbpp_95_Find_Min_Length", "language": "py", "prompt": "from typing import List\n\ndef Find_Min_Length(lst: List[List[int]]) -> int:\n \"\"\"\n\tWrite a python function to find the length of the smallest list in a list of lists.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_95_Find_Min_Length.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "Find_Min_Length", "test": "def check(candidate):\n assert candidate([[1], [1, 2]]) == 1\n assert candidate([[1, 2], [1, 2, 3], [1, 2, 3, 4]]) == 2\n assert candidate([[3, 3, 3], [4, 4, 4, 4]]) == 3\n\ndef test_check():\n check(Find_Min_Length)\n\ntest_check()\n", "solution": "from typing import List\n\ndef Find_Min_Length(lst: List[List[int]]) -> int:\n \"\"\"\n\tWrite a python function to find the length of the smallest list in a list of lists.\n\t\"\"\"\n min_length = float('inf')\n\n for sublist in lst:\n if len(sublist) < min_length:\n min_length = len(sublist)\n\n return min_length", "is_solved": true}
|
||||
{"name": "mbpp_399_bitwise_xor", "language": "py", "prompt": "from typing import Tuple\n\ndef bitwise_xor(test_tup1: Tuple[int, int, int, int], test_tup2: Tuple[int, int, int, int]) -> Tuple[int, int, int, int]:\n \"\"\"\n\tWrite a function to perform the mathematical bitwise xor operation across the given tuples.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_399_bitwise_xor.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "bitwise_xor", "test": "def check(candidate):\n assert candidate((10, 4, 6, 9), (5, 2, 3, 3)) == (15, 6, 5, 10)\n assert candidate((11, 5, 7, 10), (6, 3, 4, 4)) == (13, 6, 3, 14)\n assert candidate((12, 6, 8, 11), (7, 4, 5, 6)) == (11, 2, 13, 13)\n\ndef test_check():\n check(bitwise_xor)\n\ntest_check()\n", "solution": "from typing import Tuple\n\ndef bitwise_xor(test_tup1: Tuple[int, int, int, int], test_tup2: Tuple[int, int, int, int]) -> Tuple[int, int, int, int]:\n \"\"\"\n\tWrite a function to perform the mathematical bitwise xor operation across the given tuples.\n\t\"\"\"\n result = tuple(a ^ b for a, b in zip(test_tup1, test_tup2))\n return result", "is_solved": true}
|
||||
{"name": "mbpp_641_is_nonagonal", "language": "py", "prompt": "def is_nonagonal(n: int) -> int:\n \"\"\"\n\tWrite a function to find the nth nonagonal number.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_641_is_nonagonal.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "is_nonagonal", "test": "def check(candidate):\n assert candidate(10) == 325\n assert candidate(15) == 750\n assert candidate(18) == 1089\n\ndef test_check():\n check(is_nonagonal)\n\ntest_check()\n", "solution": "def is_nonagonal(n: int) -> int:\n \"\"\"\n\tWrite a function to find the nth nonagonal number.\n\t\"\"\"\n if n < 1:\n return 0\n\n return n * (7 * n - 5) // 2", "is_solved": true}
|
||||
{"name": "mbpp_59_is_octagonal", "language": "py", "prompt": "def is_octagonal(n: int) -> int:\n \"\"\"\n\tWrite a function to find the nth octagonal number.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_59_is_octagonal.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "is_octagonal", "test": "def check(candidate):\n assert candidate(5) == 65\n assert candidate(10) == 280\n assert candidate(15) == 645\n\ndef test_check():\n check(is_octagonal)\n\ntest_check()\n", "solution": "def is_octagonal(n: int) -> int:\n \"\"\"\n\tWrite a function to find the nth octagonal number.\n\t\"\"\"\n return n * (3 * n - 2)", "is_solved": true}
|
||||
|
1371
simple_mbpp_py2_logs
1371
simple_mbpp_py2_logs
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user