This commit is contained in:
Noah Shinn 2023-04-01 01:31:16 -04:00
parent b3b6507481
commit c3772caafc
2 changed files with 1 additions and 3 deletions

View File

@ -243,3 +243,4 @@
{"name": "mbpp_269_ascii_value", "language": "py", "prompt": "def ascii_value(k: str) -> int:\n \"\"\"\n\tWrite a function to find the ascii value of a character.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_269_ascii_value.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "ascii_value", "test": "def check(candidate):\n assert candidate('A') == 65\n assert candidate('R') == 82\n assert candidate('S') == 83\n\ndef test_check():\n check(ascii_value)\n\ntest_check()\n", "solution": "def ascii_value(k: str) -> int:\n \"\"\"\n\tWrite a function to find the ascii value of a character.\n\t\"\"\"\n return ord(k)", "is_solved": true}
{"name": "mbpp_739_find_Index", "language": "py", "prompt": "def find_Index(n: int) -> int:\n \"\"\"\n\tWrite a python function to find the index of smallest triangular number with n digits. https://www.geeksforgeeks.org/index-of-smallest-triangular-number-with-n-digits/\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_739_find_Index.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "find_Index", "test": "def check(candidate):\n assert candidate(2) == 4\n assert candidate(3) == 14\n assert candidate(4) == 45\n\ndef test_check():\n check(find_Index)\n\ntest_check()\n", "solution": "def find_Index(n: int) -> int:\n \"\"\"\n\tWrite a python function to find the index of smallest triangular number with n digits. https://www.geeksforgeeks.org/index-of-smallest-triangular-number-with-n-digits/\n\t\"\"\"\n import math\n\n # Calculate the index of the smallest triangular number with n digits\n index = int(math.ceil((math.sqrt(8 * (10 ** (n - 1)) - 1) - 1) / 2))\n\n return index", "is_solved": true}
{"name": "mbpp_19_test_duplicate", "language": "py", "prompt": "from typing import List\n\ndef test_duplicate(arraynums: List[int]) -> bool:\n \"\"\"\n\tWrite a function to find whether a given array of integers contains any duplicate element.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_19_test_duplicate.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "test_duplicate", "test": "def check(candidate):\n assert candidate([1, 2, 3, 4, 5]) == False\n assert candidate([1, 2, 3, 4, 4]) == True\n assert candidate([1, 1, 2, 2, 3, 3, 4, 4, 5]) == True\n\ndef test_check():\n check(test_duplicate)\n\ntest_check()\n", "solution": "from typing import List\n\ndef test_duplicate(arraynums: List[int]) -> bool:\n \"\"\"\n\tWrite a function to find whether a given array of integers contains any duplicate element.\n\t\"\"\"\n if len(arraynums) == len(set(arraynums)):\n return False\n else:\n return True", "is_solved": true}
{"name": "mbpp_62_smallest_num", "language": "py", "prompt": "from typing import List\n\ndef smallest_num(xs: List[int]) -> int:\n \"\"\"\n\tWrite a python function to find smallest number in a list.\n\t\"\"\"\n", "doctests": "transform", "original": "/home/arjun/repos/MultiPL-E/datasets/../datasets/mbpp-typed/mbpp_62_smallest_num.py", "prompt_terminology": "reworded", "stop_tokens": ["\ndef", "\n#", "\nif", "\nclass"], "entry_point": "smallest_num", "test": "def check(candidate):\n assert candidate([10, 20, 1, 45, 99]) == 1\n assert candidate([1, 2, 3]) == 1\n assert candidate([45, 46, 50, 60]) == 45\n\ndef test_check():\n check(smallest_num)\n\ntest_check()\n", "solution": "from typing import List\n\ndef smallest_num(xs: List[int]) -> int:\n \"\"\"\n\tWrite a python function to find smallest number in a list.\n\t\"\"\"\n if len(xs) == 0:\n raise ValueError(\"List is empty\")\n\n smallest = xs[0]\n for num in xs:\n if num < smallest:\n smallest = num\n\n return smallest", "is_solved": true}

View File

@ -1,3 +0,0 @@
x = "from typing import List\n\ndef max_sum(arr: List[int]) -> int:\n \"\"\"\n\tWrite a function that takes an array and finds the maximum sum of a bitonic subsequence for the given array, where a sequence is bitonic if it is first increasing and then decreasing.\n\t\"\"\"\n n = len(arr)\n \n # Initialize increasing and decreasing subsequences\n inc = [arr[i] for i in range(n)]\n dec = [arr[i] for i in range(n)]\n \n # Calculate increasing subsequence\n for i in range(1, n):\n for j in range(i):\n if arr[i] > arr[j] and inc[i] < inc[j] + arr[i]:\n inc[i] = inc[j] + arr[i]\n \n # Calculate decreasing subsequence\n for i in range(n-2, -1, -1):\n for j in range(i+1, n):\n if arr[i] > arr[j] and dec[i] < dec[j] + arr[i]:\n dec[i] = dec[j] + arr[i]\n \n # Find the maximum sum of bitonic subsequence\n max_sum = inc[0] + dec[0] - arr[0]\n for i in range(1, n):\n max_sum = max(max_sum, inc[i] + dec[i] - arr[i])\n \n # Check if the sequence is bitonic\n increasing = False\n decreasing = False\n for i in range(1, n):\n if arr"
print(x)