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_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([], []) ➞ []
/// total_match(['hi', 'admin'], [... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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 {
| keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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(3, 2) => false
///... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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
/// iscube(180) ==>... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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, ... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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([], 'a')
/// []
/// >>> filter_by_substring(['abc', 'bacd', 'cde', 'array'], 'a')
/// ['abc', 'bacd', 'array']
fn filter_by_substring(strings: Vec<String>, substring: String) -> Vec<String> {
| keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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(a) => False
/// is_happy(aa) => False
/// is_happy(abcd) => True
/// is_happy(aabb) => False
/// is_happy(ad... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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('Hello') == True
/// prime_length('abcdcba') == True
/// prime_length('kittens') == True
/// prime_length('orange') == False
fn prime_length(string: String) -> bool {
| keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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 {
| keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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
/// For N = 1000, the sum of digits will be 1 the output should be "1".
/// For N = 150, the sum of digits will be 6 the output should be "110".
/// For N = 147, the sum of digits will be 12 the output should be "1100".
/// Variab... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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([4, 2, 6, 7]) ==> 2
fn add(lst: Vec<isize>) -> isize {
| keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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('hi') returns 'lm'
/// encrypt('asdfghj... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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([])
/// (0, 1)
/// >>> sum_product([1, 2, 3, 4])
/// (10, 24)
fn sum_product(numbers: Vec<isize>) -> (isize, is... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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([1, 2, 3, 4, 5]) == 2
/// next_smallest([5, 1, 4, 3, 2]) == 2
/// next_smallest([]) == None
/// next_smallest([1, 1]) == None
fn ne... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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("Hello world")
/// 0
/// >>> is_bored("The sky is blue. The sun is shining. I love this we... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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_int(3.6, -2.2, 2) ➞ Fals... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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('test')
/// 'TGST'
/// >>> ... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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:
/// For lst = [0,3,2,1,3,5,7,4,5,5,5,2,181,32,4,32,3,2,32,324,4,3] the output should be 10
/// For lst = [1,0,1,8,2,4597,2,1,3,40,1,2,1,2,4,2,5,1] the output should be 25
/// For lst = [1,3... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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({"a":"apple", "b":"banana"}) should return Tru... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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) => [2,3]
/// count_up_to(11) => [2,3,5,7]
/// count_up_to(0) => []
/// count_up_to(20) => [2,3,5,7,11,13,17,19]
/// count_up_to(1) => [... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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) should return 16.
/// multiply(19, 28) should return 72.
/// multiply(2020, 1851) should return 0.
/// multiply(14,-15) should return 20.
fn mul... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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('aBCdEf') returns 1
/// count_upper('abcdefg') returns 0
/// count_upper('dBBE') returns 0
fn count_upper(s: String) -> isize {
| keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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("10")
/// 10
/// >>> closest_integer("15.3")
/// 15
/// Note:
/// Rounding away from zero m... | keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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([1, 2, 3, 2, 3, 4, 2])
/// [1, 2, 3, 3, 3, 4, 4]
fn rolling_max(numbers: Vec<isize>) -> Vec<isize> {
| keep | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals/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 list of numbers, are any two numbers closer to each other than
/// given threshold.
fn has_close_elements(numbers: Vec<f64>, threshold: f64) -> bool {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_0_has_close_elements.py | verbatim | }
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 list, where element at index
... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_100_make_a_pile.py | verbatim | }
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 an array of the words.
/// For example:
fn words_string(s: String) -> Vec<String> {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_101_words_string.py | verbatim | }
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:
fn choose_num(x: isize, y: isize) -> isize {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_102_choose_num.py | verbatim | }
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 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:
fn unique_digits(x: Vec<isize>) -> Vec<isize> {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_104_unique_digits.py | verbatim | }
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 an array of integers, sort the integers that are between 1 and 9 inclusive,
/// reverse the resulting array, and then replace each digit by its corresponding name from
/// "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine".
/// For example:
/// If the array is empty, return an empty array:... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_105_by_length.py | verbatim | }
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 list of size n, such that the value of the element at index i is the factorial of i if i is even
/// or the sum of numbers from 1 to i otherwise.
/// i starts from 1.
/// the factorial of i is the multiplication of the numbers from 1 to i (1 * ... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_106_f.py | verbatim | }
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:
/// Explanation:
/// Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd.
/// Example 2:
/// Explanation:
/// Integer palindrome... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_107_even_odd_palindrome.py | verbatim | }
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 an array of integers and returns
/// the number of elements which has a sum of digits > 0.
/// If a number is negative, then its first signed digit will be negative:
/// e.g. -123 has signed digits -1, 2, and 3.
fn count_nums(arr: Vec<isize>) -> isize {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_108_count_nums.py | verbatim | }
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 an array 'arr' of N integers arr[1], arr[2], ..., arr[N].The
/// numbers in the array will be randomly ordered. Your task is to determine if
/// it is possible to get an array sorted in non-decreasing order by performing
/// the following operation on the given array:
/// You are allowed to perform right s... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_109_move_one_ball.py | verbatim | }
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.
fn make_palindrome(string: String) -> Stri... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_10_make_palindrome.py | verbatim | }
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 lists of numbers,
/// and determines whether it is possible to perform an exchange of elements
/// between them to make lst1 a list of only even numbers.
/// There is no limit on the number of exchanged elements between lst1 and lst2.
/// If it is possib... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_110_exchange.py | verbatim | }
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 dictionary
/// of the letter with the most repetition and containing the corresponding count.
/// If several letters have the same occurrence, return all of them.
/// Example:
fn histogram(test: String) -> Hash... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_111_histogram.py | verbatim | }
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... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_112_reverse_delete.py | verbatim | }
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 list of strings, where each string consists of only digits, return a list.
/// Each element i of the output should be "the number of odd elements in the
/// string i of the input." where all the i's should be replaced by the number
/// of odd digits in the i'th string of the input.
fn odd_count(lst: Vec<Str... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_113_odd_count.py | verbatim | }
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 an array of integers nums, find the minimum sum of any non-empty sub-array
/// of nums.
/// Example
fn minSubArraySum(nums: Vec<isize>) -> isize {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_114_minSubArraySum.py | verbatim | }
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... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_115_max_fill.py | verbatim | }
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 an array of non-negative integers according to
/// number of ones in their binary representation in ascending order.
/// For similar number of ones, sort based on decimal value.
/// It must be implemented like this:
fn sort_array(arr: Vec<isize>) -> Vec<isize> {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_116_sort_array.py | verbatim | }
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}"
] |
HumanEval_117_select_words | rs | /// Given a string s and a natural number n, you have been tasked to implement
/// a function that returns a list of all words from string s that contain exactly
/// n consonants, in order these words appear in the string s.
/// If the string s is empty then the function should return an empty list.
/// Note: you may... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_117_select_words.py | verbatim | }
fn main() {
let candidate = select_words;
assert_eq!(candidate(String::from("Mary had a little lamb"), 4), vec![String::from("little")]);
assert_eq!(candidate(String::from("Mary had a little lamb"), 3), vec![String::from("Mary"), String::from("lamb")]);
assert_eq!(candidate(String::from("simple white... | [
"\n}"
] |
HumanEval_118_get_closest_vowel | rs | /// You are given a word. Your task is to find the closest vowel that stands between
/// two consonants from the right side of the word (case sensitive).
/// Vowels in the beginning and ending doesn't count. Return empty string if you didn't
/// find any vowel met the above condition.
/// You may assume that the give... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_118_get_closest_vowel.py | verbatim | }
fn main() {
let candidate = get_closest_vowel;
assert_eq!(candidate(String::from("yogurt")), String::from("u"));
assert_eq!(candidate(String::from("full")), String::from("u"));
assert_eq!(candidate(String::from("easy")), String::from(""));
assert_eq!(candidate(String::from("eAsy")), String::from(... | [
"\n}"
] |
HumanEval_119_match_parens | rs | /// You are given a list of two strings, both strings consist of open
/// parentheses '(' or close parentheses ')' only.
/// Your job is to check if it is possible to concatenate the two strings in
/// some order, that the resulting string will be good.
/// A string S is considered to be good if and only if all parenth... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_119_match_parens.py | verbatim | }
fn main() {
let candidate = match_parens;
assert_eq!(candidate(vec![String::from("()("), String::from(")")]), String::from("Yes"));
assert_eq!(candidate(vec![String::from(")"), String::from(")")]), String::from("No"));
assert_eq!(candidate(vec![String::from("(()(())"), String::from("())())")]), Strin... | [
"\n}"
] |
HumanEval_11_string_xor | rs | /// Input are two strings a and b consisting only of 1s and 0s.
/// Perform binary XOR on these inputs and return result also as a string.
fn string_xor(a: String, b: String) -> String {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_11_string_xor.py | verbatim | }
fn main() {
let candidate = string_xor;
assert_eq!(candidate(String::from("111000"), String::from("101010")), String::from("010010"));
assert_eq!(candidate(String::from("1"), String::from("1")), String::from("0"));
assert_eq!(candidate(String::from("0101"), String::from("0000")), String::from("0101")... | [
"\n}"
] |
HumanEval_120_maximum | rs | /// Given an array arr of integers and a positive integer k, return a sorted list
/// of length k with the maximum k numbers in arr.
/// Example 1:
/// Example 2:
/// Example 3:
/// Note:
/// 1. The length of the array will be in the range of [1, 1000].
/// 2. The elements in the array will be in the range of [-1000, ... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_120_maximum.py | verbatim | }
fn main() {
let candidate = maximum;
assert_eq!(candidate(vec![-3, -4, 5], 3), vec![-4, -3, 5]);
assert_eq!(candidate(vec![4, -4, 4], 2), vec![4, 4]);
assert_eq!(candidate(vec![-3, 2, 1, 2, -1, -2, 1], 1), vec![2]);
assert_eq!(candidate(vec![123, -123, 20, 0, 1, 2, -3], 3), vec![2, 20, 123]);
... | [
"\n}"
] |
HumanEval_121_solution | rs | /// Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions.
/// Examples
fn solution(lst: Vec<isize>) -> isize {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_121_solution.py | verbatim | }
fn main() {
let candidate = solution;
assert_eq!(candidate(vec![5, 8, 7, 1]), 12);
assert_eq!(candidate(vec![3, 3, 3, 3, 3]), 9);
assert_eq!(candidate(vec![30, 13, 24, 321]), 0);
assert_eq!(candidate(vec![5, 9]), 5);
assert_eq!(candidate(vec![2, 4, 8]), 0);
assert_eq!(candidate(vec![30, 1... | [
"\n}"
] |
HumanEval_122_add_elements | rs | /// Given a non-empty array of integers arr and an integer k, return
/// the sum of the elements with at most two digits from the first k elements of arr.
/// Example:
/// Constraints:
/// 1. 1 <= len(arr) <= 100
/// 2. 1 <= k <= len(arr)
fn add_elements(arr: Vec<isize>, k: isize) -> isize {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_122_add_elements.py | verbatim | }
fn main() {
let candidate = add_elements;
assert_eq!(candidate(vec![1, -2, -3, 41, 57, 76, 87, 88, 99], 3), -4);
assert_eq!(candidate(vec![111, 121, 3, 4000, 5, 6], 2), 0);
assert_eq!(candidate(vec![11, 21, 3, 90, 5, 6, 7, 8, 9], 4), 125);
assert_eq!(candidate(vec![111, 21, 3, 4000, 5, 6, 7, 8, 9... | [
"\n}"
] |
HumanEval_123_get_odd_collatz | rs | /// Given a positive integer n, return a sorted list that has the odd numbers in collatz sequence.
/// The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined
/// as follows: start with any positive integer n. Then each term is obtained from the
/// previous term as follows: if the previ... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_123_get_odd_collatz.py | verbatim | }
fn main() {
let candidate = get_odd_collatz;
assert_eq!(candidate(14), vec![1, 5, 7, 11, 13, 17]);
assert_eq!(candidate(5), vec![1, 5]);
assert_eq!(candidate(12), vec![1, 3, 5]);
assert_eq!(candidate(1), vec![1]);
}
| [
"\n}"
] |
HumanEval_124_valid_date | rs | /// You have to write a function which validates a given date string and
/// returns True if the date is valid otherwise False.
/// The date is valid if all of the following rules are satisfied:
/// 1. The date string is not empty.
/// 2. The number of days is not less than 1 or higher than 31 days for months 1,3,5,7,8... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_124_valid_date.py | verbatim | }
fn main() {
let candidate = valid_date;
assert_eq!(candidate(String::from("03-11-2000")), true);
assert_eq!(candidate(String::from("15-01-2012")), false);
assert_eq!(candidate(String::from("04-0-2040")), false);
assert_eq!(candidate(String::from("06-04-2020")), true);
assert_eq!(candidate(Str... | [
"\n}"
] |
HumanEval_126_is_sorted | rs | /// Given a list of numbers, return whether or not they are sorted
/// in ascending order. If list has more than 1 duplicate of the same
/// number, return False. Assume no negative numbers and only integers.
/// Examples
fn is_sorted(lst: Vec<isize>) -> bool {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_126_is_sorted.py | verbatim | }
fn main() {
let candidate = is_sorted;
assert_eq!(candidate(vec![5]), true);
assert_eq!(candidate(vec![1, 2, 3, 4, 5]), true);
assert_eq!(candidate(vec![1, 3, 2, 4, 5]), false);
assert_eq!(candidate(vec![1, 2, 3, 4, 5, 6]), true);
assert_eq!(candidate(vec![1, 2, 3, 4, 5, 6, 7]), true);
as... | [
"\n}"
] |
HumanEval_127_intersection | rs | /// You are given two intervals,
/// where each interval is a pair of integers. For example, interval = (start, end) = (1, 2).
/// The given intervals are closed which means that the interval (start, end)
/// includes both start and end.
/// For each given interval, it is assumed that its start is less or equal its end... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_127_intersection.py | verbatim | }
fn main() {
let candidate = intersection;
assert_eq!(candidate((1, 2), (2, 3)), String::from("NO"));
assert_eq!(candidate((-1, 1), (0, 4)), String::from("NO"));
assert_eq!(candidate((-3, -1), (-5, 5)), String::from("YES"));
assert_eq!(candidate((-2, 2), (-4, 0)), String::from("YES"));
assert_... | [
"\n}"
] |
HumanEval_128_prod_signs | rs | /// You are given an array arr of integers and you need to return
/// sum of magnitudes of integers multiplied by product of all signs
/// of each number in the array, represented by 1, -1 or 0.
/// Note: return None for empty arr.
/// Example:
fn prod_signs(arr: Vec<isize>) -> Option<isize> {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_128_prod_signs.py | verbatim | }
fn main() {
let candidate = prod_signs;
assert_eq!(candidate(vec![1, 2, 2, -4]), Some(-9));
assert_eq!(candidate(vec![0, 1]), Some(0));
assert_eq!(candidate(vec![1, 1, 1, 2, 3, -1, 1]), Some(-10));
assert_eq!(candidate(Vec::<isize>::new()), None);
assert_eq!(candidate(vec![2, 4, 1, 2, -1, -1,... | [
"\n}"
] |
HumanEval_129_minPath | rs | /// Given a grid with N rows and N columns (N >= 2) and a positive integer k,
/// each cell of the grid contains a value. Every integer in the range [1, N * N]
/// inclusive appears exactly once on the cells of the grid.
/// You have to find the minimum path of length k in the grid. You can start
/// from any cell, an... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_129_minPath.py | verbatim | }
fn main() {
let candidate = minPath;
assert_eq!(candidate(vec![vec![1, 2, 3], vec![4, 5, 6], vec![7, 8, 9]], 3), vec![1, 2, 1]);
assert_eq!(candidate(vec![vec![5, 9, 3], vec![4, 1, 6], vec![7, 8, 2]], 1), vec![1]);
assert_eq!(candidate(vec![vec![1, 2, 3, 4], vec![5, 6, 7, 8], vec![9, 10, 11, 12], vec... | [
"\n}"
] |
HumanEval_12_longest | rs | /// Out of list of strings, return the longest one. Return the first one in case of multiple
/// strings of the same length. Return None in case the input list is empty.
fn longest(strings: Vec<String>) -> Option<String> {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_12_longest.py | verbatim | }
fn main() {
let candidate = longest;
assert_eq!(candidate(Vec::<String>::new()), None);
assert_eq!(candidate(vec![String::from("x"), String::from("y"), String::from("z")]), Some(String::from("x")));
assert_eq!(candidate(vec![String::from("x"), String::from("yyy"), String::from("zzzz"), String::from("... | [
"\n}"
] |
HumanEval_130_tri | rs | /// Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in
/// the last couple centuries. However, what people don't know is Tribonacci sequence.
/// Tribonacci sequence is defined by the recurrence:
/// tri(1) = 3
/// tri(n) = 1 + n / 2, if n is even.
/// tri(n) = tri(n - 1) + tri(n - 2) + tri... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_130_tri.py | verbatim | }
fn main() {
let candidate = tri;
assert_eq!(candidate(3), vec![1, 3, 2, 8]);
assert_eq!(candidate(4), vec![1, 3, 2, 8, 3]);
assert_eq!(candidate(5), vec![1, 3, 2, 8, 3, 15]);
assert_eq!(candidate(6), vec![1, 3, 2, 8, 3, 15, 4]);
assert_eq!(candidate(7), vec![1, 3, 2, 8, 3, 15, 4, 24]);
as... | [
"\n}"
] |
HumanEval_131_digits | rs | /// Given a positive integer n, return the product of the odd digits.
/// Return 0 if all digits are even.
/// For example:
fn digits(n: isize) -> isize {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_131_digits.py | verbatim | }
fn main() {
let candidate = digits;
assert_eq!(candidate(5), 5);
assert_eq!(candidate(54), 5);
assert_eq!(candidate(120), 1);
assert_eq!(candidate(5014), 5);
assert_eq!(candidate(98765), 315);
assert_eq!(candidate(5576543), 2625);
assert_eq!(candidate(2468), 0);
}
| [
"\n}"
] |
HumanEval_132_is_nested | rs | /// Create a function that takes a string as input which contains only square brackets.
/// The function should return True if and only if there is a valid subsequence of brackets
/// where at least one bracket in the subsequence is nested.
fn is_nested(string: String) -> bool {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_132_is_nested.py | verbatim | }
fn main() {
let candidate = is_nested;
assert_eq!(candidate(String::from("[[]]")), true);
assert_eq!(candidate(String::from("[]]]]]]][[[[[]")), false);
assert_eq!(candidate(String::from("[][]")), false);
assert_eq!(candidate(String::from("[]")), false);
assert_eq!(candidate(String::from("[[[[... | [
"\n}"
] |
HumanEval_133_sum_squares | rs | /// You are given a list of numbers.
/// You need to return the sum of squared numbers in the given list,
/// round each element in the list to the upper int(Ceiling) first.
/// Examples:
fn sum_squares(lst: Vec<f64>) -> isize {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_133_sum_squares.py | verbatim | }
fn main() {
let candidate = sum_squares;
assert_eq!(candidate(vec![1.0, 2.0, 3.0]), 14);
assert_eq!(candidate(vec![1.0, 2.0, 3.0]), 14);
assert_eq!(candidate(vec![1.0, 3.0, 5.0, 7.0]), 84);
assert_eq!(candidate(vec![1.4, 4.2, 0.0]), 29);
assert_eq!(candidate(vec![-2.4, 1.0, 1.0]), 6);
ass... | [
"\n}"
] |
HumanEval_134_check_if_last_char_is_a_letter | rs | /// Create a function that returns True if the last character
/// of a given string is an alphabetical character and is not
/// a part of a word, and False otherwise.
/// Note: "word" is a group of characters separated by space.
/// Examples:
fn check_if_last_char_is_a_letter(txt: String) -> bool {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_134_check_if_last_char_is_a_letter.py | verbatim | }
fn main() {
let candidate = check_if_last_char_is_a_letter;
assert_eq!(candidate(String::from("apple")), false);
assert_eq!(candidate(String::from("apple pi e")), true);
assert_eq!(candidate(String::from("eeeee")), false);
assert_eq!(candidate(String::from("A")), true);
assert_eq!(candidate(S... | [
"\n}"
] |
HumanEval_135_can_arrange | rs | /// Create a function which returns the largest index of an element which
/// is not greater than or equal to the element immediately preceding it. If
/// no such element exists then return -1. The given array will not contain
/// duplicate values.
/// Examples:
fn can_arrange(arr: Vec<isize>) -> isize {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_135_can_arrange.py | verbatim | }
fn main() {
let candidate = can_arrange;
assert_eq!(candidate(vec![1, 2, 4, 3, 5]), 3);
assert_eq!(candidate(vec![1, 2, 4, 5]), -1);
assert_eq!(candidate(vec![1, 4, 2, 5, 6, 7, 8, 9, 10]), 2);
assert_eq!(candidate(vec![4, 8, 5, 7, 3]), 4);
assert_eq!(candidate(Vec::<isize>::new()), -1);
}
| [
"\n}"
] |
HumanEval_136_largest_smallest_integers | rs | /// Create a function that returns a tuple (a, b), where 'a' is
/// the largest of negative integers, and 'b' is the smallest
/// of positive integers in a list.
/// If there is no negative or positive integers, return them as None.
/// Examples:
fn largest_smallest_integers(lst: Vec<isize>) -> (Option<isize>, Option<i... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_136_largest_smallest_integers.py | verbatim | }
fn main() {
let candidate = largest_smallest_integers;
assert_eq!(candidate(vec![2, 4, 1, 3, 5, 7]), (None, Some(1)));
assert_eq!(candidate(vec![2, 4, 1, 3, 5, 7, 0]), (None, Some(1)));
assert_eq!(candidate(vec![1, 3, 2, 4, 5, 6, -2]), (Some(-2), Some(1)));
assert_eq!(candidate(vec![4, 5, 3, 6, 2... | [
"\n}"
] |
HumanEval_138_is_equal_to_sum_even | rs | /// Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers
/// Example
fn is_equal_to_sum_even(n: isize) -> bool {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_138_is_equal_to_sum_even.py | verbatim | }
fn main() {
let candidate = is_equal_to_sum_even;
assert_eq!(candidate(4), false);
assert_eq!(candidate(6), false);
assert_eq!(candidate(8), true);
assert_eq!(candidate(10), true);
assert_eq!(candidate(11), false);
assert_eq!(candidate(12), true);
assert_eq!(candidate(13), false);
... | [
"\n}"
] |
HumanEval_139_special_factorial | rs | /// The Brazilian factorial is defined as:
/// brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!
/// where n > 0
/// For example:
/// The function will receive an integer as input and should return the special
/// factorial of this integer.
fn special_factorial(n: isize) -> isize {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_139_special_factorial.py | verbatim | }
fn main() {
let candidate = special_factorial;
assert_eq!(candidate(4), 288);
assert_eq!(candidate(5), 34560);
assert_eq!(candidate(7), 125411328000);
assert_eq!(candidate(1), 1);
}
| [
"\n}"
] |
HumanEval_13_greatest_common_divisor | rs | /// Return a greatest common divisor of two integers a and b
fn greatest_common_divisor(a: isize, b: isize) -> isize {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_13_greatest_common_divisor.py | verbatim | }
fn main() {
let candidate = greatest_common_divisor;
assert_eq!(candidate(3, 7), 1);
assert_eq!(candidate(10, 15), 5);
assert_eq!(candidate(49, 14), 7);
assert_eq!(candidate(144, 60), 12);
}
| [
"\n}"
] |
HumanEval_140_fix_spaces | rs | /// Given a string text, replace all spaces in it with underscores,
/// and if a string has more than 2 consecutive spaces,
/// then replace all consecutive spaces with -
fn fix_spaces(text: String) -> String {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_140_fix_spaces.py | verbatim | }
fn main() {
let candidate = fix_spaces;
assert_eq!(candidate(String::from("Example")), String::from("Example"));
assert_eq!(candidate(String::from("Mudasir Hanif ")), String::from("Mudasir_Hanif_"));
assert_eq!(candidate(String::from("Yellow Yellow Dirty Fellow")), String::from("Yellow_Yellow__Dirt... | [
"\n}"
] |
HumanEval_141_file_name_check | rs | /// Create a function which takes a string representing a file's name, and returns
/// 'Yes' if the the file's name is valid, and returns 'No' otherwise.
/// A file's name is considered to be valid if and only if all the following conditions
/// are met:
/// - There should not be more than three digits ('0'-'9') in th... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_141_file_name_check.py | verbatim | }
fn main() {
let candidate = file_name_check;
assert_eq!(candidate(String::from("example.txt")), String::from("Yes"));
assert_eq!(candidate(String::from("1example.dll")), String::from("No"));
assert_eq!(candidate(String::from("s1sdf3.asd")), String::from("No"));
assert_eq!(candidate(String::from("... | [
"\n}"
] |
HumanEval_142_sum_squares | rs | /// "
/// This function will take a list of integers. For all entries in the list, the function shall square the integer entry if its index is a
/// multiple of 3 and will cube the integer entry if its index is a multiple of 4 and not a multiple of 3. The function will not
/// change the entries in the list whose ind... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_142_sum_squares.py | verbatim | }
fn main() {
let candidate = sum_squares;
assert_eq!(candidate(vec![1, 2, 3]), 6);
assert_eq!(candidate(vec![1, 4, 9]), 14);
assert_eq!(candidate(Vec::<isize>::new()), 0);
assert_eq!(candidate(vec![1, 1, 1, 1, 1, 1, 1, 1, 1]), 9);
assert_eq!(candidate(vec![-1, -1, -1, -1, -1, -1, -1, -1, -1]),... | [
"\n}"
] |
HumanEval_143_words_in_sentence | rs | /// You are given a string representing a sentence,
/// the sentence contains some words separated by a space,
/// and you have to return a string that contains the words from the original sentence,
/// whose lengths are prime numbers,
/// the order of the words in the new string should be the same as the original one.... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_143_words_in_sentence.py | verbatim | }
fn main() {
let candidate = words_in_sentence;
assert_eq!(candidate(String::from("This is a test")), String::from("is"));
assert_eq!(candidate(String::from("lets go for swimming")), String::from("go for"));
assert_eq!(candidate(String::from("there is no place available here")), String::from("there is... | [
"\n}"
] |
HumanEval_144_simplify | rs | /// Your task is to implement a function that will simplify the expression
/// x * n. The function returns True if x * n evaluates to a whole number and False
/// otherwise. Both x and n, are string representation of a fraction, and have the following format,
/// <numerator>/<denominator> where both numerator and denom... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_144_simplify.py | verbatim | }
fn main() {
let candidate = simplify;
assert_eq!(candidate(String::from("1/5"), String::from("5/1")), true);
assert_eq!(candidate(String::from("1/6"), String::from("2/1")), false);
assert_eq!(candidate(String::from("5/1"), String::from("3/1")), true);
assert_eq!(candidate(String::from("7/10"), St... | [
"\n}"
] |
HumanEval_145_order_by_points | rs | /// Write a function which sorts the given list of integers
/// in ascending order according to the sum of their digits.
/// Note: if there are several items with similar sum of their digits,
/// order them based on their index in original list.
/// For example:
fn order_by_points(nums: Vec<isize>) -> Vec<isize> {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_145_order_by_points.py | verbatim | }
fn main() {
let candidate = order_by_points;
assert_eq!(candidate(vec![1, 11, -1, -11, -12]), vec![-1, -11, 1, -12, 11]);
assert_eq!(candidate(vec![1234, 423, 463, 145, 2, 423, 423, 53, 6, 37, 3457, 3, 56, 0, 46]), vec![0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457]);
assert_eq!(can... | [
"\n}"
] |
HumanEval_146_specialFilter | rs | /// Write a function that takes an array of numbers as input and returns
/// the number of elements in the array that are greater than 10 and both
/// first and last digits of a number are odd (1, 3, 5, 7, 9).
/// For example:
fn specialFilter(nums: Vec<isize>) -> isize {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_146_specialFilter.py | verbatim | }
fn main() {
let candidate = specialFilter;
assert_eq!(candidate(vec![5, -2, 1, -5]), 0);
assert_eq!(candidate(vec![15, -73, 14, -15]), 1);
assert_eq!(candidate(vec![33, -2, -3, 45, 21, 109]), 2);
assert_eq!(candidate(vec![43, -12, 93, 125, 121, 109]), 4);
assert_eq!(candidate(vec![71, -2, -33... | [
"\n}"
] |
HumanEval_147_get_max_triples | rs | /// You are given a positive integer n. You have to create an integer array a of length n.
/// For each i (1 ≤ i ≤ n), the value of a[i] = i * i - i + 1.
/// Return the number of triples (a[i], a[j], a[k]) of a where i < j < k,
/// and a[i] + a[j] + a[k] is a multiple of 3.
/// Example :
/// Explanation:
/// a = [1, ... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_147_get_max_triples.py | verbatim | }
fn main() {
let candidate = get_max_triples;
assert_eq!(candidate(5), 1);
assert_eq!(candidate(6), 4);
assert_eq!(candidate(10), 36);
assert_eq!(candidate(100), 53361);
}
| [
"\n}"
] |
HumanEval_149_sorted_list_sum | rs | /// Write a function that accepts a list of strings as a parameter,
/// deletes the strings that have odd lengths from it,
/// and returns the resulted list with a sorted order,
/// The list is always a list of strings and never an array of numbers,
/// and it may contain duplicates.
/// The order of the list should be... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_149_sorted_list_sum.py | verbatim | }
fn main() {
let candidate = sorted_list_sum;
assert_eq!(candidate(vec![String::from("aa"), String::from("a"), String::from("aaa")]), vec![String::from("aa")]);
assert_eq!(candidate(vec![String::from("school"), String::from("AI"), String::from("asdf"), String::from("b")]), vec![String::from("AI"), String:... | [
"\n}"
] |
HumanEval_14_all_prefixes | rs | /// Return list of all prefixes from shortest to longest of the input string
fn all_prefixes(string: String) -> Vec<String> {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_14_all_prefixes.py | verbatim | }
fn main() {
let candidate = all_prefixes;
assert_eq!(candidate(String::from("")), Vec::<String>::new());
assert_eq!(candidate(String::from("asdfgh")), vec![String::from("a"), String::from("as"), String::from("asd"), String::from("asdf"), String::from("asdfg"), String::from("asdfgh")]);
assert_eq!(can... | [
"\n}"
] |
HumanEval_150_x_or_y | rs | /// A simple program which should return the value of x if n is
/// a prime number and should return the value of y otherwise.
/// Examples:
fn x_or_y(n: isize, x: isize, y: isize) -> isize {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_150_x_or_y.py | verbatim | }
fn main() {
let candidate = x_or_y;
assert_eq!(candidate(7, 34, 12), 34);
assert_eq!(candidate(15, 8, 5), 5);
assert_eq!(candidate(3, 33, 5212), 33);
assert_eq!(candidate(1259, 3, 52), 3);
assert_eq!(candidate(7919, -1, 12), -1);
assert_eq!(candidate(3609, 1245, 583), 583);
assert_eq!... | [
"\n}"
] |
HumanEval_151_double_the_difference | rs | /// Given a list of numbers, return the sum of squares of the numbers
/// in the list that are odd. Ignore numbers that are negative or not integers.
/// If the input list is empty, return 0.
fn double_the_difference(lst: Vec<f64>) -> isize {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_151_double_the_difference.py | verbatim | }
fn main() {
let candidate = double_the_difference;
assert_eq!(candidate(Vec::<f64>::new()), 0);
assert_eq!(candidate(vec![5.0, 4.0]), 25);
assert_eq!(candidate(vec![0.1, 0.2, 0.3]), 0);
assert_eq!(candidate(vec![-10.0, -20.0, -30.0]), 0);
assert_eq!(candidate(vec![-1.0, -2.0, 8.0]), 0);
a... | [
"\n}"
] |
HumanEval_152_compare | rs | /// I think we all remember that feeling when the result of some long-awaited
/// event is finally known. The feelings and thoughts you have at that moment are
/// definitely worth noting down and comparing.
/// Your task is to determine if a person correctly guessed the results of a number of matches.
/// You are give... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_152_compare.py | verbatim | }
fn main() {
let candidate = compare;
assert_eq!(candidate(vec![1, 2, 3, 4, 5, 1], vec![1, 2, 3, 4, 2, -2]), vec![0, 0, 0, 0, 3, 3]);
assert_eq!(candidate(vec![0, 0, 0, 0, 0, 0], vec![0, 0, 0, 0, 0, 0]), vec![0, 0, 0, 0, 0, 0]);
assert_eq!(candidate(vec![1, 2, 3], vec![-1, -2, -3]), vec![2, 4, 6]);
... | [
"\n}"
] |
HumanEval_153_Strongest_Extension | rs | /// You will be given the name of a class (a string) and a list of extensions.
/// The extensions are to be used to load additional classes to the class. The
/// strength of the extension is as follows: Let CAP be the number of the uppercase
/// letters in the extension's name, and let SM be the number of lowercase let... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_153_Strongest_Extension.py | verbatim | }
fn main() {
let candidate = Strongest_Extension;
assert_eq!(candidate(String::from("Watashi"), vec![String::from("tEN"), String::from("niNE"), String::from("eIGHt8OKe")]), String::from("Watashi.eIGHt8OKe"));
assert_eq!(candidate(String::from("Boku123"), vec![String::from("nani"), String::from("NazeDa"), ... | [
"\n}"
] |
HumanEval_154_cycpattern_check | rs | /// You are given 2 words. You need to return True if the second word or any of its rotations is a substring in the first word
fn cycpattern_check(a: String, b: String) -> bool {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_154_cycpattern_check.py | verbatim | }
fn main() {
let candidate = cycpattern_check;
assert_eq!(candidate(String::from("xyzw"), String::from("xyw")), false);
assert_eq!(candidate(String::from("yello"), String::from("ell")), true);
assert_eq!(candidate(String::from("whattup"), String::from("ptut")), false);
assert_eq!(candidate(String:... | [
"\n}"
] |
HumanEval_155_even_odd_count | rs | /// Given an integer. return a tuple that has the number of even and odd digits respectively.
/// Example:
fn even_odd_count(num: isize) -> (isize, isize) {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_155_even_odd_count.py | verbatim | }
fn main() {
let candidate = even_odd_count;
assert_eq!(candidate(7), (0, 1));
assert_eq!(candidate(-78), (1, 1));
assert_eq!(candidate(3452), (2, 2));
assert_eq!(candidate(346211), (3, 3));
assert_eq!(candidate(-345821), (3, 3));
assert_eq!(candidate(-2), (1, 0));
assert_eq!(candidate... | [
"\n}"
] |
HumanEval_156_int_to_mini_roman | rs | /// Given a positive integer, obtain its roman numeral equivalent as a string,
/// and return it in lowercase.
/// Restrictions: 1 <= num <= 1000
/// Examples:
fn int_to_mini_roman(number: isize) -> String {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_156_int_to_mini_roman.py | verbatim | }
fn main() {
let candidate = int_to_mini_roman;
assert_eq!(candidate(19), String::from("xix"));
assert_eq!(candidate(152), String::from("clii"));
assert_eq!(candidate(251), String::from("ccli"));
assert_eq!(candidate(426), String::from("cdxxvi"));
assert_eq!(candidate(500), String::from("d"));... | [
"\n}"
] |
HumanEval_157_right_angle_triangle | rs | /// Given the lengths of the three sides of a triangle. Return True if the three
/// sides form a right-angled triangle, False otherwise.
/// A right-angled triangle is a triangle in which one angle is right angle or
/// 90 degree.
/// Example:
fn right_angle_triangle(a: isize, b: isize, c: isize) -> bool {
| remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_157_right_angle_triangle.py | verbatim | }
fn main() {
let candidate = right_angle_triangle;
assert_eq!(candidate(3, 4, 5), true);
assert_eq!(candidate(1, 2, 3), false);
assert_eq!(candidate(10, 6, 8), true);
assert_eq!(candidate(2, 2, 2), false);
assert_eq!(candidate(7, 24, 25), true);
assert_eq!(candidate(10, 5, 7), false);
... | [
"\n}"
] |
HumanEval_158_find_max | rs | /// Write a function that accepts a list of strings.
/// The list contains different words. Return the word with maximum number
/// of unique characters. If multiple strings have maximum number of unique
/// characters, return the one which comes first in lexicographical order.
fn find_max(words: Vec<String>) -> String... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_158_find_max.py | verbatim | }
fn main() {
let candidate = find_max;
assert_eq!(candidate(vec![String::from("name"), String::from("of"), String::from("string")]), String::from("string"));
assert_eq!(candidate(vec![String::from("name"), String::from("enam"), String::from("game")]), String::from("enam"));
assert_eq!(candidate(vec![S... | [
"\n}"
] |
HumanEval_159_eat | rs | /// You're a hungry rabbit, and you already have eaten a certain number of carrots,
/// but now you need to eat more carrots to complete the day's meals.
/// you should return an array of [ total number of eaten carrots after your meals,
/// the number of carrots left after your meals ]
/// if there are not enough rema... | remove | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_159_eat.py | verbatim | }
fn main() {
let candidate = eat;
assert_eq!(candidate(5, 6, 10), vec![11, 4]);
assert_eq!(candidate(4, 8, 9), vec![12, 1]);
assert_eq!(candidate(1, 10, 10), vec![11, 0]);
assert_eq!(candidate(2, 11, 5), vec![7, 0]);
assert_eq!(candidate(4, 5, 7), vec![9, 2]);
assert_eq!(candidate(4, 5, 1)... | [
"\n}"
] |
HumanEval_15_string_sequence | rs | /// Return a string containing space-delimited numbers starting from 0 upto n inclusive.
fn string_sequence(n: isize) -> String {
| remove | /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_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
fn solve(s: String) -> String {
| remove | /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.
fn string_to_md5(text: String) -> Option<String> {
| remove | /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:
fn generate_integers(a: isize, b: isize) -> Vec<isize> {
| remove | /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
fn count_distinct_characters(string: String) -> isize {
| remove | /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
/// '.... | remove | /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.
fn how_many_times(string: String, substring: String) -> isize {
| remove | /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
fn sort_numbers(numbers: String) -> String {
| remove | /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 ... | remove | /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}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.