Prompt:
/// Input to this function is a string representing musical notes in a special ASCII format.
/// Your task is to parse this string and return vector 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
/// '.|' - quater note, lasts one beat
/// >>> parse_music(String::from("o o| .| o| o| .| .| .| .| o o"))
/// vec![4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4]
fn parse_music(music_string: String) -> Vec<isize> {

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")), vec![2, 2, 1, 1, 4, 4, 4, 4]);
    assert_eq!(candidate(String::from("o| .| o| .| o o| o o|")), vec![2, 1, 2, 1, 4, 2, 4, 2]);
}


Prompt:
/// "
/// This function will take a vector of integers. For all entries in the vector, 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 vector whose indexes are not a multiple of 3 or 4. The function shall then return the sum of all entries.
/// Examples:
/// >>> lst
/// vec![1, 2, 3]
/// >>> lst
/// vec![]
/// >>> lst
/// vec![-1, -5, 2, -1, -5]
fn sum_squares(lst: Vec<isize>) -> isize {


Prompt:
/// triples_sum_to_zero takes a vector of integers as an input.
/// it returns true if there are three distinct elements in the vector that
/// sum to zero, and false otherwise.
/// >>> triples_sum_to_zero(vec![1, 3, 5, 0])
/// false
/// >>> triples_sum_to_zero(vec![1, 3, -2, 1])
/// true
/// >>> triples_sum_to_zero(vec![1, 2, 3, 7])
/// false
/// >>> triples_sum_to_zero(vec![2, 4, -5, 3, 9, 7])
/// true
/// >>> triples_sum_to_zero(vec![1])
/// false
fn triples_sum_to_zero(l: Vec<isize>) -> bool {

fn main() {
    let candidate = triples_sum_to_zero;
    assert_eq!(candidate(vec![1, 3, 5, 0]), false);
    assert_eq!(candidate(vec![1, 3, 5, -1]), false);
    assert_eq!(candidate(vec![1, 3, -2, 1]), true);
    assert_eq!(candidate(vec![1, 2, 3, 7]), false);
    assert_eq!(candidate(vec![1, 2, 5, 7]), false);
    assert_eq!(candidate(vec![2, 4, -5, 3, 9, 7]), true);
    assert_eq!(candidate(vec![1]), false);
    assert_eq!(candidate(vec![1, 3, 5, -100]), false);
    assert_eq!(candidate(vec![100, 3, 5, -100]), false);
}


Prompt:
/// brackets is a string of "<" and ">".
/// return true if every opening bracket has a corresponding closing bracket.
/// >>> correct_bracketing(String::from("<"))
/// false
/// >>> correct_bracketing(String::from("<>"))
/// true
/// >>> correct_bracketing(String::from("<<><>>"))
/// true
/// >>> correct_bracketing(String::from("><<>"))
/// false
fn correct_bracketing(brackets: String) -> bool {

fn main() {
    let candidate = correct_bracketing;
    assert_eq!(candidate(String::from("<>")), true);
    assert_eq!(candidate(String::from("<<><>>")), true);
    assert_eq!(candidate(String::from("<><><<><>><>")), true);
    assert_eq!(candidate(String::from("<><><<<><><>><>><<><><<>>>")), true);
    assert_eq!(candidate(String::from("<<<><>>>>")), false);
    assert_eq!(candidate(String::from("><<>")), false);
    assert_eq!(candidate(String::from("<")), false);
    assert_eq!(candidate(String::from("<<<<")), false);
    assert_eq!(candidate(String::from(">")), false);
    assert_eq!(candidate(String::from("<<>")), false);
    assert_eq!(candidate(String::from("<><><<><>><>><<>")), false);
    assert_eq!(candidate(String::from("<><><<><>><>>><>")), false);
}


Prompt:
/// Write a function that takes a vector of numbers as input and returns
/// the number of elements in the vector 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, 45, 21, 109])
/// 2
fn specialFilter(nums: Vec<isize>) -> isize {

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, 75, 21, 19]), 3);
    assert_eq!(candidate(vec![1]), 0);
    assert_eq!(candidate(Vec::<isize>::new()), 0);
}


Prompt:
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("apple")), (String::from("b"), String::from("banana"))]))
/// true
/// >>> check_dict_case(HashMap::from([(String::from("a"), String::from("apple")), (String::from("A"), String::from("banana")), (String::from("B"), String::from("banana"))]))
/// false
/// >>> check_dict_case(HashMap::from([(String::from("a"), String::from("apple")), (8, String::from("banana")), (String::from("a"), String::from("apple"))]))
/// false
/// >>> check_dict_case(HashMap::from([(String::from("Name"), String::from("John")), (String::from("Age"), String::from("36")), (String::from("City"), String::from("Houston"))]))
/// false
/// >>> check_dict_case(HashMap::from([(String::from("STATE"), String::from("NC")), (String::from("ZIP"), String::from("12345"))]))
/// true
fn check_dict_case(dict: HashMap<String, String>) -> bool {

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("banana")), (String::from("B"), String::from("banana"))])), false);
    assert_eq!(candidate(HashMap::from([(String::from("p"), String::from("pineapple")), (String::from("5"), String::from("banana")), (String::from("a"), String::from("apple"))])), false);
    assert_eq!(candidate(HashMap::from([(String::from("Name"), String::from("John")), (String::from("Age"), String::from("36")), (String::from("City"), String::from("Houston"))])), false);
    assert_eq!(candidate(HashMap::from([(String::from("STATE"), String::from("NC")), (String::from("ZIP"), String::from("12345"))])), true);
    assert_eq!(candidate(HashMap::from([(String::from("fruit"), String::from("Orange")), (String::from("taste"), String::from("Sweet"))])), true);
    assert_eq!(candidate(HashMap::from([])), false);
}


Prompt:
/// The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
/// fibfib(0) == 0
/// fibfib(1) == 0
/// fibfib(2) == 1
/// fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3).
/// Please write a function to efficiently compute the n-th element of the fibfib number sequence.
/// >>> fibfib(1)
/// 0
/// >>> fibfib(5)
/// 4
/// >>> fibfib(8)
/// 24
fn fibfib(n: isize) -> isize {

fn main() {
    let candidate = fibfib;
    assert_eq!(candidate(2), 1);
    assert_eq!(candidate(1), 0);
    assert_eq!(candidate(5), 4);
    assert_eq!(candidate(8), 24);
    assert_eq!(candidate(10), 81);
    assert_eq!(candidate(12), 274);
    assert_eq!(candidate(14), 927);
}


Prompt:
/// You are given a vector of numbers.
/// You need to return the sum of squared numbers in the given vector,
/// round each element in the vector 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
/// >>> lst(vec![1.4, 4.2, 0.0])
/// 29
/// >>> lst(vec![-2.4, 1.0, 1.0])
/// 6
fn sum_squares(lst: Vec<f64>) -> isize {


Prompt:
/// 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 {

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);
}


Prompt:
/// Return sorted unique elements in a vector
/// >>> unique(vec![5, 3, 5, 2, 3, 3, 9, 0, 123])
/// vec![0, 2, 3, 5, 9, 123]
fn unique(l: Vec<isize>) -> Vec<isize> {


Prompt:
/// 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_1")
/// >>> fix_spaces(String::from(" Example 2"))
/// String::from("_Example_2")
/// >>> fix_spaces(String::from(" Example 3"))
/// String::from("_Example-3")
fn fix_spaces(text: String) -> String {

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__Dirty__Fellow"));
    assert_eq!(candidate(String::from("Exa   mple")), String::from("Exa-mple"));
    assert_eq!(candidate(String::from("   Exa 1 2 2 mple")), String::from("-Exa_1_2_2_mple"));
}


Prompt:
/// Return 2^n modulo p (be aware of numerics).
/// >>> modp(3, 5)
/// 3
/// >>> modp(1101, 101)
/// 2
/// >>> modp(0, 101)
/// 1
/// >>> modp(3, 11)
/// 8
/// >>> modp(100, 101)
/// 1
fn modp(n: isize, p: isize) -> isize {

fn main() {
    let candidate = modp;
    assert_eq!(candidate(3, 5), 3);
    assert_eq!(candidate(1101, 101), 2);
    assert_eq!(candidate(0, 101), 1);
    assert_eq!(candidate(3, 11), 8);
    assert_eq!(candidate(100, 101), 1);
    assert_eq!(candidate(30, 5), 4);
    assert_eq!(candidate(31, 5), 3);
}


Prompt:
/// 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,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2.
/// 3. The months should not be less than 1 or higher than 12.
/// 4. The date should be in the format: mm-dd-yyyy
/// >>> valid_date(String::from("03-11-2000"))
/// true
/// >>> valid_date(String::from("15-01-2012"))
/// false
/// >>> valid_date(String::from("04-0-2040"))
/// false
/// >>> valid_date(String::from("06-04-2020"))
/// true
/// >>> valid_date(String::from("06/04/2020"))
/// false
fn valid_date(date: String) -> bool {

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(String::from("01-01-2007")), true);
    assert_eq!(candidate(String::from("03-32-2011")), false);
    assert_eq!(candidate(String::from("")), false);
    assert_eq!(candidate(String::from("04-31-3000")), false);
    assert_eq!(candidate(String::from("06-06-2005")), true);
    assert_eq!(candidate(String::from("21-31-2000")), false);
    assert_eq!(candidate(String::from("04-12-2003")), true);
    assert_eq!(candidate(String::from("04122003")), false);
    assert_eq!(candidate(String::from("20030412")), false);
    assert_eq!(candidate(String::from("2003-04")), false);
    assert_eq!(candidate(String::from("2003-04-12")), false);
    assert_eq!(candidate(String::from("04-2003")), false);
}


Prompt:
/// 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 blank spaces in the sentence.
/// For example:
/// >>> anti_shuffle(String::from("Hi"))
/// String::from("Hi")
/// >>> anti_shuffle(String::from("hello"))
/// String::from("ehllo")
/// >>> anti_shuffle(String::from("Hello World!!!"))
/// String::from("Hello !!!Wdlor")
fn anti_shuffle(s: String) -> String {

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::from("abcd"));
    assert_eq!(candidate(String::from("Hello World!!!")), String::from("Hello !!!Wdlor"));
    assert_eq!(candidate(String::from("")), String::from(""));
    assert_eq!(candidate(String::from("Hi. My name is Mister Robot. How are you?")), String::from(".Hi My aemn is Meirst .Rboot How aer ?ouy"));
}


Prompt:
/// Given a vector of numbers, return whether or not they are sorted
/// in ascending order. If vector 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_sorted(vec![1, 3, 2, 4, 5])
/// false
/// >>> is_sorted(vec![1, 2, 3, 4, 5, 6])
/// true
/// >>> is_sorted(vec![1, 2, 3, 4, 5, 6, 7])
/// true
/// >>> is_sorted(vec![1, 3, 2, 4, 5, 6, 7])
/// false
/// >>> is_sorted(vec![1, 2, 2, 3, 3, 4])
/// true
/// >>> is_sorted(vec![1, 2, 2, 2, 3, 4])
/// false
fn is_sorted(lst: Vec<isize>) -> bool {

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);
    assert_eq!(candidate(vec![1, 3, 2, 4, 5, 6, 7]), false);
    assert_eq!(candidate(Vec::<isize>::new()), true);
    assert_eq!(candidate(vec![1]), true);
    assert_eq!(candidate(vec![3, 2, 1]), false);
    assert_eq!(candidate(vec![1, 2, 2, 2, 3, 4]), false);
    assert_eq!(candidate(vec![1, 2, 3, 3, 3, 4]), false);
    assert_eq!(candidate(vec![1, 2, 2, 3, 3, 4]), true);
    assert_eq!(candidate(vec![1, 2, 3, 4]), true);
}


Prompt:
/// 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::from("abcd"))
/// true
/// >>> is_happy(String::from("aabb"))
/// false
/// >>> is_happy(String::from("adb"))
/// true
/// >>> is_happy(String::from("xyy"))
/// false
fn is_happy(s: String) -> bool {

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);
    assert_eq!(candidate(String::from("xyy")), false);
    assert_eq!(candidate(String::from("iopaxpoi")), true);
    assert_eq!(candidate(String::from("iopaxioi")), false);
}


Prompt:
/// 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 the maximum possible weight, but it's unbalanced.
/// >>> will_it_fly(vec![3, 2, 3], 1)
/// false
/// # it's balanced, but 3+2+3 is more than the maximum possible weight.
/// >>> will_it_fly(vec![3, 2, 3], 9)
/// true
/// # 3+2+3 is less than the maximum possible weight, and it's balanced.
/// >>> will_it_fly(vec![3], 5)
/// true
/// # 3 is less than the maximum possible weight, and it's balanced.
fn will_it_fly(q: Vec<isize>, w: isize) -> bool {

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!(candidate(vec![5], 5), true);
}


Prompt:
/// 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 change the given vector.
/// Examples:
/// >>> sort_array(vec![])
/// Vec::<isize>::new()
/// >>> sort_array(vec![5])
/// vec![5]
/// >>> sort_array(vec![2, 4, 3, 0, 1, 5])
/// vec![0, 1, 2, 3, 4, 5]
/// >>> sort_array(vec![2, 4, 3, 0, 1, 5, 6])
/// vec![6, 5, 4, 3, 2, 1, 0]
fn sort_array(array: Vec<isize>) -> Vec<isize> {


Prompt:
/// 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)
/// vec![2, 3, 5, 7, 11, 13, 17, 19]
/// >>> count_up_to(1)
/// Vec::<isize>::new()
/// >>> count_up_to(18)
/// vec![2, 3, 5, 7, 11, 13, 17]
fn count_up_to(n: isize) -> Vec<isize> {


Prompt:
/// Out of vector 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 vector is empty.
/// >>> longest(vec![])
/// None
/// >>> longest(vec![String::from("a"), String::from("b"), String::from("c")])
/// Some(String::from("a"))
/// >>> longest(vec![String::from("a"), String::from("bb"), String::from("ccc")])
/// Some(String::from("ccc"))
fn longest(strings: Vec<String>) -> Option<String> {

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("www"), String::from("kkkk"), String::from("abc")]), Some(String::from("zzzz")));
}


Prompt:
/// Given a vector of integers, sort the integers that are between 1 and 9 inclusive,
/// reverse the resulting vector, and then replace each digit by its corresponding name from
/// "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine".
/// For example:
/// >>> by_length(vec![2, 1, 1, 4, 5, 8, 2, 3])
/// 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")]
/// If the vector is empty, return an empty vector:
/// >>> by_length(vec![])
/// Vec::<String>::new()
/// If the vector has any strange number ignore it:
/// >>> by_length(vec![1, -1, 55])
/// vec![String::from("One")]
fn by_length(arr: Vec<isize>) -> Vec<String> {

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>::new()), Vec::<String>::new());
    assert_eq!(candidate(vec![1, -1, 55]), vec![String::from("One")]);
    assert_eq!(candidate(vec![1, -1, 3, 2]), vec![String::from("Three"), String::from("Two"), String::from("One")]);
    assert_eq!(candidate(vec![9, 4, 8]), vec![String::from("Nine"), String::from("Eight"), String::from("Four")]);
}


Prompt:
/// Implement the function f that takes n as a parameter,
/// and returns a vector of size n, such that the value of the element at index i is the factorial of i if i is even
/// or the sum of numbers from 1 to i otherwise.
/// i starts from 1.
/// the factorial of i is the multiplication of the numbers from 1 to i (1 * 2 * ... * i).
/// Example:
/// >>> f(5)
/// vec![1, 2, 6, 24, 15]
fn f(n: isize) -> Vec<isize> {

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]);
}


Prompt:
/// Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13.
/// >>> fizz_buzz(50)
/// 0
/// >>> fizz_buzz(78)
/// 2
/// >>> fizz_buzz(79)
/// 3
fn fizz_buzz(n: isize) -> isize {

fn main() {
    let candidate = fizz_buzz;
    assert_eq!(candidate(50), 0);
    assert_eq!(candidate(78), 2);
    assert_eq!(candidate(79), 3);
    assert_eq!(candidate(100), 3);
    assert_eq!(candidate(200), 6);
    assert_eq!(candidate(4000), 192);
    assert_eq!(candidate(10000), 639);
    assert_eq!(candidate(100000), 8026);
}


Prompt:
/// Given a positive floating point number, it can be decomposed into
/// and integer part (largest integer smaller than given number) and decimals
/// (leftover part always smaller than 1).
/// Return the decimal part of the number.
/// >>> truncate_number(3.5)
/// 0.5
fn truncate_number(number: f64) -> f64 {

fn main() {
    let candidate = truncate_number;
    assert_eq!(candidate(3.5), 0.5);
    assert_eq!(candidate(1.25), 0.25);
    assert_eq!(candidate(123.0), 0.0);
}


Prompt:
/// 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>) -> (isize, isize) {

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));
}


Prompt:
/// 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 is a coordinate - (row, columns), starting with 0.
/// Sort coordinates initially by rows in ascending order.
/// Also, sort coordinates of the row by columns in descending order.
/// Examples:
/// >>> get_row(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)]
/// >>> get_row(vec![], 1)
/// Vec::<(isize, isize)>::new()
/// >>> get_row(vec![vec![], vec![1], vec![1, 2, 3]], 3)
/// vec![(2, 2)]
fn get_row(lst: Vec<Vec<isize>>, x: isize) -> Vec<(isize, isize)> {


Prompt:
/// 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 a vector of [ total number of eaten carrots after your meals,
/// the number of carrots left after your meals ]
/// if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.
/// Example:
/// >>> eat(5, 6, 10)
/// vec![11, 4]
/// >>> eat(4, 8, 9)
/// vec![12, 1]
/// >>> eat(1, 10, 10)
/// vec![11, 0]
/// >>> eat(2, 11, 5)
/// vec![7, 0]
/// Variables:
/// @number : integer
/// the number of carrots that you have eaten.
/// @need : integer
/// the number of carrots that you need to eat.
/// @remaining : integer
/// the number of remaining carrots thet exist in stock
/// Constrain:
/// * 0 <= number <= 1000
/// * 0 <= need <= 1000
/// * 0 <= remaining <= 1000
/// Have fun :)
fn eat(number: isize, need: isize, remaining: isize) -> Vec<isize> {

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), vec![5, 0]);
}


Prompt:
/// 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 number
fn solve(N: isize) -> String {

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"));
}


Prompt:
/// 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])
/// 25
/// >>> skjkasdkd(vec![1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3])
/// 13
/// >>> skjkasdkd(vec![0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6])
/// 11
/// >>> skjkasdkd(vec![0, 81, 12, 3, 1, 21])
/// 3
/// >>> skjkasdkd(vec![0, 8, 1, 2, 1, 7])
/// 7
fn skjkasdkd(lst: Vec<isize>) -> isize {


Prompt:
/// 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(vec![1, 2, 3, 5, 4, 7, 9, 6])
/// 4
/// >>> smallest_change(vec![1, 2, 3, 4, 3, 2, 2])
/// 1
/// >>> smallest_change(vec![1, 2, 3, 2, 1])
/// 0
fn smallest_change(arr: Vec<isize>) -> isize {

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);
    assert_eq!(candidate(vec![3, 1, 1, 3]), 0);
    assert_eq!(candidate(vec![1]), 0);
    assert_eq!(candidate(vec![0, 1]), 1);
}


Prompt:
/// 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 that can output a vector of letter grades using the following table:
/// GPA       |    Letter grade
/// 4.0                A+
/// > 3.7                A
/// > 3.3                A-
/// > 3.0                B+
/// > 2.7                B
/// > 2.3                B-
/// > 2.0                C+
/// > 1.7                C
/// > 1.3                C-
/// > 1.0                D+
/// > 0.7                D
/// > 0.0                D-
/// 0.0                E
/// Example:
/// >>> grade_equation(vec![4.0, 3, 1.7, 2, 3.5])
/// vec![String::from("A+"), String::from("B"), String::from("C-"), String::from("C"), String::from("A-")]
fn numerical_letter_grade(grades: Vec<f64>) -> Vec<String> {

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]), vec![String::from("D-")]);
    assert_eq!(candidate(vec![0.0]), vec![String::from("E")]);
    assert_eq!(candidate(vec![1.0, 0.3, 1.5, 2.8, 3.3]), vec![String::from("D"), String::from("D-"), String::from("C-"), String::from("B"), String::from("B+")]);
    assert_eq!(candidate(vec![0.0, 0.7]), vec![String::from("E"), String::from("D-")]);
}


Prompt:
/// 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:
/// >>> triangle_area(3, 4, 5)
/// 6.0
/// >>> triangle_area(1, 2, 10)
/// -1.0
fn triangle_area(a: isize, b: isize, c: isize) -> f64 {

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!(candidate(2, 6, 3), -1.0);
    assert_eq!(candidate(1, 1, 1), 0.43);
    assert_eq!(candidate(2, 2, 10), -1.0);
}


Prompt:
/// Check if two words have the same characters.
/// >>> same_chars(String::from("eabcdzzzz"), String::from("dddzzzzzzzddeddabc"))
/// true
/// >>> same_chars(String::from("abcd"), String::from("dddddddabc"))
/// true
/// >>> same_chars(String::from("dddddddabc"), String::from("abcd"))
/// true
/// >>> same_chars(String::from("eabcd"), String::from("dddddddabc"))
/// false
/// >>> same_chars(String::from("abcd"), String::from("dddddddabce"))
/// false
/// >>> same_chars(String::from("eabcdzzzz"), String::from("dddzzzzzzzddddabc"))
/// false
fn same_chars(s0: String, s1: String) -> bool {

fn main() {
    let candidate = same_chars;
    assert_eq!(candidate(String::from("eabcdzzzz"), String::from("dddzzzzzzzddeddabc")), true);
    assert_eq!(candidate(String::from("abcd"), String::from("dddddddabc")), true);
    assert_eq!(candidate(String::from("dddddddabc"), String::from("abcd")), true);
    assert_eq!(candidate(String::from("eabcd"), String::from("dddddddabc")), false);
    assert_eq!(candidate(String::from("abcd"), String::from("dddddddabcf")), false);
    assert_eq!(candidate(String::from("eabcdzzzz"), String::from("dddzzzzzzzddddabc")), false);
    assert_eq!(candidate(String::from("aabb"), String::from("aaccc")), false);
}


Prompt:
/// Given a vector of integers nums, find the minimum sum of any non-empty sub-vector
/// of nums.
/// Example
/// >>> minSubArraySum(vec![2, 3, 4, 1, 2, 4])
/// 1
/// >>> minSubArraySum(vec![-1, -2, -3])
/// -6
fn minSubArraySum(nums: Vec<isize>) -> isize {


Prompt:
/// Given a string s and a natural number n, you have been tasked to implement
/// a function that returns a vector 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 vector.
/// Note: you may assume the input string contains only letters and spaces.
/// Examples:
/// >>> select_words(String::from("Mary had a little lamb"), 4)
/// vec![String::from("little")]
/// >>> select_words(String::from("Mary had a little lamb"), 3)
/// vec![String::from("Mary"), String::from("lamb")]
/// >>> select_words(String::from("simple white space"), 2)
/// Vec::<String>::new()
/// >>> select_words(String::from("Hello world"), 4)
/// vec![String::from("world")]
/// >>> select_words(String::from("Uncle sam"), 3)
/// vec![String::from("Uncle")]
fn select_words(s: String, n: isize) -> Vec<String> {

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 space"), 2), Vec::<String>::new());
    assert_eq!(candidate(String::from("Hello world"), 4), vec![String::from("world")]);
    assert_eq!(candidate(String::from("Uncle sam"), 3), vec![String::from("Uncle")]);
    assert_eq!(candidate(String::from(""), 4), Vec::<String>::new());
    assert_eq!(candidate(String::from("a b c d e f"), 1), vec![String::from("b"), String::from("c"), String::from("d"), String::from("f")]);
}


Prompt:
/// Return vector 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> {

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!(candidate(String::from("WWW")), vec![String::from("W"), String::from("WW"), String::from("WWW")]);
}


Prompt:
/// 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:
/// Rounding away from zero means that if the given number is equidistant
/// from two integers, the one you should return is the one that is the
/// farthest from zero. For example closest_integer("14.5") should
/// return 15 and closest_integer("-14.5") should return -15.
fn closest_integer(value: String) -> isize {

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);
}


Prompt:
/// 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 the file's name.
/// - The file's name contains exactly one dot '.'
/// - The substring before the dot should not be empty, and it starts with a letter from
/// the latin alphapet ('a'-'z' and 'A'-'Z').
/// - The substring after the dot should be one of these: ['txt', 'exe', 'dll']
/// Examples:
/// >>> file_name_check(String::from("example.txt"))
/// String::from("Yes")
/// >>> file_name_check(String::from("1example.dll"))
/// String::from("No")
fn file_name_check(file_name: String) -> String {

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("K.dll")), String::from("Yes"));
    assert_eq!(candidate(String::from("MY16FILE3.exe")), String::from("Yes"));
    assert_eq!(candidate(String::from("His12FILE94.exe")), String::from("No"));
    assert_eq!(candidate(String::from("_Y.txt")), String::from("No"));
    assert_eq!(candidate(String::from("?aREYA.exe")), String::from("No"));
    assert_eq!(candidate(String::from("/this_is_valid.dll")), String::from("No"));
    assert_eq!(candidate(String::from("this_is_valid.wow")), String::from("No"));
    assert_eq!(candidate(String::from("this_is_valid.txt")), String::from("Yes"));
    assert_eq!(candidate(String::from("this_is_valid.txtexe")), String::from("No"));
    assert_eq!(candidate(String::from("#this2_i4s_5valid.ten")), String::from("No"));
    assert_eq!(candidate(String::from("@this1_is6_valid.exe")), String::from("No"));
    assert_eq!(candidate(String::from("this_is_12valid.6exe4.txt")), String::from("No"));
    assert_eq!(candidate(String::from("all.exe.txt")), String::from("No"));
    assert_eq!(candidate(String::from("I563_No.exe")), String::from("Yes"));
    assert_eq!(candidate(String::from("Is3youfault.txt")), String::from("Yes"));
    assert_eq!(candidate(String::from("no_one#knows.dll")), String::from("Yes"));
    assert_eq!(candidate(String::from("1I563_Yes3.exe")), String::from("No"));
    assert_eq!(candidate(String::from("I563_Yes3.txtt")), String::from("No"));
    assert_eq!(candidate(String::from("final..txt")), String::from("No"));
    assert_eq!(candidate(String::from("final132")), String::from("No"));
    assert_eq!(candidate(String::from("_f4indsartal132.")), String::from("No"));
    assert_eq!(candidate(String::from(".txt")), String::from("No"));
    assert_eq!(candidate(String::from("s.")), String::from("No"));
}


Prompt:
/// 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.
/// Your task is to determine whether the length of intersection of these two
/// intervals is a prime number.
/// Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)
/// which its length is 1, which not a prime number.
/// If the length of the intersection is a prime number, return "YES",
/// otherwise, return "NO".
/// If the two intervals don't intersect, return "NO".
/// [input/output] samples:
/// >>> intersection((1, 2), (2, 3))
/// String::from("NO")
/// >>> intersection((-1, 1), (0, 4))
/// String::from("NO")
/// >>> intersection((-3, -1), (-5, 5))
/// String::from("YES")
fn intersection(interval1: (isize, isize), interval2: (isize, isize)) -> String {

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_eq!(candidate((-11, 2), (-1, -1)), String::from("NO"));
    assert_eq!(candidate((1, 2), (3, 5)), String::from("NO"));
    assert_eq!(candidate((1, 2), (1, 2)), String::from("NO"));
    assert_eq!(candidate((-2, -2), (-3, -2)), String::from("NO"));
}


Prompt:
/// Return the largest prime factor of n. Assume n > 1 and is not a prime.
/// >>> largest_prime_factor(13195)
/// 29
/// >>> largest_prime_factor(2048)
/// 2
fn largest_prime_factor(n: isize) -> isize {

fn main() {
    let candidate = largest_prime_factor;
    assert_eq!(candidate(15), 5);
    assert_eq!(candidate(27), 3);
    assert_eq!(candidate(63), 7);
    assert_eq!(candidate(330), 11);
    assert_eq!(candidate(13195), 29);
}


Prompt:
/// Given a string, find out how many distinct characters (regardless of case) does it consist of
/// >>> count_distinct_characters(String::from("xyzXYZ"))
/// 3
/// >>> count_distinct_characters(String::from("Jerry"))
/// 4
fn count_distinct_characters(string: String) -> isize {

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::from("Jerry jERRY JeRRRY")), 5);
}


Prompt:
/// You're given a vector of deposit and withdrawal operations on a bank account that starts with
/// zero balance. Your task is to detect if at any point the balance of account fallls below zero, and
/// at that point function should return true. Otherwise it should return false.
/// >>> below_zero(vec![1, 2, 3])
/// false
/// >>> below_zero(vec![1, 2, -4, 5])
/// true
fn below_zero(operations: Vec<isize>) -> bool {

fn main() {
    let candidate = below_zero;
    assert_eq!(candidate(Vec::<isize>::new()), false);
    assert_eq!(candidate(vec![1, 2, -3, 1, 2, -3]), false);
    assert_eq!(candidate(vec![1, 2, -4, 5, 6]), true);
    assert_eq!(candidate(vec![1, -1, 2, -2, 5, -5, 4, -4]), false);
    assert_eq!(candidate(vec![1, -1, 2, -2, 5, -5, 4, -5]), true);
    assert_eq!(candidate(vec![1, -2, 2, -2, 5, -5, 4, -4]), true);
}


Prompt:
/// 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(""))
/// String::from("")
/// >>> make_palindrome(String::from("cat"))
/// String::from("catac")
/// >>> make_palindrome(String::from("cata"))
/// String::from("catac")
fn make_palindrome(string: String) -> String {

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"));
    assert_eq!(candidate(String::from("jerry")), String::from("jerryrrej"));
}


Prompt:
/// 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("cdxxvi")
fn int_to_mini_roman(number: isize) -> String {

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"));
    assert_eq!(candidate(1), String::from("i"));
    assert_eq!(candidate(4), String::from("iv"));
    assert_eq!(candidate(43), String::from("xliii"));
    assert_eq!(candidate(90), String::from("xc"));
    assert_eq!(candidate(94), String::from("xciv"));
    assert_eq!(candidate(532), String::from("dxxxii"));
    assert_eq!(candidate(900), String::from("cm"));
    assert_eq!(candidate(994), String::from("cmxciv"));
    assert_eq!(candidate(1000), String::from("m"));
}