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_24_largest_divisor
d
import std.math; import std.typecons; /* For a given number n, find the largest number that divides n evenly, smaller than n */ long largest_divisor(long n)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_24_largest_divisor.py
verbatim
unittest { alias candidate = largest_divisor; assert(candidate(3L) == 1L); assert(candidate(7L) == 1L); assert(candidate(10L) == 5L); assert(candidate(100L) == 50L); assert(candidate(49L) == 7L); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_25_factorize
d
import std.math; import std.typecons; /* 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 */ long[] factorize...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_25_factorize.py
verbatim
unittest { alias candidate = factorize; assert(candidate(2L) == [2L]); assert(candidate(4L) == [2L, 2L]); assert(candidate(8L) == [2L, 2L, 2L]); assert(candidate(57L) == [3L, 19L]); assert(candidate(3249L) == [3L, 3L, 19L, 19L]); assert(candidate(185193L) == [3L, 3L, 3L, 19L, 19L, 19L]); ...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_26_remove_duplicates
d
import std.math; import std.typecons; /* From a list of integers, remove all elements that occur more than once. Keep order of elements left the same as in the input. */ long[] remove_duplicates(long[] numbers)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_26_remove_duplicates.py
verbatim
unittest { alias candidate = remove_duplicates; assert(candidate([]) == []); assert(candidate([1L, 2L, 3L, 4L]) == [1L, 2L, 3L, 4L]); assert(candidate([1L, 2L, 3L, 2L, 4L, 3L, 5L]) == [1L, 4L, 5L]); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_27_flip_case
d
import std.math; import std.typecons; /* For a given string, flip lowercase characters to uppercase and uppercase to lowercase. */ string flip_case(string string)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_27_flip_case.py
verbatim
unittest { alias candidate = flip_case; assert(candidate("") == ""); assert(candidate("Hello!") == "hELLO!"); assert(candidate("These violent delights have violent ends") == "tHESE VIOLENT DELIGHTS HAVE VIOLENT ENDS"); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_28_concatenate
d
import std.math; import std.typecons; /* Concatenate list of strings into a single string */ string concatenate(string[] strings)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_28_concatenate.py
verbatim
unittest { alias candidate = concatenate; assert(candidate([]) == ""); assert(candidate(["x", "y", "z"]) == "xyz"); assert(candidate(["x", "y", "z", "w", "k"]) == "xyzwk"); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_29_filter_by_prefix
d
import std.math; import std.typecons; /* Filter an input list of strings only for ones that start with a given prefix. */ string[] filter_by_prefix(string[] strings, string prefix)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_29_filter_by_prefix.py
verbatim
unittest { alias candidate = filter_by_prefix; assert(candidate([], "john") == []); assert(candidate(["xxx", "asd", "xxy", "john doe", "xxxAAA", "xxx"], "xxx") == ["xxx", "xxxAAA", "xxx"]); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_2_truncate_number
d
import std.math; import std.typecons; /* 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. */ float truncate_number(float number)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_2_truncate_number.py
verbatim
unittest { alias candidate = truncate_number; assert(candidate(3.5) == 0.5); assert(candidate(1.25) == 0.25); assert(candidate(123.0) == 0.0); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_30_get_positive
d
import std.math; import std.typecons; /* Return only positive numbers in the list. */ long[] get_positive(long[] l)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_30_get_positive.py
verbatim
unittest { alias candidate = get_positive; assert(candidate([-1L, -2L, 4L, 5L, 6L]) == [4L, 5L, 6L]); assert(candidate([5L, 3L, -5L, 2L, 3L, 3L, 9L, 0L, 123L, 1L, -10L]) == [5L, 3L, 2L, 3L, 3L, 9L, 123L, 1L]); assert(candidate([-1L, -2L]) == []); assert(candidate([]) == []); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_31_is_prime
d
import std.math; import std.typecons; /* Return true if a given number is prime, and false otherwise. */ bool is_prime(long n)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_31_is_prime.py
verbatim
unittest { alias candidate = is_prime; assert(candidate(6L) == false); assert(candidate(101L) == true); assert(candidate(11L) == true); assert(candidate(13441L) == true); assert(candidate(61L) == true); assert(candidate(4L) == false); assert(candidate(1L) == false); assert(candidate...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_33_sort_third
d
import std.math; import std.typecons; /* 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. */ long[] sort_...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_33_sort_third.py
verbatim
unittest { alias candidate = sort_third; assert(candidate([5L, 6L, 3L, 4L, 8L, 9L, 2L]) == [2L, 6L, 3L, 4L, 8L, 9L, 5L]); assert(candidate([5L, 8L, 3L, 4L, 6L, 9L, 2L]) == [2L, 8L, 3L, 4L, 6L, 9L, 5L]); assert(candidate([5L, 6L, 9L, 4L, 8L, 3L, 2L]) == [2L, 6L, 9L, 4L, 8L, 3L, 5L]); assert(candidat...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_34_unique
d
import std.math; import std.typecons; /* Return sorted unique elements in a list */ long[] unique(long[] l)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_34_unique.py
verbatim
unittest { alias candidate = unique; assert(candidate([5L, 3L, 5L, 2L, 3L, 3L, 9L, 0L, 123L]) == [0L, 2L, 3L, 5L, 9L, 123L]); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_35_max_element
d
import std.math; import std.typecons; /* Return maximum element in the list. */ long max_element(long[] l)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_35_max_element.py
verbatim
unittest { alias candidate = max_element; assert(candidate([1L, 2L, 3L]) == 3L); assert(candidate([5L, 3L, -5L, 2L, -3L, 3L, 9L, 0L, 124L, 1L, -10L]) == 124L); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_36_fizz_buzz
d
import std.math; import std.typecons; /* Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13. */ long fizz_buzz(long n)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_36_fizz_buzz.py
verbatim
unittest { alias candidate = fizz_buzz; assert(candidate(50L) == 0L); assert(candidate(78L) == 2L); assert(candidate(79L) == 3L); assert(candidate(100L) == 3L); assert(candidate(200L) == 6L); assert(candidate(4000L) == 192L); assert(candidate(10000L) == 639L); assert(candidate(10000...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_37_sort_even
d
import std.math; import std.typecons; /* 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. */ long[] sort_even(long[] l)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_37_sort_even.py
verbatim
unittest { alias candidate = sort_even; assert(candidate([1L, 2L, 3L]) == [1L, 2L, 3L]); assert(candidate([5L, 3L, -5L, 2L, -3L, 3L, 9L, 0L, 123L, 1L, -10L]) == [-10L, 3L, -5L, 2L, -3L, 3L, 5L, 0L, 9L, 1L, 123L]); assert(candidate([5L, 8L, -12L, 4L, 23L, 2L, 3L, 11L, 12L, -10L]) == [-12L, 8L, 3L, 4L, 5...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_39_prime_fib
d
import std.math; import std.typecons; /* prime_fib returns n-th number that is a Fibonacci number and it's also prime. */ long prime_fib(long n)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_39_prime_fib.py
verbatim
unittest { alias candidate = prime_fib; assert(candidate(1L) == 2L); assert(candidate(2L) == 3L); assert(candidate(3L) == 5L); assert(candidate(4L) == 13L); assert(candidate(5L) == 89L); assert(candidate(6L) == 233L); assert(candidate(7L) == 1597L); assert(candidate(8L) == 28657L); ...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_3_below_zero
d
import std.math; import std.typecons; /* 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. */ bool be...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_3_below_zero.py
verbatim
unittest { alias candidate = below_zero; assert(candidate([]) == false); assert(candidate([1L, 2L, -3L, 1L, 2L, -3L]) == false); assert(candidate([1L, 2L, -4L, 5L, 6L]) == true); assert(candidate([1L, -1L, 2L, -2L, 5L, -5L, 4L, -4L]) == false); assert(candidate([1L, -1L, 2L, -2L, 5L, -5L, 4L, -...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_40_triples_sum_to_zero
d
import std.math; import std.typecons; /* 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. */ bool triples_sum_to_zero(long[] l)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_40_triples_sum_to_zero.py
verbatim
unittest { alias candidate = triples_sum_to_zero; assert(candidate([1L, 3L, 5L, 0L]) == false); assert(candidate([1L, 3L, 5L, -1L]) == false); assert(candidate([1L, 3L, -2L, 1L]) == true); assert(candidate([1L, 2L, 3L, 7L]) == false); assert(candidate([1L, 2L, 5L, 7L]) == false); assert(can...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_42_incr_list
d
import std.math; import std.typecons; /* Return list with elements incremented by 1. */ long[] incr_list(long[] l)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_42_incr_list.py
verbatim
unittest { alias candidate = incr_list; assert(candidate([]) == []); assert(candidate([3L, 2L, 1L]) == [4L, 3L, 2L]); assert(candidate([5L, 2L, 5L, 2L, 3L, 3L, 9L, 0L, 123L]) == [6L, 3L, 6L, 3L, 4L, 4L, 10L, 1L, 124L]); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_43_pairs_sum_to_zero
d
import std.math; import std.typecons; /* 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. */ bool pairs_sum_to_zero(long[] l)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_43_pairs_sum_to_zero.py
verbatim
unittest { alias candidate = pairs_sum_to_zero; assert(candidate([1L, 3L, 5L, 0L]) == false); assert(candidate([1L, 3L, -2L, 1L]) == false); assert(candidate([1L, 2L, 3L, 7L]) == false); assert(candidate([2L, 4L, -5L, 3L, 5L, 7L]) == true); assert(candidate([1L]) == false); assert(candidate...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_44_change_base
d
import std.math; import std.typecons; /* Change numerical base of input number x to base. return string representation after the conversion. base numbers are less than 10. */ string change_base(long x, long base)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_44_change_base.py
verbatim
unittest { alias candidate = change_base; assert(candidate(8L, 3L) == "22"); assert(candidate(9L, 3L) == "100"); assert(candidate(234L, 2L) == "11101010"); assert(candidate(16L, 2L) == "10000"); assert(candidate(8L, 2L) == "1000"); assert(candidate(7L, 2L) == "111"); assert(candidate(2L...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_45_triangle_area
d
import std.math; import std.typecons; /* Given length of a side and high return area for a triangle. */ float triangle_area(long a, long h)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_45_triangle_area.py
verbatim
unittest { alias candidate = triangle_area; assert(candidate(5L, 3L) == 7.5); assert(candidate(2L, 2L) == 2.0); assert(candidate(10L, 8L) == 40.0); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_46_fib4
d
import std.math; import std.typecons; /* 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 t...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_46_fib4.py
verbatim
unittest { alias candidate = fib4; assert(candidate(5L) == 4L); assert(candidate(8L) == 28L); assert(candidate(10L) == 104L); assert(candidate(12L) == 386L); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_47_median
d
import std.math; import std.typecons; /* Return median of elements in the list l. */ float median(long[] l)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_47_median.py
verbatim
unittest { alias candidate = median; assert(candidate([3L, 1L, 2L, 4L, 5L]) == 3L); assert(candidate([-10L, 4L, 6L, 1000L, 10L, 20L]) == 8.0); assert(candidate([5L]) == 5L); assert(candidate([6L, 5L]) == 5.5); assert(candidate([8L, 1L, 3L, 9L, 9L, 2L, 7L]) == 7L); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_48_is_palindrome
d
import std.math; import std.typecons; /* Checks if given string is a palindrome */ bool is_palindrome(string text)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_48_is_palindrome.py
verbatim
unittest { alias candidate = is_palindrome; assert(candidate("") == true); assert(candidate("aba") == true); assert(candidate("aaaaa") == true); assert(candidate("zbcd") == false); assert(candidate("xywyx") == true); assert(candidate("xywyz") == false); assert(candidate("xywzx") == fals...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_49_modp
d
import std.math; import std.typecons; /* Return 2^n modulo p (be aware of numerics). */ long modp(long n, long p)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_49_modp.py
verbatim
unittest { alias candidate = modp; assert(candidate(3L, 5L) == 3L); assert(candidate(1101L, 101L) == 2L); assert(candidate(0L, 101L) == 1L); assert(candidate(3L, 11L) == 8L); assert(candidate(100L, 101L) == 1L); assert(candidate(30L, 5L) == 4L); assert(candidate(31L, 5L) == 3L); } void ...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_4_mean_absolute_deviation
d
import std.math; import std.typecons; /* 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 | */ float mean_absolute_devia...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_4_mean_absolute_deviation.py
verbatim
unittest { alias candidate = mean_absolute_deviation; assert(candidate([1.0, 2.0]) == 0.5); assert(candidate([1.0, 2.0, 3.0, 4.0]) == 1.0); assert(candidate([1.0, 2.0, 3.0, 4.0, 5.0]) == 1.2); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_51_remove_vowels
d
import std.math; import std.typecons; /* remove_vowels is a function that takes string and returns string without vowels. */ string remove_vowels(string text)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_51_remove_vowels.py
verbatim
unittest { alias candidate = remove_vowels; assert(candidate("") == ""); assert(candidate("abcdef ghijklm") == "bcdf ghjklm"); assert(candidate("fedcba") == "fdcb"); assert(candidate("eeeee") == ""); assert(candidate("acBAA") == "cB"); assert(candidate("EcBOO") == "cB"); assert(candidat...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_52_below_threshold
d
import std.math; import std.typecons; /* Return True if all numbers in the list l are below threshold t. */ bool below_threshold(long[] l, long t)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_52_below_threshold.py
verbatim
unittest { alias candidate = below_threshold; assert(candidate([1L, 2L, 4L, 10L], 100L) == true); assert(candidate([1L, 20L, 4L, 10L], 5L) == false); assert(candidate([1L, 20L, 4L, 10L], 21L) == true); assert(candidate([1L, 20L, 4L, 10L], 22L) == true); assert(candidate([1L, 8L, 4L, 10L], 11L) ...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_53_add
d
import std.math; import std.typecons; /* Add two numbers x and y */ long add(long x, long y)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_53_add.py
verbatim
unittest { alias candidate = add; assert(candidate(0L, 1L) == 1L); assert(candidate(1L, 0L) == 1L); assert(candidate(2L, 3L) == 5L); assert(candidate(5L, 7L) == 12L); assert(candidate(7L, 5L) == 12L); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_54_same_chars
d
import std.math; import std.typecons; /* Check if two words have the same characters. */ bool same_chars(string s0, string s1)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_54_same_chars.py
verbatim
unittest { alias candidate = same_chars; assert(candidate("eabcdzzzz", "dddzzzzzzzddeddabc") == true); assert(candidate("abcd", "dddddddabc") == true); assert(candidate("dddddddabc", "abcd") == true); assert(candidate("eabcd", "dddddddabc") == false); assert(candidate("abcd", "dddddddabcf") == ...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_55_fib
d
import std.math; import std.typecons; /* Return n-th Fibonacci number. */ long fib(long n)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_55_fib.py
verbatim
unittest { alias candidate = fib; assert(candidate(10L) == 55L); assert(candidate(1L) == 1L); assert(candidate(8L) == 21L); assert(candidate(11L) == 89L); assert(candidate(12L) == 144L); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_56_correct_bracketing
d
import std.math; import std.typecons; /* brackets is a string of "<" and ">". return True if every opening bracket has a corresponding closing bracket. */ bool correct_bracketing(string brackets)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_56_correct_bracketing.py
verbatim
unittest { alias candidate = correct_bracketing; assert(candidate("<>") == true); assert(candidate("<<><>>") == true); assert(candidate("<><><<><>><>") == true); assert(candidate("<><><<<><><>><>><<><><<>>>") == true); assert(candidate("<<<><>>>>") == false); assert(candidate("><<>") == fal...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_57_monotonic
d
import std.math; import std.typecons; /* Return True is list elements are monotonically increasing or decreasing. */ bool monotonic(long[] l)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_57_monotonic.py
verbatim
unittest { alias candidate = monotonic; assert(candidate([1L, 2L, 4L, 10L]) == true); assert(candidate([1L, 2L, 4L, 20L]) == true); assert(candidate([1L, 20L, 4L, 10L]) == false); assert(candidate([4L, 1L, 0L, -10L]) == true); assert(candidate([4L, 1L, 1L, 0L]) == true); assert(candidate([1...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_58_common
d
import std.math; import std.typecons; /* Return sorted unique common elements for two lists. */ long[] common(long[] l1, long[] l2)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_58_common.py
verbatim
unittest { alias candidate = common; assert(candidate([1L, 4L, 3L, 34L, 653L, 2L, 5L], [5L, 7L, 1L, 5L, 9L, 653L, 121L]) == [1L, 5L, 653L]); assert(candidate([5L, 3L, 2L, 8L], [3L, 2L]) == [2L, 3L]); assert(candidate([4L, 3L, 2L, 8L], [3L, 2L, 4L]) == [2L, 3L, 4L]); assert(candidate([4L, 3L, 2L, 8L...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_59_largest_prime_factor
d
import std.math; import std.typecons; /* Return the largest prime factor of n. Assume n > 1 and is not a prime. */ long largest_prime_factor(long n)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_59_largest_prime_factor.py
verbatim
unittest { alias candidate = largest_prime_factor; assert(candidate(15L) == 5L); assert(candidate(27L) == 3L); assert(candidate(63L) == 7L); assert(candidate(330L) == 11L); assert(candidate(13195L) == 29L); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_5_intersperse
d
import std.math; import std.typecons; /* Insert a number 'delimeter' between every two consecutive elements of input list `numbers' */ long[] intersperse(long[] numbers, long delimeter)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_5_intersperse.py
verbatim
unittest { alias candidate = intersperse; assert(candidate([], 7L) == []); assert(candidate([5L, 6L, 3L, 2L], 8L) == [5L, 8L, 6L, 8L, 3L, 8L, 2L]); assert(candidate([2L, 2L, 2L], 2L) == [2L, 2L, 2L, 2L, 2L]); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_60_sum_to_n
d
import std.math; import std.typecons; /* sum_to_n is a function that sums numbers from 1 to n. */ long sum_to_n(long n)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_60_sum_to_n.py
verbatim
unittest { alias candidate = sum_to_n; assert(candidate(1L) == 1L); assert(candidate(6L) == 21L); assert(candidate(11L) == 66L); assert(candidate(30L) == 465L); assert(candidate(100L) == 5050L); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_61_correct_bracketing
d
import std.math; import std.typecons; /* brackets is a string of "(" and ")". return True if every opening bracket has a corresponding closing bracket. */ bool correct_bracketing(string brackets)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_61_correct_bracketing.py
verbatim
unittest { alias candidate = correct_bracketing; assert(candidate("()") == true); assert(candidate("(()())") == true); assert(candidate("()()(()())()") == true); assert(candidate("()()((()()())())(()()(()))") == true); assert(candidate("((()())))") == false); assert(candidate(")(()") == fal...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_62_derivative
d
import std.math; import std.typecons; /* xs represent coefficients of a polynomial. xs[0] + xs[1] * x + xs[2] * x^2 + .... Return derivative of this polynomial in the same form. */ long[] derivative(long[] xs)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_62_derivative.py
verbatim
unittest { alias candidate = derivative; assert(candidate([3L, 1L, 2L, 4L, 5L]) == [1L, 4L, 12L, 20L]); assert(candidate([1L, 2L, 3L]) == [2L, 6L]); assert(candidate([3L, 2L, 1L]) == [2L, 2L]); assert(candidate([3L, 2L, 1L, 0L, 4L]) == [2L, 2L, 0L, 16L]); assert(candidate([1L]) == []); } void m...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_63_fibfib
d
import std.math; import std.typecons; /* 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...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_63_fibfib.py
verbatim
unittest { alias candidate = fibfib; assert(candidate(2L) == 1L); assert(candidate(1L) == 0L); assert(candidate(5L) == 4L); assert(candidate(8L) == 24L); assert(candidate(10L) == 81L); assert(candidate(12L) == 274L); assert(candidate(14L) == 927L); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_64_vowels_count
d
import std.math; import std.typecons; /* 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: */ long vowels_c...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_64_vowels_count.py
verbatim
unittest { alias candidate = vowels_count; assert(candidate("abcde") == 2L); assert(candidate("Alone") == 3L); assert(candidate("key") == 2L); assert(candidate("bye") == 1L); assert(candidate("keY") == 2L); assert(candidate("bYe") == 1L); assert(candidate("ACEDY") == 3L); } void main(){...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_65_circular_shift
d
import std.math; import std.typecons; /* 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. */ string circular_shift(long x, long shift)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_65_circular_shift.py
verbatim
unittest { alias candidate = circular_shift; assert(candidate(100L, 2L) == "001"); assert(candidate(12L, 2L) == "12"); assert(candidate(97L, 8L) == "79"); assert(candidate(12L, 1L) == "21"); assert(candidate(11L, 101L) == "11"); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_66_digitSum
d
import std.math; import std.typecons; /* Task Write a function that takes a string as input and returns the sum of the upper characters only' ASCII codes. Examples: */ long digitSum(string s)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_66_digitSum.py
verbatim
unittest { alias candidate = digitSum; assert(candidate("") == 0L); assert(candidate("abAB") == 131L); assert(candidate("abcCd") == 67L); assert(candidate("helloE") == 69L); assert(candidate("woArBld") == 131L); assert(candidate("aAaaaXa") == 153L); assert(candidate(" How are yOu?") == ...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_67_fruit_distribution
d
import std.math; import std.typecons; /* 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...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_67_fruit_distribution.py
verbatim
unittest { alias candidate = fruit_distribution; assert(candidate("5 apples and 6 oranges", 19L) == 8L); assert(candidate("5 apples and 6 oranges", 21L) == 10L); assert(candidate("0 apples and 1 oranges", 3L) == 2L); assert(candidate("1 apples and 0 oranges", 3L) == 2L); assert(candidate("2 app...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_68_pluck
d
import std.math; import std.typecons; /* "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 no...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_68_pluck.py
verbatim
unittest { alias candidate = pluck; assert(candidate([4L, 2L, 3L]) == [2L, 1L]); assert(candidate([1L, 2L, 3L]) == [2L, 1L]); assert(candidate([]) == []); assert(candidate([5L, 0L, 3L, 0L, 4L, 2L]) == [0L, 1L]); assert(candidate([1L, 2L, 3L, 0L, 5L, 3L]) == [0L, 3L]); assert(candidate([5L, ...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_69_search
d
import std.math; import std.typecons; /* 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 val...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_69_search.py
verbatim
unittest { alias candidate = search; assert(candidate([5L, 5L, 5L, 5L, 1L]) == 1L); assert(candidate([4L, 1L, 4L, 1L, 4L, 4L]) == 4L); assert(candidate([3L, 3L]) == -1L); assert(candidate([8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L]) == 8L); assert(candidate([2L, 3L, 3L, 2L, 2L]) == 2L); assert(candida...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_6_parse_nested_parens
d
import std.math; import std.typecons; /* 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. */ long[] parse_nested_par...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_6_parse_nested_parens.py
verbatim
unittest { alias candidate = parse_nested_parens; assert(candidate("(()()) ((())) () ((())()())") == [2L, 3L, 1L, 3L]); assert(candidate("() (()) ((())) (((())))") == [1L, 2L, 3L, 4L]); assert(candidate("(()(())((())))") == [4L]); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_70_strange_sort_list
d
import std.math; import std.typecons; /* 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: */ long[] strange_sort_list(long[] lst)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_70_strange_sort_list.py
verbatim
unittest { alias candidate = strange_sort_list; assert(candidate([1L, 2L, 3L, 4L]) == [1L, 4L, 2L, 3L]); assert(candidate([5L, 6L, 7L, 8L, 9L]) == [5L, 9L, 6L, 8L, 7L]); assert(candidate([1L, 2L, 3L, 4L, 5L]) == [1L, 5L, 2L, 4L, 3L]); assert(candidate([5L, 6L, 7L, 8L, 9L, 1L]) == [1L, 9L, 5L, 8L, 6...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_71_triangle_area
d
import std.math; import std.typecons; /* 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...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_71_triangle_area.py
verbatim
unittest { alias candidate = triangle_area; assert(candidate(3L, 4L, 5L) == 6.0); assert(candidate(1L, 2L, 10L) == -1L); assert(candidate(4L, 8L, 5L) == 8.18); assert(candidate(2L, 2L, 2L) == 1.73); assert(candidate(1L, 2L, 3L) == -1L); assert(candidate(10L, 5L, 7L) == 16.25); assert(ca...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_72_will_it_fly
d
import std.math; import std.typecons; /* 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 possib...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_72_will_it_fly.py
verbatim
unittest { alias candidate = will_it_fly; assert(candidate([3L, 2L, 3L], 9L) == true); assert(candidate([1L, 2L], 5L) == false); assert(candidate([3L], 5L) == true); assert(candidate([3L, 2L, 3L], 1L) == false); assert(candidate([1L, 2L, 3L], 6L) == false); assert(candidate([5L], 5L) == tru...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_73_smallest_change
d
import std.math; import std.typecons; /* 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: *...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_73_smallest_change.py
verbatim
unittest { alias candidate = smallest_change; assert(candidate([1L, 2L, 3L, 5L, 4L, 7L, 9L, 6L]) == 4L); assert(candidate([1L, 2L, 3L, 4L, 3L, 2L, 2L]) == 1L); assert(candidate([1L, 4L, 2L]) == 1L); assert(candidate([1L, 4L, 4L, 2L]) == 1L); assert(candidate([1L, 2L, 3L, 2L, 1L]) == 0L); as...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_74_total_match
d
import std.math; import std.typecons; /* 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 */ string[] total_match(string[] lst1,...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_74_total_match.py
verbatim
unittest { alias candidate = total_match; assert(candidate([], []) == []); assert(candidate(["hi", "admin"], ["hi", "hi"]) == ["hi", "hi"]); assert(candidate(["hi", "admin"], ["hi", "hi", "admin", "project"]) == ["hi", "admin"]); assert(candidate(["4"], ["1", "2", "3", "4", "5"]) == ["4"]); ass...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_75_is_multiply_prime
d
import std.math; import std.typecons; /* 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 */ bool is_multiply_prime(long a)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_75_is_multiply_prime.py
verbatim
unittest { alias candidate = is_multiply_prime; assert(candidate(5L) == false); assert(candidate(30L) == true); assert(candidate(8L) == true); assert(candidate(10L) == false); assert(candidate(125L) == true); assert(candidate(105L) == true); assert(candidate(126L) == false); assert(...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_76_is_simple_power
d
import std.math; import std.typecons; /* 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: */ bool is_simple_power(long x, long n)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_76_is_simple_power.py
verbatim
unittest { alias candidate = is_simple_power; assert(candidate(16L, 2L) == true); assert(candidate(143214L, 16L) == false); assert(candidate(4L, 2L) == true); assert(candidate(9L, 3L) == true); assert(candidate(16L, 4L) == true); assert(candidate(24L, 2L) == false); assert(candidate(128...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_77_iscube
d
import std.math; import std.typecons; /* 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: */ bool iscube(long a)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_77_iscube.py
verbatim
unittest { alias candidate = iscube; assert(candidate(1L) == true); assert(candidate(2L) == false); assert(candidate(-1L) == true); assert(candidate(64L) == true); assert(candidate(180L) == false); assert(candidate(1000L) == true); assert(candidate(0L) == true); assert(candidate(172...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_78_hex_key
d
import std.math; import std.typecons; /* 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...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_78_hex_key.py
verbatim
unittest { alias candidate = hex_key; assert(candidate("AB") == 1L); assert(candidate("1077E") == 2L); assert(candidate("ABED1A33") == 4L); assert(candidate("2020") == 2L); assert(candidate("123456789ABCDEF0") == 6L); assert(candidate("112233445566778899AABBCCDDEEFF00") == 12L); } void main...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_79_decimal_to_binary
d
import std.math; import std.typecons; /* 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...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_79_decimal_to_binary.py
verbatim
unittest { alias candidate = decimal_to_binary; assert(candidate(0L) == "db0db"); assert(candidate(32L) == "db100000db"); assert(candidate(103L) == "db1100111db"); assert(candidate(15L) == "db1111db"); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_7_filter_by_substring
d
import std.math; import std.typecons; /* Filter an input list of strings only for ones that contain given substring */ string[] filter_by_substring(string[] strings, string substring)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_7_filter_by_substring.py
verbatim
unittest { alias candidate = filter_by_substring; assert(candidate([], "john") == []); assert(candidate(["xxx", "asd", "xxy", "john doe", "xxxAAA", "xxx"], "xxx") == ["xxx", "xxxAAA", "xxx"]); assert(candidate(["xxx", "asd", "aaaxxy", "john doe", "xxxAAA", "xxx"], "xx") == ["xxx", "aaaxxy", "xxxAAA", "...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_80_is_happy
d
import std.math; import std.typecons; /* 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: */ bool is_happy(string s)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_80_is_happy.py
verbatim
unittest { alias candidate = is_happy; assert(candidate("a") == false); assert(candidate("aa") == false); assert(candidate("abcd") == true); assert(candidate("aabb") == false); assert(candidate("adb") == true); assert(candidate("xyy") == false); assert(candidate("iopaxpoi") == true); ...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_81_numerical_letter_grade
d
import std.math; import std.typecons; /* 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 ...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_81_numerical_letter_grade.py
verbatim
unittest { alias candidate = numerical_letter_grade; assert(candidate([4.0, 3L, 1.7, 2L, 3.5]) == ["A+", "B", "C-", "C", "A-"]); assert(candidate([1.2]) == ["D+"]); assert(candidate([0.5]) == ["D-"]); assert(candidate([0.0]) == ["E"]); assert(candidate([1.0, 0.3, 1.5, 2.8, 3.3]) == ["D", "D-", ...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_82_prime_length
d
import std.math; import std.typecons; /* Write a function that takes a string and returns True if the string length is a prime number or False otherwise Examples */ bool prime_length(string string)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_82_prime_length.py
verbatim
unittest { alias candidate = prime_length; assert(candidate("Hello") == true); assert(candidate("abcdcba") == true); assert(candidate("kittens") == true); assert(candidate("orange") == false); assert(candidate("wow") == true); assert(candidate("world") == true); assert(candidate("MadaM"...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_84_solve
d
import std.math; import std.typecons; /* 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 */ string solve(long N)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_84_solve.py
verbatim
unittest { alias candidate = solve; assert(candidate(1000L) == "1"); assert(candidate(150L) == "110"); assert(candidate(147L) == "1100"); assert(candidate(333L) == "1001"); assert(candidate(963L) == "10010"); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_85_add
d
import std.math; import std.typecons; /* Given a non-empty list of integers lst. add the even elements that are at odd indices.. Examples: */ long add(long[] lst)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_85_add.py
verbatim
unittest { alias candidate = add; assert(candidate([4L, 88L]) == 88L); assert(candidate([4L, 5L, 6L, 7L, 2L, 122L]) == 122L); assert(candidate([4L, 0L, 6L, 7L]) == 0L); assert(candidate([4L, 4L, 6L, 8L]) == 12L); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_86_anti_shuffle
d
import std.math; import std.typecons; /* 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 ...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_86_anti_shuffle.py
verbatim
unittest { alias candidate = anti_shuffle; assert(candidate("Hi") == "Hi"); assert(candidate("hello") == "ehllo"); assert(candidate("number") == "bemnru"); assert(candidate("abcd") == "abcd"); assert(candidate("Hello World!!!") == "Hello !!!Wdlor"); assert(candidate("") == ""); assert(c...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_87_get_row
d
import std.math; import std.typecons; /* 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 e...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_87_get_row.py
verbatim
unittest { alias candidate = get_row; assert(candidate([[1L, 2L, 3L, 4L, 5L, 6L], [1L, 2L, 3L, 4L, 1L, 6L], [1L, 2L, 3L, 4L, 5L, 1L]], 1L) == [tuple(0L, 0L), tuple(1L, 4L), tuple(1L, 0L), tuple(2L, 5L), tuple(2L, 0L)]); assert(candidate([[1L, 2L, 3L, 4L, 5L, 6L], [1L, 2L, 3L, 4L, 5L, 6L], [1L, 2L, 3L, 4L, ...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_88_sort_array
d
import std.math; import std.typecons; /* 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 e...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_88_sort_array.py
verbatim
unittest { alias candidate = sort_array; assert(candidate([]) == []); assert(candidate([5L]) == [5L]); assert(candidate([2L, 4L, 3L, 0L, 1L, 5L]) == [0L, 1L, 2L, 3L, 4L, 5L]); assert(candidate([2L, 4L, 3L, 0L, 1L, 5L, 6L]) == [6L, 5L, 4L, 3L, 2L, 1L, 0L]); assert(candidate([2L, 1L]) == [1L, 2L]...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_89_encrypt
d
import std.math; import std.typecons; /* 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: */ string encrypt(string s)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_89_encrypt.py
verbatim
unittest { alias candidate = encrypt; assert(candidate("hi") == "lm"); assert(candidate("asdfghjkl") == "ewhjklnop"); assert(candidate("gf") == "kj"); assert(candidate("et") == "ix"); assert(candidate("faewfawefaewg") == "jeiajeaijeiak"); assert(candidate("hellomyfriend") == "lippsqcjvmirh"...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_8_sum_product
d
import std.math; import std.typecons; /* 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. */ Tuple!(long, long) sum_product(long[] numbers)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_8_sum_product.py
verbatim
unittest { alias candidate = sum_product; assert(candidate([]) == tuple(0L, 1L)); assert(candidate([1L, 1L, 1L]) == tuple(3L, 1L)); assert(candidate([100L, 0L]) == tuple(100L, 0L)); assert(candidate([3L, 5L, 7L]) == tuple(15L, 105L)); assert(candidate([10L]) == tuple(10L, 10L)); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_90_next_smallest
d
import std.math; import std.typecons; /* 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. */ Nullable!(long) next_smallest(long[] lst)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_90_next_smallest.py
verbatim
unittest { alias candidate = next_smallest; { auto result = candidate([1L, 2L, 3L, 4L, 5L]); assert(!result.isNull && result.get == 2L); } { auto result = candidate([5L, 1L, 4L, 3L, 2L]); assert(!result.isNull && result.get == 2L); } { auto result = candidate([]); ...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_91_is_bored
d
import std.math; import std.typecons; /* 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: */ long is_bored(string S)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_91_is_bored.py
verbatim
unittest { alias candidate = is_bored; assert(candidate("Hello world") == 0L); assert(candidate("Is the sky blue?") == 0L); assert(candidate("I love It !") == 1L); assert(candidate("bIt") == 0L); assert(candidate("I feel good today. I will be productive. will kill It") == 2L); assert(candid...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_92_any_int
d
import std.math; import std.typecons; /* 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 */ bool any_int(float x, float y, float z)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_92_any_int.py
verbatim
unittest { alias candidate = any_int; assert(candidate(2L, 3L, 1L) == true); assert(candidate(2.5, 2L, 3L) == false); assert(candidate(1.5, 5L, 3.5) == false); assert(candidate(2L, 6L, 2L) == false); assert(candidate(4L, 2L, 2L) == true); assert(candidate(2.2, 2.2, 2.2) == false); asser...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_93_encode
d
import std.math; import std.typecons; /* 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: */ string encode(string m...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_93_encode.py
verbatim
unittest { alias candidate = encode; assert(candidate("TEST") == "tgst"); assert(candidate("Mudasir") == "mWDCSKR"); assert(candidate("YES") == "ygs"); assert(candidate("This is a message") == "tHKS KS C MGSSCGG"); assert(candidate("I DoNt KnOw WhAt tO WrItE") == "k dQnT kNqW wHcT Tq wRkTg"); }...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_94_skjkasdkd
d
import std.math; import std.typecons; /* You are given a list of integers. You need to find the largest prime value and return the sum of its digits. Examples: */ long skjkasdkd(long[] lst)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_94_skjkasdkd.py
verbatim
unittest { alias candidate = skjkasdkd; assert(candidate([0L, 3L, 2L, 1L, 3L, 5L, 7L, 4L, 5L, 5L, 5L, 2L, 181L, 32L, 4L, 32L, 3L, 2L, 32L, 324L, 4L, 3L]) == 10L); assert(candidate([1L, 0L, 1L, 8L, 2L, 4597L, 2L, 1L, 3L, 40L, 1L, 2L, 1L, 2L, 4L, 2L, 5L, 1L]) == 25L); assert(candidate([1L, 3L, 1L, 32L, 5...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_95_check_dict_case
d
import std.math; import std.typecons; /* 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: */ bool check_dict_case(Nullable!(string[string]) dict)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_95_check_dict_case.py
verbatim
unittest { alias candidate = check_dict_case; assert(candidate(["p": "pineapple", "b": "banana"].nullable) == true); assert(candidate(["p": "pineapple", "A": "banana", "B": "banana"].nullable) == false); assert(candidate(["p": "pineapple", "5": "banana", "a": "apple"].nullable) == false); assert(ca...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_96_count_up_to
d
import std.math; import std.typecons; /* 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: */ long[] count_up_to(long n)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_96_count_up_to.py
verbatim
unittest { alias candidate = count_up_to; assert(candidate(5L) == [2L, 3L]); assert(candidate(6L) == [2L, 3L, 5L]); assert(candidate(7L) == [2L, 3L, 5L]); assert(candidate(10L) == [2L, 3L, 5L, 7L]); assert(candidate(0L) == []); assert(candidate(22L) == [2L, 3L, 5L, 7L, 11L, 13L, 17L, 19L]);...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_97_multiply
d
import std.math; import std.typecons; /* Complete the function that takes two integers and returns the product of their unit digits. Assume the input is always valid. Examples: */ long multiply(long a, long b)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_97_multiply.py
verbatim
unittest { alias candidate = multiply; assert(candidate(148L, 412L) == 16L); assert(candidate(19L, 28L) == 72L); assert(candidate(2020L, 1851L) == 0L); assert(candidate(14L, -15L) == 20L); assert(candidate(76L, 67L) == 42L); assert(candidate(17L, 27L) == 49L); assert(candidate(0L, 1L) =...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_98_count_upper
d
import std.math; import std.typecons; /* Given a string s, count the number of uppercase vowels in even indices. For example: */ long count_upper(string s)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_98_count_upper.py
verbatim
unittest { alias candidate = count_upper; assert(candidate("aBCdEf") == 1L); assert(candidate("abcdefg") == 0L); assert(candidate("dBBE") == 0L); assert(candidate("B") == 0L); assert(candidate("U") == 1L); assert(candidate("") == 0L); assert(candidate("EEEE") == 2L); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_99_closest_integer
d
import std.math; import std.typecons; /* 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 integ...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_99_closest_integer.py
verbatim
unittest { alias candidate = closest_integer; assert(candidate("10") == 10L); assert(candidate("14.5") == 15L); assert(candidate("-15.5") == -16L); assert(candidate("15.3") == 15L); assert(candidate("0") == 0L); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_9_rolling_max
d
import std.math; import std.typecons; /* From a given list of integers, generate a list of rolling maximum element found until given moment in the sequence. */ long[] rolling_max(long[] numbers)
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_9_rolling_max.py
verbatim
unittest { alias candidate = rolling_max; assert(candidate([]) == []); assert(candidate([1L, 2L, 3L, 4L]) == [1L, 2L, 3L, 4L]); assert(candidate([4L, 3L, 2L, 1L]) == [4L, 4L, 4L, 4L]); assert(candidate([3L, 2L, 3L, 100L, 3L]) == [3L, 3L, 3L, 100L, 100L]); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_0_has_close_elements
d
import std.math; /* Check if in given array 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 */ bool has_close_elements(float[] numbers, float threshold)
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_0_has_close_elements.py
reworded
unittest { alias candidate = has_close_elements; assert(candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.3) == true); assert(candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.05) == false); assert(candidate([1.0, 2.0, 5.9, 4.0, 5.0], 0.95) == true); assert(candidate([1.0, 2.0, 5.9, 4.0, 5.0], 0.8) == false); ...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_100_make_a_pile
d
import std.math; /* 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 an array, where element at ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_100_make_a_pile.py
reworded
unittest { alias candidate = make_a_pile; assert(candidate(3L) == [3L, 5L, 7L]); assert(candidate(4L) == [4L, 6L, 8L, 10L]); assert(candidate(5L) == [5L, 7L, 9L, 11L, 13L]); assert(candidate(6L) == [6L, 8L, 10L, 12L, 14L, 16L]); assert(candidate(8L) == [8L, 10L, 12L, 14L, 16L, 18L, 20L, 22L]); ...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_101_words_string
d
import std.math; /* You will be given a string of words separated by commas or spaces. Your task is to split the string into words and return an array 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
unittest { alias candidate = words_string; assert(candidate("Hi, my name is John") == ["Hi", "my", "name", "is", "John"]); assert(candidate("One, two, three, four, five, six") == ["One", "two", "three", "four", "five", "six"]); assert(candidate("Hi, my name") == ["Hi", "my", "name"]); assert(candid...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_102_choose_num
d
import std.math; /* 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(12L, 15L) 14L >>> choose_num(13L, 12L) -1L */ long choose_num(long x, long y...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_102_choose_num.py
reworded
unittest { alias candidate = choose_num; assert(candidate(12L, 15L) == 14L); assert(candidate(13L, 12L) == -1L); assert(candidate(33L, 12354L) == 12354L); assert(candidate(5234L, 5233L) == -1L); assert(candidate(6L, 29L) == 28L); assert(candidate(27L, 10L) == -1L); assert(candidate(7L, ...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_104_unique_digits
d
import std.math; /* Given an array of positive integers x. return a sorted array of all elements that hasn't any even digit. Note: Returned array should be sorted in increasing order. For example: >>> unique_digits([15L, 33L, 1422L, 1L]) [1L, 15L, 33L] >>> unique_digits([152L, 323L, 1422L, 10L]) [] */ long[] unique_di...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_104_unique_digits.py
reworded
unittest { alias candidate = unique_digits; assert(candidate([15L, 33L, 1422L, 1L]) == [1L, 15L, 33L]); assert(candidate([152L, 323L, 1422L, 10L]) == []); assert(candidate([12345L, 2033L, 111L, 151L]) == [111L, 151L]); assert(candidate([135L, 103L, 31L]) == [31L, 135L]); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_105_by_length
d
import std.math; /* Given an array of integers, sort the integers that are between 1 and 9 inclusive, reverse the resulting array, and then replace each digit by its corresponding name from "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine". For example: >>> by_length([2L, 1L, 1L, 4L, 5L, 8L, 2L, 3L...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_105_by_length.py
reworded
unittest { alias candidate = by_length; assert(candidate([2L, 1L, 1L, 4L, 5L, 8L, 2L, 3L]) == ["Eight", "Five", "Four", "Three", "Two", "Two", "One", "One"]); assert(candidate([]) == []); assert(candidate([1L, -1L, 55L]) == ["One"]); assert(candidate([1L, -1L, 3L, 2L]) == ["Three", "Two", "One"]); ...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_106_f
d
import std.math; /* Implement the function f that takes n as a parameter, and returns an array 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...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_106_f.py
reworded
unittest { alias candidate = f; assert(candidate(5L) == [1L, 2L, 6L, 24L, 15L]); assert(candidate(7L) == [1L, 2L, 6L, 24L, 15L, 720L, 28L]); assert(candidate(1L) == [1L]); assert(candidate(3L) == [1L, 2L, 6L]); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_107_even_odd_palindrome
d
import std.math; import std.typecons; /* Given a positive integer n, return a tuple that has the number of even and odd integer palindromes that fall within the range(1, n), inclusive. Example 1: >>> even_odd_palindrome(3L) tuple(1L, 2L) Explanation: Integer palindrome are 1, 2, 3. one of them is even, and two ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_107_even_odd_palindrome.py
reworded
unittest { alias candidate = even_odd_palindrome; assert(candidate(123L) == tuple(8L, 13L)); assert(candidate(12L) == tuple(4L, 6L)); assert(candidate(3L) == tuple(1L, 2L)); assert(candidate(63L) == tuple(6L, 8L)); assert(candidate(25L) == tuple(5L, 6L)); assert(candidate(19L) == tuple(4L, ...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_108_count_nums
d
import std.math; import std.typecons; /* Write a function count_nums which takes an array 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([]) 0L >>> count_nums([-...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_108_count_nums.py
reworded
unittest { alias candidate = count_nums; assert(candidate([]) == 0L); assert(candidate([-1L, -2L, 0L]) == 0L); assert(candidate([1L, 1L, 2L, -2L, 3L, 4L, 5L]) == 6L); assert(candidate([1L, 6L, 9L, -6L, 0L, 1L, 5L]) == 5L); assert(candidate([1L, 100L, 98L, -7L, 1L, -1L]) == 4L); assert(candi...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_109_move_one_ball
d
import std.math; import std.typecons; /* We have an array 'arr' of N integers arr[1], arr[2], ..., arr[N].The numbers in the array will be randomly ordered. Your task is to determine if it is possible to get an array sorted in non-decreasing order by performing the following operation on the given array: You are a...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_109_move_one_ball.py
reworded
unittest { alias candidate = move_one_ball; assert(candidate([3L, 4L, 5L, 1L, 2L]) == true); assert(candidate([3L, 5L, 10L, 1L, 2L]) == true); assert(candidate([4L, 3L, 1L, 2L]) == false); assert(candidate([3L, 5L, 4L, 1L, 2L]) == false); assert(candidate([]) == true); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_10_make_palindrome
d
import std.math; import std.typecons; /* 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_palindr...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_10_make_palindrome.py
reworded
unittest { alias candidate = make_palindrome; assert(candidate("") == ""); assert(candidate("x") == "x"); assert(candidate("xyz") == "xyzyx"); assert(candidate("xyx") == "xyx"); assert(candidate("jerry") == "jerryrrej"); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_110_exchange
d
import std.math; import std.typecons; /* In this problem, you will implement a function that takes two arrays of numbers, and determines whether it is possible to perform an exchange of elements between them to make lst1 an array of only even numbers. There is no limit on the number of exchanged elements between lst1 a...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_110_exchange.py
reworded
unittest { alias candidate = exchange; assert(candidate([1L, 2L, 3L, 4L], [1L, 2L, 3L, 4L]) == "YES"); assert(candidate([1L, 2L, 3L, 4L], [1L, 5L, 3L, 4L]) == "NO"); assert(candidate([1L, 2L, 3L, 4L], [2L, 1L, 4L, 3L]) == "YES"); assert(candidate([5L, 7L, 3L], [2L, 6L, 4L]) == "YES"); assert(ca...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_111_histogram
d
import std.math; import std.typecons; /* Given a string representing a space separated lowercase letters, return an associative array of the letter with the most repetition and containing the corresponding count. If several letters have the same occurrence, return all of them. Example: >>> histogram("a b c") ["a": 1L, ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_111_histogram.py
reworded
unittest { alias candidate = histogram; { auto result = candidate("a b b a"); assert(!result.isNull && result.get == ["a": 2L, "b": 2L]); } { auto result = candidate("a b c a b"); assert(!result.isNull && result.get == ["a": 2L, "b": 2L]); } { auto result = candidate("a b ...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_112_reverse_delete
d
import std.math; import std.typecons; /* Task 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 then check if the result string is palindrome. A string is called palindrome if it reads the same backward as forward. You should return a tuple containing the...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_112_reverse_delete.py
reworded
unittest { alias candidate = reverse_delete; assert(candidate("abcde", "ae") == tuple("bcd", false)); assert(candidate("abcdef", "b") == tuple("acdef", false)); assert(candidate("abcdedcba", "ab") == tuple("cdedc", true)); assert(candidate("dwik", "w") == tuple("dik", false)); assert(candidate(...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_113_odd_count
d
import std.math; import std.typecons; /* Given an array of strings, where each string consists of only digits, return an array. Each element i of the output should be "the number of odd elements in the string i of the input." where all the i's should be replaced by the number of odd digits in the i'th string of the inp...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_113_odd_count.py
reworded
unittest { alias candidate = odd_count; assert(candidate(["1234567"]) == ["the number of odd elements 4n the str4ng 4 of the 4nput."]); assert(candidate(["3", "11111111"]) == ["the number of odd elements 1n the str1ng 1 of the 1nput.", "the number of odd elements 8n the str8ng 8 of the 8nput."]); asser...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_114_minSubArraySum
d
import std.math; import std.typecons; /* Given an array of integers nums, find the minimum sum of any non-empty sub-array of nums. Example >>> minSubArraySum([2L, 3L, 4L, 1L, 2L, 4L]) 1L >>> minSubArraySum([-1L, -2L, -3L]) -6L */ long minSubArraySum(long[] nums)
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_114_minSubArraySum.py
reworded
unittest { alias candidate = minSubArraySum; assert(candidate([2L, 3L, 4L, 1L, 2L, 4L]) == 1L); assert(candidate([-1L, -2L, -3L]) == -6L); assert(candidate([-1L, -2L, -3L, 2L, -10L]) == -14L); assert(candidate([-9999999999999999L]) == -9999999999999999L); assert(candidate([0L, 10L, 20L, 1000000...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_115_max_fill
d
import std.math; import std.typecons; /* You are given a rectangular grid of wells. Each row represents a single well, and each 1 in a row represents a single unit of water. Each well has a corresponding bucket that can be used to extract water from it, and all buckets have the same capacity. Your task is to use the b...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_115_max_fill.py
reworded
unittest { alias candidate = max_fill; assert(candidate([[0L, 0L, 1L, 0L], [0L, 1L, 0L, 0L], [1L, 1L, 1L, 1L]], 1L) == 6L); assert(candidate([[0L, 0L, 1L, 1L], [0L, 0L, 0L, 0L], [1L, 1L, 1L, 1L], [0L, 1L, 1L, 1L]], 2L) == 5L); assert(candidate([[0L, 0L, 0L], [0L, 0L, 0L]], 5L) == 0L); assert(candid...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_116_sort_array
d
import std.math; import std.typecons; /* In this Kata, you have to sort an array of non-negative integers according to number of ones in their binary representation in ascending order. For similar number of ones, sort based on decimal value. It must be implemented like this: >>> sort_array([1L, 5L, 2L, 3L, 4L]) [1L, 2L...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_116_sort_array.py
reworded
unittest { alias candidate = sort_array; assert(candidate([1L, 5L, 2L, 3L, 4L]) == [1L, 2L, 4L, 3L, 5L]); assert(candidate([-2L, -3L, -4L, -5L, -6L]) == [-4L, -2L, -6L, -5L, -3L]); assert(candidate([1L, 0L, 2L, 3L, 4L]) == [0L, 1L, 2L, 4L, 3L]); assert(candidate([]) == []); assert(candidate([2L...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_117_select_words
d
import std.math; import std.typecons; /* Given a string s and a natural number n, you have been tasked to implement a function that returns an array of all words from string s that contain exactly n consonants, in order these words appear in the string s. If the string s is empty then the function should return an em...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_117_select_words.py
reworded
unittest { alias candidate = select_words; assert(candidate("Mary had a little lamb", 4L) == ["little"]); assert(candidate("Mary had a little lamb", 3L) == ["Mary", "lamb"]); assert(candidate("simple white space", 2L) == []); assert(candidate("Hello world", 4L) == ["world"]); assert(candidate("...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_118_get_closest_vowel
d
import std.math; import std.typecons; /* You are given a word. Your task is to find the closest vowel that stands between two consonants from the right side of the word (case sensitive). Vowels in the beginning and ending doesn't count. Return empty string if you didn't find any vowel met the above condition. You may...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_118_get_closest_vowel.py
reworded
unittest { alias candidate = get_closest_vowel; assert(candidate("yogurt") == "u"); assert(candidate("full") == "u"); assert(candidate("easy") == ""); assert(candidate("eAsy") == ""); assert(candidate("ali") == ""); assert(candidate("bad") == "a"); assert(candidate("most") == "o"); ...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_119_match_parens
d
import std.math; import std.typecons; /* You are given an array of two strings, both strings consist of open parentheses '(' or close parentheses ')' only. Your job is to check if it is possible to concatenate the two strings in some order, that the resulting string will be good. A string S is considered to be good if ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_119_match_parens.py
reworded
unittest { alias candidate = match_parens; assert(candidate(["()(", ")"]) == "Yes"); assert(candidate([")", ")"]) == "No"); assert(candidate(["(()(())", "())())"]) == "No"); assert(candidate([")())", "(()()("]) == "Yes"); assert(candidate(["(())))", "(()())(("]) == "Yes"); assert(candidate(...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]