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_69_search
d
import std.math; import std.typecons; /* You are given a non-empty array 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 array. If no such a v...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_69_search.py
reworded
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. >>> parse_nested_parens("(...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_6_parse_nested_parens.py
reworded
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 array of integers, return array 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: >>> strange_sort_list([1L, 2L, 3L, 4L]) [1L, 4L, 2L, 3L] >>> strange_sort_list([5L, 5L, 5L...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_70_strange_sort_list.py
reworded
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...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_71_triangle_area.py
reworded
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 array) and the sum of its elements is less than or equal the maximum possible weight w. Example: >>> will_it_fly([1L, 2L], 5L) false # 1+...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_72_will_it_fly.py
reworded
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: >...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_73_smallest_change.py
reworded
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 arrays of strings and returns the array that has total number of chars in the all strings of the array less than the other array. if the two arrays have the same number of chars, return the first array. Examples >>> total_match([], []) [] >>> t...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_74_total_match.py
reworded
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: >>> is_multiply_prime(30L) true 30 = 2 * 3 * 5 */ bool is_multiply_prime(long a)
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_75_is_multiply_prime.py
reworded
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: >>> is_simple_power(1L, 4L) true >>> is_simple_power(2L, 2L) true >>> is_simple_power(8L, 2L) true >>> is_simple_po...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_76_is_simple_power.py
reworded
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: >>> iscube(1L) true >>> iscube(2L) false >>> iscube(-1L) true >>> iscube(64L) true >>> iscube(0L) true >>> iscub...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_77_iscube.py
reworded
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...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_78_hex_key.py
reworded
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...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_79_decimal_to_binary.py
reworded
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 array of strings only for ones that contain given substring >>> filter_by_substring([], "a") [] >>> filter_by_substring(["abc", "bacd", "cde", "array"], "a") ["abc", "bacd", "array"] */ string[] filter_by_substring(string[] strings, string substring)
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_7_filter_by_substring.py
reworded
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 hapd or not. A string is hapd if its length is at least 3 and every 3 consecutive letters are distinct For example: >>> is_happy("a") false >>> is_happy("aa") false >>> is_happy("abcd") true >>> is_happy("aabb") fa...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_80_is_happy.py
reworded
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 an array of GPAs for some students and you have t...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_81_numerical_letter_grade.py
reworded
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 >>> prime_length("Hello") true >>> prime_length("abcdcba") true >>> prime_length("kittens") true >>> prime_length("orange") false */ bool prime_length(string ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_82_prime_length.py
reworded
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_83_starts_one_ends
d
import std.math; import std.typecons; /* Given a positive integer n, return the count of the numbers of n-digit positive integers that start or end with 1. */ long starts_one_ends(long n)
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_83_starts_one_ends.py
reworded
unittest { alias candidate = starts_one_ends; assert(candidate(1L) == 1L); assert(candidate(2L) == 18L); assert(candidate(3L) == 180L); assert(candidate(4L) == 1800L); assert(candidate(5L) == 18000L); } void main(){}
[ "\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 >>> solve(1000L) "1" >>> solve(150L) "110" >>> solve(147L) "1100" Variables: @N integer Constraints: 0 ≤ N ≤ 10000. Output: a string of binary number */ string solve(long N)
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_84_solve.py
reworded
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 array of integers lst. add the even elements that are at odd indices.. Examples: >>> add([4L, 2L, 6L, 7L]) 2L */ long add(long[] lst)
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_85_add.py
reworded
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 ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_86_anti_shuffle.py
reworded
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 arrays, 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 array, and return array of tuples, [(x1, y1), (x2, y2) ...] such tha...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_87_get_row.py
reworded
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 cod 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 ev...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_88_sort_array.py
reworded
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: >>> encrypt("hi") "lm" >>> enc...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_89_encrypt.py
reworded
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 array of integers, return a tuple consisting of a sum and a product of all the integers in an array. Empty sum should be equal to 0 and empty product should be equal to 1. >>> sum_product([]) tuple(0L, 1L) >>> sum_product([1L, 2L, 3L, 4L]) tuple(10L, 24L) */ Tuple!(...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_8_sum_product.py
reworded
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 an array of integers. Write a function next_smallest() that returns the 2nd smallest element of the array. Return null if there is no such element. >>> next_smallest([1L, 2L, 3L, 4L, 5L]) 2L >>> next_smallest([5L, 1L, 4L, 3L, 2L]) 2L >>> next_smallest([]) None >>> ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_90_next_smallest.py
reworded
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: >>> is_bored("Hello world") 0L >>> is_bored("The sky is blue. The sun is shining. ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_91_is_bored.py
reworded
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 >>> any_int(5L, 2L, 7L) true >>> any_int(3L, 2L, 2L) false >>> any_int(3L, -2L, 1L) true >>> ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_92_any_int.py
reworded
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: >>> encode("test") "TGST"...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_93_encode.py
reworded
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 an array of integers. You need to find the largest prime value and return the sum of its digits. Examples: >>> skjkasdkd([0L, 3L, 2L, 1L, 3L, 5L, 7L, 4L, 5L, 5L, 5L, 2L, 181L, 32L, 4L, 32L, 3L, 2L, 32L, 324L, 4L, 3L]) 10L >>> skjkasdkd([1L, 0L, 1L, 8L, 2L, 4597L, 2...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_94_skjkasdkd.py
reworded
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 an associative array, 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 associative array is empty. Examples: >>> check_dict_case(["a": "apple", "b": "banana"].nullable...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_95_check_dict_case.py
reworded
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: >>> count_up_to(5L) [2L, 3L] >>> count_up_to(11L) [2L, 3L, 5L, 7L] >>> count_up_to(0L) [] >>> count_up_to(20L) [2L, 3L, 5L, 7...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_96_count_up_to.py
reworded
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: >>> multiply(148L, 412L) 16L >>> multiply(19L, 28L) 72L >>> multiply(2020L, 1851L) 0L >>> multiply(14L, -15L) 20L */ long multiply(long a, lon...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_97_multiply.py
reworded
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: >>> count_upper("aBCdEf") 1L >>> count_upper("abcdefg") 0L >>> count_upper("dBBE") 0L */ long count_upper(string s)
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_98_count_upper.py
reworded
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 >>> closest_integer("10") 10L >>> closest_integer("15.3") 15L Note: Rounding away from zer...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_99_closest_integer.py
reworded
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 array of integers, generate an array of rolling maximum element found until given moment in the sequence. >>> rolling_max([1L, 2L, 3L, 2L, 3L, 4L, 2L]) [1L, 2L, 3L, 3L, 3L, 4L, 4L] */ long[] rolling_max(long[] numbers)
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_9_rolling_max.py
reworded
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 list 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
verbatim
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 a list, where element at in...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_100_make_a_pile.py
verbatim
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
verbatim
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
verbatim
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 a list of positive integers x. return a sorted list of all elements that hasn't any even digit. Note: Returned list 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_digits...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_104_unique_digits.py
verbatim
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
verbatim
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 a list 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
verbatim
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
verbatim
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
verbatim
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
verbatim
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
verbatim
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 lists of numbers, and determines whether it is possible to perform an exchange of elements between them to make lst1 a list of only even numbers. There is no limit on the number of exchanged elements between lst1 and ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_110_exchange.py
verbatim
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 a dictionary 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, "b": 1L,...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_111_histogram.py
verbatim
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
verbatim
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 a list of strings, where each string consists of only digits, return a list. 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 input. ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_113_odd_count.py
verbatim
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
verbatim
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
verbatim
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
verbatim
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 a list 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 empt...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_117_select_words.py
verbatim
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
verbatim
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 a list 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 an...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_119_match_parens.py
verbatim
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" ]
HumanEval_11_string_xor
d
import std.math; import std.typecons; /* Input are two strings a and b consisting only of 1s and 0s. Perform binary XOR on these inputs and return result also as a string. >>> string_xor("010", "110") "100" */ string string_xor(string a, string b)
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_11_string_xor.py
verbatim
unittest { alias candidate = string_xor; assert(candidate("111000", "101010") == "010010"); assert(candidate("1", "1") == "0"); assert(candidate("0101", "0000") == "0101"); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_120_maximum
d
import std.math; import std.typecons; /* Given an array arr of integers and a positive integer k, return a sorted list of length k with the maximum k numbers in arr. Example 1: >>> maximum([-3L, -4L, 5L], 3L) [-4L, -3L, 5L] Example 2: >>> maximum([4L, -4L, 4L], 2L) [4L, 4L] Example 3: >>> maximum([-3L, 2L, 1L, 2L, -1L...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_120_maximum.py
verbatim
unittest { alias candidate = maximum; assert(candidate([-3L, -4L, 5L], 3L) == [-4L, -3L, 5L]); assert(candidate([4L, -4L, 4L], 2L) == [4L, 4L]); assert(candidate([-3L, 2L, 1L, 2L, -1L, -2L, 1L], 1L) == [2L]); assert(candidate([123L, -123L, 20L, 0L, 1L, 2L, -3L], 3L) == [2L, 20L, 123L]); assert(...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_121_solution
d
import std.math; import std.typecons; /* Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions. Examples >>> solution([5L, 8L, 7L, 1L]) 12L >>> solution([3L, 3L, 3L, 3L, 3L]) 9L >>> solution([30L, 13L, 24L, 321L]) 0L */ long solution(long[] lst)
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_121_solution.py
verbatim
unittest { alias candidate = solution; assert(candidate([5L, 8L, 7L, 1L]) == 12L); assert(candidate([3L, 3L, 3L, 3L, 3L]) == 9L); assert(candidate([30L, 13L, 24L, 321L]) == 0L); assert(candidate([5L, 9L]) == 5L); assert(candidate([2L, 4L, 8L]) == 0L); assert(candidate([30L, 13L, 23L, 32L]) ...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_122_add_elements
d
import std.math; import std.typecons; /* Given a non-empty array of integers arr and an integer k, return the sum of the elements with at most two digits from the first k elements of arr. Example: >>> add_elements([111L, 21L, 3L, 4000L, 5L, 6L, 7L, 8L, 9L], 4L) 24L Constraints: 1. 1 <= len(arr) <= 100 2. 1 <= k...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_122_add_elements.py
verbatim
unittest { alias candidate = add_elements; assert(candidate([1L, -2L, -3L, 41L, 57L, 76L, 87L, 88L, 99L], 3L) == -4L); assert(candidate([111L, 121L, 3L, 4000L, 5L, 6L], 2L) == 0L); assert(candidate([11L, 21L, 3L, 90L, 5L, 6L, 7L, 8L, 9L], 4L) == 125L); assert(candidate([111L, 21L, 3L, 4000L, 5L, 6L...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_123_get_odd_collatz
d
import std.math; import std.typecons; /* Given a positive integer n, return a sorted list that has the odd numbers in collatz sequence. The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined as follows: start with any positive integer n. Then each term is obtained from the previous term...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_123_get_odd_collatz.py
verbatim
unittest { alias candidate = get_odd_collatz; assert(candidate(14L) == [1L, 5L, 7L, 11L, 13L, 17L]); assert(candidate(5L) == [1L, 5L]); assert(candidate(12L) == [1L, 3L, 5L]); assert(candidate(1L) == [1L]); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_124_valid_date
d
import std.math; import std.typecons; /* You have to write a function which validates a given date string and returns True if the date is valid otherwise False. The date is valid if all of the following rules are satisfied: 1. The date string is not empty. 2. The number of days is not less than 1 or higher than 31 days...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_124_valid_date.py
verbatim
unittest { alias candidate = valid_date; assert(candidate("03-11-2000") == true); assert(candidate("15-01-2012") == false); assert(candidate("04-0-2040") == false); assert(candidate("06-04-2020") == true); assert(candidate("01-01-2007") == true); assert(candidate("03-32-2011") == false); ...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_126_is_sorted
d
import std.math; import std.typecons; /* Given a list of numbers, return whether or not they are sorted in ascending order. If list has more than 1 duplicate of the same number, return False. Assume no negative numbers and only integers. Examples >>> is_sorted([5L]) true >>> is_sorted([1L, 2L, 3L, 4L, 5L]) true >>> is_...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_126_is_sorted.py
verbatim
unittest { alias candidate = is_sorted; assert(candidate([5L]) == true); assert(candidate([1L, 2L, 3L, 4L, 5L]) == true); assert(candidate([1L, 3L, 2L, 4L, 5L]) == false); assert(candidate([1L, 2L, 3L, 4L, 5L, 6L]) == true); assert(candidate([1L, 2L, 3L, 4L, 5L, 6L, 7L]) == true); assert(ca...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_127_intersection
d
import std.math; import std.typecons; /* You are given two intervals, where each interval is a pair of integers. For example, interval = (start, end) = (1, 2). The given intervals are closed which means that the interval (start, end) includes both start and end. For each given interval, it is assumed that its start is ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_127_intersection.py
verbatim
unittest { alias candidate = intersection; assert(candidate(tuple(1L, 2L), tuple(2L, 3L)) == "NO"); assert(candidate(tuple(-1L, 1L), tuple(0L, 4L)) == "NO"); assert(candidate(tuple(-3L, -1L), tuple(-5L, 5L)) == "YES"); assert(candidate(tuple(-2L, 2L), tuple(-4L, 0L)) == "YES"); assert(candidate...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_128_prod_signs
d
import std.math; import std.typecons; /* You are given an array arr of integers and you need to return sum of magnitudes of integers multiplied by product of all signs of each number in the array, represented by 1, -1 or 0. Note: return None for empty arr. Example: >>> prod_signs([1L, 2L, 2L, -4L]) 9L >>> prod_signs([0...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_128_prod_signs.py
verbatim
unittest { alias candidate = prod_signs; { auto result = candidate([1L, 2L, 2L, -4L]); assert(!result.isNull && result.get == -9L); } { auto result = candidate([0L, 1L]); assert(!result.isNull && result.get == 0L); } { auto result = candidate([1L, 1L, 1L, 2L, 3L, -1L, 1L])...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_129_minPath
d
import std.math; import std.typecons; /* Given a grid with N rows and N columns (N >= 2) and a positive integer k, each cell of the grid contains a value. Every integer in the range [1, N * N] inclusive appears exactly once on the cells of the grid. You have to find the minimum path of length k in the grid. You can st...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_129_minPath.py
verbatim
unittest { alias candidate = minPath; assert(candidate([[1L, 2L, 3L], [4L, 5L, 6L], [7L, 8L, 9L]], 3L) == [1L, 2L, 1L]); assert(candidate([[5L, 9L, 3L], [4L, 1L, 6L], [7L, 8L, 2L]], 1L) == [1L]); assert(candidate([[1L, 2L, 3L, 4L], [5L, 6L, 7L, 8L], [9L, 10L, 11L, 12L], [13L, 14L, 15L, 16L]], 4L) == [1...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_12_longest
d
import std.math; import std.typecons; /* Out of list of strings, return the longest one. Return the first one in case of multiple strings of the same length. Return None in case the input list is empty. >>> longest([]) None >>> longest(["a", "b", "c"]) "a" >>> longest(["a", "bb", "ccc"]) "ccc" */ Nullable!(string) lon...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_12_longest.py
verbatim
unittest { alias candidate = longest; { auto result = candidate([]); assert(result.isNull); } { auto result = candidate(["x", "y", "z"]); assert(!result.isNull && result.get == "x"); } { auto result = candidate(["x", "yyy", "zzzz", "www", "kkkk", "abc"]); assert(!r...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_130_tri
d
import std.math; import std.typecons; /* Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in the last couple centuries. However, what people don't know is Tribonacci sequence. Tribonacci sequence is defined by the recurrence: tri(1) = 3 tri(n) = 1 + n / 2, if n is even. tri(n) = tri(n - 1) +...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_130_tri.py
verbatim
unittest { alias candidate = tri; assert(candidate(3L) == [1L, 3L, 2L, 8L]); assert(candidate(4L) == [1L, 3L, 2L, 8L, 3L]); assert(candidate(5L) == [1L, 3L, 2L, 8L, 3L, 15L]); assert(candidate(6L) == [1L, 3L, 2L, 8L, 3L, 15L, 4L]); assert(candidate(7L) == [1L, 3L, 2L, 8L, 3L, 15L, 4L, 24L]); ...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_131_digits
d
import std.math; import std.typecons; /* Given a positive integer n, return the product of the odd digits. Return 0 if all digits are even. For example: >>> digits(1L) 1L >>> digits(4L) 0L >>> digits(235L) 15L */ long digits(long n)
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_131_digits.py
verbatim
unittest { alias candidate = digits; assert(candidate(5L) == 5L); assert(candidate(54L) == 5L); assert(candidate(120L) == 1L); assert(candidate(5014L) == 5L); assert(candidate(98765L) == 315L); assert(candidate(5576543L) == 2625L); assert(candidate(2468L) == 0L); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_132_is_nested
d
import std.math; import std.typecons; /* Create a function that takes a string as input which contains only square brackets. The function should return True if and only if there is a valid subsequence of brackets where at least one bracket in the subsequence is nested. >>> is_nested("[[]]") true >>> is_nested("[]]]]]]...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_132_is_nested.py
verbatim
unittest { alias candidate = is_nested; assert(candidate("[[]]") == true); assert(candidate("[]]]]]]][[[[[]") == false); assert(candidate("[][]") == false); assert(candidate("[]") == false); assert(candidate("[[[[]]]]") == true); assert(candidate("[]]]]]]]]]]") == false); assert(candida...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_133_sum_squares
d
import std.math; import std.typecons; /* You are given a list of numbers. You need to return the sum of squared numbers in the given list, round each element in the list to the upper int(Ceiling) first. Examples: >>> lst([1.0, 2.0, 3.0]) 14L >>> lst([1.0, 4.0, 9.0]) 98L >>> lst([1.0, 3.0, 5.0, 7.0]) 84L >>> lst([1.4, 4...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_133_sum_squares.py
verbatim
unittest { alias candidate = sum_squares; assert(candidate([1.0, 2.0, 3.0]) == 14L); assert(candidate([1.0, 2.0, 3.0]) == 14L); assert(candidate([1.0, 3.0, 5.0, 7.0]) == 84L); assert(candidate([1.4, 4.2, 0.0]) == 29L); assert(candidate([-2.4, 1.0, 1.0]) == 6L); assert(candidate([100.0, 1.0,...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_134_check_if_last_char_is_a_letter
d
import std.math; import std.typecons; /* Create a function that returns True if the last character of a given string is an alphabetical character and is not a part of a word, and False otherwise. Note: "word" is a group of characters separated by space. Examples: >>> check_if_last_char_is_a_letter("apple pie") false >>...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_134_check_if_last_char_is_a_letter.py
verbatim
unittest { alias candidate = check_if_last_char_is_a_letter; assert(candidate("apple") == false); assert(candidate("apple pi e") == true); assert(candidate("eeeee") == false); assert(candidate("A") == true); assert(candidate("Pumpkin pie ") == false); assert(candidate("Pumpkin pie 1") == fa...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_135_can_arrange
d
import std.math; import std.typecons; /* Create a function which returns the largest index of an element which is not greater than or equal to the element immediately preceding it. If no such element exists then return -1. The given array will not contain duplicate values. Examples: >>> can_arrange([1L, 2L, 4L, 3L, 5L]...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_135_can_arrange.py
verbatim
unittest { alias candidate = can_arrange; assert(candidate([1L, 2L, 4L, 3L, 5L]) == 3L); assert(candidate([1L, 2L, 4L, 5L]) == -1L); assert(candidate([1L, 4L, 2L, 5L, 6L, 7L, 8L, 9L, 10L]) == 2L); assert(candidate([4L, 8L, 5L, 7L, 3L]) == 4L); assert(candidate([]) == -1L); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_136_largest_smallest_integers
d
import std.math; import std.typecons; /* Create a function that returns a tuple (a, b), where 'a' is the largest of negative integers, and 'b' is the smallest of positive integers in a list. If there is no negative or positive integers, return them as None. Examples: >>> largest_smallest_integers([2L, 4L, 1L, 3L, 5L, 7...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_136_largest_smallest_integers.py
verbatim
unittest { alias candidate = largest_smallest_integers; { auto result = candidate([2L, 4L, 1L, 3L, 5L, 7L]); assert(result[0].isNull); assert(!result[1].isNull && result[1].get == 1L); } { auto result = candidate([2L, 4L, 1L, 3L, 5L, 7L, 0L]); assert(result[0].isNull); ...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_138_is_equal_to_sum_even
d
import std.math; import std.typecons; /* Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers Example >>> is_equal_to_sum_even(4L) false >>> is_equal_to_sum_even(6L) false >>> is_equal_to_sum_even(8L) true */ bool is_equal_to_sum_even(long n)
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_138_is_equal_to_sum_even.py
verbatim
unittest { alias candidate = is_equal_to_sum_even; assert(candidate(4L) == false); assert(candidate(6L) == false); assert(candidate(8L) == true); assert(candidate(10L) == true); assert(candidate(11L) == false); assert(candidate(12L) == true); assert(candidate(13L) == false); assert(...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_139_special_factorial
d
import std.math; import std.typecons; /* The Brazilian factorial is defined as: brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1! where n > 0 For example: >>> special_factorial(4L) 288L The function will receive an integer as input and should return the special factorial of this integer. */ long special_factoria...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_139_special_factorial.py
verbatim
unittest { alias candidate = special_factorial; assert(candidate(4L) == 288L); assert(candidate(5L) == 34560L); assert(candidate(7L) == 125411328000L); assert(candidate(1L) == 1L); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_13_greatest_common_divisor
d
import std.math; import std.typecons; /* Return a greatest common divisor of two integers a and b >>> greatest_common_divisor(3L, 5L) 1L >>> greatest_common_divisor(25L, 15L) 5L */ long greatest_common_divisor(long a, long b)
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_13_greatest_common_divisor.py
verbatim
unittest { alias candidate = greatest_common_divisor; assert(candidate(3L, 7L) == 1L); assert(candidate(10L, 15L) == 5L); assert(candidate(49L, 14L) == 7L); assert(candidate(144L, 60L) == 12L); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_140_fix_spaces
d
import std.math; import std.typecons; /* Given a string text, replace all spaces in it with underscores, and if a string has more than 2 consecutive spaces, then replace all consecutive spaces with - >>> fix_spaces(" Example") "Example" >>> fix_spaces(" Example 1") "Example_1" >>> fix_spaces(" Example 2") "_Example_...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_140_fix_spaces.py
verbatim
unittest { alias candidate = fix_spaces; assert(candidate("Example") == "Example"); assert(candidate("Mudasir Hanif ") == "Mudasir_Hanif_"); assert(candidate("Yellow Yellow Dirty Fellow") == "Yellow_Yellow__Dirty__Fellow"); assert(candidate("Exa mple") == "Exa-mple"); assert(candidate(" E...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_141_file_name_check
d
import std.math; import std.typecons; /* Create a function which takes a string representing a file's name, and returns 'Yes' if the the file's name is valid, and returns 'No' otherwise. A file's name is considered to be valid if and only if all the following conditions are met: - There should not be more than three d...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_141_file_name_check.py
verbatim
unittest { alias candidate = file_name_check; assert(candidate("example.txt") == "Yes"); assert(candidate("1example.dll") == "No"); assert(candidate("s1sdf3.asd") == "No"); assert(candidate("K.dll") == "Yes"); assert(candidate("MY16FILE3.exe") == "Yes"); assert(candidate("His12FILE94.exe") ...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_142_sum_squares
d
import std.math; import std.typecons; /* " This function will take a list of integers. For all entries in the list, the function shall square the integer entry if its index is a multiple of 3 and will cube the integer entry if its index is a multiple of 4 and not a multiple of 3. The function will not change the entr...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_142_sum_squares.py
verbatim
unittest { alias candidate = sum_squares; assert(candidate([1L, 2L, 3L]) == 6L); assert(candidate([1L, 4L, 9L]) == 14L); assert(candidate([]) == 0L); assert(candidate([1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L]) == 9L); assert(candidate([-1L, -1L, -1L, -1L, -1L, -1L, -1L, -1L, -1L]) == -3L); asser...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_143_words_in_sentence
d
import std.math; import std.typecons; /* You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new string should be the same...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_143_words_in_sentence.py
verbatim
unittest { alias candidate = words_in_sentence; assert(candidate("This is a test") == "is"); assert(candidate("lets go for swimming") == "go for"); assert(candidate("there is no place available here") == "there is no place"); assert(candidate("Hi I am Hussein") == "Hi am Hussein"); assert(candi...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_144_simplify
d
import std.math; import std.typecons; /* Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the following format, <numerator>/<denominator> where...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_144_simplify.py
verbatim
unittest { alias candidate = simplify; assert(candidate("1/5", "5/1") == true); assert(candidate("1/6", "2/1") == false); assert(candidate("5/1", "3/1") == true); assert(candidate("7/10", "10/2") == false); assert(candidate("2/10", "50/10") == true); assert(candidate("7/2", "4/2") == true);...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_145_order_by_points
d
import std.math; import std.typecons; /* Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For example: >>> order_by_points([1L, 11L, -1L, -...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_145_order_by_points.py
verbatim
unittest { alias candidate = order_by_points; assert(candidate([1L, 11L, -1L, -11L, -12L]) == [-1L, -11L, 1L, -12L, 11L]); assert(candidate([1234L, 423L, 463L, 145L, 2L, 423L, 423L, 53L, 6L, 37L, 3457L, 3L, 56L, 0L, 46L]) == [0L, 2L, 3L, 6L, 53L, 423L, 423L, 423L, 1234L, 145L, 37L, 46L, 56L, 463L, 3457L]);...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_146_specialFilter
d
import std.math; import std.typecons; /* Write a function that takes an array of numbers as input and returns the number of elements in the array that are greater than 10 and both first and last digits of a number are odd (1, 3, 5, 7, 9). For example: >>> specialFilter([15L, -73L, 14L, -15L]) 1L >>> specialFilter([33...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_146_specialFilter.py
verbatim
unittest { alias candidate = specialFilter; assert(candidate([5L, -2L, 1L, -5L]) == 0L); assert(candidate([15L, -73L, 14L, -15L]) == 1L); assert(candidate([33L, -2L, -3L, 45L, 21L, 109L]) == 2L); assert(candidate([43L, -12L, 93L, 125L, 121L, 109L]) == 4L); assert(candidate([71L, -2L, -33L, 75L,...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_147_get_max_triples
d
import std.math; import std.typecons; /* You are given a positive integer n. You have to create an integer array a of length n. For each i (1 ≤ i ≤ n), the value of a[i] = i * i - i + 1. Return the number of triples (a[i], a[j], a[k]) of a where i < j < k, and a[i] + a[j] + a[k] is a multiple of 3. Example...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_147_get_max_triples.py
verbatim
unittest { alias candidate = get_max_triples; assert(candidate(5L) == 1L); assert(candidate(6L) == 4L); assert(candidate(10L) == 36L); assert(candidate(100L) == 53361L); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_149_sorted_list_sum
d
import std.math; import std.typecons; /* Write a function that accepts a list of strings as a parameter, deletes the strings that have odd lengths from it, and returns the resulted list with a sorted order, The list is always a list of strings and never an array of numbers, and it may contain duplicates. The order of t...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_149_sorted_list_sum.py
verbatim
unittest { alias candidate = sorted_list_sum; assert(candidate(["aa", "a", "aaa"]) == ["aa"]); assert(candidate(["school", "AI", "asdf", "b"]) == ["AI", "asdf", "school"]); assert(candidate(["d", "b", "c", "a"]) == []); assert(candidate(["d", "dcba", "abcd", "a"]) == ["abcd", "dcba"]); assert(c...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_14_all_prefixes
d
import std.math; import std.typecons; /* Return list of all prefixes from shortest to longest of the input string >>> all_prefixes("abc") ["a", "ab", "abc"] */ string[] all_prefixes(string string)
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_14_all_prefixes.py
verbatim
unittest { alias candidate = all_prefixes; assert(candidate("") == []); assert(candidate("asdfgh") == ["a", "as", "asd", "asdf", "asdfg", "asdfgh"]); assert(candidate("WWW") == ["W", "WW", "WWW"]); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_150_x_or_y
d
import std.math; import std.typecons; /* A simple program which should return the value of x if n is a prime number and should return the value of y otherwise. Examples: >>> x_or_y(7L, 34L, 12L) 34L >>> x_or_y(15L, 8L, 5L) 5L */ long x_or_y(long n, long x, long y)
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_150_x_or_y.py
verbatim
unittest { alias candidate = x_or_y; assert(candidate(7L, 34L, 12L) == 34L); assert(candidate(15L, 8L, 5L) == 5L); assert(candidate(3L, 33L, 5212L) == 33L); assert(candidate(1259L, 3L, 52L) == 3L); assert(candidate(7919L, -1L, 12L) == -1L); assert(candidate(3609L, 1245L, 583L) == 583L); ...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_151_double_the_difference
d
import std.math; import std.typecons; /* Given a list of numbers, return the sum of squares of the numbers in the list that are odd. Ignore numbers that are negative or not integers. >>> double_the_difference([1L, 3L, 2L, 0L]) 10L >>> double_the_difference([-1L, -2L, 0L]) 0L >>> double_the_difference([9L, -2L]) 81L >>>...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_151_double_the_difference.py
verbatim
unittest { alias candidate = double_the_difference; assert(candidate([]) == 0L); assert(candidate([5.0, 4.0]) == 25L); assert(candidate([0.1, 0.2, 0.3]) == 0L); assert(candidate([-10.0, -20.0, -30.0]) == 0L); assert(candidate([-1.0, -2.0, 8.0]) == 0L); assert(candidate([0.2, 3.0, 5.0]) == 3...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_152_compare
d
import std.math; import std.typecons; /* I think we all remember that feeling when the result of some long-awaited event is finally known. The feelings and thoughts you have at that moment are definitely worth noting down and comparing. Your task is to determine if a person correctly guessed the results of a number of ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_152_compare.py
verbatim
unittest { alias candidate = compare; assert(candidate([1L, 2L, 3L, 4L, 5L, 1L], [1L, 2L, 3L, 4L, 2L, -2L]) == [0L, 0L, 0L, 0L, 3L, 3L]); assert(candidate([0L, 0L, 0L, 0L, 0L, 0L], [0L, 0L, 0L, 0L, 0L, 0L]) == [0L, 0L, 0L, 0L, 0L, 0L]); assert(candidate([1L, 2L, 3L], [-1L, -2L, -3L]) == [2L, 4L, 6L]); ...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_153_Strongest_Extension
d
import std.math; import std.typecons; /* You will be given the name of a class (a string) and a list of extensions. The extensions are to be used to load additional classes to the class. The strength of the extension is as follows: Let CAP be the number of the uppercase letters in the extension's name, and let SM be th...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_153_Strongest_Extension.py
verbatim
unittest { alias candidate = Strongest_Extension; assert(candidate("Watashi", ["tEN", "niNE", "eIGHt8OKe"]) == "Watashi.eIGHt8OKe"); assert(candidate("Boku123", ["nani", "NazeDa", "YEs.WeCaNe", "32145tggg"]) == "Boku123.YEs.WeCaNe"); assert(candidate("__YESIMHERE", ["t", "eMptY", "nothing", "zeR00", "N...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_154_cycpattern_check
d
import std.math; import std.typecons; /* You are given 2 words. You need to return True if the second word or any of its rotations is a substring in the first word >>> cycpattern_check("abcd", "abd") false >>> cycpattern_check("hello", "ell") true >>> cycpattern_check("whassup", "psus") false >>> cycpattern_check("abab...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_154_cycpattern_check.py
verbatim
unittest { alias candidate = cycpattern_check; assert(candidate("xyzw", "xyw") == false); assert(candidate("yello", "ell") == true); assert(candidate("whattup", "ptut") == false); assert(candidate("efef", "fee") == true); assert(candidate("abab", "aabb") == false); assert(candidate("winemtt...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_155_even_odd_count
d
import std.math; import std.typecons; /* Given an integer. return a tuple that has the number of even and odd digits respectively. Example: >>> even_odd_count(-12L) tuple(1L, 1L) >>> even_odd_count(123L) tuple(1L, 2L) */ Tuple!(long, long) even_odd_count(long num)
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_155_even_odd_count.py
verbatim
unittest { alias candidate = even_odd_count; assert(candidate(7L) == tuple(0L, 1L)); assert(candidate(-78L) == tuple(1L, 1L)); assert(candidate(3452L) == tuple(2L, 2L)); assert(candidate(346211L) == tuple(3L, 3L)); assert(candidate(-345821L) == tuple(3L, 3L)); assert(candidate(-2L) == tuple...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_156_int_to_mini_roman
d
import std.math; import std.typecons; /* Given a positive integer, obtain its roman numeral equivalent as a string, and return it in lowercase. Restrictions: 1 <= num <= 1000 Examples: >>> int_to_mini_roman(19L) "xix" >>> int_to_mini_roman(152L) "clii" >>> int_to_mini_roman(426L) "cdxxvi" */ string int_to_mini_roman(lo...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_156_int_to_mini_roman.py
verbatim
unittest { alias candidate = int_to_mini_roman; assert(candidate(19L) == "xix"); assert(candidate(152L) == "clii"); assert(candidate(251L) == "ccli"); assert(candidate(426L) == "cdxxvi"); assert(candidate(500L) == "d"); assert(candidate(1L) == "i"); assert(candidate(4L) == "iv"); as...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_157_right_angle_triangle
d
import std.math; import std.typecons; /* Given the lengths of the three sides of a triangle. Return True if the three sides form a right-angled triangle, False otherwise. A right-angled triangle is a triangle in which one angle is right angle or 90 degree. Example: >>> right_angle_triangle(3L, 4L, 5L) true >>> right_a...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_157_right_angle_triangle.py
verbatim
unittest { alias candidate = right_angle_triangle; assert(candidate(3L, 4L, 5L) == true); assert(candidate(1L, 2L, 3L) == false); assert(candidate(10L, 6L, 8L) == true); assert(candidate(2L, 2L, 2L) == false); assert(candidate(7L, 24L, 25L) == true); assert(candidate(10L, 5L, 7L) == false);...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_158_find_max
d
import std.math; import std.typecons; /* Write a function that accepts a list of strings. The list contains different words. Return the word with maximum number of unique characters. If multiple strings have maximum number of unique characters, return the one which comes first in lexicographical order. >>> find_max(["n...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_158_find_max.py
verbatim
unittest { alias candidate = find_max; assert(candidate(["name", "of", "string"]) == "string"); assert(candidate(["name", "enam", "game"]) == "enam"); assert(candidate(["aaaaaaa", "bb", "cc"]) == "aaaaaaa"); assert(candidate(["abc", "cba"]) == "abc"); assert(candidate(["play", "this", "game", "...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_159_eat
d
import std.math; import std.typecons; /* You're a hungry rabbit, and you already have eaten a certain number of carrots, but now you need to eat more carrots to complete the day's meals. you should return an array of [ total number of eaten carrots after your meals, the number of carrots...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_159_eat.py
verbatim
unittest { alias candidate = eat; assert(candidate(5L, 6L, 10L) == [11L, 4L]); assert(candidate(4L, 8L, 9L) == [12L, 1L]); assert(candidate(1L, 10L, 10L) == [11L, 0L]); assert(candidate(2L, 11L, 5L) == [7L, 0L]); assert(candidate(4L, 5L, 7L) == [9L, 2L]); assert(candidate(4L, 5L, 1L) == [5L...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_15_string_sequence
d
import std.math; import std.typecons; /* Return a string containing space-delimited numbers starting from 0 upto n inclusive. >>> string_sequence(0L) "0" >>> string_sequence(5L) "0 1 2 3 4 5" */ string string_sequence(long n)
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_15_string_sequence.py
verbatim
unittest { alias candidate = string_sequence; assert(candidate(0L) == "0"); assert(candidate(3L) == "0 1 2 3"); assert(candidate(10L) == "0 1 2 3 4 5 6 7 8 9 10"); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_160_do_algebra
d
import std.math; import std.typecons; /* Given two lists operator, and operand. The first list has basic algebra operations, and the second list is a list of integers. Use the two given lists to build the algebric expression and return the evaluation of this expression. The basic algebra operations: Addition ( + ) S...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_160_do_algebra.py
verbatim
unittest { alias candidate = do_algebra; assert(candidate(["**", "*", "+"], [2L, 3L, 4L, 5L]) == 37L); assert(candidate(["+", "*", "-"], [2L, 3L, 4L, 5L]) == 9L); assert(candidate(["//", "*"], [7L, 3L, 4L]) == 8L); } void main(){}
[ "\n\n", "\nvoid", "\nbool", "\nint" ]
HumanEval_161_solve
d
import std.math; import std.typecons; /* You are given a string s. if s[i] is a letter, reverse its case from lower to upper or vise versa, otherwise keep it as it is. If the string contains no letters, reverse the string. The function should return the resulted string. Examples >>> solve("1234") "4321" >>> solve("ab"...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_161_solve.py
verbatim
unittest { alias candidate = solve; assert(candidate("AsDf") == "aSdF"); assert(candidate("1234") == "4321"); assert(candidate("ab") == "AB"); assert(candidate("#a@C") == "#A@c"); assert(candidate("#AsdfW^45") == "#aSDFw^45"); assert(candidate("#6@2") == "2@6#"); assert(candidate("#$a^D...
[ "\n\n", "\nvoid", "\nbool", "\nint" ]