{"date": "2026-11-02 21:14", "hash": "fe585eb4df8c88d844eeb463ea4d0302", "eval": {"HumanEval/1": [{"task_id": "HumanEval/1", "solution": "from typing import List\ndef separate_paren_groups(paren_string: str) -> List[str]:\n    \"\"\"\n    Split a string of balanced parenthesis groups into a list of the groups.\n\n    Parameters\n    ----------\n    paren_string : str\n        A string that may contain spaces and several groups of nested\n        parentheses.  The groups are guaranteed to be balanced and not\n        nested within each other.\n\n    Returns\n    -------\n    List[str]\n        A list containing each balanced group as a separate string.\n\n    Examples\n    --------\n    >>> separate_paren_groups('( ) (( )) (( )( ))')\n    ['()', '(())', '(()())']\n\n    >>> separate_paren_groups('((a)(b)) (c) ((d))')\n    ['((a)(b))', '(c)', '((d))']\n    \"\"\"\n    groups: List[str] = []\n    current: List[str] = []\n    depth = 0\n\n    for ch in paren_string:\n        if ch == ' ':\n            # ignore spaces\n            continue\n        if ch == '(':\n            depth += 1\n            current.append(ch)\n        elif ch == ')':\n            depth -= 1\n            current.append(ch)\n            if depth == 0:\n                # a complete group has been collected\n                groups.append(''.join(current))\n                current = []\n        else:\n            # any other character is treated as part of the current group\n            # (this allows the function to work with strings that contain\n            # letters or digits inside the parentheses)\n            current.append(ch)\n\n    # In a well\u2011formed input depth should be 0 at the end.\n    # If it is not, we simply ignore the incomplete part.\n    return groups", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/2": [{"task_id": "HumanEval/2", "solution": "def truncate_number(number: float) -> float:\n    \"\"\"\n    Return the decimal part of a positive floating point number.\n\n    The decimal part is the remainder after removing the integer part.\n    For example, ``3.5`` becomes ``0.5`` and ``10.0`` becomes ``0.0``.\n\n    Parameters\n    ----------\n    number : float\n        A positive floating point number.\n\n    Returns\n    -------\n    float\n        The fractional part of *number*.\n\n    Examples\n    --------\n    >>> truncate_number(3.5)\n    0.5\n    >>> truncate_number(10.0)\n    0.0\n    >>> truncate_number(0.12345)\n    0.12345\n    \"\"\"\n    if number < 0:\n        raise ValueError(\"truncate_number expects a positive number\")\n    return number - int(number)", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/0": [{"task_id": "HumanEval/0", "solution": "from typing import List\nimport sys\nimport doctest\ndef has_close_elements(numbers: List[float], threshold: float) -> bool:\n    \"\"\"\n    Return ``True`` if any two numbers in *numbers* are closer to each other\n    than *threshold*.\n\n    The algorithm works as follows:\n\n    1.  Sort the list.  After sorting, any two numbers that are closer than the\n        threshold must be adjacent in the sorted order.\n    2.  Scan the sorted list once, comparing each element with the next one.\n        If the difference is smaller than the threshold, return ``True``.\n    3.  If the loop finishes without finding such a pair, return ``False``.\n\n    Parameters\n    ----------\n    numbers : List[float]\n        The list of numbers to examine.\n    threshold : float\n        The minimum allowed distance between any two numbers.\n\n    Returns\n    -------\n    bool\n        ``True`` if a pair of numbers is closer than *threshold*, otherwise\n        ``False``.\n\n    Examples\n    --------\n    >>> has_close_elements([1.0, 2.0, 3.0], 0.5)\n    False\n    >>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3)\n    True\n    >>> has_close_elements([], 1.0)\n    False\n    >>> has_close_elements([5.0], 0.1)\n    False\n    \"\"\"\n    if len(numbers) < 2:\n        return False\n\n    # Sorting is required to bring close numbers next to each other.\n    sorted_numbers = sorted(numbers)\n\n    # Compare each element with its successor.\n    for i in range(len(sorted_numbers) - 1):\n        if abs(sorted_numbers[i + 1] - sorted_numbers[i]) < threshold:\n            return True\n\n    return False", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/3": [{"task_id": "HumanEval/3", "solution": "from typing import List\ndef below_zero(operations: List[int]) -> bool:\n    \"\"\"\n    Return ``True`` if the account balance ever becomes negative.\n\n    Parameters\n    ----------\n    operations : List[int]\n        A list of integers where positive values represent deposits and\n        negative values represent withdrawals.\n\n    Returns\n    -------\n    bool\n        ``True`` if the balance falls below zero at any point, otherwise\n        ``False``.\n\n    Examples\n    --------\n    >>> below_zero([1, 2, 3])\n    False\n    >>> below_zero([1, 2, -4, 5])\n    True\n    >>> below_zero([-1, 2, -3])\n    True\n    >>> below_zero([])\n    False\n    \"\"\"\n    balance = 0\n    for op in operations:\n        balance += op\n        if balance < 0:\n            return True\n    return False", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/6": [{"task_id": "HumanEval/6", "solution": "from typing import List\ndef parse_nested_parens(paren_string: str) -> List[int]:\n    \"\"\"\n    Return the maximum depth of nested parentheses for each group in\n    ``paren_string``.  Groups are separated by whitespace.\n\n    Parameters\n    ----------\n    paren_string : str\n        A string containing one or more groups of parentheses.  Each\n        group may contain any number of opening and closing\n        parentheses, but the string is guaranteed to be well\u2011formed\n        (every '(' has a matching ')').\n\n    Returns\n    -------\n    List[int]\n        A list of integers, one per group, where each integer is the\n        deepest level of nesting found in that group.\n\n    Examples\n    --------\n    >>> parse_nested_parens('(()()) ((())) () ((())()())')\n    [2, 3, 1, 3]\n    \"\"\"\n    # Split the input on whitespace to get individual groups.\n    groups = paren_string.split()\n\n    depths: List[int] = []\n\n    for group in groups:\n        current_depth = 0\n        max_depth = 0\n\n        for ch in group:\n            if ch == '(':\n                current_depth += 1\n                if current_depth > max_depth:\n                    max_depth = current_depth\n            elif ch == ')':\n                current_depth -= 1\n                # In a well\u2011formed string current_depth will never go negative.\n            else:\n                # Ignore any non\u2011parenthesis characters (shouldn't happen\n                # in the problem statement, but makes the function more robust).\n                continue\n\n        depths.append(max_depth)\n\n    return depths", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/7": [{"task_id": "HumanEval/7", "solution": "from typing import List\ndef filter_by_substring(strings: List[str], substring: str) -> List[str]:\n    \"\"\"\n    Return a new list containing only the strings from *strings* that contain\n    *substring*.\n\n    Parameters\n    ----------\n    strings : List[str]\n        The list of strings to filter.\n    substring : str\n        The substring to look for.\n\n    Returns\n    -------\n    List[str]\n        A list of strings that contain *substring*.\n\n    Examples\n    --------\n    >>> filter_by_substring([], 'a')\n    []\n    >>> filter_by_substring(['abc', 'bacd', 'cde', 'array'], 'a')\n    ['abc', 'bacd', 'array']\n    >>> filter_by_substring(['foo', 'bar', 'baz'], 'z')\n    ['baz']\n    >>> filter_by_substring(['foo', 'bar', 'baz'], 'x')\n    []\n    \"\"\"\n    # Using a list comprehension keeps the code short and readable.\n    return [s for s in strings if substring in s]", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/5": [{"task_id": "HumanEval/5", "solution": "from typing import List\ndef intersperse(numbers: List[int], delimeter: int) -> List[int]:\n    \"\"\"\n    Insert a number ``delimeter`` between every two consecutive elements of\n    the input list ``numbers``.\n\n    Parameters\n    ----------\n    numbers : List[int]\n        The list of integers to intersperse.\n    delimeter : int\n        The value to insert between consecutive elements.\n\n    Returns\n    -------\n    List[int]\n        A new list with ``delimeter`` inserted between each pair of elements.\n\n    Examples\n    --------\n    >>> intersperse([], 4)\n    []\n    >>> intersperse([1, 2, 3], 4)\n    [1, 4, 2, 4, 3]\n    >>> intersperse([10], 99)\n    [10]\n    \"\"\"\n    if not numbers:\n        return []\n\n    # Start with the first element\n    result: List[int] = [numbers[0]]\n\n    # Append the delimiter and the next element for every remaining item\n    for num in numbers[1:]:\n        result.append(delimeter)\n        result.append(num)\n\n    return result", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/4": [{"task_id": "HumanEval/4", "solution": "from typing import Iterable, List, Sequence\ndef mean_absolute_deviation(numbers: Iterable[float]) -> float:\n    \"\"\"\n    Return the Mean Absolute Deviation (MAD) of *numbers* around their mean.\n\n    The MAD is defined as the average of the absolute differences between each\n    element and the arithmetic mean of the dataset:\n\n        MAD = (1 / N) * \u03a3 |x_i - mean|\n\n    Parameters\n    ----------\n    numbers : Iterable[float]\n        A sequence of numeric values.  Empty sequences raise a ValueError.\n\n    Returns\n    -------\n    float\n        The MAD of the input numbers.\n\n    Raises\n    ------\n    ValueError\n        If *numbers* is empty.\n\n    Examples\n    --------\n    >>> mean_absolute_deviation([1.0, 2.0, 3.0, 4.0])\n    1.0\n    >>> mean_absolute_deviation([5, 5, 5, 5])\n    0.0\n    >>> mean_absolute_deviation([1, 2, 3])\n    0.6666666666666666\n    \"\"\"\n    # Convert to a list so we can iterate multiple times\n    data: List[float] = list(numbers)\n\n    if not data:\n        raise ValueError(\"mean_absolute_deviation requires at least one number\")\n\n    mean_val = sum(data) / len(data)\n    abs_diffs = [abs(x - mean_val) for x in data]\n    return sum(abs_diffs) / len(data)", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/11": [{"task_id": "HumanEval/11", "solution": "from typing import List\nimport sys\nimport doctest\ndef string_xor(a: str, b: str) -> str:\n    \"\"\"\n    Perform binary XOR on two strings consisting only of '0' and '1'.\n\n    The function assumes that both strings are of equal length.  If they are\n    not, the shorter string is padded on the left with zeros so that the\n    XOR operation can be performed element\u2011wise.\n\n    Parameters\n    ----------\n    a : str\n        First binary string.\n    b : str\n        Second binary string.\n\n    Returns\n    -------\n    str\n        Result of the XOR operation, also a binary string.\n\n    Examples\n    --------\n    >>> string_xor('010', '110')\n    '100'\n    >>> string_xor('1', '0')\n    '1'\n    >>> string_xor('1010', '0011')\n    '1001'\n    >>> string_xor('101', '1100')\n    '0111'   # note: the first string is padded to '0101'\n    \"\"\"\n    # Pad the shorter string with leading zeros\n    max_len = max(len(a), len(b))\n    a = a.zfill(max_len)\n    b = b.zfill(max_len)\n\n    # Build the result character by character\n    result: List[str] = []\n    for bit_a, bit_b in zip(a, b):\n        # XOR: 1 if bits differ, 0 otherwise\n        xor_bit = '1' if bit_a != bit_b else '0'\n        result.append(xor_bit)\n\n    return ''.join(result)", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/13": [{"task_id": "HumanEval/13", "solution": "from typing import Tuple\ndef greatest_common_divisor(a: int, b: int) -> int:\n    \"\"\"\n    Return the greatest common divisor (GCD) of two integers a and b.\n\n    The function uses the Euclidean algorithm, which repeatedly\n    replaces the larger number by its remainder when divided by the\n    smaller number until the remainder is zero.  The last non\u2011zero\n    remainder is the GCD.\n\n    Parameters\n    ----------\n    a : int\n        First integer.\n    b : int\n        Second integer.\n\n    Returns\n    -------\n    int\n        The greatest common divisor of a and b.\n\n    Examples\n    --------\n    >>> greatest_common_divisor(3, 5)\n    1\n    >>> greatest_common_divisor(25, 15)\n    5\n    >>> greatest_common_divisor(-12, 18)\n    6\n    >>> greatest_common_divisor(0, 7)\n    7\n    >>> greatest_common_divisor(0, 0)\n    0\n    \"\"\"\n    # Handle the special case where both numbers are zero.\n    if a == 0 and b == 0:\n        return 0\n\n    # Work with absolute values to avoid negative remainders.\n    a, b = abs(a), abs(b)\n\n    # Euclidean algorithm loop.\n    while b:\n        a, b = b, a % b\n    return a", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/12": [{"task_id": "HumanEval/12", "solution": "from typing import List, Optional\ndef longest(strings: List[str]) -> Optional[str]:\n    \"\"\"\n    Return the longest string from *strings*.\n\n    If several strings share the maximum length, the first one in the list\n    is returned.  If *strings* is empty, ``None`` is returned.\n\n    Parameters\n    ----------\n    strings : List[str]\n        A list of strings to examine.\n\n    Returns\n    -------\n    Optional[str]\n        The longest string, or ``None`` if the list is empty.\n\n    Examples\n    --------\n    >>> longest([])\n    >>> longest(['a', 'b', 'c'])\n    'a'\n    >>> longest(['a', 'bb', 'ccc'])\n    'ccc'\n    >>> longest(['foo', 'bar', 'baz'])\n    'foo'\n    >>> longest(['', ''])\n    ''\n    \"\"\"\n    if not strings:\n        return None\n\n    # Initialise with the first element; this guarantees the first\n    # string of the maximum length is returned in case of ties.\n    longest_str = strings[0]\n    max_len = len(longest_str)\n\n    for s in strings[1:]:\n        if len(s) > max_len:\n            longest_str = s\n            max_len = len(s)\n\n    return longest_str", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/9": [{"task_id": "HumanEval/9", "solution": "from typing import List\ndef rolling_max(numbers: List[int]) -> List[int]:\n    \"\"\"\n    Return a list of the rolling maximums of *numbers*.\n\n    The i\u2011th element of the result is the maximum of ``numbers[: i + 1]``.\n    The function runs in O(n) time and O(1) additional space.\n\n    Parameters\n    ----------\n    numbers : List[int]\n        The input list of integers.\n\n    Returns\n    -------\n    List[int]\n        A list of the same length where each element is the maximum seen so far.\n\n    Examples\n    --------\n    >>> rolling_max([1, 2, 3, 2, 3, 4, 2])\n    [1, 2, 3, 3, 3, 4, 4]\n    >>> rolling_max([])\n    []\n    >>> rolling_max([5])\n    [5]\n    \"\"\"\n    if not numbers:\n        return []\n\n    max_so_far = numbers[0]\n    result: List[int] = [max_so_far]\n\n    for num in numbers[1:]:\n        if num > max_so_far:\n            max_so_far = num\n        result.append(max_so_far)\n\n    return result", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/10": [{"task_id": "HumanEval/10", "solution": "from typing import List\nimport sys\nimport unittest\ndef is_palindrome(s: str) -> bool:\n    \"\"\"Return True if *s* is a palindrome.\"\"\"\n    return s == s[::-1]\ndef make_palindrome(s: str) -> str:\n    \"\"\"\n    Return the shortest palindrome that starts with *s*.\n\n    The function works by finding the longest suffix of *s* that is a palindrome.\n    Everything before that suffix is mirrored and appended to the end.\n\n    Examples\n    --------\n    >>> make_palindrome('')\n    ''\n    >>> make_palindrome('cat')\n    'catac'\n    >>> make_palindrome('cata')\n    'catac'\n    >>> make_palindrome('race')\n    'racecar'\n    >>> make_palindrome('ababa')\n    'ababa'\n    \"\"\"\n    n = len(s)\n    # Find the longest palindromic suffix\n    for i in range(n):\n        suffix = s[i:]\n        if is_palindrome(suffix):\n            # Mirror the prefix before the suffix\n            prefix = s[:i]\n            return s + prefix[::-1]\n    # Fallback: the whole string is not a palindrome (should never happen)\n    return s + s[::-1]", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/8": [{"task_id": "HumanEval/8", "solution": "from typing import List, Tuple\nimport sys\nimport doctest\ndef sum_product(numbers: List[int]) -> Tuple[int, int]:\n    \"\"\"\n    For a given list of integers, return a tuple consisting of a sum and a product\n    of all the integers in the list.\n\n    Empty sum should be equal to 0 and empty product should be equal to 1.\n\n    Parameters\n    ----------\n    numbers : List[int]\n        The list of integers to process.\n\n    Returns\n    -------\n    Tuple[int, int]\n        A tuple `(total_sum, total_product)`.\n\n    Examples\n    --------\n    >>> sum_product([])\n    (0, 1)\n    >>> sum_product([1, 2, 3, 4])\n    (10, 24)\n    >>> sum_product([5])\n    (5, 5)\n    >>> sum_product([-1, 2, -3])\n    (-2, 6)\n    \"\"\"\n    total_sum = 0\n    total_product = 1\n\n    for n in numbers:\n        total_sum += n\n        total_product *= n\n\n    return total_sum, total_product", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/14": [{"task_id": "HumanEval/14", "solution": "from typing import List\ndef all_prefixes(string: str) -> List[str]:\n    \"\"\"\n    Return a list of all prefixes of *string*, ordered from the shortest\n    to the longest.\n\n    A prefix is any leading substring of the original string.  For\n    example, the prefixes of ``\"abc\"`` are ``\"a\"``, ``\"ab\"``, and\n    ``\"abc\"``.\n\n    Parameters\n    ----------\n    string : str\n        The string to generate prefixes for.\n\n    Returns\n    -------\n    List[str]\n        A list containing every prefix of *string*.\n\n    Examples\n    --------\n    >>> all_prefixes('abc')\n    ['a', 'ab', 'abc']\n    >>> all_prefixes('')\n    []\n    >>> all_prefixes('x')\n    ['x']\n    \"\"\"\n    # The most straightforward way is to iterate over the indices that\n    # represent the end of each prefix and slice the string up to that\n    # point.  ``range(1, len(string) + 1)`` gives us 1, 2, \u2026, len(string).\n    return [string[:i] for i in range(1, len(string) + 1)]", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/19": [{"task_id": "HumanEval/19", "solution": "from typing import List\nWORD_TO_VALUE = {\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}\ndef sort_numbers(numbers: str) -> str:\n    \"\"\"\n    Sort a space\u2011delimited string of number words from 'zero' to 'nine'.\n\n    Parameters\n    ----------\n    numbers : str\n        A string containing number words separated by spaces.  The words\n        must be one of the keys in :data:`WORD_TO_VALUE`.\n\n    Returns\n    -------\n    str\n        The input words sorted from smallest to largest, joined by a single\n        space.\n\n    Examples\n    --------\n    >>> sort_numbers('three one five')\n    'one three five'\n    >>> sort_numbers('nine eight seven')\n    'seven eight nine'\n    >>> sort_numbers('zero')\n    'zero'\n    \"\"\"\n    if not numbers:\n        return \"\"\n\n    # Split on whitespace, filter out any accidental empty tokens\n    tokens: List[str] = [t for t in numbers.split() if t]\n\n    # Validate tokens\n    for t in tokens:\n        if t not in WORD_TO_VALUE:\n            raise ValueError(f\"Invalid number word: {t!r}\")\n\n    # Sort by numeric value\n    sorted_tokens = sorted(tokens, key=lambda w: WORD_TO_VALUE[w])\n\n    return \" \".join(sorted_tokens)", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/16": [{"task_id": "HumanEval/16", "solution": "def count_distinct_characters(string: str) -> int:\n    \"\"\"\n    Return the number of distinct alphabetic characters in *string*, ignoring case.\n\n    Parameters\n    ----------\n    string : str\n        The input string to analyse.\n\n    Returns\n    -------\n    int\n        The count of unique alphabetic characters, case\u2011insensitive.\n\n    Examples\n    --------\n    >>> count_distinct_characters('xyzXYZ')\n    3\n    >>> count_distinct_characters('Jerry')\n    4\n    >>> count_distinct_characters('Hello, World!')\n    8\n    >>> count_distinct_characters('')\n    0\n    \"\"\"\n    # Normalise to lower case so that 'A' and 'a' are treated the same.\n    lower = string.lower()\n    # Build a set of characters that are alphabetic.\n    unique_chars = {ch for ch in lower if ch.isalpha()}\n    return len(unique_chars)", "base_status": "fail", "plus_status": "fail", "base_fail_tests": [["Jerry jERRY JeRRRY"]], "plus_fail_tests": [["1234567890"]]}], "HumanEval/17": [{"task_id": "HumanEval/17", "solution": "from typing import List\nNOTE_DURATIONS = {\n    \"o\": 4,\n    \"o|\": 2,\n    \".|\": 1,\n}\ndef parse_music(music_string: str) -> List[int]:\n    \"\"\"\n    Convert a string of ASCII musical notes into a list of beat counts.\n\n    Parameters\n    ----------\n    music_string : str\n        A whitespace\u2011separated string containing the symbols ``o``, ``o|`` and\n        ``.|``.  Any leading/trailing whitespace is ignored.\n\n    Returns\n    -------\n    List[int]\n        A list where each element is the number of beats of the corresponding\n        note in the input string.\n\n    Examples\n    --------\n    >>> parse_music('o o| .| o| o| .| .| .| .| o o')\n    [4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4]\n    \"\"\"\n    # Split on any whitespace; ``split()`` automatically collapses multiple\n    # spaces and ignores leading/trailing ones.\n    tokens = music_string.split()\n    beats: List[int] = []\n\n    for token in tokens:\n        try:\n            beats.append(NOTE_DURATIONS[token])\n        except KeyError as exc:\n            raise ValueError(f\"Unknown note token: {token!r}\") from exc\n\n    return beats", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/18": [{"task_id": "HumanEval/18", "solution": "def how_many_times(string: str, substring: str) -> int:\n    \"\"\"\n    Return the number of (possibly overlapping) occurrences of *substring* in *string*.\n\n    Parameters\n    ----------\n    string : str\n        The text to search in.\n    substring : str\n        The pattern to look for.\n\n    Returns\n    -------\n    int\n        The number of times *substring* appears in *string*.\n\n    Examples\n    --------\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    if not substring:          # empty pattern matches nothing\n        return 0\n\n    count = 0\n    start = 0\n    while True:\n        idx = string.find(substring, start)\n        if idx == -1:\n            break\n        count += 1\n        start = idx + 1          # move one step forward to allow overlap\n    return count", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/21": [{"task_id": "HumanEval/21", "solution": "from typing import List\ndef rescale_to_unit(numbers: List[float]) -> List[float]:\n    \"\"\"\n    Scale a list of numbers to the unit interval [0, 1].\n\n    Parameters\n    ----------\n    numbers : List[float]\n        A list containing at least two numeric values.\n\n    Returns\n    -------\n    List[float]\n        A new list where the minimum value is 0 and the maximum value is 1.\n        All other values are linearly interpolated between them.\n\n    Raises\n    ------\n    ValueError\n        If all numbers are identical (the range is zero) or if the list\n        contains fewer than two elements.\n\n    Notes\n    -----\n    The function does **not** modify the input list.\n    \"\"\"\n    if len(numbers) < 2:\n        raise ValueError(\"At least two numbers are required for rescaling.\")\n\n    min_val = min(numbers)\n    max_val = max(numbers)\n\n    if min_val == max_val:\n        raise ValueError(\"Cannot rescale when all numbers are identical.\")\n\n    range_val = max_val - min_val\n    return [(x - min_val) / range_val for x in numbers]", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/20": [{"task_id": "HumanEval/20", "solution": "from typing import List, Tuple\nimport sys\nimport doctest\ndef find_closest_elements(numbers: List[float]) -> Tuple[float, float]:\n    \"\"\"\n    Return the two numbers from *numbers* that are closest to each other.\n    The returned pair is ordered (smaller, larger).\n\n    The algorithm sorts the list once (O(n log n)) and then scans the\n    adjacent pairs to find the minimum difference.  Sorting guarantees\n    that the closest pair must be adjacent in the sorted order.\n\n    Parameters\n    ----------\n    numbers : List[float]\n        A list containing at least two numeric values.\n\n    Returns\n    -------\n    Tuple[float, float]\n        The pair of numbers that are closest to each other, ordered\n        from smaller to larger.\n\n    Examples\n    --------\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    >>> find_closest_elements([10, 1, 5, 9, 3])\n    (3, 5)\n    >>> find_closest_elements([0.1, 0.2, 0.15, 0.18])\n    (0.15, 0.18)\n    \"\"\"\n    if len(numbers) < 2:\n        raise ValueError(\"At least two numbers are required\")\n\n    # Sort the numbers once; this guarantees that the closest pair\n    # will be adjacent in the sorted list.\n    sorted_nums = sorted(numbers)\n\n    # Initialise with the first adjacent pair.\n    best_pair = (sorted_nums[0], sorted_nums[1])\n    best_diff = abs(best_pair[1] - best_pair[0])\n\n    # Scan the remaining adjacent pairs.\n    for i in range(1, len(sorted_nums) - 1):\n        a, b = sorted_nums[i], sorted_nums[i + 1]\n        diff = b - a  # b >= a because the list is sorted\n        if diff < best_diff:\n            best_diff = diff\n            best_pair = (a, b)\n\n    return best_pair", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/22": [{"task_id": "HumanEval/22", "solution": "from typing import Any, List\ndef filter_integers(values: List[Any]) -> List[int]:\n    \"\"\"\n    Return a new list containing only the integer elements from *values*.\n\n    Parameters\n    ----------\n    values : List[Any]\n        A list that may contain objects of any type.\n\n    Returns\n    -------\n    List[int]\n        A list of the elements that are integers (excluding booleans).\n\n    Examples\n    --------\n    >>> filter_integers(['a', 3.14, 5])\n    [5]\n    >>> filter_integers([1, 2, 3, 'abc', {}, []])\n    [1, 2, 3]\n    >>> filter_integers([True, False, 0, 1])\n    [0, 1]\n    \"\"\"\n    # ``bool`` is a subclass of ``int``; we want to exclude it.\n    return [x for x in values if isinstance(x, int) and not isinstance(x, bool)]", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/15": [{"task_id": "HumanEval/15", "solution": "def string_sequence(n: int) -> str:\n    \"\"\"\n    Return a string containing space\u2011delimited numbers starting from 0 up to `n` inclusive.\n\n    Parameters\n    ----------\n    n : int\n        The upper bound of the sequence.  Must be a non\u2011negative integer.\n\n    Returns\n    -------\n    str\n        A single string with the numbers 0, 1, \u2026, n separated by a single space.\n\n    Examples\n    --------\n    >>> string_sequence(0)\n    '0'\n    >>> string_sequence(5)\n    '0 1 2 3 4 5'\n    >>> string_sequence(10)\n    '0 1 2 3 4 5 6 7 8 9 10'\n    \"\"\"\n    if n < 0:\n        raise ValueError(\"n must be a non\u2011negative integer\")\n    # Build the sequence lazily and join with a space\n    return \" \".join(str(i) for i in range(n + 1))", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/25": [{"task_id": "HumanEval/25", "solution": "from typing import List\nimport sys\nimport math\nimport doctest\ndef factorize(n: int) -> List[int]:\n    \"\"\"\n    Return a list of prime factors of the given integer in ascending order.\n    Each prime factor appears as many times as it occurs in the factorisation.\n\n    Parameters\n    ----------\n    n : int\n        The integer to factorise. Must be a positive integer.\n\n    Returns\n    -------\n    List[int]\n        A list of prime factors sorted from smallest to largest.\n\n    Examples\n    --------\n    >>> factorize(8)\n    [2, 2, 2]\n    >>> factorize(25)\n    [5, 5]\n    >>> factorize(70)\n    [2, 5, 7]\n    >>> factorize(1)\n    []\n    >>> factorize(2)\n    [2]\n    >>> factorize(100)\n    [2, 2, 5, 5]\n    \"\"\"\n    if n < 1:\n        raise ValueError(\"factorize() only accepts positive integers\")\n\n    factors: List[int] = []\n\n    # Handle factor 2 separately to allow incrementing by 2 later\n    while n % 2 == 0:\n        factors.append(2)\n        n //= 2\n\n    # Now n is odd; test odd divisors up to sqrt(n)\n    divisor = 3\n    max_divisor = math.isqrt(n) + 1\n    while divisor <= max_divisor and n > 1:\n        while n % divisor == 0:\n            factors.append(divisor)\n            n //= divisor\n            max_divisor = math.isqrt(n) + 1  # update because n shrank\n        divisor += 2\n\n    # If n is still > 1, it is a prime factor larger than sqrt(original n)\n    if n > 1:\n        factors.append(n)\n\n    return factors", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/23": [{"task_id": "HumanEval/23", "solution": "def strlen(string: str) -> int:\n    \"\"\"\n    Return the length of *string*.\n\n    Parameters\n    ----------\n    string : str\n        The string whose length should be calculated.\n\n    Returns\n    -------\n    int\n        The number of characters in *string*.\n\n    Examples\n    --------\n    >>> strlen('')\n    0\n    >>> strlen('abc')\n    3\n    >>> strlen('Hello, world!')\n    13\n    \"\"\"\n    count = 0\n    for _ in string:\n        count += 1\n    return count", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/26": [{"task_id": "HumanEval/26", "solution": "from collections import Counter\nfrom typing import List\ndef remove_duplicates(numbers: List[int]) -> List[int]:\n    \"\"\"\n    Return a new list containing only the elements that occur exactly once\n    in *numbers*, preserving the original order.\n\n    Parameters\n    ----------\n    numbers : List[int]\n        The input list of integers.\n\n    Returns\n    -------\n    List[int]\n        A list of the unique elements, in the same order as they first\n        appeared in *numbers*.\n\n    Examples\n    --------\n    >>> remove_duplicates([1, 2, 3, 2, 4])\n    [1, 3, 4]\n    >>> remove_duplicates([5, 5, 5])\n    []\n    >>> remove_duplicates([1, 2, 3])\n    [1, 2, 3]\n    \"\"\"\n    # Count how many times each number appears\n    freq = Counter(numbers)\n\n    # Keep only those numbers that appear exactly once\n    return [n for n in numbers if freq[n] == 1]", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/29": [{"task_id": "HumanEval/29", "solution": "from typing import List\ndef filter_by_prefix(strings: List[str], prefix: str) -> List[str]:\n    \"\"\"\n    Return a new list containing only the strings from *strings* that\n    start with *prefix*.\n\n    Parameters\n    ----------\n    strings : List[str]\n        The list of strings to filter.\n    prefix : str\n        The prefix to match against.\n\n    Returns\n    -------\n    List[str]\n        A list of strings that start with *prefix*.\n\n    Examples\n    --------\n    >>> filter_by_prefix([], 'a')\n    []\n    >>> filter_by_prefix(['abc', 'bcd', 'cde', 'array'], 'a')\n    ['abc', 'array']\n    >>> filter_by_prefix(['foo', 'bar', 'baz'], 'ba')\n    ['bar', 'baz']\n    >>> filter_by_prefix(['foo', 'bar', 'baz'], 'z')\n    []\n    \"\"\"\n    # Using a list comprehension keeps the code short and readable.\n    return [s for s in strings if s.startswith(prefix)]", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/27": [{"task_id": "HumanEval/27", "solution": "import unittest\ndef flip_case(string: str) -> str:\n    \"\"\"\n    Return a new string where every lowercase letter is converted to uppercase\n    and every uppercase letter is converted to lowercase. Non\u2011alphabetic\n    characters are left unchanged.\n\n    Parameters\n    ----------\n    string : str\n        The input string to transform.\n\n    Returns\n    -------\n    str\n        The case\u2011flipped string.\n\n    Examples\n    --------\n    >>> flip_case('Hello')\n    'hELLO'\n    >>> flip_case('Python 3.8')\n    'pYTHON 3.8'\n    \"\"\"\n    # Using a list comprehension is fast and clear.\n    return ''.join(ch.lower() if ch.isupper() else ch.upper() if ch.islower() else ch\n                   for ch in string)", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/28": [{"task_id": "HumanEval/28", "solution": "from typing import List\nimport doctest\ndef concatenate(strings: List[str]) -> str:\n    \"\"\"Concatenate list of strings into a single string.\n\n    The function simply joins the elements of *strings* with no\n    separator.  It is deliberately written in a single line to\n    keep the example short and clear.\n\n    >>> concatenate([])\n    ''\n    >>> concatenate(['a', 'b', 'c'])\n    'abc'\n    \"\"\"\n    return \"\".join(strings)", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/24": [{"task_id": "HumanEval/24", "solution": "from typing import Optional\nimport unittest\ndef largest_divisor(n: int) -> Optional[int]:\n    \"\"\"\n    Return the largest integer that divides `n` evenly and is smaller than `n`.\n\n    Parameters\n    ----------\n    n : int\n        A positive integer greater than 1.\n\n    Returns\n    -------\n    int or None\n        The largest proper divisor of `n`.  If `n` is 1, return None\n        because 1 has no proper divisors.\n\n    Examples\n    --------\n    >>> largest_divisor(15)\n    5\n    >>> largest_divisor(13)  # prime number\n    1\n    >>> largest_divisor(1)\n    None\n    \"\"\"\n    if n <= 1:\n        return None\n\n    # Check divisors from n-1 down to 1\n    for d in range(n - 1, 0, -1):\n        if n % d == 0:\n            return d\n    # The loop always returns for n > 1, but keep a fallback\n    return None", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/30": [{"task_id": "HumanEval/30", "solution": "def get_positive(l: list) -> list:\n    \"\"\"\n    Return only positive numbers in the list.\n\n    Parameters\n    ----------\n    l : list\n        A list of numbers (int or float).  Elements that are\n        greater than zero are kept; everything else is discarded.\n\n    Returns\n    -------\n    list\n        A new list containing only the positive elements of *l*,\n        preserving the original order.\n\n    Examples\n    --------\n    >>> get_positive([-1, 2, -4, 5, 6])\n    [2, 5, 6]\n    >>> get_positive([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])\n    [5, 3, 2, 3, 9, 123, 1]\n    \"\"\"\n    return [x for x in l if x > 0]", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/32": [{"task_id": "HumanEval/32", "solution": "import math\nfrom typing import List\ndef poly(xs: List[float], x: float) -> float:\n    \"\"\"Evaluate a polynomial with coefficients `xs` at point `x`.\"\"\"\n    return sum(coeff * math.pow(x, i) for i, coeff in enumerate(xs))\ndef find_zero(xs: List[float], *, tol: float = 1e-12, max_iter: int = 1000) -> float:\n    \"\"\"\n    Find a real root of the polynomial defined by `xs`.\n\n    Parameters\n    ----------\n    xs : list[float]\n        Coefficients of the polynomial (even length, leading coefficient non\u2011zero).\n    tol : float, optional\n        Desired absolute tolerance for the root.  Default is 1e-12.\n    max_iter : int, optional\n        Maximum number of iterations.  Default is 1000.\n\n    Returns\n    -------\n    float\n        A real number `x` such that `poly(xs, x)` is within `tol` of zero.\n\n    Notes\n    -----\n    The algorithm first locates an interval `[a, b]` where the polynomial\n    changes sign (hence contains a root) by expanding a search window\n    exponentially.  Once such an interval is found, the classic\n    bisection method is applied.\n\n    Examples\n    --------\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)\n    1.0\n    \"\"\"\n    if len(xs) % 2 != 0:\n        raise ValueError(\"Coefficient list must contain an even number of elements.\")\n    if xs[-1] == 0:\n        raise ValueError(\"Leading coefficient must be non\u2011zero.\")\n\n    # 1. Find an interval [a, b] where the polynomial changes sign.\n    #    Start with a small interval and expand it until a sign change is found.\n    a, b = 0.0, 1.0\n    fa, fb = poly(xs, a), poly(xs, b)\n\n    # If the polynomial is already zero at a or b, return that point.\n    if abs(fa) < tol:\n        return a\n    if abs(fb) < tol:\n        return b\n\n    # Expand the interval until a sign change occurs.\n    # We use a factor of 2 to keep the growth exponential.\n    factor = 2.0\n    for _ in range(max_iter):\n        if fa * fb < 0:          # sign change detected\n            break\n        # Expand the interval symmetrically around zero\n        a -= factor\n        b += factor\n        fa, fb = poly(xs, a), poly(xs, b)\n    else:\n        raise RuntimeError(\"Failed to bracket a root within the iteration limit.\")\n\n    # 2. Bisection method\n    for _ in range(max_iter):\n        mid = (a + b) / 2.0\n        fmid = poly(xs, mid)\n\n        if abs(fmid) < tol:\n            return mid\n\n        # Decide which sub\u2011interval contains the root\n        if fa * fmid < 0:\n            b, fb = mid, fmid\n        else:\n            a, fa = mid, fmid\n\n        # Stop if the interval is smaller than the tolerance\n        if abs(b - a) < tol:\n            return (a + b) / 2.0\n\n    # If we exit the loop, return the best estimate we have\n    return (a + b) / 2.0", "base_status": "pass", "plus_status": "fail", "base_fail_tests": [], "plus_fail_tests": [[[0, 2667, 0, 0]]]}], "HumanEval/31": [{"task_id": "HumanEval/31", "solution": "import math\nimport doctest\ndef is_prime(n: int) -> bool:\n    \"\"\"\n    Return True if *n* is a prime number, otherwise False.\n\n    Parameters\n    ----------\n    n : int\n        The number to test for primality.\n\n    Returns\n    -------\n    bool\n        True if *n* is prime, False otherwise.\n\n    Examples\n    --------\n    >>> is_prime(6)\n    False\n    >>> is_prime(101)\n    True\n    >>> is_prime(11)\n    True\n    >>> is_prime(13441)\n    True\n    >>> is_prime(61)\n    True\n    >>> is_prime(4)\n    False\n    >>> is_prime(1)\n    False\n    \"\"\"\n    if n <= 1:\n        return False\n    if n <= 3:\n        return True\n    if n % 2 == 0 or n % 3 == 0:\n        return False\n\n    # Check divisibility by numbers of the form 6k \u00b1 1 up to sqrt(n)\n    limit = int(math.isqrt(n))\n    i = 5\n    while i <= limit:\n        if n % i == 0 or n % (i + 2) == 0:\n            return False\n        i += 6\n    return True", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/33": [{"task_id": "HumanEval/33", "solution": "from typing import List, TypeVar\nT = TypeVar(\"T\", bound=object)\ndef sort_third(l: List[T]) -> List[T]:\n    \"\"\"\n    Return a new list where elements at indices divisible by 3 are sorted,\n    while all other elements remain unchanged.\n\n    Parameters\n    ----------\n    l : list\n        Input list of comparable elements.\n\n    Returns\n    -------\n    list\n        A new list with the same length as `l`.\n\n    Examples\n    --------\n    >>> sort_third([1, 2, 3])\n    [1, 2, 3]\n    >>> sort_third([5, 6, 3, 4, 8, 9, 2])\n    [2, 6, 3, 4, 8, 9, 5]\n    >>> sort_third([9, 8, 7, 6, 5, 4, 3, 2, 1])\n    [1, 8, 7, 6, 5, 4, 3, 2, 9]\n    \"\"\"\n    # Extract the values at indices 0, 3, 6, ...\n    indices = list(range(0, len(l), 3))\n    values = [l[i] for i in indices]\n\n    # Sort those values\n    sorted_values = sorted(values)\n\n    # Build the result list\n    result = l.copy()\n    for idx, val in zip(indices, sorted_values):\n        result[idx] = val\n\n    return result", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/34": [{"task_id": "HumanEval/34", "solution": "from typing import List, Any\ndef unique(l: List[Any]) -> List[Any]:\n    \"\"\"\n    Return sorted unique elements in a list.\n\n    Parameters\n    ----------\n    l : list\n        The input list that may contain duplicate values.\n\n    Returns\n    -------\n    list\n        A new list containing each distinct element from *l* exactly once,\n        sorted according to the natural ordering of the elements.\n\n    Examples\n    --------\n    >>> unique([5, 3, 5, 2, 3, 3, 9, 0, 123])\n    [0, 2, 3, 5, 9, 123]\n    \"\"\"\n    # Using a set removes duplicates; converting back to a list and sorting\n    # gives the desired deterministic order.\n    return sorted(set(l))", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/35": [{"task_id": "HumanEval/35", "solution": "from typing import List, Any\ndef max_element(l: List[Any]) -> Any:\n    \"\"\"\n    Return the maximum element in the list.\n\n    The function works for any list whose elements support the\n    comparison operators (<, >).  It raises a ValueError if the\n    list is empty.\n\n    >>> max_element([1, 2, 3])\n    3\n    >>> max_element([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])\n    123\n    \"\"\"\n    if not l:\n        raise ValueError(\"max_element() arg is an empty sequence\")\n\n    # Initialise the maximum with the first element\n    maximum = l[0]\n    for item in l[1:]:\n        if item > maximum:\n            maximum = item\n    return maximum", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/37": [{"task_id": "HumanEval/37", "solution": "from typing import List, TypeVar\nT = TypeVar(\"T\", bound=object)\ndef sort_even(l: List[T]) -> List[T]:\n    \"\"\"\n    Return a new list where the elements at even indices (0, 2, 4, \u2026)\n    are sorted, while the elements at odd indices remain in their\n    original positions.\n\n    Parameters\n    ----------\n    l : list\n        The input list.\n\n    Returns\n    -------\n    list\n        A new list with the even\u2011indexed elements sorted.\n\n    Examples\n    --------\n    >>> sort_even([1, 2, 3])\n    [1, 2, 3]\n    >>> sort_even([5, 6, 3, 4])\n    [3, 6, 5, 4]\n    >>> sort_even([9, 1, 8, 2, 7, 3, 6, 4])\n    [6, 1, 7, 2, 8, 3, 9, 4]\n    \"\"\"\n    # Extract even-indexed elements\n    even_vals = [l[i] for i in range(0, len(l), 2)]\n    # Sort them\n    even_vals.sort()\n    # Build the result list\n    result = l.copy()\n    even_idx = 0\n    for i in range(0, len(l), 2):\n        result[i] = even_vals[even_idx]\n        even_idx += 1\n    return result", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/38": [{"task_id": "HumanEval/38", "solution": "from typing import List\ndef decode_cyclic(s: str) -> str:\n    \"\"\"\n    Decode a string that was encoded with :func:`encode_cyclic`.\n\n    Parameters\n    ----------\n    s : str\n        The encoded string.\n\n    Returns\n    -------\n    str\n        The original, decoded string.\n    \"\"\"\n    # Split the encoded string into the same groups of length 3.\n    groups: List[str] = [\n        s[3 * i : min(3 * i + 3, len(s))]\n        for i in range((len(s) + 2) // 3)\n    ]\n\n    # Rotate each full group right by one position.\n    groups = [\n        (group[-1] + group[:-1]) if len(group) == 3 else group\n        for group in groups\n    ]\n\n    return \"\".join(groups)", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/36": [{"task_id": "HumanEval/36", "solution": "from typing import Iterable\nimport unittest\ndef fizz_buzz(n: int) -> int:\n    \"\"\"\n    Return the number of times the digit 7 appears in integers less than ``n`` which\n    are divisible by 11 or 13.\n\n    Parameters\n    ----------\n    n : int\n        Upper bound (exclusive). Must be non\u2011negative.\n\n    Returns\n    -------\n    int\n        Total count of digit ``7`` in all qualifying numbers.\n\n    Examples\n    --------\n    >>> fizz_buzz(50)\n    0\n    >>> fizz_buzz(78)\n    2\n    >>> fizz_buzz(79)\n    3\n    \"\"\"\n    if n < 0:\n        raise ValueError(\"n must be non\u2011negative\")\n\n    count = 0\n    for num in range(n):\n        if num % 11 == 0 or num % 13 == 0:\n            count += str(num).count(\"7\")\n    return count", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/39": [{"task_id": "HumanEval/39", "solution": "import sys\nimport math\nfrom typing import Iterator\ndef is_prime(n: int) -> bool:\n    \"\"\"Return True if n is a prime number, otherwise False.\"\"\"\n    if n < 2:\n        return False\n    if n in (2, 3):\n        return True\n    if n % 2 == 0 or n % 3 == 0:\n        return False\n\n    # Check divisibility up to sqrt(n) using 6k \u00b1 1 optimisation\n    limit = int(math.isqrt(n))\n    i = 5\n    while i <= limit:\n        if n % i == 0 or n % (i + 2) == 0:\n            return False\n        i += 6\n    return True\ndef prime_fib(n: int) -> int:\n    \"\"\"\n    Return the n-th Fibonacci number that is also prime.\n\n    Parameters\n    ----------\n    n : int\n        1\u2011based index of the desired prime Fibonacci number.\n\n    Returns\n    -------\n    int\n        The n\u2011th prime Fibonacci number.\n\n    Examples\n    --------\n    >>> prime_fib(1)\n    2\n    >>> prime_fib(2)\n    3\n    >>> prime_fib(3)\n    5\n    >>> prime_fib(4)\n    13\n    >>> prime_fib(5)\n    89\n    \"\"\"\n    if n <= 0:\n        raise ValueError(\"n must be a positive integer\")\n\n    count = 0\n    for f in fib_generator():\n        if is_prime(f):\n            count += 1\n            if count == n:\n                return f", "base_status": "fail", "plus_status": "fail", "base_fail_tests": [[1]], "plus_fail_tests": [[11]]}], "HumanEval/41": [{"task_id": "HumanEval/41", "solution": "from typing import Callable\ndef car_race_collision(n: int) -> int:\n    \"\"\"\n    Count the number of collisions between two sets of cars moving in opposite\n    directions on an infinitely long straight road.\n\n    Parameters\n    ----------\n    n : int\n        Number of cars in each direction (left\u2011to\u2011right and right\u2011to\u2011left).\n\n    Returns\n    -------\n    int\n        Total number of collisions.\n\n    Notes\n    -----\n    * All cars start far apart and move with the same speed.\n    * Because the cars are perfectly sturdy, they continue on their paths after\n      a collision, so each pair of cars collides exactly once.\n    * Therefore the total number of collisions is simply n * n.\n    \"\"\"\n    if n < 0:\n        raise ValueError(\"Number of cars must be non\u2011negative\")\n    return n * n", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/40": [{"task_id": "HumanEval/40", "solution": "from typing import List\ndef triples_sum_to_zero(l: List[int]) -> bool:\n    \"\"\"\n    Return True if there exist three distinct indices i, j, k\n    such that l[i] + l[j] + l[k] == 0, otherwise False.\n\n    The algorithm sorts the list and then, for each element\n    l[i], looks for a pair (l[j], l[k]) with j > i, k > j\n    that sums to -l[i] using two pointers.\n\n    Parameters\n    ----------\n    l : List[int]\n        The input list of integers.\n\n    Returns\n    -------\n    bool\n        True if a zero\u2011sum triple exists, False otherwise.\n\n    Examples\n    --------\n    >>> triples_sum_to_zero([1, 3, 5, 0])\n    False\n    >>> triples_sum_to_zero([1, 3, -2, 1])\n    True\n    >>> triples_sum_to_zero([1, 2, 3, 7])\n    False\n    >>> triples_sum_to_zero([2, 4, -5, 3, 9, 7])\n    True\n    >>> triples_sum_to_zero([1])\n    False\n    \"\"\"\n    n = len(l)\n    if n < 3:\n        return False\n\n    # Sort once \u2013 O(n log n)\n    l_sorted = sorted(l)\n\n    # For each first element, use two\u2011pointer search for the other two\n    for i in range(n - 2):\n        target = -l_sorted[i]\n        left, right = i + 1, n - 1\n        while left < right:\n            current_sum = l_sorted[left] + l_sorted[right]\n            if current_sum == target:\n                return True\n            elif current_sum < target:\n                left += 1\n            else:\n                right -= 1\n\n    return False", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/42": [{"task_id": "HumanEval/42", "solution": "from typing import List\ndef incr_list(l: List[int]) -> List[int]:\n    \"\"\"\n    Return a new list with each element of *l* incremented by 1.\n\n    Parameters\n    ----------\n    l : list[int]\n        The input list of integers.\n\n    Returns\n    -------\n    list[int]\n        A new list where every element is the corresponding element of\n        *l* plus one.\n\n    Examples\n    --------\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    # Using a list comprehension keeps the code concise and\n    # guarantees that the original list is not modified.\n    return [x + 1 for x in l]", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/43": [{"task_id": "HumanEval/43", "solution": "from typing import Iterable, List\ndef pairs_sum_to_zero(l: Iterable[int]) -> bool:\n    \"\"\"\n    Return True if there are two distinct elements in *l* that sum to zero.\n\n    Parameters\n    ----------\n    l : Iterable[int]\n        A sequence of integers.\n\n    Returns\n    -------\n    bool\n        True if a pair of distinct elements sums to zero, False otherwise.\n\n    Examples\n    --------\n    >>> pairs_sum_to_zero([1, 3, 5, 0])\n    False\n    >>> pairs_sum_to_zero([1, 3, -2, 1])\n    False\n    >>> pairs_sum_to_zero([1, 2, 3, 7])\n    False\n    >>> pairs_sum_to_zero([2, 4, -5, 3, 5, 7])\n    True\n    >>> pairs_sum_to_zero([1])\n    False\n    \"\"\"\n    seen = set()\n    for x in l:\n        if -x in seen:\n            return True\n        seen.add(x)\n    return False", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/46": [{"task_id": "HumanEval/46", "solution": "from typing import List\ndef fib4(n: int) -> int:\n    \"\"\"\n    Return the n\u2011th element of the Fib4 sequence.\n\n    Parameters\n    ----------\n    n : int\n        The index of the desired element (must be non\u2011negative).\n\n    Returns\n    -------\n    int\n        The value of fib4(n).\n\n    Examples\n    --------\n    >>> fib4(5)\n    4\n    >>> fib4(6)\n    8\n    >>> fib4(7)\n    14\n    >>> fib4(0)\n    0\n    >>> fib4(1)\n    0\n    >>> fib4(2)\n    2\n    >>> fib4(3)\n    0\n    \"\"\"\n    if n < 0:\n        raise ValueError(\"n must be a non\u2011negative integer\")\n\n    # Base cases\n    base = [0, 0, 2, 0]\n    if n < 4:\n        return base[n]\n\n    # Rolling window of the last four values\n    a, b, c, d = base  # a = fib4(n-4), b = fib4(n-3), c = fib4(n-2), d = fib4(n-1)\n    for _ in range(4, n + 1):\n        e = a + b + c + d  # fib4(n)\n        a, b, c, d = b, c, d, e\n\n    return d", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/44": [{"task_id": "HumanEval/44", "solution": "from typing import List\ndef change_base(x: int, base: int) -> str:\n    \"\"\"\n    Convert a non\u2011negative integer `x` to its representation in the given\n    `base` (2 \u2264 base < 10).\n\n    Parameters\n    ----------\n    x : int\n        The integer to convert. Must be non\u2011negative.\n    base : int\n        The target base. Must satisfy 2 <= base < 10.\n\n    Returns\n    -------\n    str\n        The string representation of `x` in the target base.\n\n    Examples\n    --------\n    >>> change_base(8, 3)\n    '22'\n    >>> change_base(8, 2)\n    '1000'\n    >>> change_base(7, 2)\n    '111'\n    \"\"\"\n    if x < 0:\n        raise ValueError(\"x must be non\u2011negative\")\n    if not (2 <= base < 10):\n        raise ValueError(\"base must be between 2 and 9 inclusive\")\n\n    if x == 0:\n        return \"0\"\n\n    digits: List[str] = []\n    while x:\n        x, rem = divmod(x, base)\n        digits.append(str(rem))\n    return \"\".join(reversed(digits))", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/45": [{"task_id": "HumanEval/45", "solution": "def triangle_area(a: float, h: float) -> float:\n    \"\"\"\n    Return the area of a triangle given the length of a side and its\n    corresponding altitude.\n\n    Parameters\n    ----------\n    a : float\n        Length of the side (base) of the triangle.\n    h : float\n        Altitude (height) corresponding to that side.\n\n    Returns\n    -------\n    float\n        The area of the triangle.\n\n    Examples\n    --------\n    >>> triangle_area(5, 3)\n    7.5\n    >>> triangle_area(10, 4)\n    20.0\n    >>> triangle_area(0, 5)\n    0.0\n    \"\"\"\n    return 0.5 * a * h", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/47": [{"task_id": "HumanEval/47", "solution": "from typing import List, Union\nNumber = Union[int, float]\ndef median(l: List[Number]) -> float:\n    \"\"\"\n    Return the median of the elements in the list ``l``.\n\n    The function works for any list of numbers (int or float).  It\n    first sorts the list and then:\n\n    * If the list has an odd length, returns the middle element.\n    * If the list has an even length, returns the average of the two\n      middle elements.\n\n    Parameters\n    ----------\n    l : list\n        A list of numeric values.\n\n    Returns\n    -------\n    float\n        The median value.\n\n    Examples\n    --------\n    >>> median([3, 1, 2, 4, 5])\n    3\n    >>> median([-10, 4, 6, 1000, 10, 20])\n    15.0\n    \"\"\"\n    if not l:\n        raise ValueError(\"median requires a non-empty list\")\n\n    # Work on a copy so that the original list is not modified.\n    sorted_l = sorted(l)\n    n = len(sorted_l)\n    mid = n // 2\n\n    if n % 2:  # odd number of elements\n        return float(sorted_l[mid])\n    else:  # even number of elements\n        return (sorted_l[mid - 1] + sorted_l[mid]) / 2.0", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/49": [{"task_id": "HumanEval/49", "solution": "import sys\nimport doctest\ndef modp(n: int, p: int) -> int:\n    \"\"\"\n    Return 2^n modulo p.\n\n    Parameters\n    ----------\n    n : int\n        The exponent (must be non\u2011negative).\n    p : int\n        The modulus (must be positive).\n\n    Returns\n    -------\n    int\n        The value of 2**n % p.\n\n    Notes\n    -----\n    * The function uses Python's built\u2011in `pow` which implements\n      modular exponentiation efficiently.\n    * If `p == 1` the result is always 0 (by definition of modulo).\n    * If `n == 0` the result is 1 % p (which is 1 unless p == 1).\n\n    Examples\n    --------\n    >>> modp(3, 5)\n    3\n    >>> modp(1101, 101)\n    2\n    >>> modp(0, 101)\n    1\n    >>> modp(3, 11)\n    8\n    >>> modp(100, 101)\n    1\n    \"\"\"\n    if p <= 0:\n        raise ValueError(\"Modulus p must be a positive integer\")\n    if n < 0:\n        raise ValueError(\"Exponent n must be non\u2011negative\")\n    return pow(2, n, p)", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/50": [{"task_id": "HumanEval/50", "solution": "import sys\nimport argparse\ndef decode_shift(s: str) -> str:\n    \"\"\"\n    Decode a string that was encoded with `encode_shift`.\n\n    Parameters\n    ----------\n    s : str\n        Encoded string (only lower\u2011case letters are affected).\n\n    Returns\n    -------\n    str\n        The original plain\u2011text string.\n    \"\"\"\n    return \"\".join(\n        chr(((ord(ch) - 5 - ord(\"a\")) % 26) + ord(\"a\"))\n        if \"a\" <= ch <= \"z\"\n        else ch\n        for ch in s\n    )", "base_status": "pass", "plus_status": "fail", "base_fail_tests": [], "plus_fail_tests": [["encoded message with shift"]]}], "HumanEval/48": [{"task_id": "HumanEval/48", "solution": "import doctest\nimport sys\ndef is_palindrome(text: str) -> bool:\n    \"\"\"\n    Checks if the given string is a palindrome.\n\n    A palindrome reads the same forwards and backwards.  The comparison is\n    case\u2011sensitive and does not ignore whitespace or punctuation \u2013 it\n    simply compares the raw characters.\n\n    Parameters\n    ----------\n    text : str\n        The string to test.\n\n    Returns\n    -------\n    bool\n        ``True`` if ``text`` is a palindrome, ``False`` otherwise.\n\n    Examples\n    --------\n    >>> is_palindrome('')\n    True\n    >>> is_palindrome('aba')\n    True\n    >>> is_palindrome('aaaaa')\n    True\n    >>> is_palindrome('zbcd')\n    False\n    \"\"\"\n    # The simplest way to test for a palindrome is to compare the string\n    # with its reversed version.  ``text[::-1]`` creates a new string that\n    # contains the characters of ``text`` in reverse order.\n    return text == text[::-1]", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/51": [{"task_id": "HumanEval/51", "solution": "import doctest\nimport sys\nfrom typing import Iterable\ndef remove_vowels(text: str) -> str:\n    \"\"\"\n    Return *text* with all vowels removed.\n\n    Vowels are the characters ``a e i o u`` in both lower\u2011 and upper\u2011case.\n    The function preserves all other characters, including whitespace,\n    punctuation and digits.\n\n    Parameters\n    ----------\n    text : str\n        The input string.\n\n    Returns\n    -------\n    str\n        The string with vowels removed.\n\n    Examples\n    --------\n    >>> remove_vowels('')\n    ''\n    >>> remove_vowels('abcdef\\\\nghijklm')\n    'bcdf\\\\nghjklm'\n    >>> remove_vowels('abcdef')\n    'bcdf'\n    >>> remove_vowels('aaaaa')\n    ''\n    >>> remove_vowels('aaBAA')\n    'B'\n    >>> remove_vowels('zbcd')\n    'zbcd'\n    \"\"\"\n    vowels: set[str] = set(\"aeiouAEIOU\")\n    return \"\".join(ch for ch in text if ch not in vowels)", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/52": [{"task_id": "HumanEval/52", "solution": "def below_threshold(l: list[int], t: int) -> bool:\n    \"\"\"\n    Return ``True`` if all numbers in the list ``l`` are strictly below the\n    threshold ``t``; otherwise return ``False``.\n\n    Parameters\n    ----------\n    l : list[int]\n        A list of integers to test.\n    t : int\n        The threshold value.\n\n    Returns\n    -------\n    bool\n        ``True`` if every element in ``l`` is < ``t``, otherwise ``False``.\n\n    Examples\n    --------\n    >>> below_threshold([1, 2, 4, 10], 100)\n    True\n    >>> below_threshold([1, 20, 4, 10], 5)\n    False\n    >>> below_threshold([], 10)          # An empty list is vacuously below any threshold\n    True\n    \"\"\"\n    for x in l:\n        if x >= t:\n            return False\n    return True", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/53": [{"task_id": "HumanEval/53", "solution": "def add(x: int, y: int) -> int:\n    \"\"\"Add two numbers x and y\n\n    >>> add(2, 3)\n    5\n    >>> add(5, 7)\n    12\n    \"\"\"\n    return x + y", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/54": [{"task_id": "HumanEval/54", "solution": "def same_chars(s0: str, s1: str) -> bool:\n    \"\"\"\n    Return ``True`` if *s0* and *s1* contain the same set of characters,\n    otherwise ``False``.\n\n    The comparison is case\u2011sensitive and ignores the number of times a\n    character appears.\n\n    >>> same_chars('eabcdzzzz', 'dddzzzzzzzddeddabc')\n    True\n    >>> same_chars('abcd', 'dddddddabc')\n    True\n    >>> same_chars('dddddddabc', 'abcd')\n    True\n    >>> same_chars('eabcd', 'dddddddabc')\n    False\n    >>> same_chars('abcd', 'dddddddabce')\n    False\n    >>> same_chars('eabcdzzzz', 'dddzzzzzzzddddabc')\n    False\n    \"\"\"\n    return set(s0) == set(s1)", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/55": [{"task_id": "HumanEval/55", "solution": "from typing import Final\ndef fib(n: int) -> int:\n    \"\"\"\n    Return the n-th Fibonacci number (1\u2011based indexing).\n\n    Parameters\n    ----------\n    n : int\n        The position in the Fibonacci sequence (must be >= 1).\n\n    Returns\n    -------\n    int\n        The n\u2011th Fibonacci number.\n\n    Raises\n    ------\n    ValueError\n        If n is less than 1.\n\n    Notes\n    -----\n    The sequence is defined as:\n        F(1) = 1\n        F(2) = 1\n        F(k) = F(k-1) + F(k-2) for k > 2\n\n    Examples\n    --------\n    >>> fib(10)\n    55\n    >>> fib(1)\n    1\n    >>> fib(8)\n    21\n    \"\"\"\n    if n < 1:\n        raise ValueError(\"n must be a positive integer (1\u2011based indexing)\")\n\n    # Base cases\n    if n <= 2:\n        return 1\n\n    a: int = 1  # F(1)\n    b: int = 1  # F(2)\n    for _ in range(3, n + 1):\n        a, b = b, a + b\n    return b", "base_status": "pass", "plus_status": "fail", "base_fail_tests": [], "plus_fail_tests": [[0]]}], "HumanEval/57": [{"task_id": "HumanEval/57", "solution": "from typing import List, Sequence, Any\ndef monotonic(l: Sequence[float]) -> bool:\n    \"\"\"\n    Return True if the elements of *l* are monotonically increasing\n    or monotonically decreasing.\n\n    A sequence is considered monotonically increasing if every element\n    is greater than or equal to the previous one.  It is considered\n    monotonically decreasing if every element is less than or equal\n    to the previous one.  Sequences of length 0 or 1 are trivially\n    monotonic.\n\n    Parameters\n    ----------\n    l : Sequence[float]\n        The sequence to test.\n\n    Returns\n    -------\n    bool\n        True if *l* is monotonic, False otherwise.\n\n    Examples\n    --------\n    >>> monotonic([1, 2, 4, 20])\n    True\n    >>> monotonic([1, 20, 4, 10])\n    False\n    >>> monotonic([4, 1, 0, -10])\n    True\n    >>> monotonic([1, 1, 1, 1])\n    True\n    >>> monotonic([])\n    True\n    \"\"\"\n    if len(l) <= 1:\n        return True\n\n    # Determine the direction of the first non\u2011equal pair.\n    # If all elements are equal, the sequence is monotonic.\n    it = iter(l)\n    prev = next(it)\n    for curr in it:\n        if curr > prev:\n            direction = 1  # increasing\n            break\n        elif curr < prev:\n            direction = -1  # decreasing\n            break\n        prev = curr\n    else:\n        # All elements are equal\n        return True\n\n    # Check that all subsequent differences match the direction.\n    for curr in it:\n        if (curr - prev) * direction < 0:\n            return False\n        prev = curr\n\n    return True", "base_status": "fail", "plus_status": "fail", "base_fail_tests": [[[1, 20, 4, 10]]], "plus_fail_tests": [[[1, 1, 1, 2, 1, 1, 1]]]}], "HumanEval/59": [{"task_id": "HumanEval/59", "solution": "import math\nimport sys\nimport doctest\ndef largest_prime_factor(n: int) -> int:\n    \"\"\"\n    Return the largest prime factor of n. Assume n > 1 and is not a prime.\n\n    Parameters\n    ----------\n    n : int\n        The integer to factor. Must be > 1 and not prime.\n\n    Returns\n    -------\n    int\n        The largest prime factor of n.\n\n    Examples\n    --------\n    >>> largest_prime_factor(13195)\n    29\n    >>> largest_prime_factor(2048)\n    2\n    >>> largest_prime_factor(600851475143)\n    6857\n    \"\"\"\n    if n <= 1:\n        raise ValueError(\"n must be greater than 1\")\n\n    # Handle even numbers first\n    max_factor = 1\n    while n % 2 == 0:\n        max_factor = 2\n        n //= 2\n\n    # Now n is odd. Test odd divisors up to sqrt(n).\n    divisor = 3\n    limit = math.isqrt(n) + 1\n    while divisor <= limit and n > 1:\n        if n % divisor == 0:\n            max_factor = divisor\n            while n % divisor == 0:\n                n //= divisor\n            limit = math.isqrt(n) + 1\n        divisor += 2\n\n    # If n is now > 1, it is prime and larger than any factor found.\n    if n > 1:\n        max_factor = n\n\n    return int(max_factor)", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/56": [{"task_id": "HumanEval/56", "solution": "def correct_bracketing(brackets: str) -> bool:\n    \"\"\"\n    Return ``True`` if every opening bracket has a corresponding closing\n    bracket, otherwise ``False``.\n\n    The function treats the string as a sequence of tokens where\n    ``'<'`` is an opening bracket and ``'>'`` is a closing bracket.\n    The brackets must be *properly nested* \u2013 the same rule that applies\n    to parentheses in arithmetic expressions.\n\n    Parameters\n    ----------\n    brackets : str\n        A string containing only the characters ``'<'`` and ``'>'``.\n\n    Returns\n    -------\n    bool\n        ``True`` if the string is balanced, ``False`` otherwise.\n\n    Examples\n    --------\n    >>> correct_bracketing(\"<\")\n    False\n    >>> correct_bracketing(\"<>\")\n    True\n    >>> correct_bracketing(\"<<><>>\")\n    True\n    >>> correct_bracketing(\"><<>\")\n    False\n    \"\"\"\n    # A simple counter is enough \u2013 we never need to remember the exact\n    # positions of the opening brackets, only how many are still open.\n    open_count = 0\n\n    for ch in brackets:\n        if ch == \"<\":\n            open_count += 1\n        elif ch == \">\":\n            if open_count == 0:\n                # A closing bracket with nothing to match.\n                return False\n            open_count -= 1\n        else:\n            # The problem statement guarantees that only '<' and '>' are\n            # present, but we guard against accidental misuse.\n            raise ValueError(f\"Invalid character {ch!r} in input\")\n\n    # All opening brackets must have been closed.\n    return open_count == 0", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/58": [{"task_id": "HumanEval/58", "solution": "from typing import List, Iterable\ndef common(l1: Iterable[int], l2: Iterable[int]) -> List[int]:\n    \"\"\"\n    Return sorted unique common elements for two lists.\n\n    Parameters\n    ----------\n    l1, l2 : Iterable[int]\n        Input sequences of integers.\n\n    Returns\n    -------\n    List[int]\n        Sorted list of elements that appear in both `l1` and `l2`.\n\n    Examples\n    --------\n    >>> common([1, 4, 3, 34, 653, 2, 5], [5, 7, 1, 5, 9, 653, 121])\n    [1, 5, 653]\n    >>> common([5, 3, 2, 8], [3, 2])\n    [2, 3]\n    \"\"\"\n    # Convert to sets to remove duplicates and allow fast intersection\n    set1 = set(l1)\n    set2 = set(l2)\n\n    # Intersection gives the common elements\n    common_elements = set1 & set2\n\n    # Return a sorted list\n    return sorted(common_elements)", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/61": [{"task_id": "HumanEval/61", "solution": "def correct_bracketing(brackets: str) -> bool:\n    \"\"\"\n    Return True if every opening bracket has a corresponding closing bracket.\n\n    Parameters\n    ----------\n    brackets : str\n        A string containing only the characters '(' and ')'.\n\n    Returns\n    -------\n    bool\n        True if the string is correctly bracketed, False otherwise.\n\n    Examples\n    --------\n    >>> correct_bracketing(\"(\")\n    False\n    >>> correct_bracketing(\"()\")\n    True\n    >>> correct_bracketing(\"(()())\")\n    True\n    >>> correct_bracketing(\")(()\")\n    False\n    \"\"\"\n    depth = 0\n    for ch in brackets:\n        if ch == '(':\n            depth += 1\n        elif ch == ')':\n            depth -= 1\n            if depth < 0:          # more closing than opening so far\n                return False\n        else:\n            # The problem statement guarantees only '(' and ')', but\n            # raising a ValueError makes the function safer to use elsewhere.\n            raise ValueError(f\"Invalid character {ch!r} in input\")\n    return depth == 0", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/60": [{"task_id": "HumanEval/60", "solution": "import doctest\nimport sys\ndef sum_to_n(n: int) -> int:\n    \"\"\"\n    Return the sum of all integers from 1 to n inclusive.\n\n    The function uses the closed\u2011form formula for the sum of the first\n    n natural numbers:\n\n        sum = n * (n + 1) // 2\n\n    Parameters\n    ----------\n    n : int\n        The upper bound of the summation.  Must be a non\u2011negative integer.\n        If a negative value is supplied, a ValueError is raised.\n\n    Returns\n    -------\n    int\n        The sum of the integers from 1 to n.\n\n    Examples\n    --------\n    >>> sum_to_n(30)\n    465\n    >>> sum_to_n(100)\n    5050\n    >>> sum_to_n(5)\n    15\n    >>> sum_to_n(10)\n    55\n    >>> sum_to_n(1)\n    1\n    \"\"\"\n    if n < 0:\n        raise ValueError(\"n must be a non\u2011negative integer\")\n    return n * (n + 1) // 2", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/62": [{"task_id": "HumanEval/62", "solution": "from typing import List\nimport doctest\ndef derivative(xs: List[float]) -> List[float]:\n    \"\"\"\n    Return the derivative of a polynomial represented by a list of\n    coefficients.\n\n    Parameters\n    ----------\n    xs : list of float\n        Coefficients of the polynomial in ascending order of degree.\n        xs[0] is the constant term, xs[1] the coefficient of x, etc.\n\n    Returns\n    -------\n    list of float\n        Coefficients of the derivative polynomial, also in ascending\n        order.  The constant term of the derivative is omitted\n        (since it is zero).\n\n    Examples\n    --------\n    >>> derivative([3, 1, 2, 4, 5])\n    [1, 4, 12, 20]\n    >>> derivative([1, 2, 3])\n    [2, 6]\n    \"\"\"\n    # The derivative of a0 + a1*x + a2*x^2 + ... is\n    # a1 + 2*a2*x + 3*a3*x^2 + ...\n    # So we multiply each coefficient by its degree and drop the\n    # constant term (degree 0).\n    return [coeff * deg for deg, coeff in enumerate(xs[1:], start=1)]", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/63": [{"task_id": "HumanEval/63", "solution": "from typing import List\ndef mat_mul(a: List[List[int]], b: List[List[int]]) -> List[List[int]]:\n    \"\"\"Multiply two 3\u00d73 matrices.\"\"\"\n    res = [[0, 0, 0] for _ in range(3)]\n    for i in range(3):\n        ai0, ai1, ai2 = a[i]\n        for j in range(3):\n            res[i][j] = (\n                ai0 * b[0][j] +\n                ai1 * b[1][j] +\n                ai2 * b[2][j]\n            )\n    return res\ndef mat_pow(mat: List[List[int]], exp: int) -> List[List[int]]:\n    \"\"\"Raise a 3\u00d73 matrix to a non\u2011negative integer power (binary exponentiation).\"\"\"\n    # identity matrix\n    result = [[1 if i == j else 0 for j in range(3)] for i in range(3)]\n    base = [row[:] for row in mat]\n    while exp:\n        if exp & 1:\n            result = mat_mul(result, base)\n        base = mat_mul(base, base)\n        exp >>= 1\n    return result\ndef fibfib(n: int) -> int:\n    \"\"\"\n    Return the n\u2011th FibFib number.\n\n    Parameters\n    ----------\n    n : int\n        Index of the desired element (n \u2265 0).\n\n    Returns\n    -------\n    int\n        The value of fibfib(n).\n\n    Examples\n    --------\n    >>> fibfib(1)\n    0\n    >>> fibfib(5)\n    4\n    >>> fibfib(8)\n    24\n    \"\"\"\n    if n < 0:\n        raise ValueError(\"n must be non\u2011negative\")\n\n    # Base cases\n    if n == 0 or n == 1:\n        return 0\n    if n == 2:\n        return 1\n\n    # Transition matrix\n    M = [\n        [1, 1, 1],\n        [1, 0, 0],\n        [0, 1, 0],\n    ]\n\n    # We need M^(n-2) because V(2) = [1,0,0]\u1d40\n    P = mat_pow(M, n - 2)\n\n    # The first component of V(n) is the first row of P multiplied by V(2)\n    # Since V(2) = [1,0,0]\u1d40, the result is simply P[0][0]\n    return P[0][0]", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/64": [{"task_id": "HumanEval/64", "solution": "import unittest\nimport re\ndef vowels_count(word: str) -> int:\n    \"\"\"\n    Return the number of vowels in *word*.\n\n    Parameters\n    ----------\n    word : str\n        The word to analyse.\n\n    Returns\n    -------\n    int\n        The number of vowels in the word.\n\n    Notes\n    -----\n    * The function is case\u2011insensitive.\n    * The letter 'y' is counted as a vowel only when it is the last\n      character of the word.\n\n    Examples\n    --------\n    >>> vowels_count(\"abcde\")\n    2\n    >>> vowels_count(\"ACEDY\")\n    3\n    >>> vowels_count(\"rhythm\")\n    1\n    >>> vowels_count(\"sky\")\n    1\n    >>> vowels_count(\"sky\")\n    1\n    >>> vowels_count(\"sky\")\n    1\n    \"\"\"\n    if not word:\n        return 0\n\n    # Normalise to lower case for easier comparison\n    w = word.lower()\n\n    # Count the standard vowels\n    count = sum(1 for ch in w if ch in \"aeiou\")\n\n    # Add 'y' if it is the last character\n    if w.endswith(\"y\"):\n        count += 1\n\n    return count", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/67": [{"task_id": "HumanEval/67", "solution": "import re\nfrom typing import Tuple\ndef _extract_numbers(text: str) -> Tuple[int, int]:\n    \"\"\"\n    Extract the first two integers from *text*.\n    The function assumes that the string contains exactly two numbers\n    (apples and oranges) in that order.\n\n    Parameters\n    ----------\n    text : str\n        The sentence that contains the numbers.\n\n    Returns\n    -------\n    Tuple[int, int]\n        A tuple (apples, oranges).\n\n    Raises\n    ------\n    ValueError\n        If the string does not contain at least two integers.\n    \"\"\"\n    numbers = [int(n) for n in re.findall(r\"\\d+\", text)]\n    if len(numbers) < 2:\n        raise ValueError(\"Input string must contain at least two integers.\")\n    return numbers[0], numbers[1]\ndef fruit_distribution(sentence: str, total_fruits: int) -> int:\n    \"\"\"\n    Return the number of mangoes in a basket.\n\n    Parameters\n    ----------\n    sentence : str\n        A sentence that contains the number of apples and oranges,\n        e.g. \"5 apples and 6 oranges\".\n    total_fruits : int\n        The total number of fruits in the basket.\n\n    Returns\n    -------\n    int\n        The number of mangoes.\n\n    Examples\n    --------\n    >>> fruit_distribution(\"5 apples and 6 oranges\", 19)\n    8\n    >>> fruit_distribution(\"0 apples and 1 oranges\", 3)\n    2\n    >>> fruit_distribution(\"2 apples and 3 oranges\", 100)\n    95\n    >>> fruit_distribution(\"100 apples and 1 oranges\", 120)\n    19\n    \"\"\"\n    apples, oranges = _extract_numbers(sentence)\n    mangoes = total_fruits - apples - oranges\n    if mangoes < 0:\n        raise ValueError(\"Total fruits is less than the sum of apples and oranges.\")\n    return mangoes", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/65": [{"task_id": "HumanEval/65", "solution": "def circular_shift(x: int, shift: int) -> str:\n    \"\"\"\n    Circularly shift the digits of the integer ``x`` to the right by ``shift`` places\n    and return the result as a string.\n\n    If ``shift`` is greater than the number of digits in ``x``, the digits are\n    simply reversed.\n\n    Parameters\n    ----------\n    x : int\n        The integer whose digits are to be shifted.  Negative values are\n        treated as if the sign were removed; the sign is not part of the\n        rotation.\n    shift : int\n        The number of positions to shift the digits to the right.\n\n    Returns\n    -------\n    str\n        The rotated digits as a string.  The sign of ``x`` is *not* preserved\n        in the output \u2013 the function only deals with the absolute value.\n\n    Examples\n    --------\n    >>> circular_shift(12, 1)\n    '21'\n    >>> circular_shift(12, 2)\n    '12'\n    >>> circular_shift(12345, 3)\n    '45123'\n    >>> circular_shift(12345, 6)   # shift > number of digits\n    '54321'\n    >>> circular_shift(-987, 1)\n    '798'\n    \"\"\"\n    # Work with the absolute value \u2013 the sign is ignored for the rotation.\n    digits = str(abs(x))\n    n = len(digits)\n\n    # If the shift is larger than the number of digits, just reverse.\n    if shift > n:\n        return digits[::-1]\n\n    # Normal circular right shift: take the last `shift` characters\n    # and put them in front of the remaining prefix.\n    shift = shift % n  # guard against shift == 0\n    return digits[-shift:] + digits[:-shift]", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/66": [{"task_id": "HumanEval/66", "solution": "def digitSum(s: str) -> int:\n    \"\"\"Return the sum of ASCII codes of all uppercase letters in *s*.\"\"\"\n    total = 0\n    for ch in s:\n        if 'A' <= ch <= 'Z':          # check for uppercase letter\n            total += ord(ch)          # add its ASCII value\n    return total", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/69": [{"task_id": "HumanEval/69", "solution": "from collections import Counter\nfrom typing import List\ndef search(lst: List[int]) -> int:\n    \"\"\"\n    Return the greatest integer > 0 that appears in `lst` at least as many times as its value.\n    If no such integer exists, return -1.\n\n    Parameters\n    ----------\n    lst : List[int]\n        A non\u2011empty list of positive integers.\n\n    Returns\n    -------\n    int\n        The desired integer or -1.\n\n    Examples\n    --------\n    >>> search([4, 1, 2, 2, 3, 1])\n    2\n    >>> search([1, 2, 2, 3, 3, 3, 4, 4, 4])\n    3\n    >>> search([5, 5, 4, 4, 4])\n    -1\n    \"\"\"\n    freq = Counter(lst)\n    best = -1\n    for value, count in freq.items():\n        if value > 0 and count >= value:\n            if value > best:\n                best = value\n    return best", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/70": [{"task_id": "HumanEval/70", "solution": "from typing import List\ndef strange_sort_list(lst: List[int]) -> List[int]:\n    \"\"\"\n    Return a new list containing the elements of *lst* sorted in the\n    \u201cstrange\u201d order described above.\n\n    Parameters\n    ----------\n    lst : List[int]\n        The input list of integers.\n\n    Returns\n    -------\n    List[int]\n        A new list with the elements arranged as:\n        min, max, next min, next max, ...\n\n    Examples\n    --------\n    >>> strange_sort_list([1, 2, 3, 4])\n    [1, 4, 2, 3]\n    >>> strange_sort_list([5, 5, 5, 5])\n    [5, 5, 5, 5]\n    >>> strange_sort_list([])\n    []\n    \"\"\"\n    # Work on a sorted copy so we can pop from both ends efficiently.\n    sorted_lst = sorted(lst)\n    result: List[int] = []\n\n    # While there are still elements left, alternately pop from the\n    # beginning (smallest) and the end (largest).\n    while sorted_lst:\n        # Smallest remaining element\n        result.append(sorted_lst.pop(0))\n        if sorted_lst:          # If there are still elements left\n            # Largest remaining element\n            result.append(sorted_lst.pop(-1))\n\n    return result", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/68": [{"task_id": "HumanEval/68", "solution": "from typing import List\ndef pluck(arr: List[int]) -> List[int]:\n    \"\"\"\n    Return the smallest even value and its first index from `arr`.\n\n    Parameters\n    ----------\n    arr : List[int]\n        List of non\u2011negative integers representing a tree branch.\n\n    Returns\n    -------\n    List[int]\n        `[smallest_even, index]` or `[]` if no even number exists.\n    \"\"\"\n    min_val = None\n    min_idx = -1\n\n    for idx, val in enumerate(arr):\n        if val % 2 == 0:          # even number\n            if min_val is None or val < min_val:\n                min_val = val\n                min_idx = idx\n\n    return [] if min_val is None else [min_val, min_idx]", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/71": [{"task_id": "HumanEval/71", "solution": "import math\nimport sys\nimport argparse\nimport textwrap\ndef triangle_area(a: float, b: float, c: float) -> float:\n    \"\"\"\n    Return the area of a triangle with side lengths a, b, c rounded to 2 decimal places.\n    If the sides cannot form a triangle, return -1.\n\n    Parameters\n    ----------\n    a, b, c : float\n        Lengths of the three sides.\n\n    Returns\n    -------\n    float\n        The area rounded to 2 decimal places, or -1 if the sides are invalid.\n    \"\"\"\n    # Validate that all sides are positive numbers\n    if a <= 0 or b <= 0 or c <= 0:\n        return -1\n\n    # Triangle inequality check\n    if not (a + b > c and a + c > b and b + c > a):\n        return -1\n\n    # Heron's formula\n    s = (a + b + c) / 2\n    area_sq = s * (s - a) * (s - b) * (s - c)\n    # Numerical errors can make area_sq slightly negative; clamp to zero\n    area_sq = max(area_sq, 0.0)\n    area = math.sqrt(area_sq)\n\n    return round(area, 2)", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/73": [{"task_id": "HumanEval/73", "solution": "from typing import List\ndef smallest_change(arr: List[int]) -> int:\n    \"\"\"\n    Return the minimum number of changes required to make `arr` a palindrome.\n\n    Parameters\n    ----------\n    arr : List[int]\n        The input array of integers.\n\n    Returns\n    -------\n    int\n        The minimal number of elements that must be changed.\n\n    Examples\n    --------\n    >>> smallest_change([1, 2, 3, 5, 4, 7, 9, 6])\n    4\n    >>> smallest_change([1, 2, 3, 4, 3, 2, 2])\n    1\n    >>> smallest_change([1, 2, 3, 2, 1])\n    0\n    \"\"\"\n    n = len(arr)\n    changes = 0\n    for i in range(n // 2):\n        if arr[i] != arr[n - 1 - i]:\n            changes += 1\n    return changes", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/72": [{"task_id": "HumanEval/72", "solution": "def will_it_fly(q, w):\n    \"\"\"\n    Return True if the list `q` is a palindrome and its sum is <= `w`.\n    \"\"\"\n    # Check if the list is a palindrome\n    if q != q[::-1]:\n        return False\n\n    # Check if the sum of elements is within the weight limit\n    return sum(q) <= w", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/75": [{"task_id": "HumanEval/75", "solution": "from typing import List\ndef _primes_up_to(n: int) -> List[int]:\n    \"\"\"\n    Return a list of all prime numbers <= n using the Sieve of Eratosthenes.\n    \"\"\"\n    sieve = [True] * (n + 1)\n    sieve[0:2] = [False, False]          # 0 and 1 are not primes\n    for p in range(2, int(n**0.5) + 1):\n        if sieve[p]:\n            for multiple in range(p * p, n + 1, p):\n                sieve[multiple] = False\n    return [i for i, is_prime in enumerate(sieve) if is_prime]\n_PRIMES = _primes_up_to(99)\ndef is_multiply_prime(a: int) -> bool:\n    \"\"\"\n    Return True if `a` can be written as the product of exactly three prime numbers,\n    otherwise return False.\n\n    Parameters\n    ----------\n    a : int\n        The integer to test (must be < 100).\n\n    Returns\n    -------\n    bool\n        True if `a` is a product of three primes, False otherwise.\n    \"\"\"\n    if a <= 1 or a >= 100:\n        raise ValueError(\"Input must be an integer less than 100 and greater than 1\")\n\n    # Try all combinations of three primes (with repetition allowed)\n    for i, p1 in enumerate(_PRIMES):\n        if p1 * p1 * p1 > a:          # early exit: smallest possible product already too big\n            break\n        for j, p2 in enumerate(_PRIMES[i:], start=i):\n            prod12 = p1 * p2\n            if prod12 * p2 > a:       # p2 repeated would already exceed a\n                break\n            for k, p3 in enumerate(_PRIMES[j:], start=j):\n                prod = prod12 * p3\n                if prod == a:\n                    return True\n                if prod > a:\n                    break\n    return False", "base_status": "pass", "plus_status": "fail", "base_fail_tests": [], "plus_fail_tests": [[-98]]}], "HumanEval/74": [{"task_id": "HumanEval/74", "solution": "from typing import List\ndef total_match(lst1: List[str], lst2: List[str]) -> List[str]:\n    \"\"\"\n    Return the list that has the smaller total number of characters.\n\n    Parameters\n    ----------\n    lst1, lst2 : List[str]\n        Two lists of strings to compare.\n\n    Returns\n    -------\n    List[str]\n        The list with the smaller total length.  If the totals are equal,\n        ``lst1`` is returned.\n\n    Examples\n    --------\n    >>> total_match([], [])\n    []\n    >>> total_match(['hi', 'admin'], ['hI', 'Hi'])\n    ['hI', 'Hi']\n    >>> total_match(['hi', 'admin'], ['hi', 'hi', 'admin', 'project'])\n    ['hi', 'admin']\n    >>> total_match(['hi', 'admin'], ['hI', 'hi', 'hi'])\n    ['hI', 'hi', 'hi']\n    >>> total_match(['4'], ['1', '2', '3', '4', '5'])\n    ['4']\n    \"\"\"\n    # Compute the total number of characters in each list\n    total1 = sum(len(s) for s in lst1)\n    total2 = sum(len(s) for s in lst2)\n\n    # Return the list with the smaller total; if equal, return lst1\n    return lst1 if total1 <= total2 else lst2", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/77": [{"task_id": "HumanEval/77", "solution": "def iscube(a: int) -> bool:\n    \"\"\"\n    Return True if `a` is a perfect cube of an integer.\n\n    The algorithm works as follows:\n    1. Compute the integer cube root of the absolute value of `a`\n       using `round(a ** (1/3))`.  The rounding is safe because\n       the cube root of an integer is at most 1 away from the\n       nearest integer.\n    2. Raise the candidate root back to the third power.\n    3. Compare the result with the original number (taking the sign into\n       account for negative inputs).\n\n    Parameters\n    ----------\n    a : int\n        The integer to test.\n\n    Returns\n    -------\n    bool\n        True if `a` is a perfect cube, False otherwise.\n    \"\"\"\n    # Handle the trivial case of zero\n    if a == 0:\n        return True\n\n    # Compute the cube root of the absolute value\n    abs_root = round(abs(a) ** (1 / 3))\n\n    # Reconstruct the cube and compare\n    return abs_root ** 3 == abs(a)", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/76": [{"task_id": "HumanEval/76", "solution": "def is_simple_power(x: int, n: int) -> bool:\n    \"\"\"\n    Return True if x is a simple power of n, otherwise False.\n\n    A number x is a simple power of n if there exists an integer k >= 0\n    such that n**k == x.\n\n    Parameters\n    ----------\n    x : int\n        The number to test.\n    n : int\n        The base.\n\n    Returns\n    -------\n    bool\n        True if x is a power of n, False otherwise.\n\n    Notes\n    -----\n    * 0 and 1 are handled explicitly:\n        - 0 is a power of any n > 0 only when n == 0 (0**k == 0 for k > 0).\n          For simplicity we treat 0 as not a power of any n > 0.\n        - 1 is a power of any n (n**0 == 1) but we return False when n == 1\n          because 1**k == 1 for all k and the problem statement says\n          is_simple_power(3, 1) => False.\n    * Negative bases are allowed; the algorithm works for them as well.\n    \"\"\"\n    # Edge cases\n    if n == 1:\n        # 1**k == 1 for any k, but the problem statement says this should be False\n        return False\n    if x == 1:\n        # 1 is a power of any n (n**0 == 1)\n        return True\n    if x == 0:\n        # 0 is only a power of 0, but we treat it as False for n != 0\n        return False\n\n    # Work with absolute values to handle negative bases\n    abs_n = abs(n)\n    abs_x = abs(x)\n\n    # If the sign of x does not match the sign of n**k for any integer k,\n    # we can immediately return False.\n    if (x < 0) != (n < 0) and abs_n != 1:\n        return False\n\n    # Repeatedly divide x by n while it is divisible.\n    current = abs_x\n    while current % abs_n == 0:\n        current //= abs_n\n\n    # If we have reduced to 1, x was a power of n.\n    return current == 1", "base_status": "fail", "plus_status": "fail", "base_fail_tests": [[1, 1]], "plus_fail_tests": [[1, 1]]}], "HumanEval/78": [{"task_id": "HumanEval/78", "solution": "PRIME_DIGITS = {\"2\", \"3\", \"5\", \"7\", \"B\", \"D\"}\ndef hex_key(num: str) -> int:\n    \"\"\"\n    Return the count of hexadecimal digits in *num* that are prime numbers.\n\n    Parameters\n    ----------\n    num : str\n        A string containing only valid hexadecimal digits (0\u20119, A\u2011F).\n        The string may be empty.\n\n    Returns\n    -------\n    int\n        Number of characters in *num* that are in the set of prime digits.\n\n    Examples\n    --------\n    >>> hex_key(\"AB\")\n    1\n    >>> hex_key(\"1077E\")\n    2\n    >>> hex_key(\"ABED1A33\")\n    4\n    >>> hex_key(\"123456789ABCDEF0\")\n    6\n    >>> hex_key(\"2020\")\n    2\n    \"\"\"\n    # Using a generator expression keeps the implementation short and fast.\n    return sum(1 for ch in num if ch in PRIME_DIGITS)", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/79": [{"task_id": "HumanEval/79", "solution": "from typing import Union\ndef decimal_to_binary(decimal: Union[int, str]) -> str:\n    \"\"\"\n    Convert a decimal number to a binary string wrapped with ``db`` markers.\n\n    Parameters\n    ----------\n    decimal : int | str\n        The number to convert.  It may be an ``int`` or a string that\n        represents an integer.  Negative numbers are not supported\n        because the original problem statement only mentions\n        non\u2011negative integers.\n\n    Returns\n    -------\n    str\n        A string of the form ``\"db<binary>db\"`` where ``<binary>``\n        is the binary representation of the input number.\n\n    Examples\n    --------\n    >>> decimal_to_binary(15)\n    'db1111db'\n    >>> decimal_to_binary(32)\n    'db100000db'\n    >>> decimal_to_binary('0')\n    'db0db'\n    \"\"\"\n    # Accept string input for convenience\n    if isinstance(decimal, str):\n        decimal = int(decimal)\n\n    if decimal < 0:\n        raise ValueError(\"Only non\u2011negative integers are supported\")\n\n    # ``bin`` returns a string like '0b1010'; we drop the first two chars\n    binary_part = bin(decimal)[2:]\n\n    return f\"db{binary_part}db\"", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/82": [{"task_id": "HumanEval/82", "solution": "from math import isqrt\nfrom typing import Iterable\ndef _is_prime(n: int) -> bool:\n    \"\"\"\n    Return True if n is a prime number, False otherwise.\n\n    The function handles the edge cases n <= 1 explicitly and then\n    checks divisibility only up to the integer square root of n.\n    \"\"\"\n    if n <= 1:\n        return False\n    if n <= 3:\n        return True          # 2 and 3 are prime\n    if n % 2 == 0 or n % 3 == 0:\n        return False\n\n    # Check numbers of the form 6k \u00b1 1 up to sqrt(n)\n    i = 5\n    while i <= isqrt(n):\n        if n % i == 0 or n % (i + 2) == 0:\n            return False\n        i += 6\n    return True\ndef prime_length(string: str) -> bool:\n    \"\"\"\n    Return True if the length of *string* is a prime number, False otherwise.\n\n    Parameters\n    ----------\n    string : str\n        The string to test.\n\n    Returns\n    -------\n    bool\n        True if len(string) is prime, False otherwise.\n\n    Examples\n    --------\n    >>> prime_length('Hello')\n    True\n    >>> prime_length('abcdcba')\n    True\n    >>> prime_length('kittens')\n    True\n    >>> prime_length('orange')\n    False\n    \"\"\"\n    return _is_prime(len(string))", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/81": [{"task_id": "HumanEval/81", "solution": "from typing import List\ndef numerical_letter_grade(grades: List[float]) -> List[str]:\n    \"\"\"\n    Convert a list of numeric GPAs into letter grades.\n\n    Parameters\n    ----------\n    grades : List[float]\n        A list of GPAs (0.0 \u2013 4.0 inclusive).\n\n    Returns\n    -------\n    List[str]\n        The corresponding list of letter grades.\n\n    Notes\n    -----\n    The grading scale is:\n\n        GPA   | Letter grade\n        4.0   | A+\n        >3.7  | A\n        >3.3  | A-\n        >3.0  | B+\n        >2.7  | B\n        >2.3  | B-\n        >2.0  | C+\n        >1.7  | C\n        >1.3  | C-\n        >1.0  | D+\n        >0.7  | D\n        >0.0  | D-\n        0.0   | E\n\n    The function is tolerant of values outside the 0.0\u20134.0 range; they are\n    clamped to the nearest valid boundary before grading.\n    \"\"\"\n    # Define thresholds in descending order\n    thresholds = [\n        (4.0, \"A+\"),\n        (3.7, \"A\"),\n        (3.3, \"A-\"),\n        (3.0, \"B+\"),\n        (2.7, \"B\"),\n        (2.3, \"B-\"),\n        (2.0, \"C+\"),\n        (1.7, \"C\"),\n        (1.3, \"C-\"),\n        (1.0, \"D+\"),\n        (0.7, \"D\"),\n        (0.0, \"D-\"),\n    ]\n\n    result = []\n\n    for gpa in grades:\n        # Clamp GPA to the valid range\n        gpa = max(0.0, min(4.0, gpa))\n\n        # Find the first threshold that the GPA satisfies\n        for threshold, letter in thresholds:\n            if gpa == 4.0 and threshold == 4.0:\n                # Exact 4.0 gets A+\n                result.append(letter)\n                break\n            if gpa > threshold:\n                result.append(letter)\n                break\n        else:\n            # If GPA is exactly 0.0, fall through to the last threshold\n            result.append(\"E\")\n\n    return result", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/80": [{"task_id": "HumanEval/80", "solution": "from typing import Iterable\ndef is_happy(s: str) -> bool:\n    \"\"\"\n    Return True if *s* is a happy string, False otherwise.\n\n    Parameters\n    ----------\n    s : str\n        The string to test.\n\n    Returns\n    -------\n    bool\n        True if the string is happy, False otherwise.\n    \"\"\"\n    # Rule 1: length must be at least 3\n    if len(s) < 3:\n        return False\n\n    # Rule 2: every 3\u2011consecutive block must contain 3 distinct letters\n    for i in range(len(s) - 2):\n        block = s[i : i + 3]\n        if len(set(block)) != 3:          # duplicates found\n            return False\n\n    return True", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/84": [{"task_id": "HumanEval/84", "solution": "def solve(N: int) -> str:\n    \"\"\"\n    Return the binary representation of the sum of the decimal digits of N.\n    \"\"\"\n    # Sum the decimal digits\n    digit_sum = sum(int(d) for d in str(N))\n    # Convert the sum to binary (without the '0b' prefix)\n    return bin(digit_sum)[2:]", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/86": [{"task_id": "HumanEval/86", "solution": "from typing import List\ndef anti_shuffle(sentence: str) -> str:\n    \"\"\"\n    Return a new string where each word of *sentence* has its characters\n    sorted in ascending ASCII order.  Words are defined as sequences of\n    characters separated by a single space.  The original spacing is\n    preserved.\n\n    Parameters\n    ----------\n    sentence : str\n        The input string to be anti\u2011shuffled.\n\n    Returns\n    -------\n    str\n        The anti\u2011shuffled string.\n    \"\"\"\n    # Split on spaces \u2013 this keeps the original spacing intact\n    words: List[str] = sentence.split(' ')\n\n    # Sort the characters of each word\n    sorted_words = [''.join(sorted(word)) for word in words]\n\n    # Re\u2011join with single spaces\n    return ' '.join(sorted_words)", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/85": [{"task_id": "HumanEval/85", "solution": "from typing import List\ndef add(lst: List[int]) -> int:\n    \"\"\"\n    Return the sum of all even elements that are located at odd indices\n    (0\u2011based) in *lst*.\n\n    Parameters\n    ----------\n    lst : List[int]\n        A non\u2011empty list of integers.\n\n    Returns\n    -------\n    int\n        The sum of the qualifying elements.  If no element satisfies the\n        condition, the result is 0.\n\n    Examples\n    --------\n    >>> add([4, 2, 6, 7])\n    2\n    >>> add([1, 4, 3, 8, 5, 10])\n    22\n    \"\"\"\n    # Filter for even numbers that are at odd indices\n    return sum(x for i, x in enumerate(lst) if i % 2 == 1 and x % 2 == 0)", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/83": [{"task_id": "HumanEval/83", "solution": "def starts_one_ends(n: int) -> int:\n    \"\"\"\n    Return the count of n\u2011digit positive integers that start or end with 1.\n\n    Parameters\n    ----------\n    n : int\n        The number of digits (must be a positive integer).\n\n    Returns\n    -------\n    int\n        The number of n\u2011digit integers that start or end with 1.\n    \"\"\"\n    if n <= 0:\n        raise ValueError(\"n must be a positive integer\")\n    if n == 1:\n        return 1  # only the number 1\n    return 18 * (10 ** (n - 2))", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/87": [{"task_id": "HumanEval/87", "solution": "from typing import List, Tuple\ndef get_row(lst: List[List[int]], x: int) -> List[Tuple[int, int]]:\n    \"\"\"\n    Return all coordinates of the integer `x` in a ragged 2\u2011D list `lst`.\n\n    Parameters\n    ----------\n    lst : List[List[int]]\n        A list of lists of integers.  Each inner list may have a different\n        length.\n    x : int\n        The value to search for.\n\n    Returns\n    -------\n    List[Tuple[int, int]]\n        A list of `(row, col)` tuples.  The list is sorted by row\n        ascending, and for each row the columns are sorted descending.\n\n    Examples\n    --------\n    >>> get_row([\n    ...   [1,2,3,4,5,6],\n    ...   [1,2,3,4,1,6],\n    ...   [1,2,3,4,5,1]\n    ... ], 1)\n    [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]\n\n    >>> get_row([], 1)\n    []\n\n    >>> get_row([[], [1], [1, 2, 3]], 3)\n    [(2, 2)]\n    \"\"\"\n    # Collect all matching coordinates\n    coords: List[Tuple[int, int]] = []\n    for row_idx, row in enumerate(lst):\n        for col_idx, val in enumerate(row):\n            if val == x:\n                coords.append((row_idx, col_idx))\n\n    # Sort: first by row ascending, then by column descending\n    coords.sort(key=lambda t: (t[0], -t[1]))\n    return coords", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/88": [{"task_id": "HumanEval/88", "solution": "from typing import List\ndef sort_array(array: List[int]) -> List[int]:\n    \"\"\"\n    Return a sorted copy of *array*.\n\n    Parameters\n    ----------\n    array : List[int]\n        A list of non\u2011negative integers.\n\n    Returns\n    -------\n    List[int]\n        A new list containing the same elements as *array*, sorted\n        either ascending or descending depending on the parity of\n        ``array[0] + array[-1]``.\n    \"\"\"\n    # Handle the trivial cases first \u2013 an empty list or a single element\n    # list is already sorted in any order.\n    if len(array) <= 1:\n        return array.copy()\n\n    # Determine the sorting order.\n    first_last_sum = array[0] + array[-1]\n    ascending = first_last_sum % 2 == 1  # odd \u2192 ascending\n\n    # Create a copy and sort it in the required order.\n    sorted_copy = array.copy()\n    sorted_copy.sort(reverse=not ascending)\n    return sorted_copy", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/90": [{"task_id": "HumanEval/90", "solution": "from typing import List, Optional\ndef next_smallest(lst: List[int]) -> Optional[int]:\n    \"\"\"\n    Return the second smallest distinct element in *lst*.\n\n    Parameters\n    ----------\n    lst : List[int]\n        The list of integers to inspect.\n\n    Returns\n    -------\n    Optional[int]\n        The second smallest distinct value, or None if it does not exist.\n\n    Examples\n    --------\n    >>> next_smallest([1, 2, 3, 4, 5])\n    2\n    >>> next_smallest([5, 1, 4, 3, 2])\n    2\n    >>> next_smallest([])\n    None\n    >>> next_smallest([1, 1])\n    None\n    \"\"\"\n    # Convert to a set to remove duplicates, then sort.\n    unique_vals = sorted(set(lst))\n    return unique_vals[1] if len(unique_vals) >= 2 else None", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/89": [{"task_id": "HumanEval/89", "solution": "from typing import Iterable\ndef _shift_char(ch: str, shift: int = 4) -> str:\n    \"\"\"Shift a single alphabetic character by `shift` positions.\"\"\"\n    if 'a' <= ch <= 'z':\n        return chr((ord(ch) - ord('a') + shift) % 26 + ord('a'))\n    if 'A' <= ch <= 'Z':\n        return chr((ord(ch) - ord('A') + shift) % 26 + ord('A'))\n    return ch  # non\u2011alphabetic characters are unchanged\ndef encrypt(s: str) -> str:\n    \"\"\"Return a new string where each letter is rotated +4 places.\"\"\"\n    return ''.join(_shift_char(ch) for ch in s)", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/93": [{"task_id": "HumanEval/93", "solution": "import string\nfrom typing import Dict\ndef _build_vowel_map() -> Dict[str, str]:\n    vowels = \"aeiouAEIOU\"\n    alphabet = string.ascii_lowercase\n    mapping: Dict[str, str] = {}\n    for v in vowels:\n        # Find the index of the vowel in the lowercase alphabet\n        idx = alphabet.index(v.lower())\n        # Two positions ahead, wrap around if necessary\n        new_char = alphabet[(idx + 2) % 26]\n        # Preserve the original case\n        mapping[v] = new_char.upper() if v.isupper() else new_char\n    return mapping\nVOWEL_MAP = _build_vowel_map()\ndef encode(message: str) -> str:\n    \"\"\"\n    Encode a message by swapping the case of all letters and\n    replacing each vowel with the letter that appears two places\n    ahead in the alphabet.\n\n    Parameters\n    ----------\n    message : str\n        The input string containing only letters.\n\n    Returns\n    -------\n    str\n        The encoded string.\n\n    Examples\n    --------\n    >>> encode('test')\n    'TGST'\n    >>> encode('This is a message')\n    'tHKS KS C MGSSCGG'\n    \"\"\"\n    result = []\n\n    for ch in message:\n        # Replace vowel if needed\n        if ch in VOWEL_MAP:\n            ch = VOWEL_MAP[ch]\n\n        # Swap case (consonants and already replaced vowels)\n        if ch.isalpha():\n            ch = ch.swapcase()\n\n        result.append(ch)\n\n    return \"\".join(result)", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/91": [{"task_id": "HumanEval/91", "solution": "import re\nfrom typing import List\ndef _split_sentences(text: str) -> List[str]:\n    \"\"\"\n    Split *text* into sentences using '.', '?' and '!' as delimiters.\n    The delimiters are removed from the resulting strings.\n    Consecutive delimiters or delimiters at the start/end are ignored.\n    \"\"\"\n    # The regex splits on any of the delimiters followed by optional whitespace.\n    parts = re.split(r'[.!?]+', text)\n    # Strip whitespace and filter out empty parts\n    return [p.strip() for p in parts if p.strip()]\ndef is_bored(text: str) -> int:\n    \"\"\"\n    Return the number of sentences that start with the word \"I\".\n    \"\"\"\n    sentences = _split_sentences(text)\n    count = 0\n    for sentence in sentences:\n        # Split the sentence into words (split on any whitespace)\n        words = sentence.split()\n        if words and words[0] == \"I\":\n            count += 1\n    return count", "base_status": "pass", "plus_status": "fail", "base_fail_tests": [], "plus_fail_tests": [["I"]]}], "HumanEval/92": [{"task_id": "HumanEval/92", "solution": "from typing import Any\ndef any_int(x: Any, y: Any, z: Any) -> bool:\n    \"\"\"\n    Return True if one of the three arguments is equal to the sum of the other two\n    **and** all three arguments are integers.  Otherwise return False.\n\n    Parameters\n    ----------\n    x, y, z : Any\n        The three values to test.  They may be of any type; the function will\n        first check that they are all integers.\n\n    Returns\n    -------\n    bool\n        True if the condition holds, False otherwise.\n\n    Examples\n    --------\n    >>> any_int(5, 2, 7)\n    True\n    >>> any_int(3, 2, 2)\n    False\n    >>> any_int(3, -2, 1)\n    True\n    >>> any_int(3.6, -2.2, 2)\n    False\n    \"\"\"\n    # 1. All values must be integers\n    if not all(isinstance(v, int) for v in (x, y, z)):\n        return False\n\n    # 2. Check the three possible equalities\n    return (x == y + z) or (y == x + z) or (z == x + y)", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/95": [{"task_id": "HumanEval/95", "solution": "from typing import Dict, Any\ndef check_dict_case(d: Dict[Any, Any]) -> bool:\n    \"\"\"\n    Return True if all keys in *d* are strings that are either all\n    lower\u2011case or all upper\u2011case.  Return False otherwise.\n\n    Parameters\n    ----------\n    d : dict\n        The dictionary to test.\n\n    Returns\n    -------\n    bool\n        True if the dictionary satisfies the condition, False otherwise.\n    \"\"\"\n    # Empty dictionary is not allowed\n    if not d:\n        return False\n\n    # Collect the case of each string key\n    cases = set()\n    for key in d:\n        if not isinstance(key, str):\n            # Non\u2011string key \u2192 fail\n            return False\n        if key.islower():\n            cases.add(\"lower\")\n        elif key.isupper():\n            cases.add(\"upper\")\n        else:\n            # Mixed case key (e.g. \"Name\") \u2192 fail\n            return False\n\n    # We must have exactly one case type\n    return len(cases) == 1", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/97": [{"task_id": "HumanEval/97", "solution": "def multiply(a: int, b: int) -> int:\n    \"\"\"\n    Return the product of the unit digits of `a` and `b`.\n\n    Parameters\n    ----------\n    a, b : int\n        Any integer (positive, negative, or zero).\n\n    Returns\n    -------\n    int\n        The product of the last decimal digits of `a` and `b`.\n\n    Notes\n    -----\n    * The unit digit of a number `n` is `abs(n) % 10`.  \n      Using `abs` guarantees a non\u2011negative digit even for negative inputs.\n    * The function is deliberately straightforward; no error handling is\n      required because the problem statement guarantees valid input.\n    \"\"\"\n    # Extract the unit digit of each number (always non\u2011negative)\n    digit_a = abs(a) % 10\n    digit_b = abs(b) % 10\n\n    # Return the product of the two digits\n    return digit_a * digit_b", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/98": [{"task_id": "HumanEval/98", "solution": "def count_upper(s: str) -> int:\n    \"\"\"\n    Return the number of uppercase vowels that occur at even indices in *s*.\n\n    Parameters\n    ----------\n    s : str\n        The input string to examine.\n\n    Returns\n    -------\n    int\n        The count of uppercase vowels at even indices.\n\n    Examples\n    --------\n    >>> count_upper('aBCdEf')\n    1\n    >>> count_upper('abcdefg')\n    0\n    >>> count_upper('dBBE')\n    0\n    \"\"\"\n    # Define the set of uppercase vowels for quick membership tests\n    vowels = set('AEIOU')\n\n    # Enumerate over the string, keeping track of the index\n    count = 0\n    for idx, ch in enumerate(s):\n        # Even index? (0\u2011based)\n        if idx % 2 == 0 and ch in vowels:\n            count += 1\n    return count", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/96": [{"task_id": "HumanEval/96", "solution": "from typing import List\ndef is_prime(x: int) -> bool:\n    \"\"\"\n    Return True if `x` is a prime number, False otherwise.\n\n    The function assumes that `x` is a non\u2011negative integer.\n    \"\"\"\n    if x < 2:\n        return False\n    if x == 2:\n        return True\n    if x % 2 == 0:\n        return False\n\n    # Only test odd divisors up to sqrt(x)\n    limit = int(x**0.5) + 1\n    for d in range(3, limit, 2):\n        if x % d == 0:\n            return False\n    return True\ndef count_up_to(n: int) -> List[int]:\n    \"\"\"\n    Return a list of all prime numbers that are strictly less than `n`.\n\n    Parameters\n    ----------\n    n : int\n        A non\u2011negative integer.  If `n` is 0 or 1 the result is an empty list.\n\n    Returns\n    -------\n    List[int]\n        All primes `p` such that 2 <= p < n, in ascending order.\n    \"\"\"\n    if n <= 2:\n        return []\n\n    primes = []\n    for candidate in range(2, n):\n        if is_prime(candidate):\n            primes.append(candidate)\n    return primes", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/99": [{"task_id": "HumanEval/99", "solution": "import math\nimport sys\nimport unittest\nfrom typing import Union\ndef closest_integer(value: str) -> int:\n    \"\"\"\n    Return the integer that is closest to the numeric value represented by\n    *value*.  If the value is exactly halfway between two integers, the\n    integer that is farther from zero is returned.\n\n    Parameters\n    ----------\n    value : str\n        A string that can be parsed as a decimal number (e.g. \"10\",\n        \"15.3\", \"-14.5\").\n\n    Returns\n    -------\n    int\n        The nearest integer, with ties rounded away from zero.\n\n    Examples\n    --------\n    >>> closest_integer(\"10\")\n    10\n    >>> closest_integer(\"15.3\")\n    15\n    >>> closest_integer(\"14.5\")\n    15\n    >>> closest_integer(\"-14.5\")\n    -15\n    \"\"\"\n    # Convert the string to a float.  The problem statement guarantees that\n    # the input is a valid numeric string, so we don't need to handle\n    # ValueError here.\n    num = float(value)\n\n    # The standard round() function in Python rounds ties *towards\n    # even* (banker's rounding).  We need a different tie\u2011breaking rule,\n    # so we implement it manually.\n    floor_val = math.floor(num)\n    ceil_val = math.ceil(num)\n\n    # If the number is already an integer, just return it.\n    if floor_val == ceil_val:\n        return int(num)\n\n    # Compute the absolute distance to the two candidates.\n    dist_floor = abs(num - floor_val)\n    dist_ceil = abs(num - ceil_val)\n\n    # If the distances are equal, we are exactly halfway.\n    if math.isclose(dist_floor, dist_ceil, rel_tol=0, abs_tol=1e-12):\n        # Round away from zero: choose the candidate with the larger\n        # absolute value.\n        if abs(floor_val) > abs(ceil_val):\n            return int(floor_val)\n        else:\n            return int(ceil_val)\n\n    # Otherwise, return the closer candidate.\n    return int(floor_val) if dist_floor < dist_ceil else int(ceil_val)", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/101": [{"task_id": "HumanEval/101", "solution": "import re\nimport sys\nimport doctest\ndef words_string(s: str) -> list[str]:\n    \"\"\"\n    Split a string into words using commas or whitespace as separators.\n\n    Parameters\n    ----------\n    s : str\n        The input string containing words separated by commas, spaces, or both.\n\n    Returns\n    -------\n    list[str]\n        A list of the words in the order they appear in the input string.\n\n    Notes\n    -----\n    * Consecutive separators (e.g. \", ,\") are treated as a single separator.\n    * Leading or trailing separators are ignored.\n    * Empty strings are never returned in the result list.\n\n    Examples\n    --------\n    >>> words_string(\"Hi, my name is John\")\n    ['Hi', 'my', 'name', 'is', 'John']\n    >>> words_string(\"One, two, three, four, five, six\")\n    ['One', 'two', 'three', 'four', 'five', 'six']\n    >>> words_string(\"  leading and trailing  \")\n    ['leading', 'and', 'trailing']\n    >>> words_string(\"multiple,,,commas\")\n    ['multiple', 'commas']\n    \"\"\"\n    # Use a regular expression that matches one or more commas or whitespace.\n    # The split will produce an empty string at the start or end if the string\n    # starts or ends with a separator; filter those out.\n    return [word for word in re.split(r'[,\\s]+', s) if word]", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/94": [{"task_id": "HumanEval/94", "solution": "from typing import List\ndef _is_prime(n: int) -> bool:\n    \"\"\"Return True if n is a prime number, False otherwise.\"\"\"\n    if n < 2:\n        return False\n    if n in (2, 3):\n        return True\n    if n % 2 == 0 or n % 3 == 0:\n        return False\n\n    # Check divisors of the form 6k \u00b1 1 up to sqrt(n)\n    i = 5\n    while i * i <= n:\n        if n % i == 0 or n % (i + 2) == 0:\n            return False\n        i += 6\n    return True\ndef skjkasdkd(lst: List[int]) -> int:\n    \"\"\"\n    Find the largest prime value in *lst* and return the sum of its digits.\n\n    Parameters\n    ----------\n    lst : List[int]\n        A list of integers.\n\n    Returns\n    -------\n    int\n        Sum of the decimal digits of the largest prime in *lst*.\n        If the list contains no prime numbers, 0 is returned.\n\n    Examples\n    --------\n    >>> skjkasdkd([0,3,2,1,3,5,7,4,5,5,5,2,181,32,4,32,3,2,32,324,4,3])\n    10\n    >>> skjkasdkd([1,0,1,8,2,4597,2,1,3,40,1,2,1,2,4,2,5,1])\n    25\n    \"\"\"\n    # Filter primes and keep the maximum\n    primes = [x for x in lst if _is_prime(x)]\n    if not primes:\n        return 0\n\n    largest_prime = max(primes)\n\n    # Sum of digits\n    return sum(int(d) for d in str(largest_prime))", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/100": [{"task_id": "HumanEval/100", "solution": "from typing import List\ndef make_a_pile(n: int) -> List[int]:\n    \"\"\"\n    Build a pile of n levels of stones.\n\n    Parameters\n    ----------\n    n : int\n        Positive integer, number of levels.\n\n    Returns\n    -------\n    List[int]\n        List of stone counts per level.\n\n    Raises\n    ------\n    ValueError\n        If n is not a positive integer.\n    \"\"\"\n    if not isinstance(n, int) or n <= 0:\n        raise ValueError(\"n must be a positive integer\")\n\n    pile: List[int] = [n]\n    for _ in range(1, n):\n        last = pile[-1]\n        if last % 2 == 0:          # last is even \u2192 next even\n            next_stones = last + 2\n        else:                      # last is odd \u2192 next odd\n            next_stones = last + 2\n        pile.append(next_stones)\n\n    return pile", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/103": [{"task_id": "HumanEval/103", "solution": "from typing import Union\ndef rounded_avg(n: int, m: int) -> Union[str, int]:\n    \"\"\"\n    Return the rounded average of the integers from n to m inclusive,\n    expressed as a binary string.  If n > m, return -1.\n\n    Parameters\n    ----------\n    n : int\n        Lower bound of the range (inclusive).\n    m : int\n        Upper bound of the range (inclusive).\n\n    Returns\n    -------\n    str | int\n        Binary representation of the rounded average, e.g. \"0b11\",\n        or -1 if the input range is invalid.\n\n    Examples\n    --------\n    >>> rounded_avg(1, 5)\n    '0b11'\n    >>> rounded_avg(7, 5)\n    -1\n    >>> rounded_avg(10, 20)\n    '0b1111'\n    >>> rounded_avg(20, 33)\n    '0b11010'\n    \"\"\"\n    if n > m:\n        return -1\n\n    # Number of terms in the inclusive range\n    count = m - n + 1\n\n    # Sum of an arithmetic progression: count * (first + last) // 2\n    total = count * (n + m) // 2\n\n    # Rounded average: (total + count//2) // count\n    # This implements half\u2011up rounding for positive numbers.\n    rounded = (total + count // 2) // count\n\n    return bin(rounded)", "base_status": "fail", "plus_status": "fail", "base_fail_tests": [[964, 977]], "plus_fail_tests": [[4, 9]]}], "HumanEval/102": [{"task_id": "HumanEval/102", "solution": "def choose_num(x: int, y: int) -> int:\n    \"\"\"\n    Return the largest even integer in the inclusive range [x, y].\n    If the range is invalid (x > y) or contains no even integers, return -1.\n\n    Parameters\n    ----------\n    x : int\n        Lower bound of the range (must be positive).\n    y : int\n        Upper bound of the range (must be positive).\n\n    Returns\n    -------\n    int\n        The largest even integer in [x, y] or -1 if none exists.\n\n    Examples\n    --------\n    >>> choose_num(12, 15)\n    14\n    >>> choose_num(13, 12)\n    -1\n    >>> choose_num(7, 7)\n    -1\n    >>> choose_num(8, 8)\n    8\n    \"\"\"\n    # Ensure the bounds are in the correct order\n    if x > y:\n        return -1\n\n    # Find the largest even number <= y\n    largest_even = y if y % 2 == 0 else y - 1\n\n    # If that number is still within the range, return it\n    if largest_even >= x:\n        return largest_even\n\n    # No even number in the range\n    return -1", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/104": [{"task_id": "HumanEval/104", "solution": "from typing import List\ndef _has_even_digit(n: int) -> bool:\n    \"\"\"\n    Return True if *n* contains at least one even digit.\n    \"\"\"\n    while n:\n        digit = n % 10\n        if digit % 2 == 0:          # 0, 2, 4, 6, 8 are even\n            return True\n        n //= 10\n    return False\ndef unique_digits(x: List[int]) -> List[int]:\n    \"\"\"\n    Return a sorted list of all elements from *x* that do not contain any\n    even digit.\n\n    Parameters\n    ----------\n    x : List[int]\n        List of positive integers.\n\n    Returns\n    -------\n    List[int]\n        Sorted list of integers with only odd digits.\n    \"\"\"\n    filtered = [num for num in x if not _has_even_digit(num)]\n    return sorted(filtered)", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/105": [{"task_id": "HumanEval/105", "solution": "DIGIT_NAMES = {\n    1: \"One\",\n    2: \"Two\",\n    3: \"Three\",\n    4: \"Four\",\n    5: \"Five\",\n    6: \"Six\",\n    7: \"Seven\",\n    8: \"Eight\",\n    9: \"Nine\",\n}\ndef by_length(arr: list[int]) -> list[str]:\n    \"\"\"\n    Return a list of English names for the digits 1\u20119 that appear in *arr*.\n\n    The algorithm is:\n\n    1.  Keep only the integers that are between 1 and 9 inclusive.\n    2.  Sort the remaining numbers in ascending order.\n    3.  Reverse the sorted list.\n    4.  Convert each number to its word representation.\n\n    Parameters\n    ----------\n    arr : list[int]\n        The input list of integers.\n\n    Returns\n    -------\n    list[str]\n        The processed list of word names.\n\n    Examples\n    --------\n    >>> by_length([2, 1, 1, 4, 5, 8, 2, 3])\n    ['Eight', 'Five', 'Four', 'Three', 'Two', 'Two', 'One', 'One']\n\n    >>> by_length([])\n    []\n\n    >>> by_length([1, -1, 55])\n    ['One']\n    \"\"\"\n    # 1. Filter out the numbers that are not 1\u20119\n    filtered = [x for x in arr if 1 <= x <= 9]\n\n    # 2. Sort ascending\n    filtered.sort()\n\n    # 3. Reverse\n    filtered.reverse()\n\n    # 4. Map to names\n    return [DIGIT_NAMES[x] for x in filtered]", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/106": [{"task_id": "HumanEval/106", "solution": "from typing import List\ndef _factorial(n: int) -> int:\n    \"\"\"Return n! (factorial of n).  Uses an iterative approach for speed.\"\"\"\n    result = 1\n    for k in range(2, n + 1):\n        result *= k\n    return result\ndef _sum_to(n: int) -> int:\n    \"\"\"Return the sum 1 + 2 + ... + n.  Uses the arithmetic series formula.\"\"\"\n    return n * (n + 1) // 2\ndef f(n: int) -> List[int]:\n    \"\"\"\n    Return a list of length `n` where the element at 1\u2011based index `i` is:\n        * factorial(i) if i is even,\n        * sum(1..i) if i is odd.\n\n    Parameters\n    ----------\n    n : int\n        The desired length of the list.  Must be non\u2011negative.\n\n    Returns\n    -------\n    List[int]\n        The constructed list.\n\n    Examples\n    --------\n    >>> f(5)\n    [1, 2, 6, 24, 15]\n    >>> f(0)\n    []\n    >>> f(1)\n    [1]\n    \"\"\"\n    if n < 0:\n        raise ValueError(\"n must be non\u2011negative\")\n\n    result: List[int] = []\n    for i in range(1, n + 1):\n        if i % 2 == 0:          # even index\n            result.append(_factorial(i))\n        else:                   # odd index\n            result.append(_sum_to(i))\n    return result", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/107": [{"task_id": "HumanEval/107", "solution": "def is_palindrome(num: int) -> bool:\n    \"\"\"\n    Return True if *num* is a palindrome, False otherwise.\n    \"\"\"\n    s = str(num)\n    return s == s[::-1]\ndef even_odd_palindrome(n: int) -> tuple[int, int]:\n    \"\"\"\n    Count even and odd integer palindromes in the inclusive range [1, n].\n\n    Parameters\n    ----------\n    n : int\n        Upper bound of the range (must be >= 1).\n\n    Returns\n    -------\n    tuple[int, int]\n        (even_count, odd_count)\n    \"\"\"\n    if n < 1:\n        raise ValueError(\"n must be at least 1\")\n\n    even_count = 0\n    odd_count = 0\n\n    for num in range(1, n + 1):\n        if is_palindrome(num):\n            if num % 2 == 0:\n                even_count += 1\n            else:\n                odd_count += 1\n\n    return even_count, odd_count", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/108": [{"task_id": "HumanEval/108", "solution": "import unittest\nfrom typing import Iterable, List\ndef _signed_digit_sum(n: int) -> int:\n    \"\"\"\n    Return the signed sum of the decimal digits of ``n``.\n    The first digit is negative if ``n`` is negative, otherwise it is\n    positive.  All other digits are always positive.\n\n    Examples\n    --------\n    >>> _signed_digit_sum(123)\n    6\n    >>> _signed_digit_sum(-123)\n    4\n    >>> _signed_digit_sum(0)\n    0\n    \"\"\"\n    if n == 0:\n        return 0\n\n    sign = -1 if n < 0 else 1\n    n_abs = abs(n)\n    digits = [int(d) for d in str(n_abs)]\n    # first digit gets the sign of the original number\n    return sign * digits[0] + sum(digits[1:])\ndef count_nums(arr: Iterable[int]) -> int:\n    \"\"\"\n    Count how many integers in ``arr`` have a signed sum of digits > 0.\n\n    Parameters\n    ----------\n    arr : Iterable[int]\n        A sequence of integers.\n\n    Returns\n    -------\n    int\n        The number of elements whose signed digit sum is positive.\n\n    Examples\n    --------\n    >>> count_nums([])\n    0\n    >>> count_nums([-1, 11, -11])\n    1\n    >>> count_nums([1, 1, 2])\n    3\n    \"\"\"\n    return sum(1 for x in arr if _signed_digit_sum(x) > 0)", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/109": [{"task_id": "HumanEval/109", "solution": "from typing import List\ndef move_one_ball(arr: List[int]) -> bool:\n    \"\"\"\n    Return True if the array can be sorted in non\u2011decreasing order by\n    performing any number of right\u2011shift operations, otherwise False.\n\n    Parameters\n    ----------\n    arr : List[int]\n        List of unique integers (may be empty).\n\n    Returns\n    -------\n    bool\n        True if a rotation of `arr` is sorted, False otherwise.\n    \"\"\"\n    n = len(arr)\n    if n <= 1:\n        # Empty or single\u2011element lists are already sorted.\n        return True\n\n    # Count the number of places where the order is violated.\n    # We compare each element with the next one in a circular fashion.\n    violations = 0\n    for i in range(n):\n        if arr[i] > arr[(i + 1) % n]:\n            violations += 1\n            if violations > 1:\n                # More than one violation \u2192 cannot be a single rotation.\n                return False\n\n    # 0 or 1 violation means the array is a rotation of a sorted list.\n    return True", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/111": [{"task_id": "HumanEval/111", "solution": "from collections import Counter\nfrom typing import Dict\ndef histogram(test: str) -> Dict[str, int]:\n    \"\"\"\n    Return a dictionary of the most frequent letters in *test* and their count.\n\n    Parameters\n    ----------\n    test : str\n        A string of lowercase letters separated by spaces.\n\n    Returns\n    -------\n    dict[str, int]\n        Mapping of each letter that has the maximum frequency to that frequency.\n        If *test* is empty, an empty dict is returned.\n    \"\"\"\n    # Split on whitespace \u2013 an empty string yields an empty list.\n    letters = test.split()\n    if not letters:\n        return {}\n\n    # Count occurrences of each letter.\n    counts = Counter(letters)\n\n    # Find the maximum count.\n    max_count = max(counts.values())\n\n    # Build the result dictionary with all letters that reach the maximum.\n    return {letter: max_count for letter, cnt in counts.items() if cnt == max_count}", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/110": [{"task_id": "HumanEval/110", "solution": "from typing import List\ndef exchange(lst1: List[int], lst2: List[int]) -> str:\n    \"\"\"\n    Determine whether it is possible to exchange elements between `lst1` and\n    `lst2` so that every element of `lst1` becomes even.\n\n    Parameters\n    ----------\n    lst1 : List[int]\n        The list that must become all even.\n    lst2 : List[int]\n        The list that can supply elements to `lst1`.\n\n    Returns\n    -------\n    str\n        \"YES\" if the exchange is possible, otherwise \"NO\".\n    \"\"\"\n    # Count odd numbers in lst1 (need to be removed)\n    odd_in_lst1 = sum(1 for x in lst1 if x % 2 != 0)\n\n    # Count even numbers in lst2 (can be inserted)\n    even_in_lst2 = sum(1 for x in lst2 if x % 2 == 0)\n\n    return \"YES\" if even_in_lst2 >= odd_in_lst1 else \"NO\"", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/112": [{"task_id": "HumanEval/112", "solution": "from typing import Tuple\ndef reverse_delete(s: str, c: str) -> Tuple[str, bool]:\n    \"\"\"\n    Delete all characters from `s` that are present in `c` and test for\n    palindrome.\n\n    Parameters\n    ----------\n    s : str\n        The original string.\n    c : str\n        The string containing characters to delete from `s`.\n\n    Returns\n    -------\n    Tuple[str, bool]\n        A tuple where the first element is the cleaned string and the second\n        element is ``True`` if the cleaned string is a palindrome, otherwise\n        ``False``.\n\n    Examples\n    --------\n    >>> reverse_delete(\"abcde\", \"ae\")\n    ('bcd', False)\n    >>> reverse_delete(\"abcdef\", \"b\")\n    ('acdef', False)\n    >>> reverse_delete(\"abcdedcba\", \"ab\")\n    ('cdedc', True)\n    \"\"\"\n    # Build a set of characters to delete for O(1) look\u2011ups\n    delete_set = set(c)\n\n    # Filter out unwanted characters\n    cleaned = \"\".join(ch for ch in s if ch not in delete_set)\n\n    # Check palindrome: cleaned string equals its reverse\n    is_pal = cleaned == cleaned[::-1]\n\n    return cleaned, is_pal", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/113": [{"task_id": "HumanEval/113", "solution": "from typing import List\ndef odd_count(lst: List[str]) -> List[str]:\n    \"\"\"\n    Given a list of strings, where each string consists of only digits,\n    return a list.  Each element i of the output should be\n    \"the number of odd elements <n>n the str<n>ng <n> of the <n>nput.\"\n    where <n> is the number of odd digits in the i\u2011th string of the input.\n\n    >>> odd_count(['1234567'])\n    ['the number of odd elements 4n the str4ng 4 of the 4nput.']\n    >>> odd_count(['3', '11111111'])\n    ['the number of odd elements 1n the str1ng 1 of the 1nput.',\n     'the number of odd elements 8n the str8ng 8 of the 8nput.']\n    \"\"\"\n    results = []\n\n    for s in lst:\n        # Count odd digits\n        odd = sum(1 for ch in s if ch in '13579')\n\n        # Build the sentence with the required substitutions\n        sentence = (\n            f\"the number of odd elements {odd}n \"\n            f\"the str{odd}ng {odd} of the {odd}nput.\"\n        )\n        results.append(sentence)\n\n    return results", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/116": [{"task_id": "HumanEval/116", "solution": "from typing import List\nimport unittest\ndef sort_array(arr: List[int]) -> List[int]:\n    \"\"\"\n    Return a new list containing the elements of *arr* sorted by the\n    number of 1\u2011bits in their binary representation.  For equal bit\u2011counts\n    the values are sorted in ascending numeric order.\n\n    Parameters\n    ----------\n    arr : List[int]\n        List of integers (positive, zero or negative).\n\n    Returns\n    -------\n    List[int]\n        Sorted list.\n\n    Examples\n    --------\n    >>> sort_array([1, 5, 2, 3, 4])\n    [1, 2, 3, 4, 5]\n    >>> sort_array([-2, -3, -4, -5, -6])\n    [-6, -5, -4, -3, -2]\n    >>> sort_array([1, 0, 2, 3, 4])\n    [0, 1, 2, 3, 4]\n    \"\"\"\n    # The key is a tuple: (bit_count, value)\n    # Python's sort is stable, so this guarantees the required ordering.\n    return sorted(arr, key=lambda x: (x.bit_count(), x))", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/114": [{"task_id": "HumanEval/114", "solution": "from typing import List\ndef minSubArraySum(nums: List[int]) -> int:\n    \"\"\"\n    Return the minimum sum of any non\u2011empty contiguous sub\u2011array of `nums`.\n\n    Parameters\n    ----------\n    nums : List[int]\n        List of integers (can be positive, negative or zero).\n\n    Returns\n    -------\n    int\n        The smallest possible sum of a contiguous sub\u2011array.\n\n    Examples\n    --------\n    >>> minSubArraySum([2, 3, 4, 1, 2, 4])\n    1\n    >>> minSubArraySum([-1, -2, -3])\n    -6\n    >>> minSubArraySum([5, -2, 3, -1, 2])\n    -2\n    \"\"\"\n    if not nums:\n        raise ValueError(\"Input list must contain at least one element\")\n\n    # `current_min` holds the minimum sub\u2011array sum ending at the current index.\n    current_min = nums[0]\n    # `global_min` holds the overall minimum sub\u2011array sum found so far.\n    global_min = nums[0]\n\n    for num in nums[1:]:\n        # Either extend the previous sub\u2011array or start a new one at `num`.\n        current_min = min(num, current_min + num)\n        # Update the global minimum if the current one is smaller.\n        global_min = min(global_min, current_min)\n\n    return global_min", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/115": [{"task_id": "HumanEval/115", "solution": "import math\nimport sys\nimport json\nfrom typing import List\ndef max_fill(grid: List[List[int]], capacity: int) -> int:\n    \"\"\"\n    Return the minimal number of bucket dips required to empty all wells.\n\n    Parameters\n    ----------\n    grid : List[List[int]]\n        2\u2011D list where each inner list represents a well and contains 0/1 values.\n    capacity : int\n        Capacity of each bucket (units of water it can hold).\n\n    Returns\n    -------\n    int\n        Total number of bucket dips needed.\n    \"\"\"\n    if capacity <= 0:\n        raise ValueError(\"Bucket capacity must be a positive integer\")\n\n    total_dips = 0\n    for row_index, row in enumerate(grid):\n        # Count the number of water units in this well\n        units = sum(row)\n        if units == 0:\n            continue  # no dips needed for an empty well\n\n        # Compute the number of dips for this well\n        dips = math.ceil(units / capacity)\n        total_dips += dips\n\n        # Debug output (comment out if not needed)\n        # print(f\"Well {row_index}: {units} units -> {dips} dips\")\n\n    return total_dips", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/117": [{"task_id": "HumanEval/117", "solution": "import re\nfrom typing import List\ndef _is_consonant(ch: str) -> bool:\n    \"\"\"Return True if `ch` is a consonant (English alphabet only).\"\"\"\n    return ch.isalpha() and ch.lower() not in \"aeiou\"\ndef _consonant_count(word: str) -> int:\n    \"\"\"Count the number of consonants in `word`.\"\"\"\n    return sum(1 for ch in word if _is_consonant(ch))\ndef select_words(s: str, n: int) -> List[str]:\n    \"\"\"\n    Return a list of all words from `s` that contain exactly `n` consonants,\n    in the order they appear in `s`.\n\n    Parameters\n    ----------\n    s : str\n        Input string containing only letters and spaces.\n    n : int\n        Target number of consonants (must be a non\u2011negative integer).\n\n    Returns\n    -------\n    List[str]\n        Words that satisfy the condition, in original order.\n    \"\"\"\n    if not s:\n        return []\n\n    # Split on any whitespace (handles multiple spaces, tabs, etc.)\n    words = re.split(r'\\s+', s.strip())\n    result = [w for w in words if _consonant_count(w) == n]\n    return result", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/119": [{"task_id": "HumanEval/119", "solution": "def is_balanced(s: str) -> bool:\n    \"\"\"\n    Return True if the parenthesis string `s` is balanced.\n    \"\"\"\n    balance = 0\n    for ch in s:\n        if ch == '(':\n            balance += 1\n        else:  # ch == ')'\n            balance -= 1\n            if balance < 0:          # more ')' than '(' seen so far\n                return False\n    return balance == 0\ndef match_parens(lst):\n    \"\"\"\n    Parameters\n    ----------\n    lst : list[str]\n        A list of two strings, each consisting only of '(' and ')'.\n\n    Returns\n    -------\n    str\n        'Yes' if either concatenation (first+second or second+first)\n        is balanced, otherwise 'No'.\n    \"\"\"\n    if len(lst) != 2:\n        raise ValueError(\"Input must be a list of exactly two strings\")\n\n    a, b = lst\n    # Check both possible orders\n    if is_balanced(a + b) or is_balanced(b + a):\n        return 'Yes'\n    return 'No'", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/120": [{"task_id": "HumanEval/120", "solution": "from typing import List\nimport heapq\nimport random\nimport unittest\ndef maximum(arr: List[int], k: int) -> List[int]:\n    \"\"\"\n    Return a sorted list of the maximum `k` numbers in `arr`.\n\n    Parameters\n    ----------\n    arr : List[int]\n        The input array.  Length is guaranteed to be between 1 and 1000.\n    k : int\n        Number of largest elements to return.  0 \u2264 k \u2264 len(arr).\n\n    Returns\n    -------\n    List[int]\n        A list of length `k` containing the largest `k` elements from `arr`,\n        sorted in ascending order.\n\n    Examples\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    if k == 0:\n        return []\n\n    # If k is close to len(arr) we can just sort the whole array.\n    # For small arrays this is simpler and faster in practice.\n    if k > len(arr) // 2:\n        return sorted(arr)[-k:]\n\n    # Otherwise use a min\u2011heap of size k.\n    # The heap keeps the current k largest elements seen so far.\n    min_heap: List[int] = []\n    for num in arr:\n        if len(min_heap) < k:\n            heapq.heappush(min_heap, num)\n        else:\n            # Only push if the new number is larger than the smallest in the heap\n            if num > min_heap[0]:\n                heapq.heapreplace(min_heap, num)\n\n    # The heap contains the k largest numbers but in arbitrary order.\n    # Sort them before returning.\n    return sorted(min_heap)", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/118": [{"task_id": "HumanEval/118", "solution": "from typing import List\ndef get_closest_vowel(word: str) -> str:\n    \"\"\"\n    Return the first vowel (from the right) that is surrounded by consonants.\n    Vowels at the very beginning or end of the word are ignored.\n    If no such vowel exists, return an empty string.\n\n    Parameters\n    ----------\n    word : str\n        The word to inspect.  It contains only English letters.\n\n    Returns\n    -------\n    str\n        The vowel that satisfies the condition, or ``\"\"`` if none exists.\n    \"\"\"\n    # Define vowels (case\u2011sensitive)\n    vowels: set[str] = set(\"aeiouAEIOU\")\n\n    # Scan from right to left\n    for i in range(len(word) - 1, 0, -1):\n        ch = word[i]\n        if ch not in vowels:\n            continue  # not a vowel\n\n        # Skip vowels that are at the very start or end\n        if i == 0 or i == len(word) - 1:\n            continue\n\n        # Check that the neighbours are consonants\n        left, right = word[i - 1], word[i + 1]\n        if left not in vowels and right not in vowels:\n            return ch\n\n    return \"\"", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/121": [{"task_id": "HumanEval/121", "solution": "def solution(lst):\n    \"\"\"Return the sum of all odd elements that are in even positions.\n\n    Parameters\n    ----------\n    lst : list[int]\n        Non\u2011empty list of integers.\n\n    Returns\n    -------\n    int\n        Sum of odd numbers located at even positions (1\u2011based).\n    \"\"\"\n    total = 0\n    for idx, elem in enumerate(lst):\n        if idx % 2 == 1 and elem % 2 == 1:\n            total += elem\n    return total", "base_status": "fail", "plus_status": "fail", "base_fail_tests": [[[5, 8, 7, 1]]], "plus_fail_tests": [[[1, 2, 3, 4, 5, 6]]]}], "HumanEval/123": [{"task_id": "HumanEval/123", "solution": "from typing import List\ndef get_odd_collatz(n: int) -> List[int]:\n    \"\"\"\n    Return a sorted list of the odd numbers that appear in the Collatz\n    sequence starting from ``n``.\n\n    Parameters\n    ----------\n    n : int\n        A positive integer (n >= 1).\n\n    Returns\n    -------\n    List[int]\n        The odd numbers in the sequence, sorted in increasing order.\n\n    Examples\n    --------\n    >>> get_odd_collatz(5)\n    [1, 5]\n    >>> get_odd_collatz(1)\n    [1]\n    >>> get_odd_collatz(7)\n    [1, 7]\n    \"\"\"\n    if n < 1:\n        raise ValueError(\"n must be a positive integer\")\n\n    odd_numbers = set()\n    current = n\n\n    while True:\n        if current % 2 == 1:\n            odd_numbers.add(current)\n        if current == 1:\n            break\n        if current % 2 == 0:\n            current //= 2\n        else:\n            current = 3 * current + 1\n\n    return sorted(odd_numbers)", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/124": [{"task_id": "HumanEval/124", "solution": "import re\nfrom typing import Tuple\n_DATE_RE = re.compile(r\"^(?P<month>\\d{2})-(?P<day>\\d{2})-(?P<year>\\d{4})$\")\n_MAX_DAYS = {\n    1: 31, 2: 29, 3: 31, 4: 30,\n    5: 31, 6: 30, 7: 31, 8: 31,\n    9: 30, 10: 31, 11: 30, 12: 31\n}\ndef _parse_date(date_str: str) -> Tuple[int, int, int] | None:\n    \"\"\"\n    Parse the date string using the regular expression.\n    Return a tuple (month, day, year) if the format is correct,\n    otherwise return ``None``.\n    \"\"\"\n    match = _DATE_RE.match(date_str)\n    if not match:\n        return None\n    month = int(match.group(\"month\"))\n    day = int(match.group(\"day\"))\n    year = int(match.group(\"year\"))\n    return month, day, year\ndef valid_date(date: str) -> bool:\n    \"\"\"\n    Validate a date string.\n\n    Parameters\n    ----------\n    date : str\n        The date string to validate.\n\n    Returns\n    -------\n    bool\n        ``True`` if the date is valid, ``False`` otherwise.\n    \"\"\"\n    if not date:\n        return False\n\n    parsed = _parse_date(date)\n    if parsed is None:\n        return False\n\n    month, day, _year = parsed\n\n    # Rule 3 \u2013 month range\n    if month < 1 or month > 12:\n        return False\n\n    # Rule 2 \u2013 day range for the month\n    max_day = _MAX_DAYS[month]\n    if day < 1 or day > max_day:\n        return False\n\n    # All rules satisfied\n    return True", "base_status": "pass", "plus_status": "fail", "base_fail_tests": [], "plus_fail_tests": [["06-04-2020\n"]]}], "HumanEval/122": [{"task_id": "HumanEval/122", "solution": "from typing import List\ndef add_elements(arr: List[int], k: int) -> int:\n    \"\"\"\n    Sum the elements among the first `k` elements of `arr`\n    that have at most two digits.\n\n    Parameters\n    ----------\n    arr : List[int]\n        List of integers.\n    k : int\n        Number of elements from the start of `arr` to consider.\n\n    Returns\n    -------\n    int\n        Sum of qualifying elements.\n    \"\"\"\n    # Ensure k is within bounds (the problem guarantees this, but we guard anyway)\n    k = min(k, len(arr))\n\n    total = 0\n    for num in arr[:k]:\n        # Count digits of the absolute value\n        if abs(num) < 100:          # 0\u201199 or -99\u20110\n            total += num\n    return total", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/125": [{"task_id": "HumanEval/125", "solution": "import re\nfrom typing import List, Union\ndef split_words(txt: str) -> Union[List[str], int]:\n    \"\"\"\n    Split a string into words or return a count of odd\u2011indexed lower\u2011case letters.\n\n    Parameters\n    ----------\n    txt : str\n        The input string.\n\n    Returns\n    -------\n    list[str] | int\n        A list of words if the string contains whitespace or commas,\n        otherwise an integer count of lower\u2011case letters with odd alphabet\n        indices (a=0, b=1, \u2026, z=25).\n\n    Examples\n    --------\n    >>> split_words(\"Hello world!\")\n    ['Hello', 'world!']\n    >>> split_words(\"Hello,world!\")\n    ['Hello', 'world!']\n    >>> split_words(\"abcdef\")\n    3\n    \"\"\"\n    # 1. Split on any whitespace if present\n    if re.search(r'\\s', txt):\n        return txt.split()\n\n    # 2. Split on commas if present\n    if ',' in txt:\n        return txt.split(',')\n\n    # 3. Count lower\u2011case letters with odd alphabet indices\n    count = 0\n    for ch in txt:\n        if 'a' <= ch <= 'z':\n            # ord('a') == 97, so subtract 97 to get 0\u2011based index\n            idx = ord(ch) - 97\n            if idx % 2 == 1:          # odd index\n                count += 1\n    return count", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/126": [{"task_id": "HumanEval/126", "solution": "from typing import List\ndef is_sorted(lst: List[int]) -> bool:\n    \"\"\"\n    Return True if *lst* is sorted in ascending order and no element\n    appears more than twice.  Otherwise return False.\n\n    Parameters\n    ----------\n    lst : List[int]\n        A list of non\u2011negative integers.  The function does not modify\n        the input list.\n\n    Returns\n    -------\n    bool\n        True if the list satisfies the conditions, False otherwise.\n\n    Examples\n    --------\n    >>> is_sorted([5])\n    True\n    >>> is_sorted([1, 2, 3, 4, 5])\n    True\n    >>> is_sorted([1, 3, 2, 4, 5])\n    False\n    >>> is_sorted([1, 2, 2, 3, 3, 4])\n    True\n    >>> is_sorted([1, 2, 2, 2, 3, 4])\n    False\n    \"\"\"\n    if not lst:  # Empty list is considered sorted\n        return True\n\n    # Count occurrences of each number\n    counts = {}\n    prev = lst[0]\n    counts[prev] = 1\n\n    for num in lst[1:]:\n        # Check ascending order\n        if num < prev:\n            return False\n\n        # Update count\n        counts[num] = counts.get(num, 0) + 1\n        if counts[num] > 2:\n            return False\n\n        prev = num\n\n    return True", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/128": [{"task_id": "HumanEval/128", "solution": "from typing import Iterable, List, Optional\ndef prod_signs(arr: Iterable[int]) -> Optional[int]:\n    \"\"\"\n    Return the sum of magnitudes of the integers in *arr* multiplied by the\n    product of their signs.\n\n    Parameters\n    ----------\n    arr : Iterable[int]\n        A sequence of integers.\n\n    Returns\n    -------\n    int | None\n        The computed value, or ``None`` if *arr* is empty.\n\n    Examples\n    --------\n    >>> prod_signs([1, 2, 2, -4])\n    -9\n    >>> prod_signs([0, 1])\n    0\n    >>> prod_signs([])\n    None\n    \"\"\"\n    # Convert to a list so we can iterate multiple times and check emptiness\n    numbers: List[int] = list(arr)\n\n    if not numbers:\n        return None\n\n    # Sum of magnitudes\n    magnitude_sum = sum(abs(n) for n in numbers)\n\n    # Product of signs\n    sign_product = 1\n    for n in numbers:\n        if n == 0:\n            sign_product = 0\n            break\n        sign_product *= 1 if n > 0 else -1\n\n    return magnitude_sum * sign_product", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/127": [{"task_id": "HumanEval/127", "solution": "from typing import Tuple\ndef _is_prime(n: int) -> bool:\n    \"\"\"Return True if n is a prime number (n >= 2).\"\"\"\n    if n < 2:\n        return False\n    if n in (2, 3):\n        return True\n    if n % 2 == 0 or n % 3 == 0:\n        return False\n    i = 5\n    w = 2\n    while i * i <= n:\n        if n % i == 0:\n            return False\n        i += w\n        w = 6 - w  # alternate 2,4,2,4,...\n    return True\ndef intersection(interval1: Tuple[int, int], interval2: Tuple[int, int]) -> str:\n    \"\"\"\n    Determine whether the length of the intersection of two closed integer\n    intervals is a prime number.\n\n    Parameters\n    ----------\n    interval1 : tuple[int, int]\n        The first interval (start, end) with start <= end.\n    interval2 : tuple[int, int]\n        The second interval (start, end) with start <= end.\n\n    Returns\n    -------\n    str\n        \"YES\" if the intersection length is a prime number,\n        otherwise \"NO\".\n    \"\"\"\n    a_start, a_end = interval1\n    b_start, b_end = interval2\n\n    # Compute the intersection bounds\n    inter_start = max(a_start, b_start)\n    inter_end   = min(a_end,   b_end)\n\n    # No intersection\n    if inter_start > inter_end:\n        return \"NO\"\n\n    # Length of a closed interval [l, r] is r - l + 1\n    length = inter_end - inter_start + 1\n\n    return \"YES\" if _is_prime(length) else \"NO\"", "base_status": "fail", "plus_status": "fail", "base_fail_tests": [[[-1, 1], [0, 4]]], "plus_fail_tests": [[[10, 20], [15, 25]]]}], "HumanEval/129": [{"task_id": "HumanEval/129", "solution": "from typing import List, Tuple\ndef minPath(grid: List[List[int]], k: int) -> List[int]:\n    \"\"\"\n    Return the lexicographically smallest path of length k.\n    \"\"\"\n    n = len(grid)\n    # locate the cell containing value 1\n    start: Tuple[int, int] = None\n    for r in range(n):\n        for c in range(n):\n            if grid[r][c] == 1:\n                start = (r, c)\n                break\n        if start is not None:\n            break\n\n    r, c = start\n    result = [1]\n\n    # four orthogonal directions\n    dirs = [(-1, 0), (1, 0), (0, -1), (0, 1)]\n\n    for _ in range(k - 1):\n        best_val = None\n        best_pos = None\n        for dr, dc in dirs:\n            nr, nc = r + dr, c + dc\n            if 0 <= nr < n and 0 <= nc < n:\n                val = grid[nr][nc]\n                if best_val is None or val < best_val:\n                    best_val = val\n                    best_pos = (nr, nc)\n        # move to the neighbour with the smallest value\n        r, c = best_pos\n        result.append(best_val)\n\n    return result", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/132": [{"task_id": "HumanEval/132", "solution": "def is_nested(string: str) -> bool:\n    \"\"\"\n    Return True iff the input string (containing only '[' and ']') contains a\n    subsequence that is a valid bracket sequence and has at least one nested\n    pair of brackets.\n\n    The existence of a subsequence of the form\n        '['  '['  ']'  ']'\n    is sufficient, because we can always take those four characters as the\n    outer pair with an inner pair nested inside it.\n\n    Parameters\n    ----------\n    string : str\n        The string to examine. It is assumed to contain only '[' and ']'.\n\n    Returns\n    -------\n    bool\n        True if such a subsequence exists, False otherwise.\n    \"\"\"\n    # Find the first '['\n    try:\n        i1 = string.index('[')\n    except ValueError:\n        return False\n\n    # Find the second '[' after the first one\n    try:\n        i2 = string.index('[', i1 + 1)\n    except ValueError:\n        return False\n\n    # Find the first ']' after the second '['\n    try:\n        i3 = string.index(']', i2 + 1)\n    except ValueError:\n        return False\n\n    # Find the second ']' after that\n    try:\n        i4 = string.index(']', i3 + 1)\n    except ValueError:\n        return False\n\n    # All four indices exist in increasing order \u2192 nested subsequence found\n    return True", "base_status": "pass", "plus_status": "fail", "base_fail_tests": [], "plus_fail_tests": [["[][][]"]]}], "HumanEval/131": [{"task_id": "HumanEval/131", "solution": "def digits(n: int) -> int:\n    \"\"\"\n    Return the product of the odd digits of a positive integer `n`.\n    If `n` contains no odd digits, return 0.\n\n    Parameters\n    ----------\n    n : int\n        A positive integer.\n\n    Returns\n    -------\n    int\n        Product of odd digits, or 0 if none.\n    \"\"\"\n    if n <= 0:\n        raise ValueError(\"n must be a positive integer\")\n\n    product = 1\n    has_odd = False\n\n    while n:\n        digit = n % 10\n        if digit % 2:          # odd digit\n            product *= digit\n            has_odd = True\n        n //= 10\n\n    return product if has_odd else 0", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/133": [{"task_id": "HumanEval/133", "solution": "import math\nfrom typing import Iterable, List\ndef sum_squares(lst: Iterable[float]) -> int:\n    \"\"\"\n    Return the sum of squared numbers in the given list after rounding each\n    element up to the nearest integer.\n\n    Parameters\n    ----------\n    lst : Iterable[float]\n        A list (or any iterable) of numeric values.\n\n    Returns\n    -------\n    int\n        The sum of the squares of the ceiling\u2011rounded values.\n\n    Examples\n    --------\n    >>> sum_squares([1, 2, 3])\n    14\n    >>> sum_squares([1, 4, 9])\n    98\n    >>> sum_squares([1, 3, 5, 7])\n    84\n    >>> sum_squares([1.4, 4.2, 0])\n    29\n    >>> sum_squares([-2.4, 1, 1])\n    6\n    \"\"\"\n    total = 0\n    for num in lst:\n        # math.ceil works for both int and float inputs\n        ceil_val = math.ceil(num)\n        total += ceil_val * ceil_val\n    return total", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/134": [{"task_id": "HumanEval/134", "solution": "def check_if_last_char_is_a_letter(txt: str) -> bool:\n    \"\"\"\n    Return True if the last character of *txt* is an alphabetical\n    character and that character is not part of a larger word.\n    Otherwise return False.\n\n    A \"word\" is defined as a group of characters separated by a space.\n    Therefore the last character must be a single letter that is either\n    the only character in the string or is preceded by a space.\n\n    Parameters\n    ----------\n    txt : str\n        The input string to examine.\n\n    Returns\n    -------\n    bool\n        True if the last character is a lone letter, False otherwise.\n    \"\"\"\n    # Empty string \u2013 no last character\n    if not txt:\n        return False\n\n    # Strip trailing spaces \u2013 a trailing space means the last\n    # character is not a letter.\n    stripped = txt.rstrip()\n    if not stripped:\n        return False\n\n    last_char = stripped[-1]\n\n    # Must be an alphabetical character\n    if not last_char.isalpha():\n        return False\n\n    # If the string is a single character, it is a lone letter.\n    if len(stripped) == 1:\n        return True\n\n    # Otherwise the character before the last must be a space\n    # (i.e. the last letter is the start of a new word).\n    return stripped[-2] == ' '", "base_status": "fail", "plus_status": "fail", "base_fail_tests": [["eeeee e "]], "plus_fail_tests": [["k "]]}], "HumanEval/137": [{"task_id": "HumanEval/137", "solution": "from typing import Any, Union\nNumber = Union[int, float, str]\ndef _to_float(value: Number) -> float:\n    \"\"\"\n    Convert a value to a float for comparison.\n\n    * Integers and floats are returned unchanged.\n    * Strings are parsed after replacing a comma with a dot.\n    \"\"\"\n    if isinstance(value, (int, float)):\n        return float(value)\n    if isinstance(value, str):\n        # Accept both '.' and ',' as decimal separators\n        return float(value.replace(\",\", \".\"))\n    raise TypeError(f\"Unsupported type: {type(value).__name__}\")\ndef compare_one(a: Number, b: Number) -> Any:\n    \"\"\"\n    Return the larger of `a` and `b` in its original type.\n    If the numeric values are equal, return None.\n    \"\"\"\n    a_val = _to_float(a)\n    b_val = _to_float(b)\n\n    if a_val > b_val:\n        return a\n    if b_val > a_val:\n        return b\n    return None", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/135": [{"task_id": "HumanEval/135", "solution": "from typing import List\ndef can_arrange(arr: List[int]) -> int:\n    \"\"\"\n    Return the largest index of an element that is strictly smaller than its\n    predecessor.  If the array is strictly increasing (or empty/size\u20111) the\n    function returns -1.\n\n    Parameters\n    ----------\n    arr : List[int]\n        List of distinct integers.\n\n    Returns\n    -------\n    int\n        Largest index i with arr[i] < arr[i-1], or -1 if none exists.\n\n    Examples\n    --------\n    >>> can_arrange([1, 2, 4, 3, 5])\n    3\n    >>> can_arrange([1, 2, 3])\n    -1\n    >>> can_arrange([5, 4, 3, 2, 1])\n    4\n    >>> can_arrange([])\n    -1\n    \"\"\"\n    max_index = -1\n    for i in range(1, len(arr)):\n        if arr[i] < arr[i - 1]:\n            max_index = i\n    return max_index", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/136": [{"task_id": "HumanEval/136", "solution": "from typing import List, Tuple, Optional\ndef largest_smallest_integers(lst: List[int]) -> Tuple[Optional[int], Optional[int]]:\n    \"\"\"\n    Return a tuple ``(a, b)`` where:\n\n    * ``a`` is the largest negative integer in ``lst`` (i.e. the negative number\n      closest to zero).  If there are no negative numbers, ``a`` is ``None``.\n    * ``b`` is the smallest positive integer in ``lst`` (i.e. the positive number\n      closest to zero).  If there are no positive numbers, ``b`` is ``None``.\n\n    Parameters\n    ----------\n    lst : List[int]\n        The list of integers to examine.\n\n    Returns\n    -------\n    Tuple[Optional[int], Optional[int]]\n        ``(largest_negative, smallest_positive)``\n\n    Examples\n    --------\n    >>> largest_smallest_integers([2, 4, 1, 3, 5, 7])\n    (None, 1)\n    >>> largest_smallest_integers([-5, -1, -3])\n    (-1, None)\n    >>> largest_smallest_integers([-2, 0, 3, 5])\n    (-2, 3)\n    >>> largest_smallest_integers([])\n    (None, None)\n    >>> largest_smallest_integers([0])\n    (None, None)\n    \"\"\"\n    largest_negative: Optional[int] = None\n    smallest_positive: Optional[int] = None\n\n    for n in lst:\n        if n < 0:\n            if largest_negative is None or n > largest_negative:\n                largest_negative = n\n        elif n > 0:\n            if smallest_positive is None or n < smallest_positive:\n                smallest_positive = n\n        # Zero is ignored because it is neither negative nor positive\n\n    return largest_negative, smallest_positive", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/138": [{"task_id": "HumanEval/138", "solution": "from typing import List\ndef is_equal_to_sum_even(n: int) -> bool:\n    \"\"\"\n    Return True if the integer `n` can be expressed as the sum of exactly\n    four positive even numbers, otherwise False.\n\n    Parameters\n    ----------\n    n : int\n        The target integer.\n\n    Returns\n    -------\n    bool\n        True if such a representation exists, False otherwise.\n\n    Examples\n    --------\n    >>> is_equal_to_sum_even(4)\n    False\n    >>> is_equal_to_sum_even(6)\n    False\n    >>> is_equal_to_sum_even(8)\n    True\n    >>> is_equal_to_sum_even(10)\n    True\n    >>> is_equal_to_sum_even(11)\n    False\n    \"\"\"\n    # The sum of four positive even numbers is even and at least 8.\n    return n % 2 == 0 and n >= 8", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/140": [{"task_id": "HumanEval/140", "solution": "import re\nimport sys\nimport unittest\ndef fix_spaces(text: str) -> str:\n    \"\"\"\n    Replace spaces in *text* according to the rules described above.\n    \"\"\"\n    # 1. Replace runs of 3 or more spaces with a single hyphen\n    text = re.sub(r' {3,}', '-', text)\n    # 2. Replace any remaining single spaces with an underscore\n    text = text.replace(' ', '_')\n    return text", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/130": [{"task_id": "HumanEval/130", "solution": "from typing import List\ndef tri(n: int) -> List[int]:\n    \"\"\"\n    Return the first n+1 elements of the Tribonacci sequence.\n\n    Parameters\n    ----------\n    n : int\n        Non\u2011negative integer specifying the last index to compute.\n\n    Returns\n    -------\n    List[int]\n        List of length n+1 containing tri(0) \u2026 tri(n).\n\n    Raises\n    ------\n    ValueError\n        If n is negative.\n    \"\"\"\n    if n < 0:\n        raise ValueError(\"n must be non\u2011negative\")\n\n    # Base cases\n    seq = [1]          # tri(0)\n    if n == 0:\n        return seq\n\n    seq.append(3)      # tri(1)\n    if n == 1:\n        return seq\n\n    # Compute the rest of the sequence\n    for i in range(2, n + 1):\n        if i % 2 == 0:  # even index\n            val = 1 + i // 2\n        else:           # odd index\n            # tri(i+1) is even, so we can compute it directly\n            tri_ip1 = 1 + (i + 1) // 2\n            val = seq[i - 1] + seq[i - 2] + tri_ip1\n        seq.append(val)\n\n    return seq", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/141": [{"task_id": "HumanEval/141", "solution": "import re\nfrom typing import Final\nALLOWED_EXTENSIONS: Final[re.Pattern] = re.compile(r'^(txt|exe|dll)$', re.IGNORECASE)\nSTARTS_WITH_LETTER: Final[re.Pattern] = re.compile(r'^[A-Za-z]')\nDIGIT_COUNTER: Final[re.Pattern] = re.compile(r'\\d')\ndef file_name_check(file_name: str) -> str:\n    \"\"\"\n    Validate a file name according to the rules described in the module docstring.\n\n    Parameters\n    ----------\n    file_name : str\n        The file name to validate.\n\n    Returns\n    -------\n    str\n        'Yes' if the file name is valid, otherwise 'No'.\n    \"\"\"\n    # 1. Exactly one dot\n    if file_name.count('.') != 1:\n        return 'No'\n\n    name_part, ext_part = file_name.split('.', 1)\n\n    # 2. Name part must not be empty and must start with a letter\n    if not name_part or not STARTS_WITH_LETTER.match(name_part):\n        return 'No'\n\n    # 3. Extension must be one of the allowed ones\n    if not ALLOWED_EXTENSIONS.match(ext_part):\n        return 'No'\n\n    # 4. Count digits in the whole file name (including extension)\n    if len(DIGIT_COUNTER.findall(file_name)) > 3:\n        return 'No'\n\n    return 'Yes'", "base_status": "pass", "plus_status": "fail", "base_fail_tests": [], "plus_fail_tests": [["\u00e9xample.exe"]]}], "HumanEval/143": [{"task_id": "HumanEval/143", "solution": "import sys\nimport math\nfrom typing import List\ndef is_prime(n: int) -> bool:\n    \"\"\"Return True if n is a prime number, False otherwise.\"\"\"\n    if n <= 1:\n        return False\n    if n <= 3:\n        return True\n    if n % 2 == 0 or n % 3 == 0:\n        return False\n    i = 5\n    while i * i <= n:\n        if n % i == 0 or n % (i + 2) == 0:\n            return False\n        i += 6\n    return True\ndef words_in_sentence(sentence: str) -> str:\n    \"\"\"\n    Return a string containing only the words from *sentence* whose\n    lengths are prime numbers, preserving the original order.\n\n    Parameters\n    ----------\n    sentence : str\n        A sentence consisting of words separated by a single space.\n        The sentence contains only letters (no punctuation).\n\n    Returns\n    -------\n    str\n        A space\u2011separated string of the selected words.  If no word\n        has a prime length, an empty string is returned.\n    \"\"\"\n    words: List[str] = sentence.split()\n    prime_words: List[str] = [w for w in words if is_prime(len(w))]\n    return \" \".join(prime_words)", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/142": [{"task_id": "HumanEval/142", "solution": "from typing import List\ndef sum_squares(lst: List[int]) -> int:\n    \"\"\"\n    Take a list of integers and transform each element according to its index:\n\n    * If the index is a multiple of 3, square the element.\n    * Else if the index is a multiple of 4 (but not a multiple of 3), cube the element.\n    * Otherwise leave the element unchanged.\n\n    Finally return the sum of all elements in the transformed list.\n\n    Parameters\n    ----------\n    lst : List[int]\n        The input list of integers.\n\n    Returns\n    -------\n    int\n        The sum of the transformed list.\n\n    Examples\n    --------\n    >>> sum_squares([1, 2, 3])\n    6\n    >>> sum_squares([])\n    0\n    >>> sum_squares([-1, -5, 2, -1, -5])\n    -126\n    \"\"\"\n    total = 0\n    for idx, val in enumerate(lst):\n        if idx % 3 == 0:\n            val = val ** 2\n        elif idx % 4 == 0:\n            val = val ** 3\n        total += val\n    return total", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/144": [{"task_id": "HumanEval/144", "solution": "from typing import Tuple\ndef _parse_fraction(frac: str) -> Tuple[int, int]:\n    \"\"\"Parse a fraction string into a (numerator, denominator) tuple.\"\"\"\n    num_str, den_str = frac.split(\"/\")\n    return int(num_str), int(den_str)\ndef simplify(x: str, n: str) -> bool:\n    \"\"\"\n    Return True if the product of the two fractions is an integer.\n    \"\"\"\n    num_x, den_x = _parse_fraction(x)\n    num_n, den_n = _parse_fraction(n)\n\n    # product numerator and denominator\n    prod_num = num_x * num_n\n    prod_den = den_x * den_n\n\n    # the product is an integer iff prod_num is divisible by prod_den\n    return prod_num % prod_den == 0", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/146": [{"task_id": "HumanEval/146", "solution": "from typing import List\ndef _first_and_last_digits_are_odd(n: int) -> bool:\n    \"\"\"\n    Return True if the first and last decimal digits of *n* are odd.\n    Negative numbers are handled by ignoring the sign.\n    \"\"\"\n    # Work with the absolute value to ignore the sign\n    n_abs = abs(n)\n\n    # The last digit is simply n_abs % 10\n    last_digit = n_abs % 10\n\n    # The first digit can be obtained by repeatedly dividing by 10\n    first_digit = n_abs\n    while first_digit >= 10:\n        first_digit //= 10\n\n    odd_digits = {1, 3, 5, 7, 9}\n    return first_digit in odd_digits and last_digit in odd_digits\ndef specialFilter(nums: List[int]) -> int:\n    \"\"\"\n    Count how many numbers in *nums* are > 10 and have odd first and last digits.\n\n    Parameters\n    ----------\n    nums : List[int]\n        A list of integers.\n\n    Returns\n    -------\n    int\n        The count of numbers that satisfy both conditions.\n    \"\"\"\n    count = 0\n    for n in nums:\n        if n > 10 and _first_and_last_digits_are_odd(n):\n            count += 1\n    return count", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/145": [{"task_id": "HumanEval/145", "solution": "from typing import List\nimport doctest\nimport sys\ndef digit_sum(n: int) -> int:\n    \"\"\"Return the sum of the decimal digits of ``n`` (ignoring the sign).\"\"\"\n    return sum(int(d) for d in str(abs(n)))\ndef order_by_points(nums: List[int]) -> List[int]:\n    \"\"\"\n    Sort ``nums`` by the sum of their digits, preserving original order\n    for ties.\n\n    Parameters\n    ----------\n    nums : list[int]\n        List of integers to sort.\n\n    Returns\n    -------\n    list[int]\n        New list sorted by digit sum.\n\n    Examples\n    --------\n    >>> order_by_points([1, 11, -1, -11, -12])\n    [-1, -11, 1, -12, 11]\n    >>> order_by_points([])\n    []\n    >>> order_by_points([123, 45, 6, -7, 89])\n    [6, -7, 45, 89, 123]\n    \"\"\"\n    # ``sorted`` is stable, so we can use it directly.\n    return sorted(nums, key=digit_sum)", "base_status": "fail", "plus_status": "fail", "base_fail_tests": [[[1, 11, -1, -11, -12]]], "plus_fail_tests": [[[-5, -12, 9, 15]]]}], "HumanEval/147": [{"task_id": "HumanEval/147", "solution": "from math import comb\nimport sys\ndef get_max_triples(n: int) -> int:\n    \"\"\"\n    Return the number of triples (i, j, k) with 1 <= i < j < k <= n\n    such that a[i] + a[j] + a[k] is divisible by 3.\n    \"\"\"\n    # a[i] mod 3 depends only on i mod 3\n    # i % 3 == 0 or 1  -> a[i] % 3 == 1\n    # i % 3 == 2      -> a[i] % 3 == 0\n    cnt0 = n // 3                     # indices with residue 0\n    cnt1 = n - cnt0                   # indices with residue 1\n\n    # Only triples of the same residue can sum to 0 mod 3\n    # because we have no residue 2 values.\n    triples0 = comb(cnt0, 3) if cnt0 >= 3 else 0\n    triples1 = comb(cnt1, 3) if cnt1 >= 3 else 0\n\n    return triples0 + triples1", "base_status": "fail", "plus_status": "fail", "base_fail_tests": [[5]], "plus_fail_tests": [[20]]}], "HumanEval/151": [{"task_id": "HumanEval/151", "solution": "from typing import List, Any\ndef double_the_difference(lst: List[Any]) -> int:\n    \"\"\"\n    Return the sum of squares of the numbers in *lst* that are\n    non\u2011negative integers.  Negative numbers and non\u2011integers are ignored.\n\n    Parameters\n    ----------\n    lst : list\n        A list that may contain any type of elements.\n\n    Returns\n    -------\n    int\n        The sum of squares of the qualifying elements.  If the list is empty\n        or contains no qualifying elements, 0 is returned.\n\n    Examples\n    --------\n    >>> double_the_difference([1, 3, 2, 0])\n    10\n    >>> double_the_difference([-1, -2, 0])\n    0\n    >>> double_the_difference([9, -2])\n    81\n    >>> double_the_difference([0])\n    0\n    \"\"\"\n    total = 0\n    for item in lst:\n        # Keep only non\u2011negative integers\n        if isinstance(item, int) and item >= 0:\n            total += item * item\n    return total", "base_status": "fail", "plus_status": "fail", "base_fail_tests": [[[5, 4]]], "plus_fail_tests": [[[2, 4, 6]]]}], "HumanEval/149": [{"task_id": "HumanEval/149", "solution": "from typing import List", "base_status": "fail", "plus_status": "fail", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/150": [{"task_id": "HumanEval/150", "solution": "import sys\nimport math\nfrom typing import Any\ndef is_prime(n: int) -> bool:\n    \"\"\"\n    Return True if `n` is a prime number, False otherwise.\n\n    The algorithm is a classic trial\u2011division test that checks divisibility\n    by 2 and 3 first, then iterates over the numbers 6k\u00b11 up to sqrt(n).\n    This is more than fast enough for 32\u2011bit integers and keeps the code\n    short and readable.\n\n    Parameters\n    ----------\n    n : int\n        The number to test for primality.\n\n    Returns\n    -------\n    bool\n        True if `n` is prime, False otherwise.\n    \"\"\"\n    if n <= 1:\n        return False\n    if n <= 3:\n        return True\n    if n % 2 == 0 or n % 3 == 0:\n        return False\n\n    i = 5\n    w = 2\n    limit = int(math.isqrt(n))\n    while i <= limit:\n        if n % i == 0:\n            return False\n        i += w\n        w = 6 - w  # alternate between adding 2 and 4 (i.e. 6k\u00b11)\n    return True\ndef x_or_y(n: int, x: Any, y: Any) -> Any:\n    \"\"\"\n    Return `x` if `n` is a prime number, otherwise return `y`.\n\n    Parameters\n    ----------\n    n : int\n        The number to test for primality.\n    x : Any\n        Value to return if `n` is prime.\n    y : Any\n        Value to return if `n` is not prime.\n\n    Returns\n    -------\n    Any\n        Either `x` or `y` depending on the primality of `n`.\n    \"\"\"\n    return x if is_prime(n) else y", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/148": [{"task_id": "HumanEval/148", "solution": "PLANETS = (\n    \"Mercury\",\n    \"Venus\",\n    \"Earth\",\n    \"Mars\",\n    \"Jupiter\",\n    \"Saturn\",\n    \"Uranus\",\n    \"Neptune\",\n)\nINDEX = {name: i for i, name in enumerate(PLANETS)}\ndef bf(planet1: str, planet2: str) -> tuple[str, ...]:\n    \"\"\"\n    Return a tuple of planet names that lie strictly between `planet1` and\n    `planet2` in the order of their distance from the Sun.\n\n    Parameters\n    ----------\n    planet1 : str\n        Name of the first planet.\n    planet2 : str\n        Name of the second planet.\n\n    Returns\n    -------\n    tuple[str, ...]\n        A tuple containing the intermediate planets sorted from the Sun\n        outward.  If either planet name is invalid, an empty tuple is\n        returned.\n\n    Examples\n    --------\n    >>> bf(\"Jupiter\", \"Neptune\")\n    ('Saturn', 'Uranus')\n    >>> bf(\"Earth\", \"Mercury\")\n    ('Venus',)\n    >>> bf(\"Mercury\", \"Uranus\")\n    ('Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn')\n    >>> bf(\"Pluto\", \"Earth\")\n    ()\n    \"\"\"\n    # Validate the input planet names\n    if planet1 not in INDEX or planet2 not in INDEX:\n        return ()\n\n    i1, i2 = INDEX[planet1], INDEX[planet2]\n\n    # If the planets are the same or adjacent, there are no intermediate planets\n    if abs(i1 - i2) <= 1:\n        return ()\n\n    # Determine the slice boundaries (exclusive of the endpoints)\n    start, end = sorted((i1, i2))\n    return PLANETS[start + 1 : end]", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/153": [{"task_id": "HumanEval/153", "solution": "from typing import List\ndef Strongest_Extension(class_name: str, extensions: List[str]) -> str:\n    \"\"\"\n    Return the strongest extension for the given class.\n\n    Parameters\n    ----------\n    class_name : str\n        The name of the class.\n    extensions : list[str]\n        A list of extension names.\n\n    Returns\n    -------\n    str\n        The string ``ClassName.ExtensionName`` where *ExtensionName* is the\n        strongest extension according to the rule described above.\n\n    Examples\n    --------\n    >>> Strongest_Extension('Slices', ['SErviNGSliCes', 'Cheese', 'StuFfed'])\n    'Slices.SErviNGSliCes'\n    >>> Strongest_Extension('my_class', ['AA', 'Be', 'CC'])\n    'my_class.AA'\n    \"\"\"\n    best_strength = None\n    best_extension = None\n\n    for ext in extensions:\n        # Count uppercase and lowercase letters\n        cap = sum(1 for ch in ext if ch.isupper())\n        sm = sum(1 for ch in ext if ch.islower())\n        strength = cap - sm\n\n        # Update best if this extension is stronger or if we haven't set one yet\n        if best_strength is None or strength > best_strength:\n            best_strength = strength\n            best_extension = ext\n\n    return f\"{class_name}.{best_extension}\"", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/152": [{"task_id": "HumanEval/152", "solution": "from typing import List\ndef compare(game: List[int], guess: List[int]) -> List[int]:\n    \"\"\"\n    Return a list of the same length as `game` and `guess` where each element is\n    the absolute difference between the corresponding elements of the two lists.\n    If the guess matches the score exactly, the difference is 0.\n\n    Parameters\n    ----------\n    game : List[int]\n        The actual scores of the matches.\n    guess : List[int]\n        The guessed scores.\n\n    Returns\n    -------\n    List[int]\n        A list of differences.\n\n    Examples\n    --------\n    >>> compare([1, 2, 3, 4, 5, 1], [1, 2, 3, 4, 2, -2])\n    [0, 0, 0, 0, 3, 3]\n    >>> compare([0, 5, 0, 0, 0, 4], [4, 1, 1, 0, 0, -2])\n    [4, 4, 1, 0, 0, 6]\n    \"\"\"\n    if len(game) != len(guess):\n        raise ValueError(\"Both lists must have the same length\")\n\n    return [abs(g - s) for s, g in zip(game, guess)]", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/154": [{"task_id": "HumanEval/154", "solution": "from typing import List\ndef rotations(s: str) -> List[str]:\n    \"\"\"\n    Generate all rotations of a string `s`.\n\n    The rotation with k characters moved from the front to the back\n    is `s[k:] + s[:k]`.  The list contains the original string\n    (k = 0) and all other distinct rotations.\n    \"\"\"\n    return [s[i:] + s[:i] for i in range(len(s))]\ndef cycpattern_check(a: str, b: str) -> bool:\n    \"\"\"\n    Return True if any rotation of `b` occurs as a substring of `a`.\n\n    Parameters\n    ----------\n    a : str\n        The string in which we search for a rotation of `b`.\n    b : str\n        The string whose rotations we test.\n\n    Returns\n    -------\n    bool\n        True if a rotation of `b` is a substring of `a`, otherwise False.\n    \"\"\"\n    # Quick exit: if b is longer than a, no rotation can fit\n    if len(b) > len(a):\n        return False\n\n    # Generate all rotations of b\n    for r in rotations(b):\n        if r in a:\n            return True\n    return False", "base_status": "pass", "plus_status": "fail", "base_fail_tests": [], "plus_fail_tests": [["", ""]]}], "HumanEval/155": [{"task_id": "HumanEval/155", "solution": "def even_odd_count(num: int) -> tuple[int, int]:\n    \"\"\"\n    Return a tuple (even_count, odd_count) describing how many even\n    and odd digits appear in the absolute value of *num*.\n\n    Parameters\n    ----------\n    num : int\n        The integer to analyse.  The sign is ignored.\n\n    Returns\n    -------\n    tuple[int, int]\n        A two\u2011tuple where the first element is the number of even\n        digits and the second element is the number of odd digits.\n\n    Examples\n    --------\n    >>> even_odd_count(-12)\n    (1, 1)\n    >>> even_odd_count(123)\n    (1, 2)\n    >>> even_odd_count(0)\n    (1, 0)\n    \"\"\"\n    # Work with the absolute value so that the sign is ignored.\n    n = abs(num)\n\n    # Special case: 0 has one digit which is even.\n    if n == 0:\n        return (1, 0)\n\n    even = odd = 0\n    while n:\n        digit = n % 10\n        if digit % 2 == 0:\n            even += 1\n        else:\n            odd += 1\n        n //= 10\n\n    return (even, odd)", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/139": [{"task_id": "HumanEval/139", "solution": "import math\nimport sys\nimport argparse\ndef special_factorial(n: int) -> int:\n    \"\"\"\n    Return the Brazilian factorial of a positive integer n.\n\n    Parameters\n    ----------\n    n : int\n        The integer to compute the factorial for. Must be > 0.\n\n    Returns\n    -------\n    int\n        The product of all factorials from 1! up to n!.\n\n    Raises\n    ------\n    ValueError\n        If n is not a positive integer.\n    \"\"\"\n    if not isinstance(n, int):\n        raise TypeError(f\"n must be an integer, got {type(n).__name__}\")\n    if n <= 0:\n        raise ValueError(f\"n must be > 0, got {n}\")\n\n    product = 1\n    for k in range(1, n + 1):\n        product *= math.factorial(k)\n    return product", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/156": [{"task_id": "HumanEval/156", "solution": "def int_to_mini_roman(number: int) -> str:\n    \"\"\"\n    Convert an integer to a Roman numeral string (lowercase).\n\n    Parameters\n    ----------\n    number : int\n        The integer to convert. Must satisfy 1 <= number <= 1000.\n\n    Returns\n    -------\n    str\n        The Roman numeral representation in lowercase.\n\n    Examples\n    --------\n    >>> int_to_mini_roman(19)\n    'xix'\n    >>> int_to_mini_roman(152)\n    'clii'\n    >>> int_to_mini_roman(426)\n    'cdxxvi'\n    \"\"\"\n    if not (1 <= number <= 1000):\n        raise ValueError(\"Number must be between 1 and 1000 inclusive\")\n\n    # Mapping of integer values to Roman numeral symbols\n    # Ordered from largest to smallest to allow greedy subtraction\n    roman_map = [\n        (1000, \"M\"),\n        (900,  \"CM\"),\n        (500,  \"D\"),\n        (400,  \"CD\"),\n        (100,  \"C\"),\n        (90,   \"XC\"),\n        (50,   \"L\"),\n        (40,   \"XL\"),\n        (10,   \"X\"),\n        (9,    \"IX\"),\n        (5,    \"V\"),\n        (4,    \"IV\"),\n        (1,    \"I\"),\n    ]\n\n    result_parts = []\n    remaining = number\n\n    for value, symbol in roman_map:\n        if remaining == 0:\n            break\n        count, remaining = divmod(remaining, value)\n        result_parts.append(symbol * count)\n\n    return \"\".join(result_parts).lower()", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/157": [{"task_id": "HumanEval/157", "solution": "from typing import Tuple\ndef right_angle_triangle(a: float, b: float, c: float) -> bool:\n    \"\"\"\n    Return True if the three side lengths a, b, c can form a right\u2011angled triangle,\n    otherwise return False.\n\n    A triangle must satisfy the triangle inequality:\n        a + b > c, a + c > b, b + c > a\n    and one of the Pythagorean identities must hold:\n        a\u00b2 + b\u00b2 == c\u00b2  or  a\u00b2 + c\u00b2 == b\u00b2  or  b\u00b2 + c\u00b2 == a\u00b2\n\n    Parameters\n    ----------\n    a, b, c : float\n        Lengths of the sides. Must be positive numbers.\n\n    Returns\n    -------\n    bool\n        True if the sides form a right\u2011angled triangle, False otherwise.\n    \"\"\"\n    # Validate that all sides are positive numbers\n    if not all(isinstance(x, (int, float)) and x > 0 for x in (a, b, c)):\n        raise ValueError(\"All side lengths must be positive numbers.\")\n\n    # Triangle inequality check\n    if not (a + b > c and a + c > b and b + c > a):\n        return False\n\n    # Sort the sides so that the largest is treated as the hypotenuse\n    sides: Tuple[float, float, float] = tuple(sorted((a, b, c)))\n    x, y, z = sides  # z is the largest side\n\n    # Use a tolerance for floating\u2011point comparisons\n    eps = 1e-9\n    return abs(x**2 + y**2 - z**2) < eps", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/158": [{"task_id": "HumanEval/158", "solution": "def find_max(words: list[str]) -> str:\n    \"\"\"\n    Return the word with the maximum number of unique characters.\n\n    Parameters\n    ----------\n    words : list[str]\n        A list of distinct words (strings).  The list may be empty.\n\n    Returns\n    -------\n    str\n        The word that has the most unique characters.  If more than one\n        word shares that maximum, the lexicographically smallest word\n        among them is returned.  If the input list is empty, an empty\n        string is returned.\n\n    Examples\n    --------\n    >>> find_max([\\\"name\\\", \\\"of\\\", \\\"string\\\"])\n    'string'\n    >>> find_max([\\\"name\\\", \\\"enam\\\", \\\"game\\\"])\n    'enam'\n    >>> find_max([\\\"aaaaaaa\\\", \\\"bb\\\", \\\"cc\\\"])\n    'aaaaaaa'\n    >>> find_max([])\n    ''\n    \"\"\"\n    if not words:\n        return \"\"\n\n    # Compute the number of unique characters for each word\n    # and keep track of the best candidate seen so far.\n    best_word = None\n    best_unique = -1\n\n    for word in words:\n        unique_count = len(set(word))\n        if unique_count > best_unique:\n            best_unique = unique_count\n            best_word = word\n        elif unique_count == best_unique:\n            # Tie \u2013 choose the lexicographically smaller word\n            if word < best_word:\n                best_word = word\n\n    return best_word", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/160": [{"task_id": "HumanEval/160", "solution": "import sys\nfrom typing import List\ndef do_algebra(operator: List[str], operand: List[int]) -> int:\n    \"\"\"\n    Build and evaluate an algebraic expression from two lists.\n\n    Parameters\n    ----------\n    operator : list[str]\n        List of operators.  Its length must be one less than the length\n        of `operand`.  Each element must be one of '+', '-', '*', '//',\n        '**'.\n    operand : list[int]\n        List of non\u2011negative integers.  Its length must be at least 2.\n\n    Returns\n    -------\n    int\n        The integer result of evaluating the expression.\n\n    Examples\n    --------\n    >>> do_algebra(['+', '*', '-'], [2, 3, 4, 5])\n    9\n    >>> do_algebra(['*', '**'], [2, 3, 4])\n    128\n    \"\"\"\n    if len(operator) != len(operand) - 1:\n        raise ValueError(\"operator list must be one element shorter than operand list\")\n\n    # Validate operators\n    allowed_ops = {\"+\", \"-\", \"*\", \"//\", \"**\"}\n    for op in operator:\n        if op not in allowed_ops:\n            raise ValueError(f\"Unsupported operator: {op!r}\")\n\n    # Build a string representation of the expression\n    expr_parts: List[str] = [str(operand[0])]\n    for op, val in zip(operator, operand[1:]):\n        expr_parts.append(op)\n        expr_parts.append(str(val))\n\n    expr = \" \".join(expr_parts)\n\n    # Evaluate the expression safely\n    # Using eval is acceptable here because the input is strictly\n    # controlled (only integers and a known set of operators).\n    result = eval(expr, {\"__builtins__\": None}, {})\n    if not isinstance(result, int):\n        # In case of floor division returning a float (Python 3.8+)\n        result = int(result)\n    return result", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/159": [{"task_id": "HumanEval/159", "solution": "from typing import List\ndef eat(number: int, need: int, remaining: int) -> List[int]:\n    \"\"\"\n    Compute the final number of eaten carrots and the remaining stock.\n\n    Parameters\n    ----------\n    number : int\n        Carrots already eaten (0\u202f\u2264\u202fnumber\u202f\u2264\u202f1000)\n    need : int\n        Carrots the rabbit still wants to eat (0\u202f\u2264\u202fneed\u202f\u2264\u202f1000)\n    remaining : int\n        Carrots left in the stock (0\u202f\u2264\u202fremaining\u202f\u2264\u202f1000)\n\n    Returns\n    -------\n    List[int]\n        [total_eaten, left]\n    \"\"\"\n    # How many carrots can actually be eaten?\n    eaten_now = min(need, remaining)\n\n    total_eaten = number + eaten_now\n    left = remaining - eaten_now\n\n    return [total_eaten, left]", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/161": [{"task_id": "HumanEval/161", "solution": "import sys\nimport re\nfrom typing import List\ndef solve(s: str) -> str:\n    \"\"\"\n    Transform the string `s` according to the rules above.\n\n    Parameters\n    ----------\n    s : str\n        The input string.\n\n    Returns\n    -------\n    str\n        The transformed string.\n    \"\"\"\n    # Check whether the string contains at least one alphabetic character.\n    has_letter = any(ch.isalpha() for ch in s)\n\n    if has_letter:\n        # Flip the case of every alphabetic character.\n        transformed: List[str] = []\n        for ch in s:\n            if ch.islower():\n                transformed.append(ch.upper())\n            elif ch.isupper():\n                transformed.append(ch.lower())\n            else:\n                transformed.append(ch)\n        return \"\".join(transformed)\n    else:\n        # No letters \u2013 reverse the whole string.\n        return s[::-1]", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/162": [{"task_id": "HumanEval/162", "solution": "import hashlib\nimport sys\nimport unittest\ndef string_to_md5(text: str) -> str | None:\n    \"\"\"\n    Return the MD5 hash of *text* as a 32\u2011character hexadecimal string.\n\n    Parameters\n    ----------\n    text : str\n        The input string to hash.\n\n    Returns\n    -------\n    str | None\n        The MD5 digest of *text* if it is non\u2011empty; otherwise ``None``.\n\n    Notes\n    -----\n    * The function uses UTF\u20118 encoding to convert the string to bytes,\n      which is the de\u2011facto standard for text hashing in Python.\n    * An empty string is treated specially because an MD5 hash of an\n      empty string is a well\u2011known constant (`d41d8cd98f00b204e9800998ecf8427e`),\n      but the problem statement explicitly requires ``None`` in that case.\n\n    Examples\n    --------\n    >>> string_to_md5('Hello world')\n    '3e25960a79dbc69b674cd4ec67a72c62'\n    >>> string_to_md5('')\n    None\n    \"\"\"\n    if not text:\n        return None\n\n    # Encode the string to bytes using UTF\u20118\n    data = text.encode(\"utf-8\")\n\n    # Compute the MD5 digest\n    md5_hash = hashlib.md5(data).hexdigest()\n\n    return md5_hash", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}], "HumanEval/163": [{"task_id": "HumanEval/163", "solution": "from typing import List\ndef generate_integers(a: int, b: int) -> List[int]:\n    \"\"\"\n    Return the even digits between `a` and `b` (inclusive), sorted\n    in ascending order.\n\n    Parameters\n    ----------\n    a : int\n        First positive integer.\n    b : int\n        Second positive integer.\n\n    Returns\n    -------\n    List[int]\n        Sorted list of even digits between the two numbers.\n    \"\"\"\n    # Ensure a <= b for a single pass\n    low, high = sorted((a, b))\n\n    # Even digits are 0, 2, 4, 6, 8\n    even_digits = [0, 2, 4, 6, 8]\n\n    # Filter digits that lie within the inclusive range\n    result = [d for d in even_digits if low <= d <= high]\n    return result", "base_status": "pass", "plus_status": "pass", "base_fail_tests": [], "plus_fail_tests": []}]}, "pass_at_k": {"base": {"pass@1": 0.926829268292683}, "plus": {"pass@1": 0.8719512195121951}}}