task_id
stringlengths
11
13
messages
listlengths
1
1
HumanEval/0
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\nfrom typing import List\n\n\ndef has_close_elements(numbers: List[float], threshold: float) -> bool:\n \"\"\" Check if in given list of numbers, are any two numbers closer to ea...
HumanEval/1
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\nfrom typing import List\n\n\ndef separate_paren_groups(paren_string: str) -> List[str]:\n \"\"\" Input to this function is a string containing multiple groups of nested parenthe...
HumanEval/2
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef truncate_number(number: float) -> float:\n \"\"\" Given a positive floating point number, it can be decomposed into\n and integer part (largest integer smaller than given...
HumanEval/3
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\nfrom typing import List\n\n\ndef below_zero(operations: List[int]) -> bool:\n \"\"\" You're given a list of deposit and withdrawal operations on a bank account that starts with\...
HumanEval/4
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\nfrom typing import List\n\n\ndef mean_absolute_deviation(numbers: List[float]) -> float:\n \"\"\" For a given list of input numbers, calculate Mean Absolute Deviation\n aroun...
HumanEval/5
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\nfrom typing import List\n\n\ndef intersperse(numbers: List[int], delimeter: int) -> List[int]:\n \"\"\" Insert a number 'delimeter' between every two consecutive elements of inp...
HumanEval/6
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\nfrom typing import List\n\n\ndef parse_nested_parens(paren_string: str) -> List[int]:\n \"\"\" Input to this function is a string represented multiple groups for nested parenthe...
HumanEval/7
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\nfrom typing import List\n\n\ndef filter_by_substring(strings: List[str], substring: str) -> List[str]:\n \"\"\" Filter an input list of strings only for ones that contain given ...
HumanEval/8
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\nfrom typing import List, Tuple\n\n\ndef sum_product(numbers: List[int]) -> Tuple[int, int]:\n \"\"\" For a given list of integers, return a tuple consisting of a sum and a produ...
HumanEval/9
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\nfrom typing import List, Tuple\n\n\ndef rolling_max(numbers: List[int]) -> List[int]:\n \"\"\" From a given list of integers, generate a list of rolling maximum element found un...
HumanEval/10
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\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 ...
HumanEval/11
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\nfrom typing import List\n\n\ndef string_xor(a: str, b: str) -> str:\n \"\"\" Input are two strings a and b consisting only of 1s and 0s.\n Perform binary XOR on these inputs ...
HumanEval/12
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\nfrom typing import List, Optional\n\n\ndef longest(strings: List[str]) -> Optional[str]:\n \"\"\" Out of list of strings, return the longest one. Return the first one in case of...
HumanEval/13
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef greatest_common_divisor(a: int, b: int) -> int:\n \"\"\" Return a greatest common divisor of two integers a and b\n >>> greatest_common_divisor(3, 5)\n 1\n >>> grea...
HumanEval/14
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\nfrom typing import List\n\n\ndef all_prefixes(string: str) -> List[str]:\n \"\"\" Return list of all prefixes from shortest to longest of the input string\n >>> all_prefixes(...
HumanEval/15
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef string_sequence(n: int) -> str:\n \"\"\" Return a string containing space-delimited numbers starting from 0 upto n inclusive.\n >>> string_sequence(0)\n '0'\n >>> s...
HumanEval/16
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef count_distinct_characters(string: str) -> int:\n \"\"\" Given a string, find out how many distinct characters (regardless of case) does it consist of\n >>> count_distinct...
HumanEval/17
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\nfrom typing import List\n\n\ndef parse_music(music_string: str) -> List[int]:\n \"\"\" Input to this function is a string representing musical notes in a special ASCII format.\n...
HumanEval/18
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef how_many_times(string: str, substring: str) -> int:\n \"\"\" Find how many times a given substring can be found in the original string. Count overlaping cases.\n >>> how_...
HumanEval/19
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\nfrom typing import List\n\n\ndef sort_numbers(numbers: str) -> str:\n \"\"\" Input is a space-delimited string of numberals from 'zero' to 'nine'.\n Valid choices are 'zero',...
HumanEval/20
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\nfrom typing import List, Tuple\n\n\ndef find_closest_elements(numbers: List[float]) -> Tuple[float, float]:\n \"\"\" From a supplied list of numbers (of length at least two) sel...
HumanEval/21
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\nfrom typing import List\n\n\ndef rescale_to_unit(numbers: List[float]) -> List[float]:\n \"\"\" Given list of numbers (of at least two elements), apply a linear transform to tha...
HumanEval/22
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\nfrom typing import List, Any\n\n\ndef filter_integers(values: List[Any]) -> List[int]:\n \"\"\" Filter given list of any python values only for integers\n >>> filter_integers...
HumanEval/23
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef strlen(string: str) -> int:\n \"\"\" Return length of given string\n >>> strlen('')\n 0\n >>> strlen('abc')\n 3\n \"\"\"\n```", "role": "user" } ]
HumanEval/24
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef largest_divisor(n: int) -> int:\n \"\"\" For a given number n, find the largest number that divides n evenly, smaller than n\n >>> largest_divisor(15)\n 5\n \"\"\"\...
HumanEval/25
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\nfrom typing import List\n\n\ndef factorize(n: int) -> List[int]:\n \"\"\" Return list of prime factors of given integer in the order from smallest to largest.\n Each of the f...
HumanEval/26
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\nfrom typing import List\n\n\ndef remove_duplicates(numbers: List[int]) -> List[int]:\n \"\"\" From a list of integers, remove all elements that occur more than once.\n Keep o...
HumanEval/27
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef flip_case(string: str) -> str:\n \"\"\" For a given string, flip lowercase characters to uppercase and uppercase to lowercase.\n >>> flip_case('Hello')\n 'hELLO'\n ...
HumanEval/28
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\nfrom typing import List\n\n\ndef concatenate(strings: List[str]) -> str:\n \"\"\" Concatenate list of strings into a single string\n >>> concatenate([])\n ''\n >>> conc...
HumanEval/29
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\nfrom typing import List\n\n\ndef filter_by_prefix(strings: List[str], prefix: str) -> List[str]:\n \"\"\" Filter an input list of strings only for ones that start with a given p...
HumanEval/30
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef get_positive(l: list):\n \"\"\"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...
HumanEval/31
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef is_prime(n):\n \"\"\"Return true if a given number is prime, and false otherwise.\n >>> is_prime(6)\n False\n >>> is_prime(101)\n True\n >>> is_prime(11)\n ...
HumanEval/32
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\nimport 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...
HumanEval/33
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef sort_third(l: list):\n \"\"\"This function takes a list l and returns a list l' such that\n l' is identical to l in the indicies that are not divisible by three, while it...
HumanEval/34
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef unique(l: list):\n \"\"\"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]\n \"\"\"\n```", "role": "use...
HumanEval/35
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef max_element(l: list):\n \"\"\"Return maximum element in the list.\n >>> max_element([1, 2, 3])\n 3\n >>> max_element([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])\n 1...
HumanEval/36
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef fizz_buzz(n: int):\n \"\"\"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)\n 0\n >>> fiz...
HumanEval/37
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef sort_even(l: list):\n \"\"\"This function takes a list l and returns a list l' such that\n l' is identical to l in the odd indicies, while its values at the even indicies...
HumanEval/38
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\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 =...
HumanEval/39
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef prime_fib(n: int):\n \"\"\"\n prime_fib returns n-th number that is a Fibonacci number and it's also prime.\n >>> prime_fib(1)\n 2\n >>> prime_fib(2)\n 3\n ...
HumanEval/40
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef triples_sum_to_zero(l: list):\n \"\"\"\n triples_sum_to_zero takes a list of integers as an input.\n it returns True if there are three distinct elements in the list t...
HumanEval/41
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef car_race_collision(n: int):\n \"\"\"\n Imagine a road that's a perfectly straight infinitely long line.\n n cars are driving left to right; simultaneously, a differen...
HumanEval/42
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef incr_list(l: list):\n \"\"\"Return list with elements incremented by 1.\n >>> incr_list([1, 2, 3])\n [2, 3, 4]\n >>> incr_list([5, 3, 5, 2, 3, 3, 9, 0, 123])\n [...
HumanEval/43
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef pairs_sum_to_zero(l):\n \"\"\"\n pairs_sum_to_zero takes a list of integers as an input.\n it returns True if there are two distinct elements in the list that\n sum...
HumanEval/44
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef change_base(x: int, base: int):\n \"\"\"Change numerical base of input number x to base.\n return string representation after the conversion.\n base numbers are less t...
HumanEval/45
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef triangle_area(a, h):\n \"\"\"Given length of a side and high return area for a triangle.\n >>> triangle_area(5, 3)\n 7.5\n \"\"\"\n```", "role": "user" } ]
HumanEval/46
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef fib4(n: int):\n \"\"\"The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:\n fib4(0) -> 0\n fib4(1) -> 0\n fib4(2) -...
HumanEval/47
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef median(l: list):\n \"\"\"Return median of elements in the list l.\n >>> median([3, 1, 2, 4, 5])\n 3\n >>> median([-10, 4, 6, 1000, 10, 20])\n 15.0\n \"\"\"\n`...
HumanEval/48
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef is_palindrome(text: str):\n \"\"\"\n Checks if given string is a palindrome\n >>> is_palindrome('')\n True\n >>> is_palindrome('aba')\n True\n >>> is_palin...
HumanEval/49
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef modp(n: int, p: int):\n \"\"\"Return 2^n modulo p (be aware of numerics).\n >>> modp(3, 5)\n 3\n >>> modp(1101, 101)\n 2\n >>> modp(0, 101)\n 1\n >>> mo...
HumanEval/50
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\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\"...
HumanEval/51
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef remove_vowels(text):\n \"\"\"\n remove_vowels is a function that takes string and returns string without vowels.\n >>> remove_vowels('')\n ''\n >>> remove_vowels...
HumanEval/52
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef below_threshold(l: list, t: int):\n \"\"\"Return True if all numbers in the list l are below threshold t.\n >>> below_threshold([1, 2, 4, 10], 100)\n True\n >>> bel...
HumanEval/53
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef add(x: int, y: int):\n \"\"\"Add two numbers x and y\n >>> add(2, 3)\n 5\n >>> add(5, 7)\n 12\n \"\"\"\n```", "role": "user" } ]
HumanEval/54
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef same_chars(s0: str, s1: str):\n \"\"\"\n Check if two words have the same characters.\n >>> same_chars('eabcdzzzz', 'dddzzzzzzzddeddabc')\n True\n >>> same_chars...
HumanEval/55
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef fib(n: int):\n \"\"\"Return n-th Fibonacci number.\n >>> fib(10)\n 55\n >>> fib(1)\n 1\n >>> fib(8)\n 21\n \"\"\"\n```", "role": "user" } ]
HumanEval/56
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef correct_bracketing(brackets: str):\n \"\"\" brackets is a string of \"<\" and \">\".\n return True if every opening bracket has a corresponding closing bracket.\n\n >>...
HumanEval/57
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef monotonic(l: list):\n \"\"\"Return True is list elements are monotonically increasing or decreasing.\n >>> monotonic([1, 2, 4, 20])\n True\n >>> monotonic([1, 20, 4...
HumanEval/58
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef common(l1: list, l2: list):\n \"\"\"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]...
HumanEval/59
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef largest_prime_factor(n: int):\n \"\"\"Return the largest prime factor of n. Assume n > 1 and is not a prime.\n >>> largest_prime_factor(13195)\n 29\n >>> largest_pr...
HumanEval/60
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef sum_to_n(n: int):\n \"\"\"sum_to_n is a function that sums numbers from 1 to n.\n >>> sum_to_n(30)\n 465\n >>> sum_to_n(100)\n 5050\n >>> sum_to_n(5)\n 15\...
HumanEval/61
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef correct_bracketing(brackets: str):\n \"\"\" brackets is a string of \"(\" and \")\".\n return True if every opening bracket has a corresponding closing bracket.\n\n >>...
HumanEval/62
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef derivative(xs: list):\n \"\"\" xs represent coefficients of a polynomial.\n xs[0] + xs[1] * x + xs[2] * x^2 + ....\n Return derivative of this polynomial in the same ...
HumanEval/63
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef fibfib(n: int):\n \"\"\"The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:\n fibfib(0) == 0\n fibfib(1) == 0\n f...
HumanEval/64
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\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 n...
HumanEval/65
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef circular_shift(x, shift):\n \"\"\"Circular shift the digits of the integer x, shift the digits right by shift\n and return the result as a string.\n If shift > number ...
HumanEval/66
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef digitSum(s):\n \"\"\"Task\n Write a function that takes a string as input and returns the sum of the upper characters only'\n ASCII codes.\n\n Examples:\n di...
HumanEval/67
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef fruit_distribution(s,n):\n \"\"\"\n In this task, you will be given a string that represents a number of apples and oranges \n that are distributed in a basket of frui...
HumanEval/68
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef pluck(arr):\n \"\"\"\n \"Given an array representing a branch of a tree that has non-negative integer nodes\n your task is to pluck one of the nodes and return it.\n ...
HumanEval/69
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef search(lst):\n '''\n You are given a non-empty list of positive integers. Return the greatest integer that is greater than \n zero, and has a frequency greater than or...
HumanEval/70
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef strange_sort_list(lst):\n '''\n Given list of integers, return list in strange order.\n Strange sorting, is when you start with the minimum value,\n then maximum of...
HumanEval/71
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef triangle_area(a, b, c):\n '''\n Given the lengths of the three sides of a triangle. Return the area of\n the triangle rounded to 2 decimal points if the three sides fo...
HumanEval/72
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef will_it_fly(q,w):\n '''\n Write a function that returns True if the object q will fly, and False otherwise.\n The object q will fly if it's balanced (it is a palindrom...
HumanEval/73
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef smallest_change(arr):\n \"\"\"\n Given an array arr of integers, find the minimum number of elements that\n need to be changed to make the array palindromic. A palindr...
HumanEval/74
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef total_match(lst1, lst2):\n '''\n Write a function that accepts two lists of strings and returns the list that has \n total number of chars in the all strings of the li...
HumanEval/75
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef is_multiply_prime(a):\n \"\"\"Write a function that returns true if the given number is the multiplication of 3 prime numbers\n and false otherwise.\n Knowing that (a)...
HumanEval/76
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef is_simple_power(x, n):\n \"\"\"Your task is to write a function that returns true if a number x is a simple\n power of n and false in other cases.\n x is a simple powe...
HumanEval/77
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef iscube(a):\n '''\n Write a function that takes an integer a and returns True \n if this ingeger is a cube of some integer number.\n Note: you may assume the input i...
HumanEval/78
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef hex_key(num):\n \"\"\"You have been tasked to write a function that receives \n a hexadecimal number as a string and counts the number of hexadecimal \n digits that ar...
HumanEval/79
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef decimal_to_binary(decimal):\n \"\"\"You will be given a number in decimal form and your task is to convert it to\n binary format. The function should return a string, wit...
HumanEval/80
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef is_happy(s):\n \"\"\"You are given a string s.\n Your task is to check if the string is happy or not.\n A string is happy if its length is at least 3 and every 3 conse...
HumanEval/81
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef numerical_letter_grade(grades):\n \"\"\"It is the last week of the semester and the teacher has to give the grades\n to students. The teacher has been making her own algo...
HumanEval/82
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef prime_length(string):\n \"\"\"Write a function that takes a string and returns True if the string\n length is a prime number or False otherwise\n Examples\n prime_l...
HumanEval/83
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef starts_one_ends(n):\n \"\"\"\n Given a positive integer n, return the count of the numbers of n-digit\n positive integers that start or end with 1.\n \"\"\"\n```", ...
HumanEval/84
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef solve(N):\n \"\"\"Given a positive integer N, return the total sum of its digits in binary.\n \n Example\n For N = 1000, the sum of digits will be 1 the output ...
HumanEval/85
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef add(lst):\n \"\"\"Given a non-empty list of integers lst. add the even elements that are at odd indices..\n\n\n Examples:\n add([4, 2, 6, 7]) ==> 2 \n \"\"\"\n`...
HumanEval/86
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef anti_shuffle(s):\n \"\"\"\n Write a function that takes a string and returns an ordered version of it.\n Ordered version of string, is a string where all words (separa...
HumanEval/87
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef get_row(lst, x):\n \"\"\"\n You are given a 2 dimensional data, as a nested lists,\n which is similar to matrix, however, unlike matrices,\n each row may contain a ...
HumanEval/88
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef sort_array(array):\n \"\"\"\n Given an array of non-negative integers, return a copy of the given array after sorting,\n you will sort the given array in ascending ord...
HumanEval/89
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef encrypt(s):\n \"\"\"Create a function encrypt that takes a string as an argument and\n returns a string encrypted with the alphabet being rotated. \n The alphabet shou...
HumanEval/90
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef next_smallest(lst):\n \"\"\"\n You are given a list of integers.\n Write a function next_smallest() that returns the 2nd smallest element of the list.\n Return None...
HumanEval/91
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef is_bored(S):\n \"\"\"\n You'll be given a string of words, and your task is to count the number\n of boredoms. A boredom is a sentence that starts with the word \"I\"....
HumanEval/92
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef any_int(x, y, z):\n '''\n Create a function that takes 3 numbers.\n Returns true if one of the numbers is equal to the sum of the other two, and all numbers are intege...
HumanEval/93
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef encode(message):\n \"\"\"\n Write a function that takes a message, and encodes in such a \n way that it swaps case of all letters, replaces all vowels in \n the mes...
HumanEval/94
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef skjkasdkd(lst):\n \"\"\"You are given a list of integers.\n You need to find the largest prime value and return the sum of its digits.\n\n Examples:\n For lst = [0,...
HumanEval/95
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef check_dict_case(dict):\n \"\"\"\n Given a dictionary, return True if all keys are strings in lower \n case or all keys are strings in upper case, else return False.\n ...
HumanEval/96
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef count_up_to(n):\n \"\"\"Implement a function that takes an non-negative integer and returns an array of the first n\n integers that are prime numbers and less than n.\n ...
HumanEval/97
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef multiply(a, b):\n \"\"\"Complete the function that takes two integers and returns \n the product of their unit digits.\n Assume the input is always valid.\n Example...
HumanEval/98
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef count_upper(s):\n \"\"\"\n Given a string s, count the number of uppercase vowels in even indices.\n \n For example:\n count_upper('aBCdEf') returns 1\n count...
HumanEval/99
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef closest_integer(value):\n '''\n Create a function that takes a value (string) representing a number\n and returns the closest integer to it. If the number is equidista...