source
stringclasses
1 value
prompt
stringlengths
281
1.53k
ability
stringclasses
1 value
reward_model
dict
starter_code
null
extra_info
dict
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def make_a_pile(n): """ Given a positive integer n, you have to make a pile of n levels of stones. The first level has n stones. The nu...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate(3) == [3, 5, 7], \\\"Test 3\\\"\\n assert candidate(4) == [4,6,8,10], \\\"Test 4\\\"\\n assert candidate(5) == [5, 7, 9, 11, 13]\\n assert candidate(6) == [6, 8, 10, 12, 14, 16]\\n assert ...
null
{ "dataset": "openai_humaneval", "index": 100, "original": "\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 next level is:\n - the next odd number if n is odd.\n - th...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def words_string(s): """ You will be given a string of words separated by commas or spaces. Your task is to split the string into words and...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert True, \\\"This prints if this assert fails 1 (good for debugging!)\\\"\\n assert candidate(\\\"Hi, my name is John\\\") == [\\\"Hi\\\", \\\"my\\\", \\\"name\\\", \\\"is\\\", \\\"John\\\"]\\n assert candid...
null
{ "dataset": "openai_humaneval", "index": 101, "original": "\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 words.\n \n For example:\n words_string(\"Hi, my name is John\...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def choose_num(x, y): """This function takes two positive numbers x and y and returns the biggest even integer number that is in the range [x, ...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate(12, 15) == 14\\n assert candidate(13, 12) == -1\\n assert candidate(33, 12354) == 12354\\n assert candidate(5234, 5233) == -1\\n assert candidate(6, 29) == 28\\n assert candidate(27, 10...
null
{ "dataset": "openai_humaneval", "index": 102, "original": "\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 there's no such number, then the function should return -1.\n\n For ex...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def rounded_avg(n, m): """You are given two positive integers n and m, and your task is to compute the average of the integers from n through m...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate(1, 5) == \\\"0b11\\\"\\n assert candidate(7, 13) == \\\"0b1010\\\"\\n assert candidate(964,977) == \\\"0b1111001010\\\"\\n assert candidate(996,997) == \\\"0b1111100100\\\"\\n assert candi...
null
{ "dataset": "openai_humaneval", "index": 103, "original": "\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 Round the answer to the nearest integer and convert that to binary.\...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def unique_digits(x): """Given a list of positive integers x. return a sorted list of all elements that hasn't any even digit. Note: Retu...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate([15, 33, 1422, 1]) == [1, 15, 33]\\n assert candidate([152, 323, 1422, 10]) == []\\n assert candidate([12345, 2033, 111, 151]) == [111, 151]\\n assert candidate([135, 103, 31]) == [31, 135]\\...
null
{ "dataset": "openai_humaneval", "index": 104, "original": "\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 sorted in increasing order.\n \n For example:\n >>> unique_digits...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def by_length(arr): """ Given an array of integers, sort the integers that are between 1 and 9 inclusive, reverse the resulting array, and ...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert True, \\\"This prints if this assert fails 1 (good for debugging!)\\\"\\n assert candidate([2, 1, 1, 4, 5, 8, 2, 3]) == [\\\"Eight\\\", \\\"Five\\\", \\\"Four\\\", \\\"Three\\\", \\\"Two\\\", \\\"Two\\\", \\...
null
{ "dataset": "openai_humaneval", "index": 105, "original": "\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 by its corresponding name from\n \"One\", \"Two\", \"Three\", \"Four...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def f(n): """ Implement the function f that takes n as a parameter, and returns a list of size n, such that the value of the element at index i...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n assert candidate(5) == [1, 2, 6, 24, 15]\\n assert candidate(7) == [1, 2, 6, 24, 15, 720, 28]\\n assert candidate(1) == [1]\\n assert candidate(3) == [1, 2, 6]\\n\\n\\ncheck(f)\"}", "style": "rule" }
null
{ "dataset": "openai_humaneval", "index": 106, "original": "\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 if i is even\n or the sum of numbers from 1 to i otherwise.\n i sta...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def even_odd_palindrome(n): """ Given a positive integer n, return a tuple that has the number of even and odd integer palindromes that fal...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate(123) == (8, 13)\\n assert candidate(12) == (4, 6)\\n assert candidate(3) == (1, 2)\\n assert candidate(63) == (6, 8)\\n assert candidate(25) == (5, 6)\\n assert candidate(19) == (4, 6)\...
null
{ "dataset": "openai_humaneval", "index": 107, "original": "\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), inclusive.\n\n Example 1:\n\n Input: 3\n Output: (1,...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def count_nums(arr): """ Write a function count_nums which takes an array of integers and returns the number of elements which has a sum of...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate([]) == 0\\n assert candidate([-1, -2, 0]) == 0\\n assert candidate([1, 1, 2, -2, 3, 4, 5]) == 6\\n assert candidate([1, 6, 9, -6, 0, 1, 5]) == 5\\n assert candidate([1, 100, 98, -7, 1, -1]...
null
{ "dataset": "openai_humaneval", "index": 108, "original": "\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 number is negative, then its first signed digit will be negative:\n e...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def move_one_ball(arr): """We have an array 'arr' of N integers arr[1], arr[2], ..., arr[N].The numbers in the array will be randomly ordered. ...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate([3, 4, 5, 1, 2])==True, \\\"This prints if this assert fails 1 (good for debugging!)\\\"\\n assert candidate([3, 5, 10, 1, 2])==True\\n assert candidate([4, 3, 1, 2])==False\\n # Check some e...
null
{ "dataset": "openai_humaneval", "index": 109, "original": "\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 determine if\n it is possible to get an array sorted in non-decreasing order ...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def exchange(lst1, lst2): """In this problem, you will implement a function that takes two lists of numbers, and determines whether it is possi...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate([1, 2, 3, 4], [1, 2, 3, 4]) == \\\"YES\\\"\\n assert candidate([1, 2, 3, 4], [1, 5, 3, 4]) == \\\"NO\\\"\\n assert candidate([1, 2, 3, 4], [2, 1, 4, 3]) == \\\"YES\\\" \\n assert candidate([5...
null
{ "dataset": "openai_humaneval", "index": 110, "original": "\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 exchange of elements\n between them to make lst1 a list of only even number...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def histogram(test): """Given a string representing a space separated lowercase letters, return a dictionary of the letter with the most repeti...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate('a b b a') == {'a':2,'b': 2}, \\\"This prints if this assert fails 1 (good for debugging!)\\\"\\n assert candidate('a b c a b') == {'a': 2, 'b': 2}, \\\"This prints if this assert fails 2 (good for...
null
{ "dataset": "openai_humaneval", "index": 111, "original": "\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 corresponding count.\n If several letters have the same occurrence, r...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def reverse_delete(s,c): """Task We are given two strings s and c, you have to deleted all the characters in s that are equal to any character ...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n assert candidate(\\\"abcde\\\",\\\"ae\\\") == ('bcd',False)\\n assert candidate(\\\"abcdef\\\", \\\"b\\\") == ('acdef',False)\\n assert candidate(\\\"abcdedcba\\\",\\\"ab\\\") == ('cdedc',True)\\n assert candidate(\\\"dwik\\\",\\\"w\\\") ==...
null
{ "dataset": "openai_humaneval", "index": 112, "original": "\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 the result string is palindrome.\n A string is called palindrome if i...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def odd_count(lst): """Given a list of strings, where each string consists of only digits, return a list. Each element i of the output should b...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate(['1234567']) == [\\\"the number of odd elements 4n the str4ng 4 of the 4nput.\\\"], \\\"Test 1\\\"\\n assert candidate(['3',\\\"11111111\\\"]) == [\\\"the number of odd elements 1n the str1ng 1 of ...
null
{ "dataset": "openai_humaneval", "index": 113, "original": "\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 elements in the\n string i of the input.\" where all the i's should be ...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def minSubArraySum(nums): """ Given an array of integers nums, find the minimum sum of any non-empty sub-array of nums. Example min...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate([2, 3, 4, 1, 2, 4]) == 1, \\\"This prints if this assert fails 1 (good for debugging!)\\\"\\n assert candidate([-1, -2, -3]) == -6\\n assert candidate([-1, -2, -3, 2, -10]) == -14\\n assert c...
null
{ "dataset": "openai_humaneval", "index": 114, "original": "\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, 1, 2, 4]) == 1\n minSubArraySum([-1, -2, -3]) == -6\n \"\"\"\n", ...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def max_fill(grid, capacity): import math """ You are given a rectangular grid of wells. Each row represents a single well, and each 1 ...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n\\n # Check some simple cases\\n assert True, \\\"This prints if this assert fails 1 (good for debugging!)\\\"\\n assert candidate([[0,0,1,0], [0,1,0,0], [1,1,1,1]], 1) == 6, \\\"Error\\\"\\n assert candidate([[0,0,1,1], [0,0,0,0], [1,1,1,1]...
null
{ "dataset": "openai_humaneval", "index": 115, "original": "\ndef max_fill(grid, capacity):\n import math\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 single unit of water.\n Each well has a corresponding bucket that can...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def sort_array(arr): """ In this Kata, you have to sort an array of non-negative integers according to number of ones in their binary repre...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert True, \\\"This prints if this assert fails 1 (good for debugging!)\\\"\\n assert candidate([1,5,2,3,4]) == [1, 2, 4, 3, 5]\\n assert candidate([-2,-3,-4,-5,-6]) == [-4, -2, -6, -5, -3]\\n assert candid...
null
{ "dataset": "openai_humaneval", "index": 116, "original": "\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 order.\n For similar number of ones, sort based on decimal value.\n\n...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def select_words(s, n): """Given a string s and a natural number n, you have been tasked to implement a function that returns a list of all wo...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate(\\\"Mary had a little lamb\\\", 4) == [\\\"little\\\"], \\\"First test error: \\\" + str(candidate(\\\"Mary had a little lamb\\\", 4)) \\n assert candidate(\\\"Mary had a little lamb\\\", 3) =...
null
{ "dataset": "openai_humaneval", "index": 117, "original": "\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 contain exactly \n n consonants, in order these words appear in the st...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def get_closest_vowel(word): """You are given a word. Your task is to find the closest vowel that stands between two consonants from the right...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate(\\\"yogurt\\\") == \\\"u\\\"\\n assert candidate(\\\"full\\\") == \\\"u\\\"\\n assert candidate(\\\"easy\\\") == \\\"\\\"\\n assert candidate(\\\"eAsy\\\") == \\\"\\\"\\n assert candidate(...
null
{ "dataset": "openai_humaneval", "index": 118, "original": "\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 sensitive).\n \n Vowels in the beginning and ending doesn't count....
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def match_parens(lst): ''' You are given a list of two strings, both strings consist of open parentheses '(' or close parentheses ')' only....
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate(['()(', ')']) == 'Yes'\\n assert candidate([')', ')']) == 'No'\\n assert candidate(['(()(())', '())())']) == 'No'\\n assert candidate([')())', '(()()(']) == 'Yes'\\n assert candidate(['(()...
null
{ "dataset": "openai_humaneval", "index": 119, "original": "\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 if it is possible to concatenate the two strings in\n some order, th...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def maximum(arr, k): """ Given an array arr of integers and a positive integer k, return a sorted list of length k with the maximum k numb...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate([-3, -4, 5], 3) == [-4, -3, 5]\\n assert candidate([4, -4, 4], 2) == [4, 4]\\n assert candidate([-3, 2, 1, 2, -1, -2, 1], 1) == [2]\\n assert candidate([123, -123, 20, 0 , 1, 2, -3], 3) == [2...
null
{ "dataset": "openai_humaneval", "index": 120, "original": "\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 Example 1:\n\n Input: arr = [-3, -4, 5], k = 3\n Output: [-4, ...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def solution(lst): """Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions. Examples ...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate([5, 8, 7, 1]) == 12\\n assert candidate([3, 3, 3, 3, 3]) == 9\\n assert candidate([30, 13, 24, 321]) == 0\\n assert candidate([5, 9]) == 5\\n assert candidate([2, 4, 8]) == 0\\n asse...
null
{ "dataset": "openai_humaneval", "index": 121, "original": "\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, 1]) ==> 12\n solution([3, 3, 3, 3, 3]) ==> 9\n solution([30, 13,...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def add_elements(arr, k): """ Given a non-empty array of integers arr and an integer k, return the sum of the elements with at most two dig...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate([1,-2,-3,41,57,76,87,88,99], 3) == -4\\n assert candidate([111,121,3,4000,5,6], 2) == 0\\n assert candidate([11,21,3,90,5,6,7,8,9], 4) == 125\\n assert candidate([111,21,3,4000,5,6,7,8,9], 4)...
null
{ "dataset": "openai_humaneval", "index": 122, "original": "\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 elements of arr.\n\n Example:\n\n Input: arr = [111,21,3,4000,5,...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def get_odd_collatz(n): """ Given a positive integer n, return a sorted list that has the odd numbers in collatz sequence. The Collatz con...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate(14) == [1, 5, 7, 11, 13, 17]\\n assert candidate(5) == [1, 5]\\n assert candidate(12) == [1, 3, 5], \\\"This prints if this assert fails 1 (good for debugging!)\\\"\\n\\n # Check some edge ca...
null
{ "dataset": "openai_humaneval", "index": 123, "original": "\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 conjecture in mathematics that concerns a sequence defined\n as follows: start...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def valid_date(date): """You have to write a function which validates a given date string and returns True if the date is valid otherwise False...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate('03-11-2000') == True\\n\\n assert candidate('15-01-2012') == False\\n\\n assert candidate('04-0-2040') == False\\n\\n assert candidate('06-04-2020') == True\\n\\n assert candidate('01-01-...
null
{ "dataset": "openai_humaneval", "index": 124, "original": "\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 if all of the following rules are satisfied:\n 1. The date string is...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def split_words(txt): ''' Given a string of words, return a list of words split on whitespace, if no whitespaces exists in the text you sho...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n assert candidate(\\\"Hello world!\\\") == [\\\"Hello\\\",\\\"world!\\\"]\\n assert candidate(\\\"Hello,world!\\\") == [\\\"Hello\\\",\\\"world!\\\"]\\n assert candidate(\\\"Hello world,!\\\") == [\\\"Hello\\\",\\\"world,!\\\"]\\n assert can...
null
{ "dataset": "openai_humaneval", "index": 125, "original": "\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 no commas exists you should return the number of lower-case letters wit...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def is_sorted(lst): ''' Given a list of numbers, return whether or not they are sorted in ascending order. If list has more than 1 duplicat...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate([5]) == True\\n assert candidate([1, 2, 3, 4, 5]) == True\\n assert candidate([1, 3, 2, 4, 5]) == False\\n assert candidate([1, 2, 3, 4, 5, 6]) == True\\n assert candidate([1, 2, 3, 4, 5, ...
null
{ "dataset": "openai_humaneval", "index": 126, "original": "\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, return False. Assume no negative numbers and only integers.\n\n Exam...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def intersection(interval1, interval2): """You are given two intervals, where each interval is a pair of integers. For example, interval = (sta...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate((1, 2), (2, 3)) == \\\"NO\\\"\\n assert candidate((-1, 1), (0, 4)) == \\\"NO\\\"\\n assert candidate((-3, -1), (-5, 5)) == \\\"YES\\\"\\n assert candidate((-2, 2), (-4, 0)) == \\\"YES\\\"\\n\...
null
{ "dataset": "openai_humaneval", "index": 127, "original": "\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 The given intervals are closed which means that the interval (start, end...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def prod_signs(arr): """ You are given an array arr of integers and you need to return sum of magnitudes of integers multiplied by product ...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert True, \\\"This prints if this assert fails 1 (good for debugging!)\\\"\\n assert candidate([1, 2, 2, -4]) == -9\\n assert candidate([0, 1]) == 0\\n assert candidate([1, 1, 1, 2, 3, -1, 1]) == -10\\n ...
null
{ "dataset": "openai_humaneval", "index": 128, "original": "\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 each number in the array, represented by 1, -1 or 0.\n Note: return Non...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def minPath(grid, k): """ Given a grid with N rows and N columns (N >= 2) and a positive integer k, each cell of the grid contains a value...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n print\\n assert candidate([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 3) == [1, 2, 1]\\n assert candidate([[5, 9, 3], [4, 1, 6], [7, 8, 2]], 1) == [1]\\n assert candidate([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], ...
null
{ "dataset": "openai_humaneval", "index": 129, "original": "\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 range [1, N * N]\n inclusive appears exactly once on the cells of the...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def tri(n): """Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in the last couple centuries. However, what people d...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n \\n assert candidate(3) == [1, 3, 2.0, 8.0]\\n assert candidate(4) == [1, 3, 2.0, 8.0, 3.0]\\n assert candidate(5) == [1, 3, 2.0, 8.0, 3.0, 15.0]\\n assert candidate(6) == [1, 3, 2.0, 8.0, 3.0, 15.0, 4.0]\...
null
{ "dataset": "openai_humaneval", "index": 130, "original": "\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 sequence.\n Tribonacci sequence is defined by the recurrence:\n tr...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def digits(n): """Given a positive integer n, return the product of the odd digits. Return 0 if all digits are even. For example: digit...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate(5) == 5\\n assert candidate(54) == 5\\n assert candidate(120) ==1\\n assert candidate(5014) == 5\\n assert candidate(98765) == 315\\n assert candidate(5576543) == 2625\\n\\n # Check ...
null
{ "dataset": "openai_humaneval", "index": 131, "original": "\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(4) == 0\n digits(235) == 15\n \"\"\"\n", "reference": " pro...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def is_nested(string): ''' Create a function that takes a string as input which contains only square brackets. The function should return T...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate('[[]]') == True, \\\"This prints if this assert fails 1 (good for debugging!)\\\"\\n assert candidate('[]]]]]]][[[[[]') == False\\n assert candidate('[][]') == False\\n assert candidate(('[]'...
null
{ "dataset": "openai_humaneval", "index": 132, "original": "\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 is a valid subsequence of brackets \n where at least one bracket in th...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def sum_squares(lst): """You are given a list of numbers. You need to return the sum of squared numbers in the given list, round each eleme...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate([1,2,3])==14, \\\"This prints if this assert fails 1 (good for debugging!)\\\"\\n assert candidate([1.0,2,3])==14, \\\"This prints if this assert fails 1 (good for debugging!)\\\"\\n assert cand...
null
{ "dataset": "openai_humaneval", "index": 133, "original": "\n\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 upper int(Ceiling) first.\n Examples:\n For lst = [1,2,3] the out...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def check_if_last_char_is_a_letter(txt): ''' Create a function that returns True if the last character of a given string is an alphabetical...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate(\\\"apple\\\") == False\\n assert candidate(\\\"apple pi e\\\") == True\\n assert candidate(\\\"eeeee\\\") == False\\n assert candidate(\\\"A\\\") == True\\n assert candidate(\\\"Pumpkin p...
null
{ "dataset": "openai_humaneval", "index": 134, "original": "\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 a part of a word, and False otherwise.\n Note: \"word\" is a group o...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def can_arrange(arr): """Create a function which returns the largest index of an element which is not greater than or equal to the element imme...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate([1,2,4,3,5])==3\\n assert candidate([1,2,4,5])==-1\\n assert candidate([1,4,2,5,6,7,8,9,10])==2\\n assert candidate([4,8,5,7,3])==4\\n\\n # Check some edge cases that are easy to work out ...
null
{ "dataset": "openai_humaneval", "index": 135, "original": "\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\n no such element exists then return -1. The given array will not co...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def largest_smallest_integers(lst): ''' Create a function that returns a tuple (a, b), where 'a' is the largest of negative integers, and '...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate([2, 4, 1, 3, 5, 7]) == (None, 1)\\n assert candidate([2, 4, 1, 3, 5, 7, 0]) == (None, 1)\\n assert candidate([1, 3, 2, 4, 5, 6, -2]) == (-2, 1)\\n assert candidate([4, 5, 3, 6, 2, 7, -7]) == ...
null
{ "dataset": "openai_humaneval", "index": 136, "original": "\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 positive integers in a list.\n If there is no negative or positive i...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def compare_one(a, b): """ Create a function that takes integers, floats, or strings representing real numbers, and returns the larger vari...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate(1, 2) == 2\\n assert candidate(1, 2.5) == 2.5\\n assert candidate(2, 3) == 3\\n assert candidate(5, 6) == 6\\n assert candidate(1, \\\"2,3\\\") == \\\"2,3\\\"\\n assert candidate(\\\"5,...
null
{ "dataset": "openai_humaneval", "index": 137, "original": "\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 variable type.\n Return None if the values are equal.\n Note: If a real...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def is_equal_to_sum_even(n): """Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers Example is...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n assert candidate(4) == False\\n assert candidate(6) == False\\n assert candidate(8) == True\\n assert candidate(10) == True\\n assert candidate(11) == False\\n assert candidate(12) == True\\n assert candidate(13) == False\\n assert...
null
{ "dataset": "openai_humaneval", "index": 138, "original": "\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) == False\n is_equal_to_sum_even(6) == False\n is_equal_to_sum_even(...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def special_factorial(n): """The Brazilian factorial is defined as: brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1! where n > 0 ...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate(4) == 288, \\\"Test 4\\\"\\n assert candidate(5) == 34560, \\\"Test 5\\\"\\n assert candidate(7) == 125411328000, \\\"Test 7\\\"\\n\\n # Check some edge cases that are easy to work out by han...
null
{ "dataset": "openai_humaneval", "index": 139, "original": "\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 >>> special_factorial(4)\n 288\n\n The function will receive an in...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def fix_spaces(text): """ Given a string text, replace all spaces in it with underscores, and if a string has more than 2 consecutive spac...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate(\\\"Example\\\") == \\\"Example\\\", \\\"This prints if this assert fails 1 (good for debugging!)\\\"\\n assert candidate(\\\"Mudasir Hanif \\\") == \\\"Mudasir_Hanif_\\\", \\\"This prints if this ...
null
{ "dataset": "openai_humaneval", "index": 140, "original": "\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 all consecutive spaces with - \n \n fix_spaces(\"Example\") == \"E...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def file_name_check(file_name): """Create a function which takes a string representing a file's name, and returns 'Yes' if the the file's name ...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate(\\\"example.txt\\\") == 'Yes'\\n assert candidate(\\\"1example.dll\\\") == 'No'\\n assert candidate('s1sdf3.asd') == 'No'\\n assert candidate('K.dll') == 'Yes'\\n assert candidate('MY16FIL...
null
{ "dataset": "openai_humaneval", "index": 141, "original": "\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 'No' otherwise.\n A file's name is considered to be valid if and only i...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def sum_squares(lst): """" This function will take a list of integers. For all entries in the list, the function shall square the integer entry...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n \\n assert candidate([1,2,3]) == 6\\n assert candidate([1,4,9]) == 14\\n assert candidate([]) == 0\\n assert candidate([1,1,1,1,1,1,1,1,1]) == 9\\n assert candidate([-1,-1,-1,-1,-1,-1,-1,-1,-1]) == -3\\...
null
{ "dataset": "openai_humaneval", "index": 142, "original": "\n\n\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 multiple of 3 and will cube the integer entry if its index is a mu...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space,...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate(\\\"This is a test\\\") == \\\"is\\\"\\n assert candidate(\\\"lets go for swimming\\\") == \\\"go for\\\"\\n assert candidate(\\\"there is no place available here\\\") == \\\"there is no place\\...
null
{ "dataset": "openai_humaneval", "index": 143, "original": "\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 return a string that contains the words from the original sentence,\n ...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def simplify(x, n): """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluat...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate(\\\"1/5\\\", \\\"5/1\\\") == True, 'test1'\\n assert candidate(\\\"1/6\\\", \\\"2/1\\\") == False, 'test2'\\n assert candidate(\\\"5/1\\\", \\\"3/1\\\") == True, 'test3'\\n assert candidate(\...
null
{ "dataset": "openai_humaneval", "index": 144, "original": "\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 False\n otherwise. Both x and n, are string representation of a frac...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def order_by_points(nums): """ Write a function which sorts the given list of integers in ascending order according to the sum of their dig...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11]\\n assert candidate([1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46]) == [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457]\\n a...
null
{ "dataset": "openai_humaneval", "index": 145, "original": "\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 there are several items with similar sum of their digits,\n order them ba...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def specialFilter(nums): """Write a function that takes an array of numbers as input and returns the number of elements in the array that are ...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate([5, -2, 1, -5]) == 0 \\n assert candidate([15, -73, 14, -15]) == 1\\n assert candidate([33, -2, -3, 45, 21, 109]) == 2\\n assert candidate([43, -12, 93, 125, 121, 109]) == 4\\n assert can...
null
{ "dataset": "openai_humaneval", "index": 146, "original": "\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 \n first and last digits of a number are odd (1, 3, 5, 7, 9).\n F...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def get_max_triples(n): """ You are given a positive integer n. You have to create an integer array a of length n. For each i (1 ≤ i ≤ ...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n assert candidate(5) == 1\\n assert candidate(6) == 4\\n assert candidate(10) == 36\\n assert candidate(100) == 53361\\n\\n\\ncheck(get_max_triples)\"}", "style": "rule" }
null
{ "dataset": "openai_humaneval", "index": 147, "original": "\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] = i * i - i + 1.\n Return the number of triples (a[i], a[j], a[k])...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def bf(planet1, planet2): ''' There are eight planets in our solar system: the closerst to the Sun is Mercury, the next one is Venus, then...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate(\\\"Jupiter\\\", \\\"Neptune\\\") == (\\\"Saturn\\\", \\\"Uranus\\\"), \\\"First test error: \\\" + str(len(candidate(\\\"Jupiter\\\", \\\"Neptune\\\"))) \\n assert candidate(\\\"Earth\\\", \\...
null
{ "dataset": "openai_humaneval", "index": 148, "original": "\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, Saturn, \n Uranus, Neptune.\n Write a function that takes two planet ...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def sorted_list_sum(lst): """Write a function that accepts a list of strings as a parameter, deletes the strings that have odd lengths from it,...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate([\\\"aa\\\", \\\"a\\\", \\\"aaa\\\"]) == [\\\"aa\\\"]\\n assert candidate([\\\"school\\\", \\\"AI\\\", \\\"asdf\\\", \\\"b\\\"]) == [\\\"AI\\\", \\\"asdf\\\", \\\"school\\\"]\\n assert candidate...
null
{ "dataset": "openai_humaneval", "index": 149, "original": "\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 resulted list with a sorted order,\n The list is always a list of strin...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def x_or_y(n, x, y): """A simple program which should return the value of x if n is a prime number and should return the value of y otherwise....
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate(7, 34, 12) == 34\\n assert candidate(15, 8, 5) == 5\\n assert candidate(3, 33, 5212) == 33\\n assert candidate(1259, 3, 52) == 3\\n assert candidate(7919, -1, 12) == -1\\n assert candid...
null
{ "dataset": "openai_humaneval", "index": 150, "original": "\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 for x_or_y(7, 34, 12) == 34\n for x_or_y(15, 8, 5) == 5\n \n \"\...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def double_the_difference(lst): ''' Given a list of numbers, return the sum of squares of the numbers in the list that are odd. Ignore numb...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate([]) == 0 , \\\"This prints if this assert fails 1 (good for debugging!)\\\"\\n assert candidate([5, 4]) == 25 , \\\"This prints if this assert fails 2 (good for debugging!)\\\"\\n assert candida...
null
{ "dataset": "openai_humaneval", "index": 151, "original": "\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 not integers.\n \n double_the_difference([1, 3, 2, 0]) == 1 + 9 + 0...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def compare(game,guess): """I think we all remember that feeling when the result of some long-awaited event is finally known. The feelings and ...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate([1,2,3,4,5,1],[1,2,3,4,2,-2])==[0,0,0,0,3,3], \\\"This prints if this assert fails 1 (good for debugging!)\\\"\\n assert candidate([0,0,0,0,0,0],[0,0,0,0,0,0])==[0,0,0,0,0,0], \\\"This prints if th...
null
{ "dataset": "openai_humaneval", "index": 152, "original": "\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 that moment are\n definitely worth noting down and comparing.\n Your ...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def Strongest_Extension(class_name, extensions): """You will be given the name of a class (a string) and a list of extensions. The extensions a...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate('Watashi', ['tEN', 'niNE', 'eIGHt8OKe']) == 'Watashi.eIGHt8OKe'\\n assert candidate('Boku123', ['nani', 'NazeDa', 'YEs.WeCaNe', '32145tggg']) == 'Boku123.YEs.WeCaNe'\\n assert candidate('__YESIM...
null
{ "dataset": "openai_humaneval", "index": 153, "original": "\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 additional classes to the class. The\n strength of the extension is as ...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def cycpattern_check(a , b): """You are given 2 words. You need to return True if the second word or any of its rotations is a substring in the fir...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n #assert True, \\\"This prints if this assert fails 1 (good for debugging!)\\\"\\n\\n # Check some edge cases that are easy to work out by hand.\\n #assert True, \\\"This prints if this assert fails 2 (also good ...
null
{ "dataset": "openai_humaneval", "index": 154, "original": "\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_check(\"abcd\",\"abd\") => False\n cycpattern_check(\"hello\",\"ell\")...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def even_odd_count(num): """Given an integer. return a tuple that has the number of even and odd digits respectively. Example: even_o...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate(7) == (0, 1)\\n assert candidate(-78) == (1, 1)\\n assert candidate(3452) == (2, 2)\\n assert candidate(346211) == (3, 3)\\n assert candidate(-345821) == (3, 3)\\n assert candidate(-2) ...
null
{ "dataset": "openai_humaneval", "index": 155, "original": "\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, 1)\n even_odd_count(123) ==> (1, 2)\n \"\"\"\n", "reference"...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def int_to_mini_roman(number): """ Given a positive integer, obtain its roman numeral equivalent as a string, and return it in lowercase. ...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate(19) == 'xix'\\n assert candidate(152) == 'clii'\\n assert candidate(251) == 'ccli'\\n assert candidate(426) == 'cdxxvi'\\n assert candidate(500) == 'd'\\n assert candidate(1) == 'i'\\n ...
null
{ "dataset": "openai_humaneval", "index": 156, "original": "\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 <= num <= 1000\n\n Examples:\n >>> int_to_mini_roman(19) == 'xix'\n ...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def right_angle_triangle(a, b, c): ''' Given the lengths of the three sides of a triangle. Return True if the three sides form a right-angl...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate(3, 4, 5) == True, \\\"This prints if this assert fails 1 (good for debugging!)\\\"\\n assert candidate(1, 2, 3) == False\\n assert candidate(10, 6, 8) == True\\n assert candidate(2, 2, 2) == ...
null
{ "dataset": "openai_humaneval", "index": 157, "original": "\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 otherwise.\n A right-angled triangle is a triangle in which one angle is rig...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def find_max(words): """Write a function that accepts a list of strings. The list contains different words. Return the word with maximum number...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert (candidate([\\\"name\\\", \\\"of\\\", \\\"string\\\"]) == \\\"string\\\"), \\\"t1\\\"\\n assert (candidate([\\\"name\\\", \\\"enam\\\", \\\"game\\\"]) == \\\"enam\\\"), 't2'\\n assert (candidate([\\\"aaaa...
null
{ "dataset": "openai_humaneval", "index": 158, "original": "\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 characters. If multiple strings have maximum number of unique\n characters, r...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def eat(number, need, remaining): """ You're a hungry rabbit, and you already have eaten a certain number of carrots, but now you need to e...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert True, \\\"This prints if this assert fails 1 (good for debugging!)\\\"\\n assert candidate(5, 6, 10) == [11, 4], \\\"Error\\\"\\n assert candidate(4, 8, 9) == [12, 1], \\\"Error\\\"\\n assert candidate...
null
{ "dataset": "openai_humaneval", "index": 159, "original": "\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 complete the day's meals.\n you should return an array of [ total number ...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def do_algebra(operator, operand): """ Given two lists operator, and operand. The first list has basic algebra operations, and the second ...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate(['**', '*', '+'], [2, 3, 4, 5]) == 37\\n assert candidate(['+', '*', '-'], [2, 3, 4, 5]) == 9\\n assert candidate(['//', '*'], [7, 3, 4]) == 8, \\\"This prints if this assert fails 1 (good for d...
null
{ "dataset": "openai_humaneval", "index": 160, "original": "\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 integers. Use the two given lists to build the algebric \n expression and ...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def solve(s): """You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as i...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate(\\\"AsDf\\\") == \\\"aSdF\\\"\\n assert candidate(\\\"1234\\\") == \\\"4321\\\"\\n assert candidate(\\\"ab\\\") == \\\"AB\\\"\\n assert candidate(\\\"#a@C\\\") == \\\"#A@c\\\"\\n assert ca...
null
{ "dataset": "openai_humaneval", "index": 161, "original": "\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 string contains no letters, reverse the string.\n The function should retu...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def string_to_md5(text): """ Given a string 'text', return its md5 hash equivalent string. If 'text' is an empty string, return None. ...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate('Hello world') == '3e25960a79dbc69b674cd4ec67a72c62'\\n assert candidate('') == None\\n assert candidate('A B C') == '0ef78513b0cb8cef12743f5aeb35f888'\\n assert candidate('password') == '5f4...
null
{ "dataset": "openai_humaneval", "index": 162, "original": "\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('Hello world') == '3e25960a79dbc69b674cd4ec67a72c62'\n \"\"\"\n", "ref...
openai_humaneval
Read the following function signature and docstring, and fully implement the function described in Python. Your response should only contain the code for this function. def generate_integers(a, b): """ Given two positive integers a and b, return the even digits between a and b, in ascending order. For ...
codegen
{ "ground_truth": "{\"functional\": \"def check(candidate):\\n\\n # Check some simple cases\\n assert candidate(2, 10) == [2, 4, 6, 8], \\\"Test 1\\\"\\n assert candidate(10, 2) == [2, 4, 6, 8], \\\"Test 2\\\"\\n assert candidate(132, 2) == [2, 4, 6, 8], \\\"Test 3\\\"\\n assert candidate(17,89) == [],...
null
{ "dataset": "openai_humaneval", "index": 163, "original": "\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 generate_integers(2, 8) => [2, 4, 6, 8]\n generate_integers(8, 2) => [2, 4, ...