{"task_id": "HumanEval/0", "completion": "\nfrom typing import List\n\ndef has_close_elements(numbers: List[float], threshold: float) -> bool:\n for i in range(len(numbers)):\n for j in range(i+1, len(numbers)):\n if abs(numbers[i] - numbers[j]) < threshold:\n return True\n return False", "result": "passed", "passed": true} {"task_id": "HumanEval/1", "completion": "\nfrom typing import List\n\ndef separate_paren_groups(paren_string: str) -> List[str]:\n result = []\n stack = []\n current_group = ''\n \n for char in paren_string:\n if char == ' ':\n continue\n elif char == '(':\n stack.append(char)\n current_group += char\n elif char == ')':\n if stack:\n stack.pop()\n current_group += char\n if not stack:\n result.append(current_group)\n current_group = ''\n else:\n raise ValueError('Unmatched closing parenthesis')\n else:\n current_group += char\n \n if stack:\n raise ValueError('Unmatched opening parenthesis')\n \n return result", "result": "passed", "passed": true} {"task_id": "HumanEval/2", "completion": "\ndef truncate_number(number: float) -> float:\n integer_part = int(number)\n decimal_part = number - integer_part\n return decimal_part", "result": "passed", "passed": true} {"task_id": "HumanEval/3", "completion": "\nfrom typing import List\n\ndef below_zero(operations: List[int]) -> bool:\n balance = 0\n for operation in operations:\n if operation < 0:\n balance += operation\n else:\n balance -= operation\n if balance < 0:\n return True\n return False", "result": "failed: ", "passed": false} {"task_id": "HumanEval/4", "completion": "\nfrom typing import List\n\ndef mean_absolute_deviation(numbers: List[float]) -> float:\n mean = sum(numbers) / len(numbers)\n mad = sum(abs(x - mean) for x in numbers) / len(numbers)\n return mad", "result": "passed", "passed": true} {"task_id": "HumanEval/5", "completion": "\nfrom typing import List\n\ndef intersperse(numbers, delimeter):\n if not numbers:\n return []\n result = [numbers[0]]\n for i in range(1, len(numbers)):\n result.append(delimeter)\n result.append(numbers[i])\n return result", "result": "passed", "passed": true} {"task_id": "HumanEval/6", "completion": "\nfrom typing import List\n\ndef parse_nested_parens(paren_string):\n max_depth = 0\n current_depth = 0\n depth_list = []\n \n for paren in paren_string.split():\n if paren == '(':\n current_depth += 1\n max_depth = max(max_depth, current_depth)\n elif paren == ')':\n current_depth -= 1\n depth_list.append(current_depth)\n \n return depth_list", "result": "failed: ", "passed": false} {"task_id": "HumanEval/7", "completion": "\nfrom typing import List\n\ndef filter_by_substring(strings: List[str], substring: str) -> List[str]:\n return [s for s in strings if substring in s]", "result": "passed", "passed": true} {"task_id": "HumanEval/8", "completion": "\nfrom typing import List, Tuple\n\ndef sum_product(numbers: List[int]) -> Tuple[int, int]:\n if not numbers:\n return 0, 1\n else:\n return sum(numbers), 1 if not numbers else reduce(lambda x, y: x*y, numbers)", "result": "failed: name 'reduce' is not defined", "passed": false} {"task_id": "HumanEval/9", "completion": "\nfrom typing import List, Tuple\n\ndef rolling_max(numbers):\n max_num = numbers[0]\n result = [numbers[0]]\n for i in range(1, len(numbers)):\n if numbers[i] > max_num:\n max_num = numbers[i]\n result.append(max_num)\n return result", "result": "failed: list index out of range", "passed": false} {"task_id": "HumanEval/10", "completion": "\ndef is_palindrome(string: str) -> bool:\n \n return string == string[::-1]\ndef make_palindrome(string: str) -> str:\n \"\"\"\u627e\u5230\u4ee5\u7ed9\u5b9a\u7684\u5b57\u7b26\u4e32\u5f00\u5934\u7684\u6700\u77ed\u56de\u6587\u3002\u7b97\u6cd5\u601d\u60f3\u5f88\u7b80\u5355\uff1a-\u627e\u5230\u7ed9\u5b9a\u5b57\u7b26\u4e32\u7684\u6700\u957f\u56de\u6587\u540e\u7f00\u3002\u2014\u5c06\u56de\u6587\u540e\u7f00\u524d\u7684\u5b57\u7b26\u4e32\u53cd\u8f6c\uff0c\u9644\u52a0\u5230\u7ed9\u5b9a\u5b57\u7b26\u4e32\u7684\u672b\u5c3e\u3002\n >>> make_palindrome('')\n ''\n >>> make_palindrome('cat')\n 'catac'\n >>> make_palindrome('cata')\n 'catac'\n \"\"\"\n if not string:\n return ''\n for i in range(len(string), 0, -1):\n suffix = string[:i]\n if is_palindrome(suffix):\n return string[i:][::-1] + string\n return string[1:][::-1] + string", "result": "failed: ", "passed": false} {"task_id": "HumanEval/11", "completion": "\nfrom typing import List\n\ndef string_xor(a: str, b: str) -> str:\n if len(a) != len(b):\n return \"Error: Lengths of input strings are not equal.\"\n \n result = \"\"\n for i in range(len(a)):\n if a[i] == '0' and b[i] == '0':\n result += '0'\n elif a[i] == '1' and b[i] == '1':\n result += '0'\n else:\n result += '1'\n \n return result", "result": "passed", "passed": true} {"task_id": "HumanEval/12", "completion": "\nfrom typing import List, Optional\n\ndef longest(strings: List[str]) -> Optional[str]:\n if not strings:\n return None\n return max(strings, key=len)", "result": "passed", "passed": true} {"task_id": "HumanEval/13", "completion": "\ndef greatest_common_divisor(a: int, b: int) -> int:\n if a == 0:\n return b\n if b == 0:\n return a\n if a == b:\n return a\n if a > b:\n return greatest_common_divisor(a-b, b)\n return greatest_common_divisor(a, b-a)", "result": "passed", "passed": true} {"task_id": "HumanEval/14", "completion": "\nfrom typing import List\n\ndef all_prefixes(string: str) -> List[str]:\n prefixes = []\n for i in range(1, len(string)+1):\n prefix = string[:i]\n prefixes.append(prefix)\n return prefixes", "result": "passed", "passed": true} {"task_id": "HumanEval/15", "completion": "\ndef string_sequence(n: int) -> str:\n return ' '.join(str(i) for i in range(n+1))", "result": "passed", "passed": true} {"task_id": "HumanEval/16", "completion": "\ndef count_distinct_characters(string: str) -> int:\n return len(set(string.lower()))", "result": "passed", "passed": true} {"task_id": "HumanEval/17", "completion": "\nfrom typing import List\n\ndef parse_music(music_string):\n durations = {\n 'o': 4,\n 'o|': 2,\n '.|': 1\n }\n result = []\n for note in music_string.split():\n result.append(durations.get(note, 0))\n return result", "result": "passed", "passed": true} {"task_id": "HumanEval/18", "completion": "\ndef how_many_times(string: str, substring: str) -> int:\n count = 0\n start = 0\n while True:\n index = string.find(substring, start)\n if index == -1:\n break\n count += 1\n start = index + 1\n return count", "result": "passed", "passed": true} {"task_id": "HumanEval/19", "completion": "\nfrom typing import List\n\ndef sort_numbers(numbers):\n num_dict = {\n 'zero': 0,\n 'one': 1,\n 'two': 2,\n 'three': 3,\n 'four': 4,\n 'five': 5,\n 'six': 6,\n 'seven': 7,\n 'eight': 8,\n 'nine': 9\n }\n \n sorted_nums = sorted(numbers.split(), key=lambda x: num_dict[x])\n return ' '.join(sorted_nums)", "result": "passed", "passed": true} {"task_id": "HumanEval/20", "completion": "\nfrom typing import List, Tuple\n\ndef find_closest_elements(numbers):\n numbers.sort()\n min_diff = float('inf')\n result = ()\n for i in range(len(numbers) - 1):\n diff = abs(numbers[i] - numbers[i+1])\n if diff < min_diff:\n min_diff = diff\n result = (numbers[i], numbers[i+1])\n return result", "result": "passed", "passed": true} {"task_id": "HumanEval/21", "completion": "\nfrom typing import List\n\ndef rescale_to_unit(numbers: List[float]) -> List[float]:\n min_num = min(numbers)\n max_num = max(numbers)\n scale = (max_num - min_num) / (max_num - min_num)\n return [min_num + scale * (num - min_num) for num in numbers]", "result": "failed: ", "passed": false} {"task_id": "HumanEval/22", "completion": "\nfrom typing import List, Any\n\ndef filter_integers(values: List[Any]) -> List[int]:\n return [value for value in values if isinstance(value, int)]", "result": "passed", "passed": true} {"task_id": "HumanEval/23", "completion": "\ndef strlen(string: str) -> int:\n return len(string)", "result": "passed", "passed": true} {"task_id": "HumanEval/24", "completion": "\ndef largest_divisor(n: int) -> int:\n for i in range(n-1, 0, -1):\n if n % i == 0:\n return i", "result": "passed", "passed": true} {"task_id": "HumanEval/25", "completion": "\nfrom typing import List\n\ndef factorize(n: int) -> List[int]:\n factors = []\n i = 2\n while i * i <= n:\n if n % i:\n i += 1\n else:\n n //= i\n factors.append(i)\n if n > 1:\n factors.append(n)\n return factors", "result": "passed", "passed": true} {"task_id": "HumanEval/26", "completion": "\nfrom typing import List\n\ndef remove_duplicates(numbers):\n count = {}\n result = []\n for num in numbers:\n if num not in count:\n count[num] = 1\n result.append(num)\n elif count[num] == 1:\n count[num] += 1\n result.remove(num)\n return result", "result": "passed", "passed": true} {"task_id": "HumanEval/27", "completion": "\ndef flip_case(string: str) -> str:\n return string.swapcase()", "result": "passed", "passed": true} {"task_id": "HumanEval/28", "completion": "\nfrom typing import List\n\ndef concatenate(strings: List[str]) -> str:\n return ''.join(strings)", "result": "passed", "passed": true} {"task_id": "HumanEval/29", "completion": "\nfrom typing import List\n\ndef filter_by_prefix(strings: List[str], prefix: str) -> List[str]:\n return [s for s in strings if s.startswith(prefix)]", "result": "passed", "passed": true} {"task_id": "HumanEval/30", "completion": "\ndef get_positive(l: list):\n return [x for x in l if x > 0]", "result": "passed", "passed": true} {"task_id": "HumanEval/31", "completion": "\ndef is_prime(n):\n if n <= 1:\n return False\n for i in range(2, int(n**0.5)+1):\n if n % i == 0:\n return False\n return True", "result": "passed", "passed": true} {"task_id": "HumanEval/32", "completion": "\nimport math\n\ndef poly(xs: list, x: float):\n \n return sum([coeff * math.pow(x, i) for i, coeff in enumerate(xs)])\ndef find_zero(xs: list):\n \"\"\"\n xs\u662f\u591a\u9879\u5f0f\u7684\u7cfb\u6570\u3002find_zero\u8fd4\u56depoly(x)= 0\u65f6\u7684\u89e3\u3002\u51fd\u6570find_zero\u53ea\u8fd4\u56de\u4e00\u4e2a\u96f6\u70b9\uff0c\u5373\u4f7f\u6709\u591a\u4e2a\u96f6\u70b9\u3002\u6b64\u5916\uff0c\u51fd\u6570find_zero\u53ea\u63a5\u53d7\u5177\u6709\u5076\u6570\u4e2a\u7cfb\u6570\u548c\u6700\u5927\u975e\u96f6\u7cfb\u6570\u7684\u5217\u8868xs\uff0c\u56e0\u4e3a\u8fd9\u6837\u53ef\u4ee5\u4fdd\u8bc1\u6709\u4e00\u4e2a\u89e3\u3002\n >>> round(find_zero([1, 2]), 2) # f(x) = 1 + 2x\n -0.5\n >>> round(find_zero([-6, 11, -6, 1]), 2) # (x - 1) * (x - 2) * (x - 3) = -6 + 11x - 6x^2 + x^3\n 1.0\n \"\"\"\n if len(xs) % 2 == 0 and xs[-1] != 0:\n return -xs[0] / xs[-1]\n else:\n raise ValueError(\"The list of coefficients must have an even number of non-zero elements and the largest non-zero coefficient must be non-zero.\")", "result": "failed: ", "passed": false} {"task_id": "HumanEval/33", "completion": "\ndef sort_third(l):\n return sorted([l[i] for i in range(len(l)) if i % 3 == 0])", "result": "failed: ", "passed": false} {"task_id": "HumanEval/34", "completion": "\ndef unique(l):\n return sorted(list(set(l)))", "result": "passed", "passed": true} {"task_id": "HumanEval/35", "completion": "\ndef max_element(l: list):\n return max(l)", "result": "passed", "passed": true} {"task_id": "HumanEval/36", "completion": "\ndef fizz_buzz(n):\n count = 0\n for i in range(1, n):\n if i % 11 == 0 or i % 13 == 0:\n count += str(i).count('7')\n return count", "result": "passed", "passed": true} {"task_id": "HumanEval/37", "completion": "\ndef sort_even(l):\n even_indexes = [i for i in range(len(l)) if i % 2 == 0]\n sorted_values = sorted([l[i] for i in even_indexes])\n new_list = l.copy()\n for i, value in zip(even_indexes, sorted_values):\n new_list[i] = value\n return new_list", "result": "passed", "passed": true} {"task_id": "HumanEval/38", "completion": "\ndef encode_cyclic(s: str):\n \n # \u5c06\u5b57\u7b26\u4e32\u62c6\u5206\u4e3a\u7ec4\uff0c\u6bcf\u4e2a\u7ec4\u7684\u957f\u5ea6\u4e3a3\u3002\n groups = [s[(3 * i):min((3 * i + 3), len(s))] for i in range((len(s) + 2) // 3)]\n # \u5728\u6bcf\u4e2a\u7ec4\u4e2d\u5faa\u73af\u5143\u7d20\uff0c\u9664\u975e\u8be5\u7ec4\u7684\u5143\u7d20\u5c11\u4e8e3\u4e2a\u3002\n groups = [(group[1:] + group[0]) if len(group) == 3 else group for group in groups]\n return \"\".join(groups)\ndef decode_cyclic(s: str):\n \"\"\"\n \u8f93\u5165encode_cyclic\u51fd\u6570\u7f16\u7801\u7684\u5b57\u7b26\u4e32\uff0c\u8fd4\u56de\u89e3\u7801\u540e\u7684\u5b57\u7b26\u4e32\u3002\n \"\"\"\n # \u5c06\u5b57\u7b26\u4e32\u62c6\u5206\u4e3a\u7ec4\uff0c\u6bcf\u4e2a\u7ec4\u7684\u957f\u5ea6\u4e3a3\u3002\n groups = [s[i:i+3] for i in range(0, len(s), 3)]\n # \u5728\u6bcf\u4e2a\u7ec4\u4e2d\u5faa\u73af\u5143\u7d20\uff0c\u9664\u975e\u8be5\u7ec4\u7684\u5143\u7d20\u5c11\u4e8e3\u4e2a\u3002\n groups = [(group[-1] + group[1:-1] + group[0]) if len(group) == 3 else group for group in groups]\n # \u5c06\u7ec4\u91cd\u65b0\u7ec4\u5408\u6210\u5b57\u7b26\u4e32\u3002\n return \"\".join(groups)", "result": "failed: ", "passed": false} {"task_id": "HumanEval/39", "completion": "\ndef prime_fib(n):\n def is_prime(num):\n if num < 2:\n return False\n for i in range(2, int(num ** 0.5) + 1):\n if num % i == 0:\n return False\n return True\n def is_fib(num):\n a, b = 0, 1\n while a < num:\n a, b = b, a + b\n return a == num\n count = 0\n num = 2\n while count < n:\n if is_prime(num) and is_fib(num):\n count += 1\n num += 1\n return num - 1", "result": "timed out", "passed": false} {"task_id": "HumanEval/40", "completion": "\ndef triples_sum_to_zero(l: list):\n n = len(l)\n if n < 3:\n return False\n for i in range(n-2):\n for j in range(i+1, n-1):\n for k in range(j+1, n):\n if l[i] + l[j] + l[k] == 0:\n return True\n return False", "result": "passed", "passed": true} {"task_id": "HumanEval/41", "completion": "\ndef car_race_collision(n):\n return n * (n - 1) // 2", "result": "failed: ", "passed": false} {"task_id": "HumanEval/42", "completion": "\ndef incr_list(l: list):\n return [x+1 for x in l]", "result": "passed", "passed": true} {"task_id": "HumanEval/43", "completion": "\ndef pairs_sum_to_zero(l):\n if len(l) < 2:\n return False\n for i in range(len(l)):\n for j in range(i+1, len(l)):\n if l[i] + l[j] == 0:\n return True\n return False", "result": "passed", "passed": true} {"task_id": "HumanEval/44", "completion": "\ndef change_base(x: int, base: int):\n if base < 2:\n raise ValueError(\"Base must be greater than or equal to 2.\")\n digits = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n result = \"\"\n while x > 0:\n remainder = x % base\n result = digits[remainder] + result\n x = x // base\n return result", "result": "passed", "passed": true} {"task_id": "HumanEval/45", "completion": "\ndef triangle_area(a, h):\n return (a * h) / 2", "result": "passed", "passed": true} {"task_id": "HumanEval/46", "completion": "\ndef fib4(n):\n if n == 0:\n return 0\n elif n == 1:\n return 0\n elif n == 2:\n return 2\n elif n == 3:\n return 0\n else:\n a, b, c, d = 0, 0, 2, 0\n for i in range(4, n + 1):\n a, b, c, d = b, c, d, a + b + c + d\n return d", "result": "passed", "passed": true} {"task_id": "HumanEval/47", "completion": "\ndef median(l: list):\n n = len(l)\n l.sort()\n if n % 2 == 0:\n return (l[n//2-1] + l[n//2]) / 2\n else:\n return l[n//2]", "result": "passed", "passed": true} {"task_id": "HumanEval/48", "completion": "\ndef is_palindrome(text: str):\n \n if not text:\n return True\n left, right = 0, len(text) - 1\n while left < right:\n if text[left] != text[right]:\n return False\n left += 1\n right -= 1\n return True", "result": "passed", "passed": true} {"task_id": "HumanEval/49", "completion": "\ndef modp(n, p):\n if n == 0:\n return 1 % p\n elif n % 2 == 0:\n return modp(n // 2, p) ** 2 % p\n else:\n return (modp(n - 1, p) + modp(n // 2, p) * 2) % p", "result": "failed: ", "passed": false} {"task_id": "HumanEval/50", "completion": "\ndef encode_shift(s: str):\n \n return \"\".join([chr(((ord(ch) + 5 - ord(\"a\")) % 26) + ord(\"a\")) for ch in s])\ndef decode_shift(s: str):\n \"\"\" \n \u8f93\u5165encode_shift\u51fd\u6570\u7f16\u7801\u7684\u5b57\u7b26\u4e32\u3002\u8fd4\u56de\u89e3\u7801\u7684\u5b57\u7b26\u4e32\u3002\n \"\"\"\n return \"\".join([chr(((ord(ch) - 5 - ord(\"a\")) % 26) + ord(\"a\")) for ch in s])", "result": "passed", "passed": true} {"task_id": "HumanEval/51", "completion": "\ndef remove_vowels(text):\n vowels = 'aeiouAEIOU'\n return ''.join(c for c in text if c not in vowels)", "result": "passed", "passed": true} {"task_id": "HumanEval/52", "completion": "\ndef below_threshold(l: list, t: int):\n for num in l:\n if num >= t:\n return False\n return True", "result": "passed", "passed": true} {"task_id": "HumanEval/53", "completion": "\ndef add(x: int, y: int):\n return x + y", "result": "passed", "passed": true} {"task_id": "HumanEval/54", "completion": "\ndef same_chars(s0, s1):\n if len(s0) != len(s1):\n return False\n for i in range(len(s0)):\n if s0[i] != s1[i]:\n return False\n return True", "result": "failed: ", "passed": false} {"task_id": "HumanEval/55", "completion": "\ndef fib(n: int):\n if n <= 0:\n return None\n elif n == 1 or n == 2:\n return 1\n else:\n return fib(n-1) + fib(n-2)", "result": "passed", "passed": true} {"task_id": "HumanEval/56", "completion": "\ndef correct_bracketing(brackets: str):\n stack = []\n for char in brackets:\n if char == \"<\":\n stack.append(char)\n elif char == \">\":\n if not stack:\n return False\n stack.pop()\n return len(stack) == 0", "result": "passed", "passed": true} {"task_id": "HumanEval/57", "completion": "\ndef monotonic(l):\n if len(l) < 2:\n return True\n inc = l[0] <= l[-1]\n for i in range(1, len(l)):\n if l[i] > l[i-1]:\n inc = False\n elif l[i] < l[i-1]:\n return False\n return inc", "result": "failed: ", "passed": false} {"task_id": "HumanEval/58", "completion": "\ndef common(l1: list, l2: list):\n \n l1.sort()\n l2.sort()\n i = j = 0\n res = []\n while i < len(l1) and j < len(l2):\n if l1[i] == l2[j]:\n if l1[i] not in res:\n res.append(l1[i])\n i += 1\n j += 1\n elif l1[i] < l2[j]:\n i += 1\n else:\n j += 1\n return res", "result": "passed", "passed": true} {"task_id": "HumanEval/59", "completion": "\ndef largest_prime_factor(n):\n i = 2\n while i * i <= n:\n if n % i:\n i += 1\n else:\n n //= i\n return n", "result": "passed", "passed": true} {"task_id": "HumanEval/60", "completion": "\ndef sum_to_n(n: int):\n return (n*(n+1)//2)", "result": "passed", "passed": true} {"task_id": "HumanEval/61", "completion": "\ndef correct_bracketing(brackets: str):\n stack = []\n for char in brackets:\n if char == '(':\n stack.append(char)\n elif char == ')':\n if not stack:\n return False\n stack.pop()\n return len(stack) == 0", "result": "passed", "passed": true} {"task_id": "HumanEval/62", "completion": "\ndef derivative(xs):\n return [xs[i] * i for i in range(1, len(xs))]", "result": "passed", "passed": true} {"task_id": "HumanEval/63", "completion": "\ndef fibfib(n):\n if n == 0:\n return 0\n elif n == 1:\n return 0\n elif n == 2:\n return 1\n else:\n return fibfib(n-1) + fibfib(n-2) + fibfib(n-3)", "result": "passed", "passed": true} {"task_id": "HumanEval/64", "completion": "\ndef vowels_count(s):\n return sum(1 for char in s if char in 'aeiouAEIOU') + (s[-1] == 'y')", "result": "failed: Test 5", "passed": false} {"task_id": "HumanEval/65", "completion": "\ndef circular_shift(x, shift):\n x_str = str(x)\n length = len(x_str)\n if shift > length:\n return x_str[::-1]\n else:\n shift %= length\n return x_str[-shift:] + x_str[:-shift]", "result": "passed", "passed": true} {"task_id": "HumanEval/66", "completion": "\ndef digitSum(s):\n return sum(ord(c) for c in s if c.isupper())", "result": "passed", "passed": true} {"task_id": "HumanEval/67", "completion": "\ndef fruit_distribution(s,n):\n apples, oranges = map(int, [s.split()[0], s.split()[3]])\n return n - apples - oranges", "result": "passed", "passed": true} {"task_id": "HumanEval/68", "completion": "\ndef pluck(arr):\n if not arr:\n return []\n min_even = float('inf')\n min_even_index = -1\n for i in range(len(arr)):\n if arr[i] % 2 == 0 and arr[i] < min_even:\n min_even = arr[i]\n min_even_index = i\n if min_even_index == -1:\n return []\n return [min_even, min_even_index]", "result": "passed", "passed": true} {"task_id": "HumanEval/69", "completion": "\ndef search(lst):\n max_freq = -1\n for num in lst:\n if lst.count(num) >= num:\n max_freq = max(max_freq, num)\n return max_freq", "result": "passed", "passed": true} {"task_id": "HumanEval/70", "completion": "\ndef strange_sort_list(lst):\n lst.sort()\n result = []\n while lst:\n result.append(lst.pop(0))\n if lst:\n result.append(lst.pop())\n return result", "result": "passed", "passed": true} {"task_id": "HumanEval/71", "completion": "\ndef triangle_area(a, b, c):\n if a + b > c and a + c > b and b + c > a:\n return round((a * b * c) / (4 * (a ** 2 + b ** 2 + c ** 2) ** 0.5), 2)\n else:\n return -1", "result": "failed: This prints if this assert fails 1 (good for debugging!)", "passed": false} {"task_id": "HumanEval/72", "completion": "\ndef will_it_fly(q,w):\n if q == q[::-1] and sum(q) <= w:\n return True\n else:\n return False", "result": "passed", "passed": true} {"task_id": "HumanEval/73", "completion": "\ndef smallest_change(arr):\n \n n = len(arr)\n count = 0\n for i in range(n//2):\n if arr[i] != arr[n-i-1]:\n count += 1\n return count", "result": "passed", "passed": true} {"task_id": "HumanEval/74", "completion": "\ndef total_match(lst1, lst2):\n total_count = sum(len(s) for s in lst1)\n for s in lst2:\n if len(s) < total_count:\n return lst1\n return lst2", "result": "failed: ", "passed": false} {"task_id": "HumanEval/75", "completion": "\ndef is_multiply_prime(a):\n primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]\n for i in range(len(primes)):\n if a % primes[i] == 0:\n for j in range(i+1, len(primes)):\n if a % primes[j] == 0:\n for k in range(j+1, len(primes)):\n if a % primes[k] == 0:\n return True\n return False", "result": "failed: ", "passed": false} {"task_id": "HumanEval/76", "completion": "\ndef is_simple_power(x, n):\n if x == 1:\n return True\n for i in range(2, int(x ** 0.5) + 1):\n p = i\n while p <= x:\n p *= i\n if p == x:\n return True\n return False", "result": "failed: This prints if this assert fails 1 (good for debugging!)", "passed": false} {"task_id": "HumanEval/77", "completion": "\ndef iscube(a):\n return round(a ** (1/3)) ** 3 == a", "result": "failed: type complex doesn't define __round__ method", "passed": false} {"task_id": "HumanEval/78", "completion": "\ndef hex_key(num):\n primes = {'2', '3', '5', '7', 'B', 'D'}\n count = 0\n for char in num:\n if char in primes:\n count += 1\n return count", "result": "passed", "passed": true} {"task_id": "HumanEval/79", "completion": "\ndef decimal_to_binary(decimal):\n binary = bin(decimal)[2:]\n return f\"db{binary}db\"", "result": "passed", "passed": true} {"task_id": "HumanEval/80", "completion": "\ndef is_happy(s):\n if len(s) < 3:\n return False\n for i in range(len(s) - 2):\n if s[i] == s[i+1] or s[i] == s[i+2] or s[i+1] == s[i+2]:\n return False\n return True", "result": "passed", "passed": true} {"task_id": "HumanEval/81", "completion": "\ndef numerical_letter_grade(grades):\n grades.sort(reverse=True)\n result = []\n for grade in grades:\n if grade == 4.0:\n result.append('A+')\n elif grade > 3.7:\n result.append('A')\n elif grade > 3.3:\n result.append('A-')\n elif grade > 3.0:\n result.append('B+')\n elif grade > 2.7:\n result.append('B')\n elif grade > 2.3:\n result.append('B-')\n elif grade > 2.0:\n result.append('C+')\n elif grade > 1.7:\n result.append('C')\n elif grade > 1.3:\n result.append('C-')\n elif grade > 1.0:\n result.append('D+')\n elif grade > 0.7:\n result.append('D')\n elif grade > 0.0:\n result.append('D-')\n else:\n result.append('E')\n return result", "result": "failed: ", "passed": false} {"task_id": "HumanEval/82", "completion": "\ndef prime_length(string):\n length = len(string)\n if length < 2:\n return False\n for i in range(2, int(length ** 0.5) + 1):\n if length % i == 0:\n return False\n return True", "result": "passed", "passed": true} {"task_id": "HumanEval/83", "completion": "\ndef starts_one_ends(n):\n if n == 1:\n return 1\n else:\n return 9 * pow(10, n-2) + 10", "result": "failed: ", "passed": false} {"task_id": "HumanEval/84", "completion": "\ndef solve(N):\n # \u5c06N\u8f6c\u6362\u4e3a\u4e8c\u8fdb\u5236\u5b57\u7b26\u4e32\n binary_str = bin(N)[2:]\n # \u8ba1\u7b97\u6570\u4f4d\u4e4b\u548c\n sum_digits = sum(int(digit) for digit in binary_str)\n # \u5c06\u6570\u4f4d\u4e4b\u548c\u8f6c\u6362\u4e3a\u4e8c\u8fdb\u5236\u5b57\u7b26\u4e32\n result_str = bin(sum_digits)[2:]\n return result_str", "result": "failed: Error", "passed": false} {"task_id": "HumanEval/85", "completion": "\ndef add(lst):\n \n return sum([lst[i] for i in range(1, len(lst), 2) if lst[i] % 2 == 0])", "result": "passed", "passed": true} {"task_id": "HumanEval/86", "completion": "\ndef anti_shuffle(s):\n words = s.split()\n new_words = []\n for word in words:\n new_word = ''.join(sorted(word))\n new_words.append(new_word)\n return ' '.join(new_words)", "result": "passed", "passed": true} {"task_id": "HumanEval/87", "completion": "\ndef get_row(lst, x):\n res = []\n for i, row in enumerate(lst):\n if x in row:\n for j, val in enumerate(row):\n if val == x:\n res.append((i, j))\n return sorted(res, key=lambda x: (x[0], -x[1]))", "result": "passed", "passed": true} {"task_id": "HumanEval/88", "completion": "\ndef sort_array(array):\n if len(array) == 0:\n return []\n elif len(array) == 1:\n return array\n else:\n first = array[0]\n last = array[-1]\n if (first + last) % 2 == 1:\n return sorted(array)\n else:\n return sorted(array, reverse=True)", "result": "passed", "passed": true} {"task_id": "HumanEval/89", "completion": "\ndef encrypt(s):\n result = ''\n for char in s:\n if char.isalpha():\n offset = 2 * 2\n if char.islower():\n base = ord('a')\n else:\n base = ord('A')\n result += chr((ord(char) - base + offset) % 26 + base)\n else:\n result += char\n return result", "result": "passed", "passed": true} {"task_id": "HumanEval/90", "completion": "\ndef next_smallest(lst):\n if len(lst) < 2:\n return None\n smallest = min(lst)\n second_smallest = float('inf')\n for num in lst:\n if num > smallest and num < second_smallest:\n second_smallest = num\n if second_smallest == float('inf'):\n return None\n return second_smallest", "result": "passed", "passed": true} {"task_id": "HumanEval/91", "completion": "\ndef is_bored(S):\n sentences = S.split('.')\n sentences += S.split('!')\n sentences += S.split('?')\n count = 0\n for sentence in sentences:\n if sentence.startswith('I'):\n count += 1\n return count", "result": "failed: Test 2", "passed": false} {"task_id": "HumanEval/92", "completion": "\ndef any_int(x, y, z):\n if isinstance(x, int) and isinstance(y, int) and isinstance(z, int):\n if x == y + z or y == x + z or z == x + y:\n return True\n return False", "result": "passed", "passed": true} {"task_id": "HumanEval/93", "completion": "\ndef encode(message):\n vowels = 'AEIOUaeiou'\n encoded_message = ''\n for char in message:\n if char.isalpha():\n if char.islower():\n encoded_char = chr((ord(char) - ord('a') + 2) % 26 + ord('a'))\n else:\n encoded_char = chr((ord(char) - ord('A') + 2) % 26 + ord('A'))\n if encoded_char in vowels:\n encoded_char = chr(ord(encoded_char) + 2)\n encoded_message += encoded_char\n else:\n encoded_message += char\n return encoded_message", "result": "failed: This prints if this assert fails 1 (good for debugging!)", "passed": false} {"task_id": "HumanEval/94", "completion": "\ndef skjkasdkd(lst):\n def is_prime(n):\n if n < 2:\n return False\n for i in range(2, int(n**0.5)+1):\n if n % i == 0:\n return False\n return True\n \n max_prime = -1\n for num in lst:\n if is_prime(num) and num > max_prime:\n max_prime = num\n \n if max_prime == -1:\n return 0\n \n return sum(int(digit) for digit in str(max_prime))", "result": "passed", "passed": true} {"task_id": "HumanEval/95", "completion": "\ndef check_dict_case(dict):\n if not dict:\n return False\n keys = list(dict.keys())\n first_key = keys[0]\n if first_key.islower():\n for key in keys:\n if not key.islower():\n return False\n return True\n elif first_key.isupper():\n for key in keys:\n if not key.isupper():\n return False\n return True\n else:\n return False", "result": "failed: 'int' object has no attribute 'islower'", "passed": false} {"task_id": "HumanEval/96", "completion": "\ndef count_up_to(n):\n if n < 2:\n return []\n primes = [2]\n for i in range(3, n+1):\n is_prime = True\n for j in range(2, int(i**0.5)+1):\n if i % j == 0:\n is_prime = False\n break\n if is_prime:\n primes.append(i)\n return primes[:n]", "result": "failed: ", "passed": false} {"task_id": "HumanEval/97", "completion": "\ndef multiply(a, b):\n return (a % 10) * (b % 10)", "result": "passed", "passed": true} {"task_id": "HumanEval/98", "completion": "\ndef count_upper(s):\n vowels = set(['A', 'E', 'I', 'O', 'U'])\n count = 0\n for i in range(0, len(s), 2):\n if s[i].isupper() and s[i] in vowels:\n count += 1\n return count", "result": "passed", "passed": true} {"task_id": "HumanEval/99", "completion": "\ndef closest_integer(value):\n num = float(value)\n if num >= 0:\n return int(num + 0.5)\n else:\n return int(num - 0.5)", "result": "passed", "passed": true} {"task_id": "HumanEval/100", "completion": "\ndef make_a_pile(n):\n result = []\n for i in range(n):\n if i % 2 == 0:\n result.append(n + i)\n else:\n result.append(n - i)\n return result", "result": "failed: Test 3", "passed": false} {"task_id": "HumanEval/101", "completion": "\ndef words_string(s):\n return s.replace(',', ' ').split()", "result": "passed", "passed": true} {"task_id": "HumanEval/102", "completion": "\ndef choose_num(x, y):\n for i in range(x, y+1):\n if i % 2 == 0:\n return i\n return -1", "result": "failed: ", "passed": false} {"task_id": "HumanEval/103", "completion": "\ndef rounded_avg(n, m):\n if n > m:\n return -1\n total = 0\n for i in range(n, m+1):\n total += i\n avg = round(total / (m - n + 1))\n return bin(avg)[2:]", "result": "failed: ", "passed": false} {"task_id": "HumanEval/104", "completion": "\ndef unique_digits(x):\n return sorted(set(num for num in x if all(int(digit) % 2 != 0 for digit in str(num))))", "result": "passed", "passed": true} {"task_id": "HumanEval/105", "completion": "\ndef by_length(arr):\n if not arr:\n return []\n else:\n length = len(arr)\n if length < 1:\n return []\n elif length > 9:\n return []\n else:\n arr.sort()\n arr.reverse()\n result = []\n for i in range(length):\n if 1 <= arr[i] <= 9:\n result.append([\"One\", \"Two\", \"Three\", \"Four\", \"Five\", \"Six\", \"Seven\", \"Eight\", \"Nine\"].index(\n str(arr[i])\n ) + 1)\n else:\n return []\n return result", "result": "failed: '8' is not in list", "passed": false} {"task_id": "HumanEval/106", "completion": "\ndef f(n):\n result = []\n for i in range(1, n+1):\n if i % 2 == 0:\n factorial = 1\n for j in range(1, i+1):\n factorial *= j\n result.append(factorial)\n else:\n sum_of_numbers = sum(range(1, i+1))\n result.append(sum_of_numbers)\n return result", "result": "passed", "passed": true} {"task_id": "HumanEval/107", "completion": "\ndef even_odd_palindrome(n):\n even_count = 0\n odd_count = 0\n for i in range(1, n+1):\n if str(i) == str(i)[::-1]:\n if i % 2 == 0:\n even_count += 1\n else:\n odd_count += 1\n return (even_count, odd_count)", "result": "passed", "passed": true} {"task_id": "HumanEval/108", "completion": "\ndef count_nums(arr):\n count = 0\n for num in arr:\n if sum(int(digit) for digit in str(abs(num))) > 0:\n count += 1\n return count", "result": "failed: ", "passed": false} {"task_id": "HumanEval/109", "completion": "\ndef move_one_ball(arr):\n if not arr:\n return True\n sorted_arr = sorted(arr)\n for i in range(len(arr)):\n if arr == sorted_arr:\n return True\n arr = [arr[-1]] + arr[:-1]\n return False", "result": "passed", "passed": true} {"task_id": "HumanEval/110", "completion": "\ndef exchange(lst1, lst2):\n # \u7edf\u8ba1lst1\u4e2d\u5947\u6570\u7684\u4e2a\u6570\n odd_count = sum(1 for num in lst1 if num % 2 != 0)\n \n # \u7edf\u8ba1lst2\u4e2d\u5947\u6570\u7684\u4e2a\u6570\n odd_count += sum(1 for num in lst2 if num % 2 != 0)\n \n # \u5982\u679clst1\u4e2d\u5947\u6570\u7684\u4e2a\u6570\u4e3a\u5076\u6570\uff0c\u5219\u8fd4\u56de\"YES\"\n if odd_count % 2 == 0:\n return \"YES\"\n else:\n return \"NO\"", "result": "failed: ", "passed": false} {"task_id": "HumanEval/111", "completion": "\ndef histogram(test):\n if not test:\n return {}\n test = test.split()\n char_count = {}\n max_count = 0\n for char in test:\n if char in char_count:\n char_count[char] += 1\n else:\n char_count[char] = 1\n max_count = max(max_count, char_count[char])\n result = {}\n for char, count in char_count.items():\n if count == max_count:\n result[char] = count\n return result", "result": "passed", "passed": true} {"task_id": "HumanEval/112", "completion": "\ndef reverse_delete(s,c):\n s = ''.join([char for char in s if char not in c])\n return s, s == s[::-1]", "result": "passed", "passed": true} {"task_id": "HumanEval/113", "completion": "\ndef odd_count(lst):\n result = []\n for s in lst:\n count = sum(1 for c in s if int(c) % 2 != 0)\n result.append(f\"the number of odd elements {count}n the str{s}ng {count} of the {count}nput.\")\n return result", "result": "failed: Test 1", "passed": false} {"task_id": "HumanEval/114", "completion": "\ndef minSubArraySum(nums):\n if not nums:\n return 0\n \n min_sum = float('inf')\n current_sum = 0\n \n for num in nums:\n current_sum += num\n min_sum = min(min_sum, current_sum)\n \n if current_sum < 0:\n current_sum = 0\n \n return min_sum", "result": "failed: This prints if this assert fails 1 (good for debugging!)", "passed": false} {"task_id": "HumanEval/115", "completion": "\ndef max_fill(grid, capacity):\n import math\n m, n = len(grid), len(grid[0])\n buckets = [0] * n\n for i in range(m):\n for j in range(n):\n if grid[i][j] == 1:\n buckets[j] += 1\n max_fill = 0\n for i in range(n):\n if buckets[i] > 0:\n cur_capacity = capacity\n for j in range(i, n):\n if grid[i][j] == 1:\n cur_capacity -= 1\n if cur_capacity < 0:\n break\n max_fill += 1\n return max_fill", "result": "failed: list index out of range", "passed": false} {"task_id": "HumanEval/116", "completion": "\ndef sort_array(arr):\n def count_ones(num):\n return bin(num).count('1')\n return sorted(arr, key=lambda x: (count_ones(x), x))", "result": "passed", "passed": true} {"task_id": "HumanEval/117", "completion": "\ndef select_words(s, n):\n vowels = set('aeiou')\n words = s.split()\n result = []\n for word in words:\n if len([c for c in word if c not in vowels]) == n:\n result.append(word)\n return result", "result": "failed: Fifth test error: []", "passed": false} {"task_id": "HumanEval/118", "completion": "\ndef get_closest_vowel(word):\n vowels = \"aeiouAEIOU\"\n consonants = \"bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ\"\n for i in range(len(word)-1, -1, -1):\n if word[i] in vowels:\n for j in range(i+1, len(word)):\n if word[j] in consonants:\n return word[i]\n return \"\"", "result": "failed: ", "passed": false} {"task_id": "HumanEval/119", "completion": "\ndef match_parens(lst):\n if not lst:\n return 'No'\n if lst[0][0] == ')' or lst[0][-1] == '(':\n return 'No'\n if lst[1][0] == '(' and lst[0][-1] == ')':\n return 'Yes'\n return 'No'", "result": "failed: ", "passed": false} {"task_id": "HumanEval/120", "completion": "\ndef maximum(arr, k):\n arr.sort(reverse=True)\n return arr[:k]", "result": "failed: ", "passed": false} {"task_id": "HumanEval/121", "completion": "\ndef solution(lst):\n return sum([lst[i] for i in range(1, len(lst), 2) if lst[i] % 2 != 0])", "result": "failed: ", "passed": false} {"task_id": "HumanEval/122", "completion": "\ndef add_elements(arr, k):\n count = 0\n total = 0\n for num in arr:\n if num < 100:\n count += 1\n total += num\n if count == k:\n break\n return total", "result": "failed: ", "passed": false} {"task_id": "HumanEval/123", "completion": "\ndef get_odd_collatz(n):\n result = []\n while n != 1:\n if n % 2 == 1:\n result.append(n)\n n = n // 2 if n % 2 == 0 else n * 3 + 1\n return sorted(result)", "result": "failed: ", "passed": false} {"task_id": "HumanEval/124", "completion": "\ndef valid_date(date):\n if not date:\n return False\n month, day, year = date.split('-')\n if not month.isdigit() or not day.isdigit() or not year.isdigit():\n return False\n month = int(month)\n day = int(day)\n year = int(year)\n if month < 1 or month > 12:\n return False\n if month in [1, 3, 5, 7, 8, 10, 12]:\n if day < 1 or day > 31:\n return False\n elif month in [4, 6, 9, 11]:\n if day < 1 or day > 30:\n return False\n elif month == 2:\n if (year % 4 == 0 and year % 100 != 0) or year % 400 == 0:\n if day < 1 or day > 29:\n return False\n else:\n if day < 1 or day > 28:\n return False\n return True", "result": "failed: not enough values to unpack (expected 3, got 1)", "passed": false} {"task_id": "HumanEval/125", "completion": "\ndef split_words(txt):\n if ' ' in txt:\n return txt.split(' ')\n elif ',' in txt:\n return txt.split(',')\n else:\n return sum(1 for c in txt if ord(c.lower()) % 2 != 0)", "result": "failed: ", "passed": false} {"task_id": "HumanEval/126", "completion": "\ndef is_sorted(lst):\n if len(lst) != len(set(lst)):\n return False\n return lst == sorted(lst)", "result": "failed: This prints if this assert fails 7 (good for debugging!)", "passed": false} {"task_id": "HumanEval/127", "completion": "\ndef intersection(interval1, interval2):\n start1, end1 = interval1\n start2, end2 = interval2\n \n # \u8ba1\u7b97\u4ea4\u96c6\u7684\u8d77\u59cb\u503c\u548c\u7ed3\u675f\u503c\n start = max(start1, start2)\n end = min(end1, end2)\n \n # \u8ba1\u7b97\u4ea4\u96c6\u7684\u957f\u5ea6\n length = end - start + 1\n \n # \u5224\u65ad\u4ea4\u96c6\u957f\u5ea6\u662f\u5426\u4e3a\u8d28\u6570\n if length < 2:\n return \"NO\"\n for i in range(2, int(length ** 0.5) + 1):\n if length % i == 0:\n return \"NO\"\n return \"YES\"", "result": "failed: ", "passed": false} {"task_id": "HumanEval/128", "completion": "\ndef prod_signs(arr):\n if not arr:\n return None\n abs_sum = sum(abs(num) for num in arr)\n sign_prod = 1\n for num in arr:\n if num > 0:\n sign_prod *= 1\n elif num < 0:\n sign_prod *= -1\n else:\n sign_prod *= 0\n return abs_sum * sign_prod", "result": "passed", "passed": true} {"task_id": "HumanEval/129", "completion": "\ndef minPath(grid, k):\n n = len(grid)\n directions = [(0, 1), (0, -1), (1, 0), (-1, 0)]\n def dfs(x, y, path):\n if len(path) == k:\n return path\n for dx, dy in directions:\n nx, ny = x + dx, y + dy\n if 0 <= nx < n and 0 <= ny < n and (nx, ny) not in path:\n new_path = dfs(nx, ny, path + [(nx, ny)])\n if new_path:\n return new_path\n return None\n for i in range(n):\n for j in range(n):\n path = dfs(i, j, [(i, j)])\n if path:\n return [grid[x][y] for x, y in path]", "result": "failed: ", "passed": false} {"task_id": "HumanEval/130", "completion": "\ndef tri(n):\n if n == 1:\n return [3]\n elif n == 0:\n return []\n else:\n result = [3]\n a, b = 1, 3\n for i in range(2, n + 1):\n if i % 2 == 0:\n result.append(1 + i // 2)\n else:\n c = a + b + result[-1]\n result.append(c)\n a, b = b, c\n return result", "result": "failed: ", "passed": false} {"task_id": "HumanEval/131", "completion": "\ndef digits(n):\n product = 1\n while n > 0:\n digit = n % 10\n if digit % 2 == 1:\n product *= digit\n n //= 10\n return product if product > 0 else 0", "result": "failed: ", "passed": false} {"task_id": "HumanEval/132", "completion": "\ndef is_nested(string):\n stack = []\n for char in string:\n if char == '[':\n stack.append(char)\n elif char == ']':\n if len(stack) == 0 or stack[-1] != '[':\n return False\n stack.pop()\n return len(stack) > 0", "result": "failed: This prints if this assert fails 1 (good for debugging!)", "passed": false} {"task_id": "HumanEval/133", "completion": "\ndef sum_squares(lst):\n return sum([int(x)**2 for x in lst])", "result": "failed: This prints if this assert fails 1 (good for debugging!)", "passed": false} {"task_id": "HumanEval/134", "completion": "\ndef check_if_last_char_is_a_letter(txt):\n if not txt:\n return False\n words = txt.split()\n last_word = words[-1]\n if last_word and last_word[-1].isalpha() and not any(last_word.lower().endswith(word.lower()) for word in words[:-1]):\n return True\n return False", "result": "failed: ", "passed": false} {"task_id": "HumanEval/135", "completion": "\ndef can_arrange(arr):\n max_index = -1\n for i in range(1, len(arr)):\n if arr[i] <= arr[i-1]:\n max_index = i-1\n return max_index", "result": "failed: ", "passed": false} {"task_id": "HumanEval/136", "completion": "\ndef largest_smallest_integers(lst):\n neg_nums = [num for num in lst if num < 0]\n pos_nums = [num for num in lst if num > 0]\n if neg_nums:\n max_neg = max(neg_nums)\n else:\n max_neg = None\n if pos_nums:\n min_pos = min(pos_nums)\n else:\n min_pos = None\n return (max_neg, min_pos)", "result": "passed", "passed": true} {"task_id": "HumanEval/137", "completion": "\ndef compare_one(a, b):\n if isinstance(a, str):\n a = a.replace(',', '.')\n a = float(a)\n if isinstance(b, str):\n b = b.replace(',', '.')\n b = float(b)\n if a > b:\n return a\n elif a < b:\n return b\n else:\n return None", "result": "failed: ", "passed": false} {"task_id": "HumanEval/138", "completion": "\ndef is_equal_to_sum_even(n):\n if n % 2 != 0:\n return False\n for i in range(1, n//2+1):\n if (n - i) % 2 == 0 and (n - i) // 2 > i:\n return True\n return False", "result": "passed", "passed": true} {"task_id": "HumanEval/139", "completion": "\ndef special_factorial(n):\n result = 1\n for i in range(1, n+1):\n factorial = 1\n for j in range(1, i+1):\n factorial *= j\n result *= factorial\n return result", "result": "passed", "passed": true} {"task_id": "HumanEval/140", "completion": "\ndef fix_spaces(text):\n result = \"\"\n consecutive_spaces = 0\n for char in text:\n if char == \" \":\n consecutive_spaces += 1\n if consecutive_spaces > 2:\n result += \"-\"\n else:\n result += \"_\"\n else:\n result += char\n consecutive_spaces = 0\n return result", "result": "failed: This prints if this assert fails 4 (good for debugging!)", "passed": false} {"task_id": "HumanEval/141", "completion": "\ndef file_name_check(file_name):\n if file_name.count('.') != 1:\n return 'No'\n else:\n name, ext = file_name.split('.')\n if not name or not name[0].isalpha():\n return 'No'\n if ext not in ['txt', 'exe', 'dll']:\n return 'No'\n if sum(c.isdigit() for c in name) > 3:\n return 'No'\n return 'Yes'", "result": "passed", "passed": true} {"task_id": "HumanEval/142", "completion": "\ndef sum_squares(lst):\n total = 0\n for i in range(len(lst)):\n if i % 3 == 0:\n total += lst[i] ** 2\n elif i % 4 == 0:\n total += lst[i] ** 3\n else:\n total += lst[i]\n return total", "result": "passed", "passed": true} {"task_id": "HumanEval/143", "completion": "\ndef words_in_sentence(sentence):\n def is_prime(n):\n if n <= 1:\n return False\n for i in range(2, int(n**0.5) + 1):\n if n % i == 0:\n return False\n return True\n words = sentence.split()\n result = [word for word in words if is_prime(len(word))]\n return ' '.join(result)", "result": "passed", "passed": true} {"task_id": "HumanEval/144", "completion": "\ndef simplify(x, n):\n # \u5c06\u5206\u6570\u8f6c\u6362\u4e3a\u5206\u5b50\u548c\u5206\u6bcd\u7684\u6574\u6570\n x_num, x_den = map(int, x.split('/'))\n n_num, n_den = map(int, n.split('/'))\n \n # \u8ba1\u7b97\u4e58\u79ef\u7684\u5206\u5b50\u548c\u5206\u6bcd\n result_num = x_num * n_num\n result_den = x_den * n_den\n \n # \u5224\u65ad\u4e58\u79ef\u662f\u5426\u4e3a\u6574\u6570\n return result_num % result_den == 0", "result": "passed", "passed": true} {"task_id": "HumanEval/145", "completion": "\ndef order_by_points(nums):\n def get_digit_sum(num):\n return sum(int(digit) for digit in str(abs(num)))\n return sorted(nums, key=lambda x: (get_digit_sum(x), nums.index(x)))", "result": "failed: ", "passed": false} {"task_id": "HumanEval/146", "completion": "\ndef specialFilter(nums):\n count = 0\n for num in nums:\n if num > 10 and str(num)[0] in ['1', '3', '5', '7', '9'] and str(num)[-1] in ['1', '3', '5', '7', '9']:\n count += 1\n return count", "result": "passed", "passed": true} {"task_id": "HumanEval/147", "completion": "\ndef get_max_triples(n):\n a = [i * i - i + 1 for i in range(1, n+1)]\n count = 0\n for i in range(n-2):\n for j in range(i+1, n-1):\n for k in range(j+1, n):\n if (a[i] + a[j] + a[k]) % 3 == 0:\n count += 1\n return count", "result": "passed", "passed": true} {"task_id": "HumanEval/148", "completion": "\ndef bf(planet1, planet2):\n planets = [\"Mercury\", \"Venus\", \"Earth\", \"Mars\", \"Jupiter\", \"Saturn\", \"Uranus\", \"Neptune\"]\n if planet1 not in planets or planet2 not in planets:\n return ()\n start_index = min(planets.index(planet1), planets.index(planet2))\n end_index = max(planets.index(planet1), planets.index(planet2))\n result = planets[start_index+1:end_index]\n return tuple(result)", "result": "passed", "passed": true} {"task_id": "HumanEval/149", "completion": "\ndef sorted_list_sum(lst):\n return sorted([s for s in lst if len(s) % 2 == 0], key=lambda x: (len(x), x))", "result": "passed", "passed": true} {"task_id": "HumanEval/150", "completion": "\ndef x_or_y(n, x, y):\n if n < 2:\n return y\n for i in range(2, int(n**0.5) + 1):\n if n % i == 0:\n return y\n return x", "result": "passed", "passed": true} {"task_id": "HumanEval/151", "completion": "\ndef double_the_difference(lst):\n \n return sum([x**2 for x in lst if x > 0 and x % 2 == 1])", "result": "passed", "passed": true} {"task_id": "HumanEval/152", "completion": "\ndef compare(game,guess):\n res = []\n for i in range(len(game)):\n if game[i] == guess[i]:\n res.append(0)\n else:\n res.append(abs(game[i]-guess[i]))\n return res", "result": "passed", "passed": true} {"task_id": "HumanEval/153", "completion": "\ndef Strongest_Extension(class_name, extensions):\n strongest_extension = None\n max_strength = float('-inf')\n for extension in extensions:\n cap_count = sum(1 for char in extension if char.isupper())\n sm_count = sum(1 for char in extension if char.islower())\n strength = cap_count - sm_count\n if strength > max_strength:\n max_strength = strength\n strongest_extension = extension\n return f\"{class_name}.{strongest_extension}\"", "result": "passed", "passed": true} {"task_id": "HumanEval/154", "completion": "\ndef cycpattern_check(a , b):\n if len(a) != len(b):\n return False\n for i in range(len(b)):\n if a in b[i:] + b[:i]:\n return True\n return False", "result": "failed: test #1", "passed": false} {"task_id": "HumanEval/155", "completion": "\ndef even_odd_count(num):\n even_count = 0\n odd_count = 0\n num_str = str(abs(num))\n for digit in num_str:\n if int(digit) % 2 == 0:\n even_count += 1\n else:\n odd_count += 1\n if num < 0:\n return (even_count, odd_count)\n else:\n return (even_count, odd_count)", "result": "passed", "passed": true} {"task_id": "HumanEval/156", "completion": "\ndef int_to_mini_roman(number):\n roman_numerals = {\n 1: 'i', 4: 'iv', 5: 'v', 9: 'ix', 10: 'x', 40: 'xl',\n 50: 'l', 90: 'xc', 100: 'c', 400: 'cd', 500: 'd', 900: 'cm', 1000: 'm'\n }\n result = ''\n for value, numeral in sorted(roman_numerals.items(), reverse=True):\n while number >= value:\n result += numeral\n number -= value\n return result", "result": "passed", "passed": true} {"task_id": "HumanEval/157", "completion": "\ndef right_angle_triangle(a, b, c):\n sides = [a, b, c]\n sides.sort()\n return abs(sides[0]**2 + sides[1]**2 - sides[2]**2) < 1e-9", "result": "passed", "passed": true} {"task_id": "HumanEval/158", "completion": "\ndef find_max(words):\n max_unique_chars = 0\n max_word = \"\"\n for word in words:\n unique_chars = len(set(word))\n if unique_chars > max_unique_chars:\n max_unique_chars = unique_chars\n max_word = word\n elif unique_chars == max_unique_chars and word < max_word:\n max_word = word\n return max_word", "result": "passed", "passed": true} {"task_id": "HumanEval/159", "completion": "\ndef eat(number, need, remaining):\n if remaining < need:\n return [number + remaining, 0]\n else:\n return [number + need, remaining - need]", "result": "passed", "passed": true} {"task_id": "HumanEval/160", "completion": "\ndef do_algebra(operator, operand):\n result = operand[0]\n for i in range(1, len(operand)):\n if operator[i-1] == '+':\n result += operand[i]\n elif operator[i-1] == '-':\n result -= operand[i]\n elif operator[i-1] == '*':\n result *= operand[i]\n elif operator[i-1] == '//':\n result //= operand[i]\n elif operator[i-1] == '**':\n result **= operand[i]\n return result", "result": "failed: ", "passed": false} {"task_id": "HumanEval/161", "completion": "\ndef solve(s):\n if not any(c.isalpha() for c in s):\n return s[::-1]\n else:\n return ''.join([c.lower() if c.isupper() else c.upper() for c in s])", "result": "passed", "passed": true} {"task_id": "HumanEval/162", "completion": "\ndef string_to_md5(text):\n if not text:\n return None\n else:\n return hashlib.md5(text.encode('utf-8')).hexdigest()", "result": "failed: name 'hashlib' is not defined", "passed": false} {"task_id": "HumanEval/163", "completion": "\ndef generate_integers(a, b):\n result = []\n if a > b:\n a, b = b, a\n for i in range(a, b+1):\n if i % 2 == 0:\n result.append(i)\n return result", "result": "failed: Test 1", "passed": false}