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_20_find_closest_elements
rs
/// From a supplied list of numbers (of length at least two) select and return two that are the closest to each /// other and return them in order (smaller number, larger number). fn find_closest_elements(numbers: Vec<f64>) -> (f64, f64) {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_20_find_closest_elements.py
verbatim
} fn main() { let candidate = find_closest_elements; assert_eq!(candidate(vec![1.0, 2.0, 3.9, 4.0, 5.0, 2.2]), (3.9, 4.0)); assert_eq!(candidate(vec![1.0, 2.0, 5.9, 4.0, 5.0]), (5.0, 5.9)); assert_eq!(candidate(vec![1.0, 2.0, 3.0, 4.0, 5.0, 2.2]), (2.0, 2.2)); assert_eq!(candidate(vec![1.0, 2.0, 3....
[ "\n}" ]
HumanEval_21_rescale_to_unit
rs
/// Given list of numbers (of at least two elements), apply a linear transform to that list, /// such that the smallest number will become 0 and the largest will become 1 fn rescale_to_unit(numbers: Vec<f64>) -> Vec<f64> {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_21_rescale_to_unit.py
verbatim
} fn main() { let candidate = rescale_to_unit; assert_eq!(candidate(vec![2.0, 49.9]), vec![0.0, 1.0]); assert_eq!(candidate(vec![100.0, 49.9]), vec![1.0, 0.0]); assert_eq!(candidate(vec![1.0, 2.0, 3.0, 4.0, 5.0]), vec![0.0, 0.25, 0.5, 0.75, 1.0]); assert_eq!(candidate(vec![2.0, 1.0, 5.0, 3.0, 4.0])...
[ "\n}" ]
HumanEval_23_strlen
rs
/// Return length of given string fn strlen(string: String) -> isize {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_23_strlen.py
verbatim
} fn main() { let candidate = strlen; assert_eq!(candidate(String::from("")), 0); assert_eq!(candidate(String::from("x")), 1); assert_eq!(candidate(String::from("asdasnakj")), 9); }
[ "\n}" ]
HumanEval_24_largest_divisor
rs
/// For a given number n, find the largest number that divides n evenly, smaller than n fn largest_divisor(n: isize) -> isize {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_24_largest_divisor.py
verbatim
} fn main() { let candidate = largest_divisor; assert_eq!(candidate(3), 1); assert_eq!(candidate(7), 1); assert_eq!(candidate(10), 5); assert_eq!(candidate(100), 50); assert_eq!(candidate(49), 7); }
[ "\n}" ]
HumanEval_25_factorize
rs
/// Return list of prime factors of given integer in the order from smallest to largest. /// Each of the factors should be listed number of times corresponding to how many times it appeares in factorization. /// Input number should be equal to the product of all factors fn factorize(n: isize) -> Vec<isize> {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_25_factorize.py
verbatim
} fn main() { let candidate = factorize; assert_eq!(candidate(2), vec![2]); assert_eq!(candidate(4), vec![2, 2]); assert_eq!(candidate(8), vec![2, 2, 2]); assert_eq!(candidate(57), vec![3, 19]); assert_eq!(candidate(3249), vec![3, 3, 19, 19]); assert_eq!(candidate(185193), vec![3, 3, 3, 19,...
[ "\n}" ]
HumanEval_26_remove_duplicates
rs
/// From a list of integers, remove all elements that occur more than once. /// Keep order of elements left the same as in the input. fn remove_duplicates(numbers: Vec<isize>) -> Vec<isize> {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_26_remove_duplicates.py
verbatim
} fn main() { let candidate = remove_duplicates; assert_eq!(candidate(Vec::<isize>::new()), Vec::<isize>::new()); assert_eq!(candidate(vec![1, 2, 3, 4]), vec![1, 2, 3, 4]); assert_eq!(candidate(vec![1, 2, 3, 2, 4, 3, 5]), vec![1, 4, 5]); }
[ "\n}" ]
HumanEval_27_flip_case
rs
/// For a given string, flip lowercase characters to uppercase and uppercase to lowercase. fn flip_case(string: String) -> String {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_27_flip_case.py
verbatim
} fn main() { let candidate = flip_case; assert_eq!(candidate(String::from("")), String::from("")); assert_eq!(candidate(String::from("Hello!")), String::from("hELLO!")); assert_eq!(candidate(String::from("These violent delights have violent ends")), String::from("tHESE VIOLENT DELIGHTS HAVE VIOLENT EN...
[ "\n}" ]
HumanEval_28_concatenate
rs
/// Concatenate list of strings into a single string fn concatenate(strings: Vec<String>) -> String {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_28_concatenate.py
verbatim
} fn main() { let candidate = concatenate; assert_eq!(candidate(Vec::<String>::new()), String::from("")); assert_eq!(candidate(vec![String::from("x"), String::from("y"), String::from("z")]), String::from("xyz")); assert_eq!(candidate(vec![String::from("x"), String::from("y"), String::from("z"), String:...
[ "\n}" ]
HumanEval_29_filter_by_prefix
rs
/// Filter an input list of strings only for ones that start with a given prefix. fn filter_by_prefix(strings: Vec<String>, prefix: String) -> Vec<String> {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_29_filter_by_prefix.py
verbatim
} fn main() { let candidate = filter_by_prefix; assert_eq!(candidate(Vec::<String>::new(), String::from("john")), Vec::<String>::new()); assert_eq!(candidate(vec![String::from("xxx"), String::from("asd"), String::from("xxy"), String::from("john doe"), String::from("xxxAAA"), String::from("xxx")], String::f...
[ "\n}" ]
HumanEval_2_truncate_number
rs
/// 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. fn truncate_number(number: f64) -> f64 {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_2_truncate_number.py
verbatim
} fn main() { let candidate = truncate_number; assert_eq!(candidate(3.5), 0.5); assert_eq!(candidate(1.25), 0.25); assert_eq!(candidate(123.0), 0.0); }
[ "\n}" ]
HumanEval_30_get_positive
rs
/// Return only positive numbers in the list. fn get_positive(l: Vec<isize>) -> Vec<isize> {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_30_get_positive.py
verbatim
} fn main() { let candidate = get_positive; assert_eq!(candidate(vec![-1, -2, 4, 5, 6]), vec![4, 5, 6]); assert_eq!(candidate(vec![5, 3, -5, 2, 3, 3, 9, 0, 123, 1, -10]), vec![5, 3, 2, 3, 3, 9, 123, 1]); assert_eq!(candidate(vec![-1, -2]), Vec::<isize>::new()); assert_eq!(candidate(Vec::<isize>::ne...
[ "\n}" ]
HumanEval_31_is_prime
rs
/// Return true if a given number is prime, and false otherwise. fn is_prime(n: isize) -> bool {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_31_is_prime.py
verbatim
} fn main() { let candidate = is_prime; assert_eq!(candidate(6), false); assert_eq!(candidate(101), true); assert_eq!(candidate(11), true); assert_eq!(candidate(13441), true); assert_eq!(candidate(61), true); assert_eq!(candidate(4), false); assert_eq!(candidate(1), false); assert_e...
[ "\n}" ]
HumanEval_33_sort_third
rs
/// This function takes a list l and returns a list l' such that /// l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal /// to the values of the corresponding indicies of l, but sorted. fn sort_third(l: Vec<isize>) -> Vec<isize> {...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_33_sort_third.py
verbatim
} fn main() { let candidate = sort_third; assert_eq!(candidate(vec![5, 6, 3, 4, 8, 9, 2]), vec![2, 6, 3, 4, 8, 9, 5]); assert_eq!(candidate(vec![5, 8, 3, 4, 6, 9, 2]), vec![2, 8, 3, 4, 6, 9, 5]); assert_eq!(candidate(vec![5, 6, 9, 4, 8, 3, 2]), vec![2, 6, 9, 4, 8, 3, 5]); assert_eq!(candidate(vec![...
[ "\n}" ]
HumanEval_34_unique
rs
/// Return sorted unique elements in a list fn unique(l: Vec<isize>) -> Vec<isize> {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_34_unique.py
verbatim
} fn main() { let candidate = unique; assert_eq!(candidate(vec![5, 3, 5, 2, 3, 3, 9, 0, 123]), vec![0, 2, 3, 5, 9, 123]); }
[ "\n}" ]
HumanEval_35_max_element
rs
/// Return maximum element in the list. fn max_element(l: Vec<isize>) -> isize {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_35_max_element.py
verbatim
} fn main() { let candidate = max_element; assert_eq!(candidate(vec![1, 2, 3]), 3); assert_eq!(candidate(vec![5, 3, -5, 2, -3, 3, 9, 0, 124, 1, -10]), 124); }
[ "\n}" ]
HumanEval_36_fizz_buzz
rs
/// Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13. fn fizz_buzz(n: isize) -> isize {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_36_fizz_buzz.py
verbatim
} fn main() { let candidate = fizz_buzz; assert_eq!(candidate(50), 0); assert_eq!(candidate(78), 2); assert_eq!(candidate(79), 3); assert_eq!(candidate(100), 3); assert_eq!(candidate(200), 6); assert_eq!(candidate(4000), 192); assert_eq!(candidate(10000), 639); assert_eq!(candidate(...
[ "\n}" ]
HumanEval_37_sort_even
rs
/// This function takes a list l and returns a list l' such that /// l' is identical to l in the odd indicies, while its values at the even indicies are equal /// to the values of the even indicies of l, but sorted. fn sort_even(l: Vec<isize>) -> Vec<isize> {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_37_sort_even.py
verbatim
} fn main() { let candidate = sort_even; assert_eq!(candidate(vec![1, 2, 3]), vec![1, 2, 3]); assert_eq!(candidate(vec![5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]), vec![-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123]); assert_eq!(candidate(vec![5, 8, -12, 4, 23, 2, 3, 11, 12, -10]), vec![-12, 8, 3, 4, 5, 2, 12, 11...
[ "\n}" ]
HumanEval_39_prime_fib
rs
/// prime_fib returns n-th number that is a Fibonacci number and it's also prime. fn prime_fib(n: isize) -> isize {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_39_prime_fib.py
verbatim
} fn main() { let candidate = prime_fib; assert_eq!(candidate(1), 2); assert_eq!(candidate(2), 3); assert_eq!(candidate(3), 5); assert_eq!(candidate(4), 13); assert_eq!(candidate(5), 89); assert_eq!(candidate(6), 233); assert_eq!(candidate(7), 1597); assert_eq!(candidate(8), 28657);...
[ "\n}" ]
HumanEval_3_below_zero
rs
/// You're given a list of deposit and withdrawal operations on a bank account that starts with /// zero balance. Your task is to detect if at any point the balance of account fallls below zero, and /// at that point function should return True. Otherwise it should return False. fn below_zero(operations: Vec<isize>) ->...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_3_below_zero.py
verbatim
} fn main() { let candidate = below_zero; assert_eq!(candidate(Vec::<isize>::new()), false); assert_eq!(candidate(vec![1, 2, -3, 1, 2, -3]), false); assert_eq!(candidate(vec![1, 2, -4, 5, 6]), true); assert_eq!(candidate(vec![1, -1, 2, -2, 5, -5, 4, -4]), false); assert_eq!(candidate(vec![1, -1...
[ "\n}" ]
HumanEval_40_triples_sum_to_zero
rs
/// triples_sum_to_zero takes a list of integers as an input. /// it returns True if there are three distinct elements in the list that /// sum to zero, and False otherwise. fn triples_sum_to_zero(l: Vec<isize>) -> bool {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_40_triples_sum_to_zero.py
verbatim
} fn main() { let candidate = triples_sum_to_zero; assert_eq!(candidate(vec![1, 3, 5, 0]), false); assert_eq!(candidate(vec![1, 3, 5, -1]), false); assert_eq!(candidate(vec![1, 3, -2, 1]), true); assert_eq!(candidate(vec![1, 2, 3, 7]), false); assert_eq!(candidate(vec![1, 2, 5, 7]), false); ...
[ "\n}" ]
HumanEval_42_incr_list
rs
/// Return list with elements incremented by 1. fn incr_list(l: Vec<isize>) -> Vec<isize> {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_42_incr_list.py
verbatim
} fn main() { let candidate = incr_list; assert_eq!(candidate(Vec::<isize>::new()), Vec::<isize>::new()); assert_eq!(candidate(vec![3, 2, 1]), vec![4, 3, 2]); assert_eq!(candidate(vec![5, 2, 5, 2, 3, 3, 9, 0, 123]), vec![6, 3, 6, 3, 4, 4, 10, 1, 124]); }
[ "\n}" ]
HumanEval_43_pairs_sum_to_zero
rs
/// pairs_sum_to_zero takes a list of integers as an input. /// it returns True if there are two distinct elements in the list that /// sum to zero, and False otherwise. fn pairs_sum_to_zero(l: Vec<isize>) -> bool {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_43_pairs_sum_to_zero.py
verbatim
} fn main() { let candidate = pairs_sum_to_zero; assert_eq!(candidate(vec![1, 3, 5, 0]), false); assert_eq!(candidate(vec![1, 3, -2, 1]), false); assert_eq!(candidate(vec![1, 2, 3, 7]), false); assert_eq!(candidate(vec![2, 4, -5, 3, 5, 7]), true); assert_eq!(candidate(vec![1]), false); asse...
[ "\n}" ]
HumanEval_44_change_base
rs
/// Change numerical base of input number x to base. /// return string representation after the conversion. /// base numbers are less than 10. fn change_base(x: isize, base: isize) -> String {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_44_change_base.py
verbatim
} fn main() { let candidate = change_base; assert_eq!(candidate(8, 3), String::from("22")); assert_eq!(candidate(9, 3), String::from("100")); assert_eq!(candidate(234, 2), String::from("11101010")); assert_eq!(candidate(16, 2), String::from("10000")); assert_eq!(candidate(8, 2), String::from("1...
[ "\n}" ]
HumanEval_45_triangle_area
rs
/// Given length of a side and high return area for a triangle. fn triangle_area(a: isize, h: isize) -> f64 {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_45_triangle_area.py
verbatim
} fn main() { let candidate = triangle_area; assert_eq!(candidate(5, 3), 7.5); assert_eq!(candidate(2, 2), 2.0); assert_eq!(candidate(10, 8), 40.0); }
[ "\n}" ]
HumanEval_46_fib4
rs
/// The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows: /// fib4(0) -> 0 /// fib4(1) -> 0 /// fib4(2) -> 2 /// fib4(3) -> 0 /// fib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4). /// Please write a function to efficiently compute the n-th element of the fib4 numbe...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_46_fib4.py
verbatim
} fn main() { let candidate = fib4; assert_eq!(candidate(5), 4); assert_eq!(candidate(8), 28); assert_eq!(candidate(10), 104); assert_eq!(candidate(12), 386); }
[ "\n}" ]
HumanEval_47_median
rs
/// Return median of elements in the list l. fn median(l: Vec<isize>) -> f64 {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_47_median.py
verbatim
} fn main() { let candidate = median; assert_eq!(candidate(vec![3, 1, 2, 4, 5]), 3.0); assert_eq!(candidate(vec![-10, 4, 6, 1000, 10, 20]), 8.0); assert_eq!(candidate(vec![5]), 5.0); assert_eq!(candidate(vec![6, 5]), 5.5); assert_eq!(candidate(vec![8, 1, 3, 9, 9, 2, 7]), 7.0); }
[ "\n}" ]
HumanEval_48_is_palindrome
rs
/// Checks if given string is a palindrome fn is_palindrome(text: String) -> bool {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_48_is_palindrome.py
verbatim
} fn main() { let candidate = is_palindrome; assert_eq!(candidate(String::from("")), true); assert_eq!(candidate(String::from("aba")), true); assert_eq!(candidate(String::from("aaaaa")), true); assert_eq!(candidate(String::from("zbcd")), false); assert_eq!(candidate(String::from("xywyx")), true...
[ "\n}" ]
HumanEval_49_modp
rs
/// Return 2^n modulo p (be aware of numerics). fn modp(n: isize, p: isize) -> isize {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_49_modp.py
verbatim
} fn main() { let candidate = modp; assert_eq!(candidate(3, 5), 3); assert_eq!(candidate(1101, 101), 2); assert_eq!(candidate(0, 101), 1); assert_eq!(candidate(3, 11), 8); assert_eq!(candidate(100, 101), 1); assert_eq!(candidate(30, 5), 4); assert_eq!(candidate(31, 5), 3); }
[ "\n}" ]
HumanEval_4_mean_absolute_deviation
rs
/// 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 | fn mean_absolute_deviation(numbers: Vec<f64>) -> f...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_4_mean_absolute_deviation.py
verbatim
} fn main() { let candidate = mean_absolute_deviation; assert_eq!(candidate(vec![1.0, 2.0]), 0.5); assert_eq!(candidate(vec![1.0, 2.0, 3.0, 4.0]), 1.0); assert_eq!(candidate(vec![1.0, 2.0, 3.0, 4.0, 5.0]), 1.2); }
[ "\n}" ]
HumanEval_51_remove_vowels
rs
/// remove_vowels is a function that takes string and returns string without vowels. fn remove_vowels(text: String) -> String {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_51_remove_vowels.py
verbatim
} fn main() { let candidate = remove_vowels; assert_eq!(candidate(String::from("")), String::from("")); assert_eq!(candidate(String::from("abcdef ghijklm")), String::from("bcdf ghjklm")); assert_eq!(candidate(String::from("fedcba")), String::from("fdcb")); assert_eq!(candidate(String::from("eeeee")...
[ "\n}" ]
HumanEval_52_below_threshold
rs
/// Return True if all numbers in the list l are below threshold t. fn below_threshold(l: Vec<isize>, t: isize) -> bool {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_52_below_threshold.py
verbatim
} fn main() { let candidate = below_threshold; assert_eq!(candidate(vec![1, 2, 4, 10], 100), true); assert_eq!(candidate(vec![1, 20, 4, 10], 5), false); assert_eq!(candidate(vec![1, 20, 4, 10], 21), true); assert_eq!(candidate(vec![1, 20, 4, 10], 22), true); assert_eq!(candidate(vec![1, 8, 4, 1...
[ "\n}" ]
HumanEval_53_add
rs
/// Add two numbers x and y fn add(x: isize, y: isize) -> isize {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_53_add.py
verbatim
} fn main() { let candidate = add; assert_eq!(candidate(0, 1), 1); assert_eq!(candidate(1, 0), 1); assert_eq!(candidate(2, 3), 5); assert_eq!(candidate(5, 7), 12); assert_eq!(candidate(7, 5), 12); }
[ "\n}" ]
HumanEval_54_same_chars
rs
/// Check if two words have the same characters. fn same_chars(s0: String, s1: String) -> bool {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_54_same_chars.py
verbatim
} fn main() { let candidate = same_chars; assert_eq!(candidate(String::from("eabcdzzzz"), String::from("dddzzzzzzzddeddabc")), true); assert_eq!(candidate(String::from("abcd"), String::from("dddddddabc")), true); assert_eq!(candidate(String::from("dddddddabc"), String::from("abcd")), true); assert_...
[ "\n}" ]
HumanEval_55_fib
rs
/// Return n-th Fibonacci number. fn fib(n: isize) -> isize {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_55_fib.py
verbatim
} fn main() { let candidate = fib; assert_eq!(candidate(10), 55); assert_eq!(candidate(1), 1); assert_eq!(candidate(8), 21); assert_eq!(candidate(11), 89); assert_eq!(candidate(12), 144); }
[ "\n}" ]
HumanEval_56_correct_bracketing
rs
/// brackets is a string of "<" and ">". /// return True if every opening bracket has a corresponding closing bracket. fn correct_bracketing(brackets: String) -> bool {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_56_correct_bracketing.py
verbatim
} fn main() { let candidate = correct_bracketing; assert_eq!(candidate(String::from("<>")), true); assert_eq!(candidate(String::from("<<><>>")), true); assert_eq!(candidate(String::from("<><><<><>><>")), true); assert_eq!(candidate(String::from("<><><<<><><>><>><<><><<>>>")), true); assert_eq!(...
[ "\n}" ]
HumanEval_57_monotonic
rs
/// Return True is list elements are monotonically increasing or decreasing. fn monotonic(l: Vec<isize>) -> bool {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_57_monotonic.py
verbatim
} fn main() { let candidate = monotonic; assert_eq!(candidate(vec![1, 2, 4, 10]), true); assert_eq!(candidate(vec![1, 2, 4, 20]), true); assert_eq!(candidate(vec![1, 20, 4, 10]), false); assert_eq!(candidate(vec![4, 1, 0, -10]), true); assert_eq!(candidate(vec![4, 1, 1, 0]), true); assert_e...
[ "\n}" ]
HumanEval_58_common
rs
/// Return sorted unique common elements for two lists. fn common(l1: Vec<isize>, l2: Vec<isize>) -> Vec<isize> {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_58_common.py
verbatim
} fn main() { let candidate = common; assert_eq!(candidate(vec![1, 4, 3, 34, 653, 2, 5], vec![5, 7, 1, 5, 9, 653, 121]), vec![1, 5, 653]); assert_eq!(candidate(vec![5, 3, 2, 8], vec![3, 2]), vec![2, 3]); assert_eq!(candidate(vec![4, 3, 2, 8], vec![3, 2, 4]), vec![2, 3, 4]); assert_eq!(candidate(vec...
[ "\n}" ]
HumanEval_59_largest_prime_factor
rs
/// Return the largest prime factor of n. Assume n > 1 and is not a prime. fn largest_prime_factor(n: isize) -> isize {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_59_largest_prime_factor.py
verbatim
} fn main() { let candidate = largest_prime_factor; assert_eq!(candidate(15), 5); assert_eq!(candidate(27), 3); assert_eq!(candidate(63), 7); assert_eq!(candidate(330), 11); assert_eq!(candidate(13195), 29); }
[ "\n}" ]
HumanEval_5_intersperse
rs
/// Insert a number 'delimeter' between every two consecutive elements of input list `numbers' fn intersperse(numbers: Vec<isize>, delimeter: isize) -> Vec<isize> {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_5_intersperse.py
verbatim
} fn main() { let candidate = intersperse; assert_eq!(candidate(Vec::<isize>::new(), 7), Vec::<isize>::new()); assert_eq!(candidate(vec![5, 6, 3, 2], 8), vec![5, 8, 6, 8, 3, 8, 2]); assert_eq!(candidate(vec![2, 2, 2], 2), vec![2, 2, 2, 2, 2]); }
[ "\n}" ]
HumanEval_60_sum_to_n
rs
/// sum_to_n is a function that sums numbers from 1 to n. fn sum_to_n(n: isize) -> isize {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_60_sum_to_n.py
verbatim
} fn main() { let candidate = sum_to_n; assert_eq!(candidate(1), 1); assert_eq!(candidate(6), 21); assert_eq!(candidate(11), 66); assert_eq!(candidate(30), 465); assert_eq!(candidate(100), 5050); }
[ "\n}" ]
HumanEval_61_correct_bracketing
rs
/// brackets is a string of "(" and ")". /// return True if every opening bracket has a corresponding closing bracket. fn correct_bracketing(brackets: String) -> bool {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_61_correct_bracketing.py
verbatim
} fn main() { let candidate = correct_bracketing; assert_eq!(candidate(String::from("()")), true); assert_eq!(candidate(String::from("(()())")), true); assert_eq!(candidate(String::from("()()(()())()")), true); assert_eq!(candidate(String::from("()()((()()())())(()()(()))")), true); assert_eq!(...
[ "\n}" ]
HumanEval_62_derivative
rs
/// xs represent coefficients of a polynomial. /// xs[0] + xs[1] * x + xs[2] * x^2 + .... /// Return derivative of this polynomial in the same form. fn derivative(xs: Vec<isize>) -> Vec<isize> {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_62_derivative.py
verbatim
} fn main() { let candidate = derivative; assert_eq!(candidate(vec![3, 1, 2, 4, 5]), vec![1, 4, 12, 20]); assert_eq!(candidate(vec![1, 2, 3]), vec![2, 6]); assert_eq!(candidate(vec![3, 2, 1]), vec![2, 2]); assert_eq!(candidate(vec![3, 2, 1, 0, 4]), vec![2, 2, 0, 16]); assert_eq!(candidate(vec![...
[ "\n}" ]
HumanEval_63_fibfib
rs
/// The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows: /// fibfib(0) == 0 /// fibfib(1) == 0 /// fibfib(2) == 1 /// fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3). /// Please write a function to efficiently compute the n-th element of the fibfib number sequence....
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_63_fibfib.py
verbatim
} fn main() { let candidate = fibfib; assert_eq!(candidate(2), 1); assert_eq!(candidate(1), 0); assert_eq!(candidate(5), 4); assert_eq!(candidate(8), 24); assert_eq!(candidate(10), 81); assert_eq!(candidate(12), 274); assert_eq!(candidate(14), 927); }
[ "\n}" ]
HumanEval_64_vowels_count
rs
/// 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: fn vowels_count(s: String) -> isize {...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_64_vowels_count.py
verbatim
} fn main() { let candidate = vowels_count; assert_eq!(candidate(String::from("abcde")), 2); assert_eq!(candidate(String::from("Alone")), 3); assert_eq!(candidate(String::from("key")), 2); assert_eq!(candidate(String::from("bye")), 1); assert_eq!(candidate(String::from("keY")), 2); assert_e...
[ "\n}" ]
HumanEval_65_circular_shift
rs
/// 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. fn circular_shift(x: isize, shift: isize) -> String {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_65_circular_shift.py
verbatim
} fn main() { let candidate = circular_shift; assert_eq!(candidate(100, 2), String::from("001")); assert_eq!(candidate(12, 2), String::from("12")); assert_eq!(candidate(97, 8), String::from("79")); assert_eq!(candidate(12, 1), String::from("21")); assert_eq!(candidate(11, 101), String::from("11...
[ "\n}" ]
HumanEval_66_digitSum
rs
/// Task /// Write a function that takes a string as input and returns the sum of the upper characters only' /// ASCII codes. /// Examples: fn digitSum(s: String) -> isize {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_66_digitSum.py
verbatim
} fn main() { let candidate = digitSum; assert_eq!(candidate(String::from("")), 0); assert_eq!(candidate(String::from("abAB")), 131); assert_eq!(candidate(String::from("abcCd")), 67); assert_eq!(candidate(String::from("helloE")), 69); assert_eq!(candidate(String::from("woArBld")), 131); ass...
[ "\n}" ]
HumanEval_67_fruit_distribution
rs
/// In this task, you will be given a string that represents a number of apples and oranges /// that are distributed in a basket of fruit this basket contains /// apples, oranges, and mango fruits. Given the string that represents the total number of /// the oranges and apples and an integer that represent the total...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_67_fruit_distribution.py
verbatim
} fn main() { let candidate = fruit_distribution; assert_eq!(candidate(String::from("5 apples and 6 oranges"), 19), 8); assert_eq!(candidate(String::from("5 apples and 6 oranges"), 21), 10); assert_eq!(candidate(String::from("0 apples and 1 oranges"), 3), 2); assert_eq!(candidate(String::from("1 ap...
[ "\n}" ]
HumanEval_68_pluck
rs
/// "Given an array representing a branch of a tree that has non-negative integer nodes /// your task is to pluck one of the nodes and return it. /// The plucked node should be the node with the smallest even value. /// If multiple nodes with the same smallest even value are found return the node that has smallest inde...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_68_pluck.py
verbatim
} fn main() { let candidate = pluck; assert_eq!(candidate(vec![4, 2, 3]), vec![2, 1]); assert_eq!(candidate(vec![1, 2, 3]), vec![2, 1]); assert_eq!(candidate(Vec::<isize>::new()), Vec::<isize>::new()); assert_eq!(candidate(vec![5, 0, 3, 0, 4, 2]), vec![0, 1]); assert_eq!(candidate(vec![1, 2, 3,...
[ "\n}" ]
HumanEval_69_search
rs
/// You are given a non-empty list of positive integers. Return the greatest integer that is greater than /// zero, and has a frequency greater than or equal to the value of the integer itself. /// The frequency of an integer is the number of times it appears in the list. /// If no such a value exist, return -1. /// ...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_69_search.py
verbatim
} fn main() { let candidate = search; assert_eq!(candidate(vec![5, 5, 5, 5, 1]), 1); assert_eq!(candidate(vec![4, 1, 4, 1, 4, 4]), 4); assert_eq!(candidate(vec![3, 3]), -1); assert_eq!(candidate(vec![8, 8, 8, 8, 8, 8, 8, 8]), 8); assert_eq!(candidate(vec![2, 3, 3, 2, 2]), 2); assert_eq!(can...
[ "\n}" ]
HumanEval_6_parse_nested_parens
rs
/// 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. fn parse_nested_parens(paren_string: String) -> Vec<isiz...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_6_parse_nested_parens.py
verbatim
} fn main() { let candidate = parse_nested_parens; assert_eq!(candidate(String::from("(()()) ((())) () ((())()())")), vec![2, 3, 1, 3]); assert_eq!(candidate(String::from("() (()) ((())) (((())))")), vec![1, 2, 3, 4]); assert_eq!(candidate(String::from("(()(())((())))")), vec![4]); }
[ "\n}" ]
HumanEval_70_strange_sort_list
rs
/// 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: fn strange_sort_list(lst: Vec<isize>) -> Vec<isize> {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_70_strange_sort_list.py
verbatim
} fn main() { let candidate = strange_sort_list; assert_eq!(candidate(vec![1, 2, 3, 4]), vec![1, 4, 2, 3]); assert_eq!(candidate(vec![5, 6, 7, 8, 9]), vec![5, 9, 6, 8, 7]); assert_eq!(candidate(vec![1, 2, 3, 4, 5]), vec![1, 5, 2, 4, 3]); assert_eq!(candidate(vec![5, 6, 7, 8, 9, 1]), vec![1, 9, 5, 8...
[ "\n}" ]
HumanEval_71_triangle_area
rs
/// Given the lengths of the three sides of a triangle. Return the area of /// the triangle rounded to 2 decimal points if the three sides form a valid triangle. /// Otherwise return -1 /// Three sides make a valid triangle when the sum of any two sides is greater /// than the third side. /// Example: fn triangle_are...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_71_triangle_area.py
verbatim
} fn main() { let candidate = triangle_area; assert_eq!(candidate(3, 4, 5), 6.0); assert_eq!(candidate(1, 2, 10), -1.0); assert_eq!(candidate(4, 8, 5), 8.18); assert_eq!(candidate(2, 2, 2), 1.73); assert_eq!(candidate(1, 2, 3), -1.0); assert_eq!(candidate(10, 5, 7), 16.25); assert_eq!(c...
[ "\n}" ]
HumanEval_72_will_it_fly
rs
/// Write a function that returns True if the object q will fly, and False otherwise. /// The object q will fly if it's balanced (it is a palindromic list) and the sum of its elements is less than or equal the maximum possible weight w. /// Example: /// # 1+2 is less than the maximum possible weight, but it's unbalance...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_72_will_it_fly.py
verbatim
} fn main() { let candidate = will_it_fly; assert_eq!(candidate(vec![3, 2, 3], 9), true); assert_eq!(candidate(vec![1, 2], 5), false); assert_eq!(candidate(vec![3], 5), true); assert_eq!(candidate(vec![3, 2, 3], 1), false); assert_eq!(candidate(vec![1, 2, 3], 6), false); assert_eq!(candidat...
[ "\n}" ]
HumanEval_73_smallest_change
rs
/// Given an array arr of integers, find the minimum number of elements that /// need to be changed to make the array palindromic. A palindromic array is an array that /// is read the same backwards and forwards. In one change, you can change one element to any other element. /// For example: fn smallest_change(arr: Ve...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_73_smallest_change.py
verbatim
} fn main() { let candidate = smallest_change; assert_eq!(candidate(vec![1, 2, 3, 5, 4, 7, 9, 6]), 4); assert_eq!(candidate(vec![1, 2, 3, 4, 3, 2, 2]), 1); assert_eq!(candidate(vec![1, 4, 2]), 1); assert_eq!(candidate(vec![1, 4, 4, 2]), 1); assert_eq!(candidate(vec![1, 2, 3, 2, 1]), 0); ass...
[ "\n}" ]
HumanEval_74_total_match
rs
/// 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 fn total_match(lst1: Vec<String>, lst2: Vec<String>) -> Vec<Str...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_74_total_match.py
verbatim
} fn main() { let candidate = total_match; assert_eq!(candidate(Vec::<String>::new(), Vec::<String>::new()), Vec::<String>::new()); assert_eq!(candidate(vec![String::from("hi"), String::from("admin")], vec![String::from("hi"), String::from("hi")]), vec![String::from("hi"), String::from("hi")]); assert_...
[ "\n}" ]
HumanEval_75_is_multiply_prime
rs
/// Write a function that returns true if the given number is the multiplication of 3 prime numbers /// and false otherwise. /// Knowing that (a) is less then 100. /// Example: /// 30 = 2 * 3 * 5 fn is_multiply_prime(a: isize) -> bool {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_75_is_multiply_prime.py
verbatim
} fn main() { let candidate = is_multiply_prime; assert_eq!(candidate(5), false); assert_eq!(candidate(30), true); assert_eq!(candidate(8), true); assert_eq!(candidate(10), false); assert_eq!(candidate(125), true); assert_eq!(candidate(105), true); assert_eq!(candidate(126), false); ...
[ "\n}" ]
HumanEval_76_is_simple_power
rs
/// 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: fn is_simple_power(x: isize, n: isize) -> bool {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_76_is_simple_power.py
verbatim
} fn main() { let candidate = is_simple_power; assert_eq!(candidate(16, 2), true); assert_eq!(candidate(143214, 16), false); assert_eq!(candidate(4, 2), true); assert_eq!(candidate(9, 3), true); assert_eq!(candidate(16, 4), true); assert_eq!(candidate(24, 2), false); assert_eq!(candidat...
[ "\n}" ]
HumanEval_77_iscube
rs
/// 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: fn iscube(a: isize) -> bool {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_77_iscube.py
verbatim
} fn main() { let candidate = iscube; assert_eq!(candidate(1), true); assert_eq!(candidate(2), false); assert_eq!(candidate(-1), true); assert_eq!(candidate(64), true); assert_eq!(candidate(180), false); assert_eq!(candidate(1000), true); assert_eq!(candidate(0), true); assert_eq!(c...
[ "\n}" ]
HumanEval_78_hex_key
rs
/// You have been tasked to write a function that receives /// a hexadecimal number as a string and counts the number of hexadecimal /// digits that are primes (prime number, or a prime, is a natural number /// greater than 1 that is not a product of two smaller natural numbers). /// Hexadecimal digits are 0, 1, 2, ...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_78_hex_key.py
verbatim
} fn main() { let candidate = hex_key; assert_eq!(candidate(String::from("AB")), 1); assert_eq!(candidate(String::from("1077E")), 2); assert_eq!(candidate(String::from("ABED1A33")), 4); assert_eq!(candidate(String::from("2020")), 2); assert_eq!(candidate(String::from("123456789ABCDEF0")), 6); ...
[ "\n}" ]
HumanEval_79_decimal_to_binary
rs
/// You will be given a number in decimal form and your task is to convert it to /// binary format. The function should return a string, with each character representing a binary /// number. Each character in the string will be '0' or '1'. /// There will be an extra couple of characters 'db' at the beginning and at the...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_79_decimal_to_binary.py
verbatim
} fn main() { let candidate = decimal_to_binary; assert_eq!(candidate(0), String::from("db0db")); assert_eq!(candidate(32), String::from("db100000db")); assert_eq!(candidate(103), String::from("db1100111db")); assert_eq!(candidate(15), String::from("db1111db")); }
[ "\n}" ]
HumanEval_7_filter_by_substring
rs
/// Filter an input list of strings only for ones that contain given substring fn filter_by_substring(strings: Vec<String>, substring: String) -> Vec<String> {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_7_filter_by_substring.py
verbatim
} fn main() { let candidate = filter_by_substring; assert_eq!(candidate(Vec::<String>::new(), String::from("john")), Vec::<String>::new()); assert_eq!(candidate(vec![String::from("xxx"), String::from("asd"), String::from("xxy"), String::from("john doe"), String::from("xxxAAA"), String::from("xxx")], String...
[ "\n}" ]
HumanEval_80_is_happy
rs
/// 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: fn is_happy(s: String) -> bool {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_80_is_happy.py
verbatim
} fn main() { let candidate = is_happy; assert_eq!(candidate(String::from("a")), false); assert_eq!(candidate(String::from("aa")), false); assert_eq!(candidate(String::from("abcd")), true); assert_eq!(candidate(String::from("aabb")), false); assert_eq!(candidate(String::from("adb")), true); ...
[ "\n}" ]
HumanEval_81_numerical_letter_grade
rs
/// It is the last week of the semester and the teacher has to give the grades /// to students. The teacher has been making her own algorithm for grading. /// The only problem is, she has lost the code she used for grading. /// She has given you a list of GPAs for some students and you have to write /// a function tha...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_81_numerical_letter_grade.py
verbatim
} fn main() { let candidate = numerical_letter_grade; assert_eq!(candidate(vec![4.0, 3.0, 1.7, 2.0, 3.5]), vec![String::from("A+"), String::from("B"), String::from("C-"), String::from("C"), String::from("A-")]); assert_eq!(candidate(vec![1.2]), vec![String::from("D+")]); assert_eq!(candidate(vec![0.5])...
[ "\n}" ]
HumanEval_82_prime_length
rs
/// Write a function that takes a string and returns True if the string /// length is a prime number or False otherwise /// Examples fn prime_length(string: String) -> bool {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_82_prime_length.py
verbatim
} fn main() { let candidate = prime_length; assert_eq!(candidate(String::from("Hello")), true); assert_eq!(candidate(String::from("abcdcba")), true); assert_eq!(candidate(String::from("kittens")), true); assert_eq!(candidate(String::from("orange")), false); assert_eq!(candidate(String::from("wo...
[ "\n}" ]
HumanEval_84_solve
rs
/// Given a positive integer N, return the total sum of its digits in binary. /// Example /// Variables: /// @N integer /// Constraints: 0 ≤ N ≤ 10000. /// Output: /// a string of binary number fn solve(N: isize) -> String {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_84_solve.py
verbatim
} fn main() { let candidate = solve; assert_eq!(candidate(1000), String::from("1")); assert_eq!(candidate(150), String::from("110")); assert_eq!(candidate(147), String::from("1100")); assert_eq!(candidate(333), String::from("1001")); assert_eq!(candidate(963), String::from("10010")); }
[ "\n}" ]
HumanEval_85_add
rs
/// Given a non-empty list of integers lst. add the even elements that are at odd indices.. /// Examples: fn add(lst: Vec<isize>) -> isize {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_85_add.py
verbatim
} fn main() { let candidate = add; assert_eq!(candidate(vec![4, 88]), 88); assert_eq!(candidate(vec![4, 5, 6, 7, 2, 122]), 122); assert_eq!(candidate(vec![4, 0, 6, 7]), 0); assert_eq!(candidate(vec![4, 4, 6, 8]), 12); }
[ "\n}" ]
HumanEval_86_anti_shuffle
rs
/// Write a function that takes a string and returns an ordered version of it. /// Ordered version of string, is a string where all words (separated by space) /// are replaced by a new word where all the characters arranged in /// ascending order based on ascii value. /// Note: You should keep the order of words and bl...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_86_anti_shuffle.py
verbatim
} fn main() { let candidate = anti_shuffle; assert_eq!(candidate(String::from("Hi")), String::from("Hi")); assert_eq!(candidate(String::from("hello")), String::from("ehllo")); assert_eq!(candidate(String::from("number")), String::from("bemnru")); assert_eq!(candidate(String::from("abcd")), String::...
[ "\n}" ]
HumanEval_87_get_row
rs
/// You are given a 2 dimensional data, as a nested lists, /// which is similar to matrix, however, unlike matrices, /// each row may contain a different number of columns. /// Given lst, and integer x, find integers x in the list, /// and return list of tuples, [(x1, y1), (x2, y2) ...] such that /// each tuple is a co...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_87_get_row.py
verbatim
} fn main() { let candidate = get_row; assert_eq!(candidate(vec![vec![1, 2, 3, 4, 5, 6], vec![1, 2, 3, 4, 1, 6], vec![1, 2, 3, 4, 5, 1]], 1), vec![(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]); assert_eq!(candidate(vec![vec![1, 2, 3, 4, 5, 6], vec![1, 2, 3, 4, 5, 6], vec![1, 2, 3, 4, 5, 6], vec![1, 2, 3, 4, 5, ...
[ "\n}" ]
HumanEval_88_sort_array
rs
/// Given an array of non-negative integers, return a copy of the given array after sorting, /// you will sort the given array in ascending order if the sum( first index value, last index value) is odd, /// or sort it in descending order if the sum( first index value, last index value) is even. /// Note: /// * don't ch...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_88_sort_array.py
verbatim
} fn main() { let candidate = sort_array; assert_eq!(candidate(Vec::<isize>::new()), Vec::<isize>::new()); assert_eq!(candidate(vec![5]), vec![5]); assert_eq!(candidate(vec![2, 4, 3, 0, 1, 5]), vec![0, 1, 2, 3, 4, 5]); assert_eq!(candidate(vec![2, 4, 3, 0, 1, 5, 6]), vec![6, 5, 4, 3, 2, 1, 0]); ...
[ "\n}" ]
HumanEval_89_encrypt
rs
/// 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: fn encrypt(s: String) -> String {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_89_encrypt.py
verbatim
} fn main() { let candidate = encrypt; assert_eq!(candidate(String::from("hi")), String::from("lm")); assert_eq!(candidate(String::from("asdfghjkl")), String::from("ewhjklnop")); assert_eq!(candidate(String::from("gf")), String::from("kj")); assert_eq!(candidate(String::from("et")), String::from("i...
[ "\n}" ]
HumanEval_8_sum_product
rs
/// 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. fn sum_product(numbers: Vec<isize>) -> (isize, isize) {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_8_sum_product.py
verbatim
} fn main() { let candidate = sum_product; assert_eq!(candidate(Vec::<isize>::new()), (0, 1)); assert_eq!(candidate(vec![1, 1, 1]), (3, 1)); assert_eq!(candidate(vec![100, 0]), (100, 0)); assert_eq!(candidate(vec![3, 5, 7]), (15, 105)); assert_eq!(candidate(vec![10]), (10, 10)); }
[ "\n}" ]
HumanEval_90_next_smallest
rs
/// 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. fn next_smallest(lst: Vec<isize>) -> Option<isize> {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_90_next_smallest.py
verbatim
} fn main() { let candidate = next_smallest; assert_eq!(candidate(vec![1, 2, 3, 4, 5]), Some(2)); assert_eq!(candidate(vec![5, 1, 4, 3, 2]), Some(2)); assert_eq!(candidate(Vec::<isize>::new()), None); assert_eq!(candidate(vec![1, 1]), None); assert_eq!(candidate(vec![1, 1, 1, 1, 0]), Some(1)); ...
[ "\n}" ]
HumanEval_91_is_bored
rs
/// 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: fn is_bored(S: String) -> isize {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_91_is_bored.py
verbatim
} fn main() { let candidate = is_bored; assert_eq!(candidate(String::from("Hello world")), 0); assert_eq!(candidate(String::from("Is the sky blue?")), 0); assert_eq!(candidate(String::from("I love It !")), 1); assert_eq!(candidate(String::from("bIt")), 0); assert_eq!(candidate(String::from("I f...
[ "\n}" ]
HumanEval_92_any_int
rs
/// 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 fn any_int(x: f64, y: f64, z: f64) -> bool {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_92_any_int.py
verbatim
} fn main() { let candidate = any_int; assert_eq!(candidate(2.0, 3.0, 1.0), true); assert_eq!(candidate(2.5, 2.0, 3.0), false); assert_eq!(candidate(1.5, 5.0, 3.5), false); assert_eq!(candidate(2.0, 6.0, 2.0), false); assert_eq!(candidate(4.0, 2.0, 2.0), true); assert_eq!(candidate(2.2, 2.2...
[ "\n}" ]
HumanEval_93_encode
rs
/// 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: fn encode(message: String) -> String {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_93_encode.py
verbatim
} fn main() { let candidate = encode; assert_eq!(candidate(String::from("TEST")), String::from("tgst")); assert_eq!(candidate(String::from("Mudasir")), String::from("mWDCSKR")); assert_eq!(candidate(String::from("YES")), String::from("ygs")); assert_eq!(candidate(String::from("This is a message")),...
[ "\n}" ]
HumanEval_94_skjkasdkd
rs
/// You are given a list of integers. /// You need to find the largest prime value and return the sum of its digits. /// Examples: fn skjkasdkd(lst: Vec<isize>) -> isize {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_94_skjkasdkd.py
verbatim
} fn main() { let candidate = skjkasdkd; assert_eq!(candidate(vec![0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3]), 10); assert_eq!(candidate(vec![1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1]), 25); assert_eq!(candidate(vec![1, 3, 1, 32, 5107, 34, 83278, 109, 163,...
[ "\n}" ]
HumanEval_95_check_dict_case
rs
use std::collections::HashMap; /// 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: fn check_dict_case(dict: HashMap<String, String>) -> bool {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_95_check_dict_case.py
verbatim
} fn main() { let candidate = check_dict_case; assert_eq!(candidate(HashMap::from([(String::from("p"), String::from("pineapple")), (String::from("b"), String::from("banana"))])), true); assert_eq!(candidate(HashMap::from([(String::from("p"), String::from("pineapple")), (String::from("A"), String::from("ban...
[ "\n}" ]
HumanEval_96_count_up_to
rs
/// 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: fn count_up_to(n: isize) -> Vec<isize> {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_96_count_up_to.py
verbatim
} fn main() { let candidate = count_up_to; assert_eq!(candidate(5), vec![2, 3]); assert_eq!(candidate(6), vec![2, 3, 5]); assert_eq!(candidate(7), vec![2, 3, 5]); assert_eq!(candidate(10), vec![2, 3, 5, 7]); assert_eq!(candidate(0), Vec::<isize>::new()); assert_eq!(candidate(22), vec![2, 3,...
[ "\n}" ]
HumanEval_97_multiply
rs
/// Complete the function that takes two integers and returns /// the product of their unit digits. /// Assume the input is always valid. /// Examples: fn multiply(a: isize, b: isize) -> isize {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_97_multiply.py
verbatim
} fn main() { let candidate = multiply; assert_eq!(candidate(148, 412), 16); assert_eq!(candidate(19, 28), 72); assert_eq!(candidate(2020, 1851), 0); assert_eq!(candidate(14, -15), 20); assert_eq!(candidate(76, 67), 42); assert_eq!(candidate(17, 27), 49); assert_eq!(candidate(0, 1), 0);...
[ "\n}" ]
HumanEval_98_count_upper
rs
/// Given a string s, count the number of uppercase vowels in even indices. /// For example: fn count_upper(s: String) -> isize {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_98_count_upper.py
verbatim
} fn main() { let candidate = count_upper; assert_eq!(candidate(String::from("aBCdEf")), 1); assert_eq!(candidate(String::from("abcdefg")), 0); assert_eq!(candidate(String::from("dBBE")), 0); assert_eq!(candidate(String::from("B")), 0); assert_eq!(candidate(String::from("U")), 1); assert_eq...
[ "\n}" ]
HumanEval_99_closest_integer
rs
/// Create a function that takes a value (string) representing a number /// and returns the closest integer to it. If the number is equidistant /// from two integers, round it away from zero. /// Examples /// Note: /// Rounding away from zero means that if the given number is equidistant /// from two integers, the one ...
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_99_closest_integer.py
verbatim
} fn main() { let candidate = closest_integer; assert_eq!(candidate(String::from("10")), 10); assert_eq!(candidate(String::from("14.5")), 15); assert_eq!(candidate(String::from("-15.5")), -16); assert_eq!(candidate(String::from("15.3")), 15); assert_eq!(candidate(String::from("0")), 0); }
[ "\n}" ]
HumanEval_9_rolling_max
rs
/// From a given list of integers, generate a list of rolling maximum element found until given moment /// in the sequence. fn rolling_max(numbers: Vec<isize>) -> Vec<isize> {
remove
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_9_rolling_max.py
verbatim
} fn main() { let candidate = rolling_max; assert_eq!(candidate(Vec::<isize>::new()), Vec::<isize>::new()); assert_eq!(candidate(vec![1, 2, 3, 4]), vec![1, 2, 3, 4]); assert_eq!(candidate(vec![4, 3, 2, 1]), vec![4, 4, 4, 4]); assert_eq!(candidate(vec![3, 2, 3, 100, 3]), vec![3, 3, 3, 100, 100]); }
[ "\n}" ]
HumanEval_0_has_close_elements
rs
/// Check if in given vector of numbers, are any two numbers closer to each other than /// given threshold. /// >>> has_close_elements(vec![1.0, 2.0, 3.0], 0.5) /// false /// >>> has_close_elements(vec![1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3) /// true fn has_close_elements(numbers: Vec<f64>, threshold: f64) -> bool {
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_0_has_close_elements.py
reworded
} fn main() { let candidate = has_close_elements; assert_eq!(candidate(vec![1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.3), true); assert_eq!(candidate(vec![1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.05), false); assert_eq!(candidate(vec![1.0, 2.0, 5.9, 4.0, 5.0], 0.95), true); assert_eq!(candidate(vec![1.0, 2.0, 5.9, ...
[ "\n}" ]
HumanEval_100_make_a_pile
rs
/// Given a positive integer n, you have to make a pile of n levels of stones. /// The first level has n stones. /// The number of stones in the next level is: /// - the next odd number if n is odd. /// - the next even number if n is even. /// Return the number of stones in each level in a vector, where element at inde...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_100_make_a_pile.py
reworded
} fn main() { let candidate = make_a_pile; assert_eq!(candidate(3), vec![3, 5, 7]); assert_eq!(candidate(4), vec![4, 6, 8, 10]); assert_eq!(candidate(5), vec![5, 7, 9, 11, 13]); assert_eq!(candidate(6), vec![6, 8, 10, 12, 14, 16]); assert_eq!(candidate(8), vec![8, 10, 12, 14, 16, 18, 20, 22]); ...
[ "\n}" ]
HumanEval_101_words_string
rs
/// You will be given a string of words separated by commas or spaces. Your task is /// to split the string into words and return a vector of the words. /// For example: /// >>> words_string(String::from("Hi, my name is John")) /// vec![String::from("Hi"), String::from("my"), String::from("name"), String::from("is"), S...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_101_words_string.py
reworded
} fn main() { let candidate = words_string; assert_eq!(candidate(String::from("Hi, my name is John")), vec![String::from("Hi"), String::from("my"), String::from("name"), String::from("is"), String::from("John")]); assert_eq!(candidate(String::from("One, two, three, four, five, six")), vec![String::from("On...
[ "\n}" ]
HumanEval_102_choose_num
rs
/// This function takes two positive numbers x and y and returns the /// biggest even integer number that is in the range [x, y] inclusive. If /// there's no such number, then the function should return -1. /// For example: /// >>> choose_num(12, 15) /// 14 /// >>> choose_num(13, 12) /// -1 fn choose_num(x: isize, y: ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_102_choose_num.py
reworded
} fn main() { let candidate = choose_num; assert_eq!(candidate(12, 15), 14); assert_eq!(candidate(13, 12), -1); assert_eq!(candidate(33, 12354), 12354); assert_eq!(candidate(5234, 5233), -1); assert_eq!(candidate(6, 29), 28); assert_eq!(candidate(27, 10), -1); assert_eq!(candidate(7, 7)...
[ "\n}" ]
HumanEval_104_unique_digits
rs
/// Given a vector of positive integers x. return a sorted vector of all /// elements that hasn't any even digit. /// Note: Returned vector should be sorted in increasing order. /// For example: /// >>> unique_digits(vec![15, 33, 1422, 1]) /// vec![1, 15, 33] /// >>> unique_digits(vec![152, 323, 1422, 10]) /// Vec::<i...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_104_unique_digits.py
reworded
} fn main() { let candidate = unique_digits; assert_eq!(candidate(vec![15, 33, 1422, 1]), vec![1, 15, 33]); assert_eq!(candidate(vec![152, 323, 1422, 10]), Vec::<isize>::new()); assert_eq!(candidate(vec![12345, 2033, 111, 151]), vec![111, 151]); assert_eq!(candidate(vec![135, 103, 31]), vec![31, 13...
[ "\n}" ]
HumanEval_105_by_length
rs
/// Given a vector of integers, sort the integers that are between 1 and 9 inclusive, /// reverse the resulting vector, and then replace each digit by its corresponding name from /// "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine". /// For example: /// >>> by_length(vec![2, 1, 1, 4, 5, 8, 2, 3]) ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_105_by_length.py
reworded
} fn main() { let candidate = by_length; assert_eq!(candidate(vec![2, 1, 1, 4, 5, 8, 2, 3]), vec![String::from("Eight"), String::from("Five"), String::from("Four"), String::from("Three"), String::from("Two"), String::from("Two"), String::from("One"), String::from("One")]); assert_eq!(candidate(Vec::<isize>...
[ "\n}" ]
HumanEval_106_f
rs
/// Implement the function f that takes n as a parameter, /// and returns a vector of size n, such that the value of the element at index i is the factorial of i if i is even /// or the sum of numbers from 1 to i otherwise. /// i starts from 1. /// the factorial of i is the multiplication of the numbers from 1 to i (1 ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_106_f.py
reworded
} fn main() { let candidate = f; assert_eq!(candidate(5), vec![1, 2, 6, 24, 15]); assert_eq!(candidate(7), vec![1, 2, 6, 24, 15, 720, 28]); assert_eq!(candidate(1), vec![1]); assert_eq!(candidate(3), vec![1, 2, 6]); }
[ "\n}" ]
HumanEval_107_even_odd_palindrome
rs
/// 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) /// (1, 2) /// Explanation: /// Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd. /// Example ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_107_even_odd_palindrome.py
reworded
} fn main() { let candidate = even_odd_palindrome; assert_eq!(candidate(123), (8, 13)); assert_eq!(candidate(12), (4, 6)); assert_eq!(candidate(3), (1, 2)); assert_eq!(candidate(63), (6, 8)); assert_eq!(candidate(25), (5, 6)); assert_eq!(candidate(19), (4, 6)); assert_eq!(candidate(9), ...
[ "\n}" ]
HumanEval_108_count_nums
rs
/// Write a function count_nums which takes a vector 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(vec![]) /// 0 /// >>> count_nums(vec![-1, 11,...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_108_count_nums.py
reworded
} fn main() { let candidate = count_nums; assert_eq!(candidate(Vec::<isize>::new()), 0); assert_eq!(candidate(vec![-1, -2, 0]), 0); assert_eq!(candidate(vec![1, 1, 2, -2, 3, 4, 5]), 6); assert_eq!(candidate(vec![1, 6, 9, -6, 0, 1, 5]), 5); assert_eq!(candidate(vec![1, 100, 98, -7, 1, -1]), 4); ...
[ "\n}" ]
HumanEval_109_move_one_ball
rs
/// We have a vector 'arr' of N integers arr[1], arr[2], ..., arr[N].The /// numbers in the vector will be randomly ordered. Your task is to determine if /// it is possible to get a vector sorted in non-decreasing order by performing /// the following operation on the given vector: /// You are allowed to perform right...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_109_move_one_ball.py
reworded
} fn main() { let candidate = move_one_ball; assert_eq!(candidate(vec![3, 4, 5, 1, 2]), true); assert_eq!(candidate(vec![3, 5, 10, 1, 2]), true); assert_eq!(candidate(vec![4, 3, 1, 2]), false); assert_eq!(candidate(vec![3, 5, 4, 1, 2]), false); assert_eq!(candidate(Vec::<isize>::new()), true); ...
[ "\n}" ]
HumanEval_10_make_palindrome
rs
/// Find the shortest palindrome that begins with a supplied string. /// Algorithm idea is simple: /// - Find the longest postfix of supplied string that is a palindrome. /// - Append to the end of the string reverse of a string prefix that comes before the palindromic suffix. /// >>> make_palindrome(String::from("")) ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_10_make_palindrome.py
reworded
} fn main() { let candidate = make_palindrome; assert_eq!(candidate(String::from("")), String::from("")); assert_eq!(candidate(String::from("x")), String::from("x")); assert_eq!(candidate(String::from("xyz")), String::from("xyzyx")); assert_eq!(candidate(String::from("xyx")), String::from("xyx")); ...
[ "\n}" ]
HumanEval_110_exchange
rs
/// In this problem, you will implement a function that takes two vectors of numbers, /// and determines whether it is possible to perform an exchange of elements /// between them to make lst1 a vector of only even numbers. /// There is no limit on the number of exchanged elements between lst1 and lst2. /// If it is po...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_110_exchange.py
reworded
} fn main() { let candidate = exchange; assert_eq!(candidate(vec![1, 2, 3, 4], vec![1, 2, 3, 4]), String::from("YES")); assert_eq!(candidate(vec![1, 2, 3, 4], vec![1, 5, 3, 4]), String::from("NO")); assert_eq!(candidate(vec![1, 2, 3, 4], vec![2, 1, 4, 3]), String::from("YES")); assert_eq!(candidate...
[ "\n}" ]
HumanEval_111_histogram
rs
use std::collections::HashMap; /// Given a string representing a space separated lowercase letters, return a HashMap /// 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(String::from("a b c...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_111_histogram.py
reworded
} fn main() { let candidate = histogram; assert_eq!(candidate(String::from("a b b a")), HashMap::from([(String::from("a"), 2), (String::from("b"), 2)])); assert_eq!(candidate(String::from("a b c a b")), HashMap::from([(String::from("a"), 2), (String::from("b"), 2)])); assert_eq!(candidate(String::from(...
[ "\n}" ]
HumanEval_112_reverse_delete
rs
/// Task /// We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c /// then check if the result string is palindrome. /// A string is called palindrome if it reads the same backward as forward. /// You should return a tuple containing the result string and tr...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_112_reverse_delete.py
reworded
} fn main() { let candidate = reverse_delete; assert_eq!(candidate(String::from("abcde"), String::from("ae")), (String::from("bcd"), false)); assert_eq!(candidate(String::from("abcdef"), String::from("b")), (String::from("acdef"), false)); assert_eq!(candidate(String::from("abcdedcba"), String::from("a...
[ "\n}" ]
HumanEval_113_odd_count
rs
/// Given a vector of strings, where each string consists of only digits, return a vector. /// Each element i of the output should be "the number of odd elements in the /// string i of the input." where all the i's should be replaced by the number /// of odd digits in the i'th string of the input. /// >>> odd_count(vec...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_113_odd_count.py
reworded
} fn main() { let candidate = odd_count; assert_eq!(candidate(vec![String::from("1234567")]), vec![String::from("the number of odd elements 4n the str4ng 4 of the 4nput.")]); assert_eq!(candidate(vec![String::from("3"), String::from("11111111")]), vec![String::from("the number of odd elements 1n the str1ng...
[ "\n}" ]
HumanEval_114_minSubArraySum
rs
/// Given a vector of integers nums, find the minimum sum of any non-empty sub-vector /// of nums. /// Example /// >>> minSubArraySum(vec![2, 3, 4, 1, 2, 4]) /// 1 /// >>> minSubArraySum(vec![-1, -2, -3]) /// -6 fn minSubArraySum(nums: Vec<isize>) -> isize {
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_114_minSubArraySum.py
reworded
} fn main() { let candidate = minSubArraySum; assert_eq!(candidate(vec![2, 3, 4, 1, 2, 4]), 1); assert_eq!(candidate(vec![-1, -2, -3]), -6); assert_eq!(candidate(vec![-1, -2, -3, 2, -10]), -14); assert_eq!(candidate(vec![-9999999999999999]), -9999999999999999); assert_eq!(candidate(vec![0, 10, ...
[ "\n}" ]
HumanEval_115_max_fill
rs
/// You are given a rectangular grid of wells. Each row represents a single well, /// and each 1 in a row represents a single unit of water. /// Each well has a corresponding bucket that can be used to extract water from it, /// and all buckets have the same capacity. /// Your task is to use the buckets to empty the w...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_115_max_fill.py
reworded
} fn main() { let candidate = max_fill; assert_eq!(candidate(vec![vec![0, 0, 1, 0], vec![0, 1, 0, 0], vec![1, 1, 1, 1]], 1), 6); assert_eq!(candidate(vec![vec![0, 0, 1, 1], vec![0, 0, 0, 0], vec![1, 1, 1, 1], vec![0, 1, 1, 1]], 2), 5); assert_eq!(candidate(vec![vec![0, 0, 0], vec![0, 0, 0]], 5), 0); ...
[ "\n}" ]
HumanEval_116_sort_array
rs
/// In this Kata, you have to sort a vector 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(vec![1, 5, 2, 3, 4]) /// vec![1, 2, 3, 4, 5] /// >...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_116_sort_array.py
reworded
} fn main() { let candidate = sort_array; assert_eq!(candidate(vec![1, 5, 2, 3, 4]), vec![1, 2, 4, 3, 5]); assert_eq!(candidate(vec![-2, -3, -4, -5, -6]), vec![-4, -2, -6, -5, -3]); assert_eq!(candidate(vec![1, 0, 2, 3, 4]), vec![0, 1, 2, 4, 3]); assert_eq!(candidate(Vec::<isize>::new()), Vec::<isi...
[ "\n}" ]