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_15_string_sequence | rs | /// Return a string containing space-delimited numbers starting from 0 upto n inclusive.
/// >>> string_sequence(0)
/// String::from("0")
/// >>> string_sequence(5)
/// String::from("0 1 2 3 4 5")
fn string_sequence(n: isize) -> String {
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_15_string_sequence.py | verbatim | }
fn main() {
let candidate = string_sequence;
assert_eq!(candidate(0), String::from("0"));
assert_eq!(candidate(3), String::from("0 1 2 3"));
assert_eq!(candidate(10), String::from("0 1 2 3 4 5 6 7 8 9 10"));
}
| [
"\n}"
] |
HumanEval_160_do_algebra | rs | /// Given two lists operator, and operand. The first list has basic algebra operations, and
/// the second list is a list of integers. Use the two given lists to build the algebric
/// expression and return the evaluation of this expression.
/// The basic algebra operations:
/// Addition ( + )
/// Subtraction ( - ) ... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_160_do_algebra.py | verbatim | }
fn main() {
let candidate = do_algebra;
assert_eq!(candidate(vec![String::from("**"), String::from("*"), String::from("+")], vec![2, 3, 4, 5]), 37);
assert_eq!(candidate(vec![String::from("+"), String::from("*"), String::from("-")], vec![2, 3, 4, 5]), 9);
assert_eq!(candidate(vec![String::from("//"),... | [
"\n}"
] |
HumanEval_161_solve | rs | /// You are given a string s.
/// if s[i] is a letter, reverse its case from lower to upper or vise versa,
/// otherwise keep it as it is.
/// If the string contains no letters, reverse the string.
/// The function should return the resulted string.
/// Examples
/// >>> solve(String::from("1234"))
/// String::from("43... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_161_solve.py | verbatim | }
fn main() {
let candidate = solve;
assert_eq!(candidate(String::from("AsDf")), String::from("aSdF"));
assert_eq!(candidate(String::from("1234")), String::from("4321"));
assert_eq!(candidate(String::from("ab")), String::from("AB"));
assert_eq!(candidate(String::from("#a@C")), String::from("#A@c"))... | [
"\n}"
] |
HumanEval_162_string_to_md5 | rs | /// Given a string 'text', return its md5 hash equivalent string.
/// If 'text' is an empty string, return None.
/// >>> string_to_md5(String::from("Hello world"))
/// Some(String::from("3e25960a79dbc69b674cd4ec67a72c62"))
fn string_to_md5(text: String) -> Option<String> {
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_162_string_to_md5.py | verbatim | }
fn main() {
let candidate = string_to_md5;
assert_eq!(candidate(String::from("Hello world")), Some(String::from("3e25960a79dbc69b674cd4ec67a72c62")));
assert_eq!(candidate(String::from("")), None);
assert_eq!(candidate(String::from("A B C")), Some(String::from("0ef78513b0cb8cef12743f5aeb35f888")));
... | [
"\n}"
] |
HumanEval_163_generate_integers | rs | /// Given two positive integers a and b, return the even digits between a
/// and b, in ascending order.
/// For example:
/// >>> generate_integers(2, 8)
/// vec![2, 4, 6, 8]
/// >>> generate_integers(8, 2)
/// vec![2, 4, 6, 8]
/// >>> generate_integers(10, 14)
/// Vec::<isize>::new()
fn generate_integers(a: isize, b: ... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_163_generate_integers.py | verbatim | }
fn main() {
let candidate = generate_integers;
assert_eq!(candidate(2, 10), vec![2, 4, 6, 8]);
assert_eq!(candidate(10, 2), vec![2, 4, 6, 8]);
assert_eq!(candidate(132, 2), vec![2, 4, 6, 8]);
assert_eq!(candidate(17, 89), Vec::<isize>::new());
}
| [
"\n}"
] |
HumanEval_16_count_distinct_characters | rs | /// Given a string, find out how many distinct characters (regardless of case) does it consist of
/// >>> count_distinct_characters(String::from("xyzXYZ"))
/// 3
/// >>> count_distinct_characters(String::from("Jerry"))
/// 4
fn count_distinct_characters(string: String) -> isize {
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_16_count_distinct_characters.py | verbatim | }
fn main() {
let candidate = count_distinct_characters;
assert_eq!(candidate(String::from("")), 0);
assert_eq!(candidate(String::from("abcde")), 5);
assert_eq!(candidate(String::from("abcdecadeCADE")), 5);
assert_eq!(candidate(String::from("aaaaAAAAaaaa")), 1);
assert_eq!(candidate(String::fro... | [
"\n}"
] |
HumanEval_17_parse_music | rs | /// Input to this function is a string representing musical notes in a special ASCII format.
/// Your task is to parse this string and return list of integers corresponding to how many beats does each
/// not last.
/// Here is a legend:
/// 'o' - whole note, lasts four beats
/// 'o|' - half note, lasts two beats
/// '.... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_17_parse_music.py | verbatim | }
fn main() {
let candidate = parse_music;
assert_eq!(candidate(String::from("")), Vec::<isize>::new());
assert_eq!(candidate(String::from("o o o o")), vec![4, 4, 4, 4]);
assert_eq!(candidate(String::from(".| .| .| .|")), vec![1, 1, 1, 1]);
assert_eq!(candidate(String::from("o| o| .| .| o o o o")),... | [
"\n}"
] |
HumanEval_18_how_many_times | rs | /// Find how many times a given substring can be found in the original string. Count overlaping cases.
/// >>> how_many_times(String::from(""), String::from("a"))
/// 0
/// >>> how_many_times(String::from("aaa"), String::from("a"))
/// 3
/// >>> how_many_times(String::from("aaaa"), String::from("aa"))
/// 3
fn how_many... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_18_how_many_times.py | verbatim | }
fn main() {
let candidate = how_many_times;
assert_eq!(candidate(String::from(""), String::from("x")), 0);
assert_eq!(candidate(String::from("xyxyxyx"), String::from("x")), 4);
assert_eq!(candidate(String::from("cacacacac"), String::from("cac")), 4);
assert_eq!(candidate(String::from("john doe"),... | [
"\n}"
] |
HumanEval_19_sort_numbers | rs | /// Input is a space-delimited string of numberals from 'zero' to 'nine'.
/// Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
/// Return the string with numbers sorted from smallest to largest
/// >>> sort_numbers(String::from("three one five"))
/// String::from("one... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_19_sort_numbers.py | verbatim | }
fn main() {
let candidate = sort_numbers;
assert_eq!(candidate(String::from("")), String::from(""));
assert_eq!(candidate(String::from("three")), String::from("three"));
assert_eq!(candidate(String::from("three five nine")), String::from("three five nine"));
assert_eq!(candidate(String::from("fiv... | [
"\n}"
] |
HumanEval_1_separate_paren_groups | rs | /// Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
/// separate those group into separate strings and return the list of those.
/// Separate groups are balanced (each open brace is properly closed) and not nested within each other
/// Ignore any spaces in the input ... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_1_separate_paren_groups.py | verbatim | }
fn main() {
let candidate = separate_paren_groups;
assert_eq!(candidate(String::from("(()()) ((())) () ((())()())")), vec![String::from("(()())"), String::from("((()))"), String::from("()"), String::from("((())()())")]);
assert_eq!(candidate(String::from("() (()) ((())) (((())))")), vec![String::from("()... | [
"\n}"
] |
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).
/// >>> find_closest_elements(vec![1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
/// (2.0, 2.2)
/// >>> find_closest_elements(vec![1.0, 2.0, 3.0, 4.0, 5.0,... | transform | /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
/// >>> rescale_to_unit(vec![1.0, 2.0, 3.0, 4.0, 5.0])
/// vec![0.0, 0.25, 0.5, 0.75, 1.0]
fn rescale_to_unit(numbers: Vec<f64>) -> Vec<f64> {
| transform | /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
/// >>> strlen(String::from(""))
/// 0
/// >>> strlen(String::from("abc"))
/// 3
fn strlen(string: String) -> isize {
| transform | /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
/// >>> largest_divisor(15)
/// 5
fn largest_divisor(n: isize) -> isize {
| transform | /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
/// >>> factorize(8)
/// vec![2, 2, 2]
/// >>> fa... | transform | /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.
/// >>> remove_duplicates(vec![1, 2, 3, 2, 4])
/// vec![1, 3, 4]
fn remove_duplicates(numbers: Vec<isize>) -> Vec<isize> {
| transform | /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.
/// >>> flip_case(String::from("Hello"))
/// String::from("hELLO")
fn flip_case(string: String) -> String {
| transform | /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
/// >>> concatenate(vec![])
/// String::from("")
/// >>> concatenate(vec![String::from("a"), String::from("b"), String::from("c")])
/// String::from("abc")
fn concatenate(strings: Vec<String>) -> String {
| transform | /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.
/// >>> filter_by_prefix(vec![], String::from("a"))
/// Vec::<String>::new()
/// >>> filter_by_prefix(vec![String::from("abc"), String::from("bcd"), String::from("cde"), String::from("array")], String::from("a"))
/// vec![String::from("ab... | transform | /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.
/// >>> truncate_number(3.5)
/// 0.5
fn truncate_number(number: f64) -> f64 {
| transform | /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.
/// >>> get_positive(vec![-1, 2, -4, 5, 6])
/// vec![2, 5, 6]
/// >>> get_positive(vec![5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])
/// vec![5, 3, 2, 3, 9, 123, 1]
fn get_positive(l: Vec<isize>) -> Vec<isize> {
| transform | /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.
/// >>> is_prime(6)
/// false
/// >>> is_prime(101)
/// true
/// >>> is_prime(11)
/// true
/// >>> is_prime(13441)
/// true
/// >>> is_prime(61)
/// true
/// >>> is_prime(4)
/// false
/// >>> is_prime(1)
/// false
fn is_prime(n: isize) -> bool {
| transform | /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.
/// >>> sort_third(vec![1, 2, 3])
/// vec![1... | transform | /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
/// >>> unique(vec![5, 3, 5, 2, 3, 3, 9, 0, 123])
/// vec![0, 2, 3, 5, 9, 123]
fn unique(l: Vec<isize>) -> Vec<isize> {
| transform | /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.
/// >>> max_element(vec![1, 2, 3])
/// 3
/// >>> max_element(vec![5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])
/// 123
fn max_element(l: Vec<isize>) -> isize {
| transform | /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.
/// >>> fizz_buzz(50)
/// 0
/// >>> fizz_buzz(78)
/// 2
/// >>> fizz_buzz(79)
/// 3
fn fizz_buzz(n: isize) -> isize {
| transform | /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.
/// >>> sort_even(vec![1, 2, 3])
/// vec![1, 2, 3]
/// >>> sort_even(vec![5, 6, 3, 4])
/// vec![3, 6, 5,... | transform | /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.
/// >>> prime_fib(1)
/// 2
/// >>> prime_fib(2)
/// 3
/// >>> prime_fib(3)
/// 5
/// >>> prime_fib(4)
/// 13
/// >>> prime_fib(5)
/// 89
fn prime_fib(n: isize) -> isize {
| transform | /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.
/// >>> below_zero(vec![1, 2, 3])
/// fa... | transform | /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.
/// >>> triples_sum_to_zero(vec![1, 3, 5, 0])
/// false
/// >>> triples_sum_to_zero(vec![1, 3, -2, 1])
/// true
/// >>> triples_sum_to_zero(vec![1... | transform | /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_41_car_race_collision | rs | /// Imagine a road that's a perfectly straight infinitely long line.
/// n cars are driving left to right; simultaneously, a different set of n cars
/// are driving right to left. The two sets of cars start out being very far from
/// each other. All cars move in the same speed. Two cars are said to collide
/// wh... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_41_car_race_collision.py | verbatim | }
fn main() {
let candidate = car_race_collision;
assert_eq!(candidate(2), 4);
assert_eq!(candidate(3), 9);
assert_eq!(candidate(4), 16);
assert_eq!(candidate(8), 64);
assert_eq!(candidate(10), 100);
}
| [
"\n}"
] |
HumanEval_42_incr_list | rs | /// Return list with elements incremented by 1.
/// >>> incr_list(vec![1, 2, 3])
/// vec![2, 3, 4]
/// >>> incr_list(vec![5, 3, 5, 2, 3, 3, 9, 0, 123])
/// vec![6, 4, 6, 3, 4, 4, 10, 1, 124]
fn incr_list(l: Vec<isize>) -> Vec<isize> {
| transform | /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.
/// >>> pairs_sum_to_zero(vec![1, 3, 5, 0])
/// false
/// >>> pairs_sum_to_zero(vec![1, 3, -2, 1])
/// false
/// >>> pairs_sum_to_zero(vec![1, 2, 3, 7... | transform | /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.
/// >>> change_base(8, 3)
/// String::from("22")
/// >>> change_base(8, 2)
/// String::from("1000")
/// >>> change_base(7, 2)
/// String::from("111")
fn change_base(x: isize, ba... | transform | /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.
/// >>> triangle_area(5, 3)
/// 7.5
fn triangle_area(a: isize, h: isize) -> f64 {
| transform | /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... | transform | /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.
/// >>> median(vec![3, 1, 2, 4, 5])
/// 3.0
/// >>> median(vec![-10, 4, 6, 1000, 10, 20])
/// 15.0
fn median(l: Vec<isize>) -> f64 {
| transform | /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
/// >>> is_palindrome(String::from(""))
/// true
/// >>> is_palindrome(String::from("aba"))
/// true
/// >>> is_palindrome(String::from("aaaaa"))
/// true
/// >>> is_palindrome(String::from("zbcd"))
/// false
fn is_palindrome(text: String) -> bool {
| transform | /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).
/// >>> modp(3, 5)
/// 3
/// >>> modp(1101, 101)
/// 2
/// >>> modp(0, 101)
/// 1
/// >>> modp(3, 11)
/// 8
/// >>> modp(100, 101)
/// 1
fn modp(n: isize, p: isize) -> isize {
| transform | /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 |
/// >>> mean_absolute_deviation(vec![1.0, 2.0, 3.0... | transform | /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.
/// >>> remove_vowels(String::from(""))
/// String::from("")
/// >>> remove_vowels(String::from("abcdef"))
/// String::from("bcdf")
/// >>> remove_vowels(String::from("aaaaa"))
/// String::from("")
/// >>> remove_vowels(String::from("a... | transform | /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.
/// >>> below_threshold(vec![1, 2, 4, 10], 100)
/// true
/// >>> below_threshold(vec![1, 20, 4, 10], 5)
/// false
fn below_threshold(l: Vec<isize>, t: isize) -> bool {
| transform | /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
/// >>> add(2, 3)
/// 5
/// >>> add(5, 7)
/// 12
fn add(x: isize, y: isize) -> isize {
| transform | /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.
/// >>> same_chars(String::from("eabcdzzzz"), String::from("dddzzzzzzzddeddabc"))
/// true
/// >>> same_chars(String::from("abcd"), String::from("dddddddabc"))
/// true
/// >>> same_chars(String::from("dddddddabc"), String::from("abcd"))
/// true
/// >>> same_chars(Strin... | transform | /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.
/// >>> fib(10)
/// 55
/// >>> fib(1)
/// 1
/// >>> fib(8)
/// 21
fn fib(n: isize) -> isize {
| transform | /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.
/// >>> correct_bracketing(String::from("<"))
/// false
/// >>> correct_bracketing(String::from("<>"))
/// true
/// >>> correct_bracketing(String::from("<<><>>"))
/// true
/// >>> correct_bracketing(St... | transform | /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.
/// >>> monotonic(vec![1, 2, 4, 20])
/// true
/// >>> monotonic(vec![1, 20, 4, 10])
/// false
/// >>> monotonic(vec![4, 1, 0, -10])
/// true
fn monotonic(l: Vec<isize>) -> bool {
| transform | /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.
/// >>> common(vec![1, 4, 3, 34, 653, 2, 5], vec![5, 7, 1, 5, 9, 653, 121])
/// vec![1, 5, 653]
/// >>> common(vec![5, 3, 2, 8], vec![3, 2])
/// vec![2, 3]
fn common(l1: Vec<isize>, l2: Vec<isize>) -> Vec<isize> {
| transform | /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.
/// >>> largest_prime_factor(13195)
/// 29
/// >>> largest_prime_factor(2048)
/// 2
fn largest_prime_factor(n: isize) -> isize {
| transform | /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'
/// >>> intersperse(vec![], 4)
/// Vec::<isize>::new()
/// >>> intersperse(vec![1, 2, 3], 4)
/// vec![1, 4, 2, 4, 3]
fn intersperse(numbers: Vec<isize>, delimeter: isize) -> Vec<isize> {
| transform | /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.
/// >>> 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
fn sum_to_n(n: isize) -> isize {
| transform | /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.
/// >>> correct_bracketing(String::from("("))
/// false
/// >>> correct_bracketing(String::from("()"))
/// true
/// >>> correct_bracketing(String::from("(()())"))
/// true
/// >>> correct_bracketing(St... | transform | /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.
/// >>> derivative(vec![3, 1, 2, 4, 5])
/// vec![1, 4, 12, 20]
/// >>> derivative(vec![1, 2, 3])
/// vec![2, 6]
fn derivative(xs: Vec<isize>) -> Vec<isize> {
| transform | /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.... | transform | /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:
/// >>> vowels_count(String::from("ab... | transform | /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.
/// >>> circular_shift(12, 1)
/// String::from("21")
/// >>> circular_shift(12, 2)
/// String::from("12")
fn circular_shift(x: isize, shift: isi... | transform | /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:
/// >>> digitSum(String::from(""))
/// 0
/// >>> digitSum(String::from("abAB"))
/// 131
/// >>> digitSum(String::from("abcCd"))
/// 67
/// >>> digitSum(String::from("helloE"))
/// ... | transform | /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... | transform | /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... | transform | /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.
/// ... | transform | /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.
/// >>> parse_nested_parens(String::from("(()()) ((())) ... | transform | /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:
/// >>> strange_sort_list(vec![1, 2, 3, 4])
/// vec![1, 4, 2, 3]
/// >>> strange_sort_list(vec![5, 5, 5, 5])
/// vec!... | transform | /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:
/// >>> triangl... | transform | /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:
/// >>> will_it_fly(vec![1, 2], 5)
/// false
/// # 1+2 is less than th... | transform | /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:
/// >>> smallest_change(ve... | transform | /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
/// >>> total_match(vec![], vec![])
/// Vec::<String>::new()
//... | transform | /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:
/// >>> is_multiply_prime(30)
/// true
/// 30 = 2 * 3 * 5
fn is_multiply_prime(a: isize) -> bool {
| transform | /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:
/// >>> is_simple_power(1, 4)
/// true
/// >>> is_simple_power(2, 2)
/// true
/// >>> is_simple_power(8, 2)
/// true
/// >>> is_simple_power... | transform | /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:
/// >>> iscube(1)
/// true
/// >>> iscube(2)
/// false
/// >>> iscube(-1)
/// true
/// >>> iscube(64)
/// true
/// >>> iscube(0)
/// true... | transform | /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, ... | transform | /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... | transform | /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
/// >>> filter_by_substring(vec![], String::from("a"))
/// Vec::<String>::new()
/// >>> filter_by_substring(vec![String::from("abc"), String::from("bacd"), String::from("cde"), String::from("array")], String::from("a"))
/// vec![String::from... | transform | /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:
/// >>> is_happy(String::from("a"))
/// false
/// >>> is_happy(String::from("aa"))
/// false
/// >>> is_happy(String::fro... | transform | /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... | transform | /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
/// >>> prime_length(String::from("Hello"))
/// true
/// >>> prime_length(String::from("abcdcba"))
/// true
/// >>> prime_length(String::from("kittens"))
/// true
/// >>> prime_length(Str... | transform | /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_83_starts_one_ends | rs | /// Given a positive integer n, return the count of the numbers of n-digit
/// positive integers that start or end with 1.
fn starts_one_ends(n: isize) -> isize {
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_83_starts_one_ends.py | verbatim | }
fn main() {
let candidate = starts_one_ends;
assert_eq!(candidate(1), 1);
assert_eq!(candidate(2), 18);
assert_eq!(candidate(3), 180);
assert_eq!(candidate(4), 1800);
assert_eq!(candidate(5), 18000);
}
| [
"\n}"
] |
HumanEval_84_solve | rs | /// Given a positive integer N, return the total sum of its digits in binary.
/// Example
/// >>> solve(1000)
/// String::from("1")
/// >>> solve(150)
/// String::from("110")
/// >>> solve(147)
/// String::from("1100")
/// Variables:
/// @N integer
/// Constraints: 0 ≤ N ≤ 10000.
/// Output:
/// a string of binary numb... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_84_solve.py | 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:
/// >>> add(vec![4, 2, 6, 7])
/// 2
fn add(lst: Vec<isize>) -> isize {
| transform | /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... | transform | /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... | transform | /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... | transform | /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:
/// >>> encrypt(String::from("hi"))
/// String::fro... | transform | /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.
/// >>> sum_product(vec![])
/// (0, 1)
/// >>> sum_product(vec![1, 2, 3, 4])
/// (10, 24)
fn sum_product(numbers: Vec<isize>) -> (i... | transform | /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.
/// >>> next_smallest(vec![1, 2, 3, 4, 5])
/// Some(2)
/// >>> next_smallest(vec![5, 1, 4, 3, 2])
/// Some(2)
/// >>> next_smallest(vec![])
/// None
... | transform | /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:
/// >>> is_bored(String::from("Hello world"))
/// 0
/// >>> is_bored(String::from("The sky is blue. The sun... | transform | /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
/// >>> any_int(5, 2, 7)
/// true
/// >>> any_int(3, 2, 2)
/// false
/// >>> any_int(3, -2, 1)
/// true
/// >>> any_in... | transform | /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:
/// >>> encode(String::from("test"))
/// S... | transform | /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:
/// >>> skjkasdkd(vec![0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3])
/// 10
/// >>> skjkasdkd(vec![1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1])
///... | transform | /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:
/// >>> check_dict_case(HashMap::from([(String::from("a"), String:... | transform | /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:
/// >>> count_up_to(5)
/// vec![2, 3]
/// >>> count_up_to(11)
/// vec![2, 3, 5, 7]
/// >>> count_up_to(0)
/// Vec::<isize>::new()
/// >>> count_up_to(20)
... | transform | /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:
/// >>> multiply(148, 412)
/// 16
/// >>> multiply(19, 28)
/// 72
/// >>> multiply(2020, 1851)
/// 0
/// >>> multiply(14, -15)
/// 20
fn multiply(a: isize, b: isize) -... | transform | /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:
/// >>> count_upper(String::from("aBCdEf"))
/// 1
/// >>> count_upper(String::from("abcdefg"))
/// 0
/// >>> count_upper(String::from("dBBE"))
/// 0
fn count_upper(s: String) -> isize {
| transform | /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
/// >>> closest_integer(String::from("10"))
/// 10
/// >>> closest_integer(String::from("15.3"))
/// 15
/// Note:
/... | transform | /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.
/// >>> rolling_max(vec![1, 2, 3, 2, 3, 4, 2])
/// vec![1, 2, 3, 3, 3, 4, 4]
fn rolling_max(numbers: Vec<isize>) -> Vec<isize> {
| transform | /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 | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Check if in given list of numbers, are any two numbers closer to each other than
// given threshold.
// >>> has_close_elements([1.0, 2.0, 3.0], 0.5)
// False
// >>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3)
/... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_0_has_close_elements.py | verbatim | }
def main(args: Array[String]) = {
assert(hasCloseElements((List[Float](1.0f.toFloat, 2.0f.toFloat, 3.9f.toFloat, 4.0f.toFloat, 5.0f.toFloat, 2.2f.toFloat)), (0.3f)) == (true));
assert(hasCloseElements((List[Float](1.0f.toFloat, 2.0f.toFloat, 3.9f.toFloat, 4.0f.toFloat, 5.0f.toFloat, 2.2f.toFloat)), (0... | [
"\n }\n"
] |
HumanEval_100_make_a_pile | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// 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 ... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_100_make_a_pile.py | verbatim | }
def main(args: Array[String]) = {
assert(makeAPile((3l)).equals((List[Long](3l.toLong, 5l.toLong, 7l.toLong))));
assert(makeAPile((4l)).equals((List[Long](4l.toLong, 6l.toLong, 8l.toLong, 10l.toLong))));
assert(makeAPile((5l)).equals((List[Long](5l.toLong, 7l.toLong, 9l.toLong, 11l.toLong, 13l.toL... | [
"\n }\n"
] |
HumanEval_101_words_string | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// You will be given a string of words separated by commas or spaces. Your task is
// to split the string into words and return an array of the words.
// For example:
// words_string("Hi, my name is John") == ["Hi", "my", "name", "is... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_101_words_string.py | verbatim | }
def main(args: Array[String]) = {
assert(wordsString(("Hi, my name is John")).equals((List[String]("Hi", "my", "name", "is", "John"))));
assert(wordsString(("One, two, three, four, five, six")).equals((List[String]("One", "two", "three", "four", "five", "six"))));
assert(wordsString(("Hi, my name"... | [
"\n }\n"
] |
HumanEval_102_choose_num | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// 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:
// choos... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_102_choose_num.py | verbatim | }
def main(args: Array[String]) = {
assert(chooseNum((12l), (15l)) == (14l));
assert(chooseNum((13l), (12l)) == (-1l));
assert(chooseNum((33l), (12354l)) == (12354l));
assert(chooseNum((5234l), (5233l)) == (-1l));
assert(chooseNum((6l), (29l)) == (28l));
assert(chooseNum((27l), (10l)) ==... | [
"\n }\n"
] |
HumanEval_103_rounded_avg | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// You are given two positive integers n and m, and your task is to compute the
// average of the integers from n through m (including n and m).
// Round the answer to the nearest integer and convert that to binary.
// If n is great... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_103_rounded_avg.py | verbatim | }
def main(args: Array[String]) = {
assert(roundedAvg((1l), (5l)).equals("0b11"));
assert(roundedAvg((7l), (13l)).equals("0b1010"));
assert(roundedAvg((964l), (977l)).equals("0b1111001010"));
assert(roundedAvg((996l), (997l)).equals("0b1111100100"));
assert(roundedAvg((560l), (851l)).equals(... | [
"\n }\n"
] |
HumanEval_104_unique_digits | scala | import scala.math._
import scala.collection.mutable._
object Problem {
// Given a list of positive integers x. return a sorted list of all
// elements that hasn't any even digit.
// Note: Returned list should be sorted in increasing order.
// For example:
// >>> unique_digits([15, 33, 1422, 1])
... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/HumanEval_104_unique_digits.py | verbatim | }
def main(args: Array[String]) = {
assert(uniqueDigits((List[Long](15l.toLong, 33l.toLong, 1422l.toLong, 1l.toLong))).equals((List[Long](1l.toLong, 15l.toLong, 33l.toLong))));
assert(uniqueDigits((List[Long](152l.toLong, 323l.toLong, 1422l.toLong, 10l.toLong))).equals((List[Long]())));
assert(uniqu... | [
"\n }\n"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.