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_25_factorize
cpp
#include<assert.h> #include<bits/stdc++.h> // Return vector of prime factors of given integer in the order from smallest to largest. // Each of the factors should be vectored number of times corresponding to how many times it appeares in factorization. // Input number should be equal to the product of all factors // >>...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_25_factorize.py
reworded
} int main() { auto candidate = factorize; assert(candidate((2)) == (std::vector<long>({(long)2}))); assert(candidate((4)) == (std::vector<long>({(long)2, (long)2}))); assert(candidate((8)) == (std::vector<long>({(long)2, (long)2, (long)2}))); assert(candidate((57)) == (std::vector<long>({(long)3, (...
[ "\n}" ]
HumanEval_26_remove_duplicates
cpp
#include<assert.h> #include<bits/stdc++.h> // From a vector of integers, remove all elements that occur more than once. // Keep order of elements left the same as in the input. // >>> remove_duplicates((std::vector<long>({(long)1, (long)2, (long)3, (long)2, (long)4}))) // (std::vector<long>({(long)1, (long)3, (long)4})...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_26_remove_duplicates.py
reworded
} int main() { auto candidate = remove_duplicates; assert(candidate((std::vector<long>())) == (std::vector<long>())); assert(candidate((std::vector<long>({(long)1, (long)2, (long)3, (long)4}))) == (std::vector<long>({(long)1, (long)2, (long)3, (long)4}))); assert(candidate((std::vector<long>({(long)1, (...
[ "\n}" ]
HumanEval_27_flip_case
cpp
#include<assert.h> #include<bits/stdc++.h> // For a given string, flip lowercase characters to uppercase and uppercase to lowercase. // >>> flip_case(("Hello")) // ("hELLO") std::string flip_case(std::string string) {
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_27_flip_case.py
reworded
} int main() { auto candidate = flip_case; assert(candidate(("")) == ("")); assert(candidate(("Hello!")) == ("hELLO!")); assert(candidate(("These violent delights have violent ends")) == ("tHESE VIOLENT DELIGHTS HAVE VIOLENT ENDS")); }
[ "\n}" ]
HumanEval_28_concatenate
cpp
#include<assert.h> #include<bits/stdc++.h> // Concatenate vector of strings into a single string // >>> concatenate((std::vector<std::string>())) // ("") // >>> concatenate((std::vector<std::string>({(std::string)"a", (std::string)"b", (std::string)"c"}))) // ("abc") std::string concatenate(std::vector<std::string> str...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_28_concatenate.py
reworded
} int main() { auto candidate = concatenate; assert(candidate((std::vector<std::string>())) == ("")); assert(candidate((std::vector<std::string>({(std::string)"x", (std::string)"y", (std::string)"z"}))) == ("xyz")); assert(candidate((std::vector<std::string>({(std::string)"x", (std::string)"y", (std::st...
[ "\n}" ]
HumanEval_29_filter_by_prefix
cpp
#include<assert.h> #include<bits/stdc++.h> // Filter an input vector of strings only for ones that start with a given prefix. // >>> filter_by_prefix((std::vector<std::string>()), ("a")) // (std::vector<std::string>()) // >>> filter_by_prefix((std::vector<std::string>({(std::string)"abc", (std::string)"bcd", (std::stri...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_29_filter_by_prefix.py
reworded
} int main() { auto candidate = filter_by_prefix; assert(candidate((std::vector<std::string>()), ("john")) == (std::vector<std::string>())); assert(candidate((std::vector<std::string>({(std::string)"xxx", (std::string)"asd", (std::string)"xxy", (std::string)"john doe", (std::string)"xxxAAA", (std::string)"x...
[ "\n}" ]
HumanEval_2_truncate_number
cpp
#include<assert.h> #include<bits/stdc++.h> // 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. // >>> truncate_number((3.5f)) // (0.5f) float ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_2_truncate_number.py
reworded
} int main() { auto candidate = truncate_number; assert(candidate((3.5f)) == (0.5f)); assert(candidate((1.25f)) == (0.25f)); assert(candidate((123.0f)) == (0.0f)); }
[ "\n}" ]
HumanEval_30_get_positive
cpp
#include<assert.h> #include<bits/stdc++.h> // Return only positive numbers in the vector. // >>> get_positive((std::vector<long>({(long)-1, (long)2, (long)-4, (long)5, (long)6}))) // (std::vector<long>({(long)2, (long)5, (long)6})) // >>> get_positive((std::vector<long>({(long)5, (long)3, (long)-5, (long)2, (long)-3, (...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_30_get_positive.py
reworded
} int main() { auto candidate = get_positive; assert(candidate((std::vector<long>({(long)-1, (long)-2, (long)4, (long)5, (long)6}))) == (std::vector<long>({(long)4, (long)5, (long)6}))); assert(candidate((std::vector<long>({(long)5, (long)3, (long)-5, (long)2, (long)3, (long)3, (long)9, (long)0, (long)123, ...
[ "\n}" ]
HumanEval_31_is_prime
cpp
#include<assert.h> #include<bits/stdc++.h> // Return true if a given number is prime, and false otherwise. // >>> is_prime((6)) // (false) // >>> is_prime((101)) // (true) // >>> is_prime((11)) // (true) // >>> is_prime((13441)) // (true) // >>> is_prime((61)) // (true) // >>> is_prime((4)) // (false) // >>> is_prime((...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_31_is_prime.py
reworded
} int main() { auto candidate = is_prime; assert(candidate((6)) == (false)); assert(candidate((101)) == (true)); assert(candidate((11)) == (true)); assert(candidate((13441)) == (true)); assert(candidate((61)) == (true)); assert(candidate((4)) == (false)); assert(candidate((1)) == (false)...
[ "\n}" ]
HumanEval_33_sort_third
cpp
#include<assert.h> #include<bits/stdc++.h> // This function takes a vector l and returns a vector 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. ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_33_sort_third.py
reworded
} int main() { auto candidate = sort_third; assert(candidate((std::vector<long>({(long)5, (long)6, (long)3, (long)4, (long)8, (long)9, (long)2}))) == (std::vector<long>({(long)2, (long)6, (long)3, (long)4, (long)8, (long)9, (long)5}))); assert(candidate((std::vector<long>({(long)5, (long)8, (long)3, (long)4...
[ "\n}" ]
HumanEval_34_unique
cpp
#include<assert.h> #include<bits/stdc++.h> // Return sorted unique elements in a vector // >>> unique((std::vector<long>({(long)5, (long)3, (long)5, (long)2, (long)3, (long)3, (long)9, (long)0, (long)123}))) // (std::vector<long>({(long)0, (long)2, (long)3, (long)5, (long)9, (long)123})) std::vector<long> unique(std::v...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_34_unique.py
reworded
} int main() { auto candidate = unique; assert(candidate((std::vector<long>({(long)5, (long)3, (long)5, (long)2, (long)3, (long)3, (long)9, (long)0, (long)123}))) == (std::vector<long>({(long)0, (long)2, (long)3, (long)5, (long)9, (long)123}))); }
[ "\n}" ]
HumanEval_35_max_element
cpp
#include<assert.h> #include<bits/stdc++.h> // Return maximum element in the vector. // >>> max_element((std::vector<long>({(long)1, (long)2, (long)3}))) // (3) // >>> max_element((std::vector<long>({(long)5, (long)3, (long)-5, (long)2, (long)-3, (long)3, (long)9, (long)0, (long)123, (long)1, (long)-10}))) // (123) long...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_35_max_element.py
reworded
} int main() { auto candidate = max_element; assert(candidate((std::vector<long>({(long)1, (long)2, (long)3}))) == (3)); assert(candidate((std::vector<long>({(long)5, (long)3, (long)-5, (long)2, (long)-3, (long)3, (long)9, (long)0, (long)124, (long)1, (long)-10}))) == (124)); }
[ "\n}" ]
HumanEval_36_fizz_buzz
cpp
#include<assert.h> #include<bits/stdc++.h> // Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13. // >>> fizz_buzz((50)) // (0) // >>> fizz_buzz((78)) // (2) // >>> fizz_buzz((79)) // (3) long fizz_buzz(long n) {
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_36_fizz_buzz.py
reworded
} int main() { auto candidate = fizz_buzz; assert(candidate((50)) == (0)); assert(candidate((78)) == (2)); assert(candidate((79)) == (3)); assert(candidate((100)) == (3)); assert(candidate((200)) == (6)); assert(candidate((4000)) == (192)); assert(candidate((10000)) == (639)); assert...
[ "\n}" ]
HumanEval_37_sort_even
cpp
#include<assert.h> #include<bits/stdc++.h> // This function takes a vector l and returns a vector 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. // >>> sort_even((std::vector<long>({(long)1, (long)2, (long...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_37_sort_even.py
reworded
} int main() { auto candidate = sort_even; assert(candidate((std::vector<long>({(long)1, (long)2, (long)3}))) == (std::vector<long>({(long)1, (long)2, (long)3}))); assert(candidate((std::vector<long>({(long)5, (long)3, (long)-5, (long)2, (long)-3, (long)3, (long)9, (long)0, (long)123, (long)1, (long)-10})))...
[ "\n}" ]
HumanEval_39_prime_fib
cpp
#include<assert.h> #include<bits/stdc++.h> // prime_fib returns n-th number that is a Fibonacci number and it's also prime. // >>> prime_fib((1)) // (2) // >>> prime_fib((2)) // (3) // >>> prime_fib((3)) // (5) // >>> prime_fib((4)) // (13) // >>> prime_fib((5)) // (89) long prime_fib(long n) {
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_39_prime_fib.py
reworded
} int main() { auto candidate = prime_fib; assert(candidate((1)) == (2)); assert(candidate((2)) == (3)); assert(candidate((3)) == (5)); assert(candidate((4)) == (13)); assert(candidate((5)) == (89)); assert(candidate((6)) == (233)); assert(candidate((7)) == (1597)); assert(candidate(...
[ "\n}" ]
HumanEval_3_below_zero
cpp
#include<assert.h> #include<bits/stdc++.h> // You're given a vector 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...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_3_below_zero.py
reworded
} int main() { auto candidate = below_zero; assert(candidate((std::vector<long>())) == (false)); assert(candidate((std::vector<long>({(long)1, (long)2, (long)-3, (long)1, (long)2, (long)-3}))) == (false)); assert(candidate((std::vector<long>({(long)1, (long)2, (long)-4, (long)5, (long)6}))) == (true)); ...
[ "\n}" ]
HumanEval_40_triples_sum_to_zero
cpp
#include<assert.h> #include<bits/stdc++.h> // triples_sum_to_zero takes a vector of integers as an input. // it returns true if there are three distinct elements in the vector that // sum to zero, and false otherwise. // >>> triples_sum_to_zero((std::vector<long>({(long)1, (long)3, (long)5, (long)0}))) // (false) // >>...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_40_triples_sum_to_zero.py
reworded
} int main() { auto candidate = triples_sum_to_zero; assert(candidate((std::vector<long>({(long)1, (long)3, (long)5, (long)0}))) == (false)); assert(candidate((std::vector<long>({(long)1, (long)3, (long)5, (long)-1}))) == (false)); assert(candidate((std::vector<long>({(long)1, (long)3, (long)-2, (long)1...
[ "\n}" ]
HumanEval_41_car_race_collision
cpp
#include<assert.h> #include<bits/stdc++.h> // Imagine a road that's a perfectly straight infinitely long line. // n cars are driving left to right; simultaneously, a different set of n cars // are driving right to left. The two sets of cars start out being very far from // each other. All cars move in the same spee...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_41_car_race_collision.py
reworded
} int main() { auto candidate = car_race_collision; assert(candidate((2)) == (4)); assert(candidate((3)) == (9)); assert(candidate((4)) == (16)); assert(candidate((8)) == (64)); assert(candidate((10)) == (100)); }
[ "\n}" ]
HumanEval_42_incr_list
cpp
#include<assert.h> #include<bits/stdc++.h> // Return vector with elements incremented by 1. // >>> incr_list((std::vector<long>({(long)1, (long)2, (long)3}))) // (std::vector<long>({(long)2, (long)3, (long)4})) // >>> incr_list((std::vector<long>({(long)5, (long)3, (long)5, (long)2, (long)3, (long)3, (long)9, (long)0, ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_42_incr_list.py
reworded
} int main() { auto candidate = incr_list; assert(candidate((std::vector<long>())) == (std::vector<long>())); assert(candidate((std::vector<long>({(long)3, (long)2, (long)1}))) == (std::vector<long>({(long)4, (long)3, (long)2}))); assert(candidate((std::vector<long>({(long)5, (long)2, (long)5, (long)2, ...
[ "\n}" ]
HumanEval_43_pairs_sum_to_zero
cpp
#include<assert.h> #include<bits/stdc++.h> // pairs_sum_to_zero takes a vector of integers as an input. // it returns true if there are two distinct elements in the vector that // sum to zero, and false otherwise. // >>> pairs_sum_to_zero((std::vector<long>({(long)1, (long)3, (long)5, (long)0}))) // (false) // >>> pair...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_43_pairs_sum_to_zero.py
reworded
} int main() { auto candidate = pairs_sum_to_zero; assert(candidate((std::vector<long>({(long)1, (long)3, (long)5, (long)0}))) == (false)); assert(candidate((std::vector<long>({(long)1, (long)3, (long)-2, (long)1}))) == (false)); assert(candidate((std::vector<long>({(long)1, (long)2, (long)3, (long)7}))...
[ "\n}" ]
HumanEval_44_change_base
cpp
#include<assert.h> #include<bits/stdc++.h> // Change numerical base of input number x to base. // return string representation after the conversion. // base numbers are less than 10. // >>> change_base((8), (3)) // ("22") // >>> change_base((8), (2)) // ("1000") // >>> change_base((7), (2)) // ("111") std::string chang...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_44_change_base.py
reworded
} int main() { auto candidate = change_base; assert(candidate((8), (3)) == ("22")); assert(candidate((9), (3)) == ("100")); assert(candidate((234), (2)) == ("11101010")); assert(candidate((16), (2)) == ("10000")); assert(candidate((8), (2)) == ("1000")); assert(candidate((7), (2)) == ("111")...
[ "\n}" ]
HumanEval_45_triangle_area
cpp
#include<assert.h> #include<bits/stdc++.h> // Given length of a side and high return area for a triangle. // >>> triangle_area((5), (3)) // (7.5f) float triangle_area(long a, long h) {
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_45_triangle_area.py
reworded
} int main() { auto candidate = triangle_area; assert(candidate((5), (3)) == (7.5f)); assert(candidate((2), (2)) == (2.0f)); assert(candidate((10), (8)) == (40.0f)); }
[ "\n}" ]
HumanEval_46_fib4
cpp
#include<assert.h> #include<bits/stdc++.h> // 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 comput...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_46_fib4.py
reworded
} int main() { auto candidate = fib4; assert(candidate((5)) == (4)); assert(candidate((8)) == (28)); assert(candidate((10)) == (104)); assert(candidate((12)) == (386)); }
[ "\n}" ]
HumanEval_47_median
cpp
#include<assert.h> #include<bits/stdc++.h> // Return median of elements in the vector l. // >>> median((std::vector<long>({(long)3, (long)1, (long)2, (long)4, (long)5}))) // (float(3)) // >>> median((std::vector<long>({(long)-10, (long)4, (long)6, (long)1000, (long)10, (long)20}))) // (15.0f) float median(std::vector<l...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_47_median.py
reworded
} int main() { auto candidate = median; assert(candidate((std::vector<long>({(long)3, (long)1, (long)2, (long)4, (long)5}))) == (float(3))); assert(candidate((std::vector<long>({(long)-10, (long)4, (long)6, (long)1000, (long)10, (long)20}))) == (8.0f)); assert(candidate((std::vector<long>({(long)5}))) =...
[ "\n}" ]
HumanEval_48_is_palindrome
cpp
#include<assert.h> #include<bits/stdc++.h> // Checks if given string is a palindrome // >>> is_palindrome(("")) // (true) // >>> is_palindrome(("aba")) // (true) // >>> is_palindrome(("aaaaa")) // (true) // >>> is_palindrome(("zbcd")) // (false) bool is_palindrome(std::string text) {
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_48_is_palindrome.py
reworded
} int main() { auto 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(...
[ "\n}" ]
HumanEval_49_modp
cpp
#include<assert.h> #include<bits/stdc++.h> // Return 2^n modulo p (be aware of numerics). // >>> modp((3), (5)) // (3) // >>> modp((1101), (101)) // (2) // >>> modp((0), (101)) // (1) // >>> modp((3), (11)) // (8) // >>> modp((100), (101)) // (1) long modp(long n, long p) {
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_49_modp.py
reworded
} int main() { auto candidate = modp; assert(candidate((3), (5)) == (3)); assert(candidate((1101), (101)) == (2)); assert(candidate((0), (101)) == (1)); assert(candidate((3), (11)) == (8)); assert(candidate((100), (101)) == (1)); assert(candidate((30), (5)) == (4)); assert(candidate((31)...
[ "\n}" ]
HumanEval_4_mean_absolute_deviation
cpp
#include<assert.h> #include<bits/stdc++.h> // For a given vector 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 | // >>> mea...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_4_mean_absolute_deviation.py
reworded
} int main() { auto candidate = mean_absolute_deviation; assert(candidate((std::vector<float>({(float)1.0f, (float)2.0f}))) == (0.5f)); assert(candidate((std::vector<float>({(float)1.0f, (float)2.0f, (float)3.0f, (float)4.0f}))) == (1.0f)); assert(candidate((std::vector<float>({(float)1.0f, (float)2.0f,...
[ "\n}" ]
HumanEval_51_remove_vowels
cpp
#include<assert.h> #include<bits/stdc++.h> // remove_vowels is a function that takes string and returns string without vowels. // >>> remove_vowels(("")) // ("") // >>> remove_vowels(("abcdef")) // ("bcdf") // >>> remove_vowels(("aaaaa")) // ("") // >>> remove_vowels(("aaBAA")) // ("B") // >>> remove_vowels(("zbcd")) /...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_51_remove_vowels.py
reworded
} int main() { auto candidate = remove_vowels; assert(candidate(("")) == ("")); assert(candidate(("abcdef\nghijklm")) == ("bcdf\nghjklm")); assert(candidate(("fedcba")) == ("fdcb")); assert(candidate(("eeeee")) == ("")); assert(candidate(("acBAA")) == ("cB")); assert(candidate(("EcBOO")) == ...
[ "\n}" ]
HumanEval_52_below_threshold
cpp
#include<assert.h> #include<bits/stdc++.h> // Return true if all numbers in the vector l are below threshold t. // >>> below_threshold((std::vector<long>({(long)1, (long)2, (long)4, (long)10})), (100)) // (true) // >>> below_threshold((std::vector<long>({(long)1, (long)20, (long)4, (long)10})), (5)) // (false) bool bel...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_52_below_threshold.py
reworded
} int main() { auto candidate = below_threshold; assert(candidate((std::vector<long>({(long)1, (long)2, (long)4, (long)10})), (100)) == (true)); assert(candidate((std::vector<long>({(long)1, (long)20, (long)4, (long)10})), (5)) == (false)); assert(candidate((std::vector<long>({(long)1, (long)20, (long)4...
[ "\n}" ]
HumanEval_53_add
cpp
#include<assert.h> #include<bits/stdc++.h> // Add two numbers x and y // >>> add((2), (3)) // (5) // >>> add((5), (7)) // (12) long add(long x, long y) {
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_53_add.py
reworded
} int main() { auto candidate = add; assert(candidate((0), (1)) == (1)); assert(candidate((1), (0)) == (1)); assert(candidate((2), (3)) == (5)); assert(candidate((5), (7)) == (12)); assert(candidate((7), (5)) == (12)); }
[ "\n}" ]
HumanEval_54_same_chars
cpp
#include<assert.h> #include<bits/stdc++.h> // Check if two words have the same characters. // >>> same_chars(("eabcdzzzz"), ("dddzzzzzzzddeddabc")) // (true) // >>> same_chars(("abcd"), ("dddddddabc")) // (true) // >>> same_chars(("dddddddabc"), ("abcd")) // (true) // >>> same_chars(("eabcd"), ("dddddddabc")) // (false...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_54_same_chars.py
reworded
} int main() { auto 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(...
[ "\n}" ]
HumanEval_55_fib
cpp
#include<assert.h> #include<bits/stdc++.h> // Return n-th Fibonacci number. // >>> fib((10)) // (55) // >>> fib((1)) // (1) // >>> fib((8)) // (21) long fib(long n) {
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_55_fib.py
reworded
} int main() { auto candidate = fib; assert(candidate((10)) == (55)); assert(candidate((1)) == (1)); assert(candidate((8)) == (21)); assert(candidate((11)) == (89)); assert(candidate((12)) == (144)); }
[ "\n}" ]
HumanEval_56_correct_bracketing
cpp
#include<assert.h> #include<bits/stdc++.h> // brackets is a string of "<" and ">". // return true if every opening bracket has a corresponding closing bracket. // >>> correct_bracketing(("<")) // (false) // >>> correct_bracketing(("<>")) // (true) // >>> correct_bracketing(("<<><>>")) // (true) // >>> correct_bracketin...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_56_correct_bracketing.py
reworded
} int main() { auto candidate = correct_bracketing; assert(candidate(("<>")) == (true)); assert(candidate(("<<><>>")) == (true)); assert(candidate(("<><><<><>><>")) == (true)); assert(candidate(("<><><<<><><>><>><<><><<>>>")) == (true)); assert(candidate(("<<<><>>>>")) == (false)); assert(ca...
[ "\n}" ]
HumanEval_57_monotonic
cpp
#include<assert.h> #include<bits/stdc++.h> // Return true is vector elements are monotonically increasing or decreasing. // >>> monotonic((std::vector<long>({(long)1, (long)2, (long)4, (long)20}))) // (true) // >>> monotonic((std::vector<long>({(long)1, (long)20, (long)4, (long)10}))) // (false) // >>> monotonic((std::...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_57_monotonic.py
reworded
} int main() { auto candidate = monotonic; assert(candidate((std::vector<long>({(long)1, (long)2, (long)4, (long)10}))) == (true)); assert(candidate((std::vector<long>({(long)1, (long)2, (long)4, (long)20}))) == (true)); assert(candidate((std::vector<long>({(long)1, (long)20, (long)4, (long)10}))) == (f...
[ "\n}" ]
HumanEval_58_common
cpp
#include<assert.h> #include<bits/stdc++.h> // Return sorted unique common elements for two vectors. // >>> common((std::vector<long>({(long)1, (long)4, (long)3, (long)34, (long)653, (long)2, (long)5})), (std::vector<long>({(long)5, (long)7, (long)1, (long)5, (long)9, (long)653, (long)121}))) // (std::vector<long>({(lon...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_58_common.py
reworded
} int main() { auto candidate = common; assert(candidate((std::vector<long>({(long)1, (long)4, (long)3, (long)34, (long)653, (long)2, (long)5})), (std::vector<long>({(long)5, (long)7, (long)1, (long)5, (long)9, (long)653, (long)121}))) == (std::vector<long>({(long)1, (long)5, (long)653}))); assert(candidate...
[ "\n}" ]
HumanEval_59_largest_prime_factor
cpp
#include<assert.h> #include<bits/stdc++.h> // Return the largest prime factor of n. Assume n > 1 and is not a prime. // >>> largest_prime_factor((13195)) // (29) // >>> largest_prime_factor((2048)) // (2) long largest_prime_factor(long n) {
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_59_largest_prime_factor.py
reworded
} int main() { auto candidate = largest_prime_factor; assert(candidate((15)) == (5)); assert(candidate((27)) == (3)); assert(candidate((63)) == (7)); assert(candidate((330)) == (11)); assert(candidate((13195)) == (29)); }
[ "\n}" ]
HumanEval_5_intersperse
cpp
#include<assert.h> #include<bits/stdc++.h> // Insert a number 'delimeter' between every two consecutive elements of input vector `numbers' // >>> intersperse((std::vector<long>()), (4)) // (std::vector<long>()) // >>> intersperse((std::vector<long>({(long)1, (long)2, (long)3})), (4)) // (std::vector<long>({(long)1, (lo...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_5_intersperse.py
reworded
} int main() { auto candidate = intersperse; assert(candidate((std::vector<long>()), (7)) == (std::vector<long>())); assert(candidate((std::vector<long>({(long)5, (long)6, (long)3, (long)2})), (8)) == (std::vector<long>({(long)5, (long)8, (long)6, (long)8, (long)3, (long)8, (long)2}))); assert(candidate...
[ "\n}" ]
HumanEval_60_sum_to_n
cpp
#include<assert.h> #include<bits/stdc++.h> // sum_to_n is a function that sums numbers from 1 to n. // >>> sum_to_n((30)) // (465) // >>> sum_to_n((100)) // (5050) // >>> sum_to_n((5)) // (15) // >>> sum_to_n((10)) // (55) // >>> sum_to_n((1)) // (1) long sum_to_n(long n) {
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_60_sum_to_n.py
reworded
} int main() { auto candidate = sum_to_n; assert(candidate((1)) == (1)); assert(candidate((6)) == (21)); assert(candidate((11)) == (66)); assert(candidate((30)) == (465)); assert(candidate((100)) == (5050)); }
[ "\n}" ]
HumanEval_61_correct_bracketing
cpp
#include<assert.h> #include<bits/stdc++.h> // brackets is a string of "(" and ")". // return true if every opening bracket has a corresponding closing bracket. // >>> correct_bracketing(("(")) // (false) // >>> correct_bracketing(("()")) // (true) // >>> correct_bracketing(("(()())")) // (true) // >>> correct_bracketin...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_61_correct_bracketing.py
reworded
} int main() { auto candidate = correct_bracketing; assert(candidate(("()")) == (true)); assert(candidate(("(()())")) == (true)); assert(candidate(("()()(()())()")) == (true)); assert(candidate(("()()((()()())())(()()(()))")) == (true)); assert(candidate(("((()())))")) == (false)); assert(ca...
[ "\n}" ]
HumanEval_62_derivative
cpp
#include<assert.h> #include<bits/stdc++.h> // xs represent coefficients of a polynomial. // xs[0] + xs[1] * x + xs[2] * x^2 + .... // Return derivative of this polynomial in the same form. // >>> derivative((std::vector<long>({(long)3, (long)1, (long)2, (long)4, (long)5}))) // (std::vector<long>({(long)1, (long)4, (lon...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_62_derivative.py
reworded
} int main() { auto candidate = derivative; assert(candidate((std::vector<long>({(long)3, (long)1, (long)2, (long)4, (long)5}))) == (std::vector<long>({(long)1, (long)4, (long)12, (long)20}))); assert(candidate((std::vector<long>({(long)1, (long)2, (long)3}))) == (std::vector<long>({(long)2, (long)6}))); ...
[ "\n}" ]
HumanEval_63_fibfib
cpp
#include<assert.h> #include<bits/stdc++.h> // 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 e...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_63_fibfib.py
reworded
} int main() { auto candidate = fibfib; assert(candidate((2)) == (1)); assert(candidate((1)) == (0)); assert(candidate((5)) == (4)); assert(candidate((8)) == (24)); assert(candidate((10)) == (81)); assert(candidate((12)) == (274)); assert(candidate((14)) == (927)); }
[ "\n}" ]
HumanEval_64_vowels_count
cpp
#include<assert.h> #include<bits/stdc++.h> // 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:...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_64_vowels_count.py
reworded
} int main() { auto candidate = vowels_count; assert(candidate(("abcde")) == (2)); assert(candidate(("Alone")) == (3)); assert(candidate(("key")) == (2)); assert(candidate(("bye")) == (1)); assert(candidate(("keY")) == (2)); assert(candidate(("bYe")) == (1)); assert(candidate(("ACEDY")) ...
[ "\n}" ]
HumanEval_65_circular_shift
cpp
#include<assert.h> #include<bits/stdc++.h> // 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. // >>> circular_shift((12), (1)) // ("21") // >>> circular_shift((12), (2)) // ("12") std::string circul...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_65_circular_shift.py
reworded
} int main() { auto candidate = circular_shift; assert(candidate((100), (2)) == ("001")); assert(candidate((12), (2)) == ("12")); assert(candidate((97), (8)) == ("79")); assert(candidate((12), (1)) == ("21")); assert(candidate((11), (101)) == ("11")); }
[ "\n}" ]
HumanEval_66_digitSum
cpp
#include<assert.h> #include<bits/stdc++.h> // Task // Write a function that takes a string as input and returns the sum of the upper characters only' // ASCII codes. // Examples: // >>> digitSum(("")) // (0) // >>> digitSum(("abAB")) // (131) // >>> digitSum(("abcCd")) // (67) // >>> digitSum(("helloE")) // (69) // >>>...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_66_digitSum.py
reworded
} int main() { auto candidate = digitSum; assert(candidate(("")) == (0)); assert(candidate(("abAB")) == (131)); assert(candidate(("abcCd")) == (67)); assert(candidate(("helloE")) == (69)); assert(candidate(("woArBld")) == (131)); assert(candidate(("aAaaaXa")) == (153)); assert(candidate(...
[ "\n}" ]
HumanEval_67_fruit_distribution
cpp
#include<assert.h> #include<bits/stdc++.h> // 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 ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_67_fruit_distribution.py
reworded
} int main() { auto candidate = fruit_distribution; assert(candidate(("5 apples and 6 oranges"), (19)) == (8)); assert(candidate(("5 apples and 6 oranges"), (21)) == (10)); assert(candidate(("0 apples and 1 oranges"), (3)) == (2)); assert(candidate(("1 apples and 0 oranges"), (3)) == (2)); asser...
[ "\n}" ]
HumanEval_68_pluck
cpp
#include<assert.h> #include<bits/stdc++.h> // "Given a vector 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...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_68_pluck.py
reworded
} int main() { auto candidate = pluck; assert(candidate((std::vector<long>({(long)4, (long)2, (long)3}))) == (std::vector<long>({(long)2, (long)1}))); assert(candidate((std::vector<long>({(long)1, (long)2, (long)3}))) == (std::vector<long>({(long)2, (long)1}))); assert(candidate((std::vector<long>())) =...
[ "\n}" ]
HumanEval_69_search
cpp
#include<assert.h> #include<bits/stdc++.h> // You are given a non-empty vector 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 vector. /...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_69_search.py
reworded
} int main() { auto candidate = search; assert(candidate((std::vector<long>({(long)5, (long)5, (long)5, (long)5, (long)1}))) == (1)); assert(candidate((std::vector<long>({(long)4, (long)1, (long)4, (long)1, (long)4, (long)4}))) == (4)); assert(candidate((std::vector<long>({(long)3, (long)3}))) == (-1));...
[ "\n}" ]
HumanEval_6_parse_nested_parens
cpp
#include<assert.h> #include<bits/stdc++.h> // 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_nes...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_6_parse_nested_parens.py
reworded
} int main() { auto candidate = parse_nested_parens; assert(candidate(("(()()) ((())) () ((())()())")) == (std::vector<long>({(long)2, (long)3, (long)1, (long)3}))); assert(candidate(("() (()) ((())) (((())))")) == (std::vector<long>({(long)1, (long)2, (long)3, (long)4}))); assert(candidate(("(()(())(((...
[ "\n}" ]
HumanEval_70_strange_sort_list
cpp
#include<assert.h> #include<bits/stdc++.h> // Given vector of integers, return vector 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((std::vector<long>({(long)1, (long)2, (long)3, (l...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_70_strange_sort_list.py
reworded
} int main() { auto candidate = strange_sort_list; assert(candidate((std::vector<long>({(long)1, (long)2, (long)3, (long)4}))) == (std::vector<long>({(long)1, (long)4, (long)2, (long)3}))); assert(candidate((std::vector<long>({(long)5, (long)6, (long)7, (long)8, (long)9}))) == (std::vector<long>({(long)5, (...
[ "\n}" ]
HumanEval_71_triangle_area
cpp
#include<assert.h> #include<bits/stdc++.h> // 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 th...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_71_triangle_area.py
reworded
} int main() { auto candidate = triangle_area; assert(candidate((3), (4), (5)) == (6.0f)); assert(candidate((1), (2), (10)) == (float(-1))); assert(candidate((4), (8), (5)) == (8.18f)); assert(candidate((2), (2), (2)) == (1.73f)); assert(candidate((1), (2), (3)) == (float(-1))); assert(candi...
[ "\n}" ]
HumanEval_72_will_it_fly
cpp
#include<assert.h> #include<bits/stdc++.h> // 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 vector) and the sum of its elements is less than or equal the maximum possible weight w. // Example: // >>> will_it_fly((std::vec...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_72_will_it_fly.py
reworded
} int main() { auto candidate = will_it_fly; assert(candidate((std::vector<long>({(long)3, (long)2, (long)3})), (9)) == (true)); assert(candidate((std::vector<long>({(long)1, (long)2})), (5)) == (false)); assert(candidate((std::vector<long>({(long)3})), (5)) == (true)); assert(candidate((std::vector...
[ "\n}" ]
HumanEval_73_smallest_change
cpp
#include<assert.h> #include<bits/stdc++.h> // Given a vector arr of integers, find the minimum number of elements that // need to be changed to make the vector palindromic. A palindromic vector is a vector that // is read the same backwards and forwards. In one change, you can change one element to any other element. /...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_73_smallest_change.py
reworded
} int main() { auto candidate = smallest_change; assert(candidate((std::vector<long>({(long)1, (long)2, (long)3, (long)5, (long)4, (long)7, (long)9, (long)6}))) == (4)); assert(candidate((std::vector<long>({(long)1, (long)2, (long)3, (long)4, (long)3, (long)2, (long)2}))) == (1)); assert(candidate((std:...
[ "\n}" ]
HumanEval_74_total_match
cpp
#include<assert.h> #include<bits/stdc++.h> // Write a function that accepts two vectors of strings and returns the vector that has // total number of chars in the all strings of the vector less than the other vector. // if the two vectors have the same number of chars, return the first vector. // Examples // >>> total...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_74_total_match.py
reworded
} int main() { auto candidate = total_match; assert(candidate((std::vector<std::string>()), (std::vector<std::string>())) == (std::vector<std::string>())); assert(candidate((std::vector<std::string>({(std::string)"hi", (std::string)"admin"})), (std::vector<std::string>({(std::string)"hi", (std::string)"hi"}...
[ "\n}" ]
HumanEval_75_is_multiply_prime
cpp
#include<assert.h> #include<bits/stdc++.h> // 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((30)) // (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
} int main() { auto candidate = is_multiply_prime; assert(candidate((5)) == (false)); assert(candidate((30)) == (true)); assert(candidate((8)) == (true)); assert(candidate((10)) == (false)); assert(candidate((125)) == (true)); assert(candidate((105)) == (true)); assert(candidate((126)) =...
[ "\n}" ]
HumanEval_76_is_simple_power
cpp
#include<assert.h> #include<bits/stdc++.h> // 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((1), (4)) // (true) // >>> is_simple_power((2), (2)) // (true) // >>> is_simpl...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_76_is_simple_power.py
reworded
} int main() { auto candidate = is_simple_power; assert(candidate((16), (2)) == (true)); assert(candidate((143214), (16)) == (false)); assert(candidate((4), (2)) == (true)); assert(candidate((9), (3)) == (true)); assert(candidate((16), (4)) == (true)); assert(candidate((24), (2)) == (false))...
[ "\n}" ]
HumanEval_77_iscube
cpp
#include<assert.h> #include<bits/stdc++.h> // 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((1)) // (true) // >>> iscube((2)) // (false) // >>> iscube((-1)) // (true) // >>> is...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_77_iscube.py
reworded
} int main() { auto candidate = iscube; assert(candidate((1)) == (true)); assert(candidate((2)) == (false)); assert(candidate((-1)) == (true)); assert(candidate((64)) == (true)); assert(candidate((180)) == (false)); assert(candidate((1000)) == (true)); assert(candidate((0)) == (true)); ...
[ "\n}" ]
HumanEval_78_hex_key
cpp
#include<assert.h> #include<bits/stdc++.h> // 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...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_78_hex_key.py
reworded
} int main() { auto candidate = hex_key; assert(candidate(("AB")) == (1)); assert(candidate(("1077E")) == (2)); assert(candidate(("ABED1A33")) == (4)); assert(candidate(("2020")) == (2)); assert(candidate(("123456789ABCDEF0")) == (6)); assert(candidate(("112233445566778899AABBCCDDEEFF00")) =...
[ "\n}" ]
HumanEval_79_decimal_to_binary
cpp
#include<assert.h> #include<bits/stdc++.h> // 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 char...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_79_decimal_to_binary.py
reworded
} int main() { auto candidate = decimal_to_binary; assert(candidate((0)) == ("db0db")); assert(candidate((32)) == ("db100000db")); assert(candidate((103)) == ("db1100111db")); assert(candidate((15)) == ("db1111db")); }
[ "\n}" ]
HumanEval_7_filter_by_substring
cpp
#include<assert.h> #include<bits/stdc++.h> // Filter an input vector of strings only for ones that contain given substring // >>> filter_by_substring((std::vector<std::string>()), ("a")) // (std::vector<std::string>()) // >>> filter_by_substring((std::vector<std::string>({(std::string)"abc", (std::string)"bacd", (std::...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_7_filter_by_substring.py
reworded
} int main() { auto candidate = filter_by_substring; assert(candidate((std::vector<std::string>()), ("john")) == (std::vector<std::string>())); assert(candidate((std::vector<std::string>({(std::string)"xxx", (std::string)"asd", (std::string)"xxy", (std::string)"john doe", (std::string)"xxxAAA", (std::string...
[ "\n}" ]
HumanEval_80_is_happy
cpp
#include<assert.h> #include<bits/stdc++.h> // You are given a string s. // Your task is to check if the string is hapcpp or not. // A string is hapcpp 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_h...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_80_is_happy.py
reworded
} int main() { auto 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(candidat...
[ "\n}" ]
HumanEval_81_numerical_letter_grade
cpp
#include<assert.h> #include<bits/stdc++.h> // 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 vector of GPAs for some students ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_81_numerical_letter_grade.py
reworded
} int main() { auto candidate = numerical_letter_grade; assert(candidate((std::vector<float>({(float)4.0f, (float)3, (float)1.7f, (float)2, (float)3.5f}))) == (std::vector<std::string>({(std::string)"A+", (std::string)"B", (std::string)"C-", (std::string)"C", (std::string)"A-"}))); assert(candidate((std::ve...
[ "\n}" ]
HumanEval_82_prime_length
cpp
#include<assert.h> #include<bits/stdc++.h> // 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(...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_82_prime_length.py
reworded
} int main() { auto 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)); ...
[ "\n}" ]
HumanEval_83_starts_one_ends
cpp
#include<assert.h> #include<bits/stdc++.h> // 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
} int main() { auto candidate = starts_one_ends; assert(candidate((1)) == (1)); assert(candidate((2)) == (18)); assert(candidate((3)) == (180)); assert(candidate((4)) == (1800)); assert(candidate((5)) == (18000)); }
[ "\n}" ]
HumanEval_84_solve
cpp
#include<assert.h> #include<bits/stdc++.h> // Given a positive integer N, return the total sum of its digits in binary. // Example // >>> solve((1000)) // ("1") // >>> solve((150)) // ("110") // >>> solve((147)) // ("1100") // Variables: // @N integer // Constraints: 0 ≤ N ≤ 10000. // Output: // a string of binary numb...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_84_solve.py
reworded
} int main() { auto candidate = solve; assert(candidate((1000)) == ("1")); assert(candidate((150)) == ("110")); assert(candidate((147)) == ("1100")); assert(candidate((333)) == ("1001")); assert(candidate((963)) == ("10010")); }
[ "\n}" ]
HumanEval_85_add
cpp
#include<assert.h> #include<bits/stdc++.h> // Given a non-empty vector of integers lst. add the even elements that are at odd indices.. // Examples: // >>> add((std::vector<long>({(long)4, (long)2, (long)6, (long)7}))) // (2) long add(std::vector<long> lst) {
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_85_add.py
reworded
} int main() { auto candidate = add; assert(candidate((std::vector<long>({(long)4, (long)88}))) == (88)); assert(candidate((std::vector<long>({(long)4, (long)5, (long)6, (long)7, (long)2, (long)122}))) == (122)); assert(candidate((std::vector<long>({(long)4, (long)0, (long)6, (long)7}))) == (0)); as...
[ "\n}" ]
HumanEval_86_anti_shuffle
cpp
#include<assert.h> #include<bits/stdc++.h> // 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...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_86_anti_shuffle.py
reworded
} int main() { auto 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(("...
[ "\n}" ]
HumanEval_87_get_row
cpp
#include<assert.h> #include<bits/stdc++.h> // You are given a 2 dimensional data, as a nested vectors, // 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 vector, // and return vector of tuples, [(x1, y1), (x...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_87_get_row.py
reworded
} int main() { auto candidate = get_row; assert(candidate((std::vector<std::vector<long>>({(std::vector<long>)std::vector<long>({(long)1, (long)2, (long)3, (long)4, (long)5, (long)6}), (std::vector<long>)std::vector<long>({(long)1, (long)2, (long)3, (long)4, (long)1, (long)6}), (std::vector<long>)std::vector<lo...
[ "\n}" ]
HumanEval_88_sort_array
cpp
#include<assert.h> #include<bits/stdc++.h> // Given a vector of non-negative integers, return a cocpp of the given vector after sorting, // you will sort the given vector 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 ind...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_88_sort_array.py
reworded
} int main() { auto candidate = sort_array; assert(candidate((std::vector<long>())) == (std::vector<long>())); assert(candidate((std::vector<long>({(long)5}))) == (std::vector<long>({(long)5}))); assert(candidate((std::vector<long>({(long)2, (long)4, (long)3, (long)0, (long)1, (long)5}))) == (std::vecto...
[ "\n}" ]
HumanEval_89_encrypt
cpp
#include<assert.h> #include<bits/stdc++.h> // 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: // >>> encryp...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_89_encrypt.py
reworded
} int main() { auto candidate = encrypt; assert(candidate(("hi")) == ("lm")); assert(candidate(("asdfghjkl")) == ("ewhjklnop")); assert(candidate(("gf")) == ("kj")); assert(candidate(("et")) == ("ix")); assert(candidate(("faewfawefaewg")) == ("jeiajeaijeiak")); assert(candidate(("hellomyfrie...
[ "\n}" ]
HumanEval_8_sum_product
cpp
#include<assert.h> #include<bits/stdc++.h> // For a given vector of integers, return a tuple consisting of a sum and a product of all the integers in a vector. // Empty sum should be equal to 0 and empty product should be equal to 1. // >>> sum_product((std::vector<long>())) // (std::make_tuple(0, 1)) // >>> sum_produc...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_8_sum_product.py
reworded
} int main() { auto candidate = sum_product; assert(candidate((std::vector<long>())) == (std::make_tuple(0, 1))); assert(candidate((std::vector<long>({(long)1, (long)1, (long)1}))) == (std::make_tuple(3, 1))); assert(candidate((std::vector<long>({(long)100, (long)0}))) == (std::make_tuple(100, 0))); ...
[ "\n}" ]
HumanEval_90_next_smallest
cpp
#include<assert.h> #include<bits/stdc++.h> // You are given a vector of integers. // Write a function next_smallest() that returns the 2nd smallest element of the vector. // Return None if there is no such element. // >>> next_smallest((std::vector<long>({(long)1, (long)2, (long)3, (long)4, (long)5}))) // 2 // >>> next...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_90_next_smallest.py
reworded
} int main() { auto candidate = next_smallest; assert(candidate((std::vector<long>({(long)1, (long)2, (long)3, (long)4, (long)5}))) == 2); assert(candidate((std::vector<long>({(long)5, (long)1, (long)4, (long)3, (long)2}))) == 2); assert(candidate((std::vector<long>())) == std::nullopt); assert(cand...
[ "\n}" ]
HumanEval_91_is_bored
cpp
#include<assert.h> #include<bits/stdc++.h> // 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")) // (0) // >>> is_bored(("The sky is...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_91_is_bored.py
reworded
} int main() { auto candidate = is_bored; assert(candidate(("Hello world")) == (0)); assert(candidate(("Is the sky blue?")) == (0)); assert(candidate(("I love It !")) == (1)); assert(candidate(("bIt")) == (0)); assert(candidate(("I feel good today. I will be productive. will kill It")) == (2)); ...
[ "\n}" ]
HumanEval_92_any_int
cpp
#include<assert.h> #include<bits/stdc++.h> // 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((float(5)), (float(2)), (float(7))) // (true) // >>> any_int((fl...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_92_any_int.py
reworded
} int main() { auto candidate = any_int; assert(candidate((float(2)), (float(3)), (float(1))) == (true)); assert(candidate((2.5f), (float(2)), (float(3))) == (false)); assert(candidate((1.5f), (float(5)), (3.5f)) == (false)); assert(candidate((float(2)), (float(6)), (float(2))) == (false)); asse...
[ "\n}" ]
HumanEval_93_encode
cpp
#include<assert.h> #include<bits/stdc++.h> // 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: // >>...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_93_encode.py
reworded
} int main() { auto 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 kN...
[ "\n}" ]
HumanEval_94_skjkasdkd
cpp
#include<assert.h> #include<bits/stdc++.h> // You are given a vector of integers. // You need to find the largest prime value and return the sum of its digits. // Examples: // >>> skjkasdkd((std::vector<long>({(long)0, (long)3, (long)2, (long)1, (long)3, (long)5, (long)7, (long)4, (long)5, (long)5, (long)5, (long)2, (l...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_94_skjkasdkd.py
reworded
} int main() { auto candidate = skjkasdkd; assert(candidate((std::vector<long>({(long)0, (long)3, (long)2, (long)1, (long)3, (long)5, (long)7, (long)4, (long)5, (long)5, (long)5, (long)2, (long)181, (long)32, (long)4, (long)32, (long)3, (long)2, (long)32, (long)324, (long)4, (long)3}))) == (10)); assert(can...
[ "\n}" ]
HumanEval_95_check_dict_case
cpp
#include<assert.h> #include<bits/stdc++.h> // Given a map, 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 map is empty. // Examples: // >>> check_dict_case((std::map<std::string,std::string>({{"a", "apple"}...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_95_check_dict_case.py
reworded
} int main() { auto candidate = check_dict_case; assert(candidate((std::map<std::string,std::string>({{"p", "pineapple"}, {"b", "banana"}}))) == (true)); assert(candidate((std::map<std::string,std::string>({{"p", "pineapple"}, {"A", "banana"}, {"B", "banana"}}))) == (false)); assert(candidate((std::map<...
[ "\n}" ]
HumanEval_96_count_up_to
cpp
#include<assert.h> #include<bits/stdc++.h> // Implement a function that takes an non-negative integer and returns a vector of the first n // integers that are prime numbers and less than n. // for example: // >>> count_up_to((5)) // (std::vector<long>({(long)2, (long)3})) // >>> count_up_to((11)) // (std::vector<long>(...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_96_count_up_to.py
reworded
} int main() { auto candidate = count_up_to; assert(candidate((5)) == (std::vector<long>({(long)2, (long)3}))); assert(candidate((6)) == (std::vector<long>({(long)2, (long)3, (long)5}))); assert(candidate((7)) == (std::vector<long>({(long)2, (long)3, (long)5}))); assert(candidate((10)) == (std::vect...
[ "\n}" ]
HumanEval_97_multiply
cpp
#include<assert.h> #include<bits/stdc++.h> // Complete the function that takes two integers and returns // the product of their unit digits. // Assume the input is always valid. // Examples: // >>> multiply((148), (412)) // (16) // >>> multiply((19), (28)) // (72) // >>> multiply((2020), (1851)) // (0) // >>> multiply...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_97_multiply.py
reworded
} int main() { auto candidate = multiply; assert(candidate((148), (412)) == (16)); assert(candidate((19), (28)) == (72)); assert(candidate((2020), (1851)) == (0)); assert(candidate((14), (-15)) == (20)); assert(candidate((76), (67)) == (42)); assert(candidate((17), (27)) == (49)); assert...
[ "\n}" ]
HumanEval_98_count_upper
cpp
#include<assert.h> #include<bits/stdc++.h> // Given a string s, count the number of uppercase vowels in even indices. // For example: // >>> count_upper(("aBCdEf")) // (1) // >>> count_upper(("abcdefg")) // (0) // >>> count_upper(("dBBE")) // (0) long count_upper(std::string s) {
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_98_count_upper.py
reworded
} int main() { auto candidate = count_upper; assert(candidate(("aBCdEf")) == (1)); assert(candidate(("abcdefg")) == (0)); assert(candidate(("dBBE")) == (0)); assert(candidate(("B")) == (0)); assert(candidate(("U")) == (1)); assert(candidate(("")) == (0)); assert(candidate(("EEEE")) == (2...
[ "\n}" ]
HumanEval_99_closest_integer
cpp
#include<assert.h> #include<bits/stdc++.h> // 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")) // (10) // >>> closest_integer(("15.3")) // (...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_99_closest_integer.py
reworded
} int main() { auto candidate = closest_integer; assert(candidate(("10")) == (10)); assert(candidate(("14.5")) == (15)); assert(candidate(("-15.5")) == (-16)); assert(candidate(("15.3")) == (15)); assert(candidate(("0")) == (0)); }
[ "\n}" ]
HumanEval_9_rolling_max
cpp
#include<assert.h> #include<bits/stdc++.h> // From a given vector of integers, generate a vector of rolling maximum element found until given moment // in the sequence. // >>> rolling_max((std::vector<long>({(long)1, (long)2, (long)3, (long)2, (long)3, (long)4, (long)2}))) // (std::vector<long>({(long)1, (long)2, (long...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_9_rolling_max.py
reworded
} int main() { auto candidate = rolling_max; assert(candidate((std::vector<long>())) == (std::vector<long>())); assert(candidate((std::vector<long>({(long)1, (long)2, (long)3, (long)4}))) == (std::vector<long>({(long)1, (long)2, (long)3, (long)4}))); assert(candidate((std::vector<long>({(long)4, (long)3...
[ "\n}" ]
HumanEval_0_has_close_elements
cpp
#include<assert.h> #include<bits/stdc++.h> // Check if in given list of numbers, are any two numbers closer to each other than // given threshold. // >>> has_close_elements((std::vector<float>({(float)1.0f, (float)2.0f, (float)3.0f})), (0.5f)) // (false) // >>> has_close_elements((std::vector<float>({(float)1.0f, (floa...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_0_has_close_elements.py
verbatim
} int main() { auto candidate = has_close_elements; assert(candidate((std::vector<float>({(float)1.0f, (float)2.0f, (float)3.9f, (float)4.0f, (float)5.0f, (float)2.2f})), (0.3f)) == (true)); assert(candidate((std::vector<float>({(float)1.0f, (float)2.0f, (float)3.9f, (float)4.0f, (float)5.0f, (float)2.2f}))...
[ "\n}" ]
HumanEval_100_make_a_pile
cpp
#include<assert.h> #include<bits/stdc++.h> // 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 lev...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_100_make_a_pile.py
verbatim
} int main() { auto candidate = make_a_pile; assert(candidate((3)) == (std::vector<long>({(long)3, (long)5, (long)7}))); assert(candidate((4)) == (std::vector<long>({(long)4, (long)6, (long)8, (long)10}))); assert(candidate((5)) == (std::vector<long>({(long)5, (long)7, (long)9, (long)11, (long)13}))); ...
[ "\n}" ]
HumanEval_101_words_string
cpp
#include<assert.h> #include<bits/stdc++.h> // 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")) // (std::vector<std::string>({(std::string)"Hi", (std::string)"my...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_101_words_string.py
verbatim
} int main() { auto candidate = words_string; assert(candidate(("Hi, my name is John")) == (std::vector<std::string>({(std::string)"Hi", (std::string)"my", (std::string)"name", (std::string)"is", (std::string)"John"}))); assert(candidate(("One, two, three, four, five, six")) == (std::vector<std::string>({(s...
[ "\n}" ]
HumanEval_102_choose_num
cpp
#include<assert.h> #include<bits/stdc++.h> // This function takes two positive numbers x and y and returns the // biggest even integer number that is in the range [x, y] inclusive. If // there's no such number, then the function should return -1. // For example: // >>> choose_num((12), (15)) // (14) // >>> choose_num(...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_102_choose_num.py
verbatim
} int main() { auto candidate = choose_num; assert(candidate((12), (15)) == (14)); assert(candidate((13), (12)) == (-1)); assert(candidate((33), (12354)) == (12354)); assert(candidate((5234), (5233)) == (-1)); assert(candidate((6), (29)) == (28)); assert(candidate((27), (10)) == (-1)); a...
[ "\n}" ]
HumanEval_103_rounded_avg
cpp
#include<assert.h> #include<bits/stdc++.h> union Union_std_string_long{ std::string f0; long f1; Union_std_string_long(std::string _f0) : f0(_f0) {} Union_std_string_long(long _f1) : f1(_f1) {} ~Union_std_string_long() {} bool operator==(std::string f) { return f0 == f ; } bool ope...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_103_rounded_avg.py
verbatim
} int main() { auto candidate = rounded_avg; assert(candidate((1), (5)) == "0b11"); assert(candidate((7), (13)) == "0b1010"); assert(candidate((964), (977)) == "0b1111001010"); assert(candidate((996), (997)) == "0b1111100100"); assert(candidate((560), (851)) == "0b1011000010"); assert(candid...
[ "\n}" ]
HumanEval_104_unique_digits
cpp
#include<assert.h> #include<bits/stdc++.h> // 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((std::vector<long>({(long)15, (long)33, (long)1422, (long)1}))) // (st...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_104_unique_digits.py
verbatim
} int main() { auto candidate = unique_digits; assert(candidate((std::vector<long>({(long)15, (long)33, (long)1422, (long)1}))) == (std::vector<long>({(long)1, (long)15, (long)33}))); assert(candidate((std::vector<long>({(long)152, (long)323, (long)1422, (long)10}))) == (std::vector<long>())); assert(ca...
[ "\n}" ]
HumanEval_105_by_length
cpp
#include<assert.h> #include<bits/stdc++.h> // 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_...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_105_by_length.py
verbatim
} int main() { auto candidate = by_length; assert(candidate((std::vector<long>({(long)2, (long)1, (long)1, (long)4, (long)5, (long)8, (long)2, (long)3}))) == (std::vector<std::string>({(std::string)"Eight", (std::string)"Five", (std::string)"Four", (std::string)"Three", (std::string)"Two", (std::string)"Two", (...
[ "\n}" ]
HumanEval_106_f
cpp
#include<assert.h> #include<bits/stdc++.h> // 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 multiplic...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_106_f.py
verbatim
} int main() { auto candidate = f; assert(candidate((5)) == (std::vector<long>({(long)1, (long)2, (long)6, (long)24, (long)15}))); assert(candidate((7)) == (std::vector<long>({(long)1, (long)2, (long)6, (long)24, (long)15, (long)720, (long)28}))); assert(candidate((1)) == (std::vector<long>({(long)1})))...
[ "\n}" ]
HumanEval_107_even_odd_palindrome
cpp
#include<assert.h> #include<bits/stdc++.h> // 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((3)) // (std::make_tuple(1, 2)) // Explanation: // Integer palindrome are 1, 2, 3. one...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_107_even_odd_palindrome.py
verbatim
} int main() { auto candidate = even_odd_palindrome; assert(candidate((123)) == (std::make_tuple(8, 13))); assert(candidate((12)) == (std::make_tuple(4, 6))); assert(candidate((3)) == (std::make_tuple(1, 2))); assert(candidate((63)) == (std::make_tuple(6, 8))); assert(candidate((25)) == (std::ma...
[ "\n}" ]
HumanEval_108_count_nums
cpp
#include<assert.h> #include<bits/stdc++.h> // 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((std::v...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_108_count_nums.py
verbatim
} int main() { auto candidate = count_nums; assert(candidate((std::vector<long>())) == (0)); assert(candidate((std::vector<long>({(long)-1, (long)-2, (long)0}))) == (0)); assert(candidate((std::vector<long>({(long)1, (long)1, (long)2, (long)-2, (long)3, (long)4, (long)5}))) == (6)); assert(candidate...
[ "\n}" ]
HumanEval_109_move_one_ball
cpp
#include<assert.h> #include<bits/stdc++.h> // 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:...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_109_move_one_ball.py
verbatim
} int main() { auto candidate = move_one_ball; assert(candidate((std::vector<long>({(long)3, (long)4, (long)5, (long)1, (long)2}))) == (true)); assert(candidate((std::vector<long>({(long)3, (long)5, (long)10, (long)1, (long)2}))) == (true)); assert(candidate((std::vector<long>({(long)4, (long)3, (long)1...
[ "\n}" ]
HumanEval_10_make_palindrome
cpp
#include<assert.h> #include<bits/stdc++.h> // 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. // ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_10_make_palindrome.py
verbatim
} int main() { auto candidate = make_palindrome; assert(candidate(("")) == ("")); assert(candidate(("x")) == ("x")); assert(candidate(("xyz")) == ("xyzyx")); assert(candidate(("xyx")) == ("xyx")); assert(candidate(("jerry")) == ("jerryrrej")); }
[ "\n}" ]
HumanEval_110_exchange
cpp
#include<assert.h> #include<bits/stdc++.h> // 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 bet...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_110_exchange.py
verbatim
} int main() { auto candidate = exchange; assert(candidate((std::vector<long>({(long)1, (long)2, (long)3, (long)4})), (std::vector<long>({(long)1, (long)2, (long)3, (long)4}))) == ("YES")); assert(candidate((std::vector<long>({(long)1, (long)2, (long)3, (long)4})), (std::vector<long>({(long)1, (long)5, (lon...
[ "\n}" ]
HumanEval_111_histogram
cpp
#include<assert.h> #include<bits/stdc++.h> // 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"))...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_111_histogram.py
verbatim
} int main() { auto candidate = histogram; assert(candidate(("a b b a")) == (std::map<std::string,long>({{"a", 2}, {"b", 2}}))); assert(candidate(("a b c a b")) == (std::map<std::string,long>({{"a", 2}, {"b", 2}}))); assert(candidate(("a b c d g")) == (std::map<std::string,long>({{"a", 1}, {"b", 1}, {"c...
[ "\n}" ]
HumanEval_112_reverse_delete
cpp
#include<assert.h> #include<bits/stdc++.h> // 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 tup...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_112_reverse_delete.py
verbatim
} int main() { auto candidate = reverse_delete; assert(candidate(("abcde"), ("ae")) == (std::make_tuple("bcd", false))); assert(candidate(("abcdef"), ("b")) == (std::make_tuple("acdef", false))); assert(candidate(("abcdedcba"), ("ab")) == (std::make_tuple("cdedc", true))); assert(candidate(("dwik"),...
[ "\n}" ]
HumanEval_113_odd_count
cpp
#include<assert.h> #include<bits/stdc++.h> // 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 ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_113_odd_count.py
verbatim
} int main() { auto candidate = odd_count; assert(candidate((std::vector<std::string>({(std::string)"1234567"}))) == (std::vector<std::string>({(std::string)"the number of odd elements 4n the str4ng 4 of the 4nput."}))); assert(candidate((std::vector<std::string>({(std::string)"3", (std::string)"11111111"})...
[ "\n}" ]
HumanEval_114_minSubArraySum
cpp
#include<assert.h> #include<bits/stdc++.h> // Given an array of integers nums, find the minimum sum of any non-empty sub-array // of nums. // Example // >>> minSubArraySum((std::vector<long>({(long)2, (long)3, (long)4, (long)1, (long)2, (long)4}))) // (1) // >>> minSubArraySum((std::vector<long>({(long)-1, (long)-2, (l...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_114_minSubArraySum.py
verbatim
} int main() { auto candidate = minSubArraySum; assert(candidate((std::vector<long>({(long)2, (long)3, (long)4, (long)1, (long)2, (long)4}))) == (1)); assert(candidate((std::vector<long>({(long)-1, (long)-2, (long)-3}))) == (-6)); assert(candidate((std::vector<long>({(long)-1, (long)-2, (long)-3, (long)...
[ "\n}" ]
HumanEval_115_max_fill
cpp
#include<assert.h> #include<bits/stdc++.h> // 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 tas...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_115_max_fill.py
verbatim
} int main() { auto candidate = max_fill; assert(candidate((std::vector<std::vector<long>>({(std::vector<long>)std::vector<long>({(long)0, (long)0, (long)1, (long)0}), (std::vector<long>)std::vector<long>({(long)0, (long)1, (long)0, (long)0}), (std::vector<long>)std::vector<long>({(long)1, (long)1, (long)1, (lo...
[ "\n}" ]
HumanEval_116_sort_array
cpp
#include<assert.h> #include<bits/stdc++.h> // 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((std::vector...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_116_sort_array.py
verbatim
} int main() { auto candidate = sort_array; assert(candidate((std::vector<long>({(long)1, (long)5, (long)2, (long)3, (long)4}))) == (std::vector<long>({(long)1, (long)2, (long)4, (long)3, (long)5}))); assert(candidate((std::vector<long>({(long)-2, (long)-3, (long)-4, (long)-5, (long)-6}))) == (std::vector<l...
[ "\n}" ]
HumanEval_117_select_words
cpp
#include<assert.h> #include<bits/stdc++.h> // 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 ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_117_select_words.py
verbatim
} int main() { auto candidate = select_words; assert(candidate(("Mary had a little lamb"), (4)) == (std::vector<std::string>({(std::string)"little"}))); assert(candidate(("Mary had a little lamb"), (3)) == (std::vector<std::string>({(std::string)"Mary", (std::string)"lamb"}))); assert(candidate(("simple...
[ "\n}" ]