{"task_id": "HumanEval/0", "prompt": "Instruction: Check if in given list of numbers, are any two numbers closer to each other than\ngiven threshold.\n>>> has_close_elements([1.0, 2.0, 3.0], 0.5)\nFalse\n>>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3)\nTrue\nResponse:\n```python\nfrom typing import List\n\n\ndef has_close_elements(numbers: List[float], threshold: float) -> bool:\n"} {"task_id": "HumanEval/1", "prompt": "Instruction: Input to this function is a string containing multiple groups of nested parentheses. Your goal is to\nseparate those group into separate strings and return the list of those.\nSeparate groups are balanced (each open brace is properly closed) and not nested within each other\nIgnore any spaces in the input string.\n>>> separate_paren_groups('( ) (( )) (( )( ))')\n['()', '(())', '(()())']\nResponse:\n```python\nfrom typing import List\n\n\ndef separate_paren_groups(paren_string: str) -> List[str]:\n"} {"task_id": "HumanEval/2", "prompt": "Instruction: Given a positive floating point number, it can be decomposed into\nand integer part (largest integer smaller than given number) and decimals\n(leftover part always smaller than 1).\n\nReturn the decimal part of the number.\n>>> truncate_number(3.5)\n0.5\nResponse:\n```python\ndef truncate_number(number: float) -> float:\n"} {"task_id": "HumanEval/3", "prompt": "Instruction: You're given a list of deposit and withdrawal operations on a bank account that starts with\nzero balance. Your task is to detect if at any point the balance of account fallls below zero, and\nat that point function should return True. Otherwise it should return False.\n>>> below_zero([1, 2, 3])\nFalse\n>>> below_zero([1, 2, -4, 5])\nTrue\nResponse:\n```python\nfrom typing import List\n\n\ndef below_zero(operations: List[int]) -> bool:\n"} {"task_id": "HumanEval/4", "prompt": "Instruction: For a given list of input numbers, calculate Mean Absolute Deviation\naround the mean of this dataset.\nMean Absolute Deviation is the average absolute difference between each\nelement and a centerpoint (mean in this case):\nMAD = average | x - x_mean |\n>>> mean_absolute_deviation([1.0, 2.0, 3.0, 4.0])\n1.0\nResponse:\n```python\nfrom typing import List\n\n\ndef mean_absolute_deviation(numbers: List[float]) -> float:\n"} {"task_id": "HumanEval/5", "prompt": "Instruction: Insert a number 'delimeter' between every two consecutive elements of input list `numbers'\n>>> intersperse([], 4)\n[]\n>>> intersperse([1, 2, 3], 4)\n[1, 4, 2, 4, 3]\nResponse:\n```python\nfrom typing import List\n\n\ndef intersperse(numbers: List[int], delimeter: int) -> List[int]:\n"} {"task_id": "HumanEval/6", "prompt": "Instruction: Input to this function is a string represented multiple groups for nested parentheses separated by spaces.\nFor each of the group, output the deepest level of nesting of parentheses.\nE.g. (()()) has maximum two levels of nesting while ((())) has three.\n\n>>> parse_nested_parens('(()()) ((())) () ((())()())')\n[2, 3, 1, 3]\nResponse:\n```python\nfrom typing import List\n\n\ndef parse_nested_parens(paren_string: str) -> List[int]:\n"} {"task_id": "HumanEval/7", "prompt": "Instruction: Filter an input list of strings only for ones that contain given substring\n>>> filter_by_substring([], 'a')\n[]\n>>> filter_by_substring(['abc', 'bacd', 'cde', 'array'], 'a')\n['abc', 'bacd', 'array']\nResponse:\n```python\nfrom typing import List\n\n\ndef filter_by_substring(strings: List[str], substring: str) -> List[str]:\n"} {"task_id": "HumanEval/8", "prompt": "Instruction: For a given list of integers, return a tuple consisting of a sum and a product of all the integers in a list.\nEmpty sum should be equal to 0 and empty product should be equal to 1.\n>>> sum_product([])\n(0, 1)\n>>> sum_product([1, 2, 3, 4])\n(10, 24)\nResponse:\n```python\nfrom typing import List, Tuple\n\n\ndef sum_product(numbers: List[int]) -> Tuple[int, int]:\n"} {"task_id": "HumanEval/9", "prompt": "Instruction: From a given list of integers, generate a list of rolling maximum element found until given moment\nin the sequence.\n>>> rolling_max([1, 2, 3, 2, 3, 4, 2])\n[1, 2, 3, 3, 3, 4, 4]\nResponse:\n```python\nfrom typing import List, Tuple\n\n\ndef rolling_max(numbers: List[int]) -> List[int]:\n"} {"task_id": "HumanEval/10", "prompt": "Instruction: Find the shortest palindrome that begins with a supplied string.\nAlgorithm idea is simple:\n- Find the longest postfix of supplied string that is a palindrome.\n- Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.\n>>> make_palindrome('')\n''\n>>> make_palindrome('cat')\n'catac'\n>>> make_palindrome('cata')\n'catac'\nResponse:\n```python\n\ndef is_palindrome(string: str) -> bool:\n \"\"\" Test if given string is a palindrome \"\"\"\n return string == string[::-1]\n\n\ndef make_palindrome(string: str) -> str:\n \"\"\" Find the shortest palindrome that begins with a supplied string.\n Algorithm idea is simple:\n - Find the longest postfix of supplied string that is a palindrome.\n - Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.\n >>> make_palindrome('')\n ''\n >>> make_palindrome('cat')\n 'catac'\n >>> make_palindrome('cata')\n 'catac'\n \"\"\"\n"} {"task_id": "HumanEval/11", "prompt": "Instruction: Input are two strings a and b consisting only of 1s and 0s.\nPerform binary XOR on these inputs and return result also as a string.\n>>> string_xor('010', '110')\n'100'\nResponse:\n```python\nfrom typing import List\n\n\ndef string_xor(a: str, b: str) -> str:\n"} {"task_id": "HumanEval/12", "prompt": "Instruction: Out of list of strings, return the longest one. Return the first one in case of multiple\nstrings of the same length. Return None in case the input list is empty.\n>>> longest([])\n\n>>> longest(['a', 'b', 'c'])\n'a'\n>>> longest(['a', 'bb', 'ccc'])\n'ccc'\nResponse:\n```python\nfrom typing import List, Optional\n\n\ndef longest(strings: List[str]) -> Optional[str]:\n"} {"task_id": "HumanEval/13", "prompt": "Instruction: Return a greatest common divisor of two integers a and b\n>>> greatest_common_divisor(3, 5)\n1\n>>> greatest_common_divisor(25, 15)\n5\nResponse:\n```python\ndef greatest_common_divisor(a: int, b: int) -> int:\n"} {"task_id": "HumanEval/14", "prompt": "Instruction: Return list of all prefixes from shortest to longest of the input string\n>>> all_prefixes('abc')\n['a', 'ab', 'abc']\nResponse:\n```python\nfrom typing import List\n\n\ndef all_prefixes(string: str) -> List[str]:\n"} {"task_id": "HumanEval/15", "prompt": "Instruction: Return a string containing space-delimited numbers starting from 0 upto n inclusive.\n>>> string_sequence(0)\n'0'\n>>> string_sequence(5)\n'0 1 2 3 4 5'\nResponse:\n```python\ndef string_sequence(n: int) -> str:\n"} {"task_id": "HumanEval/16", "prompt": "Instruction: Given a string, find out how many distinct characters (regardless of case) does it consist of\n>>> count_distinct_characters('xyzXYZ')\n3\n>>> count_distinct_characters('Jerry')\n4\nResponse:\n```python\ndef count_distinct_characters(string: str) -> int:\n"} {"task_id": "HumanEval/17", "prompt": "Instruction: Input to this function is a string representing musical notes in a special ASCII format.\nYour task is to parse this string and return list of integers corresponding to how many beats does each\nnot last.\n\nHere is a legend:\n'o' - whole note, lasts four beats\n'o|' - half note, lasts two beats\n'.|' - quater note, lasts one beat\n\n>>> parse_music('o o| .| o| o| .| .| .| .| o o')\n[4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4]\nResponse:\n```python\nfrom typing import List\n\n\ndef parse_music(music_string: str) -> List[int]:\n"} {"task_id": "HumanEval/18", "prompt": "Instruction: Find how many times a given substring can be found in the original string. Count overlaping cases.\n>>> how_many_times('', 'a')\n0\n>>> how_many_times('aaa', 'a')\n3\n>>> how_many_times('aaaa', 'aa')\n3\nResponse:\n```python\ndef how_many_times(string: str, substring: str) -> int:\n"} {"task_id": "HumanEval/19", "prompt": "Instruction: Input is a space-delimited string of numberals from 'zero' to 'nine'.\nValid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.\nReturn the string with numbers sorted from smallest to largest\n>>> sort_numbers('three one five')\n'one three five'\nResponse:\n```python\nfrom typing import List\n\n\ndef sort_numbers(numbers: str) -> str:\n"} {"task_id": "HumanEval/20", "prompt": "Instruction: From a supplied list of numbers (of length at least two) select and return two that are the closest to each\nother and return them in order (smaller number, larger number).\n>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])\n(2.0, 2.2)\n>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])\n(2.0, 2.0)\nResponse:\n```python\nfrom typing import List, Tuple\n\n\ndef find_closest_elements(numbers: List[float]) -> Tuple[float, float]:\n"} {"task_id": "HumanEval/21", "prompt": "Instruction: Given list of numbers (of at least two elements), apply a linear transform to that list,\nsuch that the smallest number will become 0 and the largest will become 1\n>>> rescale_to_unit([1.0, 2.0, 3.0, 4.0, 5.0])\n[0.0, 0.25, 0.5, 0.75, 1.0]\nResponse:\n```python\nfrom typing import List\n\n\ndef rescale_to_unit(numbers: List[float]) -> List[float]:\n"} {"task_id": "HumanEval/22", "prompt": "Instruction: Filter given list of any python values only for integers\n>>> filter_integers(['a', 3.14, 5])\n[5]\n>>> filter_integers([1, 2, 3, 'abc', {}, []])\n[1, 2, 3]\nResponse:\n```python\nfrom typing import List, Any\n\n\ndef filter_integers(values: List[Any]) -> List[int]:\n"} {"task_id": "HumanEval/23", "prompt": "Instruction: Return length of given string\n>>> strlen('')\n0\n>>> strlen('abc')\n3\nResponse:\n```python\ndef strlen(string: str) -> int:\n"} {"task_id": "HumanEval/24", "prompt": "Instruction: For a given number n, find the largest number that divides n evenly, smaller than n\n>>> largest_divisor(15)\n5\nResponse:\n```python\ndef largest_divisor(n: int) -> int:\n"} {"task_id": "HumanEval/25", "prompt": "Instruction: Return list of prime factors of given integer in the order from smallest to largest.\nEach of the factors should be listed number of times corresponding to how many times it appeares in factorization.\nInput number should be equal to the product of all factors\n>>> factorize(8)\n[2, 2, 2]\n>>> factorize(25)\n[5, 5]\n>>> factorize(70)\n[2, 5, 7]\nResponse:\n```python\nfrom typing import List\n\n\ndef factorize(n: int) -> List[int]:\n"} {"task_id": "HumanEval/26", "prompt": "Instruction: From a list of integers, remove all elements that occur more than once.\nKeep order of elements left the same as in the input.\n>>> remove_duplicates([1, 2, 3, 2, 4])\n[1, 3, 4]\nResponse:\n```python\nfrom typing import List\n\n\ndef remove_duplicates(numbers: List[int]) -> List[int]:\n"} {"task_id": "HumanEval/27", "prompt": "Instruction: For a given string, flip lowercase characters to uppercase and uppercase to lowercase.\n>>> flip_case('Hello')\n'hELLO'\nResponse:\n```python\ndef flip_case(string: str) -> str:\n"} {"task_id": "HumanEval/28", "prompt": "Instruction: Concatenate list of strings into a single string\n>>> concatenate([])\n''\n>>> concatenate(['a', 'b', 'c'])\n'abc'\nResponse:\n```python\nfrom typing import List\n\n\ndef concatenate(strings: List[str]) -> str:\n"} {"task_id": "HumanEval/29", "prompt": "Instruction: Filter an input list of strings only for ones that start with a given prefix.\n>>> filter_by_prefix([], 'a')\n[]\n>>> filter_by_prefix(['abc', 'bcd', 'cde', 'array'], 'a')\n['abc', 'array']\nResponse:\n```python\nfrom typing import List\n\n\ndef filter_by_prefix(strings: List[str], prefix: str) -> List[str]:\n"} {"task_id": "HumanEval/30", "prompt": "Instruction: Return only positive numbers in the list.\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]\nResponse:\n```python\ndef get_positive(l: list):\n"} {"task_id": "HumanEval/31", "prompt": "Instruction: Return true if a given number is prime, and false otherwise.\n>>> is_prime(6)\nFalse\n>>> is_prime(101)\nTrue\n>>> is_prime(11)\nTrue\n>>> is_prime(13441)\nTrue\n>>> is_prime(61)\nTrue\n>>> is_prime(4)\nFalse\n>>> is_prime(1)\nFalse\nResponse:\n```python\ndef is_prime(n):\n"} {"task_id": "HumanEval/32", "prompt": "Instruction: xs are coefficients of a polynomial.\nfind_zero find x such that poly(x) = 0.\nfind_zero returns only only zero point, even if there are many.\nMoreover, find_zero only takes list xs having even number of coefficients\nand largest non zero coefficient as it guarantees\na solution.\n>>> round(find_zero([1, 2]), 2) # f(x) = 1 + 2x\n-0.5\n>>> round(find_zero([-6, 11, -6, 1]), 2) # (x - 1) * (x - 2) * (x - 3) = -6 + 11x - 6x^2 + x^3\n1.0\nResponse:\n```pythonimport math\n\n\ndef poly(xs: list, x: float):\n \"\"\"\n Evaluates polynomial with coefficients xs at point x.\n return xs[0] + xs[1] * x + xs[1] * x^2 + .... xs[n] * x^n\n \"\"\"\n return sum([coeff * math.pow(x, i) for i, coeff in enumerate(xs)])\n\n\ndef find_zero(xs: list):\n \"\"\" xs are coefficients of a polynomial.\n find_zero find x such that poly(x) = 0.\n find_zero returns only only zero point, even if there are many.\n Moreover, find_zero only takes list xs having even number of coefficients\n and largest non zero coefficient as it guarantees\n a solution.\n >>> round(find_zero([1, 2]), 2) # f(x) = 1 + 2x\n -0.5\n >>> round(find_zero([-6, 11, -6, 1]), 2) # (x - 1) * (x - 2) * (x - 3) = -6 + 11x - 6x^2 + x^3\n 1.0\n \"\"\"\n"} {"task_id": "HumanEval/33", "prompt": "Instruction: This function takes a list l and returns a list l' such that\nl' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal\nto the values of the corresponding indicies of l, but sorted.\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]\nResponse:\n```python\ndef sort_third(l: list):\n"} {"task_id": "HumanEval/34", "prompt": "Instruction: Return sorted unique elements in a list\n>>> unique([5, 3, 5, 2, 3, 3, 9, 0, 123])\n[0, 2, 3, 5, 9, 123]\nResponse:\n```python\ndef unique(l: list):\n"} {"task_id": "HumanEval/35", "prompt": "Instruction: Return maximum element in the list.\n>>> max_element([1, 2, 3])\n3\n>>> max_element([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])\n123\nResponse:\n```python\ndef max_element(l: list):\n"} {"task_id": "HumanEval/36", "prompt": "Instruction: Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13.\n>>> fizz_buzz(50)\n0\n>>> fizz_buzz(78)\n2\n>>> fizz_buzz(79)\n3\nResponse:\n```python\ndef fizz_buzz(n: int):\n"} {"task_id": "HumanEval/37", "prompt": "Instruction: This function takes a list l and returns a list l' such that\nl' is identical to l in the odd indicies, while its values at the even indicies are equal\nto the values of the even indicies of l, but sorted.\n>>> sort_even([1, 2, 3])\n[1, 2, 3]\n>>> sort_even([5, 6, 3, 4])\n[3, 6, 5, 4]\nResponse:\n```python\ndef sort_even(l: list):\n"} {"task_id": "HumanEval/38", "prompt": "Instruction: Takes as input string encoded with encode_cyclic function. Returns decoded string.\nResponse:\n```python\n\ndef encode_cyclic(s: str):\n \"\"\"\n returns encoded string by cycling groups of three characters.\n \"\"\"\n # split string to groups. Each of length 3.\n groups = [s[(3 * i):min((3 * i + 3), len(s))] for i in range((len(s) + 2) // 3)]\n # cycle elements in each group. Unless group has fewer elements than 3.\n groups = [(group[1:] + group[0]) if len(group) == 3 else group for group in groups]\n return \"\".join(groups)\n\n\ndef decode_cyclic(s: str):\n \"\"\"\n takes as input string encoded with encode_cyclic function. Returns decoded string.\n \"\"\"\n"} {"task_id": "HumanEval/39", "prompt": "Instruction: prime_fib returns n-th number that is a Fibonacci number and it's also prime.\n>>> prime_fib(1)\n2\n>>> prime_fib(2)\n3\n>>> prime_fib(3)\n5\n>>> prime_fib(4)\n13\n>>> prime_fib(5)\n89\nResponse:\n```python\ndef prime_fib(n: int):\n"} {"task_id": "HumanEval/40", "prompt": "Instruction: triples_sum_to_zero takes a list of integers as an input.\nit returns True if there are three distinct elements in the list that\nsum to zero, and False otherwise.\n\n>>> triples_sum_to_zero([1, 3, 5, 0])\nFalse\n>>> triples_sum_to_zero([1, 3, -2, 1])\nTrue\n>>> triples_sum_to_zero([1, 2, 3, 7])\nFalse\n>>> triples_sum_to_zero([2, 4, -5, 3, 9, 7])\nTrue\n>>> triples_sum_to_zero([1])\nFalse\nResponse:\n```python\ndef triples_sum_to_zero(l: list):\n"} {"task_id": "HumanEval/41", "prompt": "Instruction: Imagine a road that's a perfectly straight infinitely long line.\nn cars are driving left to right; simultaneously, a different set of n cars\nare driving right to left. The two sets of cars start out being very far from\neach other. All cars move in the same speed. Two cars are said to collide\nwhen a car that's moving left to right hits a car that's moving right to left.\nHowever, the cars are infinitely sturdy and strong; as a result, they continue moving\nin their trajectory as if they did not collide.\n\nThis function outputs the number of such collisions.\nResponse:\n```python\ndef car_race_collision(n: int):\n"} {"task_id": "HumanEval/42", "prompt": "Instruction: Return list with elements incremented by 1.\n>>> incr_list([1, 2, 3])\n[2, 3, 4]\n>>> incr_list([5, 3, 5, 2, 3, 3, 9, 0, 123])\n[6, 4, 6, 3, 4, 4, 10, 1, 124]\nResponse:\n```python\ndef incr_list(l: list):\n"} {"task_id": "HumanEval/43", "prompt": "Instruction: pairs_sum_to_zero takes a list of integers as an input.\nit returns True if there are two distinct elements in the list that\nsum to zero, and False otherwise.\n>>> pairs_sum_to_zero([1, 3, 5, 0])\nFalse\n>>> pairs_sum_to_zero([1, 3, -2, 1])\nFalse\n>>> pairs_sum_to_zero([1, 2, 3, 7])\nFalse\n>>> pairs_sum_to_zero([2, 4, -5, 3, 5, 7])\nTrue\n>>> pairs_sum_to_zero([1])\nFalse\nResponse:\n```python\ndef pairs_sum_to_zero(l):\n"} {"task_id": "HumanEval/44", "prompt": "Instruction: Change numerical base of input number x to base.\nreturn string representation after the conversion.\nbase numbers are less than 10.\n>>> change_base(8, 3)\n'22'\n>>> change_base(8, 2)\n'1000'\n>>> change_base(7, 2)\n'111'\nResponse:\n```python\ndef change_base(x: int, base: int):\n"} {"task_id": "HumanEval/45", "prompt": "Instruction: Given length of a side and high return area for a triangle.\n>>> triangle_area(5, 3)\n7.5\nResponse:\n```python\ndef triangle_area(a, h):\n"} {"task_id": "HumanEval/46", "prompt": "Instruction: The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:\nfib4(0) -> 0\nfib4(1) -> 0\nfib4(2) -> 2\nfib4(3) -> 0\nfib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4).\nPlease write a function to efficiently compute the n-th element of the fib4 number sequence. Do not use recursion.\n>>> fib4(5)\n4\n>>> fib4(6)\n8\n>>> fib4(7)\n14\nResponse:\n```python\ndef fib4(n: int):\n"} {"task_id": "HumanEval/47", "prompt": "Instruction: Return median of elements in the list l.\n>>> median([3, 1, 2, 4, 5])\n3\n>>> median([-10, 4, 6, 1000, 10, 20])\n15.0\nResponse:\n```python\ndef median(l: list):\n"} {"task_id": "HumanEval/48", "prompt": "Instruction: Checks if given string is a palindrome\n>>> is_palindrome('')\nTrue\n>>> is_palindrome('aba')\nTrue\n>>> is_palindrome('aaaaa')\nTrue\n>>> is_palindrome('zbcd')\nFalse\nResponse:\n```python\ndef is_palindrome(text: str):\n"} {"task_id": "HumanEval/49", "prompt": "Instruction: Return 2^n modulo p (be aware of numerics).\n>>> modp(3, 5)\n3\n>>> modp(1101, 101)\n2\n>>> modp(0, 101)\n1\n>>> modp(3, 11)\n8\n>>> modp(100, 101)\n1\nResponse:\n```python\ndef modp(n: int, p: int):\n"} {"task_id": "HumanEval/50", "prompt": "Instruction: Takes as input string encoded with encode_shift function. Returns decoded string.\nResponse:\n```python\n\ndef encode_shift(s: str):\n \"\"\"\n returns encoded string by shifting every character by 5 in the alphabet.\n \"\"\"\n return \"\".join([chr(((ord(ch) + 5 - ord(\"a\")) % 26) + ord(\"a\")) for ch in s])\n\n\ndef decode_shift(s: str):\n \"\"\"\n takes as input string encoded with encode_shift function. Returns decoded string.\n \"\"\"\n"} {"task_id": "HumanEval/51", "prompt": "Instruction: remove_vowels is a function that takes string and returns string without vowels.\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'\nResponse:\n```python\ndef remove_vowels(text):\n"} {"task_id": "HumanEval/52", "prompt": "Instruction: Return True if all numbers in the list l are below threshold t.\n>>> below_threshold([1, 2, 4, 10], 100)\nTrue\n>>> below_threshold([1, 20, 4, 10], 5)\nFalse\nResponse:\n```python\ndef below_threshold(l: list, t: int):\n"} {"task_id": "HumanEval/53", "prompt": "Instruction: Add two numbers x and y\n>>> add(2, 3)\n5\n>>> add(5, 7)\n12\nResponse:\n```python\ndef add(x: int, y: int):\n"} {"task_id": "HumanEval/54", "prompt": "Instruction: Check if two words have the same characters.\n>>> same_chars('eabcdzzzz', 'dddzzzzzzzddeddabc')\nTrue\n>>> same_chars('abcd', 'dddddddabc')\nTrue\n>>> same_chars('dddddddabc', 'abcd')\nTrue\n>>> same_chars('eabcd', 'dddddddabc')\nFalse\n>>> same_chars('abcd', 'dddddddabce')\nFalse\n>>> same_chars('eabcdzzzz', 'dddzzzzzzzddddabc')\nFalse\nResponse:\n```python\ndef same_chars(s0: str, s1: str):\n"} {"task_id": "HumanEval/55", "prompt": "Instruction: Return n-th Fibonacci number.\n>>> fib(10)\n55\n>>> fib(1)\n1\n>>> fib(8)\n21\nResponse:\n```python\ndef fib(n: int):\n"} {"task_id": "HumanEval/56", "prompt": "Instruction: brackets is a string of \"<\" and \">\".\nreturn True if every opening bracket has a corresponding closing bracket.\n\n>>> correct_bracketing(\"<\")\nFalse\n>>> correct_bracketing(\"<>\")\nTrue\n>>> correct_bracketing(\"<<><>>\")\nTrue\n>>> correct_bracketing(\"><<>\")\nFalse\nResponse:\n```python\ndef correct_bracketing(brackets: str):\n"} {"task_id": "HumanEval/57", "prompt": "Instruction: Return True is list elements are monotonically increasing or decreasing.\n>>> monotonic([1, 2, 4, 20])\nTrue\n>>> monotonic([1, 20, 4, 10])\nFalse\n>>> monotonic([4, 1, 0, -10])\nTrue\nResponse:\n```python\ndef monotonic(l: list):\n"} {"task_id": "HumanEval/58", "prompt": "Instruction: Return sorted unique common elements for two lists.\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]\nResponse:\n```python\ndef common(l1: list, l2: list):\n"} {"task_id": "HumanEval/59", "prompt": "Instruction: Return the largest prime factor of n. Assume n > 1 and is not a prime.\n>>> largest_prime_factor(13195)\n29\n>>> largest_prime_factor(2048)\n2\nResponse:\n```python\ndef largest_prime_factor(n: int):\n"} {"task_id": "HumanEval/60", "prompt": "Instruction: sum_to_n is a function that sums numbers from 1 to n.\n>>> sum_to_n(30)\n465\n>>> sum_to_n(100)\n5050\n>>> sum_to_n(5)\n15\n>>> sum_to_n(10)\n55\n>>> sum_to_n(1)\n1\nResponse:\n```python\ndef sum_to_n(n: int):\n"} {"task_id": "HumanEval/61", "prompt": "Instruction: brackets is a string of \"(\" and \")\".\nreturn True if every opening bracket has a corresponding closing bracket.\n\n>>> correct_bracketing(\"(\")\nFalse\n>>> correct_bracketing(\"()\")\nTrue\n>>> correct_bracketing(\"(()())\")\nTrue\n>>> correct_bracketing(\")(()\")\nFalse\nResponse:\n```python\ndef correct_bracketing(brackets: str):\n"} {"task_id": "HumanEval/62", "prompt": "Instruction: xs represent coefficients of a polynomial.\nxs[0] + xs[1] * x + xs[2] * x^2 + ....\n Return derivative of this polynomial in the same form.\n>>> derivative([3, 1, 2, 4, 5])\n[1, 4, 12, 20]\n>>> derivative([1, 2, 3])\n[2, 6]\nResponse:\n```python\ndef derivative(xs: list):\n"} {"task_id": "HumanEval/63", "prompt": "Instruction: The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:\nfibfib(0) == 0\nfibfib(1) == 0\nfibfib(2) == 1\nfibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3).\nPlease write a function to efficiently compute the n-th element of the fibfib number sequence.\n>>> fibfib(1)\n0\n>>> fibfib(5)\n4\n>>> fibfib(8)\n24\nResponse:\n```python\ndef fibfib(n: int):\n"} {"task_id": "HumanEval/64", "prompt": "Instruction: Write a function vowels_count which takes a string representing\na word as input and returns the number of vowels in the string.\nVowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a\nvowel, but only when it is at the end of the given word.\n\nExample:\n>>> vowels_count(\"abcde\")\n2\n>>> vowels_count(\"ACEDY\")\n3\nResponse:\n```python\nFIX = \"\"\"\nAdd more test cases.\n\"\"\"\n\ndef vowels_count(s):\n \"\"\"Write a function vowels_count which takes a string representing\n a word as input and returns the number of vowels in the string.\n Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a\n vowel, but only when it is at the end of the given word.\n\n Example:\n >>> vowels_count(\"abcde\")\n 2\n >>> vowels_count(\"ACEDY\")\n 3\n \"\"\"\n"} {"task_id": "HumanEval/65", "prompt": "Instruction: Circular shift the digits of the integer x, shift the digits right by shift\nand return the result as a string.\nIf shift > number of digits, return digits reversed.\n>>> circular_shift(12, 1)\n\"21\"\n>>> circular_shift(12, 2)\n\"12\"\nResponse:\n```python\ndef circular_shift(x, shift):\n"} {"task_id": "HumanEval/66", "prompt": "Instruction: Task\nWrite a function that takes a string as input and returns the sum of the upper characters only'\nASCII codes.\n\nExamples:\n digitSum(\"\") => 0\n digitSum(\"abAB\") => 131\n digitSum(\"abcCd\") => 67\n digitSum(\"helloE\") => 69\n digitSum(\"woArBld\") => 131\n digitSum(\"aAaaaXa\") => 153\nResponse:\n```python\ndef digitSum(s):\n"} {"task_id": "HumanEval/67", "prompt": "Instruction: In this task, you will be given a string that represents a number of apples and oranges \nthat are distributed in a basket of fruit this basket contains \napples, oranges, and mango fruits. Given the string that represents the total number of \nthe oranges and apples and an integer that represent the total number of the fruits \nin the basket return the number of the mango fruits in the basket.\nfor examble:\nfruit_distribution(\"5 apples and 6 oranges\", 19) ->19 - 5 - 6 = 8\nfruit_distribution(\"0 apples and 1 oranges\",3) -> 3 - 0 - 1 = 2\nfruit_distribution(\"2 apples and 3 oranges\", 100) -> 100 - 2 - 3 = 95\nfruit_distribution(\"100 apples and 1 oranges\",120) -> 120 - 100 - 1 = 19\nResponse:\n```python\ndef fruit_distribution(s,n):\n"} {"task_id": "HumanEval/68", "prompt": "Instruction: \"Given an array representing a branch of a tree that has non-negative integer nodes\nyour task is to pluck one of the nodes and return it.\nThe plucked node should be the node with the smallest even value.\nIf multiple nodes with the same smallest even value are found return the node that has smallest index.\n\nThe plucked node should be returned in a list, [ smalest_value, its index ],\nIf there are no even values or the given array is empty, return [].\n\nExample 1:\n Input: [4,2,3]\n Output: [2, 1]\n Explanation: 2 has the smallest even value, and 2 has the smallest index.\n\nExample 2:\n Input: [1,2,3]\n Output: [2, 1]\n Explanation: 2 has the smallest even value, and 2 has the smallest index. \n\nExample 3:\n Input: []\n Output: []\n\nExample 4:\n Input: [5, 0, 3, 0, 4, 2]\n Output: [0, 1]\n Explanation: 0 is the smallest value, but there are two zeros,\n so we will choose the first zero, which has the smallest index.\n\nConstraints:\n * 1 <= nodes.length <= 10000\n * 0 <= node.value\nResponse:\n```python\ndef pluck(arr):\n"} {"task_id": "HumanEval/69", "prompt": "Instruction: You are given a non-empty list of positive integers. Return the greatest integer that is greater than \nzero, and has a frequency greater than or equal to the value of the integer itself. \nThe frequency of an integer is the number of times it appears in the list.\nIf no such a value exist, return -1.\nExamples:\n search([4, 1, 2, 2, 3, 1]) == 2\n search([1, 2, 2, 3, 3, 3, 4, 4, 4]) == 3\n search([5, 5, 4, 4, 4]) == -1\nResponse:\n```python\ndef search(lst):\n"} {"task_id": "HumanEval/70", "prompt": "Instruction: Given list of integers, return list in strange order.\nStrange sorting, is when you start with the minimum value,\nthen maximum of the remaining integers, then minimum and so on.\n\nExamples:\nstrange_sort_list([1, 2, 3, 4]) == [1, 4, 2, 3]\nstrange_sort_list([5, 5, 5, 5]) == [5, 5, 5, 5]\nstrange_sort_list([]) == []\nResponse:\n```python\ndef strange_sort_list(lst):\n"} {"task_id": "HumanEval/71", "prompt": "Instruction: Given the lengths of the three sides of a triangle. Return the area of\nthe triangle rounded to 2 decimal points if the three sides form a valid triangle. \nOtherwise return -1\nThree sides make a valid triangle when the sum of any two sides is greater \nthan the third side.\nExample:\ntriangle_area(3, 4, 5) == 6.00\ntriangle_area(1, 2, 10) == -1\nResponse:\n```python\ndef triangle_area(a, b, c):\n"} {"task_id": "HumanEval/72", "prompt": "Instruction: Write a function that returns True if the object q will fly, and False otherwise.\nThe object q will fly if it's balanced (it is a palindromic list) and the sum of its elements is less than or equal the maximum possible weight w.\n\nExample:\nwill_it_fly([1, 2], 5) \u279e False \n# 1+2 is less than the maximum possible weight, but it's unbalanced.\n\nwill_it_fly([3, 2, 3], 1) \u279e False\n# it's balanced, but 3+2+3 is more than the maximum possible weight.\n\nwill_it_fly([3, 2, 3], 9) \u279e True\n# 3+2+3 is less than the maximum possible weight, and it's balanced.\n\nwill_it_fly([3], 5) \u279e True\n# 3 is less than the maximum possible weight, and it's balanced.\nResponse:\n```python\ndef will_it_fly(q,w):\n"} {"task_id": "HumanEval/73", "prompt": "Instruction: Given an array arr of integers, find the minimum number of elements that\nneed to be changed to make the array palindromic. A palindromic array is an array that\nis read the same backwards and forwards. In one change, you can change one element to any other element.\n\nFor example:\nsmallest_change([1,2,3,5,4,7,9,6]) == 4\nsmallest_change([1, 2, 3, 4, 3, 2, 2]) == 1\nsmallest_change([1, 2, 3, 2, 1]) == 0\nResponse:\n```python\ndef smallest_change(arr):\n"} {"task_id": "HumanEval/74", "prompt": "Instruction: Write a function that accepts two lists of strings and returns the list that has \ntotal number of chars in the all strings of the list less than the other list.\n\nif the two lists have the same number of chars, return the first list.\n\nExamples\ntotal_match([], []) \u279e []\ntotal_match(['hi', 'admin'], ['hI', 'Hi']) \u279e ['hI', 'Hi']\ntotal_match(['hi', 'admin'], ['hi', 'hi', 'admin', 'project']) \u279e ['hi', 'admin']\ntotal_match(['hi', 'admin'], ['hI', 'hi', 'hi']) \u279e ['hI', 'hi', 'hi']\ntotal_match(['4'], ['1', '2', '3', '4', '5']) \u279e ['4']\nResponse:\n```python\ndef total_match(lst1, lst2):\n"} {"task_id": "HumanEval/75", "prompt": "Instruction: Write a function that returns true if the given number is the multiplication of 3 prime numbers\nand false otherwise.\nKnowing that (a) is less then 100. \nExample:\nis_multiply_prime(30) == True\n30 = 2 * 3 * 5\nResponse:\n```python\ndef is_multiply_prime(a):\n"} {"task_id": "HumanEval/76", "prompt": "Instruction: Your task is to write a function that returns true if a number x is a simple\npower of n and false in other cases.\nx is a simple power of n if n**int=x\nFor example:\nis_simple_power(1, 4) => true\nis_simple_power(2, 2) => true\nis_simple_power(8, 2) => true\nis_simple_power(3, 2) => false\nis_simple_power(3, 1) => false\nis_simple_power(5, 3) => false\nResponse:\n```python\ndef is_simple_power(x, n):\n"} {"task_id": "HumanEval/77", "prompt": "Instruction: Write a function that takes an integer a and returns True \nif this ingeger is a cube of some integer number.\nNote: you may assume the input is always valid.\nExamples:\niscube(1) ==> True\niscube(2) ==> False\niscube(-1) ==> True\niscube(64) ==> True\niscube(0) ==> True\niscube(180) ==> False\nResponse:\n```python\ndef iscube(a):\n"} {"task_id": "HumanEval/78", "prompt": "Instruction: You have been tasked to write a function that receives \na hexadecimal number as a string and counts the number of hexadecimal \ndigits that are primes (prime number, or a prime, is a natural number \ngreater than 1 that is not a product of two smaller natural numbers).\nHexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.\nPrime numbers are 2, 3, 5, 7, 11, 13, 17,...\nSo you have to determine a number of the following digits: 2, 3, 5, 7, \nB (=decimal 11), D (=decimal 13).\nNote: you may assume the input is always correct or empty string, \nand symbols A,B,C,D,E,F are always uppercase.\nExamples:\nFor num = \"AB\" the output should be 1.\nFor num = \"1077E\" the output should be 2.\nFor num = \"ABED1A33\" the output should be 4.\nFor num = \"123456789ABCDEF0\" the output should be 6.\nFor num = \"2020\" the output should be 2.\nResponse:\n```python\ndef hex_key(num):\n"} {"task_id": "HumanEval/79", "prompt": "Instruction: You will be given a number in decimal form and your task is to convert it to\nbinary format. The function should return a string, with each character representing a binary\nnumber. Each character in the string will be '0' or '1'.\n\nThere will be an extra couple of characters 'db' at the beginning and at the end of the string.\nThe extra characters are there to help with the format.\n\nExamples:\ndecimal_to_binary(15) # returns \"db1111db\"\ndecimal_to_binary(32) # returns \"db100000db\"\nResponse:\n```python\ndef decimal_to_binary(decimal):\n"} {"task_id": "HumanEval/80", "prompt": "Instruction: You are given a string s.\nYour task is to check if the string is happy or not.\nA string is happy if its length is at least 3 and every 3 consecutive letters are distinct\nFor example:\nis_happy(a) => False\nis_happy(aa) => False\nis_happy(abcd) => True\nis_happy(aabb) => False\nis_happy(adb) => True\nis_happy(xyy) => False\nResponse:\n```python\ndef is_happy(s):\n"} {"task_id": "HumanEval/81", "prompt": "Instruction: It is the last week of the semester and the teacher has to give the grades\nto students. The teacher has been making her own algorithm for grading.\nThe only problem is, she has lost the code she used for grading.\nShe has given you a list of GPAs for some students and you have to write \na function that can output a list of letter grades using the following table:\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\nExample:\ngrade_equation([4.0, 3, 1.7, 2, 3.5]) ==> ['A+', 'B', 'C-', 'C', 'A-']\nResponse:\n```python\ndef numerical_letter_grade(grades):\n"} {"task_id": "HumanEval/82", "prompt": "Instruction: Write a function that takes a string and returns True if the string\nlength is a prime number or False otherwise\nExamples\nprime_length('Hello') == True\nprime_length('abcdcba') == True\nprime_length('kittens') == True\nprime_length('orange') == False\nResponse:\n```python\ndef prime_length(string):\n"} {"task_id": "HumanEval/83", "prompt": "Instruction: Given a positive integer n, return the count of the numbers of n-digit\npositive integers that start or end with 1.\nResponse:\n```python\ndef starts_one_ends(n):\n"} {"task_id": "HumanEval/84", "prompt": "Instruction: Given a positive integer N, return the total sum of its digits in binary.\n\nExample\n For N = 1000, the sum of digits will be 1 the output should be \"1\".\n For N = 150, the sum of digits will be 6 the output should be \"110\".\n For N = 147, the sum of digits will be 12 the output should be \"1100\".\n\nVariables:\n @N integer\n Constraints: 0 \u2264 N \u2264 10000.\nOutput:\n a string of binary number\nResponse:\n```python\ndef solve(N):\n"} {"task_id": "HumanEval/85", "prompt": "Instruction: Given a non-empty list of integers lst. add the even elements that are at odd indices..\n\n\nExamples:\n add([4, 2, 6, 7]) ==> 2\nResponse:\n```python\ndef add(lst):\n"} {"task_id": "HumanEval/86", "prompt": "Instruction: Write a function that takes a string and returns an ordered version of it.\nOrdered version of string, is a string where all words (separated by space)\nare replaced by a new word where all the characters arranged in\nascending order based on ascii value.\nNote: You should keep the order of words and blank spaces in the sentence.\n\nFor example:\nanti_shuffle('Hi') returns 'Hi'\nanti_shuffle('hello') returns 'ehllo'\nanti_shuffle('Hello World!!!') returns 'Hello !!!Wdlor'\nResponse:\n```python\ndef anti_shuffle(s):\n"} {"task_id": "HumanEval/87", "prompt": "Instruction: You are given a 2 dimensional data, as a nested lists,\nwhich is similar to matrix, however, unlike matrices,\neach row may contain a different number of columns.\nGiven lst, and integer x, find integers x in the list,\nand return list of tuples, [(x1, y1), (x2, y2) ...] such that\neach tuple is a coordinate - (row, columns), starting with 0.\nSort coordinates initially by rows in ascending order.\nAlso, sort coordinates of the row by columns in descending order.\n\nExamples:\nget_row([\n [1,2,3,4,5,6],\n [1,2,3,4,1,6],\n [1,2,3,4,5,1]\n], 1) == [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]\nget_row([], 1) == []\nget_row([[], [1], [1, 2, 3]], 3) == [(2, 2)]\nResponse:\n```python\ndef get_row(lst, x):\n"} {"task_id": "HumanEval/88", "prompt": "Instruction: Given an array of non-negative integers, return a copy of the given array after sorting,\nyou will sort the given array in ascending order if the sum( first index value, last index value) is odd,\nor sort it in descending order if the sum( first index value, last index value) is even.\n\nNote:\n* don't change the given array.\n\nExamples:\n* sort_array([]) => []\n* sort_array([5]) => [5]\n* sort_array([2, 4, 3, 0, 1, 5]) => [0, 1, 2, 3, 4, 5]\n* sort_array([2, 4, 3, 0, 1, 5, 6]) => [6, 5, 4, 3, 2, 1, 0]\nResponse:\n```python\ndef sort_array(array):\n"} {"task_id": "HumanEval/89", "prompt": "Instruction: Create a function encrypt that takes a string as an argument and\nreturns a string encrypted with the alphabet being rotated. \nThe alphabet should be rotated in a manner such that the letters \nshift down by two multiplied to two places.\nFor example:\nencrypt('hi') returns 'lm'\nencrypt('asdfghjkl') returns 'ewhjklnop'\nencrypt('gf') returns 'kj'\nencrypt('et') returns 'ix'\nResponse:\n```python\ndef encrypt(s):\n"} {"task_id": "HumanEval/90", "prompt": "Instruction: You are given a list of integers.\nWrite a function next_smallest() that returns the 2nd smallest element of the list.\nReturn None if there is no such element.\n\nnext_smallest([1, 2, 3, 4, 5]) == 2\nnext_smallest([5, 1, 4, 3, 2]) == 2\nnext_smallest([]) == None\nnext_smallest([1, 1]) == None\nResponse:\n```python\ndef next_smallest(lst):\n"} {"task_id": "HumanEval/91", "prompt": "Instruction: You'll be given a string of words, and your task is to count the number\nof boredoms. A boredom is a sentence that starts with the word \"I\".\nSentences are delimited by '.', '?' or '!'.\n \nFor example:\n>>> is_bored(\"Hello world\")\n0\n>>> is_bored(\"The sky is blue. The sun is shining. I love this weather\")\n1\nResponse:\n```python\ndef is_bored(S):\n"} {"task_id": "HumanEval/92", "prompt": "Instruction: Create a function that takes 3 numbers.\nReturns true if one of the numbers is equal to the sum of the other two, and all numbers are integers.\nReturns false in any other cases.\n\nExamples\nany_int(5, 2, 7) \u279e True\n\nany_int(3, 2, 2) \u279e False\n\nany_int(3, -2, 1) \u279e True\n\nany_int(3.6, -2.2, 2) \u279e False\nResponse:\n```python\ndef any_int(x, y, z):\n"} {"task_id": "HumanEval/93", "prompt": "Instruction: Write a function that takes a message, and encodes in such a \nway that it swaps case of all letters, replaces all vowels in \nthe message with the letter that appears 2 places ahead of that \nvowel in the english alphabet. \nAssume only letters. \n\nExamples:\n>>> encode('test')\n'TGST'\n>>> encode('This is a message')\n'tHKS KS C MGSSCGG'\nResponse:\n```python\ndef encode(message):\n"} {"task_id": "HumanEval/94", "prompt": "Instruction: You are given a list of integers.\nYou need to find the largest prime value and return the sum of its digits.\n\nExamples:\nFor lst = [0,3,2,1,3,5,7,4,5,5,5,2,181,32,4,32,3,2,32,324,4,3] the output should be 10\nFor lst = [1,0,1,8,2,4597,2,1,3,40,1,2,1,2,4,2,5,1] the output should be 25\nFor lst = [1,3,1,32,5107,34,83278,109,163,23,2323,32,30,1,9,3] the output should be 13\nFor lst = [0,724,32,71,99,32,6,0,5,91,83,0,5,6] the output should be 11\nFor lst = [0,81,12,3,1,21] the output should be 3\nFor lst = [0,8,1,2,1,7] the output should be 7\nResponse:\n```python\ndef skjkasdkd(lst):\n"} {"task_id": "HumanEval/95", "prompt": "Instruction: Given a dictionary, return True if all keys are strings in lower \ncase or all keys are strings in upper case, else return False.\nThe function should return False is the given dictionary is empty.\nExamples:\ncheck_dict_case({\"a\":\"apple\", \"b\":\"banana\"}) should return True.\ncheck_dict_case({\"a\":\"apple\", \"A\":\"banana\", \"B\":\"banana\"}) should return False.\ncheck_dict_case({\"a\":\"apple\", 8:\"banana\", \"a\":\"apple\"}) should return False.\ncheck_dict_case({\"Name\":\"John\", \"Age\":\"36\", \"City\":\"Houston\"}) should return False.\ncheck_dict_case({\"STATE\":\"NC\", \"ZIP\":\"12345\" }) should return True.\nResponse:\n```python\ndef check_dict_case(dict):\n"} {"task_id": "HumanEval/96", "prompt": "Instruction: Implement a function that takes an non-negative integer and returns an array of the first n\nintegers that are prime numbers and less than n.\nfor example:\ncount_up_to(5) => [2,3]\ncount_up_to(11) => [2,3,5,7]\ncount_up_to(0) => []\ncount_up_to(20) => [2,3,5,7,11,13,17,19]\ncount_up_to(1) => []\ncount_up_to(18) => [2,3,5,7,11,13,17]\nResponse:\n```python\ndef count_up_to(n):\n"} {"task_id": "HumanEval/97", "prompt": "Instruction: Complete the function that takes two integers and returns \nthe product of their unit digits.\nAssume the input is always valid.\nExamples:\nmultiply(148, 412) should return 16.\nmultiply(19, 28) should return 72.\nmultiply(2020, 1851) should return 0.\nmultiply(14,-15) should return 20.\nResponse:\n```python\ndef multiply(a, b):\n"} {"task_id": "HumanEval/98", "prompt": "Instruction: Given a string s, count the number of uppercase vowels in even indices.\n\nFor example:\ncount_upper('aBCdEf') returns 1\ncount_upper('abcdefg') returns 0\ncount_upper('dBBE') returns 0\nResponse:\n```python\ndef count_upper(s):\n"} {"task_id": "HumanEval/99", "prompt": "Instruction: Create a function that takes a value (string) representing a number\nand returns the closest integer to it. If the number is equidistant\nfrom two integers, round it away from zero.\n\nExamples\n>>> closest_integer(\"10\")\n10\n>>> closest_integer(\"15.3\")\n15\n\nNote:\nRounding away from zero means that if the given number is equidistant\nfrom two integers, the one you should return is the one that is the\nfarthest from zero. For example closest_integer(\"14.5\") should\nreturn 15 and closest_integer(\"-14.5\") should return -15.\nResponse:\n```python\ndef closest_integer(value):\n"} {"task_id": "HumanEval/100", "prompt": "Instruction: Given a positive integer n, you have to make a pile of n levels of stones.\nThe first level has n stones.\nThe number of stones in the next level is:\n - the next odd number if n is odd.\n - the next even number if n is even.\nReturn the number of stones in each level in a list, where element at index\ni represents the number of stones in the level (i+1).\n\nExamples:\n>>> make_a_pile(3)\n[3, 5, 7]\nResponse:\n```python\ndef make_a_pile(n):\n"} {"task_id": "HumanEval/101", "prompt": "Instruction: You will be given a string of words separated by commas or spaces. Your task is\nto split the string into words and return an array of the words.\n\nFor example:\nwords_string(\"Hi, my name is John\") == [\"Hi\", \"my\", \"name\", \"is\", \"John\"]\nwords_string(\"One, two, three, four, five, six\") == [\"One\", \"two\", \"three\", \"four\", \"five\", \"six\"]\nResponse:\n```python\ndef words_string(s):\n"} {"task_id": "HumanEval/102", "prompt": "Instruction: This function takes two positive numbers x and y and returns the\nbiggest even integer number that is in the range [x, y] inclusive. If \nthere's no such number, then the function should return -1.\n\nFor example:\nchoose_num(12, 15) = 14\nchoose_num(13, 12) = -1\nResponse:\n```python\ndef choose_num(x, y):\n"} {"task_id": "HumanEval/103", "prompt": "Instruction: You are given two positive integers n and m, and your task is to compute the\naverage of the integers from n through m (including n and m). \nRound the answer to the nearest integer and convert that to binary.\nIf n is greater than m, return -1.\nExample:\nrounded_avg(1, 5) => \"0b11\"\nrounded_avg(7, 5) => -1\nrounded_avg(10, 20) => \"0b1111\"\nrounded_avg(20, 33) => \"0b11010\"\nResponse:\n```python\ndef rounded_avg(n, m):\n"} {"task_id": "HumanEval/104", "prompt": "Instruction: Given a list of positive integers x. return a sorted list of all \nelements that hasn't any even digit.\n\nNote: Returned list should be sorted in increasing order.\n\nFor example:\n>>> unique_digits([15, 33, 1422, 1])\n[1, 15, 33]\n>>> unique_digits([152, 323, 1422, 10])\n[]\nResponse:\n```python\ndef unique_digits(x):\n"} {"task_id": "HumanEval/105", "prompt": "Instruction: Given an array of integers, sort the integers that are between 1 and 9 inclusive,\nreverse the resulting array, and then replace each digit by its corresponding name from\n\"One\", \"Two\", \"Three\", \"Four\", \"Five\", \"Six\", \"Seven\", \"Eight\", \"Nine\".\n\nFor example:\n arr = [2, 1, 1, 4, 5, 8, 2, 3] \n -> sort arr -> [1, 1, 2, 2, 3, 4, 5, 8] \n -> reverse arr -> [8, 5, 4, 3, 2, 2, 1, 1]\n return [\"Eight\", \"Five\", \"Four\", \"Three\", \"Two\", \"Two\", \"One\", \"One\"]\n\n If the array is empty, return an empty array:\n arr = []\n return []\n\n If the array has any strange number ignore it:\n arr = [1, -1 , 55] \n -> sort arr -> [-1, 1, 55]\n -> reverse arr -> [55, 1, -1]\n return = ['One']\nResponse:\n```python\ndef by_length(arr):\n"} {"task_id": "HumanEval/106", "prompt": "Instruction: Implement the function f that takes n as a parameter,\nand returns a list of size n, such that the value of the element at index i is the factorial of i if i is even\nor the sum of numbers from 1 to i otherwise.\ni starts from 1.\nthe factorial of i is the multiplication of the numbers from 1 to i (1 * 2 * ... * i).\nExample:\nf(5) == [1, 2, 6, 24, 15]\nResponse:\n```python\ndef f(n):\n"} {"task_id": "HumanEval/107", "prompt": "Instruction: Given a positive integer n, return a tuple that has the number of even and odd\ninteger palindromes that fall within the range(1, n), inclusive.\n\nExample 1:\n\n Input: 3\n Output: (1, 2)\n Explanation:\n Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd.\n\nExample 2:\n\n Input: 12\n Output: (4, 6)\n Explanation:\n Integer palindrome are 1, 2, 3, 4, 5, 6, 7, 8, 9, 11. four of them are even, and 6 of them are odd.\n\nNote:\n 1. 1 <= n <= 10^3\n 2. returned tuple has the number of even and odd integer palindromes respectively.\nResponse:\n```python\ndef even_odd_palindrome(n):\n"} {"task_id": "HumanEval/108", "prompt": "Instruction: Write a function count_nums which takes an array of integers and returns\nthe number of elements which has a sum of digits > 0.\nIf a number is negative, then its first signed digit will be negative:\ne.g. -123 has signed digits -1, 2, and 3.\n>>> count_nums([]) == 0\n>>> count_nums([-1, 11, -11]) == 1\n>>> count_nums([1, 1, 2]) == 3\nResponse:\n```python\ndef count_nums(arr):\n"} {"task_id": "HumanEval/109", "prompt": "Instruction: We have an array 'arr' of N integers arr[1], arr[2], ..., arr[N].The\nnumbers in the array will be randomly ordered. Your task is to determine if\nit is possible to get an array sorted in non-decreasing order by performing \nthe following operation on the given array:\n You are allowed to perform right shift operation any number of times.\n\nOne right shift operation means shifting all elements of the array by one\nposition in the right direction. The last element of the array will be moved to\nthe starting position in the array i.e. 0th index. \n\nIf it is possible to obtain the sorted array by performing the above operation\nthen return True else return False.\nIf the given array is empty then return True.\n\nNote: The given list is guaranteed to have unique elements.\n\nFor Example:\n\nmove_one_ball([3, 4, 5, 1, 2])==>True\nExplanation: By performin 2 right shift operations, non-decreasing order can\n be achieved for the given array.\nmove_one_ball([3, 5, 4, 1, 2])==>False\nExplanation:It is not possible to get non-decreasing order for the given\n array by performing any number of right shift operations.\nResponse:\n```python\ndef move_one_ball(arr):\n"} {"task_id": "HumanEval/110", "prompt": "Instruction: In this problem, you will implement a function that takes two lists of numbers,\nand determines whether it is possible to perform an exchange of elements\nbetween them to make lst1 a list of only even numbers.\nThere is no limit on the number of exchanged elements between lst1 and lst2.\nIf it is possible to exchange elements between the lst1 and lst2 to make\nall the elements of lst1 to be even, return \"YES\".\nOtherwise, return \"NO\".\nFor example:\nexchange([1, 2, 3, 4], [1, 2, 3, 4]) => \"YES\"\nexchange([1, 2, 3, 4], [1, 5, 3, 4]) => \"NO\"\nIt is assumed that the input lists will be non-empty.\nResponse:\n```python\ndef exchange(lst1, lst2):\n"} {"task_id": "HumanEval/111", "prompt": "Instruction: Given a string representing a space separated lowercase letters, return a dictionary\nof the letter with the most repetition and containing the corresponding count.\nIf several letters have the same occurrence, return all of them.\n\nExample:\nhistogram('a b c') == {'a': 1, 'b': 1, 'c': 1}\nhistogram('a b b a') == {'a': 2, 'b': 2}\nhistogram('a b c a b') == {'a': 2, 'b': 2}\nhistogram('b b b b a') == {'b': 4}\nhistogram('') == {}\nResponse:\n```python\ndef histogram(test):\n"} {"task_id": "HumanEval/112", "prompt": "Instruction: Task\nWe are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c\nthen check if the result string is palindrome.\nA string is called palindrome if it reads the same backward as forward.\nYou should return a tuple containing the result string and True/False for the check.\nExample\nFor s = \"abcde\", c = \"ae\", the result should be ('bcd',False)\nFor s = \"abcdef\", c = \"b\" the result should be ('acdef',False)\nFor s = \"abcdedcba\", c = \"ab\", the result should be ('cdedc',True)\nResponse:\n```python\ndef reverse_delete(s,c):\n"} {"task_id": "HumanEval/113", "prompt": "Instruction: Given a list of strings, where each string consists of only digits, return a list.\nEach element i of the output should be \"the number of odd elements in the\nstring i of the input.\" where all the i's should be replaced by the number\nof odd digits in the i'th 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.\"]\nResponse:\n```python\ndef odd_count(lst):\n"} {"task_id": "HumanEval/114", "prompt": "Instruction: Given an array of integers nums, find the minimum sum of any non-empty sub-array\nof nums.\nExample\nminSubArraySum([2, 3, 4, 1, 2, 4]) == 1\nminSubArraySum([-1, -2, -3]) == -6\nResponse:\n```python\ndef minSubArraySum(nums):\n"} {"task_id": "HumanEval/115", "prompt": "Instruction: You are given a rectangular grid of wells. Each row represents a single well,\nand each 1 in a row represents a single unit of water.\nEach well has a corresponding bucket that can be used to extract water from it, \nand all buckets have the same capacity.\nYour task is to use the buckets to empty the wells.\nOutput the number of times you need to lower the buckets.\n\nExample 1:\n Input: \n grid : [[0,0,1,0], [0,1,0,0], [1,1,1,1]]\n bucket_capacity : 1\n Output: 6\n\nExample 2:\n Input: \n grid : [[0,0,1,1], [0,0,0,0], [1,1,1,1], [0,1,1,1]]\n bucket_capacity : 2\n Output: 5\n\nExample 3:\n Input: \n grid : [[0,0,0], [0,0,0]]\n bucket_capacity : 5\n Output: 0\n\nConstraints:\n * all wells have the same length\n * 1 <= grid.length <= 10^2\n * 1 <= grid[:,1].length <= 10^2\n * grid[i][j] -> 0 | 1\n * 1 <= capacity <= 10\nResponse:\n```python\ndef max_fill(grid, capacity):\n import math\n"} {"task_id": "HumanEval/116", "prompt": "Instruction: In this Kata, you have to sort an array of non-negative integers according to\nnumber of ones in their binary representation in ascending order.\nFor similar number of ones, sort based on decimal value.\n\nIt must be implemented like this:\n>>> sort_array([1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5]\n>>> sort_array([-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2]\n>>> sort_array([1, 0, 2, 3, 4]) [0, 1, 2, 3, 4]\nResponse:\n```python\ndef sort_array(arr):\n"} {"task_id": "HumanEval/117", "prompt": "Instruction: Given a string s and a natural number n, you have been tasked to implement \na function that returns a list of all words from string s that contain exactly \nn consonants, in order these words appear in the string s.\nIf the string s is empty then the function should return an empty list.\nNote: you may assume the input string contains only letters and spaces.\nExamples:\nselect_words(\"Mary had a little lamb\", 4) ==> [\"little\"]\nselect_words(\"Mary had a little lamb\", 3) ==> [\"Mary\", \"lamb\"]\nselect_words(\"simple white space\", 2) ==> []\nselect_words(\"Hello world\", 4) ==> [\"world\"]\nselect_words(\"Uncle sam\", 3) ==> [\"Uncle\"]\nResponse:\n```python\ndef select_words(s, n):\n"} {"task_id": "HumanEval/118", "prompt": "Instruction: You are given a word. Your task is to find the closest vowel that stands between \ntwo consonants from the right side of the word (case sensitive).\n\nVowels in the beginning and ending doesn't count. Return empty string if you didn't\nfind any vowel met the above condition. \n\nYou may assume that the given string contains English letter only.\n\nExample:\nget_closest_vowel(\"yogurt\") ==> \"u\"\nget_closest_vowel(\"FULL\") ==> \"U\"\nget_closest_vowel(\"quick\") ==> \"\"\nget_closest_vowel(\"ab\") ==> \"\"\nResponse:\n```python\ndef get_closest_vowel(word):\n"} {"task_id": "HumanEval/119", "prompt": "Instruction: You are given a list of two strings, both strings consist of open\nparentheses '(' or close parentheses ')' only.\nYour job is to check if it is possible to concatenate the two strings in\nsome order, that the resulting string will be good.\nA string S is considered to be good if and only if all parentheses in S\nare balanced. For example: the string '(())()' is good, while the string\n'())' is not.\nReturn 'Yes' if there's a way to make a good string, and return 'No' otherwise.\n\nExamples:\nmatch_parens(['()(', ')']) == 'Yes'\nmatch_parens([')', ')']) == 'No'\nResponse:\n```python\ndef match_parens(lst):\n"} {"task_id": "HumanEval/120", "prompt": "Instruction: Given an array arr of integers and a positive integer k, return a sorted list \nof length k with the maximum k numbers in arr.\n\nExample 1:\n\n Input: arr = [-3, -4, 5], k = 3\n Output: [-4, -3, 5]\n\nExample 2:\n\n Input: arr = [4, -4, 4], k = 2\n Output: [4, 4]\n\nExample 3:\n\n Input: arr = [-3, 2, 1, 2, -1, -2, 1], k = 1\n Output: [2]\n\nNote:\n 1. The length of the array will be in the range of [1, 1000].\n 2. The elements in the array will be in the range of [-1000, 1000].\n 3. 0 <= k <= len(arr)\nResponse:\n```python\ndef maximum(arr, k):\n"} {"task_id": "HumanEval/121", "prompt": "Instruction: Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions.\n\n\nExamples\nsolution([5, 8, 7, 1]) ==> 12\nsolution([3, 3, 3, 3, 3]) ==> 9\nsolution([30, 13, 24, 321]) ==>0\nResponse:\n```python\ndef solution(lst):\n"} {"task_id": "HumanEval/122", "prompt": "Instruction: Given a non-empty array of integers arr and an integer k, return\nthe sum of the elements with at most two digits from the first k elements of arr.\n\nExample:\n\n Input: arr = [111,21,3,4000,5,6,7,8,9], k = 4\n Output: 24 # sum of 21 + 3\n\nConstraints:\n 1. 1 <= len(arr) <= 100\n 2. 1 <= k <= len(arr)\nResponse:\n```python\ndef add_elements(arr, k):\n"} {"task_id": "HumanEval/123", "prompt": "Instruction: Given a positive integer n, return a sorted list that has the odd numbers in collatz sequence.\n\nThe Collatz conjecture is a conjecture in mathematics that concerns a sequence defined\nas follows: start with any positive integer n. Then each term is obtained from the \nprevious term as follows: if the previous term is even, the next term is one half of \nthe previous term. If the previous term is odd, the next term is 3 times the previous\nterm plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.\n\nNote: \n 1. Collatz(1) is [1].\n 2. returned list sorted in increasing order.\n\nFor example:\nget_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5.\nResponse:\n```python\ndef get_odd_collatz(n):\n"} {"task_id": "HumanEval/124", "prompt": "Instruction: You have to write a function which validates a given date string and\nreturns True if the date is valid otherwise False.\nThe date is valid if all of the following rules are satisfied:\n1. The date string is not empty.\n2. The number of days is not less than 1 or higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2.\n3. The months should not be less than 1 or higher than 12.\n4. The date should be in the format: mm-dd-yyyy\n\nfor example: \nvalid_date('03-11-2000') => True\n\nvalid_date('15-01-2012') => False\n\nvalid_date('04-0-2040') => False\n\nvalid_date('06-04-2020') => True\n\nvalid_date('06/04/2020') => False\nResponse:\n```python\ndef valid_date(date):\n"} {"task_id": "HumanEval/125", "prompt": "Instruction: Given a string of words, return a list of words split on whitespace, if no whitespaces exists in the text you\nshould split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the\nalphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25\nExamples\nsplit_words(\"Hello world!\") \u279e [\"Hello\", \"world!\"]\nsplit_words(\"Hello,world!\") \u279e [\"Hello\", \"world!\"]\nsplit_words(\"abcdef\") == 3\nResponse:\n```python\ndef split_words(txt):\n"} {"task_id": "HumanEval/126", "prompt": "Instruction: Given a list of numbers, return whether or not they are sorted\nin ascending order. If list has more than 1 duplicate of the same\nnumber, return False. Assume no negative numbers and only integers.\n\nExamples\nis_sorted([5]) \u279e True\nis_sorted([1, 2, 3, 4, 5]) \u279e True\nis_sorted([1, 3, 2, 4, 5]) \u279e False\nis_sorted([1, 2, 3, 4, 5, 6]) \u279e True\nis_sorted([1, 2, 3, 4, 5, 6, 7]) \u279e True\nis_sorted([1, 3, 2, 4, 5, 6, 7]) \u279e False\nis_sorted([1, 2, 2, 3, 3, 4]) \u279e True\nis_sorted([1, 2, 2, 2, 3, 4]) \u279e False\nResponse:\n```python\ndef is_sorted(lst):\n"} {"task_id": "HumanEval/127", "prompt": "Instruction: You are given two intervals,\nwhere each interval is a pair of integers. For example, interval = (start, end) = (1, 2).\nThe given intervals are closed which means that the interval (start, end)\nincludes both start and end.\nFor each given interval, it is assumed that its start is less or equal its end.\nYour task is to determine whether the length of intersection of these two \nintervals is a prime number.\nExample, the intersection of the intervals (1, 3), (2, 4) is (2, 3)\nwhich its length is 1, which not a prime number.\nIf the length of the intersection is a prime number, return \"YES\",\notherwise, return \"NO\".\nIf the two intervals don't intersect, return \"NO\".\n\n\n[input/output] samples:\nintersection((1, 2), (2, 3)) ==> \"NO\"\nintersection((-1, 1), (0, 4)) ==> \"NO\"\nintersection((-3, -1), (-5, 5)) ==> \"YES\"\nResponse:\n```python\ndef intersection(interval1, interval2):\n"} {"task_id": "HumanEval/128", "prompt": "Instruction: You are given an array arr of integers and you need to return\nsum of magnitudes of integers multiplied by product of all signs\nof each number in the array, represented by 1, -1 or 0.\nNote: return None for empty arr.\n\nExample:\n>>> prod_signs([1, 2, 2, -4]) == -9\n>>> prod_signs([0, 1]) == 0\n>>> prod_signs([]) == None\nResponse:\n```python\ndef prod_signs(arr):\n"} {"task_id": "HumanEval/129", "prompt": "Instruction: Given a grid with N rows and N columns (N >= 2) and a positive integer k, \neach cell of the grid contains a value. Every integer in the range [1, N * N]\ninclusive appears exactly once on the cells of the grid.\n\nYou have to find the minimum path of length k in the grid. You can start\nfrom any cell, and in each step you can move to any of the neighbor cells,\nin other words, you can go to cells which share an edge with you current\ncell.\nPlease note that a path of length k means visiting exactly k cells (not\nnecessarily distinct).\nYou CANNOT go off the grid.\nA path A (of length k) is considered less than a path B (of length k) if\nafter making the ordered lists of the values on the cells that A and B go\nthrough (let's call them lst_A and lst_B), lst_A is lexicographically less\nthan lst_B, in other words, there exist an integer index i (1 <= i <= k)\nsuch that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have\nlst_A[j] = lst_B[j].\nIt is guaranteed that the answer is unique.\nReturn an ordered list of the values on the cells that the minimum path go through.\n\nExamples:\n\n Input: grid = [ [1,2,3], [4,5,6], [7,8,9]], k = 3\n Output: [1, 2, 1]\n\n Input: grid = [ [5,9,3], [4,1,6], [7,8,2]], k = 1\n Output: [1]\nResponse:\n```python\ndef minPath(grid, k):\n"} {"task_id": "HumanEval/130", "prompt": "Instruction: Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in \nthe last couple centuries. However, what people don't know is Tribonacci sequence.\nTribonacci sequence is defined by the recurrence:\ntri(1) = 3\ntri(n) = 1 + n / 2, if n is even.\ntri(n) = tri(n - 1) + tri(n - 2) + tri(n + 1), if n is odd.\nFor example:\ntri(2) = 1 + (2 / 2) = 2\ntri(4) = 3\ntri(3) = tri(2) + tri(1) + tri(4)\n = 2 + 3 + 3 = 8 \nYou are given a non-negative integer number n, you have to a return a list of the \nfirst n + 1 numbers of the Tribonacci sequence.\nExamples:\ntri(3) = [1, 3, 2, 8]\nResponse:\n```python\ndef tri(n):\n"} {"task_id": "HumanEval/131", "prompt": "Instruction: Given a positive integer n, return the product of the odd digits.\nReturn 0 if all digits are even.\nFor example:\ndigits(1) == 1\ndigits(4) == 0\ndigits(235) == 15\nResponse:\n```python\ndef digits(n):\n"} {"task_id": "HumanEval/132", "prompt": "Instruction: Create a function that takes a string as input which contains only square brackets.\nThe function should return True if and only if there is a valid subsequence of brackets \nwhere at least one bracket in the subsequence is nested.\n\nis_nested('[[]]') \u279e True\nis_nested('[]]]]]]][[[[[]') \u279e False\nis_nested('[][]') \u279e False\nis_nested('[]') \u279e False\nis_nested('[[][]]') \u279e True\nis_nested('[[]][[') \u279e True\nResponse:\n```python\ndef is_nested(string):\n"} {"task_id": "HumanEval/133", "prompt": "Instruction: You are given a list of numbers.\nYou need to return the sum of squared numbers in the given list,\nround each element in the list to the upper int(Ceiling) first.\nExamples:\nFor lst = [1,2,3] the output should be 14\nFor lst = [1,4,9] the output should be 98\nFor lst = [1,3,5,7] the output should be 84\nFor lst = [1.4,4.2,0] the output should be 29\nFor lst = [-2.4,1,1] the output should be 6\nResponse:\n```python\ndef sum_squares(lst):\n"} {"task_id": "HumanEval/134", "prompt": "Instruction: Create a function that returns True if the last character\nof a given string is an alphabetical character and is not\na part of a word, and False otherwise.\nNote: \"word\" is a group of characters separated by space.\n\nExamples:\ncheck_if_last_char_is_a_letter(\"apple pie\") \u279e False\ncheck_if_last_char_is_a_letter(\"apple pi e\") \u279e True\ncheck_if_last_char_is_a_letter(\"apple pi e \") \u279e False\ncheck_if_last_char_is_a_letter(\"\") \u279e False\nResponse:\n```python\ndef check_if_last_char_is_a_letter(txt):\n"} {"task_id": "HumanEval/135", "prompt": "Instruction: Create a function which returns the largest index of an element which\nis not greater than or equal to the element immediately preceding it. If\nno such element exists then return -1. The given array will not contain\nduplicate values.\n\nExamples:\ncan_arrange([1,2,4,3,5]) = 3\ncan_arrange([1,2,3]) = -1\nResponse:\n```python\ndef can_arrange(arr):\n"} {"task_id": "HumanEval/136", "prompt": "Instruction: Create a function that returns a tuple (a, b), where 'a' is\nthe largest of negative integers, and 'b' is the smallest\nof positive integers in a list.\nIf there is no negative or positive integers, return them as None.\n\nExamples:\nlargest_smallest_integers([2, 4, 1, 3, 5, 7]) == (None, 1)\nlargest_smallest_integers([]) == (None, None)\nlargest_smallest_integers([0]) == (None, None)\nResponse:\n```python\ndef largest_smallest_integers(lst):\n"} {"task_id": "HumanEval/137", "prompt": "Instruction: Create a function that takes integers, floats, or strings representing\nreal numbers, and returns the larger variable in its given variable type.\nReturn None if the values are equal.\nNote: If a real number is represented as a string, the floating point might be . or ,\n\ncompare_one(1, 2.5) \u279e 2.5\ncompare_one(1, \"2,3\") \u279e \"2,3\"\ncompare_one(\"5,1\", \"6\") \u279e \"6\"\ncompare_one(\"1\", 1) \u279e None\nResponse:\n```python\ndef compare_one(a, b):\n"} {"task_id": "HumanEval/138", "prompt": "Instruction: Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers\nExample\nis_equal_to_sum_even(4) == False\nis_equal_to_sum_even(6) == False\nis_equal_to_sum_even(8) == True\nResponse:\n```python\ndef is_equal_to_sum_even(n):\n"} {"task_id": "HumanEval/139", "prompt": "Instruction: The Brazilian factorial is defined as:\nbrazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!\nwhere n > 0\n\nFor example:\n>>> special_factorial(4)\n288\n\nThe function will receive an integer as input and should return the special\nfactorial of this integer.\nResponse:\n```python\ndef special_factorial(n):\n"} {"task_id": "HumanEval/140", "prompt": "Instruction: Given a string text, replace all spaces in it with underscores, \nand if a string has more than 2 consecutive spaces, \nthen replace all consecutive spaces with - \n\nfix_spaces(\"Example\") == \"Example\"\nfix_spaces(\"Example 1\") == \"Example_1\"\nfix_spaces(\" Example 2\") == \"_Example_2\"\nfix_spaces(\" Example 3\") == \"_Example-3\"\nResponse:\n```python\ndef fix_spaces(text):\n"} {"task_id": "HumanEval/141", "prompt": "Instruction: Create a function which takes a string representing a file's name, and returns\n'Yes' if the the file's name is valid, and returns 'No' otherwise.\nA file's name is considered to be valid if and only if all the following conditions \nare met:\n- There should not be more than three digits ('0'-'9') in the file's name.\n- The file's name contains exactly one dot '.'\n- The substring before the dot should not be empty, and it starts with a letter from \nthe latin alphapet ('a'-'z' and 'A'-'Z').\n- The substring after the dot should be one of these: ['txt', 'exe', 'dll']\nExamples:\nfile_name_check(\"example.txt\") # => 'Yes'\nfile_name_check(\"1example.dll\") # => 'No' (the name should start with a latin alphapet letter)\nResponse:\n```python\ndef file_name_check(file_name):\n"} {"task_id": "HumanEval/142", "prompt": "Instruction: \"\nThis function will take a list of integers. For all entries in the list, the function shall square the integer entry if its index is a \nmultiple of 3 and will cube the integer entry if its index is a multiple of 4 and not a multiple of 3. The function will not \nchange the entries in the list whose indexes are not a multiple of 3 or 4. The function shall then return the sum of all entries. \n\nExamples:\nFor lst = [1,2,3] the output should be 6\nFor lst = [] the output should be 0\nFor lst = [-1,-5,2,-1,-5] the output should be -126\nResponse:\n```python\ndef sum_squares(lst):\n"} {"task_id": "HumanEval/143", "prompt": "Instruction: You are given a string representing a sentence,\nthe sentence contains some words separated by a space,\nand you have to return a string that contains the words from the original sentence,\nwhose lengths are prime numbers,\nthe order of the words in the new string should be the same as the original one.\n\nExample 1:\n Input: sentence = \"This is a test\"\n Output: \"is\"\n\nExample 2:\n Input: sentence = \"lets go for swimming\"\n Output: \"go for\"\n\nConstraints:\n * 1 <= len(sentence) <= 100\n * sentence contains only letters\nResponse:\n```python\ndef words_in_sentence(sentence):\n"} {"task_id": "HumanEval/144", "prompt": "Instruction: Your task is to implement a function that will simplify the expression\nx * n. The function returns True if x * n evaluates to a whole number and False\notherwise. Both x and n, are string representation of a fraction, and have the following format,\n/ where both numerator and denominator are positive whole numbers.\n\nYou can assume that x, and n are valid fractions, and do not have zero as denominator.\n\nsimplify(\"1/5\", \"5/1\") = True\nsimplify(\"1/6\", \"2/1\") = False\nsimplify(\"7/10\", \"10/2\") = False\nResponse:\n```python\ndef simplify(x, n):\n"} {"task_id": "HumanEval/145", "prompt": "Instruction: Write a function which sorts the given list of integers\nin ascending order according to the sum of their digits.\nNote: if there are several items with similar sum of their digits,\norder them based on their index in original list.\n\nFor example:\n>>> order_by_points([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]\n>>> order_by_points([]) == []\nResponse:\n```python\ndef order_by_points(nums):\n"} {"task_id": "HumanEval/146", "prompt": "Instruction: Write a function that takes an array of numbers as input and returns \nthe number of elements in the array that are greater than 10 and both \nfirst and last digits of a number are odd (1, 3, 5, 7, 9).\nFor example:\nspecialFilter([15, -73, 14, -15]) => 1 \nspecialFilter([33, -2, -3, 45, 21, 109]) => 2\nResponse:\n```python\ndef specialFilter(nums):\n"} {"task_id": "HumanEval/147", "prompt": "Instruction: You are given a positive integer n. You have to create an integer array a of length n.\n For each i (1 \u2264 i \u2264 n), the value of a[i] = i * i - i + 1.\n Return the number of triples (a[i], a[j], a[k]) of a where i < j < k, \nand a[i] + a[j] + a[k] is a multiple of 3.\n\nExample :\n Input: n = 5\n Output: 1\n Explanation: \n a = [1, 3, 7, 13, 21]\n The only valid triple is (1, 7, 13).\nResponse:\n```python\ndef get_max_triples(n):\n"} {"task_id": "HumanEval/148", "prompt": "Instruction: There are eight planets in our solar system: the closerst to the Sun \nis Mercury, the next one is Venus, then Earth, Mars, Jupiter, Saturn, \nUranus, Neptune.\nWrite a function that takes two planet names as strings planet1 and planet2. \nThe function should return a tuple containing all planets whose orbits are \nlocated between the orbit of planet1 and the orbit of planet2, sorted by \nthe proximity to the sun. \nThe function should return an empty tuple if planet1 or planet2\nare not correct planet names. \nExamples\nbf(\"Jupiter\", \"Neptune\") ==> (\"Saturn\", \"Uranus\")\nbf(\"Earth\", \"Mercury\") ==> (\"Venus\")\nbf(\"Mercury\", \"Uranus\") ==> (\"Venus\", \"Earth\", \"Mars\", \"Jupiter\", \"Saturn\")\nResponse:\n```python\ndef bf(planet1, planet2):\n"} {"task_id": "HumanEval/149", "prompt": "Instruction: Write a function that accepts a list of strings as a parameter,\ndeletes the strings that have odd lengths from it,\nand returns the resulted list with a sorted order,\nThe list is always a list of strings and never an array of numbers,\nand it may contain duplicates.\nThe order of the list should be ascending by length of each word, and you\nshould return the list sorted by that rule.\nIf two words have the same length, sort the list alphabetically.\nThe function should return a list of strings in sorted order.\nYou may assume that all words will have the same length.\nFor example:\nassert list_sort([\"aa\", \"a\", \"aaa\"]) => [\"aa\"]\nassert list_sort([\"ab\", \"a\", \"aaa\", \"cd\"]) => [\"ab\", \"cd\"]\nResponse:\n```python\ndef sorted_list_sum(lst):\n"} {"task_id": "HumanEval/150", "prompt": "Instruction: A simple program which should return the value of x if n is \na prime number and should return the value of y otherwise.\n\nExamples:\nfor x_or_y(7, 34, 12) == 34\nfor x_or_y(15, 8, 5) == 5\nResponse:\n```python\ndef x_or_y(n, x, y):\n"} {"task_id": "HumanEval/151", "prompt": "Instruction: Given a list of numbers, return the sum of squares of the numbers\nin the list that are odd. Ignore numbers that are negative or not integers.\n\ndouble_the_difference([1, 3, 2, 0]) == 1 + 9 + 0 + 0 = 10\ndouble_the_difference([-1, -2, 0]) == 0\ndouble_the_difference([9, -2]) == 81\ndouble_the_difference([0]) == 0 \n \nIf the input list is empty, return 0.\nResponse:\n```python\ndef double_the_difference(lst):\n"} {"task_id": "HumanEval/152", "prompt": "Instruction: I think we all remember that feeling when the result of some long-awaited\nevent is finally known. The feelings and thoughts you have at that moment are\ndefinitely worth noting down and comparing.\nYour task is to determine if a person correctly guessed the results of a number of matches.\nYou are given two arrays of scores and guesses of equal length, where each index shows a match. \nReturn an array of the same length denoting how far off each guess was. If they have guessed correctly,\nthe value is 0, and if not, the value is the absolute difference between the guess and the score.\n\n\nexample:\n\ncompare([1,2,3,4,5,1],[1,2,3,4,2,-2]) -> [0,0,0,0,3,3]\ncompare([0,5,0,0,0,4],[4,1,1,0,0,-2]) -> [4,4,1,0,0,6]\nResponse:\n```python\ndef compare(game,guess):\n"} {"task_id": "HumanEval/153", "prompt": "Instruction: You will be given the name of a class (a string) and a list of extensions.\nThe extensions are to be used to load additional classes to the class. The\nstrength of the extension is as follows: Let CAP be the number of the uppercase\nletters in the extension's name, and let SM be the number of lowercase letters \nin the extension's name, the strength is given by the fraction CAP - SM. \nYou should find the strongest extension and return a string in this \nformat: ClassName.StrongestExtensionName.\nIf there are two or more extensions with the same strength, you should\nchoose the one that comes first in the list.\nFor example, if you are given \"Slices\" as the class and a list of the\nextensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should\nreturn 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension \n(its strength is -1).\nExample:\nfor Strongest_Extension('my_class', ['AA', 'Be', 'CC']) == 'my_class.AA'\nResponse:\n```python\ndef Strongest_Extension(class_name, extensions):\n"} {"task_id": "HumanEval/154", "prompt": "Instruction: You are given 2 words. You need to return True if the second word or any of its rotations is a substring in the first word\ncycpattern_check(\"abcd\",\"abd\") => False\ncycpattern_check(\"hello\",\"ell\") => True\ncycpattern_check(\"whassup\",\"psus\") => False\ncycpattern_check(\"abab\",\"baa\") => True\ncycpattern_check(\"efef\",\"eeff\") => False\ncycpattern_check(\"himenss\",\"simen\") => True\nResponse:\n```python\ndef cycpattern_check(a , b):\n"} {"task_id": "HumanEval/155", "prompt": "Instruction: Given an integer. return a tuple that has the number of even and odd digits respectively.\n\n Example:\n even_odd_count(-12) ==> (1, 1)\n even_odd_count(123) ==> (1, 2)\nResponse:\n```python\ndef even_odd_count(num):\n"} {"task_id": "HumanEval/156", "prompt": "Instruction: Given a positive integer, obtain its roman numeral equivalent as a string,\nand return it in lowercase.\nRestrictions: 1 <= num <= 1000\n\nExamples:\n>>> int_to_mini_roman(19) == 'xix'\n>>> int_to_mini_roman(152) == 'clii'\n>>> int_to_mini_roman(426) == 'cdxxvi'\nResponse:\n```python\ndef int_to_mini_roman(number):\n"} {"task_id": "HumanEval/157", "prompt": "Instruction: Given the lengths of the three sides of a triangle. Return True if the three\nsides form a right-angled triangle, False otherwise.\nA right-angled triangle is a triangle in which one angle is right angle or \n90 degree.\nExample:\nright_angle_triangle(3, 4, 5) == True\nright_angle_triangle(1, 2, 3) == False\nResponse:\n```python\ndef right_angle_triangle(a, b, c):\n"} {"task_id": "HumanEval/158", "prompt": "Instruction: Write a function that accepts a list of strings.\nThe list contains different words. Return the word with maximum number\nof unique characters. If multiple strings have maximum number of unique\ncharacters, return the one which comes first in lexicographical order.\n\nfind_max([\"name\", \"of\", \"string\"]) == \"string\"\nfind_max([\"name\", \"enam\", \"game\"]) == \"enam\"\nfind_max([\"aaaaaaa\", \"bb\" ,\"cc\"]) == \"\"aaaaaaa\"\nResponse:\n```python\ndef find_max(words):\n"} {"task_id": "HumanEval/159", "prompt": "Instruction: You're a hungry rabbit, and you already have eaten a certain number of carrots,\nbut now you need to eat more carrots to complete the day's meals.\nyou should return an array of [ total number of eaten carrots after your meals,\n the number of carrots left after your meals ]\nif there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.\n\nExample:\n* eat(5, 6, 10) -> [11, 4]\n* eat(4, 8, 9) -> [12, 1]\n* eat(1, 10, 10) -> [11, 0]\n* eat(2, 11, 5) -> [7, 0]\n\nVariables:\n@number : integer\n the number of carrots that you have eaten.\n@need : integer\n the number of carrots that you need to eat.\n@remaining : integer\n the number of remaining carrots thet exist in stock\n\nConstrain:\n* 0 <= number <= 1000\n* 0 <= need <= 1000\n* 0 <= remaining <= 1000\n\nHave fun :)\nResponse:\n```python\ndef eat(number, need, remaining):\n"} {"task_id": "HumanEval/160", "prompt": "Instruction: Given two lists operator, and operand. The first list has basic algebra operations, and \nthe second list is a list of integers. Use the two given lists to build the algebric \nexpression and return the evaluation of this expression.\n\nThe basic algebra operations:\nAddition ( + ) \nSubtraction ( - ) \nMultiplication ( * ) \nFloor division ( // ) \nExponentiation ( ** ) \n\nExample:\noperator['+', '*', '-']\narray = [2, 3, 4, 5]\nresult = 2 + 3 * 4 - 5\n=> result = 9\n\nNote:\n The length of operator list is equal to the length of operand list minus one.\n Operand is a list of of non-negative integers.\n Operator list has at least one operator, and operand list has at least two operands.\nResponse:\n```python\ndef do_algebra(operator, operand):\n"} {"task_id": "HumanEval/161", "prompt": "Instruction: You are given a string s.\nif s[i] is a letter, reverse its case from lower to upper or vise versa, \notherwise keep it as it is.\nIf the string contains no letters, reverse the string.\nThe function should return the resulted string.\nExamples\nsolve(\"1234\") = \"4321\"\nsolve(\"ab\") = \"AB\"\nsolve(\"#a@C\") = \"#A@c\"\nResponse:\n```python\ndef solve(s):\n"} {"task_id": "HumanEval/162", "prompt": "Instruction: Given a string 'text', return its md5 hash equivalent string.\nIf 'text' is an empty string, return None.\n\n>>> string_to_md5('Hello world') == '3e25960a79dbc69b674cd4ec67a72c62'\nResponse:\n```python\ndef string_to_md5(text):\n"} {"task_id": "HumanEval/163", "prompt": "Instruction: Given two positive integers a and b, return the even digits between a\nand b, in ascending order.\n\nFor example:\ngenerate_integers(2, 8) => [2, 4, 6, 8]\ngenerate_integers(8, 2) => [2, 4, 6, 8]\ngenerate_integers(10, 14) => []\nResponse:\n```python\ndef generate_integers(a, b):\n"}