-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrandom10-completion.jsonl_results.jsonl
10 lines (10 loc) · 6.3 KB
/
random10-completion.jsonl_results.jsonl
1
2
3
4
5
6
7
8
9
10
{"task_id": "HumanEval/4", "completion": "from typing import List\n\ndef mean_absolute_deviation(numbers: List[float]) -> float:\n \"\"\" For a given list of input numbers, calculate Mean Absolute Deviation\n around the mean of this dataset.\n Mean Absolute Deviation is the average absolute difference between each\n element and a centerpoint (mean in this case):\n MAD = average | x - x_mean |\n >>> mean_absolute_deviation([1.0, 2.0, 3.0, 4.0])\n 1.0\n \"\"\"\n if not numbers:\n return 0.0\n \n mean = sum(numbers) / len(numbers)\n return sum(abs(x - mean) for x in numbers) / len(numbers)", "result": "passed", "passed": true}
{"task_id": "HumanEval/18", "completion": "def how_many_times(string: str, substring: str) -> int:\n \"\"\" Find how many times a given substring can be found in the original string. Count overlapping cases.\n >>> how_many_times('', 'a')\n 0\n >>> how_many_times('aaa', 'a')\n 3\n >>> how_many_times('aaaa', 'aa')\n 3\n \"\"\"\n count = 0\n start = 0\n while True:\n start = string.find(substring, start)\n if start == -1:\n return count\n count += 1\n start += 1\n return count", "result": "passed", "passed": true}
{"task_id": "HumanEval/28", "completion": "from typing import List\n\ndef concatenate(strings: List[str]) -> str:\n \"\"\" Concatenate list of strings into a single string\n >>> concatenate([])\n ''\n >>> concatenate(['a', 'b', 'c'])\n 'abc'\n \"\"\"\n return ''.join(strings)", "result": "passed", "passed": true}
{"task_id": "HumanEval/42", "completion": "def incr_list(l: list) -> list:\n \"\"\"Return list with elements incremented by 1.\n >>> incr_list([1, 2, 3])\n [2, 3, 4]\n >>> incr_list([5, 3, 5, 2, 3, 3, 9, 0, 123])\n [6, 4, 6, 3, 4, 4, 10, 1, 124]\n \"\"\"\n return [x+1 for x in l]\n\ndef check(candidate):\n assert candidate([1, 2, 3]) == [2, 3, 4]\n assert candidate([5, 3, 5, 2, 3, 3, 9, 0, 123]) == [6, 4, 6, 3, 4, 4, 10, 1, 124]\n\nif __name__ == '__main__':\n check(incr_list)", "result": "passed", "passed": true}
{"task_id": "HumanEval/95", "completion": "def check_dict_case(dict):\n \"\"\"\n Given a dictionary, return True if all keys are strings in lower \n case or all keys are strings in upper case, else return False.\n The function should return False if the given dictionary is empty or contains any non-string keys.\n \n Examples:\n >>> check_dict_case({\"a\":\"apple\", \"b\":\"banana\"})\n True\n >>> check_dict_case({\"a\":\"apple\", \"A\":\"banana\", \"B\":\"banana\"}) \n False\n >>> check_dict_case({\"a\":\"apple\", 8:\"banana\", \"a\":\"apple\"})\n False\n >>> check_dict_case({\"Name\":\"John\", \"Age\":\"36\", \"City\":\"Houston\"})\n False\n >>> check_dict_case({\"STATE\":\"NC\", \"ZIP\":\"12345\" })\n True\n >>> check_dict_case({})\n False\n >>> check_dict_case({\"a\":1, \"b\":2})\n True\n >>> check_dict_case({1:1, 2:2})\n False\n \"\"\"\n if not dict:\n return False\n \n keys = dict.keys()\n \n if not all(isinstance(k, str) for k in keys):\n return False\n \n all_lower = all(k.islower() for k in keys)\n all_upper = all(k.isupper() for k in keys)\n \n return all_lower or all_upper\n\nif __name__ == \"__main__\":\n import doctest\n doctest.testmod()", "result": "passed", "passed": true}
{"task_id": "HumanEval/47", "completion": "def median(l: list) -> float:\n \"\"\"Return median of elements in the list l.\n >>> median([3, 1, 2, 4, 5])\n 3\n >>> median([-10, 4, 6, 1000, 10, 20])\n 8.0\n \"\"\"\n l.sort()\n n = len(l)\n mid = n // 2\n if n % 2 == 0:\n return (l[mid - 1] + l[mid]) / 2\n else:\n return l[mid]", "result": "passed", "passed": true}
{"task_id": "HumanEval/120", "completion": "def maximum(arr, k):\n \"\"\"\n Given an array arr of integers and a positive integer k, return a sorted list \n of length k with the maximum k numbers in arr.\n\n Example 1:\n\n Input: arr = [-3, -4, 5], k = 3\n Output: [5, -3, -4]\n\n Example 2:\n\n Input: arr = [4, -4, 4], k = 2\n Output: [4, 4]\n\n Example 3:\n\n Input: arr = [-3, 2, 1, 2, -1, -2, 1], k = 1\n Output: [2]\n\n >>> maximum([-3, -4, 5], 3)\n [-4, -3, 5]\n >>> maximum([4, -4, 4], 2)\n [4, 4]\n >>> maximum([-3, 2, 1, 2, -1, -2, 1], 1)\n [2]\n \"\"\"\n return sorted(sorted(arr, reverse=True)[:k])\n", "result": "passed", "passed": true}
{"task_id": "HumanEval/15", "completion": "def string_sequence(n: int) -> str:\n \"\"\" Return a string containing space-delimited numbers starting from 0 up to n inclusive.\n >>> string_sequence(0)\n '0'\n >>> string_sequence(5)\n '0 1 2 3 4 5'\n \"\"\"\n return ' '.join(str(i) for i in range(n + 1))", "result": "passed", "passed": true}
{"task_id": "HumanEval/155", "completion": "def even_odd_count(num):\n \"\"\"Given an integer. return a tuple that has the number of even and odd digits respectively.\n\n Example:\n even_odd_count(-12) ==> (1, 1)\n even_odd_count(123) ==> (1, 2)\n\n >>> even_odd_count(-12)\n (1, 1)\n >>> even_odd_count(123)\n (1, 2)\n \"\"\"\n num = abs(num) # Handle negative numbers\n num_str = str(num)\n evens = sum(1 for digit in num_str if int(digit) % 2 == 0)\n odds = len(num_str) - evens\n return (evens, odds)", "result": "passed", "passed": true}
{"task_id": "HumanEval/20", "completion": "from typing import List, Tuple\n\ndef find_closest_elements(numbers: List[float]) -> Tuple[float, float]:\n \"\"\" From a supplied list of numbers (of length at least two) select and return two that are the closest to each\n other and return them in order (smaller number, larger number).\n >>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])\n (2.0, 2.2)\n >>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])\n (2.0, 2.0)\n \"\"\"\n numbers.sort()\n closest_pair = (numbers[0], numbers[1])\n min_diff = numbers[1] - numbers[0]\n for i in range(2, len(numbers)):\n diff = numbers[i] - numbers[i - 1]\n if diff < min_diff:\n min_diff = diff\n closest_pair = (numbers[i - 1], numbers[i])\n return closest_pair", "result": "passed", "passed": true}