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_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
reworded
} 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
reworded
} 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 a vector representing a branch of a tree that has non-negative integer nodes /// your task is to pluck one of the nodes and return it. /// The plucked node should be the node with the smallest even value. /// If multiple nodes with the same smallest even value are found return the node that has smallest inde...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_68_pluck.py
reworded
} 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 vector of positive integers. Return the greatest integer that is greater than /// zero, and has a frequency greater than or equal to the value of the integer itself. /// The frequency of an integer is the number of times it appears in the vector. /// 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
reworded
} 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
reworded
} 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 vector of integers, return vector in strange order. /// Strange sorting, is when you start with the minimum value, /// then maximum of the remaining integers, then minimum and so on. /// Examples: /// >>> strange_sort_list(vec![1, 2, 3, 4]) /// vec![1, 4, 2, 3] /// >>> strange_sort_list(vec![5, 5, 5, 5]) /// ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_70_strange_sort_list.py
reworded
} 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
reworded
} 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 vector) 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 ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_72_will_it_fly.py
reworded
} 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 a vector arr of integers, find the minimum number of elements that /// need to be changed to make the vector palindromic. A palindromic vector is a vector that /// is read the same backwards and forwards. In one change, you can change one element to any other element. /// For example: /// >>> smallest_change(...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_73_smallest_change.py
reworded
} 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 vectors of strings and returns the vector that has /// total number of chars in the all strings of the vector less than the other vector. /// if the two vectors have the same number of chars, return the first vector. /// Examples /// >>> total_match(vec![], vec![]) /// Vec::<Strin...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_74_total_match.py
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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 vector 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::fr...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_7_filter_by_substring.py
reworded
} 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 haprs or not. /// A string is haprs 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
reworded
} 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 vector of GPAs for some students and you have to write /// a function t...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_81_numerical_letter_grade.py
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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 vector 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
reworded
} 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
reworded
} 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 vectors, /// which is similar to matrix, however, unlike matrices, /// each row may contain a different number of columns. /// Given lst, and integer x, find integers x in the vector, /// and return vector of tuples, [(x1, y1), (x2, y2) ...] such that /// each tuple i...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_87_get_row.py
reworded
} 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 a vector of non-negative integers, return a cors of the given vector after sorting, /// you will sort the given vector in ascending order if the sum( first index value, last index value) is odd, /// or sort it in descending order if the sum( first index value, last index value) is even. /// Note: /// * don't ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_88_sort_array.py
reworded
} 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
reworded
} 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 vector of integers, return a tuple consisting of a sum and a product of all the integers in a vector. /// Empty sum should be equal to 0 and empty product should be equal to 1. /// >>> sum_product(vec![]) /// (0, 1) /// >>> sum_product(vec![1, 2, 3, 4]) /// (10, 24) fn sum_product(numbers: Vec<isize>) -...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_8_sum_product.py
reworded
} 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 vector of integers. /// Write a function next_smallest() that returns the 2nd smallest element of the vector. /// Return None if there is no such element. /// >>> next_smallest(vec![1, 2, 3, 4, 5]) /// Some(2) /// >>> next_smallest(vec![5, 1, 4, 3, 2]) /// Some(2) /// >>> next_smallest(vec![]) /// N...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_90_next_smallest.py
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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 vector 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
reworded
} 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 HashMap, 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 HashMap is empty. /// Examples: /// >>> check_dict_case(HashMap::from([(String::from("a"), String::from(...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_95_check_dict_case.py
reworded
} 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 a vector 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
reworded
} 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
reworded
} 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
reworded
} 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
reworded
} 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 vector of integers, generate a vector 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
reworded
} 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. /// >>> has_close_elements(vec![1.0, 2.0, 3.0], 0.5) /// false /// >>> has_close_elements(vec![1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3) /// true fn has_close_elements(numbers: Vec<f64>, threshold: f64) -> bool {
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_0_has_close_elements.py
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 ...
transform
/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: /// >>> words_string(String::from("Hi, my name is John")) /// vec![String::from("Hi"), String::from("my"), String::from("name"), String::from("is"), S...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_101_words_string.py
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: /// >>> choose_num(12, 15) /// 14 /// >>> choose_num(13, 12) /// -1 fn choose_num(x: isize, y: ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_102_choose_num.py
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: /// >>> unique_digits(vec![15, 33, 1422, 1]) /// vec![1, 15, 33] /// >>> unique_digits(vec![152, 323, 1422, 10]) /// Vec::<isize>:...
transform
/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: /// >>> by_length(vec![2, 1, 1, 4, 5, 8, 2, 3]) /...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_105_by_length.py
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 * ...
transform
/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: /// >>> even_odd_palindrome(3) /// (1, 2) /// Explanation: /// Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd. /// Example ...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_107_even_odd_palindrome.py
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. /// >>> count_nums(vec![]) /// 0 /// >>> count_nums(vec![-1, 11,...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_108_count_nums.py
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...
transform
/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. /// >>> make_palindrome(String::from("")) ...
transform
/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...
transform
/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: /// >>> histogram(String::from("a ...
transform
/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...
transform
/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. /// >>> odd_count(vec![St...
transform
/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 /// >>> minSubArraySum(vec![2, 3, 4, 1, 2, 4]) /// 1 /// >>> minSubArraySum(vec![-1, -2, -3]) /// -6 fn minSubArraySum(nums: Vec<isize>) -> isize {
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_114_minSubArraySum.py
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...
transform
/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: /// >>> sort_array(vec![1, 5, 2, 3, 4]) /// vec![1, 2, 3, 4, 5] /// >...
transform
/home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_116_sort_array.py
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...
transform
/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...
transform
/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...
transform
/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. /// >>> string_xor(String::from("010"), String::from("110")) /// String::from("100") fn string_xor(a: String, b: String) -> String {
transform
/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: /// >>> maximum(vec![-3, -4, 5], 3) /// vec![-4, -3, 5] /// Example 2: /// >>> maximum(vec![4, -4, 4], 2) /// vec![4, 4] /// Example 3: /// >>> maximum(vec![-3, 2, 1, 2, -...
transform
/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 /// >>> solution(vec![5, 8, 7, 1]) /// 12 /// >>> solution(vec![3, 3, 3, 3, 3]) /// 9 /// >>> solution(vec![30, 13, 24, 321]) /// 0 fn solution(lst: Vec<isize>) -> isize {
transform
/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: /// >>> add_elements(vec![111, 21, 3, 4000, 5, 6, 7, 8, 9], 4) /// 24 /// Constraints: /// 1. 1 <= len(arr) <= 100 /// 2. 1 <= k <= len(arr) fn add_elem...
transform
/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...
transform
/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...
transform
/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 /// >>> is_sorted(vec![5]) /// true /// >>> is_sorted(vec![1, 2, 3, 4, 5]) /// true /// >>> is_sor...
transform
/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...
transform
/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: /// >>> prod_signs(vec![1, 2, 2, -4]) /// Some(9) /// >>> prod_signs(vec![0...
transform
/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...
transform
/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. /// >>> longest(vec![]) /// None /// >>> longest(vec![String::from("a"), String::from("b"), String::from("c")]) /// Some(String::from("a")) /// >>> lo...
transform
/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...
transform
/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: /// >>> digits(1) /// 1 /// >>> digits(4) /// 0 /// >>> digits(235) /// 15 fn digits(n: isize) -> isize {
transform
/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. /// >>> is_nested(String::from("[[]]")) /// true /// >>> is_nested(String::fro...
transform
/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: /// >>> lst(vec![1.0, 2.0, 3.0]) /// 14 /// >>> lst(vec![1.0, 4.0, 9.0]) /// 98 /// >>> lst(vec![1.0, 3.0, 5.0, 7.0]) /// 84 /// >>>...
transform
/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: /// >>> check_if_last_char_is_a_letter(String::from("apple pie")) /// false /...
transform
/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: /// >>> can_arrange(vec![1, 2, 4, 3, 5]) /// 3 /// >>> ca...
transform
/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: /// >>> largest_smallest_integers(vec![2, 4, 1, 3, 5, 7]) /// (None, Some...
transform
/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 /// >>> is_equal_to_sum_even(4) /// false /// >>> is_equal_to_sum_even(6) /// false /// >>> is_equal_to_sum_even(8) /// true fn is_equal_to_sum_even(n: isize) -> bool {
transform
/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: /// >>> special_factorial(4) /// 288 /// The function will receive an integer as input and should return the special /// factorial of this integer. fn special_factorial(n: isize) -> i...
transform
/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 /// >>> greatest_common_divisor(3, 5) /// 1 /// >>> greatest_common_divisor(25, 15) /// 5 fn greatest_common_divisor(a: isize, b: isize) -> isize {
transform
/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 - /// >>> fix_spaces(String::from(" Example")) /// String::from("Example") /// >>> fix_spaces(String::from(" Example 1")) /// String::from("Example_...
transform
/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...
transform
/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...
transform
/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....
transform
/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...
transform
/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: /// >>> order_by_points(vec![1, 11, -1, -11, -12]) /// ve...
transform
/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: /// >>> specialFilter(vec![15, -73, 14, -15]) /// 1 /// >>> specialFilter(vec![33, -2, -3, ...
transform
/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 : /// >>> get_max_triples(5) ///...
transform
/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...
transform
/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 /// >>> all_prefixes(String::from("abc")) /// vec![String::from("a"), String::from("ab"), String::from("abc")] fn all_prefixes(string: String) -> Vec<String> {
transform
/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: /// >>> x_or_y(7, 34, 12) /// 34 /// >>> x_or_y(15, 8, 5) /// 5 fn x_or_y(n: isize, x: isize, y: isize) -> isize {
transform
/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. /// >>> double_the_difference(vec![1, 3, 2, 0]) /// 10 /// >>> double_the_difference(vec![-1, -2, 0]) /// 0 /// >>> double_the_difference(vec![9, -2]) /// 81 /// >>> doub...
transform
/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...
transform
/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...
transform
/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 /// >>> cycpattern_check(String::from("abcd"), String::from("abd")) /// false /// >>> cycpattern_check(String::from("hello"), String::from("ell")) /// true /// >>> cycpattern_check(String::from...
transform
/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: /// >>> even_odd_count(-12) /// (1, 1) /// >>> even_odd_count(123) /// (1, 2) fn even_odd_count(num: isize) -> (isize, isize) {
transform
/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: /// >>> int_to_mini_roman(19) /// String::from("xix") /// >>> int_to_mini_roman(152) /// String::from("clii") /// >>> int_to_mini_roman(426) /// String::from("c...
transform
/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: /// >>> right_angle_triangle(3, 4, 5) /// true /// >>> right_angle_triangl...
transform
/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. /// >>> find_max(vec![String::from("name"...
transform
/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...
transform
/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}" ]