task_id
stringlengths
11
13
messages
listlengths
1
1
HumanEval/100
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef make_a_pile(n):\n \"\"\"\n Given a positive integer n, you have to make a pile of n levels of stones.\n The first level has n stones.\n The number of stones in the ...
HumanEval/101
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef words_string(s):\n \"\"\"\n You will be given a string of words separated by commas or spaces. Your task is\n to split the string into words and return an array of the...
HumanEval/102
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef choose_num(x, y):\n \"\"\"This function takes two positive numbers x and y and returns the\n biggest even integer number that is in the range [x, y] inclusive. If \n t...
HumanEval/103
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef rounded_avg(n, m):\n \"\"\"You are given two positive integers n and m, and your task is to compute the\n average of the integers from n through m (including n and m). \n...
HumanEval/104
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef unique_digits(x):\n \"\"\"Given a list of positive integers x. return a sorted list of all \n elements that hasn't any even digit.\n\n Note: Returned list should be so...
HumanEval/105
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef by_length(arr):\n \"\"\"\n Given an array of integers, sort the integers that are between 1 and 9 inclusive,\n reverse the resulting array, and then replace each digit...
HumanEval/106
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef f(n):\n \"\"\" Implement the function f that takes n as a parameter,\n and returns a list of size n, such that the value of the element at index i is the factorial of i i...
HumanEval/107
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef even_odd_palindrome(n):\n \"\"\"\n Given a positive integer n, return a tuple that has the number of even and odd\n integer palindromes that fall within the range(1, n...
HumanEval/108
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef count_nums(arr):\n \"\"\"\n Write a function count_nums which takes an array of integers and returns\n the number of elements which has a sum of digits > 0.\n If a ...
HumanEval/109
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef move_one_ball(arr):\n \"\"\"We have an array 'arr' of N integers arr[1], arr[2], ..., arr[N].The\n numbers in the array will be randomly ordered. Your task is to determin...
HumanEval/110
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef exchange(lst1, lst2):\n \"\"\"In this problem, you will implement a function that takes two lists of numbers,\n and determines whether it is possible to perform an exchan...
HumanEval/111
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef histogram(test):\n \"\"\"Given a string representing a space separated lowercase letters, return a dictionary\n of the letter with the most repetition and containing the ...
HumanEval/112
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef reverse_delete(s,c):\n \"\"\"Task\n We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c\n then check if ...
HumanEval/113
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef odd_count(lst):\n \"\"\"Given a list of strings, where each string consists of only digits, return a list.\n Each element i of the output should be \"the number of odd el...
HumanEval/114
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef minSubArraySum(nums):\n \"\"\"\n Given an array of integers nums, find the minimum sum of any non-empty sub-array\n of nums.\n Example\n minSubArraySum([2, 3, 4,...
HumanEval/115
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\nimport math\n\ndef max_fill(grid, capacity):\n \"\"\"\n You are given a rectangular grid of wells. Each row represents a single well,\n and each 1 in a row represents a si...
HumanEval/116
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef sort_array(arr):\n \"\"\"\n In this Kata, you have to sort an array of non-negative integers according to\n number of ones in their binary representation in ascending ...
HumanEval/117
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef select_words(s, n):\n \"\"\"Given a string s and a natural number n, you have been tasked to implement \n a function that returns a list of all words from string s that c...
HumanEval/118
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef get_closest_vowel(word):\n \"\"\"You are given a word. Your task is to find the closest vowel that stands between \n two consonants from the right side of the word (case ...
HumanEval/119
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef match_parens(lst):\n '''\n You are given a list of two strings, both strings consist of open\n parentheses '(' or close parentheses ')' only.\n Your job is to check...
HumanEval/120
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef maximum(arr, k):\n \"\"\"\n Given an array arr of integers and a positive integer k, return a sorted list \n of length k with the maximum k numbers in arr.\n\n Exam...
HumanEval/121
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef solution(lst):\n \"\"\"Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions.\n \n\n Examples\n solution([5, 8, 7...
HumanEval/122
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef add_elements(arr, k):\n \"\"\"\n Given a non-empty array of integers arr and an integer k, return\n the sum of the elements with at most two digits from the first k el...
HumanEval/123
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef get_odd_collatz(n):\n \"\"\"\n Given a positive integer n, return a sorted list that has the odd numbers in collatz sequence.\n\n The Collatz conjecture is a conjectur...
HumanEval/124
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef valid_date(date):\n \"\"\"You have to write a function which validates a given date string and\n returns True if the date is valid otherwise False.\n The date is valid...
HumanEval/125
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef split_words(txt):\n '''\n Given a string of words, return a list of words split on whitespace, if no whitespaces exists in the text you\n should split on commas ',' if...
HumanEval/126
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef is_sorted(lst):\n '''\n Given a list of numbers, return whether or not they are sorted\n in ascending order. If list has more than 1 duplicate of the same\n number,...
HumanEval/127
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef intersection(interval1, interval2):\n \"\"\"You are given two intervals,\n where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).\n ...
HumanEval/128
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef prod_signs(arr):\n \"\"\"\n You are given an array arr of integers and you need to return\n sum of magnitudes of integers multiplied by product of all signs\n of ea...
HumanEval/129
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef minPath(grid, k):\n \"\"\"\n Given a grid with N rows and N columns (N >= 2) and a positive integer k, \n each cell of the grid contains a value. Every integer in the ...
HumanEval/130
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef tri(n):\n \"\"\"Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in \n the last couple centuries. However, what people don't know is Tribonacci ...
HumanEval/131
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef digits(n):\n \"\"\"Given a positive integer n, return the product of the odd digits.\n Return 0 if all digits are even.\n For example:\n digits(1) == 1\n digits...
HumanEval/132
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef is_nested(string):\n '''\n Create a function that takes a string as input which contains only square brackets.\n The function should return True if and only if there i...
HumanEval/133
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef sum_squares(lst):\n \"\"\"You are given a list of numbers.\n You need to return the sum of squared numbers in the given list,\n round each element in the list to the u...
HumanEval/134
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef check_if_last_char_is_a_letter(txt):\n '''\n Create a function that returns True if the last character\n of a given string is an alphabetical character and is not\n ...
HumanEval/135
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef can_arrange(arr):\n \"\"\"Create a function which returns the largest index of an element which\n is not greater than or equal to the element immediately preceding it. If...
HumanEval/136
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef largest_smallest_integers(lst):\n '''\n Create a function that returns a tuple (a, b), where 'a' is\n the largest of negative integers, and 'b' is the smallest\n of...
HumanEval/137
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef compare_one(a, b):\n \"\"\"\n Create a function that takes integers, floats, or strings representing\n real numbers, and returns the larger variable in its given varia...
HumanEval/138
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef is_equal_to_sum_even(n):\n \"\"\"Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers\n Example\n is_equal_to_sum_even(4) =...
HumanEval/139
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef special_factorial(n):\n \"\"\"The Brazilian factorial is defined as:\n brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!\n where n > 0\n\n For example:\n ...
HumanEval/140
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef fix_spaces(text):\n \"\"\"\n Given a string text, replace all spaces in it with underscores, \n and if a string has more than 2 consecutive spaces, \n then replace ...
HumanEval/141
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef file_name_check(file_name):\n \"\"\"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 'N...
HumanEval/142
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef sum_squares(lst):\n \"\"\"\"\n This 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 \n ...
HumanEval/143
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef words_in_sentence(sentence):\n \"\"\"\n You are given a string representing a sentence,\n the sentence contains some words separated by a space,\n and you have to r...
HumanEval/144
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef simplify(x, n):\n \"\"\"Your task is to implement a function that will simplify the expression\n x * n. The function returns True if x * n evaluates to a whole number and...
HumanEval/145
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef order_by_points(nums):\n \"\"\"\n Write a function which sorts the given list of integers\n in ascending order according to the sum of their digits.\n Note: if ther...
HumanEval/146
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef specialFilter(nums):\n \"\"\"Write a function that takes an array of numbers as input and returns \n the number of elements in the array that are greater than 10 and both...
HumanEval/147
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef get_max_triples(n):\n \"\"\"\n You are given a positive integer n. You have to create an integer array a of length n.\n For each i (1 ≀ i ≀ n), the value of a[i] =...
HumanEval/148
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef bf(planet1, planet2):\n '''\n There are eight planets in our solar system: the closerst to the Sun \n is Mercury, the next one is Venus, then Earth, Mars, Jupiter, Sat...
HumanEval/149
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef sorted_list_sum(lst):\n \"\"\"Write a function that accepts a list of strings as a parameter,\n deletes the strings that have odd lengths from it,\n and returns the re...
HumanEval/150
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef x_or_y(n, x, y):\n \"\"\"A simple program which should return the value of x if n is \n a prime number and should return the value of y otherwise.\n\n Examples:\n f...
HumanEval/151
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef double_the_difference(lst):\n '''\n Given a list of numbers, return the sum of squares of the numbers\n in the list that are odd. Ignore numbers that are negative or n...
HumanEval/152
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef compare(game,guess):\n \"\"\"I think we all remember that feeling when the result of some long-awaited\n event is finally known. The feelings and thoughts you have at tha...
HumanEval/153
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef Strongest_Extension(class_name, extensions):\n \"\"\"You will be given the name of a class (a string) and a list of extensions.\n The extensions are to be used to load ad...
HumanEval/154
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef cycpattern_check(a , b):\n \"\"\"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\n cycpattern_c...
HumanEval/155
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef even_odd_count(num):\n \"\"\"Given an integer. return a tuple that has the number of even and odd digits respectively.\n\n Example:\n even_odd_count(-12) ==> (1, ...
HumanEval/156
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef int_to_mini_roman(number):\n \"\"\"\n Given a positive integer, obtain its roman numeral equivalent as a string,\n and return it in lowercase.\n Restrictions: 1 <= ...
HumanEval/157
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef right_angle_triangle(a, b, c):\n '''\n Given the lengths of the three sides of a triangle. Return True if the three\n sides form a right-angled triangle, False otherwi...
HumanEval/158
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef find_max(words):\n \"\"\"Write a function that accepts a list of strings.\n The list contains different words. Return the word with maximum number\n of unique characte...
HumanEval/159
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef eat(number, need, remaining):\n \"\"\"\n You're a hungry rabbit, and you already have eaten a certain number of carrots,\n but now you need to eat more carrots to comp...
HumanEval/160
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef do_algebra(operator, operand):\n \"\"\"\n Given two lists operator, and operand. The first list has basic algebra operations, and \n the second list is a list of integ...
HumanEval/161
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef solve(s):\n \"\"\"You are given a string s.\n if s[i] is a letter, reverse its case from lower to upper or vise versa, \n otherwise keep it as it is.\n If the strin...
HumanEval/162
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef string_to_md5(text):\n \"\"\"\n Given a string 'text', return its md5 hash equivalent string.\n If 'text' is an empty string, return None.\n\n >>> string_to_md5('He...
HumanEval/163
[ { "content": "Please provide a self-contained Python script that solves the following problem in a markdown code block:\n```python\ndef generate_integers(a, b):\n \"\"\"\n Given two positive integers a and b, return the even digits between a\n and b, in ascending order.\n\n For example:\n generat...