name
stringclasses
161 values
language
stringclasses
22 values
prompt
stringlengths
40
2.27k
doctests
stringclasses
3 values
original
stringclasses
956 values
prompt_terminology
stringclasses
2 values
tests
stringlengths
125
5.35k
stop_tokens
listlengths
1
7
HumanEval_16_count_distinct_characters
lua
-- Given a string, find out how many distinct characters (regardless of case) does it consist of local function count_distinct_characters(string)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_16_count_distinct_characters.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = count_distinct_characters lu.assertEquals(candidate(''), 0) lu.assertEquals(candidate('abcde'), 5) lu.assertEquals(candidate('abcdecadeCADE'), 5) lu.assertEquals(candidate('aaaaAAAAaaaa'), 1) lu.assertEquals(candidate('Jerry jERRY ...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_17_parse_music
lua
-- Input to this function is a string representing musical notes in a special ASCII format. -- Your task is to parse this string and return list of integers corresponding to how many beats does each -- not last. -- Here is a legend: -- 'o' - whole note, lasts four beats -- 'o|' - half note, lasts two beats -- '.|' - q...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_17_parse_music.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = parse_music lu.assertEquals(candidate(''), {}) lu.assertEquals(candidate('o o o o'), {4, 4, 4, 4}) lu.assertEquals(candidate('.| .| .| .|'), {1, 1, 1, 1}) lu.assertEquals(candidate('o| o| .| .| o o o o'), {2, 2, 1, 1, 4, 4, 4, 4}) ...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_18_how_many_times
lua
-- Find how many times a given substring can be found in the original string. Count overlaping cases. local function how_many_times(string, substring)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_18_how_many_times.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = how_many_times lu.assertEquals(candidate('', 'x'), 0) lu.assertEquals(candidate('xyxyxyx', 'x'), 4) lu.assertEquals(candidate('cacacacac', 'cac'), 4) lu.assertEquals(candidate('john doe', 'john'), 1) end os.exit(lu.LuaUnit.run())
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_19_sort_numbers
lua
-- Input is a space-delimited string of numberals from 'zero' to 'nine'. -- Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'. -- Return the string with numbers sorted from smallest to largest local function sort_numbers(numbers)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_19_sort_numbers.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = sort_numbers lu.assertEquals(candidate(''), '') lu.assertEquals(candidate('three'), 'three') lu.assertEquals(candidate('three five nine'), 'three five nine') lu.assertEquals(candidate('five zero four seven nine eight'), 'zero four five...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_1_separate_paren_groups
lua
-- Input to this function is a string containing multiple groups of nested parentheses. Your goal is to -- separate those group into separate strings and return the list of those. -- Separate groups are balanced (each open brace is properly closed) and not nested within each other -- Ignore any spaces in the input str...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_1_separate_paren_groups.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = separate_paren_groups lu.assertEquals(candidate('(()()) ((())) () ((())()())'), {'(()())', '((()))', '()', '((())()())'}) lu.assertEquals(candidate('() (()) ((())) (((())))'), {'()', '(())', '((()))', '(((())))'}) lu.assertEquals(candidate...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_20_find_closest_elements
lua
-- From a supplied list of numbers (of length at least two) select and return two that are the closest to each -- other and return them in order (smaller number, larger number). local function find_closest_elements(numbers)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_20_find_closest_elements.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = find_closest_elements lu.assertEquals(candidate({1.0, 2.0, 3.9, 4.0, 5.0, 2.2}), {3.9, 4.0}) lu.assertEquals(candidate({1.0, 2.0, 5.9, 4.0, 5.0}), {5.0, 5.9}) lu.assertEquals(candidate({1.0, 2.0, 3.0, 4.0, 5.0, 2.2}), {2.0, 2.2}) lu.as...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_21_rescale_to_unit
lua
-- Given list of numbers (of at least two elements), apply a linear transform to that list, -- such that the smallest number will become 0 and the largest will become 1 local function rescale_to_unit(numbers)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_21_rescale_to_unit.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = rescale_to_unit lu.assertEquals(candidate({2.0, 49.9}), {0.0, 1.0}) lu.assertEquals(candidate({100.0, 49.9}), {1.0, 0.0}) lu.assertEquals(candidate({1.0, 2.0, 3.0, 4.0, 5.0}), {0.0, 0.25, 0.5, 0.75, 1.0}) lu.assertEquals(candidate({2.0...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_22_filter_integers
lua
-- Filter given list of any python values only for integers local function filter_integers(values)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_22_filter_integers.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = filter_integers lu.assertEquals(candidate({}), {}) lu.assertEquals(candidate({4, {}, {}, 23.2, 9, 'adasd'}), {4, 9}) lu.assertEquals(candidate({3, 'c', 3, 3, 'a', 'b'}), {3, 3, 3}) end os.exit(lu.LuaUnit.run())
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_23_strlen
lua
-- Return length of given string local function strlen(string)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_23_strlen.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = strlen lu.assertEquals(candidate(''), 0) lu.assertEquals(candidate('x'), 1) lu.assertEquals(candidate('asdasnakj'), 9) end os.exit(lu.LuaUnit.run())
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_24_largest_divisor
lua
-- For a given number n, find the largest number that divides n evenly, smaller than n local function largest_divisor(n)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_24_largest_divisor.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = largest_divisor lu.assertEquals(candidate(3), 1) lu.assertEquals(candidate(7), 1) lu.assertEquals(candidate(10), 5) lu.assertEquals(candidate(100), 50) lu.assertEquals(candidate(49), 7) end os.exit(lu.LuaUnit.run())
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_25_factorize
lua
-- Return list of prime factors of given integer in the order from smallest to largest. -- Each of the factors should be listed number of times corresponding to how many times it appeares in factorization. -- Input number should be equal to the product of all factors local function factorize(n)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_25_factorize.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = factorize lu.assertEquals(candidate(2), {2}) lu.assertEquals(candidate(4), {2, 2}) lu.assertEquals(candidate(8), {2, 2, 2}) lu.assertEquals(candidate(57), {3, 19}) lu.assertEquals(candidate(3249), {3, 3, 19, 19}) lu.assertEqual...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_26_remove_duplicates
lua
-- From a list of integers, remove all elements that occur more than once. -- Keep order of elements left the same as in the input. local function remove_duplicates(numbers)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_26_remove_duplicates.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = remove_duplicates lu.assertEquals(candidate({}), {}) lu.assertEquals(candidate({1, 2, 3, 4}), {1, 2, 3, 4}) lu.assertEquals(candidate({1, 2, 3, 2, 4, 3, 5}), {1, 4, 5}) end os.exit(lu.LuaUnit.run())
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_27_flip_case
lua
-- For a given string, flip lowercase characters to uppercase and uppercase to lowercase. local function flip_case(string)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_27_flip_case.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = flip_case lu.assertEquals(candidate(''), '') lu.assertEquals(candidate('Hello!'), 'hELLO!') lu.assertEquals(candidate('These violent delights have violent ends'), 'tHESE VIOLENT DELIGHTS HAVE VIOLENT ENDS') end os.exit(lu.LuaUnit.run())
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_28_concatenate
lua
-- Concatenate list of strings into a single string local function concatenate(strings)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_28_concatenate.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = concatenate lu.assertEquals(candidate({}), '') lu.assertEquals(candidate({'x', 'y', 'z'}), 'xyz') lu.assertEquals(candidate({'x', 'y', 'z', 'w', 'k'}), 'xyzwk') end os.exit(lu.LuaUnit.run())
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_29_filter_by_prefix
lua
-- Filter an input list of strings only for ones that start with a given prefix. local function filter_by_prefix(strings, prefix)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_29_filter_by_prefix.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = filter_by_prefix lu.assertEquals(candidate({}, 'john'), {}) lu.assertEquals(candidate({'xxx', 'asd', 'xxy', 'john doe', 'xxxAAA', 'xxx'}, 'xxx'), {'xxx', 'xxxAAA', 'xxx'}) end os.exit(lu.LuaUnit.run())
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_2_truncate_number
lua
-- Given a positive floating point number, it can be decomposed into -- and integer part (largest integer smaller than given number) and decimals -- (leftover part always smaller than 1). -- Return the decimal part of the number. local function truncate_number(number)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_2_truncate_number.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = truncate_number lu.assertEquals(candidate(3.5), 0.5) lu.assertEquals(candidate(1.25), 0.25) lu.assertEquals(candidate(123.0), 0.0) end os.exit(lu.LuaUnit.run())
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_30_get_positive
lua
-- Return only positive numbers in the list. local function get_positive(l)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_30_get_positive.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = get_positive lu.assertEquals(candidate({-1, -2, 4, 5, 6}), {4, 5, 6}) lu.assertEquals(candidate({5, 3, -5, 2, 3, 3, 9, 0, 123, 1, -10}), {5, 3, 2, 3, 3, 9, 123, 1}) lu.assertEquals(candidate({-1, -2}), {}) lu.assertEquals(candidate({})...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_31_is_prime
lua
-- Return true if a given number is prime, and false otherwise. local function is_prime(n)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_31_is_prime.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = is_prime lu.assertEquals(candidate(6), false) lu.assertEquals(candidate(101), true) lu.assertEquals(candidate(11), true) lu.assertEquals(candidate(13441), true) lu.assertEquals(candidate(61), true) lu.assertEquals(candidate(4),...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_33_sort_third
lua
-- This function takes a list l and returns a list l' such that -- l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal -- to the values of the corresponding indicies of l, but sorted. local function sort_third(l)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_33_sort_third.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = sort_third lu.assertEquals(candidate({5, 6, 3, 4, 8, 9, 2}), {2, 6, 3, 4, 8, 9, 5}) lu.assertEquals(candidate({5, 8, 3, 4, 6, 9, 2}), {2, 8, 3, 4, 6, 9, 5}) lu.assertEquals(candidate({5, 6, 9, 4, 8, 3, 2}), {2, 6, 9, 4, 8, 3, 5}) lu.as...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_34_unique
lua
-- Return sorted unique elements in a list local function unique(l)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_34_unique.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = unique lu.assertEquals(candidate({5, 3, 5, 2, 3, 3, 9, 0, 123}), {0, 2, 3, 5, 9, 123}) end os.exit(lu.LuaUnit.run())
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_35_max_element
lua
-- Return maximum element in the list. local function max_element(l)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_35_max_element.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = max_element lu.assertEquals(candidate({1, 2, 3}), 3) lu.assertEquals(candidate({5, 3, -5, 2, -3, 3, 9, 0, 124, 1, -10}), 124) end os.exit(lu.LuaUnit.run())
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_36_fizz_buzz
lua
-- Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13. local function fizz_buzz(n)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_36_fizz_buzz.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = fizz_buzz lu.assertEquals(candidate(50), 0) lu.assertEquals(candidate(78), 2) lu.assertEquals(candidate(79), 3) lu.assertEquals(candidate(100), 3) lu.assertEquals(candidate(200), 6) lu.assertEquals(candidate(4000), 192) lu....
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_37_sort_even
lua
-- This function takes a list l and returns a list l' such that -- l' is identical to l in the odd indicies, while its values at the even indicies are equal -- to the values of the even indicies of l, but sorted. local function sort_even(l)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_37_sort_even.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = sort_even lu.assertEquals(candidate({1, 2, 3}), {1, 2, 3}) lu.assertEquals(candidate({5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10}), {-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123}) lu.assertEquals(candidate({5, 8, -12, 4, 23, 2, 3, 11, 12, -10}), {-12,...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_39_prime_fib
lua
-- prime_fib returns n-th number that is a Fibonacci number and it's also prime. local function prime_fib(n)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_39_prime_fib.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = prime_fib lu.assertEquals(candidate(1), 2) lu.assertEquals(candidate(2), 3) lu.assertEquals(candidate(3), 5) lu.assertEquals(candidate(4), 13) lu.assertEquals(candidate(5), 89) lu.assertEquals(candidate(6), 233) lu.assertEq...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_3_below_zero
lua
-- You're given a list of deposit and withdrawal operations on a bank account that starts with -- zero balance. Your task is to detect if at any point the balance of account fallls below zero, and -- at that point function should return True. Otherwise it should return False. local function below_zero(operations)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_3_below_zero.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = below_zero lu.assertEquals(candidate({}), false) lu.assertEquals(candidate({1, 2, -3, 1, 2, -3}), false) lu.assertEquals(candidate({1, 2, -4, 5, 6}), true) lu.assertEquals(candidate({1, -1, 2, -2, 5, -5, 4, -4}), false) lu.assertEq...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_40_triples_sum_to_zero
lua
-- triples_sum_to_zero takes a list of integers as an input. -- it returns True if there are three distinct elements in the list that -- sum to zero, and False otherwise. local function triples_sum_to_zero(l)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_40_triples_sum_to_zero.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = triples_sum_to_zero lu.assertEquals(candidate({1, 3, 5, 0}), false) lu.assertEquals(candidate({1, 3, 5, -1}), false) lu.assertEquals(candidate({1, 3, -2, 1}), true) lu.assertEquals(candidate({1, 2, 3, 7}), false) lu.assertEquals(ca...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_42_incr_list
lua
-- Return list with elements incremented by 1. local function incr_list(l)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_42_incr_list.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = incr_list lu.assertEquals(candidate({}), {}) lu.assertEquals(candidate({3, 2, 1}), {4, 3, 2}) lu.assertEquals(candidate({5, 2, 5, 2, 3, 3, 9, 0, 123}), {6, 3, 6, 3, 4, 4, 10, 1, 124}) end os.exit(lu.LuaUnit.run())
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_43_pairs_sum_to_zero
lua
-- pairs_sum_to_zero takes a list of integers as an input. -- it returns True if there are two distinct elements in the list that -- sum to zero, and False otherwise. local function pairs_sum_to_zero(l)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_43_pairs_sum_to_zero.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = pairs_sum_to_zero lu.assertEquals(candidate({1, 3, 5, 0}), false) lu.assertEquals(candidate({1, 3, -2, 1}), false) lu.assertEquals(candidate({1, 2, 3, 7}), false) lu.assertEquals(candidate({2, 4, -5, 3, 5, 7}), true) lu.assertEqual...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_44_change_base
lua
-- Change numerical base of input number x to base. -- return string representation after the conversion. -- base numbers are less than 10. local function change_base(x, base)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_44_change_base.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = change_base lu.assertEquals(candidate(8, 3), '22') lu.assertEquals(candidate(9, 3), '100') lu.assertEquals(candidate(234, 2), '11101010') lu.assertEquals(candidate(16, 2), '10000') lu.assertEquals(candidate(8, 2), '1000') lu.as...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_45_triangle_area
lua
-- Given length of a side and high return area for a triangle. local function triangle_area(a, h)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_45_triangle_area.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = triangle_area lu.assertEquals(candidate(5, 3), 7.5) lu.assertEquals(candidate(2, 2), 2.0) lu.assertEquals(candidate(10, 8), 40.0) end os.exit(lu.LuaUnit.run())
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_46_fib4
lua
-- The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows: -- fib4(0) -> 0 -- fib4(1) -> 0 -- fib4(2) -> 2 -- fib4(3) -> 0 -- fib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4). -- Please write a function to efficiently compute the n-th element of the fib4 number seque...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_46_fib4.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = fib4 lu.assertEquals(candidate(5), 4) lu.assertEquals(candidate(8), 28) lu.assertEquals(candidate(10), 104) lu.assertEquals(candidate(12), 386) end os.exit(lu.LuaUnit.run())
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_47_median
lua
-- Return median of elements in the list l. local function median(l)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_47_median.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = median lu.assertEquals(candidate({3, 1, 2, 4, 5}), 3) lu.assertEquals(candidate({-10, 4, 6, 1000, 10, 20}), 8.0) lu.assertEquals(candidate({5}), 5) lu.assertEquals(candidate({6, 5}), 5.5) lu.assertEquals(candidate({8, 1, 3, 9, 9, 2...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_48_is_palindrome
lua
-- Checks if given string is a palindrome local function is_palindrome(text)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_48_is_palindrome.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = is_palindrome lu.assertEquals(candidate(''), true) lu.assertEquals(candidate('aba'), true) lu.assertEquals(candidate('aaaaa'), true) lu.assertEquals(candidate('zbcd'), false) lu.assertEquals(candidate('xywyx'), true) lu.assertE...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_49_modp
lua
-- Return 2^n modulo p (be aware of numerics). local function modp(n, p)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_49_modp.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = modp lu.assertEquals(candidate(3, 5), 3) lu.assertEquals(candidate(1101, 101), 2) lu.assertEquals(candidate(0, 101), 1) lu.assertEquals(candidate(3, 11), 8) lu.assertEquals(candidate(100, 101), 1) lu.assertEquals(candidate(30, ...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_4_mean_absolute_deviation
lua
-- For a given list of input numbers, calculate Mean Absolute Deviation -- around the mean of this dataset. -- Mean Absolute Deviation is the average absolute difference between each -- element and a centerpoint (mean in this case): -- MAD = average | x - x_mean | local function mean_absolute_deviation(numbers)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_4_mean_absolute_deviation.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = mean_absolute_deviation lu.assertEquals(candidate({1.0, 2.0}), 0.5) lu.assertEquals(candidate({1.0, 2.0, 3.0, 4.0}), 1.0) lu.assertEquals(candidate({1.0, 2.0, 3.0, 4.0, 5.0}), 1.2) end os.exit(lu.LuaUnit.run())
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_51_remove_vowels
lua
-- remove_vowels is a function that takes string and returns string without vowels. local function remove_vowels(text)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_51_remove_vowels.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = remove_vowels lu.assertEquals(candidate(''), '') lu.assertEquals(candidate('abcdef\nghijklm'), 'bcdf\nghjklm') lu.assertEquals(candidate('fedcba'), 'fdcb') lu.assertEquals(candidate('eeeee'), '') lu.assertEquals(candidate('acBAA'),...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_52_below_threshold
lua
-- Return True if all numbers in the list l are below threshold t. local function below_threshold(l, t)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_52_below_threshold.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = below_threshold lu.assertEquals(candidate({1, 2, 4, 10}, 100), true) lu.assertEquals(candidate({1, 20, 4, 10}, 5), false) lu.assertEquals(candidate({1, 20, 4, 10}, 21), true) lu.assertEquals(candidate({1, 20, 4, 10}, 22), true) lu....
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_53_add
lua
-- Add two numbers x and y local function add(x, y)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_53_add.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = add lu.assertEquals(candidate(0, 1), 1) lu.assertEquals(candidate(1, 0), 1) lu.assertEquals(candidate(2, 3), 5) lu.assertEquals(candidate(5, 7), 12) lu.assertEquals(candidate(7, 5), 12) end os.exit(lu.LuaUnit.run())
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_54_same_chars
lua
-- Check if two words have the same characters. local function same_chars(s0, s1)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_54_same_chars.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = same_chars lu.assertEquals(candidate('eabcdzzzz', 'dddzzzzzzzddeddabc'), true) lu.assertEquals(candidate('abcd', 'dddddddabc'), true) lu.assertEquals(candidate('dddddddabc', 'abcd'), true) lu.assertEquals(candidate('eabcd', 'dddddddabc...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_55_fib
lua
-- Return n-th Fibonacci number. local function fib(n)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_55_fib.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = fib lu.assertEquals(candidate(10), 55) lu.assertEquals(candidate(1), 1) lu.assertEquals(candidate(8), 21) lu.assertEquals(candidate(11), 89) lu.assertEquals(candidate(12), 144) end os.exit(lu.LuaUnit.run())
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_56_correct_bracketing
lua
-- brackets is a string of "<" and ">". -- return True if every opening bracket has a corresponding closing bracket. local function correct_bracketing(brackets)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_56_correct_bracketing.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = correct_bracketing lu.assertEquals(candidate('<>'), true) lu.assertEquals(candidate('<<><>>'), true) lu.assertEquals(candidate('<><><<><>><>'), true) lu.assertEquals(candidate('<><><<<><><>><>><<><><<>>>'), true) lu.assertEquals(ca...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_57_monotonic
lua
-- Return True is list elements are monotonically increasing or decreasing. local function monotonic(l)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_57_monotonic.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = monotonic lu.assertEquals(candidate({1, 2, 4, 10}), true) lu.assertEquals(candidate({1, 2, 4, 20}), true) lu.assertEquals(candidate({1, 20, 4, 10}), false) lu.assertEquals(candidate({4, 1, 0, -10}), true) lu.assertEquals(candidate(...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_58_common
lua
-- Return sorted unique common elements for two lists. local function common(l1, l2)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_58_common.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = common lu.assertEquals(candidate({1, 4, 3, 34, 653, 2, 5}, {5, 7, 1, 5, 9, 653, 121}), {1, 5, 653}) lu.assertEquals(candidate({5, 3, 2, 8}, {3, 2}), {2, 3}) lu.assertEquals(candidate({4, 3, 2, 8}, {3, 2, 4}), {2, 3, 4}) lu.assertEquals...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_59_largest_prime_factor
lua
-- Return the largest prime factor of n. Assume n > 1 and is not a prime. local function largest_prime_factor(n)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_59_largest_prime_factor.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = largest_prime_factor lu.assertEquals(candidate(15), 5) lu.assertEquals(candidate(27), 3) lu.assertEquals(candidate(63), 7) lu.assertEquals(candidate(330), 11) lu.assertEquals(candidate(13195), 29) end os.exit(lu.LuaUnit.run())
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_5_intersperse
lua
-- Insert a number 'delimeter' between every two consecutive elements of input list `numbers' local function intersperse(numbers, delimeter)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_5_intersperse.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = intersperse lu.assertEquals(candidate({}, 7), {}) lu.assertEquals(candidate({5, 6, 3, 2}, 8), {5, 8, 6, 8, 3, 8, 2}) lu.assertEquals(candidate({2, 2, 2}, 2), {2, 2, 2, 2, 2}) end os.exit(lu.LuaUnit.run())
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_60_sum_to_n
lua
-- sum_to_n is a function that sums numbers from 1 to n. local function sum_to_n(n)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_60_sum_to_n.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = sum_to_n lu.assertEquals(candidate(1), 1) lu.assertEquals(candidate(6), 21) lu.assertEquals(candidate(11), 66) lu.assertEquals(candidate(30), 465) lu.assertEquals(candidate(100), 5050) end os.exit(lu.LuaUnit.run())
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_61_correct_bracketing
lua
-- brackets is a string of "(" and ")". -- return True if every opening bracket has a corresponding closing bracket. local function correct_bracketing(brackets)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_61_correct_bracketing.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = correct_bracketing lu.assertEquals(candidate('()'), true) lu.assertEquals(candidate('(()())'), true) lu.assertEquals(candidate('()()(()())()'), true) lu.assertEquals(candidate('()()((()()())())(()()(()))'), true) lu.assertEquals(ca...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_62_derivative
lua
-- xs represent coefficients of a polynomial. -- xs[0] + xs[1] * x + xs[2] * x^2 + .... -- Return derivative of this polynomial in the same form. local function derivative(xs)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_62_derivative.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = derivative lu.assertEquals(candidate({3, 1, 2, 4, 5}), {1, 4, 12, 20}) lu.assertEquals(candidate({1, 2, 3}), {2, 6}) lu.assertEquals(candidate({3, 2, 1}), {2, 2}) lu.assertEquals(candidate({3, 2, 1, 0, 4}), {2, 2, 0, 16}) lu.assert...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_63_fibfib
lua
-- The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows: -- fibfib(0) == 0 -- fibfib(1) == 0 -- fibfib(2) == 1 -- fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3). -- Please write a function to efficiently compute the n-th element of the fibfib number sequence. local...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_63_fibfib.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = fibfib lu.assertEquals(candidate(2), 1) lu.assertEquals(candidate(1), 0) lu.assertEquals(candidate(5), 4) lu.assertEquals(candidate(8), 24) lu.assertEquals(candidate(10), 81) lu.assertEquals(candidate(12), 274) lu.assertEqu...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_64_vowels_count
lua
-- Write a function vowels_count which takes a string representing -- a word as input and returns the number of vowels in the string. -- Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a -- vowel, but only when it is at the end of the given word. -- Example: local function vowels_count(s)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_64_vowels_count.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = vowels_count lu.assertEquals(candidate('abcde'), 2) lu.assertEquals(candidate('Alone'), 3) lu.assertEquals(candidate('key'), 2) lu.assertEquals(candidate('bye'), 1) lu.assertEquals(candidate('keY'), 2) lu.assertEquals(candidate...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_65_circular_shift
lua
-- Circular shift the digits of the integer x, shift the digits right by shift -- and return the result as a string. -- If shift > number of digits, return digits reversed. local function circular_shift(x, shift)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_65_circular_shift.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = circular_shift lu.assertEquals(candidate(100, 2), '001') lu.assertEquals(candidate(12, 2), '12') lu.assertEquals(candidate(97, 8), '79') lu.assertEquals(candidate(12, 1), '21') lu.assertEquals(candidate(11, 101), '11') end os.exit...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_66_digitSum
lua
-- Task -- Write a function that takes a string as input and returns the sum of the upper characters only' -- ASCII codes. -- Examples: local function digitSum(s)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_66_digitSum.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = digitSum lu.assertEquals(candidate(''), 0) lu.assertEquals(candidate('abAB'), 131) lu.assertEquals(candidate('abcCd'), 67) lu.assertEquals(candidate('helloE'), 69) lu.assertEquals(candidate('woArBld'), 131) lu.assertEquals(cand...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_67_fruit_distribution
lua
-- In this task, you will be given a string that represents a number of apples and oranges -- that are distributed in a basket of fruit this basket contains -- apples, oranges, and mango fruits. Given the string that represents the total number of -- the oranges and apples and an integer that represent the total num...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_67_fruit_distribution.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = fruit_distribution lu.assertEquals(candidate('5 apples and 6 oranges', 19), 8) lu.assertEquals(candidate('5 apples and 6 oranges', 21), 10) lu.assertEquals(candidate('0 apples and 1 oranges', 3), 2) lu.assertEquals(candidate('1 apples ...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_68_pluck
lua
-- "Given an array representing a branch of a tree that has non-negative integer nodes -- your task is to pluck one of the nodes and return it. -- The plucked node should be the node with the smallest even value. -- If multiple nodes with the same smallest even value are found return the node that has smallest index. -...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_68_pluck.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = pluck lu.assertEquals(candidate({4, 2, 3}), {2, 1}) lu.assertEquals(candidate({1, 2, 3}), {2, 1}) lu.assertEquals(candidate({}), {}) lu.assertEquals(candidate({5, 0, 3, 0, 4, 2}), {0, 1}) lu.assertEquals(candidate({1, 2, 3, 0, 5, 3...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_69_search
lua
-- You are given a non-empty list of positive integers. Return the greatest integer that is greater than -- zero, and has a frequency greater than or equal to the value of the integer itself. -- The frequency of an integer is the number of times it appears in the list. -- If no such a value exist, return -1. -- Examp...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_69_search.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = search lu.assertEquals(candidate({5, 5, 5, 5, 1}), 1) lu.assertEquals(candidate({4, 1, 4, 1, 4, 4}), 4) lu.assertEquals(candidate({3, 3}), -1) lu.assertEquals(candidate({8, 8, 8, 8, 8, 8, 8, 8}), 8) lu.assertEquals(candidate({2, 3,...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_6_parse_nested_parens
lua
-- Input to this function is a string represented multiple groups for nested parentheses separated by spaces. -- For each of the group, output the deepest level of nesting of parentheses. -- E.g. (()()) has maximum two levels of nesting while ((())) has three. local function parse_nested_parens(paren_string)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_6_parse_nested_parens.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = parse_nested_parens lu.assertEquals(candidate('(()()) ((())) () ((())()())'), {2, 3, 1, 3}) lu.assertEquals(candidate('() (()) ((())) (((())))'), {1, 2, 3, 4}) lu.assertEquals(candidate('(()(())((())))'), {4}) end os.exit(lu.LuaUnit.run()...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_70_strange_sort_list
lua
-- Given list of integers, return list in strange order. -- Strange sorting, is when you start with the minimum value, -- then maximum of the remaining integers, then minimum and so on. -- Examples: local function strange_sort_list(lst)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_70_strange_sort_list.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = strange_sort_list lu.assertEquals(candidate({1, 2, 3, 4}), {1, 4, 2, 3}) lu.assertEquals(candidate({5, 6, 7, 8, 9}), {5, 9, 6, 8, 7}) lu.assertEquals(candidate({1, 2, 3, 4, 5}), {1, 5, 2, 4, 3}) lu.assertEquals(candidate({5, 6, 7, 8, 9...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_71_triangle_area
lua
-- Given the lengths of the three sides of a triangle. Return the area of -- the triangle rounded to 2 decimal points if the three sides form a valid triangle. -- Otherwise return -1 -- Three sides make a valid triangle when the sum of any two sides is greater -- than the third side. -- Example: local function triang...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_71_triangle_area.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = triangle_area lu.assertEquals(candidate(3, 4, 5), 6.0) lu.assertEquals(candidate(1, 2, 10), -1) lu.assertEquals(candidate(4, 8, 5), 8.18) lu.assertEquals(candidate(2, 2, 2), 1.73) lu.assertEquals(candidate(1, 2, 3), -1) lu.asse...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_72_will_it_fly
lua
-- Write a function that returns True if the object q will fly, and False otherwise. -- The object q will fly if it's balanced (it is a palindromic list) and the sum of its elements is less than or equal the maximum possible weight w. -- Example: -- # 1+2 is less than the maximum possible weight, but it's unbalance...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_72_will_it_fly.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = will_it_fly lu.assertEquals(candidate({3, 2, 3}, 9), true) lu.assertEquals(candidate({1, 2}, 5), false) lu.assertEquals(candidate({3}, 5), true) lu.assertEquals(candidate({3, 2, 3}, 1), false) lu.assertEquals(candidate({1, 2, 3}, 6...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_73_smallest_change
lua
-- Given an array arr of integers, find the minimum number of elements that -- need to be changed to make the array palindromic. A palindromic array is an array that -- is read the same backwards and forwards. In one change, you can change one element to any other element. -- For example: local function smallest_change...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_73_smallest_change.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = smallest_change lu.assertEquals(candidate({1, 2, 3, 5, 4, 7, 9, 6}), 4) lu.assertEquals(candidate({1, 2, 3, 4, 3, 2, 2}), 1) lu.assertEquals(candidate({1, 4, 2}), 1) lu.assertEquals(candidate({1, 4, 4, 2}), 1) lu.assertEquals(candi...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_74_total_match
lua
-- Write a function that accepts two lists of strings and returns the list that has -- total number of chars in the all strings of the list less than the other list. -- if the two lists have the same number of chars, return the first list. -- Examples local function total_match(lst1, lst2)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_74_total_match.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = total_match lu.assertEquals(candidate({}, {}), {}) lu.assertEquals(candidate({'hi', 'admin'}, {'hi', 'hi'}), {'hi', 'hi'}) lu.assertEquals(candidate({'hi', 'admin'}, {'hi', 'hi', 'admin', 'project'}), {'hi', 'admin'}) lu.assertEquals(c...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_75_is_multiply_prime
lua
-- Write a function that returns true if the given number is the multiplication of 3 prime numbers -- and false otherwise. -- Knowing that (a) is less then 100. -- Example: -- 30 = 2 * 3 * 5 local function is_multiply_prime(a)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_75_is_multiply_prime.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = is_multiply_prime lu.assertEquals(candidate(5), false) lu.assertEquals(candidate(30), true) lu.assertEquals(candidate(8), true) lu.assertEquals(candidate(10), false) lu.assertEquals(candidate(125), true) lu.assertEquals(candida...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_76_is_simple_power
lua
-- Your task is to write a function that returns true if a number x is a simple -- power of n and false in other cases. -- x is a simple power of n if n**int=x -- For example: local function is_simple_power(x, n)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_76_is_simple_power.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = is_simple_power lu.assertEquals(candidate(16, 2), true) lu.assertEquals(candidate(143214, 16), false) lu.assertEquals(candidate(4, 2), true) lu.assertEquals(candidate(9, 3), true) lu.assertEquals(candidate(16, 4), true) lu.asse...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_77_iscube
lua
-- Write a function that takes an integer a and returns True -- if this ingeger is a cube of some integer number. -- Note: you may assume the input is always valid. -- Examples: local function iscube(a)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_77_iscube.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = iscube lu.assertEquals(candidate(1), true) lu.assertEquals(candidate(2), false) lu.assertEquals(candidate(-1), true) lu.assertEquals(candidate(64), true) lu.assertEquals(candidate(180), false) lu.assertEquals(candidate(1000), t...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_78_hex_key
lua
-- You have been tasked to write a function that receives -- a hexadecimal number as a string and counts the number of hexadecimal -- digits that are primes (prime number, or a prime, is a natural number -- greater than 1 that is not a product of two smaller natural numbers). -- Hexadecimal digits are 0, 1, 2, 3, 4,...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_78_hex_key.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = hex_key lu.assertEquals(candidate('AB'), 1) lu.assertEquals(candidate('1077E'), 2) lu.assertEquals(candidate('ABED1A33'), 4) lu.assertEquals(candidate('2020'), 2) lu.assertEquals(candidate('123456789ABCDEF0'), 6) lu.assertEqual...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_79_decimal_to_binary
lua
-- You will be given a number in decimal form and your task is to convert it to -- binary format. The function should return a string, with each character representing a binary -- number. Each character in the string will be '0' or '1'. -- There will be an extra couple of characters 'db' at the beginning and at the end...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_79_decimal_to_binary.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = decimal_to_binary lu.assertEquals(candidate(0), 'db0db') lu.assertEquals(candidate(32), 'db100000db') lu.assertEquals(candidate(103), 'db1100111db') lu.assertEquals(candidate(15), 'db1111db') end os.exit(lu.LuaUnit.run())
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_7_filter_by_substring
lua
-- Filter an input list of strings only for ones that contain given substring local function filter_by_substring(strings, substring)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_7_filter_by_substring.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = filter_by_substring lu.assertEquals(candidate({}, 'john'), {}) lu.assertEquals(candidate({'xxx', 'asd', 'xxy', 'john doe', 'xxxAAA', 'xxx'}, 'xxx'), {'xxx', 'xxxAAA', 'xxx'}) lu.assertEquals(candidate({'xxx', 'asd', 'aaaxxy', 'john doe', '...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_80_is_happy
lua
-- You are given a string s. -- Your task is to check if the string is happy or not. -- A string is happy if its length is at least 3 and every 3 consecutive letters are distinct -- For example: local function is_happy(s)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_80_is_happy.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = is_happy lu.assertEquals(candidate('a'), false) lu.assertEquals(candidate('aa'), false) lu.assertEquals(candidate('abcd'), true) lu.assertEquals(candidate('aabb'), false) lu.assertEquals(candidate('adb'), true) lu.assertEquals(...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_81_numerical_letter_grade
lua
-- It is the last week of the semester and the teacher has to give the grades -- to students. The teacher has been making her own algorithm for grading. -- The only problem is, she has lost the code she used for grading. -- She has given you a list of GPAs for some students and you have to write -- a function that can...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_81_numerical_letter_grade.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = numerical_letter_grade lu.assertEquals(candidate({4.0, 3, 1.7, 2, 3.5}), {'A+', 'B', 'C-', 'C', 'A-'}) lu.assertEquals(candidate({1.2}), {'D+'}) lu.assertEquals(candidate({0.5}), {'D-'}) lu.assertEquals(candidate({0.0}), {'E'}) lu....
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_82_prime_length
lua
-- Write a function that takes a string and returns True if the string -- length is a prime number or False otherwise -- Examples local function prime_length(string)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_82_prime_length.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = prime_length lu.assertEquals(candidate('Hello'), true) lu.assertEquals(candidate('abcdcba'), true) lu.assertEquals(candidate('kittens'), true) lu.assertEquals(candidate('orange'), false) lu.assertEquals(candidate('wow'), true) ...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_84_solve
lua
-- Given a positive integer N, return the total sum of its digits in binary. -- Example -- Variables: -- @N integer -- Constraints: 0 ≤ N ≤ 10000. -- Output: -- a string of binary number local function solve(N)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_84_solve.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = solve lu.assertEquals(candidate(1000), '1') lu.assertEquals(candidate(150), '110') lu.assertEquals(candidate(147), '1100') lu.assertEquals(candidate(333), '1001') lu.assertEquals(candidate(963), '10010') end os.exit(lu.LuaUnit.run...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_85_add
lua
-- Given a non-empty list of integers lst. add the even elements that are at odd indices.. -- Examples: local function add(lst)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_85_add.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = add lu.assertEquals(candidate({4, 88}), 88) lu.assertEquals(candidate({4, 5, 6, 7, 2, 122}), 122) lu.assertEquals(candidate({4, 0, 6, 7}), 0) lu.assertEquals(candidate({4, 4, 6, 8}), 12) end os.exit(lu.LuaUnit.run())
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_86_anti_shuffle
lua
-- Write a function that takes a string and returns an ordered version of it. -- Ordered version of string, is a string where all words (separated by space) -- are replaced by a new word where all the characters arranged in -- ascending order based on ascii value. -- Note: You should keep the order of words and blank s...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_86_anti_shuffle.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = anti_shuffle lu.assertEquals(candidate('Hi'), 'Hi') lu.assertEquals(candidate('hello'), 'ehllo') lu.assertEquals(candidate('number'), 'bemnru') lu.assertEquals(candidate('abcd'), 'abcd') lu.assertEquals(candidate('Hello World!!!'),...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_87_get_row
lua
-- You are given a 2 dimensional data, as a nested lists, -- which is similar to matrix, however, unlike matrices, -- each row may contain a different number of columns. -- Given lst, and integer x, find integers x in the list, -- and return list of tuples, [(x1, y1), (x2, y2) ...] such that -- each tuple is a coordina...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_87_get_row.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = get_row lu.assertEquals(candidate({{1, 2, 3, 4, 5, 6}, {1, 2, 3, 4, 1, 6}, {1, 2, 3, 4, 5, 1}}, 1), {{0, 0}, {1, 4}, {1, 0}, {2, 5}, {2, 0}}) lu.assertEquals(candidate({{1, 2, 3, 4, 5, 6}, {1, 2, 3, 4, 5, 6}, {1, 2, 3, 4, 5, 6}, {1, 2, 3, 4, 5...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_88_sort_array
lua
-- Given an array of non-negative integers, return a copy of the given array after sorting, -- you will sort the given array in ascending order if the sum( first index value, last index value) is odd, -- or sort it in descending order if the sum( first index value, last index value) is even. -- Note: -- * don't change ...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_88_sort_array.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = sort_array lu.assertEquals(candidate({}), {}) lu.assertEquals(candidate({5}), {5}) lu.assertEquals(candidate({2, 4, 3, 0, 1, 5}), {0, 1, 2, 3, 4, 5}) lu.assertEquals(candidate({2, 4, 3, 0, 1, 5, 6}), {6, 5, 4, 3, 2, 1, 0}) lu.asser...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_89_encrypt
lua
-- Create a function encrypt that takes a string as an argument and -- returns a string encrypted with the alphabet being rotated. -- The alphabet should be rotated in a manner such that the letters -- shift down by two multiplied to two places. -- For example: local function encrypt(s)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_89_encrypt.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = encrypt lu.assertEquals(candidate('hi'), 'lm') lu.assertEquals(candidate('asdfghjkl'), 'ewhjklnop') lu.assertEquals(candidate('gf'), 'kj') lu.assertEquals(candidate('et'), 'ix') lu.assertEquals(candidate('faewfawefaewg'), 'jeiajeai...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_8_sum_product
lua
-- For a given list of integers, return a tuple consisting of a sum and a product of all the integers in a list. -- Empty sum should be equal to 0 and empty product should be equal to 1. local function sum_product(numbers)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_8_sum_product.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = sum_product lu.assertEquals(candidate({}), {0, 1}) lu.assertEquals(candidate({1, 1, 1}), {3, 1}) lu.assertEquals(candidate({100, 0}), {100, 0}) lu.assertEquals(candidate({3, 5, 7}), {15, 105}) lu.assertEquals(candidate({10}), {10, ...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_90_next_smallest
lua
-- You are given a list of integers. -- Write a function next_smallest() that returns the 2nd smallest element of the list. -- Return None if there is no such element. local function next_smallest(lst)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_90_next_smallest.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = next_smallest lu.assertEquals(candidate({1, 2, 3, 4, 5}), 2) lu.assertEquals(candidate({5, 1, 4, 3, 2}), 2) lu.assertEquals(candidate({}), None) lu.assertEquals(candidate({1, 1}), None) lu.assertEquals(candidate({1, 1, 1, 1, 0}), 1...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_91_is_bored
lua
-- You'll be given a string of words, and your task is to count the number -- of boredoms. A boredom is a sentence that starts with the word "I". -- Sentences are delimited by '.', '?' or '!'. -- For example: local function is_bored(S)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_91_is_bored.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = is_bored lu.assertEquals(candidate('Hello world'), 0) lu.assertEquals(candidate('Is the sky blue?'), 0) lu.assertEquals(candidate('I love It !'), 1) lu.assertEquals(candidate('bIt'), 0) lu.assertEquals(candidate('I feel good today....
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_92_any_int
lua
-- Create a function that takes 3 numbers. -- Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers. -- Returns false in any other cases. -- Examples local function any_int(x, y, z)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_92_any_int.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = any_int lu.assertEquals(candidate(2, 3, 1), true) lu.assertEquals(candidate(2.5, 2, 3), false) lu.assertEquals(candidate(1.5, 5, 3.5), false) lu.assertEquals(candidate(2, 6, 2), false) lu.assertEquals(candidate(4, 2, 2), true) ...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_93_encode
lua
-- Write a function that takes a message, and encodes in such a -- way that it swaps case of all letters, replaces all vowels in -- the message with the letter that appears 2 places ahead of that -- vowel in the english alphabet. -- Assume only letters. -- Examples: local function encode(message)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_93_encode.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = encode lu.assertEquals(candidate('TEST'), 'tgst') lu.assertEquals(candidate('Mudasir'), 'mWDCSKR') lu.assertEquals(candidate('YES'), 'ygs') lu.assertEquals(candidate('This is a message'), 'tHKS KS C MGSSCGG') lu.assertEquals(candid...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_94_skjkasdkd
lua
-- You are given a list of integers. -- You need to find the largest prime value and return the sum of its digits. -- Examples: local function skjkasdkd(lst)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_94_skjkasdkd.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = skjkasdkd lu.assertEquals(candidate({0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3}), 10) lu.assertEquals(candidate({1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1}), 25) lu.assertEquals(candidate({1, 3,...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_95_check_dict_case
lua
-- Given a dictionary, return True if all keys are strings in lower -- case or all keys are strings in upper case, else return False. -- The function should return False is the given dictionary is empty. -- Examples: local function check_dict_case(dict)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_95_check_dict_case.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = check_dict_case lu.assertEquals(candidate({['p'] = 'pineapple', ['b'] = 'banana'}), true) lu.assertEquals(candidate({['p'] = 'pineapple', ['A'] = 'banana', ['B'] = 'banana'}), false) lu.assertEquals(candidate({['p'] = 'pineapple', ['5'] = ...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_96_count_up_to
lua
-- Implement a function that takes an non-negative integer and returns an array of the first n -- integers that are prime numbers and less than n. -- for example: local function count_up_to(n)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_96_count_up_to.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = count_up_to lu.assertEquals(candidate(5), {2, 3}) lu.assertEquals(candidate(6), {2, 3, 5}) lu.assertEquals(candidate(7), {2, 3, 5}) lu.assertEquals(candidate(10), {2, 3, 5, 7}) lu.assertEquals(candidate(0), {}) lu.assertEquals(...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_97_multiply
lua
-- Complete the function that takes two integers and returns -- the product of their unit digits. -- Assume the input is always valid. -- Examples: local function multiply(a, b)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_97_multiply.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = multiply lu.assertEquals(candidate(148, 412), 16) lu.assertEquals(candidate(19, 28), 72) lu.assertEquals(candidate(2020, 1851), 0) lu.assertEquals(candidate(14, -15), 20) lu.assertEquals(candidate(76, 67), 42) lu.assertEquals(c...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_98_count_upper
lua
-- Given a string s, count the number of uppercase vowels in even indices. -- For example: local function count_upper(s)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_98_count_upper.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = count_upper lu.assertEquals(candidate('aBCdEf'), 1) lu.assertEquals(candidate('abcdefg'), 0) lu.assertEquals(candidate('dBBE'), 0) lu.assertEquals(candidate('B'), 0) lu.assertEquals(candidate('U'), 1) lu.assertEquals(candidate(...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_99_closest_integer
lua
-- Create a function that takes a value (string) representing a number -- and returns the closest integer to it. If the number is equidistant -- from two integers, round it away from zero. -- Examples -- Note: -- Rounding away from zero means that if the given number is equidistant -- from two integers, the one you sho...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_99_closest_integer.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = closest_integer lu.assertEquals(candidate('10'), 10) lu.assertEquals(candidate('14.5'), 15) lu.assertEquals(candidate('-15.5'), -16) lu.assertEquals(candidate('15.3'), 15) lu.assertEquals(candidate('0'), 0) end os.exit(lu.LuaUnit....
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_9_rolling_max
lua
-- From a given list of integers, generate a list of rolling maximum element found until given moment -- in the sequence. local function rolling_max(numbers)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_9_rolling_max.py
verbatim
lu = require('luaunit') function test_humaneval() local candidate = rolling_max lu.assertEquals(candidate({}), {}) lu.assertEquals(candidate({1, 2, 3, 4}), {1, 2, 3, 4}) lu.assertEquals(candidate({4, 3, 2, 1}), {4, 4, 4, 4}) lu.assertEquals(candidate({3, 2, 3, 100, 3}), {3, 3, 3, 100, 100}) end os.exi...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_0_has_close_elements
lua
-- Check if in given table of numbers, are any two numbers closer to each other than -- given threshold. -- >>> has_close_elements({1.0, 2.0, 3.0}, 0.5) -- false -- >>> has_close_elements({1.0, 2.8, 3.0, 4.0, 5.0, 2.0}, 0.3) -- true local function has_close_elements(numbers, threshold)
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_0_has_close_elements.py
reworded
lu = require('luaunit') function test_humaneval() local candidate = has_close_elements lu.assertEquals(candidate({1.0, 2.0, 3.9, 4.0, 5.0, 2.2}, 0.3), true) lu.assertEquals(candidate({1.0, 2.0, 3.9, 4.0, 5.0, 2.2}, 0.05), false) lu.assertEquals(candidate({1.0, 2.0, 5.9, 4.0, 5.0}, 0.95), true) lu.asser...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_100_make_a_pile
lua
-- Given a positive integer n, you have to make a pile of n levels of stones. -- The first level has n stones. -- The number of stones in the next level is: -- - the next odd number if n is odd. -- - the next even number if n is even. -- Return the number of stones in each level in a table, where element at ind...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_100_make_a_pile.py
reworded
lu = require('luaunit') function test_humaneval() local candidate = make_a_pile lu.assertEquals(candidate(3), {3, 5, 7}) lu.assertEquals(candidate(4), {4, 6, 8, 10}) lu.assertEquals(candidate(5), {5, 7, 9, 11, 13}) lu.assertEquals(candidate(6), {6, 8, 10, 12, 14, 16}) lu.assertEquals(candidate(8), ...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_101_words_string
lua
-- You will be given a string of words separated by commas or spaces. Your task is -- to split the string into words and return a table of the words. -- For example: -- >>> words_string('Hi, my name is John') -- {'Hi', 'my', 'name', 'is', 'John'} -- >>> words_string('One, two, three, four, five, six') -- {'One', 'two',...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_101_words_string.py
reworded
lu = require('luaunit') function test_humaneval() local candidate = words_string lu.assertEquals(candidate('Hi, my name is John'), {'Hi', 'my', 'name', 'is', 'John'}) lu.assertEquals(candidate('One, two, three, four, five, six'), {'One', 'two', 'three', 'four', 'five', 'six'}) lu.assertEquals(candidate('Hi...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_102_choose_num
lua
-- This function takes two positive numbers x and y and returns the -- biggest even integer number that is in the range [x, y] inclusive. If -- there's no such number, then the function should return -1. -- For example: -- >>> choose_num(12, 15) -- 14 -- >>> choose_num(13, 12) -- -1 local function choose_num(x, y)
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_102_choose_num.py
reworded
lu = require('luaunit') function test_humaneval() local candidate = choose_num lu.assertEquals(candidate(12, 15), 14) lu.assertEquals(candidate(13, 12), -1) lu.assertEquals(candidate(33, 12354), 12354) lu.assertEquals(candidate(5234, 5233), -1) lu.assertEquals(candidate(6, 29), 28) lu.assertEqu...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_103_rounded_avg
lua
-- You are given two positive integers n and m, and your task is to compute the -- average of the integers from n through m (including n and m). -- Round the answer to the nearest integer and convert that to binary. -- If n is greater than m, return -1. -- Example: -- >>> rounded_avg(1, 5) -- '0b11' -- >>> rounded_avg...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_103_rounded_avg.py
reworded
lu = require('luaunit') function test_humaneval() local candidate = rounded_avg lu.assertEquals(candidate(1, 5), '0b11') lu.assertEquals(candidate(7, 13), '0b1010') lu.assertEquals(candidate(964, 977), '0b1111001010') lu.assertEquals(candidate(996, 997), '0b1111100100') lu.assertEquals(candidate(56...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_104_unique_digits
lua
-- Given a table of positive integers x. return a sorted table of all -- elements that hasn't any even digit. -- Note: Returned table should be sorted in increasing order. -- For example: -- >>> unique_digits({15, 33, 1422, 1}) -- {1, 15, 33} -- >>> unique_digits({152, 323, 1422, 10}) -- {} local function unique_digit...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_104_unique_digits.py
reworded
lu = require('luaunit') function test_humaneval() local candidate = unique_digits lu.assertEquals(candidate({15, 33, 1422, 1}), {1, 15, 33}) lu.assertEquals(candidate({152, 323, 1422, 10}), {}) lu.assertEquals(candidate({12345, 2033, 111, 151}), {111, 151}) lu.assertEquals(candidate({135, 103, 31}), {3...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_105_by_length
lua
-- Given a table of integers, sort the integers that are between 1 and 9 inclusive, -- reverse the resulting table, and then replace each digit by its corresponding name from -- "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine". -- For example: -- >>> by_length({2, 1, 1, 4, 5, 8, 2, 3}) -- {'Eight'...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_105_by_length.py
reworded
lu = require('luaunit') function test_humaneval() local candidate = by_length lu.assertEquals(candidate({2, 1, 1, 4, 5, 8, 2, 3}), {'Eight', 'Five', 'Four', 'Three', 'Two', 'Two', 'One', 'One'}) lu.assertEquals(candidate({}), {}) lu.assertEquals(candidate({1, -1, 55}), {'One'}) lu.assertEquals(candidat...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_106_f
lua
-- Implement the function f that takes n as a parameter, -- and returns a table of size n, such that the value of the element at index i is the factorial of i if i is even -- or the sum of numbers from 1 to i otherwise. -- i starts from 1. -- the factorial of i is the multiplication of the numbers from 1 to i (1 * 2 *...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_106_f.py
reworded
lu = require('luaunit') function test_humaneval() local candidate = f lu.assertEquals(candidate(5), {1, 2, 6, 24, 15}) lu.assertEquals(candidate(7), {1, 2, 6, 24, 15, 720, 28}) lu.assertEquals(candidate(1), {1}) lu.assertEquals(candidate(3), {1, 2, 6}) end os.exit(lu.LuaUnit.run())
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_107_even_odd_palindrome
lua
-- Given a positive integer n, return a table that has the number of even and odd -- integer palindromes that fall within the range(1, n), inclusive. -- Example 1: -- >>> even_odd_palindrome(3) -- {1, 2} -- Explanation: -- Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd. -- Example ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_107_even_odd_palindrome.py
reworded
lu = require('luaunit') function test_humaneval() local candidate = even_odd_palindrome lu.assertEquals(candidate(123), {8, 13}) lu.assertEquals(candidate(12), {4, 6}) lu.assertEquals(candidate(3), {1, 2}) lu.assertEquals(candidate(63), {6, 8}) lu.assertEquals(candidate(25), {5, 6}) lu.assertEq...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_108_count_nums
lua
-- Write a function count_nums which takes a table of integers and returns -- the number of elements which has a sum of digits > 0. -- If a number is negative, then its first signed digit will be negative: -- e.g. -123 has signed digits -1, 2, and 3. -- >>> count_nums({}) -- 0 -- >>> count_nums({-1, 11, -11}) -- 1 -- >...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_108_count_nums.py
reworded
lu = require('luaunit') function test_humaneval() local candidate = count_nums lu.assertEquals(candidate({}), 0) lu.assertEquals(candidate({-1, -2, 0}), 0) lu.assertEquals(candidate({1, 1, 2, -2, 3, 4, 5}), 6) lu.assertEquals(candidate({1, 6, 9, -6, 0, 1, 5}), 5) lu.assertEquals(candidate({1, 100, ...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_109_move_one_ball
lua
-- We have a table 'arr' of N integers arr[1], arr[2], ..., arr[N].The -- numbers in the table will be randomly ordered. Your task is to determine if -- it is possible to get a table sorted in non-decreasing order by performing -- the following operation on the given table: -- You are allowed to perform right shif...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_109_move_one_ball.py
reworded
lu = require('luaunit') function test_humaneval() local candidate = move_one_ball lu.assertEquals(candidate({3, 4, 5, 1, 2}), true) lu.assertEquals(candidate({3, 5, 10, 1, 2}), true) lu.assertEquals(candidate({4, 3, 1, 2}), false) lu.assertEquals(candidate({3, 5, 4, 1, 2}), false) lu.assertEquals(c...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]
HumanEval_10_make_palindrome
lua
-- Find the shortest palindrome that begins with a supplied string. -- Algorithm idea is simple: -- - Find the longest postfix of supplied string that is a palindrome. -- - Append to the end of the string reverse of a string prefix that comes before the palindromic suffix. -- >>> make_palindrome('') -- '' -- >>> make_...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_10_make_palindrome.py
reworded
lu = require('luaunit') function test_humaneval() local candidate = make_palindrome lu.assertEquals(candidate(''), '') lu.assertEquals(candidate('x'), 'x') lu.assertEquals(candidate('xyz'), 'xyzyx') lu.assertEquals(candidate('xyx'), 'xyx') lu.assertEquals(candidate('jerry'), 'jerryrrej') end os.ex...
[ "\nlocal", "\nfunction", "\n--", "\n\n" ]