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_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 change_base(long x, lon...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_44_change_base.py
verbatim
} 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.5 float triangle_area(long a, long h) {
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_45_triangle_area.py
verbatim
} 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...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_46_fib4.py
verbatim
} 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 list l. // >>> median([3, 1, 2, 4, 5]) // 3 // >>> median([-10, 4, 6, 1000, 10, 20]) // 15.0 float median(std::vector<long> l) {
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_47_median.py
verbatim
} 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) {
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_48_is_palindrome.py
verbatim
} 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) {
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_49_modp.py
verbatim
} 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 list of input numbers, calculate Mean Absolute Deviation // around the mean of this dataset. // Mean Absolute Deviation is the average absolute difference between each // element and a centerpoint (mean in this case): // MAD = average | x - x_mean | // >>> mean_...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_4_mean_absolute_deviation.py
verbatim
} 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') // 'zbcd' std::stri...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_51_remove_vowels.py
verbatim
} 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 list l are below threshold t. // >>> below_threshold([1, 2, 4, 10], 100) // True // >>> below_threshold([1, 20, 4, 10], 5) // False bool below_threshold(std::vector<long> l, long t) {
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_52_below_threshold.py
verbatim
} 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) {
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_53_add.py
verbatim
} 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 // >>> same_chars('abc...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_54_same_chars.py
verbatim
} 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) {
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_55_fib.py
verbatim
} 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_bracketing("><<>") //...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_56_correct_bracketing.py
verbatim
} 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 list elements are monotonically increasing or decreasing. // >>> monotonic([1, 2, 4, 20]) // True // >>> monotonic([1, 20, 4, 10]) // False // >>> monotonic([4, 1, 0, -10]) // True bool monotonic(std::vector<long> l) {
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_57_monotonic.py
verbatim
} 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 lists. // >>> common([1, 4, 3, 34, 653, 2, 5], [5, 7, 1, 5, 9, 653, 121]) // [1, 5, 653] // >>> common([5, 3, 2, 8], [3, 2]) // [2, 3] std::vector<long> common(std::vector<long> l1, std::vector<long> l2) {
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_58_common.py
verbatim
} 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) {
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_59_largest_prime_factor.py
verbatim
} 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 list `numbers' // >>> intersperse([], 4) // [] // >>> intersperse([1, 2, 3], 4) // [1, 4, 2, 4, 3] std::vector<long> intersperse(std::vector<long> numbers, long delimeter) {
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_5_intersperse.py
verbatim
} 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) {
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_60_sum_to_n.py
verbatim
} 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_bracketing(")(()") //...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_61_correct_bracketing.py
verbatim
} 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([3, 1, 2, 4, 5]) // [1, 4, 12, 20] // >>> derivative([1, 2, 3]) // [2, 6] std::vector<long> derivative(std::vecto...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_62_derivative.py
verbatim
} 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...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_63_fibfib.py
verbatim
} 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:...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_64_vowels_count.py
verbatim
} 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 circular_shift(lon...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_65_circular_shift.py
verbatim
} 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 // digitSum("woArBld") => 131 // digit...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_66_digitSum.py
verbatim
} 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 ...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_67_fruit_distribution.py
verbatim
} 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 an array representing a branch of a tree that has non-negative integer nodes // your task is to pluck one of the nodes and return it. // The plucked node should be the node with the smallest even value. // If multiple nodes with the same smallest even value are found...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_68_pluck.py
verbatim
} 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 list of positive integers. Return the greatest integer that is greater than // zero, and has a frequency greater than or equal to the value of the integer itself. // The frequency of an integer is the number of times it appears in the list. // If...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_69_search.py
verbatim
} 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...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_6_parse_nested_parens.py
verbatim
} 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 list of integers, return list in strange order. // Strange sorting, is when you start with the minimum value, // then maximum of the remaining integers, then minimum and so on. // Examples: // strange_sort_list([1, 2, 3, 4]) == [1, 4, 2, 3] // strange_sort_list([5, 5,...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_70_strange_sort_list.py
verbatim
} 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...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_71_triangle_area.py
verbatim
} 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 list) and the sum of its elements is less than or equal the maximum possible weight w. // Example: // will_it_fly([1, 2], 5) ➞ Fa...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_72_will_it_fly.py
verbatim
} 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 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. // ...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_73_smallest_change.py
verbatim
} 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 lists of strings and returns the list that has // total number of chars in the all strings of the list less than the other list. // if the two lists have the same number of chars, return the first list. // Examples // total_match([], []) ➞...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_74_total_match.py
verbatim
} 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) {
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_75_is_multiply_prime.py
verbatim
} 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_simple_power(8, 2) => true //...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_76_is_simple_power.py
verbatim
} 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 // iscube(64) ==> True // iscu...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_77_iscube.py
verbatim
} 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...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_78_hex_key.py
verbatim
} 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...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_79_decimal_to_binary.py
verbatim
} 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 list of strings only for ones that contain given substring // >>> filter_by_substring([], 'a') // [] // >>> filter_by_substring(['abc', 'bacd', 'cde', 'array'], 'a') // ['abc', 'bacd', 'array'] std::vector<std::string> filter_by_substring(std::vector<std::st...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_7_filter_by_substring.py
verbatim
} 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 happy or not. // A string is happy 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_h...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_80_is_happy.py
verbatim
} 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 list of GPAs for some students an...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_81_numerical_letter_grade.py
verbatim
} 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('orange') == False bool prim...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_82_prime_length.py
verbatim
} 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) {
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_83_starts_one_ends.py
verbatim
} 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 // For N = 1000, the sum of digits will be 1 the output should be "1". // For N = 150, the sum of digits will be 6 the output should be "110". // For N = 147, the sum of digits will be 12 t...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_84_solve.py
verbatim
} 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 list of integers lst. add the even elements that are at odd indices.. // Examples: // add([4, 2, 6, 7]) ==> 2 long add(std::vector<long> lst) {
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_85_add.py
verbatim
} 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...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_86_anti_shuffle.py
verbatim
} 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 lists, // which is similar to matrix, however, unlike matrices, // each row may contain a different number of columns. // Given lst, and integer x, find integers x in the list, // and return list of tuples, [(x1, y1), (x2, y2)...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_87_get_row.py
verbatim
} 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 an array of non-negative integers, return a copy of the given array after sorting, // you will sort the given array in ascending order if the sum( first index value, last index value) is odd, // or sort it in descending order if the sum( first index value, last index ...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_88_sort_array.py
verbatim
} 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: // encrypt('h...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_89_encrypt.py
verbatim
} 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 list of integers, return a tuple consisting of a sum and a product of all the integers in a list. // Empty sum should be equal to 0 and empty product should be equal to 1. // >>> sum_product([]) // (0, 1) // >>> sum_product([1, 2, 3, 4]) // (10, 24) std::tuple<l...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_8_sum_product.py
verbatim
} 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 list of integers. // Write a function next_smallest() that returns the 2nd smallest element of the list. // Return None if there is no such element. // next_smallest([1, 2, 3, 4, 5]) == 2 // next_smallest([5, 1, 4, 3, 2]) == 2 // next_smallest([]) == None //...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_90_next_smallest.py
verbatim
} 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 blue...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_91_is_bored.py
verbatim
} 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(5, 2, 7) ➞ True // any_int(3, 2, 2) ➞ False // any_int(3, -2, 1) ➞ T...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_92_any_int.py
verbatim
} 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: // >>...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_93_encode.py
verbatim
} 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 list of integers. // You need to find the largest prime value and return the sum of its digits. // Examples: // For lst = [0,3,2,1,3,5,7,4,5,5,5,2,181,32,4,32,3,2,32,324,4,3] the output should be 10 // For lst = [1,0,1,8,2,4597,2,1,3,40,1,2,1,2,4,2,5,1] the ...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_94_skjkasdkd.py
verbatim
} 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 dictionary, return True if all keys are strings in lower // case or all keys are strings in upper case, else return False. // The function should return False is the given dictionary is empty. // Examples: // check_dict_case({"a":"apple", "b":"banana"}) should retu...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_95_check_dict_case.py
verbatim
} 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 an array of the first n // integers that are prime numbers and less than n. // for example: // count_up_to(5) => [2,3] // count_up_to(11) => [2,3,5,7] // count_up_to(0) => [] // count_up_to(20) => [2,3,5,7,...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_96_count_up_to.py
verbatim
} 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) should return 16. // multiply(19, 28) should return 72. // multiply(2020, 1851) should return 0. // multip...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_97_multiply.py
verbatim
} 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') returns 1 // count_upper('abcdefg') returns 0 // count_upper('dBBE') returns 0 long count_upper(std::string s) {
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_98_count_upper.py
verbatim
} 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") // 15 // N...
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_99_closest_integer.py
verbatim
} 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 list of integers, generate a list of rolling maximum element found until given moment // in the sequence. // >>> rolling_max([1, 2, 3, 2, 3, 4, 2]) // [1, 2, 3, 3, 3, 4, 4] std::vector<long> rolling_max(std::vector<long> numbers) {
keep
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_9_rolling_max.py
verbatim
} 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. bool has_close_elements(std::vector<float> numbers, float threshold) {
remove
/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...
remove
/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: std::vector<std::string> words_string(std::string s) {
remove
/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: long choose_num(long x, long y) {
remove
/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...
remove
/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: std::vector<long> unique_digits(std::vector<long> x) {
remove
/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: // If the ...
remove
/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...
remove
/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: // Explanation: // Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd. // Example 2: //...
remove
/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. long count_nums(std::vect...
remove
/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:...
remove
/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. std...
remove
/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...
remove
/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: std::map<std::string,long> ...
remove
/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...
remove
/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 ...
remove
/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 long minSubArraySum(std::vector<long> nums) {
remove
/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...
remove
/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: std::vector<long> sort_array(s...
remove
/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 ...
remove
/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}" ]
HumanEval_118_get_closest_vowel
cpp
#include<assert.h> #include<bits/stdc++.h> // 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 condi...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_118_get_closest_vowel.py
verbatim
} int main() { auto 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(candi...
[ "\n}" ]
HumanEval_119_match_parens
cpp
#include<assert.h> #include<bits/stdc++.h> // 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...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_119_match_parens.py
verbatim
} int main() { auto candidate = match_parens; assert(candidate((std::vector<std::string>({(std::string)"()(", (std::string)")"}))) == ("Yes")); assert(candidate((std::vector<std::string>({(std::string)")", (std::string)")"}))) == ("No")); assert(candidate((std::vector<std::string>({(std::string)"(()(())...
[ "\n}" ]
HumanEval_11_string_xor
cpp
#include<assert.h> #include<bits/stdc++.h> // 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. std::string string_xor(std::string a, std::string b) {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_11_string_xor.py
verbatim
} int main() { auto candidate = string_xor; assert(candidate(("111000"), ("101010")) == ("010010")); assert(candidate(("1"), ("1")) == ("0")); assert(candidate(("0101"), ("0000")) == ("0101")); }
[ "\n}" ]
HumanEval_120_maximum
cpp
#include<assert.h> #include<bits/stdc++.h> // 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: // Example 2: // Example 3: // Note: // 1. The length of the array will be in the range of [1, 1000]. // 2. The elements in the arr...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_120_maximum.py
verbatim
} int main() { auto candidate = maximum; assert(candidate((std::vector<long>({(long)-3, (long)-4, (long)5})), (3)) == (std::vector<long>({(long)-4, (long)-3, (long)5}))); assert(candidate((std::vector<long>({(long)4, (long)-4, (long)4})), (2)) == (std::vector<long>({(long)4, (long)4}))); assert(candidat...
[ "\n}" ]
HumanEval_121_solution
cpp
#include<assert.h> #include<bits/stdc++.h> // Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions. // Examples long solution(std::vector<long> lst) {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_121_solution.py
verbatim
} int main() { auto candidate = solution; assert(candidate((std::vector<long>({(long)5, (long)8, (long)7, (long)1}))) == (12)); assert(candidate((std::vector<long>({(long)3, (long)3, (long)3, (long)3, (long)3}))) == (9)); assert(candidate((std::vector<long>({(long)30, (long)13, (long)24, (long)321}))) =...
[ "\n}" ]
HumanEval_122_add_elements
cpp
#include<assert.h> #include<bits/stdc++.h> // 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: // Constraints: // 1. 1 <= len(arr) <= 100 // 2. 1 <= k <= len(arr) long add_elements(std::vector<long> arr, lon...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_122_add_elements.py
verbatim
} int main() { auto candidate = add_elements; assert(candidate((std::vector<long>({(long)1, (long)-2, (long)-3, (long)41, (long)57, (long)76, (long)87, (long)88, (long)99})), (3)) == (-4)); assert(candidate((std::vector<long>({(long)111, (long)121, (long)3, (long)4000, (long)5, (long)6})), (2)) == (0)); ...
[ "\n}" ]
HumanEval_123_get_odd_collatz
cpp
#include<assert.h> #include<bits/stdc++.h> // 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 //...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_123_get_odd_collatz.py
verbatim
} int main() { auto candidate = get_odd_collatz; assert(candidate((14)) == (std::vector<long>({(long)1, (long)5, (long)7, (long)11, (long)13, (long)17}))); assert(candidate((5)) == (std::vector<long>({(long)1, (long)5}))); assert(candidate((12)) == (std::vector<long>({(long)1, (long)3, (long)5}))); ...
[ "\n}" ]
HumanEval_124_valid_date
cpp
#include<assert.h> #include<bits/stdc++.h> // 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 hi...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_124_valid_date.py
verbatim
} int main() { auto 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-...
[ "\n}" ]
HumanEval_125_split_words
cpp
#include<assert.h> #include<bits/stdc++.h> union Union_std_vector_std_string__long{ std::vector<std::string> f0; long f1; Union_std_vector_std_string__long(std::vector<std::string> _f0) : f0(_f0) {} Union_std_vector_std_string__long(long _f1) : f1(_f1) {} ~Union_std_vector_std_string__long() {} b...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_125_split_words.py
verbatim
} int main() { auto candidate = split_words; assert(candidate(("Hello world!")) == std::vector<std::string>({(std::string)"Hello", (std::string)"world!"})); assert(candidate(("Hello,world!")) == std::vector<std::string>({(std::string)"Hello", (std::string)"world!"})); assert(candidate(("Hello world,!"))...
[ "\n}" ]
HumanEval_126_is_sorted
cpp
#include<assert.h> #include<bits/stdc++.h> // 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 bool is_sorted(std::vector<long> lst) {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_126_is_sorted.py
verbatim
} int main() { auto candidate = is_sorted; assert(candidate((std::vector<long>({(long)5}))) == (true)); assert(candidate((std::vector<long>({(long)1, (long)2, (long)3, (long)4, (long)5}))) == (true)); assert(candidate((std::vector<long>({(long)1, (long)3, (long)2, (long)4, (long)5}))) == (false)); a...
[ "\n}" ]
HumanEval_127_intersection
cpp
#include<assert.h> #include<bits/stdc++.h> // 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 t...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_127_intersection.py
verbatim
} int main() { auto candidate = intersection; assert(candidate((std::make_tuple(1, 2)), (std::make_tuple(2, 3))) == ("NO")); assert(candidate((std::make_tuple(-1, 1)), (std::make_tuple(0, 4))) == ("NO")); assert(candidate((std::make_tuple(-3, -1)), (std::make_tuple(-5, 5))) == ("YES")); assert(candi...
[ "\n}" ]
HumanEval_128_prod_signs
cpp
#include<assert.h> #include<bits/stdc++.h> // 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: std::optional<long> prod_signs(std::v...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_128_prod_signs.py
verbatim
} int main() { auto candidate = prod_signs; assert(candidate((std::vector<long>({(long)1, (long)2, (long)2, (long)-4}))) == -9); assert(candidate((std::vector<long>({(long)0, (long)1}))) == 0); assert(candidate((std::vector<long>({(long)1, (long)1, (long)1, (long)2, (long)3, (long)-1, (long)1}))) == -10...
[ "\n}" ]
HumanEval_129_minPath
cpp
#include<assert.h> #include<bits/stdc++.h> // 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 gr...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_129_minPath.py
verbatim
} int main() { auto candidate = minPath; assert(candidate((std::vector<std::vector<long>>({(std::vector<long>)std::vector<long>({(long)1, (long)2, (long)3}), (std::vector<long>)std::vector<long>({(long)4, (long)5, (long)6}), (std::vector<long>)std::vector<long>({(long)7, (long)8, (long)9})})), (3)) == (std::vec...
[ "\n}" ]
HumanEval_12_longest
cpp
#include<assert.h> #include<bits/stdc++.h> // 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. std::optional<std::string> longest(std::vector<std::string> strings) {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_12_longest.py
verbatim
} int main() { auto candidate = longest; assert(candidate((std::vector<std::string>())) == std::nullopt); assert(candidate((std::vector<std::string>({(std::string)"x", (std::string)"y", (std::string)"z"}))) == "x"); assert(candidate((std::vector<std::string>({(std::string)"x", (std::string)"yyy", (std::...
[ "\n}" ]
HumanEval_130_tri
cpp
#include<assert.h> #include<bits/stdc++.h> // 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. // tr...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_130_tri.py
verbatim
} int main() { auto candidate = tri; assert(candidate((3)) == (std::vector<long>({(long)1, (long)3, (long)2, (long)8}))); assert(candidate((4)) == (std::vector<long>({(long)1, (long)3, (long)2, (long)8, (long)3}))); assert(candidate((5)) == (std::vector<long>({(long)1, (long)3, (long)2, (long)8, (long)3...
[ "\n}" ]
HumanEval_131_digits
cpp
#include<assert.h> #include<bits/stdc++.h> // Given a positive integer n, return the product of the odd digits. // Return 0 if all digits are even. // For example: long digits(long n) {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_131_digits.py
verbatim
} int main() { auto candidate = digits; assert(candidate((5)) == (5)); assert(candidate((54)) == (5)); assert(candidate((120)) == (1)); assert(candidate((5014)) == (5)); assert(candidate((98765)) == (315)); assert(candidate((5576543)) == (2625)); assert(candidate((2468)) == (0)); }
[ "\n}" ]
HumanEval_132_is_nested
cpp
#include<assert.h> #include<bits/stdc++.h> // 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. bool is_nested(std::string string) {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_132_is_nested.py
verbatim
} int main() { auto candidate = is_nested; assert(candidate(("[[]]")) == (true)); assert(candidate(("[]]]]]]][[[[[]")) == (false)); assert(candidate(("[][]")) == (false)); assert(candidate(("[]")) == (false)); assert(candidate(("[[[[]]]]")) == (true)); assert(candidate(("[]]]]]]]]]]")) == (f...
[ "\n}" ]
HumanEval_133_sum_squares
cpp
#include<assert.h> #include<bits/stdc++.h> // 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: long sum_squares(std::vector<float> lst) {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_133_sum_squares.py
verbatim
} int main() { auto candidate = sum_squares; assert(candidate((std::vector<float>({(float)1.0f, (float)2.0f, (float)3.0f}))) == (14)); assert(candidate((std::vector<float>({(float)1.0f, (float)2.0f, (float)3.0f}))) == (14)); assert(candidate((std::vector<float>({(float)1.0f, (float)3.0f, (float)5.0f, (f...
[ "\n}" ]
HumanEval_134_check_if_last_char_is_a_letter
cpp
#include<assert.h> #include<bits/stdc++.h> // 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: bool check_if_last_char_is_a_letter(std...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_134_check_if_last_char_is_a_letter.py
verbatim
} int main() { auto 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(...
[ "\n}" ]